diff options
author | Mike Rapoport <mike@compulab.co.il> | 2008-06-17 07:29:58 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-07-09 16:33:49 -0400 |
commit | 2f01a973729712c373ccc8acde4d218c38f3029a (patch) | |
tree | 518df9858b10df19f15e30468e8ebf4915da3d0d /arch | |
parent | 3c85bce6f820258b49bb74c53d2f47c058199f1b (diff) |
[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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-pxa/cm-x270-pci.c | 27 | ||||
-rw-r--r-- | arch/arm/mach-pxa/cm-x270-pci.h | 14 | ||||
-rw-r--r-- | arch/arm/mach-pxa/cm-x270.c | 405 |
3 files changed, 307 insertions, 139 deletions
diff --git a/arch/arm/mach-pxa/cm-x270-pci.c b/arch/arm/mach-pxa/cm-x270-pci.c index 319c9ff3ab9a..bcf0cde6ccc9 100644 --- a/arch/arm/mach-pxa/cm-x270-pci.c +++ b/arch/arm/mach-pxa/cm-x270-pci.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Bits taken from various places. | 6 | * Bits taken from various places. |
7 | * | 7 | * |
8 | * Copyright (C) 2007 Compulab, Ltd. | 8 | * Copyright (C) 2007, 2008 Compulab, Ltd. |
9 | * Mike Rapoport <mike@compulab.co.il> | 9 | * Mike Rapoport <mike@compulab.co.il> |
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
@@ -19,16 +19,16 @@ | |||
19 | #include <linux/device.h> | 19 | #include <linux/device.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
22 | #include <linux/gpio.h> | ||
22 | 23 | ||
23 | #include <asm/mach/pci.h> | 24 | #include <asm/mach/pci.h> |
24 | #include <asm/arch/cm-x270.h> | ||
25 | #include <asm/arch/pxa-regs.h> | 25 | #include <asm/arch/pxa-regs.h> |
26 | #include <asm/arch/pxa2xx-gpio.h> | ||
27 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
28 | 27 | ||
29 | #include <asm/hardware/it8152.h> | 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 | * Only first 64MB of memory can be accessed via PCI. | 34 | * Only first 64MB of memory can be accessed via PCI. |
@@ -42,7 +42,7 @@ void __init cmx270_pci_adjust_zones(int node, unsigned long *zone_size, | |||
42 | unsigned int sz = SZ_64M >> PAGE_SHIFT; | 42 | unsigned int sz = SZ_64M >> PAGE_SHIFT; |
43 | 43 | ||
44 | if (machine_is_armcore()) { | 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 | * Only adjust if > 64M on current system | 48 | * Only adjust if > 64M on current system |
@@ -60,19 +60,20 @@ void __init cmx270_pci_adjust_zones(int node, unsigned long *zone_size, | |||
60 | static void cmx270_it8152_irq_demux(unsigned int irq, struct irq_desc *desc) | 60 | static void cmx270_it8152_irq_demux(unsigned int irq, struct irq_desc *desc) |
61 | { | 61 | { |
62 | /* clear our parent irq */ | 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 | it8152_irq_demux(irq, desc); | 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 | it8152_init_irq(); | 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), | 72 | cmx270_it8152_irq_gpio = irq_gpio; |
75 | cmx270_it8152_irq_demux); | 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 | #ifdef CONFIG_PM | 79 | #ifdef CONFIG_PM |
@@ -115,8 +116,8 @@ static int __init cmx270_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | |||
115 | 116 | ||
116 | /* | 117 | /* |
117 | Here comes the ugly part. The routing is baseboard specific, | 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 | but defining a platform for each possible base of CM-X270 is |
119 | unrealistic. Here we keep mapping for ATXBase and SB-x270. | 120 | unrealistic. Here we keep mapping for ATXBase and SB-X270. |
120 | */ | 121 | */ |
121 | /* ATXBASE PCI slot */ | 122 | /* ATXBASE PCI slot */ |
122 | if (slot == 7) | 123 | if (slot == 7) |
diff --git a/arch/arm/mach-pxa/cm-x270-pci.h b/arch/arm/mach-pxa/cm-x270-pci.h index ffe37b66f9a0..48f532f4cb51 100644 --- a/arch/arm/mach-pxa/cm-x270-pci.h +++ b/arch/arm/mach-pxa/cm-x270-pci.h | |||
@@ -1,13 +1,13 @@ | |||
1 | extern void __cmx270_pci_init_irq(void); | 1 | extern void __cmx270_pci_init_irq(int irq_gpio); |
2 | extern void __cmx270_pci_suspend(void); | 2 | extern void __cmx270_pci_suspend(void); |
3 | extern void __cmx270_pci_resume(void); | 3 | extern void __cmx270_pci_resume(void); |
4 | 4 | ||
5 | #ifdef CONFIG_PCI | 5 | #ifdef CONFIG_PCI |
6 | #define cmx270_pci_init_irq __cmx270_pci_init_irq | 6 | #define cmx270_pci_init_irq(x) __cmx270_pci_init_irq(x) |
7 | #define cmx270_pci_suspend __cmx270_pci_suspend | 7 | #define cmx270_pci_suspend(x) __cmx270_pci_suspend(x) |
8 | #define cmx270_pci_resume __cmx270_pci_resume | 8 | #define cmx270_pci_resume(x) __cmx270_pci_resume(x) |
9 | #else | 9 | #else |
10 | #define cmx270_pci_init_irq() do {} while (0) | 10 | #define cmx270_pci_init_irq(x) do {} while (0) |
11 | #define cmx270_pci_suspend() do {} while (0) | 11 | #define cmx270_pci_suspend(x) do {} while (0) |
12 | #define cmx270_pci_resume() do {} while (0) | 12 | #define cmx270_pci_resume(x) do {} while (0) |
13 | #endif | 13 | #endif |
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c index b3c3fd72d045..402e807eae54 100644 --- a/arch/arm/mach-pxa/cm-x270.c +++ b/arch/arm/mach-pxa/cm-x270.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/mach-pxa/cm-x270.c | 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 | * Mike Rapoport <mike@compulab.co.il> | 5 | * Mike Rapoport <mike@compulab.co.il> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
@@ -9,44 +9,156 @@ | |||
9 | * published by the Free Software Foundation. | 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 | #include <linux/platform_device.h> | 12 | #include <linux/platform_device.h> |
16 | #include <linux/irq.h> | ||
17 | #include <linux/sysdev.h> | 13 | #include <linux/sysdev.h> |
18 | #include <linux/io.h> | 14 | #include <linux/irq.h> |
19 | #include <linux/delay.h> | 15 | #include <linux/gpio.h> |
20 | 16 | ||
21 | #include <linux/dm9000.h> | 17 | #include <linux/dm9000.h> |
22 | #include <linux/rtc-v3020.h> | 18 | #include <linux/rtc-v3020.h> |
23 | #include <linux/serial_8250.h> | ||
24 | |||
25 | #include <video/mbxfb.h> | 19 | #include <video/mbxfb.h> |
20 | #include <linux/leds.h> | ||
26 | 21 | ||
27 | #include <asm/mach/arch.h> | 22 | #include <asm/mach/arch.h> |
28 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
29 | #include <asm/mach/map.h> | 24 | #include <asm/mach/map.h> |
30 | 25 | ||
31 | #include <asm/arch/pxa-regs.h> | ||
32 | #include <asm/arch/pxa2xx-regs.h> | 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 | #include <asm/arch/audio.h> | 29 | #include <asm/arch/audio.h> |
35 | #include <asm/arch/pxafb.h> | 30 | #include <asm/arch/pxafb.h> |
36 | #include <asm/arch/ohci.h> | 31 | #include <asm/arch/ohci.h> |
37 | #include <asm/arch/mmc.h> | 32 | #include <asm/arch/mmc.h> |
38 | #include <asm/arch/bitfield.h> | 33 | #include <asm/arch/bitfield.h> |
39 | #include <asm/arch/cm-x270.h> | ||
40 | 34 | ||
41 | #include <asm/hardware/it8152.h> | 35 | #include <asm/hardware/it8152.h> |
42 | 36 | ||
43 | #include "generic.h" | 37 | #include "generic.h" |
44 | #include "cm-x270-pci.h" | 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 | #define RTC_PHYS_BASE (PXA_CS1_PHYS + (5 << 22)) | 44 | #define RTC_PHYS_BASE (PXA_CS1_PHYS + (5 << 22)) |
47 | #define DM9000_PHYS_BASE (PXA_CS1_PHYS + (6 << 22)) | 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 | [0] = { | 162 | [0] = { |
51 | .start = DM9000_PHYS_BASE, | 163 | .start = DM9000_PHYS_BASE, |
52 | .end = DM9000_PHYS_BASE + 4, | 164 | .end = DM9000_PHYS_BASE + 4, |
@@ -60,35 +172,49 @@ static struct resource cmx270_dm9k_resource[] = { | |||
60 | [2] = { | 172 | [2] = { |
61 | .start = CMX270_ETHIRQ, | 173 | .start = CMX270_ETHIRQ, |
62 | .end = CMX270_ETHIRQ, | 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 | 179 | static struct dm9000_plat_data cmx270_dm9000_platdata = { |
68 | * better IO routines can be written and tested | ||
69 | */ | ||
70 | static struct dm9000_plat_data cmx270_dm9k_platdata = { | ||
71 | .flags = DM9000_PLATF_32BITONLY, | 180 | .flags = DM9000_PLATF_32BITONLY, |
72 | }; | 181 | }; |
73 | 182 | ||
74 | /* Ethernet device */ | 183 | static struct platform_device cmx270_dm9000_device = { |
75 | static struct platform_device cmx270_device_dm9k = { | ||
76 | .name = "dm9000", | 184 | .name = "dm9000", |
77 | .id = 0, | 185 | .id = 0, |
78 | .num_resources = ARRAY_SIZE(cmx270_dm9k_resource), | 186 | .num_resources = ARRAY_SIZE(cmx270_dm9000_resource), |
79 | .resource = cmx270_dm9k_resource, | 187 | .resource = cmx270_dm9000_resource, |
80 | .dev = { | 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 | static struct platform_device cmx270_ts_device = { | 203 | static struct platform_device cmx270_ts_device = { |
87 | .name = "ucb1400_ts", | 204 | .name = "ucb1400_ts", |
88 | .id = -1, | 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 | static struct resource cmx270_v3020_resource[] = { | 218 | static struct resource cmx270_v3020_resource[] = { |
93 | [0] = { | 219 | [0] = { |
94 | .start = RTC_PHYS_BASE, | 220 | .start = RTC_PHYS_BASE, |
@@ -111,28 +237,67 @@ static struct platform_device cmx270_rtc_device = { | |||
111 | } | 237 | } |
112 | }; | 238 | }; |
113 | 239 | ||
114 | /* | 240 | static void __init cmx270_init_rtc(void) |
115 | * CM-X270 LEDs | 241 | { |
116 | */ | 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 | static struct platform_device cmx270_led_device = { | 270 | static struct platform_device cmx270_led_device = { |
118 | .name = "cm-x270-led", | 271 | .name = "leds-gpio", |
119 | .id = -1, | 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 | /* 2700G graphics */ | 286 | /* 2700G graphics */ |
287 | #if defined(CONFIG_FB_MBX) || defined(CONFIG_FB_MBX_MODULE) | ||
123 | static u64 fb_dma_mask = ~(u64)0; | 288 | static u64 fb_dma_mask = ~(u64)0; |
124 | 289 | ||
125 | static struct resource cmx270_2700G_resource[] = { | 290 | static struct resource cmx270_2700G_resource[] = { |
126 | /* frame buffer memory including ODFB and External SDRAM */ | 291 | /* frame buffer memory including ODFB and External SDRAM */ |
127 | [0] = { | 292 | [0] = { |
128 | .start = MARATHON_PHYS, | 293 | .start = PXA_CS2_PHYS, |
129 | .end = MARATHON_PHYS + 0x02000000, | 294 | .end = PXA_CS2_PHYS + 0x01ffffff, |
130 | .flags = IORESOURCE_MEM, | 295 | .flags = IORESOURCE_MEM, |
131 | }, | 296 | }, |
132 | /* Marathon registers */ | 297 | /* Marathon registers */ |
133 | [1] = { | 298 | [1] = { |
134 | .start = MARATHON_PHYS + 0x03fe0000, | 299 | .start = PXA_CS2_PHYS + 0x03fe0000, |
135 | .end = MARATHON_PHYS + 0x03ffffff, | 300 | .end = PXA_CS2_PHYS + 0x03ffffff, |
136 | .flags = IORESOURCE_MEM, | 301 | .flags = IORESOURCE_MEM, |
137 | }, | 302 | }, |
138 | }; | 303 | }; |
@@ -200,43 +365,15 @@ static struct platform_device cmx270_2700G = { | |||
200 | .id = -1, | 365 | .id = -1, |
201 | }; | 366 | }; |
202 | 367 | ||
203 | static u64 ata_dma_mask = ~(u64)0; | 368 | static void __init cmx270_init_2700G(void) |
204 | 369 | { | |
205 | static struct platform_device cmx270_ata = { | 370 | platform_device_register(&cmx270_2700G); |
206 | .name = "pata_cm_x270", | 371 | } |
207 | .id = -1, | 372 | #else |
208 | .dev = { | 373 | static inline void cmx270_init_2700G(void) {} |
209 | .dma_mask = &ata_dma_mask, | 374 | #endif |
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 | 375 | ||
376 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | ||
240 | /* | 377 | /* |
241 | Display definitions | 378 | Display definitions |
242 | keep these for backwards compatibility, although symbolic names (as | 379 | keep these for backwards compatibility, although symbolic names (as |
@@ -446,7 +583,16 @@ static int __init cmx270_set_display(char *str) | |||
446 | */ | 583 | */ |
447 | __setup("monitor=", cmx270_set_display); | 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 | /* PXA27x OHCI controller setup */ | 594 | /* PXA27x OHCI controller setup */ |
595 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
450 | static int cmx270_ohci_init(struct device *dev) | 596 | static int cmx270_ohci_init(struct device *dev) |
451 | { | 597 | { |
452 | /* Set the Power Control Polarity Low */ | 598 | /* Set the Power Control Polarity Low */ |
@@ -461,35 +607,37 @@ static struct pxaohci_platform_data cmx270_ohci_platform_data = { | |||
461 | .init = cmx270_ohci_init, | 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 | static int cmx270_mci_init(struct device *dev, | 619 | static int cmx270_mci_init(struct device *dev, |
466 | irq_handler_t cmx270_detect_int, | 620 | irq_handler_t cmx270_detect_int, |
467 | void *data) | 621 | void *data) |
468 | { | 622 | { |
469 | int err; | 623 | int err; |
470 | 624 | ||
471 | /* | 625 | err = gpio_request(GPIO105_MMC_POWER, "MMC/SD power"); |
472 | * setup GPIO for PXA27x MMC controller | 626 | if (err) { |
473 | */ | 627 | dev_warn(dev, "power gpio unavailable\n"); |
474 | pxa_gpio_mode(GPIO32_MMCCLK_MD); | 628 | return err; |
475 | pxa_gpio_mode(GPIO112_MMCCMD_MD); | 629 | } |
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); | ||
480 | |||
481 | /* SB-X270 uses GPIO105 as SD power enable */ | ||
482 | pxa_gpio_mode(105 | GPIO_OUT); | ||
483 | 630 | ||
484 | /* card detect IRQ on GPIO 83 */ | 631 | gpio_direction_output(GPIO105_MMC_POWER, 0); |
485 | pxa_gpio_mode(IRQ_TO_GPIO(CMX270_MMC_IRQ)); | ||
486 | 632 | ||
487 | err = request_irq(CMX270_MMC_IRQ, cmx270_detect_int, | 633 | err = request_irq(CMX270_MMC_IRQ, cmx270_detect_int, |
488 | IRQF_DISABLED | IRQF_TRIGGER_FALLING, | 634 | IRQF_DISABLED | IRQF_TRIGGER_FALLING, |
489 | "MMC card detect", data); | 635 | "MMC card detect", data); |
490 | if (err) | 636 | if (err) { |
491 | printk(KERN_ERR "cmx270_mci_init: MMC/SD: can't" | 637 | gpio_free(GPIO105_MMC_POWER); |
492 | " request MMC card detect IRQ\n"); | 638 | dev_err(dev, "cmx270_mci_init: MMC/SD: can't" |
639 | " request MMC card detect IRQ\n"); | ||
640 | } | ||
493 | 641 | ||
494 | return err; | 642 | return err; |
495 | } | 643 | } |
@@ -499,17 +647,18 @@ static void cmx270_mci_setpower(struct device *dev, unsigned int vdd) | |||
499 | struct pxamci_platform_data *p_d = dev->platform_data; | 647 | struct pxamci_platform_data *p_d = dev->platform_data; |
500 | 648 | ||
501 | if ((1 << vdd) & p_d->ocr_mask) { | 649 | if ((1 << vdd) & p_d->ocr_mask) { |
502 | printk(KERN_DEBUG "%s: on\n", __func__); | 650 | dev_dbg(dev, "power on\n"); |
503 | GPCR(105) = GPIO_bit(105); | 651 | gpio_set_value(GPIO105_MMC_POWER, 0); |
504 | } else { | 652 | } else { |
505 | GPSR(105) = GPIO_bit(105); | 653 | gpio_set_value(GPIO105_MMC_POWER, 1); |
506 | printk(KERN_DEBUG "%s: off\n", __func__); | 654 | dev_dbg(dev, "power off\n"); |
507 | } | 655 | } |
508 | } | 656 | } |
509 | 657 | ||
510 | static void cmx270_mci_exit(struct device *dev, void *data) | 658 | static void cmx270_mci_exit(struct device *dev, void *data) |
511 | { | 659 | { |
512 | free_irq(CMX270_MMC_IRQ, data); | 660 | free_irq(CMX270_MMC_IRQ, data); |
661 | gpio_free(GPIO105_MMC_POWER); | ||
513 | } | 662 | } |
514 | 663 | ||
515 | static struct pxamci_platform_data cmx270_mci_platform_data = { | 664 | static struct pxamci_platform_data cmx270_mci_platform_data = { |
@@ -519,6 +668,14 @@ static struct pxamci_platform_data cmx270_mci_platform_data = { | |||
519 | .exit = cmx270_mci_exit, | 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 | #ifdef CONFIG_PM | 679 | #ifdef CONFIG_PM |
523 | static unsigned long sleep_save_msc[10]; | 680 | static unsigned long sleep_save_msc[10]; |
524 | 681 | ||
@@ -580,53 +737,63 @@ static int __init cmx270_pm_init(void) | |||
580 | static int __init cmx270_pm_init(void) { return 0; } | 737 | static int __init cmx270_pm_init(void) { return 0; } |
581 | #endif | 738 | #endif |
582 | 739 | ||
583 | static void __init cmx270_init(void) | 740 | #if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE) |
741 | static void __init cmx270_init_ac97(void) | ||
584 | { | 742 | { |
585 | cmx270_pm_init(); | ||
586 | |||
587 | set_pxa_fb_info(cmx270_display); | ||
588 | |||
589 | /* register CM-X270 platform devices */ | ||
590 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | ||
591 | pxa_set_ac97_info(NULL); | 743 | pxa_set_ac97_info(NULL); |
744 | } | ||
745 | #else | ||
746 | static inline void cmx270_init_ac97(void) {} | ||
747 | #endif | ||
592 | 748 | ||
593 | /* set MCI and OHCI platform parameters */ | 749 | static void __init cmx270_init(void) |
594 | pxa_set_mci_info(&cmx270_mci_platform_data); | 750 | { |
595 | pxa_set_ohci_info(&cmx270_ohci_platform_data); | 751 | cmx270_pm_init(); |
596 | |||
597 | /* This enables the STUART */ | ||
598 | pxa_gpio_mode(GPIO46_STRXD_MD); | ||
599 | pxa_gpio_mode(GPIO47_STTXD_MD); | ||
600 | 752 | ||
601 | /* This enables the BTUART */ | 753 | pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_pin_config)); |
602 | pxa_gpio_mode(GPIO42_BTRXD_MD); | 754 | |
603 | pxa_gpio_mode(GPIO43_BTTXD_MD); | 755 | cmx270_init_dm9000(); |
604 | pxa_gpio_mode(GPIO44_BTCTS_MD); | 756 | cmx270_init_rtc(); |
605 | pxa_gpio_mode(GPIO45_BTRTS_MD); | 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 | static void __init cmx270_init_irq(void) | 766 | static void __init cmx270_init_irq(void) |
609 | { | 767 | { |
610 | pxa27x_init_irq(); | 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 */ | 784 | static void __init cmx270_map_io(void) |
616 | pxa_gpio_mode(IRQ_TO_GPIO(CMX270_ETHIRQ)); | 785 | { |
617 | set_irq_type(CMX270_ETHIRQ, IRQT_RISING); | 786 | pxa_map_io(); |
787 | iotable_init(cmx270_io_desc, ARRAY_SIZE(cmx270_io_desc)); | ||
618 | 788 | ||
619 | /* Setup interrupt for 2700G */ | 789 | it8152_base_address = CMX270_IT8152_VIRT; |
620 | pxa_gpio_mode(IRQ_TO_GPIO(CMX270_GFXIRQ)); | ||
621 | set_irq_type(CMX270_GFXIRQ, IRQT_FALLING); | ||
622 | } | 790 | } |
623 | 791 | #else | |
624 | static void __init cmx270_map_io(void) | 792 | static void __init cmx270_map_io(void) |
625 | { | 793 | { |
626 | pxa_map_io(); | 794 | pxa_map_io(); |
627 | iotable_init(cmx270_io_desc, ARRAY_SIZE(cmx270_io_desc)); | ||
628 | } | 795 | } |
629 | 796 | #endif | |
630 | 797 | ||
631 | MACHINE_START(ARMCORE, "Compulab CM-x270") | 798 | MACHINE_START(ARMCORE, "Compulab CM-x270") |
632 | .boot_params = 0xa0000100, | 799 | .boot_params = 0xa0000100, |