From patchwork Sun Mar 31 19:50:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2368651 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 19EB73FC8C for ; Sun, 31 Mar 2013 19:51:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755639Ab3CaTva (ORCPT ); Sun, 31 Mar 2013 15:51:30 -0400 Received: from mail-lb0-f180.google.com ([209.85.217.180]:65097 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753067Ab3CaTv3 (ORCPT ); Sun, 31 Mar 2013 15:51:29 -0400 Received: by mail-lb0-f180.google.com with SMTP id t11so1441183lbi.39 for ; Sun, 31 Mar 2013 12:51:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:to:subject:cc:from:organization:date:mime-version :content-type:content-transfer-encoding:message-id :x-gm-message-state; bh=4e+2KM98BExvsJBS/xopbQ9Wqo48XdKjC7kzTItq0Yc=; b=REF6Qa8b9ua6zPlvwcSlzU7IFjDJXkE/cB4+wx7BYEPzhsDr8F3anaVqqDM3E1odk8 hO16cOajzdmY5kLy2m+ysgTs5feHKZp4uA8FYlAQAVRCNQTztXslZ5UtiHLXlIekWkPI Smkij5rLMyiV9OeCpC5JTZ2Vey0i/HRZtLKCvv80CqlmoxRhpvAvmyQekP6as+GWA+gF A+9QYSqSrqSYJDifnUE4esdkGVbwjy2Q6t+euo1de98We0JlnkHR3dpXxeHGlBItn/5S 0csAANyjKrU/DqB93RoGp8bch5QyXDLvrrn2/gmkQE2VBY5TWldvmE87cUdByoFy9GQj eDkw== X-Received: by 10.152.87.212 with SMTP id ba20mr4552358lab.0.1364759488149; Sun, 31 Mar 2013 12:51:28 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-79-90-168.pppoe.mtu-net.ru. [91.79.90.168]) by mx.google.com with ESMTPS id z1sm4432359lbk.2.2013.03.31.12.51.26 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 31 Mar 2013 12:51:27 -0700 (PDT) To: netdev@vger.kernel.org Subject: [PATCH 1/2] sh_eth: fix handling of no LINK signal Cc: nobuhiro.iwamatsu.yj@renesas.com, linux-sh@vger.kernel.org From: Sergei Shtylyov Organization: Cogent Embedded Date: Sun, 31 Mar 2013 23:50:07 +0400 MIME-Version: 1.0 Message-Id: <201303312350.08153.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQnkALdasURylEAm2V3BDhIHsfFWhKZpvc6Jzi45GwAq4Z3/KbOXK7IDOteELH0Twla+652n Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org The code handling the absent LINK signal (or the absent PSR register -- which reflects the state of this signal) is quite naive and has probably never really worked. It's probably enough to say that this code is executed only on the LINK change interrupt (sic!) but even if we actually have the signal and choose to ignore it (it might be connected to PHY's link/activity LED output as on the Renesas BOCK-W board), sh_eth_adjust_link() on which this code relies to update 'mdp->link' gets executed later than the LINK change interrupt where it is checked, and so RX/TX never get enabled via ECMR register. So, ignore the LINK changed interrupt iff LINK signal is absent (or just chosen not to be used) or PSR register is absent, and enable/disable RX/TX directly in sh_eth_adjust_link() in this case. Signed-off-by: Sergei Shtylyov --- The patch is against the David Miller's 'net.git' repo. drivers/net/ethernet/renesas/sh_eth.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: net/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- net.orig/drivers/net/ethernet/renesas/sh_eth.c +++ net/drivers/net/ethernet/renesas/sh_eth.c @@ -1216,10 +1216,7 @@ static void sh_eth_error(struct net_devi if (felic_stat & ECSR_LCHNG) { /* Link Changed */ if (mdp->cd->no_psr || mdp->no_ether_link) { - if (mdp->link == PHY_DOWN) - link_stat = 0; - else - link_stat = PHY_ST_LINK; + goto ignore_link; } else { link_stat = (sh_eth_read(ndev, PSR)); if (mdp->ether_link_active_low) @@ -1242,6 +1239,7 @@ static void sh_eth_error(struct net_devi } } +ignore_link: if (intr_status & EESR_TWB) { /* Write buck end. unused write back interrupt */ if (intr_status & EESR_TABT) /* Transmit Abort int */ @@ -1392,12 +1390,16 @@ static void sh_eth_adjust_link(struct ne (sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR); new_state = 1; mdp->link = phydev->link; + if (mdp->cd->no_psr || mdp->no_ether_link) + sh_eth_rcv_snd_enable(ndev); } } else if (mdp->link) { new_state = 1; mdp->link = PHY_DOWN; mdp->speed = 0; mdp->duplex = -1; + if (mdp->cd->no_psr || mdp->no_ether_link) + sh_eth_rcv_snd_disable(ndev); } if (new_state && netif_msg_link(mdp))