Re: [PATCH v5 12/15] spi: dw: Add support for AMD Pensando Elba SoC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 13, 2022 at 9:57 PM Brad Larson <brad@xxxxxxxxxxx> wrote:
>
> From: Brad Larson <blarson@xxxxxxx>
>
> The AMD Pensando Elba SoC includes a DW apb_ssi v4 controller
> with device specific chip-select control.  The Elba SoC
> provides four chip-selects where the native DW IP supports
> two chip-selects.  The Elba DW_SPI instance has two native
> CS signals that are always overridden.

...

> +/*
> + * Elba SoC does not use ssi, pin override is used for cs 0,1 and
> + * gpios for cs 2,3 as defined in the device tree.
> + *
> + * cs:  |       1               0
> + * bit: |---3-------2-------1-------0
> + *      |  cs1   cs1_ovr   cs0   cs0_ovr
> + */

> +#define ELBA_SPICS_SHIFT(cs)           (2 * (cs))

Useless.It takes much more than simply multiplying each time in two
macros. Also see below.

> +#define ELBA_SPICS_MASK(cs)            (0x3 << ELBA_SPICS_SHIFT(cs))

(GENMASK(1, 0) << ((cs) << 1))

Or ((cs) * 2) to show that it takes 2 bits and not two times of CS',

> +#define ELBA_SPICS_SET(cs, val)        \
> +                       ((((val) << 1) | 0x1) << ELBA_SPICS_SHIFT(cs))

BIT(0)

So the main point is to use GENMASK() and BIT() the rest is up to you.

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux