From patchwork Fri Aug 28 09:25:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 44420 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7S9PAlp017331 for ; Fri, 28 Aug 2009 09:25:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751365AbZH1JZG (ORCPT ); Fri, 28 Aug 2009 05:25:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751273AbZH1JZG (ORCPT ); Fri, 28 Aug 2009 05:25:06 -0400 Received: from mail.renesas.com ([202.234.163.13]:34202 "EHLO mail01.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751269AbZH1JZF (ORCPT ); Fri, 28 Aug 2009 05:25:05 -0400 X-AuditID: ac140384-00000008000004f6-58-4a97a27071a1 Received: from guardian01.idc.renesas.com ([172.20.8.200]) by mail01.idc.renesas.com (sendmail) with ESMTP id n7S9P49K016231; Fri, 28 Aug 2009 18:25:04 +0900 (JST) Received: (from root@localhost) by guardian01.idc.renesas.com with id n7S9P5fs021867; Fri, 28 Aug 2009 18:25:05 +0900 (JST) Received: from mta01.idc.renesas.com (localhost [127.0.0.1]) by mta01.idc.renesas.com with ESMTP id n7S9P4Dg006868; Fri, 28 Aug 2009 18:25:04 +0900 (JST) Received: from [172.30.8.157] by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KP2007VAY5S6O@ims05.idc.renesas.com>; Fri, 28 Aug 2009 18:25:04 +0900 (JST) Date: Fri, 28 Aug 2009 18:25:03 +0900 From: Yoshihiro Shimoda Subject: [PATCH] net: sh_eth: add value of ether_link pin in platform_data To: netdev@vger.kernel.org Cc: SH-Linux Message-id: <4A97A26F.4060904@renesas.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) X-Brightmail-Tracker: AAAAAA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org 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 --- arch/sh/include/asm/sh_eth.h | 3 +++ drivers/net/sh_eth.c | 6 +++++- drivers/net/sh_eth.h | 3 +++ 3 files changed, 11 insertions(+), 1 deletions(-) diff --git a/arch/sh/include/asm/sh_eth.h b/arch/sh/include/asm/sh_eth.h index bb83258..acf9970 100644 --- a/arch/sh/include/asm/sh_eth.h +++ b/arch/sh/include/asm/sh_eth.h @@ -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 diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index a2d82dd..793d4d9 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -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; diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h index 9afe5b4..ba151f8 100644 --- a/drivers/net/sh_eth.h +++ b/drivers/net/sh_eth.h @@ -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)