From patchwork Wed Dec 2 16:54:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 551467 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2270D14030D for ; Thu, 3 Dec 2015 03:54:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gateworks-com.20150623.gappssmtp.com header.i=@gateworks-com.20150623.gappssmtp.com header.b=RXgK6muX; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 5571E28BD32; Wed, 2 Dec 2015 17:54:33 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 474F02877D6 for ; Wed, 2 Dec 2015 17:54:26 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .gateworks. - helo: .mail-pa0-f41.google. - helo-domain: .google.) FROM/MX_MATCHES_NOT_HELO(DOMAIN)=1; rate: -5.5 Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Wed, 2 Dec 2015 17:54:24 +0100 (CET) Received: by pacdm15 with SMTP id dm15so45529460pac.3 for ; Wed, 02 Dec 2015 08:54:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=ovT9getnqTjlI6acDVMI06jyFYCN4XHDzLoeMostVcM=; b=RXgK6muXSGrv++qiCtoeX9zHkaUdYJLjRipZxD6XoWgX0S/KGOlJObpKcJp+jZg/Dn 2TIqDjVxfuRJA2KxH1UzheAOvljPvJ1qm+MywparLrTvICOWtKZW1vQCfomgkw1UPSna 8IdlxhdsGSG/6TeOTxPvSd09X72t1iyji9HW0zeXxvdQvnfnfP51vQ6VDUf5Y2UJnuFq qkjXG9Jz05hQ0jPgXSxGxqdYR/JZ9MvoEV9g8ikERLlMm6vIL0N3weVvFx4qdqqas4cg QOLCnJ2EonrMOY0Ha2qwGbNGeYE0p+NJYgVREqHql5AYgQPlsAMYP9eTyTsig/3ljuMj k+HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ovT9getnqTjlI6acDVMI06jyFYCN4XHDzLoeMostVcM=; b=gFbPDzEEjI2gMrGocRSlqzDr+MIZXBrbI7JuYYes1+np6GeHkKC0++mFTAw/88FlCE 3DY41gaVFKtM+7rVek0KNqNx5H53AzASPp2i50hnJ/zNKnGLsk4sJwGeFqpWXcGrjnlK VtxsnF5j8DLLFzRouFuGqbs8lnPXRZf0DKbTmR/Nm64J5Txx56YNxdpSPFxYOPtOL0sq CcbALelP/JO2USIMRTRCi3obkR372HyT3L4tHy7WFtfR/YPHR0tVlRanUqdJRV0A8/B4 b2EroAmRCubp53VKO+csTCG9w+DMLc2M3zIOeUnL1ryekQxq83HLLZ5cOoWxnvzofudk YC+w== X-Gm-Message-State: ALoCoQkpYf7gVJ5uMqNPPRlWrl6i+C5KcVV5BCPGr/URH0CLkYLhuA7OkRQwqyafxnnXWjVec1IQ X-Received: by 10.66.140.79 with SMTP id re15mr5870118pab.127.1449075268481; Wed, 02 Dec 2015 08:54:28 -0800 (PST) Received: from tharvey.gw (68-189-91-139.static.snlo.ca.charter.com. [68.189.91.139]) by smtp.gmail.com with ESMTPSA id w8sm5440430pfi.41.2015.12.02.08.54.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Dec 2015 08:54:27 -0800 (PST) From: Tim Harvey To: Luka Perkov Date: Wed, 2 Dec 2015 08:54:26 -0800 Message-Id: <1449075266-22491-1-git-send-email-tharvey@gateworks.com> X-Mailer: git-send-email 1.9.1 Cc: OpenWrt Development List Subject: [OpenWrt-Devel] [PATCH] imx6: fix device-tree mac address assignment for ventana sky2/eth1 X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Some Ventana boards have a Marvell sky2 GigE controller as eth1 however assigning the mac address through device-tree is difficult because the PCI slot can move around depending on board configuration and slot population. To work around this we add a patch to the sky2 driver to allow accessing its mac address via a device-tree alias. Signed-off-by: Tim Harvey --- .../208-sky2-allow-mac-to-come-from-dt.patch | 30 ++++++++++++++++++++++ .../209-ARM-imx-ventana-add-sky2-alias.patch | 24 +++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 target/linux/imx6/patches-4.1/208-sky2-allow-mac-to-come-from-dt.patch create mode 100644 target/linux/imx6/patches-4.1/209-ARM-imx-ventana-add-sky2-alias.patch diff --git a/target/linux/imx6/patches-4.1/208-sky2-allow-mac-to-come-from-dt.patch b/target/linux/imx6/patches-4.1/208-sky2-allow-mac-to-come-from-dt.patch new file mode 100644 index 0000000..c9c352c --- /dev/null +++ b/target/linux/imx6/patches-4.1/208-sky2-allow-mac-to-come-from-dt.patch @@ -0,0 +1,30 @@ +Index: linux-4.1.6/drivers/net/ethernet/marvell/sky2.c +=================================================================== +--- linux-4.1.6.orig/drivers/net/ethernet/marvell/sky2.c 2015-08-16 20:52:51.000000000 -0700 ++++ linux-4.1.6/drivers/net/ethernet/marvell/sky2.c 2015-10-05 12:58:01.805935731 -0700 +@@ -4812,7 +4812,24 @@ + * 1) from device tree data + * 2) from internal registers set by bootloader + */ +- iap = of_get_mac_address(hw->pdev->dev.of_node); ++ ++ iap = NULL; ++ if (IS_ENABLED(CONFIG_OF)) { ++ struct device_node *np; ++ np = of_find_node_by_path("/aliases"); ++ if (np) { ++ const char *path = of_get_property(np, "sky2", NULL); ++ if (path) ++ np = of_find_node_by_path(path); ++ if (np) ++ path = of_get_mac_address(np); ++ if (path) ++ iap = (unsigned char *) path; ++ } ++ } ++ ++ if (!iap) ++ iap = of_get_mac_address(hw->pdev->dev.of_node); + if (iap) + memcpy(dev->dev_addr, iap, ETH_ALEN); + else diff --git a/target/linux/imx6/patches-4.1/209-ARM-imx-ventana-add-sky2-alias.patch b/target/linux/imx6/patches-4.1/209-ARM-imx-ventana-add-sky2-alias.patch new file mode 100644 index 0000000..eef81fa --- /dev/null +++ b/target/linux/imx6/patches-4.1/209-ARM-imx-ventana-add-sky2-alias.patch @@ -0,0 +1,24 @@ +Index: linux-4.1.6/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi +=================================================================== +--- linux-4.1.6.orig/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi 2015-10-05 13:18:30.973900271 -0700 ++++ linux-4.1.6/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi 2015-10-05 13:21:28.577895147 -0700 +@@ -15,6 +15,7 @@ + /* these are used by bootloader for disabling nodes */ + aliases { + ethernet1 = ð1; ++ sky2 = ð1; + led0 = &led0; + led1 = &led1; + led2 = &led2; +Index: linux-4.1.6/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi +=================================================================== +--- linux-4.1.6.orig/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi 2015-10-05 13:18:30.973900271 -0700 ++++ linux-4.1.6/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi 2015-10-05 13:20:09.261897435 -0700 +@@ -15,6 +15,7 @@ + /* these are used by bootloader for disabling nodes */ + aliases { + ethernet1 = ð1; ++ sky2 = ð1; + led0 = &led0; + led1 = &led1; + led2 = &led2;