Heiko Schocher | a1a218e | 2011-09-18 19:49:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Micrel KSZ8873 PHY Driver for TI DaVinci |
| 3 | * (TMS320DM644x) based boards. |
| 4 | * |
| 5 | * Copyright (C) 2011 Heiko Schocher <hsdenx.de> |
| 6 | * |
| 7 | * based on: |
| 8 | * National Semiconductor DP83848 PHY Driver for TI DaVinci |
| 9 | * (TMS320DM644x) based boards. |
| 10 | * |
| 11 | * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net> |
| 12 | * |
| 13 | * -------------------------------------------------------- |
| 14 | * |
| 15 | * See file CREDITS for list of people who contributed to this |
| 16 | * project. |
| 17 | * |
| 18 | * This program is free software; you can redistribute it and/or |
| 19 | * modify it under the terms of the GNU General Public License as |
| 20 | * published by the Free Software Foundation; either version 2 of |
| 21 | * the License, or (at your option) any later version. |
| 22 | * |
| 23 | * This program is distributed in the hope that it will be useful, |
| 24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 26 | * GNU General Public License for more details. |
| 27 | * |
| 28 | * You should have received a copy of the GNU General Public License |
| 29 | * along with this program; if not, write to the Free Software |
| 30 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 31 | * MA 02111-1307 USA |
| 32 | */ |
| 33 | |
| 34 | #include <common.h> |
| 35 | #include <miiphy.h> |
| 36 | #include <net.h> |
| 37 | #include <asm/arch/emac_defs.h> |
| 38 | #include <asm/io.h> |
Ilya Yanok | 5f732f7 | 2011-11-28 06:37:29 +0000 | [diff] [blame] | 39 | #include "../../../../../drivers/net/davinci_emac.h" |
Heiko Schocher | a1a218e | 2011-09-18 19:49:25 +0000 | [diff] [blame] | 40 | |
| 41 | int ksz8873_is_phy_connected(int phy_addr) |
| 42 | { |
| 43 | u_int16_t dummy; |
| 44 | |
| 45 | return davinci_eth_phy_read(phy_addr, MII_PHYSID1, &dummy); |
| 46 | } |
| 47 | |
| 48 | int ksz8873_get_link_speed(int phy_addr) |
| 49 | { |
| 50 | emac_regs *emac = (emac_regs *)EMAC_BASE_ADDR; |
| 51 | |
| 52 | /* we always have a link to the switch, 100 FD */ |
| 53 | writel((EMAC_MACCONTROL_MIIEN_ENABLE | |
| 54 | EMAC_MACCONTROL_FULLDUPLEX_ENABLE), |
| 55 | &emac->MACCONTROL); |
| 56 | return 1; |
| 57 | } |
| 58 | |
| 59 | |
| 60 | int ksz8873_init_phy(int phy_addr) |
| 61 | { |
| 62 | return 1; |
| 63 | } |
| 64 | |
| 65 | |
| 66 | int ksz8873_auto_negotiate(int phy_addr) |
| 67 | { |
| 68 | return dp83848_get_link_speed(phy_addr); |
| 69 | } |