aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-03-31 16:51:18 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-31 16:51:18 -0400
commitec9a82fbb10951b1841d8bbbe599f91e8ab2f67f (patch)
treea06086daa74ba9a7288c925390f04058faf28095
parent34d21e3f399729ca7c89636207fe41c481d99352 (diff)
parentfa6935981af81706f363df4b6f1285a20dc7ae17 (diff)
Merge branch 'macb-next'
Nicolas Ferre says: ==================== net/macb: fixes after big driver update The recent modifications to the macb driver lead to issues with the probe function code flow. Here are some attempt to fix them. This time, some more issues are fixed related to the clock as reported by Boris Brezillon. The series is written on top of net-next. Changes in v2: - address Cyrille comment about exit condition of queue configuration loop - add fixes for probe sequence related to clocks - add ethtool register dump - fix peripheral version test ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/cadence/macb.c207
-rw-r--r--drivers/net/ethernet/cadence/macb.h10
2 files changed, 130 insertions, 87 deletions
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index a0a04b3638e6..448a32309dd0 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -2037,8 +2037,8 @@ static void macb_get_regs(struct net_device *dev, struct ethtool_regs *regs,
2037 regs_buff[10] = macb_tx_dma(&bp->queues[0], tail); 2037 regs_buff[10] = macb_tx_dma(&bp->queues[0], tail);
2038 regs_buff[11] = macb_tx_dma(&bp->queues[0], head); 2038 regs_buff[11] = macb_tx_dma(&bp->queues[0], head);
2039 2039
2040 regs_buff[12] = macb_or_gem_readl(bp, USRIO);
2040 if (macb_is_gem(bp)) { 2041 if (macb_is_gem(bp)) {
2041 regs_buff[12] = gem_readl(bp, USRIO);
2042 regs_buff[13] = gem_readl(bp, DMACFG); 2042 regs_buff[13] = gem_readl(bp, DMACFG);
2043 } 2043 }
2044} 2044}
@@ -2129,17 +2129,19 @@ static const struct net_device_ops macb_netdev_ops = {
2129}; 2129};
2130 2130
2131/* 2131/*
2132 * Configure peripheral capacities according to device tree 2132 * Configure peripheral capabilities according to device tree
2133 * and integration options used 2133 * and integration options used
2134 */ 2134 */
2135static void macb_configure_caps(struct macb *bp) 2135static 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 (MACB_BFEXT(IDNUM, macb_readl(bp, MID)) == 0x2) 2139 if (dt_conf)
2140 bp->caps = dt_conf->caps;
2141
2142 if (macb_is_gem_hw(bp->regs)) {
2140 bp->caps |= MACB_CAPS_MACB_IS_GEM; 2143 bp->caps |= MACB_CAPS_MACB_IS_GEM;
2141 2144
2142 if (macb_is_gem(bp)) {
2143 dcfg = gem_readl(bp, DCFG1); 2145 dcfg = gem_readl(bp, DCFG1);
2144 if (GEM_BFEXT(IRQCOR, dcfg) == 0) 2146 if (GEM_BFEXT(IRQCOR, dcfg) == 0)
2145 bp->caps |= MACB_CAPS_ISR_CLEAR_ON_WRITE; 2147 bp->caps |= MACB_CAPS_ISR_CLEAR_ON_WRITE;
@@ -2156,15 +2158,17 @@ static void macb_probe_queues(void __iomem *mem,
2156 unsigned int *num_queues) 2158 unsigned int *num_queues)
2157{ 2159{
2158 unsigned int hw_q; 2160 unsigned int hw_q;
2159 u32 mid;
2160 2161
2161 *queue_mask = 0x1; 2162 *queue_mask = 0x1;
2162 *num_queues = 1; 2163 *num_queues = 1;
2163 2164
2164 /* is it macb or gem ? */ 2165 /* is it macb or gem ?
2165 mid = readl_relaxed(mem + MACB_MID); 2166 *
2166 2167 * We need to read directly from the hardware here because
2167 if (MACB_BFEXT(IDNUM, mid) < 0x2) 2168 * we are early in the probe process and don't have the
2169 * MACB_CAPS_MACB_IS_GEM flag positioned
2170 */
2171 if (!macb_is_gem_hw(mem))
2168 return; 2172 return;
2169 2173
2170 /* bit 0 is never set but queue 0 always exists */ 2174 /* bit 0 is never set but queue 0 always exists */
@@ -2177,59 +2181,73 @@ static void macb_probe_queues(void __iomem *mem,
2177 (*num_queues)++; 2181 (*num_queues)++;
2178} 2182}
2179 2183
2180static int macb_init(struct platform_device *pdev) 2184static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
2185 struct clk **hclk, struct clk **tx_clk)
2181{ 2186{
2182 struct net_device *dev = platform_get_drvdata(pdev);
2183 unsigned int hw_q, queue_mask, q, num_queues;
2184 struct macb *bp = netdev_priv(dev);
2185 struct macb_queue *queue;
2186 int err; 2187 int err;
2187 u32 val;
2188 2188
2189 bp->pclk = devm_clk_get(&pdev->dev, "pclk"); 2189 *pclk = devm_clk_get(&pdev->dev, "pclk");
2190 if (IS_ERR(bp->pclk)) { 2190 if (IS_ERR(*pclk)) {
2191 err = PTR_ERR(bp->pclk); 2191 err = PTR_ERR(*pclk);
2192 dev_err(&pdev->dev, "failed to get macb_clk (%u)\n", err); 2192 dev_err(&pdev->dev, "failed to get macb_clk (%u)\n", err);
2193 return err; 2193 return err;
2194 } 2194 }
2195 2195
2196 bp->hclk = devm_clk_get(&pdev->dev, "hclk"); 2196 *hclk = devm_clk_get(&pdev->dev, "hclk");
2197 if (IS_ERR(bp->hclk)) { 2197 if (IS_ERR(*hclk)) {
2198 err = PTR_ERR(bp->hclk); 2198 err = PTR_ERR(*hclk);
2199 dev_err(&pdev->dev, "failed to get hclk (%u)\n", err); 2199 dev_err(&pdev->dev, "failed to get hclk (%u)\n", err);
2200 return err; 2200 return err;
2201 } 2201 }
2202 2202
2203 bp->tx_clk = devm_clk_get(&pdev->dev, "tx_clk"); 2203 *tx_clk = devm_clk_get(&pdev->dev, "tx_clk");
2204 if (IS_ERR(bp->tx_clk)) 2204 if (IS_ERR(*tx_clk))
2205 bp->tx_clk = NULL; 2205 *tx_clk = NULL;
2206 2206
2207 err = clk_prepare_enable(bp->pclk); 2207 err = clk_prepare_enable(*pclk);
2208 if (err) { 2208 if (err) {
2209 dev_err(&pdev->dev, "failed to enable pclk (%u)\n", err); 2209 dev_err(&pdev->dev, "failed to enable pclk (%u)\n", err);
2210 return err; 2210 return err;
2211 } 2211 }
2212 2212
2213 err = clk_prepare_enable(bp->hclk); 2213 err = clk_prepare_enable(*hclk);
2214 if (err) { 2214 if (err) {
2215 dev_err(&pdev->dev, "failed to enable hclk (%u)\n", err); 2215 dev_err(&pdev->dev, "failed to enable hclk (%u)\n", err);
2216 goto err_disable_pclk; 2216 goto err_disable_pclk;
2217 } 2217 }
2218 2218
2219 err = clk_prepare_enable(bp->tx_clk); 2219 err = clk_prepare_enable(*tx_clk);
2220 if (err) { 2220 if (err) {
2221 dev_err(&pdev->dev, "failed to enable tx_clk (%u)\n", err); 2221 dev_err(&pdev->dev, "failed to enable tx_clk (%u)\n", err);
2222 goto err_disable_hclk; 2222 goto err_disable_hclk;
2223 } 2223 }
2224 2224
2225 return 0;
2226
2227err_disable_hclk:
2228 clk_disable_unprepare(*hclk);
2229
2230err_disable_pclk:
2231 clk_disable_unprepare(*pclk);
2232
2233 return err;
2234}
2235
2236static int macb_init(struct platform_device *pdev)
2237{
2238 struct net_device *dev = platform_get_drvdata(pdev);
2239 unsigned int hw_q, q;
2240 struct macb *bp = netdev_priv(dev);
2241 struct macb_queue *queue;
2242 int err;
2243 u32 val;
2244
2225 /* set the queue register mapping once for all: queue0 has a special 2245 /* set the queue register mapping once for all: queue0 has a special
2226 * register mapping but we don't want to test the queue index then 2246 * register mapping but we don't want to test the queue index then
2227 * compute the corresponding register offset at run time. 2247 * compute the corresponding register offset at run time.
2228 */ 2248 */
2229 macb_probe_queues(bp->regs, &queue_mask, &num_queues);
2230
2231 for (hw_q = 0, q = 0; hw_q < MACB_MAX_QUEUES; ++hw_q) { 2249 for (hw_q = 0, q = 0; hw_q < MACB_MAX_QUEUES; ++hw_q) {
2232 if (!(queue_mask & (1 << hw_q))) 2250 if (!(bp->queue_mask & (1 << hw_q)))
2233 continue; 2251 continue;
2234 2252
2235 queue = &bp->queues[q]; 2253 queue = &bp->queues[q];
@@ -2261,7 +2279,7 @@ static int macb_init(struct platform_device *pdev)
2261 dev_err(&pdev->dev, 2279 dev_err(&pdev->dev,
2262 "Unable to request IRQ %d (error %d)\n", 2280 "Unable to request IRQ %d (error %d)\n",
2263 queue->irq, err); 2281 queue->irq, err);
2264 goto err_disable_tx_clk; 2282 return err;
2265 } 2283 }
2266 2284
2267 INIT_WORK(&queue->tx_error_task, macb_tx_error_task); 2285 INIT_WORK(&queue->tx_error_task, macb_tx_error_task);
@@ -2311,26 +2329,12 @@ static int macb_init(struct platform_device *pdev)
2311 2329
2312 macb_or_gem_writel(bp, USRIO, val); 2330 macb_or_gem_writel(bp, USRIO, val);
2313 2331
2314 /* setup capacities */
2315 macb_configure_caps(bp);
2316
2317 /* Set MII management clock divider */ 2332 /* Set MII management clock divider */
2318 val = macb_mdc_clk_div(bp); 2333 val = macb_mdc_clk_div(bp);
2319 val |= macb_dbw(bp); 2334 val |= macb_dbw(bp);
2320 macb_writel(bp, NCFGR, val); 2335 macb_writel(bp, NCFGR, val);
2321 2336
2322 return 0; 2337 return 0;
2323
2324err_disable_tx_clk:
2325 clk_disable_unprepare(bp->tx_clk);
2326
2327err_disable_hclk:
2328 clk_disable_unprepare(bp->hclk);
2329
2330err_disable_pclk:
2331 clk_disable_unprepare(bp->pclk);
2332
2333 return err;
2334} 2338}
2335 2339
2336#if defined(CONFIG_OF) 2340#if defined(CONFIG_OF)
@@ -2598,30 +2602,41 @@ static const struct net_device_ops at91ether_netdev_ops = {
2598#endif 2602#endif
2599}; 2603};
2600 2604
2601static int at91ether_init(struct platform_device *pdev) 2605static int at91ether_clk_init(struct platform_device *pdev, struct clk **pclk,
2606 struct clk **hclk, struct clk **tx_clk)
2602{ 2607{
2603 struct net_device *dev = platform_get_drvdata(pdev);
2604 struct macb *bp = netdev_priv(dev);
2605 int err; 2608 int err;
2606 u32 reg;
2607 2609
2608 bp->pclk = devm_clk_get(&pdev->dev, "ether_clk"); 2610 *hclk = NULL;
2609 if (IS_ERR(bp->pclk)) 2611 *tx_clk = NULL;
2610 return PTR_ERR(bp->pclk); 2612
2613 *pclk = devm_clk_get(&pdev->dev, "ether_clk");
2614 if (IS_ERR(*pclk))
2615 return PTR_ERR(*pclk);
2611 2616
2612 err = clk_prepare_enable(bp->pclk); 2617 err = clk_prepare_enable(*pclk);
2613 if (err) { 2618 if (err) {
2614 dev_err(&pdev->dev, "failed to enable pclk (%u)\n", err); 2619 dev_err(&pdev->dev, "failed to enable pclk (%u)\n", err);
2615 return err; 2620 return err;
2616 } 2621 }
2617 2622
2623 return 0;
2624}
2625
2626static int at91ether_init(struct platform_device *pdev)
2627{
2628 struct net_device *dev = platform_get_drvdata(pdev);
2629 struct macb *bp = netdev_priv(dev);
2630 int err;
2631 u32 reg;
2632
2618 dev->netdev_ops = &at91ether_netdev_ops; 2633 dev->netdev_ops = &at91ether_netdev_ops;
2619 dev->ethtool_ops = &macb_ethtool_ops; 2634 dev->ethtool_ops = &macb_ethtool_ops;
2620 2635
2621 err = devm_request_irq(&pdev->dev, dev->irq, at91ether_interrupt, 2636 err = devm_request_irq(&pdev->dev, dev->irq, at91ether_interrupt,
2622 0, dev->name, dev); 2637 0, dev->name, dev);
2623 if (err) 2638 if (err)
2624 goto err_disable_clk; 2639 return err;
2625 2640
2626 macb_writel(bp, NCR, 0); 2641 macb_writel(bp, NCR, 0);
2627 2642
@@ -2632,37 +2647,37 @@ static int at91ether_init(struct platform_device *pdev)
2632 macb_writel(bp, NCFGR, reg); 2647 macb_writel(bp, NCFGR, reg);
2633 2648
2634 return 0; 2649 return 0;
2635
2636err_disable_clk:
2637 clk_disable_unprepare(bp->pclk);
2638
2639 return err;
2640} 2650}
2641 2651
2642static const struct macb_config at91sam9260_config = { 2652static const struct macb_config at91sam9260_config = {
2643 .caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII, 2653 .caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII,
2654 .clk_init = macb_clk_init,
2644 .init = macb_init, 2655 .init = macb_init,
2645}; 2656};
2646 2657
2647static const struct macb_config pc302gem_config = { 2658static const struct macb_config pc302gem_config = {
2648 .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE, 2659 .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE,
2649 .dma_burst_length = 16, 2660 .dma_burst_length = 16,
2661 .clk_init = macb_clk_init,
2650 .init = macb_init, 2662 .init = macb_init,
2651}; 2663};
2652 2664
2653static const struct macb_config sama5d3_config = { 2665static const struct macb_config sama5d3_config = {
2654 .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE, 2666 .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE,
2655 .dma_burst_length = 16, 2667 .dma_burst_length = 16,
2668 .clk_init = macb_clk_init,
2656 .init = macb_init, 2669 .init = macb_init,
2657}; 2670};
2658 2671
2659static const struct macb_config sama5d4_config = { 2672static const struct macb_config sama5d4_config = {
2660 .caps = 0, 2673 .caps = 0,
2661 .dma_burst_length = 4, 2674 .dma_burst_length = 4,
2675 .clk_init = macb_clk_init,
2662 .init = macb_init, 2676 .init = macb_init,
2663}; 2677};
2664 2678
2665static const struct macb_config emac_config = { 2679static const struct macb_config emac_config = {
2680 .clk_init = at91ether_clk_init,
2666 .init = at91ether_init, 2681 .init = at91ether_init,
2667}; 2682};
2668 2683
@@ -2683,9 +2698,13 @@ MODULE_DEVICE_TABLE(of, macb_dt_ids);
2683 2698
2684static int macb_probe(struct platform_device *pdev) 2699static int macb_probe(struct platform_device *pdev)
2685{ 2700{
2701 int (*clk_init)(struct platform_device *, struct clk **,
2702 struct clk **, struct clk **)
2703 = macb_clk_init;
2686 int (*init)(struct platform_device *) = macb_init; 2704 int (*init)(struct platform_device *) = macb_init;
2687 struct device_node *np = pdev->dev.of_node; 2705 struct device_node *np = pdev->dev.of_node;
2688 const struct macb_config *macb_config = NULL; 2706 const struct macb_config *macb_config = NULL;
2707 struct clk *pclk, *hclk, *tx_clk;
2689 unsigned int queue_mask, num_queues; 2708 unsigned int queue_mask, num_queues;
2690 struct macb_platform_data *pdata; 2709 struct macb_platform_data *pdata;
2691 struct phy_device *phydev; 2710 struct phy_device *phydev;
@@ -2696,15 +2715,34 @@ static int macb_probe(struct platform_device *pdev)
2696 struct macb *bp; 2715 struct macb *bp;
2697 int err; 2716 int err;
2698 2717
2718 if (np) {
2719 const struct of_device_id *match;
2720
2721 match = of_match_node(macb_dt_ids, np);
2722 if (match && match->data) {
2723 macb_config = match->data;
2724 clk_init = macb_config->clk_init;
2725 init = macb_config->init;
2726 }
2727 }
2728
2729 err = clk_init(pdev, &pclk, &hclk, &tx_clk);
2730 if (err)
2731 return err;
2732
2699 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2733 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2700 mem = devm_ioremap_resource(&pdev->dev, regs); 2734 mem = devm_ioremap_resource(&pdev->dev, regs);
2701 if (IS_ERR(mem)) 2735 if (IS_ERR(mem)) {
2702 return PTR_ERR(mem); 2736 err = PTR_ERR(mem);
2737 goto err_disable_clocks;
2738 }
2703 2739
2704 macb_probe_queues(mem, &queue_mask, &num_queues); 2740 macb_probe_queues(mem, &queue_mask, &num_queues);
2705 dev = alloc_etherdev_mq(sizeof(*bp), num_queues); 2741 dev = alloc_etherdev_mq(sizeof(*bp), num_queues);
2706 if (!dev) 2742 if (!dev) {
2707 return -ENOMEM; 2743 err = -ENOMEM;
2744 goto err_disable_clocks;
2745 }
2708 2746
2709 dev->base_addr = regs->start; 2747 dev->base_addr = regs->start;
2710 2748
@@ -2715,13 +2753,24 @@ static int macb_probe(struct platform_device *pdev)
2715 bp->dev = dev; 2753 bp->dev = dev;
2716 bp->regs = mem; 2754 bp->regs = mem;
2717 bp->num_queues = num_queues; 2755 bp->num_queues = num_queues;
2756 bp->queue_mask = queue_mask;
2757 if (macb_config)
2758 bp->dma_burst_length = macb_config->dma_burst_length;
2759 bp->pclk = pclk;
2760 bp->hclk = hclk;
2761 bp->tx_clk = tx_clk;
2718 spin_lock_init(&bp->lock); 2762 spin_lock_init(&bp->lock);
2719 2763
2764 /* setup capabilities */
2765 macb_configure_caps(bp, macb_config);
2766
2720 platform_set_drvdata(pdev, dev); 2767 platform_set_drvdata(pdev, dev);
2721 2768
2722 dev->irq = platform_get_irq(pdev, 0); 2769 dev->irq = platform_get_irq(pdev, 0);
2723 if (dev->irq < 0) 2770 if (dev->irq < 0) {
2724 return dev->irq; 2771 err = dev->irq;
2772 goto err_disable_clocks;
2773 }
2725 2774
2726 mac = of_get_mac_address(np); 2775 mac = of_get_mac_address(np);
2727 if (mac) 2776 if (mac)
@@ -2740,20 +2789,6 @@ static int macb_probe(struct platform_device *pdev)
2740 bp->phy_interface = err; 2789 bp->phy_interface = err;
2741 } 2790 }
2742 2791
2743 if (np) {
2744 const struct of_device_id *match;
2745
2746 match = of_match_node(macb_dt_ids, np);
2747 if (match)
2748 macb_config = match->data;
2749 }
2750
2751 if (macb_config) {
2752 bp->caps = macb_config->caps;
2753 bp->dma_burst_length = macb_config->dma_burst_length;
2754 init = macb_config->init;
2755 }
2756
2757 /* IP specific init */ 2792 /* IP specific init */
2758 err = init(pdev); 2793 err = init(pdev);
2759 if (err) 2794 if (err)
@@ -2762,7 +2797,7 @@ static int macb_probe(struct platform_device *pdev)
2762 err = register_netdev(dev); 2797 err = register_netdev(dev);
2763 if (err) { 2798 if (err) {
2764 dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); 2799 dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
2765 goto err_disable_clocks; 2800 goto err_out_unregister_netdev;
2766 } 2801 }
2767 2802
2768 err = macb_mii_init(bp); 2803 err = macb_mii_init(bp);
@@ -2784,14 +2819,14 @@ static int macb_probe(struct platform_device *pdev)
2784err_out_unregister_netdev: 2819err_out_unregister_netdev:
2785 unregister_netdev(dev); 2820 unregister_netdev(dev);
2786 2821
2787err_disable_clocks:
2788 clk_disable_unprepare(bp->tx_clk);
2789 clk_disable_unprepare(bp->hclk);
2790 clk_disable_unprepare(bp->pclk);
2791
2792err_out_free_netdev: 2822err_out_free_netdev:
2793 free_netdev(dev); 2823 free_netdev(dev);
2794 2824
2825err_disable_clocks:
2826 clk_disable_unprepare(tx_clk);
2827 clk_disable_unprepare(hclk);
2828 clk_disable_unprepare(pclk);
2829
2795 return err; 2830 return err;
2796} 2831}
2797 2832
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index bc6e35c40822..eb7d76f7bf6a 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -11,7 +11,7 @@
11#define _MACB_H 11#define _MACB_H
12 12
13#define MACB_GREGS_NBR 16 13#define MACB_GREGS_NBR 16
14#define MACB_GREGS_VERSION 1 14#define MACB_GREGS_VERSION 2
15#define MACB_MAX_QUEUES 8 15#define MACB_MAX_QUEUES 8
16 16
17/* MACB register offsets */ 17/* MACB register offsets */
@@ -754,6 +754,8 @@ struct macb_or_gem_ops {
754struct macb_config { 754struct macb_config {
755 u32 caps; 755 u32 caps;
756 unsigned int dma_burst_length; 756 unsigned int dma_burst_length;
757 int (*clk_init)(struct platform_device *pdev, struct clk **pclk,
758 struct clk **hclk, struct clk **tx_clk);
757 int (*init)(struct platform_device *pdev); 759 int (*init)(struct platform_device *pdev);
758}; 760};
759 761
@@ -785,6 +787,7 @@ struct macb {
785 size_t rx_buffer_size; 787 size_t rx_buffer_size;
786 788
787 unsigned int num_queues; 789 unsigned int num_queues;
790 unsigned int queue_mask;
788 struct macb_queue queues[MACB_MAX_QUEUES]; 791 struct macb_queue queues[MACB_MAX_QUEUES];
789 792
790 spinlock_t lock; 793 spinlock_t lock;
@@ -830,4 +833,9 @@ static inline bool macb_is_gem(struct macb *bp)
830 return !!(bp->caps & MACB_CAPS_MACB_IS_GEM); 833 return !!(bp->caps & MACB_CAPS_MACB_IS_GEM);
831} 834}
832 835
836static inline bool macb_is_gem_hw(void __iomem *addr)
837{
838 return !!(MACB_BFEXT(IDNUM, readl_relaxed(addr + MACB_MID)) >= 0x2);
839}
840
833#endif /* _MACB_H */ 841#endif /* _MACB_H */