summaryrefslogtreecommitdiff
path: root/drivers/reset
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2022-07-19 10:52:15 -0400
committerTom Rini <[email protected]>2022-07-19 10:52:15 -0400
commitfc97ff2695d6d7fbea7d5fda7b080f405d6ee744 (patch)
tree609c80bfc0804e0704f08990f474bba2173d59d2 /drivers/reset
parent905e779b9e0bd29255ebc6244f017690fdc10fc4 (diff)
parent25ba5be1c2b6324917254f0c22df1ad9d3d3c9e7 (diff)
Merge https://source.denx.de/u-boot/custodians/u-boot-sunxi
To quote Andre: One prominent feature is the restructering of the clock driver, which allows to end up with one actual driver for all variants, although we still only compile in support for one SoC. Also contained are some initial SPI fixes, which should fix some problems, and enable SPI flash support for the F1C100s SoC. Those patches revealed more problems, I will queue fixes later on, but for now it should at least still work. Apart from some smaller fixes (for instance for NAND operation), there is also preparation for the upcoming Allwinner D1 support, in form of the USB PHY driver. There are more driver support patches to come. The gitlab CI completed successfully, including the build test for all 160 sunxi boards. I also boot tested on a few boards, but didn't have time for more elaborate tests this time.
Diffstat (limited to 'drivers/reset')
-rw-r--r--drivers/reset/reset-sunxi.c55
1 files changed, 8 insertions, 47 deletions
diff --git a/drivers/reset/reset-sunxi.c b/drivers/reset/reset-sunxi.c
index e2a9c2a142b..e484d1fff44 100644
--- a/drivers/reset/reset-sunxi.c
+++ b/drivers/reset/reset-sunxi.c
@@ -12,30 +12,22 @@
#include <reset-uclass.h>
#include <asm/io.h>
#include <clk/sunxi.h>
-#include <dm/device-internal.h>
-#include <dm/lists.h>
#include <linux/bitops.h>
#include <linux/log2.h>
-struct sunxi_reset_priv {
- void *base;
- ulong count;
- const struct ccu_desc *desc;
-};
-
-static const struct ccu_reset *priv_to_reset(struct sunxi_reset_priv *priv,
+static const struct ccu_reset *plat_to_reset(struct ccu_plat *plat,
unsigned long id)
{
- return &priv->desc->resets[id];
+ return &plat->desc->resets[id];
}
static int sunxi_reset_request(struct reset_ctl *reset_ctl)
{
- struct sunxi_reset_priv *priv = dev_get_priv(reset_ctl->dev);
+ struct ccu_plat *plat = dev_get_plat(reset_ctl->dev);
debug("%s: (RST#%ld)\n", __func__, reset_ctl->id);
- if (reset_ctl->id >= priv->count)
+ if (reset_ctl->id >= plat->desc->num_resets)
return -EINVAL;
return 0;
@@ -43,8 +35,8 @@ static int sunxi_reset_request(struct reset_ctl *reset_ctl)
static int sunxi_set_reset(struct reset_ctl *reset_ctl, bool on)
{
- struct sunxi_reset_priv *priv = dev_get_priv(reset_ctl->dev);
- const struct ccu_reset *reset = priv_to_reset(priv, reset_ctl->id);
+ struct ccu_plat *plat = dev_get_plat(reset_ctl->dev);
+ const struct ccu_reset *reset = plat_to_reset(plat, reset_ctl->id);
u32 reg;
if (!(reset->flags & CCU_RST_F_IS_VALID)) {
@@ -55,13 +47,13 @@ static int sunxi_set_reset(struct reset_ctl *reset_ctl, bool on)
debug("%s: (RST#%ld) off#0x%x, BIT(%d)\n", __func__,
reset_ctl->id, reset->off, ilog2(reset->bit));
- reg = readl(priv->base + reset->off);
+ reg = readl(plat->base + reset->off);
if (on)
reg |= reset->bit;
else
reg &= ~reset->bit;
- writel(reg, priv->base + reset->off);
+ writel(reg, plat->base + reset->off);
return 0;
}
@@ -82,39 +74,8 @@ struct reset_ops sunxi_reset_ops = {
.rst_deassert = sunxi_reset_deassert,
};
-static int sunxi_reset_probe(struct udevice *dev)
-{
- struct sunxi_reset_priv *priv = dev_get_priv(dev);
-
- priv->base = dev_read_addr_ptr(dev);
-
- return 0;
-}
-
-int sunxi_reset_bind(struct udevice *dev, ulong count)
-{
- struct udevice *rst_dev;
- struct sunxi_reset_priv *priv;
- int ret;
-
- ret = device_bind_driver_to_node(dev, "sunxi_reset", "reset",
- dev_ofnode(dev), &rst_dev);
- if (ret) {
- debug("failed to bind sunxi_reset driver (ret=%d)\n", ret);
- return ret;
- }
- priv = malloc(sizeof(struct sunxi_reset_priv));
- priv->count = count;
- priv->desc = (const struct ccu_desc *)dev_get_driver_data(dev);
- dev_set_priv(rst_dev, priv);
-
- return 0;
-}
-
U_BOOT_DRIVER(sunxi_reset) = {
.name = "sunxi_reset",
.id = UCLASS_RESET,
.ops = &sunxi_reset_ops,
- .probe = sunxi_reset_probe,
- .priv_auto = sizeof(struct sunxi_reset_priv),
};