mbox series

[v5,0/8] mmc: sdhci-of-dwcmshc: Add Sophgo SG2042 support

Message ID cover.1721377374.git.unicorn_wang@outlook.com (mailing list archive)
Headers show
Series mmc: sdhci-of-dwcmshc: Add Sophgo SG2042 support | expand

Message

Chen Wang July 19, 2024, 8:44 a.m. UTC
From: Chen Wang <unicorn_wang@outlook.com>

This patchset is composed of two parts:
- one is the improvement of the sdhci-of-dwcmshc framework,
- the other is the support for sg2042 based on the improvement of the
  framework.
The reason for merging the two parts into one patchset is mainly to
facilitate review, especially to facilitate viewing why we need to
improve the framework and what benefits it will bring to us.

When I tried to add a new soc(SG2042) to sdhci-of-dwcmshc, I found
that the existing driver code could be optimized to facilitate expansion
for the new soc. Patch 1 ~ Patch 5 is for this.

Patch 6 ~ 7 are adding support for the mmc controller for Sophgo SG2042.
Adding corresponding new compatible strings, and implement
custom callbacks for SG2042 based on new framework.

Patch 8 is the change for DTS.

By the way, although I believe this patch only optimizes the framework
of the code and does not change the specific logic, simple verification
is certainly better. Since I don't have rk35xx/th1520 related hardware,
it would be greatly appreciated if someone could help verify it.
Note, the DTS change has dependency on clock changes for SG2042, which
has not been merged in master/upstream, so if you want to test this
new sdhci-of-dwcmshc driver for other hardware except SG2042, don't
pick patch 8.

Clocks changes for SG2042 are expected to be in 6.11-rc1 soon, I will
do catch up with that when it is relased and provide a new revision,
but anyway please feel free review this version and welcome your comments.

---

Changes in v5:

  The patch series is based on latest 'next' branch of [mmc-git].

  - Based on Adrian's suggestion, split the first part of the patch into 5.
  - Updated bindings and DTS as per suggestion from Krzysztof, Jisheng and Conor.

Changes in v4:

  The patch series is based on latest 'next' branch of [mmc-git]. You can simply
  review or test the patches at the link [4].

  Improved the dirvier code as per comments from Adrian Hunter, drop moving
  position and renaming for some helper functions.

  Put the sg2042 support as part of this series, improve the bindings and code
  as per comments from last review.

Changes in v3:
  
  The patch series is based on latest 'next' branch of [mmc-git]. You can simply
  review or test the patches at the link [3].

  Improved the dirvier code as per comments from Adrian Hunter.
  Define new structure for dwcmshc platform data/ops. In addition, I organized
  the code and classified the helper functions.

  Since the file changes were relatively large (though the functional logic did
  not change much), I split the original patch into four for the convenience of
  review.

Changes in v2:

  Rebased on latest 'next' branch of [mmc-git]. You can simply review or test the
  patches at the link [2].

Changes in v1:

  The patch series is based on v6.9-rc1. You can simply review or test the
  patches at the link [1].

Link: git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git [mmc-git]
Link: https://lore.kernel.org/linux-mmc/cover.1713257181.git.unicorn_wang@outlook.com/ [1]
Link: https://lore.kernel.org/linux-mmc/cover.1714270290.git.unicorn_wang@outlook.com/ [2]
Link: https://lore.kernel.org/linux-mmc/cover.1718241495.git.unicorn_wang@outlook.com/ [3]
Link: https://lore.kernel.org/linux-mmc/cover.1718697954.git.unicorn_wang@outlook.com/ [4]

---

Chen Wang (8):
  mmc: sdhci-of-dwcmshc: add common bulk optional clocks support
  mmc: sdhci-of-dwcmshc: move two rk35xx functions
  mmc: sdhci-of-dwcmshc: factor out code for th1520_init()
  mmc: sdhci-of-dwcmshc: factor out code into dwcmshc_rk35xx_init
  mmc: sdhci-of-dwcmshc: add dwcmshc_pltfm_data
  dt-bindings: mmc: sdhci-of-dwcmhsc: Add Sophgo SG2042 support
  mmc: sdhci-of-dwcmshc: Add support for Sophgo SG2042
  riscv: sophgo: dts: add mmc controllers for SG2042 SoC

 .../bindings/mmc/snps,dwcmshc-sdhci.yaml      |  60 ++-
 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts  |  17 +
 arch/riscv/boot/dts/sophgo/sg2042.dtsi        |  28 ++
 drivers/mmc/host/sdhci-of-dwcmshc.c           | 459 ++++++++++++------
 4 files changed, 391 insertions(+), 173 deletions(-)


base-commit: b85e021853976aaebd3788e7e721020570754199

