diff options
author | Edwin Peer <epeer@tmtservices.co.za> | 2010-02-05 11:31:48 -0500 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2010-03-01 18:40:51 -0500 |
commit | 1f3b536be7bfb3930cf7dc6d995d82877f25d6cf (patch) | |
tree | 96f7732bc2858e2e60cf307f9b49d7da2ac6a40b | |
parent | 0dc726bb264ca5ecfdfab94a6937e0e9b9b26f64 (diff) |
[ARM] pxa: add support for Embedian MXM-8x10
Signed-off-by: Edwin Peer <epeer@tmtservices.co.za>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
-rw-r--r-- | arch/arm/mach-pxa/Kconfig | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/capc7117.c | 158 | ||||
-rw-r--r-- | arch/arm/mach-pxa/icontrol.c | 202 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/mxm8x10.h | 21 | ||||
-rw-r--r-- | arch/arm/mach-pxa/mxm8x10.c | 474 |
6 files changed, 867 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index ff05f0ff2205..3602c729b89a 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -115,6 +115,11 @@ config MACH_CM_X300 | |||
115 | select CPU_PXA310 | 115 | select CPU_PXA310 |
116 | select HAVE_PWM | 116 | select HAVE_PWM |
117 | 117 | ||
118 | config MACH_CAPC7117 | ||
119 | bool "Embedian CAPC-7117 evaluation kit based on the MXM-8x10 CoM" | ||
120 | select CPU_PXA320 | ||
121 | select PXA3xx | ||
122 | |||
118 | config ARCH_GUMSTIX | 123 | config ARCH_GUMSTIX |
119 | bool "Gumstix XScale 255 boards" | 124 | bool "Gumstix XScale 255 boards" |
120 | select PXA25x | 125 | select PXA25x |
@@ -511,6 +516,11 @@ config MACH_TOSA | |||
511 | select PXA25x | 516 | select PXA25x |
512 | select PXA_HAVE_BOARD_IRQS | 517 | select PXA_HAVE_BOARD_IRQS |
513 | 518 | ||
519 | config MACH_ICONTROL | ||
520 | bool "TMT iControl/SafeTCam based on the MXM-8x10 CoM" | ||
521 | select CPU_PXA320 | ||
522 | select PXA3xx | ||
523 | |||
514 | config ARCH_PXA_ESERIES | 524 | config ARCH_PXA_ESERIES |
515 | bool "PXA based Toshiba e-series PDAs" | 525 | bool "PXA based Toshiba e-series PDAs" |
516 | select PXA25x | 526 | select PXA25x |
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 9d831939b3c5..86bc87b7f2dd 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -48,6 +48,7 @@ obj-$(CONFIG_MACH_ARMCORE) += cm-x2xx-pci.o | |||
48 | endif | 48 | endif |
49 | obj-$(CONFIG_MACH_EM_X270) += em-x270.o | 49 | obj-$(CONFIG_MACH_EM_X270) += em-x270.o |
50 | obj-$(CONFIG_MACH_CM_X300) += cm-x300.o | 50 | obj-$(CONFIG_MACH_CM_X300) += cm-x300.o |
51 | obj-$(CONFIG_MACH_CAPC7117) += capc7117.o mxm8x10.o | ||
51 | obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o | 52 | obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o |
52 | obj-$(CONFIG_GUMSTIX_AM200EPD) += am200epd.o | 53 | obj-$(CONFIG_GUMSTIX_AM200EPD) += am200epd.o |
53 | obj-$(CONFIG_GUMSTIX_AM300EPD) += am300epd.o | 54 | obj-$(CONFIG_GUMSTIX_AM300EPD) += am300epd.o |
@@ -82,6 +83,7 @@ obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o sharpsl_pm.o spitz_pm.o | |||
82 | obj-$(CONFIG_CORGI_SSP_DEPRECATED) += corgi_ssp.o corgi_lcd.o | 83 | obj-$(CONFIG_CORGI_SSP_DEPRECATED) += corgi_ssp.o corgi_lcd.o |
83 | obj-$(CONFIG_MACH_POODLE) += poodle.o | 84 | obj-$(CONFIG_MACH_POODLE) += poodle.o |
84 | obj-$(CONFIG_MACH_TOSA) += tosa.o | 85 | obj-$(CONFIG_MACH_TOSA) += tosa.o |
86 | obj-$(CONFIG_MACH_ICONTROL) += icontrol.o mxm8x10.o | ||
85 | obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o | 87 | obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o |
86 | obj-$(CONFIG_MACH_E330) += e330.o | 88 | obj-$(CONFIG_MACH_E330) += e330.o |
87 | obj-$(CONFIG_MACH_E350) += e350.o | 89 | obj-$(CONFIG_MACH_E350) += e350.o |
diff --git a/arch/arm/mach-pxa/capc7117.c b/arch/arm/mach-pxa/capc7117.c new file mode 100644 index 000000000000..aae544631a8b --- /dev/null +++ b/arch/arm/mach-pxa/capc7117.c | |||
@@ -0,0 +1,158 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/capc7117.c | ||
3 | * | ||
4 | * Support for the Embedian CAPC-7117 Evaluation Kit | ||
5 | * based on the Embedian MXM-8x10 Computer on Module | ||
6 | * | ||
7 | * Copyright (C) 2009 Embedian Inc. | ||
8 | * Copyright (C) 2009 TMT Services & Supplies (Pty) Ltd. | ||
9 | * | ||
10 | * 2007-09-04: eric miao <eric.y.miao@gmail.com> | ||
11 | * rewrite to align with latest kernel | ||
12 | * | ||
13 | * 2010-01-09: Edwin Peer <epeer@tmtservices.co.za> | ||
14 | * Hennie van der Merwe <hvdmerwe@tmtservices.co.za> | ||
15 | * rework for upstream merge | ||
16 | * | ||
17 | * This program is free software; you can redistribute it and/or modify | ||
18 | * it under the terms of the GNU General Public License version 2 as | ||
19 | * published by the Free Software Foundation. | ||
20 | */ | ||
21 | |||
22 | #include <linux/irq.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/ata_platform.h> | ||
25 | #include <linux/serial_8250.h> | ||
26 | #include <linux/gpio.h> | ||
27 | |||
28 | #include <asm/mach-types.h> | ||
29 | #include <asm/mach/arch.h> | ||
30 | |||
31 | #include <mach/pxa320.h> | ||
32 | #include <mach/mxm8x10.h> | ||
33 | |||
34 | #include "generic.h" | ||
35 | |||
36 | /* IDE (PATA) Support */ | ||
37 | static struct pata_platform_info pata_platform_data = { | ||
38 | .ioport_shift = 1 | ||
39 | }; | ||
40 | |||
41 | static struct resource capc7117_ide_resources[] = { | ||
42 | [0] = { | ||
43 | .start = 0x11000020, | ||
44 | .end = 0x1100003f, | ||
45 | .flags = IORESOURCE_MEM | ||
46 | }, | ||
47 | [1] = { | ||
48 | .start = 0x1100001c, | ||
49 | .end = 0x1100001c, | ||
50 | .flags = IORESOURCE_MEM | ||
51 | }, | ||
52 | [2] = { | ||
53 | .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO76)), | ||
54 | .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO76)), | ||
55 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING | ||
56 | } | ||
57 | }; | ||
58 | |||
59 | static struct platform_device capc7117_ide_device = { | ||
60 | .name = "pata_platform", | ||
61 | .num_resources = ARRAY_SIZE(capc7117_ide_resources), | ||
62 | .resource = capc7117_ide_resources, | ||
63 | .dev = { | ||
64 | .platform_data = &pata_platform_data, | ||
65 | .coherent_dma_mask = ~0 /* grumble */ | ||
66 | } | ||
67 | }; | ||
68 | |||
69 | static void __init capc7117_ide_init(void) | ||
70 | { | ||
71 | platform_device_register(&capc7117_ide_device); | ||
72 | } | ||
73 | |||
74 | /* TI16C752 UART support */ | ||
75 | #define TI16C752_FLAGS (UPF_BOOT_AUTOCONF | \ | ||
76 | UPF_IOREMAP | \ | ||
77 | UPF_BUGGY_UART | \ | ||
78 | UPF_SKIP_TEST) | ||
79 | #define TI16C752_UARTCLK (22118400) | ||
80 | static struct plat_serial8250_port ti16c752_platform_data[] = { | ||
81 | [0] = { | ||
82 | .mapbase = 0x14000000, | ||
83 | .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO78)), | ||
84 | .irqflags = IRQF_TRIGGER_RISING, | ||
85 | .flags = TI16C752_FLAGS, | ||
86 | .iotype = UPIO_MEM, | ||
87 | .regshift = 1, | ||
88 | .uartclk = TI16C752_UARTCLK | ||
89 | }, | ||
90 | [1] = { | ||
91 | .mapbase = 0x14000040, | ||
92 | .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO79)), | ||
93 | .irqflags = IRQF_TRIGGER_RISING, | ||
94 | .flags = TI16C752_FLAGS, | ||
95 | .iotype = UPIO_MEM, | ||
96 | .regshift = 1, | ||
97 | .uartclk = TI16C752_UARTCLK | ||
98 | }, | ||
99 | [2] = { | ||
100 | .mapbase = 0x14000080, | ||
101 | .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO80)), | ||
102 | .irqflags = IRQF_TRIGGER_RISING, | ||
103 | .flags = TI16C752_FLAGS, | ||
104 | .iotype = UPIO_MEM, | ||
105 | .regshift = 1, | ||
106 | .uartclk = TI16C752_UARTCLK | ||
107 | }, | ||
108 | [3] = { | ||
109 | .mapbase = 0x140000c0, | ||
110 | .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO81)), | ||
111 | .irqflags = IRQF_TRIGGER_RISING, | ||
112 | .flags = TI16C752_FLAGS, | ||
113 | .iotype = UPIO_MEM, | ||
114 | .regshift = 1, | ||
115 | .uartclk = TI16C752_UARTCLK | ||
116 | }, | ||
117 | [4] = { | ||
118 | /* end of array */ | ||
119 | } | ||
120 | }; | ||
121 | |||
122 | static struct platform_device ti16c752_device = { | ||
123 | .name = "serial8250", | ||
124 | .id = PLAT8250_DEV_PLATFORM, | ||
125 | .dev = { | ||
126 | .platform_data = ti16c752_platform_data | ||
127 | } | ||
128 | }; | ||
129 | |||
130 | static void __init capc7117_uarts_init(void) | ||
131 | { | ||
132 | platform_device_register(&ti16c752_device); | ||
133 | } | ||
134 | |||
135 | static void __init capc7117_init(void) | ||
136 | { | ||
137 | /* Init CoM */ | ||
138 | mxm_8x10_barebones_init(); | ||
139 | |||
140 | /* Init evaluation board peripherals */ | ||
141 | mxm_8x10_ac97_init(); | ||
142 | mxm_8x10_usb_host_init(); | ||
143 | mxm_8x10_mmc_init(); | ||
144 | |||
145 | capc7117_uarts_init(); | ||
146 | capc7117_ide_init(); | ||
147 | } | ||
148 | |||
149 | MACHINE_START(CAPC7117, | ||
150 | "Embedian CAPC-7117 evaluation kit based on the MXM-8x10 CoM") | ||
151 | .phys_io = 0x40000000, | ||
152 | .boot_params = 0xa0000100, | ||
153 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | ||
154 | .map_io = pxa_map_io, | ||
155 | .init_irq = pxa3xx_init_irq, | ||
156 | .timer = &pxa_timer, | ||
157 | .init_machine = capc7117_init | ||
158 | MACHINE_END | ||
diff --git a/arch/arm/mach-pxa/icontrol.c b/arch/arm/mach-pxa/icontrol.c new file mode 100644 index 000000000000..771137fc1a82 --- /dev/null +++ b/arch/arm/mach-pxa/icontrol.c | |||
@@ -0,0 +1,202 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/icontrol.c | ||
3 | * | ||
4 | * Support for the iControl and SafeTcam platforms from TMT Services | ||
5 | * using the Embedian MXM-8x10 Computer on Module | ||
6 | * | ||
7 | * Copyright (C) 2009 TMT Services & Supplies (Pty) Ltd. | ||
8 | * | ||
9 | * 2010-01-21 Hennie van der Merve <hvdmerwe@tmtservies.co.za> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | #include <linux/irq.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/gpio.h> | ||
19 | |||
20 | #include <asm/mach-types.h> | ||
21 | #include <asm/mach/arch.h> | ||
22 | |||
23 | #include <mach/pxa320.h> | ||
24 | #include <mach/mxm8x10.h> | ||
25 | |||
26 | #include <linux/spi/spi.h> | ||
27 | #include <mach/pxa2xx_spi.h> | ||
28 | #include <linux/can/platform/mcp251x.h> | ||
29 | |||
30 | #include "generic.h" | ||
31 | |||
32 | #define ICONTROL_MCP251x_nCS1 (15) | ||
33 | #define ICONTROL_MCP251x_nCS2 (16) | ||
34 | #define ICONTROL_MCP251x_nCS3 (17) | ||
35 | #define ICONTROL_MCP251x_nCS4 (24) | ||
36 | |||
37 | #define ICONTROL_MCP251x_nIRQ1 (74) | ||
38 | #define ICONTROL_MCP251x_nIRQ2 (75) | ||
39 | #define ICONTROL_MCP251x_nIRQ3 (76) | ||
40 | #define ICONTROL_MCP251x_nIRQ4 (77) | ||
41 | |||
42 | static struct pxa2xx_spi_chip mcp251x_chip_info1 = { | ||
43 | .tx_threshold = 8, | ||
44 | .rx_threshold = 128, | ||
45 | .dma_burst_size = 8, | ||
46 | .timeout = 235, | ||
47 | .gpio_cs = ICONTROL_MCP251x_nCS1 | ||
48 | }; | ||
49 | |||
50 | static struct pxa2xx_spi_chip mcp251x_chip_info2 = { | ||
51 | .tx_threshold = 8, | ||
52 | .rx_threshold = 128, | ||
53 | .dma_burst_size = 8, | ||
54 | .timeout = 235, | ||
55 | .gpio_cs = ICONTROL_MCP251x_nCS2 | ||
56 | }; | ||
57 | |||
58 | static struct pxa2xx_spi_chip mcp251x_chip_info3 = { | ||
59 | .tx_threshold = 8, | ||
60 | .rx_threshold = 128, | ||
61 | .dma_burst_size = 8, | ||
62 | .timeout = 235, | ||
63 | .gpio_cs = ICONTROL_MCP251x_nCS3 | ||
64 | }; | ||
65 | |||
66 | static struct pxa2xx_spi_chip mcp251x_chip_info4 = { | ||
67 | .tx_threshold = 8, | ||
68 | .rx_threshold = 128, | ||
69 | .dma_burst_size = 8, | ||
70 | .timeout = 235, | ||
71 | .gpio_cs = ICONTROL_MCP251x_nCS4 | ||
72 | }; | ||
73 | |||
74 | static struct mcp251x_platform_data mcp251x_info = { | ||
75 | .oscillator_frequency = 16E6, | ||
76 | .model = CAN_MCP251X_MCP2515, | ||
77 | .board_specific_setup = NULL, | ||
78 | .power_enable = NULL, | ||
79 | .transceiver_enable = NULL | ||
80 | }; | ||
81 | |||
82 | static struct spi_board_info mcp251x_board_info[] = { | ||
83 | { | ||
84 | .modalias = "mcp251x", | ||
85 | .max_speed_hz = 6500000, | ||
86 | .bus_num = 3, | ||
87 | .chip_select = 0, | ||
88 | .platform_data = &mcp251x_info, | ||
89 | .controller_data = &mcp251x_chip_info1, | ||
90 | .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ1) | ||
91 | }, | ||
92 | { | ||
93 | .modalias = "mcp251x", | ||
94 | .max_speed_hz = 6500000, | ||
95 | .bus_num = 3, | ||
96 | .chip_select = 1, | ||
97 | .platform_data = &mcp251x_info, | ||
98 | .controller_data = &mcp251x_chip_info2, | ||
99 | .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ2) | ||
100 | }, | ||
101 | { | ||
102 | .modalias = "mcp251x", | ||
103 | .max_speed_hz = 6500000, | ||
104 | .bus_num = 4, | ||
105 | .chip_select = 0, | ||
106 | .platform_data = &mcp251x_info, | ||
107 | .controller_data = &mcp251x_chip_info3, | ||
108 | .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ3) | ||
109 | }, | ||
110 | { | ||
111 | .modalias = "mcp251x", | ||
112 | .max_speed_hz = 6500000, | ||
113 | .bus_num = 4, | ||
114 | .chip_select = 1, | ||
115 | .platform_data = &mcp251x_info, | ||
116 | .controller_data = &mcp251x_chip_info4, | ||
117 | .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ4) | ||
118 | } | ||
119 | }; | ||
120 | |||
121 | static struct pxa2xx_spi_master pxa_ssp3_spi_master_info = { | ||
122 | .clock_enable = CKEN_SSP3, | ||
123 | .num_chipselect = 2, | ||
124 | .enable_dma = 1 | ||
125 | }; | ||
126 | |||
127 | static struct pxa2xx_spi_master pxa_ssp4_spi_master_info = { | ||
128 | .clock_enable = CKEN_SSP4, | ||
129 | .num_chipselect = 2, | ||
130 | .enable_dma = 1 | ||
131 | }; | ||
132 | |||
133 | struct platform_device pxa_spi_ssp3 = { | ||
134 | .name = "pxa2xx-spi", | ||
135 | .id = 3, | ||
136 | .dev = { | ||
137 | .platform_data = &pxa_ssp3_spi_master_info, | ||
138 | } | ||
139 | }; | ||
140 | |||
141 | struct platform_device pxa_spi_ssp4 = { | ||
142 | .name = "pxa2xx-spi", | ||
143 | .id = 4, | ||
144 | .dev = { | ||
145 | .platform_data = &pxa_ssp4_spi_master_info, | ||
146 | } | ||
147 | }; | ||
148 | |||
149 | static struct platform_device *icontrol_spi_devices[] __initdata = { | ||
150 | &pxa_spi_ssp3, | ||
151 | &pxa_spi_ssp4, | ||
152 | }; | ||
153 | |||
154 | static mfp_cfg_t mfp_can_cfg[] __initdata = { | ||
155 | /* CAN CS lines */ | ||
156 | GPIO15_GPIO, | ||
157 | GPIO16_GPIO, | ||
158 | GPIO17_GPIO, | ||
159 | GPIO24_GPIO, | ||
160 | |||
161 | /* SPI (SSP3) lines */ | ||
162 | GPIO89_SSP3_SCLK, | ||
163 | GPIO91_SSP3_TXD, | ||
164 | GPIO92_SSP3_RXD, | ||
165 | |||
166 | /* SPI (SSP4) lines */ | ||
167 | GPIO93_SSP4_SCLK, | ||
168 | GPIO95_SSP4_TXD, | ||
169 | GPIO96_SSP4_RXD, | ||
170 | |||
171 | /* CAN nIRQ lines */ | ||
172 | GPIO74_GPIO | MFP_LPM_EDGE_RISE, | ||
173 | GPIO75_GPIO | MFP_LPM_EDGE_RISE, | ||
174 | GPIO76_GPIO | MFP_LPM_EDGE_RISE, | ||
175 | GPIO77_GPIO | MFP_LPM_EDGE_RISE | ||
176 | }; | ||
177 | |||
178 | static void __init icontrol_can_init(void) | ||
179 | { | ||
180 | pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_can_cfg)); | ||
181 | platform_add_devices(ARRAY_AND_SIZE(icontrol_spi_devices)); | ||
182 | spi_register_board_info(ARRAY_AND_SIZE(mcp251x_board_info)); | ||
183 | } | ||
184 | |||
185 | static void __init icontrol_init(void) | ||
186 | { | ||
187 | mxm_8x10_barebones_init(); | ||
188 | mxm_8x10_usb_host_init(); | ||
189 | mxm_8x10_mmc_init(); | ||
190 | |||
191 | icontrol_can_init(); | ||
192 | } | ||
193 | |||
194 | MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM") | ||
195 | .phys_io = 0x40000000, | ||
196 | .boot_params = 0xa0000100, | ||
197 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | ||
198 | .map_io = pxa_map_io, | ||
199 | .init_irq = pxa3xx_init_irq, | ||
200 | .timer = &pxa_timer, | ||
201 | .init_machine = icontrol_init | ||
202 | MACHINE_END | ||
diff --git a/arch/arm/mach-pxa/include/mach/mxm8x10.h b/arch/arm/mach-pxa/include/mach/mxm8x10.h new file mode 100644 index 000000000000..d3a234b23d41 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/mxm8x10.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef __MACH_MXM_8X10_H | ||
2 | #define __MACH_MXM_8X10_H | ||
3 | |||
4 | #define MXM_8X10_ETH_PHYS 0x13000000 | ||
5 | |||
6 | #if defined(CONFIG_MMC) | ||
7 | |||
8 | #define MXM_8X10_SD_nCD (72) | ||
9 | #define MXM_8x10_SD_WP (84) | ||
10 | |||
11 | extern void mxm_8x10_mmc_init(void); | ||
12 | #else | ||
13 | static inline void mxm_8x10_mmc_init(void) {} | ||
14 | #endif | ||
15 | |||
16 | extern void mxm_8x10_usb_host_init(void); | ||
17 | extern void mxm_8x10_ac97_init(void); | ||
18 | |||
19 | extern void mxm_8x10_barebones_init(void); | ||
20 | |||
21 | #endif /* __MACH_MXM_8X10_H */ | ||
diff --git a/arch/arm/mach-pxa/mxm8x10.c b/arch/arm/mach-pxa/mxm8x10.c new file mode 100644 index 000000000000..8c9c6f0d56bb --- /dev/null +++ b/arch/arm/mach-pxa/mxm8x10.c | |||
@@ -0,0 +1,474 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/mxm8x10.c | ||
3 | * | ||
4 | * Support for the Embedian MXM-8x10 Computer on Module | ||
5 | * | ||
6 | * Copyright (C) 2006 Marvell International Ltd. | ||
7 | * Copyright (C) 2009 Embedian Inc. | ||
8 | * Copyright (C) 2009 TMT Services & Supplies (Pty) Ltd. | ||
9 | * | ||
10 | * 2007-09-04: eric miao <eric.y.miao@gmail.com> | ||
11 | * rewrite to align with latest kernel | ||
12 | * | ||
13 | * 2010-01-09: Edwin Peer <epeer@tmtservices.co.za> | ||
14 | * Hennie van der Merwe <hvdmerwe@tmtservices.co.za> | ||
15 | * rework for upstream merge | ||
16 | * | ||
17 | * This program is free software; you can redistribute it and/or modify | ||
18 | * it under the terms of the GNU General Public License version 2 as | ||
19 | * published by the Free Software Foundation. | ||
20 | */ | ||
21 | |||
22 | #include <linux/serial_8250.h> | ||
23 | #include <linux/dm9000.h> | ||
24 | #include <linux/gpio.h> | ||
25 | |||
26 | #include <plat/i2c.h> | ||
27 | #include <plat/pxa3xx_nand.h> | ||
28 | |||
29 | #include <mach/pxafb.h> | ||
30 | #include <mach/mmc.h> | ||
31 | #include <mach/ohci.h> | ||
32 | #include <mach/pxa320.h> | ||
33 | |||
34 | #include <mach/mxm8x10.h> | ||
35 | |||
36 | #include "devices.h" | ||
37 | #include "generic.h" | ||
38 | |||
39 | /* GPIO pin definition | ||
40 | |||
41 | External device stuff - Leave unconfigured for now... | ||
42 | --------------------- | ||
43 | GPIO0 - DREQ (External DMA Request) | ||
44 | GPIO3 - nGCS2 (External Chip Select) Where is nGCS0; nGCS1; nGCS4; nGCS5 ? | ||
45 | GPIO4 - nGCS3 | ||
46 | GPIO15 - EXT_GPIO1 | ||
47 | GPIO16 - EXT_GPIO2 | ||
48 | GPIO17 - EXT_GPIO3 | ||
49 | GPIO24 - EXT_GPIO4 | ||
50 | GPIO25 - EXT_GPIO5 | ||
51 | GPIO26 - EXT_GPIO6 | ||
52 | GPIO27 - EXT_GPIO7 | ||
53 | GPIO28 - EXT_GPIO8 | ||
54 | GPIO29 - EXT_GPIO9 | ||
55 | GPIO30 - EXT_GPIO10 | ||
56 | GPIO31 - EXT_GPIO11 | ||
57 | GPIO57 - EXT_GPIO12 | ||
58 | GPIO74 - EXT_IRQ1 | ||
59 | GPIO75 - EXT_IRQ2 | ||
60 | GPIO76 - EXT_IRQ3 | ||
61 | GPIO77 - EXT_IRQ4 | ||
62 | GPIO78 - EXT_IRQ5 | ||
63 | GPIO79 - EXT_IRQ6 | ||
64 | GPIO80 - EXT_IRQ7 | ||
65 | GPIO81 - EXT_IRQ8 | ||
66 | GPIO87 - VCCIO_PWREN (External Device PWREN) | ||
67 | |||
68 | Dallas 1-Wire - Leave unconfigured for now... | ||
69 | ------------- | ||
70 | GPIO0_2 - DS - 1Wire | ||
71 | |||
72 | Ethernet | ||
73 | -------- | ||
74 | GPIO1 - DM9000 PWR | ||
75 | GPIO9 - DM9K_nIRQ | ||
76 | GPIO36 - DM9K_RESET | ||
77 | |||
78 | Keypad - Leave unconfigured by for now... | ||
79 | ------ | ||
80 | GPIO1_2 - KP_DKIN0 | ||
81 | GPIO5_2 - KP_MKOUT7 | ||
82 | GPIO82 - KP_DKIN1 | ||
83 | GPIO85 - KP_DKIN2 | ||
84 | GPIO86 - KP_DKIN3 | ||
85 | GPIO113 - KP_MKIN0 | ||
86 | GPIO114 - KP_MKIN1 | ||
87 | GPIO115 - KP_MKIN2 | ||
88 | GPIO116 - KP_MKIN3 | ||
89 | GPIO117 - KP_MKIN4 | ||
90 | GPIO118 - KP_MKIN5 | ||
91 | GPIO119 - KP_MKIN6 | ||
92 | GPIO120 - KP_MKIN7 | ||
93 | GPIO121 - KP_MKOUT0 | ||
94 | GPIO122 - KP_MKOUT1 | ||
95 | GPIO122 - KP_MKOUT2 | ||
96 | GPIO123 - KP_MKOUT3 | ||
97 | GPIO124 - KP_MKOUT4 | ||
98 | GPIO125 - KP_MKOUT5 | ||
99 | GPIO127 - KP_MKOUT6 | ||
100 | |||
101 | Data Bus - Leave unconfigured for now... | ||
102 | -------- | ||
103 | GPIO2 - nWait (Data Bus) | ||
104 | |||
105 | USB Device | ||
106 | ---------- | ||
107 | GPIO4_2 - USBD_PULLUP | ||
108 | GPIO10 - UTM_CLK (USB Device UTM Clk) | ||
109 | GPIO49 - USB 2.0 Device UTM_DATA0 | ||
110 | GPIO50 - USB 2.0 Device UTM_DATA1 | ||
111 | GPIO51 - USB 2.0 Device UTM_DATA2 | ||
112 | GPIO52 - USB 2.0 Device UTM_DATA3 | ||
113 | GPIO53 - USB 2.0 Device UTM_DATA4 | ||
114 | GPIO54 - USB 2.0 Device UTM_DATA5 | ||
115 | GPIO55 - USB 2.0 Device UTM_DATA6 | ||
116 | GPIO56 - USB 2.0 Device UTM_DATA7 | ||
117 | GPIO58 - UTM_RXVALID (USB 2.0 Device) | ||
118 | GPIO59 - UTM_RXACTIVE (USB 2.0 Device) | ||
119 | GPIO60 - UTM_RXERROR | ||
120 | GPIO61 - UTM_OPMODE0 | ||
121 | GPIO62 - UTM_OPMODE1 | ||
122 | GPIO71 - USBD_INT (USB Device?) | ||
123 | GPIO73 - UTM_TXREADY (USB 2.0 Device) | ||
124 | GPIO83 - UTM_TXVALID (USB 2.0 Device) | ||
125 | GPIO98 - UTM_RESET (USB 2.0 device) | ||
126 | GPIO99 - UTM_XCVR_SELECT | ||
127 | GPIO100 - UTM_TERM_SELECT | ||
128 | GPIO101 - UTM_SUSPENDM_X | ||
129 | GPIO102 - UTM_LINESTATE0 | ||
130 | GPIO103 - UTM_LINESTATE1 | ||
131 | |||
132 | Card-Bus Interface - Leave unconfigured for now... | ||
133 | ------------------ | ||
134 | GPIO5 - nPIOR (I/O space output enable) | ||
135 | GPIO6 - nPIOW (I/O space write enable) | ||
136 | GPIO7 - nIOS16 (Input from I/O space telling size of data bus) | ||
137 | GPIO8 - nPWAIT (Input for inserting wait states) | ||
138 | |||
139 | LCD | ||
140 | --- | ||
141 | GPIO6_2 - LDD0 | ||
142 | GPIO7_2 - LDD1 | ||
143 | GPIO8_2 - LDD2 | ||
144 | GPIO9_2 - LDD3 | ||
145 | GPIO11_2 - LDD5 | ||
146 | GPIO12_2 - LDD6 | ||
147 | GPIO13_2 - LDD7 | ||
148 | GPIO14_2 - VSYNC | ||
149 | GPIO15_2 - HSYNC | ||
150 | GPIO16_2 - VCLK | ||
151 | GPIO17_2 - HCLK | ||
152 | GPIO18_2 - VDEN | ||
153 | GPIO63 - LDD8 (CPU LCD) | ||
154 | GPIO64 - LDD9 (CPU LCD) | ||
155 | GPIO65 - LDD10 (CPU LCD) | ||
156 | GPIO66 - LDD11 (CPU LCD) | ||
157 | GPIO67 - LDD12 (CPU LCD) | ||
158 | GPIO68 - LDD13 (CPU LCD) | ||
159 | GPIO69 - LDD14 (CPU LCD) | ||
160 | GPIO70 - LDD15 (CPU LCD) | ||
161 | GPIO88 - VCCLCD_PWREN (LCD Panel PWREN) | ||
162 | GPIO97 - BACKLIGHT_EN | ||
163 | GPIO104 - LCD_PWREN | ||
164 | |||
165 | PWM - Leave unconfigured for now... | ||
166 | --- | ||
167 | GPIO11 - PWM0 | ||
168 | GPIO12 - PWM1 | ||
169 | GPIO13 - PWM2 | ||
170 | GPIO14 - PWM3 | ||
171 | |||
172 | SD-CARD | ||
173 | ------- | ||
174 | GPIO18 - SDDATA0 | ||
175 | GPIO19 - SDDATA1 | ||
176 | GPIO20 - SDDATA2 | ||
177 | GPIO21 - SDDATA3 | ||
178 | GPIO22 - SDCLK | ||
179 | GPIO23 - SDCMD | ||
180 | GPIO72 - SD_WP | ||
181 | GPIO84 - SD_nIRQ_CD (SD-Card) | ||
182 | |||
183 | I2C | ||
184 | --- | ||
185 | GPIO32 - I2CSCL | ||
186 | GPIO33 - I2CSDA | ||
187 | |||
188 | AC97 | ||
189 | ---- | ||
190 | GPIO35 - AC97_SDATA_IN | ||
191 | GPIO37 - AC97_SDATA_OUT | ||
192 | GPIO38 - AC97_SYNC | ||
193 | GPIO39 - AC97_BITCLK | ||
194 | GPIO40 - AC97_nRESET | ||
195 | |||
196 | UART1 | ||
197 | ----- | ||
198 | GPIO41 - UART_RXD1 | ||
199 | GPIO42 - UART_TXD1 | ||
200 | GPIO43 - UART_CTS1 | ||
201 | GPIO44 - UART_DCD1 | ||
202 | GPIO45 - UART_DSR1 | ||
203 | GPIO46 - UART_nRI1 | ||
204 | GPIO47 - UART_DTR1 | ||
205 | GPIO48 - UART_RTS1 | ||
206 | |||
207 | UART2 | ||
208 | ----- | ||
209 | GPIO109 - RTS2 | ||
210 | GPIO110 - RXD2 | ||
211 | GPIO111 - TXD2 | ||
212 | GPIO112 - nCTS2 | ||
213 | |||
214 | UART3 | ||
215 | ----- | ||
216 | GPIO105 - nCTS3 | ||
217 | GPIO106 - nRTS3 | ||
218 | GPIO107 - TXD3 | ||
219 | GPIO108 - RXD3 | ||
220 | |||
221 | SSP3 - Leave unconfigured for now... | ||
222 | ---- | ||
223 | GPIO89 - SSP3_CLK | ||
224 | GPIO90 - SSP3_SFRM | ||
225 | GPIO91 - SSP3_TXD | ||
226 | GPIO92 - SSP3_RXD | ||
227 | |||
228 | SSP4 | ||
229 | GPIO93 - SSP4_CLK | ||
230 | GPIO94 - SSP4_SFRM | ||
231 | GPIO95 - SSP4_TXD | ||
232 | GPIO96 - SSP4_RXD | ||
233 | */ | ||
234 | |||
235 | static mfp_cfg_t mfp_cfg[] __initdata = { | ||
236 | /* USB */ | ||
237 | GPIO10_UTM_CLK, | ||
238 | GPIO49_U2D_PHYDATA_0, | ||
239 | GPIO50_U2D_PHYDATA_1, | ||
240 | GPIO51_U2D_PHYDATA_2, | ||
241 | GPIO52_U2D_PHYDATA_3, | ||
242 | GPIO53_U2D_PHYDATA_4, | ||
243 | GPIO54_U2D_PHYDATA_5, | ||
244 | GPIO55_U2D_PHYDATA_6, | ||
245 | GPIO56_U2D_PHYDATA_7, | ||
246 | GPIO58_UTM_RXVALID, | ||
247 | GPIO59_UTM_RXACTIVE, | ||
248 | GPIO60_U2D_RXERROR, | ||
249 | GPIO61_U2D_OPMODE0, | ||
250 | GPIO62_U2D_OPMODE1, | ||
251 | GPIO71_GPIO, /* USBD_INT */ | ||
252 | GPIO73_UTM_TXREADY, | ||
253 | GPIO83_U2D_TXVALID, | ||
254 | GPIO98_U2D_RESET, | ||
255 | GPIO99_U2D_XCVR_SEL, | ||
256 | GPIO100_U2D_TERM_SEL, | ||
257 | GPIO101_U2D_SUSPEND, | ||
258 | GPIO102_UTM_LINESTATE_0, | ||
259 | GPIO103_UTM_LINESTATE_1, | ||
260 | GPIO4_2_GPIO | MFP_PULL_HIGH, /* UTM_PULLUP */ | ||
261 | |||
262 | /* DM9000 */ | ||
263 | GPIO1_GPIO, | ||
264 | GPIO9_GPIO, | ||
265 | GPIO36_GPIO, | ||
266 | |||
267 | /* AC97 */ | ||
268 | GPIO35_AC97_SDATA_IN_0, | ||
269 | GPIO37_AC97_SDATA_OUT, | ||
270 | GPIO38_AC97_SYNC, | ||
271 | GPIO39_AC97_BITCLK, | ||
272 | GPIO40_AC97_nACRESET, | ||
273 | |||
274 | /* UARTS */ | ||
275 | GPIO41_UART1_RXD, | ||
276 | GPIO42_UART1_TXD, | ||
277 | GPIO43_UART1_CTS, | ||
278 | GPIO44_UART1_DCD, | ||
279 | GPIO45_UART1_DSR, | ||
280 | GPIO46_UART1_RI, | ||
281 | GPIO47_UART1_DTR, | ||
282 | GPIO48_UART1_RTS, | ||
283 | |||
284 | GPIO109_UART2_RTS, | ||
285 | GPIO110_UART2_RXD, | ||
286 | GPIO111_UART2_TXD, | ||
287 | GPIO112_UART2_CTS, | ||
288 | |||
289 | GPIO105_UART3_CTS, | ||
290 | GPIO106_UART3_RTS, | ||
291 | GPIO107_UART3_TXD, | ||
292 | GPIO108_UART3_RXD, | ||
293 | |||
294 | GPIO78_GPIO, | ||
295 | GPIO79_GPIO, | ||
296 | GPIO80_GPIO, | ||
297 | GPIO81_GPIO, | ||
298 | |||
299 | /* I2C */ | ||
300 | GPIO32_I2C_SCL, | ||
301 | GPIO33_I2C_SDA, | ||
302 | |||
303 | /* MMC */ | ||
304 | GPIO18_MMC1_DAT0, | ||
305 | GPIO19_MMC1_DAT1, | ||
306 | GPIO20_MMC1_DAT2, | ||
307 | GPIO21_MMC1_DAT3, | ||
308 | GPIO22_MMC1_CLK, | ||
309 | GPIO23_MMC1_CMD, | ||
310 | GPIO72_GPIO | MFP_PULL_HIGH, /* Card Detect */ | ||
311 | GPIO84_GPIO | MFP_PULL_LOW, /* Write Protect */ | ||
312 | |||
313 | /* IRQ */ | ||
314 | GPIO74_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ1 */ | ||
315 | GPIO75_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ2 */ | ||
316 | GPIO76_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ3 */ | ||
317 | GPIO77_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ4 */ | ||
318 | GPIO78_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ5 */ | ||
319 | GPIO79_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ6 */ | ||
320 | GPIO80_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ7 */ | ||
321 | GPIO81_GPIO | MFP_LPM_EDGE_RISE /* EXT_IRQ8 */ | ||
322 | }; | ||
323 | |||
324 | /* MMC/MCI Support */ | ||
325 | #if defined(CONFIG_MMC) | ||
326 | static struct pxamci_platform_data mxm_8x10_mci_platform_data = { | ||
327 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
328 | .detect_delay = 1, | ||
329 | .gpio_card_detect = MXM_8X10_SD_nCD, | ||
330 | .gpio_card_ro = MXM_8X10_SD_WP, | ||
331 | .gpio_power = -1 | ||
332 | }; | ||
333 | |||
334 | void __init mxm_8x10_mmc_init(void) | ||
335 | { | ||
336 | pxa_set_mci_info(&mxm_8x10_mci_platform_data); | ||
337 | } | ||
338 | #endif | ||
339 | |||
340 | /* USB Open Host Controler Interface */ | ||
341 | static struct pxaohci_platform_data mxm_8x10_ohci_platform_data = { | ||
342 | .port_mode = PMM_NPS_MODE, | ||
343 | .flags = ENABLE_PORT_ALL | ||
344 | }; | ||
345 | |||
346 | void __init mxm_8x10_usb_host_init(void) | ||
347 | { | ||
348 | pxa_set_ohci_info(&mxm_8x10_ohci_platform_data); | ||
349 | } | ||
350 | |||
351 | /* AC97 Sound Support */ | ||
352 | static struct platform_device mxm_8x10_ac97_device = { | ||
353 | .name = "pxa2xx-ac97" | ||
354 | }; | ||
355 | |||
356 | void __init mxm_8x10_ac97_init(void) | ||
357 | { | ||
358 | platform_device_register(&mxm_8x10_ac97_device); | ||
359 | } | ||
360 | |||
361 | /* NAND flash Support */ | ||
362 | #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE) | ||
363 | #define NAND_BLOCK_SIZE SZ_128K | ||
364 | #define NB(x) (NAND_BLOCK_SIZE * (x)) | ||
365 | static struct mtd_partition mxm_8x10_nand_partitions[] = { | ||
366 | [0] = { | ||
367 | .name = "boot", | ||
368 | .size = NB(0x002), | ||
369 | .offset = NB(0x000), | ||
370 | .mask_flags = MTD_WRITEABLE | ||
371 | }, | ||
372 | [1] = { | ||
373 | .name = "kernel", | ||
374 | .size = NB(0x010), | ||
375 | .offset = NB(0x002), | ||
376 | .mask_flags = MTD_WRITEABLE | ||
377 | }, | ||
378 | [2] = { | ||
379 | .name = "root", | ||
380 | .size = NB(0x36c), | ||
381 | .offset = NB(0x012) | ||
382 | }, | ||
383 | [3] = { | ||
384 | .name = "bbt", | ||
385 | .size = NB(0x082), | ||
386 | .offset = NB(0x37e), | ||
387 | .mask_flags = MTD_WRITEABLE | ||
388 | } | ||
389 | }; | ||
390 | |||
391 | static struct pxa3xx_nand_platform_data mxm_8x10_nand_info = { | ||
392 | .enable_arbiter = 1, | ||
393 | .keep_config = 1, | ||
394 | .parts = mxm_8x10_nand_partitions, | ||
395 | .nr_parts = ARRAY_SIZE(mxm_8x10_nand_partitions) | ||
396 | }; | ||
397 | |||
398 | static void __init mxm_8x10_nand_init(void) | ||
399 | { | ||
400 | pxa3xx_set_nand_info(&mxm_8x10_nand_info); | ||
401 | } | ||
402 | #else | ||
403 | static inline void mxm_8x10_nand_init(void) {} | ||
404 | #endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */ | ||
405 | |||
406 | /* Ethernet support: Davicom DM9000 */ | ||
407 | static struct resource dm9k_resources[] = { | ||
408 | [0] = { | ||
409 | .start = MXM_8X10_ETH_PHYS + 0x300, | ||
410 | .end = MXM_8X10_ETH_PHYS + 0x300, | ||
411 | .flags = IORESOURCE_MEM | ||
412 | }, | ||
413 | [1] = { | ||
414 | .start = MXM_8X10_ETH_PHYS + 0x308, | ||
415 | .end = MXM_8X10_ETH_PHYS + 0x308, | ||
416 | .flags = IORESOURCE_MEM | ||
417 | }, | ||
418 | [2] = { | ||
419 | .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)), | ||
420 | .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)), | ||
421 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | ||
422 | } | ||
423 | }; | ||
424 | |||
425 | static struct dm9000_plat_data dm9k_plat_data = { | ||
426 | .flags = DM9000_PLATF_16BITONLY | ||
427 | }; | ||
428 | |||
429 | static struct platform_device dm9k_device = { | ||
430 | .name = "dm9000", | ||
431 | .id = 0, | ||
432 | .num_resources = ARRAY_SIZE(dm9k_resources), | ||
433 | .resource = dm9k_resources, | ||
434 | .dev = { | ||
435 | .platform_data = &dm9k_plat_data | ||
436 | } | ||
437 | }; | ||
438 | |||
439 | static void __init mxm_8x10_ethernet_init(void) | ||
440 | { | ||
441 | platform_device_register(&dm9k_device); | ||
442 | } | ||
443 | |||
444 | /* PXA UARTs */ | ||
445 | static void __init mxm_8x10_uarts_init(void) | ||
446 | { | ||
447 | pxa_set_ffuart_info(NULL); | ||
448 | pxa_set_btuart_info(NULL); | ||
449 | pxa_set_stuart_info(NULL); | ||
450 | } | ||
451 | |||
452 | /* I2C and Real Time Clock */ | ||
453 | static struct i2c_board_info __initdata mxm_8x10_i2c_devices[] = { | ||
454 | { | ||
455 | I2C_BOARD_INFO("ds1337", 0x68) | ||
456 | } | ||
457 | }; | ||
458 | |||
459 | static void __init mxm_8x10_i2c_init(void) | ||
460 | { | ||
461 | i2c_register_board_info(0, mxm_8x10_i2c_devices, | ||
462 | ARRAY_SIZE(mxm_8x10_i2c_devices)); | ||
463 | pxa_set_i2c_info(NULL); | ||
464 | } | ||
465 | |||
466 | void __init mxm_8x10_barebones_init(void) | ||
467 | { | ||
468 | pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_cfg)); | ||
469 | |||
470 | mxm_8x10_uarts_init(); | ||
471 | mxm_8x10_nand_init(); | ||
472 | mxm_8x10_i2c_init(); | ||
473 | mxm_8x10_ethernet_init(); | ||
474 | } | ||