board-u5500.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2010
  3. *
  4. * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
  5. * License terms: GNU General Public License (GPL) version 2
  6. */
  7. #include <linux/init.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/amba/bus.h>
  10. #include <linux/gpio.h>
  11. #include <linux/irq.h>
  12. #include <linux/i2c.h>
  13. #include <asm/mach/arch.h>
  14. #include <asm/mach-types.h>
  15. #include <plat/pincfg.h>
  16. #include <plat/i2c.h>
  17. #include <mach/hardware.h>
  18. #include <mach/devices.h>
  19. #include <mach/setup.h>
  20. #include "pins-db5500.h"
  21. #include "devices-db5500.h"
  22. #include <linux/led-lm3530.h>
  23. /*
  24. * GPIO
  25. */
  26. static pin_cfg_t u5500_pins[] = {
  27. /* I2C */
  28. GPIO218_I2C2_SCL | PIN_INPUT_PULLUP,
  29. GPIO219_I2C2_SDA | PIN_INPUT_PULLUP,
  30. /* DISPLAY_ENABLE */
  31. GPIO226_GPIO | PIN_OUTPUT_LOW,
  32. /* Backlight Enbale */
  33. GPIO224_GPIO | PIN_OUTPUT_HIGH,
  34. };
  35. /*
  36. * I2C
  37. */
  38. #define U5500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \
  39. static struct nmk_i2c_controller u5500_i2c##id##_data = { \
  40. /* \
  41. * slave data setup time, which is \
  42. * 250 ns,100ns,10ns which is 14,6,2 \
  43. * respectively for a 48 Mhz \
  44. * i2c clock \
  45. */ \
  46. .slsu = _slsu, \
  47. /* Tx FIFO threshold */ \
  48. .tft = _tft, \
  49. /* Rx FIFO threshold */ \
  50. .rft = _rft, \
  51. /* std. mode operation */ \
  52. .clk_freq = clk, \
  53. .sm = _sm, \
  54. }
  55. /*
  56. * The board uses TODO <3> i2c controllers, initialize all of
  57. * them with slave data setup time of 250 ns,
  58. * Tx & Rx FIFO threshold values as 1 and standard
  59. * mode of operation
  60. */
  61. U5500_I2C_CONTROLLER(2, 0xe, 1, 1, 400000, I2C_FREQ_MODE_FAST);
  62. static struct lm3530_platform_data u5500_als_platform_data = {
  63. .mode = LM3530_BL_MODE_MANUAL,
  64. .als_input_mode = LM3530_INPUT_ALS1,
  65. .max_current = LM3530_FS_CURR_26mA,
  66. .pwm_pol_hi = true,
  67. .als_avrg_time = LM3530_ALS_AVRG_TIME_512ms,
  68. .brt_ramp_law = 1, /* Linear */
  69. .brt_ramp_fall = LM3530_RAMP_TIME_8s,
  70. .brt_ramp_rise = LM3530_RAMP_TIME_8s,
  71. .als1_resistor_sel = LM3530_ALS_IMPD_13_53kOhm,
  72. .als2_resistor_sel = LM3530_ALS_IMPD_Z,
  73. .als_vmin = 730, /* mV */
  74. .als_vmax = 1020, /* mV */
  75. .brt_val = 0x7F, /* Max brightness */
  76. };
  77. static struct i2c_board_info __initdata u5500_i2c2_devices[] = {
  78. {
  79. /* Backlight */
  80. I2C_BOARD_INFO("lm3530-led", 0x36),
  81. .platform_data = &u5500_als_platform_data,
  82. },
  83. };
  84. static void __init u5500_i2c_init(void)
  85. {
  86. db5500_add_i2c2(&u5500_i2c2_data);
  87. i2c_register_board_info(2, ARRAY_AND_SIZE(u5500_i2c2_devices));
  88. }
  89. static void __init u5500_uart_init(void)
  90. {
  91. db5500_add_uart0(NULL);
  92. db5500_add_uart1(NULL);
  93. db5500_add_uart2(NULL);
  94. }
  95. static void __init u5500_init_machine(void)
  96. {
  97. u5500_init_devices();
  98. nmk_config_pins(u5500_pins, ARRAY_SIZE(u5500_pins));
  99. u5500_i2c_init();
  100. u5500_sdi_init();
  101. u5500_uart_init();
  102. }
  103. MACHINE_START(U5500, "ST-Ericsson U5500 Platform")
  104. .boot_params = 0x00000100,
  105. .map_io = u5500_map_io,
  106. .init_irq = ux500_init_irq,
  107. .timer = &ux500_timer,
  108. .init_machine = u5500_init_machine,
  109. MACHINE_END