Comments

Drew Fustini July 24, 2024, 9:09 p.m. UTC | #1
On Fri, Jul 19, 2024 at 04:44:38PM +0800, Chen Wang wrote:
> From: Chen Wang <unicorn_wang@outlook.com>
> 
> This patchset is composed of two parts:
> - one is the improvement of the sdhci-of-dwcmshc framework,
> - the other is the support for sg2042 based on the improvement of the
>   framework.
> The reason for merging the two parts into one patchset is mainly to
> facilitate review, especially to facilitate viewing why we need to
> improve the framework and what benefits it will bring to us.
> 
> When I tried to add a new soc(SG2042) to sdhci-of-dwcmshc, I found
> that the existing driver code could be optimized to facilitate expansion
> for the new soc. Patch 1 ~ Patch 5 is for this.
> 
> Patch 6 ~ 7 are adding support for the mmc controller for Sophgo SG2042.
> Adding corresponding new compatible strings, and implement
> custom callbacks for SG2042 based on new framework.
> 
> Patch 8 is the change for DTS.
> 
> By the way, although I believe this patch only optimizes the framework
> of the code and does not change the specific logic, simple verification
> is certainly better. Since I don't have rk35xx/th1520 related hardware,
> it would be greatly appreciated if someone could help verify it.
> Note, the DTS change has dependency on clock changes for SG2042, which
> has not been merged in master/upstream, so if you want to test this
> new sdhci-of-dwcmshc driver for other hardware except SG2042, don't
> pick patch 8.

I have tested this on the LicheePi 4a and found no issues.

Tested-by: Drew Fustini <drew@pdp7.com> # TH1520

-Drew
Chen Wang July 25, 2024, 1:36 a.m. UTC | #2
On 2024/7/25 5:09, Drew Fustini wrote:
> On Fri, Jul 19, 2024 at 04:44:38PM +0800, Chen Wang wrote:
>> From: Chen Wang <unicorn_wang@outlook.com>
>>
>> This patchset is composed of two parts:
>> - one is the improvement of the sdhci-of-dwcmshc framework,
>> - the other is the support for sg2042 based on the improvement of the
>>    framework.
>> The reason for merging the two parts into one patchset is mainly to
>> facilitate review, especially to facilitate viewing why we need to
>> improve the framework and what benefits it will bring to us.
>>
>> When I tried to add a new soc(SG2042) to sdhci-of-dwcmshc, I found
>> that the existing driver code could be optimized to facilitate expansion
>> for the new soc. Patch 1 ~ Patch 5 is for this.
>>
>> Patch 6 ~ 7 are adding support for the mmc controller for Sophgo SG2042.
>> Adding corresponding new compatible strings, and implement
>> custom callbacks for SG2042 based on new framework.
>>
>> Patch 8 is the change for DTS.
>>
>> By the way, although I believe this patch only optimizes the framework
>> of the code and does not change the specific logic, simple verification
>> is certainly better. Since I don't have rk35xx/th1520 related hardware,
>> it would be greatly appreciated if someone could help verify it.
>> Note, the DTS change has dependency on clock changes for SG2042, which
>> has not been merged in master/upstream, so if you want to test this
>> new sdhci-of-dwcmshc driver for other hardware except SG2042, don't
>> pick patch 8.
> I have tested this on the LicheePi 4a and found no issues.
>
> Tested-by: Drew Fustini <drew@pdp7.com> # TH1520
>
> -Drew

Thank you Drew,you are always the best! :)

Regards,

Chen
Inochi Amaoto July 31, 2024, 8 a.m. UTC | #3
On Fri, Jul 19, 2024 at 04:44:38PM GMT, Chen Wang wrote:
> From: Chen Wang <unicorn_wang@outlook.com>
> 
> This patchset is composed of two parts:
> - one is the improvement of the sdhci-of-dwcmshc framework,
> - the other is the support for sg2042 based on the improvement of the
>   framework.
> The reason for merging the two parts into one patchset is mainly to
> facilitate review, especially to facilitate viewing why we need to
> improve the framework and what benefits it will bring to us.
> 
> When I tried to add a new soc(SG2042) to sdhci-of-dwcmshc, I found
> that the existing driver code could be optimized to facilitate expansion
> for the new soc. Patch 1 ~ Patch 5 is for this.
> 
> Patch 6 ~ 7 are adding support for the mmc controller for Sophgo SG2042.
> Adding corresponding new compatible strings, and implement
> custom callbacks for SG2042 based on new framework.
> 
> Patch 8 is the change for DTS.
> 
> By the way, although I believe this patch only optimizes the framework
> of the code and does not change the specific logic, simple verification
> is certainly better. Since I don't have rk35xx/th1520 related hardware,
> it would be greatly appreciated if someone could help verify it.
> Note, the DTS change has dependency on clock changes for SG2042, which
> has not been merged in master/upstream, so if you want to test this
> new sdhci-of-dwcmshc driver for other hardware except SG2042, don't
> pick patch 8.
> 
> Clocks changes for SG2042 are expected to be in 6.11-rc1 soon, I will
> do catch up with that when it is relased and provide a new revision,
> but anyway please feel free review this version and welcome your comments.
> 
> ---
> 
> Changes in v5:
> 
>   The patch series is based on latest 'next' branch of [mmc-git].
> 
>   - Based on Adrian's suggestion, split the first part of the patch into 5.
>   - Updated bindings and DTS as per suggestion from Krzysztof, Jisheng and Conor.
> 
> Changes in v4:
> 
>   The patch series is based on latest 'next' branch of [mmc-git]. You can simply
>   review or test the patches at the link [4].
> 
>   Improved the dirvier code as per comments from Adrian Hunter, drop moving
>   position and renaming for some helper functions.
> 
>   Put the sg2042 support as part of this series, improve the bindings and code
>   as per comments from last review.
> 
> Changes in v3:
>   
>   The patch series is based on latest 'next' branch of [mmc-git]. You can simply
>   review or test the patches at the link [3].
> 
>   Improved the dirvier code as per comments from Adrian Hunter.
>   Define new structure for dwcmshc platform data/ops. In addition, I organized
>   the code and classified the helper functions.
> 
>   Since the file changes were relatively large (though the functional logic did
>   not change much), I split the original patch into four for the convenience of
>   review.
> 
> Changes in v2:
> 
>   Rebased on latest 'next' branch of [mmc-git]. You can simply review or test the
>   patches at the link [2].
> 
> Changes in v1:
> 
>   The patch series is based on v6.9-rc1. You can simply review or test the
>   patches at the link [1].
> 
> Link: git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git [mmc-git]
> Link: https://lore.kernel.org/linux-mmc/cover.1713257181.git.unicorn_wang@outlook.com/ [1]
> Link: https://lore.kernel.org/linux-mmc/cover.1714270290.git.unicorn_wang@outlook.com/ [2]
> Link: https://lore.kernel.org/linux-mmc/cover.1718241495.git.unicorn_wang@outlook.com/ [3]
> Link: https://lore.kernel.org/linux-mmc/cover.1718697954.git.unicorn_wang@outlook.com/ [4]
> 
> ---
> 
> Chen Wang (8):
>   mmc: sdhci-of-dwcmshc: add common bulk optional clocks support
>   mmc: sdhci-of-dwcmshc: move two rk35xx functions
>   mmc: sdhci-of-dwcmshc: factor out code for th1520_init()
>   mmc: sdhci-of-dwcmshc: factor out code into dwcmshc_rk35xx_init
>   mmc: sdhci-of-dwcmshc: add dwcmshc_pltfm_data
>   dt-bindings: mmc: sdhci-of-dwcmhsc: Add Sophgo SG2042 support
>   mmc: sdhci-of-dwcmshc: Add support for Sophgo SG2042
>   riscv: sophgo: dts: add mmc controllers for SG2042 SoC
> 
>  .../bindings/mmc/snps,dwcmshc-sdhci.yaml      |  60 ++-
>  .../boot/dts/sophgo/sg2042-milkv-pioneer.dts  |  17 +
>  arch/riscv/boot/dts/sophgo/sg2042.dtsi        |  28 ++
>  drivers/mmc/host/sdhci-of-dwcmshc.c           | 459 ++++++++++++------
>  4 files changed, 391 insertions(+), 173 deletions(-)
> 
> 
> base-commit: b85e021853976aaebd3788e7e721020570754199
> -- 
> 2.34.1
> 

Work on both Duo and Huashan Pi. Both sd and emmc are fine.

