f885167e046f850141b0eb3757a39b2a73fd7c03
[openwrt/staging/lynxis/omap.git] / target / linux / apm821xx / patches-4.4 / 002-powerpc_ibm_phy_add_ar8035.patch
1 From 0c13957a43a90b1522eb616f3c9967ec44e4da1d Mon Sep 17 00:00:00 2001
2 From: Christian Lamparter <chunkeey@googlemail.com>
3 Date: Tue, 3 May 2016 13:58:24 +0200
4 Subject: [PATCH] drivers: net: emac: add Atheros AR8035 phy initialization
5 code
6 To: netdev@vger.kernel.org
7
8 This patch adds the phy initialization code for Qualcomm
9 Atheros AR8035 phy. This configuration is found in the
10 Cisco Meraki MR24.
11
12 Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
13 ---
14 drivers/net/ethernet/ibm/emac/phy.c | 26 ++++++++++++++++++++++++++
15 1 file changed, 26 insertions(+)
16
17 --- a/drivers/net/ethernet/ibm/emac/phy.c
18 +++ b/drivers/net/ethernet/ibm/emac/phy.c
19 @@ -470,12 +470,38 @@ static struct mii_phy_def m88e1112_phy_d
20 .ops = &m88e1112_phy_ops,
21 };
22
23 +static int ar8035_init(struct mii_phy *phy)
24 +{
25 + phy_write(phy, 0x1d, 0x5); /* Address debug register 5 */
26 + phy_write(phy, 0x1e, 0x2d47); /* Value copied from u-boot */
27 + phy_write(phy, 0x1d, 0xb); /* Address hib ctrl */
28 + phy_write(phy, 0x1e, 0xbc20); /* Value copied from u-boot */
29 +
30 + return 0;
31 +}
32 +
33 +static struct mii_phy_ops ar8035_phy_ops = {
34 + .init = ar8035_init,
35 + .setup_aneg = genmii_setup_aneg,
36 + .setup_forced = genmii_setup_forced,
37 + .poll_link = genmii_poll_link,
38 + .read_link = genmii_read_link,
39 +};
40 +
41 +static struct mii_phy_def ar8035_phy_def = {
42 + .phy_id = 0x004dd070,
43 + .phy_id_mask = 0xfffffff0,
44 + .name = "Atheros 8035 Gigabit Ethernet",
45 + .ops = &ar8035_phy_ops,
46 +};
47 +
48 static struct mii_phy_def *mii_phy_table[] = {
49 &et1011c_phy_def,
50 &cis8201_phy_def,
51 &bcm5248_phy_def,
52 &m88e1111_phy_def,
53 &m88e1112_phy_def,
54 + &ar8035_phy_def,
55 &genmii_phy_def,
56 NULL
57 };