In case the ops is not implemented, return 0 in the core right away.
This is better than having multiple copies of functions which just
return 0 in each reset driver. Drop all those empty functions.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
struct ast2500_scu *scu;
};
-static int ast2500_reset_request(struct reset_ctl *reset_ctl)
-{
- debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
- reset_ctl->dev, reset_ctl->id);
-
- return 0;
-}
-
-static int ast2500_reset_free(struct reset_ctl *reset_ctl)
-{
- debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
- reset_ctl->dev, reset_ctl->id);
-
- return 0;
-}
-
static int ast2500_reset_assert(struct reset_ctl *reset_ctl)
{
struct ast2500_reset_priv *priv = dev_get_priv(reset_ctl->dev);
};
struct reset_ops ast2500_reset_ops = {
- .request = ast2500_reset_request,
- .rfree = ast2500_reset_free,
.rst_assert = ast2500_reset_assert,
.rst_deassert = ast2500_reset_deassert,
};
struct ast2600_scu *scu;
};
-static int ast2600_reset_request(struct reset_ctl *reset_ctl)
-{
- debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
- reset_ctl->dev, reset_ctl->id);
-
- return 0;
-}
-
-static int ast2600_reset_free(struct reset_ctl *reset_ctl)
-{
- debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
- reset_ctl->dev, reset_ctl->id);
-
- return 0;
-}
-
static int ast2600_reset_assert(struct reset_ctl *reset_ctl)
{
struct ast2600_reset_priv *priv = dev_get_priv(reset_ctl->dev);
};
struct reset_ops ast2600_reset_ops = {
- .request = ast2600_reset_request,
- .rfree = ast2600_reset_free,
.rst_assert = ast2600_reset_assert,
.rst_deassert = ast2600_reset_deassert,
};
return 0;
}
-static int bcm6345_reset_free(struct reset_ctl *rst)
-{
- return 0;
-}
-
static int bcm6345_reset_request(struct reset_ctl *rst)
{
if (rst->id >= MAX_RESETS)
}
struct reset_ops bcm6345_reset_reset_ops = {
- .rfree = bcm6345_reset_free,
.request = bcm6345_reset_request,
.rst_assert = bcm6345_reset_assert,
.rst_deassert = bcm6345_reset_deassert,
u8 nreset;
};
-static int dra7_reset_request(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
-static int dra7_reset_free(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
static inline void dra7_reset_rmw(u32 addr, u32 value, u32 mask)
{
writel(((readl(addr) & (~mask)) | (value & mask)), addr);
}
struct reset_ops dra7_reset_ops = {
- .request = dra7_reset_request,
- .rfree = dra7_reset_free,
.rst_assert = dra7_reset_assert,
.rst_deassert = dra7_reset_deassert,
};
return 0;
}
-static int hisi_reset_free(struct reset_ctl *rst)
-{
- return 0;
-}
-
-static int hisi_reset_request(struct reset_ctl *rst)
-{
- return 0;
-}
-
static int hisi_reset_of_xlate(struct reset_ctl *rst,
struct ofnode_phandle_args *args)
{
static const struct reset_ops hisi_reset_reset_ops = {
.of_xlate = hisi_reset_of_xlate,
- .request = hisi_reset_request,
- .rfree = hisi_reset_free,
.rst_assert = hisi_reset_assert,
.rst_deassert = hisi_reset_deassert,
};
return hsdk_reset_do(rst);
}
-static int hsdk_reset_noop(struct reset_ctl *rst_ctl)
-{
- return 0;
-}
-
static const struct reset_ops hsdk_reset_ops = {
- .request = hsdk_reset_noop,
- .rfree = hsdk_reset_noop,
- .rst_assert = hsdk_reset_noop,
.rst_deassert = hsdk_reset_reset,
};
return priv->ops.rst_deassert(rst);
}
-static int imx7_reset_free(struct reset_ctl *rst)
-{
- return 0;
-}
-
-static int imx7_reset_request(struct reset_ctl *rst)
-{
- return 0;
-}
-
static const struct reset_ops imx7_reset_reset_ops = {
- .request = imx7_reset_request,
- .rfree = imx7_reset_free,
.rst_assert = imx7_reset_assert,
.rst_deassert = imx7_reset_deassert,
};
return 0;
}
-static int ipq4019_reset_free(struct reset_ctl *rst)
-{
- return 0;
-}
-
-static int ipq4019_reset_request(struct reset_ctl *rst)
-{
- return 0;
-}
-
static const struct reset_ops ipq4019_reset_ops = {
- .request = ipq4019_reset_request,
- .rfree = ipq4019_reset_free,
.rst_assert = ipq4019_reset_assert,
.rst_deassert = ipq4019_reset_deassert,
};
u32 nr_resets;
};
-static int mediatek_reset_request(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
-static int mediatek_reset_free(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
static int mediatek_reset_assert(struct reset_ctl *reset_ctl)
{
struct mediatek_reset_priv *priv = dev_get_priv(reset_ctl->dev);
}
struct reset_ops mediatek_reset_ops = {
- .request = mediatek_reset_request,
- .rfree = mediatek_reset_free,
.rst_assert = mediatek_reset_assert,
.rst_deassert = mediatek_reset_deassert,
};
return 0;
}
-static int meson_reset_free(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
static int meson_reset_level(struct reset_ctl *reset_ctl, bool assert)
{
struct meson_reset_priv *priv = dev_get_priv(reset_ctl->dev);
struct reset_ops meson_reset_ops = {
.request = meson_reset_request,
- .rfree = meson_reset_free,
.rst_assert = meson_reset_assert,
.rst_deassert = meson_reset_deassert,
};
void __iomem *base;
};
-static int mtmips_reset_request(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
-static int mtmips_reset_free(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
static int mtmips_reset_assert(struct reset_ctl *reset_ctl)
{
struct mtmips_reset_priv *priv = dev_get_priv(reset_ctl->dev);
}
static const struct reset_ops mtmips_reset_ops = {
- .request = mtmips_reset_request,
- .rfree = mtmips_reset_free,
.rst_assert = mtmips_reset_assert,
.rst_deassert = mtmips_reset_deassert,
};
return 0;
}
-static int raspberrypi_reset_free(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
static int raspberrypi_reset_assert(struct reset_ctl *reset_ctl)
{
switch (reset_ctl->id) {
}
}
-static int raspberrypi_reset_deassert(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
struct reset_ops raspberrypi_reset_ops = {
.request = raspberrypi_reset_request,
- .rfree = raspberrypi_reset_free,
.rst_assert = raspberrypi_reset_assert,
- .rst_deassert = raspberrypi_reset_deassert,
};
static const struct udevice_id raspberrypi_reset_ids[] = {
return 0;
}
-static int rockchip_reset_free(struct reset_ctl *reset_ctl)
-{
- debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
- reset_ctl->dev, reset_ctl->id);
-
- return 0;
-}
-
static int rockchip_reset_assert(struct reset_ctl *reset_ctl)
{
struct rockchip_reset_priv *priv = dev_get_priv(reset_ctl->dev);
struct reset_ops rockchip_reset_ops = {
.request = rockchip_reset_request,
- .rfree = rockchip_reset_free,
.rst_assert = rockchip_reset_assert,
.rst_deassert = rockchip_reset_deassert,
};
return scmi_to_linux_errno(out.status);
}
-static int scmi_reset_rfree(struct reset_ctl *rst)
-{
- return 0;
-}
-
static const struct reset_ops scmi_reset_domain_ops = {
.request = scmi_reset_request,
- .rfree = scmi_reset_rfree,
.rst_assert = scmi_reset_assert,
.rst_deassert = scmi_reset_deassert,
};
return 0;
}
-static int sifive_reset_free(struct reset_ctl *rst)
-{
- struct sifive_reset_priv *priv = dev_get_priv(rst->dev);
-
- debug("%s(rst=%p) (dev=%p, id=%lu) (nr_reset=%d)\n", __func__,
- rst, rst->dev, rst->id, priv->nr_reset);
-
- return 0;
-}
-
static int sifive_reset_probe(struct udevice *dev)
{
struct sifive_reset_priv *priv = dev_get_priv(dev);
const struct reset_ops sifive_reset_ops = {
.request = sifive_reset_request,
- .rfree = sifive_reset_free,
.rst_assert = sifive_reset_assert,
.rst_deassert = sifive_reset_deassert,
};
false, 500, false);
}
-static int socfpga_reset_request(struct reset_ctl *reset_ctl)
-{
- debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__,
- reset_ctl, reset_ctl->dev, reset_ctl->id);
-
- return 0;
-}
-
-static int socfpga_reset_free(struct reset_ctl *reset_ctl)
-{
- debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
- reset_ctl->dev, reset_ctl->id);
-
- return 0;
-}
-
static const struct reset_ops socfpga_reset_ops = {
- .request = socfpga_reset_request,
- .rfree = socfpga_reset_free,
.rst_assert = socfpga_reset_assert,
.rst_deassert = socfpga_reset_deassert,
};
return 0;
}
-static int sunxi_reset_free(struct reset_ctl *reset_ctl)
-{
- debug("%s: (RST#%ld)\n", __func__, reset_ctl->id);
-
- return 0;
-}
-
static int sunxi_set_reset(struct reset_ctl *reset_ctl, bool on)
{
struct sunxi_reset_priv *priv = dev_get_priv(reset_ctl->dev);
struct reset_ops sunxi_reset_ops = {
.request = sunxi_reset_request,
- .rfree = sunxi_reset_free,
.rst_assert = sunxi_reset_assert,
.rst_deassert = sunxi_reset_deassert,
};
return 0;
}
-static int ti_sci_reset_request(struct reset_ctl *rst)
-{
- debug("%s(rst=%p)\n", __func__, rst);
- return 0;
-}
-
-static int ti_sci_reset_free(struct reset_ctl *rst)
-{
- debug("%s(rst=%p)\n", __func__, rst);
- return 0;
-}
-
/**
* ti_sci_reset_set() - program a device's reset
* @rst: Handle to a single reset signal
static struct reset_ops ti_sci_reset_ops = {
.of_xlate = ti_sci_reset_of_xlate,
- .request = ti_sci_reset_request,
- .rfree = ti_sci_reset_free,
.rst_assert = ti_sci_reset_assert,
.rst_deassert = ti_sci_reset_deassert,
.rst_status = ti_sci_reset_status,
return ret;
}
- ret = ops->request(reset_ctl);
+ ret = ops->request ? ops->request(reset_ctl) : 0;
if (ret) {
debug("ops->request() failed: %d\n", ret);
return ret;
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
- return ops->request(reset_ctl);
+ return ops->request ? ops->request(reset_ctl) : 0;
}
int reset_free(struct reset_ctl *reset_ctl)
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
- return ops->rfree(reset_ctl);
+ return ops->rfree ? ops->rfree(reset_ctl) : 0;
}
int reset_assert(struct reset_ctl *reset_ctl)
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
- return ops->rst_assert(reset_ctl);
+ return ops->rst_assert ? ops->rst_assert(reset_ctl) : 0;
}
int reset_assert_bulk(struct reset_ctl_bulk *bulk)
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
- return ops->rst_deassert(reset_ctl);
+ return ops->rst_deassert ? ops->rst_deassert(reset_ctl) : 0;
}
int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
- return ops->rst_status(reset_ctl);
+ return ops->rst_status ? ops->rst_status(reset_ctl) : 0;
}
int reset_release_all(struct reset_ctl *reset_ctl, int count)
const struct uniphier_reset_data *data;
};
-static int uniphier_reset_request(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
-static int uniphier_reset_free(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
static int uniphier_reset_update(struct reset_ctl *reset_ctl, int assert)
{
struct uniphier_reset_priv *priv = dev_get_priv(reset_ctl->dev);
}
static const struct reset_ops uniphier_reset_ops = {
- .request = uniphier_reset_request,
- .rfree = uniphier_reset_free,
.rst_assert = uniphier_reset_assert,
.rst_deassert = uniphier_reset_deassert,
};
return 0;
}
-static int zynqmp_reset_free(struct reset_ctl *rst)
-{
- struct zynqmp_reset_priv *priv = dev_get_priv(rst->dev);
-
- dev_dbg(rst->dev, "%s(rst=%p) (id=%lu) (nr_reset=%d)\n", __func__,
- rst, rst->id, priv->nr_reset);
-
- return 0;
-}
-
static int zynqmp_reset_probe(struct udevice *dev)
{
struct zynqmp_reset_priv *priv = dev_get_priv(dev);
const struct reset_ops zynqmp_reset_ops = {
.request = zynqmp_reset_request,
- .rfree = zynqmp_reset_free,
.rst_assert = zynqmp_reset_assert,
.rst_deassert = zynqmp_reset_deassert,
};
return 0;
}
-static int sti_reset_request(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
-static int sti_reset_free(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
static int sti_reset_assert(struct reset_ctl *reset_ctl)
{
return sti_reset_program_hw(reset_ctl, true);
}
struct reset_ops sti_reset_ops = {
- .request = sti_reset_request,
- .rfree = sti_reset_free,
.rst_assert = sti_reset_assert,
.rst_deassert = sti_reset_deassert,
};
fdt_addr_t base;
};
-static int stm32_reset_request(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
-static int stm32_reset_free(struct reset_ctl *reset_ctl)
-{
- return 0;
-}
-
static int stm32_reset_assert(struct reset_ctl *reset_ctl)
{
struct stm32_reset_priv *priv = dev_get_priv(reset_ctl->dev);
}
static const struct reset_ops stm32_reset_ops = {
- .request = stm32_reset_request,
- .rfree = stm32_reset_free,
.rst_assert = stm32_reset_assert,
.rst_deassert = stm32_reset_deassert,
};
return 0;
}
-static int tegra_car_reset_free(struct reset_ctl *reset_ctl)
-{
- debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
- reset_ctl->dev, reset_ctl->id);
-
- return 0;
-}
-
static int tegra_car_reset_assert(struct reset_ctl *reset_ctl)
{
debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
struct reset_ops tegra_car_reset_ops = {
.request = tegra_car_reset_request,
- .rfree = tegra_car_reset_free,
.rst_assert = tegra_car_reset_assert,
.rst_deassert = tegra_car_reset_deassert,
};
-static int tegra_car_reset_probe(struct udevice *dev)
-{
- debug("%s(dev=%p)\n", __func__, dev);
-
- return 0;
-}
-
U_BOOT_DRIVER(tegra_car_reset) = {
.name = "tegra_car_reset",
.id = UCLASS_RESET,
- .probe = tegra_car_reset_probe,
.ops = &tegra_car_reset_ops,
};
#include <reset-uclass.h>
#include <asm/arch-tegra/bpmp_abi.h>
-static int tegra186_reset_request(struct reset_ctl *reset_ctl)
-{
- debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
- reset_ctl->dev, reset_ctl->id);
-
- return 0;
-}
-
-static int tegra186_reset_free(struct reset_ctl *reset_ctl)
-{
- debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
- reset_ctl->dev, reset_ctl->id);
-
- return 0;
-}
-
static int tegra186_reset_common(struct reset_ctl *reset_ctl,
enum mrq_reset_commands cmd)
{
}
struct reset_ops tegra186_reset_ops = {
- .request = tegra186_reset_request,
- .rfree = tegra186_reset_free,
.rst_assert = tegra186_reset_assert,
.rst_deassert = tegra186_reset_deassert,
};
-static int tegra186_reset_probe(struct udevice *dev)
-{
- debug("%s(dev=%p)\n", __func__, dev);
-
- return 0;
-}
-
U_BOOT_DRIVER(tegra186_reset) = {
.name = "tegra186_reset",
.id = UCLASS_RESET,
- .probe = tegra186_reset_probe,
.ops = &tegra186_reset_ops,
};