diff options
27 files changed, 492 insertions, 50 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index bf7273f3dc64..9b2ef2fb3cae 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1669,6 +1669,12 @@ if ARCH_HAS_CPUFREQ | |||
1669 | 1669 | ||
1670 | source "drivers/cpufreq/Kconfig" | 1670 | source "drivers/cpufreq/Kconfig" |
1671 | 1671 | ||
1672 | config CPU_FREQ_IMX | ||
1673 | tristate "CPUfreq driver for i.MX CPUs" | ||
1674 | depends on ARCH_MXC && CPU_FREQ | ||
1675 | help | ||
1676 | This enables the CPUfreq driver for i.MX CPUs. | ||
1677 | |||
1672 | config CPU_FREQ_SA1100 | 1678 | config CPU_FREQ_SA1100 |
1673 | bool | 1679 | bool |
1674 | 1680 | ||
diff --git a/arch/arm/configs/mx51_defconfig b/arch/arm/configs/mx51_defconfig index 163cfee7644c..5c7a87260fab 100644 --- a/arch/arm/configs/mx51_defconfig +++ b/arch/arm/configs/mx51_defconfig | |||
@@ -82,6 +82,7 @@ CONFIG_FEC=y | |||
82 | CONFIG_INPUT_FF_MEMLESS=m | 82 | CONFIG_INPUT_FF_MEMLESS=m |
83 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | 83 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set |
84 | CONFIG_INPUT_EVDEV=y | 84 | CONFIG_INPUT_EVDEV=y |
85 | CONFIG_KEYBOARD_GPIO=y | ||
85 | CONFIG_INPUT_EVBUG=m | 86 | CONFIG_INPUT_EVBUG=m |
86 | CONFIG_MOUSE_PS2=m | 87 | CONFIG_MOUSE_PS2=m |
87 | CONFIG_MOUSE_PS2_ELANTECH=y | 88 | CONFIG_MOUSE_PS2_ELANTECH=y |
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c index b8bbd31aa850..84a5ba03f1ba 100644 --- a/arch/arm/mach-imx/mach-mx27_3ds.c +++ b/arch/arm/mach-imx/mach-mx27_3ds.c | |||
@@ -23,16 +23,20 @@ | |||
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/input/matrix_keypad.h> | 25 | #include <linux/input/matrix_keypad.h> |
26 | #include <linux/irq.h> | ||
26 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
28 | #include <asm/mach/time.h> | 29 | #include <asm/mach/time.h> |
29 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
30 | #include <mach/common.h> | 31 | #include <mach/common.h> |
31 | #include <mach/iomux-mx27.h> | 32 | #include <mach/iomux-mx27.h> |
33 | #include <mach/mmc.h> | ||
32 | 34 | ||
33 | #include "devices-imx27.h" | 35 | #include "devices-imx27.h" |
34 | #include "devices.h" | 36 | #include "devices.h" |
35 | 37 | ||
38 | #define SD1_EN_GPIO (GPIO_PORTB + 25) | ||
39 | |||
36 | static const int mx27pdk_pins[] __initconst = { | 40 | static const int mx27pdk_pins[] __initconst = { |
37 | /* UART1 */ | 41 | /* UART1 */ |
38 | PE12_PF_UART1_TXD, | 42 | PE12_PF_UART1_TXD, |
@@ -58,6 +62,14 @@ static const int mx27pdk_pins[] __initconst = { | |||
58 | PD15_AOUT_FEC_COL, | 62 | PD15_AOUT_FEC_COL, |
59 | PD16_AIN_FEC_TX_ER, | 63 | PD16_AIN_FEC_TX_ER, |
60 | PF23_AIN_FEC_TX_EN, | 64 | PF23_AIN_FEC_TX_EN, |
65 | /* SDHC1 */ | ||
66 | PE18_PF_SD1_D0, | ||
67 | PE19_PF_SD1_D1, | ||
68 | PE20_PF_SD1_D2, | ||
69 | PE21_PF_SD1_D3, | ||
70 | PE22_PF_SD1_CMD, | ||
71 | PE23_PF_SD1_CLK, | ||
72 | SD1_EN_GPIO | GPIO_GPIO | GPIO_OUT, | ||
61 | }; | 73 | }; |
62 | 74 | ||
63 | static const struct imxuart_platform_data uart_pdata __initconst = { | 75 | static const struct imxuart_platform_data uart_pdata __initconst = { |
@@ -85,13 +97,39 @@ static struct matrix_keymap_data mx27_3ds_keymap_data = { | |||
85 | .keymap_size = ARRAY_SIZE(mx27_3ds_keymap), | 97 | .keymap_size = ARRAY_SIZE(mx27_3ds_keymap), |
86 | }; | 98 | }; |
87 | 99 | ||
100 | static int mx27_3ds_sdhc1_init(struct device *dev, irq_handler_t detect_irq, | ||
101 | void *data) | ||
102 | { | ||
103 | return request_irq(IRQ_GPIOB(26), detect_irq, IRQF_TRIGGER_FALLING | | ||
104 | IRQF_TRIGGER_RISING, "sdhc1-card-detect", data); | ||
105 | } | ||
106 | |||
107 | static void mx27_3ds_sdhc1_exit(struct device *dev, void *data) | ||
108 | { | ||
109 | free_irq(IRQ_GPIOB(26), data); | ||
110 | } | ||
111 | |||
112 | static struct imxmmc_platform_data sdhc1_pdata = { | ||
113 | .init = mx27_3ds_sdhc1_init, | ||
114 | .exit = mx27_3ds_sdhc1_exit, | ||
115 | }; | ||
116 | |||
117 | static void mx27_3ds_sdhc1_enable_level_translator(void) | ||
118 | { | ||
119 | /* Turn on TXB0108 OE pin */ | ||
120 | gpio_request(SD1_EN_GPIO, "sd1_enable"); | ||
121 | gpio_direction_output(SD1_EN_GPIO, 1); | ||
122 | } | ||
123 | |||
88 | static void __init mx27pdk_init(void) | 124 | static void __init mx27pdk_init(void) |
89 | { | 125 | { |
90 | mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), | 126 | mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), |
91 | "mx27pdk"); | 127 | "mx27pdk"); |
128 | mx27_3ds_sdhc1_enable_level_translator(); | ||
92 | imx27_add_imx_uart0(&uart_pdata); | 129 | imx27_add_imx_uart0(&uart_pdata); |
93 | imx27_add_fec(NULL); | 130 | imx27_add_fec(NULL); |
94 | mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data); | 131 | mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data); |
132 | mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); | ||
95 | } | 133 | } |
96 | 134 | ||
97 | static void __init mx27pdk_timer_init(void) | 135 | static void __init mx27pdk_timer_init(void) |
diff --git a/arch/arm/mach-mx25/Kconfig b/arch/arm/mach-mx25/Kconfig index aa57e35ce3cd..38ca09a5df9d 100644 --- a/arch/arm/mach-mx25/Kconfig +++ b/arch/arm/mach-mx25/Kconfig | |||
@@ -6,6 +6,7 @@ config MACH_MX25_3DS | |||
6 | bool "Support MX25PDK (3DS) Platform" | 6 | bool "Support MX25PDK (3DS) Platform" |
7 | select IMX_HAVE_PLATFORM_IMX_UART | 7 | select IMX_HAVE_PLATFORM_IMX_UART |
8 | select IMX_HAVE_PLATFORM_MXC_NAND | 8 | select IMX_HAVE_PLATFORM_MXC_NAND |
9 | select IMX_HAVE_PLATFORM_ESDHC | ||
9 | 10 | ||
10 | config MACH_EUKREA_CPUIMX25 | 11 | config MACH_EUKREA_CPUIMX25 |
11 | bool "Support Eukrea CPUIMX25 Platform" | 12 | bool "Support Eukrea CPUIMX25 Platform" |
diff --git a/arch/arm/mach-mx25/mach-mx25_3ds.c b/arch/arm/mach-mx25/mach-mx25_3ds.c index 80805107a73e..f8be1eb0c062 100644 --- a/arch/arm/mach-mx25/mach-mx25_3ds.c +++ b/arch/arm/mach-mx25/mach-mx25_3ds.c | |||
@@ -96,6 +96,14 @@ static struct pad_desc mx25pdk_pads[] = { | |||
96 | MX25_PAD_KPP_COL1__KPP_COL1, | 96 | MX25_PAD_KPP_COL1__KPP_COL1, |
97 | MX25_PAD_KPP_COL2__KPP_COL2, | 97 | MX25_PAD_KPP_COL2__KPP_COL2, |
98 | MX25_PAD_KPP_COL3__KPP_COL3, | 98 | MX25_PAD_KPP_COL3__KPP_COL3, |
99 | |||
100 | /* SD1 */ | ||
101 | MX25_PAD_SD1_CMD__SD1_CMD, | ||
102 | MX25_PAD_SD1_CLK__SD1_CLK, | ||
103 | MX25_PAD_SD1_DATA0__SD1_DATA0, | ||
104 | MX25_PAD_SD1_DATA1__SD1_DATA1, | ||
105 | MX25_PAD_SD1_DATA2__SD1_DATA2, | ||
106 | MX25_PAD_SD1_DATA3__SD1_DATA3, | ||
99 | }; | 107 | }; |
100 | 108 | ||
101 | static const struct fec_platform_data mx25_fec_pdata __initconst = { | 109 | static const struct fec_platform_data mx25_fec_pdata __initconst = { |
@@ -193,6 +201,8 @@ static void __init mx25pdk_init(void) | |||
193 | mx25pdk_fec_reset(); | 201 | mx25pdk_fec_reset(); |
194 | imx25_add_fec(&mx25_fec_pdata); | 202 | imx25_add_fec(&mx25_fec_pdata); |
195 | mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data); | 203 | mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data); |
204 | |||
205 | imx25_add_esdhc(0, NULL); | ||
196 | } | 206 | } |
197 | 207 | ||
198 | static void __init mx25pdk_timer_init(void) | 208 | static void __init mx25pdk_timer_init(void) |
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig index 096fd33f8ab9..5000ac1f93e3 100644 --- a/arch/arm/mach-mx3/Kconfig +++ b/arch/arm/mach-mx3/Kconfig | |||
@@ -143,8 +143,10 @@ config MACH_ARMADILLO5X0 | |||
143 | config MACH_MX35_3DS | 143 | config MACH_MX35_3DS |
144 | bool "Support MX35PDK platform" | 144 | bool "Support MX35PDK platform" |
145 | select ARCH_MX35 | 145 | select ARCH_MX35 |
146 | select MXC_DEBUG_BOARD | ||
146 | select IMX_HAVE_PLATFORM_IMX_UART | 147 | select IMX_HAVE_PLATFORM_IMX_UART |
147 | select IMX_HAVE_PLATFORM_MXC_NAND | 148 | select IMX_HAVE_PLATFORM_MXC_NAND |
149 | select IMX_HAVE_PLATFORM_ESDHC | ||
148 | default n | 150 | default n |
149 | help | 151 | help |
150 | Include support for MX35PDK platform. This includes specific | 152 | Include support for MX35PDK platform. This includes specific |
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c index f4dff11aaee7..d4da9496089a 100644 --- a/arch/arm/mach-mx3/devices.c +++ b/arch/arm/mach-mx3/devices.c | |||
@@ -72,24 +72,24 @@ struct platform_device mxc_w1_master_device = { | |||
72 | #ifdef CONFIG_ARCH_MX31 | 72 | #ifdef CONFIG_ARCH_MX31 |
73 | static struct resource mxcsdhc0_resources[] = { | 73 | static struct resource mxcsdhc0_resources[] = { |
74 | { | 74 | { |
75 | .start = MMC_SDHC1_BASE_ADDR, | 75 | .start = MX31_MMC_SDHC1_BASE_ADDR, |
76 | .end = MMC_SDHC1_BASE_ADDR + SZ_16K - 1, | 76 | .end = MX31_MMC_SDHC1_BASE_ADDR + SZ_16K - 1, |
77 | .flags = IORESOURCE_MEM, | 77 | .flags = IORESOURCE_MEM, |
78 | }, { | 78 | }, { |
79 | .start = MXC_INT_MMC_SDHC1, | 79 | .start = MX31_INT_MMC_SDHC1, |
80 | .end = MXC_INT_MMC_SDHC1, | 80 | .end = MX31_INT_MMC_SDHC1, |
81 | .flags = IORESOURCE_IRQ, | 81 | .flags = IORESOURCE_IRQ, |
82 | }, | 82 | }, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static struct resource mxcsdhc1_resources[] = { | 85 | static struct resource mxcsdhc1_resources[] = { |
86 | { | 86 | { |
87 | .start = MMC_SDHC2_BASE_ADDR, | 87 | .start = MX31_MMC_SDHC2_BASE_ADDR, |
88 | .end = MMC_SDHC2_BASE_ADDR + SZ_16K - 1, | 88 | .end = MX31_MMC_SDHC2_BASE_ADDR + SZ_16K - 1, |
89 | .flags = IORESOURCE_MEM, | 89 | .flags = IORESOURCE_MEM, |
90 | }, { | 90 | }, { |
91 | .start = MXC_INT_MMC_SDHC2, | 91 | .start = MX31_INT_MMC_SDHC2, |
92 | .end = MXC_INT_MMC_SDHC2, | 92 | .end = MX31_INT_MMC_SDHC2, |
93 | .flags = IORESOURCE_IRQ, | 93 | .flags = IORESOURCE_IRQ, |
94 | }, | 94 | }, |
95 | }; | 95 | }; |
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c index 5c1d0e86c91e..0ad9e7821082 100644 --- a/arch/arm/mach-mx3/mach-mx31_3ds.c +++ b/arch/arm/mach-mx3/mach-mx31_3ds.c | |||
@@ -38,39 +38,9 @@ | |||
38 | #include "devices-imx31.h" | 38 | #include "devices-imx31.h" |
39 | #include "devices.h" | 39 | #include "devices.h" |
40 | 40 | ||
41 | /* Definitions for components on the Debug board */ | ||
42 | |||
43 | /* Base address of CPLD controller on the Debug board */ | ||
44 | #define DEBUG_BASE_ADDRESS CS5_IO_ADDRESS(MX3x_CS5_BASE_ADDR) | ||
45 | |||
46 | /* LAN9217 ethernet base address */ | ||
47 | #define LAN9217_BASE_ADDR MX3x_CS5_BASE_ADDR | ||
48 | |||
49 | /* CPLD config and interrupt base address */ | ||
50 | #define CPLD_ADDR (DEBUG_BASE_ADDRESS + 0x20000) | ||
51 | |||
52 | /* status, interrupt */ | ||
53 | #define CPLD_INT_STATUS_REG (CPLD_ADDR + 0x10) | ||
54 | #define CPLD_INT_MASK_REG (CPLD_ADDR + 0x38) | ||
55 | #define CPLD_INT_RESET_REG (CPLD_ADDR + 0x20) | ||
56 | /* magic word for debug CPLD */ | ||
57 | #define CPLD_MAGIC_NUMBER1_REG (CPLD_ADDR + 0x40) | ||
58 | #define CPLD_MAGIC_NUMBER2_REG (CPLD_ADDR + 0x48) | ||
59 | /* CPLD code version */ | ||
60 | #define CPLD_CODE_VER_REG (CPLD_ADDR + 0x50) | ||
61 | /* magic word for debug CPLD */ | ||
62 | #define CPLD_MAGIC_NUMBER3_REG (CPLD_ADDR + 0x58) | ||
63 | |||
64 | /* CPLD IRQ line for external uart, external ethernet etc */ | 41 | /* CPLD IRQ line for external uart, external ethernet etc */ |
65 | #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_1) | 42 | #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_1) |
66 | 43 | ||
67 | #define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START) | ||
68 | #define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE) | ||
69 | |||
70 | #define EXPIO_INT_ENET (MXC_EXP_IO_BASE + 0) | ||
71 | |||
72 | #define MXC_MAX_EXP_IO_LINES 16 | ||
73 | |||
74 | /* | 44 | /* |
75 | * This file contains the board-specific initialization routines. | 45 | * This file contains the board-specific initialization routines. |
76 | */ | 46 | */ |
@@ -272,7 +242,7 @@ static void __init mxc_board_init(void) | |||
272 | imx31_add_imx_uart0(&uart_pdata); | 242 | imx31_add_imx_uart0(&uart_pdata); |
273 | imx31_add_mxc_nand(&mx31_3ds_nand_board_info); | 243 | imx31_add_mxc_nand(&mx31_3ds_nand_board_info); |
274 | 244 | ||
275 | imx31_add_spi_imx0(&spi1_pdata); | 245 | imx31_add_spi_imx1(&spi1_pdata); |
276 | spi_register_board_info(mx31_3ds_spi_devs, | 246 | spi_register_board_info(mx31_3ds_spi_devs, |
277 | ARRAY_SIZE(mx31_3ds_spi_devs)); | 247 | ARRAY_SIZE(mx31_3ds_spi_devs)); |
278 | 248 | ||
@@ -281,9 +251,9 @@ static void __init mxc_board_init(void) | |||
281 | mx31_3ds_usbotg_init(); | 251 | mx31_3ds_usbotg_init(); |
282 | mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata); | 252 | mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata); |
283 | 253 | ||
284 | if (!mxc_expio_init(CS5_BASE_ADDR, EXPIO_PARENT_INT)) | 254 | if (mxc_expio_init(MX31_CS5_BASE_ADDR, EXPIO_PARENT_INT)) |
285 | printk(KERN_WARNING "Init of the debugboard failed, all " | 255 | printk(KERN_WARNING "Init of the debug board failed, all " |
286 | "devices on the board are unusable.\n"); | 256 | "devices on the debug board are unusable.\n"); |
287 | } | 257 | } |
288 | 258 | ||
289 | static void __init mx31_3ds_timer_init(void) | 259 | static void __init mx31_3ds_timer_init(void) |
diff --git a/arch/arm/mach-mx3/mach-mx35_3ds.c b/arch/arm/mach-mx3/mach-mx35_3ds.c index 05f628d90725..b66a75aa2e88 100644 --- a/arch/arm/mach-mx3/mach-mx35_3ds.c +++ b/arch/arm/mach-mx3/mach-mx35_3ds.c | |||
@@ -38,11 +38,15 @@ | |||
38 | #include <mach/hardware.h> | 38 | #include <mach/hardware.h> |
39 | #include <mach/common.h> | 39 | #include <mach/common.h> |
40 | #include <mach/iomux-mx35.h> | 40 | #include <mach/iomux-mx35.h> |
41 | #include <mach/irqs.h> | ||
42 | #include <mach/3ds_debugboard.h> | ||
41 | #include <mach/mxc_ehci.h> | 43 | #include <mach/mxc_ehci.h> |
42 | 44 | ||
43 | #include "devices-imx35.h" | 45 | #include "devices-imx35.h" |
44 | #include "devices.h" | 46 | #include "devices.h" |
45 | 47 | ||
48 | #define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTA + 1) | ||
49 | |||
46 | static const struct imxuart_platform_data uart_pdata __initconst = { | 50 | static const struct imxuart_platform_data uart_pdata __initconst = { |
47 | .flags = IMXUART_HAVE_RTSCTS, | 51 | .flags = IMXUART_HAVE_RTSCTS, |
48 | }; | 52 | }; |
@@ -108,6 +112,13 @@ static struct pad_desc mx35pdk_pads[] = { | |||
108 | /* USBH1 */ | 112 | /* USBH1 */ |
109 | MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR, | 113 | MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR, |
110 | MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC, | 114 | MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC, |
115 | /* SDCARD */ | ||
116 | MX35_PAD_SD1_CMD__ESDHC1_CMD, | ||
117 | MX35_PAD_SD1_CLK__ESDHC1_CLK, | ||
118 | MX35_PAD_SD1_DATA0__ESDHC1_DAT0, | ||
119 | MX35_PAD_SD1_DATA1__ESDHC1_DAT1, | ||
120 | MX35_PAD_SD1_DATA2__ESDHC1_DAT2, | ||
121 | MX35_PAD_SD1_DATA3__ESDHC1_DAT3, | ||
111 | }; | 122 | }; |
112 | 123 | ||
113 | /* OTG config */ | 124 | /* OTG config */ |
@@ -140,6 +151,11 @@ static void __init mxc_board_init(void) | |||
140 | mxc_register_device(&mxc_usbh1, &usb_host_pdata); | 151 | mxc_register_device(&mxc_usbh1, &usb_host_pdata); |
141 | 152 | ||
142 | imx35_add_mxc_nand(&mx35pdk_nand_board_info); | 153 | imx35_add_mxc_nand(&mx35pdk_nand_board_info); |
154 | imx35_add_esdhc(0, NULL); | ||
155 | |||
156 | if (mxc_expio_init(MX35_CS5_BASE_ADDR, EXPIO_PARENT_INT)) | ||
157 | pr_warn("Init of the debugboard failed, all " | ||
158 | "devices on the debugboard are unusable.\n"); | ||
143 | } | 159 | } |
144 | 160 | ||
145 | static void __init mx35pdk_timer_init(void) | 161 | static void __init mx35pdk_timer_init(void) |
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig index a2df9ac37996..3ec910a7a182 100644 --- a/arch/arm/mach-mx5/Kconfig +++ b/arch/arm/mach-mx5/Kconfig | |||
@@ -6,6 +6,7 @@ config ARCH_MX51 | |||
6 | select MXC_TZIC | 6 | select MXC_TZIC |
7 | select ARCH_MXC_IOMUX_V3 | 7 | select ARCH_MXC_IOMUX_V3 |
8 | select ARCH_MXC_AUDMUX_V2 | 8 | select ARCH_MXC_AUDMUX_V2 |
9 | select ARCH_HAS_CPUFREQ | ||
9 | 10 | ||
10 | comment "MX5 platforms:" | 11 | comment "MX5 platforms:" |
11 | 12 | ||
@@ -13,6 +14,7 @@ config MACH_MX51_BABBAGE | |||
13 | bool "Support MX51 BABBAGE platforms" | 14 | bool "Support MX51 BABBAGE platforms" |
14 | select IMX_HAVE_PLATFORM_IMX_I2C | 15 | select IMX_HAVE_PLATFORM_IMX_I2C |
15 | select IMX_HAVE_PLATFORM_IMX_UART | 16 | select IMX_HAVE_PLATFORM_IMX_UART |
17 | select IMX_HAVE_PLATFORM_ESDHC | ||
16 | help | 18 | help |
17 | Include support for MX51 Babbage platform, also known as MX51EVK in | 19 | Include support for MX51 Babbage platform, also known as MX51EVK in |
18 | u-boot. This includes specific configurations for the board and its | 20 | u-boot. This includes specific configurations for the board and its |
diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile index 1769c161a60d..462f177eddfe 100644 --- a/arch/arm/mach-mx5/Makefile +++ b/arch/arm/mach-mx5/Makefile | |||
@@ -5,6 +5,7 @@ | |||
5 | # Object file lists. | 5 | # Object file lists. |
6 | obj-y := cpu.o mm.o clock-mx51.o devices.o | 6 | obj-y := cpu.o mm.o clock-mx51.o devices.o |
7 | 7 | ||
8 | obj-$(CONFIG_CPU_FREQ_IMX) += cpu_op-mx51.o | ||
8 | obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o | 9 | obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o |
9 | obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o | 10 | obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o |
10 | obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o | 11 | obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o |
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c index 0821fe9b3b27..acbe30df2e69 100644 --- a/arch/arm/mach-mx5/board-mx51_babbage.c +++ b/arch/arm/mach-mx5/board-mx51_babbage.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved. | 2 | * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. |
3 | * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com> | 3 | * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com> |
4 | * | 4 | * |
5 | * The code contained herein is licensed under the GNU General Public | 5 | * The code contained herein is licensed under the GNU General Public |
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/fsl_devices.h> | 19 | #include <linux/fsl_devices.h> |
20 | #include <linux/fec.h> | 20 | #include <linux/fec.h> |
21 | #include <linux/gpio_keys.h> | ||
22 | #include <linux/input.h> | ||
21 | 23 | ||
22 | #include <mach/common.h> | 24 | #include <mach/common.h> |
23 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
@@ -32,11 +34,13 @@ | |||
32 | 34 | ||
33 | #include "devices-imx51.h" | 35 | #include "devices-imx51.h" |
34 | #include "devices.h" | 36 | #include "devices.h" |
37 | #include "cpu_op-mx51.h" | ||
35 | 38 | ||
36 | #define BABBAGE_USB_HUB_RESET (0*32 + 7) /* GPIO_1_7 */ | 39 | #define BABBAGE_USB_HUB_RESET (0*32 + 7) /* GPIO_1_7 */ |
37 | #define BABBAGE_USBH1_STP (0*32 + 27) /* GPIO_1_27 */ | 40 | #define BABBAGE_USBH1_STP (0*32 + 27) /* GPIO_1_27 */ |
38 | #define BABBAGE_PHY_RESET (1*32 + 5) /* GPIO_2_5 */ | 41 | #define BABBAGE_PHY_RESET (1*32 + 5) /* GPIO_2_5 */ |
39 | #define BABBAGE_FEC_PHY_RESET (1*32 + 14) /* GPIO_2_14 */ | 42 | #define BABBAGE_FEC_PHY_RESET (1*32 + 14) /* GPIO_2_14 */ |
43 | #define BABBAGE_POWER_KEY (1*32 + 21) /* GPIO_2_21 */ | ||
40 | 44 | ||
41 | /* USB_CTRL_1 */ | 45 | /* USB_CTRL_1 */ |
42 | #define MX51_USB_CTRL_1_OFFSET 0x10 | 46 | #define MX51_USB_CTRL_1_OFFSET 0x10 |
@@ -46,6 +50,21 @@ | |||
46 | #define MX51_USB_PLL_DIV_19_2_MHZ 0x01 | 50 | #define MX51_USB_PLL_DIV_19_2_MHZ 0x01 |
47 | #define MX51_USB_PLL_DIV_24_MHZ 0x02 | 51 | #define MX51_USB_PLL_DIV_24_MHZ 0x02 |
48 | 52 | ||
53 | static struct gpio_keys_button babbage_buttons[] = { | ||
54 | { | ||
55 | .gpio = BABBAGE_POWER_KEY, | ||
56 | .code = BTN_0, | ||
57 | .desc = "PWR", | ||
58 | .active_low = 1, | ||
59 | .wakeup = 1, | ||
60 | }, | ||
61 | }; | ||
62 | |||
63 | static const struct gpio_keys_platform_data imx_button_data __initconst = { | ||
64 | .buttons = babbage_buttons, | ||
65 | .nbuttons = ARRAY_SIZE(babbage_buttons), | ||
66 | }; | ||
67 | |||
49 | static struct pad_desc mx51babbage_pads[] = { | 68 | static struct pad_desc mx51babbage_pads[] = { |
50 | /* UART1 */ | 69 | /* UART1 */ |
51 | MX51_PAD_UART1_RXD__UART1_RXD, | 70 | MX51_PAD_UART1_RXD__UART1_RXD, |
@@ -112,6 +131,22 @@ static struct pad_desc mx51babbage_pads[] = { | |||
112 | 131 | ||
113 | /* FEC PHY reset line */ | 132 | /* FEC PHY reset line */ |
114 | MX51_PAD_EIM_A20__GPIO_2_14, | 133 | MX51_PAD_EIM_A20__GPIO_2_14, |
134 | |||
135 | /* SD 1 */ | ||
136 | MX51_PAD_SD1_CMD__SD1_CMD, | ||
137 | MX51_PAD_SD1_CLK__SD1_CLK, | ||
138 | MX51_PAD_SD1_DATA0__SD1_DATA0, | ||
139 | MX51_PAD_SD1_DATA1__SD1_DATA1, | ||
140 | MX51_PAD_SD1_DATA2__SD1_DATA2, | ||
141 | MX51_PAD_SD1_DATA3__SD1_DATA3, | ||
142 | |||
143 | /* SD 2 */ | ||
144 | MX51_PAD_SD2_CMD__SD2_CMD, | ||
145 | MX51_PAD_SD2_CLK__SD2_CLK, | ||
146 | MX51_PAD_SD2_DATA0__SD2_DATA0, | ||
147 | MX51_PAD_SD2_DATA1__SD2_DATA1, | ||
148 | MX51_PAD_SD2_DATA2__SD2_DATA2, | ||
149 | MX51_PAD_SD2_DATA3__SD2_DATA3, | ||
115 | }; | 150 | }; |
116 | 151 | ||
117 | /* Serial ports */ | 152 | /* Serial ports */ |
@@ -281,13 +316,22 @@ __setup("otg_mode=", babbage_otg_mode); | |||
281 | static void __init mxc_board_init(void) | 316 | static void __init mxc_board_init(void) |
282 | { | 317 | { |
283 | struct pad_desc usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP; | 318 | struct pad_desc usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP; |
319 | struct pad_desc power_key = MX51_PAD_EIM_A27__GPIO_2_21; | ||
284 | 320 | ||
321 | #if defined(CONFIG_CPU_FREQ_IMX) | ||
322 | get_cpu_op = mx51_get_cpu_op; | ||
323 | #endif | ||
285 | mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads, | 324 | mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads, |
286 | ARRAY_SIZE(mx51babbage_pads)); | 325 | ARRAY_SIZE(mx51babbage_pads)); |
287 | mxc_init_imx_uart(); | 326 | mxc_init_imx_uart(); |
288 | babbage_fec_reset(); | 327 | babbage_fec_reset(); |
289 | imx51_add_fec(NULL); | 328 | imx51_add_fec(NULL); |
290 | 329 | ||
330 | /* Set the PAD settings for the pwr key. */ | ||
331 | power_key.pad_ctrl = MX51_GPIO_PAD_CTRL_2; | ||
332 | mxc_iomux_v3_setup_pad(&power_key); | ||
333 | imx51_add_gpio_keys(&imx_button_data); | ||
334 | |||
291 | imx51_add_imx_i2c(0, &babbage_i2c_data); | 335 | imx51_add_imx_i2c(0, &babbage_i2c_data); |
292 | imx51_add_imx_i2c(1, &babbage_i2c_data); | 336 | imx51_add_imx_i2c(1, &babbage_i2c_data); |
293 | mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data); | 337 | mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data); |
@@ -304,6 +348,9 @@ static void __init mxc_board_init(void) | |||
304 | /* setback USBH1_STP to be function */ | 348 | /* setback USBH1_STP to be function */ |
305 | mxc_iomux_v3_setup_pad(&usbh1stp); | 349 | mxc_iomux_v3_setup_pad(&usbh1stp); |
306 | babbage_usbhub_reset(); | 350 | babbage_usbhub_reset(); |
351 | |||
352 | imx51_add_esdhc(0, NULL); | ||
353 | imx51_add_esdhc(1, NULL); | ||
307 | } | 354 | } |
308 | 355 | ||
309 | static void __init mx51_babbage_timer_init(void) | 356 | static void __init mx51_babbage_timer_init(void) |
diff --git a/arch/arm/mach-mx5/clock-mx51.c b/arch/arm/mach-mx5/clock-mx51.c index f2aae92cf0e2..8ac36d882927 100644 --- a/arch/arm/mach-mx5/clock-mx51.c +++ b/arch/arm/mach-mx5/clock-mx51.c | |||
@@ -362,7 +362,7 @@ static int _clk_lp_apm_set_parent(struct clk *clk, struct clk *parent) | |||
362 | return 0; | 362 | return 0; |
363 | } | 363 | } |
364 | 364 | ||
365 | static unsigned long clk_arm_get_rate(struct clk *clk) | 365 | static unsigned long clk_cpu_get_rate(struct clk *clk) |
366 | { | 366 | { |
367 | u32 cacrr, div; | 367 | u32 cacrr, div; |
368 | unsigned long parent_rate; | 368 | unsigned long parent_rate; |
@@ -374,6 +374,22 @@ static unsigned long clk_arm_get_rate(struct clk *clk) | |||
374 | return parent_rate / div; | 374 | return parent_rate / div; |
375 | } | 375 | } |
376 | 376 | ||
377 | static int clk_cpu_set_rate(struct clk *clk, unsigned long rate) | ||
378 | { | ||
379 | u32 reg, cpu_podf; | ||
380 | unsigned long parent_rate; | ||
381 | |||
382 | parent_rate = clk_get_rate(clk->parent); | ||
383 | cpu_podf = parent_rate / rate - 1; | ||
384 | /* use post divider to change freq */ | ||
385 | reg = __raw_readl(MXC_CCM_CACRR); | ||
386 | reg &= ~MXC_CCM_CACRR_ARM_PODF_MASK; | ||
387 | reg |= cpu_podf << MXC_CCM_CACRR_ARM_PODF_OFFSET; | ||
388 | __raw_writel(reg, MXC_CCM_CACRR); | ||
389 | |||
390 | return 0; | ||
391 | } | ||
392 | |||
377 | static int _clk_periph_apm_set_parent(struct clk *clk, struct clk *parent) | 393 | static int _clk_periph_apm_set_parent(struct clk *clk, struct clk *parent) |
378 | { | 394 | { |
379 | u32 reg, mux; | 395 | u32 reg, mux; |
@@ -736,7 +752,8 @@ static struct clk periph_apm_clk = { | |||
736 | 752 | ||
737 | static struct clk cpu_clk = { | 753 | static struct clk cpu_clk = { |
738 | .parent = &pll1_sw_clk, | 754 | .parent = &pll1_sw_clk, |
739 | .get_rate = clk_arm_get_rate, | 755 | .get_rate = clk_cpu_get_rate, |
756 | .set_rate = clk_cpu_set_rate, | ||
740 | }; | 757 | }; |
741 | 758 | ||
742 | static struct clk ahb_clk = { | 759 | static struct clk ahb_clk = { |
@@ -1064,6 +1081,7 @@ static struct clk_lookup lookups[] = { | |||
1064 | _REGISTER_CLOCK("imx51-cspi.0", NULL, cspi_clk) | 1081 | _REGISTER_CLOCK("imx51-cspi.0", NULL, cspi_clk) |
1065 | _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) | 1082 | _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) |
1066 | _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) | 1083 | _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) |
1084 | _REGISTER_CLOCK(NULL, "cpu_clk", cpu_clk) | ||
1067 | }; | 1085 | }; |
1068 | 1086 | ||
1069 | static void clk_tree_init(void) | 1087 | static void clk_tree_init(void) |
diff --git a/arch/arm/mach-mx5/cpu_op-mx51.c b/arch/arm/mach-mx5/cpu_op-mx51.c new file mode 100644 index 000000000000..9d34c3d4c024 --- /dev/null +++ b/arch/arm/mach-mx5/cpu_op-mx51.c | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | */ | ||
4 | |||
5 | /* | ||
6 | * The code contained herein is licensed under the GNU General Public | ||
7 | * License. You may obtain a copy of the GNU General Public License | ||
8 | * Version 2 or later at the following locations: | ||
9 | * | ||
10 | * http://www.opensource.org/licenses/gpl-license.html | ||
11 | * http://www.gnu.org/copyleft/gpl.html | ||
12 | */ | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | #include <mach/hardware.h> | ||
16 | #include <linux/kernel.h> | ||
17 | |||
18 | static struct cpu_op mx51_cpu_op[] = { | ||
19 | { | ||
20 | .cpu_rate = 160000000,}, | ||
21 | { | ||
22 | .cpu_rate = 800000000,}, | ||
23 | }; | ||
24 | |||
25 | struct cpu_op *mx51_get_cpu_op(int *op) | ||
26 | { | ||
27 | *op = ARRAY_SIZE(mx51_cpu_op); | ||
28 | return mx51_cpu_op; | ||
29 | } | ||
diff --git a/arch/arm/mach-mx5/cpu_op-mx51.h b/arch/arm/mach-mx5/cpu_op-mx51.h new file mode 100644 index 000000000000..97477fecb469 --- /dev/null +++ b/arch/arm/mach-mx5/cpu_op-mx51.h | |||
@@ -0,0 +1,14 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | */ | ||
4 | |||
5 | /* | ||
6 | * The code contained herein is licensed under the GNU General Public | ||
7 | * License. You may obtain a copy of the GNU General Public License | ||
8 | * Version 2 or later at the following locations: | ||
9 | * | ||
10 | * http://www.opensource.org/licenses/gpl-license.html | ||
11 | * http://www.gnu.org/copyleft/gpl.html | ||
12 | */ | ||
13 | |||
14 | extern struct cpu_op *mx51_get_cpu_op(int *op); | ||
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h index 5cc910e60538..8c50cb5d05f5 100644 --- a/arch/arm/mach-mx5/devices-imx51.h +++ b/arch/arm/mach-mx5/devices-imx51.h | |||
@@ -13,6 +13,8 @@ extern const struct imx_fec_data imx51_fec_data __initconst; | |||
13 | #define imx51_add_fec(pdata) \ | 13 | #define imx51_add_fec(pdata) \ |
14 | imx_add_fec(&imx51_fec_data, pdata) | 14 | imx_add_fec(&imx51_fec_data, pdata) |
15 | 15 | ||
16 | #define imx51_add_gpio_keys(pdata) imx_add_gpio_keys(pdata) | ||
17 | |||
16 | extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst; | 18 | extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst; |
17 | #define imx51_add_imx_i2c(id, pdata) \ | 19 | #define imx51_add_imx_i2c(id, pdata) \ |
18 | imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata) | 20 | imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata) |
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile index 06875b4dd70f..372670952789 100644 --- a/arch/arm/plat-mxc/Makefile +++ b/arch/arm/plat-mxc/Makefile | |||
@@ -18,6 +18,7 @@ obj-$(CONFIG_MXC_USE_EPIT) += epit.o | |||
18 | obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o | 18 | obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o |
19 | obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o | 19 | obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o |
20 | obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o | 20 | obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o |
21 | obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o | ||
21 | ifdef CONFIG_SND_IMX_SOC | 22 | ifdef CONFIG_SND_IMX_SOC |
22 | obj-y += ssi-fiq.o | 23 | obj-y += ssi-fiq.o |
23 | obj-y += ssi-fiq-ksym.o | 24 | obj-y += ssi-fiq-ksym.o |
diff --git a/arch/arm/plat-mxc/cpufreq.c b/arch/arm/plat-mxc/cpufreq.c new file mode 100644 index 000000000000..039538e68793 --- /dev/null +++ b/arch/arm/plat-mxc/cpufreq.c | |||
@@ -0,0 +1,206 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | */ | ||
4 | |||
5 | /* | ||
6 | * The code contained herein is licensed under the GNU General Public | ||
7 | * License. You may obtain a copy of the GNU General Public License | ||
8 | * Version 2 or later at the following locations: | ||
9 | * | ||
10 | * http://www.opensource.org/licenses/gpl-license.html | ||
11 | * http://www.gnu.org/copyleft/gpl.html | ||
12 | */ | ||
13 | |||
14 | /* | ||
15 | * A driver for the Freescale Semiconductor i.MXC CPUfreq module. | ||
16 | * The CPUFREQ driver is for controling CPU frequency. It allows you to change | ||
17 | * the CPU clock speed on the fly. | ||
18 | */ | ||
19 | |||
20 | #include <linux/cpufreq.h> | ||
21 | #include <linux/clk.h> | ||
22 | #include <linux/err.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <mach/hardware.h> | ||
25 | #include <mach/clock.h> | ||
26 | |||
27 | #define CLK32_FREQ 32768 | ||
28 | #define NANOSECOND (1000 * 1000 * 1000) | ||
29 | |||
30 | struct cpu_op *(*get_cpu_op)(int *op); | ||
31 | |||
32 | static int cpu_freq_khz_min; | ||
33 | static int cpu_freq_khz_max; | ||
34 | |||
35 | static struct clk *cpu_clk; | ||
36 | static struct cpufreq_frequency_table *imx_freq_table; | ||
37 | |||
38 | static int cpu_op_nr; | ||
39 | static struct cpu_op *cpu_op_tbl; | ||
40 | |||
41 | static int set_cpu_freq(int freq) | ||
42 | { | ||
43 | int ret = 0; | ||
44 | int org_cpu_rate; | ||
45 | |||
46 | org_cpu_rate = clk_get_rate(cpu_clk); | ||
47 | if (org_cpu_rate == freq) | ||
48 | return ret; | ||
49 | |||
50 | ret = clk_set_rate(cpu_clk, freq); | ||
51 | if (ret != 0) { | ||
52 | printk(KERN_DEBUG "cannot set CPU clock rate\n"); | ||
53 | return ret; | ||
54 | } | ||
55 | |||
56 | return ret; | ||
57 | } | ||
58 | |||
59 | static int mxc_verify_speed(struct cpufreq_policy *policy) | ||
60 | { | ||
61 | if (policy->cpu != 0) | ||
62 | return -EINVAL; | ||
63 | |||
64 | return cpufreq_frequency_table_verify(policy, imx_freq_table); | ||
65 | } | ||
66 | |||
67 | static unsigned int mxc_get_speed(unsigned int cpu) | ||
68 | { | ||
69 | if (cpu) | ||
70 | return 0; | ||
71 | |||
72 | return clk_get_rate(cpu_clk) / 1000; | ||
73 | } | ||
74 | |||
75 | static int mxc_set_target(struct cpufreq_policy *policy, | ||
76 | unsigned int target_freq, unsigned int relation) | ||
77 | { | ||
78 | struct cpufreq_freqs freqs; | ||
79 | int freq_Hz; | ||
80 | int ret = 0; | ||
81 | unsigned int index; | ||
82 | |||
83 | cpufreq_frequency_table_target(policy, imx_freq_table, | ||
84 | target_freq, relation, &index); | ||
85 | freq_Hz = imx_freq_table[index].frequency * 1000; | ||
86 | |||
87 | freqs.old = clk_get_rate(cpu_clk) / 1000; | ||
88 | freqs.new = freq_Hz / 1000; | ||
89 | freqs.cpu = 0; | ||
90 | freqs.flags = 0; | ||
91 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
92 | |||
93 | ret = set_cpu_freq(freq_Hz); | ||
94 | |||
95 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
96 | |||
97 | return ret; | ||
98 | } | ||
99 | |||
100 | static int __init mxc_cpufreq_init(struct cpufreq_policy *policy) | ||
101 | { | ||
102 | int ret; | ||
103 | int i; | ||
104 | |||
105 | printk(KERN_INFO "i.MXC CPU frequency driver\n"); | ||
106 | |||
107 | if (policy->cpu != 0) | ||
108 | return -EINVAL; | ||
109 | |||
110 | if (!get_cpu_op) | ||
111 | return -EINVAL; | ||
112 | |||
113 | cpu_clk = clk_get(NULL, "cpu_clk"); | ||
114 | if (IS_ERR(cpu_clk)) { | ||
115 | printk(KERN_ERR "%s: failed to get cpu clock\n", __func__); | ||
116 | return PTR_ERR(cpu_clk); | ||
117 | } | ||
118 | |||
119 | cpu_op_tbl = get_cpu_op(&cpu_op_nr); | ||
120 | |||
121 | cpu_freq_khz_min = cpu_op_tbl[0].cpu_rate / 1000; | ||
122 | cpu_freq_khz_max = cpu_op_tbl[0].cpu_rate / 1000; | ||
123 | |||
124 | imx_freq_table = kmalloc( | ||
125 | sizeof(struct cpufreq_frequency_table) * (cpu_op_nr + 1), | ||
126 | GFP_KERNEL); | ||
127 | if (!imx_freq_table) { | ||
128 | ret = -ENOMEM; | ||
129 | goto err1; | ||
130 | } | ||
131 | |||
132 | for (i = 0; i < cpu_op_nr; i++) { | ||
133 | imx_freq_table[i].index = i; | ||
134 | imx_freq_table[i].frequency = cpu_op_tbl[i].cpu_rate / 1000; | ||
135 | |||
136 | if ((cpu_op_tbl[i].cpu_rate / 1000) < cpu_freq_khz_min) | ||
137 | cpu_freq_khz_min = cpu_op_tbl[i].cpu_rate / 1000; | ||
138 | |||
139 | if ((cpu_op_tbl[i].cpu_rate / 1000) > cpu_freq_khz_max) | ||
140 | cpu_freq_khz_max = cpu_op_tbl[i].cpu_rate / 1000; | ||
141 | } | ||
142 | |||
143 | imx_freq_table[i].index = i; | ||
144 | imx_freq_table[i].frequency = CPUFREQ_TABLE_END; | ||
145 | |||
146 | policy->cur = clk_get_rate(cpu_clk) / 1000; | ||
147 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
148 | policy->min = policy->cpuinfo.min_freq = cpu_freq_khz_min; | ||
149 | policy->max = policy->cpuinfo.max_freq = cpu_freq_khz_max; | ||
150 | |||
151 | /* Manual states, that PLL stabilizes in two CLK32 periods */ | ||
152 | policy->cpuinfo.transition_latency = 2 * NANOSECOND / CLK32_FREQ; | ||
153 | |||
154 | ret = cpufreq_frequency_table_cpuinfo(policy, imx_freq_table); | ||
155 | |||
156 | if (ret < 0) { | ||
157 | printk(KERN_ERR "%s: failed to register i.MXC CPUfreq \ | ||
158 | with error code %d\n", __func__, ret); | ||
159 | goto err; | ||
160 | } | ||
161 | |||
162 | cpufreq_frequency_table_get_attr(imx_freq_table, policy->cpu); | ||
163 | return 0; | ||
164 | err: | ||
165 | kfree(imx_freq_table); | ||
166 | err1: | ||
167 | clk_put(cpu_clk); | ||
168 | return ret; | ||
169 | } | ||
170 | |||
171 | static int mxc_cpufreq_exit(struct cpufreq_policy *policy) | ||
172 | { | ||
173 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
174 | |||
175 | set_cpu_freq(cpu_freq_khz_max * 1000); | ||
176 | clk_put(cpu_clk); | ||
177 | kfree(imx_freq_table); | ||
178 | return 0; | ||
179 | } | ||
180 | |||
181 | static struct cpufreq_driver mxc_driver = { | ||
182 | .flags = CPUFREQ_STICKY, | ||
183 | .verify = mxc_verify_speed, | ||
184 | .target = mxc_set_target, | ||
185 | .get = mxc_get_speed, | ||
186 | .init = mxc_cpufreq_init, | ||
187 | .exit = mxc_cpufreq_exit, | ||
188 | .name = "imx", | ||
189 | }; | ||
190 | |||
191 | static int __devinit mxc_cpufreq_driver_init(void) | ||
192 | { | ||
193 | return cpufreq_register_driver(&mxc_driver); | ||
194 | } | ||
195 | |||
196 | static void mxc_cpufreq_driver_exit(void) | ||
197 | { | ||
198 | cpufreq_unregister_driver(&mxc_driver); | ||
199 | } | ||
200 | |||
201 | module_init(mxc_cpufreq_driver_init); | ||
202 | module_exit(mxc_cpufreq_driver_exit); | ||
203 | |||
204 | MODULE_AUTHOR("Freescale Semiconductor Inc. Yong Shen <yong.shen@linaro.org>"); | ||
205 | MODULE_DESCRIPTION("CPUfreq driver for i.MX"); | ||
206 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig index 404799487f17..9aa6f3ea9012 100644 --- a/arch/arm/plat-mxc/devices/Kconfig +++ b/arch/arm/plat-mxc/devices/Kconfig | |||
@@ -6,9 +6,13 @@ config IMX_HAVE_PLATFORM_FEC | |||
6 | default y if ARCH_MX25 || SOC_IMX27 || ARCH_MX35 || ARCH_MX51 | 6 | default y if ARCH_MX25 || SOC_IMX27 || ARCH_MX35 || ARCH_MX51 |
7 | 7 | ||
8 | config IMX_HAVE_PLATFORM_FLEXCAN | 8 | config IMX_HAVE_PLATFORM_FLEXCAN |
9 | select HAVE_CAN_FLEXCAN | 9 | select HAVE_CAN_FLEXCAN if CAN |
10 | bool | 10 | bool |
11 | 11 | ||
12 | config IMX_HAVE_PLATFORM_GPIO_KEYS | ||
13 | bool | ||
14 | default y if ARCH_MX51 | ||
15 | |||
12 | config IMX_HAVE_PLATFORM_IMX_I2C | 16 | config IMX_HAVE_PLATFORM_IMX_I2C |
13 | bool | 17 | bool |
14 | 18 | ||
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index 0a3c1f089413..45aefeb283ba 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile | |||
@@ -1,6 +1,7 @@ | |||
1 | obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o | 1 | obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o |
2 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o | 2 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o |
3 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o | 3 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o |
4 | obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o | ||
4 | obj-y += platform-imx-dma.o | 5 | obj-y += platform-imx-dma.o |
5 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o | 6 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o |
6 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o | 7 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o |
diff --git a/arch/arm/plat-mxc/devices/platform-gpio_keys.c b/arch/arm/plat-mxc/devices/platform-gpio_keys.c new file mode 100644 index 000000000000..1c53a532ea0e --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-gpio_keys.c | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version 2 | ||
7 | * of the License, or (at your option) any later version. | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program; if not, write to the Free Software | ||
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
16 | * Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | #include <asm/sizes.h> | ||
19 | #include <mach/hardware.h> | ||
20 | #include <mach/devices-common.h> | ||
21 | |||
22 | struct platform_device *__init imx_add_gpio_keys( | ||
23 | const struct gpio_keys_platform_data *pdata) | ||
24 | { | ||
25 | return imx_add_platform_device("gpio-keys", -1, NULL, | ||
26 | 0, pdata, sizeof(*pdata)); | ||
27 | } | ||
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c index 9d38da077edb..9c3e36232b5b 100644 --- a/arch/arm/plat-mxc/gpio.c +++ b/arch/arm/plat-mxc/gpio.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/interrupt.h> | ||
23 | #include <linux/io.h> | 24 | #include <linux/io.h> |
24 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
25 | #include <linux/gpio.h> | 26 | #include <linux/gpio.h> |
@@ -201,11 +202,42 @@ static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc) | |||
201 | } | 202 | } |
202 | } | 203 | } |
203 | 204 | ||
205 | /* | ||
206 | * Set interrupt number "irq" in the GPIO as a wake-up source. | ||
207 | * While system is running, all registered GPIO interrupts need to have | ||
208 | * wake-up enabled. When system is suspended, only selected GPIO interrupts | ||
209 | * need to have wake-up enabled. | ||
210 | * @param irq interrupt source number | ||
211 | * @param enable enable as wake-up if equal to non-zero | ||
212 | * @return This function returns 0 on success. | ||
213 | */ | ||
214 | static int gpio_set_wake_irq(u32 irq, u32 enable) | ||
215 | { | ||
216 | u32 gpio = irq_to_gpio(irq); | ||
217 | u32 gpio_idx = gpio & 0x1F; | ||
218 | struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32]; | ||
219 | |||
220 | if (enable) { | ||
221 | if (port->irq_high && (gpio_idx >= 16)) | ||
222 | enable_irq_wake(port->irq_high); | ||
223 | else | ||
224 | enable_irq_wake(port->irq); | ||
225 | } else { | ||
226 | if (port->irq_high && (gpio_idx >= 16)) | ||
227 | disable_irq_wake(port->irq_high); | ||
228 | else | ||
229 | disable_irq_wake(port->irq); | ||
230 | } | ||
231 | |||
232 | return 0; | ||
233 | } | ||
234 | |||
204 | static struct irq_chip gpio_irq_chip = { | 235 | static struct irq_chip gpio_irq_chip = { |
205 | .ack = gpio_ack_irq, | 236 | .ack = gpio_ack_irq, |
206 | .mask = gpio_mask_irq, | 237 | .mask = gpio_mask_irq, |
207 | .unmask = gpio_unmask_irq, | 238 | .unmask = gpio_unmask_irq, |
208 | .set_type = gpio_set_irq_type, | 239 | .set_type = gpio_set_irq_type, |
240 | .set_wake = gpio_set_wake_irq, | ||
209 | }; | 241 | }; |
210 | 242 | ||
211 | static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset, | 243 | static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset, |
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index 86d7575a564d..8c6896fd1e5f 100644 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h | |||
@@ -29,6 +29,10 @@ struct platform_device *__init imx_add_flexcan(int id, | |||
29 | resource_size_t irq, | 29 | resource_size_t irq, |
30 | const struct flexcan_platform_data *pdata); | 30 | const struct flexcan_platform_data *pdata); |
31 | 31 | ||
32 | #include <linux/gpio_keys.h> | ||
33 | struct platform_device *__init imx_add_gpio_keys( | ||
34 | const struct gpio_keys_platform_data *pdata); | ||
35 | |||
32 | #include <mach/i2c.h> | 36 | #include <mach/i2c.h> |
33 | struct imx_imx_i2c_data { | 37 | struct imx_imx_i2c_data { |
34 | int id; | 38 | int id; |
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx51.h b/arch/arm/plat-mxc/include/mach/iomux-mx51.h index e46b1c2836d4..d7a41e9a2605 100644 --- a/arch/arm/plat-mxc/include/mach/iomux-mx51.h +++ b/arch/arm/plat-mxc/include/mach/iomux-mx51.h | |||
@@ -45,6 +45,8 @@ typedef enum iomux_config { | |||
45 | PAD_CTL_PKE | PAD_CTL_HYS) | 45 | PAD_CTL_PKE | PAD_CTL_HYS) |
46 | #define MX51_GPIO_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PKE | \ | 46 | #define MX51_GPIO_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PKE | \ |
47 | PAD_CTL_SRE_FAST) | 47 | PAD_CTL_SRE_FAST) |
48 | #define MX51_GPIO_PAD_CTRL_2 (PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | \ | ||
49 | PAD_CTL_PUS_100K_UP) | ||
48 | #define MX51_ECSPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_DSE_HIGH | \ | 50 | #define MX51_ECSPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_DSE_HIGH | \ |
49 | PAD_CTL_SRE_FAST) | 51 | PAD_CTL_SRE_FAST) |
50 | #define MX51_SDHCI_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PUS_47K_UP | \ | 52 | #define MX51_SDHCI_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PUS_47K_UP | \ |
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h index 03e2afabc9fc..61cfe827498b 100644 --- a/arch/arm/plat-mxc/include/mach/mx31.h +++ b/arch/arm/plat-mxc/include/mach/mx31.h | |||
@@ -240,7 +240,6 @@ static inline void mx31_setup_weimcs(size_t cs, | |||
240 | #define MPEG4_ENC_BASE_ADDR MX31_MPEG4_ENC_BASE_ADDR | 240 | #define MPEG4_ENC_BASE_ADDR MX31_MPEG4_ENC_BASE_ADDR |
241 | #define MXC_INT_MPEG4_ENCODER MX31_INT_MPEG4_ENCODER | 241 | #define MXC_INT_MPEG4_ENCODER MX31_INT_MPEG4_ENCODER |
242 | #define MXC_INT_FIRI MX31_INT_FIRI | 242 | #define MXC_INT_FIRI MX31_INT_FIRI |
243 | #define MXC_INT_MMC_SDHC1 MX31_INT_MMC_SDHC1 | ||
244 | #define MXC_INT_MBX MX31_INT_MBX | 243 | #define MXC_INT_MBX MX31_INT_MBX |
245 | #define MXC_INT_CSPI3 MX31_INT_CSPI3 | 244 | #define MXC_INT_CSPI3 MX31_INT_CSPI3 |
246 | #define MXC_INT_SIM2 MX31_INT_SIM2 | 245 | #define MXC_INT_SIM2 MX31_INT_SIM2 |
diff --git a/arch/arm/plat-mxc/include/mach/mx35.h b/arch/arm/plat-mxc/include/mach/mx35.h index ff905cb32458..6267cff6035d 100644 --- a/arch/arm/plat-mxc/include/mach/mx35.h +++ b/arch/arm/plat-mxc/include/mach/mx35.h | |||
@@ -197,8 +197,6 @@ | |||
197 | /* these should go away */ | 197 | /* these should go away */ |
198 | #define MXC_FEC_BASE_ADDR MX35_FEC_BASE_ADDR | 198 | #define MXC_FEC_BASE_ADDR MX35_FEC_BASE_ADDR |
199 | #define MXC_INT_OWIRE MX35_INT_OWIRE | 199 | #define MXC_INT_OWIRE MX35_INT_OWIRE |
200 | #define MXC_INT_MMC_SDHC2 MX35_INT_MMC_SDHC2 | ||
201 | #define MXC_INT_MMC_SDHC3 MX35_INT_MMC_SDHC3 | ||
202 | #define MXC_INT_GPU2D MX35_INT_GPU2D | 200 | #define MXC_INT_GPU2D MX35_INT_GPU2D |
203 | #define MXC_INT_ASRC MX35_INT_ASRC | 201 | #define MXC_INT_ASRC MX35_INT_ASRC |
204 | #define MXC_INT_USBHS MX35_INT_USBHS | 202 | #define MXC_INT_USBHS MX35_INT_USBHS |
diff --git a/arch/arm/plat-mxc/include/mach/mxc.h b/arch/arm/plat-mxc/include/mach/mxc.h index a790bf212972..a42c7207082d 100644 --- a/arch/arm/plat-mxc/include/mach/mxc.h +++ b/arch/arm/plat-mxc/include/mach/mxc.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. | 2 | * Copyright 2004-2007, 2010 Freescale Semiconductor, Inc. All Rights Reserved. |
3 | * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) | 3 | * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -20,6 +20,8 @@ | |||
20 | #ifndef __ASM_ARCH_MXC_H__ | 20 | #ifndef __ASM_ARCH_MXC_H__ |
21 | #define __ASM_ARCH_MXC_H__ | 21 | #define __ASM_ARCH_MXC_H__ |
22 | 22 | ||
23 | #include <linux/types.h> | ||
24 | |||
23 | #ifndef __ASM_ARCH_MXC_HARDWARE_H__ | 25 | #ifndef __ASM_ARCH_MXC_HARDWARE_H__ |
24 | #error "Do not include directly." | 26 | #error "Do not include directly." |
25 | #endif | 27 | #endif |
@@ -133,6 +135,15 @@ extern unsigned int __mxc_cpu_type; | |||
133 | # define cpu_is_mxc91231() (0) | 135 | # define cpu_is_mxc91231() (0) |
134 | #endif | 136 | #endif |
135 | 137 | ||
138 | #ifndef __ASSEMBLY__ | ||
139 | |||
140 | struct cpu_op { | ||
141 | u32 cpu_rate; | ||
142 | }; | ||
143 | |||
144 | extern struct cpu_op *(*get_cpu_op)(int *op); | ||
145 | #endif | ||
146 | |||
136 | #if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX2) | 147 | #if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX2) |
137 | /* These are deprecated, use mx[23][157]_setup_weimcs instead. */ | 148 | /* These are deprecated, use mx[23][157]_setup_weimcs instead. */ |
138 | #define CSCR_U(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10)) | 149 | #define CSCR_U(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10)) |