drivers/fsi: Adjust slave ID based on address
PATCH v2 1/1 drivers/fsi: Adjust slave ID based on address
In order to access slave address ranges > 0x1FFFFF the slave ID must be adjusted accordingly in the command encoding:
ID 0: 0x00000000 - 0x001FFFFF
ID 1: 0x00200000 - 0x003FFFFF
ID 2: 0x00400000 - 0x005FFFFF
ID 3: 0x00600000 - 0x007FFFFF
---
Changes in V2
- Remove alignment masking as per recommendation of Alistair Popple <[email protected]>
--- drivers/fsi/fsi-master-gpio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/fsi/fsi-master-gpio.c +5 -1
@@ -40,6 +40,9 @@#define FSI_GPIO_CMD_DFLT_LEN 28#define FSI_GPIO_CMD_CRC_SHIFT 60 +#define FSI_SLAVE_SHIFT 21 +#define FSI_SLAVE_MASK 0x3 +/* Bus errors */ #define FSI_GPIO_ERR_BUSY 1/* Slave stuck in busy state */ #define FSI_GPIO_RESP_ERRA 2/* Any (misc) Error */
@@ -305,7 +308,8 @@ static void build_abs_ar_command(struct fsi_gpio_msg *cmd, uint64_t mode, cmd->bits =FSI_GPIO_CMD_DFLT_LEN ; cmd->msg =FSI_GPIO_CMD_DEFAULT ; cmd->msg |= mode; - cmd->msg &= ~FSI_GPIO_CMD_SLAVE_MASK ; +if (!slave) + slave = (addr >>FSI_SLAVE_SHIFT ) &FSI_SLAVE_MASK ; cmd->msg |= (((uint64_t )slave) <<FSI_GPIO_CMD_SLV_SHIFT ); addr &=FSI_GPIO_CMD_ADDR_MASK ; cmd->msg |= (((uint64_t )addr) <<FSI_GPIO_CMD_ADDR_SHIFT );
Signature · 1 line
1.8.2.2
Looks good to me.
Quoted 43 lines · Christopher Bostic
In order to access slave address ranges >
0x1FFFFFthe slave ID must be adjusted accordingly in the command encoding:ID 0:
0x00000000-0x001FFFFF
ID 1:0x00200000-0x003FFFFF
ID 2:0x00400000-0x005FFFFF
ID 3:0x00600000-0x007FFFFFSigned-off-by Christopher Bostic <[email protected]>---
Changes in V2
- Remove alignment masking as per recommendation of Alistair Popple <[email protected]>--- drivers/fsi/fsi-master-gpio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/fsi/fsi-master-gpio.c +5
-1@@ -40,6 +40,9 @@#define FSI_GPIO_CMD_DFLT_LEN 28#define FSI_GPIO_CMD_CRC_SHIFT 60 +#define FSI_SLAVE_SHIFT 21 +#define FSI_SLAVE_MASK 0x3 +/* Bus errors */ #define FSI_GPIO_ERR_BUSY 1/* Slave stuck in busy state */ #define FSI_GPIO_RESP_ERRA 2/* Any (misc) Error */ @@ -305,7 +308,8 @@ static void build_abs_ar_command(struct fsi_gpio_msg *cmd, uint64_t mode, cmd->bits =FSI_GPIO_CMD_DFLT_LEN ; cmd->msg =FSI_GPIO_CMD_DEFAULT ; cmd->msg |= mode; - cmd->msg &= ~FSI_GPIO_CMD_SLAVE_MASK ; +if (!slave) + slave = (addr >>FSI_SLAVE_SHIFT ) &FSI_SLAVE_MASK ; cmd->msg |= (((uint64_t )slave) <<FSI_GPIO_CMD_SLV_SHIFT ); addr &=FSI_GPIO_CMD_ADDR_MASK ; cmd->msg |= (((uint64_t )addr) <<FSI_GPIO_CMD_ADDR_SHIFT );
Quoted 16 lines · Eddie James
Looks good to me.
Reviewed-by Eddie James <[email protected]>Quoted 10 lines · Christopher Bostic
In order to access slave address ranges >
0x1FFFFFthe slave ID must be adjusted accordingly in the command encoding:ID 0:
0x00000000-0x001FFFFF
ID 1:0x00200000-0x003FFFFF
ID 2:0x00400000-0x005FFFFF
ID 3:0x00600000-0x007FFFFFSigned-off-by Christopher Bostic <[email protected]>
via the magic of instant messaging:
Merged into dev-4.7.
Chris, please make sure you incorporate this fix into the series you're sending upstream.
Cheers,
Joel