summaryrefslogtreecommitdiff
path: root/arch/arm/mach-ux500/board-u5500.c
blob: 9b615de8fac7cf04d53ef3953f77b99b2462e538 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
/*
 * Copyright (C) ST-Ericsson SA 2010
 *
 * License terms: GNU General Public License (GPL) version 2
 */

#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/amba/bus.h>
#include <linux/amba/pl022.h>
#include <linux/gpio.h>
#include <linux/irq.h>
#include <linux/i2c.h>
#include <linux/i2s/i2s.h>
#include <linux/mfd/abx500.h>
#include <linux/ab5500-vibra.h>
#include <linux/led-lm3530.h>
#include <../drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h>
#include <linux/input/matrix_keypad.h>
#include <linux/lsm303dlh.h>
#include <linux/leds-ab5500.h>
#include <linux/cyttsp.h>

#include <video/av8100.h>

#include <asm/mach/arch.h>
#include <asm/mach-types.h>

#include <plat/pincfg.h>
#include <plat/i2c.h>

#include <mach/hardware.h>
#include <mach/ste-dma40-db5500.h>
#include <mach/msp.h>
#include <mach/devices.h>
#include <mach/setup.h>
#include <mach/db5500-keypad.h>
#include <mach/crypto-ux500.h>
#include <mach/usb.h>
#include <mach/abx500-accdet.h>

#include "pins-db5500.h"
#include "pins.h"
#include "devices-db5500.h"
#include "board-u5500.h"
#include "board-u5500-bm.h"
#include "board-u5500-wlan.h"
#include "board-ux500-usb.h"

/*
 * LSM303DLH
 */

static struct lsm303dlh_platform_data __initdata lsm303dlh_pdata = {
	.name_a = "lsm303dlh.0",
	.name_m = "lsm303dlh.1",
	.axis_map_x = 1,
	.axis_map_y = 0,
	.axis_map_z = 2,
	.negative_x = 0,
	.negative_y = 0,
	.negative_z = 1,
};

/*
 * Touchscreen
 */
static struct synaptics_rmi4_platform_data rmi4_i2c_platformdata = {
	.irq_number	= NOMADIK_GPIO_TO_IRQ(179),
	.irq_type	= (IRQF_TRIGGER_FALLING | IRQF_SHARED),
#if defined(CONFIG_DISPLAY_GENERIC_DSI_PRIMARY_ROTATION_ANGLE) &&      \
			CONFIG_DISPLAY_GENERIC_DSI_PRIMARY_ROTATION_ANGLE == 270
	.x_flip		= true,
	.y_flip		= false,
#else
	.x_flip		= false,
	.y_flip		= true,
#endif
	.regulator_en	= true,
};

static struct av8100_platform_data av8100_plat_data = {
	.irq = NOMADIK_GPIO_TO_IRQ(223),
	.reset = 225,
	.alt_powerupseq = true,
	.mclk_freq = 1, /* MCLK_RNG_22_27 */
};

/*
 * leds LM3530
 */
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 */
};


/* leds-ab5500 */
static struct ab5500_hvleds_platform_data ab5500_hvleds_data = {
	.hw_fade = false,
	.leds = {
		[0] = {
			.name = "red",
			.led_on = true,
			.led_id = 0,
			.fade_hi = 255,
			.fade_lo = 0,
			.max_current = 10, /* wrong value may damage h/w */
		},
		[1] = {
			.name = "green",
			.led_on = true,
			.led_id = 1,
			.fade_hi = 255,
			.fade_lo = 0,
			.max_current = 10, /* wrong value may damage h/w */
		},
		[2] {
			.name = "blue",
			.led_on = true,
			.led_id = 2,
			.fade_hi = 255,
			.fade_lo = 0,
			.max_current = 10, /* wrong value may damage h/w */
		},
	},
};

static struct ab5500_ponkey_platform_data ab5500_ponkey_data = {
	/*
	 * Shutdown time in secs. Can be set
	 * to 10sec, 5sec and 0sec(disabled)
	 */
	.shutdown_secs = 10,
};

/* ab5500-vibra */
static struct ab5500_vibra_platform_data ab5500_vibra_data = {
	.type           = AB5500_VIB_ROTARY,
	.voltage        = AB5500_VIB_VOLT_MIN,
	.res_freq       = AB5500_VIB_RFREQ_150HZ,
	.magnitude      = 0x7F,
	.pulse          = AB5500_VIB_PULSE_130ms,
};

/*
 * I2C
 */

#define U5500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, t_out, _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,		\
	/* Slave response timeout(ms) */\
	.timeout	= t_out,	\
	.sm		= _sm,		\
}

/*
 * The board uses 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(1,	0xe, 1, 10, 400000, 200, I2C_FREQ_MODE_FAST);
U5500_I2C_CONTROLLER(2,	0xe, 1, 10, 400000, 200, I2C_FREQ_MODE_FAST);
U5500_I2C_CONTROLLER(3,	0xe, 1, 10, 400000, 200, I2C_FREQ_MODE_FAST);

static struct i2c_board_info __initdata u5500_i2c1_devices[] = {
	{
		I2C_BOARD_INFO("synaptics_rmi4_i2c", 0x4B),
		.platform_data = &rmi4_i2c_platformdata,
	},
};

static struct i2c_board_info __initdata u5500v1_i2c2_sensor_devices[] = {
 	{
 		/* LSM303DLH Accelerometer */
 		I2C_BOARD_INFO("lsm303dlh_a", 0x19),
 		.platform_data = &lsm303dlh_pdata,
 	},
 	{
		/* LSM303DLH Magnetometer */
		I2C_BOARD_INFO("lsm303dlh_m", 0x1E),
		.platform_data = &lsm303dlh_pdata,
	},
};

static struct i2c_board_info __initdata u5500v2_i2c2_sensor_devices[] = {
	{
		/* LSM303DLHC Accelerometer */
		I2C_BOARD_INFO("lsm303dlhc_a", 0x19),
		.platform_data = &lsm303dlh_pdata,
	},
	{
		/* LSM303DLH Magnetometer */
		I2C_BOARD_INFO("lsm303dlh_m", 0x1E),
		.platform_data = &lsm303dlh_pdata,
	},
};

static struct i2c_board_info __initdata u5500_i2c2_devices[] = {
	{
		/* Backlight */
		I2C_BOARD_INFO("lm3530-led", 0x36),
		.platform_data = &u5500_als_platform_data,
	},
	{
		I2C_BOARD_INFO("av8100", 0x70),
		.platform_data = &av8100_plat_data,
	},
};

/*
 * Keypad
 */

#define ROW_PIN_I0      128
#define ROW_PIN_I1      130
#define ROW_PIN_I2      132
#define ROW_PIN_I3      134
#define COL_PIN_O4      137
#define COL_PIN_O5      139

static int db5500_kp_rows[] = {
	ROW_PIN_I0, ROW_PIN_I1, ROW_PIN_I2, ROW_PIN_I3,
};

static int db5500_kp_cols[] = {
	COL_PIN_O4, COL_PIN_O5,
};

static bool db5500_config;
static int db5500_set_gpio_row(int gpio)
{
	int ret = -1;


	if (!db5500_config) {
		ret = gpio_request(gpio, "db5500_kpd");
		if (ret < 0) {
			pr_err("db5500_set_gpio_row: gpio request failed\n");
			return ret;
		}
	}

	ret = gpio_direction_output(gpio, 1);
	if (ret < 0) {
		pr_err("db5500_set_gpio_row: gpio direction failed\n");
		gpio_free(gpio);
	}

	return ret;
}

static int db5500_kp_init(void)
{
	struct ux500_pins *pins;
	int ret, i;

	pins = ux500_pins_get("db5500_kp");
	if (pins)
		ux500_pins_enable(pins);

	for (i = 0; i < ARRAY_SIZE(db5500_kp_rows); i++) {
		ret = db5500_set_gpio_row(db5500_kp_rows[i]);
		if (ret < 0) {
			pr_err("db5500_kp_init: failed init\n");
			return ret;
		}
	}

	if (!db5500_config)
		db5500_config = true;

	return 0;
}

static int db5500_kp_exit(void)
{
	struct ux500_pins *pins;

	pins = ux500_pins_get("db5500_kp");
	if (pins)
		ux500_pins_disable(pins);

	return 0;
}

static const unsigned int u5500_keymap[] = {
	KEY(4, 0, KEY_CAMERA), /* Camera2 */
	KEY(4, 1, KEY_CAMERA_FOCUS), /* Camera1 */
	KEY(4, 2, KEY_MENU),
	KEY(4, 3, KEY_BACK),
	KEY(5, 2, KEY_SEND),
	KEY(5, 3, KEY_HOME),
#ifndef CONFIG_INPUT_AB8500_PONKEY
	/* AB5500 ONSWa is also hooked up to this key */
	KEY(8, 0, KEY_END),
#endif
	KEY(8, 1, KEY_VOLUMEUP),
	KEY(8, 2, KEY_VOLUMEDOWN),
};

