1
0
Fork 0

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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEkgNvrZJU/QSQYIcQG9Q+yVyrpXMFAl1gZLgRHHRvbnlAYXRv
 bWlkZS5jb20ACgkQG9Q+yVyrpXNj5A/9F56FliHXmFRCsVw1vja5bgWagmOVnptx
 Xa0K29GanTx/cuTaUi5Cp+EPJSDYV2REp2J8jK9jfycEEm9ww3MovFCXJIYeUha3
 URMsyd9PctoQyfYdgqfTFs/4HE6NUjCFRjegZWN4K+A0vCx6x5xli7565QTrk0iL
 /Eok6oCA3tZkG3cBHn7ZNYahf0NNTlKhYe2Mq2TsJTgROymQ5I9SaCHPSIgdWuH3
 v0ysCyQnCNc9QLRLLdy2qnk1k5T/Mf04CMlUs8OIClm1d9cl0Wox83sQemaC5oLZ
 lpLBQYyuojob4rK2T2u4c6xNPrrDKltJufB0SyDuYBj30rCCPE/I3GwWZ9tjxcC0
 OHq8r+PTdGASyD0H5RfXkXRQARUDuQqt8DQR6lwSnhcCz8pUooDrhGY4+44ynbwg
 /tBfKrEr1PcFMnN28Htz+djSqzTB7GNa4XINV87SNmnKuEFQ/nE/CPW7/McVK7Dx
 WsRPC/ial+LhUio8dNNML9Ul2+xw46tTxiO0wvMI6nI6NgmDbQ1zOmBMFzN6ze8y
 naAJSCA1kP9zeYZ8y/YWio8TTRbdHZznX8nqNXQ6t/UGBMrxaWeHiOulKmz1YlwR
 cBHduWwgF6t/qB7qrxwqNddUKcRRIfJA//h0QwieQLdC5EZeq0cUbn4yHMchnCIx
 DuOc9DS0NKk=
 =RAgR
 -----END PGP SIGNATURE-----

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.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
alistair/sunxi64-5.4-dsi
Arnd Bergmann 2019-09-04 17:20:03 +02:00
commit bf3176b350
4 changed files with 31 additions and 35 deletions

View File

