Fixes for omaps for v5.8-rc cycle

Few fixes for issues noticed during testing:
 
 - Two DEBUG_ATOMIC_SLEEP fixes for ti-sysc interconnect target module
   driver
 
 - A regression fix for ti-sysc no-idle handling that caused issues
   compared to earlier platform data based booting
 
 - A fix for memory leak for omap_hwmod_allocate_module
 
 - Fix d_can driver probe for am437x
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEkgNvrZJU/QSQYIcQG9Q+yVyrpXMFAl8PUn4RHHRvbnlAYXRv
 bWlkZS5jb20ACgkQG9Q+yVyrpXN7XRAA0PRDhYAQF9OoeWL337gf0fXRchYA42Pk
 C5R5KXdkSZZOlexWCsnmXGBIfAgup2B9sBTr6kFWQW1oPAIzO2oF/ALkw0U+aMsd
 A5UMKOmHJCaHwMyiHu2kpwnTFCRUFdGpTYsCxOxAjFgk8R8YdSD2xnWnDwdgJSDX
 Lk2SQ+ycfRf1aDT06UaSiwn1vQAOmMOEi0SV4KpyO4eH93mRjsNB7N2aUcKeq2m/
 y4JLBF486QCJjJg91YG4wHoM/4O/fIeDWH2nGW2C3BU9f6F7uDip31mNBMB8ra2R
 7ijIxLnQRypB5fgCEjimQ+2wWE2Mt1NRfxaIu2Kc9dZxmjqknzEV7oFQg48bQbtQ
 X7K8idTFyvdlhMZS9ajKpbbrxSGLqo53sgLWJHCNC0QBFX0clHmcWXrwZn6BNtbr
 lQ/+u6lFRthN6jQzudxf3nI/W68yskmfKWnVl5TEkA8tctxyZYjl5Td6DRLCI988
 f23NKqTAssgHH5MWR5jDpJrZSThlty9ZqRWLjTON4rYeqVM5vXKtieSIDpV5ZmFo
 VYVdv43tg4wnKBFLWZUurVmXhVmlawzsVyAAG83XkjNmPcQCGpI4sByGtujltLGQ
 Bo6EwgMo3aOi9sKMOiEviAHhZbzxjLGwqt13L3b/9NX0e9T14gKhil9WswQpSkZ0
 UnB5N2rwOUU=
 =ekbH
 -----END PGP SIGNATURE-----

Merge tag 'omap-for-v5.8/fixes-rc5-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into arm/fixes

Fixes for omaps for v5.8-rc cycle

Few fixes for issues noticed during testing:

- Two DEBUG_ATOMIC_SLEEP fixes for ti-sysc interconnect target module
  driver

- A regression fix for ti-sysc no-idle handling that caused issues
  compared to earlier platform data based booting

- A fix for memory leak for omap_hwmod_allocate_module

- Fix d_can driver probe for am437x

* tag 'omap-for-v5.8/fixes-rc5-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  ARM: dts: Fix dcan driver probe failed on am437x platform
  ARM: OMAP2+: Fix possible memory leak in omap_hwmod_allocate_module
  bus: ti-sysc: Do not disable on suspend for no-idle
  bus: ti-sysc: Fix sleeping function called from invalid context for RTC quirk
  bus: ti-sysc: Fix wakeirq sleeping function called from invalid context

Link: https://lore.kernel.org/r/pull-1594840100-132735@atomide.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2020-07-16 22:08:21 +02:00
commit b041ef0e58
3 changed files with 33 additions and 18 deletions

View File

