Skip to content

Commit e9c7831

Browse files
Merge tag 'rcar_rst_rproc-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel into rproc-next
Renesas R-Car Reset Controller remoteproc API Definition of rcar_rst_set_rproc_boot_addr(), to be consumed by the Renesas R-Car Gen3 remote processor driver. Signed-off-by: Mathieu Poirier <[email protected]>
2 parents 8f86e69 + 4c7924f commit e9c7831

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed

drivers/soc/renesas/rcar-rst.c

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,43 @@
1313
#define WDTRSTCR_RESET 0xA55A0002
1414
#define WDTRSTCR 0x0054
1515

16+
#define CR7BAR 0x0070
17+
#define CR7BAREN BIT(4)
18+
#define CR7BAR_MASK 0xFFFC0000
19+
20+
static void __iomem *rcar_rst_base;
21+
static u32 saved_mode __initdata;
22+
static int (*rcar_rst_set_rproc_boot_addr_func)(u64 boot_addr);
23+
1624
static int rcar_rst_enable_wdt_reset(void __iomem *base)
1725
{
1826
iowrite32(WDTRSTCR_RESET, base + WDTRSTCR);
1927
return 0;
2028
}
2129

30+
/*
31+
* Most of the R-Car Gen3 SoCs have an ARM Realtime Core.
32+
* Firmware boot address has to be set in CR7BAR before
33+
* starting the realtime core.
34+
* Boot address must be aligned on a 256k boundary.
35+
*/
36+
static int rcar_rst_set_gen3_rproc_boot_addr(u64 boot_addr)
37+
{
38+
if (boot_addr & ~(u64)CR7BAR_MASK) {
39+
pr_err("Invalid boot address got %llx\n", boot_addr);
40+
return -EINVAL;
41+
}
42+
43+
iowrite32(boot_addr, rcar_rst_base + CR7BAR);
44+
iowrite32(boot_addr | CR7BAREN, rcar_rst_base + CR7BAR);
45+
46+
return 0;
47+
}
48+
2249
struct rst_config {
2350
unsigned int modemr; /* Mode Monitoring Register Offset */
2451
int (*configure)(void __iomem *base); /* Platform specific config */
52+
int (*set_rproc_boot_addr)(u64 boot_addr);
2553
};
2654

2755
static const struct rst_config rcar_rst_gen1 __initconst = {
@@ -35,6 +63,7 @@ static const struct rst_config rcar_rst_gen2 __initconst = {
3563

3664
static const struct rst_config rcar_rst_gen3 __initconst = {
3765
.modemr = 0x60,
66+
.set_rproc_boot_addr = rcar_rst_set_gen3_rproc_boot_addr,
3867
};
3968

4069
static const struct rst_config rcar_rst_r8a779a0 __initconst = {
@@ -76,9 +105,6 @@ static const struct of_device_id rcar_rst_matches[] __initconst = {
76105
{ /* sentinel */ }
77106
};
78107

79-
static void __iomem *rcar_rst_base __initdata;
80-
static u32 saved_mode __initdata;
81-
82108
static int __init rcar_rst_init(void)
83109
{
84110
const struct of_device_id *match;
@@ -100,6 +126,8 @@ static int __init rcar_rst_init(void)
100126

101127
rcar_rst_base = base;
102128
cfg = match->data;
129+
rcar_rst_set_rproc_boot_addr_func = cfg->set_rproc_boot_addr;
130+
103131
saved_mode = ioread32(base + cfg->modemr);
104132
if (cfg->configure) {
105133
error = cfg->configure(base);
@@ -130,3 +158,12 @@ int __init rcar_rst_read_mode_pins(u32 *mode)
130158
*mode = saved_mode;
131159
return 0;
132160
}
161+
162+
int rcar_rst_set_rproc_boot_addr(u64 boot_addr)
163+
{
164+
if (!rcar_rst_set_rproc_boot_addr_func)
165+
return -EIO;
166+
167+
return rcar_rst_set_rproc_boot_addr_func(boot_addr);
168+
}
169+
EXPORT_SYMBOL_GPL(rcar_rst_set_rproc_boot_addr);

include/linux/soc/renesas/rcar-rst.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
#ifdef CONFIG_RST_RCAR
66
int rcar_rst_read_mode_pins(u32 *mode);
7+
int rcar_rst_set_rproc_boot_addr(u64 boot_addr);
78
#else
89
static inline int rcar_rst_read_mode_pins(u32 *mode) { return -ENODEV; }
10+
static inline int rcar_rst_set_rproc_boot_addr(u64 boot_addr) { return -ENODEV; }
911
#endif
1012

1113
#endif /* __LINUX_SOC_RENESAS_RCAR_RST_H__ */

0 commit comments

Comments
 (0)