* [PATCH v3 0/4] Add fec1 and fec2 support for i.MX7d sdb board
@ 2015-09-07 2:54 Fugang Duan
2015-09-07 2:54 ` [PATCH v3 1/4] ARM: imx7d: add imx7d iomux-gpr field define Fugang Duan
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Fugang Duan @ 2015-09-07 2:54 UTC (permalink / raw)
To: linux-arm-kernel
The patch series is to add fec support for i.MX7d sdb board. Since i.MX7d fec ip is
the same as i.MX6SX, so there have no change for driver itself.
Patch#1: add new iomux-gpr file to define iomux-gpr register and field for i.MX7d.
Patch#2: i.MX7d sdb board install bcm54220 phy, i.MX7d arm2 board install AR8031 phy.
For the two phys, there needs extra phy setting, so package the setting to fixup.
Patch#3~4: Add fec dts node and pinmux setting in dts file.
Since the patch series drop i.MX7d pinfunc patch, and also depend on the pinfunc patch. So
pls apply the patch series after Adrian's patch: http://article.gmane.org/gmane.linux.kernel.gpio/10398/match=
Change:
V3:
* Drop patch "ARM: dts: imx: pinfunc: add GPIO1 pin define for i.MX7d" that was also submitted by
Adrian: http://article.gmane.org/gmane.linux.kernel.gpio/10398/match=
* Modify some slice as Shawn's comments.
V2:
* Remove patch#1 in V1 patch series. Move the sigle BCM54220 PHY ID define to machine file.
* The current BCM54220 switch phy still use generic phy driver since broadcom phy driver don't
support the switch phy, there need effort to add the switch phy support. Once broadcom phy driver
will support the bcm54220 switch phy, we can add the special config to imx_v6_v7_defconfig.
Fugang Duan (4):
ARM: imx7d: add imx7d iomux-gpr field define
ARM: imx: add enet init for i.MX7D platform
ARM: dts: imx7d: add fec1 and fec2 support for i.MX7d soc
ARM: dts: imx7d-sdb: add fec1 and fec2 support
arch/arm/boot/dts/imx7d-sdb.dts | 76 +++++++++++++++++++++++++++++-
arch/arm/boot/dts/imx7d.dtsi | 36 ++++++++++++++
arch/arm/mach-imx/mach-imx7d.c | 74 +++++++++++++++++++++++++++++
include/linux/mfd/syscon/imx7-iomuxc-gpr.h | 47 ++++++++++++++++++
4 files changed, 232 insertions(+), 1 deletion(-)
create mode 100644 include/linux/mfd/syscon/imx7-iomuxc-gpr.h
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/4] ARM: imx7d: add imx7d iomux-gpr field define
2015-09-07 2:54 [PATCH v3 0/4] Add fec1 and fec2 support for i.MX7d sdb board Fugang Duan
@ 2015-09-07 2:54 ` Fugang Duan
2015-09-07 2:55 ` [PATCH v3 2/4] ARM: imx: add enet init for i.MX7D platform Fugang Duan
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Fugang Duan @ 2015-09-07 2:54 UTC (permalink / raw)
To: linux-arm-kernel
Add imx7d iomux-gpr field define.
Signed-off-by: Fugang Duan <B38611@freescale.com>
---
include/linux/mfd/syscon/imx7-iomuxc-gpr.h | 47 ++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/include/linux/mfd/syscon/imx7-iomuxc-gpr.h b/include/linux/mfd/syscon/imx7-iomuxc-gpr.h
new file mode 100644
index 0000000..4585d61
--- /dev/null
+++ b/include/linux/mfd/syscon/imx7-iomuxc-gpr.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2015 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LINUX_IMX7_IOMUXC_GPR_H
+#define __LINUX_IMX7_IOMUXC_GPR_H
+
+#define IOMUXC_GPR0 0x00
+#define IOMUXC_GPR1 0x04
+#define IOMUXC_GPR2 0x08
+#define IOMUXC_GPR3 0x0c
+#define IOMUXC_GPR4 0x10
+#define IOMUXC_GPR5 0x14
+#define IOMUXC_GPR6 0x18
+#define IOMUXC_GPR7 0x1c
+#define IOMUXC_GPR8 0x20
+#define IOMUXC_GPR9 0x24
+#define IOMUXC_GPR10 0x28
+#define IOMUXC_GPR11 0x2c
+#define IOMUXC_GPR12 0x30
+#define IOMUXC_GPR13 0x34
+#define IOMUXC_GPR14 0x38
+#define IOMUXC_GPR15 0x3c
+#define IOMUXC_GPR16 0x40
+#define IOMUXC_GPR17 0x44
+#define IOMUXC_GPR18 0x48
+#define IOMUXC_GPR19 0x4c
+#define IOMUXC_GPR20 0x50
+#define IOMUXC_GPR21 0x54
+#define IOMUXC_GPR22 0x58
+
+/* For imx7d iomux gpr register field define */
+#define IMX7D_GPR1_IRQ_MASK (0x1 << 12)
+#define IMX7D_GPR1_ENET1_TX_CLK_SEL_MASK (0x1 << 13)
+#define IMX7D_GPR1_ENET2_TX_CLK_SEL_MASK (0x1 << 14)
+#define IMX7D_GPR1_ENET_TX_CLK_SEL_MASK (0x3 << 13)
+#define IMX7D_GPR1_ENET1_CLK_DIR_MASK (0x1 << 17)
+#define IMX7D_GPR1_ENET2_CLK_DIR_MASK (0x1 << 18)
+#define IMX7D_GPR1_ENET_CLK_DIR_MASK (0x3 << 17)
+
+#define IMX7D_GPR5_CSI_MUX_CONTROL_MIPI (0x1 << 4)
+
+#endif /* __LINUX_IMX7_IOMUXC_GPR_H */
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 2/4] ARM: imx: add enet init for i.MX7D platform
2015-09-07 2:54 [PATCH v3 0/4] Add fec1 and fec2 support for i.MX7d sdb board Fugang Duan
2015-09-07 2:54 ` [PATCH v3 1/4] ARM: imx7d: add imx7d iomux-gpr field define Fugang Duan
@ 2015-09-07 2:55 ` Fugang Duan
2015-09-07 2:55 ` [PATCH v3 3/4] ARM: dts: imx7d: add fec1 and fec2 support for i.MX7d soc Fugang Duan
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Fugang Duan @ 2015-09-07 2:55 UTC (permalink / raw)
To: linux-arm-kernel
Add enet phy fixup, clock source init for i.MX7D platform.
Signed-off-by: Fugang Duan <B38611@freescale.com>
---
arch/arm/mach-imx/mach-imx7d.c | 74 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/arch/arm/mach-imx/mach-imx7d.c b/arch/arm/mach-imx/mach-imx7d.c
index 4d4a190..c06956f 100644
--- a/arch/arm/mach-imx/mach-imx7d.c
+++ b/arch/arm/mach-imx/mach-imx7d.c
@@ -6,12 +6,85 @@
* published by the Free Software Foundation.
*/
#include <linux/irqchip.h>
+#include <linux/mfd/syscon.h>
+#include <linux/mfd/syscon/imx7-iomuxc-gpr.h>
#include <linux/of_platform.h>
+#include <linux/phy.h>
+#include <linux/regmap.h>
+
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include "common.h"
+static int ar8031_phy_fixup(struct phy_device *dev)
+{
+ u16 val;
+
+ /* Set RGMII IO voltage to 1.8V */
+ phy_write(dev, 0x1d, 0x1f);
+ phy_write(dev, 0x1e, 0x8);
+
+ /* disable phy AR8031 SmartEEE function. */
+ phy_write(dev, 0xd, 0x3);
+ phy_write(dev, 0xe, 0x805d);
+ phy_write(dev, 0xd, 0x4003);
+ val = phy_read(dev, 0xe);
+ val &= ~(0x1 << 8);
+ phy_write(dev, 0xe, val);
+
+ /* introduce tx clock delay */
+ phy_write(dev, 0x1d, 0x5);
+ val = phy_read(dev, 0x1e);
+ val |= 0x0100;
+ phy_write(dev, 0x1e, val);
+
+ return 0;
+}
+
+static int bcm54220_phy_fixup(struct phy_device *dev)
+{
+ /* enable RXC skew select RGMII copper mode */
+ phy_write(dev, 0x1e, 0x21);
+ phy_write(dev, 0x1f, 0x7ea8);
+ phy_write(dev, 0x1e, 0x2f);
+ phy_write(dev, 0x1f, 0x71b7);
+
+ return 0;
+}
+
+#define PHY_ID_AR8031 0x004dd074
+#define PHY_ID_BCM54220 0x600d8589
+
+static void __init imx7d_enet_phy_init(void)
+{
+ if (IS_BUILTIN(CONFIG_PHYLIB)) {
+ phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffff,
+ ar8031_phy_fixup);
+ phy_register_fixup_for_uid(PHY_ID_BCM54220, 0xffffffff,
+ bcm54220_phy_fixup);
+ }
+}
+
+static void __init imx7d_enet_clk_sel(void)
+{
+ struct regmap *gpr;
+
+ gpr = syscon_regmap_lookup_by_compatible("fsl,imx7d-iomuxc-gpr");
+ if (!IS_ERR(gpr)) {
+ regmap_update_bits(gpr, IOMUXC_GPR1, IMX7D_GPR1_ENET_TX_CLK_SEL_MASK, 0);
+ regmap_update_bits(gpr, IOMUXC_GPR1, IMX7D_GPR1_ENET_CLK_DIR_MASK, 0);
+ } else {
+ pr_err("failed to find fsl,imx7d-iomux-gpr regmap\n");
+ }
+}
+
+static inline void imx7d_enet_init(void)
+{
+ imx7d_enet_phy_init();
+ imx7d_enet_clk_sel();
+}
+
static void __init imx7d_init_machine(void)
{
struct device *parent;
@@ -22,6 +95,7 @@ static void __init imx7d_init_machine(void)
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
imx_anatop_init();
+ imx7d_enet_init();
}
static void __init imx7d_init_irq(void)
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 3/4] ARM: dts: imx7d: add fec1 and fec2 support for i.MX7d soc
2015-09-07 2:54 [PATCH v3 0/4] Add fec1 and fec2 support for i.MX7d sdb board Fugang Duan
2015-09-07 2:54 ` [PATCH v3 1/4] ARM: imx7d: add imx7d iomux-gpr field define Fugang Duan
2015-09-07 2:55 ` [PATCH v3 2/4] ARM: imx: add enet init for i.MX7D platform Fugang Duan
@ 2015-09-07 2:55 ` Fugang Duan
2015-09-07 2:55 ` [PATCH v3 4/4] ARM: dts: imx7d-sdb: add fec1 and fec2 support Fugang Duan
2015-09-23 0:25 ` [PATCH v3 0/4] Add fec1 and fec2 support for i.MX7d sdb board Shawn Guo
4 siblings, 0 replies; 7+ messages in thread
From: Fugang Duan @ 2015-09-07 2:55 UTC (permalink / raw)
To: linux-arm-kernel
Add fec1 and fec2 nodes for i.MX7d soc.
Signed-off-by: Fugang Duan <B38611@freescale.com>
---
arch/arm/boot/dts/imx7d.dtsi | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/arch/arm/boot/dts/imx7d.dtsi b/arch/arm/boot/dts/imx7d.dtsi
index b738ce0..7631492 100644
--- a/arch/arm/boot/dts/imx7d.dtsi
+++ b/arch/arm/boot/dts/imx7d.dtsi
@@ -729,6 +729,42 @@
bus-width = <4>;
status = "disabled";
};
+
+ fec1: ethernet at 30be0000 {
+ compatible = "fsl,imx7d-fec", "fsl,imx6sx-fec";
+ reg = <0x30be0000 0x10000>;
+ interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clks IMX7D_ENET_AXI_ROOT_CLK>,
+ <&clks IMX7D_ENET_AXI_ROOT_CLK>,
+ <&clks IMX7D_ENET1_TIME_ROOT_CLK>,
+ <&clks IMX7D_PLL_ENET_MAIN_125M_CLK>,
+ <&clks IMX7D_ENET_PHY_REF_ROOT_CLK>;
+ clock-names = "ipg", "ahb", "ptp",
+ "enet_clk_ref", "enet_out";
+ fsl,num-tx-queues=<3>;
+ fsl,num-rx-queues=<3>;
+ status = "disabled";
+ };
+
+ fec2: ethernet at 30bf0000 {
+ compatible = "fsl,imx7d-fec", "fsl,imx6sx-fec";
+ reg = <0x30bf0000 0x10000>;
+ interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clks IMX7D_ENET_AXI_ROOT_CLK>,
+ <&clks IMX7D_ENET_AXI_ROOT_CLK>,
+ <&clks IMX7D_ENET2_TIME_ROOT_CLK>,
+ <&clks IMX7D_PLL_ENET_MAIN_125M_CLK>,
+ <&clks IMX7D_ENET_PHY_REF_ROOT_CLK>;
+ clock-names = "ipg", "ahb", "ptp",
+ "enet_clk_ref", "enet_out";
+ fsl,num-tx-queues=<3>;
+ fsl,num-rx-queues=<3>;
+ status = "disabled";
+ };
};
};
};
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 4/4] ARM: dts: imx7d-sdb: add fec1 and fec2 support
2015-09-07 2:54 [PATCH v3 0/4] Add fec1 and fec2 support for i.MX7d sdb board Fugang Duan
` (2 preceding siblings ...)
2015-09-07 2:55 ` [PATCH v3 3/4] ARM: dts: imx7d: add fec1 and fec2 support for i.MX7d soc Fugang Duan
@ 2015-09-07 2:55 ` Fugang Duan
2015-09-24 12:30 ` Shawn Guo
2015-09-23 0:25 ` [PATCH v3 0/4] Add fec1 and fec2 support for i.MX7d sdb board Shawn Guo
4 siblings, 1 reply; 7+ messages in thread
From: Fugang Duan @ 2015-09-07 2:55 UTC (permalink / raw)
To: linux-arm-kernel
Enable fec1 and fec2 for i.MX7d-sdb board.
Signed-off-by: Fugang Duan <B38611@freescale.com>
---
arch/arm/boot/dts/imx7d-sdb.dts | 76 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 75 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/imx7d-sdb.dts b/arch/arm/boot/dts/imx7d-sdb.dts
index 4d1a4b9..7d3e980 100644
--- a/arch/arm/boot/dts/imx7d-sdb.dts
+++ b/arch/arm/boot/dts/imx7d-sdb.dts
@@ -101,6 +101,45 @@
arm-supply = <&sw1a_reg>;
};
+&fec1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_enet1>;
+ assigned-clocks = <&clks IMX7D_ENET1_TIME_ROOT_SRC>,
+ <&clks IMX7D_ENET1_TIME_ROOT_CLK>;
+ assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
+ assigned-clock-rates = <0>, <100000000>;
+ phy-mode = "rgmii";
+ phy-handle = <ðphy0>;
+ fsl,magic-packet;
+ status = "okay";
+
+ mdio {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethphy0: ethernet-phy at 0 {
+ reg = <0>;
+ };
+
+ ethphy1: ethernet-phy at 1 {
+ reg = <1>;
+ };
+ };
+};
+
+&fec2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_enet2>;
+ assigned-clocks = <&clks IMX7D_ENET2_TIME_ROOT_SRC>,
+ <&clks IMX7D_ENET2_TIME_ROOT_CLK>;
+ assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
+ assigned-clock-rates = <0>, <100000000>;
+ phy-mode = "rgmii";
+ phy-handle = <ðphy1>;
+ fsl,magic-packet;
+ status = "okay";
+};
+
&i2c1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c1>;
@@ -246,6 +285,42 @@
pinctrl-0 = <&pinctrl_hog>;
imx7d-sdb {
+ pinctrl_enet1: enet1grp {
+ fsl,pins = <
+ MX7D_PAD_GPIO1_IO10__ENET1_MDIO 0x3
+ MX7D_PAD_GPIO1_IO11__ENET1_MDC 0x3
+ MX7D_PAD_ENET1_RGMII_TXC__ENET1_RGMII_TXC 0x1
+ MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0 0x1
+ MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1 0x1
+ MX7D_PAD_ENET1_RGMII_TD2__ENET1_RGMII_TD2 0x1
+ MX7D_PAD_ENET1_RGMII_TD3__ENET1_RGMII_TD3 0x1
+ MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL 0x1
+ MX7D_PAD_ENET1_RGMII_RXC__ENET1_RGMII_RXC 0x1
+ MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0 0x1
+ MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1 0x1
+ MX7D_PAD_ENET1_RGMII_RD2__ENET1_RGMII_RD2 0x1
+ MX7D_PAD_ENET1_RGMII_RD3__ENET1_RGMII_RD3 0x1
+ MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL 0x1
+ >;
+ };
+
+ pinctrl_enet2: enet2grp {
+ fsl,pins = <
+ MX7D_PAD_EPDC_GDSP__ENET2_RGMII_TXC 0x1
+ MX7D_PAD_EPDC_SDCE2__ENET2_RGMII_TD0 0x1
+ MX7D_PAD_EPDC_SDCE3__ENET2_RGMII_TD1 0x1
+ MX7D_PAD_EPDC_GDCLK__ENET2_RGMII_TD2 0x1
+ MX7D_PAD_EPDC_GDOE__ENET2_RGMII_TD3 0x1
+ MX7D_PAD_EPDC_GDRL__ENET2_RGMII_TX_CTL 0x1
+ MX7D_PAD_EPDC_SDCE1__ENET2_RGMII_RXC 0x1
+ MX7D_PAD_EPDC_SDCLK__ENET2_RGMII_RD0 0x1
+ MX7D_PAD_EPDC_SDLE__ENET2_RGMII_RD1 0x1
+ MX7D_PAD_EPDC_SDOE__ENET2_RGMII_RD2 0x1
+ MX7D_PAD_EPDC_SDSHR__ENET2_RGMII_RD3 0x1
+ MX7D_PAD_EPDC_SDCE0__ENET2_RGMII_RX_CTL 0x1
+ >;
+ };
+
pinctrl_hog: hoggrp {
fsl,pins = <
MX7D_PAD_UART3_CTS_B__GPIO4_IO7 0x14
@@ -281,7 +356,6 @@
>;
};
-
pinctrl_uart1: uart1grp {
fsl,pins = <
MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX 0x79
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 0/4] Add fec1 and fec2 support for i.MX7d sdb board
2015-09-07 2:54 [PATCH v3 0/4] Add fec1 and fec2 support for i.MX7d sdb board Fugang Duan
` (3 preceding siblings ...)
2015-09-07 2:55 ` [PATCH v3 4/4] ARM: dts: imx7d-sdb: add fec1 and fec2 support Fugang Duan
@ 2015-09-23 0:25 ` Shawn Guo
4 siblings, 0 replies; 7+ messages in thread
From: Shawn Guo @ 2015-09-23 0:25 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Sep 07, 2015 at 10:54:58AM +0800, Fugang Duan wrote:
> Fugang Duan (4):
> ARM: imx7d: add imx7d iomux-gpr field define
> ARM: imx: add enet init for i.MX7D platform
> ARM: dts: imx7d: add fec1 and fec2 support for i.MX7d soc
Applied above 3.
> ARM: dts: imx7d-sdb: add fec1 and fec2 support
Will apply this one after the prerequisite is applied.
Shawn
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 4/4] ARM: dts: imx7d-sdb: add fec1 and fec2 support
2015-09-07 2:55 ` [PATCH v3 4/4] ARM: dts: imx7d-sdb: add fec1 and fec2 support Fugang Duan
@ 2015-09-24 12:30 ` Shawn Guo
0 siblings, 0 replies; 7+ messages in thread
From: Shawn Guo @ 2015-09-24 12:30 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Sep 07, 2015 at 10:55:02AM +0800, Fugang Duan wrote:
> Enable fec1 and fec2 for i.MX7d-sdb board.
>
> Signed-off-by: Fugang Duan <B38611@freescale.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-09-24 12:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-07 2:54 [PATCH v3 0/4] Add fec1 and fec2 support for i.MX7d sdb board Fugang Duan
2015-09-07 2:54 ` [PATCH v3 1/4] ARM: imx7d: add imx7d iomux-gpr field define Fugang Duan
2015-09-07 2:55 ` [PATCH v3 2/4] ARM: imx: add enet init for i.MX7D platform Fugang Duan
2015-09-07 2:55 ` [PATCH v3 3/4] ARM: dts: imx7d: add fec1 and fec2 support for i.MX7d soc Fugang Duan
2015-09-07 2:55 ` [PATCH v3 4/4] ARM: dts: imx7d-sdb: add fec1 and fec2 support Fugang Duan
2015-09-24 12:30 ` Shawn Guo
2015-09-23 0:25 ` [PATCH v3 0/4] Add fec1 and fec2 support for i.MX7d sdb board Shawn Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).