diff options
author | Felipe Balbi <balbi@ti.com> | 2015-01-16 11:11:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-18 01:07:29 -0500 |
commit | 5087b915d5c33a0dd1af90eb41cc3e04117c5231 (patch) | |
tree | 2abdd3e9de2569f935b98b3c5947211597ec09f7 | |
parent | 053c095a82cf773075e83d7233b5cc19a1f73ece (diff) |
net: ethernet: cpsw: unroll IRQ request loop
This patch is in preparation for a nicer IRQ
handling scheme where we use different IRQ
handlers for each IRQ line (as it should be).
Later, we will also drop IRQs offset 0 and 3
because they are always disabled in this driver.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/ti/cpsw.c | 62 |
1 files changed, 47 insertions, 15 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 64d1cef4cda1..fd5157296100 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -2163,7 +2163,8 @@ static int cpsw_probe(struct platform_device *pdev) | |||
2163 | void __iomem *ss_regs; | 2163 | void __iomem *ss_regs; |
2164 | struct resource *res, *ss_res; | 2164 | struct resource *res, *ss_res; |
2165 | u32 slave_offset, sliver_offset, slave_size; | 2165 | u32 slave_offset, sliver_offset, slave_size; |
2166 | int ret = 0, i, k = 0; | 2166 | int ret = 0, i; |
2167 | int irq; | ||
2167 | 2168 | ||
2168 | ndev = alloc_etherdev(sizeof(struct cpsw_priv)); | 2169 | ndev = alloc_etherdev(sizeof(struct cpsw_priv)); |
2169 | if (!ndev) { | 2170 | if (!ndev) { |
@@ -2352,24 +2353,55 @@ static int cpsw_probe(struct platform_device *pdev) | |||
2352 | goto clean_ale_ret; | 2353 | goto clean_ale_ret; |
2353 | } | 2354 | } |
2354 | 2355 | ||
2355 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { | 2356 | irq = platform_get_irq(pdev, 0); |
2356 | if (k >= ARRAY_SIZE(priv->irqs_table)) { | 2357 | if (irq < 0) |
2357 | ret = -EINVAL; | 2358 | goto clean_ale_ret; |
2358 | goto clean_ale_ret; | ||
2359 | } | ||
2360 | 2359 | ||
2361 | ret = devm_request_irq(&pdev->dev, res->start, cpsw_interrupt, | 2360 | priv->irqs_table[0] = irq; |
2362 | 0, dev_name(&pdev->dev), priv); | 2361 | ret = devm_request_irq(&pdev->dev, irq, cpsw_interrupt, |
2363 | if (ret < 0) { | 2362 | 0, dev_name(&pdev->dev), priv); |
2364 | dev_err(priv->dev, "error attaching irq (%d)\n", ret); | 2363 | if (ret < 0) { |
2365 | goto clean_ale_ret; | 2364 | dev_err(priv->dev, "error attaching irq (%d)\n", ret); |
2366 | } | 2365 | goto clean_ale_ret; |
2366 | } | ||
2367 | 2367 | ||
2368 | priv->irqs_table[k] = res->start; | 2368 | irq = platform_get_irq(pdev, 1); |
2369 | k++; | 2369 | if (irq < 0) |
2370 | goto clean_ale_ret; | ||
2371 | |||
2372 | priv->irqs_table[1] = irq; | ||
2373 | ret = devm_request_irq(&pdev->dev, irq, cpsw_interrupt, | ||
2374 | 0, dev_name(&pdev->dev), priv); | ||
2375 | if (ret < 0) { | ||
2376 | dev_err(priv->dev, "error attaching irq (%d)\n", ret); | ||
2377 | goto clean_ale_ret; | ||
2378 | } | ||
2379 | |||
2380 | irq = platform_get_irq(pdev, 2); | ||
2381 | if (irq < 0) | ||
2382 | goto clean_ale_ret; | ||
2383 | |||
2384 | priv->irqs_table[2] = irq; | ||
2385 | ret = devm_request_irq(&pdev->dev, irq, cpsw_interrupt, | ||
2386 | 0, dev_name(&pdev->dev), priv); | ||
2387 | if (ret < 0) { | ||
2388 | dev_err(priv->dev, "error attaching irq (%d)\n", ret); | ||
2389 | goto clean_ale_ret; | ||
2390 | } | ||
2391 | |||
2392 | irq = platform_get_irq(pdev, 3); | ||
2393 | if (irq < 0) | ||
2394 | goto clean_ale_ret; | ||
2395 | |||
2396 | priv->irqs_table[3] = irq; | ||
2397 | ret = devm_request_irq(&pdev->dev, irq, cpsw_interrupt, | ||
2398 | 0, dev_name(&pdev->dev), priv); | ||
2399 | if (ret < 0) { | ||
2400 | dev_err(priv->dev, "error attaching irq (%d)\n", ret); | ||
2401 | goto clean_ale_ret; | ||
2370 | } | 2402 | } |
2371 | 2403 | ||
2372 | priv->num_irqs = k; | 2404 | priv->num_irqs = 4; |
2373 | 2405 | ||
2374 | ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; | 2406 | ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; |
2375 | 2407 | ||