Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-28 Thread Simon Glass
Hi Alex,

On 16 April 2017 at 13:34, Simon Glass  wrote:
> Hi Alex,
>
> On 16 April 2017 at 04:08, Alexander Graf  wrote:
>>
>>
>> On 16.04.17 04:09, Heinrich Schuchardt wrote:
>>>
>>> On 04/15/2017 11:51 PM, Andreas Färber wrote:

 Am 15.04.2017 um 23:16 schrieb Andreas Färber:
>
> Am 15.04.2017 um 23:04 schrieb Alexander Graf:
>>>
>>> Am 15.04.2017 um 22:34 schrieb Andreas Färber :

 Am 15.04.2017 um 20:27 schrieb Alexander Graf:
>
> On 15.04.17 20:18, Heiner Kallweit wrote:
>>
>> Am 15.04.2017 um 17:05 schrieb Andreas Färber:
>> But for the Vega S95 Telos I needed to disable the first of three
>> MMC
>> nodes (SDIO) - otherwise U-Boot would happily iterate over them for
>> distro boot with Heinrich's patch, but GRUB would come up with no
>> disks,
>> so that booting failed. I'm not yet sure why, maybe it's a
>> UEFI-side
>> problem in that it is the first MMC device that is absent rather
>> than
>> the last one?
>>
> I don't own this device so I can just provide a guess.
> Based on DT the device ordering most likely is:
> mmc0: SDIO
> mmc1: SD
> mmc2: eMMC
>>>
>>> [...]

 If grub comes up, distro boot has successfully found the target
 binary
 and executed it. For some reason, grub can not find its boot origin
 though.

 Andreas, please add debug prints like the ones below and check that
 the
 device names match:
>>>
>>>
>>> U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
>>> vega-s95
>>>
>>> DRAM:  2 GiB
>>> MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
>>> Using default environment
>>>
>>> In:serial@4c0
>>> Out:   serial@4c0
>>> Err:   serial@4c0
>>> Net:   eth0: ethernet@c941
>>> Hit any key to stop autoboot:  0
>>> mmc_init: -95, time 1806
>>> MMC Device 0 not found
>>> no mmc device at slot 0
>>> switch to partitions #0, OK
>>> mmc1 is current device
>>> Scanning mmc 1:1...
>>> Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
>>> 20335 bytes read in 43 ms (460.9 KiB/s)
>>> Found EFI removable media binary efi/boot/bootaa64.efi
>>> Setting boot device name to '/efi/boot/bootaa64.efi'
>>> reading efi/boot/bootaa64.efi
>>> 129024 bytes read in 13 ms (9.5 MiB/s)
>>> ## Starting EFI application at 0108 ...
>>> mmc_init: -95, time 1807
>>> Found 0 disks
>>
>>
>> That looks like efi_disk didn't manage to enumerate any devices?
>
>
> Apparently. The last line comes from
> lib/efi_loader_efi_disk:efi_disk_register(), and CONFIG_BLK=y. As you
> can see, there is not a single "Scanning disk" line, so I guess we do
> not iterate over uclass devices properly?
>
> On the Odroid-C2 I get this:
>
> Scanning disk m...@72000.blk...
> Card did not respond to voltage select!
> mmc_init: -95, time 9
> Found 1 disks
>
> Therefore my guess that it matters at what point in time - before or
> after the disk we want - the error accessing an MMC device happens.


 For comparison, Vega S95 with first MMC node disabled in DT:

 Scanning disk m...@72000.blk...
 Adding disk device 'm...@72000.blk'
 ** First descriptor is NOT a primary desc on 1:1 **
 Scanning disk m...@74000.blk...
 Adding disk device 'm...@74000.blk'
 Found 2 disks

 Regards,
 Andreas

>>> By adding sd_mmc_a to the odroid-c2.dts I was able to reproduce the
>>> problem on the Odroid C2.
>>>
>>> While booting from SD card via booti still worked
>>> bootefi would not find any block device:
>>>
>>> => bootefi hello
>>> ## Starting EFI application at 0100 ...
>>> WARNING: Invalid device tree, expect boot to fail
>>> efi_add_memory_map: 0x7cf53000 0x1 2 yes
>>> uclass_find_device_by_seq: 0 -1
>>> uclass_find_device_by_seq: 0 0
>>>- -1 -1
>>>- -1 -1
>>>- -1 -1
>>>- not found
>>> set_state_simple op missing
>>> blk_get_device: if_type=6, devnum=0: m...@7.blk, 6, 0
>>> mmc_init: -95, time 1807
>>> Found 0 disks
>>> efi_add_memory_map: 0x7cf52000 0x1 6 yes
>>> do_bootefi_exec:234 Jumping to 0x7cf53148
>>> EFI: Entry efi_cout_output_string(7ff94b38, 7cf53280)
>>> Hello, world!
>>> EFI: Entry efi_exit(7ffa4598, 0, 0, )
>>> ## Application terminated, r = 0
>>>
>>> In the debug output you can see that after trying non-existant
>>> m...@7.blk no further devices are scanned. m...@72000.blk which has
>>> the SD card is not enumerated.
>>
>>
>> To me that looks like something wrong with DM code, as there is no explicit
>> abort condition in efi_disk_register() for the CONFIG_BLK case. Let's CC

Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-23 Thread Jaehoon Chung
On 04/24/2017 12:38 PM, Simon Glass wrote:
> Hi,
> 
> On 17 April 2017 at 16:39, Jaehoon Chung  wrote:
>> On 04/18/2017 06:18 AM, Heinrich Schuchardt wrote:
>>> On 04/16/2017 09:34 PM, Simon Glass wrote:
 Hi Alex,

 On 16 April 2017 at 04:08, Alexander Graf  wrote:
>
>
> On 16.04.17 04:09, Heinrich Schuchardt wrote:
>>
>> On 04/15/2017 11:51 PM, Andreas Färber wrote:
>>>
>>> Am 15.04.2017 um 23:16 schrieb Andreas Färber:

 Am 15.04.2017 um 23:04 schrieb Alexander Graf:
>>
>> Am 15.04.2017 um 22:34 schrieb Andreas Färber :
>>>
>>> Am 15.04.2017 um 20:27 schrieb Alexander Graf:

 On 15.04.17 20:18, Heiner Kallweit wrote:
>
> Am 15.04.2017 um 17:05 schrieb Andreas Färber:
> But for the Vega S95 Telos I needed to disable the first of three
> MMC
> nodes (SDIO) - otherwise U-Boot would happily iterate over them 
> for
> distro boot with Heinrich's patch, but GRUB would come up with no
> disks,
> so that booting failed. I'm not yet sure why, maybe it's a
> UEFI-side
> problem in that it is the first MMC device that is absent rather
> than
> the last one?
>
 I don't own this device so I can just provide a guess.
 Based on DT the device ordering most likely is:
 mmc0: SDIO
 mmc1: SD
 mmc2: eMMC
>>
>> [...]
>>>
>>> If grub comes up, distro boot has successfully found the target
>>> binary
>>> and executed it. For some reason, grub can not find its boot origin
>>> though.
>>>
>>> Andreas, please add debug prints like the ones below and check that
>>> the
>>> device names match:
>>
>>
>> U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 
>> +0200)
>> vega-s95
>>
>> DRAM:  2 GiB
>> MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
>> Using default environment
>>
>> In:serial@4c0
>> Out:   serial@4c0
>> Err:   serial@4c0
>> Net:   eth0: ethernet@c941
>> Hit any key to stop autoboot:  0
>> mmc_init: -95, time 1806
>> MMC Device 0 not found
>> no mmc device at slot 0
>> switch to partitions #0, OK
>> mmc1 is current device
>> Scanning mmc 1:1...
>> Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
>> 20335 bytes read in 43 ms (460.9 KiB/s)
>> Found EFI removable media binary efi/boot/bootaa64.efi
>> Setting boot device name to '/efi/boot/bootaa64.efi'
>> reading efi/boot/bootaa64.efi
>> 129024 bytes read in 13 ms (9.5 MiB/s)
>> ## Starting EFI application at 0108 ...
>> mmc_init: -95, time 1807
>> Found 0 disks
>
>
> That looks like efi_disk didn't manage to enumerate any devices?


 Apparently. The last line comes from
 lib/efi_loader_efi_disk:efi_disk_register(), and CONFIG_BLK=y. As you
 can see, there is not a single "Scanning disk" line, so I guess we do
 not iterate over uclass devices properly?

 On the Odroid-C2 I get this:

 Scanning disk m...@72000.blk...
 Card did not respond to voltage select!
 mmc_init: -95, time 9
 Found 1 disks

 Therefore my guess that it matters at what point in time - before or
 after the disk we want - the error accessing an MMC device happens.
>>>
>>>
>>> For comparison, Vega S95 with first MMC node disabled in DT:
>>>
>>> Scanning disk m...@72000.blk...
>>> Adding disk device 'm...@72000.blk'
>>> ** First descriptor is NOT a primary desc on 1:1 **
>>> Scanning disk m...@74000.blk...
>>> Adding disk device 'm...@74000.blk'
>>> Found 2 disks
>>>
>>> Regards,
>>> Andreas
>>>
>> By adding sd_mmc_a to the odroid-c2.dts I was able to reproduce the
>> problem on the Odroid C2.
>>
>> While booting from SD card via booti still worked
>> bootefi would not find any block device:
>>
>> => bootefi hello
>> ## Starting EFI application at 0100 ...
>> WARNING: Invalid device tree, expect boot to fail
>> efi_add_memory_map: 0x7cf53000 0x1 2 yes
>> uclass_find_device_by_seq: 0 -1
>> uclass_find_device_by_seq: 0 0
>>- -1 -1
>>- -1 -1
>>- -1 -1
>>- not found
>> set_state_simple op missing
>> blk_get_device: if_type=6, devnum=0: m...@7.blk, 6, 0
>> mmc_init: -95, time 1807
>>
>> This error number is "EOPNOTSUPP". Is "cfg->voltages" correct in 
>> 

Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-23 Thread Simon Glass
Hi,

