diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2018-06-03 21:40:19 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2018-06-03 21:40:19 +1000 |
commit | 52122ff10406e774c08cd01472e6b6138bb5f8f4 (patch) | |
tree | fd5169eb7f38148918e95e46fe83582a91c4e04e | |
parent | 43c93dbd0072e35b9104f7039790cb44bdf9745b (diff) | |
download | cf-fsi-52122ff10406e774c08cd01472e6b6138bb5f8f4.tar.gz cf-fsi-52122ff10406e774c08cd01472e6b6138bb5f8f4.zip |
Fix problems with write commands (CRC incorrect and endian issues)
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | cf-fsi-test.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/cf-fsi-test.c b/cf-fsi-test.c index e70aad9..73a339d 100644 --- a/cf-fsi-test.c +++ b/cf-fsi-test.c @@ -475,11 +475,13 @@ int test_rw(uint32_t addr, bool is_write, uint32_t *data) struct fsi_gpio_msg cmd; uint32_t op, resp = 0, crc; uint8_t rtag, rcrc, ack; + uint32_t be_data; int rc; - if (is_write) - build_ar_command(&cmd, 0, addr, 4, &data); - else + if (is_write) { + be_data = htonl(*data); + build_ar_command(&cmd, 0, addr, 4, &be_data); + } else build_ar_command(&cmd, 0, addr, 4, NULL); /* Left align message */ @@ -491,7 +493,8 @@ int test_rw(uint32_t addr, bool is_write, uint32_t *data) op = CMD_COMMAND; op |= cmd.bits << CMD_REG_CLEN_SHIFT; - op |= 32 << CMD_REG_RLEN_SHIFT; + if (!is_write) + op |= 32 << CMD_REG_RLEN_SHIFT; rc = do_command(op); if (rc) { |