Tested-by: Inochi Amaoto <inochiama@outlook.com>
Chen Wang Aug. 5, 2024, 2:53 a.m. UTC | #4
On 2024/7/31 16:00, Inochi Amaoto wrote:
> On Fri, Jul 19, 2024 at 04:44:38PM GMT, Chen Wang wrote:
>> From: Chen Wang <unicorn_wang@outlook.com>
>>
>> This patchset is composed of two parts:
>> - one is the improvement of the sdhci-of-dwcmshc framework,
>> - the other is the support for sg2042 based on the improvement of the
>>    framework.
>> The reason for merging the two parts into one patchset is mainly to
>> facilitate review, especially to facilitate viewing why we need to
>> improve the framework and what benefits it will bring to us.
>>
>> When I tried to add a new soc(SG2042) to sdhci-of-dwcmshc, I found
>> that the existing driver code could be optimized to facilitate expansion
>> for the new soc. Patch 1 ~ Patch 5 is for this.
>>
>> Patch 6 ~ 7 are adding support for the mmc controller for Sophgo SG2042.
>> Adding corresponding new compatible strings, and implement
>> custom callbacks for SG2042 based on new framework.
>>
>> Patch 8 is the change for DTS.
>>
>> By the way, although I believe this patch only optimizes the framework
>> of the code and does not change the specific logic, simple verification
>> is certainly better. Since I don't have rk35xx/th1520 related hardware,
>> it would be greatly appreciated if someone could help verify it.
>> Note, the DTS change has dependency on clock changes for SG2042, which
>> has not been merged in master/upstream, so if you want to test this
>> new sdhci-of-dwcmshc driver for other hardware except SG2042, don't
>> pick patch 8.
>>
>> Clocks changes for SG2042 are expected to be in 6.11-rc1 soon, I will
>> do catch up with that when it is relased and provide a new revision,
>> but anyway please feel free review this version and welcome your comments.
>>
>> ---
>>
>> Changes in v5:
>>
>>    The patch series is based on latest 'next' branch of [mmc-git].
>>
>>    - Based on Adrian's suggestion, split the first part of the patch into 5.
>>    - Updated bindings and DTS as per suggestion from Krzysztof, Jisheng and Conor.
>>
>> Changes in v4:
>>
>>    The patch series is based on latest 'next' branch of [mmc-git]. You can simply
>>    review or test the patches at the link [4].
>>
>>    Improved the dirvier code as per comments from Adrian Hunter, drop moving
>>    position and renaming for some helper functions.
>>
>>    Put the sg2042 support as part of this series, improve the bindings and code
>>    as per comments from last review.
>>
>> Changes in v3:
>>    
>>    The patch series is based on latest 'next' branch of [mmc-git]. You can simply
>>    review or test the patches at the link [3].
>>
>>    Improved the dirvier code as per comments from Adrian Hunter.
>>    Define new structure for dwcmshc platform data/ops. In addition, I organized
>>    the code and classified the helper functions.
>>
>>    Since the file changes were relatively large (though the functional logic did
>>    not change much), I split the original patch into four for the convenience of
>>    review.
>>
>> Changes in v2:
>>
>>    Rebased on latest 'next' branch of [mmc-git]. You can simply review or test the
>>    patches at the link [2].
>>
>> Changes in v1:
>>
>>    The patch series is based on v6.9-rc1. You can simply review or test the
>>    patches at the link [1].
>>
>> Link: git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git [mmc-git]
>> Link: https://lore.kernel.org/linux-mmc/cover.1713257181.git.unicorn_wang@outlook.com/ [1]
>> Link: https://lore.kernel.org/linux-mmc/cover.1714270290.git.unicorn_wang@outlook.com/ [2]
>> Link: https://lore.kernel.org/linux-mmc/cover.1718241495.git.unicorn_wang@outlook.com/ [3]
>> Link: https://lore.kernel.org/linux-mmc/cover.1718697954.git.unicorn_wang@outlook.com/ [4]
>>
>> ---
>>
>> Chen Wang (8):
>>    mmc: sdhci-of-dwcmshc: add common bulk optional clocks support
>>    mmc: sdhci-of-dwcmshc: move two rk35xx functions
>>    mmc: sdhci-of-dwcmshc: factor out code for th1520_init()
>>    mmc: sdhci-of-dwcmshc: factor out code into dwcmshc_rk35xx_init
>>    mmc: sdhci-of-dwcmshc: add dwcmshc_pltfm_data
>>    dt-bindings: mmc: sdhci-of-dwcmhsc: Add Sophgo SG2042 support
>>    mmc: sdhci-of-dwcmshc: Add support for Sophgo SG2042
>>    riscv: sophgo: dts: add mmc controllers for SG2042 SoC
>>
>>   .../bindings/mmc/snps,dwcmshc-sdhci.yaml      |  60 ++-
>>   .../boot/dts/sophgo/sg2042-milkv-pioneer.dts  |  17 +
>>   arch/riscv/boot/dts/sophgo/sg2042.dtsi        |  28 ++
>>   drivers/mmc/host/sdhci-of-dwcmshc.c           | 459 ++++++++++++------
>>   4 files changed, 391 insertions(+), 173 deletions(-)
>>
>>
>> base-commit: b85e021853976aaebd3788e7e721020570754199
>> -- 
>> 2.34.1
>>
> Work on both Duo and Huashan Pi. Both sd and emmc are fine.
>
> Tested-by: Inochi Amaoto <inochiama@outlook.com>

Thanks a lot.

Regards,

Chen.