On 17 April 2017 at 16:39, Jaehoon Chung  wrote:
> On 04/18/2017 06:18 AM, Heinrich Schuchardt wrote:
>> On 04/16/2017 09:34 PM, Simon Glass wrote:
>>> Hi Alex,
>>>
>>> On 16 April 2017 at 04:08, Alexander Graf  wrote:


 On 16.04.17 04:09, Heinrich Schuchardt wrote:
>
> On 04/15/2017 11:51 PM, Andreas Färber wrote:
>>
>> Am 15.04.2017 um 23:16 schrieb Andreas Färber:
>>>
>>> Am 15.04.2017 um 23:04 schrieb Alexander Graf:
>
> Am 15.04.2017 um 22:34 schrieb Andreas Färber :
>>
>> Am 15.04.2017 um 20:27 schrieb Alexander Graf:
>>>
>>> On 15.04.17 20:18, Heiner Kallweit wrote:

 Am 15.04.2017 um 17:05 schrieb Andreas Färber:
 But for the Vega S95 Telos I needed to disable the first of three
 MMC
 nodes (SDIO) - otherwise U-Boot would happily iterate over them for
 distro boot with Heinrich's patch, but GRUB would come up with no
 disks,
 so that booting failed. I'm not yet sure why, maybe it's a
 UEFI-side
 problem in that it is the first MMC device that is absent rather
 than
 the last one?

>>> I don't own this device so I can just provide a guess.
>>> Based on DT the device ordering most likely is:
>>> mmc0: SDIO
>>> mmc1: SD
>>> mmc2: eMMC
>
> [...]
>>
>> If grub comes up, distro boot has successfully found the target
>> binary
>> and executed it. For some reason, grub can not find its boot origin
>> though.
>>
>> Andreas, please add debug prints like the ones below and check that
>> the
>> device names match:
>
>
> U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
> vega-s95
>
> DRAM:  2 GiB
> MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
> Using default environment
>
> In:serial@4c0
> Out:   serial@4c0
> Err:   serial@4c0
> Net:   eth0: ethernet@c941
> Hit any key to stop autoboot:  0
> mmc_init: -95, time 1806
> MMC Device 0 not found
> no mmc device at slot 0
> switch to partitions #0, OK
> mmc1 is current device
> Scanning mmc 1:1...
> Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
> 20335 bytes read in 43 ms (460.9 KiB/s)
> Found EFI removable media binary efi/boot/bootaa64.efi
> Setting boot device name to '/efi/boot/bootaa64.efi'
> reading efi/boot/bootaa64.efi
> 129024 bytes read in 13 ms (9.5 MiB/s)
> ## Starting EFI application at 0108 ...
> mmc_init: -95, time 1807
> Found 0 disks


 That looks like efi_disk didn't manage to enumerate any devices?
>>>
>>>
>>> Apparently. The last line comes from
>>> lib/efi_loader_efi_disk:efi_disk_register(), and CONFIG_BLK=y. As you
>>> can see, there is not a single "Scanning disk" line, so I guess we do
>>> not iterate over uclass devices properly?
>>>
>>> On the Odroid-C2 I get this:
>>>
>>> Scanning disk m...@72000.blk...
>>> Card did not respond to voltage select!
>>> mmc_init: -95, time 9
>>> Found 1 disks
>>>
>>> Therefore my guess that it matters at what point in time - before or
>>> after the disk we want - the error accessing an MMC device happens.
>>
>>
>> For comparison, Vega S95 with first MMC node disabled in DT:
>>
>> Scanning disk m...@72000.blk...
>> Adding disk device 'm...@72000.blk'
>> ** First descriptor is NOT a primary desc on 1:1 **
>> Scanning disk m...@74000.blk...
>> Adding disk device 'm...@74000.blk'
>> Found 2 disks
>>
>> Regards,
>> Andreas
>>
> By adding sd_mmc_a to the odroid-c2.dts I was able to reproduce the
> problem on the Odroid C2.
>
> While booting from SD card via booti still worked
> bootefi would not find any block device:
>
> => bootefi hello
> ## Starting EFI application at 0100 ...
> WARNING: Invalid device tree, expect boot to fail
> efi_add_memory_map: 0x7cf53000 0x1 2 yes
> uclass_find_device_by_seq: 0 -1
> uclass_find_device_by_seq: 0 0
>- -1 -1
>- -1 -1
>- -1 -1
>- not found
> set_state_simple op missing
> blk_get_device: if_type=6, devnum=0: m...@7.blk, 6, 0
> mmc_init: -95, time 1807
>
> This error number is "EOPNOTSUPP". Is "cfg->voltages" correct in 
> meson_gx_mmc.c?

Or it could just be that there is no card inserted? See
mmc_start_init(). It would be good to update mmc.c to return different
errors for the different cases.

Regards,
Simon

Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-17 Thread Jaehoon Chung
On 04/18/2017 06:18 AM, Heinrich Schuchardt wrote:
> On 04/16/2017 09:34 PM, Simon Glass wrote:
>> Hi Alex,
>>
>> On 16 April 2017 at 04:08, Alexander Graf  wrote:
>>>
>>>
>>> On 16.04.17 04:09, Heinrich Schuchardt wrote:

 On 04/15/2017 11:51 PM, Andreas Färber wrote:
>
> Am 15.04.2017 um 23:16 schrieb Andreas Färber:
>>
>> Am 15.04.2017 um 23:04 schrieb Alexander Graf:

 Am 15.04.2017 um 22:34 schrieb Andreas Färber :
>
> Am 15.04.2017 um 20:27 schrieb Alexander Graf:
>>
>> On 15.04.17 20:18, Heiner Kallweit wrote:
>>>
>>> Am 15.04.2017 um 17:05 schrieb Andreas Färber:
>>> But for the Vega S95 Telos I needed to disable the first of three
>>> MMC
>>> nodes (SDIO) - otherwise U-Boot would happily iterate over them for
>>> distro boot with Heinrich's patch, but GRUB would come up with no
>>> disks,
>>> so that booting failed. I'm not yet sure why, maybe it's a
>>> UEFI-side
>>> problem in that it is the first MMC device that is absent rather
>>> than
>>> the last one?
>>>
>> I don't own this device so I can just provide a guess.
>> Based on DT the device ordering most likely is:
>> mmc0: SDIO
>> mmc1: SD
>> mmc2: eMMC

 [...]
>
> If grub comes up, distro boot has successfully found the target
> binary
> and executed it. For some reason, grub can not find its boot origin
> though.
>
> Andreas, please add debug prints like the ones below and check that
> the
> device names match:


 U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
 vega-s95

 DRAM:  2 GiB
 MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
 Using default environment

 In:serial@4c0
 Out:   serial@4c0
 Err:   serial@4c0
 Net:   eth0: ethernet@c941
 Hit any key to stop autoboot:  0
 mmc_init: -95, time 1806
 MMC Device 0 not found
 no mmc device at slot 0
 switch to partitions #0, OK
 mmc1 is current device
 Scanning mmc 1:1...
 Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
 20335 bytes read in 43 ms (460.9 KiB/s)
 Found EFI removable media binary efi/boot/bootaa64.efi
 Setting boot device name to '/efi/boot/bootaa64.efi'
 reading efi/boot/bootaa64.efi
 129024 bytes read in 13 ms (9.5 MiB/s)
 ## Starting EFI application at 0108 ...
 mmc_init: -95, time 1807
 Found 0 disks
>>>
>>>
>>> That looks like efi_disk didn't manage to enumerate any devices?
>>
>>
>> Apparently. The last line comes from
>> lib/efi_loader_efi_disk:efi_disk_register(), and CONFIG_BLK=y. As you
>> can see, there is not a single "Scanning disk" line, so I guess we do
>> not iterate over uclass devices properly?
>>
>> On the Odroid-C2 I get this:
>>
>> Scanning disk m...@72000.blk...
>> Card did not respond to voltage select!
>> mmc_init: -95, time 9
>> Found 1 disks
>>
>> Therefore my guess that it matters at what point in time - before or
>> after the disk we want - the error accessing an MMC device happens.
>
>
> For comparison, Vega S95 with first MMC node disabled in DT:
>
> Scanning disk m...@72000.blk...
> Adding disk device 'm...@72000.blk'
> ** First descriptor is NOT a primary desc on 1:1 **
> Scanning disk m...@74000.blk...
> Adding disk device 'm...@74000.blk'
> Found 2 disks
>
> Regards,
> Andreas
>
 By adding sd_mmc_a to the odroid-c2.dts I was able to reproduce the
 problem on the Odroid C2.

 While booting from SD card via booti still worked
 bootefi would not find any block device:

 => bootefi hello
 ## Starting EFI application at 0100 ...
 WARNING: Invalid device tree, expect boot to fail
 efi_add_memory_map: 0x7cf53000 0x1 2 yes
 uclass_find_device_by_seq: 0 -1
 uclass_find_device_by_seq: 0 0
- -1 -1
- -1 -1
- -1 -1
- not found
 set_state_simple op missing
 blk_get_device: if_type=6, devnum=0: m...@7.blk, 6, 0
 mmc_init: -95, time 1807

This error number is "EOPNOTSUPP". Is "cfg->voltages" correct in meson_gx_mmc.c?

 Found 0 disks
 efi_add_memory_map: 0x7cf52000 0x1 6 yes
 do_bootefi_exec:234 Jumping to 0x7cf53148
 EFI: Entry efi_cout_output_string(7ff94b38, 7cf53280)
 Hello, world!
 EFI: Entry efi_exit(7ffa4598, 0, 0, )
 ## Application terminated, r = 0

 In the debug output you can see that after trying non-existant
 m...@7.blk no further 

Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-17 Thread Heinrich Schuchardt
On 04/16/2017 09:34 PM, Simon Glass wrote:
> Hi Alex,
> 
> On 16 April 2017 at 04:08, Alexander Graf  wrote:
>>
>>
>> On 16.04.17 04:09, Heinrich Schuchardt wrote:
>>>
>>> On 04/15/2017 11:51 PM, Andreas Färber wrote:

 Am 15.04.2017 um 23:16 schrieb Andreas Färber:
>
> Am 15.04.2017 um 23:04 schrieb Alexander Graf:
>>>
>>> Am 15.04.2017 um 22:34 schrieb Andreas Färber :

 Am 15.04.2017 um 20:27 schrieb Alexander Graf:
>
> On 15.04.17 20:18, Heiner Kallweit wrote:
>>
>> Am 15.04.2017 um 17:05 schrieb Andreas Färber:
>> But for the Vega S95 Telos I needed to disable the first of three
>> MMC
>> nodes (SDIO) - otherwise U-Boot would happily iterate over them for
>> distro boot with Heinrich's patch, but GRUB would come up with no
>> disks,
>> so that booting failed. I'm not yet sure why, maybe it's a
>> UEFI-side
>> problem in that it is the first MMC device that is absent rather
>> than
>> the last one?
>>
> I don't own this device so I can just provide a guess.
> Based on DT the device ordering most likely is:
> mmc0: SDIO
> mmc1: SD
> mmc2: eMMC
>>>
>>> [...]

 If grub comes up, distro boot has successfully found the target
 binary
 and executed it. For some reason, grub can not find its boot origin
 though.

 Andreas, please add debug prints like the ones below and check that
 the
 device names match:
>>>
>>>
>>> U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
>>> vega-s95
>>>
>>> DRAM:  2 GiB
>>> MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
>>> Using default environment
>>>
>>> In:serial@4c0
>>> Out:   serial@4c0
>>> Err:   serial@4c0
>>> Net:   eth0: ethernet@c941
>>> Hit any key to stop autoboot:  0
>>> mmc_init: -95, time 1806
>>> MMC Device 0 not found
>>> no mmc device at slot 0
>>> switch to partitions #0, OK
>>> mmc1 is current device
>>> Scanning mmc 1:1...
>>> Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
>>> 20335 bytes read in 43 ms (460.9 KiB/s)
>>> Found EFI removable media binary efi/boot/bootaa64.efi
>>> Setting boot device name to '/efi/boot/bootaa64.efi'
>>> reading efi/boot/bootaa64.efi
>>> 129024 bytes read in 13 ms (9.5 MiB/s)
>>> ## Starting EFI application at 0108 ...
>>> mmc_init: -95, time 1807
>>> Found 0 disks
>>
>>
>> That looks like efi_disk didn't manage to enumerate any devices?
>
>
> Apparently. The last line comes from
> lib/efi_loader_efi_disk:efi_disk_register(), and CONFIG_BLK=y. As you
> can see, there is not a single "Scanning disk" line, so I guess we do
> not iterate over uclass devices properly?
>
> On the Odroid-C2 I get this:
>
> Scanning disk m...@72000.blk...
> Card did not respond to voltage select!
> mmc_init: -95, time 9
> Found 1 disks
>
> Therefore my guess that it matters at what point in time - before or
> after the disk we want - the error accessing an MMC device happens.


 For comparison, Vega S95 with first MMC node disabled in DT:

 Scanning disk m...@72000.blk...
 Adding disk device 'm...@72000.blk'
 ** First descriptor is NOT a primary desc on 1:1 **
 Scanning disk m...@74000.blk...
 Adding disk device 'm...@74000.blk'
 Found 2 disks

 Regards,
 Andreas

>>> By adding sd_mmc_a to the odroid-c2.dts I was able to reproduce the
>>> problem on the Odroid C2.
>>>
>>> While booting from SD card via booti still worked
>>> bootefi would not find any block device:
>>>
>>> => bootefi hello
>>> ## Starting EFI application at 0100 ...
>>> WARNING: Invalid device tree, expect boot to fail
>>> efi_add_memory_map: 0x7cf53000 0x1 2 yes
>>> uclass_find_device_by_seq: 0 -1
>>> uclass_find_device_by_seq: 0 0
>>>- -1 -1
>>>- -1 -1
>>>- -1 -1
>>>- not found
>>> set_state_simple op missing
>>> blk_get_device: if_type=6, devnum=0: m...@7.blk, 6, 0
>>> mmc_init: -95, time 1807
>>> Found 0 disks
>>> efi_add_memory_map: 0x7cf52000 0x1 6 yes
>>> do_bootefi_exec:234 Jumping to 0x7cf53148
>>> EFI: Entry efi_cout_output_string(7ff94b38, 7cf53280)
>>> Hello, world!
>>> EFI: Entry efi_exit(7ffa4598, 0, 0, )
>>> ## Application terminated, r = 0
>>>
>>> In the debug output you can see that after trying non-existant
>>> m...@7.blk no further devices are scanned. m...@72000.blk which has
>>> the SD card is not enumerated.
>>
>>
>> To me that looks like something wrong with DM code, as there is no explicit
>> abort condition in efi_disk_register() for the CONFIG_BLK case. Let's CC
>> Simon and ask for help :).
> 

Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-16 Thread Simon Glass
Hi Alex,

On 16 April 2017 at 04:08, Alexander Graf  wrote:
>
>
> On 16.04.17 04:09, Heinrich Schuchardt wrote:
>>
>> On 04/15/2017 11:51 PM, Andreas Färber wrote:
>>>
>>> Am 15.04.2017 um 23:16 schrieb Andreas Färber:

 Am 15.04.2017 um 23:04 schrieb Alexander Graf:
>>
>> Am 15.04.2017 um 22:34 schrieb Andreas Färber :
>>>
>>> Am 15.04.2017 um 20:27 schrieb Alexander Graf:

 On 15.04.17 20:18, Heiner Kallweit wrote:
>
> Am 15.04.2017 um 17:05 schrieb Andreas Färber:
> But for the Vega S95 Telos I needed to disable the first of three
> MMC
> nodes (SDIO) - otherwise U-Boot would happily iterate over them for
> distro boot with Heinrich's patch, but GRUB would come up with no
> disks,
> so that booting failed. I'm not yet sure why, maybe it's a
> UEFI-side
> problem in that it is the first MMC device that is absent rather
> than
> the last one?
>
 I don't own this device so I can just provide a guess.
 Based on DT the device ordering most likely is:
 mmc0: SDIO
 mmc1: SD
 mmc2: eMMC
>>
>> [...]
>>>
>>> If grub comes up, distro boot has successfully found the target
>>> binary
>>> and executed it. For some reason, grub can not find its boot origin
>>> though.
>>>
>>> Andreas, please add debug prints like the ones below and check that
>>> the
>>> device names match:
>>
>>
>> U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
>> vega-s95
>>
>> DRAM:  2 GiB
>> MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
>> Using default environment
>>
>> In:serial@4c0
>> Out:   serial@4c0
>> Err:   serial@4c0
>> Net:   eth0: ethernet@c941
>> Hit any key to stop autoboot:  0
>> mmc_init: -95, time 1806
>> MMC Device 0 not found
>> no mmc device at slot 0
>> switch to partitions #0, OK
>> mmc1 is current device
>> Scanning mmc 1:1...
>> Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
>> 20335 bytes read in 43 ms (460.9 KiB/s)
>> Found EFI removable media binary efi/boot/bootaa64.efi
>> Setting boot device name to '/efi/boot/bootaa64.efi'
>> reading efi/boot/bootaa64.efi
>> 129024 bytes read in 13 ms (9.5 MiB/s)
>> ## Starting EFI application at 0108 ...
>> mmc_init: -95, time 1807
>> Found 0 disks
>
>
> That looks like efi_disk didn't manage to enumerate any devices?


 Apparently. The last line comes from
 lib/efi_loader_efi_disk:efi_disk_register(), and CONFIG_BLK=y. As you
 can see, there is not a single "Scanning disk" line, so I guess we do
 not iterate over uclass devices properly?

 On the Odroid-C2 I get this:

 Scanning disk m...@72000.blk...
 Card did not respond to voltage select!
 mmc_init: -95, time 9
 Found 1 disks

 Therefore my guess that it matters at what point in time - before or
 after the disk we want - the error accessing an MMC device happens.
>>>
>>>
>>> For comparison, Vega S95 with first MMC node disabled in DT:
>>>
>>> Scanning disk m...@72000.blk...
>>> Adding disk device 'm...@72000.blk'
>>> ** First descriptor is NOT a primary desc on 1:1 **
>>> Scanning disk m...@74000.blk...
>>> Adding disk device 'm...@74000.blk'
>>> Found 2 disks
>>>
>>> Regards,
>>> Andreas
>>>
>> By adding sd_mmc_a to the odroid-c2.dts I was able to reproduce the
>> problem on the Odroid C2.
>>
>> While booting from SD card via booti still worked
>> bootefi would not find any block device:
>>
>> => bootefi hello
>> ## Starting EFI application at 0100 ...
>> WARNING: Invalid device tree, expect boot to fail
>> efi_add_memory_map: 0x7cf53000 0x1 2 yes
>> uclass_find_device_by_seq: 0 -1
>> uclass_find_device_by_seq: 0 0
>>- -1 -1
>>- -1 -1
>>- -1 -1
>>- not found
>> set_state_simple op missing
>> blk_get_device: if_type=6, devnum=0: m...@7.blk, 6, 0
>> mmc_init: -95, time 1807
>> Found 0 disks
>> efi_add_memory_map: 0x7cf52000 0x1 6 yes
>> do_bootefi_exec:234 Jumping to 0x7cf53148
>> EFI: Entry efi_cout_output_string(7ff94b38, 7cf53280)
>> Hello, world!
>> EFI: Entry efi_exit(7ffa4598, 0, 0, )
>> ## Application terminated, r = 0
>>
>> In the debug output you can see that after trying non-existant
>> m...@7.blk no further devices are scanned. m...@72000.blk which has
>> the SD card is not enumerated.
>
>
> To me that looks like something wrong with DM code, as there is no explicit
> abort condition in efi_disk_register() for the CONFIG_BLK case. Let's CC
> Simon and ask for help :).

Reviewed-by: Simon Glass 

Do you have a board that uses CONFIG_BLK?

Or could we enhance my helloworld test to check the test? I really
don't like having to run grub to 

Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-16 Thread Alexander Graf



On 16.04.17 04:09, Heinrich Schuchardt wrote:

On 04/15/2017 11:51 PM, Andreas Färber wrote:

Am 15.04.2017 um 23:16 schrieb Andreas Färber:

Am 15.04.2017 um 23:04 schrieb Alexander Graf:

Am 15.04.2017 um 22:34 schrieb Andreas Färber :

Am 15.04.2017 um 20:27 schrieb Alexander Graf:

On 15.04.17 20:18, Heiner Kallweit wrote:

Am 15.04.2017 um 17:05 schrieb Andreas Färber:
But for the Vega S95 Telos I needed to disable the first of three MMC
nodes (SDIO) - otherwise U-Boot would happily iterate over them for
distro boot with Heinrich's patch, but GRUB would come up with no disks,
so that booting failed. I'm not yet sure why, maybe it's a UEFI-side
problem in that it is the first MMC device that is absent rather than
the last one?


I don't own this device so I can just provide a guess.
Based on DT the device ordering most likely is:
mmc0: SDIO
mmc1: SD
mmc2: eMMC

[...]

If grub comes up, distro boot has successfully found the target binary
and executed it. For some reason, grub can not find its boot origin though.

Andreas, please add debug prints like the ones below and check that the
device names match:


U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
vega-s95

DRAM:  2 GiB
MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
Using default environment

In:serial@4c0
Out:   serial@4c0
Err:   serial@4c0
Net:   eth0: ethernet@c941
Hit any key to stop autoboot:  0
mmc_init: -95, time 1806
MMC Device 0 not found
no mmc device at slot 0
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
20335 bytes read in 43 ms (460.9 KiB/s)
Found EFI removable media binary efi/boot/bootaa64.efi
Setting boot device name to '/efi/boot/bootaa64.efi'
reading efi/boot/bootaa64.efi
129024 bytes read in 13 ms (9.5 MiB/s)
## Starting EFI application at 0108 ...
mmc_init: -95, time 1807
Found 0 disks


That looks like efi_disk didn't manage to enumerate any devices?


Apparently. The last line comes from
lib/efi_loader_efi_disk:efi_disk_register(), and CONFIG_BLK=y. As you
can see, there is not a single "Scanning disk" line, so I guess we do
not iterate over uclass devices properly?

On the Odroid-C2 I get this:

Scanning disk m...@72000.blk...
Card did not respond to voltage select!
mmc_init: -95, time 9
Found 1 disks

Therefore my guess that it matters at what point in time - before or
after the disk we want - the error accessing an MMC device happens.


For comparison, Vega S95 with first MMC node disabled in DT:

Scanning disk m...@72000.blk...
Adding disk device 'm...@72000.blk'
** First descriptor is NOT a primary desc on 1:1 **
Scanning disk m...@74000.blk...
Adding disk device 'm...@74000.blk'
Found 2 disks

Regards,
Andreas


By adding sd_mmc_a to the odroid-c2.dts I was able to reproduce the
problem on the Odroid C2.

While booting from SD card via booti still worked
bootefi would not find any block device:

=> bootefi hello
## Starting EFI application at 0100 ...
WARNING: Invalid device tree, expect boot to fail
efi_add_memory_map: 0x7cf53000 0x1 2 yes
uclass_find_device_by_seq: 0 -1
uclass_find_device_by_seq: 0 0
   - -1 -1
   - -1 -1
   - -1 -1
   - not found
set_state_simple op missing
blk_get_device: if_type=6, devnum=0: m...@7.blk, 6, 0
mmc_init: -95, time 1807
Found 0 disks
efi_add_memory_map: 0x7cf52000 0x1 6 yes
do_bootefi_exec:234 Jumping to 0x7cf53148
EFI: Entry efi_cout_output_string(7ff94b38, 7cf53280)
Hello, world!
EFI: Entry efi_exit(7ffa4598, 0, 0, )
## Application terminated, r = 0

In the debug output you can see that after trying non-existant
m...@7.blk no further devices are scanned. m...@72000.blk which has
the SD card is not enumerated.


To me that looks like something wrong with DM code, as there is no 
explicit abort condition in efi_disk_register() for the CONFIG_BLK case. 
Let's CC Simon and ask for help :).



Alex
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-15 Thread Heinrich Schuchardt
On 04/15/2017 11:51 PM, Andreas Färber wrote:
> Am 15.04.2017 um 23:16 schrieb Andreas Färber:
>> Am 15.04.2017 um 23:04 schrieb Alexander Graf:
 Am 15.04.2017 um 22:34 schrieb Andreas Färber :
> Am 15.04.2017 um 20:27 schrieb Alexander Graf:
>> On 15.04.17 20:18, Heiner Kallweit wrote:
>>> Am 15.04.2017 um 17:05 schrieb Andreas Färber:
>>> But for the Vega S95 Telos I needed to disable the first of three MMC
>>> nodes (SDIO) - otherwise U-Boot would happily iterate over them for
>>> distro boot with Heinrich's patch, but GRUB would come up with no disks,
>>> so that booting failed. I'm not yet sure why, maybe it's a UEFI-side
>>> problem in that it is the first MMC device that is absent rather than
>>> the last one?
>>>
>> I don't own this device so I can just provide a guess.
>> Based on DT the device ordering most likely is:
>> mmc0: SDIO
>> mmc1: SD
>> mmc2: eMMC
 [...]
> If grub comes up, distro boot has successfully found the target binary
> and executed it. For some reason, grub can not find its boot origin 
> though.
>
> Andreas, please add debug prints like the ones below and check that the
> device names match:

 U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
 vega-s95

 DRAM:  2 GiB
 MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
 Using default environment

 In:serial@4c0
 Out:   serial@4c0
 Err:   serial@4c0
 Net:   eth0: ethernet@c941
 Hit any key to stop autoboot:  0
 mmc_init: -95, time 1806
 MMC Device 0 not found
 no mmc device at slot 0
 switch to partitions #0, OK
 mmc1 is current device
 Scanning mmc 1:1...
 Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
 20335 bytes read in 43 ms (460.9 KiB/s)
 Found EFI removable media binary efi/boot/bootaa64.efi
 Setting boot device name to '/efi/boot/bootaa64.efi'
 reading efi/boot/bootaa64.efi
 129024 bytes read in 13 ms (9.5 MiB/s)
 ## Starting EFI application at 0108 ...
 mmc_init: -95, time 1807
 Found 0 disks
>>>
>>> That looks like efi_disk didn't manage to enumerate any devices?
>>
>> Apparently. The last line comes from
>> lib/efi_loader_efi_disk:efi_disk_register(), and CONFIG_BLK=y. As you
>> can see, there is not a single "Scanning disk" line, so I guess we do
>> not iterate over uclass devices properly?
>>
>> On the Odroid-C2 I get this:
>>
>> Scanning disk m...@72000.blk...
>> Card did not respond to voltage select!
>> mmc_init: -95, time 9
>> Found 1 disks
>>
>> Therefore my guess that it matters at what point in time - before or
>> after the disk we want - the error accessing an MMC device happens.
> 
> For comparison, Vega S95 with first MMC node disabled in DT:
> 
> Scanning disk m...@72000.blk...
> Adding disk device 'm...@72000.blk'
> ** First descriptor is NOT a primary desc on 1:1 **
> Scanning disk m...@74000.blk...
> Adding disk device 'm...@74000.blk'
> Found 2 disks
> 
> Regards,
> Andreas
> 
By adding sd_mmc_a to the odroid-c2.dts I was able to reproduce the
problem on the Odroid C2.

While booting from SD card via booti still worked
bootefi would not find any block device:

=> bootefi hello
## Starting EFI application at 0100 ...
WARNING: Invalid device tree, expect boot to fail
efi_add_memory_map: 0x7cf53000 0x1 2 yes
uclass_find_device_by_seq: 0 -1
uclass_find_device_by_seq: 0 0
   - -1 -1
   - -1 -1
   - -1 -1
   - not found
set_state_simple op missing
blk_get_device: if_type=6, devnum=0: m...@7.blk, 6, 0
mmc_init: -95, time 1807
Found 0 disks
efi_add_memory_map: 0x7cf52000 0x1 6 yes
do_bootefi_exec:234 Jumping to 0x7cf53148
EFI: Entry efi_cout_output_string(7ff94b38, 7cf53280)
Hello, world!
EFI: Entry efi_exit(7ffa4598, 0, 0, )
## Application terminated, r = 0

In the debug output you can see that after trying non-existant
m...@7.blk no further devices are scanned. m...@72000.blk which has
the SD card is not enumerated.

Best regards

Heinrich Schuchardt

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-15 Thread Andreas Färber
Am 15.04.2017 um 23:16 schrieb Andreas Färber:
> Am 15.04.2017 um 23:04 schrieb Alexander Graf:
>>> Am 15.04.2017 um 22:34 schrieb Andreas Färber :
 Am 15.04.2017 um 20:27 schrieb Alexander Graf:
> On 15.04.17 20:18, Heiner Kallweit wrote:
>> Am 15.04.2017 um 17:05 schrieb Andreas Färber:
>> But for the Vega S95 Telos I needed to disable the first of three MMC
>> nodes (SDIO) - otherwise U-Boot would happily iterate over them for
>> distro boot with Heinrich's patch, but GRUB would come up with no disks,
>> so that booting failed. I'm not yet sure why, maybe it's a UEFI-side
>> problem in that it is the first MMC device that is absent rather than
>> the last one?
>>
> I don't own this device so I can just provide a guess.
> Based on DT the device ordering most likely is:
> mmc0: SDIO
> mmc1: SD
> mmc2: eMMC
>>> [...]
 If grub comes up, distro boot has successfully found the target binary
 and executed it. For some reason, grub can not find its boot origin though.

 Andreas, please add debug prints like the ones below and check that the
 device names match:
>>>
>>> U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
>>> vega-s95
>>>
>>> DRAM:  2 GiB
>>> MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
>>> Using default environment
>>>
>>> In:serial@4c0
>>> Out:   serial@4c0
>>> Err:   serial@4c0
>>> Net:   eth0: ethernet@c941
>>> Hit any key to stop autoboot:  0
>>> mmc_init: -95, time 1806
>>> MMC Device 0 not found
>>> no mmc device at slot 0
>>> switch to partitions #0, OK
>>> mmc1 is current device
>>> Scanning mmc 1:1...
>>> Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
>>> 20335 bytes read in 43 ms (460.9 KiB/s)
>>> Found EFI removable media binary efi/boot/bootaa64.efi
>>> Setting boot device name to '/efi/boot/bootaa64.efi'
>>> reading efi/boot/bootaa64.efi
>>> 129024 bytes read in 13 ms (9.5 MiB/s)
>>> ## Starting EFI application at 0108 ...
>>> mmc_init: -95, time 1807
>>> Found 0 disks
>>
>> That looks like efi_disk didn't manage to enumerate any devices?
> 
> Apparently. The last line comes from
> lib/efi_loader_efi_disk:efi_disk_register(), and CONFIG_BLK=y. As you
> can see, there is not a single "Scanning disk" line, so I guess we do
> not iterate over uclass devices properly?
> 
> On the Odroid-C2 I get this:
> 
> Scanning disk m...@72000.blk...
> Card did not respond to voltage select!
> mmc_init: -95, time 9
> Found 1 disks
> 
> Therefore my guess that it matters at what point in time - before or
> after the disk we want - the error accessing an MMC device happens.

For comparison, Vega S95 with first MMC node disabled in DT:

Scanning disk m...@72000.blk...
Adding disk device 'm...@72000.blk'
** First descriptor is NOT a primary desc on 1:1 **
Scanning disk m...@74000.blk...
Adding disk device 'm...@74000.blk'
Found 2 disks

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-15 Thread Andreas Färber
Am 15.04.2017 um 23:04 schrieb Alexander Graf:
>> Am 15.04.2017 um 22:34 schrieb Andreas Färber :
>>> Am 15.04.2017 um 20:27 schrieb Alexander Graf:
 On 15.04.17 20:18, Heiner Kallweit wrote:
> Am 15.04.2017 um 17:05 schrieb Andreas Färber:
> But for the Vega S95 Telos I needed to disable the first of three MMC
> nodes (SDIO) - otherwise U-Boot would happily iterate over them for
> distro boot with Heinrich's patch, but GRUB would come up with no disks,
> so that booting failed. I'm not yet sure why, maybe it's a UEFI-side
> problem in that it is the first MMC device that is absent rather than
> the last one?
>
 I don't own this device so I can just provide a guess.
 Based on DT the device ordering most likely is:
 mmc0: SDIO
 mmc1: SD
 mmc2: eMMC
>> [...]
>>> If grub comes up, distro boot has successfully found the target binary
>>> and executed it. For some reason, grub can not find its boot origin though.
>>>
>>> Andreas, please add debug prints like the ones below and check that the
>>> device names match:
>>
>> U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
>> vega-s95
>>
>> DRAM:  2 GiB
>> MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
>> Using default environment
>>
>> In:serial@4c0
>> Out:   serial@4c0
>> Err:   serial@4c0
>> Net:   eth0: ethernet@c941
>> Hit any key to stop autoboot:  0
>> mmc_init: -95, time 1806
>> MMC Device 0 not found
>> no mmc device at slot 0
>> switch to partitions #0, OK
>> mmc1 is current device
>> Scanning mmc 1:1...
>> Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
>> 20335 bytes read in 43 ms (460.9 KiB/s)
>> Found EFI removable media binary efi/boot/bootaa64.efi
>> Setting boot device name to '/efi/boot/bootaa64.efi'
>> reading efi/boot/bootaa64.efi
>> 129024 bytes read in 13 ms (9.5 MiB/s)
>> ## Starting EFI application at 0108 ...
>> mmc_init: -95, time 1807
>> Found 0 disks
> 
> That looks like efi_disk didn't manage to enumerate any devices?

Apparently. The last line comes from
lib/efi_loader_efi_disk:efi_disk_register(), and CONFIG_BLK=y. As you
can see, there is not a single "Scanning disk" line, so I guess we do
not iterate over uclass devices properly?

On the Odroid-C2 I get this:

Scanning disk m...@72000.blk...
Card did not respond to voltage select!
mmc_init: -95, time 9
Found 1 disks

Therefore my guess that it matters at what point in time - before or
after the disk we want - the error accessing an MMC device happens.

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-15 Thread Andreas Färber
Am 15.04.2017 um 22:52 schrieb Heinrich Schuchardt:
> On 04/15/2017 10:34 PM, Andreas Färber wrote:
>> U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
>> vega-s95
>>
>> DRAM:  2 GiB
>> MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
>> Using default environment
>>
>> In:serial@4c0
>> Out:   serial@4c0
>> Err:   serial@4c0
>> Net:   eth0: ethernet@c941
>> Hit any key to stop autoboot:  0
>> mmc_init: -95, time 1806
>> MMC Device 0 not found
>> no mmc device at slot 0
>> switch to partitions #0, OK
>> mmc1 is current device
>> Scanning mmc 1:1...
>> Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
>> 20335 bytes read in 43 ms (460.9 KiB/s)
>> Found EFI removable media binary efi/boot/bootaa64.efi
>> Setting boot device name to '/efi/boot/bootaa64.efi'
>> reading efi/boot/bootaa64.efi
>> 129024 bytes read in 13 ms (9.5 MiB/s)
>> ## Starting EFI application at 0108 ...
>> mmc_init: -95, time 1807
>> Found 0 disks
>> Welcome to GRUB!
>>
>> error: disk `,msdos2' not found.
>> Entering rescue mode...
>> grub rescue>
[...]
> What is the output of
> ls
> in grub rescue mode?

Entirely empty.

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-15 Thread Alexander Graf


> Am 15.04.2017 um 22:34 schrieb Andreas Färber :
> 
>> Am 15.04.2017 um 20:27 schrieb Alexander Graf:
>>> On 15.04.17 20:18, Heiner Kallweit wrote:
 Am 15.04.2017 um 17:05 schrieb Andreas Färber:
 But for the Vega S95 Telos I needed to disable the first of three MMC
 nodes (SDIO) - otherwise U-Boot would happily iterate over them for
 distro boot with Heinrich's patch, but GRUB would come up with no disks,
 so that booting failed. I'm not yet sure why, maybe it's a UEFI-side
 problem in that it is the first MMC device that is absent rather than
 the last one?
 
>>> I don't own this device so I can just provide a guess.
>>> Based on DT the device ordering most likely is:
>>> mmc0: SDIO
>>> mmc1: SD
>>> mmc2: eMMC
> [...]
>> If grub comes up, distro boot has successfully found the target binary
>> and executed it. For some reason, grub can not find its boot origin though.
>> 
>> Andreas, please add debug prints like the ones below and check that the
>> device names match:
> 
> U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
> vega-s95
> 
> DRAM:  2 GiB
> MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
> Using default environment
> 
> In:serial@4c0
> Out:   serial@4c0
> Err:   serial@4c0
> Net:   eth0: ethernet@c941
> Hit any key to stop autoboot:  0
> mmc_init: -95, time 1806
> MMC Device 0 not found
> no mmc device at slot 0
> switch to partitions #0, OK
> mmc1 is current device
> Scanning mmc 1:1...
> Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
> 20335 bytes read in 43 ms (460.9 KiB/s)
> Found EFI removable media binary efi/boot/bootaa64.efi
> Setting boot device name to '/efi/boot/bootaa64.efi'
> reading efi/boot/bootaa64.efi
> 129024 bytes read in 13 ms (9.5 MiB/s)
> ## Starting EFI application at 0108 ...
> mmc_init: -95, time 1807
> Found 0 disks

That looks like efi_disk didn't manage to enumerate any devices?


Alex

> Welcome to GRUB!
> 
> error: disk `,msdos2' not found.
> Entering rescue mode...
> grub rescue>
> 
> Regards,
> Andreas
> 
> -- 
> SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Felix Imendörffer, Jane Smithard, Graham Norton
> HRB 21284 (AG Nürnberg)

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-15 Thread Heinrich Schuchardt
On 04/15/2017 10:34 PM, Andreas Färber wrote:
> Am 15.04.2017 um 20:27 schrieb Alexander Graf:
>> On 15.04.17 20:18, Heiner Kallweit wrote:
>>> Am 15.04.2017 um 17:05 schrieb Andreas Färber:
 But for the Vega S95 Telos I needed to disable the first of three MMC
 nodes (SDIO) - otherwise U-Boot would happily iterate over them for
 distro boot with Heinrich's patch, but GRUB would come up with no disks,
 so that booting failed. I'm not yet sure why, maybe it's a UEFI-side
 problem in that it is the first MMC device that is absent rather than
 the last one?

