mach-pb42.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Atheros PB42 board support
  3. *
  4. * Copyright (C) 2008-2012 Gabor Juhos <juhosg@openwrt.org>
  5. * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published
  9. * by the Free Software Foundation.
  10. */
  11. #include <asm/mach-ath79/ath79.h>
  12. #include "dev-eth.h"
  13. #include "dev-gpio-buttons.h"
  14. #include "dev-m25p80.h"
  15. #include "dev-usb.h"
  16. #include "machtypes.h"
  17. #include "pci.h"
  18. #define PB42_KEYS_POLL_INTERVAL 20 /* msecs */
  19. #define PB42_KEYS_DEBOUNCE_INTERVAL (3 * PB42_KEYS_POLL_INTERVAL)
  20. #define PB42_GPIO_BTN_SW4 8
  21. #define PB42_GPIO_BTN_SW5 3
  22. static struct gpio_keys_button pb42_gpio_keys[] __initdata = {
  23. {
  24. .desc = "sw4",
  25. .type = EV_KEY,
  26. .code = BTN_0,
  27. .debounce_interval = PB42_KEYS_DEBOUNCE_INTERVAL,
  28. .gpio = PB42_GPIO_BTN_SW4,
  29. .active_low = 1,
  30. }, {
  31. .desc = "sw5",
  32. .type = EV_KEY,
  33. .code = BTN_1,
  34. .debounce_interval = PB42_KEYS_DEBOUNCE_INTERVAL,
  35. .gpio = PB42_GPIO_BTN_SW5,
  36. .active_low = 1,
  37. }
  38. };
  39. static const char *pb42_part_probes[] = {
  40. "RedBoot",
  41. NULL,
  42. };
  43. static struct flash_platform_data pb42_flash_data = {
  44. .part_probes = pb42_part_probes,
  45. };
  46. #define PB42_WAN_PHYMASK BIT(20)
  47. #define PB42_LAN_PHYMASK (BIT(16) | BIT(17) | BIT(18) | BIT(19))
  48. #define PB42_MDIO_PHYMASK (PB42_LAN_PHYMASK | PB42_WAN_PHYMASK)
  49. static void __init pb42_init(void)
  50. {
  51. ath79_register_m25p80(&pb42_flash_data);
  52. ath79_register_mdio(0, ~PB42_MDIO_PHYMASK);
  53. ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
  54. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  55. ath79_eth0_data.phy_mask = PB42_WAN_PHYMASK;
  56. ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1);
  57. ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
  58. ath79_eth1_data.speed = SPEED_100;
  59. ath79_eth1_data.duplex = DUPLEX_FULL;
  60. ath79_register_eth(0);
  61. ath79_register_eth(1);
  62. ath79_register_gpio_keys_polled(-1, PB42_KEYS_POLL_INTERVAL,
  63. ARRAY_SIZE(pb42_gpio_keys),
  64. pb42_gpio_keys);
  65. ath79_register_pci();
  66. }
  67. MIPS_MACHINE(ATH79_MACH_PB42, "PB42", "Atheros PB42", pb42_init);