Commit bf3176b3 authored by Arnd Bergmann's avatar Arnd Bergmann

Merge tag 'omap-for-v5.4/ti-sysc-signed' of...

Merge tag 'omap-for-v5.4/ti-sysc-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into arm/late

Driver changes for ti-sysc for v5.4

Few changes to prepare for using a reset driver for PRM rstctrl mostly
to deal with the clocks for reset. Then few minor clean-up patches and
SPDX license identifier changes, and add a MAINTAINERs file entry.

* tag 'omap-for-v5.4/ti-sysc-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  bus: ti-sysc: remove set but not used variable 'quirks'
  bus: ti-sysc: allow reset sharing across devices
  bus: ti-sysc: rework the reset handling
  bus: ti-sysc: re-order the clkdm control around reset handling
  bus: ti-sysc: Add missing kerneldoc comments
  bus: ti-sysc: Switch to SPDX license identifier
  dt-bindings: ti-sysc: Add SPDX license identifier
  MAINTAINERS: Add ti-sysc files under the OMAP2+ entry

Link: https://lore.kernel.org/r/pull-1566599057-142651@atomide.comSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents 089cf7f6 c8a738f4
...@@ -11786,6 +11786,7 @@ S: Maintained ...@@ -11786,6 +11786,7 @@ S: Maintained
F: arch/arm/mach-omap2/ F: arch/arm/mach-omap2/
F: arch/arm/plat-omap/ F: arch/arm/plat-omap/
F: arch/arm/configs/omap2plus_defconfig F: arch/arm/configs/omap2plus_defconfig
F: drivers/bus/ti-sysc.c
F: drivers/i2c/busses/i2c-omap.c F: drivers/i2c/busses/i2c-omap.c
F: drivers/irqchip/irq-omap-intc.c F: drivers/irqchip/irq-omap-intc.c
F: drivers/mfd/*omap*.c F: drivers/mfd/*omap*.c
...@@ -11806,6 +11807,7 @@ F: drivers/regulator/tps65910-regulator.c ...@@ -11806,6 +11807,7 @@ F: drivers/regulator/tps65910-regulator.c
F: drivers/regulator/twl-regulator.c F: drivers/regulator/twl-regulator.c
F: drivers/regulator/twl6030-regulator.c F: drivers/regulator/twl6030-regulator.c
F: include/linux/platform_data/i2c-omap.h F: include/linux/platform_data/i2c-omap.h
F: include/linux/platform_data/ti-sysc.h
ONION OMEGA2+ BOARD ONION OMEGA2+ BOARD
M: Harvey Hunt <harveyhuntnexus@gmail.com> M: Harvey Hunt <harveyhuntnexus@gmail.com>
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* ti-sysc.c - Texas Instruments sysc interconnect target driver * ti-sysc.c - Texas Instruments sysc interconnect target driver
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/ */
#include <linux/io.h> #include <linux/io.h>
...@@ -62,15 +54,22 @@ static const char * const clock_names[SYSC_MAX_CLOCKS] = { ...@@ -62,15 +54,22 @@ static const char * const clock_names[SYSC_MAX_CLOCKS] = {
* @module_size: size of the interconnect target module * @module_size: size of the interconnect target module
* @module_va: virtual address of the interconnect target module * @module_va: virtual address of the interconnect target module
* @offsets: register offsets from module base * @offsets: register offsets from module base
* @mdata: ti-sysc to hwmod translation data for a module
* @clocks: clocks used by the interconnect target module * @clocks: clocks used by the interconnect target module
* @clock_roles: clock role names for the found clocks * @clock_roles: clock role names for the found clocks
* @nr_clocks: number of clocks used by the interconnect target module * @nr_clocks: number of clocks used by the interconnect target module
* @rsts: resets used by the interconnect target module
* @legacy_mode: configured for legacy mode if set * @legacy_mode: configured for legacy mode if set
* @cap: interconnect target module capabilities * @cap: interconnect target module capabilities
* @cfg: interconnect target module configuration * @cfg: interconnect target module configuration
* @cookie: data used by legacy platform callbacks
* @name: name if available * @name: name if available
* @revision: interconnect target module revision * @revision: interconnect target module revision
* @enabled: sysc runtime enabled status
* @needs_resume: runtime resume needed on resume from suspend * @needs_resume: runtime resume needed on resume from suspend
* @child_needs_resume: runtime resume needed for child on resume from suspend
* @disable_on_idle: status flag used for disabling modules with resets
* @idle_work: work structure used to perform delayed idle on a module
* @clk_enable_quirk: module specific clock enable quirk * @clk_enable_quirk: module specific clock enable quirk
* @clk_disable_quirk: module specific clock disable quirk * @clk_disable_quirk: module specific clock disable quirk
* @reset_done_quirk: module specific reset done quirk * @reset_done_quirk: module specific reset done quirk
...@@ -95,7 +94,6 @@ struct sysc { ...@@ -95,7 +94,6 @@ struct sysc {
unsigned int enabled:1; unsigned int enabled:1;
unsigned int needs_resume:1; unsigned int needs_resume:1;
unsigned int child_needs_resume:1; unsigned int child_needs_resume:1;
unsigned int disable_on_idle:1;
struct delayed_work idle_work; struct delayed_work idle_work;
void (*clk_enable_quirk)(struct sysc *sysc); void (*clk_enable_quirk)(struct sysc *sysc);
void (*clk_disable_quirk)(struct sysc *sysc); void (*clk_disable_quirk)(struct sysc *sysc);
...@@ -503,7 +501,7 @@ static void sysc_clkdm_allow_idle(struct sysc *ddata) ...@@ -503,7 +501,7 @@ static void sysc_clkdm_allow_idle(struct sysc *ddata)
static int sysc_init_resets(struct sysc *ddata) static int sysc_init_resets(struct sysc *ddata)
{ {
ddata->rsts = ddata->rsts =
devm_reset_control_get_optional(ddata->dev, "rstctrl"); devm_reset_control_get_optional_shared(ddata->dev, "rstctrl");
if (IS_ERR(ddata->rsts)) if (IS_ERR(ddata->rsts))
return PTR_ERR(ddata->rsts); return PTR_ERR(ddata->rsts);
...@@ -1031,7 +1029,6 @@ static int __maybe_unused sysc_runtime_suspend_legacy(struct device *dev, ...@@ -1031,7 +1029,6 @@ static int __maybe_unused sysc_runtime_suspend_legacy(struct device *dev,
dev_err(dev, "%s: could not idle: %i\n", dev_err(dev, "%s: could not idle: %i\n",
__func__, error); __func__, error);
if (ddata->disable_on_idle)
reset_control_assert(ddata->rsts); reset_control_assert(ddata->rsts);
return 0; return 0;
...@@ -1043,7 +1040,6 @@ static int __maybe_unused sysc_runtime_resume_legacy(struct device *dev, ...@@ -1043,7 +1040,6 @@ static int __maybe_unused sysc_runtime_resume_legacy(struct device *dev,
struct ti_sysc_platform_data *pdata; struct ti_sysc_platform_data *pdata;
int error; int error;
if (ddata->disable_on_idle)
reset_control_deassert(ddata->rsts); reset_control_deassert(ddata->rsts);
pdata = dev_get_platdata(ddata->dev); pdata = dev_get_platdata(ddata->dev);
...@@ -1091,11 +1087,10 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev) ...@@ -1091,11 +1087,10 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
ddata->enabled = false; ddata->enabled = false;
err_allow_idle: err_allow_idle:
sysc_clkdm_allow_idle(ddata);
if (ddata->disable_on_idle)
reset_control_assert(ddata->rsts); reset_control_assert(ddata->rsts);
sysc_clkdm_allow_idle(ddata);
return error; return error;
} }
...@@ -1109,11 +1104,11 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev) ...@@ -1109,11 +1104,11 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev)
if (ddata->enabled) if (ddata->enabled)
return 0; return 0;
if (ddata->disable_on_idle)
reset_control_deassert(ddata->rsts);
sysc_clkdm_deny_idle(ddata); sysc_clkdm_deny_idle(ddata);
reset_control_deassert(ddata->rsts);
if (sysc_opt_clks_needed(ddata)) { if (sysc_opt_clks_needed(ddata)) {
error = sysc_enable_opt_clocks(ddata); error = sysc_enable_opt_clocks(ddata);
if (error) if (error)
...@@ -1532,7 +1527,7 @@ static int sysc_legacy_init(struct sysc *ddata) ...@@ -1532,7 +1527,7 @@ static int sysc_legacy_init(struct sysc *ddata)
*/ */
static int sysc_rstctrl_reset_deassert(struct sysc *ddata, bool reset) static int sysc_rstctrl_reset_deassert(struct sysc *ddata, bool reset)
{ {
int error, val; int error;
if (!ddata->rsts) if (!ddata->rsts)
return 0; return 0;
...@@ -1543,14 +1538,9 @@ static int sysc_rstctrl_reset_deassert(struct sysc *ddata, bool reset) ...@@ -1543,14 +1538,9 @@ static int sysc_rstctrl_reset_deassert(struct sysc *ddata, bool reset)
return error; return error;
} }
error = reset_control_deassert(ddata->rsts); reset_control_deassert(ddata->rsts);
if (error == -EEXIST)
return 0;
error = readx_poll_timeout(reset_control_status, ddata->rsts, val,
val == 0, 100, MAX_MODULE_SOFTRESET_WAIT);
return error; return 0;
} }
/* /*
...@@ -1559,12 +1549,11 @@ static int sysc_rstctrl_reset_deassert(struct sysc *ddata, bool reset) ...@@ -1559,12 +1549,11 @@ static int sysc_rstctrl_reset_deassert(struct sysc *ddata, bool reset)
*/ */
static int sysc_reset(struct sysc *ddata) static int sysc_reset(struct sysc *ddata)
{ {
int sysc_offset, syss_offset, sysc_val, rstval, quirks, error = 0; int sysc_offset, syss_offset, sysc_val, rstval, error = 0;
u32 sysc_mask, syss_done; u32 sysc_mask, syss_done;
sysc_offset = ddata->offsets[SYSC_SYSCONFIG]; sysc_offset = ddata->offsets[SYSC_SYSCONFIG];
syss_offset = ddata->offsets[SYSC_SYSSTATUS]; syss_offset = ddata->offsets[SYSC_SYSSTATUS];
quirks = ddata->cfg.quirks;
if (ddata->legacy_mode || sysc_offset < 0 || if (ddata->legacy_mode || sysc_offset < 0 ||
ddata->cap->regbits->srst_shift < 0 || ddata->cap->regbits->srst_shift < 0 ||
...@@ -2427,6 +2416,10 @@ static int sysc_probe(struct platform_device *pdev) ...@@ -2427,6 +2416,10 @@ static int sysc_probe(struct platform_device *pdev)
goto unprepare; goto unprepare;
} }
/* Balance reset counts */
if (ddata->rsts)
reset_control_assert(ddata->rsts);
sysc_show_registers(ddata); sysc_show_registers(ddata);
ddata->dev->type = &sysc_device_type; ddata->dev->type = &sysc_device_type;
...@@ -2446,9 +2439,6 @@ static int sysc_probe(struct platform_device *pdev) ...@@ -2446,9 +2439,6 @@ static int sysc_probe(struct platform_device *pdev)
pm_runtime_put(&pdev->dev); pm_runtime_put(&pdev->dev);
} }
if (!of_get_available_child_count(ddata->dev->of_node))
ddata->disable_on_idle = true;
return 0; return 0;
err: err:
......
/* SPDX-License-Identifier: GPL-2.0 */
/* TI sysc interconnect target module defines */ /* TI sysc interconnect target module defines */
/* Generic sysc found on omap2 and later, also known as type1 */ /* Generic sysc found on omap2 and later, also known as type1 */
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __TI_SYSC_DATA_H__ #ifndef __TI_SYSC_DATA_H__
#define __TI_SYSC_DATA_H__ #define __TI_SYSC_DATA_H__
...@@ -70,7 +72,7 @@ struct sysc_regbits { ...@@ -70,7 +72,7 @@ struct sysc_regbits {
/** /**
* struct sysc_capabilities - capabilities for an interconnect target module * struct sysc_capabilities - capabilities for an interconnect target module
* * @type: sysc type identifier for the module
* @sysc_mask: bitmask of supported SYSCONFIG register bits * @sysc_mask: bitmask of supported SYSCONFIG register bits
* @regbits: bitmask of SYSCONFIG register bits * @regbits: bitmask of SYSCONFIG register bits
* @mod_quirks: bitmask of module specific quirks * @mod_quirks: bitmask of module specific quirks
...@@ -85,8 +87,9 @@ struct sysc_capabilities { ...@@ -85,8 +87,9 @@ struct sysc_capabilities {
/** /**
* struct sysc_config - configuration for an interconnect target module * struct sysc_config - configuration for an interconnect target module
* @sysc_val: configured value for sysc register * @sysc_val: configured value for sysc register
* @syss_mask: configured mask value for SYSSTATUS register
* @midlemodes: bitmask of supported master idle modes * @midlemodes: bitmask of supported master idle modes
* @sidlemodes: bitmask of supported master idle modes * @sidlemodes: bitmask of supported slave idle modes
* @srst_udelay: optional delay needed after OCP soft reset * @srst_udelay: optional delay needed after OCP soft reset
* @quirks: bitmask of enabled quirks * @quirks: bitmask of enabled quirks
*/ */
......
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