diff options
author | Nicolas Ferre <nicolas.ferre@atmel.com> | 2015-03-31 09:02:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-31 16:51:17 -0400 |
commit | f6970505defd0e7bb5dea9606939bb3b32e51768 (patch) | |
tree | e3cfd9edc534195580d989baaff2b744053712fa /drivers/net/ethernet/cadence | |
parent | da120112493460332b5b430070ca0ea205c37632 (diff) |
net/macb: fix capabilities configuration
Capabilities configuration by macb_configure_caps() was moved far too late by
421d9df0628b (net/macb: merge at91_ether driver into macb driver) which would
lead to badly configured hardware.
So, move this function to early probe and modify its prototype to re-gain its
original behavior.
DT data retrieval is also moved to simplify the probe code flow.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cadence')
-rw-r--r-- | drivers/net/ethernet/cadence/macb.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 68d59b3900b1..680e1eebb7ea 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -2132,10 +2132,13 @@ static const struct net_device_ops macb_netdev_ops = { | |||
2132 | * Configure peripheral capacities according to device tree | 2132 | * Configure peripheral capacities according to device tree |
2133 | * and integration options used | 2133 | * and integration options used |
2134 | */ | 2134 | */ |
2135 | static void macb_configure_caps(struct macb *bp) | 2135 | static void macb_configure_caps(struct macb *bp, const struct macb_config *dt_conf) |
2136 | { | 2136 | { |
2137 | u32 dcfg; | 2137 | u32 dcfg; |
2138 | 2138 | ||
2139 | if (dt_conf) | ||
2140 | bp->caps = dt_conf->caps; | ||
2141 | |||
2139 | if (MACB_BFEXT(IDNUM, macb_readl(bp, MID)) == 0x2) | 2142 | if (MACB_BFEXT(IDNUM, macb_readl(bp, MID)) == 0x2) |
2140 | bp->caps |= MACB_CAPS_MACB_IS_GEM; | 2143 | bp->caps |= MACB_CAPS_MACB_IS_GEM; |
2141 | 2144 | ||
@@ -2313,9 +2316,6 @@ static int macb_init(struct platform_device *pdev) | |||
2313 | 2316 | ||
2314 | macb_or_gem_writel(bp, USRIO, val); | 2317 | macb_or_gem_writel(bp, USRIO, val); |
2315 | 2318 | ||
2316 | /* setup capacities */ | ||
2317 | macb_configure_caps(bp); | ||
2318 | |||
2319 | /* Set MII management clock divider */ | 2319 | /* Set MII management clock divider */ |
2320 | val = macb_mdc_clk_div(bp); | 2320 | val = macb_mdc_clk_div(bp); |
2321 | val |= macb_dbw(bp); | 2321 | val |= macb_dbw(bp); |
@@ -2720,6 +2720,20 @@ static int macb_probe(struct platform_device *pdev) | |||
2720 | bp->queue_mask = queue_mask; | 2720 | bp->queue_mask = queue_mask; |
2721 | spin_lock_init(&bp->lock); | 2721 | spin_lock_init(&bp->lock); |
2722 | 2722 | ||
2723 | if (np) { | ||
2724 | const struct of_device_id *match; | ||
2725 | |||
2726 | match = of_match_node(macb_dt_ids, np); | ||
2727 | if (match && match->data) { | ||
2728 | macb_config = match->data; | ||
2729 | bp->dma_burst_length = macb_config->dma_burst_length; | ||
2730 | init = macb_config->init; | ||
2731 | } | ||
2732 | } | ||
2733 | |||
2734 | /* setup capacities */ | ||
2735 | macb_configure_caps(bp, macb_config); | ||
2736 | |||
2723 | platform_set_drvdata(pdev, dev); | 2737 | platform_set_drvdata(pdev, dev); |
2724 | 2738 | ||
2725 | dev->irq = platform_get_irq(pdev, 0); | 2739 | dev->irq = platform_get_irq(pdev, 0); |
@@ -2743,20 +2757,6 @@ static int macb_probe(struct platform_device *pdev) | |||
2743 | bp->phy_interface = err; | 2757 | bp->phy_interface = err; |
2744 | } | 2758 | } |
2745 | 2759 | ||
2746 | if (np) { | ||
2747 | const struct of_device_id *match; | ||
2748 | |||
2749 | match = of_match_node(macb_dt_ids, np); | ||
2750 | if (match) | ||
2751 | macb_config = match->data; | ||
2752 | } | ||
2753 | |||
2754 | if (macb_config) { | ||
2755 | bp->caps = macb_config->caps; | ||
2756 | bp->dma_burst_length = macb_config->dma_burst_length; | ||
2757 | init = macb_config->init; | ||
2758 | } | ||
2759 | |||
2760 | /* IP specific init */ | 2760 | /* IP specific init */ |
2761 | err = init(pdev); | 2761 | err = init(pdev); |
2762 | if (err) | 2762 | if (err) |