[PATCH v2 13/14] spi: bcmbca-hsspi: Add driver for newer HSSPI controller

William Zhang william.zhang at broadcom.com
Thu Jan 26 18:17:58 PST 2023



On 01/26/2023 07:16 AM, Jonas Gorski wrote:
>> +static void bcmbca_hsspi_set_cs(struct bcmbca_hsspi *bs, unsigned int cs,
>> +                                bool active)
>> +{
>> +       u32 reg;
>> +
>> +       /* No cs orerriden needed for SS7 internal cs on pcm based voice dev */
>> +       if (cs == 7)
>> +               return;
>> +
>> +       mutex_lock(&bs->bus_mutex);
>> +
>> +       if (active) {
>> +               /* activate cs by setting the override bit and active value bit*/
>> +               reg = __raw_readl(bs->spim_ctrl);
>> +               reg |= BIT(cs+SPIM_CTRL_CS_OVERRIDE_SEL_SHIFT);
> 
> Doesn't checkpatch complain about missing spaces around the operator (+)?
> 
Nope...

>> +               reg &= ~BIT(cs+SPIM_CTRL_CS_OVERRIDE_VAL_SHIFT);
>> +               if (bs->cs_polarity & BIT(cs))
>> +                       reg |= BIT(cs+SPIM_CTRL_CS_OVERRIDE_VAL_SHIFT);
> 
> Does the CS_OVERRIDE_VAL get reset on clearing the OVERRIDE_SEL bit or
> it is persistent? If the latter, you could initialize its value in
> bcmbca_hsspi_setup() and then this becomes:
> 
> reg = _raw_readl(bs->spim_ctrl);
> if (active)
>     reg |= BIT(cs+SPIM_CTRL_CS_OVERRIDE_SEL_SHIFT);
> else
>     reg &= ~BIT(cs + SPIM_CTRL_CS_OVERRIDE_SEL_SHIFT);
>   __raw_writel(reg, bs->spim_ctrl);
> 
> and you can drop the cs_polarity field.
> 
> 
No. So I will try this optimization and see if that actually works in 
the controller.

>> +               __raw_writel(reg, bs->spim_ctrl);
>> +       } else {
>> +               /* clear the cs override bit */
>> +               reg = __raw_readl(bs->spim_ctrl);
>> +               reg &= ~BIT(cs+SPIM_CTRL_CS_OVERRIDE_SEL_SHIFT);
>> +               __raw_writel(reg, bs->spim_ctrl);
>> +       }
>> +
>> +       mutex_unlock(&bs->bus_mutex);
>> +}
>> +
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4212 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20230126/efe5807b/attachment.p7s>


More information about the linux-arm-kernel mailing list