aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx5
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-10-28 15:39:13 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-10-28 15:39:13 -0400
commit9bafc74163d8bccca9810159aab39be926fb877c (patch)
treebaa3ba406135247eeb9cdf495448b5db8eea2f0b /arch/arm/mach-mx5
parent8df6516864462cb7a6f87d5a46df68fb0faebbb5 (diff)
parentb3773301c4290f054aa2aa5379e59a1bf4f78bdf (diff)
Merge branch 'devel-stable' into devel
Diffstat (limited to 'arch/arm/mach-mx5')
-rw-r--r--arch/arm/mach-mx5/Kconfig2
-rw-r--r--arch/arm/mach-mx5/Makefile1
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c49
-rw-r--r--arch/arm/mach-mx5/clock-mx51.c22
-rw-r--r--arch/arm/mach-mx5/cpu_op-mx51.c29
-rw-r--r--arch/arm/mach-mx5/cpu_op-mx51.h14
-rw-r--r--arch/arm/mach-mx5/devices-imx51.h2
7 files changed, 116 insertions, 3 deletions
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index a2df9ac3799..3ec910a7a18 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
10comment "MX5 platforms:" 11comment "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 1769c161a60..462f177eddf 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.
6obj-y := cpu.o mm.o clock-mx51.o devices.o 6obj-y := cpu.o mm.o clock-mx51.o devices.o
7 7
8obj-$(CONFIG_CPU_FREQ_IMX) += cpu_op-mx51.o
8obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o 9obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o
9obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o 10obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o
10obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o 11obj-$(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 0821fe9b3b2..acbe30df2e6 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
53static 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
63static const struct gpio_keys_platform_data imx_button_data __initconst = {
64 .buttons = babbage_buttons,
65 .nbuttons = ARRAY_SIZE(babbage_buttons),
66};
67
49static struct pad_desc mx51babbage_pads[] = { 68static 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);
281static void __init mxc_board_init(void) 316static 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
309static void __init mx51_babbage_timer_init(void) 356static 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 f2aae92cf0e..8ac36d88292 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
365static unsigned long clk_arm_get_rate(struct clk *clk) 365static 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
377static 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
377static int _clk_periph_apm_set_parent(struct clk *clk, struct clk *parent) 393static 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
737static struct clk cpu_clk = { 753static 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
742static struct clk ahb_clk = { 759static 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
1069static void clk_tree_init(void) 1087static 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 00000000000..9d34c3d4c02
--- /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
18static struct cpu_op mx51_cpu_op[] = {
19 {
20 .cpu_rate = 160000000,},
21 {
22 .cpu_rate = 800000000,},
23};
24
25struct 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 00000000000..97477fecb46
--- /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
14extern 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 5cc910e6053..8c50cb5d05f 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
16extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst; 18extern 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)