1
|
/*
|
2
|
* Critical Link MityOMAP-L138 SoM Baseboard initializtaion file
|
3
|
*
|
4
|
*/
|
5
|
#include <linux/kernel.h>
|
6
|
#include <linux/init.h>
|
7
|
#include <linux/gpio.h>
|
8
|
#include <linux/platform_device.h>
|
9
|
#include <linux/spi/spi.h>
|
10
|
#include <linux/spi/flash.h>
|
11
|
#include <linux/delay.h>
|
12
|
#include <linux/mtd/mtd.h>
|
13
|
#include <linux/usb/musb.h>
|
14
|
#include <linux/mtd/partitions.h>
|
15
|
|
16
|
|
17
|
#include <asm/mach-types.h>
|
18
|
#include <asm/mach/arch.h>
|
19
|
#include <asm/setup.h>
|
20
|
#include <mach/mux.h>
|
21
|
#include <mach/da8xx.h>
|
22
|
#include <linux/can/platform/mcp251x.h>
|
23
|
|
24
|
#define BASEBOARD_NAME "System9000"
|
25
|
|
26
|
#define SPI1_FLASH_CS_N GPIO_TO_PIN(2, 15) // System configuration flash (optional)
|
27
|
|
28
|
/*
|
29
|
* GPIO pins
|
30
|
*/
|
31
|
|
32
|
static short sys9000_gpio_pins[] __initdata = {
|
33
|
DA850_GPIO0_1, // SYNC_PLL_CLK2_LOS
|
34
|
DA850_GPIO0_3, // SYNC_PLL_LOL
|
35
|
DA850_GPIO0_5, // SYNC_PLL_CLK1_LOS
|
36
|
DA850_GPIO0_7, // SYNC_MASTER_EN
|
37
|
DA850_GPIO0_8, // SOM_GP0_8
|
38
|
DA850_GPIO0_9, // TEST_LED_0
|
39
|
DA850_GPIO0_10, // SYS_GOOD_LED_YEL
|
40
|
DA850_GPIO0_11, // SYS_GOOD_LED_GRN
|
41
|
DA850_GPIO0_12, // SYNC_LED_YEL
|
42
|
DA850_GPIO0_13, // SYNC_LED_GRN
|
43
|
DA850_GPIO0_14, // REC_LED_RED
|
44
|
DA850_GPIO0_15, // REC_LED_GRN
|
45
|
|
46
|
DA850_GPIO1_4, // TEST_POINT_1
|
47
|
DA850_GPIO1_5, // TEST_POINT_0
|
48
|
|
49
|
DA850_GPIO4_0, // VCAL_EN
|
50
|
DA850_GPIO4_1, // VCAL_EN_n
|
51
|
DA850_GPIO4_2, // ECAL_EN_n
|
52
|
DA850_GPIO4_3, // ECAL_EN_n
|
53
|
DA850_GPIO4_4, // VCAL_ZERO
|
54
|
DA850_GPIO4_5, // VCAL_OUT_EN
|
55
|
DA850_GPIO4_6, // VCAL_SPARE
|
56
|
DA850_GPIO4_7, // SSD_DET_N
|
57
|
|
58
|
DA850_GPIO5_14, // TEST_LED_1
|
59
|
|
60
|
DA850_GPIO6_0, // SOM_GP6_0
|
61
|
DA850_GPIO6_1, // SOM_GP6_1
|
62
|
DA850_GPIO6_2, // SOM_GP6_2
|
63
|
DA850_GPIO6_3, // SOM_GP6_3
|
64
|
DA850_GPIO6_4, // SOM_GP6_4
|
65
|
DA850_GPIO6_6, // SOM_GP6_6
|
66
|
DA850_GPIO6_7, // SOM_GP6_7
|
67
|
DA850_GPIO6_8, // SOM_GP6_8
|
68
|
DA850_GPIO6_9, // SOM_GP6_9
|
69
|
DA850_GPIO6_10, // SOM_GP6_10
|
70
|
DA850_GPIO6_11, // SOM_GP6_11
|
71
|
|
72
|
DA850_GPIO7_0, // LDAC0_n
|
73
|
DA850_GPIO7_1, // LDAC1_n
|
74
|
DA850_GPIO7_2, // LDAC2_n
|
75
|
DA850_GPIO7_3, // LDAC3_n
|
76
|
DA850_GPIO7_4, // LDAC4_n
|
77
|
DA850_GPIO7_5, // LDAC5_n
|
78
|
DA850_GPIO7_6, // LDAC6_n
|
79
|
|
80
|
DA850_GPIO7_8, // CARD_DET3
|
81
|
DA850_GPIO7_9, // CARD_DET2
|
82
|
DA850_GPIO7_10, // CARD_DET1
|
83
|
DA850_GPIO7_11, // CARD_DET0
|
84
|
|
85
|
DA850_GPIO7_12, // DIO_0_OUT
|
86
|
DA850_GPIO7_13, // DIO_0_IN
|
87
|
DA850_GPIO7_14, // DIO_1_OUT
|
88
|
DA850_GPIO7_15, // DIO_1_IN
|
89
|
|
90
|
DA850_GPIO8_8, // SYS_RST_N
|
91
|
DA850_GPIO8_10, // Factory Reset In
|
92
|
DA850_GPIO8_12, // HW_REV_0
|
93
|
DA850_GPIO8_13, // HW_REV_1
|
94
|
DA850_GPIO8_14, // HW_REV_2
|
95
|
DA850_GPIO8_15, // HW_REV_3
|
96
|
-1,
|
97
|
};
|
98
|
|
99
|
|
100
|
/*
|
101
|
* SPI Devices:
|
102
|
* SPI1_CS1: Flash M25PE80
|
103
|
*/
|
104
|
static struct mtd_partition sys9000_spi_flash_partitions[] = {
|
105
|
[0] = {
|
106
|
.name = "sys9000_cfg",
|
107
|
.offset = 0,
|
108
|
.size = SZ_512K,
|
109
|
.mask_flags = MTD_WRITEABLE,
|
110
|
},
|
111
|
[1] = {
|
112
|
.name = "sys9000_cal",
|
113
|
.offset = MTDPART_OFS_APPEND,
|
114
|
.size = MTDPART_SIZ_FULL,
|
115
|
.mask_flags = MTD_WRITEABLE,
|
116
|
},
|
117
|
};
|
118
|
|
119
|
// Copied from board-mityomapl138.c in this directory
|
120
|
static struct flash_platform_data sys9000_spi_flash_data = {
|
121
|
.name = "M25PE80",
|
122
|
.parts = sys9000_spi_flash_partitions,
|
123
|
.nr_parts = ARRAY_SIZE(sys9000_spi_flash_partitions),
|
124
|
.type = "m25p64-nonjedec",
|
125
|
};
|
126
|
|
127
|
static struct davinci_spi_config spi_M25PE80_config = {
|
128
|
.io_type = SPI_IO_TYPE_DMA,
|
129
|
.c2tdelay = 8,
|
130
|
.t2cdelay = 8,
|
131
|
};
|
132
|
|
133
|
static struct spi_board_info sys9000_spi1_info[] = {
|
134
|
[0] = {
|
135
|
.modalias = "M25PE80",
|
136
|
.platform_data = &sys9000_spi_flash_data,
|
137
|
.controller_data = &spi_M25PE80_config,
|
138
|
.mode = SPI_MODE_0,
|
139
|
.max_speed_hz = 30000000,
|
140
|
.bus_num = 1,
|
141
|
.chip_select = 1,
|
142
|
},
|
143
|
};
|
144
|
|
145
|
// TODO: does spi1_cs[] need to have 2 elements?
|
146
|
static u8 spi1_cs[] = {
|
147
|
SPI_INTERN_CS,
|
148
|
SPI1_FLASH_CS_N,
|
149
|
};
|
150
|
|
151
|
static void __init baseboard_setup_spi(void)
|
152
|
{
|
153
|
int ret;
|
154
|
|
155
|
ret = gpio_request(SPI1_FLASH_CS_N, "Sys9000 SPI FLASH CS\n");
|
156
|
if (ret)
|
157
|
pr_warning("%s: can not open Sys9000 SPI CS %d\n", __func__, SPI1_FLASH_CS_N);
|
158
|
|
159
|
ret = spi_register_board_info(sys9000_spi1_info,
|
160
|
ARRAY_SIZE(sys9000_spi1_info));
|
161
|
if (ret)
|
162
|
pr_warning("%s: Unable to register SPI1 Info: %d\n", __func__,
|
163
|
ret);
|
164
|
}
|
165
|
|
166
|
static int __init baseboard_pre_init(void)
|
167
|
{
|
168
|
pr_info("%s: Entered\n", __func__);
|
169
|
da8xx_spi_pdata[1].chip_sel = spi1_cs;
|
170
|
da8xx_spi_pdata[1].num_chipselect = ARRAY_SIZE(spi1_cs);
|
171
|
davinci_soc_info.emac_pdata->phy_id = "0:03";
|
172
|
return 0;
|
173
|
}
|
174
|
postcore_initcall_sync(baseboard_pre_init);
|
175
|
|
176
|
static int __init baseboard_init(void)
|
177
|
{
|
178
|
pr_info("%s [%s]...\n", __func__, BASEBOARD_NAME);
|
179
|
|
180
|
davinci_cfg_reg_list(sys9000_gpio_pins);
|
181
|
|
182
|
baseboard_setup_spi();
|
183
|
|
184
|
return 0;
|
185
|
}
|
186
|
arch_initcall_sync(baseboard_init);
|
187
|
|