>>> I don't own this device so I can just provide a guess.
>>> Based on DT the device ordering most likely is:
>>> mmc0: SDIO
>>> mmc1: SD
>>> mmc2: eMMC
> [...]
>> If grub comes up, distro boot has successfully found the target binary
>> and executed it. For some reason, grub can not find its boot origin though.
>>
>> Andreas, please add debug prints like the ones below and check that the
>> device names match:
> 
> U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
> vega-s95
> 
> DRAM:  2 GiB
> MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
> Using default environment
> 
> In:serial@4c0
> Out:   serial@4c0
> Err:   serial@4c0
> Net:   eth0: ethernet@c941
> Hit any key to stop autoboot:  0
> mmc_init: -95, time 1806
> MMC Device 0 not found
> no mmc device at slot 0
> switch to partitions #0, OK
> mmc1 is current device
> Scanning mmc 1:1...
> Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
> 20335 bytes read in 43 ms (460.9 KiB/s)
> Found EFI removable media binary efi/boot/bootaa64.efi
> Setting boot device name to '/efi/boot/bootaa64.efi'
> reading efi/boot/bootaa64.efi
> 129024 bytes read in 13 ms (9.5 MiB/s)
> ## Starting EFI application at 0108 ...
> mmc_init: -95, time 1807
> Found 0 disks
> Welcome to GRUB!
> 
> error: disk `,msdos2' not found.
> Entering rescue mode...
> grub rescue>
> 
> Regards,
> Andreas
> 
What is the output of
ls
in grub rescue mode?

Best regards

Heinrich
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-15 Thread Andreas Färber
Am 15.04.2017 um 20:27 schrieb Alexander Graf:
> On 15.04.17 20:18, Heiner Kallweit wrote:
>> Am 15.04.2017 um 17:05 schrieb Andreas Färber:
>>> But for the Vega S95 Telos I needed to disable the first of three MMC
>>> nodes (SDIO) - otherwise U-Boot would happily iterate over them for
>>> distro boot with Heinrich's patch, but GRUB would come up with no disks,
>>> so that booting failed. I'm not yet sure why, maybe it's a UEFI-side
>>> problem in that it is the first MMC device that is absent rather than
>>> the last one?
>>>
>> I don't own this device so I can just provide a guess.
>> Based on DT the device ordering most likely is:
>> mmc0: SDIO
>> mmc1: SD
>> mmc2: eMMC
[...]
> If grub comes up, distro boot has successfully found the target binary
> and executed it. For some reason, grub can not find its boot origin though.
> 
> Andreas, please add debug prints like the ones below and check that the
> device names match:

U-Boot 2017.05-rc1-00318-g082535f-dirty (Apr 15 2017 - 22:29:17 +0200)
vega-s95

DRAM:  2 GiB
MMC:   mmc@7: 0, mmc@72000: 1, mmc@74000: 2
Using default environment

In:serial@4c0
Out:   serial@4c0
Err:   serial@4c0
Net:   eth0: ethernet@c941
Hit any key to stop autoboot:  0
mmc_init: -95, time 1806
MMC Device 0 not found
no mmc device at slot 0
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
Setting boot device name to '//boot/dtb/amlogic/meson-gxbb-v'
20335 bytes read in 43 ms (460.9 KiB/s)
Found EFI removable media binary efi/boot/bootaa64.efi
Setting boot device name to '/efi/boot/bootaa64.efi'
reading efi/boot/bootaa64.efi
129024 bytes read in 13 ms (9.5 MiB/s)
## Starting EFI application at 0108 ...
mmc_init: -95, time 1807
Found 0 disks
Welcome to GRUB!

error: disk `,msdos2' not found.
Entering rescue mode...
grub rescue>

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-15 Thread Alexander Graf



On 15.04.17 21:13, Heinrich Schuchardt wrote:

On 04/15/2017 08:27 PM, Alexander Graf wrote:



On 15.04.17 20:18, Heiner Kallweit wrote:

Am 15.04.2017 um 17:05 schrieb Andreas Färber:

Am 14.04.2017 um 08:22 schrieb Jaehoon Chung:

On 04/13/2017 03:30 AM, Heiner Kallweit wrote:

From: Carlo Caione 
This driver implements MMC support on Meson GX (S905) based systems.
It's based on Carlo Caione's work, changes:
- BLK support added
- general refactoring

Signed-off-by: Carlo Caione 
Signed-off-by: Andreas Färber 
Signed-off-by: Heiner Kallweit 


Applied to u-boot-mmc. Thanks!


Thanks guys for all the work on this!

I have tested it successfully on the Odroid-C2.

But for the Vega S95 Telos I needed to disable the first of three MMC
nodes (SDIO) - otherwise U-Boot would happily iterate over them for
distro boot with Heinrich's patch, but GRUB would come up with no disks,
so that booting failed. I'm not yet sure why, maybe it's a UEFI-side
problem in that it is the first MMC device that is absent rather than
the last one?


I don't own this device so I can just provide a guess.
Based on DT the device ordering most likely is:
mmc0: SDIO
mmc1: SD
mmc2: eMMC


sd_emmc_a - Wireless SDIO Module
sd_emmc_b - SD card
sd_emmc_c - eMMC



I'm not familiar with distro boot, but as far as I understand Heinrich's
patch it just adds mmc0 and mmc1. Therefore distro boot doesn't try to
boot from eMMC.


I will resubmit https://patchwork.ozlabs.org/patch/750859/
odroid-c2: enable MMC as boot target
with 3 MMC targets.

I have tested on my Odroid C2 that the fallthrough to DHCP is still
working with 3 defined MMC targets.



If grub comes up, distro boot has successfully found the target binary
and executed it. For some reason, grub can not find its boot origin though.


You could enable
CONFIG_DISPLAY_BOARDINFO=y
CONFIG_CMD_BOOTEFI_HELLO_COMPILE=y

Boardinfo will display the MMC devices detected.

bootefi hello
prints the number of disks detected and handed over to the EFI target.



Andreas, please add debug prints like the ones below and check that the
device names match:

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 97a0fc9..a98cd95 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -364,5 +364,6 @@ void efi_set_bootdev(const char *dev, const char
*devnr, const char *path)
 } else {
 snprintf(devname, sizeof(devname), "%s", path);
 }
+printf("Setting boot device name to '%s'\n", devname);
 ascii2unicode(bootefi_image_path[0].str, devname);
 }
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 1e3dca4..f83fa0e 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -207,6 +207,7 @@ static void efi_disk_add_dev(const char *name,
 if (!desc->lba)
 return;

+printf("Adding disk device '%s'\n", name);
 diskobj = calloc(1, objlen);

 /* Fill in object data */

Alex


Wouldn't it make sense to add Alex's patch to mainline?


You usually don't want these debug messages in a proper u-boot build. 
Maybe as debug prints.


We really need to simply improve on general debuggability of the efi 
object model though :). I need to sit down and make grub's "lsefi" just 
work. Ideally that would give us all the hints we need to find out 
what's going wrong in situations like this, as it has access to all 
pieces that we need.



Alex
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-15 Thread Heinrich Schuchardt
On 04/15/2017 08:27 PM, Alexander Graf wrote:
> 
> 
> On 15.04.17 20:18, Heiner Kallweit wrote:
>> Am 15.04.2017 um 17:05 schrieb Andreas Färber:
>>> Am 14.04.2017 um 08:22 schrieb Jaehoon Chung:
 On 04/13/2017 03:30 AM, Heiner Kallweit wrote:
> From: Carlo Caione 
> This driver implements MMC support on Meson GX (S905) based systems.
> It's based on Carlo Caione's work, changes:
> - BLK support added
> - general refactoring
>
> Signed-off-by: Carlo Caione 
> Signed-off-by: Andreas Färber 
> Signed-off-by: Heiner Kallweit 

 Applied to u-boot-mmc. Thanks!
>>>
>>> Thanks guys for all the work on this!
>>>
>>> I have tested it successfully on the Odroid-C2.
>>>
>>> But for the Vega S95 Telos I needed to disable the first of three MMC
>>> nodes (SDIO) - otherwise U-Boot would happily iterate over them for
>>> distro boot with Heinrich's patch, but GRUB would come up with no disks,
>>> so that booting failed. I'm not yet sure why, maybe it's a UEFI-side
>>> problem in that it is the first MMC device that is absent rather than
>>> the last one?
>>>
>> I don't own this device so I can just provide a guess.
>> Based on DT the device ordering most likely is:
>> mmc0: SDIO
>> mmc1: SD
>> mmc2: eMMC

