aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2014-05-10 11:47:36 -0400
committerShawn Guo <shawn.guo@freescale.com>2014-05-12 21:52:49 -0400
commit8da4d6b2f7988d1742ea5b38a0fbdb01814f3596 (patch)
treea4fe62bd548fce6b9277dc89fe1e4e9fcde29ada /arch
parent000bf9ee89b4c921173cf49c0329a673aa08f516 (diff)
ARM: mx51: Remove mach-cpuimx51sd board file
eukrea_mbimxsd51-baseboard.c and mach-cpuimx51sd.c can be replaced with their devicetree equivalents: imx51-eukrea-mbimxsd51-baseboard.dts and imx51-eukrea-cpuimx51.dtsi respectively, so remove the board files. This allows the conversion of mx51 to a devicetree-only platform. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Reviewed-by: Eric Bénard <eric@eukrea.com> Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig1
-rw-r--r--arch/arm/mach-imx/Kconfig46
-rw-r--r--arch/arm/mach-imx/Makefile4
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c231
-rw-r--r--arch/arm/mach-imx/mach-cpuimx51sd.c363
5 files changed, 6 insertions, 639 deletions
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 79153d06abec..ef8815327e5b 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -32,7 +32,6 @@ CONFIG_MACH_PCM043=y
32CONFIG_MACH_MX35_3DS=y 32CONFIG_MACH_MX35_3DS=y
33CONFIG_MACH_VPR200=y 33CONFIG_MACH_VPR200=y
34CONFIG_MACH_IMX51_DT=y 34CONFIG_MACH_IMX51_DT=y
35CONFIG_MACH_EUKREA_CPUIMX51SD=y
36CONFIG_SOC_IMX50=y 35CONFIG_SOC_IMX50=y
37CONFIG_SOC_IMX53=y 36CONFIG_SOC_IMX53=y
38CONFIG_SOC_IMX6Q=y 37CONFIG_SOC_IMX6Q=y
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index d56eb1a001d8..839ef51fd390 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -702,46 +702,6 @@ endif
702 702
703if ARCH_MULTI_V7 703if ARCH_MULTI_V7
704 704
705comment "i.MX51 machines:"
706
707config MACH_IMX51_DT
708 bool "Support i.MX51 platforms from device tree"
709 select SOC_IMX51
710 help
711 Include support for Freescale i.MX51 based platforms
712 using the device tree for discovery
713
714config MACH_EUKREA_CPUIMX51SD
715 bool "Support Eukrea CPUIMX51SD module"
716 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
717 select IMX_HAVE_PLATFORM_IMX2_WDT
718 select IMX_HAVE_PLATFORM_IMX_I2C
719 select IMX_HAVE_PLATFORM_IMX_UART
720 select IMX_HAVE_PLATFORM_MXC_EHCI
721 select IMX_HAVE_PLATFORM_MXC_NAND
722 select IMX_HAVE_PLATFORM_SPI_IMX
723 select SOC_IMX51
724 help
725 Include support for Eukrea CPUIMX51SD platform. This includes
726 specific configurations for the module and its peripherals.
727
728choice
729 prompt "Baseboard"
730 depends on MACH_EUKREA_CPUIMX51SD
731 default MACH_EUKREA_MBIMXSD51_BASEBOARD
732
733config MACH_EUKREA_MBIMXSD51_BASEBOARD
734 prompt "Eukrea MBIMXSD development board"
735 bool
736 select IMX_HAVE_PLATFORM_IMX_SSI
737 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
738 select LEDS_GPIO_REGISTER
739 help
740 This adds board specific devices that can be found on Eukrea's
741 MBIMXSD evaluation board.
742
743endchoice
744
745comment "Device tree only" 705comment "Device tree only"
746 706
747config SOC_IMX50 707config SOC_IMX50
@@ -753,6 +713,12 @@ config SOC_IMX50
753 help 713 help
754 This enables support for Freescale i.MX50 processor. 714 This enables support for Freescale i.MX50 processor.
755 715
716config MACH_IMX51_DT
717 bool "i.MX51 support"
718 select SOC_IMX51
719 help
720 This enables support for Freescale i.MX51 processor
721
756config SOC_IMX53 722config SOC_IMX53
757 bool "i.MX53 support" 723 bool "i.MX53 support"
758 select HAVE_IMX_SRC 724 select HAVE_IMX_SRC
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 8dd377be88a6..572e1ab02c14 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -108,10 +108,6 @@ obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o
108endif 108endif
109obj-$(CONFIG_SOC_IMX6) += pm-imx6.o 109obj-$(CONFIG_SOC_IMX6) += pm-imx6.o
110 110
111# i.MX5 based machines
112obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += mach-cpuimx51sd.o
113obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd51-baseboard.o
114
115obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o 111obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
116obj-$(CONFIG_SOC_IMX50) += mach-imx50.o 112obj-$(CONFIG_SOC_IMX50) += mach-imx50.o
117obj-$(CONFIG_SOC_IMX53) += mach-imx53.o 113obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c
deleted file mode 100644
index 9be6c1e69d68..000000000000
--- a/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c
+++ /dev/null
@@ -1,231 +0,0 @@
1/*
2 * Copyright (C) 2010 Eric Benard - eric@eukrea.com
3 *
4 * Based on pcm970-baseboard.c which is :
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22#include <linux/types.h>
23#include <linux/init.h>
24
25#include <linux/gpio.h>
26#include <linux/interrupt.h>
27#include <linux/leds.h>
28#include <linux/platform_device.h>
29#include <linux/input.h>
30#include <linux/i2c.h>
31#include <video/platform_lcd.h>
32#include <linux/backlight.h>
33
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/time.h>
37#include <asm/mach/map.h>
38
39#include "common.h"
40#include "devices-imx51.h"
41#include "hardware.h"
42#include "iomux-mx51.h"
43
44static iomux_v3_cfg_t eukrea_mbimxsd51_pads[] = {
45 /* LED */
46 MX51_PAD_NANDF_D10__GPIO3_30,
47 /* SWITCH */
48 NEW_PAD_CTRL(MX51_PAD_NANDF_D9__GPIO3_31, PAD_CTL_PUS_22K_UP |
49 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
50 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
51 /* UART2 */
52 MX51_PAD_UART2_RXD__UART2_RXD,
53 MX51_PAD_UART2_TXD__UART2_TXD,
54 /* UART 3 */
55 MX51_PAD_UART3_RXD__UART3_RXD,
56 MX51_PAD_UART3_TXD__UART3_TXD,
57 MX51_PAD_KEY_COL4__UART3_RTS,
58 MX51_PAD_KEY_COL5__UART3_CTS,
59 /* SD */
60 MX51_PAD_SD1_CMD__SD1_CMD,
61 MX51_PAD_SD1_CLK__SD1_CLK,
62 MX51_PAD_SD1_DATA0__SD1_DATA0,
63 MX51_PAD_SD1_DATA1__SD1_DATA1,
64 MX51_PAD_SD1_DATA2__SD1_DATA2,
65 MX51_PAD_SD1_DATA3__SD1_DATA3,
66 /* SD1 CD */
67 NEW_PAD_CTRL(MX51_PAD_GPIO1_0__SD1_CD, PAD_CTL_PUS_22K_UP |
68 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
69 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
70 /* SSI */
71 MX51_PAD_AUD3_BB_TXD__AUD3_TXD,
72 MX51_PAD_AUD3_BB_RXD__AUD3_RXD,
73 MX51_PAD_AUD3_BB_CK__AUD3_TXC,
74 MX51_PAD_AUD3_BB_FS__AUD3_TXFS,
75 /* LCD Backlight */
76 MX51_PAD_DI1_D1_CS__GPIO3_4,
77 /* LCD RST */
78 MX51_PAD_CSI1_D9__GPIO3_13,
79};
80
81#define GPIO_LED1 IMX_GPIO_NR(3, 30)
82#define GPIO_SWITCH1 IMX_GPIO_NR(3, 31)
83#define GPIO_LCDRST IMX_GPIO_NR(3, 13)
84#define GPIO_LCDBL IMX_GPIO_NR(3, 4)
85
86static void eukrea_mbimxsd51_lcd_power_set(struct plat_lcd_data *pd,
87 unsigned int power)
88{
89 if (power)
90 gpio_direction_output(GPIO_LCDRST, 1);
91 else
92 gpio_direction_output(GPIO_LCDRST, 0);
93}
94
95static struct plat_lcd_data eukrea_mbimxsd51_lcd_power_data = {
96 .set_power = eukrea_mbimxsd51_lcd_power_set,
97};
98
99static struct platform_device eukrea_mbimxsd51_lcd_powerdev = {
100 .name = "platform-lcd",
101 .dev.platform_data = &eukrea_mbimxsd51_lcd_power_data,
102};
103
104static void eukrea_mbimxsd51_bl_set_intensity(int intensity)
105{
106 if (intensity)
107 gpio_direction_output(GPIO_LCDBL, 1);
108 else
109 gpio_direction_output(GPIO_LCDBL, 0);
110}
111
112static struct generic_bl_info eukrea_mbimxsd51_bl_info = {
113 .name = "eukrea_mbimxsd51-bl",
114 .max_intensity = 0xff,
115 .default_intensity = 0xff,
116 .set_bl_intensity = eukrea_mbimxsd51_bl_set_intensity,
117};
118
119static struct platform_device eukrea_mbimxsd51_bl_dev = {
120 .name = "generic-bl",
121 .id = 1,
122 .dev = {
123 .platform_data = &eukrea_mbimxsd51_bl_info,
124 },
125};
126
127static const struct gpio_led eukrea_mbimxsd51_leds[] __initconst = {
128 {
129 .name = "led1",
130 .default_trigger = "heartbeat",
131 .active_low = 1,
132 .gpio = GPIO_LED1,
133 },
134};
135
136static const struct gpio_led_platform_data
137 eukrea_mbimxsd51_led_info __initconst = {
138 .leds = eukrea_mbimxsd51_leds,
139 .num_leds = ARRAY_SIZE(eukrea_mbimxsd51_leds),
140};
141
142static struct gpio_keys_button eukrea_mbimxsd51_gpio_buttons[] = {
143 {
144 .gpio = GPIO_SWITCH1,
145 .code = BTN_0,
146 .desc = "BP1",
147 .active_low = 1,
148 .wakeup = 1,
149 },
150};
151
152static const struct gpio_keys_platform_data
153 eukrea_mbimxsd51_button_data __initconst = {
154 .buttons = eukrea_mbimxsd51_gpio_buttons,
155 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd51_gpio_buttons),
156};
157
158static const struct imxuart_platform_data uart_pdata __initconst = {
159 .flags = IMXUART_HAVE_RTSCTS,
160};
161
162static struct i2c_board_info eukrea_mbimxsd51_i2c_devices[] = {
163 {
164 I2C_BOARD_INFO("tlv320aic23", 0x1a),
165 },
166};
167
168static const
169struct imx_ssi_platform_data eukrea_mbimxsd51_ssi_pdata __initconst = {
170 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
171};
172
173static int screen_type;
174
175static int __init eukrea_mbimxsd51_screen_type(char *options)
176{
177 if (!strcmp(options, "dvi"))
178 screen_type = 1;
179 else if (!strcmp(options, "tft"))
180 screen_type = 0;
181
182 return 0;
183}
184__setup("screen_type=", eukrea_mbimxsd51_screen_type);
185
186/*
187 * system init for baseboard usage. Will be called by cpuimx51sd init.
188 *
189 * Add platform devices present on this baseboard and init
190 * them from CPU side as far as required to use them later on
191 */
192void __init eukrea_mbimxsd51_baseboard_init(void)
193{
194 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd51_pads,
195 ARRAY_SIZE(eukrea_mbimxsd51_pads)))
196 printk(KERN_ERR "error setting mbimxsd pads !\n");
197
198 imx51_add_imx_uart(1, NULL);
199 imx51_add_imx_uart(2, &uart_pdata);
200
201 imx51_add_sdhci_esdhc_imx(0, NULL);
202
203 imx51_add_imx_ssi(0, &eukrea_mbimxsd51_ssi_pdata);
204
205 gpio_request(GPIO_LED1, "LED1");
206 gpio_direction_output(GPIO_LED1, 1);
207 gpio_free(GPIO_LED1);
208
209 gpio_request(GPIO_SWITCH1, "SWITCH1");
210 gpio_direction_input(GPIO_SWITCH1);
211 gpio_free(GPIO_SWITCH1);
212
213 gpio_request(GPIO_LCDRST, "LCDRST");
214 gpio_direction_output(GPIO_LCDRST, 0);
215 gpio_request(GPIO_LCDBL, "LCDBL");
216 gpio_direction_output(GPIO_LCDBL, 0);
217 if (!screen_type) {
218 platform_device_register(&eukrea_mbimxsd51_bl_dev);
219 platform_device_register(&eukrea_mbimxsd51_lcd_powerdev);
220 } else {
221 gpio_free(GPIO_LCDRST);
222 gpio_free(GPIO_LCDBL);
223 }
224
225 i2c_register_board_info(0, eukrea_mbimxsd51_i2c_devices,
226 ARRAY_SIZE(eukrea_mbimxsd51_i2c_devices));
227
228 gpio_led_register_device(-1, &eukrea_mbimxsd51_led_info);
229 imx_add_gpio_keys(&eukrea_mbimxsd51_button_data);
230 imx_add_platform_device("eukrea_tlv320", 0, NULL, 0, NULL, 0);
231}
diff --git a/arch/arm/mach-imx/mach-cpuimx51sd.c b/arch/arm/mach-imx/mach-cpuimx51sd.c
deleted file mode 100644
index ef9d8d3762b2..000000000000
--- a/arch/arm/mach-imx/mach-cpuimx51sd.c
+++ /dev/null
@@ -1,363 +0,0 @@
1/*
2 *
3 * Copyright (C) 2010 Eric Bénard <eric@eukrea.com>
4 *
5 * based on board-mx51_babbage.c which is
6 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
7 * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com>
8 *
9 * The code contained herein is licensed under the GNU General Public
10 * License. You may obtain a copy of the GNU General Public License
11 * Version 2 or later at the following locations:
12 *
13 * http://www.opensource.org/licenses/gpl-license.html
14 * http://www.gnu.org/copyleft/gpl.html
15 */
16
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/i2c.h>
20#include <linux/i2c/tsc2007.h>
21#include <linux/gpio.h>
22#include <linux/delay.h>
23#include <linux/io.h>
24#include <linux/interrupt.h>
25#include <linux/i2c-gpio.h>
26#include <linux/spi/spi.h>
27#include <linux/can/platform/mcp251x.h>
28
29#include <asm/setup.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/time.h>
33
34#include "common.h"
35#include "devices-imx51.h"
36#include "eukrea-baseboards.h"
37#include "hardware.h"
38#include "iomux-mx51.h"
39
40#define USBH1_RST IMX_GPIO_NR(2, 28)
41#define ETH_RST IMX_GPIO_NR(2, 31)
42#define TSC2007_IRQGPIO_REV2 IMX_GPIO_NR(3, 12)
43#define TSC2007_IRQGPIO_REV3 IMX_GPIO_NR(4, 0)
44#define CAN_IRQGPIO IMX_GPIO_NR(1, 1)
45#define CAN_RST IMX_GPIO_NR(4, 15)
46#define CAN_NCS IMX_GPIO_NR(4, 24)
47#define CAN_RXOBF_REV2 IMX_GPIO_NR(1, 4)
48#define CAN_RXOBF_REV3 IMX_GPIO_NR(3, 12)
49#define CAN_RX1BF IMX_GPIO_NR(1, 6)
50#define CAN_TXORTS IMX_GPIO_NR(1, 7)
51#define CAN_TX1RTS IMX_GPIO_NR(1, 8)
52#define CAN_TX2RTS IMX_GPIO_NR(1, 9)
53#define I2C_SCL IMX_GPIO_NR(4, 16)
54#define I2C_SDA IMX_GPIO_NR(4, 17)
55
56/* USB_CTRL_1 */
57#define MX51_USB_CTRL_1_OFFSET 0x10
58#define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25)
59
60#define MX51_USB_PLLDIV_12_MHZ 0x00
61#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
62#define MX51_USB_PLL_DIV_24_MHZ 0x02
63
64static iomux_v3_cfg_t eukrea_cpuimx51sd_pads[] = {
65 /* UART1 */
66 MX51_PAD_UART1_RXD__UART1_RXD,
67 MX51_PAD_UART1_TXD__UART1_TXD,
68 MX51_PAD_UART1_RTS__UART1_RTS,
69 MX51_PAD_UART1_CTS__UART1_CTS,
70
71 /* USB HOST1 */
72 MX51_PAD_USBH1_CLK__USBH1_CLK,
73 MX51_PAD_USBH1_DIR__USBH1_DIR,
74 MX51_PAD_USBH1_NXT__USBH1_NXT,
75 MX51_PAD_USBH1_DATA0__USBH1_DATA0,
76 MX51_PAD_USBH1_DATA1__USBH1_DATA1,
77 MX51_PAD_USBH1_DATA2__USBH1_DATA2,
78 MX51_PAD_USBH1_DATA3__USBH1_DATA3,
79 MX51_PAD_USBH1_DATA4__USBH1_DATA4,
80 MX51_PAD_USBH1_DATA5__USBH1_DATA5,
81 MX51_PAD_USBH1_DATA6__USBH1_DATA6,
82 MX51_PAD_USBH1_DATA7__USBH1_DATA7,
83 MX51_PAD_USBH1_STP__USBH1_STP,
84 MX51_PAD_EIM_CS3__GPIO2_28, /* PHY nRESET */
85
86 /* FEC */
87 MX51_PAD_EIM_DTACK__GPIO2_31, /* PHY nRESET */
88
89 /* HSI2C */
90 MX51_PAD_I2C1_CLK__GPIO4_16,
91 MX51_PAD_I2C1_DAT__GPIO4_17,
92
93 /* I2C1 */
94 MX51_PAD_SD2_CMD__I2C1_SCL,
95 MX51_PAD_SD2_CLK__I2C1_SDA,
96
97 /* CAN */
98 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
99 MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
100 MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
101 MX51_PAD_CSPI1_SS0__GPIO4_24, /* nCS */
102 MX51_PAD_CSI2_PIXCLK__GPIO4_15, /* nReset */
103 MX51_PAD_GPIO1_1__GPIO1_1, /* IRQ */
104 MX51_PAD_GPIO1_4__GPIO1_4, /* Control signals */
105 MX51_PAD_GPIO1_6__GPIO1_6,
106 MX51_PAD_GPIO1_7__GPIO1_7,
107 MX51_PAD_GPIO1_8__GPIO1_8,
108 MX51_PAD_GPIO1_9__GPIO1_9,
109
110 /* Touchscreen */
111 /* IRQ */
112 NEW_PAD_CTRL(MX51_PAD_GPIO_NAND__GPIO_NAND, PAD_CTL_PUS_22K_UP |
113 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
114 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
115 NEW_PAD_CTRL(MX51_PAD_NANDF_D8__GPIO4_0, PAD_CTL_PUS_22K_UP |
116 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
117 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
118};
119
120static const struct imxuart_platform_data uart_pdata __initconst = {
121 .flags = IMXUART_HAVE_RTSCTS,
122};
123
124static int tsc2007_get_pendown_state(struct device *dev)
125{
126 if (mx51_revision() < IMX_CHIP_REVISION_3_0)
127 return !gpio_get_value(TSC2007_IRQGPIO_REV2);
128 else
129 return !gpio_get_value(TSC2007_IRQGPIO_REV3);
130}
131
132static struct tsc2007_platform_data tsc2007_info = {
133 .model = 2007,
134 .x_plate_ohms = 180,
135 .get_pendown_state = tsc2007_get_pendown_state,
136};
137
138static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = {
139 {
140 I2C_BOARD_INFO("pcf8563", 0x51),
141 }, {
142 I2C_BOARD_INFO("tsc2007", 0x49),
143 .platform_data = &tsc2007_info,
144 },
145};
146
147static const struct mxc_nand_platform_data
148 eukrea_cpuimx51sd_nand_board_info __initconst = {
149 .width = 1,
150 .hw_ecc = 1,
151 .flash_bbt = 1,
152};
153
154/* This function is board specific as the bit mask for the plldiv will also
155be different for other Freescale SoCs, thus a common bitmask is not
156possible and cannot get place in /plat-mxc/ehci.c.*/
157static int initialize_otg_port(struct platform_device *pdev)
158{
159 u32 v;
160 void __iomem *usb_base;
161 void __iomem *usbother_base;
162
163 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
164 if (!usb_base)
165 return -ENOMEM;
166 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
167
168 /* Set the PHY clock to 19.2MHz */
169 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
170 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
171 v |= MX51_USB_PLL_DIV_19_2_MHZ;
172 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
173 iounmap(usb_base);
174
175 mdelay(10);
176
177 return mx51_initialize_usb_hw(0, MXC_EHCI_INTERNAL_PHY);
178}
179
180static int initialize_usbh1_port(struct platform_device *pdev)
181{
182 u32 v;
183 void __iomem *usb_base;
184 void __iomem *usbother_base;
185
186 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
187 if (!usb_base)
188 return -ENOMEM;
189 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
190
191 /* The clock for the USBH1 ULPI port will come from the PHY. */
192 v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET);
193 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN,
194 usbother_base + MX51_USB_CTRL_1_OFFSET);
195 iounmap(usb_base);
196
197 mdelay(10);
198
199 return mx51_initialize_usb_hw(1, MXC_EHCI_POWER_PINS_ENABLED |
200 MXC_EHCI_ITC_NO_THRESHOLD);
201}
202
203static const struct mxc_usbh_platform_data dr_utmi_config __initconst = {
204 .init = initialize_otg_port,
205 .portsc = MXC_EHCI_UTMI_16BIT,
206};
207
208static const struct fsl_usb2_platform_data usb_pdata __initconst = {
209 .operating_mode = FSL_USB2_DR_DEVICE,
210 .phy_mode = FSL_USB2_PHY_UTMI_WIDE,
211};
212
213static const struct mxc_usbh_platform_data usbh1_config __initconst = {
214 .init = initialize_usbh1_port,
215 .portsc = MXC_EHCI_MODE_ULPI,
216};
217
218static bool otg_mode_host __initdata;
219
220static int __init eukrea_cpuimx51sd_otg_mode(char *options)
221{
222 if (!strcmp(options, "host"))
223 otg_mode_host = true;
224 else if (!strcmp(options, "device"))
225 otg_mode_host = false;
226 else
227 pr_info("otg_mode neither \"host\" nor \"device\". "
228 "Defaulting to device\n");
229 return 1;
230}
231__setup("otg_mode=", eukrea_cpuimx51sd_otg_mode);
232
233static struct i2c_gpio_platform_data pdata = {
234 .sda_pin = I2C_SDA,
235 .sda_is_open_drain = 0,
236 .scl_pin = I2C_SCL,
237 .scl_is_open_drain = 0,
238 .udelay = 2,
239};
240
241static struct platform_device hsi2c_gpio_device = {
242 .name = "i2c-gpio",
243 .id = 0,
244 .dev.platform_data = &pdata,
245};
246
247static struct mcp251x_platform_data mcp251x_info = {
248 .oscillator_frequency = 24E6,
249};
250
251static struct spi_board_info cpuimx51sd_spi_device[] = {
252 {
253 .modalias = "mcp2515",
254 .max_speed_hz = 10000000,
255 .bus_num = 0,
256 .mode = SPI_MODE_0,
257 .chip_select = 0,
258 .platform_data = &mcp251x_info,
259 /* irq number is run-time assigned */
260 },
261};
262
263static int cpuimx51sd_spi1_cs[] = {
264 CAN_NCS,
265};
266
267static const struct spi_imx_master cpuimx51sd_ecspi1_pdata __initconst = {
268 .chipselect = cpuimx51sd_spi1_cs,
269 .num_chipselect = ARRAY_SIZE(cpuimx51sd_spi1_cs),
270};
271
272static struct platform_device *rev2_platform_devices[] __initdata = {
273 &hsi2c_gpio_device,
274};
275
276static const struct imxi2c_platform_data cpuimx51sd_i2c_data __initconst = {
277 .bitrate = 100000,
278};
279
280static void __init eukrea_cpuimx51sd_init(void)
281{
282 imx51_soc_init();
283
284 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads,
285 ARRAY_SIZE(eukrea_cpuimx51sd_pads));
286
287 imx51_add_imx_uart(0, &uart_pdata);
288 imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info);
289 imx51_add_imx2_wdt(0);
290
291 gpio_request(ETH_RST, "eth_rst");
292 gpio_set_value(ETH_RST, 1);
293 imx51_add_fec(NULL);
294
295 gpio_request(CAN_IRQGPIO, "can_irq");
296 gpio_direction_input(CAN_IRQGPIO);
297 gpio_free(CAN_IRQGPIO);
298 gpio_request(CAN_NCS, "can_ncs");
299 gpio_direction_output(CAN_NCS, 1);
300 gpio_free(CAN_NCS);
301 gpio_request(CAN_RST, "can_rst");
302 gpio_direction_output(CAN_RST, 0);
303 msleep(20);
304 gpio_set_value(CAN_RST, 1);
305 imx51_add_ecspi(0, &cpuimx51sd_ecspi1_pdata);
306 cpuimx51sd_spi_device[0].irq = gpio_to_irq(CAN_IRQGPIO);
307 spi_register_board_info(cpuimx51sd_spi_device,
308 ARRAY_SIZE(cpuimx51sd_spi_device));
309
310 if (mx51_revision() < IMX_CHIP_REVISION_3_0) {
311 eukrea_cpuimx51sd_i2c_devices[1].irq =
312 gpio_to_irq(TSC2007_IRQGPIO_REV2),
313 platform_add_devices(rev2_platform_devices,
314 ARRAY_SIZE(rev2_platform_devices));
315 gpio_request(TSC2007_IRQGPIO_REV2, "tsc2007_irq");
316 gpio_direction_input(TSC2007_IRQGPIO_REV2);
317 gpio_free(TSC2007_IRQGPIO_REV2);
318 } else {
319 eukrea_cpuimx51sd_i2c_devices[1].irq =
320 gpio_to_irq(TSC2007_IRQGPIO_REV3),
321 imx51_add_imx_i2c(0, &cpuimx51sd_i2c_data);
322 gpio_request(TSC2007_IRQGPIO_REV3, "tsc2007_irq");
323 gpio_direction_input(TSC2007_IRQGPIO_REV3);
324 gpio_free(TSC2007_IRQGPIO_REV3);
325 }
326
327 i2c_register_board_info(0, eukrea_cpuimx51sd_i2c_devices,
328 ARRAY_SIZE(eukrea_cpuimx51sd_i2c_devices));
329
330 if (otg_mode_host)
331 imx51_add_mxc_ehci_otg(&dr_utmi_config);
332 else {
333 initialize_otg_port(NULL);
334 imx51_add_fsl_usb2_udc(&usb_pdata);
335 }
336
337 gpio_request(USBH1_RST, "usb_rst");
338 gpio_direction_output(USBH1_RST, 0);
339 msleep(20);
340 gpio_set_value(USBH1_RST, 1);
341 imx51_add_mxc_ehci_hs(1, &usbh1_config);
342
343#ifdef CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD
344 eukrea_mbimxsd51_baseboard_init();
345#endif
346}
347
348static void __init eukrea_cpuimx51sd_timer_init(void)
349{
350 mx51_clocks_init(32768, 24000000, 22579200, 0);
351}
352
353MACHINE_START(EUKREA_CPUIMX51SD, "Eukrea CPUIMX51SD")
354 /* Maintainer: Eric Bénard <eric@eukrea.com> */
355 .atag_offset = 0x100,
356 .map_io = mx51_map_io,
357 .init_early = imx51_init_early,
358 .init_irq = mx51_init_irq,
359 .init_time = eukrea_cpuimx51sd_timer_init,
360 .init_machine = eukrea_cpuimx51sd_init,
361 .init_late = imx51_init_late,
362 .restart = mxc_restart,
363MACHINE_END