devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
To: Sam Protsenko <semen.protsenko@linaro.org>,
	David Virag <virag.david003@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>, Mark Brown <broonie@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jaewon Kim <jaewon02.kim@samsung.com>,
	Chanho Park <chanho61.park@samsung.com>,
	Youngmin Nam <youngmin.nam@samsung.com>,
	devicetree@vger.kernel.org, linux-spi@vger.kernel.org,
	linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-i2c@vger.kernel.org
Subject: Re: [PATCH 0/8] soc: samsung: Add USIv2 driver
Date: Mon, 29 Nov 2021 18:35:51 +0100	[thread overview]
Message-ID: <5687bb27-973e-b774-b876-46c8dffc1176@canonical.com> (raw)
In-Reply-To: <CAPLW+4kkVNSvEQjVnSWA2BjkWJXzV-4n1i+10a9FCNL0sD0n3A@mail.gmail.com>

On 29/11/2021 14:56, Sam Protsenko wrote:
> On Sun, 28 Nov 2021 at 05:15, David Virag <virag.david003@gmail.com> wrote:
>>
>> 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
>>
> 
> Well, it's USIv2 driver after all. I never expected it can be extended
> for USIv1 support. If you think it can be reused for USIv1, it's fine
> by me. But we need to consider next things:
>   - rename the driver to just "usi.c" (and also its configuration symbol)
>   - provide different compatible for USIv1 (and maybe corresponding driver data)
>   - rework bindings (header and doc); make sure existing bindings are
> intact (we shouldn't change already introduced interfaces)
>   - in case of USIv1 compatible; don't try to tinker with USIv2 registers
>   - samsung,clkreq-on won't be available in case of USIv1 compatible

I expect this driver to be in future extended for USIv1 and I do not see
any problems in doing that for current Sam's approach. Most of our
drivers support several devices, sometimes with differences, and we
already have patterns solving it, e.g. ops structure or quirks bitmap.
Driver for new USIv1 compatible would skip setting USI_CON (or any other
unrelated register). Modification of SW_CONF could be shared or could be
also split, depending on complexity.

> 
> Because I don't have USIv1 SoC TRM (and neither do I possess some
> USIv1 board which I can use for test), I don't think it's my place to
> add USIv1 support. But I think it's possible to do so, using my input
> above.
> 
> I can see how it might be frustrating having to do some extra work
> (comparing to just using the code existing in downstream). But I guess
> that's the difference: vendor is mostly concerned about competitive
> advantage and getting to market fast, while upstream is more concerned
> about quality, considering all use cases, and having proper design.
> Anyway, we can work together to make it right, and to have both
> IP-cores support. In the worst case, if those are too different, we
> can have two separate drivers for those.
> 
>> 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
>> :-)
>>
> 
> I'd argue that there are a lot of real drawbacks of using downstream
> driver as is. That's why I completely re-designed and re-implemented
> it. Downstream driver can't be built and function as a module, it
> doesn't respect System Register sharing between consumers, it leads to
> USI reset code duplication scattered across protocol drivers (that
> arguably shouldn't even be aware of that), it doesn't reflect HW
> structure clearly, it's not holding clocks needed for registers access
> (btw, sysreg clock can be provided in syscon node, exactly for that
> reason). As Krzysztof said, it also can't handle correct probe order
> and deferred probes. Downstream driver might work fine for some
> particular use-cases the vendor has, but in upstream it's better to
> cover more cases we can expect, as upstream kernel is used on more
> platforms, with more user space variants, etc.

Implementing USI in each of I2C/SPI/UART drivers is a big minus. Current
approach nicely encapsulates USI in dedicated driver without polluting
the other drivers with unrelated bus/protocol stuff.

Best regards,
Krzysztof

  reply	other threads:[~2021-11-29 17:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-27 22:32 [PATCH 0/8] soc: samsung: Add USIv2 driver Sam Protsenko
2021-11-27 22:32 ` [PATCH 1/8] dt-bindings: soc: samsung: Add Exynos USIv2 bindings Sam Protsenko
2021-11-27 22:32 ` [PATCH 2/8] dt-bindings: soc: samsung: Add Exynos USIv2 bindings doc Sam Protsenko
2021-11-29  8:33   ` Krzysztof Kozlowski
2021-11-27 22:32 ` [PATCH 3/8] soc: samsung: Add USIv2 driver Sam Protsenko
2021-11-29  8:49   ` Krzysztof Kozlowski
2021-11-27 22:32 ` [PATCH 4/8] tty: serial: samsung: Remove USI initialization Sam Protsenko
2021-11-28 14:28   ` Greg Kroah-Hartman
2021-11-28 16:26     ` Sam Protsenko
2021-11-28 17:03       ` Sam Protsenko
2021-11-27 22:32 ` [PATCH 5/8] tty: serial: samsung: Enable console as module Sam Protsenko
2021-11-29  8:52   ` Krzysztof Kozlowski
2021-11-29 20:18     ` Sam Protsenko
2021-11-29 20:38       ` Sam Protsenko
2021-11-27 22:32 ` [PATCH 6/8] tty: serial: Make SERIAL_SAMSUNG=y impossible when EXYNOS_USI_V2=m Sam Protsenko
2021-11-28 14:27   ` Greg Kroah-Hartman
2021-11-28 23:54     ` Sam Protsenko
2021-11-27 22:32 ` [PATCH 7/8] i2c: Make I2C_EXYNOS5=y " Sam Protsenko
2021-11-29  0:02   ` Sam Protsenko
2021-11-27 22:32 ` [PATCH 8/8] spi: Make SPI_S3C64XX=y " Sam Protsenko
2021-11-29  0:02   ` Sam Protsenko
2021-11-28  3:15 ` [PATCH 0/8] soc: samsung: Add USIv2 driver David Virag
2021-11-29  9:02   ` Krzysztof Kozlowski
2021-11-29 13:56   ` Sam Protsenko
2021-11-29 17:35     ` Krzysztof Kozlowski [this message]
2021-11-29 19:19     ` David Virag
2021-11-30  0:01       ` Sam Protsenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5687bb27-973e-b774-b876-46c8dffc1176@canonical.com \
    --to=krzysztof.kozlowski@canonical.com \
    --cc=broonie@kernel.org \
    --cc=chanho61.park@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jaewon02.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=semen.protsenko@linaro.org \
    --cc=virag.david003@gmail.com \
    --cc=youngmin.nam@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).