aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-overo.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-26 15:11:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-26 15:11:54 -0400
commit829ae2732998e628d762b97627e4e5cc6c1b5625 (patch)
tree7ffdfa365ab54df4fd1742673289621b3f5de2f5 /arch/arm/mach-omap2/board-overo.c
parent6ddb4518c7af7b03fa322552d794f759cd5c26fa (diff)
parent9b28b11e2a648f07c8481b9666ccf1c088e1ab74 (diff)
Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6
* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (33 commits) OMAP3: PM: Boot message is not an error, and not helpful, remove it OMAP3: cpuidle: change the power domains modes determination logic OMAP3: cpuidle: code rework for improved readability OMAP3: cpuidle: re-organize the C-states data OMAP3: clean-up mach specific cpuidle data structures OMAP3 cpuidle: remove useless SDP specific timings usb: otg: OMAP4430: Powerdown the internal PHY when USB is disabled usb: otg: OMAP4430: Fixing the omap4430_phy_init function usb: musb: am35x: fix compile error when building am35x usb: musb: OMAP4430: Power down the PHY during board init omap: drop board-igep0030.c omap: igep0020: add support for IGEP3 omap: igep0020: minor refactoring omap: igep0020: name refactoring for future merge with IGEP3 omap: Remove support for omap2evm arm: omap2plus: GPIO cleanup omap: musb: introduce default board config omap: move detection of NAND CS to common-board-devices omap: use common initialization for PMIC i2c bus omap: consolidate touch screen initialization among different boards ...
Diffstat (limited to 'arch/arm/mach-omap2/board-overo.c')
-rw-r--r--arch/arm/mach-omap2/board-overo.c265
1 files changed, 46 insertions, 219 deletions
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 9d192ff3b9ac..1555918e3ffa 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -56,6 +56,7 @@
56#include "mux.h" 56#include "mux.h"
57#include "sdram-micron-mt46h32m32lf-6.h" 57#include "sdram-micron-mt46h32m32lf-6.h"
58#include "hsmmc.h" 58#include "hsmmc.h"
59#include "common-board-devices.h"
59 60
60#define OVERO_GPIO_BT_XGATE 15 61#define OVERO_GPIO_BT_XGATE 15
61#define OVERO_GPIO_W2W_NRESET 16 62#define OVERO_GPIO_W2W_NRESET 16
@@ -74,30 +75,6 @@
74#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ 75#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
75 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 76 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
76 77
77#include <linux/spi/ads7846.h>
78
79static struct omap2_mcspi_device_config ads7846_mcspi_config = {
80 .turbo_mode = 0,
81 .single_channel = 1, /* 0: slave, 1: master */
82};
83
84static int ads7846_get_pendown_state(void)
85{
86 return !gpio_get_value(OVERO_GPIO_PENDOWN);
87}
88
89static struct ads7846_platform_data ads7846_config = {
90 .x_max = 0x0fff,
91 .y_max = 0x0fff,
92 .x_plate_ohms = 180,
93 .pressure_max = 255,
94 .debounce_max = 10,
95 .debounce_tol = 3,
96 .debounce_rep = 1,
97 .get_pendown_state = ads7846_get_pendown_state,
98 .keep_vref_on = 1,
99};
100
101/* fixed regulator for ads7846 */ 78/* fixed regulator for ads7846 */
102static struct regulator_consumer_supply ads7846_supply = 79static struct regulator_consumer_supply ads7846_supply =
103 REGULATOR_SUPPLY("vcc", "spi1.0"); 80 REGULATOR_SUPPLY("vcc", "spi1.0");
@@ -128,14 +105,7 @@ static struct platform_device vads7846_device = {
128 105
129static void __init overo_ads7846_init(void) 106static void __init overo_ads7846_init(void)
130{ 107{
131 if ((gpio_request(OVERO_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) && 108 omap_ads7846_init(1, OVERO_GPIO_PENDOWN, 0, NULL);
132 (gpio_direction_input(OVERO_GPIO_PENDOWN) == 0)) {
133 gpio_export(OVERO_GPIO_PENDOWN, 0);
134 } else {
135 printk(KERN_ERR "could not obtain gpio for ADS7846_PENDOWN\n");
136 return;
137 }
138
139 platform_device_register(&vads7846_device); 109 platform_device_register(&vads7846_device);
140} 110}
141 111
@@ -146,106 +116,28 @@ static inline void __init overo_ads7846_init(void) { return; }
146#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 116#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
147 117
148#include <linux/smsc911x.h> 118#include <linux/smsc911x.h>
119#include <plat/gpmc-smsc911x.h>
149 120
150static struct resource overo_smsc911x_resources[] = { 121static struct omap_smsc911x_platform_data smsc911x_cfg = {
151 {
152 .name = "smsc911x-memory",
153 .flags = IORESOURCE_MEM,
154 },
155 {
156 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
157 },
158};
159
160static struct resource overo_smsc911x2_resources[] = {
161 {
162 .name = "smsc911x2-memory",
163 .flags = IORESOURCE_MEM,
164 },
165 {
166 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
167 },
168};
169
170static struct smsc911x_platform_config overo_smsc911x_config = {
171 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
172 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
173 .flags = SMSC911X_USE_32BIT ,
174 .phy_interface = PHY_INTERFACE_MODE_MII,
175};
176
177static struct platform_device overo_smsc911x_device = {
178 .name = "smsc911x",
179 .id = 0, 122 .id = 0,
180 .num_resources = ARRAY_SIZE(overo_smsc911x_resources), 123 .cs = OVERO_SMSC911X_CS,
181 .resource = overo_smsc911x_resources, 124 .gpio_irq = OVERO_SMSC911X_GPIO,
182 .dev = { 125 .gpio_reset = -EINVAL,
183 .platform_data = &overo_smsc911x_config, 126 .flags = SMSC911X_USE_32BIT,
184 },
185}; 127};
186 128
187static struct platform_device overo_smsc911x2_device = { 129static struct omap_smsc911x_platform_data smsc911x2_cfg = {
188 .name = "smsc911x",
189 .id = 1, 130 .id = 1,
190 .num_resources = ARRAY_SIZE(overo_smsc911x2_resources), 131 .cs = OVERO_SMSC911X2_CS,
191 .resource = overo_smsc911x2_resources, 132 .gpio_irq = OVERO_SMSC911X2_GPIO,
192 .dev = { 133 .gpio_reset = -EINVAL,
193 .platform_data = &overo_smsc911x_config, 134 .flags = SMSC911X_USE_32BIT,
194 },
195}; 135};
196 136
197static struct platform_device *smsc911x_devices[] = { 137static void __init overo_init_smsc911x(void)
198 &overo_smsc911x_device,
199 &overo_smsc911x2_device,
200};
201
202static inline void __init overo_init_smsc911x(void)
203{ 138{
204 unsigned long cs_mem_base, cs_mem_base2; 139 gpmc_smsc911x_init(&smsc911x_cfg);
205 140 gpmc_smsc911x_init(&smsc911x2_cfg);
206 /* set up first smsc911x chip */
207
208 if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
209 printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n");
210 return;
211 }
212
213 overo_smsc911x_resources[0].start = cs_mem_base + 0x0;
214 overo_smsc911x_resources[0].end = cs_mem_base + 0xff;
215
216 if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
217 (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) {
218 gpio_export(OVERO_SMSC911X_GPIO, 0);
219 } else {
220 printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n");
221 return;
222 }
223
224 overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO);
225 overo_smsc911x_resources[1].end = 0;
226
227 /* set up second smsc911x chip */
228
229 if (gpmc_cs_request(OVERO_SMSC911X2_CS, SZ_16M, &cs_mem_base2) < 0) {
230 printk(KERN_ERR "Failed request for GPMC mem for smsc911x2\n");
231 return;
232 }
233
234 overo_smsc911x2_resources[0].start = cs_mem_base2 + 0x0;
235 overo_smsc911x2_resources[0].end = cs_mem_base2 + 0xff;
236
237 if ((gpio_request(OVERO_SMSC911X2_GPIO, "SMSC911X2 IRQ") == 0) &&
238 (gpio_direction_input(OVERO_SMSC911X2_GPIO) == 0)) {
239 gpio_export(OVERO_SMSC911X2_GPIO, 0);
240 } else {
241 printk(KERN_ERR "could not obtain gpio for SMSC911X2 IRQ\n");
242 return;
243 }
244
245 overo_smsc911x2_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X2_GPIO);
246 overo_smsc911x2_resources[1].end = 0;
247
248 platform_add_devices(smsc911x_devices, ARRAY_SIZE(smsc911x_devices));
249} 141}
250 142
251#else 143#else
@@ -259,21 +151,20 @@ static int dvi_enabled;
259#define OVERO_GPIO_LCD_EN 144 151#define OVERO_GPIO_LCD_EN 144
260#define OVERO_GPIO_LCD_BL 145 152#define OVERO_GPIO_LCD_BL 145
261 153
154static struct gpio overo_dss_gpios[] __initdata = {
155 { OVERO_GPIO_LCD_EN, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_EN" },
156 { OVERO_GPIO_LCD_BL, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_BL" },
157};
158
262static void __init overo_display_init(void) 159static void __init overo_display_init(void)
263{ 160{
264 if ((gpio_request(OVERO_GPIO_LCD_EN, "OVERO_GPIO_LCD_EN") == 0) && 161 if (gpio_request_array(overo_dss_gpios, ARRAY_SIZE(overo_dss_gpios))) {
265 (gpio_direction_output(OVERO_GPIO_LCD_EN, 1) == 0)) 162 printk(KERN_ERR "could not obtain DSS control GPIOs\n");
266 gpio_export(OVERO_GPIO_LCD_EN, 0); 163 return;
267 else 164 }
268 printk(KERN_ERR "could not obtain gpio for "
269 "OVERO_GPIO_LCD_EN\n");
270 165
271 if ((gpio_request(OVERO_GPIO_LCD_BL, "OVERO_GPIO_LCD_BL") == 0) && 166 gpio_export(OVERO_GPIO_LCD_EN, 0);
272 (gpio_direction_output(OVERO_GPIO_LCD_BL, 1) == 0)) 167 gpio_export(OVERO_GPIO_LCD_BL, 0);
273 gpio_export(OVERO_GPIO_LCD_BL, 0);
274 else
275 printk(KERN_ERR "could not obtain gpio for "
276 "OVERO_GPIO_LCD_BL\n");
277} 168}
278 169
279static int overo_panel_enable_dvi(struct omap_dss_device *dssdev) 170static int overo_panel_enable_dvi(struct omap_dss_device *dssdev)
@@ -412,45 +303,6 @@ static struct mtd_partition overo_nand_partitions[] = {
412 }, 303 },
413}; 304};
414 305
415static struct omap_nand_platform_data overo_nand_data = {
416 .parts = overo_nand_partitions,
417 .nr_parts = ARRAY_SIZE(overo_nand_partitions),
418 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
419};
420
421static void __init overo_flash_init(void)
422{
423 u8 cs = 0;
424 u8 nandcs = GPMC_CS_NUM + 1;
425
426 /* find out the chip-select on which NAND exists */
427 while (cs < GPMC_CS_NUM) {
428 u32 ret = 0;
429 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
430
431 if ((ret & 0xC00) == 0x800) {
432 printk(KERN_INFO "Found NAND on CS%d\n", cs);
433 if (nandcs > GPMC_CS_NUM)
434 nandcs = cs;
435 }
436 cs++;
437 }
438
439 if (nandcs > GPMC_CS_NUM) {
440 printk(KERN_INFO "NAND: Unable to find configuration "
441 "in GPMC\n ");
442 return;
443 }
444
445 if (nandcs < GPMC_CS_NUM) {
446 overo_nand_data.cs = nandcs;
447
448 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
449 if (gpmc_nand_init(&overo_nand_data) < 0)
450 printk(KERN_ERR "Unable to register NAND device\n");
451 }
452}
453
454static struct omap2_hsmmc_info mmc[] = { 306static struct omap2_hsmmc_info mmc[] = {
455 { 307 {
456 .mmc = 1, 308 .mmc = 1,
@@ -648,37 +500,15 @@ static struct twl4030_platform_data overo_twldata = {
648 .vpll2 = &overo_vpll2, 500 .vpll2 = &overo_vpll2,
649}; 501};
650 502
651static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
652 {
653 I2C_BOARD_INFO("tps65950", 0x48),
654 .flags = I2C_CLIENT_WAKE,
655 .irq = INT_34XX_SYS_NIRQ,
656 .platform_data = &overo_twldata,
657 },
658};
659
660static int __init overo_i2c_init(void) 503static int __init overo_i2c_init(void)
661{ 504{
662 omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo, 505 omap3_pmic_init("tps65950", &overo_twldata);
663 ARRAY_SIZE(overo_i2c_boardinfo));
664 /* i2c2 pins are used for gpio */ 506 /* i2c2 pins are used for gpio */
665 omap_register_i2c_bus(3, 400, NULL, 0); 507 omap_register_i2c_bus(3, 400, NULL, 0);
666 return 0; 508 return 0;
667} 509}
668 510
669static struct spi_board_info overo_spi_board_info[] __initdata = { 511static struct spi_board_info overo_spi_board_info[] __initdata = {
670#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
671 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
672 {
673 .modalias = "ads7846",
674 .bus_num = 1,
675 .chip_select = 0,
676 .max_speed_hz = 1500000,
677 .controller_data = &ads7846_mcspi_config,
678 .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN),
679 .platform_data = &ads7846_config,
680 },
681#endif
682#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ 512#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
683 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) 513 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
684 { 514 {
@@ -722,20 +552,22 @@ static struct omap_board_mux board_mux[] __initdata = {
722}; 552};
723#endif 553#endif
724 554
725static struct omap_musb_board_data musb_board_data = { 555static struct gpio overo_bt_gpios[] __initdata = {
726 .interface_type = MUSB_INTERFACE_ULPI, 556 { OVERO_GPIO_BT_XGATE, GPIOF_OUT_INIT_LOW, "lcd enable" },
727 .mode = MUSB_OTG, 557 { OVERO_GPIO_BT_NRESET, GPIOF_OUT_INIT_HIGH, "lcd bl enable" },
728 .power = 100,
729}; 558};
730 559
731static void __init overo_init(void) 560static void __init overo_init(void)
732{ 561{
562 int ret;
563
733 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 564 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
734 overo_i2c_init(); 565 overo_i2c_init();
735 omap_display_init(&overo_dss_data); 566 omap_display_init(&overo_dss_data);
736 omap_serial_init(); 567 omap_serial_init();
737 overo_flash_init(); 568 omap_nand_flash_init(0, overo_nand_partitions,
738 usb_musb_init(&musb_board_data); 569 ARRAY_SIZE(overo_nand_partitions));
570 usb_musb_init(NULL);
739 usbhs_init(&usbhs_bdata); 571 usbhs_init(&usbhs_bdata);
740 overo_spi_init(); 572 overo_spi_init();
741 overo_ads7846_init(); 573 overo_ads7846_init();
@@ -748,9 +580,9 @@ static void __init overo_init(void)
748 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 580 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
749 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); 581 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
750 582
751 if ((gpio_request(OVERO_GPIO_W2W_NRESET, 583 ret = gpio_request_one(OVERO_GPIO_W2W_NRESET, GPIOF_OUT_INIT_HIGH,
752 "OVERO_GPIO_W2W_NRESET") == 0) && 584 "OVERO_GPIO_W2W_NRESET");
753 (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) { 585 if (ret == 0) {
754 gpio_export(OVERO_GPIO_W2W_NRESET, 0); 586 gpio_export(OVERO_GPIO_W2W_NRESET, 0);
755 gpio_set_value(OVERO_GPIO_W2W_NRESET, 0); 587 gpio_set_value(OVERO_GPIO_W2W_NRESET, 0);
756 udelay(10); 588 udelay(10);
@@ -760,25 +592,20 @@ static void __init overo_init(void)
760 "OVERO_GPIO_W2W_NRESET\n"); 592 "OVERO_GPIO_W2W_NRESET\n");
761 } 593 }
762 594
763 if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) && 595 ret = gpio_request_array(overo_bt_gpios, ARRAY_SIZE(overo_bt_gpios));
764 (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0)) 596 if (ret) {
597 pr_err("%s: could not obtain BT gpios\n", __func__);
598 } else {
765 gpio_export(OVERO_GPIO_BT_XGATE, 0); 599 gpio_export(OVERO_GPIO_BT_XGATE, 0);
766 else
767 printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n");
768
769 if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) &&
770 (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) {
771 gpio_export(OVERO_GPIO_BT_NRESET, 0); 600 gpio_export(OVERO_GPIO_BT_NRESET, 0);
772 gpio_set_value(OVERO_GPIO_BT_NRESET, 0); 601 gpio_set_value(OVERO_GPIO_BT_NRESET, 0);
773 mdelay(6); 602 mdelay(6);
774 gpio_set_value(OVERO_GPIO_BT_NRESET, 1); 603 gpio_set_value(OVERO_GPIO_BT_NRESET, 1);
775 } else {
776 printk(KERN_ERR "could not obtain gpio for "
777 "OVERO_GPIO_BT_NRESET\n");
778 } 604 }
779 605
780 if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) && 606 ret = gpio_request_one(OVERO_GPIO_USBH_CPEN, GPIOF_OUT_INIT_HIGH,
781 (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0)) 607 "OVERO_GPIO_USBH_CPEN");
608 if (ret == 0)
782 gpio_export(OVERO_GPIO_USBH_CPEN, 0); 609 gpio_export(OVERO_GPIO_USBH_CPEN, 0);
783 else 610 else
784 printk(KERN_ERR "could not obtain gpio for " 611 printk(KERN_ERR "could not obtain gpio for "