sd_emmc_a - Wireless SDIO Module
sd_emmc_b - SD card
sd_emmc_c - eMMC

>>
>> I'm not familiar with distro boot, but as far as I understand Heinrich's
>> patch it just adds mmc0 and mmc1. Therefore distro boot doesn't try to
>> boot from eMMC.

I will resubmit https://patchwork.ozlabs.org/patch/750859/
odroid-c2: enable MMC as boot target
with 3 MMC targets.

I have tested on my Odroid C2 that the fallthrough to DHCP is still
working with 3 defined MMC targets.

> 
> If grub comes up, distro boot has successfully found the target binary
> and executed it. For some reason, grub can not find its boot origin though.

You could enable
CONFIG_DISPLAY_BOARDINFO=y
CONFIG_CMD_BOOTEFI_HELLO_COMPILE=y

Boardinfo will display the MMC devices detected.

bootefi hello
prints the number of disks detected and handed over to the EFI target.

> 
> Andreas, please add debug prints like the ones below and check that the
> device names match:
> 
> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> index 97a0fc9..a98cd95 100644
> --- a/cmd/bootefi.c
> +++ b/cmd/bootefi.c
> @@ -364,5 +364,6 @@ void efi_set_bootdev(const char *dev, const char
> *devnr, const char *path)
>  } else {
>  snprintf(devname, sizeof(devname), "%s", path);
>  }
> +printf("Setting boot device name to '%s'\n", devname);
>  ascii2unicode(bootefi_image_path[0].str, devname);
>  }
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index 1e3dca4..f83fa0e 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -207,6 +207,7 @@ static void efi_disk_add_dev(const char *name,
>  if (!desc->lba)
>  return;
> 
> +printf("Adding disk device '%s'\n", name);
>  diskobj = calloc(1, objlen);
> 
>  /* Fill in object data */
>
> Alex
> 
Wouldn't it make sense to add Alex's patch to mainline?

Best regards

Heinrich Schuchardt
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-15 Thread Alexander Graf



On 15.04.17 20:18, Heiner Kallweit wrote:

Am 15.04.2017 um 17:05 schrieb Andreas Färber:

Am 14.04.2017 um 08:22 schrieb Jaehoon Chung:

On 04/13/2017 03:30 AM, Heiner Kallweit wrote:

From: Carlo Caione 
This driver implements MMC support on Meson GX (S905) based systems.
It's based on Carlo Caione's work, changes:
- BLK support added
- general refactoring

Signed-off-by: Carlo Caione 
Signed-off-by: Andreas Färber 
Signed-off-by: Heiner Kallweit 


Applied to u-boot-mmc. Thanks!


Thanks guys for all the work on this!

I have tested it successfully on the Odroid-C2.

But for the Vega S95 Telos I needed to disable the first of three MMC
nodes (SDIO) - otherwise U-Boot would happily iterate over them for
distro boot with Heinrich's patch, but GRUB would come up with no disks,
so that booting failed. I'm not yet sure why, maybe it's a UEFI-side
problem in that it is the first MMC device that is absent rather than
the last one?


I don't own this device so I can just provide a guess.
Based on DT the device ordering most likely is:
mmc0: SDIO
mmc1: SD
mmc2: eMMC

I'm not familiar with distro boot, but as far as I understand Heinrich's
patch it just adds mmc0 and mmc1. Therefore distro boot doesn't try to
boot from eMMC.


If grub comes up, distro boot has successfully found the target binary 
and executed it. For some reason, grub can not find its boot origin though.


Andreas, please add debug prints like the ones below and check that the 
device names match:


diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 97a0fc9..a98cd95 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -364,5 +364,6 @@ void efi_set_bootdev(const char *dev, const char 
*devnr, const char *path)

} else {
snprintf(devname, sizeof(devname), "%s", path);
}
+printf("Setting boot device name to '%s'\n", devname);
ascii2unicode(bootefi_image_path[0].str, devname);
 }
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 1e3dca4..f83fa0e 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -207,6 +207,7 @@ static void efi_disk_add_dev(const char *name,
if (!desc->lba)
return;

+printf("Adding disk device '%s'\n", name);
diskobj = calloc(1, objlen);

/* Fill in object data */


Alex
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-15 Thread Heiner Kallweit
Am 15.04.2017 um 17:05 schrieb Andreas Färber:
> Am 14.04.2017 um 08:22 schrieb Jaehoon Chung:
>> On 04/13/2017 03:30 AM, Heiner Kallweit wrote:
>>> From: Carlo Caione 
>>> This driver implements MMC support on Meson GX (S905) based systems.
>>> It's based on Carlo Caione's work, changes:
>>> - BLK support added
>>> - general refactoring
>>>
>>> Signed-off-by: Carlo Caione 
>>> Signed-off-by: Andreas Färber 
>>> Signed-off-by: Heiner Kallweit 
>>
>> Applied to u-boot-mmc. Thanks!
> 
> Thanks guys for all the work on this!
> 
> I have tested it successfully on the Odroid-C2.
> 
> But for the Vega S95 Telos I needed to disable the first of three MMC
> nodes (SDIO) - otherwise U-Boot would happily iterate over them for
> distro boot with Heinrich's patch, but GRUB would come up with no disks,
> so that booting failed. I'm not yet sure why, maybe it's a UEFI-side
> problem in that it is the first MMC device that is absent rather than
> the last one?
> 
I don't own this device so I can just provide a guess.
Based on DT the device ordering most likely is:
mmc0: SDIO
mmc1: SD
mmc2: eMMC

I'm not familiar with distro boot, but as far as I understand Heinrich's
patch it just adds mmc0 and mmc1. Therefore distro boot doesn't try to
boot from eMMC.

Rgds, Heiner

> Regards,
> Andreas
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-15 Thread Andreas Färber
Am 14.04.2017 um 08:22 schrieb Jaehoon Chung:
> On 04/13/2017 03:30 AM, Heiner Kallweit wrote:
>> From: Carlo Caione 
>> This driver implements MMC support on Meson GX (S905) based systems.
>> It's based on Carlo Caione's work, changes:
>> - BLK support added
>> - general refactoring
>>
>> Signed-off-by: Carlo Caione 
>> Signed-off-by: Andreas Färber 
>> Signed-off-by: Heiner Kallweit 
> 
> Applied to u-boot-mmc. Thanks!

Thanks guys for all the work on this!

I have tested it successfully on the Odroid-C2.

But for the Vega S95 Telos I needed to disable the first of three MMC
nodes (SDIO) - otherwise U-Boot would happily iterate over them for
distro boot with Heinrich's patch, but GRUB would come up with no disks,
so that booting failed. I'm not yet sure why, maybe it's a UEFI-side
problem in that it is the first MMC device that is absent rather than
the last one?

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-14 Thread Jaehoon Chung
On 04/13/2017 03:30 AM, Heiner Kallweit wrote:
> From: Carlo Caione 
> This driver implements MMC support on Meson GX (S905) based systems.
> It's based on Carlo Caione's work, changes:
> - BLK support added
> - general refactoring
> 
> Signed-off-by: Carlo Caione 
> Signed-off-by: Andreas Färber 
> Signed-off-by: Heiner Kallweit 

Applied to u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

> ---
> v6:
> - remove DM_MMC_OPS from Kconfig dependencies
> - address two minor review comments of Jaehoon
> v7:
> - rebased
> ---
>  arch/arm/include/asm/arch-meson/sd_emmc.h |  89 +
>  drivers/mmc/Kconfig   |   6 +
>  drivers/mmc/Makefile  |   1 +
>  drivers/mmc/meson_gx_mmc.c| 291 
> ++
>  4 files changed, 387 insertions(+)
>  create mode 100644 arch/arm/include/asm/arch-meson/sd_emmc.h
>  create mode 100644 drivers/mmc/meson_gx_mmc.c
> 
> diff --git a/arch/arm/include/asm/arch-meson/sd_emmc.h 
> b/arch/arm/include/asm/arch-meson/sd_emmc.h
> new file mode 100644
> index 000..a09e034
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-meson/sd_emmc.h
> @@ -0,0 +1,89 @@
> +/*
> + * (C) Copyright 2016 Carlo Caione 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#ifndef __SD_EMMC_H__
> +#define __SD_EMMC_H__
> +
> +#include 
> +
> +#define SDIO_PORT_A  0
> +#define SDIO_PORT_B  1
> +#define SDIO_PORT_C  2
> +
> +#define SD_EMMC_CLKSRC_24M   2400/* 24 MHz */
> +#define SD_EMMC_CLKSRC_DIV2  10  /* 1 GHz */
> +
> +#define MESON_SD_EMMC_CLOCK  0x00
> +#define   CLK_MAX_DIV63
> +#define   CLK_SRC_24M(0 << 6)
> +#define   CLK_SRC_DIV2   (1 << 6)
> +#define   CLK_CO_PHASE_000   (0 << 8)
> +#define   CLK_CO_PHASE_090   (1 << 8)
> +#define   CLK_CO_PHASE_180   (2 << 8)
> +#define   CLK_CO_PHASE_270   (3 << 8)
> +#define   CLK_TX_PHASE_000   (0 << 10)
> +#define   CLK_TX_PHASE_090   (1 << 10)
> +#define   CLK_TX_PHASE_180   (2 << 10)
> +#define   CLK_TX_PHASE_270   (3 << 10)
> +#define   CLK_ALWAYS_ON  BIT(24)
> +
> +#define MESON_SD_EMMC_CFG0x44
> +#define   CFG_BUS_WIDTH_MASK GENMASK(1, 0)
> +#define   CFG_BUS_WIDTH_10
> +#define   CFG_BUS_WIDTH_41
> +#define   CFG_BUS_WIDTH_82
> +#define   CFG_BL_LEN_MASKGENMASK(7, 4)
> +#define   CFG_BL_LEN_SHIFT   4
> +#define   CFG_BL_LEN_512 (9 << 4)
> +#define   CFG_RESP_TIMEOUT_MASK  GENMASK(11, 8)
> +#define   CFG_RESP_TIMEOUT_256   (8 << 8)
> +#define   CFG_RC_CC_MASK GENMASK(15, 12)
> +#define   CFG_RC_CC_16   (4 << 12)
> +#define   CFG_SDCLK_ALWAYS_ONBIT(18)
> +#define   CFG_AUTO_CLK   BIT(23)
> +
> +#define MESON_SD_EMMC_STATUS 0x48
> +#define   STATUS_MASKGENMASK(15, 0)
> +#define   STATUS_ERR_MASKGENMASK(12, 0)
> +#define   STATUS_RXD_ERR_MASKGENMASK(7, 0)
> +#define   STATUS_TXD_ERR BIT(8)
> +#define   STATUS_DESC_ERRBIT(9)
> +#define   STATUS_RESP_ERRBIT(10)
> +#define   STATUS_RESP_TIMEOUTBIT(11)
> +#define   STATUS_DESC_TIMEOUTBIT(12)
> +#define   STATUS_END_OF_CHAINBIT(13)
> +
> +#define MESON_SD_EMMC_IRQ_EN 0x4c
> +
> +#define MESON_SD_EMMC_CMD_CFG0x50
> +#define   CMD_CFG_LENGTH_MASKGENMASK(8, 0)
> +#define   CMD_CFG_BLOCK_MODE BIT(9)
> +#define   CMD_CFG_R1BBIT(10)
> +#define   CMD_CFG_END_OF_CHAIN   BIT(11)
> +#define   CMD_CFG_TIMEOUT_4S (12 << 12)
> +#define   CMD_CFG_NO_RESPBIT(16)
> +#define   CMD_CFG_DATA_IOBIT(18)
> +#define   CMD_CFG_DATA_WRBIT(19)
> +#define   CMD_CFG_RESP_NOCRC BIT(20)
> +#define   CMD_CFG_RESP_128   BIT(21)
> +#define   CMD_CFG_CMD_INDEX_SHIFT24
> +#define   CMD_CFG_OWNER  BIT(31)
> +
> +#define MESON_SD_EMMC_CMD_ARG0x54
> +#define MESON_SD_EMMC_CMD_DAT0x58
> +#define MESON_SD_EMMC_CMD_RSP0x5c
> +#define MESON_SD_EMMC_CMD_RSP1   0x60
> +#define MESON_SD_EMMC_CMD_RSP2   0x64
> +#define MESON_SD_EMMC_CMD_RSP3   0x68
> +
> +struct meson_mmc_platdata {
> + struct mmc_config cfg;
> + struct mmc mmc;
> + void *regbase;
> + void *w_buf;
> +};
> +
> +#endif
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index 560391f..077b184 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -105,6 +105,12 @@ 

[U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905)

2017-04-12 Thread Heiner Kallweit
From: Carlo Caione 
This driver implements MMC support on Meson GX (S905) based systems.
It's based on Carlo Caione's work, changes:
- BLK support added
- general refactoring

Signed-off-by: Carlo Caione 
Signed-off-by: Andreas Färber 
Signed-off-by: Heiner Kallweit 
---
v6:
- remove DM_MMC_OPS from Kconfig dependencies
- address two minor review comments of Jaehoon
v7:
- rebased
---
 arch/arm/include/asm/arch-meson/sd_emmc.h |  89 +
 drivers/mmc/Kconfig   |   6 +
 drivers/mmc/Makefile  |   1 +
 drivers/mmc/meson_gx_mmc.c| 291 ++
 4 files changed, 387 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-meson/sd_emmc.h
 create mode 100644 drivers/mmc/meson_gx_mmc.c

diff --git a/arch/arm/include/asm/arch-meson/sd_emmc.h 
b/arch/arm/include/asm/arch-meson/sd_emmc.h
new file mode 100644
index 000..a09e034
--- /dev/null
+++ b/arch/arm/include/asm/arch-meson/sd_emmc.h
@@ -0,0 +1,89 @@
+/*
+ * (C) Copyright 2016 Carlo Caione 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef __SD_EMMC_H__
+#define __SD_EMMC_H__
+
+#include 
+
+#define SDIO_PORT_A0
+#define SDIO_PORT_B1
+#define SDIO_PORT_C2
+
+#define SD_EMMC_CLKSRC_24M 2400/* 24 MHz */
+#define SD_EMMC_CLKSRC_DIV210  /* 1 GHz */
+
+#define MESON_SD_EMMC_CLOCK0x00
+#define   CLK_MAX_DIV  63
+#define   CLK_SRC_24M  (0 << 6)
+#define   CLK_SRC_DIV2 (1 << 6)
+#define   CLK_CO_PHASE_000 (0 << 8)
+#define   CLK_CO_PHASE_090 (1 << 8)
+#define   CLK_CO_PHASE_180 (2 << 8)
+#define   CLK_CO_PHASE_270 (3 << 8)
+#define   CLK_TX_PHASE_000 (0 << 10)
+#define   CLK_TX_PHASE_090 (1 << 10)
+#define   CLK_TX_PHASE_180 (2 << 10)
+#define   CLK_TX_PHASE_270 (3 << 10)
+#define   CLK_ALWAYS_ONBIT(24)
+
+#define MESON_SD_EMMC_CFG  0x44
+#define   CFG_BUS_WIDTH_MASK   GENMASK(1, 0)
+#define   CFG_BUS_WIDTH_1  0
+#define   CFG_BUS_WIDTH_4  1
+#define   CFG_BUS_WIDTH_8  2
+#define   CFG_BL_LEN_MASK  GENMASK(7, 4)
+#define   CFG_BL_LEN_SHIFT 4
+#define   CFG_BL_LEN_512   (9 << 4)
+#define   CFG_RESP_TIMEOUT_MASKGENMASK(11, 8)
+#define   CFG_RESP_TIMEOUT_256 (8 << 8)
+#define   CFG_RC_CC_MASK   GENMASK(15, 12)
+#define   CFG_RC_CC_16 (4 << 12)
+#define   CFG_SDCLK_ALWAYS_ON  BIT(18)
+#define   CFG_AUTO_CLK BIT(23)
+
+#define MESON_SD_EMMC_STATUS   0x48
+#define   STATUS_MASK  GENMASK(15, 0)
+#define   STATUS_ERR_MASK  GENMASK(12, 0)
+#define   STATUS_RXD_ERR_MASK  GENMASK(7, 0)
+#define   STATUS_TXD_ERR   BIT(8)
+#define   STATUS_DESC_ERR  BIT(9)
+#define   STATUS_RESP_ERR  BIT(10)
+#define   STATUS_RESP_TIMEOUT  BIT(11)
+#define   STATUS_DESC_TIMEOUT  BIT(12)
+#define   STATUS_END_OF_CHAIN  BIT(13)
+
+#define MESON_SD_EMMC_IRQ_EN   0x4c
+
+#define MESON_SD_EMMC_CMD_CFG  0x50
+#define   CMD_CFG_LENGTH_MASK  GENMASK(8, 0)
+#define   CMD_CFG_BLOCK_MODE   BIT(9)
+#define   CMD_CFG_R1B  BIT(10)
+#define   CMD_CFG_END_OF_CHAIN BIT(11)
+#define   CMD_CFG_TIMEOUT_4S   (12 << 12)
+#define   CMD_CFG_NO_RESP  BIT(16)
+#define   CMD_CFG_DATA_IO  BIT(18)
+#define   CMD_CFG_DATA_WR  BIT(19)
+#define   CMD_CFG_RESP_NOCRC   BIT(20)
+#define   CMD_CFG_RESP_128 BIT(21)
+#define   CMD_CFG_CMD_INDEX_SHIFT  24
+#define   CMD_CFG_OWNERBIT(31)
+
+#define MESON_SD_EMMC_CMD_ARG  0x54
+#define MESON_SD_EMMC_CMD_DAT  0x58
+#define MESON_SD_EMMC_CMD_RSP  0x5c
+#define MESON_SD_EMMC_CMD_RSP1 0x60
+#define MESON_SD_EMMC_CMD_RSP2 0x64
+#define MESON_SD_EMMC_CMD_RSP3 0x68
+
+struct meson_mmc_platdata {
+   struct mmc_config cfg;
+   struct mmc mmc;
+   void *regbase;
+   void *w_buf;
+};
+
+#endif
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 560391f..077b184 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -105,6 +105,12 @@ config MMC_DW_SOCFPGA
  Synopsys DesignWare Memory Card Interface driver. Select this option
  for platforms based on Altera SOCFPGA.
 
+config MMC_MESON_GX
+   bool "Meson GX EMMC controller support"
+   depends on DM_MMC && BLK && DM_MMC_OPS && ARCH_MESON
+   help
+Support for EMMC host controller on Meson GX ARM SoCs platform (S905)
+
 config MMC_MXC
bool