static struct matrix_keymap_data u5500_keymap_data = {
	.keymap		= u5500_keymap,
	.keymap_size	= ARRAY_SIZE(u5500_keymap),
};

static struct db5500_keypad_platform_data u5500_keypad_board = {
	.init           = db5500_kp_init,
	.exit           = db5500_kp_exit,
	.gpio_input_pins = db5500_kp_rows,
	.gpio_output_pins = db5500_kp_cols,
	.keymap_data	= &u5500_keymap_data,
	.no_autorepeat	= true,
	.krow		= ARRAY_SIZE(db5500_kp_rows),
	.kcol		= ARRAY_SIZE(db5500_kp_cols),
	.debounce_ms	= 40, /* milliseconds */
	.switch_delay	= 200, /* in jiffies */
};

/*
 * MSP
 */

#define MSP_DMA(num, eventline)					\
static struct stedma40_chan_cfg msp##num##_dma_rx = {		\
	.high_priority = true,					\
	.dir = STEDMA40_PERIPH_TO_MEM,				\
	.src_dev_type = eventline##_RX,				\
	.dst_dev_type = STEDMA40_DEV_DST_MEMORY,		\
	.src_info.psize = STEDMA40_PSIZE_LOG_4,			\
	.dst_info.psize = STEDMA40_PSIZE_LOG_4,			\
};								\
								\
static struct stedma40_chan_cfg msp##num##_dma_tx = {		\
	.high_priority = true,					\
	.dir = STEDMA40_MEM_TO_PERIPH,				\
	.src_dev_type = STEDMA40_DEV_SRC_MEMORY,		\
	.dst_dev_type = eventline##_TX,				\
	.src_info.psize = STEDMA40_PSIZE_LOG_4,			\
	.dst_info.psize = STEDMA40_PSIZE_LOG_4,			\
}

MSP_DMA(0, DB5500_DMA_DEV9_MSP0);
MSP_DMA(1, DB5500_DMA_DEV10_MSP1);
MSP_DMA(2, DB5500_DMA_DEV11_MSP2);

static struct msp_i2s_platform_data u5500_msp0_data = {
	.id		= MSP_0_I2S_CONTROLLER,
	.msp_i2s_dma_rx	= &msp0_dma_rx,
	.msp_i2s_dma_tx	= &msp0_dma_tx,
};

static struct msp_i2s_platform_data u5500_msp1_data = {
	.id		= MSP_1_I2S_CONTROLLER,
	.msp_i2s_dma_rx	= &msp1_dma_rx,
	.msp_i2s_dma_tx	= &msp1_dma_tx,
};

static struct msp_i2s_platform_data u5500_msp2_data = {
	.id		= MSP_2_I2S_CONTROLLER,
	.msp_i2s_dma_rx	= &msp2_dma_rx,
	.msp_i2s_dma_tx	= &msp2_dma_tx,
};

static struct i2s_board_info stm_i2s_board_info[] __initdata = {
	{
		.modalias	= "i2s_device.0",
		.id		= 0,
		.chip_select	= 0,
	},
	{
		.modalias	= "i2s_device.1",
		.id		= 1,
		.chip_select	= 1,
	},
	{
		.modalias	= "i2s_device.2",
		.id		= 2,
		.chip_select	= 2,
	},
};

static void __init u5500_msp_init(void)
{
	db5500_add_msp0_i2s(&u5500_msp0_data);
	db5500_add_msp1_i2s(&u5500_msp1_data);
	db5500_add_msp2_i2s(&u5500_msp2_data);

	i2s_register_board_info(ARRAY_AND_SIZE(stm_i2s_board_info));
}

/*
 * SPI
 */

static struct pl022_ssp_controller u5500_spi3_data = {
	.bus_id		= 1,
	.num_chipselect	= 4,	/* 3 possible CS lines + 1 for tests */
};

static void __init u5500_spi_init(void)
{
	db5500_add_spi3(&u5500_spi3_data);
}

static struct resource ab5500_resources[] = {
	[0] = {
		.start = IRQ_DB5500_PRCMU_ABB,
		.end = IRQ_DB5500_PRCMU_ABB,
		.flags = IORESOURCE_IRQ
	}
};


#ifdef CONFIG_INPUT_AB5500_ACCDET
static struct abx500_accdet_platform_data ab5500_accdet_pdata = {
	       .btn_keycode = KEY_MEDIA,
	       .accdet1_dbth = ACCDET1_TH_300mV | ACCDET1_DB_10ms,
	       .accdet2122_th = ACCDET21_TH_300mV | ACCDET22_TH_300mV,
	       .is_detection_inverted = false,
	};
