mach-pb44.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Atheros PB44 reference board support
  3. *
  4. * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published
  8. * by the Free Software Foundation.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/i2c.h>
  13. #include <linux/i2c-gpio.h>
  14. #include <linux/i2c/pcf857x.h>
  15. #include "machtypes.h"
  16. #include "dev-leds-gpio.h"
  17. #define PB44_GPIO_I2C_SCL 0
  18. #define PB44_GPIO_I2C_SDA 1
  19. #define PB44_GPIO_EXP_BASE 16
  20. #define PB44_GPIO_LED_JUMP1 (PB44_GPIO_EXP_BASE + 9)
  21. #define PB44_GPIO_LED_JUMP2 (PB44_GPIO_EXP_BASE + 10)
  22. static struct i2c_gpio_platform_data pb44_i2c_gpio_data = {
  23. .sda_pin = PB44_GPIO_I2C_SDA,
  24. .scl_pin = PB44_GPIO_I2C_SCL,
  25. };
  26. static struct platform_device pb44_i2c_gpio_device = {
  27. .name = "i2c-gpio",
  28. .id = 0,
  29. .dev = {
  30. .platform_data = &pb44_i2c_gpio_data,
  31. }
  32. };
  33. static struct pcf857x_platform_data pb44_pcf857x_data = {
  34. .gpio_base = PB44_GPIO_EXP_BASE,
  35. };
  36. static struct i2c_board_info pb44_i2c_board_info[] __initdata = {
  37. {
  38. I2C_BOARD_INFO("pcf8575", 0x20),
  39. .platform_data = &pb44_pcf857x_data,
  40. },
  41. };
  42. static struct gpio_led pb44_leds_gpio[] __initdata = {
  43. {
  44. .name = "pb44:amber:jump1",
  45. .gpio = PB44_GPIO_LED_JUMP1,
  46. .active_low = 1,
  47. }, {
  48. .name = "pb44:green:jump2",
  49. .gpio = PB44_GPIO_LED_JUMP2,
  50. .active_low = 1,
  51. },
  52. };
  53. static void __init pb44_init(void)
  54. {
  55. i2c_register_board_info(0, pb44_i2c_board_info,
  56. ARRAY_SIZE(pb44_i2c_board_info));
  57. platform_device_register(&pb44_i2c_gpio_device);
  58. ath79_register_leds_gpio(-1, ARRAY_SIZE(pb44_leds_gpio),
  59. pb44_leds_gpio);
  60. }
  61. MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board",
  62. pb44_init);