blob: 75af13538d14ebcd2b9b99e05eeb4eaa12b42bb9 [file] [log] [blame]
Heiko Schocher4f3c42a2011-09-18 19:49:25 +00001/*
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 *
Wolfgang Denk1a459662013-07-08 09:37:19 +020015 * SPDX-License-Identifier: GPL-2.0+
Heiko Schocher4f3c42a2011-09-18 19:49:25 +000016 */
17
18#include <common.h>
19#include <miiphy.h>
20#include <net.h>
21#include <asm/arch/emac_defs.h>
22#include <asm/io.h>
Masahiro Yamada601fbec2015-02-20 17:04:05 +090023#include "../../../drivers/net/davinci_emac.h"
Heiko Schocher4f3c42a2011-09-18 19:49:25 +000024
25int ksz8873_is_phy_connected(int phy_addr)
26{
27 u_int16_t dummy;
28
29 return davinci_eth_phy_read(phy_addr, MII_PHYSID1, &dummy);
30}
31
32int ksz8873_get_link_speed(int phy_addr)
33{
34 emac_regs *emac = (emac_regs *)EMAC_BASE_ADDR;
35
36 /* we always have a link to the switch, 100 FD */
37 writel((EMAC_MACCONTROL_MIIEN_ENABLE |
38 EMAC_MACCONTROL_FULLDUPLEX_ENABLE),
39 &emac->MACCONTROL);
40 return 1;
41}
42
43
44int ksz8873_init_phy(int phy_addr)
45{
46 return 1;
47}
48
49
50int ksz8873_auto_negotiate(int phy_addr)
51{
52 return dp83848_get_link_speed(phy_addr);
53}