[PATCH v5 2/6] i3c: mipi-i3c-hci: Read HC_CONTROL_PIO_MODE only after i3c hci v1.1

Jarkko Nikula jarkko.nikula at linux.intel.com
Tue Aug 27 00:23:06 PDT 2024


Hi

On 8/23/24 5:19 PM, Shyam Sundar S K wrote:
> The HC_CONTROL_PIO_MODE bit was introduced in the HC_CONTROL register
> starting from version 1.1. Therefore, checking the HC_CONTROL_PIO_MODE bit
> on hardware that adheres to older specification revisions (i.e., versions
> earlier than 1.1) is incorrect. To address this, add an additional check
> to read the HCI version before attempting to read the HC_CONTROL_PIO_MODE
> status.
> 
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k at amd.com>
> ---
>   drivers/i3c/master/mipi-i3c-hci/core.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
> index 07de1cecfa30..42d2362d072b 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
> @@ -630,8 +630,8 @@ static irqreturn_t i3c_hci_irq_handler(int irq, void *dev_id)
>   
>   static int i3c_hci_init(struct i3c_hci *hci)
>   {
> +	bool size_in_dwords, pio_mode_support;
>   	u32 regval, offset;
> -	bool size_in_dwords;
>   	int ret;
>   
>   	/* Validate HCI hardware version */
> @@ -753,10 +753,13 @@ static int i3c_hci_init(struct i3c_hci *hci)
>   		return -EINVAL;
>   	}
>   
> +	pio_mode_support = hci->version_major > 1 ||
> +				(hci->version_major == 1  && hci->version_minor > 0) ? true : false;
> +
I'd rename this as mode_selector etc. since I've understood PIO mode is 
possible in earlier version(s) too.

Also latter part of statement "? true : false" is needless.



More information about the linux-i3c mailing list