Skip to content

Commit 2ed5c2e

Browse files
committed
Merge tag 'omap-for-v5.0/fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into fixes
SoC fixes for omaps for v5.0-rc cycle This series contains two SoC regression fixes and one uninitialized variable fix: - Fix inverted nirq pin handling for omap5 that started producing warnings with earlier GIC direction checks and took a while to understand and confirm. Basically there are two sys_nirq pins that are bypassing peripheral modules and inverted automatically by the SoC and need to be handled with a custom irq_set_type() - Recent ti-sysc changes caused a regression to the pwm-omap-dmtimer code where the device tree handling code for timer source clock gets confused. It looks like we can remove that code eventually, but for now we just drop a bogus pm_runtime_irq_safe() for the timers with the related quirks caused by pm_runtime_irq_safe(), and have the standard assigned-clocks and assigned-clock-parents deal with setting the source clock - Fix potentially uninitialized value for display init code if regmap_read() fails * tag 'omap-for-v5.0/fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: ARM: OMAP2+: Variable "reg" in function omap4_dsi_mux_pads() could be uninitialized ARM: dts: Configure clock parent for pwm vibra bus: ti-sysc: Fix timer handling with drop pm_runtime_irq_safe() ARM: OMAP5+: Fix inverted nirq pin interrupts with irq_set_type clocksource: timer-ti-dm: Fix pwm dmtimer usage of fck reparenting
2 parents d139371 + dc30e70 commit 2ed5c2e

File tree

7 files changed

+76
-10
lines changed

7 files changed

+76
-10
lines changed

arch/arm/boot/dts/omap4-droid4-xt894.dts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,17 @@
644644
};
645645
};
646646

647+
/* Configure pwm clock source for timers 8 & 9 */
648+
&timer8 {
649+
assigned-clocks = <&abe_clkctrl OMAP4_TIMER8_CLKCTRL 24>;
650+
assigned-clock-parents = <&sys_clkin_ck>;
651+
};
652+
653+
&timer9 {
654+
assigned-clocks = <&l4_per_clkctrl OMAP4_TIMER9_CLKCTRL 24>;
655+
assigned-clock-parents = <&sys_clkin_ck>;
656+
};
657+
647658
/*
648659
* As uart1 is wired to mdm6600 with rts and cts, we can use the cts pin for
649660
* uart1 wakeirq.

arch/arm/boot/dts/omap5-board-common.dtsi

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@
317317

318318
palmas_sys_nirq_pins: pinmux_palmas_sys_nirq_pins {
319319
pinctrl-single,pins = <
320-
OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0) /* sys_nirq1 */
320+
/* sys_nirq1 is pulled down as the SoC is inverting it for GIC */
321+
OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0)
321322
>;
322323
};
323324

@@ -385,7 +386,8 @@
385386

386387
palmas: palmas@48 {
387388
compatible = "ti,palmas";
388-
interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */
389+
/* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */
390+
interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_LOW>;
389391
reg = <0x48>;
390392
interrupt-controller;
391393
#interrupt-cells = <2>;
@@ -651,7 +653,8 @@
651653
pinctrl-names = "default";
652654
pinctrl-0 = <&twl6040_pins>;
653655

654-
interrupts = <GIC_SPI 119 IRQ_TYPE_NONE>; /* IRQ_SYS_2N cascaded to gic */
656+
/* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */
657+
interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_LOW>;
655658

656659
/* audpwron gpio defined in the board specific dts */
657660

arch/arm/boot/dts/omap5-cm-t54.dts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@
181181
OMAP5_IOPAD(0x0042, PIN_INPUT_PULLDOWN | MUX_MODE6) /* llib_wakereqin.gpio1_wk15 */
182182
>;
183183
};
184+
185+
palmas_sys_nirq_pins: pinmux_palmas_sys_nirq_pins {
186+
pinctrl-single,pins = <
187+
/* sys_nirq1 is pulled down as the SoC is inverting it for GIC */
188+
OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0)
189+
>;
190+
};
184191
};
185192

