Commit 2f01a973729712c373ccc8acde4d218c38f3029a
Committed by
Russell King
1 parent
3c85bce6f8
[ARM] 5103/2: CM-X270: update core platform support
Convert CM-X270 pin configuration to use MFP tables. Make device initialization dependent on respective driver CONFIG_ value (like in zylonite). Cleanup includes Signed-off-by: Mike Rapoport <mike@compulab.co.il> Acked-by: Eric Miao <eric.miao@marvell.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Showing 3 changed files with 307 additions and 139 deletions Side-by-side Diff
arch/arm/mach-pxa/cm-x270-pci.c
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | * |
6 | 6 | * Bits taken from various places. |
7 | 7 | * |
8 | - * Copyright (C) 2007 Compulab, Ltd. | |
8 | + * Copyright (C) 2007, 2008 Compulab, Ltd. | |
9 | 9 | * Mike Rapoport <mike@compulab.co.il> |
10 | 10 | * |
11 | 11 | * This program is free software; you can redistribute it and/or modify |
12 | 12 | |
13 | 13 | |
14 | 14 | |
... | ... | @@ -19,16 +19,16 @@ |
19 | 19 | #include <linux/device.h> |
20 | 20 | #include <linux/platform_device.h> |
21 | 21 | #include <linux/irq.h> |
22 | +#include <linux/gpio.h> | |
22 | 23 | |
23 | 24 | #include <asm/mach/pci.h> |
24 | -#include <asm/arch/cm-x270.h> | |
25 | 25 | #include <asm/arch/pxa-regs.h> |
26 | -#include <asm/arch/pxa2xx-gpio.h> | |
27 | 26 | #include <asm/mach-types.h> |
28 | 27 | |
29 | 28 | #include <asm/hardware/it8152.h> |
30 | 29 | |
31 | -unsigned long it8152_base_address = CMX270_IT8152_VIRT; | |
30 | +unsigned long it8152_base_address; | |
31 | +static int cmx270_it8152_irq_gpio; | |
32 | 32 | |
33 | 33 | /* |
34 | 34 | * Only first 64MB of memory can be accessed via PCI. |
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | unsigned int sz = SZ_64M >> PAGE_SHIFT; |
43 | 43 | |
44 | 44 | if (machine_is_armcore()) { |
45 | - pr_info("Adjusting zones for CM-x270\n"); | |
45 | + pr_info("Adjusting zones for CM-X270\n"); | |
46 | 46 | |
47 | 47 | /* |
48 | 48 | * Only adjust if > 64M on current system |
49 | 49 | |
50 | 50 | |
51 | 51 | |
... | ... | @@ -60,19 +60,20 @@ |
60 | 60 | static void cmx270_it8152_irq_demux(unsigned int irq, struct irq_desc *desc) |
61 | 61 | { |
62 | 62 | /* clear our parent irq */ |
63 | - GEDR(GPIO_IT8152_IRQ) = GPIO_bit(GPIO_IT8152_IRQ); | |
63 | + GEDR(cmx270_it8152_irq_gpio) = GPIO_bit(cmx270_it8152_irq_gpio); | |
64 | 64 | |
65 | 65 | it8152_irq_demux(irq, desc); |
66 | 66 | } |
67 | 67 | |
68 | -void __cmx270_pci_init_irq(void) | |
68 | +void __cmx270_pci_init_irq(int irq_gpio) | |
69 | 69 | { |
70 | 70 | it8152_init_irq(); |
71 | - pxa_gpio_mode(IRQ_TO_GPIO(GPIO_IT8152_IRQ)); | |
72 | - set_irq_type(IRQ_GPIO(GPIO_IT8152_IRQ), IRQT_RISING); | |
73 | 71 | |
74 | - set_irq_chained_handler(IRQ_GPIO(GPIO_IT8152_IRQ), | |
75 | - cmx270_it8152_irq_demux); | |
72 | + cmx270_it8152_irq_gpio = irq_gpio; | |
73 | + | |
74 | + set_irq_type(gpio_to_irq(irq_gpio), IRQT_RISING); | |
75 | + | |
76 | + set_irq_chained_handler(gpio_to_irq(irq_gpio), cmx270_it8152_irq_demux); | |
76 | 77 | } |
77 | 78 | |
78 | 79 | #ifdef CONFIG_PM |
... | ... | @@ -115,8 +116,8 @@ |
115 | 116 | |
116 | 117 | /* |
117 | 118 | Here comes the ugly part. The routing is baseboard specific, |
118 | - but defining a platform for each possible base of CM-x270 is | |
119 | - unrealistic. Here we keep mapping for ATXBase and SB-x270. | |
119 | + but defining a platform for each possible base of CM-X270 is | |
120 | + unrealistic. Here we keep mapping for ATXBase and SB-X270. | |
120 | 121 | */ |
121 | 122 | /* ATXBASE PCI slot */ |
122 | 123 | if (slot == 7) |
arch/arm/mach-pxa/cm-x270-pci.h
1 | -extern void __cmx270_pci_init_irq(void); | |
1 | +extern void __cmx270_pci_init_irq(int irq_gpio); | |
2 | 2 | extern void __cmx270_pci_suspend(void); |
3 | 3 | extern void __cmx270_pci_resume(void); |
4 | 4 | |
5 | 5 | #ifdef CONFIG_PCI |
6 | -#define cmx270_pci_init_irq __cmx270_pci_init_irq | |
7 | -#define cmx270_pci_suspend __cmx270_pci_suspend | |
8 | -#define cmx270_pci_resume __cmx270_pci_resume | |
6 | +#define cmx270_pci_init_irq(x) __cmx270_pci_init_irq(x) | |
7 | +#define cmx270_pci_suspend(x) __cmx270_pci_suspend(x) | |
8 | +#define cmx270_pci_resume(x) __cmx270_pci_resume(x) | |
9 | 9 | #else |
10 | -#define cmx270_pci_init_irq() do {} while (0) | |
11 | -#define cmx270_pci_suspend() do {} while (0) | |
12 | -#define cmx270_pci_resume() do {} while (0) | |
10 | +#define cmx270_pci_init_irq(x) do {} while (0) | |
11 | +#define cmx270_pci_suspend(x) do {} while (0) | |
12 | +#define cmx270_pci_resume(x) do {} while (0) | |
13 | 13 | #endif |
arch/arm/mach-pxa/cm-x270.c
1 | 1 | /* |
2 | 2 | * linux/arch/arm/mach-pxa/cm-x270.c |
3 | 3 | * |
4 | - * Copyright (C) 2007 CompuLab, Ltd. | |
4 | + * Copyright (C) 2007, 2008 CompuLab, Ltd. | |
5 | 5 | * Mike Rapoport <mike@compulab.co.il> |
6 | 6 | * |
7 | 7 | * This program is free software; you can redistribute it and/or modify |
8 | 8 | |
9 | 9 | |
10 | 10 | |
11 | 11 | |
12 | 12 | |
13 | 13 | |
14 | 14 | |
15 | 15 | |
16 | 16 | |
... | ... | @@ -9,44 +9,156 @@ |
9 | 9 | * published by the Free Software Foundation. |
10 | 10 | */ |
11 | 11 | |
12 | -#include <linux/types.h> | |
13 | -#include <linux/pm.h> | |
14 | -#include <linux/fb.h> | |
15 | 12 | #include <linux/platform_device.h> |
16 | -#include <linux/irq.h> | |
17 | 13 | #include <linux/sysdev.h> |
18 | -#include <linux/io.h> | |
19 | -#include <linux/delay.h> | |
14 | +#include <linux/irq.h> | |
15 | +#include <linux/gpio.h> | |
20 | 16 | |
21 | 17 | #include <linux/dm9000.h> |
22 | 18 | #include <linux/rtc-v3020.h> |
23 | -#include <linux/serial_8250.h> | |
24 | - | |
25 | 19 | #include <video/mbxfb.h> |
20 | +#include <linux/leds.h> | |
26 | 21 | |
27 | 22 | #include <asm/mach/arch.h> |
28 | 23 | #include <asm/mach-types.h> |
29 | 24 | #include <asm/mach/map.h> |
30 | 25 | |
31 | -#include <asm/arch/pxa-regs.h> | |
32 | 26 | #include <asm/arch/pxa2xx-regs.h> |
33 | -#include <asm/arch/pxa2xx-gpio.h> | |
27 | +#include <asm/arch/mfp-pxa27x.h> | |
28 | +#include <asm/arch/pxa-regs.h> | |
34 | 29 | #include <asm/arch/audio.h> |
35 | 30 | #include <asm/arch/pxafb.h> |
36 | 31 | #include <asm/arch/ohci.h> |
37 | 32 | #include <asm/arch/mmc.h> |
38 | 33 | #include <asm/arch/bitfield.h> |
39 | -#include <asm/arch/cm-x270.h> | |
40 | 34 | |
41 | 35 | #include <asm/hardware/it8152.h> |
42 | 36 | |
43 | 37 | #include "generic.h" |
44 | 38 | #include "cm-x270-pci.h" |
45 | 39 | |
40 | +/* virtual addresses for statically mapped regions */ | |
41 | +#define CMX270_VIRT_BASE (0xe8000000) | |
42 | +#define CMX270_IT8152_VIRT (CMX270_VIRT_BASE) | |
43 | + | |
46 | 44 | #define RTC_PHYS_BASE (PXA_CS1_PHYS + (5 << 22)) |
47 | 45 | #define DM9000_PHYS_BASE (PXA_CS1_PHYS + (6 << 22)) |
48 | 46 | |
49 | -static struct resource cmx270_dm9k_resource[] = { | |
47 | +/* GPIO IRQ usage */ | |
48 | +#define GPIO10_ETHIRQ (10) | |
49 | +#define GPIO22_IT8152_IRQ (22) | |
50 | +#define GPIO83_MMC_IRQ (83) | |
51 | +#define GPIO95_GFXIRQ (95) | |
52 | + | |
53 | +#define CMX270_ETHIRQ IRQ_GPIO(GPIO10_ETHIRQ) | |
54 | +#define CMX270_IT8152_IRQ IRQ_GPIO(GPIO22_IT8152_IRQ) | |
55 | +#define CMX270_MMC_IRQ IRQ_GPIO(GPIO83_MMC_IRQ) | |
56 | +#define CMX270_GFXIRQ IRQ_GPIO(GPIO95_GFXIRQ) | |
57 | + | |
58 | +/* MMC power enable */ | |
59 | +#define GPIO105_MMC_POWER (105) | |
60 | + | |
61 | +static unsigned long cmx270_pin_config[] = { | |
62 | + /* AC'97 */ | |
63 | + GPIO28_AC97_BITCLK, | |
64 | + GPIO29_AC97_SDATA_IN_0, | |
65 | + GPIO30_AC97_SDATA_OUT, | |
66 | + GPIO31_AC97_SYNC, | |
67 | + GPIO98_AC97_SYSCLK, | |
68 | + GPIO113_AC97_nRESET, | |
69 | + | |
70 | + /* BTUART */ | |
71 | + GPIO42_BTUART_RXD, | |
72 | + GPIO43_BTUART_TXD, | |
73 | + GPIO44_BTUART_CTS, | |
74 | + GPIO45_BTUART_RTS, | |
75 | + | |
76 | + /* STUART */ | |
77 | + GPIO46_STUART_RXD, | |
78 | + GPIO47_STUART_TXD, | |
79 | + | |
80 | + /* MCI controller */ | |
81 | + GPIO32_MMC_CLK, | |
82 | + GPIO112_MMC_CMD, | |
83 | + GPIO92_MMC_DAT_0, | |
84 | + GPIO109_MMC_DAT_1, | |
85 | + GPIO110_MMC_DAT_2, | |
86 | + GPIO111_MMC_DAT_3, | |
87 | + | |
88 | + /* LCD */ | |
89 | + GPIO58_LCD_LDD_0, | |
90 | + GPIO59_LCD_LDD_1, | |
91 | + GPIO60_LCD_LDD_2, | |
92 | + GPIO61_LCD_LDD_3, | |
93 | + GPIO62_LCD_LDD_4, | |
94 | + GPIO63_LCD_LDD_5, | |
95 | + GPIO64_LCD_LDD_6, | |
96 | + GPIO65_LCD_LDD_7, | |
97 | + GPIO66_LCD_LDD_8, | |
98 | + GPIO67_LCD_LDD_9, | |
99 | + GPIO68_LCD_LDD_10, | |
100 | + GPIO69_LCD_LDD_11, | |
101 | + GPIO70_LCD_LDD_12, | |
102 | + GPIO71_LCD_LDD_13, | |
103 | + GPIO72_LCD_LDD_14, | |
104 | + GPIO73_LCD_LDD_15, | |
105 | + GPIO74_LCD_FCLK, | |
106 | + GPIO75_LCD_LCLK, | |
107 | + GPIO76_LCD_PCLK, | |
108 | + GPIO77_LCD_BIAS, | |
109 | + | |
110 | + /* I2C */ | |
111 | + GPIO117_I2C_SCL, | |
112 | + GPIO118_I2C_SDA, | |
113 | + | |
114 | + /* SSP1 */ | |
115 | + GPIO23_SSP1_SCLK, | |
116 | + GPIO24_SSP1_SFRM, | |
117 | + GPIO25_SSP1_TXD, | |
118 | + GPIO26_SSP1_RXD, | |
119 | + | |
120 | + /* SSP2 */ | |
121 | + GPIO19_SSP2_SCLK, | |
122 | + GPIO14_SSP2_SFRM, | |
123 | + GPIO87_SSP2_TXD, | |
124 | + GPIO88_SSP2_RXD, | |
125 | + | |
126 | + /* PC Card */ | |
127 | + GPIO48_nPOE, | |
128 | + GPIO49_nPWE, | |
129 | + GPIO50_nPIOR, | |
130 | + GPIO51_nPIOW, | |
131 | + GPIO85_nPCE_1, | |
132 | + GPIO54_nPCE_2, | |
133 | + GPIO55_nPREG, | |
134 | + GPIO56_nPWAIT, | |
135 | + GPIO57_nIOIS16, | |
136 | + | |
137 | + /* SDRAM and local bus */ | |
138 | + GPIO15_nCS_1, | |
139 | + GPIO78_nCS_2, | |
140 | + GPIO79_nCS_3, | |
141 | + GPIO80_nCS_4, | |
142 | + GPIO33_nCS_5, | |
143 | + GPIO49_nPWE, | |
144 | + GPIO18_RDY, | |
145 | + | |
146 | + /* GPIO */ | |
147 | + GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH, | |
148 | + GPIO105_GPIO | MFP_LPM_DRIVE_HIGH, /* MMC/SD power */ | |
149 | + GPIO53_GPIO, /* PC card reset */ | |
150 | + | |
151 | + /* NAND controls */ | |
152 | + GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */ | |
153 | + GPIO89_GPIO, /* NAND Ready/Busy */ | |
154 | + | |
155 | + /* interrupts */ | |
156 | + GPIO10_GPIO, /* DM9000 interrupt */ | |
157 | + GPIO83_GPIO, /* MMC card detect */ | |
158 | +}; | |
159 | + | |
160 | +#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) | |
161 | +static struct resource cmx270_dm9000_resource[] = { | |
50 | 162 | [0] = { |
51 | 163 | .start = DM9000_PHYS_BASE, |
52 | 164 | .end = DM9000_PHYS_BASE + 4, |
53 | 165 | |
54 | 166 | |
55 | 167 | |
56 | 168 | |
57 | 169 | |
58 | 170 | |
... | ... | @@ -60,35 +172,49 @@ |
60 | 172 | [2] = { |
61 | 173 | .start = CMX270_ETHIRQ, |
62 | 174 | .end = CMX270_ETHIRQ, |
63 | - .flags = IORESOURCE_IRQ, | |
175 | + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | |
64 | 176 | } |
65 | 177 | }; |
66 | 178 | |
67 | -/* for the moment we limit ourselves to 32bit IO until some | |
68 | - * better IO routines can be written and tested | |
69 | - */ | |
70 | -static struct dm9000_plat_data cmx270_dm9k_platdata = { | |
179 | +static struct dm9000_plat_data cmx270_dm9000_platdata = { | |
71 | 180 | .flags = DM9000_PLATF_32BITONLY, |
72 | 181 | }; |
73 | 182 | |
74 | -/* Ethernet device */ | |
75 | -static struct platform_device cmx270_device_dm9k = { | |
183 | +static struct platform_device cmx270_dm9000_device = { | |
76 | 184 | .name = "dm9000", |
77 | 185 | .id = 0, |
78 | - .num_resources = ARRAY_SIZE(cmx270_dm9k_resource), | |
79 | - .resource = cmx270_dm9k_resource, | |
186 | + .num_resources = ARRAY_SIZE(cmx270_dm9000_resource), | |
187 | + .resource = cmx270_dm9000_resource, | |
80 | 188 | .dev = { |
81 | - .platform_data = &cmx270_dm9k_platdata, | |
189 | + .platform_data = &cmx270_dm9000_platdata, | |
82 | 190 | } |
83 | 191 | }; |
84 | 192 | |
85 | -/* touchscreen controller */ | |
193 | +static void __init cmx270_init_dm9000(void) | |
194 | +{ | |
195 | + platform_device_register(&cmx270_dm9000_device); | |
196 | +} | |
197 | +#else | |
198 | +static inline void cmx270_init_dm9000(void) {} | |
199 | +#endif | |
200 | + | |
201 | +/* UCB1400 touchscreen controller */ | |
202 | +#if defined(CONFIG_TOUCHSCREEN_UCB1400) || defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) | |
86 | 203 | static struct platform_device cmx270_ts_device = { |
87 | 204 | .name = "ucb1400_ts", |
88 | 205 | .id = -1, |
89 | 206 | }; |
90 | 207 | |
91 | -/* RTC */ | |
208 | +static void __init cmx270_init_touchscreen(void) | |
209 | +{ | |
210 | + platform_device_register(&cmx270_ts_device); | |
211 | +} | |
212 | +#else | |
213 | +static inline void cmx270_init_touchscreen(void) {} | |
214 | +#endif | |
215 | + | |
216 | +/* V3020 RTC */ | |
217 | +#if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE) | |
92 | 218 | static struct resource cmx270_v3020_resource[] = { |
93 | 219 | [0] = { |
94 | 220 | .start = RTC_PHYS_BASE, |
95 | 221 | |
96 | 222 | |
97 | 223 | |
98 | 224 | |
99 | 225 | |
100 | 226 | |
... | ... | @@ -111,28 +237,67 @@ |
111 | 237 | } |
112 | 238 | }; |
113 | 239 | |
114 | -/* | |
115 | - * CM-X270 LEDs | |
116 | - */ | |
240 | +static void __init cmx270_init_rtc(void) | |
241 | +{ | |
242 | + platform_device_register(&cmx270_rtc_device); | |
243 | +} | |
244 | +#else | |
245 | +static inline void cmx270_init_rtc(void) {} | |
246 | +#endif | |
247 | + | |
248 | +/* CM-X270 LEDs */ | |
249 | +#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | |
250 | +static struct gpio_led cmx270_leds[] = { | |
251 | + [0] = { | |
252 | + .name = "cm-x270:red", | |
253 | + .default_trigger = "nand-disk", | |
254 | + .gpio = 93, | |
255 | + .active_low = 1, | |
256 | + }, | |
257 | + [1] = { | |
258 | + .name = "cm-x270:green", | |
259 | + .default_trigger = "heartbeat", | |
260 | + .gpio = 94, | |
261 | + .active_low = 1, | |
262 | + }, | |
263 | +}; | |
264 | + | |
265 | +static struct gpio_led_platform_data cmx270_gpio_led_pdata = { | |
266 | + .num_leds = ARRAY_SIZE(cmx270_leds), | |
267 | + .leds = cmx270_leds, | |
268 | +}; | |
269 | + | |
117 | 270 | static struct platform_device cmx270_led_device = { |
118 | - .name = "cm-x270-led", | |
271 | + .name = "leds-gpio", | |
119 | 272 | .id = -1, |
273 | + .dev = { | |
274 | + .platform_data = &cmx270_gpio_led_pdata, | |
275 | + }, | |
120 | 276 | }; |
121 | 277 | |
278 | +static void __init cmx270_init_leds(void) | |
279 | +{ | |
280 | + platform_device_register(&cmx270_led_device); | |
281 | +} | |
282 | +#else | |
283 | +static inline void cmx270_init_leds(void) {} | |
284 | +#endif | |
285 | + | |
122 | 286 | /* 2700G graphics */ |
287 | +#if defined(CONFIG_FB_MBX) || defined(CONFIG_FB_MBX_MODULE) | |
123 | 288 | static u64 fb_dma_mask = ~(u64)0; |
124 | 289 | |
125 | 290 | static struct resource cmx270_2700G_resource[] = { |
126 | 291 | /* frame buffer memory including ODFB and External SDRAM */ |
127 | 292 | [0] = { |
128 | - .start = MARATHON_PHYS, | |
129 | - .end = MARATHON_PHYS + 0x02000000, | |
293 | + .start = PXA_CS2_PHYS, | |
294 | + .end = PXA_CS2_PHYS + 0x01ffffff, | |
130 | 295 | .flags = IORESOURCE_MEM, |
131 | 296 | }, |
132 | 297 | /* Marathon registers */ |
133 | 298 | [1] = { |
134 | - .start = MARATHON_PHYS + 0x03fe0000, | |
135 | - .end = MARATHON_PHYS + 0x03ffffff, | |
299 | + .start = PXA_CS2_PHYS + 0x03fe0000, | |
300 | + .end = PXA_CS2_PHYS + 0x03ffffff, | |
136 | 301 | .flags = IORESOURCE_MEM, |
137 | 302 | }, |
138 | 303 | }; |
139 | 304 | |
... | ... | @@ -200,43 +365,15 @@ |
200 | 365 | .id = -1, |
201 | 366 | }; |
202 | 367 | |
203 | -static u64 ata_dma_mask = ~(u64)0; | |
368 | +static void __init cmx270_init_2700G(void) | |
369 | +{ | |
370 | + platform_device_register(&cmx270_2700G); | |
371 | +} | |
372 | +#else | |
373 | +static inline void cmx270_init_2700G(void) {} | |
374 | +#endif | |
204 | 375 | |
205 | -static struct platform_device cmx270_ata = { | |
206 | - .name = "pata_cm_x270", | |
207 | - .id = -1, | |
208 | - .dev = { | |
209 | - .dma_mask = &ata_dma_mask, | |
210 | - .coherent_dma_mask = 0xffffffff, | |
211 | - }, | |
212 | -}; | |
213 | - | |
214 | -/* platform devices */ | |
215 | -static struct platform_device *platform_devices[] __initdata = { | |
216 | - &cmx270_device_dm9k, | |
217 | - &cmx270_rtc_device, | |
218 | - &cmx270_2700G, | |
219 | - &cmx270_led_device, | |
220 | - &cmx270_ts_device, | |
221 | - &cmx270_ata, | |
222 | -}; | |
223 | - | |
224 | -/* Map PCI companion and IDE/General Purpose CS statically */ | |
225 | -static struct map_desc cmx270_io_desc[] __initdata = { | |
226 | - [0] = { /* IDE/general purpose space */ | |
227 | - .virtual = CMX270_IDE104_VIRT, | |
228 | - .pfn = __phys_to_pfn(CMX270_IDE104_PHYS), | |
229 | - .length = SZ_64M - SZ_8M, | |
230 | - .type = MT_DEVICE | |
231 | - }, | |
232 | - [1] = { /* PCI bridge */ | |
233 | - .virtual = CMX270_IT8152_VIRT, | |
234 | - .pfn = __phys_to_pfn(CMX270_IT8152_PHYS), | |
235 | - .length = SZ_64M, | |
236 | - .type = MT_DEVICE | |
237 | - }, | |
238 | -}; | |
239 | - | |
376 | +#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | |
240 | 377 | /* |
241 | 378 | Display definitions |
242 | 379 | keep these for backwards compatibility, although symbolic names (as |
243 | 380 | |
... | ... | @@ -446,7 +583,16 @@ |
446 | 583 | */ |
447 | 584 | __setup("monitor=", cmx270_set_display); |
448 | 585 | |
586 | +static void __init cmx270_init_display(void) | |
587 | +{ | |
588 | + set_pxa_fb_info(cmx270_display); | |
589 | +} | |
590 | +#else | |
591 | +static inline void cmx270_init_display(void) {} | |
592 | +#endif | |
593 | + | |
449 | 594 | /* PXA27x OHCI controller setup */ |
595 | +#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | |
450 | 596 | static int cmx270_ohci_init(struct device *dev) |
451 | 597 | { |
452 | 598 | /* Set the Power Control Polarity Low */ |
453 | 599 | |
454 | 600 | |
455 | 601 | |
456 | 602 | |
457 | 603 | |
... | ... | @@ -461,35 +607,37 @@ |
461 | 607 | .init = cmx270_ohci_init, |
462 | 608 | }; |
463 | 609 | |
610 | +static void __init cmx270_init_ohci(void) | |
611 | +{ | |
612 | + pxa_set_ohci_info(&cmx270_ohci_platform_data); | |
613 | +} | |
614 | +#else | |
615 | +static inline void cmx270_init_ohci(void) {} | |
616 | +#endif | |
464 | 617 | |
618 | +#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) | |
465 | 619 | static int cmx270_mci_init(struct device *dev, |
466 | 620 | irq_handler_t cmx270_detect_int, |
467 | 621 | void *data) |
468 | 622 | { |
469 | 623 | int err; |
470 | 624 | |
471 | - /* | |
472 | - * setup GPIO for PXA27x MMC controller | |
473 | - */ | |
474 | - pxa_gpio_mode(GPIO32_MMCCLK_MD); | |
475 | - pxa_gpio_mode(GPIO112_MMCCMD_MD); | |
476 | - pxa_gpio_mode(GPIO92_MMCDAT0_MD); | |
477 | - pxa_gpio_mode(GPIO109_MMCDAT1_MD); | |
478 | - pxa_gpio_mode(GPIO110_MMCDAT2_MD); | |
479 | - pxa_gpio_mode(GPIO111_MMCDAT3_MD); | |
625 | + err = gpio_request(GPIO105_MMC_POWER, "MMC/SD power"); | |
626 | + if (err) { | |
627 | + dev_warn(dev, "power gpio unavailable\n"); | |
628 | + return err; | |
629 | + } | |
480 | 630 | |
481 | - /* SB-X270 uses GPIO105 as SD power enable */ | |
482 | - pxa_gpio_mode(105 | GPIO_OUT); | |
631 | + gpio_direction_output(GPIO105_MMC_POWER, 0); | |
483 | 632 | |
484 | - /* card detect IRQ on GPIO 83 */ | |
485 | - pxa_gpio_mode(IRQ_TO_GPIO(CMX270_MMC_IRQ)); | |
486 | - | |
487 | 633 | err = request_irq(CMX270_MMC_IRQ, cmx270_detect_int, |
488 | 634 | IRQF_DISABLED | IRQF_TRIGGER_FALLING, |
489 | 635 | "MMC card detect", data); |
490 | - if (err) | |
491 | - printk(KERN_ERR "cmx270_mci_init: MMC/SD: can't" | |
492 | - " request MMC card detect IRQ\n"); | |
636 | + if (err) { | |
637 | + gpio_free(GPIO105_MMC_POWER); | |
638 | + dev_err(dev, "cmx270_mci_init: MMC/SD: can't" | |
639 | + " request MMC card detect IRQ\n"); | |
640 | + } | |
493 | 641 | |
494 | 642 | return err; |
495 | 643 | } |
496 | 644 | |
497 | 645 | |
... | ... | @@ -499,17 +647,18 @@ |
499 | 647 | struct pxamci_platform_data *p_d = dev->platform_data; |
500 | 648 | |
501 | 649 | if ((1 << vdd) & p_d->ocr_mask) { |
502 | - printk(KERN_DEBUG "%s: on\n", __func__); | |
503 | - GPCR(105) = GPIO_bit(105); | |
650 | + dev_dbg(dev, "power on\n"); | |
651 | + gpio_set_value(GPIO105_MMC_POWER, 0); | |
504 | 652 | } else { |
505 | - GPSR(105) = GPIO_bit(105); | |
506 | - printk(KERN_DEBUG "%s: off\n", __func__); | |
653 | + gpio_set_value(GPIO105_MMC_POWER, 1); | |
654 | + dev_dbg(dev, "power off\n"); | |
507 | 655 | } |
508 | 656 | } |
509 | 657 | |
510 | 658 | static void cmx270_mci_exit(struct device *dev, void *data) |
511 | 659 | { |
512 | 660 | free_irq(CMX270_MMC_IRQ, data); |
661 | + gpio_free(GPIO105_MMC_POWER); | |
513 | 662 | } |
514 | 663 | |
515 | 664 | static struct pxamci_platform_data cmx270_mci_platform_data = { |
... | ... | @@ -519,6 +668,14 @@ |
519 | 668 | .exit = cmx270_mci_exit, |
520 | 669 | }; |
521 | 670 | |
671 | +static void __init cmx270_init_mmc(void) | |
672 | +{ | |
673 | + pxa_set_mci_info(&cmx270_mci_platform_data); | |
674 | +} | |
675 | +#else | |
676 | +static inline void cmx270_init_mmc(void) {} | |
677 | +#endif | |
678 | + | |
522 | 679 | #ifdef CONFIG_PM |
523 | 680 | static unsigned long sleep_save_msc[10]; |
524 | 681 | |
525 | 682 | |
526 | 683 | |
527 | 684 | |
528 | 685 | |
529 | 686 | |
530 | 687 | |
531 | 688 | |
532 | 689 | |
533 | 690 | |
... | ... | @@ -580,53 +737,63 @@ |
580 | 737 | static int __init cmx270_pm_init(void) { return 0; } |
581 | 738 | #endif |
582 | 739 | |
740 | +#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE) | |
741 | +static void __init cmx270_init_ac97(void) | |
742 | +{ | |
743 | + pxa_set_ac97_info(NULL); | |
744 | +} | |
745 | +#else | |
746 | +static inline void cmx270_init_ac97(void) {} | |
747 | +#endif | |
748 | + | |
583 | 749 | static void __init cmx270_init(void) |
584 | 750 | { |
585 | 751 | cmx270_pm_init(); |
586 | 752 | |
587 | - set_pxa_fb_info(cmx270_display); | |
753 | + pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_pin_config)); | |
588 | 754 | |
589 | - /* register CM-X270 platform devices */ | |
590 | - platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | |
591 | - pxa_set_ac97_info(NULL); | |
592 | - | |
593 | - /* set MCI and OHCI platform parameters */ | |
594 | - pxa_set_mci_info(&cmx270_mci_platform_data); | |
595 | - pxa_set_ohci_info(&cmx270_ohci_platform_data); | |
596 | - | |
597 | - /* This enables the STUART */ | |
598 | - pxa_gpio_mode(GPIO46_STRXD_MD); | |
599 | - pxa_gpio_mode(GPIO47_STTXD_MD); | |
600 | - | |
601 | - /* This enables the BTUART */ | |
602 | - pxa_gpio_mode(GPIO42_BTRXD_MD); | |
603 | - pxa_gpio_mode(GPIO43_BTTXD_MD); | |
604 | - pxa_gpio_mode(GPIO44_BTCTS_MD); | |
605 | - pxa_gpio_mode(GPIO45_BTRTS_MD); | |
755 | + cmx270_init_dm9000(); | |
756 | + cmx270_init_rtc(); | |
757 | + cmx270_init_display(); | |
758 | + cmx270_init_mmc(); | |
759 | + cmx270_init_ohci(); | |
760 | + cmx270_init_ac97(); | |
761 | + cmx270_init_touchscreen(); | |
762 | + cmx270_init_leds(); | |
763 | + cmx270_init_2700G(); | |
606 | 764 | } |
607 | 765 | |
608 | 766 | static void __init cmx270_init_irq(void) |
609 | 767 | { |
610 | 768 | pxa27x_init_irq(); |
611 | 769 | |
770 | + cmx270_pci_init_irq(GPIO22_IT8152_IRQ); | |
771 | +} | |
612 | 772 | |
613 | - cmx270_pci_init_irq(); | |
773 | +#ifdef CONFIG_PCI | |
774 | +/* Map PCI companion statically */ | |
775 | +static struct map_desc cmx270_io_desc[] __initdata = { | |
776 | + [0] = { /* PCI bridge */ | |
777 | + .virtual = CMX270_IT8152_VIRT, | |
778 | + .pfn = __phys_to_pfn(PXA_CS4_PHYS), | |
779 | + .length = SZ_64M, | |
780 | + .type = MT_DEVICE | |
781 | + }, | |
782 | +}; | |
614 | 783 | |
615 | - /* Setup interrupt for dm9000 */ | |
616 | - pxa_gpio_mode(IRQ_TO_GPIO(CMX270_ETHIRQ)); | |
617 | - set_irq_type(CMX270_ETHIRQ, IRQT_RISING); | |
784 | +static void __init cmx270_map_io(void) | |
785 | +{ | |
786 | + pxa_map_io(); | |
787 | + iotable_init(cmx270_io_desc, ARRAY_SIZE(cmx270_io_desc)); | |
618 | 788 | |
619 | - /* Setup interrupt for 2700G */ | |
620 | - pxa_gpio_mode(IRQ_TO_GPIO(CMX270_GFXIRQ)); | |
621 | - set_irq_type(CMX270_GFXIRQ, IRQT_FALLING); | |
789 | + it8152_base_address = CMX270_IT8152_VIRT; | |
622 | 790 | } |
623 | - | |
791 | +#else | |
624 | 792 | static void __init cmx270_map_io(void) |
625 | 793 | { |
626 | 794 | pxa_map_io(); |
627 | - iotable_init(cmx270_io_desc, ARRAY_SIZE(cmx270_io_desc)); | |
628 | 795 | } |
629 | - | |
796 | +#endif | |
630 | 797 | |
631 | 798 | MACHINE_START(ARMCORE, "Compulab CM-x270") |
632 | 799 | .boot_params = 0xa0000100, |