2 * Copyright (C) ST-Ericsson SA 2010
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL) version 2
8 #include <linux/init.h>
9 #include <linux/platform_device.h>
10 #include <linux/amba/bus.h>
11 #include <linux/irq.h>
12 #include <linux/i2c.h>
13 #include <linux/mfd/abx500/ab5500.h>
15 #include <asm/hardware/gic.h>
16 #include <asm/mach/arch.h>
17 #include <asm/mach-types.h>
19 #include <plat/pincfg.h>
21 #include <plat/gpio-nomadik.h>
23 #include <mach/hardware.h>
24 #include <mach/devices.h>
25 #include <mach/setup.h>
27 #include "pins-db5500.h"
28 #include "devices-db5500.h"
29 #include <linux/led-lm3530.h>
35 static pin_cfg_t u5500_pins
[] = {
37 GPIO218_I2C2_SCL
| PIN_INPUT_PULLUP
,
38 GPIO219_I2C2_SDA
| PIN_INPUT_PULLUP
,
41 GPIO226_GPIO
| PIN_OUTPUT_LOW
,
43 /* Backlight Enbale */
44 GPIO224_GPIO
| PIN_OUTPUT_HIGH
,
50 #define U5500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \
51 static struct nmk_i2c_controller u5500_i2c##id##_data = { \
53 * slave data setup time, which is \
54 * 250 ns,100ns,10ns which is 14,6,2 \
55 * respectively for a 48 Mhz \
59 /* Tx FIFO threshold */ \
61 /* Rx FIFO threshold */ \
63 /* std. mode operation */ \
68 * The board uses TODO <3> i2c controllers, initialize all of
69 * them with slave data setup time of 250 ns,
70 * Tx & Rx FIFO threshold values as 1 and standard
74 U5500_I2C_CONTROLLER(2, 0xe, 1, 1, 400000, I2C_FREQ_MODE_FAST
);
76 static struct lm3530_platform_data u5500_als_platform_data
= {
77 .mode
= LM3530_BL_MODE_MANUAL
,
78 .als_input_mode
= LM3530_INPUT_ALS1
,
79 .max_current
= LM3530_FS_CURR_26mA
,
81 .als_avrg_time
= LM3530_ALS_AVRG_TIME_512ms
,
82 .brt_ramp_law
= 1, /* Linear */
83 .brt_ramp_fall
= LM3530_RAMP_TIME_8s
,
84 .brt_ramp_rise
= LM3530_RAMP_TIME_8s
,
85 .als1_resistor_sel
= LM3530_ALS_IMPD_13_53kOhm
,
86 .als2_resistor_sel
= LM3530_ALS_IMPD_Z
,
87 .als_vmin
= 730, /* mV */
88 .als_vmax
= 1020, /* mV */
89 .brt_val
= 0x7F, /* Max brightness */
92 static struct i2c_board_info __initdata u5500_i2c2_devices
[] = {
95 I2C_BOARD_INFO("lm3530-led", 0x36),
96 .platform_data
= &u5500_als_platform_data
,
100 static void __init
u5500_i2c_init(void)
102 db5500_add_i2c2(&u5500_i2c2_data
);
103 i2c_register_board_info(2, ARRAY_AND_SIZE(u5500_i2c2_devices
));
106 static struct ab5500_platform_data ab5500_plf_data
= {
111 .init_settings
= NULL
,
112 .init_settings_sz
= 0,
113 .pm_power_off
= false,
116 static struct platform_device ab5500_device
= {
117 .name
= "ab5500-core",
120 .platform_data
= &ab5500_plf_data
,
125 static struct platform_device
*u5500_platform_devices
[] __initdata
= {
129 static void __init
u5500_uart_init(void)
131 db5500_add_uart0(NULL
);
132 db5500_add_uart1(NULL
);
133 db5500_add_uart2(NULL
);
136 static void __init
u5500_init_machine(void)
138 u5500_init_devices();
139 nmk_config_pins(u5500_pins
, ARRAY_SIZE(u5500_pins
));
144 platform_add_devices(u5500_platform_devices
,
145 ARRAY_SIZE(u5500_platform_devices
));
148 MACHINE_START(U5500
, "ST-Ericsson U5500 Platform")
149 .atag_offset
= 0x100,
150 .map_io
= u5500_map_io
,
151 .init_irq
= ux500_init_irq
,
152 .timer
= &ux500_timer
,
153 .handle_irq
= gic_handle_irq
,
154 .init_machine
= u5500_init_machine
,