Skip to content

Commit ca8f96f

Browse files
committed
Merge tag 'omap-for-v6.18/soc-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap into soc/arm
ARM: OMAP: SoC: updates for v6.18 * tag 'omap-for-v6.18/soc-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap: ARM: OMAP2+: clock: convert from round_rate() to determine_rate() ARM: OMAP1: clock: convert from round_rate() to determine_rate() arm: omap2: use string choices helper ARM: OMAP2+: pm33xx-core: ix device node reference leaks in amx3_idle_init ARM: OMAP2+: use IS_ERR_OR_NULL() helper ARM: AM33xx: Implement TI advisory 1.0.36 (EMU0/EMU1 pins state on reset) Link: https://lore.kernel.org/r/7h7bxup0ob.fsf@baylibre.com Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 1cdfe53 + bb67699 commit ca8f96f

8 files changed

Lines changed: 71 additions & 22 deletions

File tree

arch/arm/mach-omap1/clock.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -705,14 +705,21 @@ static unsigned long omap1_clk_recalc_rate(struct clk_hw *hw, unsigned long p_ra
705705
return clk->rate;
706706
}
707707

708-
static long omap1_clk_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *p_rate)
708+
static int omap1_clk_determine_rate(struct clk_hw *hw,
709+
struct clk_rate_request *req)
709710
{
710711
struct omap1_clk *clk = to_omap1_clk(hw);
711712

712-
if (clk->round_rate != NULL)
713-
return clk->round_rate(clk, rate, p_rate);
713+
if (clk->round_rate != NULL) {
714+
req->rate = clk->round_rate(clk, req->rate,
715+
&req->best_parent_rate);
714716

715-
return omap1_clk_recalc_rate(hw, *p_rate);
717+
return 0;
718+
}
719+
720+
req->rate = omap1_clk_recalc_rate(hw, req->best_parent_rate);
721+
722+
return 0;
716723
}
717724

