Blame view

arch/arm/mach-ux500/board-u5500.c 3.5 KB
591d8dd71   Rabin Vincent   ARM: 6090/1: ux50...
1
2
3
4
5
6
7
8
9
10
  /*
   * Copyright (C) ST-Ericsson SA 2010
   *
   * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
   * License terms: GNU General Public License (GPL) version 2
   */
  
  #include <linux/init.h>
  #include <linux/platform_device.h>
  #include <linux/amba/bus.h>
fbf1eadf9   Rabin Vincent   ux500: rework dev...
11
  #include <linux/irq.h>
b09628ef5   Linus Walleij   mach-ux500: add l...
12
  #include <linux/i2c.h>
ee66e653c   Linus Walleij   mfd: Unify abx500...
13
  #include <linux/mfd/abx500/ab5500.h>
591d8dd71   Rabin Vincent   ARM: 6090/1: ux50...
14

bbf5f3859   Marc Zyngier   ARM: ux500: conve...
15
  #include <asm/hardware/gic.h>
591d8dd71   Rabin Vincent   ARM: 6090/1: ux50...
16
17
  #include <asm/mach/arch.h>
  #include <asm/mach-types.h>
b09628ef5   Linus Walleij   mach-ux500: add l...
18
19
  #include <plat/pincfg.h>
  #include <plat/i2c.h>
0f3328619   Linus Walleij   ARM: 7032/1: plat...
20
  #include <plat/gpio-nomadik.h>
b09628ef5   Linus Walleij   mach-ux500: add l...
21

591d8dd71   Rabin Vincent   ARM: 6090/1: ux50...
22
23
24
  #include <mach/hardware.h>
  #include <mach/devices.h>
  #include <mach/setup.h>
b09628ef5   Linus Walleij   mach-ux500: add l...
25
  #include "pins-db5500.h"
fbf1eadf9   Rabin Vincent   ux500: rework dev...
26
  #include "devices-db5500.h"
b09628ef5   Linus Walleij   mach-ux500: add l...
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  #include <linux/led-lm3530.h>
  
  /*
   * GPIO
   */
  
  static pin_cfg_t u5500_pins[] = {
  	/* I2C */
  	GPIO218_I2C2_SCL        | PIN_INPUT_PULLUP,
  	GPIO219_I2C2_SDA        | PIN_INPUT_PULLUP,
  
  	/* DISPLAY_ENABLE */
  	GPIO226_GPIO        | PIN_OUTPUT_LOW,
  
  	/* Backlight Enbale */
  	GPIO224_GPIO        | PIN_OUTPUT_HIGH,
  };
  /*
   * I2C
   */
  
  #define U5500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \
  static struct nmk_i2c_controller u5500_i2c##id##_data = { \
  	/*				\
  	 * slave data setup time, which is	\
  	 * 250 ns,100ns,10ns which is 14,6,2	\
  	 * respectively for a 48 Mhz	\
  	 * i2c clock			\
  	 */				\
  	.slsu		= _slsu,	\
  	/* Tx FIFO threshold */		\
  	.tft		= _tft,		\
  	/* Rx FIFO threshold */		\
  	.rft		= _rft,		\
  	/* std. mode operation */	\
  	.clk_freq	= clk,		\
  	.sm		= _sm,		\
  }
  /*
   * The board uses TODO <3> i2c controllers, initialize all of
   * them with slave data setup time of 250 ns,
   * Tx & Rx FIFO threshold values as 1 and standard
   * mode of operation
   */
  
  U5500_I2C_CONTROLLER(2,	0xe, 1, 1, 400000, I2C_FREQ_MODE_FAST);
  
  static struct lm3530_platform_data u5500_als_platform_data = {
  	.mode = LM3530_BL_MODE_MANUAL,
  	.als_input_mode = LM3530_INPUT_ALS1,
  	.max_current = LM3530_FS_CURR_26mA,
  	.pwm_pol_hi = true,
  	.als_avrg_time = LM3530_ALS_AVRG_TIME_512ms,
  	.brt_ramp_law = 1,      /* Linear */
  	.brt_ramp_fall = LM3530_RAMP_TIME_8s,
  	.brt_ramp_rise = LM3530_RAMP_TIME_8s,
  	.als1_resistor_sel = LM3530_ALS_IMPD_13_53kOhm,
  	.als2_resistor_sel = LM3530_ALS_IMPD_Z,
  	.als_vmin = 730,	/* mV */
  	.als_vmax = 1020,	/* mV */
  	.brt_val = 0x7F,	/* Max brightness */
  };
