aboutsummaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorMichal Simek2021-12-06 16:25:20 +0100
committerMichal Simek2022-01-05 11:16:21 +0100
commitb5ffc9f758a7a25c4aeabe8a6e889febc989bb4c (patch)
treecf89492621c018941a041bd99146d79f503d2671 /drivers/net
parent12133b11a7ff817fd96210eeb7e84ff9f871e714 (diff)
net: zynq: Add support for GEM reset
Perform reset before core initialization. Standard flow which close to 99% users are using getting all IPs out of reset that there is no need to reset IP again. This is because of all low level initialization is done in previous bootloader stage. In SOM case these IPs are not touched by previous bootloader stage that's why reset needs to be called before IP is accessed to make sure that it is in correct state. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Link: https://lore.kernel.org/r/5ae1c85b282d632bb62030f1f24a0065661b9153.1638804318.git.michal.simek@xilinx.com
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/zynq_gem.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index de613210723..56f668c2496 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -21,6 +21,7 @@
#include <asm/cache.h>
#include <asm/io.h>
#include <phy.h>
+#include <reset.h>
#include <miiphy.h>
#include <wait_bit.h>
#include <watchdog.h>
@@ -215,6 +216,7 @@ struct zynq_gem_priv {
bool int_pcs;
bool dma_64bit;
u32 clk_en_info;
+ struct reset_ctl_bulk resets;
};
static int phy_setup_op(struct zynq_gem_priv *priv, u32 phy_addr, u32 regnum,
@@ -686,12 +688,36 @@ static int zynq_gem_miiphy_write(struct mii_dev *bus, int addr, int devad,
return phywrite(priv, addr, reg, value);
}
+static int zynq_gem_reset_init(struct udevice *dev)
+{
+ struct zynq_gem_priv *priv = dev_get_priv(dev);
+ int ret;
+
+ ret = reset_get_bulk(dev, &priv->resets);
+ if (ret == -ENOTSUPP || ret == -ENOENT)
+ return 0;
+ else if (ret)
+ return ret;
+
+ ret = reset_deassert_bulk(&priv->resets);
+ if (ret) {
+ reset_release_bulk(&priv->resets);
+ return ret;
+ }
+
+ return 0;
+}
+
static int zynq_gem_probe(struct udevice *dev)
{
void *bd_space;
struct zynq_gem_priv *priv = dev_get_priv(dev);
int ret;
+ ret = zynq_gem_reset_init(dev);
+ if (ret)
+ return ret;
+
/* Align rxbuffers to ARCH_DMA_MINALIGN */
priv->rxbuffers = memalign(ARCH_DMA_MINALIGN, RX_BUF * PKTSIZE_ALIGN);
if (!priv->rxbuffers)