summaryrefslogtreecommitdiffstats
path: root/drivers/fsi/fsi-core.c
diff options
context:
space:
mode:
authorEddie James <eajames@us.ibm.com>2018-02-12 15:45:43 +1030
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-14 19:11:00 +0100
commit99f039e97bf8aa045d719b8e0a39ecdf396e362a (patch)
treeb7b4c84b517be1e0ac17db07451517dc3d234059 /drivers/fsi/fsi-core.c
parentb8bd146d38da5f4e683929412d59f93ad4d961c5 (diff)
downloadlinux-99f039e97bf8aa045d719b8e0a39ecdf396e362a.tar.bz2
fsi: Fix one and two byte bus reads/writes
Address checker fixed to allow one and two byte reads/writes. Address alignments for each size verified. Signed-off-by: Edward James <eajames@us.ibm.com> Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com> Acked-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/fsi/fsi-core.c')
-rw-r--r--drivers/fsi/fsi-core.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 6e5aa9b26665..e5dfece248a5 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -656,10 +656,13 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
/* FSI master support */
static int fsi_check_access(uint32_t addr, size_t size)
{
- if (size != 1 && size != 2 && size != 4)
- return -EINVAL;
-
- if ((addr & 0x3) != (size & 0x3))
+ if (size == 4) {
+ if (addr & 0x3)
+ return -EINVAL;
+ } else if (size == 2) {
+ if (addr & 0x1)
+ return -EINVAL;
+ } else if (size != 1)
return -EINVAL;
return 0;