aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bus/ti-sysc.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-01-29Merge branch 'pwm-dmtimer-fixes' into omap-for-v5.0/fixes-v2Tony Lindgren1-3/+3
2019-01-29bus: ti-sysc: Fix timer handling with drop pm_runtime_irq_safe()Tony Lindgren1-2/+2
Commit 84badc5ec5fc ("ARM: dts: omap4: Move l4 child devices to probe them with ti-sysc") started producing a warning for pwm-omap-dmtimer: WARNING: CPU: 0 PID: 77 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x2f8/0x388 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4PER2 (Idle): Data Access in Supervisor mode during Functional access ... __pm_runtime_idle omap_dm_timer_disable pwm_omap_dmtimer_start pwm_omap_dmtimer_enable pwm_apply_state pwm_vibrator_start pwm_vibrator_play_work This is because the timer that pwm-omap-dmtimer is using is now being probed with ti-sysc interconnect target module instead of omap_device and the ti-sysc quirk for SYSC_QUIRK_LEGACY_IDLE is not fully compatible with what omap_device has been doing. We could fix this by reverting the timer changes and have the timer probe again with omap_device. Or we could add more quirk handling to ti-sysc driver. But as these options don't work nicely as longer term solutions, let's just make timers probe with ti-sysc without any quirks. To do this, all we need to do is remove quirks for timers for ti-sysc, and drop the bogus pm_runtime_irq_safe() flag for timer-ti-dm. We should not use pm_runtime_irq_safe() anyways for drivers as it will take a permanent use count on the parent device blocking the parent devices from idling and has been forcing ti-sysc driver to use a quirk flag. Note that we will move the timer data to DEBUG section later on in clean-up patches. Fixes: 84badc5ec5fc ("ARM: dts: omap4: Move l4 child devices to probe them with ti-sysc") Cc: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: H. Nikolaus Schaller <hns@goldelico.com> Cc: Keerthy <j-keerthy@ti.com> Cc: Ladislav Michl <ladis@linux-mips.org> Cc: Pavel Machek <pavel@ucw.cz> Cc: Sebastian Reichel <sre@kernel.org> Cc: Tero Kristo <t-kristo@ti.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Reported-by: H. Nikolaus Schaller <hns@goldelico.com> Tested-By: Andreas Kemnade <andreas@kemnade.info> Tested-By: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-12-10bus: ti-sysc: Check for no-reset and no-idle flags at the child levelTony Lindgren1-7/+25
With ti-sysc, we need to now have the device tree properties for ti,no-reset-on-init and ti,no-idle-on-init at the module level instead of the child device level. Let's check for these properties at the child device level to enable quirks, and warn about moving the properties to the module level. Otherwise am335x-evm based boards tagging gpio1 with ti,no-reset-on-init will have their DDR power disabled if wired up in such a tricky way. Note that this should not be an issue for earlier kernels as we don't rely on this until the dts files have been updated to probe with ti-sysc interconnect target driver. Cc: Peter Ujfalusi <peter.ujfalusi@ti.com> Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-11-15bus: ti-sysc: Detect devices for debug on omap5Tony Lindgren1-0/+3
We want to see the names of detected devices when DEBUG is enabled. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-11-15bus: ti-sysc: Add mcasp optional clocks flagTony Lindgren1-0/+11
We have OPT_CLKS_NEEDED in legacy platform data, but it's missing from the ti-sysc driver for device tree based configuration. In order to pass OPT_CLKS_NEEDED quirk flag we need to update omap4 module data and add a new compatible for dra7 as the module layout is different from sysc_regbits_omap4_mcasp. Fixes: 70a65240efb1 ("bus: ti-sysc: Add register bits for interconnect target modules") Cc: Mark Rutland <mark.rutland@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-11-15bus: ti-sysc: Fix getting optional clocks in clock_rolesTony Lindgren1-2/+7
We can have holes in clock_roles with interface clock missing for example. Currently getting an optional clock will fail if there are only a functional clock and an optional clock. Fixes: 09dfe5810762 ("bus: ti-sysc: Add handling for clkctrl opt clocks") Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-10-01bus: ti-sysc: Just use SET_NOIRQ_SYSTEM_SLEEP_PM_OPSTony Lindgren1-111/+4
As Grygorii Strashko pointed out, the runtime PM use count of the children can be whatever at suspend and we should not use it. So let's just suspend ti-sysc at noirq level and get rid of some code. Let's also remove the PM_SLEEP ifdef and use __maybe_unused as the PM code already deals with the ifdefs. Suggested-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-09-28bus: ti-sysc: Make some warnings debug onlyTony Lindgren1-2/+2
We're currently warning about busy children on suspend in sysc_child_suspend_noirq() but the legacy code omap_device does not do that. Let's just make it dev_dbg() instead of dev_warn(). Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-09-28bus: ti-sysc: Detect devices for debug on dra7Tony Lindgren1-5/+8
We want to see the names of detected devices when DEBUG is enabled. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-09-28bus: ti-sysc: Detect timer and gpio on dra7Tony Lindgren1-2/+4
We need to detect timer and gpio on dra7 because of the SYSC_QUIRK_LEGACY_IDLE flag for suspend and resume. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-09-28Merge commit '4f3530f4a41d49c41015020cd9a5ed5c95b5d2db' into omap-for-v4.20/ti-syscTony Lindgren1-20/+17
2018-09-24bus: ti-sysc: Detect devices on am335x when DEBUG is enabledTony Lindgren1-2/+6
When debug is enabled, we want to see what devices we're detecting to make things a bit easier for us. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-09-24bus: ti-sysc: Detect more devices on am473x for debuggingTony Lindgren1-3/+20
When debug is enabled, we want to see what devices we're detecting to make things a bit easier for us. Many of these devices will also be available on am335x and dra7, and some just need updating the revision register mask. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-09-24bus: ti-sysc: Update revision masks to support am437xTony Lindgren1-2/+4
We need to detect few new devices to tag for noirq_suspend and pm_runtime_irq_safe to avoid causing regressions compared to legacy platform data booting. Let's update i2c, gpio, uart and wdt revision masks to detect them on am437x. Note that we can remove the second wdt entry with the updated mask. Note that we also have some uarts with a different revision register. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-09-24bus: ti-sysc: Defer suspend as neededTony Lindgren1-57/+61
We don't care when we suspend but some our children do. In order to avoid tagging various modules with SYSC_QUIRK_RESOURCE_PROVIDER, let's do it automatically by tagging modules that are busy on suspend for noirq suspend. This way we can just do module detection on define DEBUG. Note that we still need to keep SYSC_QUIRK_LEGACY_IDLE flag around so the our legacy single-child devices that set pm_runtime_irq_safe() can manage the interconnect target module themselves. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-08-28Merge branch 'perm-fix' into omap-for-v4.19/fixes-v2Tony Lindgren1-0/+64
2018-08-22bus: ti-sysc: Fix no_console_suspend handlingTony Lindgren1-3/+3
If no_console_suspend is set, we should keep console enabled during suspend. Lets fix this by only producing a warning if we can't idle hardware during suspend. Fixes: ef55f8215a78 ("bus: ti-sysc: Improve suspend and resume handling") Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-08-17bus: ti-sysc: Fix module register ioremap for larger offsetsTony Lindgren1-17/+14
We can have the interconnect target module control registers pretty much anywhere within the module range. The current code attempts an incomplete optimization of the ioremap size but does it wrong and it only works for registers at the beginning of the module. Let's just use the largest control register to calculate the ioremap size. The ioremapped range is for most part cached anyways so there is no need for size optimization. Let's also update the comments accordingly. Fixes: 0eecc636e5a2 ("bus: ti-sysc: Add minimal TI sysc interconnect target driver") Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-07-09bus: ti-sysc: Add support for software resetFaiz Abbas1-0/+46
Add support for the software reset of a target interconnect module using its sysconfig and sysstatus registers. Signed-off-by: Faiz Abbas <faiz_abbas@ti.com> [tony@atomide.com: updated to check if sysconfig exists] Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-07-09bus: ti-sysc: Add support for using ti-sysc for MCAN on dra76xFaiz Abbas1-0/+18
The dra76x MCAN generic interconnect module has a its own format for the bits in the control registers. Therefore add a new module type, new regbits and new capabilities specific to the MCAN module. Acked-by: Rob Herring <robh@kernel.org> CC: Tony Lindgren <tony@atomide.com> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-07-02bus: ti-sysc: Use 2-factor allocator argumentsKees Cook1-4/+4
This adjusts the allocator calls to use 2-factor argument call style, as done treewide already for improved defense against allocation overflows. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-05-18bus: ti-sysc: Fix optional clocks array accessTony Lindgren1-1/+1
We should be checking ddata->clocks[i] instead of clock_names[i] for the optional clocks. Currently this just happens to work for the typical case of one fck and one optional clock. Fixes: 09dfe5810762 ("bus: ti-sysc: Add handling for clkctrl opt clocks") Cc: Dan Carpenter <dan.carpenter@oracle.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-05-01bus: ti-sysc: Show module information for suspend if DEBUG is enabledTony Lindgren1-0/+18
Let's show module info if DEBUG is enabled to make it easier to follow what happens on the suspend and resume path. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-05-01bus: ti-sysc: Tag sdio and wdt with legacy mode for suspendTony Lindgren1-0/+8
Looks like these two device drivers don't yet behave properly for suspend unless configured with the legacy option. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-05-01bus: ti-sysc: Detect UARTs for SYSC_QUIRK_LEGACY_IDLE quirk on omap4Tony Lindgren1-0/+3
Starting with omap4, UARTs have different revision register that we need to detect to enable SYSC_QUIRK_LEGACY_IDLE. Otherwise UARTs won't idle properly. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-05-01bus: ti-sysc: Detect omap4 type timers for quirkTony Lindgren1-0/+3
Starting with omap4 some timers have different sysc registers (type2) compared to the omap2 timers (type1). We need to detect these to enable the quirk for SYSC_QUIRK_LEGACY_IDLE, otherwise these won't be idling properly. Siganed-off-by: Tony Lindgren <tony@atomide.com>
2018-05-01bus: ti-sysc: Add initial support for external resetsTony Lindgren1-1/+47
Some modules need to use external resets in the rstctrl bits. Typically only one of the rstctrl bits is for the interconnect target module while the others are for various child devices. For ti-sysc driver, we just need the module rstctrl bit mapped. The rest of the rstctrl bits can be directly mapped to the child devices. Cc: Suman Anna <s-anna@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-05-01bus: ti-sysc: Improve suspend and resume handlingTony Lindgren1-6/+48
Based on testing with more devices I noticed that some devices don't suspend or resume properly. We need to PM runtime suspend and resume devices if we have ddata->needs_resume set. Let's also improve the error handling and add few debug statements to make it easier to notice suspend and resume related issues if DEBUG is set. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-05-01bus: ti-sysc: Tag some modules resource providers for noirq suspendTony Lindgren1-0/+77
Modules that provide resources for other modules need to be suspended and resumed in the noirq calls. Tag the resource providing modules. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-04-30bus: ti-sysc: Add handling for clkctrl opt clocksTony Lindgren1-25/+115
There can be up to eight optional device functional gate gate clocks for each clkctrl instance in clkctrl register bits 8 to 15. Some of them are only needed for module level reset while others may always be needed during use. Let's add support for those and update the binding doc accordingly. Note that the optional clkctrl mux and divider clocks starting at bit 20 can be directly mapped to the child devices, and ti-sysc does not need to manage those. And as GPIOs need the optional clocks for reset, we can now add it with SYSC_QUIRK_OPT_CLKS_IN_RESET. Cc: Mark Rutland <mark.rutland@arm.com> Cc: Tero Kristo <t-kristo@ti.com> Cc: devicetree@vger.kernel.org Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-04-30bus: ti-sysc: Make child clock alias handling more genericTony Lindgren1-13/+23
In order to prepare supporting clkctrl optional clocks, we need to make the current child clock handling more generic so we can use the clock role names for the optional clocks in the following patch. Cc: Tero Kristo <t-kristo@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-04-30bus: ti-sysc: Handle simple-bus for nested childrenTony Lindgren1-2/+7
Otherwise child devices that some interconnect target module devices have won't probe using simple-bus. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-03-07Merge tag 'omap-for-v4.17/ti-sysc-signed' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/socArnd Bergmann1-33/+493
Pull "Driver changes for ti-sysc for v4.17" from Tony Lindgren: This series of changes enables the use device tree based sysconfig data for ti-sysc driver. As we already have SmartReflex data configured, we use that as the first driver to enable. To do that in a way where SmartReflex is not probed twice, we need to prepare the SmartReflex driver before flipping dts data on for it in the last patch of the series. To avoid regressions, we are checking the passed dts data against existing platform data since we still have it available. Then after the dts files are converted, we can simply drop the related platform data at some point in the future. * tag 'omap-for-v4.17/ti-sysc-signed' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: ARM: OMAP2+: Enable ti-sysc to use device tree data for smartreflex PM / AVS: SmartReflex: Prepare to use device tree based probing ARM: OMAP2+: Try to parse earlycon from parent too ARM: OMAP2+: Add checks for device tree based sysconfig data ARM: OMAP2+: Add functions to allocate module data from device tree bus: ti-sysc: Handle some devices in omap_device compatible way bus: ti-sysc: Add support for platform data callbacks bus: ti-sysc: Remove unnecessary debugging statements bus: ti-sysc: Improve handling for no-reset-on-init and no-idle-on-init bus: ti-sysc: Handle stdout-path for debug console bus: ti-sysc: Add suspend and resume handling bus: ti-sysc: Add fck clock alias for children with notifier_block ARM: OMAP2+: Prepare to pass auxdata for smartreflex
2018-02-26bus: ti-sysc: Handle some devices in omap_device compatible wayTony Lindgren1-3/+223
Now that ti-sysc can manage child devices, we must also be backwards compatible with the current omap_device code. With omap_device, we assume that the child device manages the interconnect target module directly. The drivers needing special handling are the ones that still set pm_runtime_irq_safe(). In the long run we want to update those drivers as otherwise they will cause problems with genpd as a permanent PM runtime usage count is set on the parent device. We can handle omap_device these devices by improving the ti-sysc quirk handling to detect the devices needing special handling based on register map and revision register if usable. We also need to implement dev_pm_domain for these child devices just like omap_device does. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-02-26bus: ti-sysc: Add support for platform data callbacksTony Lindgren1-14/+82
We want to pass the device tree configuration for interconnect target modules from ti-sysc driver to the existing platform hwmod code. This allows us to first validate the dts data against the existing platform data before we start dropping the platform data in favor of device tree data. To do this, let's add platform data callbacks for PM runtime functions to call for the interconnect target modules if platform data is available. Note that as ti-sysc driver can rebind, omap_auxdata_lookup and related functions can no longer be __init. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-02-26bus: ti-sysc: Remove unnecessary debugging statementsTony Lindgren1-8/+1
We already show the status for the interconnect target module when debugging is enabled, there's no need to be more verbose about that. So let's just cut down the noise and remove the extra debug statements. Signed-off-by: Tony Lindgren <tony@atomide.coM>
2018-02-26bus: ti-sysc: Improve handling for no-reset-on-init and no-idle-on-initTony Lindgren1-6/+22
At least earlycon needs a delayed idle before the 8250 driver probes to avoid glitches in the console output. Let's handle the delayed idle for devices tagged with ti,no-reset-on-init and ti,no-idle-on-init with delayed_work. Others don't need it, and there should be no need to use runtime PM autosuspend for the interconnect target driver as it's the child device drivers that should configure it. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-02-26bus: ti-sysc: Handle stdout-path for debug consoleTony Lindgren1-0/+46
If we have stdout-path specified for earlycon, we must prevent the debug console from idling until runtime PM kicks in. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-02-26bus: ti-sysc: Add suspend and resume handlingTony Lindgren1-0/+34
This allows us to idle the module on suspend after the children are suspended. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-02-26bus: ti-sysc: Add fck clock alias for children with notifier_blockTony Lindgren1-4/+87
The functional clock is used by several child device drivers to query the rate for the child device internal configuration. The functional clock is really for the whole interconnect target module, and not just for the child device, and can also be shared across multiple children. At least the timers, i2c and mmc driver query the fck for rate. So let's just create a clock alias for the child fck if it does not yet exits. We can do this with the BUS_NOTIFY_ADD_DEVICE before the child is probed. Note that we need to now also remove the legacy mode check for getting the dts clocks in ti-sysc driver. Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-02-15bus: ti-sysc: Fix checking of no-reset-on-init quirkTony Lindgren1-1/+1
We are currently only checking for the first entry in the table while we should check them all. Usual no-idle-on-init is together with no-reset-on-init, so this has gone unnoticed. Fixes: 566a9b05e1fa ("bus: ti-sysc: Handle module quirks based dts configuration") Signed-off-by: Tony Lindgren <tony@atomide.com>
2018-01-22bus: ti-sysc: Fix smartreflex sysc maskTony Lindgren1-1/+1
The enawakeup bit is in a different location for smartreflex compared to the "ti,sysc-omap2" compatible. Fixes: 70a65240efb1 ("bus: ti-sysc: Add register bits for interconnect target modules") Signed-off-by: Tony Lindgren <tony@atomide.com>
2017-12-21bus: ti-sysc: Add parsing of module capabilitiesTony Lindgren1-0/+100
We need to configure the interconnect target module based on the device three configuration. Let's also add a new quirk for SYSC_QUIRK_RESET_STATUS to indicate that the SYSCONFIG reset bit changes after the reset is done. Signed-off-by: Tony Lindgren <tony@atomide.com>
2017-12-21bus: ti-sysc: Handle module quirks based dts configurationTony Lindgren1-18/+96
Let's configure few module quirks via device tree using the properties for "ti,no-idle-on-init", "ti,no-reset-on-init" and "ti,sysc-delay-us". Let's also reorder the probe a bit so we have pdata available earlier, and move the PM runtime calls to sysc_init_module() from sysc_read_revision(). Signed-off-by: Tony Lindgren <tony@atomide.com>
2017-12-21bus: ti-sysc: Detect i2c interconnect target module based on register layoutTony Lindgren1-0/+17
We can easily detect i2c based on it's non-standard module registers that consist of two 32-bit registers accessed in 16-bit mode. So far we don't have other 16-bit modules, so there's currently no need to add a custom property for 16-bit register access. Signed-off-by: Tony Lindgren <tony@atomide.com>
2017-12-21bus: ti-sysc: Add register bits for interconnect target modulesTony Lindgren1-10/+246
Let's add data for the known interconnect target module types by mapping their register bits. Note that we can handle many quirks for the older omap2 type1 modules directly in the driver without a need for adding custom properties. Signed-off-by: Tony Lindgren <tony@atomide.com>
2017-10-13bus: ti-sysc: Fix unbalanced pm_runtime_enable by adding removeTony Lindgren1-0/+25
Looks like we're missing remove() that's needed if a driver instance rebound. Otherwise we will get "Unbalanced pm_runtime_enable!". Signed-off-by: Tony Lindgren <tony@atomide.com>
2017-10-13bus: ti-sysc: mark PM functions as __maybe_unusedArnd Bergmann1-2/+2
The new bus driver causes a harmless compile-time warning when CONFIG_PM is disabled: drivers/bus/ti-sysc.c:440:12: error: 'sysc_runtime_resume' defined but not used [-Werror=unused-function] static int sysc_runtime_resume(struct device *dev) ^~~~~~~~~~~~~~~~~~~ drivers/bus/ti-sysc.c:421:12: error: 'sysc_runtime_suspend' defined but not used [-Werror=unused-function] static int sysc_runtime_suspend(struct device *dev) ^~~~~~~~~~~~~~~~~~~~ This marks the two unused functions as __maybe_unused to shut up that warning. Fixes: 0eecc636e5a2 ("bus: ti-sysc: Add minimal TI sysc interconnect target driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Tony Lindgren <tony@atomide.com>
2017-10-10bus: ti-sysc: Add minimal TI sysc interconnect target driverTony Lindgren1-0/+558
We can handle the sysc interconnect target module in a generic way for many TI SoCs. Initially let's just enable runtime PM with autosuspend, and probe the children. This can already be used for idling interconnect target modules that don't have any device driver available for the child devices. For now, the "ti,hwmods" custom binding is still required. That will be eventually deprecated in later patches. And more features will be added, such as parsing for sysc capabilities so we can continue removing the legacy platform data. Cc: BenoƮt Cousson <bcousson@baylibre.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Nishanth Menon <nm@ti.com> Cc: Matthijs van Duin <matthijsvanduin@gmail.com> Cc: Paul Walmsley <paul@pwsan.com> Cc: Peter Ujfalusi <peter.ujfalusi@ti.com> Cc: Sakari Ailus <sakari.ailus@iki.fi> Cc: Tero Kristo <t-kristo@ti.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: linux-kernel@vger.kernel.org Signed-off-by: Tony Lindgren <tony@atomide.com>