From: Dirk Behme <dirk.behme@xxxxxxxxx> Instead of using a hard coded address in the driver for the boot mode register, optain it from the device tree. Signed-off-by: Dirk Behme <dirk.behme@xxxxxxxxx> --- drivers/misc/boot-mode-reg/rcar.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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: -- 2.8.0