mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-11-21 15:17:21 +00:00
The function returns zero unconditionally. Change it to return void instead which simplifies some callers as error handing becomes unnecessary. The function is also used for some drivers as remove callback. Switch these to the .remove_new() callback. For some others no error can happen in the remove callback now, convert them to .remove_new(), too. Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Michal Kubiak <michal.kubiak@intel.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
106 lines
2.3 KiB
C
106 lines
2.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Amlogic Meson6 and Meson8 DWMAC glue layer
|
|
*
|
|
* Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
|
|
*/
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/ethtool.h>
|
|
#include <linux/io.h>
|
|
#include <linux/ioport.h>
|
|
#include <linux/module.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/stmmac.h>
|
|
|
|
#include "stmmac_platform.h"
|
|
|
|
#define ETHMAC_SPEED_100 BIT(1)
|
|
|
|
struct meson_dwmac {
|
|
struct device *dev;
|
|
void __iomem *reg;
|
|
};
|
|
|
|
static void meson6_dwmac_fix_mac_speed(void *priv, unsigned int speed)
|
|
{
|
|
struct meson_dwmac *dwmac = priv;
|
|
unsigned int val;
|
|
|
|
val = readl(dwmac->reg);
|
|
|
|
switch (speed) {
|
|
case SPEED_10:
|
|
val &= ~ETHMAC_SPEED_100;
|
|
break;
|
|
case SPEED_100:
|
|
val |= ETHMAC_SPEED_100;
|
|
break;
|
|
}
|
|
|
|
writel(val, dwmac->reg);
|
|
}
|
|
|
|
static int meson6_dwmac_probe(struct platform_device *pdev)
|
|
{
|
|
struct plat_stmmacenet_data *plat_dat;
|
|
struct stmmac_resources stmmac_res;
|
|
struct meson_dwmac *dwmac;
|
|
int ret;
|
|
|
|
ret = stmmac_get_platform_resources(pdev, &stmmac_res);
|
|
if (ret)
|
|
return ret;
|
|
|
|
plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac);
|
|
if (IS_ERR(plat_dat))
|
|
return PTR_ERR(plat_dat);
|
|
|
|
dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
|
|
if (!dwmac) {
|
|
ret = -ENOMEM;
|
|
goto err_remove_config_dt;
|
|
}
|
|
|
|
dwmac->reg = devm_platform_ioremap_resource(pdev, 1);
|
|
if (IS_ERR(dwmac->reg)) {
|
|
ret = PTR_ERR(dwmac->reg);
|
|
goto err_remove_config_dt;
|
|
}
|
|
|
|
plat_dat->bsp_priv = dwmac;
|
|
plat_dat->fix_mac_speed = meson6_dwmac_fix_mac_speed;
|
|
|
|
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
|
|
if (ret)
|
|
goto err_remove_config_dt;
|
|
|
|
return 0;
|
|
|
|
err_remove_config_dt:
|
|
stmmac_remove_config_dt(pdev, plat_dat);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static const struct of_device_id meson6_dwmac_match[] = {
|
|
{ .compatible = "amlogic,meson6-dwmac" },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, meson6_dwmac_match);
|
|
|
|
static struct platform_driver meson6_dwmac_driver = {
|
|
.probe = meson6_dwmac_probe,
|
|
.remove_new = stmmac_pltfr_remove,
|
|
.driver = {
|
|
.name = "meson6-dwmac",
|
|
.pm = &stmmac_pltfr_pm_ops,
|
|
.of_match_table = meson6_dwmac_match,
|
|
},
|
|
};
|
|
module_platform_driver(meson6_dwmac_driver);
|
|
|
|
MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>");
|
|
MODULE_DESCRIPTION("Amlogic Meson6 and Meson8 DWMAC glue layer");
|
|
MODULE_LICENSE("GPL v2");
|