diff options
Diffstat (limited to 'arch/arm/mach-mx2/pcm038.c')
-rw-r--r-- | arch/arm/mach-mx2/pcm038.c | 82 |
1 files changed, 62 insertions, 20 deletions
diff --git a/arch/arm/mach-mx2/pcm038.c b/arch/arm/mach-mx2/pcm038.c index 7f55746e2591..dfd4156da7d5 100644 --- a/arch/arm/mach-mx2/pcm038.c +++ b/arch/arm/mach-mx2/pcm038.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/mtd/physmap.h> | 21 | #include <linux/mtd/physmap.h> |
22 | #include <linux/mtd/plat-ram.h> | ||
22 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
23 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
24 | #include <mach/common.h> | 25 | #include <mach/common.h> |
@@ -27,10 +28,36 @@ | |||
27 | #include <asm/mach/time.h> | 28 | #include <asm/mach/time.h> |
28 | #include <mach/imx-uart.h> | 29 | #include <mach/imx-uart.h> |
29 | #include <mach/board-pcm038.h> | 30 | #include <mach/board-pcm038.h> |
31 | #include <mach/mxc_nand.h> | ||
30 | 32 | ||
31 | #include "devices.h" | 33 | #include "devices.h" |
32 | 34 | ||
33 | /* | 35 | /* |
36 | * Phytec's PCM038 comes with 2MiB battery buffered SRAM, | ||
37 | * 16 bit width | ||
38 | */ | ||
39 | |||
40 | static struct platdata_mtd_ram pcm038_sram_data = { | ||
41 | .bankwidth = 2, | ||
42 | }; | ||
43 | |||
44 | static struct resource pcm038_sram_resource = { | ||
45 | .start = CS1_BASE_ADDR, | ||
46 | .end = CS1_BASE_ADDR + 512 * 1024 - 1, | ||
47 | .flags = IORESOURCE_MEM, | ||
48 | }; | ||
49 | |||
50 | static struct platform_device pcm038_sram_mtd_device = { | ||
51 | .name = "mtd-ram", | ||
52 | .id = 0, | ||
53 | .dev = { | ||
54 | .platform_data = &pcm038_sram_data, | ||
55 | }, | ||
56 | .num_resources = 1, | ||
57 | .resource = &pcm038_sram_resource, | ||
58 | }; | ||
59 | |||
60 | /* | ||
34 | * Phytec's phyCORE-i.MX27 comes with 32MiB flash, | 61 | * Phytec's phyCORE-i.MX27 comes with 32MiB flash, |
35 | * 16 bit width | 62 | * 16 bit width |
36 | */ | 63 | */ |
@@ -64,15 +91,14 @@ static int mxc_uart0_pins[] = { | |||
64 | static int uart_mxc_port0_init(struct platform_device *pdev) | 91 | static int uart_mxc_port0_init(struct platform_device *pdev) |
65 | { | 92 | { |
66 | return mxc_gpio_setup_multiple_pins(mxc_uart0_pins, | 93 | return mxc_gpio_setup_multiple_pins(mxc_uart0_pins, |
67 | ARRAY_SIZE(mxc_uart0_pins), | 94 | ARRAY_SIZE(mxc_uart0_pins), "UART0"); |
68 | MXC_GPIO_ALLOC_MODE_NORMAL, "UART0"); | ||
69 | } | 95 | } |
70 | 96 | ||
71 | static int uart_mxc_port0_exit(struct platform_device *pdev) | 97 | static int uart_mxc_port0_exit(struct platform_device *pdev) |
72 | { | 98 | { |
73 | return mxc_gpio_setup_multiple_pins(mxc_uart0_pins, | 99 | mxc_gpio_release_multiple_pins(mxc_uart0_pins, |
74 | ARRAY_SIZE(mxc_uart0_pins), | 100 | ARRAY_SIZE(mxc_uart0_pins)); |
75 | MXC_GPIO_ALLOC_MODE_RELEASE, "UART0"); | 101 | return 0; |
76 | } | 102 | } |
77 | 103 | ||
78 | static int mxc_uart1_pins[] = { | 104 | static int mxc_uart1_pins[] = { |
@@ -85,15 +111,14 @@ static int mxc_uart1_pins[] = { | |||
85 | static int uart_mxc_port1_init(struct platform_device *pdev) | 111 | static int uart_mxc_port1_init(struct platform_device *pdev) |
86 | { | 112 | { |
87 | return mxc_gpio_setup_multiple_pins(mxc_uart1_pins, | 113 | return mxc_gpio_setup_multiple_pins(mxc_uart1_pins, |
88 | ARRAY_SIZE(mxc_uart1_pins), | 114 | ARRAY_SIZE(mxc_uart1_pins), "UART1"); |
89 | MXC_GPIO_ALLOC_MODE_NORMAL, "UART1"); | ||
90 | } | 115 | } |
91 | 116 | ||
92 | static int uart_mxc_port1_exit(struct platform_device *pdev) | 117 | static int uart_mxc_port1_exit(struct platform_device *pdev) |
93 | { | 118 | { |
94 | return mxc_gpio_setup_multiple_pins(mxc_uart1_pins, | 119 | mxc_gpio_release_multiple_pins(mxc_uart1_pins, |
95 | ARRAY_SIZE(mxc_uart1_pins), | 120 | ARRAY_SIZE(mxc_uart1_pins)); |
96 | MXC_GPIO_ALLOC_MODE_RELEASE, "UART1"); | 121 | return 0; |
97 | } | 122 | } |
98 | 123 | ||
99 | static int mxc_uart2_pins[] = { PE10_PF_UART3_CTS, | 124 | static int mxc_uart2_pins[] = { PE10_PF_UART3_CTS, |
@@ -104,15 +129,14 @@ static int mxc_uart2_pins[] = { PE10_PF_UART3_CTS, | |||
104 | static int uart_mxc_port2_init(struct platform_device *pdev) | 129 | static int uart_mxc_port2_init(struct platform_device *pdev) |
105 | { | 130 | { |
106 | return mxc_gpio_setup_multiple_pins(mxc_uart2_pins, | 131 | return mxc_gpio_setup_multiple_pins(mxc_uart2_pins, |
107 | ARRAY_SIZE(mxc_uart2_pins), | 132 | ARRAY_SIZE(mxc_uart2_pins), "UART2"); |
108 | MXC_GPIO_ALLOC_MODE_NORMAL, "UART2"); | ||
109 | } | 133 | } |
110 | 134 | ||
111 | static int uart_mxc_port2_exit(struct platform_device *pdev) | 135 | static int uart_mxc_port2_exit(struct platform_device *pdev) |
112 | { | 136 | { |
113 | return mxc_gpio_setup_multiple_pins(mxc_uart2_pins, | 137 | mxc_gpio_release_multiple_pins(mxc_uart2_pins, |
114 | ARRAY_SIZE(mxc_uart2_pins), | 138 | ARRAY_SIZE(mxc_uart2_pins)); |
115 | MXC_GPIO_ALLOC_MODE_RELEASE, "UART2"); | 139 | return 0; |
116 | } | 140 | } |
117 | 141 | ||
118 | static struct imxuart_platform_data uart_pdata[] = { | 142 | static struct imxuart_platform_data uart_pdata[] = { |
@@ -155,29 +179,47 @@ static int mxc_fec_pins[] = { | |||
155 | static void gpio_fec_active(void) | 179 | static void gpio_fec_active(void) |
156 | { | 180 | { |
157 | mxc_gpio_setup_multiple_pins(mxc_fec_pins, | 181 | mxc_gpio_setup_multiple_pins(mxc_fec_pins, |
158 | ARRAY_SIZE(mxc_fec_pins), | 182 | ARRAY_SIZE(mxc_fec_pins), "FEC"); |
159 | MXC_GPIO_ALLOC_MODE_NORMAL, "FEC"); | ||
160 | } | 183 | } |
161 | 184 | ||
162 | static void gpio_fec_inactive(void) | 185 | static void gpio_fec_inactive(void) |
163 | { | 186 | { |
164 | mxc_gpio_setup_multiple_pins(mxc_fec_pins, | 187 | mxc_gpio_release_multiple_pins(mxc_fec_pins, |
165 | ARRAY_SIZE(mxc_fec_pins), | 188 | ARRAY_SIZE(mxc_fec_pins)); |
166 | MXC_GPIO_ALLOC_MODE_RELEASE, "FEC"); | ||
167 | } | 189 | } |
168 | 190 | ||
191 | static struct mxc_nand_platform_data pcm038_nand_board_info = { | ||
192 | .width = 1, | ||
193 | .hw_ecc = 1, | ||
194 | }; | ||
195 | |||
169 | static struct platform_device *platform_devices[] __initdata = { | 196 | static struct platform_device *platform_devices[] __initdata = { |
170 | &pcm038_nor_mtd_device, | 197 | &pcm038_nor_mtd_device, |
198 | &mxc_w1_master_device, | ||
199 | &pcm038_sram_mtd_device, | ||
171 | }; | 200 | }; |
172 | 201 | ||
202 | /* On pcm038 there's a sram attached to CS1, we enable the chipselect here and | ||
203 | * setup other stuffs to access the sram. */ | ||
204 | static void __init pcm038_init_sram(void) | ||
205 | { | ||
206 | __raw_writel(0x0000d843, CSCR_U(1)); | ||
207 | __raw_writel(0x22252521, CSCR_L(1)); | ||
208 | __raw_writel(0x22220a00, CSCR_A(1)); | ||
209 | } | ||
210 | |||
173 | static void __init pcm038_init(void) | 211 | static void __init pcm038_init(void) |
174 | { | 212 | { |
175 | gpio_fec_active(); | 213 | gpio_fec_active(); |
214 | pcm038_init_sram(); | ||
176 | 215 | ||
177 | mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); | 216 | mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); |
178 | mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); | 217 | mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); |
179 | mxc_register_device(&mxc_uart_device2, &uart_pdata[2]); | 218 | mxc_register_device(&mxc_uart_device2, &uart_pdata[2]); |
180 | 219 | ||
220 | mxc_gpio_mode(PE16_AF_RTCK); /* OWIRE */ | ||
221 | mxc_register_device(&mxc_nand_device, &pcm038_nand_board_info); | ||
222 | |||
181 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 223 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
182 | 224 | ||
183 | #ifdef CONFIG_MACH_PCM970_BASEBOARD | 225 | #ifdef CONFIG_MACH_PCM970_BASEBOARD |