Commit 24759daa authored by David S. Miller's avatar David S. Miller

Merge branch 'macb-usrio-cap'

Neil Armstrong says:

====================
Add new capability and macb DT variant

The first patch introduces a new capability bit to disable usage of the
USRIO register on platform not implementing it thus avoiding some external
imprecise aborts on ARM based platforms.
The two last patchs adds a new macb variant compatible name using the
capability, the NP4 SoC uses this particular hardware configuration.

v1: http://lkml.kernel.org/r/1449485914-12883-1-git-send-email-narmstrong@baylibre.com
v2: http://lkml.kernel.org/r/1449582726-6148-1-git-send-email-narmstrong@baylibre.com
v3: http://lkml.kernel.org/r/1451898103-21868-1-git-send-email-narmstrong@baylibre.com
v4: http://lkml.kernel.org/r/1451900573-22657-1-git-send-email-narmstrong@baylibre.com
v5: switch SoC name to non-generic NP4 name
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 12358177 c505a382
...@@ -4,6 +4,7 @@ Required properties: ...@@ -4,6 +4,7 @@ Required properties:
- compatible: Should be "cdns,[<chip>-]{macb|gem}" - compatible: Should be "cdns,[<chip>-]{macb|gem}"
Use "cdns,at91sam9260-macb" for Atmel at91sam9 SoCs or the 10/100Mbit IP Use "cdns,at91sam9260-macb" for Atmel at91sam9 SoCs or the 10/100Mbit IP
available on sama5d3 SoCs. available on sama5d3 SoCs.
Use "cdns,np4-macb" for NP4 SoC devices.
Use "cdns,at32ap7000-macb" for other 10/100 usage or use the generic form: "cdns,macb". 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 Use "cdns,pc302-gem" for Picochip picoXcell pc302 and later devices based on
the Cadence GEM, or the generic form: "cdns,gem". the Cadence GEM, or the generic form: "cdns,gem".
......
...@@ -2113,6 +2113,7 @@ static void macb_get_regs(struct net_device *dev, struct ethtool_regs *regs, ...@@ -2113,6 +2113,7 @@ static void macb_get_regs(struct net_device *dev, struct ethtool_regs *regs,
regs_buff[10] = macb_tx_dma(&bp->queues[0], tail); regs_buff[10] = macb_tx_dma(&bp->queues[0], tail);
regs_buff[11] = macb_tx_dma(&bp->queues[0], head); regs_buff[11] = macb_tx_dma(&bp->queues[0], head);
if (!(bp->caps & MACB_CAPS_USRIO_DISABLED))
regs_buff[12] = macb_or_gem_readl(bp, USRIO); regs_buff[12] = macb_or_gem_readl(bp, USRIO);
if (macb_is_gem(bp)) { if (macb_is_gem(bp)) {
regs_buff[13] = gem_readl(bp, DMACFG); regs_buff[13] = gem_readl(bp, DMACFG);
...@@ -2392,6 +2393,7 @@ static int macb_init(struct platform_device *pdev) ...@@ -2392,6 +2393,7 @@ static int macb_init(struct platform_device *pdev)
dev->hw_features &= ~NETIF_F_SG; dev->hw_features &= ~NETIF_F_SG;
dev->features = dev->hw_features; dev->features = dev->hw_features;
if (!(bp->caps & MACB_CAPS_USRIO_DISABLED)) {
val = 0; val = 0;
if (bp->phy_interface == PHY_INTERFACE_MODE_RGMII) if (bp->phy_interface == PHY_INTERFACE_MODE_RGMII)
val = GEM_BIT(RGMII); val = GEM_BIT(RGMII);
...@@ -2405,6 +2407,7 @@ static int macb_init(struct platform_device *pdev) ...@@ -2405,6 +2407,7 @@ static int macb_init(struct platform_device *pdev)
val |= MACB_BIT(CLKEN); val |= MACB_BIT(CLKEN);
macb_or_gem_writel(bp, USRIO, val); macb_or_gem_writel(bp, USRIO, val);
}
/* Set MII management clock divider */ /* Set MII management clock divider */
val = macb_mdc_clk_div(bp); val = macb_mdc_clk_div(bp);
...@@ -2767,6 +2770,11 @@ static const struct macb_config emac_config = { ...@@ -2767,6 +2770,11 @@ static const struct macb_config emac_config = {
.init = at91ether_init, .init = at91ether_init,
}; };
static const struct macb_config np4_config = {
.caps = MACB_CAPS_USRIO_DISABLED,
.clk_init = macb_clk_init,
.init = macb_init,
};
static const struct macb_config zynqmp_config = { static const struct macb_config zynqmp_config = {
.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO, .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO,
...@@ -2787,6 +2795,7 @@ static const struct of_device_id macb_dt_ids[] = { ...@@ -2787,6 +2795,7 @@ static const struct of_device_id macb_dt_ids[] = {
{ .compatible = "cdns,at32ap7000-macb" }, { .compatible = "cdns,at32ap7000-macb" },
{ .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config }, { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config },
{ .compatible = "cdns,macb" }, { .compatible = "cdns,macb" },
{ .compatible = "cdns,np4-macb", .data = &np4_config },
{ .compatible = "cdns,pc302-gem", .data = &pc302gem_config }, { .compatible = "cdns,pc302-gem", .data = &pc302gem_config },
{ .compatible = "cdns,gem", .data = &pc302gem_config }, { .compatible = "cdns,gem", .data = &pc302gem_config },
{ .compatible = "atmel,sama5d2-gem", .data = &sama5d2_config }, { .compatible = "atmel,sama5d2-gem", .data = &sama5d2_config },
......
...@@ -400,6 +400,7 @@ ...@@ -400,6 +400,7 @@
#define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002 #define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002
#define MACB_CAPS_USRIO_DEFAULT_IS_MII 0x00000004 #define MACB_CAPS_USRIO_DEFAULT_IS_MII 0x00000004
#define MACB_CAPS_NO_GIGABIT_HALF 0x00000008 #define MACB_CAPS_NO_GIGABIT_HALF 0x00000008
#define MACB_CAPS_USRIO_DISABLED 0x00000010
#define MACB_CAPS_FIFO_MODE 0x10000000 #define MACB_CAPS_FIFO_MODE 0x10000000
#define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000
#define MACB_CAPS_SG_DISABLED 0x40000000 #define MACB_CAPS_SG_DISABLED 0x40000000
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment