Re: [PATCH 0/8] soc: samsung: Add USIv2 driver

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

 



On Sun, 2021-11-28 at 00:32 +0200, Sam Protsenko wrote:
> USIv2 IP-core provides selectable serial protocol (UART, SPI or
> High-Speed I2C); only one can be chosen at a time. This series
> implements USIv2 driver, which allows one to select particular USI
> function in device tree, and also performs USI block initialization.
> 
> With that driver implemented, it's not needed to do USI
> initialization
> in protocol drivers anymore, so that code is removed from the serial
> driver.
> 

I think the downstream way of doing this (USI node reg being on the
SW_CONF register itself rather than an offset from uart/i2c/spi, the
USI driver only controlling the SW_CONF, and the uart/i2c/spi drivers
controlling their USI_CON and USI_OPTION regs) is cleaner, better, and
easier to adapt to USIv1 too.

For example: I'm sure this is the case on USIv2 devices too, but on
Exynos7885, different devices have USI modes configured differently.
For example a Samsung Galaxy A8 (2018) has all the USI blocks
configured as SPI while a Samsung Galaxy M20 has the first USI
configured as dual HSI2C, the second as HSI2C on the first 2 pins and
the third as HSI2C on the last 2 pins. With this way of doing
everything on USIv2 we'd need 3 disabled USIv2 nodes in the SoC DTSI
for one USI block, each for every protocol the USI block can do, all
having a single child for their protocol and each referencing the same
sysreg (not even sure if that's even supported). Then the board DTS
could enable the USI node it needs.

With the downstream way we could have just one USI node and we could
add the 3 protocols it can do disabled as seperate or child nodes. This
way the board DTS only needs to set the appropriate mode setting and
enable the protocol it needs. I'd say much better than having 3 USI
nodes for the same USI block.

Also this way is pretty USIv2 centric. Adding USIv1 support to this
driver is difficult this way because of the the lack of USI_CON and
USI_OPTION registers as a whole (so having nowhere to actually set the
reg of the USI node to, as the only thing USIv1 has is the SW_CONF
register). In my opinion being able to use the same driver and same
device tree layout for USIv1 and USIv2 is a definite plus

The only real drawback of that way is having to add code for USIv2
inside the UART, HSI2C, and SPI drivers but in my opinion the benefits
overweigh the drawbacks greatly. We could even make the uart/spi/hsi2c
drivers call a helper function in the USI driver to set their USI_CON
and USI_OPTION registers up so that code would be shared and not
duplicated. Wether this patch gets applied like this is not my choice
though, I'll let the people responsible decide
:-)

Anyways, soon enough I can write an USIv1 driver after I submit all the
7885 stuff I'm working on currently. If you want to, you can add USIv2
support to that driver, or if an USIv2 driver is already in upstream at
that point, if it is written in the downstream way I can add v1 support
to that, or if it's like this I'll have to make a whole seperate driver
with a whole seperate DT structure.

Best regards,
David



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux