Message ID | 1462778041-19595-11-git-send-email-dirk.behme@de.bosch.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Simon Horman |
Headers | show |
On Mon, May 9, 2016 at 9:14 AM, Dirk Behme <dirk.behme@de.bosch.com> wrote: > --- a/drivers/misc/boot-mode-reg/rcar.c > +++ b/drivers/misc/boot-mode-reg/rcar.c > @@ -16,24 +16,32 @@ > #include <linux/io.h> > #include <linux/module.h> > #include <linux/of.h> > +#include <linux/of_address.h> > > #include <misc/boot-mode-reg.h> > > -#define MODEMR 0xe6160060 > - > static int __init rcar_read_mode_pins(void) > { > void __iomem *modemr; > + struct device_node *np; > int err = -ENOMEM; > static u32 mode; > > - modemr = ioremap_nocache(MODEMR, 4); > + np = of_find_compatible_node(NULL, NULL, "renesas,modemr"); > + if (!np) { > + pr_err("can't find renesas,modemr device node"); > + goto err; At least for R-Car Gen2, we need to preserve compatibility with old DTBs that don't have the node in DT. > + } > + > + modemr = of_iomap(np, 0); Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
diff --git a/drivers/misc/boot-mode-reg/rcar.c b/drivers/misc/boot-mode-reg/rcar.c index e994980..2cfbf9c 100644 --- a/drivers/misc/boot-mode-reg/rcar.c +++ b/drivers/misc/boot-mode-reg/rcar.c @@ -16,24 +16,32 @@ #include <linux/io.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_address.h> #include <misc/boot-mode-reg.h> -#define MODEMR 0xe6160060 - static int __init rcar_read_mode_pins(void) { void __iomem *modemr; + struct device_node *np; int err = -ENOMEM; static u32 mode; - modemr = ioremap_nocache(MODEMR, 4); + np = of_find_compatible_node(NULL, NULL, "renesas,modemr"); + if (!np) { + pr_err("can't find renesas,modemr device node"); + goto err; + } + + modemr = of_iomap(np, 0); if (!modemr) { pr_err("failed to map boot mode register"); + of_node_put(np); goto err; } mode = ioread32(modemr); iounmap(modemr); + of_node_put(np); err = boot_mode_reg_set(mode); err: