1
|
|
2
|
|
3
|
#include <linux/kernel.h>
|
4
|
#include <linux/init.h>
|
5
|
#include <linux/clk.h>
|
6
|
#include <linux/err.h>
|
7
|
#include <linux/phy.h>
|
8
|
#include <linux/usb/musb.h>
|
9
|
#include <linux/dma-mapping.h>
|
10
|
#include <linux/spi/spi.h>
|
11
|
#include <linux/spi/ads7846.h>
|
12
|
#include <linux/delay.h>
|
13
|
#include <linux/gpio.h>
|
14
|
#include <linux/spi/spidev.h>
|
15
|
|
16
|
/* TSc controller */
|
17
|
#include <linux/input/ti_tsc.h>
|
18
|
#include <linux/platform_data/ti_adc.h>
|
19
|
#include <linux/mfd/ti_tscadc.h>
|
20
|
#include <linux/lis3lv02d.h>
|
21
|
|
22
|
#include <video/da8xx-fb.h>
|
23
|
#include <plat/omap-pm.h>
|
24
|
#include <plat/lcdc.h> /* uhhggg... */
|
25
|
#include <plat/mmc.h>
|
26
|
#include <plat/usb.h>
|
27
|
#include <plat/omap_device.h>
|
28
|
#include <plat/mcspi.h>
|
29
|
#include <plat/i2c.h>
|
30
|
|
31
|
#include <linux/wl12xx.h>
|
32
|
#include <linux/regulator/fixed.h>
|
33
|
#include <linux/regulator/machine.h>
|
34
|
#include <linux/mmc/host.h>
|
35
|
#include <linux/pwm/pwm.h>
|
36
|
|
37
|
#include <asm/hardware/asp.h>
|
38
|
|
39
|
#include "mux.h"
|
40
|
#include "devices.h"
|
41
|
#include "mityarm335x.h"
|
42
|
|
43
|
#define BASEBOARD_NAME "MitySOM-335x Frantec AEC"
|
44
|
/* Vitesse 8601 register defs we need... */
|
45
|
#define VSC8601_PHY_ID (0x00070420)
|
46
|
#define VSC8601_PHY_MASK (0xFFFFFFFC)
|
47
|
#define MII_EXTPAGE (0x1F)
|
48
|
#define RGMII_SKEW (0x1C)
|
49
|
#define MITY335X_DK_SPIBUS_TS (1)
|
50
|
|
51
|
/* TODO - refactor all the pinmux stuff for all board files to use */
|
52
|
#define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))
|
53
|
|
54
|
#define MITY335X_DK_GPIO_TS_IRQ_N GPIO_TO_PIN(0, 20)
|
55
|
#define MITY335X_DK_GPIO_BACKLIGHT GPIO_TO_PIN(3, 14)
|
56
|
|
57
|
|
58
|
#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
|
59
|
defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
|
60
|
#define TS_USE_SPI 0 /*1 -- currently not supported*/
|
61
|
#else
|
62
|
#define TS_USE_SPI 0
|
63
|
#endif
|
64
|
|
65
|
struct pinmux_config {
|
66
|
const char *muxname;
|
67
|
int val;
|
68
|
};
|
69
|
|
70
|
|
71
|
#define setup_pin_mux(pin_mux) \
|
72
|
{ \
|
73
|
int i = 0; \
|
74
|
for (; pin_mux[i].muxname != NULL; i++) \
|
75
|
omap_mux_init_signal(pin_mux[i].muxname, pin_mux[i].val); \
|
76
|
}
|
77
|
|
78
|
/******************************************************************************
|
79
|
*
|
80
|
* N O T E
|
81
|
*
|
82
|
* PUT ALL PINMUX SETTINGS HERE
|
83
|
*
|
84
|
*****************************************************************************/
|
85
|
|
86
|
static struct pinmux_config __initdata rgmii2_pin_mux[] = {
|
87
|
{"gpmc_a0.rgmii2_tctl", AM33XX_PIN_OUTPUT},
|
88
|
{"gpmc_a1.rgmii2_rctl", AM33XX_PIN_INPUT_PULLDOWN},
|
89
|
{"gpmc_a2.rgmii2_td3", AM33XX_PIN_OUTPUT},
|
90
|
{"gpmc_a3.rgmii2_td2", AM33XX_PIN_OUTPUT},
|
91
|
{"gpmc_a4.rgmii2_td1", AM33XX_PIN_OUTPUT},
|
92
|
{"gpmc_a5.rgmii2_td0", AM33XX_PIN_OUTPUT},
|
93
|
{"gpmc_a6.rgmii2_tclk", AM33XX_PIN_OUTPUT},
|
94
|
{"gpmc_a7.rgmii2_rclk", AM33XX_PIN_INPUT_PULLDOWN},
|
95
|
{"gpmc_a8.rgmii2_rd3", AM33XX_PIN_INPUT_PULLDOWN},
|
96
|
{"gpmc_a9.rgmii2_rd2", AM33XX_PIN_INPUT_PULLDOWN},
|
97
|
{"gpmc_a10.rgmii2_rd1", AM33XX_PIN_INPUT_PULLDOWN},
|
98
|
{"gpmc_a11.rgmii2_rd0", AM33XX_PIN_INPUT_PULLDOWN},
|
99
|
{"mdio_data.mdio_data", AM33XX_PIN_INPUT_PULLUP},
|
100
|
{"mdio_clk.mdio_clk", AM33XX_PIN_OUTPUT_PULLUP},
|
101
|
// {"gpmc_csn2.gpio1_31", AM33XX_PIN_OUTPUT}, // RGMII2_RESETN Added MDF 12/10/15, commented out (set up in U-boot) MDF 01/08/16
|
102
|
{"gpmc_clk.gpio2_1", AM33XX_PIN_INPUT}, // ENET1_INTN, Added MDF 12/10/15
|
103
|
{NULL, 0}
|
104
|
};
|
105
|
|
106
|
static struct pinmux_config __initdata rgmii1_pin_mux[] = {
|
107
|
{"mii1_rxd0.rgmii1_rd0", AM33XX_PIN_INPUT_PULLDOWN},
|
108
|
{"mii1_rxd1.rgmii1_rd1", AM33XX_PIN_INPUT_PULLDOWN},
|
109
|
{"mii1_rxd2.rgmii1_rd2", AM33XX_PIN_INPUT_PULLDOWN},
|
110
|
{"mii1_rxd3.rgmii1_rd3", AM33XX_PIN_INPUT_PULLDOWN},
|
111
|
{"mii1_rxclk.rgmii1_rclk", AM33XX_PIN_INPUT_PULLDOWN},
|
112
|
{"mii1_rxdv.rgmii1_rctl", AM33XX_PIN_INPUT_PULLDOWN},
|
113
|
{"mii1_txclk.rgmii1_tclk", AM33XX_PIN_OUTPUT},
|
114
|
{"mii1_txd0.rgmii1_td0", AM33XX_PIN_OUTPUT},
|
115
|
{"mii1_txd1.rgmii1_td1", AM33XX_PIN_OUTPUT},
|
116
|
{"mii1_txd2.rgmii1_td2", AM33XX_PIN_OUTPUT},
|
117
|
{"mii1_txd3.rgmii1_td3", AM33XX_PIN_OUTPUT},
|
118
|
{"mii1_txen.rgmii1_tctl", AM33XX_PIN_OUTPUT},
|
119
|
{NULL, 0}
|
120
|
};
|
121
|
|
122
|
|
123
|
static struct pinmux_config __initdata lcdc_pin_mux[] = {
|
124
|
{"lcd_data0.lcd_data0", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
125
|
{"lcd_data1.lcd_data1", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
126
|
{"lcd_data2.lcd_data2", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
127
|
{"lcd_data3.lcd_data3", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
128
|
{"lcd_data4.lcd_data4", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
129
|
{"lcd_data5.lcd_data5", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
130
|
{"lcd_data6.lcd_data6", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
131
|
{"lcd_data7.lcd_data7", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
132
|
{"lcd_data8.lcd_data8", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
133
|
{"lcd_data9.lcd_data9", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
134
|
{"lcd_data10.lcd_data10", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
135
|
{"lcd_data11.lcd_data11", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
136
|
{"lcd_data12.lcd_data12", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
137
|
{"lcd_data13.lcd_data13", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
138
|
{"lcd_data14.lcd_data14", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
139
|
{"lcd_data15.lcd_data15", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
140
|
{"lcd_vsync.lcd_vsync", AM33XX_PIN_OUTPUT},
|
141
|
{"lcd_hsync.lcd_hsync", AM33XX_PIN_OUTPUT},
|
142
|
{"lcd_pclk.lcd_pclk", AM33XX_PIN_OUTPUT},
|
143
|
{"lcd_ac_bias_en.lcd_ac_bias_en", AM33XX_PIN_OUTPUT},
|
144
|
/* GPIO for the backlight */
|
145
|
{ "mcasp0_aclkx.gpio3_14", AM33XX_PIN_OUTPUT},
|
146
|
|
147
|
// Added MDF 12/10/15
|
148
|
{"gpmc_ad15.lcd_data16", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
149
|
{"gpmc_ad14.lcd_data17", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
150
|
{"gpmc_ad13.lcd_data18", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
151
|
{"gpmc_ad12.lcd_data19", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
152
|
{"gpmc_ad11.lcd_data20", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
153
|
{"gpmc_ad10.lcd_data21", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
154
|
{"gpmc_ad9.lcd_data22", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
155
|
{"gpmc_ad8.lcd_data23", AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA},
|
156
|
{NULL, 0}
|
157
|
};
|
158
|
|
159
|
|
160
|
/* Altanium CAN bus */
|
161
|
static struct pinmux_config __initdata can1_pin_mux[] = {
|
162
|
{"uart0_ctsn.d_can1_tx", AM33XX_PULL_ENBL},
|
163
|
{"uart0_rtsn.d_can1_rx", AM33XX_PIN_INPUT_PULLUP},
|
164
|
{NULL, 0}
|
165
|
};
|
166
|
|
167
|
/* Uarts */
|
168
|
static struct pinmux_config __initdata uart_pin_mux[] = {
|
169
|
{"uart1_rxd.uart1_rxd", AM33XX_PIN_INPUT_PULLUP}, /* Uart1 RX */
|
170
|
{"uart1_txd.uart1_txd", AM33XX_PULL_ENBL}, /* Uart1 TX */
|
171
|
{"mcasp0_fsr.gpio3_19", AM33XX_PULL_ENBL}, /* Uart1 TXE */
|
172
|
|
173
|
{"mmc0_clk.uart2_rxd", AM33XX_PIN_INPUT_PULLUP}, /* Uart2 RX */
|
174
|
{"mmc0_cmd.uart2_txd", AM33XX_PULL_ENBL}, /* Uart2 TX */
|
175
|
|
176
|
{"mmc0_dat1.uart3_rxd", AM33XX_PIN_INPUT_PULLUP}, /* Uart3 RX */
|
177
|
{"mmc0_dat0.uart3_txd", AM33XX_PULL_ENBL}, /* Uart3 TX */
|
178
|
{"gpmc_csn1.gpio1_30", AM33XX_PULL_ENBL}, /* Uart3 TXE */
|
179
|
|
180
|
{"mii1_col.uart5_rxd", AM33XX_PIN_INPUT_PULLUP}, /* Uart5 RX */
|
181
|
{"rmii1_refclk.uart5_txd", AM33XX_PULL_ENBL}, /* Uart5 TX */
|
182
|
{NULL, 0}
|
183
|
};
|
184
|
|
185
|
/* GPIO */
|
186
|
static struct pinmux_config __initdata gpio_pin_mux[] = {
|
187
|
{"mcasp0_aclkr.gpio3_18", AM33XX_PIN_OUTPUT}, // LED0
|
188
|
{"mcasp0_ahclkx.gpio3_21", AM33XX_PIN_OUTPUT}, // LED1
|
189
|
{"mmc0_dat2.gpio2_27", AM33XX_PIN_OUTPUT}, // LED2
|
190
|
{"mmc0_dat3.gpio2_26", AM33XX_PIN_OUTPUT}, // LED3
|
191
|
{"gpmc_ben1.gpio1_28", AM33XX_PIN_OUTPUT}, // LED_RGB
|
192
|
|
193
|
};
|
194
|
|
195
|
|
196
|
static struct pinmux_config __initdata usb_pin_mux[] = {
|
197
|
{"usb0_drvvbus.usb0_drvvbus", AM33XX_PIN_OUTPUT},
|
198
|
//{"usb1_drvvbus.usb1_drvvbus", AM33XX_PIN_OUTPUT},
|
199
|
{NULL, 0}
|
200
|
};
|
201
|
|
202
|
#if (TS_USE_SPI)
|
203
|
static struct pinmux_config __initdata ts_pin_mux[] = {
|
204
|
/* SPI0 CS0 taken care of by SPI pinmux setup */
|
205
|
{"xdma_event_intr1.gpio0_20", AM33XX_PIN_INPUT}, /* Pen down */
|
206
|
{NULL, 0}
|
207
|
};
|
208
|
#endif
|
209
|
|
210
|
|
211
|
static struct pinmux_config __initdata spi0_pin_mux[] = {
|
212
|
{"spi0_cs0.spi0_cs0", AM33XX_PIN_OUTPUT_PULLUP},
|
213
|
{"spi0_cs1.spi0_cs1", AM33XX_PIN_OUTPUT_PULLUP},
|
214
|
{"spi0_sclk.spi0_sclk", AM33XX_PIN_OUTPUT_PULLUP},
|
215
|
{"spi0_d0.spi0_d0", AM33XX_PIN_OUTPUT},
|
216
|
{"spi0_d1.spi0_d1", AM33XX_PULL_ENBL | AM33XX_INPUT_EN},
|
217
|
{NULL, 0},
|
218
|
};
|
219
|
|
220
|
|
221
|
|
222
|
|
223
|
static void __init baseboard_setup_uarts(void)
|
224
|
{
|
225
|
pr_info("%s: SPI %s\n", BASEBOARD_NAME, __FUNCTION__);
|
226
|
setup_pin_mux(uart_pin_mux);
|
227
|
}
|
228
|
|
229
|
static void __init baseboard_setup_can(void)
|
230
|
{
|
231
|
pr_info("%s: SPI %s\n", BASEBOARD_NAME, __FUNCTION__);
|
232
|
setup_pin_mux(can1_pin_mux);
|
233
|
am33xx_d_can_init(1);
|
234
|
}
|
235
|
|
236
|
static struct omap_musb_board_data board_data = {
|
237
|
.interface_type = MUSB_INTERFACE_ULPI,
|
238
|
.mode = MUSB_OTG,
|
239
|
.power = 500,
|
240
|
.instances = 1,
|
241
|
};
|
242
|
|
243
|
static void __init baseboard_setup_usb(void)
|
244
|
{
|
245
|
pr_info("%s: SPI %s\n", BASEBOARD_NAME, __FUNCTION__);
|
246
|
setup_pin_mux(usb_pin_mux);
|
247
|
usb_musb_init(&board_data);
|
248
|
}
|
249
|
|
250
|
|
251
|
static const struct display_panel disp_panel = {
|
252
|
WVGA, /* panel_type */
|
253
|
32, /* max_bpp */
|
254
|
16, /* min_bpp */
|
255
|
COLOR_ACTIVE, /* panel_shade */
|
256
|
};
|
257
|
|
258
|
static struct lcd_ctrl_config dvi_cfg = {
|
259
|
.p_disp_panel = &disp_panel,
|
260
|
.ac_bias = 255,
|
261
|
.ac_bias_intrpt = 0,
|
262
|
.dma_burst_sz = 16,
|
263
|
.bpp = 16,
|
264
|
.fdd = 0x80,
|
265
|
.tft_alt_mode = 0,
|
266
|
.stn_565_mode = 0,
|
267
|
.mono_8bit_mode = 0,
|
268
|
.invert_line_clock = 1,
|
269
|
.invert_frm_clock = 1,
|
270
|
.sync_edge = 0,
|
271
|
.sync_ctrl = 1,
|
272
|
.raster_order = 0,
|
273
|
};
|
274
|
|
275
|
/* TODO - should really update driver to support VESA mode timings... */
|
276
|
struct da8xx_lcdc_platform_data dvi_pdata = {
|
277
|
.manu_name = "VESA",
|
278
|
.controller_data = &dvi_cfg,
|
279
|
.type = "1024x768",
|
280
|
};
|
281
|
#ifdef CONFIG_BACKLIGHT_TPS6116X
|
282
|
|
283
|
static struct platform_device tps6116x_device = {
|
284
|
.name = "tps6116x",
|
285
|
.id = -1,
|
286
|
.dev = {
|
287
|
.platform_data = (void *)MITY335X_DK_GPIO_BACKLIGHT,
|
288
|
},
|
289
|
};
|
290
|
#endif /* CONFIG_BACKLIGHT_TPS6116X */
|
291
|
|
292
|
|
293
|
#if (TS_USE_SPI)
|
294
|
static struct ads7846_platform_data ads7846_config = {
|
295
|
.model = 7843,
|
296
|
.vref_mv = 3300,
|
297
|
.x_max = 0x0fff,
|
298
|
.y_max = 0x0fff,
|
299
|
.x_plate_ohms = 180,
|
300
|
.pressure_max = 255,
|
301
|
.debounce_max = 0, /* 200, */
|
302
|
.debounce_tol = 5,
|
303
|
.debounce_rep = 10,
|
304
|
.gpio_pendown = MITY335X_DK_GPIO_TS_IRQ_N,
|
305
|
.keep_vref_on = 1,
|
306
|
.irq_flags = IRQF_TRIGGER_FALLING,
|
307
|
.vref_delay_usecs = 100,
|
308
|
.settle_delay_usecs = 200,
|
309
|
.penirq_recheck_delay_usecs = 1000,
|
310
|
.filter_init = 0,
|
311
|
.filter = 0,
|
312
|
.filter_cleanup = 0,
|
313
|
.gpio_pendown = MITY335X_DK_GPIO_TS_IRQ_N,
|
314
|
};
|
315
|
|
316
|
static void __init baseboard_setup_ts(void)
|
317
|
{
|
318
|
setup_pin_mux(ts_pin_mux);
|
319
|
/* SPI hookup already done by baseboard_setup_spi0() */
|
320
|
}
|
321
|
#else
|
322
|
|
323
|
static struct tsc_data am335x_touchscreen_data = {
|
324
|
.wires = 4,
|
325
|
.x_plate_resistance = 200,
|
326
|
.steps_to_configure = 5,
|
327
|
};
|
328
|
|
329
|
static struct adc_data am335x_adc_data = {
|
330
|
.adc_channels = 4,
|
331
|
};
|
332
|
|
333
|
static struct mfd_tscadc_board am335x_tscadc = {
|
334
|
.tsc_init = &am335x_touchscreen_data,
|
335
|
.adc_init = &am335x_adc_data,
|
336
|
};
|
337
|
|
338
|
|
339
|
static void __init baseboard_setup_ts(void)
|
340
|
{
|
341
|
int err;
|
342
|
|
343
|
/* Removed Pin Mux -- Analog pins don't require it */
|
344
|
|
345
|
pr_info("IN : %s \n", __FUNCTION__);
|
346
|
err = am33xx_register_mfd_tscadc(&am335x_tscadc);
|
347
|
if (err)
|
348
|
pr_err("failed to register touchscreen device\n");
|
349
|
|
350
|
pr_info("Setup LCD touchscreen\n");
|
351
|
}
|
352
|
#endif /* CONFIG_TOUCHSCREEN_ADS7846 */
|
353
|
|
354
|
static int __init conf_disp_pll(int rate)
|
355
|
{
|
356
|
struct clk *disp_pll;
|
357
|
int ret = -EINVAL;
|
358
|
|
359
|
disp_pll = clk_get(NULL, "dpll_disp_ck");
|
360
|
if (IS_ERR(disp_pll)) {
|
361
|
pr_err("Cannot clk_get disp_pll\n");
|
362
|
goto out;
|
363
|
}
|
364
|
|
365
|
ret = clk_set_rate(disp_pll, rate);
|
366
|
clk_put(disp_pll);
|
367
|
out:
|
368
|
return ret;
|
369
|
}
|
370
|
|
371
|
static void __init baseboard_setup_dvi(void)
|
372
|
{
|
373
|
pr_info("%s: SPI %s\n", BASEBOARD_NAME, __FUNCTION__);
|
374
|
/* pinmux */
|
375
|
setup_pin_mux(lcdc_pin_mux);
|
376
|
|
377
|
/* add I2C1 device entry */
|
378
|
|
379
|
/* TODO - really need to modify da8xx driver to support mating to the
|
380
|
* TFP410 and tweaking settings at the driver level... need to stew on
|
381
|
* this..
|
382
|
*/
|
383
|
|
384
|
/* configure / enable LCDC */
|
385
|
if (conf_disp_pll(300000000)) {
|
386
|
pr_info("Failed configure display PLL, not attempting to"
|
387
|
"register LCDC\n");
|
388
|
return;
|
389
|
}
|
390
|
|
391
|
dvi_pdata.get_context_loss_count = omap_pm_get_dev_context_loss_count;
|
392
|
|
393
|
if (am33xx_register_lcdc(&dvi_pdata))
|
394
|
pr_warning("%s: Unable to register LCDC device.\n",
|
395
|
__func__);
|
396
|
|
397
|
#ifdef CONFIG_BACKLIGHT_TPS6116X
|
398
|
if (platform_device_register(&tps6116x_device))
|
399
|
pr_err("failed to register backlight device\n");
|
400
|
|
401
|
#else
|
402
|
/* backlight */
|
403
|
/* TEMPORARY until driver is ready... just jam it on! */
|
404
|
if (0 != gpio_request(MITY335X_DK_GPIO_BACKLIGHT, "backlight control")) {
|
405
|
pr_warning("Unable to request GPIO %d\n",
|
406
|
MITY335X_DK_GPIO_BACKLIGHT);
|
407
|
return;
|
408
|
}
|
409
|
if (0 != gpio_direction_output(MITY335X_DK_GPIO_BACKLIGHT, 1)) {
|
410
|
pr_warning("Unable to set backlight GPIO %d ON\n",
|
411
|
MITY335X_DK_GPIO_BACKLIGHT);
|
412
|
return;
|
413
|
} else {
|
414
|
pr_info("Backlight GPIO = %d\n", MITY335X_DK_GPIO_BACKLIGHT);
|
415
|
}
|
416
|
#endif /* CONFIG_BACKLIGHT_TPS6116X */
|
417
|
}
|
418
|
|
419
|
static struct omap2_mcspi_device_config spi0_ctlr_data = {
|
420
|
.turbo_mode = 0, /* diable "turbo" mode */
|
421
|
.d0_is_mosi = 1, /* D0 is output from 3335X */
|
422
|
};
|
423
|
|
424
|
|
425
|
static struct spi_board_info baseboard_spi0_slave_info[] = {
|
426
|
|
427
|
{
|
428
|
.modalias = "spidev",
|
429
|
// .controller_data = &spi0_ctlr_data,
|
430
|
.irq = -1,
|
431
|
.max_speed_hz = 1000000,
|
432
|
.bus_num = 0,
|
433
|
.chip_select = 1,
|
434
|
.mode = SPI_MODE_0,
|
435
|
},
|
436
|
|
437
|
#if (TS_USE_SPI)
|
438
|
{
|
439
|
.modalias = "ads7846",
|
440
|
.bus_num = MITY335X_DK_SPIBUS_TS,
|
441
|
.chip_select = 0,
|
442
|
.max_speed_hz = 1500000,
|
443
|
.controller_data = &spi0_ctlr_data,
|
444
|
.irq = OMAP_GPIO_IRQ(MITY335X_DK_GPIO_TS_IRQ_N),
|
445
|
.platform_data = &ads7846_config,
|
446
|
}
|
447
|
#endif /* TS_USE_SPI */
|
448
|
};
|
449
|
|
450
|
|
451
|
|
452
|
static __init void baseboard_setup_spi0_devices(void)
|
453
|
{
|
454
|
pr_info("%s: SPI %s\n", BASEBOARD_NAME, __FUNCTION__);
|
455
|
setup_pin_mux(spi0_pin_mux);
|
456
|
spi_register_board_info(baseboard_spi0_slave_info,
|
457
|
ARRAY_SIZE(baseboard_spi0_slave_info));
|
458
|
|
459
|
// baseboard_setup_ts();
|
460
|
|
461
|
}
|
462
|
|
463
|
|
464
|
/* fixup for the Vitesse 8601 PHY on the MityARM335x dev kit.
|
465
|
* We need to adjust the recv clock skew to recenter the data eye.
|
466
|
*/
|
467
|
static int am335x_vsc8601_phy_fixup(struct phy_device *phydev)
|
468
|
{
|
469
|
unsigned int val;
|
470
|
|
471
|
pr_info("am335x_vsc8601_phy_fixup %x here addr = %d\n",
|
472
|
phydev->phy_id, phydev->addr);
|
473
|
|
474
|
/* skew control is in extended register set */
|
475
|
if (phy_write(phydev, MII_EXTPAGE, 1) < 0) {
|
476
|
pr_err("Error enabling extended PHY regs\n");
|
477
|
return 1;
|
478
|
}
|
479
|
/* read the skew */
|
480
|
val = phy_read(phydev, RGMII_SKEW);
|
481
|
if (val < 0) {
|
482
|
pr_err("Error reading RGMII skew reg\n");
|
483
|
return val;
|
484
|
}
|
485
|
val &= 0x0FFF; /* clear skew values */
|
486
|
val |= 0x3000; /* 0 Tx skew, 2.0ns Rx skew */
|
487
|
if (phy_write(phydev, RGMII_SKEW, val) < 0) {
|
488
|
pr_err("failed to write RGMII_SKEW\n");
|
489
|
return 1;
|
490
|
}
|
491
|
/* disable the extended page access */
|
492
|
if (phy_write(phydev, MII_EXTPAGE, 0) < 0) {
|
493
|
pr_err("Error disabling extended PHY regs\n");
|
494
|
return 1;
|
495
|
}
|
496
|
return 0;
|
497
|
}
|
498
|
|
499
|
static void __init baseboard_setup_enet(void)
|
500
|
{
|
501
|
pr_info("%s: SPI %s\n", BASEBOARD_NAME, __FUNCTION__);
|
502
|
/* pinmux */
|
503
|
setup_pin_mux(rgmii2_pin_mux);
|
504
|
setup_pin_mux(rgmii1_pin_mux);
|
505
|
|
506
|
am33xx_cpsw_init(AM33XX_CPSW_MODE_RGMII, "0:03", "0:02");
|
507
|
|
508
|
/* network configuration done in SOM code */
|
509
|
/* PHY address setup? */
|
510
|
/* Register PHY fixup to adjust rx clock skew */
|
511
|
// phy_register_fixup_for_uid(VSC8601_PHY_ID,
|
512
|
// VSC8601_PHY_MASK,
|
513
|
// am335x_vsc8601_phy_fixup);
|
514
|
}
|
515
|
|
516
|
|
517
|
|
518
|
|
519
|
static void __init factory_config_callback(const struct mityarm335x_factory_config* factory_config)
|
520
|
{
|
521
|
int ii;
|
522
|
|
523
|
pr_info("%s: %s\n", BASEBOARD_NAME, __FUNCTION__);
|
524
|
|
525
|
|
526
|
}
|
527
|
|
528
|
static __init int baseboard_init(void)
|
529
|
{
|
530
|
pr_info("%s [%s]...\n", __func__, BASEBOARD_NAME);
|
531
|
|
532
|
mityarm335x_set_config_callback(factory_config_callback);
|
533
|
|
534
|
setup_pin_mux(gpio_pin_mux);
|
535
|
|
536
|
baseboard_setup_enet();
|
537
|
|
538
|
baseboard_setup_usb();
|
539
|
|
540
|
baseboard_setup_dvi();
|
541
|
|
542
|
baseboard_setup_can();
|
543
|
|
544
|
baseboard_setup_spi0_devices();
|
545
|
|
546
|
baseboard_setup_uarts();
|
547
|
|
548
|
|
549
|
|
550
|
return 0;
|
551
|
}
|
552
|
arch_initcall_sync(baseboard_init);
|
553
|
|