net: sh_eth: add value of ether_link pin in platform_data
authorYoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Thu, 27 Aug 2009 23:25:03 +0000 (23:25 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 29 Aug 2009 07:19:35 +0000 (00:19 -0700)
The method of ETHER_LINK pin is board dependence.
This patch adding paramters are:
 - no_ether_link          : If set to 1, do not use ETHER_LINK
 - ether_link_active_low  : If set to 1, ETHER_LINK is active low.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sh/include/asm/sh_eth.h
drivers/net/sh_eth.c
drivers/net/sh_eth.h

index bb832584f3c17c644a54296b0bfb66e8a5fa5ebb..acf99700deed60370935b1e951bf057ba55bc623 100644 (file)
@@ -6,6 +6,9 @@ enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};
 struct sh_eth_plat_data {
        int phy;
        int edmac_endian;
+
+       unsigned no_ether_link:1;
+       unsigned ether_link_active_low:1;
 };
 
 #endif
index 4c4dcbf1902670ed019b1bf74b5f86ed4e5750ff..f49d0800c1d103c70bdb37f59cba9f00047b5285 100644 (file)
@@ -772,13 +772,15 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
                        mdp->stats.tx_carrier_errors++;
                if (felic_stat & ECSR_LCHNG) {
                        /* Link Changed */
-                       if (mdp->cd->no_psr) {
+                       if (mdp->cd->no_psr || mdp->no_ether_link) {
                                if (mdp->link == PHY_DOWN)
                                        link_stat = 0;
                                else
                                        link_stat = PHY_ST_LINK;
                        } else {
                                link_stat = (ctrl_inl(ioaddr + PSR));
+                               if (mdp->ether_link_active_low)
+                                       link_stat = ~link_stat;
                        }
                        if (!(link_stat & PHY_ST_LINK)) {
                                /* Link Down : disable tx and rx */
@@ -1410,6 +1412,8 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
        mdp->phy_id = pd->phy;
        /* EDMAC endian */
        mdp->edmac_endian = pd->edmac_endian;
+       mdp->no_ether_link = pd->no_ether_link;
+       mdp->ether_link_active_low = pd->ether_link_active_low;
 
        /* set cpu data */
        mdp->cd = &sh_eth_my_cpu_data;
index 9afe5b4c855d4f15429eccb7cca36f09e468fe83..ba151f86ae7b9a76b07942c7a2a45d573c79a664 100644 (file)
@@ -729,6 +729,9 @@ struct sh_eth_private {
        char post_rx;           /* POST receive */
        char post_fw;           /* POST forward */
        struct net_device_stats tsu_stats;      /* TSU forward status */
+
+       unsigned no_ether_link:1;
+       unsigned ether_link_active_low:1;
 };
 
 static inline void sh_eth_soft_swap(char *src, int len)