aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx5/mx51_efika.c
diff options
context:
space:
mode:
authorArnaud Patard (Rtp) <arnaud.patard@rtp-net.org>2011-02-17 09:31:28 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2011-02-18 04:56:38 -0500
commit7ac18a3845145f4f48e611640e33918ae450f955 (patch)
tree98fa07be45f359471c46c00cc1dafb5c18b74d9f /arch/arm/mach-mx5/mx51_efika.c
parent15808182ae8044a064286445bcecaee6105cd718 (diff)
Introduce EFIKA_COMMON
The Genesi EFIKA MX and EFIKA Smartbook are sharing a lot of things so it makes sense to create a common file for both devices and a specific file for each. No functionnal change except dropping uart 1 & 2. Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx5/mx51_efika.c')
-rw-r--r--arch/arm/mach-mx5/mx51_efika.c175
1 files changed, 175 insertions, 0 deletions
diff --git a/arch/arm/mach-mx5/mx51_efika.c b/arch/arm/mach-mx5/mx51_efika.c
new file mode 100644
index 000000000000..a249ca3c4138
--- /dev/null
+++ b/arch/arm/mach-mx5/mx51_efika.c
@@ -0,0 +1,175 @@
1/*
2 * based on code from the following
3 * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
4 * Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
5 * Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
6 *
7 * The code contained herein is licensed under the GNU General Public
8 * License. You may obtain a copy of the GNU General Public License
9 * Version 2 or later at the following locations:
10 *
11 * http://www.opensource.org/licenses/gpl-license.html
12 * http://www.gnu.org/copyleft/gpl.html
13 */
14
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/i2c.h>
18#include <linux/gpio.h>
19#include <linux/leds.h>
20#include <linux/input.h>
21#include <linux/delay.h>
22#include <linux/io.h>
23#include <linux/fsl_devices.h>
24#include <linux/spi/flash.h>
25#include <linux/spi/spi.h>
26
27#include <mach/common.h>
28#include <mach/hardware.h>
29#include <mach/iomux-mx51.h>
30#include <mach/i2c.h>
31#include <mach/mxc_ehci.h>
32
33#include <asm/irq.h>
34#include <asm/setup.h>
35#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37#include <asm/mach/time.h>
38
39#include "devices-imx51.h"
40#include "devices.h"
41#include "efika.h"
42
43#define MX51_USB_PLL_DIV_24_MHZ 0x01
44
45#define EFIKAMX_SPI_CS0 IMX_GPIO_NR(4, 24)
46#define EFIKAMX_SPI_CS1 IMX_GPIO_NR(4, 25)
47
48static iomux_v3_cfg_t mx51efika_pads[] = {
49 /* UART1 */
50 MX51_PAD_UART1_RXD__UART1_RXD,
51 MX51_PAD_UART1_TXD__UART1_TXD,
52 MX51_PAD_UART1_RTS__UART1_RTS,
53 MX51_PAD_UART1_CTS__UART1_CTS,
54
55 /* SD 1 */
56 MX51_PAD_SD1_CMD__SD1_CMD,
57 MX51_PAD_SD1_CLK__SD1_CLK,
58 MX51_PAD_SD1_DATA0__SD1_DATA0,
59 MX51_PAD_SD1_DATA1__SD1_DATA1,
60 MX51_PAD_SD1_DATA2__SD1_DATA2,
61 MX51_PAD_SD1_DATA3__SD1_DATA3,
62
63 /* SD 2 */
64 MX51_PAD_SD2_CMD__SD2_CMD,
65 MX51_PAD_SD2_CLK__SD2_CLK,
66 MX51_PAD_SD2_DATA0__SD2_DATA0,
67 MX51_PAD_SD2_DATA1__SD2_DATA1,
68 MX51_PAD_SD2_DATA2__SD2_DATA2,
69 MX51_PAD_SD2_DATA3__SD2_DATA3,
70
71 /* SD/MMC WP/CD */
72 MX51_PAD_GPIO1_0__SD1_CD,
73 MX51_PAD_GPIO1_1__SD1_WP,
74 MX51_PAD_GPIO1_7__SD2_WP,
75 MX51_PAD_GPIO1_8__SD2_CD,
76
77 /* spi */
78 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
79 MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
80 MX51_PAD_CSPI1_SS0__GPIO4_24,
81 MX51_PAD_CSPI1_SS1__GPIO4_25,
82 MX51_PAD_CSPI1_RDY__ECSPI1_RDY,
83 MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
84};
85
86/* Serial ports */
87static const struct imxuart_platform_data uart_pdata = {
88 .flags = IMXUART_HAVE_RTSCTS,
89};
90
91/* This function is board specific as the bit mask for the plldiv will also
92 * be different for other Freescale SoCs, thus a common bitmask is not
93 * possible and cannot get place in /plat-mxc/ehci.c.
94 */
95static int initialize_otg_port(struct platform_device *pdev)
96{
97 u32 v;
98 void __iomem *usb_base;
99 void __iomem *usbother_base;
100 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
101 if (!usb_base)
102 return -ENOMEM;
103 usbother_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET);
104
105 /* Set the PHY clock to 19.2MHz */
106 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
107 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
108 v |= MX51_USB_PLL_DIV_24_MHZ;
109 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
110 iounmap(usb_base);
111
112 mdelay(10);
113
114 return mx51_initialize_usb_hw(0, MXC_EHCI_INTERNAL_PHY);
115}
116
117static struct mxc_usbh_platform_data dr_utmi_config = {
118 .init = initialize_otg_port,
119 .portsc = MXC_EHCI_UTMI_16BIT,
120};
121
122static struct mtd_partition mx51_efika_spi_nor_partitions[] = {
123 {
124 .name = "u-boot",
125 .offset = 0,
126 .size = SZ_256K,
127 },
128 {
129 .name = "config",
130 .offset = MTDPART_OFS_APPEND,
131 .size = SZ_64K,
132 },
133};
134
135static struct flash_platform_data mx51_efika_spi_flash_data = {
136 .name = "spi_flash",
137 .parts = mx51_efika_spi_nor_partitions,
138 .nr_parts = ARRAY_SIZE(mx51_efika_spi_nor_partitions),
139 .type = "sst25vf032b",
140};
141
142static struct spi_board_info mx51_efika_spi_board_info[] __initdata = {
143 {
144 .modalias = "m25p80",
145 .max_speed_hz = 25000000,
146 .bus_num = 0,
147 .chip_select = 1,
148 .platform_data = &mx51_efika_spi_flash_data,
149 .irq = -1,
150 },
151};
152
153static int mx51_efika_spi_cs[] = {
154 EFIKAMX_SPI_CS0,
155 EFIKAMX_SPI_CS1,
156};
157
158static const struct spi_imx_master mx51_efika_spi_pdata __initconst = {
159 .chipselect = mx51_efika_spi_cs,
160 .num_chipselect = ARRAY_SIZE(mx51_efika_spi_cs),
161};
162
163void __init efika_board_common_init(void)
164{
165 mxc_iomux_v3_setup_multiple_pads(mx51efika_pads,
166 ARRAY_SIZE(mx51efika_pads));
167 mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
168 imx51_add_imx_uart(0, &uart_pdata);
169 imx51_add_sdhci_esdhc_imx(0, NULL);
170
171 spi_register_board_info(mx51_efika_spi_board_info,
172 ARRAY_SIZE(mx51_efika_spi_board_info));
173 imx51_add_ecspi(0, &mx51_efika_spi_pdata);
174}
175