summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-11-14 13:44:46 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-11-14 13:56:35 +0100
commit081e5da7db077e8bfb3313664ea45e60c474994a (patch)
treee3551160a8cb9b3e73f918372e38002269f70a12 /drivers
parent4d824b3235dde8189285f4ec37ffb147a03616c4 (diff)
downloadbarebox-081e5da7db077e8bfb3313664ea45e60c474994a.tar.gz
barebox-081e5da7db077e8bfb3313664ea45e60c474994a.tar.xz
net: fsl-fman: reset device before leaving
edev->halt is implemented, but not called by the core during shutdown. We have to call it manually during device remove. With this and also resetting the whole FMan during shutdown the driver now works properly when started second stage from another barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/fsl-fman.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/net/fsl-fman.c b/drivers/net/fsl-fman.c
index 4e6bb2ecfd..287a891a63 100644
--- a/drivers/net/fsl-fman.c
+++ b/drivers/net/fsl-fman.c
@@ -1175,6 +1175,8 @@ static int fsl_fman_memac_probe(struct device_d *dev)
/* alloc the FMan ethernet private struct */
fm_eth = xzalloc(sizeof(*fm_eth));
+ dev->priv = fm_eth;
+
fm_eth->dev = dev;
ret = fsl_fman_memac_port_bind(fm_eth, FMAN_PORT_TYPE_TX);
@@ -1216,6 +1218,13 @@ static int fsl_fman_memac_probe(struct device_d *dev)
return 0;
}
+static void fsl_fman_memac_remove(struct device_d *dev)
+{
+ struct fm_eth *fm_eth = dev->priv;
+
+ fm_eth_halt(&fm_eth->edev);
+}
+
static int fsl_fman_muram_probe(struct device_d *dev)
{
struct resource *iores;
@@ -1274,6 +1283,7 @@ static struct of_device_id fsl_fman_memac_dt_ids[] = {
static struct driver_d fman_memac_driver = {
.name = "fsl-fman-memac",
.probe = fsl_fman_memac_probe,
+ .remove = fsl_fman_memac_remove,
.of_compatible = DRV_OF_COMPAT(fsl_fman_memac_dt_ids),
};
@@ -1303,6 +1313,7 @@ static int fsl_fman_probe(struct device_d *dev)
return PTR_ERR(iores);
reg = IOMEM(iores->start);
+ dev->priv = reg;
ret = of_platform_populate(dev->device_node, NULL, dev);
if (ret)
@@ -1320,6 +1331,13 @@ static int fsl_fman_probe(struct device_d *dev)
return 0;
}
+static void fsl_fman_remove(struct device_d *dev)
+{
+ struct ccsr_fman *reg = dev->priv;
+
+ setbits_be32(&reg->fm_fpm.fmrstc, FMFP_RSTC_RFM);
+}
+
static struct of_device_id fsl_fman_dt_ids[] = {
{
.compatible = "fsl,fman",
@@ -1330,6 +1348,7 @@ static struct of_device_id fsl_fman_dt_ids[] = {
static struct driver_d fman_driver = {
.name = "fsl-fman",
.probe = fsl_fman_probe,
+ .remove = fsl_fman_remove,
.of_compatible = DRV_OF_COMPAT(fsl_fman_dt_ids),
};
device_platform_driver(fman_driver);