mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-13 20:36:02 +01:00
power-domain: Return 0 if ops unimplemented and remove empty functions
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 power domain driver. Drop all those empty functions. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
85d0580e68
commit
20874a6072
@ -42,16 +42,6 @@ static int apple_reset_of_xlate(struct reset_ctl *reset_ctl,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int apple_reset_request(struct reset_ctl *reset_ctl)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int apple_reset_free(struct reset_ctl *reset_ctl)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int apple_reset_assert(struct reset_ctl *reset_ctl)
|
||||
{
|
||||
struct apple_pmgr_priv *priv = dev_get_priv(reset_ctl->dev->parent);
|
||||
@ -80,8 +70,6 @@ static int apple_reset_deassert(struct reset_ctl *reset_ctl)
|
||||
|
||||
struct reset_ops apple_reset_ops = {
|
||||
.of_xlate = apple_reset_of_xlate,
|
||||
.request = apple_reset_request,
|
||||
.rfree = apple_reset_free,
|
||||
.rst_assert = apple_reset_assert,
|
||||
.rst_deassert = apple_reset_deassert,
|
||||
};
|
||||
@ -92,16 +80,6 @@ static struct driver apple_reset_driver = {
|
||||
.ops = &apple_reset_ops,
|
||||
};
|
||||
|
||||
static int apple_pmgr_request(struct power_domain *power_domain)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int apple_pmgr_rfree(struct power_domain *power_domain)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int apple_pmgr_ps_set(struct power_domain *power_domain, u32 pstate)
|
||||
{
|
||||
struct apple_pmgr_priv *priv = dev_get_priv(power_domain->dev);
|
||||
@ -121,11 +99,6 @@ static int apple_pmgr_on(struct power_domain *power_domain)
|
||||
return apple_pmgr_ps_set(power_domain, APPLE_PMGR_PS_ACTIVE);
|
||||
}
|
||||
|
||||
static int apple_pmgr_off(struct power_domain *power_domain)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int apple_pmgr_of_xlate(struct power_domain *power_domain,
|
||||
struct ofnode_phandle_args *args)
|
||||
{
|
||||
@ -167,10 +140,7 @@ static int apple_pmgr_probe(struct udevice *dev)
|
||||
}
|
||||
|
||||
struct power_domain_ops apple_pmgr_ops = {
|
||||
.request = apple_pmgr_request,
|
||||
.rfree = apple_pmgr_rfree,
|
||||
.on = apple_pmgr_on,
|
||||
.off = apple_pmgr_off,
|
||||
.of_xlate = apple_pmgr_of_xlate,
|
||||
};
|
||||
|
||||
|
@ -24,11 +24,6 @@ static int bcm6328_power_domain_request(struct power_domain *power_domain)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm6328_power_domain_free(struct power_domain *power_domain)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm6328_power_domain_on(struct power_domain *power_domain)
|
||||
{
|
||||
struct bcm6328_power_domain *priv = dev_get_priv(power_domain->dev);
|
||||
@ -64,7 +59,6 @@ static const struct udevice_id bcm6328_power_domain_ids[] = {
|
||||
};
|
||||
|
||||
struct power_domain_ops bcm6328_power_domain_ops = {
|
||||
.rfree = bcm6328_power_domain_free,
|
||||
.off = bcm6328_power_domain_off,
|
||||
.on = bcm6328_power_domain_on,
|
||||
.request = bcm6328_power_domain_request,
|
||||
|
@ -84,20 +84,6 @@ int imx8_power_domain_lookup_name(const char *name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int imx8_power_domain_request(struct power_domain *power_domain)
|
||||
{
|
||||
debug("%s(power_domain=%p)\n", __func__, power_domain);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int imx8_power_domain_free(struct power_domain *power_domain)
|
||||
{
|
||||
debug("%s(power_domain=%p)\n", __func__, power_domain);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int imx8_power_domain_on(struct power_domain *power_domain)
|
||||
{
|
||||
struct udevice *dev = power_domain->dev;
|
||||
@ -364,8 +350,6 @@ static const struct udevice_id imx8_power_domain_ids[] = {
|
||||
};
|
||||
|
||||
struct power_domain_ops imx8_power_domain_ops = {
|
||||
.request = imx8_power_domain_request,
|
||||
.rfree = imx8_power_domain_free,
|
||||
.on = imx8_power_domain_on,
|
||||
.off = imx8_power_domain_off,
|
||||
.of_xlate = imx8_power_domain_of_xlate,
|
||||
|
@ -12,20 +12,6 @@
|
||||
#include <asm/arch/power-domain.h>
|
||||
#include <asm/arch/sci/sci.h>
|
||||
|
||||
static int imx8_power_domain_request(struct power_domain *power_domain)
|
||||
{
|
||||
debug("%s(power_domain=%p)\n", __func__, power_domain);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int imx8_power_domain_free(struct power_domain *power_domain)
|
||||
{
|
||||
debug("%s(power_domain=%p)\n", __func__, power_domain);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int imx8_power_domain_on(struct power_domain *power_domain)
|
||||
{
|
||||
u32 resource_id = power_domain->id;
|
||||
@ -60,13 +46,6 @@ static int imx8_power_domain_off(struct power_domain *power_domain)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int imx8_power_domain_probe(struct udevice *dev)
|
||||
{
|
||||
debug("%s(dev=%s)\n", __func__, dev->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct udevice_id imx8_power_domain_ids[] = {
|
||||
{ .compatible = "fsl,imx8qxp-scu-pd" },
|
||||
{ .compatible = "fsl,scu-pd" },
|
||||
@ -74,8 +53,6 @@ static const struct udevice_id imx8_power_domain_ids[] = {
|
||||
};
|
||||
|
||||
struct power_domain_ops imx8_power_domain_ops_v2 = {
|
||||
.request = imx8_power_domain_request,
|
||||
.rfree = imx8_power_domain_free,
|
||||
.on = imx8_power_domain_on,
|
||||
.off = imx8_power_domain_off,
|
||||
};
|
||||
@ -84,6 +61,5 @@ U_BOOT_DRIVER(imx8_power_domain_v2) = {
|
||||
.name = "imx8_power_domain_v2",
|
||||
.id = UCLASS_POWER_DOMAIN,
|
||||
.of_match = imx8_power_domain_ids,
|
||||
.probe = imx8_power_domain_probe,
|
||||
.ops = &imx8_power_domain_ops_v2,
|
||||
};
|
||||
|
@ -18,16 +18,6 @@
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static int imx8m_power_domain_request(struct power_domain *power_domain)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int imx8m_power_domain_free(struct power_domain *power_domain)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int imx8m_power_domain_on(struct power_domain *power_domain)
|
||||
{
|
||||
struct udevice *dev = power_domain->dev;
|
||||
@ -100,11 +90,6 @@ static int imx8m_power_domain_bind(struct udevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int imx8m_power_domain_probe(struct udevice *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int imx8m_power_domain_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
struct imx8m_power_domain_plat *pdata = dev_get_plat(dev);
|
||||
@ -126,8 +111,6 @@ static const struct udevice_id imx8m_power_domain_ids[] = {
|
||||
};
|
||||
|
||||
struct power_domain_ops imx8m_power_domain_ops = {
|
||||
.request = imx8m_power_domain_request,
|
||||
.rfree = imx8m_power_domain_free,
|
||||
.on = imx8m_power_domain_on,
|
||||
.off = imx8m_power_domain_off,
|
||||
.of_xlate = imx8m_power_domain_of_xlate,
|
||||
@ -138,7 +121,6 @@ U_BOOT_DRIVER(imx8m_power_domain) = {
|
||||
.id = UCLASS_POWER_DOMAIN,
|
||||
.of_match = imx8m_power_domain_ids,
|
||||
.bind = imx8m_power_domain_bind,
|
||||
.probe = imx8m_power_domain_probe,
|
||||
.of_to_plat = imx8m_power_domain_of_to_plat,
|
||||
.plat_auto = sizeof(struct imx8m_power_domain_plat),
|
||||
.ops = &imx8m_power_domain_ops,
|
||||
|
@ -273,16 +273,6 @@ static bool pwrc_ee_get_power(struct power_domain *power_domain)
|
||||
return (reg & pwrc_domain->top_pd->sleep_mask);
|
||||
}
|
||||
|
||||
static int meson_ee_pwrc_request(struct power_domain *power_domain)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int meson_ee_pwrc_free(struct power_domain *power_domain)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int meson_ee_pwrc_off(struct power_domain *power_domain)
|
||||
{
|
||||
struct meson_ee_pwrc_priv *priv = dev_get_priv(power_domain->dev);
|
||||
@ -387,10 +377,8 @@ static int meson_ee_pwrc_of_xlate(struct power_domain *power_domain,
|
||||
}
|
||||
|
||||
struct power_domain_ops meson_ee_pwrc_ops = {
|
||||
.rfree = meson_ee_pwrc_free,
|
||||
.off = meson_ee_pwrc_off,
|
||||
.on = meson_ee_pwrc_on,
|
||||
.request = meson_ee_pwrc_request,
|
||||
.of_xlate = meson_ee_pwrc_of_xlate,
|
||||
};
|
||||
|
||||
|
@ -45,16 +45,6 @@ struct meson_gx_pwrc_vpu_priv {
|
||||
struct clk_bulk clks;
|
||||
};
|
||||
|
||||
static int meson_pwrc_vpu_request(struct power_domain *power_domain)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int meson_pwrc_vpu_free(struct power_domain *power_domain)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int meson_gx_pwrc_vpu_on(struct power_domain *power_domain)
|
||||
{
|
||||
struct meson_gx_pwrc_vpu_priv *priv = dev_get_priv(power_domain->dev);
|
||||
@ -274,10 +264,8 @@ static int meson_pwrc_vpu_of_xlate(struct power_domain *power_domain,
|
||||
}
|
||||
|
||||
struct power_domain_ops meson_gx_pwrc_vpu_ops = {
|
||||
.rfree = meson_pwrc_vpu_free,
|
||||
.off = meson_pwrc_vpu_off,
|
||||
.on = meson_pwrc_vpu_on,
|
||||
.request = meson_pwrc_vpu_request,
|
||||
.of_xlate = meson_pwrc_vpu_of_xlate,
|
||||
};
|
||||
|
||||
|
@ -317,11 +317,6 @@ static int scpsys_power_request(struct power_domain *power_domain)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int scpsys_power_free(struct power_domain *power_domain)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mtk_power_domain_hook(struct udevice *dev)
|
||||
{
|
||||
struct scp_domain *scpd = dev_get_priv(dev);
|
||||
@ -399,7 +394,6 @@ static const struct udevice_id mtk_power_domain_ids[] = {
|
||||
};
|
||||
|
||||
struct power_domain_ops mtk_power_domain_ops = {
|
||||
.rfree = scpsys_power_free,
|
||||
.off = scpsys_power_off,
|
||||
.on = scpsys_power_on,
|
||||
.request = scpsys_power_request,
|
||||
|
@ -71,7 +71,7 @@ int power_domain_get_by_index(struct udevice *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ops->request(power_domain);
|
||||
ret = ops->request ? ops->request(power_domain) : 0;
|
||||
if (ret) {
|
||||
debug("ops->request() failed: %d\n", ret);
|
||||
return ret;
|
||||
@ -91,7 +91,7 @@ int power_domain_free(struct power_domain *power_domain)
|
||||
|
||||
debug("%s(power_domain=%p)\n", __func__, power_domain);
|
||||
|
||||
return ops->rfree(power_domain);
|
||||
return ops->rfree ? ops->rfree(power_domain) : 0;
|
||||
}
|
||||
|
||||
int power_domain_on(struct power_domain *power_domain)
|
||||
@ -100,7 +100,7 @@ int power_domain_on(struct power_domain *power_domain)
|
||||
|
||||
debug("%s(power_domain=%p)\n", __func__, power_domain);
|
||||
|
||||
return ops->on(power_domain);
|
||||
return ops->on ? ops->on(power_domain) : 0;
|
||||
}
|
||||
|
||||
int power_domain_off(struct power_domain *power_domain)
|
||||
@ -109,7 +109,7 @@ int power_domain_off(struct power_domain *power_domain)
|
||||
|
||||
debug("%s(power_domain=%p)\n", __func__, power_domain);
|
||||
|
||||
return ops->off(power_domain);
|
||||
return ops->off ? ops->off(power_domain) : 0;
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
|
@ -15,22 +15,6 @@
|
||||
#define UPDATE BIT(0)
|
||||
#define ON BIT(1)
|
||||
|
||||
static int tegra186_power_domain_request(struct power_domain *power_domain)
|
||||
{
|
||||
debug("%s(power_domain=%p) (dev=%p, id=%lu)\n", __func__,
|
||||
power_domain, power_domain->dev, power_domain->id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tegra186_power_domain_free(struct power_domain *power_domain)
|
||||
{
|
||||
debug("%s(power_domain=%p) (dev=%p, id=%lu)\n", __func__,
|
||||
power_domain, power_domain->dev, power_domain->id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tegra186_power_domain_common(struct power_domain *power_domain,
|
||||
bool on)
|
||||
{
|
||||
@ -73,22 +57,12 @@ static int tegra186_power_domain_off(struct power_domain *power_domain)
|
||||
}
|
||||
|
||||
struct power_domain_ops tegra186_power_domain_ops = {
|
||||
.request = tegra186_power_domain_request,
|
||||
.rfree = tegra186_power_domain_free,
|
||||
.on = tegra186_power_domain_on,
|
||||
.off = tegra186_power_domain_off,
|
||||
};
|
||||
|
||||
static int tegra186_power_domain_probe(struct udevice *dev)
|
||||
{
|
||||
debug("%s(dev=%p)\n", __func__, dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
U_BOOT_DRIVER(tegra186_power_domain) = {
|
||||
.name = "tegra186_power_domain",
|
||||
.id = UCLASS_POWER_DOMAIN,
|
||||
.probe = tegra186_power_domain_probe,
|
||||
.ops = &tegra186_power_domain_ops,
|
||||
};
|
||||
|
@ -356,17 +356,6 @@ static int ti_power_domain_of_xlate(struct power_domain *pd,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ti_power_domain_request(struct power_domain *pd)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ti_power_domain_free(struct power_domain *pd)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct udevice_id ti_power_domain_of_match[] = {
|
||||
{ .compatible = "ti,sci-pm-domain" },
|
||||
{ /* sentinel */ }
|
||||
@ -376,8 +365,6 @@ static struct power_domain_ops ti_power_domain_ops = {
|
||||
.on = ti_power_domain_on,
|
||||
.off = ti_power_domain_off,
|
||||
.of_xlate = ti_power_domain_of_xlate,
|
||||
.request = ti_power_domain_request,
|
||||
.rfree = ti_power_domain_free,
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(ti_pm_domains) = {
|
||||
|
@ -44,18 +44,6 @@ static int ti_sci_power_domain_probe(struct udevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ti_sci_power_domain_request(struct power_domain *pd)
|
||||
{
|
||||
debug("%s(pd=%p)\n", __func__, pd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ti_sci_power_domain_free(struct power_domain *pd)
|
||||
{
|
||||
debug("%s(pd=%p)\n", __func__, pd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ti_sci_power_domain_on(struct power_domain *pd)
|
||||
{
|
||||
struct ti_sci_power_domain_data *data = dev_get_priv(pd->dev);
|
||||
@ -123,8 +111,6 @@ static const struct udevice_id ti_sci_power_domain_of_match[] = {
|
||||
};
|
||||
|
||||
static struct power_domain_ops ti_sci_power_domain_ops = {
|
||||
.request = ti_sci_power_domain_request,
|
||||
.rfree = ti_sci_power_domain_free,
|
||||
.on = ti_sci_power_domain_on,
|
||||
.off = ti_sci_power_domain_off,
|
||||
.of_xlate = ti_sci_power_domain_of_xlate,
|
||||
|
Loading…
x
Reference in New Issue
Block a user