Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Heiko Schocher | a1a218e | 2011-09-18 19:49:25 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Micrel KSZ8873 PHY Driver for TI DaVinci |
| 4 | * (TMS320DM644x) based boards. |
| 5 | * |
| 6 | * Copyright (C) 2011 Heiko Schocher <hsdenx.de> |
| 7 | * |
| 8 | * based on: |
| 9 | * National Semiconductor DP83848 PHY Driver for TI DaVinci |
| 10 | * (TMS320DM644x) based boards. |
| 11 | * |
| 12 | * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net> |
| 13 | * |
| 14 | * -------------------------------------------------------- |
Heiko Schocher | a1a218e | 2011-09-18 19:49:25 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <common.h> |
| 18 | #include <miiphy.h> |
| 19 | #include <net.h> |
| 20 | #include <asm/arch/emac_defs.h> |
| 21 | #include <asm/io.h> |
Masahiro Yamada | 3644548 | 2015-02-20 17:04:05 +0900 | [diff] [blame] | 22 | #include "../../../drivers/net/davinci_emac.h" |
Heiko Schocher | a1a218e | 2011-09-18 19:49:25 +0000 | [diff] [blame] | 23 | |
| 24 | int ksz8873_is_phy_connected(int phy_addr) |
| 25 | { |
| 26 | u_int16_t dummy; |
| 27 | |
| 28 | return davinci_eth_phy_read(phy_addr, MII_PHYSID1, &dummy); |
| 29 | } |
| 30 | |
| 31 | int ksz8873_get_link_speed(int phy_addr) |
| 32 | { |
| 33 | emac_regs *emac = (emac_regs *)EMAC_BASE_ADDR; |
| 34 | |
| 35 | /* we always have a link to the switch, 100 FD */ |
| 36 | writel((EMAC_MACCONTROL_MIIEN_ENABLE | |
| 37 | EMAC_MACCONTROL_FULLDUPLEX_ENABLE), |
| 38 | &emac->MACCONTROL); |
| 39 | return 1; |
| 40 | } |
| 41 | |
| 42 | |
| 43 | int ksz8873_init_phy(int phy_addr) |
| 44 | { |
| 45 | return 1; |
| 46 | } |
| 47 | |
| 48 | |
| 49 | int ksz8873_auto_negotiate(int phy_addr) |
| 50 | { |
| 51 | return dp83848_get_link_speed(phy_addr); |
| 52 | } |