@ -11786,6 +11786,7 @@ S: Maintained
F: arch/arm/mach-omap2/
F: arch/arm/plat-omap/
F: arch/arm/configs/omap2plus_defconfig
F: drivers/bus/ti-sysc.c
F: drivers/i2c/busses/i2c-omap.c
F: drivers/irqchip/irq-omap-intc.c
F: drivers/mfd/*omap*.c
@ -11806,6 +11807,7 @@ F: drivers/regulator/tps65910-regulator.c
F: drivers/regulator/twl-regulator.c
F: drivers/regulator/twl6030-regulator.c
F: include/linux/platform_data/i2c-omap.h
F: include/linux/platform_data/ti-sysc.h
ONION OMEGA2+ BOARD
M: Harvey Hunt <harveyhuntnexus@gmail.com>

View File

@ -1,14 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* 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>
@ -62,15 +54,22 @@ static const char * const clock_names[SYSC_MAX_CLOCKS] = {
* @module_size: size of the interconnect target module
* @module_va: virtual address of the interconnect target module
* @offsets: register offsets from module base
* @mdata: ti-sysc to hwmod translation data for a module
* @clocks: clocks used by the interconnect target module
* @clock_roles: clock role names for the found clocks
* @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
* @cap: interconnect target module capabilities
* @cfg: interconnect target module configuration
* @cookie: data used by legacy platform callbacks
* @name: name if available
* @revision: interconnect target module revision
* @enabled: sysc runtime enabled status
* @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_disable_quirk: module specific clock disable quirk
* @reset_done_quirk: module specific reset done quirk
@ -95,7 +94,6 @@ struct sysc {
unsigned int enabled:1;
unsigned int needs_resume:1;
unsigned int child_needs_resume:1;
unsigned int disable_on_idle:1;
struct delayed_work idle_work;
void (*clk_enable_quirk)(struct sysc *sysc);
void (*clk_disable_quirk)(struct sysc *sysc);
@ -503,7 +501,7 @@ static void sysc_clkdm_allow_idle(struct sysc *ddata)
static int sysc_init_resets(struct sysc *ddata)
{
ddata->rsts =
devm_reset_control_get_optional(ddata->dev, "rstctrl");
devm_reset_control_get_optional_shared(ddata->dev, "rstctrl");
if (IS_ERR(ddata->rsts))
return PTR_ERR(ddata->rsts);
@ -1031,8 +1029,7 @@ static int __maybe_unused sysc_runtime_suspend_legacy(struct device *dev,
dev_err(dev, "%s: could not idle: %i\n",
__func__, error);
if (ddata->disable_on_idle)
reset_control_assert(ddata->rsts);
reset_control_assert(ddata->rsts);
return 0;
}
@ -1043,8 +1040,7 @@ static int __maybe_unused sysc_runtime_resume_legacy(struct device *dev,
struct ti_sysc_platform_data *pdata;
int error;
if (ddata->disable_on_idle)
reset_control_deassert(ddata->rsts);
reset_control_deassert(ddata->rsts);
pdata = dev_get_platdata(ddata->dev);
if (!pdata)
@ -1091,10 +1087,9 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
ddata->enabled = false;
err_allow_idle:
sysc_clkdm_allow_idle(ddata);
reset_control_assert(ddata->rsts);
if (ddata->disable_on_idle)
reset_control_assert(ddata->rsts);
sysc_clkdm_allow_idle(ddata);
return error;
}
@ -1109,11 +1104,11 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev)
if (ddata->enabled)
return 0;
if (ddata->disable_on_idle)
reset_control_deassert(ddata->rsts);
sysc_clkdm_deny_idle(ddata);
reset_control_deassert(ddata->rsts);
if (sysc_opt_clks_needed(ddata)) {
error = sysc_enable_opt_clocks(ddata);
if (error)
@ -1532,7 +1527,7 @@ static int sysc_legacy_init(struct sysc *ddata)
*/
static int sysc_rstctrl_reset_deassert(struct sysc *ddata, bool reset)
{
int error, val;
int error;
if (!ddata->rsts)
return 0;
@ -1543,14 +1538,9 @@ static int sysc_rstctrl_reset_deassert(struct sysc *ddata, bool reset)
return error;
}
error = reset_control_deassert(ddata->rsts);
if (error == -EEXIST)
return 0;
reset_control_deassert(ddata->rsts);
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)
*/
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;
sysc_offset = ddata->offsets[SYSC_SYSCONFIG];
syss_offset = ddata->offsets[SYSC_SYSSTATUS];
quirks = ddata->cfg.quirks;
if (ddata->legacy_mode || sysc_offset < 0 ||
ddata->cap->regbits->srst_shift < 0 ||
@ -2427,6 +2416,10 @@ static int sysc_probe(struct platform_device *pdev)
goto unprepare;
}
/* Balance reset counts */
if (ddata->rsts)
reset_control_assert(ddata->rsts);
sysc_show_registers(ddata);
ddata->dev->type = &sysc_device_type;
@ -2446,9 +2439,6 @@ static int sysc_probe(struct platform_device *pdev)
pm_runtime_put(&pdev->dev);
}
if (!of_get_available_child_count(ddata->dev->of_node))
ddata->disable_on_idle = true;
return 0;
err:

View File

@ -1,3 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* TI sysc interconnect target module defines */
/* Generic sysc found on omap2 and later, also known as type1 */

View File

@ -1,3 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __TI_SYSC_DATA_H__
#define __TI_SYSC_DATA_H__
@ -70,7 +72,7 @@ struct sysc_regbits {
/**
* struct sysc_capabilities - capabilities for an interconnect target module
*
* @type: sysc type identifier for the module
* @sysc_mask: bitmask of supported SYSCONFIG register bits
* @regbits: bitmask of SYSCONFIG register bits
* @mod_quirks: bitmask of module specific quirks
@ -85,8 +87,9 @@ struct sysc_capabilities {
/**
* struct sysc_config - configuration for an interconnect target module
* @sysc_val: configured value for sysc register
* @syss_mask: configured mask value for SYSSTATUS register
* @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
* @quirks: bitmask of enabled quirks
*/