186193
&omap5_pmx_core {
@@ -414,8 +421,11 @@
414421

415422
palmas: palmas@48 {
416423
compatible = "ti,palmas";
417-
interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */
418424
reg = <0x48>;
425+
pinctrl-0 = <&palmas_sys_nirq_pins>;
426+
pinctrl-names = "default";
427+
/* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */
428+
interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_LOW>;
419429
interrupt-controller;
420430
#interrupt-cells = <2>;
421431
ti,system-power-controller;

arch/arm/mach-omap2/display.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
8383
u32 enable_mask, enable_shift;
8484
u32 pipd_mask, pipd_shift;
8585
u32 reg;
86+
int ret;
8687

8788
if (dsi_id == 0) {
8889
enable_mask = OMAP4_DSI1_LANEENABLE_MASK;
@@ -98,7 +99,11 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
9899
return -ENODEV;
99100
}
100101

101-
regmap_read(omap4_dsi_mux_syscon, OMAP4_DSIPHY_SYSCON_OFFSET, &reg);
102+
ret = regmap_read(omap4_dsi_mux_syscon,
103+
OMAP4_DSIPHY_SYSCON_OFFSET,
104+
&reg);
105+
if (ret)
106+
return ret;
102107

103108
reg &= ~enable_mask;
104109
reg &= ~pipd_mask;

arch/arm/mach-omap2/omap-wakeupgen.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
#define OMAP4_NR_BANKS 4
5151
#define OMAP4_NR_IRQS 128
5252

53+
#define SYS_NIRQ1_EXT_SYS_IRQ_1 7
54+
#define SYS_NIRQ2_EXT_SYS_IRQ_2 119
55+
5356
static void __iomem *wakeupgen_base;
5457
static void __iomem *sar_base;
5558
static DEFINE_RAW_SPINLOCK(wakeupgen_lock);
@@ -153,6 +156,37 @@ static void wakeupgen_unmask(struct irq_data *d)
153156
irq_chip_unmask_parent(d);
154157
}
155158

159+
/*
160+
* The sys_nirq pins bypass peripheral modules and are wired directly
161+
* to MPUSS wakeupgen. They get automatically inverted for GIC.
162+
*/
163+
static int wakeupgen_irq_set_type(struct irq_data *d, unsigned int type)
164+
{
165+
bool inverted = false;
166+
167+
switch (type) {
168+
case IRQ_TYPE_LEVEL_LOW:
169+
type &= ~IRQ_TYPE_LEVEL_MASK;
170+
type |= IRQ_TYPE_LEVEL_HIGH;
171+
inverted = true;
172+
break;
173+
case IRQ_TYPE_EDGE_FALLING:
174+
type &= ~IRQ_TYPE_EDGE_BOTH;
175+
type |= IRQ_TYPE_EDGE_RISING;
176+
inverted = true;
177+
break;
178+
default:
179+
break;
180+
}
181+
182+
if (inverted && d->hwirq != SYS_NIRQ1_EXT_SYS_IRQ_1 &&
183+
d->hwirq != SYS_NIRQ2_EXT_SYS_IRQ_2)
184+
pr_warn("wakeupgen: irq%li polarity inverted in dts\n",
185+
d->hwirq);
186+
187+
return irq_chip_set_type_parent(d, type);
188+
}
189+
156190
#ifdef CONFIG_HOTPLUG_CPU
157191
static DEFINE_PER_CPU(u32 [MAX_NR_REG_BANKS], irqmasks);
158192

@@ -446,7 +480,7 @@ static struct irq_chip wakeupgen_chip = {
446480
.irq_mask = wakeupgen_mask,
447481
.irq_unmask = wakeupgen_unmask,
448482
.irq_retrigger = irq_chip_retrigger_hierarchy,
449-
.irq_set_type = irq_chip_set_type_parent,
483+
.irq_set_type = wakeupgen_irq_set_type,
450484
.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND,
451485
#ifdef CONFIG_SMP
452486
.irq_set_affinity = irq_chip_set_affinity_parent,

drivers/bus/ti-sysc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -781,12 +781,12 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
781781
SYSC_QUIRK("smartreflex", 0, -1, 0x38, -1, 0x00000000, 0xffffffff,
782782
SYSC_QUIRK_LEGACY_IDLE),
783783
SYSC_QUIRK("timer", 0, 0, 0x10, 0x14, 0x00000015, 0xffffffff,
784-
SYSC_QUIRK_LEGACY_IDLE),
784+
0),
785785
/* Some timers on omap4 and later */
786786
SYSC_QUIRK("timer", 0, 0, 0x10, -1, 0x50002100, 0xffffffff,
787-
SYSC_QUIRK_LEGACY_IDLE),
787+
0),
788788
SYSC_QUIRK("timer", 0, 0, 0x10, -1, 0x4fff1301, 0xffff00ff,
789-
SYSC_QUIRK_LEGACY_IDLE),
789+
0),
790790
SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff,
791791
SYSC_QUIRK_LEGACY_IDLE),
792792
/* Uarts on omap4 and later */

drivers/clocksource/timer-ti-dm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ static int omap_dm_timer_of_set_source(struct omap_dm_timer *timer)
154154
if (IS_ERR(parent))
155155
return -ENODEV;
156156

157+
/* Bail out if both clocks point to fck */
158+
if (clk_is_match(parent, timer->fclk))
159+
return 0;
160+
157161
ret = clk_set_parent(timer->fclk, parent);
158162
if (ret < 0)
159163
pr_err("%s: failed to set parent\n", __func__);
@@ -864,7 +868,6 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
864868
timer->pdev = pdev;
865869

866870
pm_runtime_enable(dev);
867-
pm_runtime_irq_safe(dev);
868871

869872
if (!timer->reserved) {
870873
ret = pm_runtime_get_sync(dev);

0 commit comments

Comments
 (0)