@ -1540,8 +1540,9 @@ target-module@cc000 { /* 0x481cc000, ap 50 46.0 */
reg = <0xcc020 0x4>; reg = <0xcc020 0x4>;
reg-names = "rev"; reg-names = "rev";
/* Domains (P, C): per_pwrdm, l4ls_clkdm */ /* Domains (P, C): per_pwrdm, l4ls_clkdm */
clocks = <&l4ls_clkctrl AM4_L4LS_D_CAN0_CLKCTRL 0>; clocks = <&l4ls_clkctrl AM4_L4LS_D_CAN0_CLKCTRL 0>,
clock-names = "fck"; <&dcan0_fck>;
clock-names = "fck", "osc";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
ranges = <0x0 0xcc000 0x2000>; ranges = <0x0 0xcc000 0x2000>;
@ -1549,6 +1550,8 @@ target-module@cc000 { /* 0x481cc000, ap 50 46.0 */
dcan0: can@0 { dcan0: can@0 {
compatible = "ti,am4372-d_can", "ti,am3352-d_can"; compatible = "ti,am4372-d_can", "ti,am3352-d_can";
reg = <0x0 0x2000>; reg = <0x0 0x2000>;
clocks = <&dcan0_fck>;
clock-names = "fck";
syscon-raminit = <&scm_conf 0x644 0>; syscon-raminit = <&scm_conf 0x644 0>;
interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>; interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled"; status = "disabled";
@ -1560,8 +1563,9 @@ target-module@d0000 { /* 0x481d0000, ap 52 3a.0 */
reg = <0xd0020 0x4>; reg = <0xd0020 0x4>;
reg-names = "rev"; reg-names = "rev";
/* Domains (P, C): per_pwrdm, l4ls_clkdm */ /* Domains (P, C): per_pwrdm, l4ls_clkdm */
clocks = <&l4ls_clkctrl AM4_L4LS_D_CAN1_CLKCTRL 0>; clocks = <&l4ls_clkctrl AM4_L4LS_D_CAN1_CLKCTRL 0>,
clock-names = "fck"; <&dcan1_fck>;
clock-names = "fck", "osc";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
ranges = <0x0 0xd0000 0x2000>; ranges = <0x0 0xd0000 0x2000>;
@ -1569,6 +1573,8 @@ target-module@d0000 { /* 0x481d0000, ap 52 3a.0 */
dcan1: can@0 { dcan1: can@0 {
compatible = "ti,am4372-d_can", "ti,am3352-d_can"; compatible = "ti,am4372-d_can", "ti,am3352-d_can";
reg = <0x0 0x2000>; reg = <0x0 0x2000>;
clocks = <&dcan1_fck>;
clock-name = "fck";
syscon-raminit = <&scm_conf 0x644 1>; syscon-raminit = <&scm_conf 0x644 1>;
interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>; interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled"; status = "disabled";

View File

@ -3435,7 +3435,7 @@ static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
regs = ioremap(data->module_pa, regs = ioremap(data->module_pa,
data->module_size); data->module_size);
if (!regs) if (!regs)
return -ENOMEM; goto out_free_sysc;
} }
/* /*
@ -3445,13 +3445,13 @@ static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
if (oh->class->name && strcmp(oh->class->name, data->name)) { if (oh->class->name && strcmp(oh->class->name, data->name)) {
class = kmemdup(oh->class, sizeof(*oh->class), GFP_KERNEL); class = kmemdup(oh->class, sizeof(*oh->class), GFP_KERNEL);
if (!class) if (!class)
return -ENOMEM; goto out_unmap;
} }
if (list_empty(&oh->slave_ports)) { if (list_empty(&oh->slave_ports)) {
oi = kcalloc(1, sizeof(*oi), GFP_KERNEL); oi = kcalloc(1, sizeof(*oi), GFP_KERNEL);
if (!oi) if (!oi)
return -ENOMEM; goto out_free_class;
/* /*
* Note that we assume interconnect interface clocks will be * Note that we assume interconnect interface clocks will be
@ -3478,6 +3478,14 @@ static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
spin_unlock_irqrestore(&oh->_lock, flags); spin_unlock_irqrestore(&oh->_lock, flags);
return 0; return 0;
out_free_class:
kfree(class);
out_unmap:
iounmap(regs);
out_free_sysc:
kfree(sysc);
return -ENOMEM;
} }
static const struct omap_hwmod_reset omap24xx_reset_quirks[] = { static const struct omap_hwmod_reset omap24xx_reset_quirks[] = {

View File

@ -236,14 +236,13 @@ static int sysc_wait_softreset(struct sysc *ddata)
syss_done = ddata->cfg.syss_mask; syss_done = ddata->cfg.syss_mask;
if (syss_offset >= 0) { if (syss_offset >= 0) {
error = readx_poll_timeout(sysc_read_sysstatus, ddata, rstval, error = readx_poll_timeout_atomic(sysc_read_sysstatus, ddata,
(rstval & ddata->cfg.syss_mask) == rstval, (rstval & ddata->cfg.syss_mask) ==
syss_done, syss_done, 100, MAX_MODULE_SOFTRESET_WAIT);
100, MAX_MODULE_SOFTRESET_WAIT);
} else if (ddata->cfg.quirks & SYSC_QUIRK_RESET_STATUS) { } else if (ddata->cfg.quirks & SYSC_QUIRK_RESET_STATUS) {
error = readx_poll_timeout(sysc_read_sysconfig, ddata, rstval, error = readx_poll_timeout_atomic(sysc_read_sysconfig, ddata,
!(rstval & sysc_mask), rstval, !(rstval & sysc_mask),
100, MAX_MODULE_SOFTRESET_WAIT); 100, MAX_MODULE_SOFTRESET_WAIT);
} }
@ -1279,7 +1278,8 @@ static int __maybe_unused sysc_noirq_suspend(struct device *dev)
ddata = dev_get_drvdata(dev); ddata = dev_get_drvdata(dev);
if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE) if (ddata->cfg.quirks &
(SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_NO_IDLE))
return 0; return 0;
return pm_runtime_force_suspend(dev); return pm_runtime_force_suspend(dev);
@ -1291,7 +1291,8 @@ static int __maybe_unused sysc_noirq_resume(struct device *dev)
ddata = dev_get_drvdata(dev); ddata = dev_get_drvdata(dev);
if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE) if (ddata->cfg.quirks &
(SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_NO_IDLE))
return 0; return 0;
return pm_runtime_force_resume(dev); return pm_runtime_force_resume(dev);
@ -1728,7 +1729,7 @@ static void sysc_quirk_rtc(struct sysc *ddata, bool lock)
local_irq_save(flags); local_irq_save(flags);
/* RTC_STATUS BUSY bit may stay active for 1/32768 seconds (~30 usec) */ /* RTC_STATUS BUSY bit may stay active for 1/32768 seconds (~30 usec) */
error = readl_poll_timeout(ddata->module_va + 0x44, val, error = readl_poll_timeout_atomic(ddata->module_va + 0x44, val,
!(val & BIT(0)), 100, 50); !(val & BIT(0)), 100, 50);
if (error) if (error)
dev_warn(ddata->dev, "rtc busy timeout\n"); dev_warn(ddata->dev, "rtc busy timeout\n");