Commit 716a3dc20084da9b3ab17bd125005a5345e23e3b
1 parent
4de3a8e101
Exists in
master
and in
6 other branches
ARM: Add arm_memblock_steal() to allocate memory away from the kernel
Several platforms are now using the memblock_alloc+memblock_free+ memblock_remove trick to obtain memory which won't be mapped in the kernel's page tables. Most platforms do this (correctly) in the ->reserve callback. However, OMAP has started to call these functions outside of this callback, and this is extremely unsafe - memory will not be unmapped, and could well be given out after memblock is no longer responsible for its management. So, provide arm_memblock_steal() to perform this function, and ensure that it panic()s if it is used inappropriately. Convert everyone over, including OMAP. As a result, OMAP with OMAP4_ERRATA_I688 enabled will panic on boot with this change. Mark this option as BROKEN and make it depend on BROKEN. OMAP needs to be fixed, or 137d105d50 (ARM: OMAP4: Fix errata i688 with MPU interconnect barriers.) reverted until such time it can be fixed correctly. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Showing 9 changed files with 34 additions and 32 deletions Inline Diff
arch/arm/include/asm/memblock.h
1 | #ifndef _ASM_ARM_MEMBLOCK_H | 1 | #ifndef _ASM_ARM_MEMBLOCK_H |
2 | #define _ASM_ARM_MEMBLOCK_H | 2 | #define _ASM_ARM_MEMBLOCK_H |
3 | 3 | ||
4 | struct meminfo; | 4 | struct meminfo; |
5 | struct machine_desc; | 5 | struct machine_desc; |
6 | 6 | ||
7 | extern void arm_memblock_init(struct meminfo *, struct machine_desc *); | 7 | extern void arm_memblock_init(struct meminfo *, struct machine_desc *); |
8 | 8 | ||
9 | phys_addr_t arm_memblock_steal(phys_addr_t size, phys_addr_t align); | ||
10 | |||
9 | #endif | 11 | #endif |
10 | 12 |
arch/arm/mach-imx/mach-mx31_3ds.c
1 | /* | 1 | /* |
2 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | 2 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the License, or | 6 | * the Free Software Foundation; either version 2 of the License, or |
7 | * (at your option) any later version. | 7 | * (at your option) any later version. |
8 | * | 8 | * |
9 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/irq.h> | 20 | #include <linux/irq.h> |
21 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/mfd/mc13783.h> | 23 | #include <linux/mfd/mc13783.h> |
24 | #include <linux/spi/spi.h> | 24 | #include <linux/spi/spi.h> |
25 | #include <linux/spi/l4f00242t03.h> | 25 | #include <linux/spi/l4f00242t03.h> |
26 | #include <linux/regulator/machine.h> | 26 | #include <linux/regulator/machine.h> |
27 | #include <linux/usb/otg.h> | 27 | #include <linux/usb/otg.h> |
28 | #include <linux/usb/ulpi.h> | 28 | #include <linux/usb/ulpi.h> |
29 | #include <linux/memblock.h> | 29 | #include <linux/memblock.h> |
30 | 30 | ||
31 | #include <media/soc_camera.h> | 31 | #include <media/soc_camera.h> |
32 | 32 | ||
33 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
34 | #include <asm/mach-types.h> | 34 | #include <asm/mach-types.h> |
35 | #include <asm/mach/arch.h> | 35 | #include <asm/mach/arch.h> |
36 | #include <asm/mach/time.h> | 36 | #include <asm/mach/time.h> |
37 | #include <asm/memory.h> | 37 | #include <asm/memory.h> |
38 | #include <asm/mach/map.h> | 38 | #include <asm/mach/map.h> |
39 | #include <asm/memblock.h> | ||
39 | #include <mach/common.h> | 40 | #include <mach/common.h> |
40 | #include <mach/iomux-mx3.h> | 41 | #include <mach/iomux-mx3.h> |
41 | #include <mach/3ds_debugboard.h> | 42 | #include <mach/3ds_debugboard.h> |
42 | #include <mach/ulpi.h> | 43 | #include <mach/ulpi.h> |
43 | 44 | ||
44 | #include "devices-imx31.h" | 45 | #include "devices-imx31.h" |
45 | 46 | ||
46 | /* CPLD IRQ line for external uart, external ethernet etc */ | 47 | /* CPLD IRQ line for external uart, external ethernet etc */ |
47 | #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_1) | 48 | #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_1) |
48 | 49 | ||
49 | static int mx31_3ds_pins[] = { | 50 | static int mx31_3ds_pins[] = { |
50 | /* UART1 */ | 51 | /* UART1 */ |
51 | MX31_PIN_CTS1__CTS1, | 52 | MX31_PIN_CTS1__CTS1, |
52 | MX31_PIN_RTS1__RTS1, | 53 | MX31_PIN_RTS1__RTS1, |
53 | MX31_PIN_TXD1__TXD1, | 54 | MX31_PIN_TXD1__TXD1, |
54 | MX31_PIN_RXD1__RXD1, | 55 | MX31_PIN_RXD1__RXD1, |
55 | IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO), | 56 | IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO), |
56 | /*SPI0*/ | 57 | /*SPI0*/ |
57 | IOMUX_MODE(MX31_PIN_DSR_DCE1, IOMUX_CONFIG_ALT1), | 58 | IOMUX_MODE(MX31_PIN_DSR_DCE1, IOMUX_CONFIG_ALT1), |
58 | IOMUX_MODE(MX31_PIN_RI_DCE1, IOMUX_CONFIG_ALT1), | 59 | IOMUX_MODE(MX31_PIN_RI_DCE1, IOMUX_CONFIG_ALT1), |
59 | /* SPI 1 */ | 60 | /* SPI 1 */ |
60 | MX31_PIN_CSPI2_SCLK__SCLK, | 61 | MX31_PIN_CSPI2_SCLK__SCLK, |
61 | MX31_PIN_CSPI2_MOSI__MOSI, | 62 | MX31_PIN_CSPI2_MOSI__MOSI, |
62 | MX31_PIN_CSPI2_MISO__MISO, | 63 | MX31_PIN_CSPI2_MISO__MISO, |
63 | MX31_PIN_CSPI2_SPI_RDY__SPI_RDY, | 64 | MX31_PIN_CSPI2_SPI_RDY__SPI_RDY, |
64 | MX31_PIN_CSPI2_SS0__SS0, | 65 | MX31_PIN_CSPI2_SS0__SS0, |
65 | MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */ | 66 | MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */ |
66 | /* MC13783 IRQ */ | 67 | /* MC13783 IRQ */ |
67 | IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO), | 68 | IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO), |
68 | /* USB OTG reset */ | 69 | /* USB OTG reset */ |
69 | IOMUX_MODE(MX31_PIN_USB_PWR, IOMUX_CONFIG_GPIO), | 70 | IOMUX_MODE(MX31_PIN_USB_PWR, IOMUX_CONFIG_GPIO), |
70 | /* USB OTG */ | 71 | /* USB OTG */ |
71 | MX31_PIN_USBOTG_DATA0__USBOTG_DATA0, | 72 | MX31_PIN_USBOTG_DATA0__USBOTG_DATA0, |
72 | MX31_PIN_USBOTG_DATA1__USBOTG_DATA1, | 73 | MX31_PIN_USBOTG_DATA1__USBOTG_DATA1, |
73 | MX31_PIN_USBOTG_DATA2__USBOTG_DATA2, | 74 | MX31_PIN_USBOTG_DATA2__USBOTG_DATA2, |
74 | MX31_PIN_USBOTG_DATA3__USBOTG_DATA3, | 75 | MX31_PIN_USBOTG_DATA3__USBOTG_DATA3, |
75 | MX31_PIN_USBOTG_DATA4__USBOTG_DATA4, | 76 | MX31_PIN_USBOTG_DATA4__USBOTG_DATA4, |
76 | MX31_PIN_USBOTG_DATA5__USBOTG_DATA5, | 77 | MX31_PIN_USBOTG_DATA5__USBOTG_DATA5, |
77 | MX31_PIN_USBOTG_DATA6__USBOTG_DATA6, | 78 | MX31_PIN_USBOTG_DATA6__USBOTG_DATA6, |
78 | MX31_PIN_USBOTG_DATA7__USBOTG_DATA7, | 79 | MX31_PIN_USBOTG_DATA7__USBOTG_DATA7, |
79 | MX31_PIN_USBOTG_CLK__USBOTG_CLK, | 80 | MX31_PIN_USBOTG_CLK__USBOTG_CLK, |
80 | MX31_PIN_USBOTG_DIR__USBOTG_DIR, | 81 | MX31_PIN_USBOTG_DIR__USBOTG_DIR, |
81 | MX31_PIN_USBOTG_NXT__USBOTG_NXT, | 82 | MX31_PIN_USBOTG_NXT__USBOTG_NXT, |
82 | MX31_PIN_USBOTG_STP__USBOTG_STP, | 83 | MX31_PIN_USBOTG_STP__USBOTG_STP, |
83 | /*Keyboard*/ | 84 | /*Keyboard*/ |
84 | MX31_PIN_KEY_ROW0_KEY_ROW0, | 85 | MX31_PIN_KEY_ROW0_KEY_ROW0, |
85 | MX31_PIN_KEY_ROW1_KEY_ROW1, | 86 | MX31_PIN_KEY_ROW1_KEY_ROW1, |
86 | MX31_PIN_KEY_ROW2_KEY_ROW2, | 87 | MX31_PIN_KEY_ROW2_KEY_ROW2, |
87 | MX31_PIN_KEY_COL0_KEY_COL0, | 88 | MX31_PIN_KEY_COL0_KEY_COL0, |
88 | MX31_PIN_KEY_COL1_KEY_COL1, | 89 | MX31_PIN_KEY_COL1_KEY_COL1, |
89 | MX31_PIN_KEY_COL2_KEY_COL2, | 90 | MX31_PIN_KEY_COL2_KEY_COL2, |
90 | MX31_PIN_KEY_COL3_KEY_COL3, | 91 | MX31_PIN_KEY_COL3_KEY_COL3, |
91 | /* USB Host 2 */ | 92 | /* USB Host 2 */ |
92 | IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC), | 93 | IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC), |
93 | IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC), | 94 | IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC), |
94 | IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC), | 95 | IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC), |
95 | IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC), | 96 | IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC), |
96 | IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC), | 97 | IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC), |
97 | IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC), | 98 | IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC), |
98 | IOMUX_MODE(MX31_PIN_PC_VS2, IOMUX_CONFIG_ALT1), | 99 | IOMUX_MODE(MX31_PIN_PC_VS2, IOMUX_CONFIG_ALT1), |
99 | IOMUX_MODE(MX31_PIN_PC_BVD1, IOMUX_CONFIG_ALT1), | 100 | IOMUX_MODE(MX31_PIN_PC_BVD1, IOMUX_CONFIG_ALT1), |
100 | IOMUX_MODE(MX31_PIN_PC_BVD2, IOMUX_CONFIG_ALT1), | 101 | IOMUX_MODE(MX31_PIN_PC_BVD2, IOMUX_CONFIG_ALT1), |
101 | IOMUX_MODE(MX31_PIN_PC_RST, IOMUX_CONFIG_ALT1), | 102 | IOMUX_MODE(MX31_PIN_PC_RST, IOMUX_CONFIG_ALT1), |
102 | IOMUX_MODE(MX31_PIN_IOIS16, IOMUX_CONFIG_ALT1), | 103 | IOMUX_MODE(MX31_PIN_IOIS16, IOMUX_CONFIG_ALT1), |
103 | IOMUX_MODE(MX31_PIN_PC_RW_B, IOMUX_CONFIG_ALT1), | 104 | IOMUX_MODE(MX31_PIN_PC_RW_B, IOMUX_CONFIG_ALT1), |
104 | /* USB Host2 reset */ | 105 | /* USB Host2 reset */ |
105 | IOMUX_MODE(MX31_PIN_USB_BYP, IOMUX_CONFIG_GPIO), | 106 | IOMUX_MODE(MX31_PIN_USB_BYP, IOMUX_CONFIG_GPIO), |
106 | /* I2C1 */ | 107 | /* I2C1 */ |
107 | MX31_PIN_I2C_CLK__I2C1_SCL, | 108 | MX31_PIN_I2C_CLK__I2C1_SCL, |
108 | MX31_PIN_I2C_DAT__I2C1_SDA, | 109 | MX31_PIN_I2C_DAT__I2C1_SDA, |
109 | /* SDHC1 */ | 110 | /* SDHC1 */ |
110 | MX31_PIN_SD1_DATA3__SD1_DATA3, | 111 | MX31_PIN_SD1_DATA3__SD1_DATA3, |
111 | MX31_PIN_SD1_DATA2__SD1_DATA2, | 112 | MX31_PIN_SD1_DATA2__SD1_DATA2, |
112 | MX31_PIN_SD1_DATA1__SD1_DATA1, | 113 | MX31_PIN_SD1_DATA1__SD1_DATA1, |
113 | MX31_PIN_SD1_DATA0__SD1_DATA0, | 114 | MX31_PIN_SD1_DATA0__SD1_DATA0, |
114 | MX31_PIN_SD1_CLK__SD1_CLK, | 115 | MX31_PIN_SD1_CLK__SD1_CLK, |
115 | MX31_PIN_SD1_CMD__SD1_CMD, | 116 | MX31_PIN_SD1_CMD__SD1_CMD, |
116 | MX31_PIN_GPIO3_1__GPIO3_1, /* Card detect */ | 117 | MX31_PIN_GPIO3_1__GPIO3_1, /* Card detect */ |
117 | MX31_PIN_GPIO3_0__GPIO3_0, /* OE */ | 118 | MX31_PIN_GPIO3_0__GPIO3_0, /* OE */ |
118 | /* Framebuffer */ | 119 | /* Framebuffer */ |
119 | MX31_PIN_LD0__LD0, | 120 | MX31_PIN_LD0__LD0, |
120 | MX31_PIN_LD1__LD1, | 121 | MX31_PIN_LD1__LD1, |
121 | MX31_PIN_LD2__LD2, | 122 | MX31_PIN_LD2__LD2, |
122 | MX31_PIN_LD3__LD3, | 123 | MX31_PIN_LD3__LD3, |
123 | MX31_PIN_LD4__LD4, | 124 | MX31_PIN_LD4__LD4, |
124 | MX31_PIN_LD5__LD5, | 125 | MX31_PIN_LD5__LD5, |
125 | MX31_PIN_LD6__LD6, | 126 | MX31_PIN_LD6__LD6, |
126 | MX31_PIN_LD7__LD7, | 127 | MX31_PIN_LD7__LD7, |
127 | MX31_PIN_LD8__LD8, | 128 | MX31_PIN_LD8__LD8, |
128 | MX31_PIN_LD9__LD9, | 129 | MX31_PIN_LD9__LD9, |
129 | MX31_PIN_LD10__LD10, | 130 | MX31_PIN_LD10__LD10, |
130 | MX31_PIN_LD11__LD11, | 131 | MX31_PIN_LD11__LD11, |
131 | MX31_PIN_LD12__LD12, | 132 | MX31_PIN_LD12__LD12, |
132 | MX31_PIN_LD13__LD13, | 133 | MX31_PIN_LD13__LD13, |
133 | MX31_PIN_LD14__LD14, | 134 | MX31_PIN_LD14__LD14, |
134 | MX31_PIN_LD15__LD15, | 135 | MX31_PIN_LD15__LD15, |
135 | MX31_PIN_LD16__LD16, | 136 | MX31_PIN_LD16__LD16, |
136 | MX31_PIN_LD17__LD17, | 137 | MX31_PIN_LD17__LD17, |
137 | MX31_PIN_VSYNC3__VSYNC3, | 138 | MX31_PIN_VSYNC3__VSYNC3, |
138 | MX31_PIN_HSYNC__HSYNC, | 139 | MX31_PIN_HSYNC__HSYNC, |
139 | MX31_PIN_FPSHIFT__FPSHIFT, | 140 | MX31_PIN_FPSHIFT__FPSHIFT, |
140 | MX31_PIN_CONTRAST__CONTRAST, | 141 | MX31_PIN_CONTRAST__CONTRAST, |
141 | /* CSI */ | 142 | /* CSI */ |
142 | MX31_PIN_CSI_D6__CSI_D6, | 143 | MX31_PIN_CSI_D6__CSI_D6, |
143 | MX31_PIN_CSI_D7__CSI_D7, | 144 | MX31_PIN_CSI_D7__CSI_D7, |
144 | MX31_PIN_CSI_D8__CSI_D8, | 145 | MX31_PIN_CSI_D8__CSI_D8, |
145 | MX31_PIN_CSI_D9__CSI_D9, | 146 | MX31_PIN_CSI_D9__CSI_D9, |
146 | MX31_PIN_CSI_D10__CSI_D10, | 147 | MX31_PIN_CSI_D10__CSI_D10, |
147 | MX31_PIN_CSI_D11__CSI_D11, | 148 | MX31_PIN_CSI_D11__CSI_D11, |
148 | MX31_PIN_CSI_D12__CSI_D12, | 149 | MX31_PIN_CSI_D12__CSI_D12, |
149 | MX31_PIN_CSI_D13__CSI_D13, | 150 | MX31_PIN_CSI_D13__CSI_D13, |
150 | MX31_PIN_CSI_D14__CSI_D14, | 151 | MX31_PIN_CSI_D14__CSI_D14, |
151 | MX31_PIN_CSI_D15__CSI_D15, | 152 | MX31_PIN_CSI_D15__CSI_D15, |
152 | MX31_PIN_CSI_HSYNC__CSI_HSYNC, | 153 | MX31_PIN_CSI_HSYNC__CSI_HSYNC, |
153 | MX31_PIN_CSI_MCLK__CSI_MCLK, | 154 | MX31_PIN_CSI_MCLK__CSI_MCLK, |
154 | MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, | 155 | MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, |
155 | MX31_PIN_CSI_VSYNC__CSI_VSYNC, | 156 | MX31_PIN_CSI_VSYNC__CSI_VSYNC, |
156 | MX31_PIN_CSI_D5__GPIO3_5, /* CMOS PWDN */ | 157 | MX31_PIN_CSI_D5__GPIO3_5, /* CMOS PWDN */ |
157 | IOMUX_MODE(MX31_PIN_RI_DTE1, IOMUX_CONFIG_GPIO), /* CMOS reset */ | 158 | IOMUX_MODE(MX31_PIN_RI_DTE1, IOMUX_CONFIG_GPIO), /* CMOS reset */ |
158 | }; | 159 | }; |
159 | 160 | ||
160 | /* | 161 | /* |
161 | * Camera support | 162 | * Camera support |
162 | */ | 163 | */ |
163 | static phys_addr_t mx3_camera_base __initdata; | 164 | static phys_addr_t mx3_camera_base __initdata; |
164 | #define MX31_3DS_CAMERA_BUF_SIZE SZ_8M | 165 | #define MX31_3DS_CAMERA_BUF_SIZE SZ_8M |
165 | 166 | ||
166 | #define MX31_3DS_GPIO_CAMERA_PW IOMUX_TO_GPIO(MX31_PIN_CSI_D5) | 167 | #define MX31_3DS_GPIO_CAMERA_PW IOMUX_TO_GPIO(MX31_PIN_CSI_D5) |
167 | #define MX31_3DS_GPIO_CAMERA_RST IOMUX_TO_GPIO(MX31_PIN_RI_DTE1) | 168 | #define MX31_3DS_GPIO_CAMERA_RST IOMUX_TO_GPIO(MX31_PIN_RI_DTE1) |
168 | 169 | ||
169 | static struct gpio mx31_3ds_camera_gpios[] = { | 170 | static struct gpio mx31_3ds_camera_gpios[] = { |
170 | { MX31_3DS_GPIO_CAMERA_PW, GPIOF_OUT_INIT_HIGH, "camera-power" }, | 171 | { MX31_3DS_GPIO_CAMERA_PW, GPIOF_OUT_INIT_HIGH, "camera-power" }, |
171 | { MX31_3DS_GPIO_CAMERA_RST, GPIOF_OUT_INIT_HIGH, "camera-reset" }, | 172 | { MX31_3DS_GPIO_CAMERA_RST, GPIOF_OUT_INIT_HIGH, "camera-reset" }, |
172 | }; | 173 | }; |
173 | 174 | ||
174 | static const struct mx3_camera_pdata mx31_3ds_camera_pdata __initconst = { | 175 | static const struct mx3_camera_pdata mx31_3ds_camera_pdata __initconst = { |
175 | .flags = MX3_CAMERA_DATAWIDTH_10, | 176 | .flags = MX3_CAMERA_DATAWIDTH_10, |
176 | .mclk_10khz = 2600, | 177 | .mclk_10khz = 2600, |
177 | }; | 178 | }; |
178 | 179 | ||
179 | static int __init mx31_3ds_init_camera(void) | 180 | static int __init mx31_3ds_init_camera(void) |
180 | { | 181 | { |
181 | int dma, ret = -ENOMEM; | 182 | int dma, ret = -ENOMEM; |
182 | struct platform_device *pdev = | 183 | struct platform_device *pdev = |
183 | imx31_alloc_mx3_camera(&mx31_3ds_camera_pdata); | 184 | imx31_alloc_mx3_camera(&mx31_3ds_camera_pdata); |
184 | 185 | ||
185 | if (IS_ERR(pdev)) | 186 | if (IS_ERR(pdev)) |
186 | return PTR_ERR(pdev); | 187 | return PTR_ERR(pdev); |
187 | 188 | ||
188 | if (!mx3_camera_base) | 189 | if (!mx3_camera_base) |
189 | goto err; | 190 | goto err; |
190 | 191 | ||
191 | dma = dma_declare_coherent_memory(&pdev->dev, | 192 | dma = dma_declare_coherent_memory(&pdev->dev, |
192 | mx3_camera_base, mx3_camera_base, | 193 | mx3_camera_base, mx3_camera_base, |
193 | MX31_3DS_CAMERA_BUF_SIZE, | 194 | MX31_3DS_CAMERA_BUF_SIZE, |
194 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | 195 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); |
195 | 196 | ||
196 | if (!(dma & DMA_MEMORY_MAP)) | 197 | if (!(dma & DMA_MEMORY_MAP)) |
197 | goto err; | 198 | goto err; |
198 | 199 | ||
199 | ret = platform_device_add(pdev); | 200 | ret = platform_device_add(pdev); |
200 | if (ret) | 201 | if (ret) |
201 | err: | 202 | err: |
202 | platform_device_put(pdev); | 203 | platform_device_put(pdev); |
203 | 204 | ||
204 | return ret; | 205 | return ret; |
205 | } | 206 | } |
206 | 207 | ||
207 | static int mx31_3ds_camera_power(struct device *dev, int on) | 208 | static int mx31_3ds_camera_power(struct device *dev, int on) |
208 | { | 209 | { |
209 | /* enable or disable the camera */ | 210 | /* enable or disable the camera */ |
210 | pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE"); | 211 | pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE"); |
211 | gpio_set_value(MX31_3DS_GPIO_CAMERA_PW, on ? 0 : 1); | 212 | gpio_set_value(MX31_3DS_GPIO_CAMERA_PW, on ? 0 : 1); |
212 | 213 | ||
213 | if (!on) | 214 | if (!on) |
214 | goto out; | 215 | goto out; |
215 | 216 | ||
216 | /* If enabled, give a reset impulse */ | 217 | /* If enabled, give a reset impulse */ |
217 | gpio_set_value(MX31_3DS_GPIO_CAMERA_RST, 0); | 218 | gpio_set_value(MX31_3DS_GPIO_CAMERA_RST, 0); |
218 | msleep(20); | 219 | msleep(20); |
219 | gpio_set_value(MX31_3DS_GPIO_CAMERA_RST, 1); | 220 | gpio_set_value(MX31_3DS_GPIO_CAMERA_RST, 1); |
220 | msleep(100); | 221 | msleep(100); |
221 | 222 | ||
222 | out: | 223 | out: |
223 | return 0; | 224 | return 0; |
224 | } | 225 | } |
225 | 226 | ||
226 | static struct i2c_board_info mx31_3ds_i2c_camera = { | 227 | static struct i2c_board_info mx31_3ds_i2c_camera = { |
227 | I2C_BOARD_INFO("ov2640", 0x30), | 228 | I2C_BOARD_INFO("ov2640", 0x30), |
228 | }; | 229 | }; |
229 | 230 | ||
230 | static struct regulator_bulk_data mx31_3ds_camera_regs[] = { | 231 | static struct regulator_bulk_data mx31_3ds_camera_regs[] = { |
231 | { .supply = "cmos_vcore" }, | 232 | { .supply = "cmos_vcore" }, |
232 | { .supply = "cmos_2v8" }, | 233 | { .supply = "cmos_2v8" }, |
233 | }; | 234 | }; |
234 | 235 | ||
235 | static struct soc_camera_link iclink_ov2640 = { | 236 | static struct soc_camera_link iclink_ov2640 = { |
236 | .bus_id = 0, | 237 | .bus_id = 0, |
237 | .board_info = &mx31_3ds_i2c_camera, | 238 | .board_info = &mx31_3ds_i2c_camera, |
238 | .i2c_adapter_id = 0, | 239 | .i2c_adapter_id = 0, |
239 | .power = mx31_3ds_camera_power, | 240 | .power = mx31_3ds_camera_power, |
240 | .regulators = mx31_3ds_camera_regs, | 241 | .regulators = mx31_3ds_camera_regs, |
241 | .num_regulators = ARRAY_SIZE(mx31_3ds_camera_regs), | 242 | .num_regulators = ARRAY_SIZE(mx31_3ds_camera_regs), |
242 | }; | 243 | }; |
243 | 244 | ||
244 | static struct platform_device mx31_3ds_ov2640 = { | 245 | static struct platform_device mx31_3ds_ov2640 = { |
245 | .name = "soc-camera-pdrv", | 246 | .name = "soc-camera-pdrv", |
246 | .id = 0, | 247 | .id = 0, |
247 | .dev = { | 248 | .dev = { |
248 | .platform_data = &iclink_ov2640, | 249 | .platform_data = &iclink_ov2640, |
249 | }, | 250 | }, |
250 | }; | 251 | }; |
251 | 252 | ||
252 | /* | 253 | /* |
253 | * FB support | 254 | * FB support |
254 | */ | 255 | */ |
255 | static const struct fb_videomode fb_modedb[] = { | 256 | static const struct fb_videomode fb_modedb[] = { |
256 | { /* 480x640 @ 60 Hz */ | 257 | { /* 480x640 @ 60 Hz */ |
257 | .name = "Epson-VGA", | 258 | .name = "Epson-VGA", |
258 | .refresh = 60, | 259 | .refresh = 60, |
259 | .xres = 480, | 260 | .xres = 480, |
260 | .yres = 640, | 261 | .yres = 640, |
261 | .pixclock = 41701, | 262 | .pixclock = 41701, |
262 | .left_margin = 20, | 263 | .left_margin = 20, |
263 | .right_margin = 41, | 264 | .right_margin = 41, |
264 | .upper_margin = 10, | 265 | .upper_margin = 10, |
265 | .lower_margin = 5, | 266 | .lower_margin = 5, |
266 | .hsync_len = 20, | 267 | .hsync_len = 20, |
267 | .vsync_len = 10, | 268 | .vsync_len = 10, |
268 | .sync = FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT, | 269 | .sync = FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT, |
269 | .vmode = FB_VMODE_NONINTERLACED, | 270 | .vmode = FB_VMODE_NONINTERLACED, |
270 | .flag = 0, | 271 | .flag = 0, |
271 | }, | 272 | }, |
272 | }; | 273 | }; |
273 | 274 | ||
274 | static struct ipu_platform_data mx3_ipu_data = { | 275 | static struct ipu_platform_data mx3_ipu_data = { |
275 | .irq_base = MXC_IPU_IRQ_START, | 276 | .irq_base = MXC_IPU_IRQ_START, |
276 | }; | 277 | }; |
277 | 278 | ||
278 | static struct mx3fb_platform_data mx3fb_pdata __initdata = { | 279 | static struct mx3fb_platform_data mx3fb_pdata __initdata = { |
279 | .name = "Epson-VGA", | 280 | .name = "Epson-VGA", |
280 | .mode = fb_modedb, | 281 | .mode = fb_modedb, |
281 | .num_modes = ARRAY_SIZE(fb_modedb), | 282 | .num_modes = ARRAY_SIZE(fb_modedb), |
282 | }; | 283 | }; |
283 | 284 | ||
284 | /* LCD */ | 285 | /* LCD */ |
285 | static struct l4f00242t03_pdata mx31_3ds_l4f00242t03_pdata = { | 286 | static struct l4f00242t03_pdata mx31_3ds_l4f00242t03_pdata = { |
286 | .reset_gpio = IOMUX_TO_GPIO(MX31_PIN_LCS1), | 287 | .reset_gpio = IOMUX_TO_GPIO(MX31_PIN_LCS1), |
287 | .data_enable_gpio = IOMUX_TO_GPIO(MX31_PIN_SER_RS), | 288 | .data_enable_gpio = IOMUX_TO_GPIO(MX31_PIN_SER_RS), |
288 | }; | 289 | }; |
289 | 290 | ||
290 | /* | 291 | /* |
291 | * Support for SD card slot in personality board | 292 | * Support for SD card slot in personality board |
292 | */ | 293 | */ |
293 | #define MX31_3DS_GPIO_SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_GPIO3_1) | 294 | #define MX31_3DS_GPIO_SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_GPIO3_1) |
294 | #define MX31_3DS_GPIO_SDHC1_BE IOMUX_TO_GPIO(MX31_PIN_GPIO3_0) | 295 | #define MX31_3DS_GPIO_SDHC1_BE IOMUX_TO_GPIO(MX31_PIN_GPIO3_0) |
295 | 296 | ||
296 | static struct gpio mx31_3ds_sdhc1_gpios[] = { | 297 | static struct gpio mx31_3ds_sdhc1_gpios[] = { |
297 | { MX31_3DS_GPIO_SDHC1_CD, GPIOF_IN, "sdhc1-card-detect" }, | 298 | { MX31_3DS_GPIO_SDHC1_CD, GPIOF_IN, "sdhc1-card-detect" }, |
298 | { MX31_3DS_GPIO_SDHC1_BE, GPIOF_OUT_INIT_LOW, "sdhc1-bus-en" }, | 299 | { MX31_3DS_GPIO_SDHC1_BE, GPIOF_OUT_INIT_LOW, "sdhc1-bus-en" }, |
299 | }; | 300 | }; |
300 | 301 | ||
301 | static int mx31_3ds_sdhc1_init(struct device *dev, | 302 | static int mx31_3ds_sdhc1_init(struct device *dev, |
302 | irq_handler_t detect_irq, | 303 | irq_handler_t detect_irq, |
303 | void *data) | 304 | void *data) |
304 | { | 305 | { |
305 | int ret; | 306 | int ret; |
306 | 307 | ||
307 | ret = gpio_request_array(mx31_3ds_sdhc1_gpios, | 308 | ret = gpio_request_array(mx31_3ds_sdhc1_gpios, |
308 | ARRAY_SIZE(mx31_3ds_sdhc1_gpios)); | 309 | ARRAY_SIZE(mx31_3ds_sdhc1_gpios)); |
309 | if (ret) { | 310 | if (ret) { |
310 | pr_warning("Unable to request the SD/MMC GPIOs.\n"); | 311 | pr_warning("Unable to request the SD/MMC GPIOs.\n"); |
311 | return ret; | 312 | return ret; |
312 | } | 313 | } |
313 | 314 | ||
314 | ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), | 315 | ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), |
315 | detect_irq, IRQF_DISABLED | | 316 | detect_irq, IRQF_DISABLED | |
316 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, | 317 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, |
317 | "sdhc1-detect", data); | 318 | "sdhc1-detect", data); |
318 | if (ret) { | 319 | if (ret) { |
319 | pr_warning("Unable to request the SD/MMC card-detect IRQ.\n"); | 320 | pr_warning("Unable to request the SD/MMC card-detect IRQ.\n"); |
320 | goto gpio_free; | 321 | goto gpio_free; |
321 | } | 322 | } |
322 | 323 | ||
323 | return 0; | 324 | return 0; |
324 | 325 | ||
325 | gpio_free: | 326 | gpio_free: |
326 | gpio_free_array(mx31_3ds_sdhc1_gpios, | 327 | gpio_free_array(mx31_3ds_sdhc1_gpios, |
327 | ARRAY_SIZE(mx31_3ds_sdhc1_gpios)); | 328 | ARRAY_SIZE(mx31_3ds_sdhc1_gpios)); |
328 | return ret; | 329 | return ret; |
329 | } | 330 | } |
330 | 331 | ||
331 | static void mx31_3ds_sdhc1_exit(struct device *dev, void *data) | 332 | static void mx31_3ds_sdhc1_exit(struct device *dev, void *data) |
332 | { | 333 | { |
333 | free_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), data); | 334 | free_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), data); |
334 | gpio_free_array(mx31_3ds_sdhc1_gpios, | 335 | gpio_free_array(mx31_3ds_sdhc1_gpios, |
335 | ARRAY_SIZE(mx31_3ds_sdhc1_gpios)); | 336 | ARRAY_SIZE(mx31_3ds_sdhc1_gpios)); |
336 | } | 337 | } |
337 | 338 | ||
338 | static void mx31_3ds_sdhc1_setpower(struct device *dev, unsigned int vdd) | 339 | static void mx31_3ds_sdhc1_setpower(struct device *dev, unsigned int vdd) |
339 | { | 340 | { |
340 | /* | 341 | /* |
341 | * While the voltage stuff is done by the driver, activate the | 342 | * While the voltage stuff is done by the driver, activate the |
342 | * Buffer Enable Pin only if there is a card in slot to fix the card | 343 | * Buffer Enable Pin only if there is a card in slot to fix the card |
343 | * voltage issue caused by bi-directional chip TXB0108 on 3Stack. | 344 | * voltage issue caused by bi-directional chip TXB0108 on 3Stack. |
344 | * Done here because at this stage we have for sure a debounced value | 345 | * Done here because at this stage we have for sure a debounced value |
345 | * of the presence of the card, showed by the value of vdd. | 346 | * of the presence of the card, showed by the value of vdd. |
346 | * 7 == ilog2(MMC_VDD_165_195) | 347 | * 7 == ilog2(MMC_VDD_165_195) |
347 | */ | 348 | */ |
348 | if (vdd > 7) | 349 | if (vdd > 7) |
349 | gpio_set_value(MX31_3DS_GPIO_SDHC1_BE, 1); | 350 | gpio_set_value(MX31_3DS_GPIO_SDHC1_BE, 1); |
350 | else | 351 | else |
351 | gpio_set_value(MX31_3DS_GPIO_SDHC1_BE, 0); | 352 | gpio_set_value(MX31_3DS_GPIO_SDHC1_BE, 0); |
352 | } | 353 | } |
353 | 354 | ||
354 | static struct imxmmc_platform_data sdhc1_pdata = { | 355 | static struct imxmmc_platform_data sdhc1_pdata = { |
355 | .init = mx31_3ds_sdhc1_init, | 356 | .init = mx31_3ds_sdhc1_init, |
356 | .exit = mx31_3ds_sdhc1_exit, | 357 | .exit = mx31_3ds_sdhc1_exit, |
357 | .setpower = mx31_3ds_sdhc1_setpower, | 358 | .setpower = mx31_3ds_sdhc1_setpower, |
358 | }; | 359 | }; |
359 | 360 | ||
360 | /* | 361 | /* |
361 | * Matrix keyboard | 362 | * Matrix keyboard |
362 | */ | 363 | */ |
363 | 364 | ||
364 | static const uint32_t mx31_3ds_keymap[] = { | 365 | static const uint32_t mx31_3ds_keymap[] = { |
365 | KEY(0, 0, KEY_UP), | 366 | KEY(0, 0, KEY_UP), |
366 | KEY(0, 1, KEY_DOWN), | 367 | KEY(0, 1, KEY_DOWN), |
367 | KEY(1, 0, KEY_RIGHT), | 368 | KEY(1, 0, KEY_RIGHT), |
368 | KEY(1, 1, KEY_LEFT), | 369 | KEY(1, 1, KEY_LEFT), |
369 | KEY(1, 2, KEY_ENTER), | 370 | KEY(1, 2, KEY_ENTER), |
370 | KEY(2, 0, KEY_F6), | 371 | KEY(2, 0, KEY_F6), |
371 | KEY(2, 1, KEY_F8), | 372 | KEY(2, 1, KEY_F8), |
372 | KEY(2, 2, KEY_F9), | 373 | KEY(2, 2, KEY_F9), |
373 | KEY(2, 3, KEY_F10), | 374 | KEY(2, 3, KEY_F10), |
374 | }; | 375 | }; |
375 | 376 | ||
376 | static const struct matrix_keymap_data mx31_3ds_keymap_data __initconst = { | 377 | static const struct matrix_keymap_data mx31_3ds_keymap_data __initconst = { |
377 | .keymap = mx31_3ds_keymap, | 378 | .keymap = mx31_3ds_keymap, |
378 | .keymap_size = ARRAY_SIZE(mx31_3ds_keymap), | 379 | .keymap_size = ARRAY_SIZE(mx31_3ds_keymap), |
379 | }; | 380 | }; |
380 | 381 | ||
381 | /* Regulators */ | 382 | /* Regulators */ |
382 | static struct regulator_init_data pwgtx_init = { | 383 | static struct regulator_init_data pwgtx_init = { |
383 | .constraints = { | 384 | .constraints = { |
384 | .boot_on = 1, | 385 | .boot_on = 1, |
385 | .always_on = 1, | 386 | .always_on = 1, |
386 | }, | 387 | }, |
387 | }; | 388 | }; |
388 | 389 | ||
389 | static struct regulator_init_data gpo_init = { | 390 | static struct regulator_init_data gpo_init = { |
390 | .constraints = { | 391 | .constraints = { |
391 | .boot_on = 1, | 392 | .boot_on = 1, |
392 | .always_on = 1, | 393 | .always_on = 1, |
393 | } | 394 | } |
394 | }; | 395 | }; |
395 | 396 | ||
396 | static struct regulator_consumer_supply vmmc2_consumers[] = { | 397 | static struct regulator_consumer_supply vmmc2_consumers[] = { |
397 | REGULATOR_SUPPLY("vmmc", "mxc-mmc.0"), | 398 | REGULATOR_SUPPLY("vmmc", "mxc-mmc.0"), |
398 | }; | 399 | }; |
399 | 400 | ||
400 | static struct regulator_init_data vmmc2_init = { | 401 | static struct regulator_init_data vmmc2_init = { |
401 | .constraints = { | 402 | .constraints = { |
402 | .min_uV = 3000000, | 403 | .min_uV = 3000000, |
403 | .max_uV = 3000000, | 404 | .max_uV = 3000000, |
404 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | 405 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
405 | REGULATOR_CHANGE_STATUS, | 406 | REGULATOR_CHANGE_STATUS, |
406 | }, | 407 | }, |
407 | .num_consumer_supplies = ARRAY_SIZE(vmmc2_consumers), | 408 | .num_consumer_supplies = ARRAY_SIZE(vmmc2_consumers), |
408 | .consumer_supplies = vmmc2_consumers, | 409 | .consumer_supplies = vmmc2_consumers, |
409 | }; | 410 | }; |
410 | 411 | ||
411 | static struct regulator_consumer_supply vmmc1_consumers[] = { | 412 | static struct regulator_consumer_supply vmmc1_consumers[] = { |
412 | REGULATOR_SUPPLY("vcore", "spi0.0"), | 413 | REGULATOR_SUPPLY("vcore", "spi0.0"), |
413 | REGULATOR_SUPPLY("cmos_2v8", "soc-camera-pdrv.0"), | 414 | REGULATOR_SUPPLY("cmos_2v8", "soc-camera-pdrv.0"), |
414 | }; | 415 | }; |
415 | 416 | ||
416 | static struct regulator_init_data vmmc1_init = { | 417 | static struct regulator_init_data vmmc1_init = { |
417 | .constraints = { | 418 | .constraints = { |
418 | .min_uV = 2800000, | 419 | .min_uV = 2800000, |
419 | .max_uV = 2800000, | 420 | .max_uV = 2800000, |
420 | .apply_uV = 1, | 421 | .apply_uV = 1, |
421 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | 422 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
422 | REGULATOR_CHANGE_STATUS, | 423 | REGULATOR_CHANGE_STATUS, |
423 | }, | 424 | }, |
424 | .num_consumer_supplies = ARRAY_SIZE(vmmc1_consumers), | 425 | .num_consumer_supplies = ARRAY_SIZE(vmmc1_consumers), |
425 | .consumer_supplies = vmmc1_consumers, | 426 | .consumer_supplies = vmmc1_consumers, |
426 | }; | 427 | }; |
427 | 428 | ||
428 | static struct regulator_consumer_supply vgen_consumers[] = { | 429 | static struct regulator_consumer_supply vgen_consumers[] = { |
429 | REGULATOR_SUPPLY("vdd", "spi0.0"), | 430 | REGULATOR_SUPPLY("vdd", "spi0.0"), |
430 | }; | 431 | }; |
431 | 432 | ||
432 | static struct regulator_init_data vgen_init = { | 433 | static struct regulator_init_data vgen_init = { |
433 | .constraints = { | 434 | .constraints = { |
434 | .min_uV = 1800000, | 435 | .min_uV = 1800000, |
435 | .max_uV = 1800000, | 436 | .max_uV = 1800000, |
436 | .apply_uV = 1, | 437 | .apply_uV = 1, |
437 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | 438 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
438 | REGULATOR_CHANGE_STATUS, | 439 | REGULATOR_CHANGE_STATUS, |
439 | }, | 440 | }, |
440 | .num_consumer_supplies = ARRAY_SIZE(vgen_consumers), | 441 | .num_consumer_supplies = ARRAY_SIZE(vgen_consumers), |
441 | .consumer_supplies = vgen_consumers, | 442 | .consumer_supplies = vgen_consumers, |
442 | }; | 443 | }; |
443 | 444 | ||
444 | static struct regulator_consumer_supply vvib_consumers[] = { | 445 | static struct regulator_consumer_supply vvib_consumers[] = { |
445 | REGULATOR_SUPPLY("cmos_vcore", "soc-camera-pdrv.0"), | 446 | REGULATOR_SUPPLY("cmos_vcore", "soc-camera-pdrv.0"), |
446 | }; | 447 | }; |
447 | 448 | ||
448 | static struct regulator_init_data vvib_init = { | 449 | static struct regulator_init_data vvib_init = { |
449 | .constraints = { | 450 | .constraints = { |
450 | .min_uV = 1300000, | 451 | .min_uV = 1300000, |
451 | .max_uV = 1300000, | 452 | .max_uV = 1300000, |
452 | .apply_uV = 1, | 453 | .apply_uV = 1, |
453 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | 454 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
454 | REGULATOR_CHANGE_STATUS, | 455 | REGULATOR_CHANGE_STATUS, |
455 | }, | 456 | }, |
456 | .num_consumer_supplies = ARRAY_SIZE(vvib_consumers), | 457 | .num_consumer_supplies = ARRAY_SIZE(vvib_consumers), |
457 | .consumer_supplies = vvib_consumers, | 458 | .consumer_supplies = vvib_consumers, |
458 | }; | 459 | }; |
459 | 460 | ||
460 | static struct mc13xxx_regulator_init_data mx31_3ds_regulators[] = { | 461 | static struct mc13xxx_regulator_init_data mx31_3ds_regulators[] = { |
461 | { | 462 | { |
462 | .id = MC13783_REG_PWGT1SPI, /* Power Gate for ARM core. */ | 463 | .id = MC13783_REG_PWGT1SPI, /* Power Gate for ARM core. */ |
463 | .init_data = &pwgtx_init, | 464 | .init_data = &pwgtx_init, |
464 | }, { | 465 | }, { |
465 | .id = MC13783_REG_PWGT2SPI, /* Power Gate for L2 Cache. */ | 466 | .id = MC13783_REG_PWGT2SPI, /* Power Gate for L2 Cache. */ |
466 | .init_data = &pwgtx_init, | 467 | .init_data = &pwgtx_init, |
467 | }, { | 468 | }, { |
468 | 469 | ||
469 | .id = MC13783_REG_GPO1, /* Turn on 1.8V */ | 470 | .id = MC13783_REG_GPO1, /* Turn on 1.8V */ |
470 | .init_data = &gpo_init, | 471 | .init_data = &gpo_init, |
471 | }, { | 472 | }, { |
472 | .id = MC13783_REG_GPO3, /* Turn on 3.3V */ | 473 | .id = MC13783_REG_GPO3, /* Turn on 3.3V */ |
473 | .init_data = &gpo_init, | 474 | .init_data = &gpo_init, |
474 | }, { | 475 | }, { |
475 | .id = MC13783_REG_VMMC2, /* Power MMC/SD, WiFi/Bluetooth. */ | 476 | .id = MC13783_REG_VMMC2, /* Power MMC/SD, WiFi/Bluetooth. */ |
476 | .init_data = &vmmc2_init, | 477 | .init_data = &vmmc2_init, |
477 | }, { | 478 | }, { |
478 | .id = MC13783_REG_VMMC1, /* Power LCD, CMOS, FM, GPS, Accel. */ | 479 | .id = MC13783_REG_VMMC1, /* Power LCD, CMOS, FM, GPS, Accel. */ |
479 | .init_data = &vmmc1_init, | 480 | .init_data = &vmmc1_init, |
480 | }, { | 481 | }, { |
481 | .id = MC13783_REG_VGEN, /* Power LCD */ | 482 | .id = MC13783_REG_VGEN, /* Power LCD */ |
482 | .init_data = &vgen_init, | 483 | .init_data = &vgen_init, |
483 | }, { | 484 | }, { |
484 | .id = MC13783_REG_VVIB, /* Power CMOS */ | 485 | .id = MC13783_REG_VVIB, /* Power CMOS */ |
485 | .init_data = &vvib_init, | 486 | .init_data = &vvib_init, |
486 | }, | 487 | }, |
487 | }; | 488 | }; |
488 | 489 | ||
489 | /* MC13783 */ | 490 | /* MC13783 */ |
490 | static struct mc13xxx_platform_data mc13783_pdata = { | 491 | static struct mc13xxx_platform_data mc13783_pdata = { |
491 | .regulators = { | 492 | .regulators = { |
492 | .regulators = mx31_3ds_regulators, | 493 | .regulators = mx31_3ds_regulators, |
493 | .num_regulators = ARRAY_SIZE(mx31_3ds_regulators), | 494 | .num_regulators = ARRAY_SIZE(mx31_3ds_regulators), |
494 | }, | 495 | }, |
495 | .flags = MC13XXX_USE_TOUCHSCREEN | MC13XXX_USE_RTC, | 496 | .flags = MC13XXX_USE_TOUCHSCREEN | MC13XXX_USE_RTC, |
496 | }; | 497 | }; |
497 | 498 | ||
498 | /* SPI */ | 499 | /* SPI */ |
499 | static int spi0_internal_chipselect[] = { | 500 | static int spi0_internal_chipselect[] = { |
500 | MXC_SPI_CS(2), | 501 | MXC_SPI_CS(2), |
501 | }; | 502 | }; |
502 | 503 | ||
503 | static const struct spi_imx_master spi0_pdata __initconst = { | 504 | static const struct spi_imx_master spi0_pdata __initconst = { |
504 | .chipselect = spi0_internal_chipselect, | 505 | .chipselect = spi0_internal_chipselect, |
505 | .num_chipselect = ARRAY_SIZE(spi0_internal_chipselect), | 506 | .num_chipselect = ARRAY_SIZE(spi0_internal_chipselect), |
506 | }; | 507 | }; |
507 | 508 | ||
508 | static int spi1_internal_chipselect[] = { | 509 | static int spi1_internal_chipselect[] = { |
509 | MXC_SPI_CS(0), | 510 | MXC_SPI_CS(0), |
510 | MXC_SPI_CS(2), | 511 | MXC_SPI_CS(2), |
511 | }; | 512 | }; |
512 | 513 | ||
513 | static const struct spi_imx_master spi1_pdata __initconst = { | 514 | static const struct spi_imx_master spi1_pdata __initconst = { |
514 | .chipselect = spi1_internal_chipselect, | 515 | .chipselect = spi1_internal_chipselect, |
515 | .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect), | 516 | .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect), |
516 | }; | 517 | }; |
517 | 518 | ||
518 | static struct spi_board_info mx31_3ds_spi_devs[] __initdata = { | 519 | static struct spi_board_info mx31_3ds_spi_devs[] __initdata = { |
519 | { | 520 | { |
520 | .modalias = "mc13783", | 521 | .modalias = "mc13783", |
521 | .max_speed_hz = 1000000, | 522 | .max_speed_hz = 1000000, |
522 | .bus_num = 1, | 523 | .bus_num = 1, |
523 | .chip_select = 1, /* SS2 */ | 524 | .chip_select = 1, /* SS2 */ |
524 | .platform_data = &mc13783_pdata, | 525 | .platform_data = &mc13783_pdata, |
525 | .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3), | 526 | .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3), |
526 | .mode = SPI_CS_HIGH, | 527 | .mode = SPI_CS_HIGH, |
527 | }, { | 528 | }, { |
528 | .modalias = "l4f00242t03", | 529 | .modalias = "l4f00242t03", |
529 | .max_speed_hz = 5000000, | 530 | .max_speed_hz = 5000000, |
530 | .bus_num = 0, | 531 | .bus_num = 0, |
531 | .chip_select = 0, /* SS2 */ | 532 | .chip_select = 0, /* SS2 */ |
532 | .platform_data = &mx31_3ds_l4f00242t03_pdata, | 533 | .platform_data = &mx31_3ds_l4f00242t03_pdata, |
533 | }, | 534 | }, |
534 | }; | 535 | }; |
535 | 536 | ||
536 | /* | 537 | /* |
537 | * NAND Flash | 538 | * NAND Flash |
538 | */ | 539 | */ |
539 | static const struct mxc_nand_platform_data | 540 | static const struct mxc_nand_platform_data |
540 | mx31_3ds_nand_board_info __initconst = { | 541 | mx31_3ds_nand_board_info __initconst = { |
541 | .width = 1, | 542 | .width = 1, |
542 | .hw_ecc = 1, | 543 | .hw_ecc = 1, |
543 | #ifdef CONFIG_MACH_MX31_3DS_MXC_NAND_USE_BBT | 544 | #ifdef CONFIG_MACH_MX31_3DS_MXC_NAND_USE_BBT |
544 | .flash_bbt = 1, | 545 | .flash_bbt = 1, |
545 | #endif | 546 | #endif |
546 | }; | 547 | }; |
547 | 548 | ||
548 | /* | 549 | /* |
549 | * USB OTG | 550 | * USB OTG |
550 | */ | 551 | */ |
551 | 552 | ||
552 | #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ | 553 | #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ |
553 | PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) | 554 | PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) |
554 | 555 | ||
555 | #define USBOTG_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_PWR) | 556 | #define USBOTG_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_PWR) |
556 | #define USBH2_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_BYP) | 557 | #define USBH2_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_BYP) |
557 | 558 | ||
558 | static int mx31_3ds_usbotg_init(void) | 559 | static int mx31_3ds_usbotg_init(void) |
559 | { | 560 | { |
560 | int err; | 561 | int err; |
561 | 562 | ||
562 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG); | 563 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG); |
563 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG); | 564 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG); |
564 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG); | 565 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG); |
565 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG); | 566 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG); |
566 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG); | 567 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG); |
567 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG); | 568 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG); |
568 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG); | 569 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG); |
569 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG); | 570 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG); |
570 | mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG); | 571 | mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG); |
571 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG); | 572 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG); |
572 | mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG); | 573 | mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG); |
573 | mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG); | 574 | mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG); |
574 | 575 | ||
575 | err = gpio_request(USBOTG_RST_B, "otgusb-reset"); | 576 | err = gpio_request(USBOTG_RST_B, "otgusb-reset"); |
576 | if (err) { | 577 | if (err) { |
577 | pr_err("Failed to request the USB OTG reset gpio\n"); | 578 | pr_err("Failed to request the USB OTG reset gpio\n"); |
578 | return err; | 579 | return err; |
579 | } | 580 | } |
580 | 581 | ||
581 | err = gpio_direction_output(USBOTG_RST_B, 0); | 582 | err = gpio_direction_output(USBOTG_RST_B, 0); |
582 | if (err) { | 583 | if (err) { |
583 | pr_err("Failed to drive the USB OTG reset gpio\n"); | 584 | pr_err("Failed to drive the USB OTG reset gpio\n"); |
584 | goto usbotg_free_reset; | 585 | goto usbotg_free_reset; |
585 | } | 586 | } |
586 | 587 | ||
587 | mdelay(1); | 588 | mdelay(1); |
588 | gpio_set_value(USBOTG_RST_B, 1); | 589 | gpio_set_value(USBOTG_RST_B, 1); |
589 | return 0; | 590 | return 0; |
590 | 591 | ||
591 | usbotg_free_reset: | 592 | usbotg_free_reset: |
592 | gpio_free(USBOTG_RST_B); | 593 | gpio_free(USBOTG_RST_B); |
593 | return err; | 594 | return err; |
594 | } | 595 | } |
595 | 596 | ||
596 | static int mx31_3ds_otg_init(struct platform_device *pdev) | 597 | static int mx31_3ds_otg_init(struct platform_device *pdev) |
597 | { | 598 | { |
598 | return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED); | 599 | return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED); |
599 | } | 600 | } |
600 | 601 | ||
601 | static int mx31_3ds_host2_init(struct platform_device *pdev) | 602 | static int mx31_3ds_host2_init(struct platform_device *pdev) |
602 | { | 603 | { |
603 | int err; | 604 | int err; |
604 | 605 | ||
605 | mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG); | 606 | mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG); |
606 | mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG); | 607 | mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG); |
607 | mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG); | 608 | mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG); |
608 | mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG); | 609 | mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG); |
609 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG); | 610 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG); |
610 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG); | 611 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG); |
611 | mxc_iomux_set_pad(MX31_PIN_PC_VS2, USB_PAD_CFG); | 612 | mxc_iomux_set_pad(MX31_PIN_PC_VS2, USB_PAD_CFG); |
612 | mxc_iomux_set_pad(MX31_PIN_PC_BVD1, USB_PAD_CFG); | 613 | mxc_iomux_set_pad(MX31_PIN_PC_BVD1, USB_PAD_CFG); |
613 | mxc_iomux_set_pad(MX31_PIN_PC_BVD2, USB_PAD_CFG); | 614 | mxc_iomux_set_pad(MX31_PIN_PC_BVD2, USB_PAD_CFG); |
614 | mxc_iomux_set_pad(MX31_PIN_PC_RST, USB_PAD_CFG); | 615 | mxc_iomux_set_pad(MX31_PIN_PC_RST, USB_PAD_CFG); |
615 | mxc_iomux_set_pad(MX31_PIN_IOIS16, USB_PAD_CFG); | 616 | mxc_iomux_set_pad(MX31_PIN_IOIS16, USB_PAD_CFG); |
616 | mxc_iomux_set_pad(MX31_PIN_PC_RW_B, USB_PAD_CFG); | 617 | mxc_iomux_set_pad(MX31_PIN_PC_RW_B, USB_PAD_CFG); |
617 | 618 | ||
618 | err = gpio_request(USBH2_RST_B, "usbh2-reset"); | 619 | err = gpio_request(USBH2_RST_B, "usbh2-reset"); |
619 | if (err) { | 620 | if (err) { |
620 | pr_err("Failed to request the USB Host 2 reset gpio\n"); | 621 | pr_err("Failed to request the USB Host 2 reset gpio\n"); |
621 | return err; | 622 | return err; |
622 | } | 623 | } |
623 | 624 | ||
624 | err = gpio_direction_output(USBH2_RST_B, 0); | 625 | err = gpio_direction_output(USBH2_RST_B, 0); |
625 | if (err) { | 626 | if (err) { |
626 | pr_err("Failed to drive the USB Host 2 reset gpio\n"); | 627 | pr_err("Failed to drive the USB Host 2 reset gpio\n"); |
627 | goto usbotg_free_reset; | 628 | goto usbotg_free_reset; |
628 | } | 629 | } |
629 | 630 | ||
630 | mdelay(1); | 631 | mdelay(1); |
631 | gpio_set_value(USBH2_RST_B, 1); | 632 | gpio_set_value(USBH2_RST_B, 1); |
632 | 633 | ||
633 | mdelay(10); | 634 | mdelay(10); |
634 | 635 | ||
635 | return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED); | 636 | return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED); |
636 | 637 | ||
637 | usbotg_free_reset: | 638 | usbotg_free_reset: |
638 | gpio_free(USBH2_RST_B); | 639 | gpio_free(USBH2_RST_B); |
639 | return err; | 640 | return err; |
640 | } | 641 | } |
641 | 642 | ||
642 | static struct mxc_usbh_platform_data otg_pdata __initdata = { | 643 | static struct mxc_usbh_platform_data otg_pdata __initdata = { |
643 | .init = mx31_3ds_otg_init, | 644 | .init = mx31_3ds_otg_init, |
644 | .portsc = MXC_EHCI_MODE_ULPI, | 645 | .portsc = MXC_EHCI_MODE_ULPI, |
645 | }; | 646 | }; |
646 | 647 | ||
647 | static struct mxc_usbh_platform_data usbh2_pdata __initdata = { | 648 | static struct mxc_usbh_platform_data usbh2_pdata __initdata = { |
648 | .init = mx31_3ds_host2_init, | 649 | .init = mx31_3ds_host2_init, |
649 | .portsc = MXC_EHCI_MODE_ULPI, | 650 | .portsc = MXC_EHCI_MODE_ULPI, |
650 | }; | 651 | }; |
651 | 652 | ||
652 | static const struct fsl_usb2_platform_data usbotg_pdata __initconst = { | 653 | static const struct fsl_usb2_platform_data usbotg_pdata __initconst = { |
653 | .operating_mode = FSL_USB2_DR_DEVICE, | 654 | .operating_mode = FSL_USB2_DR_DEVICE, |
654 | .phy_mode = FSL_USB2_PHY_ULPI, | 655 | .phy_mode = FSL_USB2_PHY_ULPI, |
655 | }; | 656 | }; |
656 | 657 | ||
657 | static int otg_mode_host; | 658 | static int otg_mode_host; |
658 | 659 | ||
659 | static int __init mx31_3ds_otg_mode(char *options) | 660 | static int __init mx31_3ds_otg_mode(char *options) |
660 | { | 661 | { |
661 | if (!strcmp(options, "host")) | 662 | if (!strcmp(options, "host")) |
662 | otg_mode_host = 1; | 663 | otg_mode_host = 1; |
663 | else if (!strcmp(options, "device")) | 664 | else if (!strcmp(options, "device")) |
664 | otg_mode_host = 0; | 665 | otg_mode_host = 0; |
665 | else | 666 | else |
666 | pr_info("otg_mode neither \"host\" nor \"device\". " | 667 | pr_info("otg_mode neither \"host\" nor \"device\". " |
667 | "Defaulting to device\n"); | 668 | "Defaulting to device\n"); |
668 | return 0; | 669 | return 0; |
669 | } | 670 | } |
670 | __setup("otg_mode=", mx31_3ds_otg_mode); | 671 | __setup("otg_mode=", mx31_3ds_otg_mode); |
671 | 672 | ||
672 | static const struct imxuart_platform_data uart_pdata __initconst = { | 673 | static const struct imxuart_platform_data uart_pdata __initconst = { |
673 | .flags = IMXUART_HAVE_RTSCTS, | 674 | .flags = IMXUART_HAVE_RTSCTS, |
674 | }; | 675 | }; |
675 | 676 | ||
676 | static const struct imxi2c_platform_data mx31_3ds_i2c0_data __initconst = { | 677 | static const struct imxi2c_platform_data mx31_3ds_i2c0_data __initconst = { |
677 | .bitrate = 100000, | 678 | .bitrate = 100000, |
678 | }; | 679 | }; |
679 | 680 | ||
680 | static struct platform_device *devices[] __initdata = { | 681 | static struct platform_device *devices[] __initdata = { |
681 | &mx31_3ds_ov2640, | 682 | &mx31_3ds_ov2640, |
682 | }; | 683 | }; |
683 | 684 | ||
684 | static void __init mx31_3ds_init(void) | 685 | static void __init mx31_3ds_init(void) |
685 | { | 686 | { |
686 | int ret; | 687 | int ret; |
687 | 688 | ||
688 | imx31_soc_init(); | 689 | imx31_soc_init(); |
689 | 690 | ||
690 | /* Configure SPI1 IOMUX */ | 691 | /* Configure SPI1 IOMUX */ |
691 | mxc_iomux_set_gpr(MUX_PGP_CSPI_BB, true); | 692 | mxc_iomux_set_gpr(MUX_PGP_CSPI_BB, true); |
692 | 693 | ||
693 | mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins), | 694 | mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins), |
694 | "mx31_3ds"); | 695 | "mx31_3ds"); |
695 | 696 | ||
696 | imx31_add_imx_uart0(&uart_pdata); | 697 | imx31_add_imx_uart0(&uart_pdata); |
697 | imx31_add_mxc_nand(&mx31_3ds_nand_board_info); | 698 | imx31_add_mxc_nand(&mx31_3ds_nand_board_info); |
698 | 699 | ||
699 | imx31_add_spi_imx1(&spi1_pdata); | 700 | imx31_add_spi_imx1(&spi1_pdata); |
700 | spi_register_board_info(mx31_3ds_spi_devs, | 701 | spi_register_board_info(mx31_3ds_spi_devs, |
701 | ARRAY_SIZE(mx31_3ds_spi_devs)); | 702 | ARRAY_SIZE(mx31_3ds_spi_devs)); |
702 | 703 | ||
703 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 704 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
704 | 705 | ||
705 | imx31_add_imx_keypad(&mx31_3ds_keymap_data); | 706 | imx31_add_imx_keypad(&mx31_3ds_keymap_data); |
706 | 707 | ||
707 | mx31_3ds_usbotg_init(); | 708 | mx31_3ds_usbotg_init(); |
708 | if (otg_mode_host) { | 709 | if (otg_mode_host) { |
709 | otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | | 710 | otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | |
710 | ULPI_OTG_DRVVBUS_EXT); | 711 | ULPI_OTG_DRVVBUS_EXT); |
711 | if (otg_pdata.otg) | 712 | if (otg_pdata.otg) |
712 | imx31_add_mxc_ehci_otg(&otg_pdata); | 713 | imx31_add_mxc_ehci_otg(&otg_pdata); |
713 | } | 714 | } |
714 | usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | | 715 | usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | |
715 | ULPI_OTG_DRVVBUS_EXT); | 716 | ULPI_OTG_DRVVBUS_EXT); |
716 | if (usbh2_pdata.otg) | 717 | if (usbh2_pdata.otg) |
717 | imx31_add_mxc_ehci_hs(2, &usbh2_pdata); | 718 | imx31_add_mxc_ehci_hs(2, &usbh2_pdata); |
718 | 719 | ||
719 | if (!otg_mode_host) | 720 | if (!otg_mode_host) |
720 | imx31_add_fsl_usb2_udc(&usbotg_pdata); | 721 | imx31_add_fsl_usb2_udc(&usbotg_pdata); |
721 | 722 | ||
722 | if (mxc_expio_init(MX31_CS5_BASE_ADDR, EXPIO_PARENT_INT)) | 723 | if (mxc_expio_init(MX31_CS5_BASE_ADDR, EXPIO_PARENT_INT)) |
723 | printk(KERN_WARNING "Init of the debug board failed, all " | 724 | printk(KERN_WARNING "Init of the debug board failed, all " |
724 | "devices on the debug board are unusable.\n"); | 725 | "devices on the debug board are unusable.\n"); |
725 | imx31_add_imx2_wdt(NULL); | 726 | imx31_add_imx2_wdt(NULL); |
726 | imx31_add_imx_i2c0(&mx31_3ds_i2c0_data); | 727 | imx31_add_imx_i2c0(&mx31_3ds_i2c0_data); |
727 | imx31_add_mxc_mmc(0, &sdhc1_pdata); | 728 | imx31_add_mxc_mmc(0, &sdhc1_pdata); |
728 | 729 | ||
729 | imx31_add_spi_imx0(&spi0_pdata); | 730 | imx31_add_spi_imx0(&spi0_pdata); |
730 | imx31_add_ipu_core(&mx3_ipu_data); | 731 | imx31_add_ipu_core(&mx3_ipu_data); |
731 | imx31_add_mx3_sdc_fb(&mx3fb_pdata); | 732 | imx31_add_mx3_sdc_fb(&mx3fb_pdata); |
732 | 733 | ||
733 | /* CSI */ | 734 | /* CSI */ |
734 | /* Camera power: default - off */ | 735 | /* Camera power: default - off */ |
735 | ret = gpio_request_array(mx31_3ds_camera_gpios, | 736 | ret = gpio_request_array(mx31_3ds_camera_gpios, |
736 | ARRAY_SIZE(mx31_3ds_camera_gpios)); | 737 | ARRAY_SIZE(mx31_3ds_camera_gpios)); |
737 | if (ret) { | 738 | if (ret) { |
738 | pr_err("Failed to request camera gpios"); | 739 | pr_err("Failed to request camera gpios"); |
739 | iclink_ov2640.power = NULL; | 740 | iclink_ov2640.power = NULL; |
740 | } | 741 | } |
741 | 742 | ||
742 | mx31_3ds_init_camera(); | 743 | mx31_3ds_init_camera(); |
743 | } | 744 | } |
744 | 745 | ||
745 | static void __init mx31_3ds_timer_init(void) | 746 | static void __init mx31_3ds_timer_init(void) |
746 | { | 747 | { |
747 | mx31_clocks_init(26000000); | 748 | mx31_clocks_init(26000000); |
748 | } | 749 | } |
749 | 750 | ||
750 | static struct sys_timer mx31_3ds_timer = { | 751 | static struct sys_timer mx31_3ds_timer = { |
751 | .init = mx31_3ds_timer_init, | 752 | .init = mx31_3ds_timer_init, |
752 | }; | 753 | }; |
753 | 754 | ||
754 | static void __init mx31_3ds_reserve(void) | 755 | static void __init mx31_3ds_reserve(void) |
755 | { | 756 | { |
756 | /* reserve MX31_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */ | 757 | /* reserve MX31_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */ |
757 | mx3_camera_base = memblock_alloc(MX31_3DS_CAMERA_BUF_SIZE, | 758 | mx3_camera_base = arm_memblock_steal(MX31_3DS_CAMERA_BUF_SIZE, |
758 | MX31_3DS_CAMERA_BUF_SIZE); | 759 | MX31_3DS_CAMERA_BUF_SIZE); |
759 | memblock_free(mx3_camera_base, MX31_3DS_CAMERA_BUF_SIZE); | ||
760 | memblock_remove(mx3_camera_base, MX31_3DS_CAMERA_BUF_SIZE); | ||
761 | } | 760 | } |
762 | 761 | ||
763 | MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)") | 762 | MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)") |
764 | /* Maintainer: Freescale Semiconductor, Inc. */ | 763 | /* Maintainer: Freescale Semiconductor, Inc. */ |
765 | .atag_offset = 0x100, | 764 | .atag_offset = 0x100, |
766 | .map_io = mx31_map_io, | 765 | .map_io = mx31_map_io, |
767 | .init_early = imx31_init_early, | 766 | .init_early = imx31_init_early, |
768 | .init_irq = mx31_init_irq, | 767 | .init_irq = mx31_init_irq, |
769 | .handle_irq = imx31_handle_irq, | 768 | .handle_irq = imx31_handle_irq, |
770 | .timer = &mx31_3ds_timer, | 769 | .timer = &mx31_3ds_timer, |
771 | .init_machine = mx31_3ds_init, | 770 | .init_machine = mx31_3ds_init, |
772 | .reserve = mx31_3ds_reserve, | 771 | .reserve = mx31_3ds_reserve, |
773 | .restart = mxc_restart, | 772 | .restart = mxc_restart, |
774 | MACHINE_END | 773 | MACHINE_END |
arch/arm/mach-imx/mach-mx31moboard.c
1 | /* | 1 | /* |
2 | * Copyright (C) 2008 Valentin Longchamp, EPFL Mobots group | 2 | * Copyright (C) 2008 Valentin Longchamp, EPFL Mobots group |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the License, or | 6 | * the Free Software Foundation; either version 2 of the License, or |
7 | * (at your option) any later version. | 7 | * (at your option) any later version. |
8 | * | 8 | * |
9 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
17 | #include <linux/gfp.h> | 17 | #include <linux/gfp.h> |
18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/moduleparam.h> | 21 | #include <linux/moduleparam.h> |
22 | #include <linux/leds.h> | 22 | #include <linux/leds.h> |
23 | #include <linux/memory.h> | 23 | #include <linux/memory.h> |
24 | #include <linux/mtd/physmap.h> | 24 | #include <linux/mtd/physmap.h> |
25 | #include <linux/mtd/partitions.h> | 25 | #include <linux/mtd/partitions.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/regulator/machine.h> | 27 | #include <linux/regulator/machine.h> |
28 | #include <linux/mfd/mc13783.h> | 28 | #include <linux/mfd/mc13783.h> |
29 | #include <linux/spi/spi.h> | 29 | #include <linux/spi/spi.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/memblock.h> | 31 | #include <linux/memblock.h> |
32 | #include <linux/clk.h> | 32 | #include <linux/clk.h> |
33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
34 | #include <linux/err.h> | 34 | #include <linux/err.h> |
35 | #include <linux/input.h> | 35 | #include <linux/input.h> |
36 | 36 | ||
37 | #include <linux/usb/otg.h> | 37 | #include <linux/usb/otg.h> |
38 | #include <linux/usb/ulpi.h> | 38 | #include <linux/usb/ulpi.h> |
39 | 39 | ||
40 | #include <asm/mach-types.h> | 40 | #include <asm/mach-types.h> |
41 | #include <asm/mach/arch.h> | 41 | #include <asm/mach/arch.h> |
42 | #include <asm/mach/time.h> | 42 | #include <asm/mach/time.h> |
43 | #include <asm/mach/map.h> | 43 | #include <asm/mach/map.h> |
44 | #include <asm/memblock.h> | ||
44 | #include <mach/board-mx31moboard.h> | 45 | #include <mach/board-mx31moboard.h> |
45 | #include <mach/common.h> | 46 | #include <mach/common.h> |
46 | #include <mach/hardware.h> | 47 | #include <mach/hardware.h> |
47 | #include <mach/iomux-mx3.h> | 48 | #include <mach/iomux-mx3.h> |
48 | #include <mach/ulpi.h> | 49 | #include <mach/ulpi.h> |
49 | 50 | ||
50 | #include "devices-imx31.h" | 51 | #include "devices-imx31.h" |
51 | 52 | ||
52 | static unsigned int moboard_pins[] = { | 53 | static unsigned int moboard_pins[] = { |
53 | /* UART0 */ | 54 | /* UART0 */ |
54 | MX31_PIN_TXD1__TXD1, MX31_PIN_RXD1__RXD1, | 55 | MX31_PIN_TXD1__TXD1, MX31_PIN_RXD1__RXD1, |
55 | MX31_PIN_CTS1__GPIO2_7, | 56 | MX31_PIN_CTS1__GPIO2_7, |
56 | /* UART4 */ | 57 | /* UART4 */ |
57 | MX31_PIN_PC_RST__CTS5, MX31_PIN_PC_VS2__RTS5, | 58 | MX31_PIN_PC_RST__CTS5, MX31_PIN_PC_VS2__RTS5, |
58 | MX31_PIN_PC_BVD2__TXD5, MX31_PIN_PC_BVD1__RXD5, | 59 | MX31_PIN_PC_BVD2__TXD5, MX31_PIN_PC_BVD1__RXD5, |
59 | /* I2C0 */ | 60 | /* I2C0 */ |
60 | MX31_PIN_I2C_DAT__I2C1_SDA, MX31_PIN_I2C_CLK__I2C1_SCL, | 61 | MX31_PIN_I2C_DAT__I2C1_SDA, MX31_PIN_I2C_CLK__I2C1_SCL, |
61 | /* I2C1 */ | 62 | /* I2C1 */ |
62 | MX31_PIN_DCD_DTE1__I2C2_SDA, MX31_PIN_RI_DTE1__I2C2_SCL, | 63 | MX31_PIN_DCD_DTE1__I2C2_SDA, MX31_PIN_RI_DTE1__I2C2_SCL, |
63 | /* SDHC1 */ | 64 | /* SDHC1 */ |
64 | MX31_PIN_SD1_DATA3__SD1_DATA3, MX31_PIN_SD1_DATA2__SD1_DATA2, | 65 | MX31_PIN_SD1_DATA3__SD1_DATA3, MX31_PIN_SD1_DATA2__SD1_DATA2, |
65 | MX31_PIN_SD1_DATA1__SD1_DATA1, MX31_PIN_SD1_DATA0__SD1_DATA0, | 66 | MX31_PIN_SD1_DATA1__SD1_DATA1, MX31_PIN_SD1_DATA0__SD1_DATA0, |
66 | MX31_PIN_SD1_CLK__SD1_CLK, MX31_PIN_SD1_CMD__SD1_CMD, | 67 | MX31_PIN_SD1_CLK__SD1_CLK, MX31_PIN_SD1_CMD__SD1_CMD, |
67 | MX31_PIN_ATA_CS0__GPIO3_26, MX31_PIN_ATA_CS1__GPIO3_27, | 68 | MX31_PIN_ATA_CS0__GPIO3_26, MX31_PIN_ATA_CS1__GPIO3_27, |
68 | /* USB reset */ | 69 | /* USB reset */ |
69 | MX31_PIN_GPIO1_0__GPIO1_0, | 70 | MX31_PIN_GPIO1_0__GPIO1_0, |
70 | /* USB OTG */ | 71 | /* USB OTG */ |
71 | MX31_PIN_USBOTG_DATA0__USBOTG_DATA0, | 72 | MX31_PIN_USBOTG_DATA0__USBOTG_DATA0, |
72 | MX31_PIN_USBOTG_DATA1__USBOTG_DATA1, | 73 | MX31_PIN_USBOTG_DATA1__USBOTG_DATA1, |
73 | MX31_PIN_USBOTG_DATA2__USBOTG_DATA2, | 74 | MX31_PIN_USBOTG_DATA2__USBOTG_DATA2, |
74 | MX31_PIN_USBOTG_DATA3__USBOTG_DATA3, | 75 | MX31_PIN_USBOTG_DATA3__USBOTG_DATA3, |
75 | MX31_PIN_USBOTG_DATA4__USBOTG_DATA4, | 76 | MX31_PIN_USBOTG_DATA4__USBOTG_DATA4, |
76 | MX31_PIN_USBOTG_DATA5__USBOTG_DATA5, | 77 | MX31_PIN_USBOTG_DATA5__USBOTG_DATA5, |
77 | MX31_PIN_USBOTG_DATA6__USBOTG_DATA6, | 78 | MX31_PIN_USBOTG_DATA6__USBOTG_DATA6, |
78 | MX31_PIN_USBOTG_DATA7__USBOTG_DATA7, | 79 | MX31_PIN_USBOTG_DATA7__USBOTG_DATA7, |
79 | MX31_PIN_USBOTG_CLK__USBOTG_CLK, MX31_PIN_USBOTG_DIR__USBOTG_DIR, | 80 | MX31_PIN_USBOTG_CLK__USBOTG_CLK, MX31_PIN_USBOTG_DIR__USBOTG_DIR, |
80 | MX31_PIN_USBOTG_NXT__USBOTG_NXT, MX31_PIN_USBOTG_STP__USBOTG_STP, | 81 | MX31_PIN_USBOTG_NXT__USBOTG_NXT, MX31_PIN_USBOTG_STP__USBOTG_STP, |
81 | MX31_PIN_USB_OC__GPIO1_30, | 82 | MX31_PIN_USB_OC__GPIO1_30, |
82 | /* USB H2 */ | 83 | /* USB H2 */ |
83 | MX31_PIN_USBH2_DATA0__USBH2_DATA0, | 84 | MX31_PIN_USBH2_DATA0__USBH2_DATA0, |
84 | MX31_PIN_USBH2_DATA1__USBH2_DATA1, | 85 | MX31_PIN_USBH2_DATA1__USBH2_DATA1, |
85 | MX31_PIN_STXD3__USBH2_DATA2, MX31_PIN_SRXD3__USBH2_DATA3, | 86 | MX31_PIN_STXD3__USBH2_DATA2, MX31_PIN_SRXD3__USBH2_DATA3, |
86 | MX31_PIN_SCK3__USBH2_DATA4, MX31_PIN_SFS3__USBH2_DATA5, | 87 | MX31_PIN_SCK3__USBH2_DATA4, MX31_PIN_SFS3__USBH2_DATA5, |
87 | MX31_PIN_STXD6__USBH2_DATA6, MX31_PIN_SRXD6__USBH2_DATA7, | 88 | MX31_PIN_STXD6__USBH2_DATA6, MX31_PIN_SRXD6__USBH2_DATA7, |
88 | MX31_PIN_USBH2_CLK__USBH2_CLK, MX31_PIN_USBH2_DIR__USBH2_DIR, | 89 | MX31_PIN_USBH2_CLK__USBH2_CLK, MX31_PIN_USBH2_DIR__USBH2_DIR, |
89 | MX31_PIN_USBH2_NXT__USBH2_NXT, MX31_PIN_USBH2_STP__USBH2_STP, | 90 | MX31_PIN_USBH2_NXT__USBH2_NXT, MX31_PIN_USBH2_STP__USBH2_STP, |
90 | MX31_PIN_SCK6__GPIO1_25, | 91 | MX31_PIN_SCK6__GPIO1_25, |
91 | /* LEDs */ | 92 | /* LEDs */ |
92 | MX31_PIN_SVEN0__GPIO2_0, MX31_PIN_STX0__GPIO2_1, | 93 | MX31_PIN_SVEN0__GPIO2_0, MX31_PIN_STX0__GPIO2_1, |
93 | MX31_PIN_SRX0__GPIO2_2, MX31_PIN_SIMPD0__GPIO2_3, | 94 | MX31_PIN_SRX0__GPIO2_2, MX31_PIN_SIMPD0__GPIO2_3, |
94 | /* SPI1 */ | 95 | /* SPI1 */ |
95 | MX31_PIN_CSPI2_MOSI__MOSI, MX31_PIN_CSPI2_MISO__MISO, | 96 | MX31_PIN_CSPI2_MOSI__MOSI, MX31_PIN_CSPI2_MISO__MISO, |
96 | MX31_PIN_CSPI2_SCLK__SCLK, MX31_PIN_CSPI2_SPI_RDY__SPI_RDY, | 97 | MX31_PIN_CSPI2_SCLK__SCLK, MX31_PIN_CSPI2_SPI_RDY__SPI_RDY, |
97 | MX31_PIN_CSPI2_SS0__SS0, MX31_PIN_CSPI2_SS2__SS2, | 98 | MX31_PIN_CSPI2_SS0__SS0, MX31_PIN_CSPI2_SS2__SS2, |
98 | /* Atlas IRQ */ | 99 | /* Atlas IRQ */ |
99 | MX31_PIN_GPIO1_3__GPIO1_3, | 100 | MX31_PIN_GPIO1_3__GPIO1_3, |
100 | /* SPI2 */ | 101 | /* SPI2 */ |
101 | MX31_PIN_CSPI3_MOSI__MOSI, MX31_PIN_CSPI3_MISO__MISO, | 102 | MX31_PIN_CSPI3_MOSI__MOSI, MX31_PIN_CSPI3_MISO__MISO, |
102 | MX31_PIN_CSPI3_SCLK__SCLK, MX31_PIN_CSPI3_SPI_RDY__SPI_RDY, | 103 | MX31_PIN_CSPI3_SCLK__SCLK, MX31_PIN_CSPI3_SPI_RDY__SPI_RDY, |
103 | MX31_PIN_CSPI2_SS1__CSPI3_SS1, | 104 | MX31_PIN_CSPI2_SS1__CSPI3_SS1, |
104 | }; | 105 | }; |
105 | 106 | ||
106 | static struct physmap_flash_data mx31moboard_flash_data = { | 107 | static struct physmap_flash_data mx31moboard_flash_data = { |
107 | .width = 2, | 108 | .width = 2, |
108 | }; | 109 | }; |
109 | 110 | ||
110 | static struct resource mx31moboard_flash_resource = { | 111 | static struct resource mx31moboard_flash_resource = { |
111 | .start = 0xa0000000, | 112 | .start = 0xa0000000, |
112 | .end = 0xa1ffffff, | 113 | .end = 0xa1ffffff, |
113 | .flags = IORESOURCE_MEM, | 114 | .flags = IORESOURCE_MEM, |
114 | }; | 115 | }; |
115 | 116 | ||
116 | static struct platform_device mx31moboard_flash = { | 117 | static struct platform_device mx31moboard_flash = { |
117 | .name = "physmap-flash", | 118 | .name = "physmap-flash", |
118 | .id = 0, | 119 | .id = 0, |
119 | .dev = { | 120 | .dev = { |
120 | .platform_data = &mx31moboard_flash_data, | 121 | .platform_data = &mx31moboard_flash_data, |
121 | }, | 122 | }, |
122 | .resource = &mx31moboard_flash_resource, | 123 | .resource = &mx31moboard_flash_resource, |
123 | .num_resources = 1, | 124 | .num_resources = 1, |
124 | }; | 125 | }; |
125 | 126 | ||
126 | static int moboard_uart0_init(struct platform_device *pdev) | 127 | static int moboard_uart0_init(struct platform_device *pdev) |
127 | { | 128 | { |
128 | int ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack"); | 129 | int ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack"); |
129 | if (ret) | 130 | if (ret) |
130 | return ret; | 131 | return ret; |
131 | 132 | ||
132 | ret = gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0); | 133 | ret = gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0); |
133 | if (ret) | 134 | if (ret) |
134 | gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1)); | 135 | gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1)); |
135 | 136 | ||
136 | return ret; | 137 | return ret; |
137 | } | 138 | } |
138 | 139 | ||
139 | static void moboard_uart0_exit(struct platform_device *pdev) | 140 | static void moboard_uart0_exit(struct platform_device *pdev) |
140 | { | 141 | { |
141 | gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1)); | 142 | gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1)); |
142 | } | 143 | } |
143 | 144 | ||
144 | static const struct imxuart_platform_data uart0_pdata __initconst = { | 145 | static const struct imxuart_platform_data uart0_pdata __initconst = { |
145 | .init = moboard_uart0_init, | 146 | .init = moboard_uart0_init, |
146 | .exit = moboard_uart0_exit, | 147 | .exit = moboard_uart0_exit, |
147 | }; | 148 | }; |
148 | 149 | ||
149 | static const struct imxuart_platform_data uart4_pdata __initconst = { | 150 | static const struct imxuart_platform_data uart4_pdata __initconst = { |
150 | .flags = IMXUART_HAVE_RTSCTS, | 151 | .flags = IMXUART_HAVE_RTSCTS, |
151 | }; | 152 | }; |
152 | 153 | ||
153 | static const struct imxi2c_platform_data moboard_i2c0_data __initconst = { | 154 | static const struct imxi2c_platform_data moboard_i2c0_data __initconst = { |
154 | .bitrate = 400000, | 155 | .bitrate = 400000, |
155 | }; | 156 | }; |
156 | 157 | ||
157 | static const struct imxi2c_platform_data moboard_i2c1_data __initconst = { | 158 | static const struct imxi2c_platform_data moboard_i2c1_data __initconst = { |
158 | .bitrate = 100000, | 159 | .bitrate = 100000, |
159 | }; | 160 | }; |
160 | 161 | ||
161 | static int moboard_spi1_cs[] = { | 162 | static int moboard_spi1_cs[] = { |
162 | MXC_SPI_CS(0), | 163 | MXC_SPI_CS(0), |
163 | MXC_SPI_CS(2), | 164 | MXC_SPI_CS(2), |
164 | }; | 165 | }; |
165 | 166 | ||
166 | static const struct spi_imx_master moboard_spi1_pdata __initconst = { | 167 | static const struct spi_imx_master moboard_spi1_pdata __initconst = { |
167 | .chipselect = moboard_spi1_cs, | 168 | .chipselect = moboard_spi1_cs, |
168 | .num_chipselect = ARRAY_SIZE(moboard_spi1_cs), | 169 | .num_chipselect = ARRAY_SIZE(moboard_spi1_cs), |
169 | }; | 170 | }; |
170 | 171 | ||
171 | static struct regulator_consumer_supply sdhc_consumers[] = { | 172 | static struct regulator_consumer_supply sdhc_consumers[] = { |
172 | { | 173 | { |
173 | .dev_name = "mxc-mmc.0", | 174 | .dev_name = "mxc-mmc.0", |
174 | .supply = "sdhc0_vcc", | 175 | .supply = "sdhc0_vcc", |
175 | }, | 176 | }, |
176 | { | 177 | { |
177 | .dev_name = "mxc-mmc.1", | 178 | .dev_name = "mxc-mmc.1", |
178 | .supply = "sdhc1_vcc", | 179 | .supply = "sdhc1_vcc", |
179 | }, | 180 | }, |
180 | }; | 181 | }; |
181 | 182 | ||
182 | static struct regulator_init_data sdhc_vreg_data = { | 183 | static struct regulator_init_data sdhc_vreg_data = { |
183 | .constraints = { | 184 | .constraints = { |
184 | .min_uV = 2700000, | 185 | .min_uV = 2700000, |
185 | .max_uV = 3000000, | 186 | .max_uV = 3000000, |
186 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | 187 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
187 | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, | 188 | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, |
188 | .valid_modes_mask = REGULATOR_MODE_NORMAL | | 189 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
189 | REGULATOR_MODE_FAST, | 190 | REGULATOR_MODE_FAST, |
190 | .always_on = 0, | 191 | .always_on = 0, |
191 | .boot_on = 1, | 192 | .boot_on = 1, |
192 | }, | 193 | }, |
193 | .num_consumer_supplies = ARRAY_SIZE(sdhc_consumers), | 194 | .num_consumer_supplies = ARRAY_SIZE(sdhc_consumers), |
194 | .consumer_supplies = sdhc_consumers, | 195 | .consumer_supplies = sdhc_consumers, |
195 | }; | 196 | }; |
196 | 197 | ||
197 | static struct regulator_consumer_supply cam_consumers[] = { | 198 | static struct regulator_consumer_supply cam_consumers[] = { |
198 | { | 199 | { |
199 | .dev_name = "mx3_camera.0", | 200 | .dev_name = "mx3_camera.0", |
200 | .supply = "cam_vcc", | 201 | .supply = "cam_vcc", |
201 | }, | 202 | }, |
202 | }; | 203 | }; |
203 | 204 | ||
204 | static struct regulator_init_data cam_vreg_data = { | 205 | static struct regulator_init_data cam_vreg_data = { |
205 | .constraints = { | 206 | .constraints = { |
206 | .min_uV = 2700000, | 207 | .min_uV = 2700000, |
207 | .max_uV = 3000000, | 208 | .max_uV = 3000000, |
208 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | 209 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
209 | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, | 210 | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, |
210 | .valid_modes_mask = REGULATOR_MODE_NORMAL | | 211 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
211 | REGULATOR_MODE_FAST, | 212 | REGULATOR_MODE_FAST, |
212 | .always_on = 0, | 213 | .always_on = 0, |
213 | .boot_on = 1, | 214 | .boot_on = 1, |
214 | }, | 215 | }, |
215 | .num_consumer_supplies = ARRAY_SIZE(cam_consumers), | 216 | .num_consumer_supplies = ARRAY_SIZE(cam_consumers), |
216 | .consumer_supplies = cam_consumers, | 217 | .consumer_supplies = cam_consumers, |
217 | }; | 218 | }; |
218 | 219 | ||
219 | static struct mc13xxx_regulator_init_data moboard_regulators[] = { | 220 | static struct mc13xxx_regulator_init_data moboard_regulators[] = { |
220 | { | 221 | { |
221 | .id = MC13783_REG_VMMC1, | 222 | .id = MC13783_REG_VMMC1, |
222 | .init_data = &sdhc_vreg_data, | 223 | .init_data = &sdhc_vreg_data, |
223 | }, | 224 | }, |
224 | { | 225 | { |
225 | .id = MC13783_REG_VCAM, | 226 | .id = MC13783_REG_VCAM, |
226 | .init_data = &cam_vreg_data, | 227 | .init_data = &cam_vreg_data, |
227 | }, | 228 | }, |
228 | }; | 229 | }; |
229 | 230 | ||
230 | static struct mc13xxx_led_platform_data moboard_led[] = { | 231 | static struct mc13xxx_led_platform_data moboard_led[] = { |
231 | { | 232 | { |
232 | .id = MC13783_LED_R1, | 233 | .id = MC13783_LED_R1, |
233 | .name = "coreboard-led-4:red", | 234 | .name = "coreboard-led-4:red", |
234 | .max_current = 2, | 235 | .max_current = 2, |
235 | }, | 236 | }, |
236 | { | 237 | { |
237 | .id = MC13783_LED_G1, | 238 | .id = MC13783_LED_G1, |
238 | .name = "coreboard-led-4:green", | 239 | .name = "coreboard-led-4:green", |
239 | .max_current = 2, | 240 | .max_current = 2, |
240 | }, | 241 | }, |
241 | { | 242 | { |
242 | .id = MC13783_LED_B1, | 243 | .id = MC13783_LED_B1, |
243 | .name = "coreboard-led-4:blue", | 244 | .name = "coreboard-led-4:blue", |
244 | .max_current = 2, | 245 | .max_current = 2, |
245 | }, | 246 | }, |
246 | { | 247 | { |
247 | .id = MC13783_LED_R2, | 248 | .id = MC13783_LED_R2, |
248 | .name = "coreboard-led-5:red", | 249 | .name = "coreboard-led-5:red", |
249 | .max_current = 3, | 250 | .max_current = 3, |
250 | }, | 251 | }, |
251 | { | 252 | { |
252 | .id = MC13783_LED_G2, | 253 | .id = MC13783_LED_G2, |
253 | .name = "coreboard-led-5:green", | 254 | .name = "coreboard-led-5:green", |
254 | .max_current = 3, | 255 | .max_current = 3, |
255 | }, | 256 | }, |
256 | { | 257 | { |
257 | .id = MC13783_LED_B2, | 258 | .id = MC13783_LED_B2, |
258 | .name = "coreboard-led-5:blue", | 259 | .name = "coreboard-led-5:blue", |
259 | .max_current = 3, | 260 | .max_current = 3, |
260 | }, | 261 | }, |
261 | }; | 262 | }; |
262 | 263 | ||
263 | static struct mc13xxx_leds_platform_data moboard_leds = { | 264 | static struct mc13xxx_leds_platform_data moboard_leds = { |
264 | .num_leds = ARRAY_SIZE(moboard_led), | 265 | .num_leds = ARRAY_SIZE(moboard_led), |
265 | .led = moboard_led, | 266 | .led = moboard_led, |
266 | .flags = MC13783_LED_SLEWLIMTC, | 267 | .flags = MC13783_LED_SLEWLIMTC, |
267 | .abmode = MC13783_LED_AB_DISABLED, | 268 | .abmode = MC13783_LED_AB_DISABLED, |
268 | .tc1_period = MC13783_LED_PERIOD_10MS, | 269 | .tc1_period = MC13783_LED_PERIOD_10MS, |
269 | .tc2_period = MC13783_LED_PERIOD_10MS, | 270 | .tc2_period = MC13783_LED_PERIOD_10MS, |
270 | }; | 271 | }; |
271 | 272 | ||
272 | static struct mc13xxx_buttons_platform_data moboard_buttons = { | 273 | static struct mc13xxx_buttons_platform_data moboard_buttons = { |
273 | .b1on_flags = MC13783_BUTTON_DBNC_750MS | MC13783_BUTTON_ENABLE | | 274 | .b1on_flags = MC13783_BUTTON_DBNC_750MS | MC13783_BUTTON_ENABLE | |
274 | MC13783_BUTTON_POL_INVERT, | 275 | MC13783_BUTTON_POL_INVERT, |
275 | .b1on_key = KEY_POWER, | 276 | .b1on_key = KEY_POWER, |
276 | }; | 277 | }; |
277 | 278 | ||
278 | static struct mc13xxx_platform_data moboard_pmic = { | 279 | static struct mc13xxx_platform_data moboard_pmic = { |
279 | .regulators = { | 280 | .regulators = { |
280 | .regulators = moboard_regulators, | 281 | .regulators = moboard_regulators, |
281 | .num_regulators = ARRAY_SIZE(moboard_regulators), | 282 | .num_regulators = ARRAY_SIZE(moboard_regulators), |
282 | }, | 283 | }, |
283 | .leds = &moboard_leds, | 284 | .leds = &moboard_leds, |
284 | .buttons = &moboard_buttons, | 285 | .buttons = &moboard_buttons, |
285 | .flags = MC13XXX_USE_RTC | MC13XXX_USE_ADC, | 286 | .flags = MC13XXX_USE_RTC | MC13XXX_USE_ADC, |
286 | }; | 287 | }; |
287 | 288 | ||
288 | static struct spi_board_info moboard_spi_board_info[] __initdata = { | 289 | static struct spi_board_info moboard_spi_board_info[] __initdata = { |
289 | { | 290 | { |
290 | .modalias = "mc13783", | 291 | .modalias = "mc13783", |
291 | .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3), | 292 | .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3), |
292 | .max_speed_hz = 300000, | 293 | .max_speed_hz = 300000, |
293 | .bus_num = 1, | 294 | .bus_num = 1, |
294 | .chip_select = 0, | 295 | .chip_select = 0, |
295 | .platform_data = &moboard_pmic, | 296 | .platform_data = &moboard_pmic, |
296 | .mode = SPI_CS_HIGH, | 297 | .mode = SPI_CS_HIGH, |
297 | }, | 298 | }, |
298 | }; | 299 | }; |
299 | 300 | ||
300 | static int moboard_spi2_cs[] = { | 301 | static int moboard_spi2_cs[] = { |
301 | MXC_SPI_CS(1), | 302 | MXC_SPI_CS(1), |
302 | }; | 303 | }; |
303 | 304 | ||
304 | static const struct spi_imx_master moboard_spi2_pdata __initconst = { | 305 | static const struct spi_imx_master moboard_spi2_pdata __initconst = { |
305 | .chipselect = moboard_spi2_cs, | 306 | .chipselect = moboard_spi2_cs, |
306 | .num_chipselect = ARRAY_SIZE(moboard_spi2_cs), | 307 | .num_chipselect = ARRAY_SIZE(moboard_spi2_cs), |
307 | }; | 308 | }; |
308 | 309 | ||
309 | #define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0) | 310 | #define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0) |
310 | #define SDHC1_WP IOMUX_TO_GPIO(MX31_PIN_ATA_CS1) | 311 | #define SDHC1_WP IOMUX_TO_GPIO(MX31_PIN_ATA_CS1) |
311 | 312 | ||
312 | static int moboard_sdhc1_get_ro(struct device *dev) | 313 | static int moboard_sdhc1_get_ro(struct device *dev) |
313 | { | 314 | { |
314 | return !gpio_get_value(SDHC1_WP); | 315 | return !gpio_get_value(SDHC1_WP); |
315 | } | 316 | } |
316 | 317 | ||
317 | static int moboard_sdhc1_init(struct device *dev, irq_handler_t detect_irq, | 318 | static int moboard_sdhc1_init(struct device *dev, irq_handler_t detect_irq, |
318 | void *data) | 319 | void *data) |
319 | { | 320 | { |
320 | int ret; | 321 | int ret; |
321 | 322 | ||
322 | ret = gpio_request(SDHC1_CD, "sdhc-detect"); | 323 | ret = gpio_request(SDHC1_CD, "sdhc-detect"); |
323 | if (ret) | 324 | if (ret) |
324 | return ret; | 325 | return ret; |
325 | 326 | ||
326 | gpio_direction_input(SDHC1_CD); | 327 | gpio_direction_input(SDHC1_CD); |
327 | 328 | ||
328 | ret = gpio_request(SDHC1_WP, "sdhc-wp"); | 329 | ret = gpio_request(SDHC1_WP, "sdhc-wp"); |
329 | if (ret) | 330 | if (ret) |
330 | goto err_gpio_free; | 331 | goto err_gpio_free; |
331 | gpio_direction_input(SDHC1_WP); | 332 | gpio_direction_input(SDHC1_WP); |
332 | 333 | ||
333 | ret = request_irq(gpio_to_irq(SDHC1_CD), detect_irq, | 334 | ret = request_irq(gpio_to_irq(SDHC1_CD), detect_irq, |
334 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 335 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
335 | "sdhc1-card-detect", data); | 336 | "sdhc1-card-detect", data); |
336 | if (ret) | 337 | if (ret) |
337 | goto err_gpio_free_2; | 338 | goto err_gpio_free_2; |
338 | 339 | ||
339 | return 0; | 340 | return 0; |
340 | 341 | ||
341 | err_gpio_free_2: | 342 | err_gpio_free_2: |
342 | gpio_free(SDHC1_WP); | 343 | gpio_free(SDHC1_WP); |
343 | err_gpio_free: | 344 | err_gpio_free: |
344 | gpio_free(SDHC1_CD); | 345 | gpio_free(SDHC1_CD); |
345 | 346 | ||
346 | return ret; | 347 | return ret; |
347 | } | 348 | } |
348 | 349 | ||
349 | static void moboard_sdhc1_exit(struct device *dev, void *data) | 350 | static void moboard_sdhc1_exit(struct device *dev, void *data) |
350 | { | 351 | { |
351 | free_irq(gpio_to_irq(SDHC1_CD), data); | 352 | free_irq(gpio_to_irq(SDHC1_CD), data); |
352 | gpio_free(SDHC1_WP); | 353 | gpio_free(SDHC1_WP); |
353 | gpio_free(SDHC1_CD); | 354 | gpio_free(SDHC1_CD); |
354 | } | 355 | } |
355 | 356 | ||
356 | static const struct imxmmc_platform_data sdhc1_pdata __initconst = { | 357 | static const struct imxmmc_platform_data sdhc1_pdata __initconst = { |
357 | .get_ro = moboard_sdhc1_get_ro, | 358 | .get_ro = moboard_sdhc1_get_ro, |
358 | .init = moboard_sdhc1_init, | 359 | .init = moboard_sdhc1_init, |
359 | .exit = moboard_sdhc1_exit, | 360 | .exit = moboard_sdhc1_exit, |
360 | }; | 361 | }; |
361 | 362 | ||
362 | /* | 363 | /* |
363 | * this pin is dedicated for all mx31moboard systems, so we do it here | 364 | * this pin is dedicated for all mx31moboard systems, so we do it here |
364 | */ | 365 | */ |
365 | #define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0) | 366 | #define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0) |
366 | #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ | 367 | #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ |
367 | PAD_CTL_ODE_CMOS) | 368 | PAD_CTL_ODE_CMOS) |
368 | 369 | ||
369 | #define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC) | 370 | #define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC) |
370 | #define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6) | 371 | #define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6) |
371 | 372 | ||
372 | static void usb_xcvr_reset(void) | 373 | static void usb_xcvr_reset(void) |
373 | { | 374 | { |
374 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD); | 375 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD); |
375 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD); | 376 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD); |
376 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG | PAD_CTL_100K_PD); | 377 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG | PAD_CTL_100K_PD); |
377 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG | PAD_CTL_100K_PD); | 378 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG | PAD_CTL_100K_PD); |
378 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG | PAD_CTL_100K_PD); | 379 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG | PAD_CTL_100K_PD); |
379 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG | PAD_CTL_100K_PD); | 380 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG | PAD_CTL_100K_PD); |
380 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG | PAD_CTL_100K_PD); | 381 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG | PAD_CTL_100K_PD); |
381 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG | PAD_CTL_100K_PD); | 382 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG | PAD_CTL_100K_PD); |
382 | mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG | PAD_CTL_100K_PU); | 383 | mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG | PAD_CTL_100K_PU); |
383 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG | PAD_CTL_100K_PU); | 384 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG | PAD_CTL_100K_PU); |
384 | mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG | PAD_CTL_100K_PU); | 385 | mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG | PAD_CTL_100K_PU); |
385 | mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG | PAD_CTL_100K_PU); | 386 | mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG | PAD_CTL_100K_PU); |
386 | 387 | ||
387 | mxc_iomux_set_gpr(MUX_PGP_UH2, true); | 388 | mxc_iomux_set_gpr(MUX_PGP_UH2, true); |
388 | mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG | PAD_CTL_100K_PU); | 389 | mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG | PAD_CTL_100K_PU); |
389 | mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG | PAD_CTL_100K_PU); | 390 | mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG | PAD_CTL_100K_PU); |
390 | mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG | PAD_CTL_100K_PU); | 391 | mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG | PAD_CTL_100K_PU); |
391 | mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG | PAD_CTL_100K_PU); | 392 | mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG | PAD_CTL_100K_PU); |
392 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD); | 393 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD); |
393 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD); | 394 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD); |
394 | mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG | PAD_CTL_100K_PD); | 395 | mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG | PAD_CTL_100K_PD); |
395 | mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG | PAD_CTL_100K_PD); | 396 | mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG | PAD_CTL_100K_PD); |
396 | mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG | PAD_CTL_100K_PD); | 397 | mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG | PAD_CTL_100K_PD); |
397 | mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG | PAD_CTL_100K_PD); | 398 | mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG | PAD_CTL_100K_PD); |
398 | mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG | PAD_CTL_100K_PD); | 399 | mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG | PAD_CTL_100K_PD); |
399 | mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG | PAD_CTL_100K_PD); | 400 | mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG | PAD_CTL_100K_PD); |
400 | 401 | ||
401 | gpio_request(OTG_EN_B, "usb-udc-en"); | 402 | gpio_request(OTG_EN_B, "usb-udc-en"); |
402 | gpio_direction_output(OTG_EN_B, 0); | 403 | gpio_direction_output(OTG_EN_B, 0); |
403 | gpio_request(USBH2_EN_B, "usbh2-en"); | 404 | gpio_request(USBH2_EN_B, "usbh2-en"); |
404 | gpio_direction_output(USBH2_EN_B, 0); | 405 | gpio_direction_output(USBH2_EN_B, 0); |
405 | 406 | ||
406 | gpio_request(USB_RESET_B, "usb-reset"); | 407 | gpio_request(USB_RESET_B, "usb-reset"); |
407 | gpio_direction_output(USB_RESET_B, 0); | 408 | gpio_direction_output(USB_RESET_B, 0); |
408 | mdelay(1); | 409 | mdelay(1); |
409 | gpio_set_value(USB_RESET_B, 1); | 410 | gpio_set_value(USB_RESET_B, 1); |
410 | mdelay(1); | 411 | mdelay(1); |
411 | } | 412 | } |
412 | 413 | ||
413 | static int moboard_usbh2_init_hw(struct platform_device *pdev) | 414 | static int moboard_usbh2_init_hw(struct platform_device *pdev) |
414 | { | 415 | { |
415 | return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED); | 416 | return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED); |
416 | } | 417 | } |
417 | 418 | ||
418 | static struct mxc_usbh_platform_data usbh2_pdata __initdata = { | 419 | static struct mxc_usbh_platform_data usbh2_pdata __initdata = { |
419 | .init = moboard_usbh2_init_hw, | 420 | .init = moboard_usbh2_init_hw, |
420 | .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, | 421 | .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, |
421 | }; | 422 | }; |
422 | 423 | ||
423 | static int __init moboard_usbh2_init(void) | 424 | static int __init moboard_usbh2_init(void) |
424 | { | 425 | { |
425 | struct platform_device *pdev; | 426 | struct platform_device *pdev; |
426 | 427 | ||
427 | usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | | 428 | usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | |
428 | ULPI_OTG_DRVVBUS_EXT); | 429 | ULPI_OTG_DRVVBUS_EXT); |
429 | if (!usbh2_pdata.otg) | 430 | if (!usbh2_pdata.otg) |
430 | return -ENODEV; | 431 | return -ENODEV; |
431 | 432 | ||
432 | pdev = imx31_add_mxc_ehci_hs(2, &usbh2_pdata); | 433 | pdev = imx31_add_mxc_ehci_hs(2, &usbh2_pdata); |
433 | if (IS_ERR(pdev)) | 434 | if (IS_ERR(pdev)) |
434 | return PTR_ERR(pdev); | 435 | return PTR_ERR(pdev); |
435 | 436 | ||
436 | return 0; | 437 | return 0; |
437 | } | 438 | } |
438 | 439 | ||
439 | static const struct gpio_led mx31moboard_leds[] __initconst = { | 440 | static const struct gpio_led mx31moboard_leds[] __initconst = { |
440 | { | 441 | { |
441 | .name = "coreboard-led-0:red:running", | 442 | .name = "coreboard-led-0:red:running", |
442 | .default_trigger = "heartbeat", | 443 | .default_trigger = "heartbeat", |
443 | .gpio = IOMUX_TO_GPIO(MX31_PIN_SVEN0), | 444 | .gpio = IOMUX_TO_GPIO(MX31_PIN_SVEN0), |
444 | }, { | 445 | }, { |
445 | .name = "coreboard-led-1:red", | 446 | .name = "coreboard-led-1:red", |
446 | .gpio = IOMUX_TO_GPIO(MX31_PIN_STX0), | 447 | .gpio = IOMUX_TO_GPIO(MX31_PIN_STX0), |
447 | }, { | 448 | }, { |
448 | .name = "coreboard-led-2:red", | 449 | .name = "coreboard-led-2:red", |
449 | .gpio = IOMUX_TO_GPIO(MX31_PIN_SRX0), | 450 | .gpio = IOMUX_TO_GPIO(MX31_PIN_SRX0), |
450 | }, { | 451 | }, { |
451 | .name = "coreboard-led-3:red", | 452 | .name = "coreboard-led-3:red", |
452 | .gpio = IOMUX_TO_GPIO(MX31_PIN_SIMPD0), | 453 | .gpio = IOMUX_TO_GPIO(MX31_PIN_SIMPD0), |
453 | }, | 454 | }, |
454 | }; | 455 | }; |
455 | 456 | ||
456 | static const struct gpio_led_platform_data mx31moboard_led_pdata __initconst = { | 457 | static const struct gpio_led_platform_data mx31moboard_led_pdata __initconst = { |
457 | .num_leds = ARRAY_SIZE(mx31moboard_leds), | 458 | .num_leds = ARRAY_SIZE(mx31moboard_leds), |
458 | .leds = mx31moboard_leds, | 459 | .leds = mx31moboard_leds, |
459 | }; | 460 | }; |
460 | 461 | ||
461 | static const struct ipu_platform_data mx3_ipu_data __initconst = { | 462 | static const struct ipu_platform_data mx3_ipu_data __initconst = { |
462 | .irq_base = MXC_IPU_IRQ_START, | 463 | .irq_base = MXC_IPU_IRQ_START, |
463 | }; | 464 | }; |
464 | 465 | ||
465 | static struct platform_device *devices[] __initdata = { | 466 | static struct platform_device *devices[] __initdata = { |
466 | &mx31moboard_flash, | 467 | &mx31moboard_flash, |
467 | }; | 468 | }; |
468 | 469 | ||
469 | static struct mx3_camera_pdata camera_pdata __initdata = { | 470 | static struct mx3_camera_pdata camera_pdata __initdata = { |
470 | .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10, | 471 | .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10, |
471 | .mclk_10khz = 4800, | 472 | .mclk_10khz = 4800, |
472 | }; | 473 | }; |
473 | 474 | ||
474 | static phys_addr_t mx3_camera_base __initdata; | 475 | static phys_addr_t mx3_camera_base __initdata; |
475 | #define MX3_CAMERA_BUF_SIZE SZ_4M | 476 | #define MX3_CAMERA_BUF_SIZE SZ_4M |
476 | 477 | ||
477 | static int __init mx31moboard_init_cam(void) | 478 | static int __init mx31moboard_init_cam(void) |
478 | { | 479 | { |
479 | int dma, ret = -ENOMEM; | 480 | int dma, ret = -ENOMEM; |
480 | struct platform_device *pdev; | 481 | struct platform_device *pdev; |
481 | 482 | ||
482 | imx31_add_ipu_core(&mx3_ipu_data); | 483 | imx31_add_ipu_core(&mx3_ipu_data); |
483 | 484 | ||
484 | pdev = imx31_alloc_mx3_camera(&camera_pdata); | 485 | pdev = imx31_alloc_mx3_camera(&camera_pdata); |
485 | if (IS_ERR(pdev)) | 486 | if (IS_ERR(pdev)) |
486 | return PTR_ERR(pdev); | 487 | return PTR_ERR(pdev); |
487 | 488 | ||
488 | dma = dma_declare_coherent_memory(&pdev->dev, | 489 | dma = dma_declare_coherent_memory(&pdev->dev, |
489 | mx3_camera_base, mx3_camera_base, | 490 | mx3_camera_base, mx3_camera_base, |
490 | MX3_CAMERA_BUF_SIZE, | 491 | MX3_CAMERA_BUF_SIZE, |
491 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | 492 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); |
492 | if (!(dma & DMA_MEMORY_MAP)) | 493 | if (!(dma & DMA_MEMORY_MAP)) |
493 | goto err; | 494 | goto err; |
494 | 495 | ||
495 | ret = platform_device_add(pdev); | 496 | ret = platform_device_add(pdev); |
496 | if (ret) | 497 | if (ret) |
497 | err: | 498 | err: |
498 | platform_device_put(pdev); | 499 | platform_device_put(pdev); |
499 | 500 | ||
500 | return ret; | 501 | return ret; |
501 | 502 | ||
502 | } | 503 | } |
503 | 504 | ||
504 | static void mx31moboard_poweroff(void) | 505 | static void mx31moboard_poweroff(void) |
505 | { | 506 | { |
506 | struct clk *clk = clk_get_sys("imx2-wdt.0", NULL); | 507 | struct clk *clk = clk_get_sys("imx2-wdt.0", NULL); |
507 | 508 | ||
508 | if (!IS_ERR(clk)) | 509 | if (!IS_ERR(clk)) |
509 | clk_enable(clk); | 510 | clk_enable(clk); |
510 | 511 | ||
511 | mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST); | 512 | mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST); |
512 | 513 | ||
513 | __raw_writew(1 << 6 | 1 << 2, MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); | 514 | __raw_writew(1 << 6 | 1 << 2, MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); |
514 | } | 515 | } |
515 | 516 | ||
516 | static int mx31moboard_baseboard; | 517 | static int mx31moboard_baseboard; |
517 | core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444); | 518 | core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444); |
518 | 519 | ||
519 | /* | 520 | /* |
520 | * Board specific initialization. | 521 | * Board specific initialization. |
521 | */ | 522 | */ |
522 | static void __init mx31moboard_init(void) | 523 | static void __init mx31moboard_init(void) |
523 | { | 524 | { |
524 | imx31_soc_init(); | 525 | imx31_soc_init(); |
525 | 526 | ||
526 | mxc_iomux_setup_multiple_pins(moboard_pins, ARRAY_SIZE(moboard_pins), | 527 | mxc_iomux_setup_multiple_pins(moboard_pins, ARRAY_SIZE(moboard_pins), |
527 | "moboard"); | 528 | "moboard"); |
528 | 529 | ||
529 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 530 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
530 | gpio_led_register_device(-1, &mx31moboard_led_pdata); | 531 | gpio_led_register_device(-1, &mx31moboard_led_pdata); |
531 | 532 | ||
532 | imx31_add_imx_uart0(&uart0_pdata); | 533 | imx31_add_imx_uart0(&uart0_pdata); |
533 | imx31_add_imx_uart4(&uart4_pdata); | 534 | imx31_add_imx_uart4(&uart4_pdata); |
534 | 535 | ||
535 | imx31_add_imx_i2c0(&moboard_i2c0_data); | 536 | imx31_add_imx_i2c0(&moboard_i2c0_data); |
536 | imx31_add_imx_i2c1(&moboard_i2c1_data); | 537 | imx31_add_imx_i2c1(&moboard_i2c1_data); |
537 | 538 | ||
538 | imx31_add_spi_imx1(&moboard_spi1_pdata); | 539 | imx31_add_spi_imx1(&moboard_spi1_pdata); |
539 | imx31_add_spi_imx2(&moboard_spi2_pdata); | 540 | imx31_add_spi_imx2(&moboard_spi2_pdata); |
540 | 541 | ||
541 | gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq"); | 542 | gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq"); |
542 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)); | 543 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)); |
543 | spi_register_board_info(moboard_spi_board_info, | 544 | spi_register_board_info(moboard_spi_board_info, |
544 | ARRAY_SIZE(moboard_spi_board_info)); | 545 | ARRAY_SIZE(moboard_spi_board_info)); |
545 | 546 | ||
546 | imx31_add_mxc_mmc(0, &sdhc1_pdata); | 547 | imx31_add_mxc_mmc(0, &sdhc1_pdata); |
547 | 548 | ||
548 | mx31moboard_init_cam(); | 549 | mx31moboard_init_cam(); |
549 | 550 | ||
550 | usb_xcvr_reset(); | 551 | usb_xcvr_reset(); |
551 | 552 | ||
552 | moboard_usbh2_init(); | 553 | moboard_usbh2_init(); |
553 | 554 | ||
554 | pm_power_off = mx31moboard_poweroff; | 555 | pm_power_off = mx31moboard_poweroff; |
555 | 556 | ||
556 | switch (mx31moboard_baseboard) { | 557 | switch (mx31moboard_baseboard) { |
557 | case MX31NOBOARD: | 558 | case MX31NOBOARD: |
558 | break; | 559 | break; |
559 | case MX31DEVBOARD: | 560 | case MX31DEVBOARD: |
560 | mx31moboard_devboard_init(); | 561 | mx31moboard_devboard_init(); |
561 | break; | 562 | break; |
562 | case MX31MARXBOT: | 563 | case MX31MARXBOT: |
563 | mx31moboard_marxbot_init(); | 564 | mx31moboard_marxbot_init(); |
564 | break; | 565 | break; |
565 | case MX31SMARTBOT: | 566 | case MX31SMARTBOT: |
566 | case MX31EYEBOT: | 567 | case MX31EYEBOT: |
567 | mx31moboard_smartbot_init(mx31moboard_baseboard); | 568 | mx31moboard_smartbot_init(mx31moboard_baseboard); |
568 | break; | 569 | break; |
569 | default: | 570 | default: |
570 | printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n", | 571 | printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n", |
571 | mx31moboard_baseboard); | 572 | mx31moboard_baseboard); |
572 | } | 573 | } |
573 | } | 574 | } |
574 | 575 | ||
575 | static void __init mx31moboard_timer_init(void) | 576 | static void __init mx31moboard_timer_init(void) |
576 | { | 577 | { |
577 | mx31_clocks_init(26000000); | 578 | mx31_clocks_init(26000000); |
578 | } | 579 | } |
579 | 580 | ||
580 | struct sys_timer mx31moboard_timer = { | 581 | struct sys_timer mx31moboard_timer = { |
581 | .init = mx31moboard_timer_init, | 582 | .init = mx31moboard_timer_init, |
582 | }; | 583 | }; |
583 | 584 | ||
584 | static void __init mx31moboard_reserve(void) | 585 | static void __init mx31moboard_reserve(void) |
585 | { | 586 | { |
586 | /* reserve 4 MiB for mx3-camera */ | 587 | /* reserve 4 MiB for mx3-camera */ |
587 | mx3_camera_base = memblock_alloc(MX3_CAMERA_BUF_SIZE, | 588 | mx3_camera_base = arm_memblock_steal(MX3_CAMERA_BUF_SIZE, |
588 | MX3_CAMERA_BUF_SIZE); | 589 | MX3_CAMERA_BUF_SIZE); |
589 | memblock_free(mx3_camera_base, MX3_CAMERA_BUF_SIZE); | ||
590 | memblock_remove(mx3_camera_base, MX3_CAMERA_BUF_SIZE); | ||
591 | } | 590 | } |
592 | 591 | ||
593 | MACHINE_START(MX31MOBOARD, "EPFL Mobots mx31moboard") | 592 | MACHINE_START(MX31MOBOARD, "EPFL Mobots mx31moboard") |
594 | /* Maintainer: Valentin Longchamp, EPFL Mobots group */ | 593 | /* Maintainer: Valentin Longchamp, EPFL Mobots group */ |
595 | .atag_offset = 0x100, | 594 | .atag_offset = 0x100, |
596 | .reserve = mx31moboard_reserve, | 595 | .reserve = mx31moboard_reserve, |
597 | .map_io = mx31_map_io, | 596 | .map_io = mx31_map_io, |
598 | .init_early = imx31_init_early, | 597 | .init_early = imx31_init_early, |
599 | .init_irq = mx31_init_irq, | 598 | .init_irq = mx31_init_irq, |
600 | .handle_irq = imx31_handle_irq, | 599 | .handle_irq = imx31_handle_irq, |
601 | .timer = &mx31moboard_timer, | 600 | .timer = &mx31moboard_timer, |
602 | .init_machine = mx31moboard_init, | 601 | .init_machine = mx31moboard_init, |
603 | .restart = mxc_restart, | 602 | .restart = mxc_restart, |
604 | MACHINE_END | 603 | MACHINE_END |
arch/arm/mach-imx/mach-pcm037.c
1 | /* | 1 | /* |
2 | * Copyright (C) 2008 Sascha Hauer, Pengutronix | 2 | * Copyright (C) 2008 Sascha Hauer, Pengutronix |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the License, or | 6 | * the Free Software Foundation; either version 2 of the License, or |
7 | * (at your option) any later version. | 7 | * (at your option) any later version. |
8 | * | 8 | * |
9 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/dma-mapping.h> | 17 | #include <linux/dma-mapping.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/mtd/physmap.h> | 19 | #include <linux/mtd/physmap.h> |
20 | #include <linux/mtd/plat-ram.h> | 20 | #include <linux/mtd/plat-ram.h> |
21 | #include <linux/memory.h> | 21 | #include <linux/memory.h> |
22 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
23 | #include <linux/smsc911x.h> | 23 | #include <linux/smsc911x.h> |
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/i2c/at24.h> | 26 | #include <linux/i2c/at24.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/spi/spi.h> | 28 | #include <linux/spi/spi.h> |
29 | #include <linux/irq.h> | 29 | #include <linux/irq.h> |
30 | #include <linux/can/platform/sja1000.h> | 30 | #include <linux/can/platform/sja1000.h> |
31 | #include <linux/usb/otg.h> | 31 | #include <linux/usb/otg.h> |
32 | #include <linux/usb/ulpi.h> | 32 | #include <linux/usb/ulpi.h> |
33 | #include <linux/gfp.h> | 33 | #include <linux/gfp.h> |
34 | #include <linux/memblock.h> | 34 | #include <linux/memblock.h> |
35 | 35 | ||
36 | #include <media/soc_camera.h> | 36 | #include <media/soc_camera.h> |
37 | 37 | ||
38 | #include <asm/mach-types.h> | 38 | #include <asm/mach-types.h> |
39 | #include <asm/mach/arch.h> | 39 | #include <asm/mach/arch.h> |
40 | #include <asm/mach/time.h> | 40 | #include <asm/mach/time.h> |
41 | #include <asm/mach/map.h> | 41 | #include <asm/mach/map.h> |
42 | #include <asm/memblock.h> | ||
42 | #include <mach/common.h> | 43 | #include <mach/common.h> |
43 | #include <mach/hardware.h> | 44 | #include <mach/hardware.h> |
44 | #include <mach/iomux-mx3.h> | 45 | #include <mach/iomux-mx3.h> |
45 | #include <mach/ulpi.h> | 46 | #include <mach/ulpi.h> |
46 | 47 | ||
47 | #include "devices-imx31.h" | 48 | #include "devices-imx31.h" |
48 | #include "pcm037.h" | 49 | #include "pcm037.h" |
49 | 50 | ||
50 | static enum pcm037_board_variant pcm037_instance = PCM037_PCM970; | 51 | static enum pcm037_board_variant pcm037_instance = PCM037_PCM970; |
51 | 52 | ||
52 | static int __init pcm037_variant_setup(char *str) | 53 | static int __init pcm037_variant_setup(char *str) |
53 | { | 54 | { |
54 | if (!strcmp("eet", str)) | 55 | if (!strcmp("eet", str)) |
55 | pcm037_instance = PCM037_EET; | 56 | pcm037_instance = PCM037_EET; |
56 | else if (strcmp("pcm970", str)) | 57 | else if (strcmp("pcm970", str)) |
57 | pr_warning("Unknown pcm037 baseboard variant %s\n", str); | 58 | pr_warning("Unknown pcm037 baseboard variant %s\n", str); |
58 | 59 | ||
59 | return 1; | 60 | return 1; |
60 | } | 61 | } |
61 | 62 | ||
62 | /* Supported values: "pcm970" (default) and "eet" */ | 63 | /* Supported values: "pcm970" (default) and "eet" */ |
63 | __setup("pcm037_variant=", pcm037_variant_setup); | 64 | __setup("pcm037_variant=", pcm037_variant_setup); |
64 | 65 | ||
65 | enum pcm037_board_variant pcm037_variant(void) | 66 | enum pcm037_board_variant pcm037_variant(void) |
66 | { | 67 | { |
67 | return pcm037_instance; | 68 | return pcm037_instance; |
68 | } | 69 | } |
69 | 70 | ||
70 | /* UART1 with RTS/CTS handshake signals */ | 71 | /* UART1 with RTS/CTS handshake signals */ |
71 | static unsigned int pcm037_uart1_handshake_pins[] = { | 72 | static unsigned int pcm037_uart1_handshake_pins[] = { |
72 | MX31_PIN_CTS1__CTS1, | 73 | MX31_PIN_CTS1__CTS1, |
73 | MX31_PIN_RTS1__RTS1, | 74 | MX31_PIN_RTS1__RTS1, |
74 | MX31_PIN_TXD1__TXD1, | 75 | MX31_PIN_TXD1__TXD1, |
75 | MX31_PIN_RXD1__RXD1, | 76 | MX31_PIN_RXD1__RXD1, |
76 | }; | 77 | }; |
77 | 78 | ||
78 | /* UART1 without RTS/CTS handshake signals */ | 79 | /* UART1 without RTS/CTS handshake signals */ |
79 | static unsigned int pcm037_uart1_pins[] = { | 80 | static unsigned int pcm037_uart1_pins[] = { |
80 | MX31_PIN_TXD1__TXD1, | 81 | MX31_PIN_TXD1__TXD1, |
81 | MX31_PIN_RXD1__RXD1, | 82 | MX31_PIN_RXD1__RXD1, |
82 | }; | 83 | }; |
83 | 84 | ||
84 | static unsigned int pcm037_pins[] = { | 85 | static unsigned int pcm037_pins[] = { |
85 | /* I2C */ | 86 | /* I2C */ |
86 | MX31_PIN_CSPI2_MOSI__SCL, | 87 | MX31_PIN_CSPI2_MOSI__SCL, |
87 | MX31_PIN_CSPI2_MISO__SDA, | 88 | MX31_PIN_CSPI2_MISO__SDA, |
88 | MX31_PIN_CSPI2_SS2__I2C3_SDA, | 89 | MX31_PIN_CSPI2_SS2__I2C3_SDA, |
89 | MX31_PIN_CSPI2_SCLK__I2C3_SCL, | 90 | MX31_PIN_CSPI2_SCLK__I2C3_SCL, |
90 | /* SDHC1 */ | 91 | /* SDHC1 */ |
91 | MX31_PIN_SD1_DATA3__SD1_DATA3, | 92 | MX31_PIN_SD1_DATA3__SD1_DATA3, |
92 | MX31_PIN_SD1_DATA2__SD1_DATA2, | 93 | MX31_PIN_SD1_DATA2__SD1_DATA2, |
93 | MX31_PIN_SD1_DATA1__SD1_DATA1, | 94 | MX31_PIN_SD1_DATA1__SD1_DATA1, |
94 | MX31_PIN_SD1_DATA0__SD1_DATA0, | 95 | MX31_PIN_SD1_DATA0__SD1_DATA0, |
95 | MX31_PIN_SD1_CLK__SD1_CLK, | 96 | MX31_PIN_SD1_CLK__SD1_CLK, |
96 | MX31_PIN_SD1_CMD__SD1_CMD, | 97 | MX31_PIN_SD1_CMD__SD1_CMD, |
97 | IOMUX_MODE(MX31_PIN_SCK6, IOMUX_CONFIG_GPIO), /* card detect */ | 98 | IOMUX_MODE(MX31_PIN_SCK6, IOMUX_CONFIG_GPIO), /* card detect */ |
98 | IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_GPIO), /* write protect */ | 99 | IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_GPIO), /* write protect */ |
99 | /* SPI1 */ | 100 | /* SPI1 */ |
100 | MX31_PIN_CSPI1_MOSI__MOSI, | 101 | MX31_PIN_CSPI1_MOSI__MOSI, |
101 | MX31_PIN_CSPI1_MISO__MISO, | 102 | MX31_PIN_CSPI1_MISO__MISO, |
102 | MX31_PIN_CSPI1_SCLK__SCLK, | 103 | MX31_PIN_CSPI1_SCLK__SCLK, |
103 | MX31_PIN_CSPI1_SPI_RDY__SPI_RDY, | 104 | MX31_PIN_CSPI1_SPI_RDY__SPI_RDY, |
104 | MX31_PIN_CSPI1_SS0__SS0, | 105 | MX31_PIN_CSPI1_SS0__SS0, |
105 | MX31_PIN_CSPI1_SS1__SS1, | 106 | MX31_PIN_CSPI1_SS1__SS1, |
106 | MX31_PIN_CSPI1_SS2__SS2, | 107 | MX31_PIN_CSPI1_SS2__SS2, |
107 | /* UART2 */ | 108 | /* UART2 */ |
108 | MX31_PIN_TXD2__TXD2, | 109 | MX31_PIN_TXD2__TXD2, |
109 | MX31_PIN_RXD2__RXD2, | 110 | MX31_PIN_RXD2__RXD2, |
110 | MX31_PIN_CTS2__CTS2, | 111 | MX31_PIN_CTS2__CTS2, |
111 | MX31_PIN_RTS2__RTS2, | 112 | MX31_PIN_RTS2__RTS2, |
112 | /* UART3 */ | 113 | /* UART3 */ |
113 | MX31_PIN_CSPI3_MOSI__RXD3, | 114 | MX31_PIN_CSPI3_MOSI__RXD3, |
114 | MX31_PIN_CSPI3_MISO__TXD3, | 115 | MX31_PIN_CSPI3_MISO__TXD3, |
115 | MX31_PIN_CSPI3_SCLK__RTS3, | 116 | MX31_PIN_CSPI3_SCLK__RTS3, |
116 | MX31_PIN_CSPI3_SPI_RDY__CTS3, | 117 | MX31_PIN_CSPI3_SPI_RDY__CTS3, |
117 | /* LAN9217 irq pin */ | 118 | /* LAN9217 irq pin */ |
118 | IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO), | 119 | IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO), |
119 | /* Onewire */ | 120 | /* Onewire */ |
120 | MX31_PIN_BATT_LINE__OWIRE, | 121 | MX31_PIN_BATT_LINE__OWIRE, |
121 | /* Framebuffer */ | 122 | /* Framebuffer */ |
122 | MX31_PIN_LD0__LD0, | 123 | MX31_PIN_LD0__LD0, |
123 | MX31_PIN_LD1__LD1, | 124 | MX31_PIN_LD1__LD1, |
124 | MX31_PIN_LD2__LD2, | 125 | MX31_PIN_LD2__LD2, |
125 | MX31_PIN_LD3__LD3, | 126 | MX31_PIN_LD3__LD3, |
126 | MX31_PIN_LD4__LD4, | 127 | MX31_PIN_LD4__LD4, |
127 | MX31_PIN_LD5__LD5, | 128 | MX31_PIN_LD5__LD5, |
128 | MX31_PIN_LD6__LD6, | 129 | MX31_PIN_LD6__LD6, |
129 | MX31_PIN_LD7__LD7, | 130 | MX31_PIN_LD7__LD7, |
130 | MX31_PIN_LD8__LD8, | 131 | MX31_PIN_LD8__LD8, |
131 | MX31_PIN_LD9__LD9, | 132 | MX31_PIN_LD9__LD9, |
132 | MX31_PIN_LD10__LD10, | 133 | MX31_PIN_LD10__LD10, |
133 | MX31_PIN_LD11__LD11, | 134 | MX31_PIN_LD11__LD11, |
134 | MX31_PIN_LD12__LD12, | 135 | MX31_PIN_LD12__LD12, |
135 | MX31_PIN_LD13__LD13, | 136 | MX31_PIN_LD13__LD13, |
136 | MX31_PIN_LD14__LD14, | 137 | MX31_PIN_LD14__LD14, |
137 | MX31_PIN_LD15__LD15, | 138 | MX31_PIN_LD15__LD15, |
138 | MX31_PIN_LD16__LD16, | 139 | MX31_PIN_LD16__LD16, |
139 | MX31_PIN_LD17__LD17, | 140 | MX31_PIN_LD17__LD17, |
140 | MX31_PIN_VSYNC3__VSYNC3, | 141 | MX31_PIN_VSYNC3__VSYNC3, |
141 | MX31_PIN_HSYNC__HSYNC, | 142 | MX31_PIN_HSYNC__HSYNC, |
142 | MX31_PIN_FPSHIFT__FPSHIFT, | 143 | MX31_PIN_FPSHIFT__FPSHIFT, |
143 | MX31_PIN_DRDY0__DRDY0, | 144 | MX31_PIN_DRDY0__DRDY0, |
144 | MX31_PIN_D3_REV__D3_REV, | 145 | MX31_PIN_D3_REV__D3_REV, |
145 | MX31_PIN_CONTRAST__CONTRAST, | 146 | MX31_PIN_CONTRAST__CONTRAST, |
146 | MX31_PIN_D3_SPL__D3_SPL, | 147 | MX31_PIN_D3_SPL__D3_SPL, |
147 | MX31_PIN_D3_CLS__D3_CLS, | 148 | MX31_PIN_D3_CLS__D3_CLS, |
148 | MX31_PIN_LCS0__GPI03_23, | 149 | MX31_PIN_LCS0__GPI03_23, |
149 | /* CSI */ | 150 | /* CSI */ |
150 | IOMUX_MODE(MX31_PIN_CSI_D5, IOMUX_CONFIG_GPIO), | 151 | IOMUX_MODE(MX31_PIN_CSI_D5, IOMUX_CONFIG_GPIO), |
151 | MX31_PIN_CSI_D6__CSI_D6, | 152 | MX31_PIN_CSI_D6__CSI_D6, |
152 | MX31_PIN_CSI_D7__CSI_D7, | 153 | MX31_PIN_CSI_D7__CSI_D7, |
153 | MX31_PIN_CSI_D8__CSI_D8, | 154 | MX31_PIN_CSI_D8__CSI_D8, |
154 | MX31_PIN_CSI_D9__CSI_D9, | 155 | MX31_PIN_CSI_D9__CSI_D9, |
155 | MX31_PIN_CSI_D10__CSI_D10, | 156 | MX31_PIN_CSI_D10__CSI_D10, |
156 | MX31_PIN_CSI_D11__CSI_D11, | 157 | MX31_PIN_CSI_D11__CSI_D11, |
157 | MX31_PIN_CSI_D12__CSI_D12, | 158 | MX31_PIN_CSI_D12__CSI_D12, |
158 | MX31_PIN_CSI_D13__CSI_D13, | 159 | MX31_PIN_CSI_D13__CSI_D13, |
159 | MX31_PIN_CSI_D14__CSI_D14, | 160 | MX31_PIN_CSI_D14__CSI_D14, |
160 | MX31_PIN_CSI_D15__CSI_D15, | 161 | MX31_PIN_CSI_D15__CSI_D15, |
161 | MX31_PIN_CSI_HSYNC__CSI_HSYNC, | 162 | MX31_PIN_CSI_HSYNC__CSI_HSYNC, |
162 | MX31_PIN_CSI_MCLK__CSI_MCLK, | 163 | MX31_PIN_CSI_MCLK__CSI_MCLK, |
163 | MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, | 164 | MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, |
164 | MX31_PIN_CSI_VSYNC__CSI_VSYNC, | 165 | MX31_PIN_CSI_VSYNC__CSI_VSYNC, |
165 | /* GPIO */ | 166 | /* GPIO */ |
166 | IOMUX_MODE(MX31_PIN_ATA_DMACK, IOMUX_CONFIG_GPIO), | 167 | IOMUX_MODE(MX31_PIN_ATA_DMACK, IOMUX_CONFIG_GPIO), |
167 | /* OTG */ | 168 | /* OTG */ |
168 | MX31_PIN_USBOTG_DATA0__USBOTG_DATA0, | 169 | MX31_PIN_USBOTG_DATA0__USBOTG_DATA0, |
169 | MX31_PIN_USBOTG_DATA1__USBOTG_DATA1, | 170 | MX31_PIN_USBOTG_DATA1__USBOTG_DATA1, |
170 | MX31_PIN_USBOTG_DATA2__USBOTG_DATA2, | 171 | MX31_PIN_USBOTG_DATA2__USBOTG_DATA2, |
171 | MX31_PIN_USBOTG_DATA3__USBOTG_DATA3, | 172 | MX31_PIN_USBOTG_DATA3__USBOTG_DATA3, |
172 | MX31_PIN_USBOTG_DATA4__USBOTG_DATA4, | 173 | MX31_PIN_USBOTG_DATA4__USBOTG_DATA4, |
173 | MX31_PIN_USBOTG_DATA5__USBOTG_DATA5, | 174 | MX31_PIN_USBOTG_DATA5__USBOTG_DATA5, |
174 | MX31_PIN_USBOTG_DATA6__USBOTG_DATA6, | 175 | MX31_PIN_USBOTG_DATA6__USBOTG_DATA6, |
175 | MX31_PIN_USBOTG_DATA7__USBOTG_DATA7, | 176 | MX31_PIN_USBOTG_DATA7__USBOTG_DATA7, |
176 | MX31_PIN_USBOTG_CLK__USBOTG_CLK, | 177 | MX31_PIN_USBOTG_CLK__USBOTG_CLK, |
177 | MX31_PIN_USBOTG_DIR__USBOTG_DIR, | 178 | MX31_PIN_USBOTG_DIR__USBOTG_DIR, |
178 | MX31_PIN_USBOTG_NXT__USBOTG_NXT, | 179 | MX31_PIN_USBOTG_NXT__USBOTG_NXT, |
179 | MX31_PIN_USBOTG_STP__USBOTG_STP, | 180 | MX31_PIN_USBOTG_STP__USBOTG_STP, |
180 | /* USB host 2 */ | 181 | /* USB host 2 */ |
181 | IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC), | 182 | IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC), |
182 | IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC), | 183 | IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC), |
183 | IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC), | 184 | IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC), |
184 | IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC), | 185 | IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC), |
185 | IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC), | 186 | IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC), |
186 | IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC), | 187 | IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC), |
187 | IOMUX_MODE(MX31_PIN_STXD3, IOMUX_CONFIG_FUNC), | 188 | IOMUX_MODE(MX31_PIN_STXD3, IOMUX_CONFIG_FUNC), |
188 | IOMUX_MODE(MX31_PIN_SRXD3, IOMUX_CONFIG_FUNC), | 189 | IOMUX_MODE(MX31_PIN_SRXD3, IOMUX_CONFIG_FUNC), |
189 | IOMUX_MODE(MX31_PIN_SCK3, IOMUX_CONFIG_FUNC), | 190 | IOMUX_MODE(MX31_PIN_SCK3, IOMUX_CONFIG_FUNC), |
190 | IOMUX_MODE(MX31_PIN_SFS3, IOMUX_CONFIG_FUNC), | 191 | IOMUX_MODE(MX31_PIN_SFS3, IOMUX_CONFIG_FUNC), |
191 | IOMUX_MODE(MX31_PIN_STXD6, IOMUX_CONFIG_FUNC), | 192 | IOMUX_MODE(MX31_PIN_STXD6, IOMUX_CONFIG_FUNC), |
192 | IOMUX_MODE(MX31_PIN_SRXD6, IOMUX_CONFIG_FUNC), | 193 | IOMUX_MODE(MX31_PIN_SRXD6, IOMUX_CONFIG_FUNC), |
193 | }; | 194 | }; |
194 | 195 | ||
195 | static struct physmap_flash_data pcm037_flash_data = { | 196 | static struct physmap_flash_data pcm037_flash_data = { |
196 | .width = 2, | 197 | .width = 2, |
197 | }; | 198 | }; |
198 | 199 | ||
199 | static struct resource pcm037_flash_resource = { | 200 | static struct resource pcm037_flash_resource = { |
200 | .start = 0xa0000000, | 201 | .start = 0xa0000000, |
201 | .end = 0xa1ffffff, | 202 | .end = 0xa1ffffff, |
202 | .flags = IORESOURCE_MEM, | 203 | .flags = IORESOURCE_MEM, |
203 | }; | 204 | }; |
204 | 205 | ||
205 | static struct platform_device pcm037_flash = { | 206 | static struct platform_device pcm037_flash = { |
206 | .name = "physmap-flash", | 207 | .name = "physmap-flash", |
207 | .id = 0, | 208 | .id = 0, |
208 | .dev = { | 209 | .dev = { |
209 | .platform_data = &pcm037_flash_data, | 210 | .platform_data = &pcm037_flash_data, |
210 | }, | 211 | }, |
211 | .resource = &pcm037_flash_resource, | 212 | .resource = &pcm037_flash_resource, |
212 | .num_resources = 1, | 213 | .num_resources = 1, |
213 | }; | 214 | }; |
214 | 215 | ||
215 | static const struct imxuart_platform_data uart_pdata __initconst = { | 216 | static const struct imxuart_platform_data uart_pdata __initconst = { |
216 | .flags = IMXUART_HAVE_RTSCTS, | 217 | .flags = IMXUART_HAVE_RTSCTS, |
217 | }; | 218 | }; |
218 | 219 | ||
219 | static struct resource smsc911x_resources[] = { | 220 | static struct resource smsc911x_resources[] = { |
220 | { | 221 | { |
221 | .start = MX31_CS1_BASE_ADDR + 0x300, | 222 | .start = MX31_CS1_BASE_ADDR + 0x300, |
222 | .end = MX31_CS1_BASE_ADDR + 0x300 + SZ_64K - 1, | 223 | .end = MX31_CS1_BASE_ADDR + 0x300 + SZ_64K - 1, |
223 | .flags = IORESOURCE_MEM, | 224 | .flags = IORESOURCE_MEM, |
224 | }, { | 225 | }, { |
225 | .start = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), | 226 | .start = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), |
226 | .end = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), | 227 | .end = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), |
227 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | 228 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
228 | }, | 229 | }, |
229 | }; | 230 | }; |
230 | 231 | ||
231 | static struct smsc911x_platform_config smsc911x_info = { | 232 | static struct smsc911x_platform_config smsc911x_info = { |
232 | .flags = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY | | 233 | .flags = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY | |
233 | SMSC911X_SAVE_MAC_ADDRESS, | 234 | SMSC911X_SAVE_MAC_ADDRESS, |
234 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | 235 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
235 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | 236 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, |
236 | .phy_interface = PHY_INTERFACE_MODE_MII, | 237 | .phy_interface = PHY_INTERFACE_MODE_MII, |
237 | }; | 238 | }; |
238 | 239 | ||
239 | static struct platform_device pcm037_eth = { | 240 | static struct platform_device pcm037_eth = { |
240 | .name = "smsc911x", | 241 | .name = "smsc911x", |
241 | .id = -1, | 242 | .id = -1, |
242 | .num_resources = ARRAY_SIZE(smsc911x_resources), | 243 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
243 | .resource = smsc911x_resources, | 244 | .resource = smsc911x_resources, |
244 | .dev = { | 245 | .dev = { |
245 | .platform_data = &smsc911x_info, | 246 | .platform_data = &smsc911x_info, |
246 | }, | 247 | }, |
247 | }; | 248 | }; |
248 | 249 | ||
249 | static struct platdata_mtd_ram pcm038_sram_data = { | 250 | static struct platdata_mtd_ram pcm038_sram_data = { |
250 | .bankwidth = 2, | 251 | .bankwidth = 2, |
251 | }; | 252 | }; |
252 | 253 | ||
253 | static struct resource pcm038_sram_resource = { | 254 | static struct resource pcm038_sram_resource = { |
254 | .start = MX31_CS4_BASE_ADDR, | 255 | .start = MX31_CS4_BASE_ADDR, |
255 | .end = MX31_CS4_BASE_ADDR + 512 * 1024 - 1, | 256 | .end = MX31_CS4_BASE_ADDR + 512 * 1024 - 1, |
256 | .flags = IORESOURCE_MEM, | 257 | .flags = IORESOURCE_MEM, |
257 | }; | 258 | }; |
258 | 259 | ||
259 | static struct platform_device pcm037_sram_device = { | 260 | static struct platform_device pcm037_sram_device = { |
260 | .name = "mtd-ram", | 261 | .name = "mtd-ram", |
261 | .id = 0, | 262 | .id = 0, |
262 | .dev = { | 263 | .dev = { |
263 | .platform_data = &pcm038_sram_data, | 264 | .platform_data = &pcm038_sram_data, |
264 | }, | 265 | }, |
265 | .num_resources = 1, | 266 | .num_resources = 1, |
266 | .resource = &pcm038_sram_resource, | 267 | .resource = &pcm038_sram_resource, |
267 | }; | 268 | }; |
268 | 269 | ||
269 | static const struct mxc_nand_platform_data | 270 | static const struct mxc_nand_platform_data |
270 | pcm037_nand_board_info __initconst = { | 271 | pcm037_nand_board_info __initconst = { |
271 | .width = 1, | 272 | .width = 1, |
272 | .hw_ecc = 1, | 273 | .hw_ecc = 1, |
273 | }; | 274 | }; |
274 | 275 | ||
275 | static const struct imxi2c_platform_data pcm037_i2c1_data __initconst = { | 276 | static const struct imxi2c_platform_data pcm037_i2c1_data __initconst = { |
276 | .bitrate = 100000, | 277 | .bitrate = 100000, |
277 | }; | 278 | }; |
278 | 279 | ||
279 | static const struct imxi2c_platform_data pcm037_i2c2_data __initconst = { | 280 | static const struct imxi2c_platform_data pcm037_i2c2_data __initconst = { |
280 | .bitrate = 20000, | 281 | .bitrate = 20000, |
281 | }; | 282 | }; |
282 | 283 | ||
283 | static struct at24_platform_data board_eeprom = { | 284 | static struct at24_platform_data board_eeprom = { |
284 | .byte_len = 4096, | 285 | .byte_len = 4096, |
285 | .page_size = 32, | 286 | .page_size = 32, |
286 | .flags = AT24_FLAG_ADDR16, | 287 | .flags = AT24_FLAG_ADDR16, |
287 | }; | 288 | }; |
288 | 289 | ||
289 | static int pcm037_camera_power(struct device *dev, int on) | 290 | static int pcm037_camera_power(struct device *dev, int on) |
290 | { | 291 | { |
291 | /* disable or enable the camera in X7 or X8 PCM970 connector */ | 292 | /* disable or enable the camera in X7 or X8 PCM970 connector */ |
292 | gpio_set_value(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), !on); | 293 | gpio_set_value(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), !on); |
293 | return 0; | 294 | return 0; |
294 | } | 295 | } |
295 | 296 | ||
296 | static struct i2c_board_info pcm037_i2c_camera[] = { | 297 | static struct i2c_board_info pcm037_i2c_camera[] = { |
297 | { | 298 | { |
298 | I2C_BOARD_INFO("mt9t031", 0x5d), | 299 | I2C_BOARD_INFO("mt9t031", 0x5d), |
299 | }, { | 300 | }, { |
300 | I2C_BOARD_INFO("mt9v022", 0x48), | 301 | I2C_BOARD_INFO("mt9v022", 0x48), |
301 | }, | 302 | }, |
302 | }; | 303 | }; |
303 | 304 | ||
304 | static struct soc_camera_link iclink_mt9v022 = { | 305 | static struct soc_camera_link iclink_mt9v022 = { |
305 | .bus_id = 0, /* Must match with the camera ID */ | 306 | .bus_id = 0, /* Must match with the camera ID */ |
306 | .board_info = &pcm037_i2c_camera[1], | 307 | .board_info = &pcm037_i2c_camera[1], |
307 | .i2c_adapter_id = 2, | 308 | .i2c_adapter_id = 2, |
308 | }; | 309 | }; |
309 | 310 | ||
310 | static struct soc_camera_link iclink_mt9t031 = { | 311 | static struct soc_camera_link iclink_mt9t031 = { |
311 | .bus_id = 0, /* Must match with the camera ID */ | 312 | .bus_id = 0, /* Must match with the camera ID */ |
312 | .power = pcm037_camera_power, | 313 | .power = pcm037_camera_power, |
313 | .board_info = &pcm037_i2c_camera[0], | 314 | .board_info = &pcm037_i2c_camera[0], |
314 | .i2c_adapter_id = 2, | 315 | .i2c_adapter_id = 2, |
315 | }; | 316 | }; |
316 | 317 | ||
317 | static struct i2c_board_info pcm037_i2c_devices[] = { | 318 | static struct i2c_board_info pcm037_i2c_devices[] = { |
318 | { | 319 | { |
319 | I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ | 320 | I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ |
320 | .platform_data = &board_eeprom, | 321 | .platform_data = &board_eeprom, |
321 | }, { | 322 | }, { |
322 | I2C_BOARD_INFO("pcf8563", 0x51), | 323 | I2C_BOARD_INFO("pcf8563", 0x51), |
323 | } | 324 | } |
324 | }; | 325 | }; |
325 | 326 | ||
326 | static struct platform_device pcm037_mt9t031 = { | 327 | static struct platform_device pcm037_mt9t031 = { |
327 | .name = "soc-camera-pdrv", | 328 | .name = "soc-camera-pdrv", |
328 | .id = 0, | 329 | .id = 0, |
329 | .dev = { | 330 | .dev = { |
330 | .platform_data = &iclink_mt9t031, | 331 | .platform_data = &iclink_mt9t031, |
331 | }, | 332 | }, |
332 | }; | 333 | }; |
333 | 334 | ||
334 | static struct platform_device pcm037_mt9v022 = { | 335 | static struct platform_device pcm037_mt9v022 = { |
335 | .name = "soc-camera-pdrv", | 336 | .name = "soc-camera-pdrv", |
336 | .id = 1, | 337 | .id = 1, |
337 | .dev = { | 338 | .dev = { |
338 | .platform_data = &iclink_mt9v022, | 339 | .platform_data = &iclink_mt9v022, |
339 | }, | 340 | }, |
340 | }; | 341 | }; |
341 | 342 | ||
342 | /* Not connected by default */ | 343 | /* Not connected by default */ |
343 | #ifdef PCM970_SDHC_RW_SWITCH | 344 | #ifdef PCM970_SDHC_RW_SWITCH |
344 | static int pcm970_sdhc1_get_ro(struct device *dev) | 345 | static int pcm970_sdhc1_get_ro(struct device *dev) |
345 | { | 346 | { |
346 | return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_SFS6)); | 347 | return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_SFS6)); |
347 | } | 348 | } |
348 | #endif | 349 | #endif |
349 | 350 | ||
350 | #define SDHC1_GPIO_WP IOMUX_TO_GPIO(MX31_PIN_SFS6) | 351 | #define SDHC1_GPIO_WP IOMUX_TO_GPIO(MX31_PIN_SFS6) |
351 | #define SDHC1_GPIO_DET IOMUX_TO_GPIO(MX31_PIN_SCK6) | 352 | #define SDHC1_GPIO_DET IOMUX_TO_GPIO(MX31_PIN_SCK6) |
352 | 353 | ||
353 | static int pcm970_sdhc1_init(struct device *dev, irq_handler_t detect_irq, | 354 | static int pcm970_sdhc1_init(struct device *dev, irq_handler_t detect_irq, |
354 | void *data) | 355 | void *data) |
355 | { | 356 | { |
356 | int ret; | 357 | int ret; |
357 | 358 | ||
358 | ret = gpio_request(SDHC1_GPIO_DET, "sdhc-detect"); | 359 | ret = gpio_request(SDHC1_GPIO_DET, "sdhc-detect"); |
359 | if (ret) | 360 | if (ret) |
360 | return ret; | 361 | return ret; |
361 | 362 | ||
362 | gpio_direction_input(SDHC1_GPIO_DET); | 363 | gpio_direction_input(SDHC1_GPIO_DET); |
363 | 364 | ||
364 | #ifdef PCM970_SDHC_RW_SWITCH | 365 | #ifdef PCM970_SDHC_RW_SWITCH |
365 | ret = gpio_request(SDHC1_GPIO_WP, "sdhc-wp"); | 366 | ret = gpio_request(SDHC1_GPIO_WP, "sdhc-wp"); |
366 | if (ret) | 367 | if (ret) |
367 | goto err_gpio_free; | 368 | goto err_gpio_free; |
368 | gpio_direction_input(SDHC1_GPIO_WP); | 369 | gpio_direction_input(SDHC1_GPIO_WP); |
369 | #endif | 370 | #endif |
370 | 371 | ||
371 | ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), detect_irq, | 372 | ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), detect_irq, |
372 | IRQF_DISABLED | IRQF_TRIGGER_FALLING, | 373 | IRQF_DISABLED | IRQF_TRIGGER_FALLING, |
373 | "sdhc-detect", data); | 374 | "sdhc-detect", data); |
374 | if (ret) | 375 | if (ret) |
375 | goto err_gpio_free_2; | 376 | goto err_gpio_free_2; |
376 | 377 | ||
377 | return 0; | 378 | return 0; |
378 | 379 | ||
379 | err_gpio_free_2: | 380 | err_gpio_free_2: |
380 | #ifdef PCM970_SDHC_RW_SWITCH | 381 | #ifdef PCM970_SDHC_RW_SWITCH |
381 | gpio_free(SDHC1_GPIO_WP); | 382 | gpio_free(SDHC1_GPIO_WP); |
382 | err_gpio_free: | 383 | err_gpio_free: |
383 | #endif | 384 | #endif |
384 | gpio_free(SDHC1_GPIO_DET); | 385 | gpio_free(SDHC1_GPIO_DET); |
385 | 386 | ||
386 | return ret; | 387 | return ret; |
387 | } | 388 | } |
388 | 389 | ||
389 | static void pcm970_sdhc1_exit(struct device *dev, void *data) | 390 | static void pcm970_sdhc1_exit(struct device *dev, void *data) |
390 | { | 391 | { |
391 | free_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), data); | 392 | free_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), data); |
392 | gpio_free(SDHC1_GPIO_DET); | 393 | gpio_free(SDHC1_GPIO_DET); |
393 | gpio_free(SDHC1_GPIO_WP); | 394 | gpio_free(SDHC1_GPIO_WP); |
394 | } | 395 | } |
395 | 396 | ||
396 | static const struct imxmmc_platform_data sdhc_pdata __initconst = { | 397 | static const struct imxmmc_platform_data sdhc_pdata __initconst = { |
397 | #ifdef PCM970_SDHC_RW_SWITCH | 398 | #ifdef PCM970_SDHC_RW_SWITCH |
398 | .get_ro = pcm970_sdhc1_get_ro, | 399 | .get_ro = pcm970_sdhc1_get_ro, |
399 | #endif | 400 | #endif |
400 | .init = pcm970_sdhc1_init, | 401 | .init = pcm970_sdhc1_init, |
401 | .exit = pcm970_sdhc1_exit, | 402 | .exit = pcm970_sdhc1_exit, |
402 | }; | 403 | }; |
403 | 404 | ||
404 | struct mx3_camera_pdata camera_pdata __initdata = { | 405 | struct mx3_camera_pdata camera_pdata __initdata = { |
405 | .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10, | 406 | .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10, |
406 | .mclk_10khz = 2000, | 407 | .mclk_10khz = 2000, |
407 | }; | 408 | }; |
408 | 409 | ||
409 | static phys_addr_t mx3_camera_base __initdata; | 410 | static phys_addr_t mx3_camera_base __initdata; |
410 | #define MX3_CAMERA_BUF_SIZE SZ_4M | 411 | #define MX3_CAMERA_BUF_SIZE SZ_4M |
411 | 412 | ||
412 | static int __init pcm037_init_camera(void) | 413 | static int __init pcm037_init_camera(void) |
413 | { | 414 | { |
414 | int dma, ret = -ENOMEM; | 415 | int dma, ret = -ENOMEM; |
415 | struct platform_device *pdev = imx31_alloc_mx3_camera(&camera_pdata); | 416 | struct platform_device *pdev = imx31_alloc_mx3_camera(&camera_pdata); |
416 | 417 | ||
417 | if (IS_ERR(pdev)) | 418 | if (IS_ERR(pdev)) |
418 | return PTR_ERR(pdev); | 419 | return PTR_ERR(pdev); |
419 | 420 | ||
420 | dma = dma_declare_coherent_memory(&pdev->dev, | 421 | dma = dma_declare_coherent_memory(&pdev->dev, |
421 | mx3_camera_base, mx3_camera_base, | 422 | mx3_camera_base, mx3_camera_base, |
422 | MX3_CAMERA_BUF_SIZE, | 423 | MX3_CAMERA_BUF_SIZE, |
423 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | 424 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); |
424 | if (!(dma & DMA_MEMORY_MAP)) | 425 | if (!(dma & DMA_MEMORY_MAP)) |
425 | goto err; | 426 | goto err; |
426 | 427 | ||
427 | ret = platform_device_add(pdev); | 428 | ret = platform_device_add(pdev); |
428 | if (ret) | 429 | if (ret) |
429 | err: | 430 | err: |
430 | platform_device_put(pdev); | 431 | platform_device_put(pdev); |
431 | 432 | ||
432 | return ret; | 433 | return ret; |
433 | } | 434 | } |
434 | 435 | ||
435 | static struct platform_device *devices[] __initdata = { | 436 | static struct platform_device *devices[] __initdata = { |
436 | &pcm037_flash, | 437 | &pcm037_flash, |
437 | &pcm037_sram_device, | 438 | &pcm037_sram_device, |
438 | &pcm037_mt9t031, | 439 | &pcm037_mt9t031, |
439 | &pcm037_mt9v022, | 440 | &pcm037_mt9v022, |
440 | }; | 441 | }; |
441 | 442 | ||
442 | static const struct ipu_platform_data mx3_ipu_data __initconst = { | 443 | static const struct ipu_platform_data mx3_ipu_data __initconst = { |
443 | .irq_base = MXC_IPU_IRQ_START, | 444 | .irq_base = MXC_IPU_IRQ_START, |
444 | }; | 445 | }; |
445 | 446 | ||
446 | static const struct fb_videomode fb_modedb[] = { | 447 | static const struct fb_videomode fb_modedb[] = { |
447 | { | 448 | { |
448 | /* 240x320 @ 60 Hz Sharp */ | 449 | /* 240x320 @ 60 Hz Sharp */ |
449 | .name = "Sharp-LQ035Q7DH06-QVGA", | 450 | .name = "Sharp-LQ035Q7DH06-QVGA", |
450 | .refresh = 60, | 451 | .refresh = 60, |
451 | .xres = 240, | 452 | .xres = 240, |
452 | .yres = 320, | 453 | .yres = 320, |
453 | .pixclock = 185925, | 454 | .pixclock = 185925, |
454 | .left_margin = 9, | 455 | .left_margin = 9, |
455 | .right_margin = 16, | 456 | .right_margin = 16, |
456 | .upper_margin = 7, | 457 | .upper_margin = 7, |
457 | .lower_margin = 9, | 458 | .lower_margin = 9, |
458 | .hsync_len = 1, | 459 | .hsync_len = 1, |
459 | .vsync_len = 1, | 460 | .vsync_len = 1, |
460 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_SHARP_MODE | | 461 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_SHARP_MODE | |
461 | FB_SYNC_CLK_INVERT | FB_SYNC_CLK_IDLE_EN, | 462 | FB_SYNC_CLK_INVERT | FB_SYNC_CLK_IDLE_EN, |
462 | .vmode = FB_VMODE_NONINTERLACED, | 463 | .vmode = FB_VMODE_NONINTERLACED, |
463 | .flag = 0, | 464 | .flag = 0, |
464 | }, { | 465 | }, { |
465 | /* 240x320 @ 60 Hz */ | 466 | /* 240x320 @ 60 Hz */ |
466 | .name = "TX090", | 467 | .name = "TX090", |
467 | .refresh = 60, | 468 | .refresh = 60, |
468 | .xres = 240, | 469 | .xres = 240, |
469 | .yres = 320, | 470 | .yres = 320, |
470 | .pixclock = 38255, | 471 | .pixclock = 38255, |
471 | .left_margin = 144, | 472 | .left_margin = 144, |
472 | .right_margin = 0, | 473 | .right_margin = 0, |
473 | .upper_margin = 7, | 474 | .upper_margin = 7, |
474 | .lower_margin = 40, | 475 | .lower_margin = 40, |
475 | .hsync_len = 96, | 476 | .hsync_len = 96, |
476 | .vsync_len = 1, | 477 | .vsync_len = 1, |
477 | .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH, | 478 | .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH, |
478 | .vmode = FB_VMODE_NONINTERLACED, | 479 | .vmode = FB_VMODE_NONINTERLACED, |
479 | .flag = 0, | 480 | .flag = 0, |
480 | }, { | 481 | }, { |
481 | /* 240x320 @ 60 Hz */ | 482 | /* 240x320 @ 60 Hz */ |
482 | .name = "CMEL-OLED", | 483 | .name = "CMEL-OLED", |
483 | .refresh = 60, | 484 | .refresh = 60, |
484 | .xres = 240, | 485 | .xres = 240, |
485 | .yres = 320, | 486 | .yres = 320, |
486 | .pixclock = 185925, | 487 | .pixclock = 185925, |
487 | .left_margin = 9, | 488 | .left_margin = 9, |
488 | .right_margin = 16, | 489 | .right_margin = 16, |
489 | .upper_margin = 7, | 490 | .upper_margin = 7, |
490 | .lower_margin = 9, | 491 | .lower_margin = 9, |
491 | .hsync_len = 1, | 492 | .hsync_len = 1, |
492 | .vsync_len = 1, | 493 | .vsync_len = 1, |
493 | .sync = FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT, | 494 | .sync = FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT, |
494 | .vmode = FB_VMODE_NONINTERLACED, | 495 | .vmode = FB_VMODE_NONINTERLACED, |
495 | .flag = 0, | 496 | .flag = 0, |
496 | }, | 497 | }, |
497 | }; | 498 | }; |
498 | 499 | ||
499 | static struct mx3fb_platform_data mx3fb_pdata = { | 500 | static struct mx3fb_platform_data mx3fb_pdata = { |
500 | .name = "Sharp-LQ035Q7DH06-QVGA", | 501 | .name = "Sharp-LQ035Q7DH06-QVGA", |
501 | .mode = fb_modedb, | 502 | .mode = fb_modedb, |
502 | .num_modes = ARRAY_SIZE(fb_modedb), | 503 | .num_modes = ARRAY_SIZE(fb_modedb), |
503 | }; | 504 | }; |
504 | 505 | ||
505 | static struct resource pcm970_sja1000_resources[] = { | 506 | static struct resource pcm970_sja1000_resources[] = { |
506 | { | 507 | { |
507 | .start = MX31_CS5_BASE_ADDR, | 508 | .start = MX31_CS5_BASE_ADDR, |
508 | .end = MX31_CS5_BASE_ADDR + 0x100 - 1, | 509 | .end = MX31_CS5_BASE_ADDR + 0x100 - 1, |
509 | .flags = IORESOURCE_MEM, | 510 | .flags = IORESOURCE_MEM, |
510 | }, { | 511 | }, { |
511 | .start = IOMUX_TO_IRQ(IOMUX_PIN(48, 105)), | 512 | .start = IOMUX_TO_IRQ(IOMUX_PIN(48, 105)), |
512 | .end = IOMUX_TO_IRQ(IOMUX_PIN(48, 105)), | 513 | .end = IOMUX_TO_IRQ(IOMUX_PIN(48, 105)), |
513 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, | 514 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, |
514 | }, | 515 | }, |
515 | }; | 516 | }; |
516 | 517 | ||
517 | struct sja1000_platform_data pcm970_sja1000_platform_data = { | 518 | struct sja1000_platform_data pcm970_sja1000_platform_data = { |
518 | .osc_freq = 16000000, | 519 | .osc_freq = 16000000, |
519 | .ocr = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL, | 520 | .ocr = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL, |
520 | .cdr = CDR_CBP, | 521 | .cdr = CDR_CBP, |
521 | }; | 522 | }; |
522 | 523 | ||
523 | static struct platform_device pcm970_sja1000 = { | 524 | static struct platform_device pcm970_sja1000 = { |
524 | .name = "sja1000_platform", | 525 | .name = "sja1000_platform", |
525 | .dev = { | 526 | .dev = { |
526 | .platform_data = &pcm970_sja1000_platform_data, | 527 | .platform_data = &pcm970_sja1000_platform_data, |
527 | }, | 528 | }, |
528 | .resource = pcm970_sja1000_resources, | 529 | .resource = pcm970_sja1000_resources, |
529 | .num_resources = ARRAY_SIZE(pcm970_sja1000_resources), | 530 | .num_resources = ARRAY_SIZE(pcm970_sja1000_resources), |
530 | }; | 531 | }; |
531 | 532 | ||
532 | static int pcm037_otg_init(struct platform_device *pdev) | 533 | static int pcm037_otg_init(struct platform_device *pdev) |
533 | { | 534 | { |
534 | return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); | 535 | return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); |
535 | } | 536 | } |
536 | 537 | ||
537 | static struct mxc_usbh_platform_data otg_pdata __initdata = { | 538 | static struct mxc_usbh_platform_data otg_pdata __initdata = { |
538 | .init = pcm037_otg_init, | 539 | .init = pcm037_otg_init, |
539 | .portsc = MXC_EHCI_MODE_ULPI, | 540 | .portsc = MXC_EHCI_MODE_ULPI, |
540 | }; | 541 | }; |
541 | 542 | ||
542 | static int pcm037_usbh2_init(struct platform_device *pdev) | 543 | static int pcm037_usbh2_init(struct platform_device *pdev) |
543 | { | 544 | { |
544 | return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); | 545 | return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); |
545 | } | 546 | } |
546 | 547 | ||
547 | static struct mxc_usbh_platform_data usbh2_pdata __initdata = { | 548 | static struct mxc_usbh_platform_data usbh2_pdata __initdata = { |
548 | .init = pcm037_usbh2_init, | 549 | .init = pcm037_usbh2_init, |
549 | .portsc = MXC_EHCI_MODE_ULPI, | 550 | .portsc = MXC_EHCI_MODE_ULPI, |
550 | }; | 551 | }; |
551 | 552 | ||
552 | static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { | 553 | static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { |
553 | .operating_mode = FSL_USB2_DR_DEVICE, | 554 | .operating_mode = FSL_USB2_DR_DEVICE, |
554 | .phy_mode = FSL_USB2_PHY_ULPI, | 555 | .phy_mode = FSL_USB2_PHY_ULPI, |
555 | }; | 556 | }; |
556 | 557 | ||
557 | static int otg_mode_host; | 558 | static int otg_mode_host; |
558 | 559 | ||
559 | static int __init pcm037_otg_mode(char *options) | 560 | static int __init pcm037_otg_mode(char *options) |
560 | { | 561 | { |
561 | if (!strcmp(options, "host")) | 562 | if (!strcmp(options, "host")) |
562 | otg_mode_host = 1; | 563 | otg_mode_host = 1; |
563 | else if (!strcmp(options, "device")) | 564 | else if (!strcmp(options, "device")) |
564 | otg_mode_host = 0; | 565 | otg_mode_host = 0; |
565 | else | 566 | else |
566 | pr_info("otg_mode neither \"host\" nor \"device\". " | 567 | pr_info("otg_mode neither \"host\" nor \"device\". " |
567 | "Defaulting to device\n"); | 568 | "Defaulting to device\n"); |
568 | return 0; | 569 | return 0; |
569 | } | 570 | } |
570 | __setup("otg_mode=", pcm037_otg_mode); | 571 | __setup("otg_mode=", pcm037_otg_mode); |
571 | 572 | ||
572 | /* | 573 | /* |
573 | * Board specific initialization. | 574 | * Board specific initialization. |
574 | */ | 575 | */ |
575 | static void __init pcm037_init(void) | 576 | static void __init pcm037_init(void) |
576 | { | 577 | { |
577 | int ret; | 578 | int ret; |
578 | 579 | ||
579 | imx31_soc_init(); | 580 | imx31_soc_init(); |
580 | 581 | ||
581 | mxc_iomux_set_gpr(MUX_PGP_UH2, 1); | 582 | mxc_iomux_set_gpr(MUX_PGP_UH2, 1); |
582 | 583 | ||
583 | mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins), | 584 | mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins), |
584 | "pcm037"); | 585 | "pcm037"); |
585 | 586 | ||
586 | #define H2_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS \ | 587 | #define H2_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS \ |
587 | | PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) | 588 | | PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) |
588 | 589 | ||
589 | mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, H2_PAD_CFG); | 590 | mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, H2_PAD_CFG); |
590 | mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, H2_PAD_CFG); | 591 | mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, H2_PAD_CFG); |
591 | mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, H2_PAD_CFG); | 592 | mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, H2_PAD_CFG); |
592 | mxc_iomux_set_pad(MX31_PIN_USBH2_STP, H2_PAD_CFG); | 593 | mxc_iomux_set_pad(MX31_PIN_USBH2_STP, H2_PAD_CFG); |
593 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, H2_PAD_CFG); /* USBH2_DATA0 */ | 594 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, H2_PAD_CFG); /* USBH2_DATA0 */ |
594 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, H2_PAD_CFG); /* USBH2_DATA1 */ | 595 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, H2_PAD_CFG); /* USBH2_DATA1 */ |
595 | mxc_iomux_set_pad(MX31_PIN_SRXD6, H2_PAD_CFG); /* USBH2_DATA2 */ | 596 | mxc_iomux_set_pad(MX31_PIN_SRXD6, H2_PAD_CFG); /* USBH2_DATA2 */ |
596 | mxc_iomux_set_pad(MX31_PIN_STXD6, H2_PAD_CFG); /* USBH2_DATA3 */ | 597 | mxc_iomux_set_pad(MX31_PIN_STXD6, H2_PAD_CFG); /* USBH2_DATA3 */ |
597 | mxc_iomux_set_pad(MX31_PIN_SFS3, H2_PAD_CFG); /* USBH2_DATA4 */ | 598 | mxc_iomux_set_pad(MX31_PIN_SFS3, H2_PAD_CFG); /* USBH2_DATA4 */ |
598 | mxc_iomux_set_pad(MX31_PIN_SCK3, H2_PAD_CFG); /* USBH2_DATA5 */ | 599 | mxc_iomux_set_pad(MX31_PIN_SCK3, H2_PAD_CFG); /* USBH2_DATA5 */ |
599 | mxc_iomux_set_pad(MX31_PIN_SRXD3, H2_PAD_CFG); /* USBH2_DATA6 */ | 600 | mxc_iomux_set_pad(MX31_PIN_SRXD3, H2_PAD_CFG); /* USBH2_DATA6 */ |
600 | mxc_iomux_set_pad(MX31_PIN_STXD3, H2_PAD_CFG); /* USBH2_DATA7 */ | 601 | mxc_iomux_set_pad(MX31_PIN_STXD3, H2_PAD_CFG); /* USBH2_DATA7 */ |
601 | 602 | ||
602 | if (pcm037_variant() == PCM037_EET) | 603 | if (pcm037_variant() == PCM037_EET) |
603 | mxc_iomux_setup_multiple_pins(pcm037_uart1_pins, | 604 | mxc_iomux_setup_multiple_pins(pcm037_uart1_pins, |
604 | ARRAY_SIZE(pcm037_uart1_pins), "pcm037_uart1"); | 605 | ARRAY_SIZE(pcm037_uart1_pins), "pcm037_uart1"); |
605 | else | 606 | else |
606 | mxc_iomux_setup_multiple_pins(pcm037_uart1_handshake_pins, | 607 | mxc_iomux_setup_multiple_pins(pcm037_uart1_handshake_pins, |
607 | ARRAY_SIZE(pcm037_uart1_handshake_pins), | 608 | ARRAY_SIZE(pcm037_uart1_handshake_pins), |
608 | "pcm037_uart1"); | 609 | "pcm037_uart1"); |
609 | 610 | ||
610 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 611 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
611 | 612 | ||
612 | imx31_add_imx2_wdt(NULL); | 613 | imx31_add_imx2_wdt(NULL); |
613 | imx31_add_imx_uart0(&uart_pdata); | 614 | imx31_add_imx_uart0(&uart_pdata); |
614 | /* XXX: should't this have .flags = 0 (i.e. no RTSCTS) on PCM037_EET? */ | 615 | /* XXX: should't this have .flags = 0 (i.e. no RTSCTS) on PCM037_EET? */ |
615 | imx31_add_imx_uart1(&uart_pdata); | 616 | imx31_add_imx_uart1(&uart_pdata); |
616 | imx31_add_imx_uart2(&uart_pdata); | 617 | imx31_add_imx_uart2(&uart_pdata); |
617 | 618 | ||
618 | imx31_add_mxc_w1(NULL); | 619 | imx31_add_mxc_w1(NULL); |
619 | 620 | ||
620 | /* LAN9217 IRQ pin */ | 621 | /* LAN9217 IRQ pin */ |
621 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1), "lan9217-irq"); | 622 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1), "lan9217-irq"); |
622 | if (ret) | 623 | if (ret) |
623 | pr_warning("could not get LAN irq gpio\n"); | 624 | pr_warning("could not get LAN irq gpio\n"); |
624 | else { | 625 | else { |
625 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)); | 626 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)); |
626 | platform_device_register(&pcm037_eth); | 627 | platform_device_register(&pcm037_eth); |
627 | } | 628 | } |
628 | 629 | ||
629 | 630 | ||
630 | /* I2C adapters and devices */ | 631 | /* I2C adapters and devices */ |
631 | i2c_register_board_info(1, pcm037_i2c_devices, | 632 | i2c_register_board_info(1, pcm037_i2c_devices, |
632 | ARRAY_SIZE(pcm037_i2c_devices)); | 633 | ARRAY_SIZE(pcm037_i2c_devices)); |
633 | 634 | ||
634 | imx31_add_imx_i2c1(&pcm037_i2c1_data); | 635 | imx31_add_imx_i2c1(&pcm037_i2c1_data); |
635 | imx31_add_imx_i2c2(&pcm037_i2c2_data); | 636 | imx31_add_imx_i2c2(&pcm037_i2c2_data); |
636 | 637 | ||
637 | imx31_add_mxc_nand(&pcm037_nand_board_info); | 638 | imx31_add_mxc_nand(&pcm037_nand_board_info); |
638 | imx31_add_mxc_mmc(0, &sdhc_pdata); | 639 | imx31_add_mxc_mmc(0, &sdhc_pdata); |
639 | imx31_add_ipu_core(&mx3_ipu_data); | 640 | imx31_add_ipu_core(&mx3_ipu_data); |
640 | imx31_add_mx3_sdc_fb(&mx3fb_pdata); | 641 | imx31_add_mx3_sdc_fb(&mx3fb_pdata); |
641 | 642 | ||
642 | /* CSI */ | 643 | /* CSI */ |
643 | /* Camera power: default - off */ | 644 | /* Camera power: default - off */ |
644 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), "mt9t031-power"); | 645 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), "mt9t031-power"); |
645 | if (!ret) | 646 | if (!ret) |
646 | gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), 1); | 647 | gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), 1); |
647 | else | 648 | else |
648 | iclink_mt9t031.power = NULL; | 649 | iclink_mt9t031.power = NULL; |
649 | 650 | ||
650 | pcm037_init_camera(); | 651 | pcm037_init_camera(); |
651 | 652 | ||
652 | platform_device_register(&pcm970_sja1000); | 653 | platform_device_register(&pcm970_sja1000); |
653 | 654 | ||
654 | if (otg_mode_host) { | 655 | if (otg_mode_host) { |
655 | otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | | 656 | otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | |
656 | ULPI_OTG_DRVVBUS_EXT); | 657 | ULPI_OTG_DRVVBUS_EXT); |
657 | if (otg_pdata.otg) | 658 | if (otg_pdata.otg) |
658 | imx31_add_mxc_ehci_otg(&otg_pdata); | 659 | imx31_add_mxc_ehci_otg(&otg_pdata); |
659 | } | 660 | } |
660 | 661 | ||
661 | usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | | 662 | usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | |
662 | ULPI_OTG_DRVVBUS_EXT); | 663 | ULPI_OTG_DRVVBUS_EXT); |
663 | if (usbh2_pdata.otg) | 664 | if (usbh2_pdata.otg) |
664 | imx31_add_mxc_ehci_hs(2, &usbh2_pdata); | 665 | imx31_add_mxc_ehci_hs(2, &usbh2_pdata); |
665 | 666 | ||
666 | if (!otg_mode_host) | 667 | if (!otg_mode_host) |
667 | imx31_add_fsl_usb2_udc(&otg_device_pdata); | 668 | imx31_add_fsl_usb2_udc(&otg_device_pdata); |
668 | 669 | ||
669 | } | 670 | } |
670 | 671 | ||
671 | static void __init pcm037_timer_init(void) | 672 | static void __init pcm037_timer_init(void) |
672 | { | 673 | { |
673 | mx31_clocks_init(26000000); | 674 | mx31_clocks_init(26000000); |
674 | } | 675 | } |
675 | 676 | ||
676 | struct sys_timer pcm037_timer = { | 677 | struct sys_timer pcm037_timer = { |
677 | .init = pcm037_timer_init, | 678 | .init = pcm037_timer_init, |
678 | }; | 679 | }; |
679 | 680 | ||
680 | static void __init pcm037_reserve(void) | 681 | static void __init pcm037_reserve(void) |
681 | { | 682 | { |
682 | /* reserve 4 MiB for mx3-camera */ | 683 | /* reserve 4 MiB for mx3-camera */ |
683 | mx3_camera_base = memblock_alloc(MX3_CAMERA_BUF_SIZE, | 684 | mx3_camera_base = arm_memblock_steal(MX3_CAMERA_BUF_SIZE, |
684 | MX3_CAMERA_BUF_SIZE); | 685 | MX3_CAMERA_BUF_SIZE); |
685 | memblock_free(mx3_camera_base, MX3_CAMERA_BUF_SIZE); | ||
686 | memblock_remove(mx3_camera_base, MX3_CAMERA_BUF_SIZE); | ||
687 | } | 686 | } |
688 | 687 | ||
689 | MACHINE_START(PCM037, "Phytec Phycore pcm037") | 688 | MACHINE_START(PCM037, "Phytec Phycore pcm037") |
690 | /* Maintainer: Pengutronix */ | 689 | /* Maintainer: Pengutronix */ |
691 | .atag_offset = 0x100, | 690 | .atag_offset = 0x100, |
692 | .reserve = pcm037_reserve, | 691 | .reserve = pcm037_reserve, |
693 | .map_io = mx31_map_io, | 692 | .map_io = mx31_map_io, |
694 | .init_early = imx31_init_early, | 693 | .init_early = imx31_init_early, |
695 | .init_irq = mx31_init_irq, | 694 | .init_irq = mx31_init_irq, |
696 | .handle_irq = imx31_handle_irq, | 695 | .handle_irq = imx31_handle_irq, |
697 | .timer = &pcm037_timer, | 696 | .timer = &pcm037_timer, |
698 | .init_machine = pcm037_init, | 697 | .init_machine = pcm037_init, |
699 | .restart = mxc_restart, | 698 | .restart = mxc_restart, |
700 | MACHINE_END | 699 | MACHINE_END |
arch/arm/mach-omap2/Kconfig
1 | if ARCH_OMAP2PLUS | 1 | if ARCH_OMAP2PLUS |
2 | 2 | ||
3 | menu "TI OMAP2/3/4 Specific Features" | 3 | menu "TI OMAP2/3/4 Specific Features" |
4 | 4 | ||
5 | config ARCH_OMAP2PLUS_TYPICAL | 5 | config ARCH_OMAP2PLUS_TYPICAL |
6 | bool "Typical OMAP configuration" | 6 | bool "Typical OMAP configuration" |
7 | default y | 7 | default y |
8 | select AEABI | 8 | select AEABI |
9 | select REGULATOR | 9 | select REGULATOR |
10 | select PM_RUNTIME | 10 | select PM_RUNTIME |
11 | select VFP | 11 | select VFP |
12 | select NEON if ARCH_OMAP3 || ARCH_OMAP4 | 12 | select NEON if ARCH_OMAP3 || ARCH_OMAP4 |
13 | select SERIAL_OMAP | 13 | select SERIAL_OMAP |
14 | select SERIAL_OMAP_CONSOLE | 14 | select SERIAL_OMAP_CONSOLE |
15 | select I2C | 15 | select I2C |
16 | select I2C_OMAP | 16 | select I2C_OMAP |
17 | select MENELAUS if ARCH_OMAP2 | 17 | select MENELAUS if ARCH_OMAP2 |
18 | select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4 | 18 | select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4 |
19 | select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4 | 19 | select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4 |
20 | help | 20 | help |
21 | Compile a kernel suitable for booting most boards | 21 | Compile a kernel suitable for booting most boards |
22 | 22 | ||
23 | config ARCH_OMAP2 | 23 | config ARCH_OMAP2 |
24 | bool "TI OMAP2" | 24 | bool "TI OMAP2" |
25 | depends on ARCH_OMAP2PLUS | 25 | depends on ARCH_OMAP2PLUS |
26 | default y | 26 | default y |
27 | select CPU_V6 | 27 | select CPU_V6 |
28 | select MULTI_IRQ_HANDLER | 28 | select MULTI_IRQ_HANDLER |
29 | 29 | ||
30 | config ARCH_OMAP3 | 30 | config ARCH_OMAP3 |
31 | bool "TI OMAP3" | 31 | bool "TI OMAP3" |
32 | depends on ARCH_OMAP2PLUS | 32 | depends on ARCH_OMAP2PLUS |
33 | default y | 33 | default y |
34 | select CPU_V7 | 34 | select CPU_V7 |
35 | select USB_ARCH_HAS_EHCI | 35 | select USB_ARCH_HAS_EHCI |
36 | select ARM_L1_CACHE_SHIFT_6 if !ARCH_OMAP4 | 36 | select ARM_L1_CACHE_SHIFT_6 if !ARCH_OMAP4 |
37 | select ARCH_HAS_OPP | 37 | select ARCH_HAS_OPP |
38 | select PM_OPP if PM | 38 | select PM_OPP if PM |
39 | select ARM_CPU_SUSPEND if PM | 39 | select ARM_CPU_SUSPEND if PM |
40 | select MULTI_IRQ_HANDLER | 40 | select MULTI_IRQ_HANDLER |
41 | 41 | ||
42 | config ARCH_OMAP4 | 42 | config ARCH_OMAP4 |
43 | bool "TI OMAP4" | 43 | bool "TI OMAP4" |
44 | default y | 44 | default y |
45 | depends on ARCH_OMAP2PLUS | 45 | depends on ARCH_OMAP2PLUS |
46 | select CACHE_L2X0 | 46 | select CACHE_L2X0 |
47 | select CPU_V7 | 47 | select CPU_V7 |
48 | select ARM_GIC | 48 | select ARM_GIC |
49 | select HAVE_SMP | 49 | select HAVE_SMP |
50 | select LOCAL_TIMERS if SMP | 50 | select LOCAL_TIMERS if SMP |
51 | select PL310_ERRATA_588369 | 51 | select PL310_ERRATA_588369 |
52 | select PL310_ERRATA_727915 | 52 | select PL310_ERRATA_727915 |
53 | select ARM_ERRATA_720789 | 53 | select ARM_ERRATA_720789 |
54 | select ARCH_HAS_OPP | 54 | select ARCH_HAS_OPP |
55 | select PM_OPP if PM | 55 | select PM_OPP if PM |
56 | select USB_ARCH_HAS_EHCI | 56 | select USB_ARCH_HAS_EHCI |
57 | select ARM_CPU_SUSPEND if PM | 57 | select ARM_CPU_SUSPEND if PM |
58 | 58 | ||
59 | comment "OMAP Core Type" | 59 | comment "OMAP Core Type" |
60 | depends on ARCH_OMAP2 | 60 | depends on ARCH_OMAP2 |
61 | 61 | ||
62 | config SOC_OMAP2420 | 62 | config SOC_OMAP2420 |
63 | bool "OMAP2420 support" | 63 | bool "OMAP2420 support" |
64 | depends on ARCH_OMAP2 | 64 | depends on ARCH_OMAP2 |
65 | default y | 65 | default y |
66 | select OMAP_DM_TIMER | 66 | select OMAP_DM_TIMER |
67 | select ARCH_OMAP_OTG | 67 | select ARCH_OMAP_OTG |
68 | 68 | ||
69 | config SOC_OMAP2430 | 69 | config SOC_OMAP2430 |
70 | bool "OMAP2430 support" | 70 | bool "OMAP2430 support" |
71 | depends on ARCH_OMAP2 | 71 | depends on ARCH_OMAP2 |
72 | default y | 72 | default y |
73 | select ARCH_OMAP_OTG | 73 | select ARCH_OMAP_OTG |
74 | 74 | ||
75 | config SOC_OMAP3430 | 75 | config SOC_OMAP3430 |
76 | bool "OMAP3430 support" | 76 | bool "OMAP3430 support" |
77 | depends on ARCH_OMAP3 | 77 | depends on ARCH_OMAP3 |
78 | default y | 78 | default y |
79 | select ARCH_OMAP_OTG | 79 | select ARCH_OMAP_OTG |
80 | 80 | ||
81 | config SOC_OMAPTI81XX | 81 | config SOC_OMAPTI81XX |
82 | bool "TI81XX support" | 82 | bool "TI81XX support" |
83 | depends on ARCH_OMAP3 | 83 | depends on ARCH_OMAP3 |
84 | default y | 84 | default y |
85 | 85 | ||
86 | config SOC_OMAPAM33XX | 86 | config SOC_OMAPAM33XX |
87 | bool "AM33XX support" | 87 | bool "AM33XX support" |
88 | depends on ARCH_OMAP3 | 88 | depends on ARCH_OMAP3 |
89 | default y | 89 | default y |
90 | 90 | ||
91 | config OMAP_PACKAGE_ZAF | 91 | config OMAP_PACKAGE_ZAF |
92 | bool | 92 | bool |
93 | 93 | ||
94 | config OMAP_PACKAGE_ZAC | 94 | config OMAP_PACKAGE_ZAC |
95 | bool | 95 | bool |
96 | 96 | ||
97 | config OMAP_PACKAGE_CBC | 97 | config OMAP_PACKAGE_CBC |
98 | bool | 98 | bool |
99 | 99 | ||
100 | config OMAP_PACKAGE_CBB | 100 | config OMAP_PACKAGE_CBB |
101 | bool | 101 | bool |
102 | 102 | ||
103 | config OMAP_PACKAGE_CUS | 103 | config OMAP_PACKAGE_CUS |
104 | bool | 104 | bool |
105 | 105 | ||
106 | config OMAP_PACKAGE_CBP | 106 | config OMAP_PACKAGE_CBP |
107 | bool | 107 | bool |
108 | 108 | ||
109 | config OMAP_PACKAGE_CBL | 109 | config OMAP_PACKAGE_CBL |
110 | bool | 110 | bool |
111 | 111 | ||
112 | config OMAP_PACKAGE_CBS | 112 | config OMAP_PACKAGE_CBS |
113 | bool | 113 | bool |
114 | 114 | ||
115 | comment "OMAP Board Type" | 115 | comment "OMAP Board Type" |
116 | depends on ARCH_OMAP2PLUS | 116 | depends on ARCH_OMAP2PLUS |
117 | 117 | ||
118 | config MACH_OMAP_GENERIC | 118 | config MACH_OMAP_GENERIC |
119 | bool "Generic OMAP2+ board" | 119 | bool "Generic OMAP2+ board" |
120 | depends on ARCH_OMAP2PLUS | 120 | depends on ARCH_OMAP2PLUS |
121 | select USE_OF | 121 | select USE_OF |
122 | default y | 122 | default y |
123 | help | 123 | help |
124 | Support for generic TI OMAP2+ boards using Flattened Device Tree. | 124 | Support for generic TI OMAP2+ boards using Flattened Device Tree. |
125 | More information at Documentation/devicetree | 125 | More information at Documentation/devicetree |
126 | 126 | ||
127 | config MACH_OMAP2_TUSB6010 | 127 | config MACH_OMAP2_TUSB6010 |
128 | bool | 128 | bool |
129 | depends on ARCH_OMAP2 && SOC_OMAP2420 | 129 | depends on ARCH_OMAP2 && SOC_OMAP2420 |
130 | default y if MACH_NOKIA_N8X0 | 130 | default y if MACH_NOKIA_N8X0 |
131 | 131 | ||
132 | config MACH_OMAP_H4 | 132 | config MACH_OMAP_H4 |
133 | bool "OMAP 2420 H4 board" | 133 | bool "OMAP 2420 H4 board" |
134 | depends on SOC_OMAP2420 | 134 | depends on SOC_OMAP2420 |
135 | default y | 135 | default y |
136 | select OMAP_PACKAGE_ZAF | 136 | select OMAP_PACKAGE_ZAF |
137 | select OMAP_DEBUG_DEVICES | 137 | select OMAP_DEBUG_DEVICES |
138 | 138 | ||
139 | config MACH_OMAP_APOLLON | 139 | config MACH_OMAP_APOLLON |
140 | bool "OMAP 2420 Apollon board" | 140 | bool "OMAP 2420 Apollon board" |
141 | depends on SOC_OMAP2420 | 141 | depends on SOC_OMAP2420 |
142 | default y | 142 | default y |
143 | select OMAP_PACKAGE_ZAC | 143 | select OMAP_PACKAGE_ZAC |
144 | 144 | ||
145 | config MACH_OMAP_2430SDP | 145 | config MACH_OMAP_2430SDP |
146 | bool "OMAP 2430 SDP board" | 146 | bool "OMAP 2430 SDP board" |
147 | depends on SOC_OMAP2430 | 147 | depends on SOC_OMAP2430 |
148 | default y | 148 | default y |
149 | select OMAP_PACKAGE_ZAC | 149 | select OMAP_PACKAGE_ZAC |
150 | 150 | ||
151 | config MACH_OMAP3_BEAGLE | 151 | config MACH_OMAP3_BEAGLE |
152 | bool "OMAP3 BEAGLE board" | 152 | bool "OMAP3 BEAGLE board" |
153 | depends on ARCH_OMAP3 | 153 | depends on ARCH_OMAP3 |
154 | default y | 154 | default y |
155 | select OMAP_PACKAGE_CBB | 155 | select OMAP_PACKAGE_CBB |
156 | 156 | ||
157 | config MACH_DEVKIT8000 | 157 | config MACH_DEVKIT8000 |
158 | bool "DEVKIT8000 board" | 158 | bool "DEVKIT8000 board" |
159 | depends on ARCH_OMAP3 | 159 | depends on ARCH_OMAP3 |
160 | default y | 160 | default y |
161 | select OMAP_PACKAGE_CUS | 161 | select OMAP_PACKAGE_CUS |
162 | 162 | ||
163 | config MACH_OMAP_LDP | 163 | config MACH_OMAP_LDP |
164 | bool "OMAP3 LDP board" | 164 | bool "OMAP3 LDP board" |
165 | depends on ARCH_OMAP3 | 165 | depends on ARCH_OMAP3 |
166 | default y | 166 | default y |
167 | select OMAP_PACKAGE_CBB | 167 | select OMAP_PACKAGE_CBB |
168 | 168 | ||
169 | config MACH_OMAP3530_LV_SOM | 169 | config MACH_OMAP3530_LV_SOM |
170 | bool "OMAP3 Logic 3530 LV SOM board" | 170 | bool "OMAP3 Logic 3530 LV SOM board" |
171 | depends on ARCH_OMAP3 | 171 | depends on ARCH_OMAP3 |
172 | select OMAP_PACKAGE_CBB | 172 | select OMAP_PACKAGE_CBB |
173 | default y | 173 | default y |
174 | help | 174 | help |
175 | Support for the LogicPD OMAP3530 SOM Development kit | 175 | Support for the LogicPD OMAP3530 SOM Development kit |
176 | for full description please see the products webpage at | 176 | for full description please see the products webpage at |
177 | http://www.logicpd.com/products/development-kits/texas-instruments-zoom%E2%84%A2-omap35x-development-kit | 177 | http://www.logicpd.com/products/development-kits/texas-instruments-zoom%E2%84%A2-omap35x-development-kit |
178 | 178 | ||
179 | config MACH_OMAP3_TORPEDO | 179 | config MACH_OMAP3_TORPEDO |
180 | bool "OMAP3 Logic 35x Torpedo board" | 180 | bool "OMAP3 Logic 35x Torpedo board" |
181 | depends on ARCH_OMAP3 | 181 | depends on ARCH_OMAP3 |
182 | select OMAP_PACKAGE_CBB | 182 | select OMAP_PACKAGE_CBB |
183 | default y | 183 | default y |
184 | help | 184 | help |
185 | Support for the LogicPD OMAP35x Torpedo Development kit | 185 | Support for the LogicPD OMAP35x Torpedo Development kit |
186 | for full description please see the products webpage at | 186 | for full description please see the products webpage at |
187 | http://www.logicpd.com/products/development-kits/zoom-omap35x-torpedo-development-kit | 187 | http://www.logicpd.com/products/development-kits/zoom-omap35x-torpedo-development-kit |
188 | 188 | ||
189 | config MACH_OVERO | 189 | config MACH_OVERO |
190 | bool "Gumstix Overo board" | 190 | bool "Gumstix Overo board" |
191 | depends on ARCH_OMAP3 | 191 | depends on ARCH_OMAP3 |
192 | default y | 192 | default y |
193 | select OMAP_PACKAGE_CBB | 193 | select OMAP_PACKAGE_CBB |
194 | 194 | ||
195 | config MACH_OMAP3EVM | 195 | config MACH_OMAP3EVM |
196 | bool "OMAP 3530 EVM board" | 196 | bool "OMAP 3530 EVM board" |
197 | depends on ARCH_OMAP3 | 197 | depends on ARCH_OMAP3 |
198 | default y | 198 | default y |
199 | select OMAP_PACKAGE_CBB | 199 | select OMAP_PACKAGE_CBB |
200 | 200 | ||
201 | config MACH_OMAP3517EVM | 201 | config MACH_OMAP3517EVM |
202 | bool "OMAP3517/ AM3517 EVM board" | 202 | bool "OMAP3517/ AM3517 EVM board" |
203 | depends on ARCH_OMAP3 | 203 | depends on ARCH_OMAP3 |
204 | default y | 204 | default y |
205 | select OMAP_PACKAGE_CBB | 205 | select OMAP_PACKAGE_CBB |
206 | 206 | ||
207 | config MACH_CRANEBOARD | 207 | config MACH_CRANEBOARD |
208 | bool "AM3517/05 CRANE board" | 208 | bool "AM3517/05 CRANE board" |
209 | depends on ARCH_OMAP3 | 209 | depends on ARCH_OMAP3 |
210 | select OMAP_PACKAGE_CBB | 210 | select OMAP_PACKAGE_CBB |
211 | 211 | ||
212 | config MACH_OMAP3_PANDORA | 212 | config MACH_OMAP3_PANDORA |
213 | bool "OMAP3 Pandora" | 213 | bool "OMAP3 Pandora" |
214 | depends on ARCH_OMAP3 | 214 | depends on ARCH_OMAP3 |
215 | default y | 215 | default y |
216 | select OMAP_PACKAGE_CBB | 216 | select OMAP_PACKAGE_CBB |
217 | select REGULATOR_FIXED_VOLTAGE | 217 | select REGULATOR_FIXED_VOLTAGE |
218 | 218 | ||
219 | config MACH_OMAP3_TOUCHBOOK | 219 | config MACH_OMAP3_TOUCHBOOK |
220 | bool "OMAP3 Touch Book" | 220 | bool "OMAP3 Touch Book" |
221 | depends on ARCH_OMAP3 | 221 | depends on ARCH_OMAP3 |
222 | default y | 222 | default y |
223 | select BACKLIGHT_CLASS_DEVICE | 223 | select BACKLIGHT_CLASS_DEVICE |
224 | 224 | ||
225 | config MACH_OMAP_3430SDP | 225 | config MACH_OMAP_3430SDP |
226 | bool "OMAP 3430 SDP board" | 226 | bool "OMAP 3430 SDP board" |
227 | depends on ARCH_OMAP3 | 227 | depends on ARCH_OMAP3 |
228 | default y | 228 | default y |
229 | select OMAP_PACKAGE_CBB | 229 | select OMAP_PACKAGE_CBB |
230 | 230 | ||
231 | config MACH_NOKIA_N800 | 231 | config MACH_NOKIA_N800 |
232 | bool | 232 | bool |
233 | 233 | ||
234 | config MACH_NOKIA_N810 | 234 | config MACH_NOKIA_N810 |
235 | bool | 235 | bool |
236 | 236 | ||
237 | config MACH_NOKIA_N810_WIMAX | 237 | config MACH_NOKIA_N810_WIMAX |
238 | bool | 238 | bool |
239 | 239 | ||
240 | config MACH_NOKIA_N8X0 | 240 | config MACH_NOKIA_N8X0 |
241 | bool "Nokia N800/N810" | 241 | bool "Nokia N800/N810" |
242 | depends on SOC_OMAP2420 | 242 | depends on SOC_OMAP2420 |
243 | default y | 243 | default y |
244 | select OMAP_PACKAGE_ZAC | 244 | select OMAP_PACKAGE_ZAC |
245 | select MACH_NOKIA_N800 | 245 | select MACH_NOKIA_N800 |
246 | select MACH_NOKIA_N810 | 246 | select MACH_NOKIA_N810 |
247 | select MACH_NOKIA_N810_WIMAX | 247 | select MACH_NOKIA_N810_WIMAX |
248 | 248 | ||
249 | config MACH_NOKIA_RM680 | 249 | config MACH_NOKIA_RM680 |
250 | bool "Nokia RM-680 board" | 250 | bool "Nokia RM-680 board" |
251 | depends on ARCH_OMAP3 | 251 | depends on ARCH_OMAP3 |
252 | default y | 252 | default y |
253 | select OMAP_PACKAGE_CBB | 253 | select OMAP_PACKAGE_CBB |
254 | 254 | ||
255 | config MACH_NOKIA_RX51 | 255 | config MACH_NOKIA_RX51 |
256 | bool "Nokia RX-51 board" | 256 | bool "Nokia RX-51 board" |
257 | depends on ARCH_OMAP3 | 257 | depends on ARCH_OMAP3 |
258 | default y | 258 | default y |
259 | select OMAP_PACKAGE_CBB | 259 | select OMAP_PACKAGE_CBB |
260 | 260 | ||
261 | config MACH_OMAP_ZOOM2 | 261 | config MACH_OMAP_ZOOM2 |
262 | bool "OMAP3 Zoom2 board" | 262 | bool "OMAP3 Zoom2 board" |
263 | depends on ARCH_OMAP3 | 263 | depends on ARCH_OMAP3 |
264 | default y | 264 | default y |
265 | select OMAP_PACKAGE_CBB | 265 | select OMAP_PACKAGE_CBB |
266 | select SERIAL_8250 | 266 | select SERIAL_8250 |
267 | select SERIAL_CORE_CONSOLE | 267 | select SERIAL_CORE_CONSOLE |
268 | select SERIAL_8250_CONSOLE | 268 | select SERIAL_8250_CONSOLE |
269 | select REGULATOR_FIXED_VOLTAGE | 269 | select REGULATOR_FIXED_VOLTAGE |
270 | 270 | ||
271 | config MACH_OMAP_ZOOM3 | 271 | config MACH_OMAP_ZOOM3 |
272 | bool "OMAP3630 Zoom3 board" | 272 | bool "OMAP3630 Zoom3 board" |
273 | depends on ARCH_OMAP3 | 273 | depends on ARCH_OMAP3 |
274 | default y | 274 | default y |
275 | select OMAP_PACKAGE_CBP | 275 | select OMAP_PACKAGE_CBP |
276 | select SERIAL_8250 | 276 | select SERIAL_8250 |
277 | select SERIAL_CORE_CONSOLE | 277 | select SERIAL_CORE_CONSOLE |
278 | select SERIAL_8250_CONSOLE | 278 | select SERIAL_8250_CONSOLE |
279 | select REGULATOR_FIXED_VOLTAGE | 279 | select REGULATOR_FIXED_VOLTAGE |
280 | 280 | ||
281 | config MACH_CM_T35 | 281 | config MACH_CM_T35 |
282 | bool "CompuLab CM-T35/CM-T3730 modules" | 282 | bool "CompuLab CM-T35/CM-T3730 modules" |
283 | depends on ARCH_OMAP3 | 283 | depends on ARCH_OMAP3 |
284 | default y | 284 | default y |
285 | select MACH_CM_T3730 | 285 | select MACH_CM_T3730 |
286 | select OMAP_PACKAGE_CUS | 286 | select OMAP_PACKAGE_CUS |
287 | 287 | ||
288 | config MACH_CM_T3517 | 288 | config MACH_CM_T3517 |
289 | bool "CompuLab CM-T3517 module" | 289 | bool "CompuLab CM-T3517 module" |
290 | depends on ARCH_OMAP3 | 290 | depends on ARCH_OMAP3 |
291 | default y | 291 | default y |
292 | select OMAP_PACKAGE_CBB | 292 | select OMAP_PACKAGE_CBB |
293 | 293 | ||
294 | config MACH_CM_T3730 | 294 | config MACH_CM_T3730 |
295 | bool | 295 | bool |
296 | 296 | ||
297 | config MACH_IGEP0020 | 297 | config MACH_IGEP0020 |
298 | bool "IGEP v2 board" | 298 | bool "IGEP v2 board" |
299 | depends on ARCH_OMAP3 | 299 | depends on ARCH_OMAP3 |
300 | default y | 300 | default y |
301 | select OMAP_PACKAGE_CBB | 301 | select OMAP_PACKAGE_CBB |
302 | 302 | ||
303 | config MACH_IGEP0030 | 303 | config MACH_IGEP0030 |
304 | bool "IGEP OMAP3 module" | 304 | bool "IGEP OMAP3 module" |
305 | depends on ARCH_OMAP3 | 305 | depends on ARCH_OMAP3 |
306 | default y | 306 | default y |
307 | select OMAP_PACKAGE_CBB | 307 | select OMAP_PACKAGE_CBB |
308 | select MACH_IGEP0020 | 308 | select MACH_IGEP0020 |
309 | 309 | ||
310 | config MACH_SBC3530 | 310 | config MACH_SBC3530 |
311 | bool "OMAP3 SBC STALKER board" | 311 | bool "OMAP3 SBC STALKER board" |
312 | depends on ARCH_OMAP3 | 312 | depends on ARCH_OMAP3 |
313 | default y | 313 | default y |
314 | select OMAP_PACKAGE_CUS | 314 | select OMAP_PACKAGE_CUS |
315 | 315 | ||
316 | config MACH_OMAP_3630SDP | 316 | config MACH_OMAP_3630SDP |
317 | bool "OMAP3630 SDP board" | 317 | bool "OMAP3630 SDP board" |
318 | depends on ARCH_OMAP3 | 318 | depends on ARCH_OMAP3 |
319 | default y | 319 | default y |
320 | select OMAP_PACKAGE_CBP | 320 | select OMAP_PACKAGE_CBP |
321 | 321 | ||
322 | config MACH_TI8168EVM | 322 | config MACH_TI8168EVM |
323 | bool "TI8168 Evaluation Module" | 323 | bool "TI8168 Evaluation Module" |
324 | depends on SOC_OMAPTI81XX | 324 | depends on SOC_OMAPTI81XX |
325 | default y | 325 | default y |
326 | 326 | ||
327 | config MACH_TI8148EVM | 327 | config MACH_TI8148EVM |
328 | bool "TI8148 Evaluation Module" | 328 | bool "TI8148 Evaluation Module" |
329 | depends on SOC_OMAPTI81XX | 329 | depends on SOC_OMAPTI81XX |
330 | default y | 330 | default y |
331 | 331 | ||
332 | config MACH_OMAP_4430SDP | 332 | config MACH_OMAP_4430SDP |
333 | bool "OMAP 4430 SDP board" | 333 | bool "OMAP 4430 SDP board" |
334 | default y | 334 | default y |
335 | depends on ARCH_OMAP4 | 335 | depends on ARCH_OMAP4 |
336 | select OMAP_PACKAGE_CBL | 336 | select OMAP_PACKAGE_CBL |
337 | select OMAP_PACKAGE_CBS | 337 | select OMAP_PACKAGE_CBS |
338 | select REGULATOR_FIXED_VOLTAGE | 338 | select REGULATOR_FIXED_VOLTAGE |
339 | 339 | ||
340 | config MACH_OMAP4_PANDA | 340 | config MACH_OMAP4_PANDA |
341 | bool "OMAP4 Panda Board" | 341 | bool "OMAP4 Panda Board" |
342 | default y | 342 | default y |
343 | depends on ARCH_OMAP4 | 343 | depends on ARCH_OMAP4 |
344 | select OMAP_PACKAGE_CBL | 344 | select OMAP_PACKAGE_CBL |
345 | select OMAP_PACKAGE_CBS | 345 | select OMAP_PACKAGE_CBS |
346 | select REGULATOR_FIXED_VOLTAGE | 346 | select REGULATOR_FIXED_VOLTAGE |
347 | 347 | ||
348 | config OMAP3_EMU | 348 | config OMAP3_EMU |
349 | bool "OMAP3 debugging peripherals" | 349 | bool "OMAP3 debugging peripherals" |
350 | depends on ARCH_OMAP3 | 350 | depends on ARCH_OMAP3 |
351 | select ARM_AMBA | 351 | select ARM_AMBA |
352 | select OC_ETM | 352 | select OC_ETM |
353 | help | 353 | help |
354 | Say Y here to enable debugging hardware of omap3 | 354 | Say Y here to enable debugging hardware of omap3 |
355 | 355 | ||
356 | config OMAP3_SDRC_AC_TIMING | 356 | config OMAP3_SDRC_AC_TIMING |
357 | bool "Enable SDRC AC timing register changes" | 357 | bool "Enable SDRC AC timing register changes" |
358 | depends on ARCH_OMAP3 | 358 | depends on ARCH_OMAP3 |
359 | default n | 359 | default n |
360 | help | 360 | help |
361 | If you know that none of your system initiators will attempt to | 361 | If you know that none of your system initiators will attempt to |
362 | access SDRAM during CORE DVFS, select Y here. This should boost | 362 | access SDRAM during CORE DVFS, select Y here. This should boost |
363 | SDRAM performance at lower CORE OPPs. There are relatively few | 363 | SDRAM performance at lower CORE OPPs. There are relatively few |
364 | users who will wish to say yes at this point - almost everyone will | 364 | users who will wish to say yes at this point - almost everyone will |
365 | wish to say no. Selecting yes without understanding what is | 365 | wish to say no. Selecting yes without understanding what is |
366 | going on could result in system crashes; | 366 | going on could result in system crashes; |
367 | 367 | ||
368 | config OMAP4_ERRATA_I688 | 368 | config OMAP4_ERRATA_I688 |
369 | bool "OMAP4 errata: Async Bridge Corruption" | 369 | bool "OMAP4 errata: Async Bridge Corruption (BROKEN)" |
370 | depends on ARCH_OMAP4 | 370 | depends on ARCH_OMAP4 && BROKEN |
371 | select ARCH_HAS_BARRIERS | 371 | select ARCH_HAS_BARRIERS |
372 | help | 372 | help |
373 | If a data is stalled inside asynchronous bridge because of back | 373 | If a data is stalled inside asynchronous bridge because of back |
374 | pressure, it may be accepted multiple times, creating pointer | 374 | pressure, it may be accepted multiple times, creating pointer |
375 | misalignment that will corrupt next transfers on that data path | 375 | misalignment that will corrupt next transfers on that data path |
376 | until next reset of the system (No recovery procedure once the | 376 | until next reset of the system (No recovery procedure once the |
377 | issue is hit, the path remains consistently broken). Async bridge | 377 | issue is hit, the path remains consistently broken). Async bridge |
378 | can be found on path between MPU to EMIF and MPU to L3 interconnect. | 378 | can be found on path between MPU to EMIF and MPU to L3 interconnect. |
379 | This situation can happen only when the idle is initiated by a | 379 | This situation can happen only when the idle is initiated by a |
380 | Master Request Disconnection (which is trigged by software when | 380 | Master Request Disconnection (which is trigged by software when |
381 | executing WFI on CPU). | 381 | executing WFI on CPU). |
382 | The work-around for this errata needs all the initiators connected | 382 | The work-around for this errata needs all the initiators connected |
383 | through async bridge must ensure that data path is properly drained | 383 | through async bridge must ensure that data path is properly drained |
384 | before issuing WFI. This condition will be met if one Strongly ordered | 384 | before issuing WFI. This condition will be met if one Strongly ordered |
385 | access is performed to the target right before executing the WFI. | 385 | access is performed to the target right before executing the WFI. |
386 | In MPU case, L3 T2ASYNC FIFO and DDR T2ASYNC FIFO needs to be drained. | 386 | In MPU case, L3 T2ASYNC FIFO and DDR T2ASYNC FIFO needs to be drained. |
387 | IO barrier ensure that there is no synchronisation loss on initiators | 387 | IO barrier ensure that there is no synchronisation loss on initiators |
388 | operating on both interconnect port simultaneously. | 388 | operating on both interconnect port simultaneously. |
389 | endmenu | 389 | endmenu |
390 | 390 | ||
391 | endif | 391 | endif |
392 | 392 |
arch/arm/mach-omap2/omap-secure.c
1 | /* | 1 | /* |
2 | * OMAP Secure API infrastructure. | 2 | * OMAP Secure API infrastructure. |
3 | * | 3 | * |
4 | * Copyright (C) 2011 Texas Instruments, Inc. | 4 | * Copyright (C) 2011 Texas Instruments, Inc. |
5 | * Santosh Shilimkar <santosh.shilimkar@ti.com> | 5 | * Santosh Shilimkar <santosh.shilimkar@ti.com> |
6 | * | 6 | * |
7 | * | 7 | * |
8 | * This program is free software,you can redistribute it and/or modify | 8 | * This program is free software,you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/memblock.h> | 16 | #include <linux/memblock.h> |
17 | 17 | ||
18 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
19 | #include <asm/memblock.h> | ||
19 | 20 | ||
20 | #include <mach/omap-secure.h> | 21 | #include <mach/omap-secure.h> |
21 | 22 | ||
22 | static phys_addr_t omap_secure_memblock_base; | 23 | static phys_addr_t omap_secure_memblock_base; |
23 | 24 | ||
24 | /** | 25 | /** |
25 | * omap_sec_dispatcher: Routine to dispatch low power secure | 26 | * omap_sec_dispatcher: Routine to dispatch low power secure |
26 | * service routines | 27 | * service routines |
27 | * @idx: The HAL API index | 28 | * @idx: The HAL API index |
28 | * @flag: The flag indicating criticality of operation | 29 | * @flag: The flag indicating criticality of operation |
29 | * @nargs: Number of valid arguments out of four. | 30 | * @nargs: Number of valid arguments out of four. |
30 | * @arg1, arg2, arg3 args4: Parameters passed to secure API | 31 | * @arg1, arg2, arg3 args4: Parameters passed to secure API |
31 | * | 32 | * |
32 | * Return the non-zero error value on failure. | 33 | * Return the non-zero error value on failure. |
33 | */ | 34 | */ |
34 | u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, u32 arg1, u32 arg2, | 35 | u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, u32 arg1, u32 arg2, |
35 | u32 arg3, u32 arg4) | 36 | u32 arg3, u32 arg4) |
36 | { | 37 | { |
37 | u32 ret; | 38 | u32 ret; |
38 | u32 param[5]; | 39 | u32 param[5]; |
39 | 40 | ||
40 | param[0] = nargs; | 41 | param[0] = nargs; |
41 | param[1] = arg1; | 42 | param[1] = arg1; |
42 | param[2] = arg2; | 43 | param[2] = arg2; |
43 | param[3] = arg3; | 44 | param[3] = arg3; |
44 | param[4] = arg4; | 45 | param[4] = arg4; |
45 | 46 | ||
46 | /* | 47 | /* |
47 | * Secure API needs physical address | 48 | * Secure API needs physical address |
48 | * pointer for the parameters | 49 | * pointer for the parameters |
49 | */ | 50 | */ |
50 | flush_cache_all(); | 51 | flush_cache_all(); |
51 | outer_clean_range(__pa(param), __pa(param + 5)); | 52 | outer_clean_range(__pa(param), __pa(param + 5)); |
52 | ret = omap_smc2(idx, flag, __pa(param)); | 53 | ret = omap_smc2(idx, flag, __pa(param)); |
53 | 54 | ||
54 | return ret; | 55 | return ret; |
55 | } | 56 | } |
56 | 57 | ||
57 | /* Allocate the memory to save secure ram */ | 58 | /* Allocate the memory to save secure ram */ |
58 | int __init omap_secure_ram_reserve_memblock(void) | 59 | int __init omap_secure_ram_reserve_memblock(void) |
59 | { | 60 | { |
60 | phys_addr_t paddr; | ||
61 | u32 size = OMAP_SECURE_RAM_STORAGE; | 61 | u32 size = OMAP_SECURE_RAM_STORAGE; |
62 | 62 | ||
63 | size = ALIGN(size, SZ_1M); | 63 | size = ALIGN(size, SZ_1M); |
64 | paddr = memblock_alloc(size, SZ_1M); | 64 | omap_secure_memblock_base = arm_memblock_steal(size, SZ_1M); |
65 | if (!paddr) { | ||
66 | pr_err("%s: failed to reserve %x bytes\n", | ||
67 | __func__, size); | ||
68 | return -ENOMEM; | ||
69 | } | ||
70 | memblock_free(paddr, size); | ||
71 | memblock_remove(paddr, size); | ||
72 | |||
73 | omap_secure_memblock_base = paddr; | ||
74 | 65 | ||
75 | return 0; | 66 | return 0; |
76 | } | 67 | } |
77 | 68 | ||
78 | phys_addr_t omap_secure_ram_mempool_base(void) | 69 | phys_addr_t omap_secure_ram_mempool_base(void) |
79 | { | 70 | { |
80 | return omap_secure_memblock_base; | 71 | return omap_secure_memblock_base; |
81 | } | 72 | } |
arch/arm/mach-omap2/omap4-common.c
1 | /* | 1 | /* |
2 | * OMAP4 specific common source file. | 2 | * OMAP4 specific common source file. |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Texas Instruments, Inc. | 4 | * Copyright (C) 2010 Texas Instruments, Inc. |
5 | * Author: | 5 | * Author: |
6 | * Santosh Shilimkar <santosh.shilimkar@ti.com> | 6 | * Santosh Shilimkar <santosh.shilimkar@ti.com> |
7 | * | 7 | * |
8 | * | 8 | * |
9 | * This program is free software,you can redistribute it and/or modify | 9 | * This program is free software,you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/memblock.h> | 18 | #include <linux/memblock.h> |
19 | 19 | ||
20 | #include <asm/hardware/gic.h> | 20 | #include <asm/hardware/gic.h> |
21 | #include <asm/hardware/cache-l2x0.h> | 21 | #include <asm/hardware/cache-l2x0.h> |
22 | #include <asm/mach/map.h> | 22 | #include <asm/mach/map.h> |
23 | #include <asm/memblock.h> | ||
23 | 24 | ||
24 | #include <plat/irqs.h> | 25 | #include <plat/irqs.h> |
25 | #include <plat/sram.h> | 26 | #include <plat/sram.h> |
26 | 27 | ||
27 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
28 | #include <mach/omap-wakeupgen.h> | 29 | #include <mach/omap-wakeupgen.h> |
29 | 30 | ||
30 | #include "common.h" | 31 | #include "common.h" |
31 | #include "omap4-sar-layout.h" | 32 | #include "omap4-sar-layout.h" |
32 | 33 | ||
33 | #ifdef CONFIG_CACHE_L2X0 | 34 | #ifdef CONFIG_CACHE_L2X0 |
34 | static void __iomem *l2cache_base; | 35 | static void __iomem *l2cache_base; |
35 | #endif | 36 | #endif |
36 | 37 | ||
37 | static void __iomem *sar_ram_base; | 38 | static void __iomem *sar_ram_base; |
38 | 39 | ||
39 | #ifdef CONFIG_OMAP4_ERRATA_I688 | 40 | #ifdef CONFIG_OMAP4_ERRATA_I688 |
40 | /* Used to implement memory barrier on DRAM path */ | 41 | /* Used to implement memory barrier on DRAM path */ |
41 | #define OMAP4_DRAM_BARRIER_VA 0xfe600000 | 42 | #define OMAP4_DRAM_BARRIER_VA 0xfe600000 |
42 | 43 | ||
43 | void __iomem *dram_sync, *sram_sync; | 44 | void __iomem *dram_sync, *sram_sync; |
44 | 45 | ||
45 | void omap_bus_sync(void) | 46 | void omap_bus_sync(void) |
46 | { | 47 | { |
47 | if (dram_sync && sram_sync) { | 48 | if (dram_sync && sram_sync) { |
48 | writel_relaxed(readl_relaxed(dram_sync), dram_sync); | 49 | writel_relaxed(readl_relaxed(dram_sync), dram_sync); |
49 | writel_relaxed(readl_relaxed(sram_sync), sram_sync); | 50 | writel_relaxed(readl_relaxed(sram_sync), sram_sync); |
50 | isb(); | 51 | isb(); |
51 | } | 52 | } |
52 | } | 53 | } |
53 | 54 | ||
54 | static int __init omap_barriers_init(void) | 55 | static int __init omap_barriers_init(void) |
55 | { | 56 | { |
56 | struct map_desc dram_io_desc[1]; | 57 | struct map_desc dram_io_desc[1]; |
57 | phys_addr_t paddr; | 58 | phys_addr_t paddr; |
58 | u32 size; | 59 | u32 size; |
59 | 60 | ||
60 | if (!cpu_is_omap44xx()) | 61 | if (!cpu_is_omap44xx()) |
61 | return -ENODEV; | 62 | return -ENODEV; |
62 | 63 | ||
63 | size = ALIGN(PAGE_SIZE, SZ_1M); | 64 | size = ALIGN(PAGE_SIZE, SZ_1M); |
64 | paddr = memblock_alloc(size, SZ_1M); | 65 | paddr = arm_memblock_steal(size, SZ_1M); |
65 | if (!paddr) { | 66 | |
66 | pr_err("%s: failed to reserve 4 Kbytes\n", __func__); | ||
67 | return -ENOMEM; | ||
68 | } | ||
69 | memblock_free(paddr, size); | ||
70 | memblock_remove(paddr, size); | ||
71 | dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA; | 67 | dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA; |
72 | dram_io_desc[0].pfn = __phys_to_pfn(paddr); | 68 | dram_io_desc[0].pfn = __phys_to_pfn(paddr); |
73 | dram_io_desc[0].length = size; | 69 | dram_io_desc[0].length = size; |
74 | dram_io_desc[0].type = MT_MEMORY_SO; | 70 | dram_io_desc[0].type = MT_MEMORY_SO; |
75 | iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc)); | 71 | iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc)); |
76 | dram_sync = (void __iomem *) dram_io_desc[0].virtual; | 72 | dram_sync = (void __iomem *) dram_io_desc[0].virtual; |
77 | sram_sync = (void __iomem *) OMAP4_SRAM_VA; | 73 | sram_sync = (void __iomem *) OMAP4_SRAM_VA; |
78 | 74 | ||
79 | pr_info("OMAP4: Map 0x%08llx to 0x%08lx for dram barrier\n", | 75 | pr_info("OMAP4: Map 0x%08llx to 0x%08lx for dram barrier\n", |
80 | (long long) paddr, dram_io_desc[0].virtual); | 76 | (long long) paddr, dram_io_desc[0].virtual); |
81 | 77 | ||
82 | return 0; | 78 | return 0; |
83 | } | 79 | } |
84 | core_initcall(omap_barriers_init); | 80 | core_initcall(omap_barriers_init); |
85 | #endif | 81 | #endif |
86 | 82 | ||
87 | void __init gic_init_irq(void) | 83 | void __init gic_init_irq(void) |
88 | { | 84 | { |
89 | void __iomem *omap_irq_base; | 85 | void __iomem *omap_irq_base; |
90 | void __iomem *gic_dist_base_addr; | 86 | void __iomem *gic_dist_base_addr; |
91 | 87 | ||
92 | /* Static mapping, never released */ | 88 | /* Static mapping, never released */ |
93 | gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K); | 89 | gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K); |
94 | BUG_ON(!gic_dist_base_addr); | 90 | BUG_ON(!gic_dist_base_addr); |
95 | 91 | ||
96 | /* Static mapping, never released */ | 92 | /* Static mapping, never released */ |
97 | omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512); | 93 | omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512); |
98 | BUG_ON(!omap_irq_base); | 94 | BUG_ON(!omap_irq_base); |
99 | 95 | ||
100 | omap_wakeupgen_init(); | 96 | omap_wakeupgen_init(); |
101 | 97 | ||
102 | gic_init(0, 29, gic_dist_base_addr, omap_irq_base); | 98 | gic_init(0, 29, gic_dist_base_addr, omap_irq_base); |
103 | } | 99 | } |
104 | 100 | ||
105 | #ifdef CONFIG_CACHE_L2X0 | 101 | #ifdef CONFIG_CACHE_L2X0 |
106 | 102 | ||
107 | void __iomem *omap4_get_l2cache_base(void) | 103 | void __iomem *omap4_get_l2cache_base(void) |
108 | { | 104 | { |
109 | return l2cache_base; | 105 | return l2cache_base; |
110 | } | 106 | } |
111 | 107 | ||
112 | static void omap4_l2x0_disable(void) | 108 | static void omap4_l2x0_disable(void) |
113 | { | 109 | { |
114 | /* Disable PL310 L2 Cache controller */ | 110 | /* Disable PL310 L2 Cache controller */ |
115 | omap_smc1(0x102, 0x0); | 111 | omap_smc1(0x102, 0x0); |
116 | } | 112 | } |
117 | 113 | ||
118 | static void omap4_l2x0_set_debug(unsigned long val) | 114 | static void omap4_l2x0_set_debug(unsigned long val) |
119 | { | 115 | { |
120 | /* Program PL310 L2 Cache controller debug register */ | 116 | /* Program PL310 L2 Cache controller debug register */ |
121 | omap_smc1(0x100, val); | 117 | omap_smc1(0x100, val); |
122 | } | 118 | } |
123 | 119 | ||
124 | static int __init omap_l2_cache_init(void) | 120 | static int __init omap_l2_cache_init(void) |
125 | { | 121 | { |
126 | u32 aux_ctrl = 0; | 122 | u32 aux_ctrl = 0; |
127 | 123 | ||
128 | /* | 124 | /* |
129 | * To avoid code running on other OMAPs in | 125 | * To avoid code running on other OMAPs in |
130 | * multi-omap builds | 126 | * multi-omap builds |
131 | */ | 127 | */ |
132 | if (!cpu_is_omap44xx()) | 128 | if (!cpu_is_omap44xx()) |
133 | return -ENODEV; | 129 | return -ENODEV; |
134 | 130 | ||
135 | /* Static mapping, never released */ | 131 | /* Static mapping, never released */ |
136 | l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K); | 132 | l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K); |
137 | if (WARN_ON(!l2cache_base)) | 133 | if (WARN_ON(!l2cache_base)) |
138 | return -ENOMEM; | 134 | return -ENOMEM; |
139 | 135 | ||
140 | /* | 136 | /* |
141 | * 16-way associativity, parity disabled | 137 | * 16-way associativity, parity disabled |
142 | * Way size - 32KB (es1.0) | 138 | * Way size - 32KB (es1.0) |
143 | * Way size - 64KB (es2.0 +) | 139 | * Way size - 64KB (es2.0 +) |
144 | */ | 140 | */ |
145 | aux_ctrl = ((1 << L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT) | | 141 | aux_ctrl = ((1 << L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT) | |
146 | (0x1 << 25) | | 142 | (0x1 << 25) | |
147 | (0x1 << L2X0_AUX_CTRL_NS_LOCKDOWN_SHIFT) | | 143 | (0x1 << L2X0_AUX_CTRL_NS_LOCKDOWN_SHIFT) | |
148 | (0x1 << L2X0_AUX_CTRL_NS_INT_CTRL_SHIFT)); | 144 | (0x1 << L2X0_AUX_CTRL_NS_INT_CTRL_SHIFT)); |
149 | 145 | ||
150 | if (omap_rev() == OMAP4430_REV_ES1_0) { | 146 | if (omap_rev() == OMAP4430_REV_ES1_0) { |
151 | aux_ctrl |= 0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT; | 147 | aux_ctrl |= 0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT; |
152 | } else { | 148 | } else { |
153 | aux_ctrl |= ((0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | | 149 | aux_ctrl |= ((0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | |
154 | (1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | | 150 | (1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | |
155 | (1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | | 151 | (1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | |
156 | (1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | | 152 | (1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | |
157 | (1 << L2X0_AUX_CTRL_EARLY_BRESP_SHIFT)); | 153 | (1 << L2X0_AUX_CTRL_EARLY_BRESP_SHIFT)); |
158 | } | 154 | } |
159 | if (omap_rev() != OMAP4430_REV_ES1_0) | 155 | if (omap_rev() != OMAP4430_REV_ES1_0) |
160 | omap_smc1(0x109, aux_ctrl); | 156 | omap_smc1(0x109, aux_ctrl); |
161 | 157 | ||
162 | /* Enable PL310 L2 Cache controller */ | 158 | /* Enable PL310 L2 Cache controller */ |
163 | omap_smc1(0x102, 0x1); | 159 | omap_smc1(0x102, 0x1); |
164 | 160 | ||
165 | l2x0_init(l2cache_base, aux_ctrl, L2X0_AUX_CTRL_MASK); | 161 | l2x0_init(l2cache_base, aux_ctrl, L2X0_AUX_CTRL_MASK); |
166 | 162 | ||
167 | /* | 163 | /* |
168 | * Override default outer_cache.disable with a OMAP4 | 164 | * Override default outer_cache.disable with a OMAP4 |
169 | * specific one | 165 | * specific one |
170 | */ | 166 | */ |
171 | outer_cache.disable = omap4_l2x0_disable; | 167 | outer_cache.disable = omap4_l2x0_disable; |
172 | outer_cache.set_debug = omap4_l2x0_set_debug; | 168 | outer_cache.set_debug = omap4_l2x0_set_debug; |
173 | 169 | ||
174 | return 0; | 170 | return 0; |
175 | } | 171 | } |
176 | early_initcall(omap_l2_cache_init); | 172 | early_initcall(omap_l2_cache_init); |
177 | #endif | 173 | #endif |
178 | 174 | ||
179 | void __iomem *omap4_get_sar_ram_base(void) | 175 | void __iomem *omap4_get_sar_ram_base(void) |
180 | { | 176 | { |
181 | return sar_ram_base; | 177 | return sar_ram_base; |
182 | } | 178 | } |
183 | 179 | ||
184 | /* | 180 | /* |
185 | * SAR RAM used to save and restore the HW | 181 | * SAR RAM used to save and restore the HW |
186 | * context in low power modes | 182 | * context in low power modes |
187 | */ | 183 | */ |
188 | static int __init omap4_sar_ram_init(void) | 184 | static int __init omap4_sar_ram_init(void) |
189 | { | 185 | { |
190 | /* | 186 | /* |
191 | * To avoid code running on other OMAPs in | 187 | * To avoid code running on other OMAPs in |
192 | * multi-omap builds | 188 | * multi-omap builds |
193 | */ | 189 | */ |
194 | if (!cpu_is_omap44xx()) | 190 | if (!cpu_is_omap44xx()) |
195 | return -ENOMEM; | 191 | return -ENOMEM; |
196 | 192 | ||
197 | /* Static mapping, never released */ | 193 | /* Static mapping, never released */ |
198 | sar_ram_base = ioremap(OMAP44XX_SAR_RAM_BASE, SZ_16K); | 194 | sar_ram_base = ioremap(OMAP44XX_SAR_RAM_BASE, SZ_16K); |
199 | if (WARN_ON(!sar_ram_base)) | 195 | if (WARN_ON(!sar_ram_base)) |
200 | return -ENOMEM; | 196 | return -ENOMEM; |
201 | 197 | ||
202 | return 0; | 198 | return 0; |
203 | } | 199 | } |
204 | early_initcall(omap4_sar_ram_init); | 200 | early_initcall(omap4_sar_ram_init); |
arch/arm/mm/init.c
1 | /* | 1 | /* |
2 | * linux/arch/arm/mm/init.c | 2 | * linux/arch/arm/mm/init.c |
3 | * | 3 | * |
4 | * Copyright (C) 1995-2005 Russell King | 4 | * Copyright (C) 1995-2005 Russell King |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
12 | #include <linux/swap.h> | 12 | #include <linux/swap.h> |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/bootmem.h> | 14 | #include <linux/bootmem.h> |
15 | #include <linux/mman.h> | 15 | #include <linux/mman.h> |
16 | #include <linux/export.h> | 16 | #include <linux/export.h> |
17 | #include <linux/nodemask.h> | 17 | #include <linux/nodemask.h> |
18 | #include <linux/initrd.h> | 18 | #include <linux/initrd.h> |
19 | #include <linux/of_fdt.h> | 19 | #include <linux/of_fdt.h> |
20 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
21 | #include <linux/gfp.h> | 21 | #include <linux/gfp.h> |
22 | #include <linux/memblock.h> | 22 | #include <linux/memblock.h> |
23 | 23 | ||
24 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
25 | #include <asm/memblock.h> | ||
25 | #include <asm/prom.h> | 26 | #include <asm/prom.h> |
26 | #include <asm/sections.h> | 27 | #include <asm/sections.h> |
27 | #include <asm/setup.h> | 28 | #include <asm/setup.h> |
28 | #include <asm/sizes.h> | 29 | #include <asm/sizes.h> |
29 | #include <asm/tlb.h> | 30 | #include <asm/tlb.h> |
30 | #include <asm/fixmap.h> | 31 | #include <asm/fixmap.h> |
31 | 32 | ||
32 | #include <asm/mach/arch.h> | 33 | #include <asm/mach/arch.h> |
33 | #include <asm/mach/map.h> | 34 | #include <asm/mach/map.h> |
34 | #include <asm/memblock.h> | 35 | #include <asm/memblock.h> |
35 | 36 | ||
36 | #include "mm.h" | 37 | #include "mm.h" |
37 | 38 | ||
38 | static unsigned long phys_initrd_start __initdata = 0; | 39 | static unsigned long phys_initrd_start __initdata = 0; |
39 | static unsigned long phys_initrd_size __initdata = 0; | 40 | static unsigned long phys_initrd_size __initdata = 0; |
40 | 41 | ||
41 | static int __init early_initrd(char *p) | 42 | static int __init early_initrd(char *p) |
42 | { | 43 | { |
43 | unsigned long start, size; | 44 | unsigned long start, size; |
44 | char *endp; | 45 | char *endp; |
45 | 46 | ||
46 | start = memparse(p, &endp); | 47 | start = memparse(p, &endp); |
47 | if (*endp == ',') { | 48 | if (*endp == ',') { |
48 | size = memparse(endp + 1, NULL); | 49 | size = memparse(endp + 1, NULL); |
49 | 50 | ||
50 | phys_initrd_start = start; | 51 | phys_initrd_start = start; |
51 | phys_initrd_size = size; | 52 | phys_initrd_size = size; |
52 | } | 53 | } |
53 | return 0; | 54 | return 0; |
54 | } | 55 | } |
55 | early_param("initrd", early_initrd); | 56 | early_param("initrd", early_initrd); |
56 | 57 | ||
57 | static int __init parse_tag_initrd(const struct tag *tag) | 58 | static int __init parse_tag_initrd(const struct tag *tag) |
58 | { | 59 | { |
59 | printk(KERN_WARNING "ATAG_INITRD is deprecated; " | 60 | printk(KERN_WARNING "ATAG_INITRD is deprecated; " |
60 | "please update your bootloader.\n"); | 61 | "please update your bootloader.\n"); |
61 | phys_initrd_start = __virt_to_phys(tag->u.initrd.start); | 62 | phys_initrd_start = __virt_to_phys(tag->u.initrd.start); |
62 | phys_initrd_size = tag->u.initrd.size; | 63 | phys_initrd_size = tag->u.initrd.size; |
63 | return 0; | 64 | return 0; |
64 | } | 65 | } |
65 | 66 | ||
66 | __tagtable(ATAG_INITRD, parse_tag_initrd); | 67 | __tagtable(ATAG_INITRD, parse_tag_initrd); |
67 | 68 | ||
68 | static int __init parse_tag_initrd2(const struct tag *tag) | 69 | static int __init parse_tag_initrd2(const struct tag *tag) |
69 | { | 70 | { |
70 | phys_initrd_start = tag->u.initrd.start; | 71 | phys_initrd_start = tag->u.initrd.start; |
71 | phys_initrd_size = tag->u.initrd.size; | 72 | phys_initrd_size = tag->u.initrd.size; |
72 | return 0; | 73 | return 0; |
73 | } | 74 | } |
74 | 75 | ||
75 | __tagtable(ATAG_INITRD2, parse_tag_initrd2); | 76 | __tagtable(ATAG_INITRD2, parse_tag_initrd2); |
76 | 77 | ||
77 | #ifdef CONFIG_OF_FLATTREE | 78 | #ifdef CONFIG_OF_FLATTREE |
78 | void __init early_init_dt_setup_initrd_arch(unsigned long start, unsigned long end) | 79 | void __init early_init_dt_setup_initrd_arch(unsigned long start, unsigned long end) |
79 | { | 80 | { |
80 | phys_initrd_start = start; | 81 | phys_initrd_start = start; |
81 | phys_initrd_size = end - start; | 82 | phys_initrd_size = end - start; |
82 | } | 83 | } |
83 | #endif /* CONFIG_OF_FLATTREE */ | 84 | #endif /* CONFIG_OF_FLATTREE */ |
84 | 85 | ||
85 | /* | 86 | /* |
86 | * This keeps memory configuration data used by a couple memory | 87 | * This keeps memory configuration data used by a couple memory |
87 | * initialization functions, as well as show_mem() for the skipping | 88 | * initialization functions, as well as show_mem() for the skipping |
88 | * of holes in the memory map. It is populated by arm_add_memory(). | 89 | * of holes in the memory map. It is populated by arm_add_memory(). |
89 | */ | 90 | */ |
90 | struct meminfo meminfo; | 91 | struct meminfo meminfo; |
91 | 92 | ||
92 | void show_mem(unsigned int filter) | 93 | void show_mem(unsigned int filter) |
93 | { | 94 | { |
94 | int free = 0, total = 0, reserved = 0; | 95 | int free = 0, total = 0, reserved = 0; |
95 | int shared = 0, cached = 0, slab = 0, i; | 96 | int shared = 0, cached = 0, slab = 0, i; |
96 | struct meminfo * mi = &meminfo; | 97 | struct meminfo * mi = &meminfo; |
97 | 98 | ||
98 | printk("Mem-info:\n"); | 99 | printk("Mem-info:\n"); |
99 | show_free_areas(filter); | 100 | show_free_areas(filter); |
100 | 101 | ||
101 | for_each_bank (i, mi) { | 102 | for_each_bank (i, mi) { |
102 | struct membank *bank = &mi->bank[i]; | 103 | struct membank *bank = &mi->bank[i]; |
103 | unsigned int pfn1, pfn2; | 104 | unsigned int pfn1, pfn2; |
104 | struct page *page, *end; | 105 | struct page *page, *end; |
105 | 106 | ||
106 | pfn1 = bank_pfn_start(bank); | 107 | pfn1 = bank_pfn_start(bank); |
107 | pfn2 = bank_pfn_end(bank); | 108 | pfn2 = bank_pfn_end(bank); |
108 | 109 | ||
109 | page = pfn_to_page(pfn1); | 110 | page = pfn_to_page(pfn1); |
110 | end = pfn_to_page(pfn2 - 1) + 1; | 111 | end = pfn_to_page(pfn2 - 1) + 1; |
111 | 112 | ||
112 | do { | 113 | do { |
113 | total++; | 114 | total++; |
114 | if (PageReserved(page)) | 115 | if (PageReserved(page)) |
115 | reserved++; | 116 | reserved++; |
116 | else if (PageSwapCache(page)) | 117 | else if (PageSwapCache(page)) |
117 | cached++; | 118 | cached++; |
118 | else if (PageSlab(page)) | 119 | else if (PageSlab(page)) |
119 | slab++; | 120 | slab++; |
120 | else if (!page_count(page)) | 121 | else if (!page_count(page)) |
121 | free++; | 122 | free++; |
122 | else | 123 | else |
123 | shared += page_count(page) - 1; | 124 | shared += page_count(page) - 1; |
124 | page++; | 125 | page++; |
125 | } while (page < end); | 126 | } while (page < end); |
126 | } | 127 | } |
127 | 128 | ||
128 | printk("%d pages of RAM\n", total); | 129 | printk("%d pages of RAM\n", total); |
129 | printk("%d free pages\n", free); | 130 | printk("%d free pages\n", free); |
130 | printk("%d reserved pages\n", reserved); | 131 | printk("%d reserved pages\n", reserved); |
131 | printk("%d slab pages\n", slab); | 132 | printk("%d slab pages\n", slab); |
132 | printk("%d pages shared\n", shared); | 133 | printk("%d pages shared\n", shared); |
133 | printk("%d pages swap cached\n", cached); | 134 | printk("%d pages swap cached\n", cached); |
134 | } | 135 | } |
135 | 136 | ||
136 | static void __init find_limits(unsigned long *min, unsigned long *max_low, | 137 | static void __init find_limits(unsigned long *min, unsigned long *max_low, |
137 | unsigned long *max_high) | 138 | unsigned long *max_high) |
138 | { | 139 | { |
139 | struct meminfo *mi = &meminfo; | 140 | struct meminfo *mi = &meminfo; |
140 | int i; | 141 | int i; |
141 | 142 | ||
142 | /* This assumes the meminfo array is properly sorted */ | 143 | /* This assumes the meminfo array is properly sorted */ |
143 | *min = bank_pfn_start(&mi->bank[0]); | 144 | *min = bank_pfn_start(&mi->bank[0]); |
144 | for_each_bank (i, mi) | 145 | for_each_bank (i, mi) |
145 | if (mi->bank[i].highmem) | 146 | if (mi->bank[i].highmem) |
146 | break; | 147 | break; |
147 | *max_low = bank_pfn_end(&mi->bank[i - 1]); | 148 | *max_low = bank_pfn_end(&mi->bank[i - 1]); |
148 | *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]); | 149 | *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]); |
149 | } | 150 | } |
150 | 151 | ||
151 | static void __init arm_bootmem_init(unsigned long start_pfn, | 152 | static void __init arm_bootmem_init(unsigned long start_pfn, |
152 | unsigned long end_pfn) | 153 | unsigned long end_pfn) |
153 | { | 154 | { |
154 | struct memblock_region *reg; | 155 | struct memblock_region *reg; |
155 | unsigned int boot_pages; | 156 | unsigned int boot_pages; |
156 | phys_addr_t bitmap; | 157 | phys_addr_t bitmap; |
157 | pg_data_t *pgdat; | 158 | pg_data_t *pgdat; |
158 | 159 | ||
159 | /* | 160 | /* |
160 | * Allocate the bootmem bitmap page. This must be in a region | 161 | * Allocate the bootmem bitmap page. This must be in a region |
161 | * of memory which has already been mapped. | 162 | * of memory which has already been mapped. |
162 | */ | 163 | */ |
163 | boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn); | 164 | boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn); |
164 | bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES, | 165 | bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES, |
165 | __pfn_to_phys(end_pfn)); | 166 | __pfn_to_phys(end_pfn)); |
166 | 167 | ||
167 | /* | 168 | /* |
168 | * Initialise the bootmem allocator, handing the | 169 | * Initialise the bootmem allocator, handing the |
169 | * memory banks over to bootmem. | 170 | * memory banks over to bootmem. |
170 | */ | 171 | */ |
171 | node_set_online(0); | 172 | node_set_online(0); |
172 | pgdat = NODE_DATA(0); | 173 | pgdat = NODE_DATA(0); |
173 | init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn); | 174 | init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn); |
174 | 175 | ||
175 | /* Free the lowmem regions from memblock into bootmem. */ | 176 | /* Free the lowmem regions from memblock into bootmem. */ |
176 | for_each_memblock(memory, reg) { | 177 | for_each_memblock(memory, reg) { |
177 | unsigned long start = memblock_region_memory_base_pfn(reg); | 178 | unsigned long start = memblock_region_memory_base_pfn(reg); |
178 | unsigned long end = memblock_region_memory_end_pfn(reg); | 179 | unsigned long end = memblock_region_memory_end_pfn(reg); |
179 | 180 | ||
180 | if (end >= end_pfn) | 181 | if (end >= end_pfn) |
181 | end = end_pfn; | 182 | end = end_pfn; |
182 | if (start >= end) | 183 | if (start >= end) |
183 | break; | 184 | break; |
184 | 185 | ||
185 | free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT); | 186 | free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT); |
186 | } | 187 | } |
187 | 188 | ||
188 | /* Reserve the lowmem memblock reserved regions in bootmem. */ | 189 | /* Reserve the lowmem memblock reserved regions in bootmem. */ |
189 | for_each_memblock(reserved, reg) { | 190 | for_each_memblock(reserved, reg) { |
190 | unsigned long start = memblock_region_reserved_base_pfn(reg); | 191 | unsigned long start = memblock_region_reserved_base_pfn(reg); |
191 | unsigned long end = memblock_region_reserved_end_pfn(reg); | 192 | unsigned long end = memblock_region_reserved_end_pfn(reg); |
192 | 193 | ||
193 | if (end >= end_pfn) | 194 | if (end >= end_pfn) |
194 | end = end_pfn; | 195 | end = end_pfn; |
195 | if (start >= end) | 196 | if (start >= end) |
196 | break; | 197 | break; |
197 | 198 | ||
198 | reserve_bootmem(__pfn_to_phys(start), | 199 | reserve_bootmem(__pfn_to_phys(start), |
199 | (end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT); | 200 | (end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT); |
200 | } | 201 | } |
201 | } | 202 | } |
202 | 203 | ||
203 | #ifdef CONFIG_ZONE_DMA | 204 | #ifdef CONFIG_ZONE_DMA |
204 | 205 | ||
205 | unsigned long arm_dma_zone_size __read_mostly; | 206 | unsigned long arm_dma_zone_size __read_mostly; |
206 | EXPORT_SYMBOL(arm_dma_zone_size); | 207 | EXPORT_SYMBOL(arm_dma_zone_size); |
207 | 208 | ||
208 | /* | 209 | /* |
209 | * The DMA mask corresponding to the maximum bus address allocatable | 210 | * The DMA mask corresponding to the maximum bus address allocatable |
210 | * using GFP_DMA. The default here places no restriction on DMA | 211 | * using GFP_DMA. The default here places no restriction on DMA |
211 | * allocations. This must be the smallest DMA mask in the system, | 212 | * allocations. This must be the smallest DMA mask in the system, |
212 | * so a successful GFP_DMA allocation will always satisfy this. | 213 | * so a successful GFP_DMA allocation will always satisfy this. |
213 | */ | 214 | */ |
214 | u32 arm_dma_limit; | 215 | u32 arm_dma_limit; |
215 | 216 | ||
216 | static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole, | 217 | static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole, |
217 | unsigned long dma_size) | 218 | unsigned long dma_size) |
218 | { | 219 | { |
219 | if (size[0] <= dma_size) | 220 | if (size[0] <= dma_size) |
220 | return; | 221 | return; |
221 | 222 | ||
222 | size[ZONE_NORMAL] = size[0] - dma_size; | 223 | size[ZONE_NORMAL] = size[0] - dma_size; |
223 | size[ZONE_DMA] = dma_size; | 224 | size[ZONE_DMA] = dma_size; |
224 | hole[ZONE_NORMAL] = hole[0]; | 225 | hole[ZONE_NORMAL] = hole[0]; |
225 | hole[ZONE_DMA] = 0; | 226 | hole[ZONE_DMA] = 0; |
226 | } | 227 | } |
227 | #endif | 228 | #endif |
228 | 229 | ||
229 | static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, | 230 | static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, |
230 | unsigned long max_high) | 231 | unsigned long max_high) |
231 | { | 232 | { |
232 | unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; | 233 | unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; |
233 | struct memblock_region *reg; | 234 | struct memblock_region *reg; |
234 | 235 | ||
235 | /* | 236 | /* |
236 | * initialise the zones. | 237 | * initialise the zones. |
237 | */ | 238 | */ |
238 | memset(zone_size, 0, sizeof(zone_size)); | 239 | memset(zone_size, 0, sizeof(zone_size)); |
239 | 240 | ||
240 | /* | 241 | /* |
241 | * The memory size has already been determined. If we need | 242 | * The memory size has already been determined. If we need |
242 | * to do anything fancy with the allocation of this memory | 243 | * to do anything fancy with the allocation of this memory |
243 | * to the zones, now is the time to do it. | 244 | * to the zones, now is the time to do it. |
244 | */ | 245 | */ |
245 | zone_size[0] = max_low - min; | 246 | zone_size[0] = max_low - min; |
246 | #ifdef CONFIG_HIGHMEM | 247 | #ifdef CONFIG_HIGHMEM |
247 | zone_size[ZONE_HIGHMEM] = max_high - max_low; | 248 | zone_size[ZONE_HIGHMEM] = max_high - max_low; |
248 | #endif | 249 | #endif |
249 | 250 | ||
250 | /* | 251 | /* |
251 | * Calculate the size of the holes. | 252 | * Calculate the size of the holes. |
252 | * holes = node_size - sum(bank_sizes) | 253 | * holes = node_size - sum(bank_sizes) |
253 | */ | 254 | */ |
254 | memcpy(zhole_size, zone_size, sizeof(zhole_size)); | 255 | memcpy(zhole_size, zone_size, sizeof(zhole_size)); |
255 | for_each_memblock(memory, reg) { | 256 | for_each_memblock(memory, reg) { |
256 | unsigned long start = memblock_region_memory_base_pfn(reg); | 257 | unsigned long start = memblock_region_memory_base_pfn(reg); |
257 | unsigned long end = memblock_region_memory_end_pfn(reg); | 258 | unsigned long end = memblock_region_memory_end_pfn(reg); |
258 | 259 | ||
259 | if (start < max_low) { | 260 | if (start < max_low) { |
260 | unsigned long low_end = min(end, max_low); | 261 | unsigned long low_end = min(end, max_low); |
261 | zhole_size[0] -= low_end - start; | 262 | zhole_size[0] -= low_end - start; |
262 | } | 263 | } |
263 | #ifdef CONFIG_HIGHMEM | 264 | #ifdef CONFIG_HIGHMEM |
264 | if (end > max_low) { | 265 | if (end > max_low) { |
265 | unsigned long high_start = max(start, max_low); | 266 | unsigned long high_start = max(start, max_low); |
266 | zhole_size[ZONE_HIGHMEM] -= end - high_start; | 267 | zhole_size[ZONE_HIGHMEM] -= end - high_start; |
267 | } | 268 | } |
268 | #endif | 269 | #endif |
269 | } | 270 | } |
270 | 271 | ||
271 | #ifdef CONFIG_ZONE_DMA | 272 | #ifdef CONFIG_ZONE_DMA |
272 | /* | 273 | /* |
273 | * Adjust the sizes according to any special requirements for | 274 | * Adjust the sizes according to any special requirements for |
274 | * this machine type. | 275 | * this machine type. |
275 | */ | 276 | */ |
276 | if (arm_dma_zone_size) { | 277 | if (arm_dma_zone_size) { |
277 | arm_adjust_dma_zone(zone_size, zhole_size, | 278 | arm_adjust_dma_zone(zone_size, zhole_size, |
278 | arm_dma_zone_size >> PAGE_SHIFT); | 279 | arm_dma_zone_size >> PAGE_SHIFT); |
279 | arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1; | 280 | arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1; |
280 | } else | 281 | } else |
281 | arm_dma_limit = 0xffffffff; | 282 | arm_dma_limit = 0xffffffff; |
282 | #endif | 283 | #endif |
283 | 284 | ||
284 | free_area_init_node(0, zone_size, min, zhole_size); | 285 | free_area_init_node(0, zone_size, min, zhole_size); |
285 | } | 286 | } |
286 | 287 | ||
287 | #ifdef CONFIG_HAVE_ARCH_PFN_VALID | 288 | #ifdef CONFIG_HAVE_ARCH_PFN_VALID |
288 | int pfn_valid(unsigned long pfn) | 289 | int pfn_valid(unsigned long pfn) |
289 | { | 290 | { |
290 | return memblock_is_memory(__pfn_to_phys(pfn)); | 291 | return memblock_is_memory(__pfn_to_phys(pfn)); |
291 | } | 292 | } |
292 | EXPORT_SYMBOL(pfn_valid); | 293 | EXPORT_SYMBOL(pfn_valid); |
293 | #endif | 294 | #endif |
294 | 295 | ||
295 | #ifndef CONFIG_SPARSEMEM | 296 | #ifndef CONFIG_SPARSEMEM |
296 | static void arm_memory_present(void) | 297 | static void arm_memory_present(void) |
297 | { | 298 | { |
298 | } | 299 | } |
299 | #else | 300 | #else |
300 | static void arm_memory_present(void) | 301 | static void arm_memory_present(void) |
301 | { | 302 | { |
302 | struct memblock_region *reg; | 303 | struct memblock_region *reg; |
303 | 304 | ||
304 | for_each_memblock(memory, reg) | 305 | for_each_memblock(memory, reg) |
305 | memory_present(0, memblock_region_memory_base_pfn(reg), | 306 | memory_present(0, memblock_region_memory_base_pfn(reg), |
306 | memblock_region_memory_end_pfn(reg)); | 307 | memblock_region_memory_end_pfn(reg)); |
307 | } | 308 | } |
308 | #endif | 309 | #endif |
309 | 310 | ||
311 | static bool arm_memblock_steal_permitted = true; | ||
312 | |||
313 | phys_addr_t arm_memblock_steal(phys_addr_t size, phys_addr_t align) | ||
314 | { | ||
315 | phys_addr_t phys; | ||
316 | |||
317 | BUG_ON(!arm_memblock_steal_permitted); | ||
318 | |||
319 | phys = memblock_alloc(size, align); | ||
320 | memblock_free(phys, size); | ||
321 | memblock_remove(phys, size); | ||
322 | |||
323 | return phys; | ||
324 | } | ||
325 | |||
310 | void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc) | 326 | void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc) |
311 | { | 327 | { |
312 | int i; | 328 | int i; |
313 | 329 | ||
314 | for (i = 0; i < mi->nr_banks; i++) | 330 | for (i = 0; i < mi->nr_banks; i++) |
315 | memblock_add(mi->bank[i].start, mi->bank[i].size); | 331 | memblock_add(mi->bank[i].start, mi->bank[i].size); |
316 | 332 | ||
317 | /* Register the kernel text, kernel data and initrd with memblock. */ | 333 | /* Register the kernel text, kernel data and initrd with memblock. */ |
318 | #ifdef CONFIG_XIP_KERNEL | 334 | #ifdef CONFIG_XIP_KERNEL |
319 | memblock_reserve(__pa(_sdata), _end - _sdata); | 335 | memblock_reserve(__pa(_sdata), _end - _sdata); |
320 | #else | 336 | #else |
321 | memblock_reserve(__pa(_stext), _end - _stext); | 337 | memblock_reserve(__pa(_stext), _end - _stext); |
322 | #endif | 338 | #endif |
323 | #ifdef CONFIG_BLK_DEV_INITRD | 339 | #ifdef CONFIG_BLK_DEV_INITRD |
324 | if (phys_initrd_size && | 340 | if (phys_initrd_size && |
325 | !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) { | 341 | !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) { |
326 | pr_err("INITRD: 0x%08lx+0x%08lx is not a memory region - disabling initrd\n", | 342 | pr_err("INITRD: 0x%08lx+0x%08lx is not a memory region - disabling initrd\n", |
327 | phys_initrd_start, phys_initrd_size); | 343 | phys_initrd_start, phys_initrd_size); |
328 | phys_initrd_start = phys_initrd_size = 0; | 344 | phys_initrd_start = phys_initrd_size = 0; |
329 | } | 345 | } |
330 | if (phys_initrd_size && | 346 | if (phys_initrd_size && |
331 | memblock_is_region_reserved(phys_initrd_start, phys_initrd_size)) { | 347 | memblock_is_region_reserved(phys_initrd_start, phys_initrd_size)) { |
332 | pr_err("INITRD: 0x%08lx+0x%08lx overlaps in-use memory region - disabling initrd\n", | 348 | pr_err("INITRD: 0x%08lx+0x%08lx overlaps in-use memory region - disabling initrd\n", |
333 | phys_initrd_start, phys_initrd_size); | 349 | phys_initrd_start, phys_initrd_size); |
334 | phys_initrd_start = phys_initrd_size = 0; | 350 | phys_initrd_start = phys_initrd_size = 0; |
335 | } | 351 | } |
336 | if (phys_initrd_size) { | 352 | if (phys_initrd_size) { |
337 | memblock_reserve(phys_initrd_start, phys_initrd_size); | 353 | memblock_reserve(phys_initrd_start, phys_initrd_size); |
338 | 354 | ||
339 | /* Now convert initrd to virtual addresses */ | 355 | /* Now convert initrd to virtual addresses */ |
340 | initrd_start = __phys_to_virt(phys_initrd_start); | 356 | initrd_start = __phys_to_virt(phys_initrd_start); |
341 | initrd_end = initrd_start + phys_initrd_size; | 357 | initrd_end = initrd_start + phys_initrd_size; |
342 | } | 358 | } |
343 | #endif | 359 | #endif |
344 | 360 | ||
345 | arm_mm_memblock_reserve(); | 361 | arm_mm_memblock_reserve(); |
346 | arm_dt_memblock_reserve(); | 362 | arm_dt_memblock_reserve(); |
347 | 363 | ||
348 | /* reserve any platform specific memblock areas */ | 364 | /* reserve any platform specific memblock areas */ |
349 | if (mdesc->reserve) | 365 | if (mdesc->reserve) |
350 | mdesc->reserve(); | 366 | mdesc->reserve(); |
351 | 367 | ||
368 | arm_memblock_steal_permitted = false; | ||
352 | memblock_allow_resize(); | 369 | memblock_allow_resize(); |
353 | memblock_dump_all(); | 370 | memblock_dump_all(); |
354 | } | 371 | } |
355 | 372 | ||
356 | void __init bootmem_init(void) | 373 | void __init bootmem_init(void) |
357 | { | 374 | { |
358 | unsigned long min, max_low, max_high; | 375 | unsigned long min, max_low, max_high; |
359 | 376 | ||
360 | max_low = max_high = 0; | 377 | max_low = max_high = 0; |
361 | 378 | ||
362 | find_limits(&min, &max_low, &max_high); | 379 | find_limits(&min, &max_low, &max_high); |
363 | 380 | ||
364 | arm_bootmem_init(min, max_low); | 381 | arm_bootmem_init(min, max_low); |
365 | 382 | ||
366 | /* | 383 | /* |
367 | * Sparsemem tries to allocate bootmem in memory_present(), | 384 | * Sparsemem tries to allocate bootmem in memory_present(), |
368 | * so must be done after the fixed reservations | 385 | * so must be done after the fixed reservations |
369 | */ | 386 | */ |
370 | arm_memory_present(); | 387 | arm_memory_present(); |
371 | 388 | ||
372 | /* | 389 | /* |
373 | * sparse_init() needs the bootmem allocator up and running. | 390 | * sparse_init() needs the bootmem allocator up and running. |
374 | */ | 391 | */ |
375 | sparse_init(); | 392 | sparse_init(); |
376 | 393 | ||
377 | /* | 394 | /* |
378 | * Now free the memory - free_area_init_node needs | 395 | * Now free the memory - free_area_init_node needs |
379 | * the sparse mem_map arrays initialized by sparse_init() | 396 | * the sparse mem_map arrays initialized by sparse_init() |
380 | * for memmap_init_zone(), otherwise all PFNs are invalid. | 397 | * for memmap_init_zone(), otherwise all PFNs are invalid. |
381 | */ | 398 | */ |
382 | arm_bootmem_free(min, max_low, max_high); | 399 | arm_bootmem_free(min, max_low, max_high); |
383 | 400 | ||
384 | /* | 401 | /* |
385 | * This doesn't seem to be used by the Linux memory manager any | 402 | * This doesn't seem to be used by the Linux memory manager any |
386 | * more, but is used by ll_rw_block. If we can get rid of it, we | 403 | * more, but is used by ll_rw_block. If we can get rid of it, we |
387 | * also get rid of some of the stuff above as well. | 404 | * also get rid of some of the stuff above as well. |
388 | * | 405 | * |
389 | * Note: max_low_pfn and max_pfn reflect the number of _pages_ in | 406 | * Note: max_low_pfn and max_pfn reflect the number of _pages_ in |
390 | * the system, not the maximum PFN. | 407 | * the system, not the maximum PFN. |
391 | */ | 408 | */ |
392 | max_low_pfn = max_low - PHYS_PFN_OFFSET; | 409 | max_low_pfn = max_low - PHYS_PFN_OFFSET; |
393 | max_pfn = max_high - PHYS_PFN_OFFSET; | 410 | max_pfn = max_high - PHYS_PFN_OFFSET; |
394 | } | 411 | } |
395 | 412 | ||
396 | static inline int free_area(unsigned long pfn, unsigned long end, char *s) | 413 | static inline int free_area(unsigned long pfn, unsigned long end, char *s) |
397 | { | 414 | { |
398 | unsigned int pages = 0, size = (end - pfn) << (PAGE_SHIFT - 10); | 415 | unsigned int pages = 0, size = (end - pfn) << (PAGE_SHIFT - 10); |
399 | 416 | ||
400 | for (; pfn < end; pfn++) { | 417 | for (; pfn < end; pfn++) { |
401 | struct page *page = pfn_to_page(pfn); | 418 | struct page *page = pfn_to_page(pfn); |
402 | ClearPageReserved(page); | 419 | ClearPageReserved(page); |
403 | init_page_count(page); | 420 | init_page_count(page); |
404 | __free_page(page); | 421 | __free_page(page); |
405 | pages++; | 422 | pages++; |
406 | } | 423 | } |
407 | 424 | ||
408 | if (size && s) | 425 | if (size && s) |
409 | printk(KERN_INFO "Freeing %s memory: %dK\n", s, size); | 426 | printk(KERN_INFO "Freeing %s memory: %dK\n", s, size); |
410 | 427 | ||
411 | return pages; | 428 | return pages; |
412 | } | 429 | } |
413 | 430 | ||
414 | /* | 431 | /* |
415 | * Poison init memory with an undefined instruction (ARM) or a branch to an | 432 | * Poison init memory with an undefined instruction (ARM) or a branch to an |
416 | * undefined instruction (Thumb). | 433 | * undefined instruction (Thumb). |
417 | */ | 434 | */ |
418 | static inline void poison_init_mem(void *s, size_t count) | 435 | static inline void poison_init_mem(void *s, size_t count) |
419 | { | 436 | { |
420 | u32 *p = (u32 *)s; | 437 | u32 *p = (u32 *)s; |
421 | for (; count != 0; count -= 4) | 438 | for (; count != 0; count -= 4) |
422 | *p++ = 0xe7fddef0; | 439 | *p++ = 0xe7fddef0; |
423 | } | 440 | } |
424 | 441 | ||
425 | static inline void | 442 | static inline void |
426 | free_memmap(unsigned long start_pfn, unsigned long end_pfn) | 443 | free_memmap(unsigned long start_pfn, unsigned long end_pfn) |
427 | { | 444 | { |
428 | struct page *start_pg, *end_pg; | 445 | struct page *start_pg, *end_pg; |
429 | unsigned long pg, pgend; | 446 | unsigned long pg, pgend; |
430 | 447 | ||
431 | /* | 448 | /* |
432 | * Convert start_pfn/end_pfn to a struct page pointer. | 449 | * Convert start_pfn/end_pfn to a struct page pointer. |
433 | */ | 450 | */ |
434 | start_pg = pfn_to_page(start_pfn - 1) + 1; | 451 | start_pg = pfn_to_page(start_pfn - 1) + 1; |
435 | end_pg = pfn_to_page(end_pfn - 1) + 1; | 452 | end_pg = pfn_to_page(end_pfn - 1) + 1; |
436 | 453 | ||
437 | /* | 454 | /* |
438 | * Convert to physical addresses, and | 455 | * Convert to physical addresses, and |
439 | * round start upwards and end downwards. | 456 | * round start upwards and end downwards. |
440 | */ | 457 | */ |
441 | pg = (unsigned long)PAGE_ALIGN(__pa(start_pg)); | 458 | pg = (unsigned long)PAGE_ALIGN(__pa(start_pg)); |
442 | pgend = (unsigned long)__pa(end_pg) & PAGE_MASK; | 459 | pgend = (unsigned long)__pa(end_pg) & PAGE_MASK; |
443 | 460 | ||
444 | /* | 461 | /* |
445 | * If there are free pages between these, | 462 | * If there are free pages between these, |
446 | * free the section of the memmap array. | 463 | * free the section of the memmap array. |
447 | */ | 464 | */ |
448 | if (pg < pgend) | 465 | if (pg < pgend) |
449 | free_bootmem(pg, pgend - pg); | 466 | free_bootmem(pg, pgend - pg); |
450 | } | 467 | } |
451 | 468 | ||
452 | /* | 469 | /* |
453 | * The mem_map array can get very big. Free the unused area of the memory map. | 470 | * The mem_map array can get very big. Free the unused area of the memory map. |
454 | */ | 471 | */ |
455 | static void __init free_unused_memmap(struct meminfo *mi) | 472 | static void __init free_unused_memmap(struct meminfo *mi) |
456 | { | 473 | { |
457 | unsigned long bank_start, prev_bank_end = 0; | 474 | unsigned long bank_start, prev_bank_end = 0; |
458 | unsigned int i; | 475 | unsigned int i; |
459 | 476 | ||
460 | /* | 477 | /* |
461 | * This relies on each bank being in address order. | 478 | * This relies on each bank being in address order. |
462 | * The banks are sorted previously in bootmem_init(). | 479 | * The banks are sorted previously in bootmem_init(). |
463 | */ | 480 | */ |
464 | for_each_bank(i, mi) { | 481 | for_each_bank(i, mi) { |
465 | struct membank *bank = &mi->bank[i]; | 482 | struct membank *bank = &mi->bank[i]; |
466 | 483 | ||
467 | bank_start = bank_pfn_start(bank); | 484 | bank_start = bank_pfn_start(bank); |
468 | 485 | ||
469 | #ifdef CONFIG_SPARSEMEM | 486 | #ifdef CONFIG_SPARSEMEM |
470 | /* | 487 | /* |
471 | * Take care not to free memmap entries that don't exist | 488 | * Take care not to free memmap entries that don't exist |
472 | * due to SPARSEMEM sections which aren't present. | 489 | * due to SPARSEMEM sections which aren't present. |
473 | */ | 490 | */ |
474 | bank_start = min(bank_start, | 491 | bank_start = min(bank_start, |
475 | ALIGN(prev_bank_end, PAGES_PER_SECTION)); | 492 | ALIGN(prev_bank_end, PAGES_PER_SECTION)); |
476 | #else | 493 | #else |
477 | /* | 494 | /* |
478 | * Align down here since the VM subsystem insists that the | 495 | * Align down here since the VM subsystem insists that the |
479 | * memmap entries are valid from the bank start aligned to | 496 | * memmap entries are valid from the bank start aligned to |
480 | * MAX_ORDER_NR_PAGES. | 497 | * MAX_ORDER_NR_PAGES. |
481 | */ | 498 | */ |
482 | bank_start = round_down(bank_start, MAX_ORDER_NR_PAGES); | 499 | bank_start = round_down(bank_start, MAX_ORDER_NR_PAGES); |
483 | #endif | 500 | #endif |
484 | /* | 501 | /* |
485 | * If we had a previous bank, and there is a space | 502 | * If we had a previous bank, and there is a space |
486 | * between the current bank and the previous, free it. | 503 | * between the current bank and the previous, free it. |
487 | */ | 504 | */ |
488 | if (prev_bank_end && prev_bank_end < bank_start) | 505 | if (prev_bank_end && prev_bank_end < bank_start) |
489 | free_memmap(prev_bank_end, bank_start); | 506 | free_memmap(prev_bank_end, bank_start); |
490 | 507 | ||
491 | /* | 508 | /* |
492 | * Align up here since the VM subsystem insists that the | 509 | * Align up here since the VM subsystem insists that the |
493 | * memmap entries are valid from the bank end aligned to | 510 | * memmap entries are valid from the bank end aligned to |
494 | * MAX_ORDER_NR_PAGES. | 511 | * MAX_ORDER_NR_PAGES. |
495 | */ | 512 | */ |
496 | prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES); | 513 | prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES); |
497 | } | 514 | } |
498 | 515 | ||
499 | #ifdef CONFIG_SPARSEMEM | 516 | #ifdef CONFIG_SPARSEMEM |
500 | if (!IS_ALIGNED(prev_bank_end, PAGES_PER_SECTION)) | 517 | if (!IS_ALIGNED(prev_bank_end, PAGES_PER_SECTION)) |
501 | free_memmap(prev_bank_end, | 518 | free_memmap(prev_bank_end, |
502 | ALIGN(prev_bank_end, PAGES_PER_SECTION)); | 519 | ALIGN(prev_bank_end, PAGES_PER_SECTION)); |
503 | #endif | 520 | #endif |
504 | } | 521 | } |
505 | 522 | ||
506 | static void __init free_highpages(void) | 523 | static void __init free_highpages(void) |
507 | { | 524 | { |
508 | #ifdef CONFIG_HIGHMEM | 525 | #ifdef CONFIG_HIGHMEM |
509 | unsigned long max_low = max_low_pfn + PHYS_PFN_OFFSET; | 526 | unsigned long max_low = max_low_pfn + PHYS_PFN_OFFSET; |
510 | struct memblock_region *mem, *res; | 527 | struct memblock_region *mem, *res; |
511 | 528 | ||
512 | /* set highmem page free */ | 529 | /* set highmem page free */ |
513 | for_each_memblock(memory, mem) { | 530 | for_each_memblock(memory, mem) { |
514 | unsigned long start = memblock_region_memory_base_pfn(mem); | 531 | unsigned long start = memblock_region_memory_base_pfn(mem); |
515 | unsigned long end = memblock_region_memory_end_pfn(mem); | 532 | unsigned long end = memblock_region_memory_end_pfn(mem); |
516 | 533 | ||
517 | /* Ignore complete lowmem entries */ | 534 | /* Ignore complete lowmem entries */ |
518 | if (end <= max_low) | 535 | if (end <= max_low) |
519 | continue; | 536 | continue; |
520 | 537 | ||
521 | /* Truncate partial highmem entries */ | 538 | /* Truncate partial highmem entries */ |
522 | if (start < max_low) | 539 | if (start < max_low) |
523 | start = max_low; | 540 | start = max_low; |
524 | 541 | ||
525 | /* Find and exclude any reserved regions */ | 542 | /* Find and exclude any reserved regions */ |
526 | for_each_memblock(reserved, res) { | 543 | for_each_memblock(reserved, res) { |
527 | unsigned long res_start, res_end; | 544 | unsigned long res_start, res_end; |
528 | 545 | ||
529 | res_start = memblock_region_reserved_base_pfn(res); | 546 | res_start = memblock_region_reserved_base_pfn(res); |
530 | res_end = memblock_region_reserved_end_pfn(res); | 547 | res_end = memblock_region_reserved_end_pfn(res); |
531 | 548 | ||
532 | if (res_end < start) | 549 | if (res_end < start) |
533 | continue; | 550 | continue; |
534 | if (res_start < start) | 551 | if (res_start < start) |
535 | res_start = start; | 552 | res_start = start; |
536 | if (res_start > end) | 553 | if (res_start > end) |
537 | res_start = end; | 554 | res_start = end; |
538 | if (res_end > end) | 555 | if (res_end > end) |
539 | res_end = end; | 556 | res_end = end; |
540 | if (res_start != start) | 557 | if (res_start != start) |
541 | totalhigh_pages += free_area(start, res_start, | 558 | totalhigh_pages += free_area(start, res_start, |
542 | NULL); | 559 | NULL); |
543 | start = res_end; | 560 | start = res_end; |
544 | if (start == end) | 561 | if (start == end) |
545 | break; | 562 | break; |
546 | } | 563 | } |
547 | 564 | ||
548 | /* And now free anything which remains */ | 565 | /* And now free anything which remains */ |
549 | if (start < end) | 566 | if (start < end) |
550 | totalhigh_pages += free_area(start, end, NULL); | 567 | totalhigh_pages += free_area(start, end, NULL); |
551 | } | 568 | } |
552 | totalram_pages += totalhigh_pages; | 569 | totalram_pages += totalhigh_pages; |
553 | #endif | 570 | #endif |
554 | } | 571 | } |
555 | 572 | ||
556 | /* | 573 | /* |
557 | * mem_init() marks the free areas in the mem_map and tells us how much | 574 | * mem_init() marks the free areas in the mem_map and tells us how much |
558 | * memory is free. This is done after various parts of the system have | 575 | * memory is free. This is done after various parts of the system have |
559 | * claimed their memory after the kernel image. | 576 | * claimed their memory after the kernel image. |
560 | */ | 577 | */ |
561 | void __init mem_init(void) | 578 | void __init mem_init(void) |
562 | { | 579 | { |
563 | unsigned long reserved_pages, free_pages; | 580 | unsigned long reserved_pages, free_pages; |
564 | struct memblock_region *reg; | 581 | struct memblock_region *reg; |
565 | int i; | 582 | int i; |
566 | #ifdef CONFIG_HAVE_TCM | 583 | #ifdef CONFIG_HAVE_TCM |
567 | /* These pointers are filled in on TCM detection */ | 584 | /* These pointers are filled in on TCM detection */ |
568 | extern u32 dtcm_end; | 585 | extern u32 dtcm_end; |
569 | extern u32 itcm_end; | 586 | extern u32 itcm_end; |
570 | #endif | 587 | #endif |
571 | 588 | ||
572 | max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; | 589 | max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; |
573 | 590 | ||
574 | /* this will put all unused low memory onto the freelists */ | 591 | /* this will put all unused low memory onto the freelists */ |
575 | free_unused_memmap(&meminfo); | 592 | free_unused_memmap(&meminfo); |
576 | 593 | ||
577 | totalram_pages += free_all_bootmem(); | 594 | totalram_pages += free_all_bootmem(); |
578 | 595 | ||
579 | #ifdef CONFIG_SA1111 | 596 | #ifdef CONFIG_SA1111 |
580 | /* now that our DMA memory is actually so designated, we can free it */ | 597 | /* now that our DMA memory is actually so designated, we can free it */ |
581 | totalram_pages += free_area(PHYS_PFN_OFFSET, | 598 | totalram_pages += free_area(PHYS_PFN_OFFSET, |
582 | __phys_to_pfn(__pa(swapper_pg_dir)), NULL); | 599 | __phys_to_pfn(__pa(swapper_pg_dir)), NULL); |
583 | #endif | 600 | #endif |
584 | 601 | ||
585 | free_highpages(); | 602 | free_highpages(); |
586 | 603 | ||
587 | reserved_pages = free_pages = 0; | 604 | reserved_pages = free_pages = 0; |
588 | 605 | ||
589 | for_each_bank(i, &meminfo) { | 606 | for_each_bank(i, &meminfo) { |
590 | struct membank *bank = &meminfo.bank[i]; | 607 | struct membank *bank = &meminfo.bank[i]; |
591 | unsigned int pfn1, pfn2; | 608 | unsigned int pfn1, pfn2; |
592 | struct page *page, *end; | 609 | struct page *page, *end; |
593 | 610 | ||
594 | pfn1 = bank_pfn_start(bank); | 611 | pfn1 = bank_pfn_start(bank); |
595 | pfn2 = bank_pfn_end(bank); | 612 | pfn2 = bank_pfn_end(bank); |
596 | 613 | ||
597 | page = pfn_to_page(pfn1); | 614 | page = pfn_to_page(pfn1); |
598 | end = pfn_to_page(pfn2 - 1) + 1; | 615 | end = pfn_to_page(pfn2 - 1) + 1; |
599 | 616 | ||
600 | do { | 617 | do { |
601 | if (PageReserved(page)) | 618 | if (PageReserved(page)) |
602 | reserved_pages++; | 619 | reserved_pages++; |
603 | else if (!page_count(page)) | 620 | else if (!page_count(page)) |
604 | free_pages++; | 621 | free_pages++; |
605 | page++; | 622 | page++; |
606 | } while (page < end); | 623 | } while (page < end); |
607 | } | 624 | } |
608 | 625 | ||
609 | /* | 626 | /* |
610 | * Since our memory may not be contiguous, calculate the | 627 | * Since our memory may not be contiguous, calculate the |
611 | * real number of pages we have in this system | 628 | * real number of pages we have in this system |
612 | */ | 629 | */ |
613 | printk(KERN_INFO "Memory:"); | 630 | printk(KERN_INFO "Memory:"); |
614 | num_physpages = 0; | 631 | num_physpages = 0; |
615 | for_each_memblock(memory, reg) { | 632 | for_each_memblock(memory, reg) { |
616 | unsigned long pages = memblock_region_memory_end_pfn(reg) - | 633 | unsigned long pages = memblock_region_memory_end_pfn(reg) - |
617 | memblock_region_memory_base_pfn(reg); | 634 | memblock_region_memory_base_pfn(reg); |
618 | num_physpages += pages; | 635 | num_physpages += pages; |
619 | printk(" %ldMB", pages >> (20 - PAGE_SHIFT)); | 636 | printk(" %ldMB", pages >> (20 - PAGE_SHIFT)); |
620 | } | 637 | } |
621 | printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT)); | 638 | printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT)); |
622 | 639 | ||
623 | printk(KERN_NOTICE "Memory: %luk/%luk available, %luk reserved, %luK highmem\n", | 640 | printk(KERN_NOTICE "Memory: %luk/%luk available, %luk reserved, %luK highmem\n", |
624 | nr_free_pages() << (PAGE_SHIFT-10), | 641 | nr_free_pages() << (PAGE_SHIFT-10), |
625 | free_pages << (PAGE_SHIFT-10), | 642 | free_pages << (PAGE_SHIFT-10), |
626 | reserved_pages << (PAGE_SHIFT-10), | 643 | reserved_pages << (PAGE_SHIFT-10), |
627 | totalhigh_pages << (PAGE_SHIFT-10)); | 644 | totalhigh_pages << (PAGE_SHIFT-10)); |
628 | 645 | ||
629 | #define MLK(b, t) b, t, ((t) - (b)) >> 10 | 646 | #define MLK(b, t) b, t, ((t) - (b)) >> 10 |
630 | #define MLM(b, t) b, t, ((t) - (b)) >> 20 | 647 | #define MLM(b, t) b, t, ((t) - (b)) >> 20 |
631 | #define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K) | 648 | #define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K) |
632 | 649 | ||
633 | printk(KERN_NOTICE "Virtual kernel memory layout:\n" | 650 | printk(KERN_NOTICE "Virtual kernel memory layout:\n" |
634 | " vector : 0x%08lx - 0x%08lx (%4ld kB)\n" | 651 | " vector : 0x%08lx - 0x%08lx (%4ld kB)\n" |
635 | #ifdef CONFIG_HAVE_TCM | 652 | #ifdef CONFIG_HAVE_TCM |
636 | " DTCM : 0x%08lx - 0x%08lx (%4ld kB)\n" | 653 | " DTCM : 0x%08lx - 0x%08lx (%4ld kB)\n" |
637 | " ITCM : 0x%08lx - 0x%08lx (%4ld kB)\n" | 654 | " ITCM : 0x%08lx - 0x%08lx (%4ld kB)\n" |
638 | #endif | 655 | #endif |
639 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" | 656 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" |
640 | " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" | 657 | " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" |
641 | " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n" | 658 | " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n" |
642 | #ifdef CONFIG_HIGHMEM | 659 | #ifdef CONFIG_HIGHMEM |
643 | " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n" | 660 | " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n" |
644 | #endif | 661 | #endif |
645 | " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" | 662 | " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" |
646 | " .text : 0x%p" " - 0x%p" " (%4d kB)\n" | 663 | " .text : 0x%p" " - 0x%p" " (%4d kB)\n" |
647 | " .init : 0x%p" " - 0x%p" " (%4d kB)\n" | 664 | " .init : 0x%p" " - 0x%p" " (%4d kB)\n" |
648 | " .data : 0x%p" " - 0x%p" " (%4d kB)\n" | 665 | " .data : 0x%p" " - 0x%p" " (%4d kB)\n" |
649 | " .bss : 0x%p" " - 0x%p" " (%4d kB)\n", | 666 | " .bss : 0x%p" " - 0x%p" " (%4d kB)\n", |
650 | 667 | ||
651 | MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) + | 668 | MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) + |
652 | (PAGE_SIZE)), | 669 | (PAGE_SIZE)), |
653 | #ifdef CONFIG_HAVE_TCM | 670 | #ifdef CONFIG_HAVE_TCM |
654 | MLK(DTCM_OFFSET, (unsigned long) dtcm_end), | 671 | MLK(DTCM_OFFSET, (unsigned long) dtcm_end), |
655 | MLK(ITCM_OFFSET, (unsigned long) itcm_end), | 672 | MLK(ITCM_OFFSET, (unsigned long) itcm_end), |
656 | #endif | 673 | #endif |
657 | MLK(FIXADDR_START, FIXADDR_TOP), | 674 | MLK(FIXADDR_START, FIXADDR_TOP), |
658 | MLM(VMALLOC_START, VMALLOC_END), | 675 | MLM(VMALLOC_START, VMALLOC_END), |
659 | MLM(PAGE_OFFSET, (unsigned long)high_memory), | 676 | MLM(PAGE_OFFSET, (unsigned long)high_memory), |
660 | #ifdef CONFIG_HIGHMEM | 677 | #ifdef CONFIG_HIGHMEM |
661 | MLM(PKMAP_BASE, (PKMAP_BASE) + (LAST_PKMAP) * | 678 | MLM(PKMAP_BASE, (PKMAP_BASE) + (LAST_PKMAP) * |
662 | (PAGE_SIZE)), | 679 | (PAGE_SIZE)), |
663 | #endif | 680 | #endif |
664 | MLM(MODULES_VADDR, MODULES_END), | 681 | MLM(MODULES_VADDR, MODULES_END), |
665 | 682 | ||
666 | MLK_ROUNDUP(_text, _etext), | 683 | MLK_ROUNDUP(_text, _etext), |
667 | MLK_ROUNDUP(__init_begin, __init_end), | 684 | MLK_ROUNDUP(__init_begin, __init_end), |
668 | MLK_ROUNDUP(_sdata, _edata), | 685 | MLK_ROUNDUP(_sdata, _edata), |
669 | MLK_ROUNDUP(__bss_start, __bss_stop)); | 686 | MLK_ROUNDUP(__bss_start, __bss_stop)); |
670 | 687 | ||
671 | #undef MLK | 688 | #undef MLK |
672 | #undef MLM | 689 | #undef MLM |
673 | #undef MLK_ROUNDUP | 690 | #undef MLK_ROUNDUP |
674 | 691 | ||
675 | /* | 692 | /* |
676 | * Check boundaries twice: Some fundamental inconsistencies can | 693 | * Check boundaries twice: Some fundamental inconsistencies can |
677 | * be detected at build time already. | 694 | * be detected at build time already. |
678 | */ | 695 | */ |
679 | #ifdef CONFIG_MMU | 696 | #ifdef CONFIG_MMU |
680 | BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR); | 697 | BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR); |
681 | BUG_ON(TASK_SIZE > MODULES_VADDR); | 698 | BUG_ON(TASK_SIZE > MODULES_VADDR); |
682 | #endif | 699 | #endif |
683 | 700 | ||
684 | #ifdef CONFIG_HIGHMEM | 701 | #ifdef CONFIG_HIGHMEM |
685 | BUILD_BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET); | 702 | BUILD_BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET); |
686 | BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET); | 703 | BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET); |
687 | #endif | 704 | #endif |
688 | 705 | ||
689 | if (PAGE_SIZE >= 16384 && num_physpages <= 128) { | 706 | if (PAGE_SIZE >= 16384 && num_physpages <= 128) { |
690 | extern int sysctl_overcommit_memory; | 707 | extern int sysctl_overcommit_memory; |
691 | /* | 708 | /* |
692 | * On a machine this small we won't get | 709 | * On a machine this small we won't get |
693 | * anywhere without overcommit, so turn | 710 | * anywhere without overcommit, so turn |
694 | * it on by default. | 711 | * it on by default. |
695 | */ | 712 | */ |
696 | sysctl_overcommit_memory = OVERCOMMIT_ALWAYS; | 713 | sysctl_overcommit_memory = OVERCOMMIT_ALWAYS; |
697 | } | 714 | } |
698 | } | 715 | } |
699 | 716 | ||
700 | void free_initmem(void) | 717 | void free_initmem(void) |
701 | { | 718 | { |
702 | #ifdef CONFIG_HAVE_TCM | 719 | #ifdef CONFIG_HAVE_TCM |
703 | extern char __tcm_start, __tcm_end; | 720 | extern char __tcm_start, __tcm_end; |
704 | 721 | ||
705 | poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start); | 722 | poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start); |
706 | totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)), | 723 | totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)), |
707 | __phys_to_pfn(__pa(&__tcm_end)), | 724 | __phys_to_pfn(__pa(&__tcm_end)), |
708 | "TCM link"); | 725 | "TCM link"); |
709 | #endif | 726 | #endif |
710 | 727 | ||
711 | poison_init_mem(__init_begin, __init_end - __init_begin); | 728 | poison_init_mem(__init_begin, __init_end - __init_begin); |
712 | if (!machine_is_integrator() && !machine_is_cintegrator()) | 729 | if (!machine_is_integrator() && !machine_is_cintegrator()) |
713 | totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)), | 730 | totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)), |
714 | __phys_to_pfn(__pa(__init_end)), | 731 | __phys_to_pfn(__pa(__init_end)), |
715 | "init"); | 732 | "init"); |
716 | } | 733 | } |
717 | 734 | ||
718 | #ifdef CONFIG_BLK_DEV_INITRD | 735 | #ifdef CONFIG_BLK_DEV_INITRD |
719 | 736 | ||
720 | static int keep_initrd; | 737 | static int keep_initrd; |
721 | 738 | ||
722 | void free_initrd_mem(unsigned long start, unsigned long end) | 739 | void free_initrd_mem(unsigned long start, unsigned long end) |
723 | { | 740 | { |
724 | if (!keep_initrd) { | 741 | if (!keep_initrd) { |
725 | poison_init_mem((void *)start, PAGE_ALIGN(end) - start); | 742 | poison_init_mem((void *)start, PAGE_ALIGN(end) - start); |
726 | totalram_pages += free_area(__phys_to_pfn(__pa(start)), | 743 | totalram_pages += free_area(__phys_to_pfn(__pa(start)), |
727 | __phys_to_pfn(__pa(end)), | 744 | __phys_to_pfn(__pa(end)), |
728 | "initrd"); | 745 | "initrd"); |
729 | } | 746 | } |
730 | } | 747 | } |
731 | 748 | ||
732 | static int __init keepinitrd_setup(char *__unused) | 749 | static int __init keepinitrd_setup(char *__unused) |
733 | { | 750 | { |
734 | keep_initrd = 1; | 751 | keep_initrd = 1; |
735 | return 1; | 752 | return 1; |
736 | } | 753 | } |
737 | 754 | ||
738 | __setup("keepinitrd", keepinitrd_setup); | 755 | __setup("keepinitrd", keepinitrd_setup); |
739 | #endif | 756 | #endif |
740 | 757 |
arch/arm/plat-omap/devices.c
1 | /* | 1 | /* |
2 | * linux/arch/arm/plat-omap/devices.c | 2 | * linux/arch/arm/plat-omap/devices.c |
3 | * | 3 | * |
4 | * Common platform device setup/initialization for OMAP1 and OMAP2 | 4 | * Common platform device setup/initialization for OMAP1 and OMAP2 |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or | 8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. | 9 | * (at your option) any later version. |
10 | */ | 10 | */ |
11 | #include <linux/gpio.h> | 11 | #include <linux/gpio.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/memblock.h> | 18 | #include <linux/memblock.h> |
19 | 19 | ||
20 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
21 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
22 | #include <asm/mach/map.h> | 22 | #include <asm/mach/map.h> |
23 | #include <asm/memblock.h> | ||
23 | 24 | ||
24 | #include <plat/tc.h> | 25 | #include <plat/tc.h> |
25 | #include <plat/board.h> | 26 | #include <plat/board.h> |
26 | #include <plat/mmc.h> | 27 | #include <plat/mmc.h> |
27 | #include <plat/menelaus.h> | 28 | #include <plat/menelaus.h> |
28 | #include <plat/omap44xx.h> | 29 | #include <plat/omap44xx.h> |
29 | 30 | ||
30 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ | 31 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ |
31 | defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) | 32 | defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) |
32 | 33 | ||
33 | #define OMAP_MMC_NR_RES 2 | 34 | #define OMAP_MMC_NR_RES 2 |
34 | 35 | ||
35 | /* | 36 | /* |
36 | * Register MMC devices. Called from mach-omap1 and mach-omap2 device init. | 37 | * Register MMC devices. Called from mach-omap1 and mach-omap2 device init. |
37 | */ | 38 | */ |
38 | int __init omap_mmc_add(const char *name, int id, unsigned long base, | 39 | int __init omap_mmc_add(const char *name, int id, unsigned long base, |
39 | unsigned long size, unsigned int irq, | 40 | unsigned long size, unsigned int irq, |
40 | struct omap_mmc_platform_data *data) | 41 | struct omap_mmc_platform_data *data) |
41 | { | 42 | { |
42 | struct platform_device *pdev; | 43 | struct platform_device *pdev; |
43 | struct resource res[OMAP_MMC_NR_RES]; | 44 | struct resource res[OMAP_MMC_NR_RES]; |
44 | int ret; | 45 | int ret; |
45 | 46 | ||
46 | pdev = platform_device_alloc(name, id); | 47 | pdev = platform_device_alloc(name, id); |
47 | if (!pdev) | 48 | if (!pdev) |
48 | return -ENOMEM; | 49 | return -ENOMEM; |
49 | 50 | ||
50 | memset(res, 0, OMAP_MMC_NR_RES * sizeof(struct resource)); | 51 | memset(res, 0, OMAP_MMC_NR_RES * sizeof(struct resource)); |
51 | res[0].start = base; | 52 | res[0].start = base; |
52 | res[0].end = base + size - 1; | 53 | res[0].end = base + size - 1; |
53 | res[0].flags = IORESOURCE_MEM; | 54 | res[0].flags = IORESOURCE_MEM; |
54 | res[1].start = res[1].end = irq; | 55 | res[1].start = res[1].end = irq; |
55 | res[1].flags = IORESOURCE_IRQ; | 56 | res[1].flags = IORESOURCE_IRQ; |
56 | 57 | ||
57 | ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); | 58 | ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); |
58 | if (ret == 0) | 59 | if (ret == 0) |
59 | ret = platform_device_add_data(pdev, data, sizeof(*data)); | 60 | ret = platform_device_add_data(pdev, data, sizeof(*data)); |
60 | if (ret) | 61 | if (ret) |
61 | goto fail; | 62 | goto fail; |
62 | 63 | ||
63 | ret = platform_device_add(pdev); | 64 | ret = platform_device_add(pdev); |
64 | if (ret) | 65 | if (ret) |
65 | goto fail; | 66 | goto fail; |
66 | 67 | ||
67 | /* return device handle to board setup code */ | 68 | /* return device handle to board setup code */ |
68 | data->dev = &pdev->dev; | 69 | data->dev = &pdev->dev; |
69 | return 0; | 70 | return 0; |
70 | 71 | ||
71 | fail: | 72 | fail: |
72 | platform_device_put(pdev); | 73 | platform_device_put(pdev); |
73 | return ret; | 74 | return ret; |
74 | } | 75 | } |
75 | 76 | ||
76 | #endif | 77 | #endif |
77 | 78 | ||
78 | /*-------------------------------------------------------------------------*/ | 79 | /*-------------------------------------------------------------------------*/ |
79 | 80 | ||
80 | #if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE) | 81 | #if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE) |
81 | 82 | ||
82 | #ifdef CONFIG_ARCH_OMAP2 | 83 | #ifdef CONFIG_ARCH_OMAP2 |
83 | #define OMAP_RNG_BASE 0x480A0000 | 84 | #define OMAP_RNG_BASE 0x480A0000 |
84 | #else | 85 | #else |
85 | #define OMAP_RNG_BASE 0xfffe5000 | 86 | #define OMAP_RNG_BASE 0xfffe5000 |
86 | #endif | 87 | #endif |
87 | 88 | ||
88 | static struct resource rng_resources[] = { | 89 | static struct resource rng_resources[] = { |
89 | { | 90 | { |
90 | .start = OMAP_RNG_BASE, | 91 | .start = OMAP_RNG_BASE, |
91 | .end = OMAP_RNG_BASE + 0x4f, | 92 | .end = OMAP_RNG_BASE + 0x4f, |
92 | .flags = IORESOURCE_MEM, | 93 | .flags = IORESOURCE_MEM, |
93 | }, | 94 | }, |
94 | }; | 95 | }; |
95 | 96 | ||
96 | static struct platform_device omap_rng_device = { | 97 | static struct platform_device omap_rng_device = { |
97 | .name = "omap_rng", | 98 | .name = "omap_rng", |
98 | .id = -1, | 99 | .id = -1, |
99 | .num_resources = ARRAY_SIZE(rng_resources), | 100 | .num_resources = ARRAY_SIZE(rng_resources), |
100 | .resource = rng_resources, | 101 | .resource = rng_resources, |
101 | }; | 102 | }; |
102 | 103 | ||
103 | static void omap_init_rng(void) | 104 | static void omap_init_rng(void) |
104 | { | 105 | { |
105 | (void) platform_device_register(&omap_rng_device); | 106 | (void) platform_device_register(&omap_rng_device); |
106 | } | 107 | } |
107 | #else | 108 | #else |
108 | static inline void omap_init_rng(void) {} | 109 | static inline void omap_init_rng(void) {} |
109 | #endif | 110 | #endif |
110 | 111 | ||
111 | /*-------------------------------------------------------------------------*/ | 112 | /*-------------------------------------------------------------------------*/ |
112 | 113 | ||
113 | /* Numbering for the SPI-capable controllers when used for SPI: | 114 | /* Numbering for the SPI-capable controllers when used for SPI: |
114 | * spi = 1 | 115 | * spi = 1 |
115 | * uwire = 2 | 116 | * uwire = 2 |
116 | * mmc1..2 = 3..4 | 117 | * mmc1..2 = 3..4 |
117 | * mcbsp1..3 = 5..7 | 118 | * mcbsp1..3 = 5..7 |
118 | */ | 119 | */ |
119 | 120 | ||
120 | #if defined(CONFIG_SPI_OMAP_UWIRE) || defined(CONFIG_SPI_OMAP_UWIRE_MODULE) | 121 | #if defined(CONFIG_SPI_OMAP_UWIRE) || defined(CONFIG_SPI_OMAP_UWIRE_MODULE) |
121 | 122 | ||
122 | #define OMAP_UWIRE_BASE 0xfffb3000 | 123 | #define OMAP_UWIRE_BASE 0xfffb3000 |
123 | 124 | ||
124 | static struct resource uwire_resources[] = { | 125 | static struct resource uwire_resources[] = { |
125 | { | 126 | { |
126 | .start = OMAP_UWIRE_BASE, | 127 | .start = OMAP_UWIRE_BASE, |
127 | .end = OMAP_UWIRE_BASE + 0x20, | 128 | .end = OMAP_UWIRE_BASE + 0x20, |
128 | .flags = IORESOURCE_MEM, | 129 | .flags = IORESOURCE_MEM, |
129 | }, | 130 | }, |
130 | }; | 131 | }; |
131 | 132 | ||
132 | static struct platform_device omap_uwire_device = { | 133 | static struct platform_device omap_uwire_device = { |
133 | .name = "omap_uwire", | 134 | .name = "omap_uwire", |
134 | .id = -1, | 135 | .id = -1, |
135 | .num_resources = ARRAY_SIZE(uwire_resources), | 136 | .num_resources = ARRAY_SIZE(uwire_resources), |
136 | .resource = uwire_resources, | 137 | .resource = uwire_resources, |
137 | }; | 138 | }; |
138 | 139 | ||
139 | static void omap_init_uwire(void) | 140 | static void omap_init_uwire(void) |
140 | { | 141 | { |
141 | /* FIXME define and use a boot tag; not all boards will be hooking | 142 | /* FIXME define and use a boot tag; not all boards will be hooking |
142 | * up devices to the microwire controller, and multi-board configs | 143 | * up devices to the microwire controller, and multi-board configs |
143 | * mean that CONFIG_SPI_OMAP_UWIRE may be configured anyway... | 144 | * mean that CONFIG_SPI_OMAP_UWIRE may be configured anyway... |
144 | */ | 145 | */ |
145 | 146 | ||
146 | /* board-specific code must configure chipselects (only a few | 147 | /* board-specific code must configure chipselects (only a few |
147 | * are normally used) and SCLK/SDI/SDO (each has two choices). | 148 | * are normally used) and SCLK/SDI/SDO (each has two choices). |
148 | */ | 149 | */ |
149 | (void) platform_device_register(&omap_uwire_device); | 150 | (void) platform_device_register(&omap_uwire_device); |
150 | } | 151 | } |
151 | #else | 152 | #else |
152 | static inline void omap_init_uwire(void) {} | 153 | static inline void omap_init_uwire(void) {} |
153 | #endif | 154 | #endif |
154 | 155 | ||
155 | #if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE) | 156 | #if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE) |
156 | 157 | ||
157 | static phys_addr_t omap_dsp_phys_mempool_base; | 158 | static phys_addr_t omap_dsp_phys_mempool_base; |
158 | 159 | ||
159 | void __init omap_dsp_reserve_sdram_memblock(void) | 160 | void __init omap_dsp_reserve_sdram_memblock(void) |
160 | { | 161 | { |
161 | phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE; | 162 | phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE; |
162 | phys_addr_t paddr; | 163 | phys_addr_t paddr; |
163 | 164 | ||
164 | if (!size) | 165 | if (!size) |
165 | return; | 166 | return; |
166 | 167 | ||
167 | paddr = memblock_alloc(size, SZ_1M); | 168 | paddr = arm_memblock_steal(size, SZ_1M); |
168 | if (!paddr) { | 169 | if (!paddr) { |
169 | pr_err("%s: failed to reserve %x bytes\n", | 170 | pr_err("%s: failed to reserve %x bytes\n", |
170 | __func__, size); | 171 | __func__, size); |
171 | return; | 172 | return; |
172 | } | 173 | } |
173 | memblock_free(paddr, size); | ||
174 | memblock_remove(paddr, size); | ||
175 | 174 | ||
176 | omap_dsp_phys_mempool_base = paddr; | 175 | omap_dsp_phys_mempool_base = paddr; |
177 | } | 176 | } |
178 | 177 | ||
179 | phys_addr_t omap_dsp_get_mempool_base(void) | 178 | phys_addr_t omap_dsp_get_mempool_base(void) |
180 | { | 179 | { |
181 | return omap_dsp_phys_mempool_base; | 180 | return omap_dsp_phys_mempool_base; |
182 | } | 181 | } |
183 | EXPORT_SYMBOL(omap_dsp_get_mempool_base); | 182 | EXPORT_SYMBOL(omap_dsp_get_mempool_base); |
184 | #endif | 183 | #endif |
185 | 184 | ||
186 | /* | 185 | /* |
187 | * This gets called after board-specific INIT_MACHINE, and initializes most | 186 | * This gets called after board-specific INIT_MACHINE, and initializes most |
188 | * on-chip peripherals accessible on this board (except for few like USB): | 187 | * on-chip peripherals accessible on this board (except for few like USB): |
189 | * | 188 | * |
190 | * (a) Does any "standard config" pin muxing needed. Board-specific | 189 | * (a) Does any "standard config" pin muxing needed. Board-specific |
191 | * code will have muxed GPIO pins and done "nonstandard" setup; | 190 | * code will have muxed GPIO pins and done "nonstandard" setup; |
192 | * that code could live in the boot loader. | 191 | * that code could live in the boot loader. |
193 | * (b) Populating board-specific platform_data with the data drivers | 192 | * (b) Populating board-specific platform_data with the data drivers |
194 | * rely on to handle wiring variations. | 193 | * rely on to handle wiring variations. |
195 | * (c) Creating platform devices as meaningful on this board and | 194 | * (c) Creating platform devices as meaningful on this board and |
196 | * with this kernel configuration. | 195 | * with this kernel configuration. |
197 | * | 196 | * |
198 | * Claiming GPIOs, and setting their direction and initial values, is the | 197 | * Claiming GPIOs, and setting their direction and initial values, is the |
199 | * responsibility of the device drivers. So is responding to probe(). | 198 | * responsibility of the device drivers. So is responding to probe(). |
200 | * | 199 | * |
201 | * Board-specific knowledge like creating devices or pin setup is to be | 200 | * Board-specific knowledge like creating devices or pin setup is to be |
202 | * kept out of drivers as much as possible. In particular, pin setup | 201 | * kept out of drivers as much as possible. In particular, pin setup |
203 | * may be handled by the boot loader, and drivers should expect it will | 202 | * may be handled by the boot loader, and drivers should expect it will |
204 | * normally have been done by the time they're probed. | 203 | * normally have been done by the time they're probed. |
205 | */ | 204 | */ |
206 | static int __init omap_init_devices(void) | 205 | static int __init omap_init_devices(void) |
207 | { | 206 | { |
208 | /* please keep these calls, and their implementations above, | 207 | /* please keep these calls, and their implementations above, |
209 | * in alphabetical order so they're easier to sort through. | 208 | * in alphabetical order so they're easier to sort through. |
210 | */ | 209 | */ |
211 | omap_init_rng(); | 210 | omap_init_rng(); |
212 | omap_init_uwire(); | 211 | omap_init_uwire(); |
213 | return 0; | 212 | return 0; |
214 | } | 213 | } |
215 | arch_initcall(omap_init_devices); | 214 | arch_initcall(omap_init_devices); |