718725
static int omap1_clk_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long p_rate)
@@ -771,7 +778,7 @@ const struct clk_ops omap1_clk_gate_ops = {
771778

772779
const struct clk_ops omap1_clk_rate_ops = {
773780
.recalc_rate = omap1_clk_recalc_rate,
774-
.round_rate = omap1_clk_round_rate,
781+
.determine_rate = omap1_clk_determine_rate,
775782
.set_rate = omap1_clk_set_rate,
776783
.init = omap1_clk_init_op,
777784
};
@@ -784,7 +791,7 @@ const struct clk_ops omap1_clk_full_ops = {
784791
.disable_unused = omap1_clk_disable_unused,
785792
#endif
786793
.recalc_rate = omap1_clk_recalc_rate,
787-
.round_rate = omap1_clk_round_rate,
794+
.determine_rate = omap1_clk_determine_rate,
788795
.set_rate = omap1_clk_set_rate,
789796
.init = omap1_clk_init_op,
790797
};

arch/arm/mach-omap2/am33xx-restart.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,46 @@
22
/*
33
* am33xx-restart.c - Code common to all AM33xx machines.
44
*/
5+
#include <dt-bindings/pinctrl/am33xx.h>
6+
#include <linux/delay.h>
57
#include <linux/kernel.h>
68
#include <linux/reboot.h>
79

810
#include "common.h"
11+
#include "control.h"
912
#include "prm.h"
1013

14+
/*
15+
* Advisory 1.0.36 EMU0 and EMU1: Terminals Must be Pulled High Before
16+
* ICEPick Samples
17+
*
18+
* If EMU0/EMU1 pins have been used as GPIO outputs and actively driving low
19+
* level, the device might not reboot in normal mode. We are in a bad position
20+
* to override GPIO state here, so just switch the pins into EMU input mode
21+
* (that's what reset will do anyway) and wait a bit, because the state will be
22+
* latched 190 ns after reset.
23+
*/
24+
static void am33xx_advisory_1_0_36(void)
25+
{
26+
u32 emu0 = omap_ctrl_readl(AM335X_PIN_EMU0);
27+
u32 emu1 = omap_ctrl_readl(AM335X_PIN_EMU1);
28+
29+
/* If both pins are in EMU mode, nothing to do */
30+
if (!(emu0 & 7) && !(emu1 & 7))
31+
return;
32+
33+
/* Switch GPIO3_7/GPIO3_8 into EMU0/EMU1 modes respectively */
34+
omap_ctrl_writel(emu0 & ~7, AM335X_PIN_EMU0);
35+
omap_ctrl_writel(emu1 & ~7, AM335X_PIN_EMU1);
36+
37+
/*
38+
* Give pull-ups time to load the pin/PCB trace capacity.
39+
* 5 ms shall be enough to load 1 uF (would be huge capacity for these
40+
* pins) with TI-recommended 4k7 external pull-ups.
41+
*/
42+
mdelay(5);
43+
}
44+
1145
/**
1246
* am33xx_restart - trigger a software restart of the SoC
1347
* @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
@@ -18,6 +52,8 @@
1852
*/
1953
void am33xx_restart(enum reboot_mode mode, const char *cmd)
2054
{
55+
am33xx_advisory_1_0_36();
56+
2157
/* TODO: Handle cmd if necessary */
2258
prm_reboot_mode = mode;
2359

arch/arm/mach-omap2/board-n8x0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static int n8x0_mmc_set_power_menelaus(struct device *dev, int slot,
167167

168168
#ifdef CONFIG_MMC_DEBUG
169169
dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1,
170-
power_on ? "on" : "off", vdd);
170+
str_on_off(power_on), vdd);
171171
#endif
172172
if (slot == 0) {
173173
if (!power_on)

arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ static unsigned long omap2_table_mpu_recalc(struct clk_hw *clk,
7070
* Some might argue L3-DDR, others ARM, others IVA. This code is simple and
7171
* just uses the ARM rates.
7272
*/
73-
static long omap2_round_to_table_rate(struct clk_hw *hw, unsigned long rate,
74-
unsigned long *parent_rate)
73+
static int omap2_determine_rate_to_table(struct clk_hw *hw,
74+
struct clk_rate_request *req)
7575
{
7676
const struct prcm_config *ptr;
7777
long highest_rate;
@@ -87,10 +87,12 @@ static long omap2_round_to_table_rate(struct clk_hw *hw, unsigned long rate,
8787
highest_rate = ptr->mpu_speed;
8888

8989
/* Can check only after xtal frequency check */
90-
if (ptr->mpu_speed <= rate)
90+
if (ptr->mpu_speed <= req->rate)
9191
break;
9292
}
93-
return highest_rate;
93+
req->rate = highest_rate;
94+
95+
return 0;
9496
}
9597

9698
/* Sets basic clocks based on the specified rate */
@@ -215,7 +217,7 @@ static void omap2xxx_clkt_vps_late_init(void)
215217
static const struct clk_ops virt_prcm_set_ops = {
216218
.recalc_rate = &omap2_table_mpu_recalc,
217219
.set_rate = &omap2_select_table_rate,
218-
.round_rate = &omap2_round_to_table_rate,
220+
.determine_rate = &omap2_determine_rate_to_table,
219221
};
220222

221223
/**

arch/arm/mach-omap2/pm33xx-core.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,15 @@ static int __init amx3_idle_init(struct device_node *cpu_node, int cpu)
388388
if (!state_node)
389389
break;
390390

391-
if (!of_device_is_available(state_node))
391+
if (!of_device_is_available(state_node)) {
392+
of_node_put(state_node);
392393
continue;
394+
}
393395

394396
if (i == CPUIDLE_STATE_MAX) {
395397
pr_warn("%s: cpuidle states reached max possible\n",
396398
__func__);
399+
of_node_put(state_node);
397400
break;
398401
}
399402

@@ -403,6 +406,7 @@ static int __init amx3_idle_init(struct device_node *cpu_node, int cpu)
403406
states[state_count].wfi_flags |= WFI_FLAG_WAKE_M3 |
404407
WFI_FLAG_FLUSH_CACHE;
405408

409+
of_node_put(state_node);
406410
state_count++;
407411
}
408412

arch/arm/mach-omap2/powerdomain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u8 pwrst)
11111111
int curr_pwrst;
11121112
int ret = 0;
11131113

1114-
if (!pwrdm || IS_ERR(pwrdm))
1114+
if (IS_ERR_OR_NULL(pwrdm))
11151115
return -EINVAL;
11161116

11171117
while (!(pwrdm->pwrsts & (1 << pwrst))) {

arch/arm/mach-omap2/voltage.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static LIST_HEAD(voltdm_list);
5151
*/
5252
unsigned long voltdm_get_voltage(struct voltagedomain *voltdm)
5353
{
54-
if (!voltdm || IS_ERR(voltdm)) {
54+
if (IS_ERR_OR_NULL(voltdm)) {
5555
pr_warn("%s: VDD specified does not exist!\n", __func__);
5656
return 0;
5757
}
@@ -73,7 +73,7 @@ static int voltdm_scale(struct voltagedomain *voltdm,
7373
int ret, i;
7474
unsigned long volt = 0;
7575

76-
if (!voltdm || IS_ERR(voltdm)) {
76+
if (IS_ERR_OR_NULL(voltdm)) {
7777
pr_warn("%s: VDD specified does not exist!\n", __func__);
7878
return -EINVAL;
7979
}
@@ -124,7 +124,7 @@ void voltdm_reset(struct voltagedomain *voltdm)
124124
{
125125
unsigned long target_volt;
126126

127-
if (!voltdm || IS_ERR(voltdm)) {
127+
if (IS_ERR_OR_NULL(voltdm)) {
128128
pr_warn("%s: VDD specified does not exist!\n", __func__);
129129
return;
130130
}
@@ -154,7 +154,7 @@ void voltdm_reset(struct voltagedomain *voltdm)
154154
void omap_voltage_get_volttable(struct voltagedomain *voltdm,
155155
struct omap_volt_data **volt_data)
156156
{
157-
if (!voltdm || IS_ERR(voltdm)) {
157+
if (IS_ERR_OR_NULL(voltdm)) {
158158
pr_warn("%s: VDD specified does not exist!\n", __func__);
159159
return;
160160
}
@@ -182,7 +182,7 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
182182
{
183183
int i;
184184

185-
if (!voltdm || IS_ERR(voltdm)) {
185+
if (IS_ERR_OR_NULL(voltdm)) {
186186
pr_warn("%s: VDD specified does not exist!\n", __func__);
187187
return ERR_PTR(-EINVAL);
188188
}
@@ -216,7 +216,7 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
216216
int omap_voltage_register_pmic(struct voltagedomain *voltdm,
217217
struct omap_voltdm_pmic *pmic)
218218
{
219-
if (!voltdm || IS_ERR(voltdm)) {
219+
if (IS_ERR_OR_NULL(voltdm)) {
220220
pr_warn("%s: VDD specified does not exist!\n", __func__);
221221
return -EINVAL;
222222
}

arch/arm/mach-omap2/vp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void omap_vp_enable(struct voltagedomain *voltdm)
199199
struct omap_vp_instance *vp;
200200
u32 vpconfig, volt;
201201

202-
if (!voltdm || IS_ERR(voltdm)) {
202+
if (IS_ERR_OR_NULL(voltdm)) {
203203
pr_warn("%s: VDD specified does not exist!\n", __func__);
204204
return;
205205
}
@@ -244,7 +244,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
244244
u32 vpconfig;
245245
int timeout;
246246

247-
if (!voltdm || IS_ERR(voltdm)) {
247+
if (IS_ERR_OR_NULL(voltdm)) {
248248
pr_warn("%s: VDD specified does not exist!\n", __func__);
249249
return;
250250
}

0 commit comments

Comments
 (0)