]>
Commit | Line | Data |
---|---|---|
1f3b536b EP |
1 | /* |
2 | * linux/arch/arm/mach-pxa/icontrol.c | |
3 | * | |
4 | * Support for the iControl and SafeTcam platforms from TMT Services | |
5 | * using the Embedian MXM-8x10 Computer on Module | |
6 | * | |
7 | * Copyright (C) 2009 TMT Services & Supplies (Pty) Ltd. | |
8 | * | |
9 | * 2010-01-21 Hennie van der Merve <hvdmerwe@tmtservies.co.za> | |
10 | * | |
11 | * This program is free software; you can redistribute it and/or modify | |
12 | * it under the terms of the GNU General Public License version 2 as | |
13 | * published by the Free Software Foundation. | |
14 | */ | |
15 | ||
16 | #include <linux/irq.h> | |
17 | #include <linux/platform_device.h> | |
18 | #include <linux/gpio.h> | |
19 | ||
20 | #include <asm/mach-types.h> | |
21 | #include <asm/mach/arch.h> | |
22 | ||
23 | #include <mach/pxa320.h> | |
24 | #include <mach/mxm8x10.h> | |
25 | ||
26 | #include <linux/spi/spi.h> | |
27 | #include <mach/pxa2xx_spi.h> | |
28 | #include <linux/can/platform/mcp251x.h> | |
29 | ||
30 | #include "generic.h" | |
31 | ||
32 | #define ICONTROL_MCP251x_nCS1 (15) | |
33 | #define ICONTROL_MCP251x_nCS2 (16) | |
34 | #define ICONTROL_MCP251x_nCS3 (17) | |
35 | #define ICONTROL_MCP251x_nCS4 (24) | |
36 | ||
37 | #define ICONTROL_MCP251x_nIRQ1 (74) | |
38 | #define ICONTROL_MCP251x_nIRQ2 (75) | |
39 | #define ICONTROL_MCP251x_nIRQ3 (76) | |
40 | #define ICONTROL_MCP251x_nIRQ4 (77) | |
41 | ||
42 | static struct pxa2xx_spi_chip mcp251x_chip_info1 = { | |
43 | .tx_threshold = 8, | |
44 | .rx_threshold = 128, | |
45 | .dma_burst_size = 8, | |
46 | .timeout = 235, | |
47 | .gpio_cs = ICONTROL_MCP251x_nCS1 | |
48 | }; | |
49 | ||
50 | static struct pxa2xx_spi_chip mcp251x_chip_info2 = { | |
51 | .tx_threshold = 8, | |
52 | .rx_threshold = 128, | |
53 | .dma_burst_size = 8, | |
54 | .timeout = 235, | |
55 | .gpio_cs = ICONTROL_MCP251x_nCS2 | |
56 | }; | |
57 | ||
58 | static struct pxa2xx_spi_chip mcp251x_chip_info3 = { | |
59 | .tx_threshold = 8, | |
60 | .rx_threshold = 128, | |
61 | .dma_burst_size = 8, | |
62 | .timeout = 235, | |
63 | .gpio_cs = ICONTROL_MCP251x_nCS3 | |
64 | }; | |
65 | ||
66 | static struct pxa2xx_spi_chip mcp251x_chip_info4 = { | |
67 | .tx_threshold = 8, | |
68 | .rx_threshold = 128, | |
69 | .dma_burst_size = 8, | |
70 | .timeout = 235, | |
71 | .gpio_cs = ICONTROL_MCP251x_nCS4 | |
72 | }; | |
73 | ||
74 | static struct mcp251x_platform_data mcp251x_info = { | |
75 | .oscillator_frequency = 16E6, | |
76 | .model = CAN_MCP251X_MCP2515, | |
77 | .board_specific_setup = NULL, | |
78 | .power_enable = NULL, | |
79 | .transceiver_enable = NULL | |
80 | }; | |
81 | ||
82 | static struct spi_board_info mcp251x_board_info[] = { | |
83 | { | |
84 | .modalias = "mcp251x", | |
85 | .max_speed_hz = 6500000, | |
86 | .bus_num = 3, | |
87 | .chip_select = 0, | |
88 | .platform_data = &mcp251x_info, | |
89 | .controller_data = &mcp251x_chip_info1, | |
90 | .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ1) | |
91 | }, | |
92 | { | |
93 | .modalias = "mcp251x", | |
94 | .max_speed_hz = 6500000, | |
95 | .bus_num = 3, | |
96 | .chip_select = 1, | |
97 | .platform_data = &mcp251x_info, | |
98 | .controller_data = &mcp251x_chip_info2, | |
99 | .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ2) | |
100 | }, | |
101 | { | |
102 | .modalias = "mcp251x", | |
103 | .max_speed_hz = 6500000, | |
104 | .bus_num = 4, | |
105 | .chip_select = 0, | |
106 | .platform_data = &mcp251x_info, | |
107 | .controller_data = &mcp251x_chip_info3, | |
108 | .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ3) | |
109 | }, | |
110 | { | |
111 | .modalias = "mcp251x", | |
112 | .max_speed_hz = 6500000, | |
113 | .bus_num = 4, | |
114 | .chip_select = 1, | |
115 | .platform_data = &mcp251x_info, | |
116 | .controller_data = &mcp251x_chip_info4, | |
117 | .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ4) | |
118 | } | |
119 | }; | |
120 | ||
121 | static struct pxa2xx_spi_master pxa_ssp3_spi_master_info = { | |
122 | .clock_enable = CKEN_SSP3, | |
123 | .num_chipselect = 2, | |
124 | .enable_dma = 1 | |
125 | }; | |
126 | ||
127 | static struct pxa2xx_spi_master pxa_ssp4_spi_master_info = { | |
128 | .clock_enable = CKEN_SSP4, | |
129 | .num_chipselect = 2, | |
130 | .enable_dma = 1 | |
131 | }; | |
132 | ||
133 | struct platform_device pxa_spi_ssp3 = { | |
134 | .name = "pxa2xx-spi", | |
135 | .id = 3, | |
136 | .dev = { | |
137 | .platform_data = &pxa_ssp3_spi_master_info, | |
138 | } | |
139 | }; | |
140 | ||
141 | struct platform_device pxa_spi_ssp4 = { | |
142 | .name = "pxa2xx-spi", | |
143 | .id = 4, | |
144 | .dev = { | |
145 | .platform_data = &pxa_ssp4_spi_master_info, | |
146 | } | |
147 | }; | |
148 | ||
149 | static struct platform_device *icontrol_spi_devices[] __initdata = { | |
150 | &pxa_spi_ssp3, | |
151 | &pxa_spi_ssp4, | |
152 | }; | |
153 | ||
154 | static mfp_cfg_t mfp_can_cfg[] __initdata = { | |
155 | /* CAN CS lines */ | |
156 | GPIO15_GPIO, | |
157 | GPIO16_GPIO, | |
158 | GPIO17_GPIO, | |
159 | GPIO24_GPIO, | |
160 | ||
161 | /* SPI (SSP3) lines */ | |
162 | GPIO89_SSP3_SCLK, | |
163 | GPIO91_SSP3_TXD, | |
164 | GPIO92_SSP3_RXD, | |
165 | ||
166 | /* SPI (SSP4) lines */ | |
167 | GPIO93_SSP4_SCLK, | |
168 | GPIO95_SSP4_TXD, | |
169 | GPIO96_SSP4_RXD, | |
170 | ||
171 | /* CAN nIRQ lines */ | |
172 | GPIO74_GPIO | MFP_LPM_EDGE_RISE, | |
173 | GPIO75_GPIO | MFP_LPM_EDGE_RISE, | |
174 | GPIO76_GPIO | MFP_LPM_EDGE_RISE, | |
175 | GPIO77_GPIO | MFP_LPM_EDGE_RISE | |
176 | }; | |
177 | ||
178 | static void __init icontrol_can_init(void) | |
179 | { | |
180 | pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_can_cfg)); | |
181 | platform_add_devices(ARRAY_AND_SIZE(icontrol_spi_devices)); | |
182 | spi_register_board_info(ARRAY_AND_SIZE(mcp251x_board_info)); | |
183 | } | |
184 | ||
185 | static void __init icontrol_init(void) | |
186 | { | |
187 | mxm_8x10_barebones_init(); | |
188 | mxm_8x10_usb_host_init(); | |
189 | mxm_8x10_mmc_init(); | |
190 | ||
191 | icontrol_can_init(); | |
192 | } | |
193 | ||
194 | MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM") | |
195 | .phys_io = 0x40000000, | |
196 | .boot_params = 0xa0000100, | |
197 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
198 | .map_io = pxa_map_io, | |
199 | .init_irq = pxa3xx_init_irq, | |
200 | .timer = &pxa_timer, | |
201 | .init_machine = icontrol_init | |
202 | MACHINE_END |