1
|
/*
|
2
|
* Critical Link MityARM-335x SoM Development Kit Baseboard Initialization File
|
3
|
*
|
4
|
* Someday... Someday... most of this should be replaced with device tree....
|
5
|
*/
|
6
|
#include <linux/kernel.h>
|
7
|
#include <linux/init.h>
|
8
|
#include <linux/clk.h>
|
9
|
#include <linux/err.h>
|
10
|
#include <linux/phy.h>
|
11
|
#include <linux/usb/musb.h>
|
12
|
#include <linux/dma-mapping.h>
|
13
|
#include <linux/spi/spi.h>
|
14
|
#include <linux/spi/ads7846.h>
|
15
|
#include <linux/delay.h>
|
16
|
#include <linux/gpio.h>
|
17
|
|
18
|
/* TSc controller */
|
19
|
#include <linux/input/ti_tscadc.h>
|
20
|
#include <linux/lis3lv02d.h>
|
21
|
|
22
|
#include <video/da8xx-fb.h>
|
23
|
#include <plat/lcdc.h> /* uhhggg... */
|
24
|
#include <plat/mmc.h>
|
25
|
#include <plat/usb.h>
|
26
|
#include <plat/omap_device.h>
|
27
|
#include <plat/mcspi.h>
|
28
|
#include <plat/i2c.h>
|
29
|
|
30
|
#include <linux/wl12xx.h>
|
31
|
#include <linux/regulator/fixed.h>
|
32
|
#include <linux/regulator/machine.h>
|
33
|
#include <linux/mmc/host.h>
|
34
|
|
35
|
#include <asm/hardware/asp.h>
|
36
|
|
37
|
#include "mux.h"
|
38
|
#include "hsmmc.h"
|
39
|
#include "devices.h"
|
40
|
#include "mityarm335x.h"
|
41
|
|
42
|
#define BASEBOARD_NAME "MityARM-335x DevKit"
|
43
|
/* Vitesse 8601 register defs we need... */
|
44
|
#define VSC8601_PHY_ID (0x00070420)
|
45
|
#define VSC8601_PHY_MASK (0xFFFFFFFC)
|
46
|
#define MII_EXTPAGE (0x1F)
|
47
|
#define RGMII_SKEW (0x1C)
|
48
|
/* SMSC LAN8820 register defs we need... */
|
49
|
#define LAN8820_PHY_ID (0x0007c0e0)
|
50
|
#define LAN8820_PHY_MASK (0xFFFFFFF0)
|
51
|
#define LAN8820_CTLREG (0x00)
|
52
|
#define LAN8820_LINK100 (0X2000)
|
53
|
|
54
|
#define MITY335X_DK_SPIBUS_TS (1)
|
55
|
|
56
|
/* TODO - refactor all the pinmux stuff for all board files to use */
|
57
|
#define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))
|
58
|
|
59
|
#define MITY335X_DK_GPIO_TS_IRQ_N GPIO_TO_PIN(0, 20)
|
60
|
#define MITY335X_DK_GPIO_BACKLIGHT GPIO_TO_PIN(3, 14)
|
61
|
|
62
|
#define SANDIA_USR0 GPIO_TO_PIN(1, 21)
|
63
|
#define SANDIA_USR1 GPIO_TO_PIN(1, 22)
|
64
|
|
65
|
|
66
|
#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
|
67
|
defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
|
68
|
#define TS_USE_SPI 0 /*1 -- currently not supported*/
|
69
|
#else
|
70
|
#define TS_USE_SPI 0
|
71
|
#endif
|
72
|
|
73
|
struct pinmux_config {
|
74
|
const char *muxname;
|
75
|
int val;
|
76
|
};
|
77
|
|
78
|
|
79
|
#define setup_pin_mux(pin_mux) \
|
80
|
{ \
|
81
|
int i = 0; \
|
82
|
for (; pin_mux[i].muxname != NULL; i++) \
|
83
|
omap_mux_init_signal(pin_mux[i].muxname, pin_mux[i].val); \
|
84
|
}
|
85
|
|
86
|
/******************************************************************************
|
87
|
*
|
88
|
* N O T E
|
89
|
*
|
90
|
* PUT ALL PINMUX SETTINGS HERE
|
91
|
*
|
92
|
*****************************************************************************/
|
93
|
/*
|
94
|
static struct pinmux_config rgmii2_pin_mux[] = {
|
95
|
{"gpmc_a0.rgmii2_tctl", AM33XX_PIN_OUTPUT},
|
96
|
{"gpmc_a1.rgmii2_rctl", AM33XX_PIN_INPUT_PULLDOWN},
|
97
|
{"gpmc_a2.rgmii2_td3", AM33XX_PIN_OUTPUT},
|
98
|
{"gpmc_a3.rgmii2_td2", AM33XX_PIN_OUTPUT},
|
99
|
{"gpmc_a4.rgmii2_td1", AM33XX_PIN_OUTPUT},
|
100
|
{"gpmc_a5.rgmii2_td0", AM33XX_PIN_OUTPUT},
|
101
|
{"gpmc_a6.rgmii2_tclk", AM33XX_PIN_OUTPUT},
|
102
|
{"gpmc_a7.rgmii2_rclk", AM33XX_PIN_INPUT_PULLDOWN},
|
103
|
{"gpmc_a8.rgmii2_rd3", AM33XX_PIN_INPUT_PULLDOWN},
|
104
|
{"gpmc_a9.rgmii2_rd2", AM33XX_PIN_INPUT_PULLDOWN},
|
105
|
{"gpmc_a10.rgmii2_rd1", AM33XX_PIN_INPUT_PULLDOWN},
|
106
|
{"gpmc_a11.rgmii2_rd0", AM33XX_PIN_INPUT_PULLDOWN},
|
107
|
{"mdio_data.mdio_data", AM33XX_PIN_INPUT_PULLUP},
|
108
|
{"mdio_clk.mdio_clk", AM33XX_PIN_OUTPUT_PULLUP},
|
109
|
{NULL, 0}
|
110
|
}; */
|
111
|
static struct pinmux_config rgmii2_pin_mux[] = {
|
112
|
{"mii1_txen.rgmii1_tctl", AM33XX_PIN_OUTPUT},
|
113
|
{"mii1_rxdv.rgmii1_rctl", AM33XX_PIN_INPUT},
|
114
|
{"mii1_txd3.rgmii1_td3", AM33XX_PIN_OUTPUT},
|
115
|
{"mii1_txd2.rgmii1_td2", AM33XX_PIN_OUTPUT},
|
116
|
{"mii1_txd1.rgmii1_td1", AM33XX_PIN_OUTPUT},
|
117
|
{"mii1_txd0.rgmii1_td0", AM33XX_PIN_OUTPUT},
|
118
|
{"mii1_txclk.rgmii1_tclk", AM33XX_PIN_OUTPUT},
|
119
|
{"mii1_rxclk.rgmii1_rclk", AM33XX_PIN_INPUT},
|
120
|
{"mii1_rxd3.rgmii1_rd3", AM33XX_PIN_INPUT},
|
121
|
{"mii1_rxd2.rgmii1_rd2", AM33XX_PIN_INPUT},
|
122
|
{"mii1_rxd1.rgmii1_rd1", AM33XX_PIN_INPUT},
|
123
|
{"mii1_rxd0.rgmii1_rd0", AM33XX_PIN_INPUT},
|
124
|
{"rmii1_refclk.rmii1_refclk", AM33XX_PIN_OUTPUT},
|
125
|
{"mdio_data.mdio_data", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
|
126
|
{"mdio_clk.mdio_clk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT_PULLUP},
|
127
|
{NULL, 0},
|
128
|
};
|
129
|
|
130
|
static struct pinmux_config lcdc_pin_mux[] = {
|
131
|
{"lcd_data0.lcd_data0", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
132
|
{"lcd_data1.lcd_data1", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
133
|
{"lcd_data2.lcd_data2", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
134
|
{"lcd_data3.lcd_data3", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
135
|
{"lcd_data4.lcd_data4", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
136
|
{"lcd_data5.lcd_data5", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
137
|
{"lcd_data6.lcd_data6", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
138
|
{"lcd_data7.lcd_data7", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
139
|
{"lcd_data8.lcd_data8", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
140
|
{"lcd_data9.lcd_data9", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
141
|
{"lcd_data10.lcd_data10", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
142
|
{"lcd_data11.lcd_data11", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
143
|
{"lcd_data12.lcd_data12", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
144
|
{"lcd_data13.lcd_data13", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
145
|
{"lcd_data14.lcd_data14", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
146
|
{"lcd_data15.lcd_data15", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
147
|
{"lcd_vsync.lcd_vsync", AM33XX_PIN_OUTPUT},
|
148
|
{"lcd_hsync.lcd_hsync", AM33XX_PIN_OUTPUT},
|
149
|
{"lcd_pclk.lcd_pclk", AM33XX_PIN_OUTPUT},
|
150
|
{"lcd_ac_bias_en.lcd_ac_bias_en", AM33XX_PIN_OUTPUT},
|
151
|
/* GPIO for the backlight */
|
152
|
{ "mcasp0_aclkx.gpio3_14", AM33XX_PIN_OUTPUT},
|
153
|
{NULL, 0}
|
154
|
};
|
155
|
/*
|
156
|
static struct pinmux_config mmc0_pin_mux[] = {
|
157
|
{"mmc0_dat3.mmc0_dat3", AM33XX_PIN_INPUT_PULLUP},
|
158
|
{"mmc0_dat2.mmc0_dat2", AM33XX_PIN_INPUT_PULLUP},
|
159
|
{"mmc0_dat1.mmc0_dat1", AM33XX_PIN_INPUT_PULLUP},
|
160
|
{"mmc0_dat0.mmc0_dat0", AM33XX_PIN_INPUT_PULLUP},
|
161
|
{"mmc0_clk.mmc0_clk", AM33XX_PIN_INPUT_PULLUP},
|
162
|
{"mmc0_cmd.mmc0_cmd", AM33XX_PIN_INPUT_PULLUP},
|
163
|
{"mii1_txen.gpio3_3", AM33XX_PIN_INPUT_PULLUP}, // SD Card Detect
|
164
|
{"mii1_col.gpio3_0", AM33XX_PIN_INPUT_PULLUP}, // SD Write Protect
|
165
|
{NULL, 0}
|
166
|
}; */
|
167
|
|
168
|
// sandia0_pin_mux
|
169
|
static struct pinmux_config sandia0_pin_mux[] = {
|
170
|
{"gpmc_a4.gpio1_20", AM33XX_PIN_OUTPUT}, //lcd enable
|
171
|
{"gpmc_a5.gpio1_21", AM33XX_PIN_OUTPUT}, // usrled0
|
172
|
{"gpmc_a6.gpio1_22", AM33XX_PIN_OUTPUT}, // usrled1
|
173
|
{"gpmc_a9.gpio1_25", AM33XX_PIN_INPUT_PULLUP}, // touchscreen interrrupt
|
174
|
/*{"mcasp0_clkx.ehrpwm0a", AM33XX_PIN_OUTPUT}, // lcd pwm*/
|
175
|
{NULL, 0}
|
176
|
};
|
177
|
|
178
|
//
|
179
|
//
|
180
|
|
181
|
static struct pinmux_config mmc0_pin_mux[] = {
|
182
|
{"mmc0_dat3.mmc0_dat3", AM33XX_PIN_INPUT_PULLUP},
|
183
|
{"mmc0_dat2.mmc0_dat2", AM33XX_PIN_INPUT_PULLUP},
|
184
|
{"mmc0_dat1.mmc0_dat1", AM33XX_PIN_INPUT_PULLUP},
|
185
|
{"mmc0_dat0.mmc0_dat0", AM33XX_PIN_INPUT_PULLUP},
|
186
|
{"mmc0_clk.mmc0_clk", AM33XX_PIN_INPUT_PULLUP},
|
187
|
{"mmc0_cmd.mmc0_cmd", AM33XX_PIN_INPUT_PULLUP},
|
188
|
{"gpmc_a1.gpio1_17", AM33XX_PIN_INPUT_PULLDOWN}, /* SD Card Detect */
|
189
|
{"gpmc_a3.gpio1_19", AM33XX_PIN_INPUT_PULLDOWN}, /* SD Write Protect */
|
190
|
{NULL, 0}
|
191
|
};
|
192
|
|
193
|
|
194
|
/**
|
195
|
* Expansion connector pins for SDIO
|
196
|
* Pin WifiJ1 DevJ700 335X PIN/Function
|
197
|
* 1 SDIO_D3 GPMC_AD15 GPMC_AD15/MMC2_DAT3
|
198
|
* 3 SDIO_D2 GPMC_AD14 GPMC_AD14/MMC2_DAT2
|
199
|
* 5 SDIO_D1 GPMC_AD13 GPMC_AD13/MMC2_DAT1
|
200
|
* 7 SDIO_D0 GPMC_AD12 GPMC_AD12/MMC2_DAT0
|
201
|
* 9 RESET GPMC_AD11 GPMC_AD11/GPIO2_27
|
202
|
* 22 SDIO_CMD GPMC_CS3_N GPMC_CSN3/MMC2_CMD
|
203
|
* 30 SDIO_CLK GPMC_CLK GPMC_CLK/MMC2_CLK
|
204
|
*/
|
205
|
static struct pinmux_config mmc2_pin_mux[] = {
|
206
|
{"gpmc_ad15.mmc2_dat3", AM33XX_PIN_INPUT_PULLUP},
|
207
|
{"gpmc_ad14.mmc2_dat2", AM33XX_PIN_INPUT_PULLUP},
|
208
|
{"gpmc_ad13.mmc2_dat1", AM33XX_PIN_INPUT_PULLUP},
|
209
|
{"gpmc_ad12.mmc2_dat0", AM33XX_PIN_INPUT_PULLUP},
|
210
|
{"gpmc_clk.mmc2_clk", AM33XX_PIN_INPUT_PULLUP},
|
211
|
{"gpmc_csn3.mmc2_cmd", AM33XX_PIN_INPUT_PULLUP},
|
212
|
{NULL, 0}
|
213
|
};
|
214
|
|
215
|
|
216
|
static struct pinmux_config can_pin_mux[] = {
|
217
|
{"uart1_rxd.d_can1_tx", AM33XX_PULL_ENBL},
|
218
|
{"uart1_txd.d_can1_rx", AM33XX_PIN_INPUT_PULLUP},
|
219
|
{"mii1_txd3.d_can0_tx", AM33XX_PULL_ENBL},
|
220
|
{"mii1_txd2.d_can0_rx", AM33XX_PIN_INPUT_PULLUP},
|
221
|
{NULL, 0}
|
222
|
};
|
223
|
|
224
|
static struct pinmux_config expansion_pin_mux[] = {
|
225
|
{"uart0_ctsn.uart4_rxd", AM33XX_PIN_INPUT_PULLUP}, /* Exp0 RX */
|
226
|
{"uart0_rtsn.uart4_txd", AM33XX_PULL_ENBL}, /* Exp0 TX */
|
227
|
{"mii1_rxd3.uart3_rxd", AM33XX_PIN_INPUT_PULLUP}, /* Exp1 RX */
|
228
|
{"mii1_rxd2.uart3_txd", AM33XX_PULL_ENBL}, /* Exp1 TX */
|
229
|
{"mii1_rxd1.gpio2_20", AM33XX_PULL_ENBL}, /* Exp1 TX EN */
|
230
|
{"mii1_txclk.gpio3_9", AM33XX_PULL_ENBL}, /* Exp0 TX EN */
|
231
|
{NULL, 0}
|
232
|
};
|
233
|
|
234
|
static struct pinmux_config usb_pin_mux[] = {
|
235
|
{"usb0_drvvbus.usb0_drvvbus", AM33XX_PIN_OUTPUT},
|
236
|
{"usb1_drvvbus.usb1_drvvbus", AM33XX_PIN_OUTPUT},
|
237
|
{NULL, 0}
|
238
|
};
|
239
|
|
240
|
#if (TS_USE_SPI)
|
241
|
static struct pinmux_config ts_pin_mux[] = {
|
242
|
/* SPI0 CS0 taken care of by SPI pinmux setup */
|
243
|
{"xdma_event_intr1.gpio0_20", AM33XX_PIN_INPUT}, /* Pen down */
|
244
|
{"xdma_event_intr0.gpio0_19", AM33XX_PIN_INPUT}, /* 7843 busy (not used)*/
|
245
|
{NULL, 0}
|
246
|
};
|
247
|
#endif
|
248
|
|
249
|
/* Module pin mux for mcasp1 */
|
250
|
static struct pinmux_config mcasp1_pin_mux[] = {
|
251
|
{"mcasp0_aclkr.mcasp1_aclkx", AM33XX_PIN_INPUT_PULLDOWN},
|
252
|
{"mcasp0_fsr.mcasp1_fsx", AM33XX_PIN_INPUT_PULLDOWN},
|
253
|
{"mcasp0_axr1.mcasp1_axr0", AM33XX_PIN_OUTPUT},
|
254
|
{"mcasp0_ahclkx.mcasp1_axr1", AM33XX_PIN_INPUT_PULLDOWN},
|
255
|
{"mii1_rxd0.mcasp1_ahclkr", AM33XX_PIN_INPUT_PULLDOWN},
|
256
|
//{"rmii1_refclk.mcasp1_ahclkx", AM33XX_PIN_INPUT_PULLDOWN},
|
257
|
{NULL, 0},
|
258
|
};
|
259
|
|
260
|
|
261
|
static struct pinmux_config i2c0_pin_mux[] = {
|
262
|
{"i2c0_sda.i2c0_sda", AM33XX_SLEWCTRL_SLOW | AM33XX_PULL_ENBL |
|
263
|
AM33XX_INPUT_EN | AM33XX_PIN_OUTPUT},
|
264
|
{"i2c0_scl.i2c0_scl", AM33XX_SLEWCTRL_SLOW | AM33XX_PULL_ENBL |
|
265
|
AM33XX_INPUT_EN | AM33XX_PIN_OUTPUT},
|
266
|
{NULL, 0},
|
267
|
};
|
268
|
|
269
|
static struct pinmux_config spi0_pin_mux[] = {
|
270
|
{"spi0_cs0.spi0_cs0", AM33XX_PIN_OUTPUT_PULLUP},
|
271
|
{"spi0_cs1.spi0_cs1", AM33XX_PIN_OUTPUT_PULLUP},
|
272
|
{"spi0_sclk.spi0_sclk", AM33XX_PIN_OUTPUT_PULLUP},
|
273
|
{"spi0_d0.spi0_d0", AM33XX_PIN_OUTPUT},
|
274
|
{"spi0_d1.spi0_d1", AM33XX_PULL_ENBL | AM33XX_INPUT_EN},
|
275
|
{NULL, 0},
|
276
|
};
|
277
|
|
278
|
|
279
|
static struct pinmux_config tsc_pin_mux[] = {
|
280
|
{"ain0.ain0", AM33XX_INPUT_EN},
|
281
|
{"ain1.ain1", AM33XX_INPUT_EN},
|
282
|
{"ain2.ain2", AM33XX_INPUT_EN},
|
283
|
{"ain3.ain3", AM33XX_INPUT_EN},
|
284
|
{"vrefp.vrefp", AM33XX_INPUT_EN},
|
285
|
{"vrefn.vrefn", AM33XX_INPUT_EN},
|
286
|
{NULL, 0},
|
287
|
};
|
288
|
|
289
|
static struct pinmux_config wl12xx_pin_mux[] = {
|
290
|
{"gpmc_ad10.gpio0_26", AM33XX_PIN_INPUT}, /* WL WL IRQ */
|
291
|
{"gpmc_ad11.gpio0_27", AM33XX_PIN_INPUT}, /* WL SPI I/O RST */
|
292
|
{"gpmc_csn1.gpio1_30", AM33XX_PIN_INPUT_PULLUP}, /* WL IRQ */
|
293
|
{"gpmc_csn2.gpio1_31", AM33XX_PIN_OUTPUT}, /* BT RST ?*/
|
294
|
{NULL, 0},
|
295
|
};
|
296
|
|
297
|
#define AM335XEVM_WLAN_IRQ_GPIO GPIO_TO_PIN(0, 26)
|
298
|
|
299
|
struct wl12xx_platform_data am335x_wlan_data = {
|
300
|
.irq = OMAP_GPIO_IRQ(AM335XEVM_WLAN_IRQ_GPIO),
|
301
|
.board_ref_clock = WL12XX_REFCLOCK_38_XTAL, /* 38.4Mhz */
|
302
|
};
|
303
|
|
304
|
static struct omap2_hsmmc_info mmc_info[] __initdata = {
|
305
|
{
|
306
|
.mmc = 1,
|
307
|
.caps = MMC_CAP_4_BIT_DATA,
|
308
|
.gpio_cd = GPIO_TO_PIN(1, 17),
|
309
|
.gpio_wp = GPIO_TO_PIN(1, 19),
|
310
|
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
|
311
|
},
|
312
|
{
|
313
|
.mmc = 0, /* will be set at runtime */
|
314
|
},
|
315
|
{
|
316
|
.mmc = 0, /* will be set at runtime */
|
317
|
},
|
318
|
{} /* Terminator */
|
319
|
};
|
320
|
|
321
|
static __init void baseboard_setup_expansion(void)
|
322
|
{
|
323
|
setup_pin_mux(expansion_pin_mux);
|
324
|
}
|
325
|
|
326
|
static __init void baseboard_setup_can(void)
|
327
|
{
|
328
|
setup_pin_mux(can_pin_mux);
|
329
|
|
330
|
am33xx_d_can_init(0);
|
331
|
am33xx_d_can_init(1);
|
332
|
}
|
333
|
|
334
|
static struct omap_musb_board_data board_data = {
|
335
|
.interface_type = MUSB_INTERFACE_ULPI,
|
336
|
.mode = MUSB_OTG,
|
337
|
.power = 500,
|
338
|
.instances = 1,
|
339
|
};
|
340
|
|
341
|
static __init void baseboard_setup_usb(void)
|
342
|
{
|
343
|
setup_pin_mux(usb_pin_mux);
|
344
|
usb_musb_init(&board_data);
|
345
|
}
|
346
|
|
347
|
static __init void baseboard_setup_mmc(void)
|
348
|
{
|
349
|
/* pin mux */
|
350
|
setup_pin_mux(mmc0_pin_mux);
|
351
|
|
352
|
/* configure mmc */
|
353
|
omap2_hsmmc_init(mmc_info);
|
354
|
}
|
355
|
|
356
|
static __init void baseboard_setup_sandia(void)
|
357
|
{
|
358
|
/* pin mux */
|
359
|
setup_pin_mux(sandia0_pin_mux);
|
360
|
|
361
|
/* configure mmc */
|
362
|
// omap2_hsmmc_init(mmc_info);
|
363
|
}
|
364
|
|
365
|
|
366
|
static const struct display_panel disp_panel = {
|
367
|
WVGA, /* panel_type */
|
368
|
32, /* max_bpp */
|
369
|
16, /* min_bpp */
|
370
|
COLOR_ACTIVE, /* panel_shade */
|
371
|
};
|
372
|
|
373
|
static struct lcd_ctrl_config dvi_cfg = {
|
374
|
.p_disp_panel = &disp_panel,
|
375
|
.ac_bias = 255,
|
376
|
.ac_bias_intrpt = 0,
|
377
|
.dma_burst_sz = 16,
|
378
|
.bpp = 16,
|
379
|
.fdd = 0x80,
|
380
|
.tft_alt_mode = 0,
|
381
|
.stn_565_mode = 0,
|
382
|
.mono_8bit_mode = 0,
|
383
|
.invert_line_clock = 1,
|
384
|
.invert_frm_clock = 1,
|
385
|
.sync_edge = 0,
|
386
|
.sync_ctrl = 1,
|
387
|
.raster_order = 0,
|
388
|
};
|
389
|
|
390
|
/* TODO - should really update driver to support VESA mode timings... */
|
391
|
struct da8xx_lcdc_platform_data dvi_pdata = {
|
392
|
.manu_name = "VESA",
|
393
|
.controller_data = &dvi_cfg,
|
394
|
.type = "800x600",
|
395
|
};
|
396
|
#ifdef CONFIG_BACKLIGHT_TPS6116X
|
397
|
|
398
|
static struct platform_device tps6116x_device = {
|
399
|
.name = "tps6116x",
|
400
|
.id = -1,
|
401
|
.dev = {
|
402
|
.platform_data = (void *)MITY335X_DK_GPIO_BACKLIGHT,
|
403
|
},
|
404
|
};
|
405
|
#endif /* CONFIG_BACKLIGHT_TPS6116X */
|
406
|
|
407
|
|
408
|
#if (TS_USE_SPI)
|
409
|
static struct ads7846_platform_data ads7846_config = {
|
410
|
.model = 7843,
|
411
|
.vref_mv = 3300,
|
412
|
.x_max = 0x0fff,
|
413
|
.y_max = 0x0fff,
|
414
|
.x_plate_ohms = 180,
|
415
|
.pressure_max = 255,
|
416
|
.debounce_max = 0, /* 200, */
|
417
|
.debounce_tol = 5,
|
418
|
.debounce_rep = 10,
|
419
|
.gpio_pendown = MITY335X_DK_GPIO_TS_IRQ_N,
|
420
|
.keep_vref_on = 1,
|
421
|
.irq_flags = IRQF_TRIGGER_FALLING,
|
422
|
.vref_delay_usecs = 100,
|
423
|
.settle_delay_usecs = 200,
|
424
|
.penirq_recheck_delay_usecs = 1000,
|
425
|
.filter_init = 0,
|
426
|
.filter = 0,
|
427
|
.filter_cleanup = 0,
|
428
|
.gpio_pendown = MITY335X_DK_GPIO_TS_IRQ_N,
|
429
|
};
|
430
|
|
431
|
static __init void baseboard_setup_ts(void)
|
432
|
{
|
433
|
setup_pin_mux(ts_pin_mux);
|
434
|
/* SPI hookup already done by baseboard_setup_spi0() */
|
435
|
}
|
436
|
#else
|
437
|
|
438
|
static struct tsc_data am335x_touchscreen_data = {
|
439
|
.wires = 4,
|
440
|
.analog_input = 1,
|
441
|
.x_plate_resistance = 200,
|
442
|
};
|
443
|
|
444
|
static __init void baseboard_setup_ts(void)
|
445
|
{
|
446
|
int err;
|
447
|
|
448
|
setup_pin_mux(tsc_pin_mux);
|
449
|
|
450
|
err = am33xx_register_tsc(&am335x_touchscreen_data);
|
451
|
if (err)
|
452
|
pr_err("failed to register touchscreen device\n");
|
453
|
}
|
454
|
#endif /* CONFIG_TOUCHSCREEN_ADS7846 */
|
455
|
|
456
|
static __init void baseboard_setup_dvi(void)
|
457
|
{
|
458
|
struct clk *disp_pll;
|
459
|
|
460
|
/* pinmux */
|
461
|
setup_pin_mux(lcdc_pin_mux);
|
462
|
|
463
|
/* add I2C1 device entry */
|
464
|
|
465
|
/* TODO - really need to modify da8xx driver to support mating to the
|
466
|
* TFP410 and tweaking settings at the driver level... need to stew on
|
467
|
* this..
|
468
|
*/
|
469
|
|
470
|
/* configure / enable LCDC */
|
471
|
disp_pll = clk_get(NULL, "dpll_disp_ck");
|
472
|
if (IS_ERR(disp_pll)) {
|
473
|
pr_err("Connect get disp_pll\n");
|
474
|
return;
|
475
|
}
|
476
|
|
477
|
if (clk_set_rate(disp_pll, 300000000)) {
|
478
|
pr_warning("%s: Unable to initialize display PLL.\n",
|
479
|
__func__);
|
480
|
goto out;
|
481
|
}
|
482
|
|
483
|
if (am33xx_register_lcdc(&dvi_pdata))
|
484
|
pr_warning("%s: Unable to register LCDC device.\n",
|
485
|
__func__);
|
486
|
|
487
|
#ifdef CONFIG_BACKLIGHT_TPS6116X
|
488
|
if (platform_device_register(&tps6116x_device))
|
489
|
pr_err("failed to register backlight device\n");
|
490
|
|
491
|
#else
|
492
|
/* backlight */
|
493
|
/* TEMPORARY until driver is ready... just jam it on! */
|
494
|
if (0 != gpio_request(MITY335X_DK_GPIO_BACKLIGHT, "backlight control")) {
|
495
|
pr_warning("Unable to request GPIO %d\n",
|
496
|
MITY335X_DK_GPIO_BACKLIGHT);
|
497
|
goto out;
|
498
|
}
|
499
|
if (0 != gpio_direction_output(MITY335X_DK_GPIO_BACKLIGHT, 1)) {
|
500
|
pr_warning("Unable to set backlight GPIO %d ON\n",
|
501
|
MITY335X_DK_GPIO_BACKLIGHT);
|
502
|
goto out;
|
503
|
} else {
|
504
|
pr_info("Backlight GPIO = %d\n", MITY335X_DK_GPIO_BACKLIGHT);
|
505
|
}
|
506
|
#endif /* CONFIG_BACKLIGHT_TPS6116X */
|
507
|
out:
|
508
|
clk_put(disp_pll);
|
509
|
}
|
510
|
|
511
|
|
512
|
|
513
|
static u8 am335x_iis_serializer_direction[] = {
|
514
|
TX_MODE, RX_MODE, INACTIVE_MODE, INACTIVE_MODE,
|
515
|
INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
|
516
|
INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
|
517
|
INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
|
518
|
};
|
519
|
|
520
|
static struct snd_platform_data baseboard_snd_data = {
|
521
|
.tx_dma_offset = 0x46400000, /* McASP1 */
|
522
|
.rx_dma_offset = 0x46400000,
|
523
|
.op_mode = DAVINCI_MCASP_IIS_MODE,
|
524
|
.num_serializer = ARRAY_SIZE(am335x_iis_serializer_direction),
|
525
|
.tdm_slots = 2,
|
526
|
.serial_dir = am335x_iis_serializer_direction,
|
527
|
.asp_chan_q = EVENTQ_2,
|
528
|
.version = MCASP_VERSION_3,
|
529
|
.txnumevt = 1,
|
530
|
.rxnumevt = 1,
|
531
|
};
|
532
|
|
533
|
static struct omap2_mcspi_device_config spi0_ctlr_data = {
|
534
|
.turbo_mode = 0, /* diable "turbo" mode */
|
535
|
.d0_is_mosi = 1, /* D0 is output from 3335X */
|
536
|
};
|
537
|
|
538
|
static struct spi_board_info baseboard_spi0_slave_info[] = {
|
539
|
{
|
540
|
.modalias = "tlv320aic26-codec",
|
541
|
.controller_data = &spi0_ctlr_data,
|
542
|
.irq = -1,
|
543
|
.max_speed_hz = 2000000,
|
544
|
.bus_num = 1,
|
545
|
.chip_select = 1,
|
546
|
.mode = SPI_MODE_1,
|
547
|
},
|
548
|
#if (TS_USE_SPI)
|
549
|
{
|
550
|
.modalias = "ads7846",
|
551
|
.bus_num = MITY335X_DK_SPIBUS_TS,
|
552
|
.chip_select = 0,
|
553
|
.max_speed_hz = 1500000,
|
554
|
.controller_data = &spi0_ctlr_data,
|
555
|
.irq = OMAP_GPIO_IRQ(MITY335X_DK_GPIO_TS_IRQ_N),
|
556
|
.platform_data = &ads7846_config,
|
557
|
}
|
558
|
#endif /* TS_USE_SPI */
|
559
|
};
|
560
|
|
561
|
static __init void baseboard_setup_audio(void)
|
562
|
{
|
563
|
pr_info("Configuring audio...\n");
|
564
|
setup_pin_mux(mcasp1_pin_mux);
|
565
|
am335x_register_mcasp(&baseboard_snd_data, 1);
|
566
|
}
|
567
|
|
568
|
|
569
|
static __init void baseboard_setup_spi0_devices(void)
|
570
|
{
|
571
|
setup_pin_mux(spi0_pin_mux);
|
572
|
spi_register_board_info(baseboard_spi0_slave_info,
|
573
|
ARRAY_SIZE(baseboard_spi0_slave_info));
|
574
|
|
575
|
baseboard_setup_audio();
|
576
|
baseboard_setup_ts();
|
577
|
|
578
|
}
|
579
|
|
580
|
|
581
|
static void __init baseboard_i2c0_init(void)
|
582
|
{
|
583
|
setup_pin_mux(i2c0_pin_mux);
|
584
|
omap_register_i2c_bus(1, 100, NULL, 0);
|
585
|
}
|
586
|
|
587
|
/* fixup for the Vitesse 8601 PHY on the MityARM335x dev kit.
|
588
|
* We need to adjust the recv clock skew to recenter the data eye.
|
589
|
*/
|
590
|
static int am335x_vsc8601_phy_fixup(struct phy_device *phydev)
|
591
|
{
|
592
|
unsigned int val;
|
593
|
|
594
|
pr_info("am335x_vsc8601_phy_fixup %x here addr = %d\n",
|
595
|
phydev->phy_id, phydev->addr);
|
596
|
|
597
|
/* skew control is in extended register set */
|
598
|
if (phy_write(phydev, MII_EXTPAGE, 1) < 0) {
|
599
|
pr_err("Error enabling extended PHY regs\n");
|
600
|
return 1;
|
601
|
}
|
602
|
/* read the skew */
|
603
|
val = phy_read(phydev, RGMII_SKEW);
|
604
|
if (val < 0) {
|
605
|
pr_err("Error reading RGMII skew reg\n");
|
606
|
return val;
|
607
|
}
|
608
|
val &= 0x0FFF; /* clear skew values */
|
609
|
val |= 0x3000; /* 0 Tx skew, 2.0ns Rx skew */
|
610
|
if (phy_write(phydev, RGMII_SKEW, val) < 0) {
|
611
|
pr_err("failed to write RGMII_SKEW\n");
|
612
|
return 1;
|
613
|
}
|
614
|
/* disable the extended page access */
|
615
|
if (phy_write(phydev, MII_EXTPAGE, 0) < 0) {
|
616
|
pr_err("Error disabling extended PHY regs\n");
|
617
|
return 1;
|
618
|
}
|
619
|
return 0;
|
620
|
}
|
621
|
//
|
622
|
//
|
623
|
//
|
624
|
/* fixup for the smsc PHY on the sANDIA BOARD
|
625
|
* wE NEED TO FORCE LINK AT 100m
|
626
|
*/
|
627
|
static int am335x_LAN8820_phy_fixup(struct phy_device *phydev)
|
628
|
{
|
629
|
unsigned int val;
|
630
|
|
631
|
pr_info("am335x_lan8820_phy_fixup %x here addr = %d\n",
|
632
|
phydev->phy_id, phydev->addr);
|
633
|
|
634
|
/* skew control is in extended register set */
|
635
|
if (phy_write(phydev, LAN8820_CTLREG , LAN8820_LINK100) < 0) {
|
636
|
pr_err("Error enabling extended LAN8820 PHY regs\n");
|
637
|
return 1;
|
638
|
}
|
639
|
|
640
|
return 0;
|
641
|
}
|
642
|
static __init void baseboard_setup_enet(void)
|
643
|
{
|
644
|
/* pinmux */
|
645
|
int reginfo;
|
646
|
pr_info("Configure Ethernet RGMII PINs...\n");
|
647
|
setup_pin_mux(rgmii2_pin_mux);
|
648
|
|
649
|
/* network configuration done in SOM code */
|
650
|
/* PHY address setup? */
|
651
|
/* Register PHY fixup to adjust rx clock skew */
|
652
|
pr_info("Configure SMSC LAN8820 PHY chip...\n");
|
653
|
#if 0
|
654
|
phy_register_fixup_for_uid(VSC8601_PHY_ID,
|
655
|
VSC8601_PHY_MASK,
|
656
|
am335x_vsc8601_phy_fixup);
|
657
|
#endif
|
658
|
|
659
|
phy_register_fixup_for_uid(LAN8820_PHY_ID,
|
660
|
LAN8820_PHY_MASK,
|
661
|
am335x_LAN8820_phy_fixup);
|
662
|
reginfo = gpio_direction_output(SANDIA_USR0, 1);
|
663
|
//reginfo = gpio_direction_output(SANDIA_USR1, 0);
|
664
|
|
665
|
}
|
666
|
|
667
|
|
668
|
|
669
|
|
670
|
|
671
|
static void mmc2_wl12xx_init(void)
|
672
|
{
|
673
|
setup_pin_mux(mmc2_pin_mux);
|
674
|
|
675
|
mmc_info[1].mmc = 3;
|
676
|
mmc_info[1].name = "wl1271";
|
677
|
mmc_info[1].caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD
|
678
|
| MMC_PM_KEEP_POWER;
|
679
|
mmc_info[1].nonremovable = true;
|
680
|
mmc_info[1].gpio_cd = -EINVAL;
|
681
|
mmc_info[1].gpio_wp = -EINVAL;
|
682
|
mmc_info[1].ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34; /* 3V3 */
|
683
|
|
684
|
/* mmc will be initialized when mmc0_init is called */
|
685
|
return;
|
686
|
}
|
687
|
|
688
|
static void wl12xx_bluetooth_enable(void)
|
689
|
{
|
690
|
#if 0
|
691
|
int status = gpio_request(am335x_wlan_data.bt_enable_gpio,
|
692
|
"bt_en\n");
|
693
|
if (status < 0)
|
694
|
pr_err("Failed to request gpio for bt_enable");
|
695
|
|
696
|
pr_info("Configure Bluetooth Enable pin...\n");
|
697
|
gpio_direction_output(am335x_wlan_data.bt_enable_gpio, 0);
|
698
|
#else
|
699
|
pr_info("Bluetooth not Enabled!\n");
|
700
|
#endif
|
701
|
}
|
702
|
|
703
|
static int wl12xx_set_power(struct device *dev, int slot, int on, int vdd)
|
704
|
{
|
705
|
#if 1 /* TJI - 5/24/12 WL enable not connected yet.. always on */
|
706
|
if (on) {
|
707
|
gpio_set_value(am335x_wlan_data.wlan_enable_gpio, 1);
|
708
|
mdelay(70);
|
709
|
} else
|
710
|
gpio_set_value(am335x_wlan_data.wlan_enable_gpio, 0);
|
711
|
#endif
|
712
|
return 0;
|
713
|
}
|
714
|
|
715
|
static void baseboard_setup_wlan(void)
|
716
|
{
|
717
|
struct device *dev;
|
718
|
struct omap_mmc_platform_data *pdata;
|
719
|
int ret;
|
720
|
|
721
|
|
722
|
/* Register WLAN and BT enable pins based on the evm board revision */
|
723
|
am335x_wlan_data.wlan_enable_gpio = GPIO_TO_PIN(3, 4);
|
724
|
am335x_wlan_data.bt_enable_gpio = -EINVAL;
|
725
|
|
726
|
pr_info("WLAN GPIO Info.. IRQ = %3d WL_EN = %3d BT_EN = %3d\n",
|
727
|
am335x_wlan_data.irq,
|
728
|
am335x_wlan_data.wlan_enable_gpio,
|
729
|
am335x_wlan_data.bt_enable_gpio);
|
730
|
|
731
|
wl12xx_bluetooth_enable();
|
732
|
|
733
|
if (wl12xx_set_platform_data(&am335x_wlan_data))
|
734
|
pr_err("error setting wl12xx data\n");
|
735
|
|
736
|
dev = mmc_info[1].dev;
|
737
|
if (!dev) {
|
738
|
pr_err("wl12xx mmc device initialization failed\n");
|
739
|
goto out;
|
740
|
}
|
741
|
|
742
|
pdata = dev->platform_data;
|
743
|
if (!pdata) {
|
744
|
pr_err("Platfrom data of wl12xx device not set\n");
|
745
|
goto out;
|
746
|
}
|
747
|
#if 1
|
748
|
ret = gpio_request_one(am335x_wlan_data.wlan_enable_gpio,
|
749
|
GPIOF_OUT_INIT_LOW, "wlan_en");
|
750
|
if (ret) {
|
751
|
pr_err("Error requesting wlan enable gpio: %d\n", ret);
|
752
|
goto out;
|
753
|
}
|
754
|
#endif
|
755
|
setup_pin_mux(wl12xx_pin_mux);
|
756
|
|
757
|
pdata->slots[0].set_power = wl12xx_set_power;
|
758
|
pr_info("baseboard_setup_wlan: finished\n");
|
759
|
out:
|
760
|
return;
|
761
|
|
762
|
}
|
763
|
static void factory_config_callback(const struct mityarm335x_factory_config* factory_config)
|
764
|
{
|
765
|
pr_info("%s: %s\n", BASEBOARD_NAME, __FUNCTION__);
|
766
|
}
|
767
|
|
768
|
static __init int baseboard_init(void)
|
769
|
{
|
770
|
int reginfo;
|
771
|
pr_info("%s [%s]...\n", __func__, BASEBOARD_NAME);
|
772
|
mityarm335x_set_config_callback(factory_config_callback);
|
773
|
|
774
|
baseboard_setup_enet();
|
775
|
|
776
|
mmc2_wl12xx_init();
|
777
|
|
778
|
baseboard_setup_mmc();
|
779
|
baseboard_setup_sandia();
|
780
|
|
781
|
baseboard_setup_usb();
|
782
|
|
783
|
|
784
|
baseboard_setup_dvi();
|
785
|
|
786
|
baseboard_setup_can();
|
787
|
|
788
|
baseboard_setup_spi0_devices();
|
789
|
|
790
|
baseboard_i2c0_init();
|
791
|
|
792
|
baseboard_setup_wlan();
|
793
|
|
794
|
baseboard_setup_expansion();
|
795
|
reginfo = gpio_direction_output(SANDIA_USR1, 1);
|
796
|
return 0;
|
797
|
}
|
798
|
arch_initcall_sync(baseboard_init);
|