[glsdk/meta-ti-glsdk.git] / recipes-bsp / linux / linux-omap-psp-2.6.32 / 0007-ARM-OMAP-beagleboard-Add-infrastructure-to-do-fixups.patch
1 From 25ae9895ed107a6fe9d9c4345f21bbdaee4ccde6 Mon Sep 17 00:00:00 2001
2 From: Koen Kooi <koen@dominion.thruhere.net>
3 Date: Mon, 3 May 2010 14:41:29 +0200
4 Subject: [PATCH 07/45] ARM: OMAP: beagleboard: Add infrastructure to do fixups based on expansionboard name passed by u-boot
6 And add support for zippy2
7 ---
8 arch/arm/mach-omap2/board-omap3beagle.c | 88 +++++++++++++++++++++++++++----
9 1 files changed, 78 insertions(+), 10 deletions(-)
11 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
12 index 429dacb..ac96551 100644
13 --- a/arch/arm/mach-omap2/board-omap3beagle.c
14 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
15 @@ -75,6 +75,8 @@ static struct omap_opp * _omap37x_l3_rate_table = NULL;
17 #define NAND_BLOCK_SIZE SZ_128K
19 +char expansionboard_name[16];
20 +
21 #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
23 #include <plat/mcspi.h>
24 @@ -87,7 +89,7 @@ static struct omap2_mcspi_device_config enc28j60_spi_chip_info = {
25 .single_channel = 1, /* 0: slave, 1: master */
26 };
28 -static struct spi_board_info omap3beagle_spi_board_info[] __initdata = {
29 +static struct spi_board_info omap3beagle_zippy_spi_board_info[] __initdata = {
30 {
31 .modalias = "enc28j60",
32 .bus_num = 4,
33 @@ -102,21 +104,62 @@ static void __init omap3beagle_enc28j60_init(void)
34 if ((gpio_request(OMAP3BEAGLE_GPIO_ENC28J60_IRQ, "ENC28J60_IRQ") == 0) &&
35 (gpio_direction_input(OMAP3BEAGLE_GPIO_ENC28J60_IRQ) == 0)) {
36 gpio_export(OMAP3BEAGLE_GPIO_ENC28J60_IRQ, 0);
37 - omap3beagle_spi_board_info[0].irq = OMAP_GPIO_IRQ(OMAP3BEAGLE_GPIO_ENC28J60_IRQ);
38 - set_irq_type(omap3beagle_spi_board_info[0].irq, IRQ_TYPE_EDGE_FALLING);
39 + omap3beagle_zippy_spi_board_info[0].irq = OMAP_GPIO_IRQ(OMAP3BEAGLE_GPIO_ENC28J60_IRQ);
40 + set_irq_type(omap3beagle_zippy_spi_board_info[0].irq, IRQ_TYPE_EDGE_FALLING);
41 } else {
42 printk(KERN_ERR "could not obtain gpio for ENC28J60_IRQ\n");
43 return;
44 }
46 - spi_register_board_info(omap3beagle_spi_board_info,
47 - ARRAY_SIZE(omap3beagle_spi_board_info));
48 + spi_register_board_info(omap3beagle_zippy_spi_board_info,
49 + ARRAY_SIZE(omap3beagle_zippy_spi_board_info));
50 }
52 #else
53 static inline void __init omap3beagle_enc28j60_init(void) { return; }
54 #endif
56 +#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
57 +
58 +#include <plat/mcspi.h>
59 +#include <linux/spi/spi.h>
60 +
61 +#define OMAP3BEAGLE_GPIO_KS8851_IRQ 157
62 +
63 +static struct omap2_mcspi_device_config ks8851_spi_chip_info = {
64 + .turbo_mode = 0,
65 + .single_channel = 1, /* 0: slave, 1: master */
66 +};
67 +
68 +static struct spi_board_info omap3beagle_zippy2_spi_board_info[] __initdata = {
69 + {
70 + .modalias = "ks8851",
71 + .bus_num = 4,
72 + .chip_select = 0,
73 + .max_speed_hz = 36000000,
74 + .controller_data = &ks8851_spi_chip_info,
75 + },
76 +};
77 +
78 +static void __init omap3beagle_ks8851_init(void)
79 +{
80 + if ((gpio_request(OMAP3BEAGLE_GPIO_KS8851_IRQ, "KS8851_IRQ") == 0) &&
81 + (gpio_direction_input(OMAP3BEAGLE_GPIO_KS8851_IRQ) == 0)) {
82 + gpio_export(OMAP3BEAGLE_GPIO_KS8851_IRQ, 0);
83 + omap3beagle_zippy2_spi_board_info[0].irq = OMAP_GPIO_IRQ(OMAP3BEAGLE_GPIO_KS8851_IRQ);
84 + set_irq_type(omap3beagle_zippy2_spi_board_info[0].irq, IRQ_TYPE_EDGE_FALLING);
85 + } else {
86 + printk(KERN_ERR "could not obtain gpio for KS8851_IRQ\n");
87 + return;
88 + }
89 +
90 + spi_register_board_info(omap3beagle_zippy2_spi_board_info,
91 + ARRAY_SIZE(omap3beagle_zippy2_spi_board_info));
92 +}
93 +
94 +#else
95 +static inline void __init omap3beagle_ks8851_init(void) { return; }
96 +#endif
98 static struct mtd_partition omap3beagle_nand_partitions[] = {
99 /* All the partition sizes are listed in terms of NAND block size */
100 @@ -281,8 +324,6 @@ static struct twl4030_hsmmc_info mmc[] = {
101 {
102 .mmc = 2,
103 .wires = 4,
104 - .gpio_wp = 141,
105 - .gpio_cd = 162,
106 .transceiver = true,
107 .ocr_mask = 0x00100000, /* 3.3V */
108 },
109 @@ -601,7 +642,7 @@ static void __init omap3beagle_flash_init(void)
110 }
111 }
113 -static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
114 +static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
116 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
117 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
118 @@ -621,6 +662,15 @@ static struct omap_board_mux board_mux[] __initdata = {
119 #define board_mux NULL
120 #endif
122 +static int __init expansionboard_setup(char *str)
123 +{
124 + if (!str)
125 + return -EINVAL;
126 + strncpy(expansionboard_name, str, 16);
127 + printk(KERN_INFO "Beagle expansionboard: %s\n", expansionboard_name);
128 + return 0;
129 +}
130 +
131 static void __init omap3_beagle_init(void)
132 {
133 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
134 @@ -634,8 +684,24 @@ static void __init omap3_beagle_init(void)
135 /* REVISIT leave DVI powered down until it's needed ... */
136 gpio_direction_output(170, true);
138 - omap3beagle_enc28j60_init();
139 -
140 + if(!strcmp(expansionboard_name, "zippy"))
141 + {
142 + printk(KERN_INFO "Beagle expansionboard: initializing enc28j60\n");
143 + omap3beagle_enc28j60_init();
144 + printk(KERN_INFO "Beagle expansionboard: assigning GPIO 141 and 162 to MMC1\n");
145 + mmc[1].gpio_wp = 141;
146 + mmc[1].gpio_cd = 162;
147 + }
148 +
149 + if(!strcmp(expansionboard_name, "zippy2"))
150 + {
151 + printk(KERN_INFO "Beagle expansionboard: initializing ks_8851\n");
152 + omap3beagle_ks8851_init();
153 + printk(KERN_INFO "Beagle expansionboard: assigning GPIO 141 and 162 to MMC1\n");
154 + mmc[1].gpio_wp = 141;
155 + mmc[1].gpio_cd = 162;
156 + }
157 +
158 usb_musb_init();
159 usb_ehci_init(&ehci_pdata);
160 omap3beagle_flash_init();
161 @@ -652,6 +718,8 @@ static void __init omap3_beagle_map_io(void)
162 omap2_map_common_io();
163 }
165 +early_param("buddy", expansionboard_setup);
166 +
167 MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
168 /* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */
169 .phys_io = 0x48000000,
170 --
171 1.6.6.1