diff mbox series

[v2,1/6] riscv: dts: sophgo: Put sdhci compatible in dt of specific SoC

Message ID 20240612-sg2002-v2-1-19a585af6846@bootlin.com (mailing list archive)
State Superseded
Headers show
Series Add board support for Sipeed LicheeRV Nano | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR success PR summary
conchuod/patch-1-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh
conchuod/patch-1-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh
conchuod/patch-1-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh
conchuod/patch-1-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh
conchuod/patch-1-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh
conchuod/patch-1-test-6 success .github/scripts/patches/tests/checkpatch.sh
conchuod/patch-1-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh
conchuod/patch-1-test-8 success .github/scripts/patches/tests/header_inline.sh
conchuod/patch-1-test-9 success .github/scripts/patches/tests/kdoc.sh
conchuod/patch-1-test-10 success .github/scripts/patches/tests/module_param.sh
conchuod/patch-1-test-11 success .github/scripts/patches/tests/verify_fixes.sh
conchuod/patch-1-test-12 success .github/scripts/patches/tests/verify_signedoff.sh

Commit Message

Thomas Bonnefille June 12, 2024, 8:02 a.m. UTC
Remove SDHCI compatible for CV1800b from common dtsi file to put it in
the specific dtsi file of the CV1800b.
This commits aims at following the same guidelines as in the other nodes
of the CV18XX family.

Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
 arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 4 ++++
 arch/riscv/boot/dts/sophgo/cv18xx.dtsi  | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Inochi Amaoto June 12, 2024, 10:47 a.m. UTC | #1
On Wed, Jun 12, 2024 at 10:02:31AM GMT, Thomas Bonnefille wrote:
> Remove SDHCI compatible for CV1800b from common dtsi file to put it in
> the specific dtsi file of the CV1800b.
> This commits aims at following the same guidelines as in the other nodes
> of the CV18XX family.
> 
> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> ---
>  arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 4 ++++
>  arch/riscv/boot/dts/sophgo/cv18xx.dtsi  | 1 -
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> index ec9530972ae2..b9cd51457b4c 100644
> --- a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> +++ b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> @@ -25,3 +25,7 @@ &clint {
>  &clk {
>  	compatible = "sophgo,cv1800-clk";
>  };
> +
> +&sdhci0 {
> +	compatible = "sophgo,cv1800b-dwcmshc";
> +};
> diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> index 891932ae470f..7247c7c3013c 100644
> --- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> +++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> @@ -288,7 +288,6 @@ uart4: serial@41c0000 {
>  		};
>  
>  		sdhci0: mmc@4310000 {
> -			compatible = "sophgo,cv1800b-dwcmshc";
>  			reg = <0x4310000 0x1000>;
>  			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
>  			clocks = <&clk CLK_AXI4_SD0>,
> 
> -- 
> 2.45.2
> 

Hi, Jisheng,

Is this change necessary? IIRC, the sdhci is the same across 
the whole series.

Regards,
Inochi
Yixun Lan June 16, 2024, 11:58 p.m. UTC | #2
Hi

On 18:47 Wed 12 Jun     , Inochi Amaoto wrote:
> On Wed, Jun 12, 2024 at 10:02:31AM GMT, Thomas Bonnefille wrote:
> > Remove SDHCI compatible for CV1800b from common dtsi file to put it in
> > the specific dtsi file of the CV1800b.
> > This commits aims at following the same guidelines as in the other nodes
> > of the CV18XX family.
is there any URL of guideline? or did I miss anything
couldn't find any discussion about this in v1

> > 
> > Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> > ---
> >  arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 4 ++++
> >  arch/riscv/boot/dts/sophgo/cv18xx.dtsi  | 1 -
> >  2 files changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> > index ec9530972ae2..b9cd51457b4c 100644
> > --- a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> > +++ b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> > @@ -25,3 +25,7 @@ &clint {
> >  &clk {
> >  	compatible = "sophgo,cv1800-clk";
> >  };
> > +
> > +&sdhci0 {
> > +	compatible = "sophgo,cv1800b-dwcmshc";
> > +};
> > diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> > index 891932ae470f..7247c7c3013c 100644
> > --- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> > +++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> > @@ -288,7 +288,6 @@ uart4: serial@41c0000 {
> >  		};
> >  
> >  		sdhci0: mmc@4310000 {
> > -			compatible = "sophgo,cv1800b-dwcmshc";
> >  			reg = <0x4310000 0x1000>;
> >  			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
> >  			clocks = <&clk CLK_AXI4_SD0>,
> > 
> > -- 
> > 2.45.2
> > 
> 
> Hi, Jisheng,
> 
> Is this change necessary? IIRC, the sdhci is the same across 
> the whole series.
I tend to agree with Inochi here, if it's same across all SoC, then no bother to
split, it will cause more trouble to maintain..

> 
> Regards,
> Inochi
Inochi Amaoto June 17, 2024, 3:36 a.m. UTC | #3
On Sun, Jun 16, 2024 at 11:58:29PM GMT, Yixun Lan wrote:
> Hi
> 
> On 18:47 Wed 12 Jun     , Inochi Amaoto wrote:
> > On Wed, Jun 12, 2024 at 10:02:31AM GMT, Thomas Bonnefille wrote:
> > > Remove SDHCI compatible for CV1800b from common dtsi file to put it in
> > > the specific dtsi file of the CV1800b.
> > > This commits aims at following the same guidelines as in the other nodes
> > > of the CV18XX family.
> is there any URL of guideline? or did I miss anything
> couldn't find any discussion about this in v1
> 

No, it seems like that this is a new change from Thomas.

> > > 
> > > Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> > > ---
> > >  arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 4 ++++
> > >  arch/riscv/boot/dts/sophgo/cv18xx.dtsi  | 1 -
> > >  2 files changed, 4 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> > > index ec9530972ae2..b9cd51457b4c 100644
> > > --- a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> > > +++ b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> > > @@ -25,3 +25,7 @@ &clint {
> > >  &clk {
> > >  	compatible = "sophgo,cv1800-clk";
> > >  };
> > > +
> > > +&sdhci0 {
> > > +	compatible = "sophgo,cv1800b-dwcmshc";
> > > +};
> > > diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> > > index 891932ae470f..7247c7c3013c 100644
> > > --- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> > > +++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> > > @@ -288,7 +288,6 @@ uart4: serial@41c0000 {
> > >  		};
> > >  
> > >  		sdhci0: mmc@4310000 {
> > > -			compatible = "sophgo,cv1800b-dwcmshc";
> > >  			reg = <0x4310000 0x1000>;
> > >  			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
> > >  			clocks = <&clk CLK_AXI4_SD0>,
> > > 
> > > -- 
> > > 2.45.2
> > > 
> > 
> > Hi, Jisheng,
> > 
> > Is this change necessary? IIRC, the sdhci is the same across 
> > the whole series.
> I tend to agree with Inochi here, if it's same across all SoC, then no bother to
> split, it will cause more trouble to maintain..
> 
> > 
> > Regards,
> > Inochi
> 
> -- 
> Yixun Lan (dlan)
> Gentoo Linux Developer
> GPG Key ID AABEFD55
Thomas Bonnefille June 17, 2024, 9:16 a.m. UTC | #4
On 6/17/24 1:58 AM, Yixun Lan wrote:
> Hi
> 
> On 18:47 Wed 12 Jun     , Inochi Amaoto wrote:
>> On Wed, Jun 12, 2024 at 10:02:31AM GMT, Thomas Bonnefille wrote:
>>> Remove SDHCI compatible for CV1800b from common dtsi file to put it in
>>> the specific dtsi file of the CV1800b.
>>> This commits aims at following the same guidelines as in the other nodes
>>> of the CV18XX family.
> is there any URL of guideline? or did I miss anything
> couldn't find any discussion about this in v1
> 

Not explicitly, the fact is that I had to use a specific compatible on 
SG2002 for the sdhci (it is already defined mainline), I had to choose 
between :

1. cv18xx.dtsi : compatible cv1800b-dwcmshc
    cv1800b.dtsi : no redefined compatible
    sg2002.dtsi : overwrite the previous compatible to use sg2002-dwcmshc

2. cv18xx.dtsi : no compatible
    cv1800b.dtsi : compatible for cv1800b-dwcmshc
    sg2002.dtsi : compatible for sg2002-dwcmshc

As in the plic and clint controllers, the second option was chosen I 
consider this as a "guideline" and reformat the dtsis accordingly.

>>>
>>> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
>>> ---
>>>   arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 4 ++++
>>>   arch/riscv/boot/dts/sophgo/cv18xx.dtsi  | 1 -
>>>   2 files changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
>>> index ec9530972ae2..b9cd51457b4c 100644
>>> --- a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
>>> +++ b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
>>> @@ -25,3 +25,7 @@ &clint {
>>>   &clk {
>>>   	compatible = "sophgo,cv1800-clk";
>>>   };
>>> +
>>> +&sdhci0 {
>>> +	compatible = "sophgo,cv1800b-dwcmshc";
>>> +};
>>> diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
>>> index 891932ae470f..7247c7c3013c 100644
>>> --- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
>>> +++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
>>> @@ -288,7 +288,6 @@ uart4: serial@41c0000 {
>>>   		};
>>>   
>>>   		sdhci0: mmc@4310000 {
>>> -			compatible = "sophgo,cv1800b-dwcmshc";
>>>   			reg = <0x4310000 0x1000>;
>>>   			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
>>>   			clocks = <&clk CLK_AXI4_SD0>,
>>>
>>> -- 
>>> 2.45.2
>>>
>>
>> Hi, Jisheng,
>>
>> Is this change necessary? IIRC, the sdhci is the same across
>> the whole series.
> I tend to agree with Inochi here, if it's same across all SoC, then no bother to
> split, it will cause more trouble to maintain..
> 

To be honest, I agree with this to, but as a specific compatible for the 
SG2002 was created in commit 849e81817b9b, I thought that the best 
practice was to use it.

>>
>> Regards,
>> Inochi
>
Jisheng Zhang June 17, 2024, 1:16 p.m. UTC | #5
On Mon, Jun 17, 2024 at 11:16:32AM +0200, Thomas Bonnefille wrote:
> 
> 
> On 6/17/24 1:58 AM, Yixun Lan wrote:
> > Hi
> > 
> > On 18:47 Wed 12 Jun     , Inochi Amaoto wrote:
> > > On Wed, Jun 12, 2024 at 10:02:31AM GMT, Thomas Bonnefille wrote:
> > > > Remove SDHCI compatible for CV1800b from common dtsi file to put it in
> > > > the specific dtsi file of the CV1800b.
> > > > This commits aims at following the same guidelines as in the other nodes
> > > > of the CV18XX family.
> > is there any URL of guideline? or did I miss anything
> > couldn't find any discussion about this in v1
> > 
> 
> Not explicitly, the fact is that I had to use a specific compatible on
> SG2002 for the sdhci (it is already defined mainline), I had to choose
> between :
> 
> 1. cv18xx.dtsi : compatible cv1800b-dwcmshc
>    cv1800b.dtsi : no redefined compatible
>    sg2002.dtsi : overwrite the previous compatible to use sg2002-dwcmshc
> 
> 2. cv18xx.dtsi : no compatible
>    cv1800b.dtsi : compatible for cv1800b-dwcmshc
>    sg2002.dtsi : compatible for sg2002-dwcmshc
> 
> As in the plic and clint controllers, the second option was chosen I
> consider this as a "guideline" and reformat the dtsis accordingly.
> 
> > > > 
> > > > Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> > > > ---
> > > >   arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 4 ++++
> > > >   arch/riscv/boot/dts/sophgo/cv18xx.dtsi  | 1 -
> > > >   2 files changed, 4 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> > > > index ec9530972ae2..b9cd51457b4c 100644
> > > > --- a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> > > > +++ b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> > > > @@ -25,3 +25,7 @@ &clint {
> > > >   &clk {
> > > >   	compatible = "sophgo,cv1800-clk";
> > > >   };
> > > > +
> > > > +&sdhci0 {
> > > > +	compatible = "sophgo,cv1800b-dwcmshc";
> > > > +};
> > > > diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> > > > index 891932ae470f..7247c7c3013c 100644
> > > > --- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> > > > +++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> > > > @@ -288,7 +288,6 @@ uart4: serial@41c0000 {
> > > >   		};
> > > >   		sdhci0: mmc@4310000 {
> > > > -			compatible = "sophgo,cv1800b-dwcmshc";
> > > >   			reg = <0x4310000 0x1000>;
> > > >   			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
> > > >   			clocks = <&clk CLK_AXI4_SD0>,
> > > > 
> > > > -- 
> > > > 2.45.2
> > > > 
> > > 
> > > Hi, Jisheng,
> > > 
> > > Is this change necessary? IIRC, the sdhci is the same across
> > > the whole series.

Hi,

sorry for being late, I was busy in the past 2.5 month. Per my
understanding, the sdhci in cv1800b is the same as the one in
sg200x. Maybe I'm wrong, but this was my impression when I cooked
the sdhci driver patch for these SoCs.

> > I tend to agree with Inochi here, if it's same across all SoC, then no bother to
> > split, it will cause more trouble to maintain..
> > 
> 
> To be honest, I agree with this to, but as a specific compatible for the
> SG2002 was created in commit 849e81817b9b, I thought that the best practice
> was to use it.

I'd like to take this chance to query DT maintainers: FWICT, in the past
even if the PLIC is the same between SoCs, adding a new compatible for
them seems a must. So when time goes on, the compatbile list would be
longer and longer, is it really necessary? Can we just use the existing
compatible string?
DT maintainers may answered the query in the past, if so, sorry for
querying again.

> 
> > > 
> > > Regards,
> > > Inochi
> > 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Conor Dooley June 17, 2024, 3:40 p.m. UTC | #6
On Mon, Jun 17, 2024 at 09:16:43PM +0800, Jisheng Zhang wrote:
> On Mon, Jun 17, 2024 at 11:16:32AM +0200, Thomas Bonnefille wrote:
> > On 6/17/24 1:58 AM, Yixun Lan wrote:
> > > On 18:47 Wed 12 Jun     , Inochi Amaoto wrote:

> > > > Is this change necessary? IIRC, the sdhci is the same across
> > > > the whole series.

> sorry for being late, I was busy in the past 2.5 month. Per my
> understanding, the sdhci in cv1800b is the same as the one in
> sg200x. Maybe I'm wrong, but this was my impression when I cooked
> the sdhci driver patch for these SoCs.
> 
> > > I tend to agree with Inochi here, if it's same across all SoC, then no bother to
> > > split, it will cause more trouble to maintain..
> > > 
> > 
> > To be honest, I agree with this to, but as a specific compatible for the
> > SG2002 was created in commit 849e81817b9b, I thought that the best practice
> > was to use it.
> 
> I'd like to take this chance to query DT maintainers: FWICT, in the past
> even if the PLIC is the same between SoCs, adding a new compatible for
> them seems a must. So when time goes on, the compatbile list would be
> longer and longer, is it really necessary? Can we just use the existing
> compatible string?
> DT maintainers may answered the query in the past, if so, sorry for
> querying again.

For new integrations of an IP, yes, new specific compatibles please. New
integrations may have different bugs etc, even if the IP itself is the
same. If there's different SoCs that are the same die, but with elements
fused off, then sure, use the same compatible.

I expect the list of compatibles in the binding to grow rather large, but
that is fine. No one SoC is going to do anything other than something like
compatible = "renesas,$soc-plic", "andestech,corecomplex-plic", "riscv,plic";
which I think is perfectly fine.
Samuel Holland June 17, 2024, 3:57 p.m. UTC | #7
Hi Jisheng, Thomas,

On 2024-06-17 10:40 AM, Conor Dooley wrote:
> On Mon, Jun 17, 2024 at 09:16:43PM +0800, Jisheng Zhang wrote:
>> On Mon, Jun 17, 2024 at 11:16:32AM +0200, Thomas Bonnefille wrote:
>>> On 6/17/24 1:58 AM, Yixun Lan wrote:
>>>> On 18:47 Wed 12 Jun     , Inochi Amaoto wrote:
> 
>>>>> Is this change necessary? IIRC, the sdhci is the same across
>>>>> the whole series.
> 
>> sorry for being late, I was busy in the past 2.5 month. Per my
>> understanding, the sdhci in cv1800b is the same as the one in
>> sg200x. Maybe I'm wrong, but this was my impression when I cooked
>> the sdhci driver patch for these SoCs.
>>
>>>> I tend to agree with Inochi here, if it's same across all SoC, then no bother to
>>>> split, it will cause more trouble to maintain..
>>>>
>>>
>>> To be honest, I agree with this to, but as a specific compatible for the
>>> SG2002 was created in commit 849e81817b9b, I thought that the best practice
>>> was to use it.
>>
>> I'd like to take this chance to query DT maintainers: FWICT, in the past
>> even if the PLIC is the same between SoCs, adding a new compatible for
>> them seems a must. So when time goes on, the compatbile list would be
>> longer and longer, is it really necessary? Can we just use the existing
>> compatible string?
>> DT maintainers may answered the query in the past, if so, sorry for
>> querying again.
> 
> For new integrations of an IP, yes, new specific compatibles please. New
> integrations may have different bugs etc, even if the IP itself is the
> same. If there's different SoCs that are the same die, but with elements
> fused off, then sure, use the same compatible.
> 
> I expect the list of compatibles in the binding to grow rather large, but
> that is fine. No one SoC is going to do anything other than something like
> compatible = "renesas,$soc-plic", "andestech,corecomplex-plic", "riscv,plic";
> which I think is perfectly fine.

And you can do the same thing here for the SDHCI controller: if you think sg200x
has the same controller (and integration! e.g. number of clocks/resets) as
cv1800b, then you should keep sophgo,cv1800b-dwcmshc as a fallback compatible
string. Then the driver doesn't need any changes until/unless you eventually
find some reason they are not compatible.

It's better to have a SoC-specific compatible string in the DT and not need it,
than find out later you need one and not have it. :)

Regards,
Samuel
Jisheng Zhang June 18, 2024, 4:20 a.m. UTC | #8
On Mon, Jun 17, 2024 at 10:57:54AM -0500, Samuel Holland wrote:
> Hi Jisheng, Thomas,
> 
> On 2024-06-17 10:40 AM, Conor Dooley wrote:
> > On Mon, Jun 17, 2024 at 09:16:43PM +0800, Jisheng Zhang wrote:
> >> On Mon, Jun 17, 2024 at 11:16:32AM +0200, Thomas Bonnefille wrote:
> >>> On 6/17/24 1:58 AM, Yixun Lan wrote:
> >>>> On 18:47 Wed 12 Jun     , Inochi Amaoto wrote:
> > 
> >>>>> Is this change necessary? IIRC, the sdhci is the same across
> >>>>> the whole series.
> > 
> >> sorry for being late, I was busy in the past 2.5 month. Per my
> >> understanding, the sdhci in cv1800b is the same as the one in
> >> sg200x. Maybe I'm wrong, but this was my impression when I cooked
> >> the sdhci driver patch for these SoCs.
> >>
> >>>> I tend to agree with Inochi here, if it's same across all SoC, then no bother to
> >>>> split, it will cause more trouble to maintain..
> >>>>
> >>>
> >>> To be honest, I agree with this to, but as a specific compatible for the
> >>> SG2002 was created in commit 849e81817b9b, I thought that the best practice
> >>> was to use it.
> >>
> >> I'd like to take this chance to query DT maintainers: FWICT, in the past
> >> even if the PLIC is the same between SoCs, adding a new compatible for
> >> them seems a must. So when time goes on, the compatbile list would be
> >> longer and longer, is it really necessary? Can we just use the existing
> >> compatible string?
> >> DT maintainers may answered the query in the past, if so, sorry for
> >> querying again.
> > 
> > For new integrations of an IP, yes, new specific compatibles please. New
> > integrations may have different bugs etc, even if the IP itself is the
> > same. If there's different SoCs that are the same die, but with elements
> > fused off, then sure, use the same compatible.
> > 
> > I expect the list of compatibles in the binding to grow rather large, but
> > that is fine. No one SoC is going to do anything other than something like
> > compatible = "renesas,$soc-plic", "andestech,corecomplex-plic", "riscv,plic";
> > which I think is perfectly fine.
> 
> And you can do the same thing here for the SDHCI controller: if you think sg200x
> has the same controller (and integration! e.g. number of clocks/resets) as
> cv1800b, then you should keep sophgo,cv1800b-dwcmshc as a fallback compatible
> string. Then the driver doesn't need any changes until/unless you eventually
> find some reason they are not compatible.
> 
> It's better to have a SoC-specific compatible string in the DT and not need it,
> than find out later you need one and not have it. :)

Good idea, this solution looks better! Thanks for the suggestion

> 
> Regards,
> Samuel
>
Inochi Amaoto June 18, 2024, 6:36 a.m. UTC | #9
On Mon, Jun 17, 2024 at 10:57:54AM GMT, Samuel Holland wrote:
> Hi Jisheng, Thomas,
> 
> On 2024-06-17 10:40 AM, Conor Dooley wrote:
> > On Mon, Jun 17, 2024 at 09:16:43PM +0800, Jisheng Zhang wrote:
> >> On Mon, Jun 17, 2024 at 11:16:32AM +0200, Thomas Bonnefille wrote:
> >>> On 6/17/24 1:58 AM, Yixun Lan wrote:
> >>>> On 18:47 Wed 12 Jun     , Inochi Amaoto wrote:
> > 
> >>>>> Is this change necessary? IIRC, the sdhci is the same across
> >>>>> the whole series.
> > 
> >> sorry for being late, I was busy in the past 2.5 month. Per my
> >> understanding, the sdhci in cv1800b is the same as the one in
> >> sg200x. Maybe I'm wrong, but this was my impression when I cooked
> >> the sdhci driver patch for these SoCs.
> >>
> >>>> I tend to agree with Inochi here, if it's same across all SoC, then no bother to
> >>>> split, it will cause more trouble to maintain..
> >>>>
> >>>
> >>> To be honest, I agree with this to, but as a specific compatible for the
> >>> SG2002 was created in commit 849e81817b9b, I thought that the best practice
> >>> was to use it.
> >>
> >> I'd like to take this chance to query DT maintainers: FWICT, in the past
> >> even if the PLIC is the same between SoCs, adding a new compatible for
> >> them seems a must. So when time goes on, the compatbile list would be
> >> longer and longer, is it really necessary? Can we just use the existing
> >> compatible string?
> >> DT maintainers may answered the query in the past, if so, sorry for
> >> querying again.
> > 
> > For new integrations of an IP, yes, new specific compatibles please. New
> > integrations may have different bugs etc, even if the IP itself is the
> > same. If there's different SoCs that are the same die, but with elements
> > fused off, then sure, use the same compatible.
> > 
> > I expect the list of compatibles in the binding to grow rather large, but
> > that is fine. No one SoC is going to do anything other than something like
> > compatible = "renesas,$soc-plic", "andestech,corecomplex-plic", "riscv,plic";
> > which I think is perfectly fine.
> 
> And you can do the same thing here for the SDHCI controller: if you think sg200x
> has the same controller (and integration! e.g. number of clocks/resets) as
> cv1800b, then you should keep sophgo,cv1800b-dwcmshc as a fallback compatible
> string. Then the driver doesn't need any changes until/unless you eventually
> find some reason they are not compatible.
> 
> It's better to have a SoC-specific compatible string in the DT and not need it,
> than find out later you need one and not have it. :)
> 
> Regards,
> Samuel
> 

This is excellect and reasonable. I will take your advice for the DT
change. With your suggetion, I think it may be acceptable to mark the
low-profile SoC as the default value and let other override it.

Let take the clk as the example:

// in the base file cv18xx.dtsi
clk: clock-controller@3002000 {
	// set the "sophgo,cv1800-clk" as the fallback.
	compatible = "sophgo,cv1800-clk";
	[...]
};

// in the cv1800b.dtsi
// now no need for the clk override since we have the compatible
// default.

// in the cv1812h.dtsi
// we still need this override as it is not compatible
&clk {
	compatible = "sophgo,cv1810-clk";
};

// in the sg2002.dtsi of the patch
// we need this override as it is also not compatible
&clk {
	compatible = "sophgo,sg2000-clk";
};

Do I understand correctly? Or we still need to duplicate these node
for SoCs with different profiles.

Regards,
Inochi
diff mbox series

Patch

diff --git a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
index ec9530972ae2..b9cd51457b4c 100644
--- a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
+++ b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
@@ -25,3 +25,7 @@  &clint {
 &clk {
 	compatible = "sophgo,cv1800-clk";
 };
+
+&sdhci0 {
+	compatible = "sophgo,cv1800b-dwcmshc";
+};
diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
index 891932ae470f..7247c7c3013c 100644
--- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
+++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
@@ -288,7 +288,6 @@  uart4: serial@41c0000 {
 		};
 
 		sdhci0: mmc@4310000 {
-			compatible = "sophgo,cv1800b-dwcmshc";
 			reg = <0x4310000 0x1000>;
 			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&clk CLK_AXI4_SD0>,