Page MenuHomeFreeBSD

Add SPI driver for Rockchip platform
ClosedPublic

Authored by gonzo on Oct 24 2019, 10:07 PM.

Details

Summary

SPI driver for Rockchip IP works only in PIO mode for now. DMA is not supported yet.
For now the driver supports only RK3399 compatibility string but it should work with older SoCs too.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

gonzo created this revision.Oct 24 2019, 10:07 PM
gonzo updated this revision to Diff 63654.Oct 24 2019, 10:11 PM

Add GENERIC config change

gonzo updated this revision to Diff 63668.Oct 25 2019, 5:02 PM

Add clocks bit

manu added inline comments.Oct 25 2019, 5:16 PM
sys/arm64/rockchip/clk/rk3399_cru.c
1587 ↗(On Diff #63668)

hack leftovers.

1618 ↗(On Diff #63668)

hack leftovers.

manu added inline comments.Oct 25 2019, 5:54 PM
sys/arm64/rockchip/rk_spi.c
150 ↗(On Diff #63668)

IP only have CS0 and CS1, we should add a checks here and return EINVAL

191 ↗(On Diff #63668)

Is this needed ?
and if it is why not doing the same for the rxfifo ?

gonzo updated this revision to Diff 63670.Oct 25 2019, 6:34 PM

Remove hack leftovers

gonzo marked 2 inline comments as done.Oct 25 2019, 6:34 PM
gonzo added inline comments.
sys/arm64/rockchip/rk_spi.c
191 ↗(On Diff #63668)

This is what Linux driver does and I think it's to handle SPI chips on older SoCs. RX fifo has the same size as TX fifo AFAIK, so there is no need to do it twice.

gonzo updated this revision to Diff 63677.Oct 25 2019, 8:16 PM

Check value of CS and return EINVAL if it's more than max

manu accepted this revision.Oct 25 2019, 8:26 PM

OK for me.
If you could split the commits between clocks and driver that would be great.

This revision is now accepted and ready to land.Oct 25 2019, 8:26 PM
This revision was automatically updated to reflect the committed changes.