From patchwork Sun Oct 21 21:57:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joachim Eastwood X-Patchwork-Id: 1623111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id EEED0DFFF1 for ; Sun, 21 Oct 2012 21:59:28 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TQ3X2-0001kS-Rd; Sun, 21 Oct 2012 21:58:04 +0000 Received: from mail-lb0-f177.google.com ([209.85.217.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TQ3WR-0001fY-2o for linux-arm-kernel@lists.infradead.org; Sun, 21 Oct 2012 21:57:29 +0000 Received: by mail-lb0-f177.google.com with SMTP id gi11so1227681lbb.36 for ; Sun, 21 Oct 2012 14:57:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=YRZdUtL8g/IvIKysYyjltEb0VaadAgE4MG2aiRe1FJM=; b=ZK/KBVHRPZTr/vKKZ4r48dmcSKyqAfveXTVLB+tQspyiTwsndjswvlYU9Gv/0LAaGD LCgivJtxfdajqoyZCzeyjrmsEVJYKc3oJKCLjyMHdR2Cr+PFWjE/YyVufeZ6DAXevVwz jVOQLrFWUYJs84wWY7p6YIASbIxIfYrApmkCNXIzkjPQMivqcYqfFdjeq8wuW5FNTGVB u+FsvVqVB/hHlvky9904/7jsiJ+TUSigE54iO08JO98a/Zuc3XQJPijNH92QMboijl+v G9q3JedIdJkeLhwXpbTKwmQl1AY2vZfyXjuxtxJYuVZD//BqV59GJNuS4fElGcCF3z8k b0kw== Received: by 10.152.148.40 with SMTP id tp8mr6534281lab.30.1350856645713; Sun, 21 Oct 2012 14:57:25 -0700 (PDT) Received: from localhost.localdomain ([90.149.223.57]) by mx.google.com with ESMTPS id f2sm1382445lbz.6.2012.10.21.14.57.24 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 21 Oct 2012 14:57:25 -0700 (PDT) From: Joachim Eastwood To: nicolas.ferre@atmel.com, davem@davemloft.net, hskinnemoen@gmail.com, egtvedt@samfundet.no, plagnioj@jcrosoft.com, bgat@billgatliff.com Subject: [PATCH v2 3/3] net/at91_ether: add pdata flag for reverse Eth addr Date: Sun, 21 Oct 2012 23:57:03 +0200 Message-Id: <1350856623-9819-4-git-send-email-manabian@gmail.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1350856623-9819-1-git-send-email-manabian@gmail.com> References: <1350856623-9819-1-git-send-email-manabian@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (manabian[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: netdev@vger.kernel.org, Joachim Eastwood , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This will allow us to remove the last mach include from at91_ether and also make it easier to share address setup with macb. Signed-off-by: Joachim Eastwood --- arch/arm/mach-at91/board-csb337.c | 2 ++ drivers/net/ethernet/cadence/Kconfig | 1 - drivers/net/ethernet/cadence/at91_ether.c | 5 ++--- include/linux/platform_data/macb.h | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c index 3e37437..aa9b320 100644 --- a/arch/arm/mach-at91/board-csb337.c +++ b/arch/arm/mach-at91/board-csb337.c @@ -53,6 +53,8 @@ static void __init csb337_init_early(void) static struct macb_platform_data __initdata csb337_eth_data = { .phy_irq_pin = AT91_PIN_PC2, .is_rmii = 0, + /* The CSB337 bootloader stores the MAC the wrong-way around */ + .rev_eth_addr = 1, }; static struct at91_usbh_data __initdata csb337_usbh_data = { diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig index f6d0956..40172d1 100644 --- a/drivers/net/ethernet/cadence/Kconfig +++ b/drivers/net/ethernet/cadence/Kconfig @@ -21,7 +21,6 @@ if NET_CADENCE config ARM_AT91_ETHER tristate "AT91RM9200 Ethernet support" - depends on ARM && ARCH_AT91RM9200 select NET_CORE select MACB ---help--- diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c index 375d272..b92815a 100644 --- a/drivers/net/ethernet/cadence/at91_ether.c +++ b/drivers/net/ethernet/cadence/at91_ether.c @@ -32,8 +32,6 @@ #include #include -#include - #include "macb.h" #define DRV_NAME "at91_ether" @@ -61,9 +59,10 @@ static short __init unpack_mac_address(struct net_device *dev, unsigned int hi, unsigned int lo) { + struct macb *lp = netdev_priv(dev); char addr[6]; - if (machine_is_csb337()) { + if (lp->board_data.rev_eth_addr) { addr[5] = (lo & 0xff); /* The CSB337 bootloader stores the MAC the wrong-way around */ addr[4] = (lo & 0xff00) >> 8; addr[3] = (lo & 0xff0000) >> 16; diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h index b081c72..044a124 100644 --- a/include/linux/platform_data/macb.h +++ b/include/linux/platform_data/macb.h @@ -12,6 +12,7 @@ struct macb_platform_data { u32 phy_mask; int phy_irq_pin; /* PHY IRQ */ u8 is_rmii; /* using RMII interface? */ + u8 rev_eth_addr; /* reverse Ethernet address byte order */ }; #endif /* __MACB_PDATA_H__ */