Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1515008 > unrolled thread
| Started by | Jon Mason <jon.mason@broadcom.com> |
|---|---|
| First post | 2016-11-04 06:20 +0100 |
| Last post | 2016-11-07 19:20 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v6 0/7] add NS2 support to bgmac Jon Mason <jon.mason@broadcom.com> - 2016-11-04 06:20 +0100
[PATCH v6 4/7] Documentation: devicetree: net: add NS2 bindings to amac Jon Mason <jon.mason@broadcom.com> - 2016-11-04 06:20 +0100
[PATCH v6 6/7] net: ethernet: bgmac: add NS2 support Jon Mason <jon.mason@broadcom.com> - 2016-11-04 06:20 +0100
Re: [PATCH v6 6/7] net: ethernet: bgmac: add NS2 support Rafał Miłecki <rafal@milecki.pl> - 2016-11-04 08:20 +0100
Re: [PATCH v6 0/7] add NS2 support to bgmac David Miller <davem@davemloft.net> - 2016-11-07 19:20 +0100
| From | Jon Mason <jon.mason@broadcom.com> |
|---|---|
| Date | 2016-11-04 06:20 +0100 |
| Subject | [PATCH v6 0/7] add NS2 support to bgmac |
| Message-ID | <szF50-5Ex-3@gated-at.bofh.it> |
Changes in v6: * Use a common bgmac_phy_connect_direct (per Rafal Milecki) * Rebased on latest net-next * Added Reviewed-by to the relevant patches Changes in v5: * Change a pr_err to netdev_err (per Scott Branden) * Reword the lane swap binding documentation (per Andrew Lunn) Changes in v4: * Actually send out the lane swap binding doc patch (Per Scott Branden) * Remove unused #define (Per Andrew Lunn) Changes in v3: * Clean-up the bgmac DT binding doc (per Rob Herring) * Document the lane swap binding and make it generic (Per Andrew Lunn) Changes in v2: * Remove the PHY power-on (per Andrew Lunn) * Misc PHY clean-ups regarding comments and #defines (per Andrew Lunn) This results on none of the original PHY code from Vikas being present. So, I'm removing him as an author and giving him "Inspired-by" credit. * Move PHY lane swapping to PHY driver (per Andrew Lunn and Florian Fainelli) * Remove bgmac sleep (per Florian Fainelli) * Re-add bgmac chip reset (per Florian Fainelli and Ray Jui) * Rebased on latest net-next * Added patch for bcm54xx_auxctl_read, which is used in the BCM54810 Jon Mason (7): net: phy: broadcom: add bcm54xx_auxctl_read Documentation: devicetree: add PHY lane swap binding net: phy: broadcom: Add BCM54810 PHY entry Documentation: devicetree: net: add NS2 bindings to amac net: ethernet: bgmac: device tree phy enablement net: ethernet: bgmac: add NS2 support arm64: dts: NS2: add AMAC ethernet support .../devicetree/bindings/net/brcm,amac.txt | 16 +++-- Documentation/devicetree/bindings/net/phy.txt | 4 ++ arch/arm64/boot/dts/broadcom/ns2-svk.dts | 5 ++ arch/arm64/boot/dts/broadcom/ns2.dtsi | 12 ++++ drivers/net/ethernet/broadcom/bgmac-bcma.c | 22 +++++++ drivers/net/ethernet/broadcom/bgmac-platform.c | 74 +++++++++++++++++++++- drivers/net/ethernet/broadcom/bgmac.c | 32 +++------- drivers/net/ethernet/broadcom/bgmac.h | 9 +++ drivers/net/phy/Kconfig | 2 +- drivers/net/phy/broadcom.c | 68 +++++++++++++++++++- include/linux/brcmphy.h | 10 +++ 11 files changed, 222 insertions(+), 32 deletions(-) -- 2.7.4
[toc] | [next] | [standalone]
| From | Jon Mason <jon.mason@broadcom.com> |
|---|---|
| Date | 2016-11-04 06:20 +0100 |
| Subject | [PATCH v6 4/7] Documentation: devicetree: net: add NS2 bindings to amac |
| Message-ID | <szF50-5Ex-17@gated-at.bofh.it> |
| In reply to | #1515008 |
Clean-up the documentation to the bgmac-amac driver, per suggestion by Rob Herring, and add details for NS2 support. Signed-off-by: Jon Mason <jon.mason@broadcom.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> --- Documentation/devicetree/bindings/net/brcm,amac.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/net/brcm,amac.txt b/Documentation/devicetree/bindings/net/brcm,amac.txt index ba5ecc1..2fefa1a 100644 --- a/Documentation/devicetree/bindings/net/brcm,amac.txt +++ b/Documentation/devicetree/bindings/net/brcm,amac.txt @@ -2,11 +2,17 @@ Broadcom AMAC Ethernet Controller Device Tree Bindings ------------------------------------------------------------- Required properties: - - compatible: "brcm,amac" or "brcm,nsp-amac" - - reg: Address and length of the GMAC registers, - Address and length of the GMAC IDM registers - - reg-names: Names of the registers. Must have both "amac_base" and - "idm_base" + - compatible: "brcm,amac" + "brcm,nsp-amac" + "brcm,ns2-amac" + - reg: Address and length of the register set for the device. It + contains the information of registers in the same order as + described by reg-names + - reg-names: Names of the registers. + "amac_base": Address and length of the GMAC registers + "idm_base": Address and length of the GMAC IDM registers + "nicpm_base": Address and length of the NIC Port Manager + registers (required for Northstar2) - interrupts: Interrupt number Optional properties: -- 2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Jon Mason <jon.mason@broadcom.com> |
|---|---|
| Date | 2016-11-04 06:20 +0100 |
| Subject | [PATCH v6 6/7] net: ethernet: bgmac: add NS2 support |
| Message-ID | <szF50-5Ex-19@gated-at.bofh.it> |
| In reply to | #1515008 |
Add support for the variant of amac hardware present in the Broadcom
Northstar2 based SoCs. Northstar2 requires an additional register to be
configured with the port speed/duplexity (NICPM). This can be added to
the link callback to hide it from the instances that do not use this.
Also, clearing of the pending interrupts on init is required due to
observed issues on some platforms.
Signed-off-by: Jon Mason <jon.mason@broadcom.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bgmac-platform.c | 56 +++++++++++++++++++++++++-
drivers/net/ethernet/broadcom/bgmac.c | 3 ++
drivers/net/ethernet/broadcom/bgmac.h | 1 +
3 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bgmac-platform.c b/drivers/net/ethernet/broadcom/bgmac-platform.c
index 4642940..6f736c1 100644
--- a/drivers/net/ethernet/broadcom/bgmac-platform.c
+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
@@ -14,12 +14,21 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/bcma/bcma.h>
+#include <linux/brcmphy.h>
#include <linux/etherdevice.h>
#include <linux/of_address.h>
#include <linux/of_mdio.h>
#include <linux/of_net.h>
#include "bgmac.h"
+#define NICPM_IOMUX_CTRL 0x00000008
+
+#define NICPM_IOMUX_CTRL_INIT_VAL 0x3196e000
+#define NICPM_IOMUX_CTRL_SPD_SHIFT 10
+#define NICPM_IOMUX_CTRL_SPD_10M 0
+#define NICPM_IOMUX_CTRL_SPD_100M 1
+#define NICPM_IOMUX_CTRL_SPD_1000M 2
+
static u32 platform_bgmac_read(struct bgmac *bgmac, u16 offset)
{
return readl(bgmac->plat.base + offset);
@@ -87,12 +96,46 @@ static void platform_bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset,
WARN_ON(1);
}
+static void bgmac_nicpm_speed_set(struct net_device *net_dev)
+{
+ struct bgmac *bgmac = netdev_priv(net_dev);
+ u32 val;
+
+ if (!bgmac->plat.nicpm_base)
+ return;
+
+ val = NICPM_IOMUX_CTRL_INIT_VAL;
+ switch (bgmac->net_dev->phydev->speed) {
+ default:
+ netdev_err(net_dev, "Unsupported speed. Defaulting to 1000Mb\n");
+ case SPEED_1000:
+ val |= NICPM_IOMUX_CTRL_SPD_1000M << NICPM_IOMUX_CTRL_SPD_SHIFT;
+ break;
+ case SPEED_100:
+ val |= NICPM_IOMUX_CTRL_SPD_100M << NICPM_IOMUX_CTRL_SPD_SHIFT;
+ break;
+ case SPEED_10:
+ val |= NICPM_IOMUX_CTRL_SPD_10M << NICPM_IOMUX_CTRL_SPD_SHIFT;
+ break;
+ }
+
+ writel(val, bgmac->plat.nicpm_base + NICPM_IOMUX_CTRL);
+
+ bgmac_adjust_link(bgmac->net_dev);
+}
+
static int platform_phy_connect(struct bgmac *bgmac)
{
struct phy_device *phy_dev;
- phy_dev = of_phy_get_and_connect(bgmac->net_dev, bgmac->dev->of_node,
- bgmac_adjust_link);
+ if (bgmac->plat.nicpm_base)
+ phy_dev = of_phy_get_and_connect(bgmac->net_dev,
+ bgmac->dev->of_node,
+ bgmac_nicpm_speed_set);
+ else
+ phy_dev = of_phy_get_and_connect(bgmac->net_dev,
+ bgmac->dev->of_node,
+ bgmac_adjust_link);
if (!phy_dev) {
dev_err(bgmac->dev, "PHY connection failed\n");
return -ENODEV;
@@ -156,6 +199,14 @@ static int bgmac_probe(struct platform_device *pdev)
if (IS_ERR(bgmac->plat.idm_base))
return PTR_ERR(bgmac->plat.idm_base);
+ regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base");
+ if (regs) {
+ bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev,
+ regs);
+ if (IS_ERR(bgmac->plat.nicpm_base))
+ return PTR_ERR(bgmac->plat.nicpm_base);
+ }
+
bgmac->read = platform_bgmac_read;
bgmac->write = platform_bgmac_write;
bgmac->idm_read = platform_bgmac_idm_read;
@@ -187,6 +238,7 @@ static int bgmac_remove(struct platform_device *pdev)
static const struct of_device_id bgmac_of_enet_match[] = {
{.compatible = "brcm,amac",},
{.compatible = "brcm,nsp-amac",},
+ {.compatible = "brcm,ns2-amac",},
{},
};
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 7f66ea7..a29787f 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -1082,6 +1082,9 @@ static void bgmac_enable(struct bgmac *bgmac)
/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipinit */
static void bgmac_chip_init(struct bgmac *bgmac)
{
+ /* Clear any erroneously pending interrupts */
+ bgmac_write(bgmac, BGMAC_INT_STATUS, ~0);
+
/* 1 interrupt per received frame */
bgmac_write(bgmac, BGMAC_INT_RECV_LAZY, 1 << BGMAC_IRL_FC_SHIFT);
diff --git a/drivers/net/ethernet/broadcom/bgmac.h b/drivers/net/ethernet/broadcom/bgmac.h
index bfd9f40..71f493f 100644
--- a/drivers/net/ethernet/broadcom/bgmac.h
+++ b/drivers/net/ethernet/broadcom/bgmac.h
@@ -463,6 +463,7 @@ struct bgmac {
struct {
void *base;
void *idm_base;
+ void *nicpm_base;
} plat;
struct {
struct bcma_device *core;
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Rafał Miłecki <rafal@milecki.pl> |
|---|---|
| Date | 2016-11-04 08:20 +0100 |
| Subject | Re: [PATCH v6 6/7] net: ethernet: bgmac: add NS2 support |
| Message-ID | <szGX7-6ZA-1@gated-at.bofh.it> |
| In reply to | #1515010 |
On 2016-11-04 06:11, Jon Mason wrote: > Add support for the variant of amac hardware present in the Broadcom > Northstar2 based SoCs. Northstar2 requires an additional register to > be > configured with the port speed/duplexity (NICPM). This can be added to > the link callback to hide it from the instances that do not use this. > Also, clearing of the pending interrupts on init is required due to > observed issues on some platforms. > > Signed-off-by: Jon Mason <jon.mason@broadcom.com> > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> [Resending from Roundcube due to "Wrong MIME labeling on 8-bit character texts." vger.kernel.org reject when using Thunderbird] Checked for possible regressions on Northstar, looks OK. Acked-by: Rafał Miłecki <rafal@milecki.pl>
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-11-07 19:20 +0100 |
| Message-ID | <sAWGu-6RG-7@gated-at.bofh.it> |
| In reply to | #1515008 |
From: Jon Mason <jon.mason@broadcom.com> Date: Fri, 4 Nov 2016 01:10:55 -0400 > Changes in v6: > * Use a common bgmac_phy_connect_direct (per Rafal Milecki) > * Rebased on latest net-next > * Added Reviewed-by to the relevant patches > > > Changes in v5: > * Change a pr_err to netdev_err (per Scott Branden) > * Reword the lane swap binding documentation (per Andrew Lunn) > > > Changes in v4: > * Actually send out the lane swap binding doc patch (Per Scott Branden) > * Remove unused #define (Per Andrew Lunn) > > > Changes in v3: > * Clean-up the bgmac DT binding doc (per Rob Herring) > * Document the lane swap binding and make it generic (Per Andrew Lunn) > > > Changes in v2: > * Remove the PHY power-on (per Andrew Lunn) > * Misc PHY clean-ups regarding comments and #defines (per Andrew Lunn) > This results on none of the original PHY code from Vikas being > present. So, I'm removing him as an author and giving him > "Inspired-by" credit. > * Move PHY lane swapping to PHY driver (per Andrew Lunn and Florian > Fainelli) > * Remove bgmac sleep (per Florian Fainelli) > * Re-add bgmac chip reset (per Florian Fainelli and Ray Jui) > * Rebased on latest net-next > * Added patch for bcm54xx_auxctl_read, which is used in the BCM54810 Series applied, thanks.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web