1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-pxa/icontrol.c
5 * Support for the iControl and SafeTcam platforms from TMT Services
6 * using the Embedian MXM-8x10 Computer on Module
8 * Copyright (C) 2009 TMT Services & Supplies (Pty) Ltd.
10 * 2010-01-21 Hennie van der Merve <hvdmerwe@tmtservies.co.za>
13 #include <linux/irq.h>
14 #include <linux/platform_device.h>
15 #include <linux/property.h>
16 #include <linux/gpio.h>
18 #include <asm/mach-types.h>
19 #include <asm/mach/arch.h>
24 #include <linux/spi/spi.h>
25 #include <linux/spi/pxa2xx_spi.h>
26 #include <linux/regulator/machine.h>
30 #define ICONTROL_MCP251x_nCS1 (15)
31 #define ICONTROL_MCP251x_nCS2 (16)
32 #define ICONTROL_MCP251x_nCS3 (17)
33 #define ICONTROL_MCP251x_nCS4 (24)
35 #define ICONTROL_MCP251x_nIRQ1 (74)
36 #define ICONTROL_MCP251x_nIRQ2 (75)
37 #define ICONTROL_MCP251x_nIRQ3 (76)
38 #define ICONTROL_MCP251x_nIRQ4 (77)
40 static struct pxa2xx_spi_chip mcp251x_chip_info1 = {
45 .gpio_cs = ICONTROL_MCP251x_nCS1
48 static struct pxa2xx_spi_chip mcp251x_chip_info2 = {
53 .gpio_cs = ICONTROL_MCP251x_nCS2
56 static struct pxa2xx_spi_chip mcp251x_chip_info3 = {
61 .gpio_cs = ICONTROL_MCP251x_nCS3
64 static struct pxa2xx_spi_chip mcp251x_chip_info4 = {
69 .gpio_cs = ICONTROL_MCP251x_nCS4
72 static const struct property_entry mcp251x_properties[] = {
73 PROPERTY_ENTRY_U32("clock-frequency", 16000000),
77 static const struct software_node mcp251x_node = {
78 .properties = mcp251x_properties,
81 static struct spi_board_info mcp251x_board_info[] = {
83 .modalias = "mcp2515",
84 .max_speed_hz = 6500000,
87 .swnode = &mcp251x_node,
88 .controller_data = &mcp251x_chip_info1,
89 .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ1)
92 .modalias = "mcp2515",
93 .max_speed_hz = 6500000,
96 .swnode = &mcp251x_node,
97 .controller_data = &mcp251x_chip_info2,
98 .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ2)
101 .modalias = "mcp2515",
102 .max_speed_hz = 6500000,
105 .swnode = &mcp251x_node,
106 .controller_data = &mcp251x_chip_info3,
107 .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ3)
110 .modalias = "mcp2515",
111 .max_speed_hz = 6500000,
114 .swnode = &mcp251x_node,
115 .controller_data = &mcp251x_chip_info4,
116 .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ4)
120 static struct pxa2xx_spi_controller pxa_ssp3_spi_master_info = {
125 static struct pxa2xx_spi_controller pxa_ssp4_spi_master_info = {
130 struct platform_device pxa_spi_ssp3 = {
131 .name = "pxa2xx-spi",
134 .platform_data = &pxa_ssp3_spi_master_info,
138 struct platform_device pxa_spi_ssp4 = {
139 .name = "pxa2xx-spi",
142 .platform_data = &pxa_ssp4_spi_master_info,
146 static struct platform_device *icontrol_spi_devices[] __initdata = {
151 static mfp_cfg_t mfp_can_cfg[] __initdata = {
158 /* SPI (SSP3) lines */
163 /* SPI (SSP4) lines */
169 GPIO74_GPIO | MFP_LPM_EDGE_RISE,
170 GPIO75_GPIO | MFP_LPM_EDGE_RISE,
171 GPIO76_GPIO | MFP_LPM_EDGE_RISE,
172 GPIO77_GPIO | MFP_LPM_EDGE_RISE
175 static void __init icontrol_can_init(void)
177 pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_can_cfg));
178 platform_add_devices(ARRAY_AND_SIZE(icontrol_spi_devices));
179 spi_register_board_info(ARRAY_AND_SIZE(mcp251x_board_info));
182 static void __init icontrol_init(void)
184 mxm_8x10_barebones_init();
185 mxm_8x10_usb_host_init();
190 regulator_has_full_constraints();
193 MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM")
194 .atag_offset = 0x100,
195 .map_io = pxa3xx_map_io,
196 .nr_irqs = PXA_NR_IRQS,
197 .init_irq = pxa3xx_init_irq,
198 .handle_irq = pxa3xx_handle_irq,
199 .init_time = pxa_timer_init,
200 .init_machine = icontrol_init,
201 .restart = pxa_restart,