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/gpio.h>
12 #include <linux/irq.h>
13 #include <linux/i2c.h>
15 #include <asm/mach/arch.h>
16 #include <asm/mach-types.h>
18 #include <plat/pincfg.h>
21 #include <mach/hardware.h>
22 #include <mach/devices.h>
23 #include <mach/setup.h>
25 #include "pins-db5500.h"
26 #include "devices-db5500.h"
27 #include <linux/led-lm3530.h>
33 static pin_cfg_t u5500_pins
[] = {
35 GPIO218_I2C2_SCL
| PIN_INPUT_PULLUP
,
36 GPIO219_I2C2_SDA
| PIN_INPUT_PULLUP
,
39 GPIO226_GPIO
| PIN_OUTPUT_LOW
,
41 /* Backlight Enbale */
42 GPIO224_GPIO
| PIN_OUTPUT_HIGH
,
48 #define U5500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \
49 static struct nmk_i2c_controller u5500_i2c##id##_data = { \
51 * slave data setup time, which is \
52 * 250 ns,100ns,10ns which is 14,6,2 \
53 * respectively for a 48 Mhz \
57 /* Tx FIFO threshold */ \
59 /* Rx FIFO threshold */ \
61 /* std. mode operation */ \
66 * The board uses TODO <3> i2c controllers, initialize all of
67 * them with slave data setup time of 250 ns,
68 * Tx & Rx FIFO threshold values as 1 and standard
72 U5500_I2C_CONTROLLER(2, 0xe, 1, 1, 400000, I2C_FREQ_MODE_FAST
);
74 static struct lm3530_platform_data u5500_als_platform_data
= {
75 .mode
= LM3530_BL_MODE_MANUAL
,
76 .als_input_mode
= LM3530_INPUT_ALS1
,
77 .max_current
= LM3530_FS_CURR_26mA
,
79 .als_avrg_time
= LM3530_ALS_AVRG_TIME_512ms
,
80 .brt_ramp_law
= 1, /* Linear */
81 .brt_ramp_fall
= LM3530_RAMP_TIME_8s
,
82 .brt_ramp_rise
= LM3530_RAMP_TIME_8s
,
83 .als1_resistor_sel
= LM3530_ALS_IMPD_13_53kOhm
,
84 .als2_resistor_sel
= LM3530_ALS_IMPD_Z
,
85 .als_vmin
= 730, /* mV */
86 .als_vmax
= 1020, /* mV */
87 .brt_val
= 0x7F, /* Max brightness */
91 static struct i2c_board_info __initdata u5500_i2c2_devices
[] = {
94 I2C_BOARD_INFO("lm3530-led", 0x36),
95 .platform_data
= &u5500_als_platform_data
,
99 static void __init
u5500_i2c_init(void)
101 db5500_add_i2c2(&u5500_i2c2_data
);
102 i2c_register_board_info(2, ARRAY_AND_SIZE(u5500_i2c2_devices
));
104 static void __init
u5500_uart_init(void)
106 db5500_add_uart0(NULL
);
107 db5500_add_uart1(NULL
);
108 db5500_add_uart2(NULL
);
111 static void __init
u5500_init_machine(void)
113 u5500_init_devices();
114 nmk_config_pins(u5500_pins
, ARRAY_SIZE(u5500_pins
));
120 MACHINE_START(U5500
, "ST-Ericsson U5500 Platform")
121 .boot_params
= 0x00000100,
122 .map_io
= u5500_map_io
,
123 .init_irq
= ux500_init_irq
,
124 .timer
= &ux500_timer
,
125 .init_machine
= u5500_init_machine
,