diff options
author | T Karthik Reddy <t.karthik.reddy@xilinx.com> | 2019-03-13 20:24:18 +0530 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2019-04-16 11:51:34 +0200 |
commit | be52372ff1bb52872e20543562b095424f040564 (patch) | |
tree | 5f045d7122601f9062811dd05f2e7cf1eef571f3 | |
parent | 1a474381b6f709582c5d71d0d7cc826ab96f8411 (diff) | |
download | u-boot-be52372ff1bb52872e20543562b095424f040564.zip u-boot-be52372ff1bb52872e20543562b095424f040564.tar.gz u-boot-be52372ff1bb52872e20543562b095424f040564.tar.bz2 |
arm64: zynqmp: Use zynqmp_mmio_read/write functions
Changed the return type of reset_reason() to int from u32, because
zynqmp_mmio_read/write() returns signed value on error.
Replaced readl and writel functions with zynqmp_mmio_read &
zynqmp_mmio_write functions to access RESET_REASON(CRL_APB) registers.
Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
-rw-r--r-- | board/xilinx/zynqmp/zynqmp.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index db27247..1e9e441 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -482,18 +482,20 @@ static const struct { {} }; -static u32 reset_reason(void) +static int reset_reason(void) { - u32 ret; - int i; + u32 reg; + int i, ret; const char *reason = NULL; - ret = readl(&crlapb_base->reset_reason); + ret = zynqmp_mmio_read((ulong)&crlapb_base->reset_reason, ®); + if (ret) + return -EINVAL; puts("Reset reason:\t"); for (i = 0; i < ARRAY_SIZE(reset_reasons); i++) { - if (ret & reset_reasons[i].bit) { + if (reg & reset_reasons[i].bit) { reason = reset_reasons[i].name; printf("%s ", reset_reasons[i].name); break; @@ -504,7 +506,9 @@ static u32 reset_reason(void) env_set("reset_reason", reason); - writel(~0, &crlapb_base->reset_reason); + ret = zynqmp_mmio_write(~0, ~0, (ulong)&crlapb_base->reset_reason); + if (ret) + return -EINVAL; return ret; } |