Commit 990d4322 authored by Olof Johansson's avatar Olof Johansson

Merge tag 'tegra-for-5.2-soc' of...

Merge tag 'tegra-for-5.2-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into arm/drivers

soc/tegra: Changes for v5.2-rc1

Besides a couple of fixes to better cope with deferred probing, this set
of patches also implements the acquire/release protocol for resets used
during powergate operations. This is necessary to allow these resets to
be temporarily shared with other devices that may also need to control
these resets.

* tag 'tegra-for-5.2-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  soc/tegra: pmc: Move powergate initialisation to probe
  soc/tegra: pmc: Remove reset sysfs entries on error
  soc/tegra: pmc: Fix reset sources and levels
  soc/tegra: pmc: Implement acquire/release for resets
  reset: Add acquire/release support for arrays
  reset: Add acquired flag to of_reset_control_array_get()
  reset: add acquired/released state for exclusive reset controls
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents fea18882 6ac2a01d
This diff is collapsed.
...@@ -268,6 +268,14 @@ static const char * const tegra186_reset_levels[] = { ...@@ -268,6 +268,14 @@ static const char * const tegra186_reset_levels[] = {
}; };
static const char * const tegra30_reset_sources[] = { static const char * const tegra30_reset_sources[] = {
"POWER_ON_RESET",
"WATCHDOG",
"SENSOR",
"SW_MAIN",
"LP0"
};
static const char * const tegra210_reset_sources[] = {
"POWER_ON_RESET", "POWER_ON_RESET",
"WATCHDOG", "WATCHDOG",
"SENSOR", "SENSOR",
...@@ -656,10 +664,15 @@ static int tegra_genpd_power_on(struct generic_pm_domain *domain) ...@@ -656,10 +664,15 @@ static int tegra_genpd_power_on(struct generic_pm_domain *domain)
int err; int err;
err = tegra_powergate_power_up(pg, true); err = tegra_powergate_power_up(pg, true);
if (err) if (err) {
dev_err(dev, "failed to turn on PM domain %s: %d\n", dev_err(dev, "failed to turn on PM domain %s: %d\n",
pg->genpd.name, err); pg->genpd.name, err);
goto out;
}
reset_control_release(pg->reset);
out:
return err; return err;
} }
...@@ -669,10 +682,18 @@ static int tegra_genpd_power_off(struct generic_pm_domain *domain) ...@@ -669,10 +682,18 @@ static int tegra_genpd_power_off(struct generic_pm_domain *domain)
struct device *dev = pg->pmc->dev; struct device *dev = pg->pmc->dev;
int err; int err;
err = reset_control_acquire(pg->reset);
if (err < 0) {
pr_err("failed to acquire resets: %d\n", err);
return err;
}
err = tegra_powergate_power_down(pg); err = tegra_powergate_power_down(pg);
if (err) if (err) {
dev_err(dev, "failed to turn off PM domain %s: %d\n", dev_err(dev, "failed to turn off PM domain %s: %d\n",
pg->genpd.name, err); pg->genpd.name, err);
reset_control_release(pg->reset);
}
return err; return err;
} }
...@@ -937,38 +958,53 @@ static int tegra_powergate_of_get_resets(struct tegra_powergate *pg, ...@@ -937,38 +958,53 @@ static int tegra_powergate_of_get_resets(struct tegra_powergate *pg,
struct device *dev = pg->pmc->dev; struct device *dev = pg->pmc->dev;
int err; int err;
pg->reset = of_reset_control_array_get_exclusive(np); pg->reset = of_reset_control_array_get_exclusive_released(np);
if (IS_ERR(pg->reset)) { if (IS_ERR(pg->reset)) {
err = PTR_ERR(pg->reset); err = PTR_ERR(pg->reset);
dev_err(dev, "failed to get device resets: %d\n", err); dev_err(dev, "failed to get device resets: %d\n", err);
return err; return err;
} }
if (off) err = reset_control_acquire(pg->reset);
if (err < 0) {
pr_err("failed to acquire resets: %d\n", err);
goto out;
}
if (off) {
err = reset_control_assert(pg->reset); err = reset_control_assert(pg->reset);
else } else {
err = reset_control_deassert(pg->reset); err = reset_control_deassert(pg->reset);
if (err < 0)
goto out;
if (err) reset_control_release(pg->reset);
}
out:
if (err) {
reset_control_release(pg->reset);
reset_control_put(pg->reset); reset_control_put(pg->reset);
}
return err; return err;
} }
static void tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np) static int tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np)
{ {
struct device *dev = pmc->dev; struct device *dev = pmc->dev;
struct tegra_powergate *pg; struct tegra_powergate *pg;
int id, err; int id, err = 0;
bool off; bool off;
pg = kzalloc(sizeof(*pg), GFP_KERNEL); pg = kzalloc(sizeof(*pg), GFP_KERNEL);
if (!pg) if (!pg)
return; return -ENOMEM;
id = tegra_powergate_lookup(pmc, np->name); id = tegra_powergate_lookup(pmc, np->name);
if (id < 0) { if (id < 0) {
dev_err(dev, "powergate lookup failed for %pOFn: %d\n", np, id); dev_err(dev, "powergate lookup failed for %pOFn: %d\n", np, id);
err = -ENODEV;
goto free_mem; goto free_mem;
} }
...@@ -1021,7 +1057,7 @@ static void tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np) ...@@ -1021,7 +1057,7 @@ static void tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np)
dev_dbg(dev, "added PM domain %s\n", pg->genpd.name); dev_dbg(dev, "added PM domain %s\n", pg->genpd.name);
return; return 0;
remove_genpd: remove_genpd:
pm_genpd_remove(&pg->genpd); pm_genpd_remove(&pg->genpd);
...@@ -1040,25 +1076,67 @@ static void tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np) ...@@ -1040,25 +1076,67 @@ static void tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np)
free_mem: free_mem:
kfree(pg); kfree(pg);
return err;
} }
static void tegra_powergate_init(struct tegra_pmc *pmc, static int tegra_powergate_init(struct tegra_pmc *pmc,
struct device_node *parent) struct device_node *parent)
{ {
struct device_node *np, *child; struct device_node *np, *child;
unsigned int i; int err = 0;
np = of_get_child_by_name(parent, "powergates");
if (!np)
return 0;
for_each_child_of_node(np, child) {
err = tegra_powergate_add(pmc, child);
if (err < 0) {
of_node_put(child);
break;
}
}
of_node_put(np);
return err;
}
static void tegra_powergate_remove(struct generic_pm_domain *genpd)
{
struct tegra_powergate *pg = to_powergate(genpd);
reset_control_put(pg->reset);
while (pg->num_clks--)
clk_put(pg->clks[pg->num_clks]);
kfree(pg->clks);
/* Create a bitmap of the available and valid partitions */ set_bit(pg->id, pmc->powergates_available);
for (i = 0; i < pmc->soc->num_powergates; i++)
if (pmc->soc->powergates[i]) kfree(pg);
set_bit(i, pmc->powergates_available); }
static void tegra_powergate_remove_all(struct device_node *parent)
{
struct generic_pm_domain *genpd;
struct device_node *np, *child;
np = of_get_child_by_name(parent, "powergates"); np = of_get_child_by_name(parent, "powergates");
if (!np) if (!np)
return; return;
for_each_child_of_node(np, child) for_each_child_of_node(np, child) {
tegra_powergate_add(pmc, child); of_genpd_del_provider(child);
genpd = of_genpd_remove_last(child);
if (IS_ERR(genpd))
continue;
tegra_powergate_remove(genpd);
}
of_node_put(np); of_node_put(np);
} }
...@@ -1709,13 +1787,16 @@ static int tegra_pmc_pinctrl_init(struct tegra_pmc *pmc) ...@@ -1709,13 +1787,16 @@ static int tegra_pmc_pinctrl_init(struct tegra_pmc *pmc)
static ssize_t reset_reason_show(struct device *dev, static ssize_t reset_reason_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
u32 value, rst_src; u32 value;
value = tegra_pmc_readl(pmc, pmc->soc->regs->rst_status); value = tegra_pmc_readl(pmc, pmc->soc->regs->rst_status);
rst_src = (value & pmc->soc->regs->rst_source_mask) >> value &= pmc->soc->regs->rst_source_mask;
pmc->soc->regs->rst_source_shift; value >>= pmc->soc->regs->rst_source_shift;
if (WARN_ON(value >= pmc->soc->num_reset_sources))
return sprintf(buf, "%s\n", "UNKNOWN");
return sprintf(buf, "%s\n", pmc->soc->reset_sources[rst_src]); return sprintf(buf, "%s\n", pmc->soc->reset_sources[value]);
} }
static DEVICE_ATTR_RO(reset_reason); static DEVICE_ATTR_RO(reset_reason);
...@@ -1723,13 +1804,16 @@ static DEVICE_ATTR_RO(reset_reason); ...@@ -1723,13 +1804,16 @@ static DEVICE_ATTR_RO(reset_reason);
static ssize_t reset_level_show(struct device *dev, static ssize_t reset_level_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
u32 value, rst_lvl; u32 value;
value = tegra_pmc_readl(pmc, pmc->soc->regs->rst_status); value = tegra_pmc_readl(pmc, pmc->soc->regs->rst_status);
rst_lvl = (value & pmc->soc->regs->rst_level_mask) >> value &= pmc->soc->regs->rst_level_mask;
pmc->soc->regs->rst_level_shift; value >>= pmc->soc->regs->rst_level_shift;
return sprintf(buf, "%s\n", pmc->soc->reset_levels[rst_lvl]); if (WARN_ON(value >= pmc->soc->num_reset_levels))
return sprintf(buf, "%s\n", "UNKNOWN");
return sprintf(buf, "%s\n", pmc->soc->reset_levels[value]);
} }
static DEVICE_ATTR_RO(reset_level); static DEVICE_ATTR_RO(reset_level);
...@@ -1999,7 +2083,7 @@ static int tegra_pmc_probe(struct platform_device *pdev) ...@@ -1999,7 +2083,7 @@ static int tegra_pmc_probe(struct platform_device *pdev)
if (IS_ENABLED(CONFIG_DEBUG_FS)) { if (IS_ENABLED(CONFIG_DEBUG_FS)) {
err = tegra_powergate_debugfs_init(); err = tegra_powergate_debugfs_init();
if (err < 0) if (err < 0)
return err; goto cleanup_sysfs;
} }
err = register_restart_handler(&tegra_pmc_restart_handler); err = register_restart_handler(&tegra_pmc_restart_handler);
...@@ -2013,9 +2097,13 @@ static int tegra_pmc_probe(struct platform_device *pdev) ...@@ -2013,9 +2097,13 @@ static int tegra_pmc_probe(struct platform_device *pdev)
if (err) if (err)
goto cleanup_restart_handler; goto cleanup_restart_handler;
err = tegra_powergate_init(pmc, pdev->dev.of_node);
if (err < 0)
goto cleanup_powergates;
err = tegra_pmc_irq_init(pmc); err = tegra_pmc_irq_init(pmc);
if (err < 0) if (err < 0)
goto cleanup_restart_handler; goto cleanup_powergates;
mutex_lock(&pmc->powergates_lock); mutex_lock(&pmc->powergates_lock);
iounmap(pmc->base); iounmap(pmc->base);
...@@ -2026,10 +2114,15 @@ static int tegra_pmc_probe(struct platform_device *pdev) ...@@ -2026,10 +2114,15 @@ static int tegra_pmc_probe(struct platform_device *pdev)
return 0; return 0;
cleanup_powergates:
tegra_powergate_remove_all(pdev->dev.of_node);
cleanup_restart_handler: cleanup_restart_handler:
unregister_restart_handler(&tegra_pmc_restart_handler); unregister_restart_handler(&tegra_pmc_restart_handler);
cleanup_debugfs: cleanup_debugfs:
debugfs_remove(pmc->debugfs); debugfs_remove(pmc->debugfs);
cleanup_sysfs:
device_remove_file(&pdev->dev, &dev_attr_reset_reason);
device_remove_file(&pdev->dev, &dev_attr_reset_level);
return err; return err;
} }
...@@ -2185,7 +2278,7 @@ static const struct tegra_pmc_soc tegra30_pmc_soc = { ...@@ -2185,7 +2278,7 @@ static const struct tegra_pmc_soc tegra30_pmc_soc = {
.init = tegra20_pmc_init, .init = tegra20_pmc_init,
.setup_irq_polarity = tegra20_pmc_setup_irq_polarity, .setup_irq_polarity = tegra20_pmc_setup_irq_polarity,
.reset_sources = tegra30_reset_sources, .reset_sources = tegra30_reset_sources,
.num_reset_sources = 5, .num_reset_sources = ARRAY_SIZE(tegra30_reset_sources),
.reset_levels = NULL, .reset_levels = NULL,
.num_reset_levels = 0, .num_reset_levels = 0,
}; };
...@@ -2236,7 +2329,7 @@ static const struct tegra_pmc_soc tegra114_pmc_soc = { ...@@ -2236,7 +2329,7 @@ static const struct tegra_pmc_soc tegra114_pmc_soc = {
.init = tegra20_pmc_init, .init = tegra20_pmc_init,
.setup_irq_polarity = tegra20_pmc_setup_irq_polarity, .setup_irq_polarity = tegra20_pmc_setup_irq_polarity,
.reset_sources = tegra30_reset_sources, .reset_sources = tegra30_reset_sources,
.num_reset_sources = 5, .num_reset_sources = ARRAY_SIZE(tegra30_reset_sources),
.reset_levels = NULL, .reset_levels = NULL,
.num_reset_levels = 0, .num_reset_levels = 0,
}; };
...@@ -2347,7 +2440,7 @@ static const struct tegra_pmc_soc tegra124_pmc_soc = { ...@@ -2347,7 +2440,7 @@ static const struct tegra_pmc_soc tegra124_pmc_soc = {
.init = tegra20_pmc_init, .init = tegra20_pmc_init,
.setup_irq_polarity = tegra20_pmc_setup_irq_polarity, .setup_irq_polarity = tegra20_pmc_setup_irq_polarity,
.reset_sources = tegra30_reset_sources, .reset_sources = tegra30_reset_sources,
.num_reset_sources = 5, .num_reset_sources = ARRAY_SIZE(tegra30_reset_sources),
.reset_levels = NULL, .reset_levels = NULL,
.num_reset_levels = 0, .num_reset_levels = 0,
}; };
...@@ -2452,8 +2545,8 @@ static const struct tegra_pmc_soc tegra210_pmc_soc = { ...@@ -2452,8 +2545,8 @@ static const struct tegra_pmc_soc tegra210_pmc_soc = {
.regs = &tegra20_pmc_regs, .regs = &tegra20_pmc_regs,
.init = tegra20_pmc_init, .init = tegra20_pmc_init,
.setup_irq_polarity = tegra20_pmc_setup_irq_polarity, .setup_irq_polarity = tegra20_pmc_setup_irq_polarity,
.reset_sources = tegra30_reset_sources, .reset_sources = tegra210_reset_sources,
.num_reset_sources = 5, .num_reset_sources = ARRAY_SIZE(tegra210_reset_sources),
.reset_levels = NULL, .reset_levels = NULL,
.num_reset_levels = 0, .num_reset_levels = 0,
}; };
...@@ -2578,9 +2671,9 @@ static const struct tegra_pmc_soc tegra186_pmc_soc = { ...@@ -2578,9 +2671,9 @@ static const struct tegra_pmc_soc tegra186_pmc_soc = {
.init = NULL, .init = NULL,
.setup_irq_polarity = tegra186_pmc_setup_irq_polarity, .setup_irq_polarity = tegra186_pmc_setup_irq_polarity,
.reset_sources = tegra186_reset_sources, .reset_sources = tegra186_reset_sources,
.num_reset_sources = 14, .num_reset_sources = ARRAY_SIZE(tegra186_reset_sources),
.reset_levels = tegra186_reset_levels, .reset_levels = tegra186_reset_levels,
.num_reset_levels = 3, .num_reset_levels = ARRAY_SIZE(tegra186_reset_levels),
.num_wake_events = ARRAY_SIZE(tegra186_wake_events), .num_wake_events = ARRAY_SIZE(tegra186_wake_events),
.wake_events = tegra186_wake_events, .wake_events = tegra186_wake_events,
}; };
...@@ -2719,6 +2812,7 @@ static int __init tegra_pmc_early_init(void) ...@@ -2719,6 +2812,7 @@ static int __init tegra_pmc_early_init(void)
const struct of_device_id *match; const struct of_device_id *match;
struct device_node *np; struct device_node *np;
struct resource regs; struct resource regs;
unsigned int i;
bool invert; bool invert;
mutex_init(&pmc->powergates_lock); mutex_init(&pmc->powergates_lock);
...@@ -2775,7 +2869,10 @@ static int __init tegra_pmc_early_init(void) ...@@ -2775,7 +2869,10 @@ static int __init tegra_pmc_early_init(void)
if (pmc->soc->maybe_tz_only) if (pmc->soc->maybe_tz_only)
pmc->tz_only = tegra_pmc_detect_tz_only(pmc); pmc->tz_only = tegra_pmc_detect_tz_only(pmc);
tegra_powergate_init(pmc, np); /* Create a bitmap of the available and valid partitions */
for (i = 0; i < pmc->soc->num_powergates; i++)
if (pmc->soc->powergates[i])
set_bit(i, pmc->powergates_available);
/* /*
* Invert the interrupt polarity if a PMC device tree node * Invert the interrupt polarity if a PMC device tree node
......
...@@ -107,7 +107,8 @@ static int dwc3_of_simple_probe(struct platform_device *pdev) ...@@ -107,7 +107,8 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
simple->pulse_resets = true; simple->pulse_resets = true;
} }
simple->resets = of_reset_control_array_get(np, shared_resets, true); simple->resets = of_reset_control_array_get(np, shared_resets, true,
true);
if (IS_ERR(simple->resets)) { if (IS_ERR(simple->resets)) {
ret = PTR_ERR(simple->resets); ret = PTR_ERR(simple->resets);
dev_err(dev, "failed to get device resets, err=%d\n", ret); dev_err(dev, "failed to get device resets, err=%d\n", ret);
......
...@@ -14,23 +14,26 @@ int reset_control_reset(struct reset_control *rstc); ...@@ -14,23 +14,26 @@ int reset_control_reset(struct reset_control *rstc);
int reset_control_assert(struct reset_control *rstc); int reset_control_assert(struct reset_control *rstc);
int reset_control_deassert(struct reset_control *rstc); int reset_control_deassert(struct reset_control *rstc);
int reset_control_status(struct reset_control *rstc); int reset_control_status(struct reset_control *rstc);
int reset_control_acquire(struct reset_control *rstc);
void reset_control_release(struct reset_control *rstc);
struct reset_control *__of_reset_control_get(struct device_node *node, struct reset_control *__of_reset_control_get(struct device_node *node,
const char *id, int index, bool shared, const char *id, int index, bool shared,
bool optional); bool optional, bool acquired);
struct reset_control *__reset_control_get(struct device *dev, const char *id, struct reset_control *__reset_control_get(struct device *dev, const char *id,
int index, bool shared, int index, bool shared,
bool optional); bool optional, bool acquired);
void reset_control_put(struct reset_control *rstc); void reset_control_put(struct reset_control *rstc);
int __device_reset(struct device *dev, bool optional); int __device_reset(struct device *dev, bool optional);
struct reset_control *__devm_reset_control_get(struct device *dev, struct reset_control *__devm_reset_control_get(struct device *dev,
const char *id, int index, bool shared, const char *id, int index, bool shared,
bool optional); bool optional, bool acquired);
struct reset_control *devm_reset_control_array_get(struct device *dev, struct reset_control *devm_reset_control_array_get(struct device *dev,
bool shared, bool optional); bool shared, bool optional);
struct reset_control *of_reset_control_array_get(struct device_node *np, struct reset_control *of_reset_control_array_get(struct device_node *np,
bool shared, bool optional); bool shared, bool optional,
bool acquired);
int reset_control_get_count(struct device *dev); int reset_control_get_count(struct device *dev);
...@@ -56,6 +59,15 @@ static inline int reset_control_status(struct reset_control *rstc) ...@@ -56,6 +59,15 @@ static inline int reset_control_status(struct reset_control *rstc)
return 0; return 0;
} }
static inline int reset_control_acquire(struct reset_control *rstc)
{
return 0;
}
static inline void reset_control_release(struct reset_control *rstc)
{
}
static inline void reset_control_put(struct reset_control *rstc) static inline void reset_control_put(struct reset_control *rstc)
{ {
} }
...@@ -68,21 +80,23 @@ static inline int __device_reset(struct device *dev, bool optional) ...@@ -68,21 +80,23 @@ static inline int __device_reset(struct device *dev, bool optional)
static inline struct reset_control *__of_reset_control_get( static inline struct reset_control *__of_reset_control_get(
struct device_node *node, struct device_node *node,
const char *id, int index, bool shared, const char *id, int index, bool shared,
bool optional) bool optional, bool acquired)
{ {
return optional ? NULL : ERR_PTR(-ENOTSUPP); return optional ? NULL : ERR_PTR(-ENOTSUPP);
} }
static inline struct reset_control *__reset_control_get( static inline struct reset_control *__reset_control_get(
struct device *dev, const char *id, struct device *dev, const char *id,
int index, bool shared, bool optional) int index, bool shared, bool optional,
bool acquired)
{ {
return optional ? NULL : ERR_PTR(-ENOTSUPP); return optional ? NULL : ERR_PTR(-ENOTSUPP);
} }
static inline struct reset_control *__devm_reset_control_get( static inline struct reset_control *__devm_reset_control_get(
struct device *dev, const char *id, struct device *dev, const char *id,
int index, bool shared, bool optional) int index, bool shared, bool optional,
bool acquired)
{ {
return optional ? NULL : ERR_PTR(-ENOTSUPP); return optional ? NULL : ERR_PTR(-ENOTSUPP);
} }
...@@ -94,7 +108,8 @@ devm_reset_control_array_get(struct device *dev, bool shared, bool optional) ...@@ -94,7 +108,8 @@ devm_reset_control_array_get(struct device *dev, bool shared, bool optional)
} }
static inline struct reset_control * static inline struct reset_control *
of_reset_control_array_get(struct device_node *np, bool shared, bool optional) of_reset_control_array_get(struct device_node *np, bool shared, bool optional,
bool acquired)
{ {
return optional ? NULL : ERR_PTR(-ENOTSUPP); return optional ? NULL : ERR_PTR(-ENOTSUPP);
} }
...@@ -134,7 +149,28 @@ static inline int device_reset_optional(struct device *dev) ...@@ -134,7 +149,28 @@ static inline int device_reset_optional(struct device *dev)
static inline struct reset_control * static inline struct reset_control *
__must_check reset_control_get_exclusive(struct device *dev, const char *id) __must_check reset_control_get_exclusive(struct device *dev, const char *id)
{ {
return __reset_control_get(dev, id, 0, false, false); return __reset_control_get(dev, id, 0, false, false, true);
}
/**
* reset_control_get_exclusive_released - Lookup and obtain a temoprarily
* exclusive reference to a reset
* controller.
* @dev: device to be reset by the controller
* @id: reset line name
*
* Returns a struct reset_control or IS_ERR() condition containing errno.
* reset-controls returned by this function must be acquired via
* reset_control_acquire() before they can be used and should be released
* via reset_control_release() afterwards.
*
* Use of id names is optional.
*/
static inline struct reset_control *
__must_check reset_control_get_exclusive_released(struct device *dev,
const char *id)
{
return __reset_control_get(dev, id, 0, false, false, false);
} }
/** /**
...@@ -162,19 +198,19 @@ __must_check reset_control_get_exclusive(struct device *dev, const char *id) ...@@ -162,19 +198,19 @@ __must_check reset_control_get_exclusive(struct device *dev, const char *id)
static inline struct reset_control *reset_control_get_shared( static inline struct reset_control *reset_control_get_shared(
struct device *dev, const char *id) struct device *dev, const char *id)
{ {
return __reset_control_get(dev, id, 0, true, false); return __reset_control_get(dev, id, 0, true, false, false);
} }
static inline struct reset_control *reset_control_get_optional_exclusive( static inline struct reset_control *reset_control_get_optional_exclusive(
struct device *dev, const char *id) struct device *dev, const char *id)
{ {
return __reset_control_get(dev, id, 0, false, true); return __reset_control_get(dev, id, 0, false, true, true);
} }
static inline struct reset_control *reset_control_get_optional_shared( static inline struct reset_control *reset_control_get_optional_shared(
struct device *dev, const char *id) struct device *dev, const char *id)
{ {
return __reset_control_get(dev, id, 0, true, true); return __reset_control_get(dev, id, 0, true, true, false);
} }
/** /**
...@@ -190,7 +226,7 @@ static inline struct reset_control *reset_control_get_optional_shared( ...@@ -190,7 +226,7 @@ static inline struct reset_control *reset_control_get_optional_shared(
static inline struct reset_control *of_reset_control_get_exclusive( static inline struct reset_control *of_reset_control_get_exclusive(
struct device_node *node, const char *id) struct device_node *node, const char *id)
{ {
return __of_reset_control_get(node, id, 0, false, false); return __of_reset_control_get(node, id, 0, false, false, true);
} }
/** /**
...@@ -215,7 +251,7 @@ static inline struct reset_control *of_reset_control_get_exclusive( ...@@ -215,7 +251,7 @@ static inline struct reset_control *of_reset_control_get_exclusive(
static inline struct reset_control *of_reset_control_get_shared( static inline struct reset_control *of_reset_control_get_shared(
struct device_node *node, const char *id) struct device_node *node, const char *id)
{ {
return __of_reset_control_get(node, id, 0, true, false); return __of_reset_control_get(node, id, 0, true, false, false);
} }
/** /**
...@@ -232,7 +268,7 @@ static inline struct reset_control *of_reset_control_get_shared( ...@@ -232,7 +268,7 @@ static inline struct reset_control *of_reset_control_get_shared(
static inline struct reset_control *of_reset_control_get_exclusive_by_index( static inline struct reset_control *of_reset_control_get_exclusive_by_index(
struct device_node *node, int index) struct device_node *node, int index)
{ {
return __of_reset_control_get(node, NULL, index, false, false); return __of_reset_control_get(node, NULL, index, false, false, true);
} }
/** /**
...@@ -260,7 +296,7 @@ static inline struct reset_control *of_reset_control_get_exclusive_by_index( ...@@ -260,7 +296,7 @@ static inline struct reset_control *of_reset_control_get_exclusive_by_index(
static inline struct reset_control *of_reset_control_get_shared_by_index( static inline struct reset_control *of_reset_control_get_shared_by_index(
struct device_node *node, int index) struct device_node *node, int index)
{ {
return __of_reset_control_get(node, NULL, index, true, false); return __of_reset_control_get(node, NULL, index, true, false, false);
} }
/** /**
...@@ -279,7 +315,26 @@ static inline struct reset_control * ...@@ -279,7 +315,26 @@ static inline struct reset_control *
__must_check devm_reset_control_get_exclusive(struct device *dev, __must_check devm_reset_control_get_exclusive(struct device *dev,
const char *id) const char *id)
{ {
return __devm_reset_control_get(dev, id, 0, false, false); return __devm_reset_control_get(dev, id, 0, false, false, true);
}
/**
* devm_reset_control_get_exclusive_released - resource managed
* reset_control_get_exclusive_released()
* @dev: device to be reset by the controller
* @id: reset line name
*
* Managed reset_control_get_exclusive_released(). For reset controllers
* returned from this function, reset_control_put() is called automatically on
* driver detach.
*
* See reset_control_get_exclusive_released() for more information.
*/
static inline struct reset_control *
__must_check devm_reset_control_get_exclusive_released(struct device *dev,
const char *id)
{
return __devm_reset_control_get(dev, id, 0, false, false, false);
} }
/** /**
...@@ -294,19 +349,19 @@ __must_check devm_reset_control_get_exclusive(struct device *dev, ...@@ -294,19 +349,19 @@ __must_check devm_reset_control_get_exclusive(struct device *dev,
static inline struct reset_control *devm_reset_control_get_shared( static inline struct reset_control *devm_reset_control_get_shared(
struct device *dev, const char *id) struct device *dev, const char *id)
{ {
return __devm_reset_control_get(dev, id, 0, true, false); return __devm_reset_control_get(dev, id, 0, true, false, false);
} }
static inline struct reset_control *devm_reset_control_get_optional_exclusive( static inline struct reset_control *devm_reset_control_get_optional_exclusive(
struct device *dev, const char *id) struct device *dev, const char *id)
{ {
return __devm_reset_control_get(dev, id, 0, false, true); return __devm_reset_control_get(dev, id, 0, false, true, true);
} }
static inline struct reset_control *devm_reset_control_get_optional_shared( static inline struct reset_control *devm_reset_control_get_optional_shared(
struct device *dev, const char *id) struct device *dev, const char *id)
{ {
return __devm_reset_control_get(dev, id, 0, true, true); return __devm_reset_control_get(dev, id, 0, true, true, false);
} }
/** /**
...@@ -324,7 +379,7 @@ static inline struct reset_control *devm_reset_control_get_optional_shared( ...@@ -324,7 +379,7 @@ static inline struct reset_control *devm_reset_control_get_optional_shared(
static inline struct reset_control * static inline struct reset_control *
devm_reset_control_get_exclusive_by_index(struct device *dev, int index) devm_reset_control_get_exclusive_by_index(struct device *dev, int index)
{ {
return __devm_reset_control_get(dev, NULL, index, false, false); return __devm_reset_control_get(dev, NULL, index, false, false, true);
} }
/** /**
...@@ -340,7 +395,7 @@ devm_reset_control_get_exclusive_by_index(struct device *dev, int index) ...@@ -340,7 +395,7 @@ devm_reset_control_get_exclusive_by_index(struct device *dev, int index)
static inline struct reset_control * static inline struct reset_control *
devm_reset_control_get_shared_by_index(struct device *dev, int index) devm_reset_control_get_shared_by_index(struct device *dev, int index)
{ {
return __devm_reset_control_get(dev, NULL, index, true, false); return __devm_reset_control_get(dev, NULL, index, true, false, false);
} }
/* /*
...@@ -412,24 +467,30 @@ devm_reset_control_array_get_optional_shared(struct device *dev) ...@@ -412,24 +467,30 @@ devm_reset_control_array_get_optional_shared(struct device *dev)
static inline struct reset_control * static inline struct reset_control *
of_reset_control_array_get_exclusive(struct device_node *node) of_reset_control_array_get_exclusive(struct device_node *node)
{ {
return of_reset_control_array_get(node, false, false); return of_reset_control_array_get(node, false, false, true);
}
static inline struct reset_control *
of_reset_control_array_get_exclusive_released(struct device_node *node)
{
return of_reset_control_array_get(node, false, false, false);
} }
static inline struct reset_control * static inline struct reset_control *
of_reset_control_array_get_shared(struct device_node *node) of_reset_control_array_get_shared(struct device_node *node)
{ {
return of_reset_control_array_get(node, true, false); return of_reset_control_array_get(node, true, false, true);
} }
static inline struct reset_control * static inline struct reset_control *
of_reset_control_array_get_optional_exclusive(struct device_node *node) of_reset_control_array_get_optional_exclusive(struct device_node *node)
{ {
return of_reset_control_array_get(node, false, true); return of_reset_control_array_get(node, false, true, true);
} }
static inline struct reset_control * static inline struct reset_control *
of_reset_control_array_get_optional_shared(struct device_node *node) of_reset_control_array_get_optional_shared(struct device_node *node)
{ {
return of_reset_control_array_get(node, true, true); return of_reset_control_array_get(node, true, true, true);
} }
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment