mbox series

[U-Boot,0/9] sunxi: enable DM_MMC

Message ID 20190119013055.28023-1-andre.przywara@arm.com
Headers show
Series sunxi: enable DM_MMC | expand

Message

Andre Przywara Jan. 19, 2019, 1:30 a.m. UTC
This series enables the Allwinner MMC driver to drive all SoCs with its
DM_MMC variant. We use the gates clock and reset support from the new
clock driver, but keep the actual mod clock in its somewhat hackish
state. Properly supporting this via the clock driver is a bit more work.
The per-compatible variant struct for now only holds the mod clock
address (which will go away), but we will need the struct later again
for the various timing modes.

This allows us to eventually enable DM_MMC for all SoCs, and get rid of
the nasty deprecation warning.

The first patch adds the MMC clock gates and resets to the clock driver.
Patch 2/9 adds support for the A80 MMC config clock, which is a bit
special. I can't test this, so please give this a try if you have a board.

Patch 3 uses the new clocks in the MMC driver, the following three patches
add the remaining compatible strings along with their required mod clock
addresses.

Patch 7 fixes the Pine64-LTS board, while patch 8 eventually enables
everything. Patch 9 is some comment fix to make it easier to reason
about what part of the driver is for DM_MMC and which is not.

I successfully compiled the HEAD for all 142 Allwinner boards, also
compiled all patches for selected boards.

This was briefly tested on Pine-H64 (H6), Pine64-LTS (A64), OrangePi PC 2
(H5), OrangePi Zero (H2+) and BananaPi-M1 (A20).

Please run it on every board that you can get hold of to give this series
a good shake.

This goes on top of current sunxi/master (543049ab5906) and is available
on https://github.com/apritzel/u-boot/commits/sunxi-dm.

This replaces Jagan's v2 series "mmc: sunxi: Enable DM_MMC" in a more
driver model compliant way, borrowing two patches from him.

Cheers,
Andre.

Andre Przywara (7):
  sunxi: clk: add MMC gates/resets
  sunxi: clk: A80: add MMC clock support
  mmc: sunxi: Add DM clk and reset support
  mmc: sunxi: Add H6 support
  mmc: sunxi: Add A80 support
  mmc: sunxi: Honour non-removable property in DT
  mmc: sunxi: Mark end of DM_MMC #ifdefs

Jagan Teki (2):
  mmc: sunxi: Add missing compatible strings
  arm: sunxi: Enable DM_MMC

 arch/arm/Kconfig                      |  1 +
 arch/arm/mach-sunxi/Kconfig           |  1 -
 configs/Linksprite_pcDuino3_defconfig |  1 -
 drivers/clk/sunxi/clk_a10.c           |  4 +++
 drivers/clk/sunxi/clk_a10s.c          |  3 ++
 drivers/clk/sunxi/clk_a23.c           |  6 ++++
 drivers/clk/sunxi/clk_a31.c           |  8 +++++
 drivers/clk/sunxi/clk_a64.c           |  6 ++++
 drivers/clk/sunxi/clk_a80.c           | 28 ++++++++++++++++-
 drivers/clk/sunxi/clk_a83t.c          |  6 ++++
 drivers/clk/sunxi/clk_h3.c            |  6 ++++
 drivers/clk/sunxi/clk_h6.c            |  6 ++++
 drivers/clk/sunxi/clk_r40.c           |  8 +++++
 drivers/mmc/sunxi_mmc.c               | 59 +++++++++++++++++++++++++++++------
 14 files changed, 131 insertions(+), 12 deletions(-)

Comments

Vasily Khoruzhick Jan. 19, 2019, 6:32 p.m. UTC | #1
On Fri, Jan 18, 2019 at 5:32 PM Andre Przywara <andre.przywara@arm.com> wrote:
>
> This series enables the Allwinner MMC driver to drive all SoCs with its
> DM_MMC variant. We use the gates clock and reset support from the new
> clock driver, but keep the actual mod clock in its somewhat hackish
> state. Properly supporting this via the clock driver is a bit more work.
> The per-compatible variant struct for now only holds the mod clock
> address (which will go away), but we will need the struct later again
> for the various timing modes.
>
> This allows us to eventually enable DM_MMC for all SoCs, and get rid of
> the nasty deprecation warning.
>
> The first patch adds the MMC clock gates and resets to the clock driver.
> Patch 2/9 adds support for the A80 MMC config clock, which is a bit
> special. I can't test this, so please give this a try if you have a board.
>
> Patch 3 uses the new clocks in the MMC driver, the following three patches
> add the remaining compatible strings along with their required mod clock
> addresses.
>
> Patch 7 fixes the Pine64-LTS board, while patch 8 eventually enables
> everything. Patch 9 is some comment fix to make it easier to reason
> about what part of the driver is for DM_MMC and which is not.
>
> I successfully compiled the HEAD for all 142 Allwinner boards, also
> compiled all patches for selected boards.
>
> This was briefly tested on Pine-H64 (H6), Pine64-LTS (A64), OrangePi PC 2
> (H5), OrangePi Zero (H2+) and BananaPi-M1 (A20).
>
> Please run it on every board that you can get hold of to give this series
> a good shake.
>
> This goes on top of current sunxi/master (543049ab5906) and is available
> on https://github.com/apritzel/u-boot/commits/sunxi-dm.

It breaks autoboot for eMMC on Pinebook.

It complains:

Card did not respond to voltage select!
MMC: no card present

Card itself is present, i.e. if I do these command I see card info:

mmc dev 2
mmc info

Regards,
Vasily

> This replaces Jagan's v2 series "mmc: sunxi: Enable DM_MMC" in a more
> driver model compliant way, borrowing two patches from him.
>
> Cheers,
> Andre.
>
> Andre Przywara (7):
>   sunxi: clk: add MMC gates/resets
>   sunxi: clk: A80: add MMC clock support
>   mmc: sunxi: Add DM clk and reset support
>   mmc: sunxi: Add H6 support
>   mmc: sunxi: Add A80 support
>   mmc: sunxi: Honour non-removable property in DT
>   mmc: sunxi: Mark end of DM_MMC #ifdefs
>
> Jagan Teki (2):
>   mmc: sunxi: Add missing compatible strings
>   arm: sunxi: Enable DM_MMC
>
>  arch/arm/Kconfig                      |  1 +
>  arch/arm/mach-sunxi/Kconfig           |  1 -
>  configs/Linksprite_pcDuino3_defconfig |  1 -
>  drivers/clk/sunxi/clk_a10.c           |  4 +++
>  drivers/clk/sunxi/clk_a10s.c          |  3 ++
>  drivers/clk/sunxi/clk_a23.c           |  6 ++++
>  drivers/clk/sunxi/clk_a31.c           |  8 +++++
>  drivers/clk/sunxi/clk_a64.c           |  6 ++++
>  drivers/clk/sunxi/clk_a80.c           | 28 ++++++++++++++++-
>  drivers/clk/sunxi/clk_a83t.c          |  6 ++++
>  drivers/clk/sunxi/clk_h3.c            |  6 ++++
>  drivers/clk/sunxi/clk_h6.c            |  6 ++++
>  drivers/clk/sunxi/clk_r40.c           |  8 +++++
>  drivers/mmc/sunxi_mmc.c               | 59 +++++++++++++++++++++++++++++------
>  14 files changed, 131 insertions(+), 12 deletions(-)
>
> --
> 2.14.5
>
Andre Przywara Jan. 19, 2019, 8:33 p.m. UTC | #2
On 19/01/2019 18:32, Vasily Khoruzhick wrote:
> On Fri, Jan 18, 2019 at 5:32 PM Andre Przywara <andre.przywara@arm.com> wrote:
>>
>> This series enables the Allwinner MMC driver to drive all SoCs with its
>> DM_MMC variant. We use the gates clock and reset support from the new
>> clock driver, but keep the actual mod clock in its somewhat hackish
>> state. Properly supporting this via the clock driver is a bit more work.
>> The per-compatible variant struct for now only holds the mod clock
>> address (which will go away), but we will need the struct later again
>> for the various timing modes.
>>
>> This allows us to eventually enable DM_MMC for all SoCs, and get rid of
>> the nasty deprecation warning.
>>
>> The first patch adds the MMC clock gates and resets to the clock driver.
>> Patch 2/9 adds support for the A80 MMC config clock, which is a bit
>> special. I can't test this, so please give this a try if you have a board.
>>
>> Patch 3 uses the new clocks in the MMC driver, the following three patches
>> add the remaining compatible strings along with their required mod clock
>> addresses.
>>
>> Patch 7 fixes the Pine64-LTS board, while patch 8 eventually enables
>> everything. Patch 9 is some comment fix to make it easier to reason
>> about what part of the driver is for DM_MMC and which is not.
>>
>> I successfully compiled the HEAD for all 142 Allwinner boards, also
>> compiled all patches for selected boards.
>>
>> This was briefly tested on Pine-H64 (H6), Pine64-LTS (A64), OrangePi PC 2
>> (H5), OrangePi Zero (H2+) and BananaPi-M1 (A20).
>>
>> Please run it on every board that you can get hold of to give this series
>> a good shake.
>>
>> This goes on top of current sunxi/master (543049ab5906) and is available
>> on https://github.com/apritzel/u-boot/commits/sunxi-dm.
> 
> It breaks autoboot for eMMC on Pinebook.
> 
> It complains:
> 
> Card did not respond to voltage select!
> MMC: no card present
> 
> Card itself is present, i.e. if I do these command I see card info:
> 
> mmc dev 2
> mmc info

Thanks for the report! So is this with this U-Boot on an SD card or on
the eMMC?

Can you try to add the mmc1 = &mmc2; alias that Jagan suggested:
https://lists.denx.de/pipermail/u-boot/2019-January/354367.html

Thanks,
Andre.

> Regards,
> Vasily
> 
>> This replaces Jagan's v2 series "mmc: sunxi: Enable DM_MMC" in a more
>> driver model compliant way, borrowing two patches from him.
>>
>> Cheers,
>> Andre.
>>
>> Andre Przywara (7):
>>   sunxi: clk: add MMC gates/resets
>>   sunxi: clk: A80: add MMC clock support
>>   mmc: sunxi: Add DM clk and reset support
>>   mmc: sunxi: Add H6 support
>>   mmc: sunxi: Add A80 support
>>   mmc: sunxi: Honour non-removable property in DT
>>   mmc: sunxi: Mark end of DM_MMC #ifdefs
>>
>> Jagan Teki (2):
>>   mmc: sunxi: Add missing compatible strings
>>   arm: sunxi: Enable DM_MMC
>>
>>  arch/arm/Kconfig                      |  1 +
>>  arch/arm/mach-sunxi/Kconfig           |  1 -
>>  configs/Linksprite_pcDuino3_defconfig |  1 -
>>  drivers/clk/sunxi/clk_a10.c           |  4 +++
>>  drivers/clk/sunxi/clk_a10s.c          |  3 ++
>>  drivers/clk/sunxi/clk_a23.c           |  6 ++++
>>  drivers/clk/sunxi/clk_a31.c           |  8 +++++
>>  drivers/clk/sunxi/clk_a64.c           |  6 ++++
>>  drivers/clk/sunxi/clk_a80.c           | 28 ++++++++++++++++-
>>  drivers/clk/sunxi/clk_a83t.c          |  6 ++++
>>  drivers/clk/sunxi/clk_h3.c            |  6 ++++
>>  drivers/clk/sunxi/clk_h6.c            |  6 ++++
>>  drivers/clk/sunxi/clk_r40.c           |  8 +++++
>>  drivers/mmc/sunxi_mmc.c               | 59 +++++++++++++++++++++++++++++------
>>  14 files changed, 131 insertions(+), 12 deletions(-)
>>
>> --
>> 2.14.5
>>
Vasily Khoruzhick Jan. 19, 2019, 11:42 p.m. UTC | #3
On Sat, Jan 19, 2019 at 12:35 PM André Przywara <andre.przywara@arm.com> wrote:

> Thanks for the report! So is this with this U-Boot on an SD card or on
> the eMMC?

This is with u-boot on eMMC and no SD card present in the slot.

> Can you try to add the mmc1 = &mmc2; alias that Jagan suggested:
> https://lists.denx.de/pipermail/u-boot/2019-January/354367.html

It didn't help.

> Thanks,
> Andre.
>
> > Regards,
> > Vasily
> >
> >> This replaces Jagan's v2 series "mmc: sunxi: Enable DM_MMC" in a more
> >> driver model compliant way, borrowing two patches from him.
> >>
> >> Cheers,
> >> Andre.
> >>
> >> Andre Przywara (7):
> >>   sunxi: clk: add MMC gates/resets
> >>   sunxi: clk: A80: add MMC clock support
> >>   mmc: sunxi: Add DM clk and reset support
> >>   mmc: sunxi: Add H6 support
> >>   mmc: sunxi: Add A80 support
> >>   mmc: sunxi: Honour non-removable property in DT
> >>   mmc: sunxi: Mark end of DM_MMC #ifdefs
> >>
> >> Jagan Teki (2):
> >>   mmc: sunxi: Add missing compatible strings
> >>   arm: sunxi: Enable DM_MMC
> >>
> >>  arch/arm/Kconfig                      |  1 +
> >>  arch/arm/mach-sunxi/Kconfig           |  1 -
> >>  configs/Linksprite_pcDuino3_defconfig |  1 -
> >>  drivers/clk/sunxi/clk_a10.c           |  4 +++
> >>  drivers/clk/sunxi/clk_a10s.c          |  3 ++
> >>  drivers/clk/sunxi/clk_a23.c           |  6 ++++
> >>  drivers/clk/sunxi/clk_a31.c           |  8 +++++
> >>  drivers/clk/sunxi/clk_a64.c           |  6 ++++
> >>  drivers/clk/sunxi/clk_a80.c           | 28 ++++++++++++++++-
> >>  drivers/clk/sunxi/clk_a83t.c          |  6 ++++
> >>  drivers/clk/sunxi/clk_h3.c            |  6 ++++
> >>  drivers/clk/sunxi/clk_h6.c            |  6 ++++
> >>  drivers/clk/sunxi/clk_r40.c           |  8 +++++
> >>  drivers/mmc/sunxi_mmc.c               | 59 +++++++++++++++++++++++++++++------
> >>  14 files changed, 131 insertions(+), 12 deletions(-)
> >>
> >> --
> >> 2.14.5
> >>
>
Priit Laes Jan. 20, 2019, 7:51 p.m. UTC | #4
On Sat, Jan 19, 2019 at 01:30:46AM +0000, Andre Przywara wrote:
> This series enables the Allwinner MMC driver to drive all SoCs with its
> DM_MMC variant. We use the gates clock and reset support from the new
> clock driver, but keep the actual mod clock in its somewhat hackish
> state. Properly supporting this via the clock driver is a bit more work.
> The per-compatible variant struct for now only holds the mod clock
> address (which will go away), but we will need the struct later again
> for the various timing modes.
> 
> This allows us to eventually enable DM_MMC for all SoCs, and get rid of
> the nasty deprecation warning.
> 
> The first patch adds the MMC clock gates and resets to the clock driver.
> Patch 2/9 adds support for the A80 MMC config clock, which is a bit
> special. I can't test this, so please give this a try if you have a board.
> 
> Patch 3 uses the new clocks in the MMC driver, the following three patches
> add the remaining compatible strings along with their required mod clock
> addresses.
> 
> Patch 7 fixes the Pine64-LTS board, while patch 8 eventually enables
> everything. Patch 9 is some comment fix to make it easier to reason
> about what part of the driver is for DM_MMC and which is not.
> 
> I successfully compiled the HEAD for all 142 Allwinner boards, also
> compiled all patches for selected boards.
> 
> This was briefly tested on Pine-H64 (H6), Pine64-LTS (A64), OrangePi PC 2
> (H5), OrangePi Zero (H2+) and BananaPi-M1 (A20).
> 
> Please run it on every board that you can get hold of to give this series
> a good shake.

Testing with A10 Gemei G9 Tablet, FEL mode is broken:

a) With usb-boot via fel:

I get following error/warning: 
Loading Environment from FAT... Card did not respond to voltage select!

=> mmc list
mmc@1c0f000: 0
### All commands below stalls for a bit (~2 seconds), but return nothing
=> mmc info  
=> mmc dev 0
=> mmc part

b) When booting from SD-card [1], card is properly found, identified and
even partitions are there.

dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 seek=8 bs=1024


> This goes on top of current sunxi/master (543049ab5906) and is available
> on https://github.com/apritzel/u-boot/commits/sunxi-dm.
> 
> This replaces Jagan's v2 series "mmc: sunxi: Enable DM_MMC" in a more
> driver model compliant way, borrowing two patches from him.
> 
> Cheers,
> Andre.
> 
> Andre Przywara (7):
>   sunxi: clk: add MMC gates/resets
>   sunxi: clk: A80: add MMC clock support
>   mmc: sunxi: Add DM clk and reset support
>   mmc: sunxi: Add H6 support
>   mmc: sunxi: Add A80 support
>   mmc: sunxi: Honour non-removable property in DT
>   mmc: sunxi: Mark end of DM_MMC #ifdefs
> 
> Jagan Teki (2):
>   mmc: sunxi: Add missing compatible strings
>   arm: sunxi: Enable DM_MMC
> 
>  arch/arm/Kconfig                      |  1 +
>  arch/arm/mach-sunxi/Kconfig           |  1 -
>  configs/Linksprite_pcDuino3_defconfig |  1 -
>  drivers/clk/sunxi/clk_a10.c           |  4 +++
>  drivers/clk/sunxi/clk_a10s.c          |  3 ++
>  drivers/clk/sunxi/clk_a23.c           |  6 ++++
>  drivers/clk/sunxi/clk_a31.c           |  8 +++++
>  drivers/clk/sunxi/clk_a64.c           |  6 ++++
>  drivers/clk/sunxi/clk_a80.c           | 28 ++++++++++++++++-
>  drivers/clk/sunxi/clk_a83t.c          |  6 ++++
>  drivers/clk/sunxi/clk_h3.c            |  6 ++++
>  drivers/clk/sunxi/clk_h6.c            |  6 ++++
>  drivers/clk/sunxi/clk_r40.c           |  8 +++++
>  drivers/mmc/sunxi_mmc.c               | 59 +++++++++++++++++++++++++++++------
>  14 files changed, 131 insertions(+), 12 deletions(-)
> 
> -- 
> 2.14.5
> 
> -- 
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Andre Przywara Jan. 21, 2019, 12:54 a.m. UTC | #5
On 20/01/2019 19:51, Priit Laes wrote:

Hi,

> On Sat, Jan 19, 2019 at 01:30:46AM +0000, Andre Przywara wrote:
>> This series enables the Allwinner MMC driver to drive all SoCs with its
>> DM_MMC variant. We use the gates clock and reset support from the new
>> clock driver, but keep the actual mod clock in its somewhat hackish
>> state. Properly supporting this via the clock driver is a bit more work.
>> The per-compatible variant struct for now only holds the mod clock
>> address (which will go away), but we will need the struct later again
>> for the various timing modes.
>>
>> This allows us to eventually enable DM_MMC for all SoCs, and get rid of
>> the nasty deprecation warning.
>>
>> The first patch adds the MMC clock gates and resets to the clock driver.
>> Patch 2/9 adds support for the A80 MMC config clock, which is a bit
>> special. I can't test this, so please give this a try if you have a board.
>>
>> Patch 3 uses the new clocks in the MMC driver, the following three patches
>> add the remaining compatible strings along with their required mod clock
>> addresses.
>>
>> Patch 7 fixes the Pine64-LTS board, while patch 8 eventually enables
>> everything. Patch 9 is some comment fix to make it easier to reason
>> about what part of the driver is for DM_MMC and which is not.
>>
>> I successfully compiled the HEAD for all 142 Allwinner boards, also
>> compiled all patches for selected boards.
>>
>> This was briefly tested on Pine-H64 (H6), Pine64-LTS (A64), OrangePi PC 2
>> (H5), OrangePi Zero (H2+) and BananaPi-M1 (A20).
>>
>> Please run it on every board that you can get hold of to give this series
>> a good shake.
> 
> Testing with A10 Gemei G9 Tablet, FEL mode is broken:
> 
> a) With usb-boot via fel:
> 
> I get following error/warning: 
> Loading Environment from FAT... Card did not respond to voltage select!
> 
> => mmc list
> mmc@1c0f000: 0
> ### All commands below stalls for a bit (~2 seconds), but return nothing
> => mmc info  
> => mmc dev 0
> => mmc part

Ah, thanks for mentioning that. Can reproduce this on the Pine64-LTS.
And I was already wondering why we wouldn't need the pinctrl parts I was
working on ...

So if we boot from SD card, the SPL sets up the pinmux for the SD pins,
and stuff works. For U-Boot proper we rely on board_mmc_init() to do
this for us, but this gets only called for !DM_MMC configurations.
If we boot with a SPL which doesn't initialise the MMC (booting via FEL
or SPI or NAND), the pinmux setup is missing and it fails.

If anyone has a clever idea how to fix this without too much hacking and
without bringing in a DM_PINCTRL driver, I am all ears.

Thanks for testing and the report!

Cheers,
Andre.

> 
> b) When booting from SD-card [1], card is properly found, identified and
> even partitions are there.
> 
> dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 seek=8 bs=1024
> 
> 
>> This goes on top of current sunxi/master (543049ab5906) and is available
>> on https://github.com/apritzel/u-boot/commits/sunxi-dm.
>>
>> This replaces Jagan's v2 series "mmc: sunxi: Enable DM_MMC" in a more
>> driver model compliant way, borrowing two patches from him.
>>
>> Cheers,
>> Andre.
>>
>> Andre Przywara (7):
>>   sunxi: clk: add MMC gates/resets
>>   sunxi: clk: A80: add MMC clock support
>>   mmc: sunxi: Add DM clk and reset support
>>   mmc: sunxi: Add H6 support
>>   mmc: sunxi: Add A80 support
>>   mmc: sunxi: Honour non-removable property in DT
>>   mmc: sunxi: Mark end of DM_MMC #ifdefs
>>
>> Jagan Teki (2):
>>   mmc: sunxi: Add missing compatible strings
>>   arm: sunxi: Enable DM_MMC
>>
>>  arch/arm/Kconfig                      |  1 +
>>  arch/arm/mach-sunxi/Kconfig           |  1 -
>>  configs/Linksprite_pcDuino3_defconfig |  1 -
>>  drivers/clk/sunxi/clk_a10.c           |  4 +++
>>  drivers/clk/sunxi/clk_a10s.c          |  3 ++
>>  drivers/clk/sunxi/clk_a23.c           |  6 ++++
>>  drivers/clk/sunxi/clk_a31.c           |  8 +++++
>>  drivers/clk/sunxi/clk_a64.c           |  6 ++++
>>  drivers/clk/sunxi/clk_a80.c           | 28 ++++++++++++++++-
>>  drivers/clk/sunxi/clk_a83t.c          |  6 ++++
>>  drivers/clk/sunxi/clk_h3.c            |  6 ++++
>>  drivers/clk/sunxi/clk_h6.c            |  6 ++++
>>  drivers/clk/sunxi/clk_r40.c           |  8 +++++
>>  drivers/mmc/sunxi_mmc.c               | 59 +++++++++++++++++++++++++++++------
>>  14 files changed, 131 insertions(+), 12 deletions(-)
>>
>> -- 
>> 2.14.5
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
Priit Laes Jan. 21, 2019, 8:22 a.m. UTC | #6
On Mon, Jan 21, 2019 at 12:54:52AM +0000, André Przywara wrote:
> On 20/01/2019 19:51, Priit Laes wrote:
> 
> Hi,
> 
> > On Sat, Jan 19, 2019 at 01:30:46AM +0000, Andre Przywara wrote:
> >> This series enables the Allwinner MMC driver to drive all SoCs with its
> >> DM_MMC variant. We use the gates clock and reset support from the new
> >> clock driver, but keep the actual mod clock in its somewhat hackish
> >> state. Properly supporting this via the clock driver is a bit more work.
> >> The per-compatible variant struct for now only holds the mod clock
> >> address (which will go away), but we will need the struct later again
> >> for the various timing modes.
> >>
> >> This allows us to eventually enable DM_MMC for all SoCs, and get rid of
> >> the nasty deprecation warning.
> >>
> >> The first patch adds the MMC clock gates and resets to the clock driver.
> >> Patch 2/9 adds support for the A80 MMC config clock, which is a bit
> >> special. I can't test this, so please give this a try if you have a board.
> >>
> >> Patch 3 uses the new clocks in the MMC driver, the following three patches
> >> add the remaining compatible strings along with their required mod clock
> >> addresses.
> >>
> >> Patch 7 fixes the Pine64-LTS board, while patch 8 eventually enables
> >> everything. Patch 9 is some comment fix to make it easier to reason
> >> about what part of the driver is for DM_MMC and which is not.
> >>
> >> I successfully compiled the HEAD for all 142 Allwinner boards, also
> >> compiled all patches for selected boards.
> >>
> >> This was briefly tested on Pine-H64 (H6), Pine64-LTS (A64), OrangePi PC 2
> >> (H5), OrangePi Zero (H2+) and BananaPi-M1 (A20).
> >>
> >> Please run it on every board that you can get hold of to give this series
> >> a good shake.
> > 
> > Testing with A10 Gemei G9 Tablet, FEL mode is broken:
> > 
> > a) With usb-boot via fel:
> > 
> > I get following error/warning: 
> > Loading Environment from FAT... Card did not respond to voltage select!
> > 
> > => mmc list
> > mmc@1c0f000: 0
> > ### All commands below stalls for a bit (~2 seconds), but return nothing
> > => mmc info  
> > => mmc dev 0
> > => mmc part

Similar issue with A20 Olinuxino Lime2 revk with SPI.

a) Fel mode usb-boot failure (cannot properly initialize sd / emmc)
b) SPI boot failure (cannot properly initialize sd / emmc)

c) Regular SD-card boot works ok!
d) eMMC boot works ok!

