mach-jwap003.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * jjPlus JWAP003 board support
  3. *
  4. */
  5. #include <linux/i2c.h>
  6. #include <linux/i2c-gpio.h>
  7. #include <linux/platform_device.h>
  8. #include <asm/mach-ath79/ath79.h>
  9. #include "dev-eth.h"
  10. #include "dev-m25p80.h"
  11. #include "dev-gpio-buttons.h"
  12. #include "dev-usb.h"
  13. #include "machtypes.h"
  14. #include "pci.h"
  15. #define JWAP003_KEYS_POLL_INTERVAL 20 /* msecs */
  16. #define JWAP003_KEYS_DEBOUNCE_INTERVAL (3 * JWAP003_KEYS_POLL_INTERVAL)
  17. #define JWAP003_GPIO_WPS 11
  18. #define JWAP003_GPIO_I2C_SCL 0
  19. #define JWAP003_GPIO_I2C_SDA 1
  20. static struct gpio_keys_button jwap003_gpio_keys[] __initdata = {
  21. {
  22. .desc = "wps",
  23. .type = EV_KEY,
  24. .code = KEY_WPS_BUTTON,
  25. .debounce_interval = JWAP003_KEYS_DEBOUNCE_INTERVAL,
  26. .gpio = JWAP003_GPIO_WPS,
  27. .active_low = 1,
  28. }
  29. };
  30. static struct i2c_gpio_platform_data jwap003_i2c_gpio_data = {
  31. .sda_pin = JWAP003_GPIO_I2C_SDA,
  32. .scl_pin = JWAP003_GPIO_I2C_SCL,
  33. };
  34. static struct platform_device jwap003_i2c_gpio_device = {
  35. .name = "i2c-gpio",
  36. .id = 0,
  37. .dev = {
  38. .platform_data = &jwap003_i2c_gpio_data,
  39. }
  40. };
  41. static const char *jwap003_part_probes[] = {
  42. "RedBoot",
  43. NULL,
  44. };
  45. static struct flash_platform_data jwap003_flash_data = {
  46. .part_probes = jwap003_part_probes,
  47. };
  48. #define JWAP003_WAN_PHYMASK BIT(0)
  49. #define JWAP003_LAN_PHYMASK BIT(4)
  50. static void __init jwap003_init(void)
  51. {
  52. ath79_register_m25p80(&jwap003_flash_data);
  53. ath79_register_mdio(0, 0x0);
  54. ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
  55. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
  56. ath79_eth0_data.phy_mask = JWAP003_WAN_PHYMASK;
  57. ath79_eth0_data.speed = SPEED_100;
  58. ath79_eth0_data.duplex = DUPLEX_FULL;
  59. ath79_eth0_data.has_ar8216 = 1;
  60. ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1);
  61. ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
  62. ath79_eth1_data.phy_mask = JWAP003_LAN_PHYMASK;
  63. ath79_eth1_data.speed = SPEED_100;
  64. ath79_eth1_data.duplex = DUPLEX_FULL;
  65. ath79_register_eth(0);
  66. ath79_register_eth(1);
  67. platform_device_register(&jwap003_i2c_gpio_device);
  68. ath79_register_usb();
  69. ath79_register_gpio_keys_polled(-1, JWAP003_KEYS_POLL_INTERVAL,
  70. ARRAY_SIZE(jwap003_gpio_keys),
  71. jwap003_gpio_keys);
  72. ath79_register_pci();
  73. }
  74. MIPS_MACHINE(ATH79_MACH_JWAP003, "JWAP003", "jjPlus JWAP003", jwap003_init);