mach-95C3AM1.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #include <linux/init.h>
  2. #include <linux/platform_device.h>
  3. #include <linux/i2c-gpio.h>
  4. #include "../machtypes.h"
  5. #include "devices.h"
  6. #include "dev-leds-gpio.h"
  7. #define BOARD_95C3AM1_GPIO_LED_0 10
  8. #define BOARD_95C3AM1_GPIO_LED_1 11
  9. #define BOARD_95C3AM1_GPIO_LED_2 12
  10. #define BOARD_95C3AM1_GPIO_LED_3 13
  11. extern unsigned char ltq_ethaddr[6];
  12. static struct mtd_partition board_95C3AM1_partitions[] =
  13. {
  14. {
  15. .name = "uboot",
  16. .offset = 0x0,
  17. .size = 0x40000,
  18. },
  19. {
  20. .name = "uboot_env",
  21. .offset = 0x40000,
  22. .size = 0x40000, /* 2 sectors for redundant env. */
  23. },
  24. {
  25. .name = "linux",
  26. .offset = 0x80000,
  27. .size = 0xF80000, /* map only 16 MiB */
  28. },
  29. };
  30. static struct flash_platform_data board_95C3AM1_flash_platform_data = {
  31. .name = "sflash",
  32. .parts = board_95C3AM1_partitions,
  33. .nr_parts = ARRAY_SIZE(board_95C3AM1_partitions)
  34. };
  35. static struct spi_board_info board_95C3AM1_flash_data __initdata = {
  36. .modalias = "m25p80",
  37. .bus_num = 0,
  38. .chip_select = 0,
  39. .max_speed_hz = 10 * 1000 * 1000,
  40. .mode = SPI_MODE_3,
  41. .platform_data = &board_95C3AM1_flash_platform_data
  42. };
  43. static struct gpio_led board_95C3AM1_leds_gpio[] __initdata = {
  44. {
  45. .name = "power",
  46. .gpio = BOARD_95C3AM1_GPIO_LED_0,
  47. .active_low = 0,
  48. }, {
  49. .name = "optical",
  50. .gpio = BOARD_95C3AM1_GPIO_LED_1,
  51. .active_low = 0,
  52. }, {
  53. .name = "lan",
  54. .gpio = BOARD_95C3AM1_GPIO_LED_2,
  55. .active_low = 0,
  56. }, {
  57. .name = "update",
  58. .gpio = BOARD_95C3AM1_GPIO_LED_3,
  59. .active_low = 0,
  60. }
  61. };
  62. static struct i2c_gpio_platform_data board_95C3AM1_i2c_gpio_data = {
  63. .sda_pin = 107,
  64. .scl_pin = 108,
  65. };
  66. static struct platform_device board_95C3AM1_i2c_gpio_device = {
  67. .name = "i2c-gpio",
  68. .id = 0,
  69. .dev = {
  70. .platform_data = &board_95C3AM1_i2c_gpio_data,
  71. }
  72. };
  73. static void __init board_95C3AM1_init(void)
  74. {
  75. falcon_register_i2c();
  76. falcon_register_spi_flash(&board_95C3AM1_flash_data);
  77. platform_device_register(&board_95C3AM1_i2c_gpio_device);
  78. ltq_add_device_leds_gpio(-1, ARRAY_SIZE(board_95C3AM1_leds_gpio),
  79. board_95C3AM1_leds_gpio);
  80. }
  81. MIPS_MACHINE(LANTIQ_MACH_95C3AM1,
  82. "95C3AM1",
  83. "95C3AM1 Board",
  84. board_95C3AM1_init);