1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
/*
* Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/nodemask.h>
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <linux/fsl_devices.h>
#include <linux/smsc911x.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
#include <linux/i2c.h>
#include <linux/i2c/pca953x.h>
#include <linux/ata.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <linux/pmic_external.h>
#include <linux/pmic_status.h>
#include <linux/mxcfb.h>
#include <linux/pwm_backlight.h>
#include <linux/fec.h>
#include <linux/memblock.h>
#include <linux/gpio.h>
#include <linux/etherdevice.h>
#include <linux/regulator/anatop-regulator.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h>
#include <linux/mfd/max17135.h>
#include <sound/wm8962.h>
#include <sound/pcm.h>
#include <mach/common.h>
#include <mach/hardware.h>
#include <mach/mxc_dvfs.h>
#include <mach/memory.h>
#include <mach/iomux-mx6sl.h>
#include <mach/imx-uart.h>
#include <mach/viv_gpu.h>
#include <asm/irq.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
#include "usb.h"
#include "devices-imx6q.h"
#include "crm_regs.h"
#include "cpu_op-mx6.h"
#include "board-mx6sl_arm2.h"
#define MX6_ARM2_USBOTG1_PWR IMX_GPIO_NR(4, 0) /* KEY_COL4 */
#define MX6_ARM2_USBOTG2_PWR IMX_GPIO_NR(4, 2) /* KEY_COL5 */
#define MX6_ARM2_SD1_WP IMX_GPIO_NR(4, 6) /* KEY_COL7 */
#define MX6_ARM2_SD1_CD IMX_GPIO_NR(4, 7) /* KEY_ROW7 */
#define MX6_ARM2_SD2_WP IMX_GPIO_NR(4, 29) /* SD2_DAT6 */
#define MX6_ARM2_SD2_CD IMX_GPIO_NR(5, 0) /* SD2_DAT7 */
#define MX6_ARM2_SD3_CD IMX_GPIO_NR(3, 22) /* REF_CLK_32K */
#define MX6_ARM2_FEC_PWR_EN IMX_GPIO_NR(4, 21) /* FEC_TX_CLK */
static const struct esdhc_platform_data mx6_arm2_sd1_data __initconst = {
.cd_gpio = MX6_ARM2_SD1_CD,
.wp_gpio = MX6_ARM2_SD1_WP,
.support_8bit = 1,
.keep_power_at_suspend = 1,
.delay_line = 0,
};
static const struct esdhc_platform_data mx6_arm2_sd2_data __initconst = {
.cd_gpio = MX6_ARM2_SD2_CD,
.wp_gpio = MX6_ARM2_SD2_WP,
.keep_power_at_suspend = 1,
.delay_line = 0,
};
static const struct esdhc_platform_data mx6_arm2_sd3_data __initconst = {
.cd_gpio = MX6_ARM2_SD3_CD,
.keep_power_at_suspend = 1,
.delay_line = 0,
};
void __init early_console_setup(unsigned long base, struct clk *clk);
static inline void mx6_arm2_init_uart(void)
{
imx6q_add_imx_uart(0, NULL); /* DEBUG UART1 */
imx6q_add_sdhci_usdhc_imx(0, &mx6_arm2_sd1_data);
imx6q_add_sdhci_usdhc_imx(1, &mx6_arm2_sd2_data);
imx6q_add_sdhci_usdhc_imx(2, &mx6_arm2_sd3_data);
}
static struct fec_platform_data fec_data __initdata = {
.phy = PHY_INTERFACE_MODE_RMII,
};
static void imx6_arm2_usbotg_vbus(bool on)
{
if (on)
gpio_set_value(MX6_ARM2_USBOTG1_PWR, 1);
else
gpio_set_value(MX6_ARM2_USBOTG1_PWR, 0);
}
static void __init mx6_arm2_init_usb(void)
{
int ret = 0;
imx_otg_base = MX6_IO_ADDRESS(MX6Q_USB_OTG_BASE_ADDR);
/* disable external charger detect,
* or it will affect signal quality at dp.
*/
ret = gpio_request(MX6_ARM2_USBOTG1_PWR, "usbotg-pwr");
if (ret) {
pr_err("failed to get GPIO MX6_ARM2_USBOTG1_PWR:%d\n", ret);
return;
}
gpio_direction_output(MX6_ARM2_USBOTG1_PWR, 0);
ret = gpio_request(MX6_ARM2_USBOTG2_PWR, "usbh1-pwr");
if (ret) {
pr_err("failed to get GPIO MX6_ARM2_USBOTG2_PWR:%d\n", ret);
return;
}
gpio_direction_output(MX6_ARM2_USBOTG2_PWR, 1);
mx6_set_otghost_vbus_func(imx6_arm2_usbotg_vbus);
mx6_usb_dr_init();
mx6_usb_h1_init();
#ifdef CONFIG_USB_EHCI_ARC_HSIC
mx6_usb_h2_init();
#endif
}
/*!
* Board specific initialization.
*/
static void __init mx6_arm2_init(void)
{
mxc_iomux_v3_setup_multiple_pads(mx6sl_arm2_pads, ARRAY_SIZE(mx6sl_arm2_pads));
mx6_arm2_init_uart();
/* get enet tx reference clk from FEC_REF_CLK pad.
* GPR1[14] = 0, GPR1[18:17] = 00
*/
mxc_iomux_set_gpr_register(1, 14, 1, 0);
mxc_iomux_set_gpr_register(1, 17, 2, 0);
/* power on FEC phy and reset phy */
gpio_request(MX6_ARM2_FEC_PWR_EN, "fec-pwr");
gpio_direction_output(MX6_ARM2_FEC_PWR_EN, 1);
/* wait RC ms for hw reset */
udelay(500);
imx6_init_fec(fec_data);
mx6_arm2_init_usb();
}
extern void __iomem *twd_base;
static void __init mx6_timer_init(void)
{
struct clk *uart_clk;
#ifdef CONFIG_LOCAL_TIMERS
twd_base = ioremap(LOCAL_TWD_ADDR, SZ_256);
BUG_ON(!twd_base);
#endif
mx6sl_clocks_init(32768, 24000000, 0, 0);
uart_clk = clk_get_sys("imx-uart.0", NULL);
early_console_setup(UART1_BASE_ADDR, uart_clk);
}
static struct sys_timer mxc_timer = {
.init = mx6_timer_init,
};
static void __init mx6_arm2_reserve(void)
{
}
MACHINE_START(MX6SL_ARM2, "Freescale i.MX 6SoloLite Armadillo2 Board")
.boot_params = MX6SL_PHYS_OFFSET + 0x100,
.map_io = mx6_map_io,
.init_irq = mx6_init_irq,
.init_machine = mx6_arm2_init,
.timer = &mxc_timer,
.reserve = mx6_arm2_reserve,
MACHINE_END
|