[target/leon]: add preliminary LEON support
[openwrt.git] / target / linux / leon / patches / 017-greth_no_gbit.patch
1 From 2e864d18c31d4e0255269f9e9cfccc09512676c6 Mon Sep 17 00:00:00 2001
2 From: Daniel Hellstrom <daniel@gaisler.com>
3 Date: Wed, 1 Dec 2010 16:51:38 +0100
4 Subject: [PATCH] GRETH: added greth_no_gbit option
5
6 Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
7 ---
8  drivers/net/greth.c |   15 +++++++++++++--
9  drivers/net/greth.h |    1 +
10  2 files changed, 14 insertions(+), 2 deletions(-)
11
12 --- a/drivers/net/greth.c
13 +++ b/drivers/net/greth.c
14 @@ -66,6 +66,10 @@ static int greth_edcl = 1;
15  module_param(greth_edcl, int, 0);
16  MODULE_PARM_DESC(greth_edcl, "GRETH EDCL usage indicator. Set to 1 if EDCL is used.");
17  
18 +static int no_gbit = 0;
19 +module_param(no_gbit, int, S_IRUGO);
20 +MODULE_PARM_DESC(no_gbit, "GRETH report GBit not supported by MAC enable. Only affects GRETH GBit MAC, default 0 (off).");
21 +
22  static int greth_open(struct net_device *dev);
23  static netdev_tx_t greth_start_xmit(struct sk_buff *skb,
24            struct net_device *dev);
25 @@ -1284,7 +1288,7 @@ static int greth_mdio_probe(struct net_d
26         }
27  
28         ret = phy_connect_direct(dev, phy, &greth_link_change,
29 -                       0, greth->gbit_mac ?
30 +                       0, greth->gbit_phy_support ?
31                         PHY_INTERFACE_MODE_GMII :
32                         PHY_INTERFACE_MODE_MII);
33         if (ret) {
34 @@ -1293,7 +1297,7 @@ static int greth_mdio_probe(struct net_d
35                 return ret;
36         }
37  
38 -       if (greth->gbit_mac)
39 +       if (greth->gbit_phy_support)
40                 phy->supported &= PHY_GBIT_FEATURES;
41         else
42                 phy->supported &= PHY_BASIC_FEATURES;
43 @@ -1441,6 +1445,13 @@ static int __devinit greth_of_probe(stru
44         tmp = GRETH_REGLOAD(regs->control);
45         greth->gbit_mac = (tmp >> 27) & 1;
46  
47 +       /* Let user skip GBit link mode by telling MDIO layer that MAC does
48 +        * not support GBIT (for debug) */
49 +       if (greth->gbit_mac && !no_gbit)
50 +               greth->gbit_phy_support = 1;
51 +       else
52 +               greth->gbit_phy_support = 0;
53 +
54         /* Check for multicast capability */
55         greth->multicast = (tmp >> 25) & 1;
56  
57 --- a/drivers/net/greth.h
58 +++ b/drivers/net/greth.h
59 @@ -138,6 +138,7 @@ struct greth_private {
60         u8 gbit_mac;
61         u8 mdio_int_en;
62         u8 edcl;
63 +       u8 gbit_phy_support;
64  };
65  
66  #endif