mach-lima.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * 8devices Lima board support
  3. *
  4. * Copyright (C) 2016 Mantas Pucka <mantas@8devices.com>
  5. * Copyright (C) 2017 Karol Dudek <karoiz@sli.pl>
  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 <linux/platform_device.h>
  12. #include <asm/mach-ath79/ar71xx_regs.h>
  13. #include <asm/mach-ath79/ath79.h>
  14. #include "common.h"
  15. #include "dev-ap9x-pci.h"
  16. #include "dev-eth.h"
  17. #include "dev-gpio-buttons.h"
  18. #include "dev-leds-gpio.h"
  19. #include "dev-m25p80.h"
  20. #include "dev-spi.h"
  21. #include "dev-usb.h"
  22. #include "dev-wmac.h"
  23. #include "machtypes.h"
  24. #include "pci.h"
  25. #define LIMA_GPIO_BTN_1_DEFAULT 16
  26. #define LIMA_KEYS_POLL_INTERVAL 20 /* msecs */
  27. #define LIMA_KEYS_DEBOUNCE_INTERVAL (3 * LIMA_KEYS_POLL_INTERVAL)
  28. #define LIMA_ETH_PHYS (BIT(0) | BIT(1))
  29. #define LIMA_MAC0_OFFSET 0x0000
  30. #define LIMA_MAC1_OFFSET 0x0006
  31. #define LIMA_CALDATA_OFFSET 0x1000
  32. static struct gpio_keys_button lima_gpio_keys[] __initdata = {
  33. {
  34. .desc = "button1",
  35. .type = EV_KEY,
  36. .code = BTN_1,
  37. .debounce_interval = LIMA_KEYS_DEBOUNCE_INTERVAL,
  38. .gpio = LIMA_GPIO_BTN_1_DEFAULT,
  39. .active_low = 1,
  40. }
  41. };
  42. static void __init lima_setup(void)
  43. {
  44. u8 *art = (u8 *) KSEG1ADDR(0x1f080000);
  45. ath79_register_m25p80(NULL);
  46. ath79_register_gpio_keys_polled(-1, LIMA_KEYS_POLL_INTERVAL,
  47. ARRAY_SIZE(lima_gpio_keys),
  48. lima_gpio_keys);
  49. ath79_setup_ar933x_phy4_switch(true, true);
  50. ath79_init_mac(ath79_eth0_data.mac_addr, art + LIMA_MAC0_OFFSET, 0);
  51. ath79_init_mac(ath79_eth1_data.mac_addr, art + LIMA_MAC1_OFFSET, 0);
  52. ath79_register_mdio(0, ~LIMA_ETH_PHYS);
  53. ath79_switch_data.phy4_mii_en = 1;
  54. ath79_switch_data.phy_poll_mask |= BIT(0);
  55. ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
  56. ath79_eth1_data.duplex = DUPLEX_FULL;
  57. ath79_eth1_data.phy_mask = BIT(1);
  58. ath79_register_eth(1);
  59. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  60. ath79_eth0_data.duplex = DUPLEX_FULL;
  61. ath79_eth0_data.speed = SPEED_100;
  62. ath79_eth0_data.phy_mask = BIT(0);
  63. ath79_register_eth(0);
  64. ath79_register_wmac(art + LIMA_CALDATA_OFFSET, NULL);
  65. ath79_register_usb();
  66. ath79_register_pci();
  67. }
  68. MIPS_MACHINE(ATH79_MACH_LIMA, "LIMA", "8devices Lima board", lima_setup);