Ludovic Desroches | 8f4b479 | 2013-03-22 13:24:12 +0000 | [diff] [blame] | 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 | |
| 10 | #include <linux/types.h> |
| 11 | #include <linux/init.h> |
| 12 | #include <linux/module.h> |
| 13 | #include <linux/gpio.h> |
| 14 | #include <linux/micrel_phy.h> |
| 15 | #include <linux/of.h> |
| 16 | #include <linux/of_irq.h> |
| 17 | #include <linux/of_platform.h> |
| 18 | #include <linux/phy.h> |
Boris BREZILLON | d4d24c1 | 2013-10-11 14:43:31 +0200 | [diff] [blame] | 19 | #include <linux/clk-provider.h> |
Wenyou Yang | b865975 | 2014-12-11 15:31:09 +0800 | [diff] [blame^] | 20 | #include <linux/phy.h> |
Ludovic Desroches | 8f4b479 | 2013-03-22 13:24:12 +0000 | [diff] [blame] | 21 | |
| 22 | #include <asm/setup.h> |
| 23 | #include <asm/irq.h> |
| 24 | #include <asm/mach/arch.h> |
| 25 | #include <asm/mach/map.h> |
| 26 | #include <asm/mach/irq.h> |
| 27 | |
Ludovic Desroches | 8f4b479 | 2013-03-22 13:24:12 +0000 | [diff] [blame] | 28 | #include "generic.h" |
| 29 | |
Wenyou Yang | b865975 | 2014-12-11 15:31:09 +0800 | [diff] [blame^] | 30 | static int ksz8081_phy_fixup(struct phy_device *phy) |
| 31 | { |
| 32 | int value; |
| 33 | |
| 34 | value = phy_read(phy, 0x16); |
| 35 | value &= ~0x20; |
| 36 | phy_write(phy, 0x16, value); |
| 37 | |
| 38 | return 0; |
| 39 | } |
| 40 | |
Ludovic Desroches | 8f4b479 | 2013-03-22 13:24:12 +0000 | [diff] [blame] | 41 | static void __init sama5_dt_device_init(void) |
| 42 | { |
Wenyou Yang | b865975 | 2014-12-11 15:31:09 +0800 | [diff] [blame^] | 43 | if (of_machine_is_compatible("atmel,sama5d4ek") && |
| 44 | IS_ENABLED(CONFIG_PHYLIB)) { |
| 45 | phy_register_fixup_for_id("fc028000.etherne:00", |
| 46 | ksz8081_phy_fixup); |
| 47 | } |
| 48 | |
Ludovic Desroches | 8f4b479 | 2013-03-22 13:24:12 +0000 | [diff] [blame] | 49 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
| 50 | } |
| 51 | |
Nicolas Ferre | 726d32b | 2014-09-15 18:15:55 +0200 | [diff] [blame] | 52 | static const char *sama5_dt_board_compat[] __initconst = { |
Ludovic Desroches | 8f4b479 | 2013-03-22 13:24:12 +0000 | [diff] [blame] | 53 | "atmel,sama5", |
| 54 | NULL |
| 55 | }; |
| 56 | |
| 57 | DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)") |
| 58 | /* Maintainer: Atmel */ |
Ludovic Desroches | 8f4b479 | 2013-03-22 13:24:12 +0000 | [diff] [blame] | 59 | .map_io = at91_map_io, |
Ludovic Desroches | 8f4b479 | 2013-03-22 13:24:12 +0000 | [diff] [blame] | 60 | .init_early = at91_dt_initialize, |
Ludovic Desroches | 8f4b479 | 2013-03-22 13:24:12 +0000 | [diff] [blame] | 61 | .init_machine = sama5_dt_device_init, |
| 62 | .dt_compat = sama5_dt_board_compat, |
| 63 | MACHINE_END |
Nicolas Ferre | 726d32b | 2014-09-15 18:15:55 +0200 | [diff] [blame] | 64 | |
| 65 | static const char *sama5_alt_dt_board_compat[] __initconst = { |
| 66 | "atmel,sama5d4", |
| 67 | NULL |
| 68 | }; |
| 69 | |
| 70 | DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5 (Device Tree)") |
| 71 | /* Maintainer: Atmel */ |
| 72 | .map_io = at91_alt_map_io, |
| 73 | .init_early = at91_dt_initialize, |
| 74 | .init_machine = sama5_dt_device_init, |
| 75 | .dt_compat = sama5_alt_dt_board_compat, |
| 76 | .l2c_aux_mask = ~0UL, |
| 77 | MACHINE_END |