> Ah, thanks for mentioning that. Can reproduce this on the Pine64-LTS.
> And I was already wondering why we wouldn't need the pinctrl parts I was
> working on ...
> 
> So if we boot from SD card, the SPL sets up the pinmux for the SD pins,
> and stuff works. For U-Boot proper we rely on board_mmc_init() to do
> this for us, but this gets only called for !DM_MMC configurations.
> If we boot with a SPL which doesn't initialise the MMC (booting via FEL
> or SPI or NAND), the pinmux setup is missing and it fails.
> 
> If anyone has a clever idea how to fix this without too much hacking and
> without bringing in a DM_PINCTRL driver, I am all ears.

Well, we know that there are basically only a few SPL boot options..
> 
> Thanks for testing and the report!
> 
> Cheers,
> Andre.
> 
> > 
> > b) When booting from SD-card [1], card is properly found, identified and
> > even partitions are there.
> > 
> > dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 seek=8 bs=1024
> > 
> > 
> >> This goes on top of current sunxi/master (543049ab5906) and is available
> >> on https://github.com/apritzel/u-boot/commits/sunxi-dm.
> >>
> >> This replaces Jagan's v2 series "mmc: sunxi: Enable DM_MMC" in a more
> >> driver model compliant way, borrowing two patches from him.
> >>
> >> Cheers,
> >> Andre.
> >>
> >> Andre Przywara (7):
> >>   sunxi: clk: add MMC gates/resets
> >>   sunxi: clk: A80: add MMC clock support
> >>   mmc: sunxi: Add DM clk and reset support
> >>   mmc: sunxi: Add H6 support
> >>   mmc: sunxi: Add A80 support
> >>   mmc: sunxi: Honour non-removable property in DT
> >>   mmc: sunxi: Mark end of DM_MMC #ifdefs
> >>
> >> Jagan Teki (2):
> >>   mmc: sunxi: Add missing compatible strings
> >>   arm: sunxi: Enable DM_MMC
> >>
> >>  arch/arm/Kconfig                      |  1 +
> >>  arch/arm/mach-sunxi/Kconfig           |  1 -
> >>  configs/Linksprite_pcDuino3_defconfig |  1 -
> >>  drivers/clk/sunxi/clk_a10.c           |  4 +++
> >>  drivers/clk/sunxi/clk_a10s.c          |  3 ++
> >>  drivers/clk/sunxi/clk_a23.c           |  6 ++++
> >>  drivers/clk/sunxi/clk_a31.c           |  8 +++++
> >>  drivers/clk/sunxi/clk_a64.c           |  6 ++++
> >>  drivers/clk/sunxi/clk_a80.c           | 28 ++++++++++++++++-
> >>  drivers/clk/sunxi/clk_a83t.c          |  6 ++++
> >>  drivers/clk/sunxi/clk_h3.c            |  6 ++++
> >>  drivers/clk/sunxi/clk_h6.c            |  6 ++++
> >>  drivers/clk/sunxi/clk_r40.c           |  8 +++++
> >>  drivers/mmc/sunxi_mmc.c               | 59 +++++++++++++++++++++++++++++------
> >>  14 files changed, 131 insertions(+), 12 deletions(-)
> >>
> >> -- 
> >> 2.14.5
> >>
> >> -- 
> >> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> >> For more options, visit https://groups.google.com/d/optout.
>
Andre Przywara Jan. 21, 2019, 8:51 a.m. UTC | #7
Hi,

....

>>> Testing with A10 Gemei G9 Tablet, FEL mode is broken:
>>>
>>> a) With usb-boot via fel:
>>>
>>> I get following error/warning: 
>>> Loading Environment from FAT... Card did not respond to voltage select!
>>>
>>> => mmc list
>>> mmc@1c0f000: 0
>>> ### All commands below stalls for a bit (~2 seconds), but return nothing
>>> => mmc info  
>>> => mmc dev 0
>>> => mmc part
>>>
> Similar issue with A20 Olinuxino Lime2 revk with SPI.
> 
> a) Fel mode usb-boot failure (cannot properly initialize sd / emmc)
> b) SPI boot failure (cannot properly initialize sd / emmc)
> 
> c) Regular SD-card boot works ok!
> d) eMMC boot works ok!

Can you please try whether the patch below fixes this? At least it worked
for me with FEL booting my Pine64-LTS.

Not totally happy with it, but it seems like we do a similar trick for
I2C anyway, so ...

Cheers,
Andre

---
 board/sunxi/board.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index ad14837291..e330367d1d 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -208,6 +208,10 @@ enum env_location env_get_location(enum env_operation op, int prio)
 }
 #endif
 
+#ifdef CONFIG_DM_MMC
+static void mmc_pinmux_setup(int sdc);
+#endif
+
 /* add board specific code here */
 int board_init(void)
 {
@@ -269,6 +273,17 @@ int board_init(void)
 	i2c_init_board();
 #endif
 
+#ifdef CONFIG_DM_MMC
+	/*
+	 * Temporary workaround for enabling I2C clocks until proper sunxi DM
+	 * clk, reset and pinctrl drivers land.
+	 */
+	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
+#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
+	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
+#endif
+#endif	/* CONFIG_DM_MMC */
+
 	/* Uses dm gpio code so do this here and not in i2c_init_board() */
 	return soft_i2c_board_init();
 }
Priit Laes Jan. 21, 2019, 9:10 a.m. UTC | #8
On Mon, Jan 21, 2019 at 08:51:10AM +0000, Andre Przywara wrote:
> Hi,
> 
> ....
> 
> >>> Testing with A10 Gemei G9 Tablet, FEL mode is broken:
> >>>
> >>> a) With usb-boot via fel:
> >>>
> >>> I get following error/warning: 
> >>> Loading Environment from FAT... Card did not respond to voltage select!
> >>>
> >>> => mmc list
> >>> mmc@1c0f000: 0
> >>> ### All commands below stalls for a bit (~2 seconds), but return nothing
> >>> => mmc info  
> >>> => mmc dev 0
> >>> => mmc part
> >>>
> > Similar issue with A20 Olinuxino Lime2 revk with SPI.
> > 
> > a) Fel mode usb-boot failure (cannot properly initialize sd / emmc)
> > b) SPI boot failure (cannot properly initialize sd / emmc)
> > 
> > c) Regular SD-card boot works ok!
> > d) eMMC boot works ok!
> 
> Can you please try whether the patch below fixes this? At least it worked
> for me with FEL booting my Pine64-LTS.
> 
> Not totally happy with it, but it seems like we do a similar trick for
> I2C anyway, so ...

Yes, it fixes it.

Tested on A20-Olinuxino-Lime2-emmc.

PS. Comment regarding i2c looks a bit odd..

> 
> Cheers,
> Andre
> 
> ---
>  board/sunxi/board.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index ad14837291..e330367d1d 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -208,6 +208,10 @@ enum env_location env_get_location(enum env_operation op, int prio)
>  }
>  #endif
>  
> +#ifdef CONFIG_DM_MMC
> +static void mmc_pinmux_setup(int sdc);
> +#endif
> +
>  /* add board specific code here */
>  int board_init(void)
>  {
> @@ -269,6 +273,17 @@ int board_init(void)
>  	i2c_init_board();
>  #endif
>  
> +#ifdef CONFIG_DM_MMC
> +	/*
> +	 * Temporary workaround for enabling I2C clocks until proper sunxi DM
> +	 * clk, reset and pinctrl drivers land.
> +	 */
> +	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
> +#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
> +	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
> +#endif
> +#endif	/* CONFIG_DM_MMC */
> +
>  	/* Uses dm gpio code so do this here and not in i2c_init_board() */
>  	return soft_i2c_board_init();
>  }
> -- 
> 2.14.5
> 
> -- 
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Jagan Teki Jan. 21, 2019, 9:22 a.m. UTC | #9
On Sat, Jan 19, 2019 at 7:02 AM Andre Przywara <andre.przywara@arm.com> wrote:
>
> This series enables the Allwinner MMC driver to drive all SoCs with its
> DM_MMC variant. We use the gates clock and reset support from the new
> clock driver, but keep the actual mod clock in its somewhat hackish
> state. Properly supporting this via the clock driver is a bit more work.
> The per-compatible variant struct for now only holds the mod clock
> address (which will go away), but we will need the struct later again
> for the various timing modes.
>
> This allows us to eventually enable DM_MMC for all SoCs, and get rid of
> the nasty deprecation warning.
>
> The first patch adds the MMC clock gates and resets to the clock driver.
> Patch 2/9 adds support for the A80 MMC config clock, which is a bit
> special. I can't test this, so please give this a try if you have a board.
>
> Patch 3 uses the new clocks in the MMC driver, the following three patches
> add the remaining compatible strings along with their required mod clock
> addresses.
>
> Patch 7 fixes the Pine64-LTS board, while patch 8 eventually enables
> everything. Patch 9 is some comment fix to make it easier to reason
> about what part of the driver is for DM_MMC and which is not.
>
> I successfully compiled the HEAD for all 142 Allwinner boards, also
> compiled all patches for selected boards.
>
> This was briefly tested on Pine-H64 (H6), Pine64-LTS (A64), OrangePi PC 2
> (H5), OrangePi Zero (H2+) and BananaPi-M1 (A20).
>
> Please run it on every board that you can get hold of to give this series
> a good shake.
>
> This goes on top of current sunxi/master (543049ab5906) and is available
> on https://github.com/apritzel/u-boot/commits/sunxi-dm.
>
> This replaces Jagan's v2 series "mmc: sunxi: Enable DM_MMC" in a more
> driver model compliant way, borrowing two patches from him.

You may be wait some tome before I'm commenting or for next version
changes.  Many changes like CLK and RESET support to mmc been in ML,
since you are not happy with v2 I prepared the CLK version for v2 (in
between you sent your version). Let me grab your few changes and
finalize my v3.
Lukasz Majewski Jan. 22, 2019, 9:49 a.m. UTC | #10
On Mon, 21 Jan 2019 00:54:52 +0000
André Przywara <andre.przywara@arm.com> wrote:

