From 2a4b53f9bfae5c4342574c983526babbe0a24160 Mon Sep 17 00:00:00 2001 From: Kedareswara rao Appana Date: Tue, 21 Apr 2015 11:36:49 +0530 Subject: [PATCH] mcap: linux: Dump all registers option (-d) Returns "Failed Reading Registers" when -d option is used to dump all the registers, It should ignore the Data register if it's empty or Not set and should not return a failure in reading those registers. Signed-off-by: Kedareswara rao Appana --- mcap/linux/mcap_lib.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/mcap/linux/mcap_lib.c b/mcap/linux/mcap_lib.c index bfe8a910..aaa14423 100644 --- a/mcap/linux/mcap_lib.c +++ b/mcap/linux/mcap_lib.c @@ -423,8 +423,12 @@ static int MCapReadDataRegisters(struct mcap_dev *mdev, u32 *data) MCapRegWrite(mdev, MCAP_CONTROL, set); read_cnt = GetRegReadCount(mdev); - if (IsErrSet(mdev) || IsFifoOverflow(mdev) || - !(read_cnt) || !(IsRegReadComplete(mdev))) { + if (!(read_cnt) || !(IsRegReadComplete(mdev))) { + MCapRegWrite(mdev, MCAP_CONTROL, restore); + return EMCAPREAD; + } + + if (IsErrSet(mdev) || IsFifoOverflow(mdev)) { pr_err("Read Register Set Configuration Failed\n"); MCapRegWrite(mdev, MCAP_CONTROL, restore); return -EMCAPREAD; @@ -454,11 +458,16 @@ static int MCapReadDataRegisters(struct mcap_dev *mdev, u32 *data) void MCapDumpReadRegs(struct mcap_dev *mdev) { u32 data[4]; + u32 status; - if (MCapReadDataRegisters(mdev, data)) { + status = MCapReadDataRegisters(mdev, data); + if (status == EMCAPREAD) + return; + + if (status) { pr_err("Failed Reading Registers.. This may be"); - pr_err("due to inappropriate FPGA configuration."); - pr_err("Make sure you downloaded the correct bitstream\n"); + pr_err(" due to inappropriate FPGA configuration."); + pr_err(" Make sure you downloaded the correct bitstream\n"); return; } pr_info("Register Read Data 0:\t0x%08x\n", data[0]);