2 * Copyright (C) 2008-2009 ST-Ericsson
4 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/interrupt.h>
14 #include <linux/platform_device.h>
16 #include <linux/amba/bus.h>
17 #include <linux/amba/pl022.h>
18 #include <linux/spi/spi.h>
20 #include <asm/mach-types.h>
21 #include <asm/mach/arch.h>
25 #include <mach/hardware.h>
26 #include <mach/setup.h>
27 #include <mach/devices.h>
29 static void ab4500_spi_cs_control(u32 command
)
31 /* set the FRM signal, which is CS - TODO */
34 struct pl022_config_chip ab4500_chip_info
= {
35 .lbm
= LOOPBACK_DISABLED
,
36 .com_mode
= INTERRUPT_TRANSFER
,
37 .iface
= SSP_INTERFACE_MOTOROLA_SPI
,
38 /* we can act as master only */
39 .hierarchy
= SSP_MASTER
,
40 .slave_tx_disable
= 0,
41 .endian_rx
= SSP_RX_MSB
,
42 .endian_tx
= SSP_TX_MSB
,
43 .data_size
= SSP_DATA_BITS_24
,
44 .rx_lev_trig
= SSP_RX_1_OR_MORE_ELEM
,
45 .tx_lev_trig
= SSP_TX_1_OR_MORE_EMPTY_LOC
,
46 .clk_phase
= SSP_CLK_SECOND_EDGE
,
47 .clk_pol
= SSP_CLK_POL_IDLE_HIGH
,
48 .cs_control
= ab4500_spi_cs_control
,
51 static struct spi_board_info u8500_spi_devices
[] = {
54 .controller_data
= &ab4500_chip_info
,
55 .max_speed_hz
= 12000000,
63 static struct pl022_ssp_controller ssp0_platform_data
= {
65 /* pl022 not yet supports dma */
67 /* on this platform, gpio 31,142,144,214 &
68 * 224 are connected as chip selects
73 #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \
74 static struct nmk_i2c_controller u8500_i2c##id##_data = { \
76 * slave data setup time, which is \
77 * 250 ns,100ns,10ns which is 14,6,2 \
78 * respectively for a 48 Mhz \
82 /* Tx FIFO threshold */ \
84 /* Rx FIFO threshold */ \
86 /* std. mode operation */ \
92 * The board uses 4 i2c controllers, initialize all of
93 * them with slave data setup time of 250 ns,
94 * Tx & Rx FIFO threshold values as 1 and standard
97 U8500_I2C_CONTROLLER(0, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD
);
98 U8500_I2C_CONTROLLER(1, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD
);
99 U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD
);
100 U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD
);
102 static struct amba_device
*amba_devs
[] __initdata
= {
109 /* add any platform devices here - TODO */
110 static struct platform_device
*platform_devs
[] __initdata
= {
117 static void __init
u8500_init_machine(void)
121 u8500_i2c0_device
.dev
.platform_data
= &u8500_i2c0_data
;
122 ux500_i2c1_device
.dev
.platform_data
= &u8500_i2c1_data
;
123 ux500_i2c2_device
.dev
.platform_data
= &u8500_i2c2_data
;
124 ux500_i2c3_device
.dev
.platform_data
= &u8500_i2c3_data
;
126 u8500_ssp0_device
.dev
.platform_data
= &ssp0_platform_data
;
128 /* Register the active AMBA devices on this board */
129 for (i
= 0; i
< ARRAY_SIZE(amba_devs
); i
++)
130 amba_device_register(amba_devs
[i
], &iomem_resource
);
132 platform_add_devices(platform_devs
, ARRAY_SIZE(platform_devs
));
134 spi_register_board_info(u8500_spi_devices
,
135 ARRAY_SIZE(u8500_spi_devices
));
137 u8500_init_devices();
140 MACHINE_START(U8500
, "ST-Ericsson MOP500 platform")
141 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
142 .phys_io
= U8500_UART2_BASE
,
143 .io_pg_offst
= (IO_ADDRESS(U8500_UART2_BASE
) >> 18) & 0xfffc,
144 .boot_params
= 0x100,
145 .map_io
= u8500_map_io
,
146 .init_irq
= ux500_init_irq
,
147 /* we re-use nomadik timer here */
148 .timer
= &u8500_timer
,
149 .init_machine
= u8500_init_machine
,