> On 20/01/2019 19:51, Priit Laes wrote:
> 
> Hi,
> 
> > On Sat, Jan 19, 2019 at 01:30:46AM +0000, Andre Przywara wrote:  
> >> This series enables the Allwinner MMC driver to drive all SoCs
> >> with its DM_MMC variant. We use the gates clock and reset support
> >> from the new clock driver, but keep the actual mod clock in its
> >> somewhat hackish state. Properly supporting this via the clock
> >> driver is a bit more work. The per-compatible variant struct for
> >> now only holds the mod clock address (which will go away), but we
> >> will need the struct later again for the various timing modes.
> >>
> >> This allows us to eventually enable DM_MMC for all SoCs, and get
> >> rid of the nasty deprecation warning.
> >>
> >> The first patch adds the MMC clock gates and resets to the clock
> >> driver. Patch 2/9 adds support for the A80 MMC config clock, which
> >> is a bit special. I can't test this, so please give this a try if
> >> you have a board.
> >>
> >> Patch 3 uses the new clocks in the MMC driver, the following three
> >> patches add the remaining compatible strings along with their
> >> required mod clock addresses.
> >>
> >> Patch 7 fixes the Pine64-LTS board, while patch 8 eventually
> >> enables everything. Patch 9 is some comment fix to make it easier
> >> to reason about what part of the driver is for DM_MMC and which is
> >> not.
> >>
> >> I successfully compiled the HEAD for all 142 Allwinner boards, also
> >> compiled all patches for selected boards.
> >>
> >> This was briefly tested on Pine-H64 (H6), Pine64-LTS (A64),
> >> OrangePi PC 2 (H5), OrangePi Zero (H2+) and BananaPi-M1 (A20).
> >>
> >> Please run it on every board that you can get hold of to give this
> >> series a good shake.  
> > 
> > Testing with A10 Gemei G9 Tablet, FEL mode is broken:
> > 
> > a) With usb-boot via fel:
> > 
> > I get following error/warning: 
> > Loading Environment from FAT... Card did not respond to voltage
> > select! 
> > => mmc list  
> > mmc@1c0f000: 0
> > ### All commands below stalls for a bit (~2 seconds), but return
> > nothing => mmc info  
> > => mmc dev 0
> > => mmc part  
> 
> Ah, thanks for mentioning that. Can reproduce this on the Pine64-LTS.
> And I was already wondering why we wouldn't need the pinctrl parts I
> was working on ...
> 
> So if we boot from SD card, the SPL sets up the pinmux for the SD
> pins, and stuff works. For U-Boot proper we rely on board_mmc_init()
> to do this for us, but this gets only called for !DM_MMC
> configurations. If we boot with a SPL which doesn't initialise the
> MMC (booting via FEL or SPI or NAND), the pinmux setup is missing and
> it fails.
> 
> If anyone has a clever idea how to fix this without too much hacking
> and without bringing in a DM_PINCTRL driver, I am all ears.
> 

I had similar problem with imx6. The DM_PINCTRL seems to be a must-have
here.

There is a similar problem - driver model tends to re-configure the
pinmux configuration in SPL and u-boot proper (also before relocation
if asked).

> Thanks for testing and the report!
> 
> Cheers,
> Andre.
> 
> > 
> > b) When booting from SD-card [1], card is properly found,
> > identified and even partitions are there.
> > 
> > dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 seek=8 bs=1024
> > 
> >   
> >> This goes on top of current sunxi/master (543049ab5906) and is
> >> available on https://github.com/apritzel/u-boot/commits/sunxi-dm.
> >>
> >> This replaces Jagan's v2 series "mmc: sunxi: Enable DM_MMC" in a
> >> more driver model compliant way, borrowing two patches from him.
> >>
> >> Cheers,
> >> Andre.
> >>
> >> Andre Przywara (7):
> >>   sunxi: clk: add MMC gates/resets
> >>   sunxi: clk: A80: add MMC clock support
> >>   mmc: sunxi: Add DM clk and reset support
> >>   mmc: sunxi: Add H6 support
> >>   mmc: sunxi: Add A80 support
> >>   mmc: sunxi: Honour non-removable property in DT
> >>   mmc: sunxi: Mark end of DM_MMC #ifdefs
> >>
> >> Jagan Teki (2):
> >>   mmc: sunxi: Add missing compatible strings
> >>   arm: sunxi: Enable DM_MMC
> >>
> >>  arch/arm/Kconfig                      |  1 +
> >>  arch/arm/mach-sunxi/Kconfig           |  1 -
> >>  configs/Linksprite_pcDuino3_defconfig |  1 -
> >>  drivers/clk/sunxi/clk_a10.c           |  4 +++
> >>  drivers/clk/sunxi/clk_a10s.c          |  3 ++
> >>  drivers/clk/sunxi/clk_a23.c           |  6 ++++
> >>  drivers/clk/sunxi/clk_a31.c           |  8 +++++
> >>  drivers/clk/sunxi/clk_a64.c           |  6 ++++
> >>  drivers/clk/sunxi/clk_a80.c           | 28 ++++++++++++++++-
> >>  drivers/clk/sunxi/clk_a83t.c          |  6 ++++
> >>  drivers/clk/sunxi/clk_h3.c            |  6 ++++
> >>  drivers/clk/sunxi/clk_h6.c            |  6 ++++
> >>  drivers/clk/sunxi/clk_r40.c           |  8 +++++
> >>  drivers/mmc/sunxi_mmc.c               | 59
> >> +++++++++++++++++++++++++++++------ 14 files changed, 131
> >> insertions(+), 12 deletions(-)
> >>
> >> -- 
> >> 2.14.5
> >>
> >> -- 
> >> You received this message because you are subscribed to the Google
> >> Groups "linux-sunxi" group. To unsubscribe from this group and
> >> stop receiving emails from it, send an email to
> >> linux-sunxi+unsubscribe@googlegroups.com. For more options, visit
> >> https://groups.google.com/d/optout.  
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de