2 * linux/arch/arm/mach-pxa/icontrol.c
4 * Support for the iControl and SafeTcam platforms from TMT Services
5 * using the Embedian MXM-8x10 Computer on Module
7 * Copyright (C) 2009 TMT Services & Supplies (Pty) Ltd.
9 * 2010-01-21 Hennie van der Merve <hvdmerwe@tmtservies.co.za>
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.
16 #include <linux/irq.h>
17 #include <linux/platform_device.h>
18 #include <linux/gpio.h>
20 #include <asm/mach-types.h>
21 #include <asm/mach/arch.h>
23 #include <mach/pxa320.h>
24 #include <mach/mxm8x10.h>
26 #include <linux/spi/spi.h>
27 #include <linux/spi/pxa2xx_spi.h>
28 #include <linux/can/platform/mcp251x.h>
32 #define ICONTROL_MCP251x_nCS1 (15)
33 #define ICONTROL_MCP251x_nCS2 (16)
34 #define ICONTROL_MCP251x_nCS3 (17)
35 #define ICONTROL_MCP251x_nCS4 (24)
37 #define ICONTROL_MCP251x_nIRQ1 (74)
38 #define ICONTROL_MCP251x_nIRQ2 (75)
39 #define ICONTROL_MCP251x_nIRQ3 (76)
40 #define ICONTROL_MCP251x_nIRQ4 (77)
42 static struct pxa2xx_spi_chip mcp251x_chip_info1 = {
47 .gpio_cs = ICONTROL_MCP251x_nCS1
50 static struct pxa2xx_spi_chip mcp251x_chip_info2 = {
55 .gpio_cs = ICONTROL_MCP251x_nCS2
58 static struct pxa2xx_spi_chip mcp251x_chip_info3 = {
63 .gpio_cs = ICONTROL_MCP251x_nCS3
66 static struct pxa2xx_spi_chip mcp251x_chip_info4 = {
71 .gpio_cs = ICONTROL_MCP251x_nCS4
74 static struct mcp251x_platform_data mcp251x_info = {
75 .oscillator_frequency = 16E6,
78 static struct spi_board_info mcp251x_board_info[] = {
80 .modalias = "mcp2515",
81 .max_speed_hz = 6500000,
84 .platform_data = &mcp251x_info,
85 .controller_data = &mcp251x_chip_info1,
86 .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ1)
89 .modalias = "mcp2515",
90 .max_speed_hz = 6500000,
93 .platform_data = &mcp251x_info,
94 .controller_data = &mcp251x_chip_info2,
95 .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ2)
98 .modalias = "mcp2515",
99 .max_speed_hz = 6500000,
102 .platform_data = &mcp251x_info,
103 .controller_data = &mcp251x_chip_info3,
104 .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ3)
107 .modalias = "mcp2515",
108 .max_speed_hz = 6500000,
111 .platform_data = &mcp251x_info,
112 .controller_data = &mcp251x_chip_info4,
113 .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ4)
117 static struct pxa2xx_spi_master pxa_ssp3_spi_master_info = {
118 .clock_enable = CKEN_SSP3,
123 static struct pxa2xx_spi_master pxa_ssp4_spi_master_info = {
124 .clock_enable = CKEN_SSP4,
129 struct platform_device pxa_spi_ssp3 = {
130 .name = "pxa2xx-spi",
133 .platform_data = &pxa_ssp3_spi_master_info,
137 struct platform_device pxa_spi_ssp4 = {
138 .name = "pxa2xx-spi",
141 .platform_data = &pxa_ssp4_spi_master_info,
145 static struct platform_device *icontrol_spi_devices[] __initdata = {
150 static mfp_cfg_t mfp_can_cfg[] __initdata = {
157 /* SPI (SSP3) lines */
162 /* SPI (SSP4) lines */
168 GPIO74_GPIO | MFP_LPM_EDGE_RISE,
169 GPIO75_GPIO | MFP_LPM_EDGE_RISE,
170 GPIO76_GPIO | MFP_LPM_EDGE_RISE,
171 GPIO77_GPIO | MFP_LPM_EDGE_RISE
174 static void __init icontrol_can_init(void)
176 pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_can_cfg));
177 platform_add_devices(ARRAY_AND_SIZE(icontrol_spi_devices));
178 spi_register_board_info(ARRAY_AND_SIZE(mcp251x_board_info));
181 static void __init icontrol_init(void)
183 mxm_8x10_barebones_init();
184 mxm_8x10_usb_host_init();
190 MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM")
191 .atag_offset = 0x100,
192 .map_io = pxa3xx_map_io,
193 .nr_irqs = PXA_NR_IRQS,
194 .init_irq = pxa3xx_init_irq,
195 .handle_irq = pxa3xx_handle_irq,
196 .init_time = pxa_timer_init,
197 .init_machine = icontrol_init,
198 .restart = pxa_restart,