From patchwork Thu Jun 13 18:12:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2718111 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1F4019F472 for ; Thu, 13 Jun 2013 18:12:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10FEA20352 for ; Thu, 13 Jun 2013 18:12:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1BD4120355 for ; Thu, 13 Jun 2013 18:12:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758451Ab3FMSM4 (ORCPT ); Thu, 13 Jun 2013 14:12:56 -0400 Received: from mail-lb0-f173.google.com ([209.85.217.173]:44493 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756474Ab3FMSMz (ORCPT ); Thu, 13 Jun 2013 14:12:55 -0400 Received: by mail-lb0-f173.google.com with SMTP id v1so5192978lbd.32 for ; Thu, 13 Jun 2013 11:12:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:cc:from:organization:date:mime-version:content-type :content-transfer-encoding:message-id:x-gm-message-state; bh=ZXlYWsOflai9yY1uJ4a5yB+9Ntj2N+dWryhmHSEzR0Y=; b=Mh3+zjS16fYZxS6TxySVFgQrXwhtcr+aGX/L8x5Z3ftKjRajKvVq4D42dbJkiy2d8R QrJyJv7Qrka86VrvlFOkCIqfnpBqzh7vxGA2JnkmL5PXjRmEdNIT+8MG61C6J79dxxJq 8GnOvdNhVHLRLZ7v3eBn3gkDl1fO8AVb1dzY+UYQgy38vDH51lUJaioHuNDZVkFVWP5C ns2VZiIHk7A5TmdFpZxn4KpbiKRUX2by2nKiDxdRgtAWcaZO6XsbTcyJ9W4YZnAV8bGJ H8RikGpH1JUNkVUrbo4L8EFftMdJxRbEk5R1pQ3D+y1TcTSa4ZaKf4x3rj1smyVaPMz/ 74dA== X-Received: by 10.112.201.10 with SMTP id jw10mr1852171lbc.58.1371147173027; Thu, 13 Jun 2013 11:12:53 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (mail.dev.rtsoft.ru. [213.79.90.226]) by mx.google.com with ESMTPSA id x5sm11164082lbx.8.2013.06.13.11.12.50 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 13 Jun 2013 11:12:52 -0700 (PDT) To: netdev@vger.kernel.org Subject: [PATCH v2] sh_eth: get R8A7740 Rx descriptor word 0 shift out of #ifdef Cc: nobuhiro.iwamatsu.yj@renesas.com, linux-sh@vger.kernel.org From: Sergei Shtylyov Organization: Cogent Embedded Date: Thu, 13 Jun 2013 22:12:45 +0400 MIME-Version: 1.0 Message-Id: <201306132212.46361.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQnoM6vIHBoIMFxTUPD2/ye/DJ8St5WuHMMuG8XYatfTAEZHFvXltnAcV1gY71LQqUCi/zVN Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The only R8A7740 specific #ifdef hindering ARM multiplatform build is left in sh_eth_rx(): it covers the code shifting Rx buffer descriptor word 0 by 16. Get rid of the #ifdef by adding 'shift_rd0' field to the 'struct sh_eth_cpu_data', making the shift dependent on it, and setting it to 1 for the R8A7740 case... Signed-off-by: Sergei Shtylyov --- The patch is against Dave Miller's 'net-next.git' repository plus commit dd019897358b815f7828dab90b51d51df4d3658d (net: sh_eth: fix incorrect RX length error if R8A7740) from the 'net.git' reposirory, so please merge it into 'net-next.git' before applying this patch. Changes in version 2: - made a patch apply atop of Yoshihiro Shimoda's commit, updated the changelog; - clarified the comment to the 'shift_rd0' field of 'struct sh_eth_cpu_data'. drivers/net/ethernet/renesas/sh_eth.c | 6 +++--- drivers/net/ethernet/renesas/sh_eth.h | 1 + 2 files changed, 4 insertions(+), 3 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-next/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c +++ net-next/drivers/net/ethernet/renesas/sh_eth.c @@ -667,6 +667,7 @@ static struct sh_eth_cpu_data r8a7740_da .no_ade = 1, .tsu = 1, .select_mii = 1, + .shift_rd0 = 1, }; static struct sh_eth_cpu_data sh7619_data = { @@ -1266,7 +1267,6 @@ static int sh_eth_rx(struct net_device * if (!(desc_status & RDFEND)) ndev->stats.rx_length_errors++; -#if defined(CONFIG_ARCH_R8A7740) /* * In case of almost all GETHER/ETHERs, the Receive Frame State * (RFS) bits in the Receive Descriptor 0 are from bit 9 to @@ -1274,8 +1274,8 @@ static int sh_eth_rx(struct net_device * * bits are from bit 25 to bit 16. So, the driver needs right * shifting by 16. */ - desc_status >>= 16; -#endif + if (mdp->cd->shift_rd0) + desc_status >>= 16; if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 | RD_RFS5 | RD_RFS6 | RD_RFS10)) { Index: net-next/drivers/net/ethernet/renesas/sh_eth.h =================================================================== --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.h +++ net-next/drivers/net/ethernet/renesas/sh_eth.h @@ -476,6 +476,7 @@ struct sh_eth_cpu_data { unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */ unsigned hw_crc:1; /* E-DMAC have CSMR */ unsigned select_mii:1; /* EtherC have RMII_MII (MII select register) */ + unsigned shift_rd0:1; /* shift Rx descriptor word 0 right by 16 */ }; struct sh_eth_private {