board-dt-sama5.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Setup code for SAMA5 Evaluation Kits with Device Tree support
  3. *
  4. * Copyright (C) 2013 Atmel,
  5. * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
  6. *
  7. * Licensed under GPLv2 or later.
  8. */
  9. #include <linux/types.h>
  10. #include <linux/init.h>
  11. #include <linux/module.h>
  12. #include <linux/gpio.h>
  13. #include <linux/micrel_phy.h>
  14. #include <linux/of.h>
  15. #include <linux/of_irq.h>
  16. #include <linux/of_platform.h>
  17. #include <linux/phy.h>
  18. #include <linux/clk-provider.h>
  19. #include <linux/phy.h>
  20. #include <asm/setup.h>
  21. #include <asm/irq.h>
  22. #include <asm/mach/arch.h>
  23. #include <asm/mach/map.h>
  24. #include <asm/mach/irq.h>
  25. #include "generic.h"
  26. static int ksz8081_phy_fixup(struct phy_device *phy)
  27. {
  28. int value;
  29. value = phy_read(phy, 0x16);
  30. value &= ~0x20;
  31. phy_write(phy, 0x16, value);
  32. return 0;
  33. }
  34. static void __init sama5_dt_device_init(void)
  35. {
  36. if (of_machine_is_compatible("atmel,sama5d4ek") &&
  37. IS_ENABLED(CONFIG_PHYLIB)) {
  38. phy_register_fixup_for_id("fc028000.etherne:00",
  39. ksz8081_phy_fixup);
  40. }
  41. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  42. }
  43. static const char *sama5_dt_board_compat[] __initconst = {
  44. "atmel,sama5",
  45. NULL
  46. };
  47. DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)")
  48. /* Maintainer: Atmel */
  49. .map_io = at91_map_io,
  50. .init_early = at91_dt_initialize,
  51. .init_machine = sama5_dt_device_init,
  52. .dt_compat = sama5_dt_board_compat,
  53. MACHINE_END
  54. static const char *sama5_alt_dt_board_compat[] __initconst = {
  55. "atmel,sama5d4",
  56. NULL
  57. };
  58. DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5 (Device Tree)")
  59. /* Maintainer: Atmel */
  60. .map_io = at91_alt_map_io,
  61. .init_early = at91_dt_initialize,
  62. .init_machine = sama5_dt_device_init,
  63. .dt_compat = sama5_alt_dt_board_compat,
  64. .l2c_aux_mask = ~0UL,
  65. MACHINE_END