]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-bsp/linux/linux-omap-2.6.37rc/0003-ARM-OMAP-beagleboard-Add-infrastructure-to-do-fixups.patch
e56e8dc3ef3b273de79db7b27050b1d9360f5c52
[glsdk/meta-ti-glsdk.git] / recipes-bsp / linux / linux-omap-2.6.37rc / 0003-ARM-OMAP-beagleboard-Add-infrastructure-to-do-fixups.patch
1 From 72657e1ec88da91b772c7158c4c987b29d274ece 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 03/29] 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 be8c4ec..495be15 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>
24  
25 @@ -143,6 +144,92 @@ fail0:
26         return;
27  }
28  
29 +char expansionboard_name[16];
30 +
31 +#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
32 +
33 +#include <plat/mcspi.h>
34 +#include <linux/spi/spi.h>
35 +
36 +#define OMAP3BEAGLE_GPIO_ENC28J60_IRQ 157
37 +
38 +static struct omap2_mcspi_device_config enc28j60_spi_chip_info = {
39 +       .turbo_mode     = 0,
40 +       .single_channel = 1,    /* 0: slave, 1: master */
41 +};
42 +
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 +};
52 +
53 +static void __init omap3beagle_enc28j60_init(void)
54 +{
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 +       }
64 +
65 +       spi_register_board_info(omap3beagle_zippy_spi_board_info,
66 +                       ARRAY_SIZE(omap3beagle_zippy_spi_board_info));
67 +}
68 +
69 +#else
70 +static inline void __init omap3beagle_enc28j60_init(void) { return; }
71 +#endif
72 +
73 +#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
74 +
75 +#include <plat/mcspi.h>
76 +#include <linux/spi/spi.h>
77 +
78 +#define OMAP3BEAGLE_GPIO_KS8851_IRQ 157
79 +
80 +static struct omap2_mcspi_device_config ks8851_spi_chip_info = {
81 +       .turbo_mode     = 0,
82 +       .single_channel = 1,    /* 0: slave, 1: master */
83 +};
84 +
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 +};
94 +
95 +static void __init omap3beagle_ks8851_init(void)
96 +{
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;
105 +       }
106 +       
107 +       spi_register_board_info(omap3beagle_zippy2_spi_board_info,
108 +                                                       ARRAY_SIZE(omap3beagle_zippy2_spi_board_info));
109 +}
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 */
117         {
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,
121         },
122 +       {
123 +               .mmc            = 2,
124 +               .caps       = MMC_CAP_4_BIT_DATA,
125 +               .transceiver    = true,
126 +               .ocr_mask       = 0x00100000,   /* 3.3V */
127 +       },
128         {}      /* Terminator */
129  };
130  
131 @@ -431,7 +524,7 @@ static struct twl4030_platform_data beagle_twldata = {
132         .vpll2          = &beagle_vpll2,
133  };
134  
135 -static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
136 +static struct i2c_board_info __initdata beagle_i2c1_boardinfo[] = {
137         {
138                 I2C_BOARD_INFO("twl4030", 0x48),
139                 .flags = I2C_CLIENT_WAKE,
140 @@ -446,10 +539,24 @@ static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
141         },
142  };
143  
144 +#if defined(CONFIG_RTC_DRV_DS1307) || \
145 +       defined(CONFIG_RTC_DRV_DS1307_MODULE)
147 +static struct i2c_board_info __initdata beagle_i2c2_boardinfo[] = {
148 +       {
149 +               I2C_BOARD_INFO("ds1307", 0x68),
150 +       },
151 +};
152 +#else
153 +static struct i2c_board_info __initdata beagle_i2c2_boardinfo[] = {};
154 +#endif
156  static int __init omap3_beagle_i2c_init(void)
157  {
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 @@ -583,6 +690,15 @@ static struct omap_musb_board_data musb_board_data = {
168         .power                  = 100,
169  };
170  
171 +static int __init expansionboard_setup(char *str)
172 +{
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;
178 +}
180  static void __init omap3_beagle_init(void)
181  {
182         omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
183 @@ -597,6 +713,24 @@ static void __init omap3_beagle_init(void)
184         /* REVISIT leave DVI powered down until it's needed ... */
185         gpio_direction_output(170, true);
186  
187 +       if(!strcmp(expansionboard_name, "zippy")) 
188 +       {
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;
194 +       }
195 +       
196 +       if(!strcmp(expansionboard_name, "zippy2")) 
197 +       {
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;
203 +       }
205         usb_musb_init(&musb_board_data);
206         usb_ehci_init(&ehci_pdata);
207         omap3beagle_flash_init();
208 @@ -608,6 +742,8 @@ static void __init omap3_beagle_init(void)
209         beagle_display_init();
210  }
211  
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,
217 -- 
218 1.6.6.1