xypron changed the topic of #u-boot to: #u-boot SOURCE MOVED TO https://source.denx.de/u-boot/u-boot.git / U-Boot 2023.01 / Merge Window is OPEN, -next is CLOSED / Release v2023.01 is scheduled for 2023-01-09 / Channel archives at https://libera.irclog.whitequark.org/u-boot
lucascastro has quit [Remote host closed the connection]
lucascastro has joined #u-boot
mmu_man has quit [Ping timeout: 252 seconds]
lucascastro has quit [Read error: Connection reset by peer]
<hays> is there a way to mount the flash referenced in this dts file and edit the uboot environment without entering the bootloader? https://elixir.bootlin.com/linux/v5.19.14/source/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts#L72
<clever> hays: looks like you could use flashrom to read it, then you would need to use that partition info to know what offsets to look at/modify
<clever> hays: where is the spi0 node it references?
<hays> i dont know... im barely able to read this dts file
<clever> hays: check the file that line 11 refers to
<clever> see if that has a spi0 node
<hays> I do have /dev/mtd{0,1,2} which is interesting
<hays> one sec
<clever> hays: does lsblk give a size for the mtd nodes? what if you `hexdump -C /dev/mtd2`
<hays> mtdblock2 31:2 0 64K 0 disk
<clever> that is the same size as the DTS listed
<hays> im trying this and its not working https://elinux.org/U-boot_environment_variables_in_linux
<clever> hays: i think the dts did the partitioning for you, so the config file should just set an offset of 0 and size of 64kb
<clever> then fw_printenv should work
<hays> yeah tried that
<clever> what did you put into the config file?
<hays> /dev/mtd2 0x0000 0x10000 0x10000
<hays> maybe that's one too many zeros
<clever> and did it give any errors?
<clever> what did hexdump say?
<hays> Cannot read environment, using default
<hays> Cannot read default environment from file
<clever> what did hexdump say?
<hays> not too legible
<clever> strings /dev/mtd2 ?
faustzero1 has joined #u-boot
<hays> i dont have strings.. hmm looking for the package
<clever> its in binutils
<hays> strings not much better
<hays> a lot of this: IBI SYSTF RUNTS$e
<clever> hays: check mtd0 and mtd1, see if they have anything that makes sense
vagrantc has quit [Quit: leaving]
<hays> they all have the same thing
<clever> not sure then
<hays> so weird its definitely seems like the right place
thopiekar has joined #u-boot
thopiekar_ has quit [Ping timeout: 268 seconds]
<hays> haha i got it
<clever> hays: what did you do differently?
<hays> i took the file from building from source rather than apt
<hays> hmm no this is still wrong.. its some sort of defaults file
camus has quit [Quit: camus]
camus has joined #u-boot
LeSpocky has quit [Ping timeout: 252 seconds]
WoC` has joined #u-boot
LeSpocky has joined #u-boot
camus1 has joined #u-boot
camus has quit [Remote host closed the connection]
camus1 is now known as camus
thopiekar_ has joined #u-boot
thopiekar has quit [Ping timeout: 268 seconds]
thopiekar has joined #u-boot
thopiekar_ has quit [Ping timeout: 268 seconds]
minimal has quit [Quit: Leaving]
<marex> examples ^
<marex> hays: if you need raw block access to mtd device, use mtdblockX instead of mtdX
<marex> clever: ^
<hays> hmm well what's weird is i was able to read it, but it was the board defaults
<marex> board defaults means whatever is built into fw_* tools is printed
<marex> hays: look at $ cat /proc/mtd
<marex> find out which partition is the env partition
<marex> then try and hexdump -vC /dev/mtdblockX | head -> look at the header
<hays> yeah the best candidate was mtd2
<hays> but it was defaults
<marex> can you share what exactly is in that hexdump -vC /dev/mtdblock2 | head output ? paste.debian.net or something ?
<marex> the line in /etc/fw_env.config should likely be '/dev/mtd2 0 0x10000 0x10000' (env size 64k, sector 64k)
<marex> thats not uboot env
<marex> https://paste.debian.net/hidden/f20b7a19/ example env content
<marex> redundant env would have one extra byte of header, likely not your case
<marex> 00000000 76 ee 15 e2 01 66 6f 6f 3d 62 61 72 00 00 ff ff |v....foo=bar....|
<marex> like so ^
<hays> its the only possibility i can find that's mtd at least
<marex> hays: cat /proc/mtd
<marex> what do you get out of that ?
<hays> hold on.. bit of a tech difficulty.. was trying a new kernel
<marex> hays: do you have the U-Boot source for this device ?
<marex> btw it could also be that mtd2 is just not populated yet (run saveenv in u-boot to find out)
<marex> saveenv would write the env into persistent storage, i.e. the spi nor
<hays> i ran saveenv-- I do have the source
<marex> is your board this sheeva64 or something else ?
<hays> gti_ccpe-88f3720_defconfig
<hays> Espressobin Ultra
<marex> GTI Armada 3720 is espressobin ultra ?
<marex> hays: is the board booting from SPI NOR or eMMC ?
<hays> emmc
<hays> yes
<marex> hays: try uh ... dd if=/dev/mmcblkX bs=2031616 skip=1 count=1 | hexdump -vC | head
<marex> X is the emmc device number
thopiekar_ has joined #u-boot
<marex> and also try this in /etc/fw_env.config : /dev/mmcblkX 0x1f0000 0x10000
<marex> that might work
thopiekar has quit [Ping timeout: 268 seconds]
<hays> nothin
<hays> Saving Environment to SPI Flash... SF: Detected mx25u3235f with page size 256 Bytes, erase size 64 KiB, total 4 MiB
<hays> (woot success I got kernel 6.0 on this which means no more patched kernel)
<marex> can you share the entire boot log, from power on ?
<marex> esp. the u-boot part ?
<marex> something does not add up here, either the sources you linked are not what you're running, or the system is not booting from emmc
<marex> hays: in that case, try this in u-boot
<marex> sf probe
<marex> sf read 0x6f00000 0x3f0000 0x10000
<marex> md 0x6f00000
<marex> what do you get that way ?
<hays> looks like environment to me
<hays> 06f00000: 3d9eb5b9 68637261 6d72613d 75616200 ...=arch=arm.bau
<marex> thats env
<marex> all right, so env is in SPI NOR, but when you boot Linux, Linux is unable to read that part of SPI NOR
<marex> for whatever reason
<marex> i.e. the problem is on the kernel side
<hays> seems that way
<marex> try booting whatever 6.0 you have now
<marex> hmmmm, wait
<marex> yeah, hexdump -vC /dev/mtdblock2 | head (the mtdblock part instead of mtd is important)
<marex> verify that /dev/mtdblock2 is really the env partition, in cat /proc/mtd
<hays> mtd2: 00010000 00001000 "u-boot-env"
<hays> 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
<marex> yeah, that's not right
<marex> hays: did you build the kernel yourself ?
<hays> CONFIG_MTD_SPI_NOR=y
<hays> yes
<marex> grep for 4096 or 4K in .config
<marex> do you see such option there ?
<marex> related to MTD or SPI NOR
<hays> CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
<marex> yes, turn it OFF , rebuild the kernel and reboot, and retry
<marex> lets see if that helps (it shouldnt make a difference, unless the SPI NOR controller driver is buggy)
<hays> might be gone for a bit :)
<hays> depends if i need make clean
<hays> booo i need make clean
<marex> uh, why ?
<marex> if you had a kernel tree all set already, switching Kconfig option would be no problem
<marex> just switch it, make, boot
<marex> if you keep switching between multiple branches -> look at git worktree , which is massively helpful
<hays> i built it without make clean and it was still =y
<hays> sorry i had a vm spun up for this eariler in the cloud but i deleted it so its running on a weaker machine
<hays> almost done i think
<hays> marex: same result
<hays> so strange
<marex> hays: edit arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts , locate /spi0/flash@0 {} node and insert into it spi-max-frequency = <10000000>;
<marex> rebuild the DT and see what happens
<marex> that would reduce the SPI NOR frequency
<marex> what happens if you do 'dmesg | grep -i flash' , is there some mention of spi nor ?
<marex> pastebin the output of 'dmesg' verbatim ...
<hays> i did earlier do you want it again
<hays> let me know if you want uboot stuff
<hays> so it turns out the .dtb is not the espressobin-ultra one, which I don't quite understand
<hays> armada-3720-ccpe.dtb
<hays> which is... ugh not in tree
<hays> it has spi-max-frequency = <108000000>;
<hays> so take off an order of magnitude
<hays> i will try that.. but I think I need to take a rest.. almost 1am here
<hays> thanks for digging into it with me
<marex> hays: well, use the matching DT for your board then
<marex> the ccpe one
<hays> yep
<marex> maybe the SPI NOR pin muxing is different
<marex> that would explain what you see
<hays> im not 100% sure which one it is, because the docs kinda suck. but i tried the espressobin-ultra one and kernel modules weren't loading or working like they should
<hays> so i went back to this (out of tree) dtb
<hays> anyways good night. i'll probably be back at this
<marex> yep
adams[1] has quit [Quit: Client closed]
WoC` has quit [Read error: Connection reset by peer]
WoC` has joined #u-boot
guillaume_g has joined #u-boot
sszy has joined #u-boot
ldevulder has joined #u-boot
monstr has joined #u-boot
frieder has joined #u-boot
mckoan|away is now known as mckoan
matthias_bgg has joined #u-boot
guillaume_g has quit [Quit: Konversation terminated!]
zibolo has joined #u-boot
guillaume_g has joined #u-boot
sam_sepi0l has quit [Quit: Textual IRC Client: www.textualapp.com]
indy has quit [Quit: ZNC 1.8.2 - https://znc.in]
indy has joined #u-boot
apritzel_ has joined #u-boot
persmule has quit [Remote host closed the connection]
persmule has joined #u-boot
camus1 has joined #u-boot
camus has quit [Ping timeout: 252 seconds]
camus1 is now known as camus
ikarso has joined #u-boot
tre has joined #u-boot
mmu_man has joined #u-boot
persmule has quit [Remote host closed the connection]
prabhakarlad has quit [Quit: Client closed]
indy has quit [Ping timeout: 264 seconds]
indy has joined #u-boot
jclsn has joined #u-boot
jclsn has quit [Client Quit]
jclsn has joined #u-boot
lucascastro has joined #u-boot
jclsn has quit [Quit: WeeChat 3.6]
jclsn has joined #u-boot
jclsn has quit [Client Quit]
minimal has joined #u-boot
jclsn has joined #u-boot
<hays> marex: it worked!
<hays> wait.
<hays> nevermind. it didn't work
lucas_ has joined #u-boot
lucascastro has quit [Ping timeout: 265 seconds]
<hays> hexdump looks the same
mmu_man has quit [Quit: reboot]
mmu_man has joined #u-boot
jclsn has quit [Quit: WeeChat 3.6]
lucas_ has quit [Ping timeout: 268 seconds]
tre has quit [Remote host closed the connection]
lucas_ has joined #u-boot
lucas_ has quit [Remote host closed the connection]
davlefou has quit [Ping timeout: 246 seconds]
jclsn has joined #u-boot
davlefou has joined #u-boot
<hays> ok I think I got it. I was able to take the spi settings from the espressobin-ultra.dts file and stick them in the one I have where everything else works. and its reading the spi now
<xypron> Tartarus: was there an issue with origin/WIP/07Oct2022 (Pull request for efi-2023-01-rc1)?
<Tartarus> xypron: no, sorry, I just forgot to push
<Tartarus> I'll do that shortly
torez has joined #u-boot
sbach has quit [Read error: Connection reset by peer]
sbach has joined #u-boot
GNUtoo has quit [Remote host closed the connection]
GNUtoo has joined #u-boot
mmu_man has quit [Ping timeout: 252 seconds]
lucascastro has joined #u-boot
prabhakarlad has joined #u-boot
persmule has joined #u-boot
prabhakarlad has quit [Quit: Client closed]
ikarso has quit [Quit: Connection closed for inactivity]
matthias_bgg has quit [Ping timeout: 265 seconds]
lucascastro has quit [Remote host closed the connection]
matthias_bgg has joined #u-boot
mmu_man has joined #u-boot
umbramalison has quit [Quit: %So long and thanks for all the fish%]
zibolo has quit [Ping timeout: 265 seconds]
<sjg1> Tartarus: I was looking at the MAINTAINERS N thing...doesn't that mean we need to glob the whole source tree for each occurrence? Is there a more efficient way?
frieder has quit [Remote host closed the connection]
<Tartarus> sjg1: I was thinking you'd store a list of regexs as well, and then check vs that too when using -R
<Tartarus> As that's the failure case, I can't take all of those broadcom updates as they use N: to match on files instead of spelling out a bunch of configs, and other things too
<sjg1> OK, what is -R?
<Tartarus> What you added to replace running genboardscfg.py and checking for unmaintained defconfigs with
persmule has quit [Quit: Leaving]
persmule has joined #u-boot
faustzero1 has quit [Ping timeout: 268 seconds]
apritzel_ is now known as apritzel
mmu_man has quit [Quit: Reconnecting]
mmu_man has joined #u-boot
JBB[m] has quit [Quit: You have been kicked for being idle]
mmu_man has quit [Ping timeout: 252 seconds]
vagrantc has joined #u-boot
sigmaris has quit [Ping timeout: 265 seconds]
mckoan is now known as mckoan|away
<sjg1> Tartarus: ah OK, got it. I think understand it have have something working so will send a patch sometime today
<Tartarus> thanks!
sszy has quit [Ping timeout: 268 seconds]
EdSwarthout has joined #u-boot
sigmaris has joined #u-boot
monstr has quit [Remote host closed the connection]
grgy has joined #u-boot
vagrantc has quit [Quit: leaving]
umbramalison has joined #u-boot
prabhakarlad has joined #u-boot
apritzel has quit [Ping timeout: 252 seconds]
alpernebbi has quit [Ping timeout: 260 seconds]
sigmaris has quit [Ping timeout: 268 seconds]
sigmaris has joined #u-boot
alpernebbi has joined #u-boot
persmule has quit [Remote host closed the connection]
persmule has joined #u-boot
WoC` has quit [Remote host closed the connection]
WoC` has joined #u-boot
<hays> Are there any guides on how to make sense of dts files? They seem mostly magic
<hays> I’ve got 2 dts files and both work mostly but are broken in different ways . Trying to see if I can patch one or the other
<milkylainen> hays: Don't fret. Nobody understands them. They just pretend. ;) It's an art you see. Just start reading a bunch of them and then start pretending you too.
naoki has quit [Quit: naoki]
cottsay has quit [Quit: TTFN]
<hays> Lol that’s what I was afraid of
cottsay has joined #u-boot
<Tartarus> Broken in U-Boot, or broken in Linux?
<Tartarus> But, uh, with my work hat on, we've had more than one customer say "please fix X/Y/Z in the dts file and then teach us how to do that", so don't feel bad about not getting it right away.
<milkylainen> hays: j/k. You'll get it eventually. Most minor fixes aren't that hard to grasp. :)
GNUtoo has quit [Quit: leaving]
GNUtoo has joined #u-boot
<cambrian_invader> hays: there's always https://elinux.org/Device_Tree
<cambrian_invader> which is a nice start
<cambrian_invader> but sadly woefully incomplete
<clever> hays: overlays also complicate things, i have some examples that are overlay free
<hays> Tartarus broken inLinux
<hays> One requires you to power cycle the WiFi chip for the module to load
<hays> The other has broken MTD/flash
<hays> I actually already fixed it, but I fixed it in the dts that I think is less current and correct
<hays> So I’d like to figure out why this other DTS is screwing up the WiFi chip
<hays> Is there a way to see the file with all the included
<hays> Includes
<cambrian_invader> depends on when you want to see it
<Tartarus> it's just cpp doing that level of stuff, so I think you can do make .../foo-dtb.i ?
<Tartarus> in linux
naoki has joined #u-boot
<hays> I guess I want to see it just before it gets compiled and I can do a side by side comparison of the two
<j`ey> you can also use ''dtc -O dts', to decompile the dtb
<hays> Sad thing is I don’t even see the WiFi in the dts
<Tartarus> There's also dtdiff
<j`ey> hays: maybe it's behind pcie?
<hays> J’ey that was my guess
<hays> PCiE is disabled in the one that works oddly
<hays> Or has status disabled
<j`ey> or usb?
<clever> dtc -O dts /proc/device-tree -s -o out
<clever> hays: if you are booted into linux, you can also translate the live dtb (including all overlays) back into a single dts file
<clever> but all of the #define constants are missing, and strings arent formated the same way
<cambrian_invader> j`ey: just `dtc` will do that, as I found out the other day
<cambrian_invader> no -I or -O necessary
<hays> Is it just describing its state at boot?
<hays> Eg needs to be enabled?
<hays> Or is it saying that the interface is unavailable to the kernel
<cambrian_invader> section 2.3.4
<cambrian_invader> Linux treats anything other than "okay" as "disabled"
torez has quit [Quit: torez]
<marex> cambrian_invader: by anything other, you mean the nodes which have no 'status' property ?
<cambrian_invader> no, I mean nodes with e.g. status = "reserved"
<cambrian_invader> which has a particular meaning accordint to the dt spec that linux doesn't care about
mmu_man has joined #u-boot
<clever> hays: if the status on a node is not "okay" then linux basically acts like the node didnt even exist
<cambrian_invader> (only for devices)
<cambrian_invader> things which don't have devices are parsed unless the driver checks for status
<marex> ... and if the status prop is not present, it is as if it was okay
<clever> marex: disabled tends to be used for when overlays or firmware are going to mess with things
<clever> for example, the soc dts file may define 2 hdmi ports, but leave them disabled, because a board may only wire up one or even none!
<clever> then the board dts file has an overlay, changing some hdmi ports to okay
<marex> clever: you likely don't want to confuse people with overlays at this point
<clever> yeah, thats why i linked an overlay free example above
<marex> almost every DT in the mainline linux kernel tree is overlay free
<cambrian_invader> /include/ is not an overlay
<clever> cambrian_invader: but it still adds overlay like confusion, when you have to read a dozen files to know what a property is set to
<cambrian_invader> a device tree overlay is a specific term referring to modifying a device tree *at runtime*
<marex> that ^
<clever> yeah
<marex> include is just like cat dts1.dts dts2.dts > final.dts and then dtc on that
<marex> DTO is ... different, more complex, involves runtime symbol resolution etc
<clever> marex: but include still leads to questions like where the heck is spi0 defined?
<cambrian_invader> keep clicking the include links
<cambrian_invader> until you get there
<clever> yep
<cambrian_invader> only took 3 clicks :P
<clever> on some dts files ive browsed, the node is modified in 3 different files
<clever> and you need to look at all of them to make sense of it
<marex> cambrian_invader: ok, that took me a while to get, heh
<cambrian_invader> hm?
<marex> cambrian_invader: https://en.wikipedia.org/wiki/Three-click_rule this is what you referred to, right ?
<cambrian_invader> no, in the particular example he gave it takes 3 clicks to get to the file which defines spi0
<marex> it's clearly well designed then ;-)
<cambrian_invader> which rules out an espressobin ultra+ board
<marex> I think in this espresso-something case, the CCPE board is just different and the user should use the DT which matches the board, really
<marex> and use the YAML schemas to write proper working DT for that board if CCPE does not provide one
<hays> Marex they are for the same board I think
<hays> The board vendor uses the ccpe one
<hays> But their docs are old before I think that other one was mainlined
<hays> Yaml schemas?
<cambrian_invader> yaml will not save hays
<marex> this ?
<marex> hays: ^
<marex> cambrian_invader: YAML schemas will save us all from writing crappy DTs
<cambrian_invader> if they don't kill us first
vagrantc has joined #u-boot
<hays> Marex that’s the board
<hays> I’ve not seen the lte device. Maybe a SIM is needed for it to come up
<clever> how does u-boot typically deal with patching DT's for runtime information, like the location of the framebuffer, the ram, and serial#'s?
<marex> hays: could be optional
<marex> clever: DT comes in, immutable, possibly another or relocated/duplicated DT is passed to next stage
<marex> that's kinda the idea of DT -- you can parse it even with no memory
<marex> if you need to change it, you may have to copy it somewhere, add space, change it, and so on
<marex> hays: the LTE modem is usually just an USB device
<marex> hays: well, so what did you change to make SPI NOR work in Linux in the espressobin ultra upstream DT ?
<clever> marex: but where in the boot process are those changes typically done?
<hays> Marex it works in the espressobin ultra dt. I copied the spi settings from that to the ccpe dts
<marex> clever: what do you mean "where", like ... where during u-boot execution or where during the whole boot process (incl. before u-boot and linux and so on)
<clever> within uboot
<marex> hays: well, so what is in the diff ?
<clever> marex: where would i modify uboot to make it apply the right patches before it runs linux
<hays> One sec I’m on my phone
<marex> clever: depends on which changes , some of them may be applied via fdt command (like user DT tweaks, DTOs), some might also be applied as part of fitImage, some might come from ft_board_setup and co. where DRAM layout is patched into DT
<cambrian_invader> clever: image_setup_libfdt
<cambrian_invader> which calls all the things that want to do fixups
<clever> cambrian_invader: ah
<clever> marex: i kinda dont want it in the boot script, because there is a lot of things and it may grow with time, and then the scripts in each distro get out of date
<marex> clever: ideally whatever is user configurable should be in scripts
<marex> stuff like DRAM layout patching is around ft_board_setup and similar hooks
<marex> or what cambrian_invader said
<clever> marex: but things like the framebuffer address/resolution, are coming from a previous stage, and arent configurable
<marex> clever: you likely want to pass those through, yes
<marex> clever: those come from firmware ?
<marex> clever: why not let linux init the framebuffer from scratch ?
<clever> marex: the 2d driver stack is currently 100% broken
<marex> hays: what happens if you only drop
<marex> -spi-rx-bus-width = <4>;
<marex> -spi-tx-bus-width = <4>;
<clever> so i'm pre-configuring a framebuffer in the firmware, and just throwing a pointer at linux
<marex> these two ^
<marex> I think that would inhibit 4bit bus wide read/write, i.e. the SPI NOR would operate in 1-1-1 mode instead of 1-1-4
<clever> ft_board_setup via image_setup_libfdt looks perfect
<hays> Marex yeah
<hays> I say yeah but I didn’t know the underlying change. Just those lines seem to be the only real change
<hays> But why does the WiFi work in the ccpe and not the ultra dtb. That’s the question
<hays> Going to dig into
<hays> It later when I have my laptop
<marex> hays: paste kernel boot log
<marex> hays: 5202f4c3816b4 ("arm64: dts: marvell: espressobin-ultra: fix SPI-NOR config")
<marex> hays: that commit is in linux-next
<marex> here
<marex> seems your problem is already fixed
<cambrian_invader> that's a pretty depressing authored/committed gap
<cambrian_invader> sat on the mailing list for 7 months
<marex> cambrian_invader: shall we open the "some maintainers are slow" support group again ?
<hays> Marex the problem of WiFi not coming up?
<marex> hays: the SPI NOR problem, has been fixed in next for months ... try linux-next on the board and see what happens, maybe your wifi would be fixed too
<hays> That looks like SPI NOR which I think is a similar fix I applied
<cambrian_invader> 6.0 should include that commit fwiw
<cambrian_invader> unless it somehow missed the merge window
<hays> Yeah I’m on 6.0
<hays> I backported that fix to the ccpe dts
<hays> Which has working WiFi but I think is old in other ways
<marex> you can check -- dtc -s -I dtb -O dts input.dts | less -> search for flash@ and see if those props are still present
<marex> it should've landed in 5.19
<hays> This is a workaround for the WiFi http://paste.debian.net/1256593/
<hays> On the ultra dtb
<marex> maybe its this patch ?
<marex> 715878016984b ("arm64: dts: marvell: armada-37xx: Set pcie_reset_pin to gpio function")
<marex> kabel: ^
<hays> I think I’d already have that when I tried the ultra dtb
<hays> group pcie1_wakeup - pins 41 - functions pcie, gpio
adams[1] has joined #u-boot