linux-omap 2.6.37: replace various patch with upstream versions and rediff
[openembedded.git] / recipes / linux / linux-omap-2.6.37 / base / 0005-ARM-OMAP-beagleboard-Add-infrastructure-to-do-fixups.patch
blob21d8d8fe37af31c122515bf6d9d5e0f51223a92c
1 From a564ca287c115928a9e7febf7c99bbab582290e6 Mon Sep 17 00:00:00 2001
2 From: Koen Kooi <koen@dominion.thruhere.net>
3 Date: Wed, 6 Oct 2010 10:19:34 +0200
4 Subject: [PATCH 05/28] ARM: OMAP: beagleboard: Add infrastructure to do fixups based on expansionboard name passed by u-boot
6 Add support for Tincantools Zippy and Zippy2 expansionboards as well
8 Signed-off-by: Koen Kooi <koen@beagleboard.org>
9 ---
10 arch/arm/mach-omap2/board-omap3beagle.c | 142 ++++++++++++++++++++++++++++++-
11 1 files changed, 139 insertions(+), 3 deletions(-)
13 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
14 index f9fb64b..d777b3b 100644
15 --- a/arch/arm/mach-omap2/board-omap3beagle.c
16 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
17 @@ -21,6 +21,7 @@
18 #include <linux/io.h>
19 #include <linux/leds.h>
20 #include <linux/gpio.h>
21 +#include <linux/irq.h>
22 #include <linux/input.h>
23 #include <linux/gpio_keys.h>
25 @@ -143,6 +144,92 @@ fail0:
26 return;
29 +char expansionboard_name[16];
31 +#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
33 +#include <plat/mcspi.h>
34 +#include <linux/spi/spi.h>
36 +#define OMAP3BEAGLE_GPIO_ENC28J60_IRQ 157
38 +static struct omap2_mcspi_device_config enc28j60_spi_chip_info = {
39 + .turbo_mode = 0,
40 + .single_channel = 1, /* 0: slave, 1: master */
41 +};
43 +static struct spi_board_info omap3beagle_zippy_spi_board_info[] __initdata = {
44 + {
45 + .modalias = "enc28j60",
46 + .bus_num = 4,
47 + .chip_select = 0,
48 + .max_speed_hz = 20000000,
49 + .controller_data = &enc28j60_spi_chip_info,
50 + },
51 +};
53 +static void __init omap3beagle_enc28j60_init(void)
55 + if ((gpio_request(OMAP3BEAGLE_GPIO_ENC28J60_IRQ, "ENC28J60_IRQ") == 0) &&
56 + (gpio_direction_input(OMAP3BEAGLE_GPIO_ENC28J60_IRQ) == 0)) {
57 + gpio_export(OMAP3BEAGLE_GPIO_ENC28J60_IRQ, 0);
58 + omap3beagle_zippy_spi_board_info[0].irq = OMAP_GPIO_IRQ(OMAP3BEAGLE_GPIO_ENC28J60_IRQ);
59 + set_irq_type(omap3beagle_zippy_spi_board_info[0].irq, IRQ_TYPE_EDGE_FALLING);
60 + } else {
61 + printk(KERN_ERR "could not obtain gpio for ENC28J60_IRQ\n");
62 + return;
63 + }
65 + spi_register_board_info(omap3beagle_zippy_spi_board_info,
66 + ARRAY_SIZE(omap3beagle_zippy_spi_board_info));
69 +#else
70 +static inline void __init omap3beagle_enc28j60_init(void) { return; }
71 +#endif
73 +#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
75 +#include <plat/mcspi.h>
76 +#include <linux/spi/spi.h>
78 +#define OMAP3BEAGLE_GPIO_KS8851_IRQ 157
80 +static struct omap2_mcspi_device_config ks8851_spi_chip_info = {
81 + .turbo_mode = 0,
82 + .single_channel = 1, /* 0: slave, 1: master */
83 +};
85 +static struct spi_board_info omap3beagle_zippy2_spi_board_info[] __initdata = {
86 + {
87 + .modalias = "ks8851",
88 + .bus_num = 4,
89 + .chip_select = 0,
90 + .max_speed_hz = 36000000,
91 + .controller_data = &ks8851_spi_chip_info,
92 + },
93 +};
95 +static void __init omap3beagle_ks8851_init(void)
97 + if ((gpio_request(OMAP3BEAGLE_GPIO_KS8851_IRQ, "KS8851_IRQ") == 0) &&
98 + (gpio_direction_input(OMAP3BEAGLE_GPIO_KS8851_IRQ) == 0)) {
99 + gpio_export(OMAP3BEAGLE_GPIO_KS8851_IRQ, 0);
100 + omap3beagle_zippy2_spi_board_info[0].irq = OMAP_GPIO_IRQ(OMAP3BEAGLE_GPIO_KS8851_IRQ);
101 + set_irq_type(omap3beagle_zippy2_spi_board_info[0].irq, IRQ_TYPE_EDGE_FALLING);
102 + } else {
103 + printk(KERN_ERR "could not obtain gpio for KS8851_IRQ\n");
104 + return;
107 + spi_register_board_info(omap3beagle_zippy2_spi_board_info,
108 + ARRAY_SIZE(omap3beagle_zippy2_spi_board_info));
111 +#else
112 +static inline void __init omap3beagle_ks8851_init(void) { return; }
113 +#endif
115 static struct mtd_partition omap3beagle_nand_partitions[] = {
116 /* All the partition sizes are listed in terms of NAND block size */
118 @@ -262,6 +349,12 @@ static struct omap2_hsmmc_info mmc[] = {
119 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
120 .gpio_wp = 29,
123 + .mmc = 2,
124 + .caps = MMC_CAP_4_BIT_DATA,
125 + .transceiver = true,
126 + .ocr_mask = 0x00100000, /* 3.3V */
127 + },
128 {} /* Terminator */
131 @@ -457,7 +550,7 @@ static struct twl4030_platform_data beagle_twldata = {
132 .vpll2 = &beagle_vpll2,
135 -static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
136 +static struct i2c_board_info __initdata beagle_i2c1_boardinfo[] = {
138 I2C_BOARD_INFO("twl4030", 0x48),
139 .flags = I2C_CLIENT_WAKE,
140 @@ -472,10 +565,24 @@ static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
144 +#if defined(CONFIG_RTC_DRV_DS1307) || \
145 + defined(CONFIG_RTC_DRV_DS1307_MODULE)
147 +static struct i2c_board_info __initdata beagle_i2c2_boardinfo[] = {
149 + I2C_BOARD_INFO("ds1307", 0x68),
150 + },
152 +#else
153 +static struct i2c_board_info __initdata beagle_i2c2_boardinfo[] = {};
154 +#endif
156 static int __init omap3_beagle_i2c_init(void)
158 - omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo,
159 - ARRAY_SIZE(beagle_i2c_boardinfo));
160 + omap_register_i2c_bus(1, 2600, beagle_i2c1_boardinfo,
161 + ARRAY_SIZE(beagle_i2c1_boardinfo));
162 + omap_register_i2c_bus(2, 400, beagle_i2c2_boardinfo,
163 + ARRAY_SIZE(beagle_i2c2_boardinfo));
164 /* Bus 3 is attached to the DVI port where devices like the pico DLP
165 * projector don't work reliably with 400kHz */
166 omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom));
167 @@ -609,6 +716,15 @@ static struct omap_musb_board_data musb_board_data = {
168 .power = 100,
171 +static int __init expansionboard_setup(char *str)
173 + if (!str)
174 + return -EINVAL;
175 + strncpy(expansionboard_name, str, 16);
176 + printk(KERN_INFO "Beagle expansionboard: %s\n", expansionboard_name);
177 + return 0;
180 static void __init omap3_beagle_init(void)
182 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
183 @@ -623,6 +739,24 @@ static void __init omap3_beagle_init(void)
184 /* REVISIT leave DVI powered down until it's needed ... */
185 gpio_direction_output(170, true);
187 + if(!strcmp(expansionboard_name, "zippy"))
189 + printk(KERN_INFO "Beagle expansionboard: initializing enc28j60\n");
190 + omap3beagle_enc28j60_init();
191 + printk(KERN_INFO "Beagle expansionboard: assigning GPIO 141 and 162 to MMC1\n");
192 + mmc[1].gpio_wp = 141;
193 + mmc[1].gpio_cd = 162;
196 + if(!strcmp(expansionboard_name, "zippy2"))
198 + printk(KERN_INFO "Beagle expansionboard: initializing ks_8851\n");
199 + omap3beagle_ks8851_init();
200 + printk(KERN_INFO "Beagle expansionboard: assigning GPIO 141 and 162 to MMC1\n");
201 + mmc[1].gpio_wp = 141;
202 + mmc[1].gpio_cd = 162;
205 usb_musb_init(&musb_board_data);
206 usb_ehci_init(&ehci_pdata);
207 omap3beagle_flash_init();
208 @@ -634,6 +768,8 @@ static void __init omap3_beagle_init(void)
209 beagle_display_init();
212 +early_param("buddy", expansionboard_setup);
214 MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
215 /* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */
216 .boot_params = 0x80000100,
218 1.6.6.1