#endif

static struct ab5500_platform_data ab5500_plf_data = {
	.irq = {
		.base = IRQ_AB5500_BASE,
		.count = AB5500_NR_IRQS,
	},
	.pm_power_off	= true,
	.regulator	= &u5500_ab5500_regulator_data,
#ifdef CONFIG_INPUT_AB5500_ACCDET
	.dev_data[AB5500_DEVID_ACCDET] = &ab5500_accdet_pdata,
	.dev_data_sz[AB5500_DEVID_ACCDET] = sizeof(ab5500_accdet_pdata),
#endif
	.dev_data[AB5500_DEVID_LEDS] = &ab5500_hvleds_data,
	.dev_data_sz[AB5500_DEVID_LEDS] = sizeof(ab5500_hvleds_data),
	.dev_data[AB5500_DEVID_VIBRATOR] = &ab5500_vibra_data,
	.dev_data_sz[AB5500_DEVID_VIBRATOR] = sizeof(ab5500_vibra_data),
	.init_settings = (struct abx500_init_settings[]){
			{
				.bank = 0x3,
				.reg = 0x17,
				.setting = 0x0F,
			},
			{
				.bank = 0x3,
				.reg = 0x18,
				.setting = 0x10,
			},
	},
	.init_settings_sz = 2,
#if defined(CONFIG_AB5500_BM)
	.dev_data[AB5500_DEVID_CHARGALG] = &abx500_bm_pt_data,
	.dev_data_sz[AB5500_DEVID_CHARGALG] = sizeof(abx500_bm_pt_data),
	.dev_data[AB5500_DEVID_CHARGER] = &abx500_bm_pt_data,
	.dev_data_sz[AB5500_DEVID_CHARGER] = sizeof(abx500_bm_pt_data),
	.dev_data[AB5500_DEVID_FG] = &abx500_bm_pt_data,
	.dev_data_sz[AB5500_DEVID_FG] = sizeof(abx500_bm_pt_data),
	.dev_data[AB5500_DEVID_BTEMP] = &abx500_bm_pt_data,
	.dev_data_sz[AB5500_DEVID_BTEMP] = sizeof(abx500_bm_pt_data),
#endif
	.dev_data[AB5500_DEVID_ONSWA] = &ab5500_ponkey_data,
	.dev_data_sz[AB5500_DEVID_ONSWA] = sizeof(ab5500_ponkey_data),
	.dev_data[AB5500_DEVID_USB] = &abx500_usbgpio_plat_data,
	.dev_data_sz[AB5500_DEVID_USB] = sizeof(abx500_usbgpio_plat_data),
};

static struct platform_device u5500_ab5500_device = {
	.name = "ab5500-core",
	.id = 0,
	.dev = {
		.platform_data = &ab5500_plf_data,
	},
	.num_resources = 1,
	.resource = ab5500_resources,
};

static struct platform_device u5500_mloader_device = {
	.name = "db5500_mloader",
	.id = -1,
	.num_resources = 0,
};

static struct cryp_platform_data u5500_cryp1_platform_data = {
	.mem_to_engine = {
		.dir = STEDMA40_MEM_TO_PERIPH,
		.src_dev_type = STEDMA40_DEV_SRC_MEMORY,
		.dst_dev_type = DB5500_DMA_DEV48_CRYPTO1_TX,
		.src_info.data_width = STEDMA40_WORD_WIDTH,
		.dst_info.data_width = STEDMA40_WORD_WIDTH,
		.mode = STEDMA40_MODE_LOGICAL,
		.src_info.psize = STEDMA40_PSIZE_LOG_4,
		.dst_info.psize = STEDMA40_PSIZE_LOG_4,
	},
	.engine_to_mem = {
		.dir = STEDMA40_PERIPH_TO_MEM,
		.src_dev_type = DB5500_DMA_DEV48_CRYPTO1_RX,
		.dst_dev_type = STEDMA40_DEV_DST_MEMORY,
		.src_info.data_width = STEDMA40_WORD_WIDTH,
		.dst_info.data_width = STEDMA40_WORD_WIDTH,
		.mode = STEDMA40_MODE_LOGICAL,
		.src_info.psize = STEDMA40_PSIZE_LOG_4,
		.dst_info.psize = STEDMA40_PSIZE_LOG_4,
	}
};

