Skip to content

Commit bd1266d

Browse files
committed
Merge branch 'net-bcmgenet-Clean-up-after-ACPI-enablement'
Andy Shevchenko says: ==================== net: bcmgenet: Clean up after ACPI enablement ACPI enablement series had missed some clean ups that would have been done at the same time. Here are these bits. In v2: - return dev_dbg() calls to avoid spamming logs when probe is deferred (Florian) - added Ack (Florian) - combined two, earlier sent, series together - added couple more patches ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 80ad41f + 7d3cca7 commit bd1266d

File tree

1 file changed

+18
-31
lines changed

1 file changed

+18
-31
lines changed

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
#include <linux/dma-mapping.h>
2424
#include <linux/pm.h>
2525
#include <linux/clk.h>
26-
#include <linux/of.h>
27-
#include <linux/of_address.h>
28-
#include <linux/of_irq.h>
29-
#include <linux/of_net.h>
30-
#include <linux/of_platform.h>
3126
#include <net/arp.h>
3227

3328
#include <linux/mii.h>
@@ -2707,9 +2702,8 @@ static void bcmgenet_umac_reset(struct bcmgenet_priv *priv)
27072702
static void bcmgenet_set_hw_addr(struct bcmgenet_priv *priv,
27082703
unsigned char *addr)
27092704
{
2710-
bcmgenet_umac_writel(priv, (addr[0] << 24) | (addr[1] << 16) |
2711-
(addr[2] << 8) | addr[3], UMAC_MAC0);
2712-
bcmgenet_umac_writel(priv, (addr[4] << 8) | addr[5], UMAC_MAC1);
2705+
bcmgenet_umac_writel(priv, get_unaligned_be32(&addr[0]), UMAC_MAC0);
2706+
bcmgenet_umac_writel(priv, get_unaligned_be16(&addr[4]), UMAC_MAC1);
27132707
}
27142708

27152709
static void bcmgenet_get_hw_addr(struct bcmgenet_priv *priv,
@@ -2718,13 +2712,9 @@ static void bcmgenet_get_hw_addr(struct bcmgenet_priv *priv,
27182712
u32 addr_tmp;
27192713

27202714
addr_tmp = bcmgenet_umac_readl(priv, UMAC_MAC0);
2721-
addr[0] = addr_tmp >> 24;
2722-
addr[1] = (addr_tmp >> 16) & 0xff;
2723-
addr[2] = (addr_tmp >> 8) & 0xff;
2724-
addr[3] = addr_tmp & 0xff;
2715+
put_unaligned_be32(addr_tmp, &addr[0]);
27252716
addr_tmp = bcmgenet_umac_readl(priv, UMAC_MAC1);
2726-
addr[4] = (addr_tmp >> 8) & 0xff;
2727-
addr[5] = addr_tmp & 0xff;
2717+
put_unaligned_be16(addr_tmp, &addr[4]);
27282718
}
27292719

27302720
/* Returns a reusable dma control register value */
@@ -3417,8 +3407,6 @@ MODULE_DEVICE_TABLE(of, bcmgenet_match);
34173407
static int bcmgenet_probe(struct platform_device *pdev)
34183408
{
34193409
struct bcmgenet_platform_data *pd = pdev->dev.platform_data;
3420-
struct device_node *dn = pdev->dev.of_node;
3421-
const struct of_device_id *of_id = NULL;
34223410
const struct bcmgenet_plat_data *pdata;
34233411
struct bcmgenet_priv *priv;
34243412
struct net_device *dev;
@@ -3433,12 +3421,6 @@ static int bcmgenet_probe(struct platform_device *pdev)
34333421
return -ENOMEM;
34343422
}
34353423

3436-
if (dn) {
3437-
of_id = of_match_node(bcmgenet_match, dn);
3438-
if (!of_id)
3439-
return -EINVAL;
3440-
}
3441-
34423424
priv = netdev_priv(dev);
34433425
priv->irq0 = platform_get_irq(pdev, 0);
34443426
if (priv->irq0 < 0) {
@@ -3500,13 +3482,16 @@ static int bcmgenet_probe(struct platform_device *pdev)
35003482
priv->dma_max_burst_length = DMA_MAX_BURST_LENGTH;
35013483
}
35023484

3503-
priv->clk = devm_clk_get(&priv->pdev->dev, "enet");
3485+
priv->clk = devm_clk_get_optional(&priv->pdev->dev, "enet");
35043486
if (IS_ERR(priv->clk)) {
35053487
dev_dbg(&priv->pdev->dev, "failed to get enet clock\n");
3506-
priv->clk = NULL;
3488+
err = PTR_ERR(priv->clk);
3489+
goto err;
35073490
}
35083491

3509-
clk_prepare_enable(priv->clk);
3492+
err = clk_prepare_enable(priv->clk);
3493+
if (err)
3494+
goto err;
35103495

35113496
bcmgenet_set_hw_params(priv);
35123497

@@ -3524,16 +3509,18 @@ static int bcmgenet_probe(struct platform_device *pdev)
35243509
priv->rx_buf_len = RX_BUF_LENGTH;
35253510
INIT_WORK(&priv->bcmgenet_irq_work, bcmgenet_irq_task);
35263511

3527-
priv->clk_wol = devm_clk_get(&priv->pdev->dev, "enet-wol");
3512+
priv->clk_wol = devm_clk_get_optional(&priv->pdev->dev, "enet-wol");
35283513
if (IS_ERR(priv->clk_wol)) {
35293514
dev_dbg(&priv->pdev->dev, "failed to get enet-wol clock\n");
3530-
priv->clk_wol = NULL;
3515+
err = PTR_ERR(priv->clk_wol);
3516+
goto err;
35313517
}
35323518

3533-
priv->clk_eee = devm_clk_get(&priv->pdev->dev, "enet-eee");
3519+
priv->clk_eee = devm_clk_get_optional(&priv->pdev->dev, "enet-eee");
35343520
if (IS_ERR(priv->clk_eee)) {
35353521
dev_dbg(&priv->pdev->dev, "failed to get enet-eee clock\n");
3536-
priv->clk_eee = NULL;
3522+
err = PTR_ERR(priv->clk_eee);
3523+
goto err;
35373524
}
35383525

35393526
/* If this is an internal GPHY, power it on now, before UniMAC is
@@ -3542,7 +3529,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
35423529
if (device_get_phy_mode(&pdev->dev) == PHY_INTERFACE_MODE_INTERNAL)
35433530
bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
35443531

3545-
if ((pd) && (!IS_ERR_OR_NULL(pd->mac_address)))
3532+
if (pd && !IS_ERR_OR_NULL(pd->mac_address))
35463533
ether_addr_copy(dev->dev_addr, pd->mac_address);
35473534
else
35483535
if (!device_get_mac_address(&pdev->dev, dev->dev_addr, ETH_ALEN))
@@ -3740,7 +3727,7 @@ static struct platform_driver bcmgenet_driver = {
37403727
.name = "bcmgenet",
37413728
.of_match_table = bcmgenet_match,
37423729
.pm = &bcmgenet_pm_ops,
3743-
.acpi_match_table = ACPI_PTR(genet_acpi_match),
3730+
.acpi_match_table = genet_acpi_match,
37443731
},
37453732
};
37463733
module_platform_driver(bcmgenet_driver);

0 commit comments

Comments
 (0)