* [PATCH v2 0/3] net: macb: rework at91 specific handling
@ 2015-03-06 10:23 Boris Brezillon
2015-03-06 10:24 ` [PATCH v2 1/3] net/macb: Update DT bindings documentation Boris Brezillon
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Boris Brezillon @ 2015-03-06 10:23 UTC (permalink / raw)
To: David S. Miller, netdev
Cc: Nicolas Ferre, Jean-Christophe Plagniol-Villard,
Alexandre Belloni, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, devicetree, linux-kernel,
linux-arm-kernel, Boris Brezillon
Hello,
This removes the #if defined(ARCH_AT91) sections to prevent any problem
when enabling ARM multi-platform support.
The at91 specific logic is now activated when the "at91sam9260-macb"
compatible string is found.
Best Regards,
Boris
Changes since v1:
- avoid changing existing behavior as Alexandre suggested
Boris Brezillon (3):
net/macb: Update DT bindings documentation
ARM: at91/dt: fix macb compatible strings
net: macb: remove #if defined(CONFIG_ARCH_AT91) sections
Documentation/devicetree/bindings/net/macb.txt | 5 +++-
arch/arm/boot/dts/at91sam9260.dtsi | 2 +-
arch/arm/boot/dts/at91sam9263.dtsi | 2 +-
arch/arm/boot/dts/at91sam9g45.dtsi | 2 +-
arch/arm/boot/dts/at91sam9x5_macb0.dtsi | 2 +-
arch/arm/boot/dts/at91sam9x5_macb1.dtsi | 2 +-
arch/arm/boot/dts/sama5d3_emac.dtsi | 2 +-
drivers/net/ethernet/cadence/macb.c | 32 ++++++++++++++------------
drivers/net/ethernet/cadence/macb.h | 2 ++
9 files changed, 29 insertions(+), 22 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/3] net/macb: Update DT bindings documentation
2015-03-06 10:23 [PATCH v2 0/3] net: macb: rework at91 specific handling Boris Brezillon
@ 2015-03-06 10:24 ` Boris Brezillon
2015-03-06 16:45 ` Nicolas Ferre
2015-03-06 10:24 ` [PATCH v2 2/3] ARM: at91/dt: fix macb compatible strings Boris Brezillon
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Boris Brezillon @ 2015-03-06 10:24 UTC (permalink / raw)
To: David S. Miller, netdev
Cc: Mark Rutland, devicetree, Pawel Moll, Ian Campbell,
Boris Brezillon, Nicolas Ferre, linux-kernel, Rob Herring,
Alexandre Belloni, Kumar Gala, Jean-Christophe Plagniol-Villard,
linux-arm-kernel
Add missing "cdns,at91sam9260-macb", "atmel,sama5d3-gem" and
"atmel,sama5d4-gem" compatible strings.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Documentation/devicetree/bindings/net/macb.txt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/net/macb.txt b/Documentation/devicetree/bindings/net/macb.txt
index aaa6964..ba19d67 100644
--- a/Documentation/devicetree/bindings/net/macb.txt
+++ b/Documentation/devicetree/bindings/net/macb.txt
@@ -2,10 +2,13 @@
Required properties:
- compatible: Should be "cdns,[<chip>-]{macb|gem}"
- Use "cdns,at91sam9260-macb" Atmel at91sam9260 and at91sam9263 SoCs.
+ Use "cdns,at91sam9260-macb" for Atmel at91sam9 SoCs or the 10/100Mbit IP
+ available on sama5d3 SoCs.
Use "cdns,at32ap7000-macb" for other 10/100 usage or use the generic form: "cdns,macb".
Use "cdns,pc302-gem" for Picochip picoXcell pc302 and later devices based on
the Cadence GEM, or the generic form: "cdns,gem".
+ Use "cdns,sama5d3-gem" for the Gigabit IP available on Atmel sama5d3 SoCs.
+ Use "cdns,sama5d4-gem" for the Gigabit IP available on Atmel sama5d4 SoCs.
- reg: Address and length of the register set for the device
- interrupts: Should contain macb interrupt
- phy-mode: See ethernet.txt file in the same directory.
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/3] ARM: at91/dt: fix macb compatible strings
2015-03-06 10:23 [PATCH v2 0/3] net: macb: rework at91 specific handling Boris Brezillon
2015-03-06 10:24 ` [PATCH v2 1/3] net/macb: Update DT bindings documentation Boris Brezillon
@ 2015-03-06 10:24 ` Boris Brezillon
[not found] ` <1425637442-8724-3-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-03-06 10:24 ` [PATCH v2 3/3] net: macb: remove #if defined(CONFIG_ARCH_AT91) sections Boris Brezillon
2015-03-06 16:44 ` [PATCH v2 0/3] net: macb: rework at91 specific handling Nicolas Ferre
3 siblings, 1 reply; 8+ messages in thread
From: Boris Brezillon @ 2015-03-06 10:24 UTC (permalink / raw)
To: David S. Miller, netdev
Cc: Nicolas Ferre, Jean-Christophe Plagniol-Villard,
Alexandre Belloni, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, devicetree, linux-kernel,
linux-arm-kernel, Boris Brezillon
Some at91 SoCs embed a 10/100 Mbit Ethernet IP, that is based on the
at91sam9260 SoC.
Fix at91 DTs accordingly.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/boot/dts/at91sam9260.dtsi | 2 +-
arch/arm/boot/dts/at91sam9263.dtsi | 2 +-
arch/arm/boot/dts/at91sam9g45.dtsi | 2 +-
arch/arm/boot/dts/at91sam9x5_macb0.dtsi | 2 +-
arch/arm/boot/dts/at91sam9x5_macb1.dtsi | 2 +-
arch/arm/boot/dts/sama5d3_emac.dtsi | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index fff0ee6..9f7c737 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -842,7 +842,7 @@
};
macb0: ethernet@fffc4000 {
- compatible = "cdns,at32ap7000-macb", "cdns,macb";
+ compatible = "cdns,at91sam9260-macb", "cdns,macb";
reg = <0xfffc4000 0x100>;
interrupts = <21 IRQ_TYPE_LEVEL_HIGH 3>;
pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 1f67bb4..340179e 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -845,7 +845,7 @@
};
macb0: ethernet@fffbc000 {
- compatible = "cdns,at32ap7000-macb", "cdns,macb";
+ compatible = "cdns,at91sam9260-macb", "cdns,macb";
reg = <0xfffbc000 0x100>;
interrupts = <21 IRQ_TYPE_LEVEL_HIGH 3>;
pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index ee80aa9..586eab7 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -956,7 +956,7 @@
};
macb0: ethernet@fffbc000 {
- compatible = "cdns,at32ap7000-macb", "cdns,macb";
+ compatible = "cdns,at91sam9260-macb", "cdns,macb";
reg = <0xfffbc000 0x100>;
interrupts = <25 IRQ_TYPE_LEVEL_HIGH 3>;
pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/at91sam9x5_macb0.dtsi b/arch/arm/boot/dts/at91sam9x5_macb0.dtsi
index 57e89d1..73d7e30 100644
--- a/arch/arm/boot/dts/at91sam9x5_macb0.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5_macb0.dtsi
@@ -53,7 +53,7 @@
};
macb0: ethernet@f802c000 {
- compatible = "cdns,at32ap7000-macb", "cdns,macb";
+ compatible = "cdns,at91sam9260-macb", "cdns,macb";
reg = <0xf802c000 0x100>;
interrupts = <24 IRQ_TYPE_LEVEL_HIGH 3>;
pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/at91sam9x5_macb1.dtsi b/arch/arm/boot/dts/at91sam9x5_macb1.dtsi
index 663676c..d81980c 100644
--- a/arch/arm/boot/dts/at91sam9x5_macb1.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5_macb1.dtsi
@@ -41,7 +41,7 @@
};
macb1: ethernet@f8030000 {
- compatible = "cdns,at32ap7000-macb", "cdns,macb";
+ compatible = "cdns,at91sam9260-macb", "cdns,macb";
reg = <0xf8030000 0x100>;
interrupts = <27 IRQ_TYPE_LEVEL_HIGH 3>;
pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/sama5d3_emac.dtsi b/arch/arm/boot/dts/sama5d3_emac.dtsi
index fe2af92..b4544cf 100644
--- a/arch/arm/boot/dts/sama5d3_emac.dtsi
+++ b/arch/arm/boot/dts/sama5d3_emac.dtsi
@@ -41,7 +41,7 @@
};
macb1: ethernet@f802c000 {
- compatible = "cdns,at32ap7000-macb", "cdns,macb";
+ compatible = "cdns,at91sam9260-macb", "cdns,macb";
reg = <0xf802c000 0x100>;
interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>;
pinctrl-names = "default";
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/3] net: macb: remove #if defined(CONFIG_ARCH_AT91) sections
2015-03-06 10:23 [PATCH v2 0/3] net: macb: rework at91 specific handling Boris Brezillon
2015-03-06 10:24 ` [PATCH v2 1/3] net/macb: Update DT bindings documentation Boris Brezillon
2015-03-06 10:24 ` [PATCH v2 2/3] ARM: at91/dt: fix macb compatible strings Boris Brezillon
@ 2015-03-06 10:24 ` Boris Brezillon
2015-03-06 16:45 ` Nicolas Ferre
2015-03-06 16:44 ` [PATCH v2 0/3] net: macb: rework at91 specific handling Nicolas Ferre
3 siblings, 1 reply; 8+ messages in thread
From: Boris Brezillon @ 2015-03-06 10:24 UTC (permalink / raw)
To: David S. Miller, netdev
Cc: Nicolas Ferre, Jean-Christophe Plagniol-Villard,
Alexandre Belloni, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, devicetree, linux-kernel,
linux-arm-kernel, Boris Brezillon
With multi platform support those sections could lead to unexpected
behavior if both ARCH_AT91 and another ARM SoC using the MACB IP are
selected.
Add two new capabilities to encode the default MII mode and the presence
of a CLKEN bit in USRIO register.
Then define the appropriate config for IPs embedded in at91 SoCs.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/net/ethernet/cadence/macb.c | 32 +++++++++++++++++---------------
drivers/net/ethernet/cadence/macb.h | 2 ++
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index ad76b8e..86e915f 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -2113,6 +2113,10 @@ static const struct net_device_ops macb_netdev_ops = {
};
#if defined(CONFIG_OF)
+static struct macb_config at91sam9260_config = {
+ .caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII,
+};
+
static struct macb_config pc302gem_config = {
.caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE,
.dma_burst_length = 16,
@@ -2130,7 +2134,7 @@ static struct macb_config sama5d4_config = {
static const struct of_device_id macb_dt_ids[] = {
{ .compatible = "cdns,at32ap7000-macb" },
- { .compatible = "cdns,at91sam9260-macb" },
+ { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config },
{ .compatible = "cdns,macb" },
{ .compatible = "cdns,pc302-gem", .data = &pc302gem_config },
{ .compatible = "cdns,gem", .data = &pc302gem_config },
@@ -2388,21 +2392,19 @@ static int macb_probe(struct platform_device *pdev)
bp->phy_interface = err;
}
+ config = 0;
if (bp->phy_interface == PHY_INTERFACE_MODE_RGMII)
- macb_or_gem_writel(bp, USRIO, GEM_BIT(RGMII));
- else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII)
-#if defined(CONFIG_ARCH_AT91)
- macb_or_gem_writel(bp, USRIO, (MACB_BIT(RMII) |
- MACB_BIT(CLKEN)));
-#else
- macb_or_gem_writel(bp, USRIO, 0);
-#endif
- else
-#if defined(CONFIG_ARCH_AT91)
- macb_or_gem_writel(bp, USRIO, MACB_BIT(CLKEN));
-#else
- macb_or_gem_writel(bp, USRIO, MACB_BIT(MII));
-#endif
+ config = GEM_BIT(RGMII);
+ else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII &&
+ (bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII))
+ config = MACB_BIT(RMII);
+ else if (!(bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII))
+ config = MACB_BIT(MII);
+
+ if (bp->caps & MACB_CAPS_USRIO_HAS_CLKEN)
+ config |= MACB_BIT(CLKEN);
+
+ macb_or_gem_writel(bp, USRIO, config);
err = register_netdev(dev);
if (err) {
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index 31dc080..efe0247 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -389,6 +389,8 @@
/* Capability mask bits */
#define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x00000001
+#define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002
+#define MACB_CAPS_USRIO_DEFAULT_IS_MII 0x00000004
#define MACB_CAPS_FIFO_MODE 0x10000000
#define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000
#define MACB_CAPS_SG_DISABLED 0x40000000
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/3] net: macb: rework at91 specific handling
2015-03-06 10:23 [PATCH v2 0/3] net: macb: rework at91 specific handling Boris Brezillon
` (2 preceding siblings ...)
2015-03-06 10:24 ` [PATCH v2 3/3] net: macb: remove #if defined(CONFIG_ARCH_AT91) sections Boris Brezillon
@ 2015-03-06 16:44 ` Nicolas Ferre
3 siblings, 0 replies; 8+ messages in thread
From: Nicolas Ferre @ 2015-03-06 16:44 UTC (permalink / raw)
To: Boris Brezillon, David S. Miller, netdev
Cc: Jean-Christophe Plagniol-Villard, Alexandre Belloni, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
linux-kernel, linux-arm-kernel
Le 06/03/2015 11:23, Boris Brezillon a écrit :
> Hello,
>
> This removes the #if defined(ARCH_AT91) sections to prevent any problem
> when enabling ARM multi-platform support.
> The at91 specific logic is now activated when the "at91sam9260-macb"
> compatible string is found.
>
> Best Regards,
>
> Boris
I'm okay with the whole series:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>
> Changes since v1:
> - avoid changing existing behavior as Alexandre suggested
>
> Boris Brezillon (3):
> net/macb: Update DT bindings documentation
> ARM: at91/dt: fix macb compatible strings
> net: macb: remove #if defined(CONFIG_ARCH_AT91) sections
>
> Documentation/devicetree/bindings/net/macb.txt | 5 +++-
> arch/arm/boot/dts/at91sam9260.dtsi | 2 +-
> arch/arm/boot/dts/at91sam9263.dtsi | 2 +-
> arch/arm/boot/dts/at91sam9g45.dtsi | 2 +-
> arch/arm/boot/dts/at91sam9x5_macb0.dtsi | 2 +-
> arch/arm/boot/dts/at91sam9x5_macb1.dtsi | 2 +-
> arch/arm/boot/dts/sama5d3_emac.dtsi | 2 +-
> drivers/net/ethernet/cadence/macb.c | 32 ++++++++++++++------------
> drivers/net/ethernet/cadence/macb.h | 2 ++
> 9 files changed, 29 insertions(+), 22 deletions(-)
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] net/macb: Update DT bindings documentation
2015-03-06 10:24 ` [PATCH v2 1/3] net/macb: Update DT bindings documentation Boris Brezillon
@ 2015-03-06 16:45 ` Nicolas Ferre
0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Ferre @ 2015-03-06 16:45 UTC (permalink / raw)
To: Boris Brezillon, David S. Miller, netdev
Cc: Jean-Christophe Plagniol-Villard, Alexandre Belloni, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
linux-kernel, linux-arm-kernel
Le 06/03/2015 11:24, Boris Brezillon a écrit :
> Add missing "cdns,at91sam9260-macb", "atmel,sama5d3-gem" and
> "atmel,sama5d4-gem" compatible strings.
>
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Reviewed-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> Documentation/devicetree/bindings/net/macb.txt | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/net/macb.txt b/Documentation/devicetree/bindings/net/macb.txt
> index aaa6964..ba19d67 100644
> --- a/Documentation/devicetree/bindings/net/macb.txt
> +++ b/Documentation/devicetree/bindings/net/macb.txt
> @@ -2,10 +2,13 @@
>
> Required properties:
> - compatible: Should be "cdns,[<chip>-]{macb|gem}"
> - Use "cdns,at91sam9260-macb" Atmel at91sam9260 and at91sam9263 SoCs.
> + Use "cdns,at91sam9260-macb" for Atmel at91sam9 SoCs or the 10/100Mbit IP
> + available on sama5d3 SoCs.
> Use "cdns,at32ap7000-macb" for other 10/100 usage or use the generic form: "cdns,macb".
> Use "cdns,pc302-gem" for Picochip picoXcell pc302 and later devices based on
> the Cadence GEM, or the generic form: "cdns,gem".
> + Use "cdns,sama5d3-gem" for the Gigabit IP available on Atmel sama5d3 SoCs.
> + Use "cdns,sama5d4-gem" for the Gigabit IP available on Atmel sama5d4 SoCs.
> - reg: Address and length of the register set for the device
> - interrupts: Should contain macb interrupt
> - phy-mode: See ethernet.txt file in the same directory.
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/3] ARM: at91/dt: fix macb compatible strings
[not found] ` <1425637442-8724-3-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
@ 2015-03-06 16:45 ` Nicolas Ferre
0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Ferre @ 2015-03-06 16:45 UTC (permalink / raw)
To: Boris Brezillon, David S. Miller, netdev-u79uwXL29TY76Z2rM5mHXA
Cc: Jean-Christophe Plagniol-Villard, Alexandre Belloni, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Le 06/03/2015 11:24, Boris Brezillon a écrit :
> Some at91 SoCs embed a 10/100 Mbit Ethernet IP, that is based on the
> at91sam9260 SoC.
> Fix at91 DTs accordingly.
>
> Signed-off-by: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> Reviewed-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Acked-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> ---
> arch/arm/boot/dts/at91sam9260.dtsi | 2 +-
> arch/arm/boot/dts/at91sam9263.dtsi | 2 +-
> arch/arm/boot/dts/at91sam9g45.dtsi | 2 +-
> arch/arm/boot/dts/at91sam9x5_macb0.dtsi | 2 +-
> arch/arm/boot/dts/at91sam9x5_macb1.dtsi | 2 +-
> arch/arm/boot/dts/sama5d3_emac.dtsi | 2 +-
> 6 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
> index fff0ee6..9f7c737 100644
> --- a/arch/arm/boot/dts/at91sam9260.dtsi
> +++ b/arch/arm/boot/dts/at91sam9260.dtsi
> @@ -842,7 +842,7 @@
> };
>
> macb0: ethernet@fffc4000 {
> - compatible = "cdns,at32ap7000-macb", "cdns,macb";
> + compatible = "cdns,at91sam9260-macb", "cdns,macb";
> reg = <0xfffc4000 0x100>;
> interrupts = <21 IRQ_TYPE_LEVEL_HIGH 3>;
> pinctrl-names = "default";
> diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
> index 1f67bb4..340179e 100644
> --- a/arch/arm/boot/dts/at91sam9263.dtsi
> +++ b/arch/arm/boot/dts/at91sam9263.dtsi
> @@ -845,7 +845,7 @@
> };
>
> macb0: ethernet@fffbc000 {
> - compatible = "cdns,at32ap7000-macb", "cdns,macb";
> + compatible = "cdns,at91sam9260-macb", "cdns,macb";
> reg = <0xfffbc000 0x100>;
> interrupts = <21 IRQ_TYPE_LEVEL_HIGH 3>;
> pinctrl-names = "default";
> diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
> index ee80aa9..586eab7 100644
> --- a/arch/arm/boot/dts/at91sam9g45.dtsi
> +++ b/arch/arm/boot/dts/at91sam9g45.dtsi
> @@ -956,7 +956,7 @@
> };
>
> macb0: ethernet@fffbc000 {
> - compatible = "cdns,at32ap7000-macb", "cdns,macb";
> + compatible = "cdns,at91sam9260-macb", "cdns,macb";
> reg = <0xfffbc000 0x100>;
> interrupts = <25 IRQ_TYPE_LEVEL_HIGH 3>;
> pinctrl-names = "default";
> diff --git a/arch/arm/boot/dts/at91sam9x5_macb0.dtsi b/arch/arm/boot/dts/at91sam9x5_macb0.dtsi
> index 57e89d1..73d7e30 100644
> --- a/arch/arm/boot/dts/at91sam9x5_macb0.dtsi
> +++ b/arch/arm/boot/dts/at91sam9x5_macb0.dtsi
> @@ -53,7 +53,7 @@
> };
>
> macb0: ethernet@f802c000 {
> - compatible = "cdns,at32ap7000-macb", "cdns,macb";
> + compatible = "cdns,at91sam9260-macb", "cdns,macb";
> reg = <0xf802c000 0x100>;
> interrupts = <24 IRQ_TYPE_LEVEL_HIGH 3>;
> pinctrl-names = "default";
> diff --git a/arch/arm/boot/dts/at91sam9x5_macb1.dtsi b/arch/arm/boot/dts/at91sam9x5_macb1.dtsi
> index 663676c..d81980c 100644
> --- a/arch/arm/boot/dts/at91sam9x5_macb1.dtsi
> +++ b/arch/arm/boot/dts/at91sam9x5_macb1.dtsi
> @@ -41,7 +41,7 @@
> };
>
> macb1: ethernet@f8030000 {
> - compatible = "cdns,at32ap7000-macb", "cdns,macb";
> + compatible = "cdns,at91sam9260-macb", "cdns,macb";
> reg = <0xf8030000 0x100>;
> interrupts = <27 IRQ_TYPE_LEVEL_HIGH 3>;
> pinctrl-names = "default";
> diff --git a/arch/arm/boot/dts/sama5d3_emac.dtsi b/arch/arm/boot/dts/sama5d3_emac.dtsi
> index fe2af92..b4544cf 100644
> --- a/arch/arm/boot/dts/sama5d3_emac.dtsi
> +++ b/arch/arm/boot/dts/sama5d3_emac.dtsi
> @@ -41,7 +41,7 @@
> };
>
> macb1: ethernet@f802c000 {
> - compatible = "cdns,at32ap7000-macb", "cdns,macb";
> + compatible = "cdns,at91sam9260-macb", "cdns,macb";
> reg = <0xf802c000 0x100>;
> interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>;
> pinctrl-names = "default";
>
--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 3/3] net: macb: remove #if defined(CONFIG_ARCH_AT91) sections
2015-03-06 10:24 ` [PATCH v2 3/3] net: macb: remove #if defined(CONFIG_ARCH_AT91) sections Boris Brezillon
@ 2015-03-06 16:45 ` Nicolas Ferre
0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Ferre @ 2015-03-06 16:45 UTC (permalink / raw)
To: Boris Brezillon, David S. Miller, netdev
Cc: Jean-Christophe Plagniol-Villard, Alexandre Belloni, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
linux-kernel, linux-arm-kernel
Le 06/03/2015 11:24, Boris Brezillon a écrit :
> With multi platform support those sections could lead to unexpected
> behavior if both ARCH_AT91 and another ARM SoC using the MACB IP are
> selected.
> Add two new capabilities to encode the default MII mode and the presence
> of a CLKEN bit in USRIO register.
> Then define the appropriate config for IPs embedded in at91 SoCs.
>
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Reviewed-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> drivers/net/ethernet/cadence/macb.c | 32 +++++++++++++++++---------------
> drivers/net/ethernet/cadence/macb.h | 2 ++
> 2 files changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
> index ad76b8e..86e915f 100644
> --- a/drivers/net/ethernet/cadence/macb.c
> +++ b/drivers/net/ethernet/cadence/macb.c
> @@ -2113,6 +2113,10 @@ static const struct net_device_ops macb_netdev_ops = {
> };
>
> #if defined(CONFIG_OF)
> +static struct macb_config at91sam9260_config = {
> + .caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII,
> +};
> +
> static struct macb_config pc302gem_config = {
> .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE,
> .dma_burst_length = 16,
> @@ -2130,7 +2134,7 @@ static struct macb_config sama5d4_config = {
>
> static const struct of_device_id macb_dt_ids[] = {
> { .compatible = "cdns,at32ap7000-macb" },
> - { .compatible = "cdns,at91sam9260-macb" },
> + { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config },
> { .compatible = "cdns,macb" },
> { .compatible = "cdns,pc302-gem", .data = &pc302gem_config },
> { .compatible = "cdns,gem", .data = &pc302gem_config },
> @@ -2388,21 +2392,19 @@ static int macb_probe(struct platform_device *pdev)
> bp->phy_interface = err;
> }
>
> + config = 0;
> if (bp->phy_interface == PHY_INTERFACE_MODE_RGMII)
> - macb_or_gem_writel(bp, USRIO, GEM_BIT(RGMII));
> - else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII)
> -#if defined(CONFIG_ARCH_AT91)
> - macb_or_gem_writel(bp, USRIO, (MACB_BIT(RMII) |
> - MACB_BIT(CLKEN)));
> -#else
> - macb_or_gem_writel(bp, USRIO, 0);
> -#endif
> - else
> -#if defined(CONFIG_ARCH_AT91)
> - macb_or_gem_writel(bp, USRIO, MACB_BIT(CLKEN));
> -#else
> - macb_or_gem_writel(bp, USRIO, MACB_BIT(MII));
> -#endif
> + config = GEM_BIT(RGMII);
> + else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII &&
> + (bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII))
> + config = MACB_BIT(RMII);
> + else if (!(bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII))
> + config = MACB_BIT(MII);
> +
> + if (bp->caps & MACB_CAPS_USRIO_HAS_CLKEN)
> + config |= MACB_BIT(CLKEN);
> +
> + macb_or_gem_writel(bp, USRIO, config);
>
> err = register_netdev(dev);
> if (err) {
> diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
> index 31dc080..efe0247 100644
> --- a/drivers/net/ethernet/cadence/macb.h
> +++ b/drivers/net/ethernet/cadence/macb.h
> @@ -389,6 +389,8 @@
>
> /* Capability mask bits */
> #define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x00000001
> +#define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002
> +#define MACB_CAPS_USRIO_DEFAULT_IS_MII 0x00000004
> #define MACB_CAPS_FIFO_MODE 0x10000000
> #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000
> #define MACB_CAPS_SG_DISABLED 0x40000000
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-03-06 16:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-06 10:23 [PATCH v2 0/3] net: macb: rework at91 specific handling Boris Brezillon
2015-03-06 10:24 ` [PATCH v2 1/3] net/macb: Update DT bindings documentation Boris Brezillon
2015-03-06 16:45 ` Nicolas Ferre
2015-03-06 10:24 ` [PATCH v2 2/3] ARM: at91/dt: fix macb compatible strings Boris Brezillon
[not found] ` <1425637442-8724-3-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-03-06 16:45 ` Nicolas Ferre
2015-03-06 10:24 ` [PATCH v2 3/3] net: macb: remove #if defined(CONFIG_ARCH_AT91) sections Boris Brezillon
2015-03-06 16:45 ` Nicolas Ferre
2015-03-06 16:44 ` [PATCH v2 0/3] net: macb: rework at91 specific handling Nicolas Ferre
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).