static struct stedma40_chan_cfg u5500_hash_dma_cfg_tx = {
	.dir = STEDMA40_MEM_TO_PERIPH,
	.src_dev_type = STEDMA40_DEV_SRC_MEMORY,
	.dst_dev_type = DB5500_DMA_DEV50_HASH1_TX,
	.src_info.data_width = STEDMA40_WORD_WIDTH,
	.dst_info.data_width = STEDMA40_WORD_WIDTH,
	.mode = STEDMA40_MODE_LOGICAL,
	.src_info.psize = STEDMA40_PSIZE_LOG_16,
	.dst_info.psize = STEDMA40_PSIZE_LOG_16,
};

static struct hash_platform_data u5500_hash1_platform_data = {
	.mem_to_engine = &u5500_hash_dma_cfg_tx,
	.dma_filter = stedma40_filter,
};

static struct platform_device *u5500_platform_devices[] __initdata = {
	&u5500_ab5500_device,
	&ux500_mcde_device,
	&ux500_hwmem_device,
	&ux500_b2r2_device,
	&u5500_mloader_device,
#ifdef CONFIG_U5500_MMIO
	&u5500_mmio_device,
#endif
	&ux500_thsens_device,
};

/*
 * This function check whether it is Small S5500 board
 * GPIO0 is HIGH for S5500
 */
bool is_s5500_board()
{
	int err , val ;

	err = gpio_request(GPIO_BOARD_VERSION, "Board Version");
	if (err) {
		pr_err("Error %d while requesting GPIO for Board Version\n",
				err);
		return err;
	}

	err = gpio_direction_input(GPIO_BOARD_VERSION);
	if (err) {
		pr_err("Error %d while setting GPIO for Board Version"
				"output mode\n", err);
		return err;
	}

	val = gpio_get_value(GPIO_BOARD_VERSION);

	gpio_free(GPIO_BOARD_VERSION);

	return (val == 1);
}


static void __init u5500_i2c_init(void)
{
	db5500_add_i2c1(&u5500_i2c1_data);
	db5500_add_i2c2(&u5500_i2c2_data);
	db5500_add_i2c3(&u5500_i2c3_data);

	i2c_register_board_info(1, ARRAY_AND_SIZE(u5500_i2c1_devices));
	i2c_register_board_info(2, ARRAY_AND_SIZE(u5500_i2c2_devices));

	if (cpu_is_u5500v1())
		i2c_register_board_info(2, ARRAY_AND_SIZE(u5500v1_i2c2_sensor_devices));

	if (cpu_is_u5500v2()) {
		/*
		 * In V2 display is mounted in reverse direction,
		 * so need to change the intial
		 * settings of Accelerometer and Magnetometer
		 */
		lsm303dlh_pdata.negative_x = 1;
		lsm303dlh_pdata.negative_y = 1;
		i2c_register_board_info(2, ARRAY_AND_SIZE(u5500v2_i2c2_sensor_devices));
	}
}

static void __init u5500_uart_init(void)
{
	db5500_add_uart0(NULL);
	db5500_add_uart1(NULL);
	db5500_add_uart2(NULL);
	db5500_add_uart3(NULL);
}

static void __init u5500_cryp1_hash1_init(void)
{
	db5500_add_cryp1(&u5500_cryp1_platform_data);
	db5500_add_hash1(&u5500_hash1_platform_data);
}

static void __init u5500_init_machine(void)
{
	u5500_regulators_init();
	u5500_init_devices();
	u5500_pins_init();

	u5500_i2c_init();
	u5500_msp_init();
	u5500_spi_init();

	u5500_sdi_init();
	u5500_uart_init();

	u5500_wlan_init();

	db5500_add_keypad(&u5500_keypad_board);
	u5500_cryp1_hash1_init();

#ifdef CONFIG_TOUCHSCREEN_CYTTSP_SPI
	u5500_cyttsp_init();
#endif

	platform_add_devices(u5500_platform_devices,
			     ARRAY_SIZE(u5500_platform_devices));
}

MACHINE_START(U5500, "ST-Ericsson U5500 Platform")
	.boot_params	= 0x00000100,
	.map_io		= u5500_map_io,
	.init_irq	= ux500_init_irq,
	.timer		= &ux500_timer,
	.init_machine	= u5500_init_machine,
MACHINE_END

MACHINE_START(B5500, "ST-Ericsson U5500 Big Board")
	.boot_params	= 0x00000100,
	.map_io		= u5500_map_io,
	.init_irq	= ux500_init_irq,
	.timer		= &ux500_timer,
	.init_machine	= u5500_init_machine,
MACHINE_END