[PATCH] arch: riscv: thead: implement basic spi
Kanak Shilledar
kanakshilledar at gmail.com
Mon Jul 1 02:13:46 PDT 2024
On Sun, Jun 30, 2024 at 7:22 PM Conor Dooley <conor at kernel.org> wrote:
>
> On Sun, Jun 30, 2024 at 12:08:20PM +0530, Kanak Shilledar wrote:
> > implemented basic spi support for TH1520 SoC.
> > created a fixed clock and a simple spi0 node.
> > updated the matching binding to include thead,th1520-spi as compatible.
> > added a spidev device in devicetree which will utilise the spi0 node.
> > this is usually reserved for a SPI NOR flash which is left unpopulated
> > underneath the carrier board. I performed a SPI self loop test using
> > tools/spi/spidev_test.c and tried sending `\xDE\xAD\xBE\xEF` and verified
> > it is being received correctly. i updated the of_device_id struct in
> > drivers/spi/spi-dw-mmio.c to include "thead,th1520-spi" as the compatible.
> > this patch also adds basic spi support on beaglev ahead which shares the
> > same TH1520 SoC. i have only tested on LicheePi 4A.
> >
> > Signed-off-by: Kanak Shilledar <kanakshilledar at gmail.com>
> > ---
> > .../devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 4 ++++
> > .../boot/dts/thead/th1520-beaglev-ahead.dts | 9 +++++++++
> > .../boot/dts/thead/th1520-lichee-module-4a.dtsi | 4 ++++
> > .../riscv/boot/dts/thead/th1520-lichee-pi-4a.dts | 10 ++++++++++
> > arch/riscv/boot/dts/thead/th1520.dtsi | 16 ++++++++++++++++
> > drivers/spi/spi-dw-mmio.c | 1 +
>
> This needs to be 3 different patches - one for the binding, one for the
> driver and a final one for the dts files.
I will convert this into a patch set of 3 patch as you suggested.
> > +
> > +&spi0 {
> > + status = "okay";
> > + spidev at 0 {
>
> "spidev" is not a type of device, the nodename should match the type.
>
> > + compatible = "rohm,dh2228fv";
> > + reg = <0>;
> > + spi-max-frequency = <500000>;
> > + };
> > +};
>
> I'll put money on you not having a dh2228fv on this board. Document what
> you actually have on it please, not what allows you to probe the spidev
> driver in linux.
Yes, you are right! Actually as per the vendor's kernel it should be a
"spi-nor" device from winbond.
I changed it to spidev for testing purposes. Shall I just leave it
with status = "okay" or add the node for
that spi-nor flash?
> Thanks,
> Conor.
Thanks and Regards,
Kanak Shilledar
More information about the linux-riscv
mailing list