Merge tag 'amlogic-defconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/khilma...
[platform/kernel/linux-rpi.git] / arch / arm / mach-ep93xx / simone.c
1 /*
2  * arch/arm/mach-ep93xx/simone.c
3  * Simplemachines Sim.One support.
4  *
5  * Copyright (C) 2010 Ryan Mallon
6  *
7  * Based on the 2.6.24.7 support:
8  *   Copyright (C) 2009 Simplemachines
9  *   MMC support by Peter Ivanov <ivanovp@gmail.com>, 2007
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or (at
14  * your option) any later version.
15  *
16  */
17
18 #include <linux/kernel.h>
19 #include <linux/init.h>
20 #include <linux/platform_device.h>
21 #include <linux/i2c.h>
22 #include <linux/i2c-gpio.h>
23 #include <linux/mmc/host.h>
24 #include <linux/spi/spi.h>
25 #include <linux/spi/mmc_spi.h>
26 #include <linux/platform_data/video-ep93xx.h>
27 #include <linux/platform_data/spi-ep93xx.h>
28 #include <linux/gpio.h>
29
30 #include <mach/hardware.h>
31 #include <mach/gpio-ep93xx.h>
32
33 #include <asm/mach-types.h>
34 #include <asm/mach/arch.h>
35
36 #include "soc.h"
37
38 static struct ep93xx_eth_data __initdata simone_eth_data = {
39         .phy_id         = 1,
40 };
41
42 static struct ep93xxfb_mach_info __initdata simone_fb_info = {
43         .flags          = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING,
44 };
45
46 static struct mmc_spi_platform_data simone_mmc_spi_data = {
47         .detect_delay   = 500,
48         .ocr_mask       = MMC_VDD_32_33 | MMC_VDD_33_34,
49         .flags          = MMC_SPI_USE_CD_GPIO,
50         .cd_gpio        = EP93XX_GPIO_LINE_EGPIO0,
51         .cd_debounce    = 1,
52 };
53
54 static struct spi_board_info simone_spi_devices[] __initdata = {
55         {
56                 .modalias               = "mmc_spi",
57                 .platform_data          = &simone_mmc_spi_data,
58                 /*
59                  * We use 10 MHz even though the maximum is 3.7 MHz. The driver
60                  * will limit it automatically to max. frequency.
61                  */
62                 .max_speed_hz           = 10 * 1000 * 1000,
63                 .bus_num                = 0,
64                 .chip_select            = 0,
65                 .mode                   = SPI_MODE_3,
66         },
67 };
68
69 /*
70  * Up to v1.3, the Sim.One used SFRMOUT as SD card chip select, but this goes
71  * low between multi-message command blocks. From v1.4, it uses a GPIO instead.
72  * v1.3 parts will still work, since the signal on SFRMOUT is automatic.
73  */
74 static int simone_spi_chipselects[] __initdata = {
75         EP93XX_GPIO_LINE_EGPIO1,
76 };
77
78 static struct ep93xx_spi_info simone_spi_info __initdata = {
79         .chipselect     = simone_spi_chipselects,
80         .num_chipselect = ARRAY_SIZE(simone_spi_chipselects),
81         .use_dma = 1,
82 };
83
84 static struct i2c_gpio_platform_data __initdata simone_i2c_gpio_data = {
85         .sda_pin                = EP93XX_GPIO_LINE_EEDAT,
86         .sda_is_open_drain      = 0,
87         .scl_pin                = EP93XX_GPIO_LINE_EECLK,
88         .scl_is_open_drain      = 0,
89         .udelay                 = 0,
90         .timeout                = 0,
91 };
92
93 static struct i2c_board_info __initdata simone_i2c_board_info[] = {
94         {
95                 I2C_BOARD_INFO("ds1337", 0x68),
96         },
97 };
98
99 static struct platform_device simone_audio_device = {
100         .name           = "simone-audio",
101         .id             = -1,
102 };
103
104 static void __init simone_register_audio(void)
105 {
106         ep93xx_register_ac97();
107         platform_device_register(&simone_audio_device);
108 }
109
110 static void __init simone_init_machine(void)
111 {
112         ep93xx_init_devices();
113         ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_8M);
114         ep93xx_register_eth(&simone_eth_data, 1);
115         ep93xx_register_fb(&simone_fb_info);
116         ep93xx_register_i2c(&simone_i2c_gpio_data, simone_i2c_board_info,
117                             ARRAY_SIZE(simone_i2c_board_info));
118         ep93xx_register_spi(&simone_spi_info, simone_spi_devices,
119                             ARRAY_SIZE(simone_spi_devices));
120         simone_register_audio();
121 }
122
123 MACHINE_START(SIM_ONE, "Simplemachines Sim.One Board")
124         /* Maintainer: Ryan Mallon */
125         .atag_offset    = 0x100,
126         .map_io         = ep93xx_map_io,
127         .init_irq       = ep93xx_init_irq,
128         .init_time      = ep93xx_timer_init,
129         .init_machine   = simone_init_machine,
130         .init_late      = ep93xx_init_late,
131         .restart        = ep93xx_restart,
132 MACHINE_END