From: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Rob Herring <robh@kernel.org>, Conor Dooley <conor+dt@kernel.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Sam Protsenko <semen.protsenko@linaro.org>,
Peter Griffin <peter.griffin@linaro.org>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/3] soc: samsung: usi: implement support for USIv1 and exynos8895
Date: Wed, 8 Jan 2025 11:45:02 +0200 [thread overview]
Message-ID: <c30a6f1b-b1a9-40db-b673-e6fc47bdb224@gmail.com> (raw)
In-Reply-To: <e28abf31-3d91-4d1b-97e6-202df5ebb3f5@kernel.org>
On 1/8/25 11:26, Krzysztof Kozlowski wrote:
> On 08/01/2025 10:17, Ivaylo Ivanov wrote:
>> On 1/8/25 10:30, Krzysztof Kozlowski wrote:
>>> On Tue, Jan 07, 2025 at 01:35:11PM +0200, Ivaylo Ivanov wrote:
>>>> USIv1 IP-core is found on some ARM64 Exynos SoCs (like Exynos8895) and
>>>> provides selectable serial protocols (one of: HSI2C0, HSI2C1, HSI2C0_1,
>>>> SPI, UART, UART_HSI2C1).
>>>>
>>>> USIv1, unlike USIv2, doesn't have any known register map. Underlying
>>>> protocols that it implements have no offset, like with Exynos850.
>>>> Desired protocol can be chosen via SW_CONF register from System
>>>> Register block of the same domain as USI.
>>>>
>>>> In order to select a particular protocol, the protocol has to be
>>>> selected via the System Register. Unlike USIv2, there's no need for
>>>> any setup before the given protocol becomes accessible apart from
>>>> enabling the APB clock and the protocol operating clock.
>>>>
>>>> Modify the existing driver in order to allow USIv1 instances in
>>>> Exynos8895 to probe and set their protocol. While we're at it,
>>>> make use of the new mode constants in place of the old ones
>>>> and add a removal routine.
>>>>
>>>> Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
>>>> ---
>>>> drivers/soc/samsung/exynos-usi.c | 108 +++++++++++++++++++++++++++----
>>>> 1 file changed, 95 insertions(+), 13 deletions(-)
>>>>
>>>> diff --git a/drivers/soc/samsung/exynos-usi.c b/drivers/soc/samsung/exynos-usi.c
>>>> index 114352695..43c17b100 100644
>>>> --- a/drivers/soc/samsung/exynos-usi.c
>>>> +++ b/drivers/soc/samsung/exynos-usi.c
>>>> @@ -16,6 +16,18 @@
>>>>
>>>> #include <dt-bindings/soc/samsung,exynos-usi.h>
>>>>
>>>> +/* USIv1: System Register: SW_CONF register bits */
>>>> +#define USI_V1_SW_CONF_NONE 0x0
>>>> +#define USI_V1_SW_CONF_I2C0 0x1
>>>> +#define USI_V1_SW_CONF_I2C1 0x2
>>>> +#define USI_V1_SW_CONF_I2C0_1 0x3
>>>> +#define USI_V1_SW_CONF_SPI 0x4
>>>> +#define USI_V1_SW_CONF_UART 0x8
>>>> +#define USI_V1_SW_CONF_UART_I2C1 0xa
>>>> +#define USI_V1_SW_CONF_MASK (USI_V1_SW_CONF_I2C0 | USI_V1_SW_CONF_I2C1 | \
>>>> + USI_V1_SW_CONF_I2C0_1 | USI_V1_SW_CONF_SPI | \
>>>> + USI_V1_SW_CONF_UART | USI_V1_SW_CONF_UART_I2C1)
>>>> +
>>>> /* USIv2: System Register: SW_CONF register bits */
>>>> #define USI_V2_SW_CONF_NONE 0x0
>>>> #define USI_V2_SW_CONF_UART BIT(0)
>>>> @@ -34,7 +46,8 @@
>>>> #define USI_OPTION_CLKSTOP_ON BIT(2)
>>>>
>>>> enum exynos_usi_ver {
>>>> - USI_VER2 = 2,
>>>> + USI_VER1 = 1,
>>> Is this assignment=1 actually now helping? Isn't it creating empty item
>>> in exynos_usi_modes array? Basically it wastes space in the array for
>>> no benefits.
>> I wanted to keep the USIv2 enum the same.
> Is there any need for keeping it the same?
No, not really.
>
>>>> + USI_VER2,
>>>> };
>
> ...
>
>>>> +
>>>> + return ret;
>>>> +}
>>>> +
>>>> +static void exynos_usi_remove(struct platform_device *pdev)
>>>> +{
>>>> + struct exynos_usi *usi = platform_get_drvdata(pdev);
>>>> +
>>>> + if (usi->data->ver == USI_VER2)
>>>> + exynos_usi_disable(usi);
>>> This is not related to the patch and should be separate patch, if at
>>> all.
>> Well I though that since didn't have any removal routine before it'd be good
>> to introduce that and not leave USIv2 with hwacg set.
> Sure, but separate commit, please. Can be preceeding the USIv1 support.
What about right after the USIv1 support? It would be less messy in my
opinion.
>
> Best regards,
> Krzysztof
next prev parent reply other threads:[~2025-01-08 9:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 11:35 [PATCH v4 0/3] soc: samsung: usi: implement support for USIv1 Ivaylo Ivanov
2025-01-07 11:35 ` [PATCH v4 1/3] dt-bindings: soc: samsung: usi: add USIv1 and samsung,exynos8895-usi Ivaylo Ivanov
2025-01-08 8:30 ` Krzysztof Kozlowski
2025-01-07 11:35 ` [PATCH v4 2/3] soc: samsung: usi: implement support for USIv1 and exynos8895 Ivaylo Ivanov
2025-01-08 8:30 ` Krzysztof Kozlowski
2025-01-08 9:17 ` Ivaylo Ivanov
2025-01-08 9:26 ` Krzysztof Kozlowski
2025-01-08 9:45 ` Ivaylo Ivanov [this message]
2025-01-08 10:08 ` Krzysztof Kozlowski
2025-01-07 11:35 ` [PATCH v4 3/3] arm64: dts: exynos: update all samsung,mode constants Ivaylo Ivanov
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=c30a6f1b-b1a9-40db-b673-e6fc47bdb224@gmail.com \
--to=ivo.ivanov.ivanov1@gmail.com \
--cc=alim.akhtar@samsung.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=peter.griffin@linaro.org \
--cc=robh@kernel.org \
--cc=semen.protsenko@linaro.org \
/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