Re: Understanding how .config for uboot is generated in buildroot

2023-10-17 Thread Ignatius Rivaldi
On Tue, Oct 17, 2023 at 7:17 PM Paul Barker 
wrote:

> On Tue, Oct 17, 2023 at 04:35:20PM +1100, Ignatius Rivaldi wrote:
> > Hi all,
> >
> > When I edit the config file in BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE in a
> > buildroot recipe, how does the config statements from that file got
> > converted into .config file in u-boot?
> >
> > The background is that we're using a custom buildroot config file at
> here:
> > https://github.com/kubos/kubos-linux-build/tree/master to build u-boot
> for
> > a space grade computer. When I added a new config statement
> > (CONFIG_SD_SWITCH=y) in the BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE, it
> doesn't
> > write the config statement to the .config file in the uboot build repo.
> >
> >  Unfortunately the company that owns that has been acquired several times
> > and all the engineers there already left, so I can't just ask them
>
> You're probably better off asking this on the buildroot mailing list.
> See https://lists.buildroot.org/mailman/listinfo/buildroot.
>
> Best regards,
> Paul
>

Thanks for the pointer, I kind of solved this by adding CONFIG_SD_SWITCH to
uboot kconfig definition file, and now when I added CONFIG_SD_SWITCH to the
_config file it works.
I'll ask about buildroot stuff on the buildroot mailing list after this.

The next problem is that the way Kubos implemented SD card slot switching
is by calling into their own proprietary(?) binary blob through the
standalone application thing:
https://www.emblogic.com/blog/12/u-boot-standalone-applications/. What
happens now is that Uboot is stuck at ## Starting application at
0×2180. What are the possible causes of this, and how do I start
debugging this?

Fortunately Kubos gave us the source code for that binary blob before they
go bankrupt, so we can tweak it


Understanding how .config for uboot is generated in buildroot

2023-10-16 Thread Ignatius Rivaldi
Hi all,

When I edit the config file in BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE in a
buildroot recipe, how does the config statements from that file got
converted into .config file in u-boot?

The background is that we're using a custom buildroot config file at here:
https://github.com/kubos/kubos-linux-build/tree/master to build u-boot for
a space grade computer. When I added a new config statement
(CONFIG_SD_SWITCH=y) in the BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE, it doesn't
write the config statement to the .config file in the uboot build repo.

 Unfortunately the company that owns that has been acquired several times
and all the engineers there already left, so I can't just ask them

Thanks
Ignatius


Re: U-boot not loading NVMe driver on Pi CM4

2023-02-14 Thread Ignatius Rivaldi
On Wed, Feb 15, 2023 at 3:52 PM Ignatius Rivaldi 
wrote:

>
> Hi Stefan,
> On Tue, Feb 14, 2023 at 2:00 AM Stefan Roese  wrote:
>
>> Hi Ignatius,
>>
>> On 2/10/23 17:05, Simon Glass wrote:
>> > Hi Ignatius,
>> >
>> > On Thu, 9 Feb 2023 at 17:29, Ignatius Rivaldi 
>> wrote:
>> >>
>> >> Added more debug logging and for some reason the nvme driver tries to
>> bind
>> >> to pcie root bridge instead of the SSD
>> >> drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple()
>> >> pcie_brcm pcie@7d50: set_state_simple op missing
>> >> PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
>> >> drivers/core/device.c:184-  device_bind_common() Bound device
>> pci_0:0.0 to
>> >> pcie@7d50
>> >> drivers/core/uclass.c:338-uclass_find_device_by_seq() 0
>> >> drivers/core/uclass.c:346-uclass_find_device_by_seq()- 0
>> 'gpio@7e20'
>> >>
>> >> drivers/core/uclass.c:349-uclass_find_device_by_seq()- found
>> >> drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple()
>> >> pci_bridge_drv pci_0:0.0: set_state_simple op missing
>> >> drivers/core/device.c:184-  device_bind_common() Bound device nvme#0 to
>> >> pci_0:0.0
>> >> U-Boot> pci
>> >>
>> DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 0
>> >>
>> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
>> >> - 0 'pcie@7d50'
>> >>
>> DEBUG.driver-model,drivers/core/uclass.c:349-uclass_find_device_by_seq()
>> >> - found
>> >> BusDevFun  VendorId   DeviceId   Device Class   Sub-Class
>> >> _
>> >> 00.00.00   0x14e4 0x2711 Bridge device   0x04
>> >>
>> DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 1
>> >>
>> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
>> >> - 0 'pcie@7d50'
>> >>
>> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
>> >> - 1 'pci_0:0.0'
>> >>
>> DEBUG.driver-model,drivers/core/uclass.c:349-uclass_find_device_by_seq()
>> >> - found
>> >> 01.00.00   0x1e0f 0x0001 Mass storage controller 0x08
>> >>
>> DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 2
>> >>
>> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
>> >> - 0 'pcie@7d50'
>> >>
>> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
>> >> - 1 'pci_0:0.0'
>> >>
>> DEBUG.driver-model,drivers/core/uclass.c:353-uclass_find_device_by_seq()
>> >> - not found
>> >>
>> >> It should be pci_1:0.0 I think
>> >>
>> >> On Thu, Feb 9, 2023 at 11:22 AM Ignatius Rivaldi <
>> minecraft2...@gmail.com>
>> >> wrote:
>> >
>> > (please try not to top post)
>> >
>> > I don't know what is going on here. The PCI scan seems to show the
>> > wrong device, as you say. Perhaps it is a bug in the bcm controller
>> > driver?
>> >
>> > +Michal Suchanek
>> > +Stefan Roese
>>
>> I've not used the NVMe driver in U-Boot yet, but at least the PCI class
>> and subclass ID seem to be fine AFAIT:
>>
>> class code =  0x01 (Mass storage controller)
>> sub class code =  0x08
>> programming interface =   0x02
>>
>> Are other PCI drivers probed correctly, if you can test this on your
>> board? E.g. an Intel E1000 PCIe board perhaps?
>>
>> Added Bin, perhaps he has some further ideas.
>>
>> Thanks,
>> Stefan
>>
>> (for some reason your email got sent to my spam folder)
>
> I'm installing the u-boot to the NVMe drive as the CM4 I have doesn't have
> eMMC
> And CM4 only have 1 PCIe lane so I can't add another PCIe device
>
> I think Home Assistant OS 9.5 which is based on u-boot 2022.1 works with
> my hardware,
> as the green LED is blinking. But I'm not sure as it seems that their rpi4
> build doesn't enable
> serial console.
>
> Thanks
> Ignatius
>
>

I've got serial out working with Home Assistant OS 9.5:
https://github.com/home-assistant/operating-system/releases/tag/9.5
and I can confirm that their u-boot works with my hardware:

U-Boot 2022.01 (Feb 15 2023 - 02

Re: U-boot not loading NVMe driver on Pi CM4

2023-02-14 Thread Ignatius Rivaldi
Hi Stefan,
On Tue, Feb 14, 2023 at 2:00 AM Stefan Roese  wrote:

> Hi Ignatius,
>
> On 2/10/23 17:05, Simon Glass wrote:
> > Hi Ignatius,
> >
> > On Thu, 9 Feb 2023 at 17:29, Ignatius Rivaldi 
> wrote:
> >>
> >> Added more debug logging and for some reason the nvme driver tries to
> bind
> >> to pcie root bridge instead of the SSD
> >> drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple()
> >> pcie_brcm pcie@7d50: set_state_simple op missing
> >> PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
> >> drivers/core/device.c:184-  device_bind_common() Bound device pci_0:0.0
> to
> >> pcie@7d50
> >> drivers/core/uclass.c:338-uclass_find_device_by_seq() 0
> >> drivers/core/uclass.c:346-uclass_find_device_by_seq()- 0
> 'gpio@7e20'
> >>
> >> drivers/core/uclass.c:349-uclass_find_device_by_seq()- found
> >> drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple()
> >> pci_bridge_drv pci_0:0.0: set_state_simple op missing
> >> drivers/core/device.c:184-  device_bind_common() Bound device nvme#0 to
> >> pci_0:0.0
> >> U-Boot> pci
> >>
> DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 0
> >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
> >> - 0 'pcie@7d50'
> >> DEBUG.driver-model,drivers/core/uclass.c:349-uclass_find_device_by_seq()
> >> - found
> >> BusDevFun  VendorId   DeviceId   Device Class   Sub-Class
> >> _
> >> 00.00.00   0x14e4 0x2711 Bridge device   0x04
> >>
> DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 1
> >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
> >> - 0 'pcie@7d50'
> >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
> >> - 1 'pci_0:0.0'
> >> DEBUG.driver-model,drivers/core/uclass.c:349-uclass_find_device_by_seq()
> >> - found
> >> 01.00.00   0x1e0f 0x0001 Mass storage controller 0x08
> >>
> DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 2
> >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
> >> - 0 'pcie@7d50'
> >> DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
> >> - 1 'pci_0:0.0'
> >> DEBUG.driver-model,drivers/core/uclass.c:353-uclass_find_device_by_seq()
> >> - not found
> >>
> >> It should be pci_1:0.0 I think
> >>
> >> On Thu, Feb 9, 2023 at 11:22 AM Ignatius Rivaldi <
> minecraft2...@gmail.com>
> >> wrote:
> >
> > (please try not to top post)
> >
> > I don't know what is going on here. The PCI scan seems to show the
> > wrong device, as you say. Perhaps it is a bug in the bcm controller
> > driver?
> >
> > +Michal Suchanek
> > +Stefan Roese
>
> I've not used the NVMe driver in U-Boot yet, but at least the PCI class
> and subclass ID seem to be fine AFAIT:
>
> class code =  0x01 (Mass storage controller)
> sub class code =  0x08
> programming interface =   0x02
>
> Are other PCI drivers probed correctly, if you can test this on your
> board? E.g. an Intel E1000 PCIe board perhaps?
>
> Added Bin, perhaps he has some further ideas.
>
> Thanks,
> Stefan
>
> (for some reason your email got sent to my spam folder)

I'm installing the u-boot to the NVMe drive as the CM4 I have doesn't have
eMMC
And CM4 only have 1 PCIe lane so I can't add another PCIe device

I think Home Assistant OS 9.5 which is based on u-boot 2022.1 works with my
hardware,
as the green LED is blinking. But I'm not sure as it seems that their rpi4
build doesn't enable
serial console.

Thanks
Ignatius


> >
> > Regards,
> > SImon
> >
> >
> >>
> >>> Hi all,
> >>>
> >>> I'm using U-boot 2022.07 from Yocto Langdale distribution, with the
> >>> following NVMe related kconfigs manually enabled through menuconfig:
> >>>
> >>> CONFIG_NVME
> >>> CONFIG_NVME_PCI
> >>> CONFIG_CMD_NVME
> >>>
> >>> and logging turned into max
> >>>
> >>> The SSD is Kioxia SSD, and it works with Pi 4 bootloader as I can boot
> >>> Raspberry Pi OS from the NVMe drive.
> >>>
> >>> U boot is installed in the fat32 partition in the NVMe SSD for this
> Yocto
> >>&

Re: U-boot not loading NVMe driver on Pi CM4

2023-02-09 Thread Ignatius Rivaldi
Added more debug logging and for some reason the nvme driver tries to bind
to pcie root bridge instead of the SSD
drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple()
pcie_brcm pcie@7d50: set_state_simple op missing
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
drivers/core/device.c:184-  device_bind_common() Bound device pci_0:0.0 to
pcie@7d50
drivers/core/uclass.c:338-uclass_find_device_by_seq() 0
drivers/core/uclass.c:346-uclass_find_device_by_seq()- 0 'gpio@7e20'

drivers/core/uclass.c:349-uclass_find_device_by_seq()- found
drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple()
pci_bridge_drv pci_0:0.0: set_state_simple op missing
drivers/core/device.c:184-  device_bind_common() Bound device nvme#0 to
pci_0:0.0
U-Boot> pci
DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 0
DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
   - 0 'pcie@7d50'
DEBUG.driver-model,drivers/core/uclass.c:349-uclass_find_device_by_seq()
   - found
BusDevFun  VendorId   DeviceId   Device Class   Sub-Class
_
00.00.00   0x14e4 0x2711 Bridge device   0x04
DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 1
DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
   - 0 'pcie@7d50'
DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
   - 1 'pci_0:0.0'
DEBUG.driver-model,drivers/core/uclass.c:349-uclass_find_device_by_seq()
   - found
01.00.00   0x1e0f 0x0001 Mass storage controller 0x08
DEBUG.driver-model,drivers/core/uclass.c:338-uclass_find_device_by_seq() 2
DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
   - 0 'pcie@7d50'
DEBUG.driver-model,drivers/core/uclass.c:346-uclass_find_device_by_seq()
   - 1 'pci_0:0.0'
DEBUG.driver-model,drivers/core/uclass.c:353-uclass_find_device_by_seq()
   - not found

It should be pci_1:0.0 I think

On Thu, Feb 9, 2023 at 11:22 AM Ignatius Rivaldi 
wrote:

> Hi all,
>
> I'm using U-boot 2022.07 from Yocto Langdale distribution, with the
> following NVMe related kconfigs manually enabled through menuconfig:
>
> CONFIG_NVME
> CONFIG_NVME_PCI
> CONFIG_CMD_NVME
>
> and logging turned into max
>
> The SSD is Kioxia SSD, and it works with Pi 4 bootloader as I can boot
> Raspberry Pi OS from the NVMe drive.
>
> U boot is installed in the fat32 partition in the NVMe SSD for this Yocto
> poky build.
>
> When I boot to U boot prompt, I can see that the SSD is detected by pci
> U-Boot> pci long
> 0
>   - 0 'pcie@7d50'
>   - found
>
> Found PCI device 00.00.00:
>  vendor ID =   0x14e4
>  device ID =   0x2711
>  command register ID = 0x0006
>  status register = 0x0010
>  revision ID = 0x20
>  class code =  0x06 (Bridge device)
>  sub class code =  0x04
>  programming interface =   0x00
>  cache line =  0x08
>  latency time =0x00
>  header type = 0x01
>  BIST =0x00
>  base address 0 =  0x
>  base address 1 =  0x
>  primary bus number =  0x00
>  secondary bus number =0x01
>  subordinate bus number =  0x01
>  secondary latency timer = 0x00
>  IO base = 0x00
>  IO limit =0x00
>  secondary status =0x
>  memory base = 0xc000
>  memory limit =0xc000
>  prefetch memory base =0xfff1
>  prefetch memory limit =   0x0001
>  prefetch memory base upper =  0x
>  prefetch memory limit upper = 0x
>  IO base upper 16 bits =   0x
>  IO limit upper 16 bits =  0x
>  expansion ROM base address =  0x
>  interrupt line =  0x00
>  interrupt pin =   0x01
>  bridge control =  0x
> 1
>   - 0 'pcie@7d50'
>   - 1 'pci_0:0.0'
>   - found
>
> Found PCI device 01.00.00:
>  vendor ID =   0x1e0f
>  device ID =   0x0001
>  command register ID = 0x0006
>  status register = 0x0010
>  revision ID = 0x00
>  class code =  0x01 (Mass storage controller)
>  sub class code =  0x08
>  programming interface =   0x02
>  cache line =  0x08
>  latency time =0x00
>  header type = 0x00
>  BIST =0x00
>  base address 0 =  0xc004
>  base address 1 =  0x
>  base address 2 =  0x
>  base address 3 =  0x000

U-boot not loading NVMe driver on Pi CM4

2023-02-08 Thread Ignatius Rivaldi
Hi all,

I'm using U-boot 2022.07 from Yocto Langdale distribution, with the
following NVMe related kconfigs manually enabled through menuconfig:

CONFIG_NVME
CONFIG_NVME_PCI
CONFIG_CMD_NVME

and logging turned into max

The SSD is Kioxia SSD, and it works with Pi 4 bootloader as I can boot
Raspberry Pi OS from the NVMe drive.

U boot is installed in the fat32 partition in the NVMe SSD for this Yocto
poky build.

When I boot to U boot prompt, I can see that the SSD is detected by pci
U-Boot> pci long
0
  - 0 'pcie@7d50'
  - found

Found PCI device 00.00.00:
 vendor ID =   0x14e4
 device ID =   0x2711
 command register ID = 0x0006
 status register = 0x0010
 revision ID = 0x20
 class code =  0x06 (Bridge device)
 sub class code =  0x04
 programming interface =   0x00
 cache line =  0x08
 latency time =0x00
 header type = 0x01
 BIST =0x00
 base address 0 =  0x
 base address 1 =  0x
 primary bus number =  0x00
 secondary bus number =0x01
 subordinate bus number =  0x01
 secondary latency timer = 0x00
 IO base = 0x00
 IO limit =0x00
 secondary status =0x
 memory base = 0xc000
 memory limit =0xc000
 prefetch memory base =0xfff1
 prefetch memory limit =   0x0001
 prefetch memory base upper =  0x
 prefetch memory limit upper = 0x
 IO base upper 16 bits =   0x
 IO limit upper 16 bits =  0x
 expansion ROM base address =  0x
 interrupt line =  0x00
 interrupt pin =   0x01
 bridge control =  0x
1
  - 0 'pcie@7d50'
  - 1 'pci_0:0.0'
  - found

Found PCI device 01.00.00:
 vendor ID =   0x1e0f
 device ID =   0x0001
 command register ID = 0x0006
 status register = 0x0010
 revision ID = 0x00
 class code =  0x01 (Mass storage controller)
 sub class code =  0x08
 programming interface =   0x02
 cache line =  0x08
 latency time =0x00
 header type = 0x00
 BIST =0x00
 base address 0 =  0xc004
 base address 1 =  0x
 base address 2 =  0x
 base address 3 =  0x
 base address 4 =  0x
 base address 5 =  0x
 cardBus CIS pointer = 0x
 sub system vendor ID =0x1e0f
 sub system ID =   0x0001
 expansion ROM base address =  0x
 interrupt line =  0x00
 interrupt pin =   0x01
 min Grant =   0x00
 max Latency = 0x00
2
  - 0 'pcie@7d50'
  - 1 'pci_0:0.0'
  - not found

but it doesn't show up in nvme scan or nvme info
U-Boot> nvme info
U-Boot> nvme scan

I know that U boot can boot from NVMe, as I can run Home Assistant OS that's
based on U boot on NVMe drive. I just don't know if I missed a kconfig
somewhere, or this U boot version haven't implement it

Can anyone help me with this?

Thanks
Ignatius