fbf1eadf9   Rabin Vincent   ux500: rework dev...
89

b09628ef5   Linus Walleij   mach-ux500: add l...
90
91
92
93
94
95
96
97
98
99
100
101
102
  static struct i2c_board_info __initdata u5500_i2c2_devices[] = {
  	{
  		/* Backlight */
  		I2C_BOARD_INFO("lm3530-led", 0x36),
  		.platform_data = &u5500_als_platform_data,
  	},
  };
  
  static void __init u5500_i2c_init(void)
  {
  	db5500_add_i2c2(&u5500_i2c2_data);
  	i2c_register_board_info(2, ARRAY_AND_SIZE(u5500_i2c2_devices));
  }
b7ddac53d   Mattias Wallin   mach-ux500: ab550...
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
  
  static struct ab5500_platform_data ab5500_plf_data = {
  	.irq = {
  		.base = 0,
  		.count = 0,
  	},
  	.init_settings = NULL,
  	.init_settings_sz = 0,
  	.pm_power_off = false,
  };
  
  static struct platform_device ab5500_device = {
  	.name = "ab5500-core",
  	.id = 0,
  	.dev = {
  		.platform_data = &ab5500_plf_data,
  	},
  	.num_resources = 0,
  };
  
  static struct platform_device *u5500_platform_devices[] __initdata = {
  	&ab5500_device,
  };
fbf1eadf9   Rabin Vincent   ux500: rework dev...
126
127
  static void __init u5500_uart_init(void)
  {
5d7b8467e   Linus Walleij   mach-ux500: confi...
128
129
130
  	db5500_add_uart0(NULL);
  	db5500_add_uart1(NULL);
  	db5500_add_uart2(NULL);
fbf1eadf9   Rabin Vincent   ux500: rework dev...
131
  }
591d8dd71   Rabin Vincent   ARM: 6090/1: ux50...
132
133
134
135
  
  static void __init u5500_init_machine(void)
  {
  	u5500_init_devices();
b09628ef5   Linus Walleij   mach-ux500: add l...
136
137
  	nmk_config_pins(u5500_pins, ARRAY_SIZE(u5500_pins));
  	u5500_i2c_init();
bab263e0c   Per Forlin   ux500: Add eMMC s...
138
  	u5500_sdi_init();
fbf1eadf9   Rabin Vincent   ux500: rework dev...
139
  	u5500_uart_init();
b7ddac53d   Mattias Wallin   mach-ux500: ab550...
140
141
142
  
  	platform_add_devices(u5500_platform_devices,
  		ARRAY_SIZE(u5500_platform_devices));
591d8dd71   Rabin Vincent   ARM: 6090/1: ux50...
143
  }
bab263e0c   Per Forlin   ux500: Add eMMC s...
144
  MACHINE_START(U5500, "ST-Ericsson U5500 Platform")
bc77b1aa0   Nicolas Pitre   ARM: mach-ux500: ...
145
  	.atag_offset	= 0x100,
591d8dd71   Rabin Vincent   ARM: 6090/1: ux50...
146
147
148
  	.map_io		= u5500_map_io,
  	.init_irq	= ux500_init_irq,
  	.timer		= &ux500_timer,
bbf5f3859   Marc Zyngier   ARM: ux500: conve...
149
  	.handle_irq	= gic_handle_irq,
591d8dd71   Rabin Vincent   ARM: 6090/1: ux50...
150
151
  	.init_machine	= u5500_init_machine,
  MACHINE_END