narmstrong changed the topic of #linux-amlogic to: Amlogic mainline kernel development discussion - our wiki http://linux-meson.com/ - ml linux-amlogic@lists.infradead.org - official channel moved from Freenode - publicly logged on https://libera.irclog.whitequark.org/linux-amlogic
jacobk has quit [Ping timeout: 255 seconds]
montjoie has quit [Ping timeout: 246 seconds]
montjoie has joined #linux-amlogic
jacobk has joined #linux-amlogic
jacobk has quit [Read error: Connection reset by peer]
vagrantc has quit [Ping timeout: 248 seconds]
naoki has joined #linux-amlogic
JohnnyonFlame has joined #linux-amlogic
hexdump0815 has quit [Ping timeout: 246 seconds]
hexdump0815 has joined #linux-amlogic
jacobk has joined #linux-amlogic
camus has quit [Read error: Connection reset by peer]
camus1 has joined #linux-amlogic
camus1 is now known as camus
vagrantc has joined #linux-amlogic
ndufresne8 has joined #linux-amlogic
jacobk_ has joined #linux-amlogic
montjoie_ has joined #linux-amlogic
hexdump01 has joined #linux-amlogic
jacobk has quit [*.net *.split]
hexdump0815 has quit [*.net *.split]
montjoie has quit [*.net *.split]
f_[xmpp] has quit [*.net *.split]
ndufresne has quit [*.net *.split]
ndufresne8 is now known as ndufresne
naoki has quit [Quit: naoki]
vagrantc has quit [Ping timeout: 258 seconds]
JohnnyonFlame has quit [Read error: Connection reset by peer]
luka177 has joined #linux-amlogic
luka177 has quit [Ping timeout: 255 seconds]
f_ has joined #linux-amlogic
<f_> hi
luka177 has joined #linux-amlogic
luka177 has quit [Ping timeout: 246 seconds]
luka177 has joined #linux-amlogic
luka177 has quit [Ping timeout: 246 seconds]
luka177 has joined #linux-amlogic
luka177 has quit [Ping timeout: 246 seconds]
luka177 has joined #linux-amlogic
luka177 has quit [Ping timeout: 245 seconds]
gabes2 has quit [Quit: The Lounge - https://thelounge.chat]
gabes2 has joined #linux-amlogic
luka177 has joined #linux-amlogic
luka177 has quit [Ping timeout: 250 seconds]
luka177 has joined #linux-amlogic
luka177 has quit [Ping timeout: 246 seconds]
<f_> the errors I get are all from uclass
<f_> so I really might have missed something in the dt.
luka177 has joined #linux-amlogic
luka177 has quit [Ping timeout: 248 seconds]
<narmstrong> i thing you missed something important indeed, look the original DT and look are the required providers on the emmc
<f_> I don't care about eMMC for now.
<f_> but yes, probably.
<f_> Also feel like dtc finds more and more errors
<f_> but AFAIK clocks are there, pinctrl too
camus has quit [Ping timeout: 248 seconds]
<narmstrong> you're missing the regulators aswell
<narmstrong> and the gpios under the pinctrl node
<f_> and space
<f_> Can't count how many times I got that same error where it overflows
<narmstrong> I think all those are optional, but the driver and the mmc uclass should ignore then
<f_> It does return ENOSYS
<f_> So I doubt anything mmc-related is ever ran
<narmstrong> so remove the vmmc-supply, vqmmc-supply, cd-gpios, pinctrl-*, clocks* because all these should be set up by the bootloader
<f_> Haven't you said that not including clocks would result in problems?
<f_> I guess at this point I should tweak the mmc driver for it to not do any mmc init at all..
<narmstrong> yes but you should check the driver don't fail when clocks are missing
<narmstrong> you could tweak the mmc driver to ignore all the clocks, gpios and regulators
<narmstrong> I think the ENOSYS comes from clk_get_bulk()
<narmstrong> comment it for SPL
<f_> clk_get_bulk never gets ran.
<f_> I just put a `printf(__func__);` and it never got ran
<f_> Wait..
<f_> $ grep OF_PLATDATA .config
<f_> # CONFIG_SPL_OF_PLATDATA is not set
<f_> I was reading the docs.
<f_> ah no.
<f_> That would be an alternative to device trees
<narmstrong> yes no you don't need pltdata
<f_> Yeah, misread.
<f_> device_probe is really the one complaining.
<narmstrong> you should locate what returns -ENOSYS in the device_probe()
<f_> Good idea, yes. That's what I'm doing now.
* narmstrong time to copy paste printf("%s:%d\n", __func__, __LINE__); in each single line of device_probe() :-p
<f_> yay
<f_> Linking errors again.
<f_> I disabled GPIO for some reason..that's why.
<f_> narmstrong: Are you also testing on your own??
<f_> drv->probe(dev) fails.
<f_> There's our problem
<f_> ^ this calls meson_mmc_probe
luka177 has joined #linux-amlogic
<f_> I added a printf there to be sure, and that's it I guess
<f_> Putting this inside #ifdefs
<narmstrong> nop sorry I can't...
<f_> No problem
<f_> You're quite helpful already
<narmstrong> but I support you 100%
<f_> AFAICT you do, indeed :)
<f_> Imagine now if it can't find itself
<narmstrong> lost in translation, u-boot edition
<f_> Now also thinking that clk_get_bulk is the one returning ENOSYS
<f_> clk_get_bulk: -38
<f_> There's our proof ^
<f_> What's weird is...debug doesn't work
<f_> Actually not weird
<f_> Perhaps should I set LOG_EMERG
<f_> Anyway....
<f_> clk_get_bulk doesn't work
<f_> I presume this could be because of the device tree
<f_> I'll have to see what actually fails
<f_> Perhaps something in drivers/clk/meson
<narmstrong> ignore it, you don;t need to enable clocks since they're already enabled, just disable clk code
<Kwiboo> yep, just remove/comment out all clk_ calls in the driver to test
<f_> Perhaps
<f_> Will do.
<Kwiboo> ENOSYS is also returned when support for a uclass is disabled, do you have CONFIG_SPL_CLK=y ?
<Kwiboo> or whatever the Kconfig option is called to enable clock support in SPL
<f_> # CONFIG_SPL_CLK is not set
<f_> Very sleepy brain :/
<f_> I knew ENOSYS was also used when support is disabled
<f_> But then I hit into linking issues
<f_> because SPL_REGMAP doesn't seem to be enabled either
<Kwiboo> I still think the best approach in the end will be to enable TPL and have TPL do bare minimum: use debug uart, init dram, read X blocks from pos Y from the mmc boot device into SPL text base, jump to SPL text base
<Kwiboo> basically do same as vendor BL2 :-)
<narmstrong> yep so it should only use the boot device, not another so no clock, pinctrl, gpio or other changes needed
<f_> Time to reenable CONFIG_LTO
<f_> Wow, with -j4 it compiles so much faster
<f_> *people laughing*
<narmstrong> *people rolling on the floor laughing*
GNUtoo has quit [Ping timeout: 246 seconds]
GNUtoo has joined #linux-amlogic
<f_> Now
<f_> I got a linker error saying the .sram region got overflowed
<f_> and that the bss section overlaps some other section
<f_> SPL can run on a 16K size limit
<f_> and there's still plenty of space between the header and 0xc000 that could be used
<f_> (just need to modify SPL_TEXT_BASE and amlimage/header)
<f_> 4K is taken by the header
<f_> 4K is a lot
<f_> /usr/lib/gcc/aarch64-linux-gnu/13.1.0/../../../../aarch64-linux-gnu/bin/ld: region `.sram' overflowed by 5544 bytes
<f_> I keep getting that same overflow
<f_> Let's try disabling some stuff..
<f_> I'm giving up
<f_> ...so I'll go with Kwiboo's suggestion
<f_> I'll enable TPL
<f_> get it to init the DRAM, load SPL, and jump to it
<f_> 44K is just not enough
<f_> and if only I could use any sort of compression :X
<f_> anyway, I'll try to get a TPL to run
<f_> But what should I set the SPL text base to?
<f_> Where should I load SPL in memory?
GNUtoo_ has joined #linux-amlogic
GNUtoo has quit [Ping timeout: 246 seconds]
<f_> Actually
<f_> I could leave DRAM init to SPL
<f_> Let TPL just load SPL from MMC to 0xD9001000, and have TPL at e.g. offset 0x1024
mripard has quit [Quit: mripard]
* f_ scraps that idea
<f_> Totally fine with TPL -> SPL -> BL30 & BL31 & U-Boot
<f_> TPL is b0rked.
<f_> Upon compiling I see lots of compile errors
<f_> *compiler
<f_> ¯\_(ツ)_/¯
luka177 has quit [Ping timeout: 245 seconds]
vagrantc has joined #linux-amlogic
<f_> Perhaps should I make use of a very tiny MMC framework instead?
<f_> Now it hangs.
rpardini has joined #linux-amlogic
<f_> Now it can't find itself.
<f_> (with everything in meson_mmc_probe commented/inside ifdefs)
jacobk_ has quit [Ping timeout: 246 seconds]
<f_> CONFIG_SPL_CLK really is the one adding too much stuff
<f_> >The clock subsystem adds a small amount of overhead to the image.
<Kwiboo> f_: Hehe, yeah, it all adds up eventually, a minimal TPL that does bare minimum to load SPL, then SPL can have access to complete DRAM to go nuts
<f_> Yeah but compiling TPL with the MMC driver leads to...issues
<f_> And besides, we don't need any init for our lovely MMC devices
<f_> Let me double-check
<Kwiboo> Yep, we need to figure out how much of the meson mmc driver needs to work, and how we can fool mmc core to be happy enough to think it can successfully init the mmc device
<f_> No I mean
<f_> drivers/mmc/mmc-uclass.c
<Kwiboo> Maybe MMC_TINY is something to look into, sounds like it is what we want to do, bare minimum to mmc interaction
<f_> I'll enable it.
<f_> But it's just a framework. It also uses the meson driver
<f_> Enabled
<f_> but it still hangs
<f_> I should paste logs
<f_> also figured out that MMC1 is the SD card, MMC2 is eMMC
<f_> MMC1 is mmc@72000, datasheets say that 0xd0072000 is SD
<Kwiboo> the mmc driver most defenetly needs some work, adding some ifdef to check if SPL build and skip or adjust the mmc_cfg
<f_> Indeed
jacobk has joined #linux-amlogic
jacobk has quit [Ping timeout: 246 seconds]
<f_> So..when commenting all of meson_mmc_probe it fails to find
<f_> it fails to find MMC1*
<f_> But when I only comment clock-related stuff it hangs
jacobk has joined #linux-amlogic
<f_> then blk_find_device kicks in, and throws ENODEV
<narmstrong> perhaps some clock is not enable
<narmstrong> finally
<f_> Doubt...BL2 doesn't do any MMC init, at all.
<f_> It just proceeds to sdio_read_data
<f_> Either way....CONFIG_SPL_CLK takes too much space.
<f_> Now that I think about it
<f_> IIRC BL2 doesn't check if the device is present or not
<f_> Okay so this is weird.
<f_> see this?
<f_> It's supposed to return 0 if desc->uclass_id == uclass_id && desc->devnum == devnum
<f_> debug("%s: uclass_id=%d, devnum=%d: %s, %d, %d\n", __func__,
<f_> uclass_id, devnum, dev->name, desc->uclass_id, desc->devnum);
<f_> ^ see this?
<f_> Now this is what I get:
<f_> blk_find_device: uclass_id=71, devnum=0: mmc@72000.blk, 71, 0
<f_> desc->uclass_id == uclass_id right?
<f_> desc->devnum == devnum right??
<f_> Yet it still returns -ENODEV...
<f_> So it doesn't return ENODEV
<f_> Something else is doing that
<f_> So the block driver *does* find the MMC device
<f_> So it's one of these misbehaving
<f_> mmc_dev isn't NULL
<f_> Seems to detect that the device is active
<f_> So dev_get_uclass_priv is the one returning NULL.
<f_> Impressive how much you need just to be able to access the device you're running from
<f_> Wondering if I'll have to do all that troubleshooting when I'll play around with SPI on lafrite...
<f_> upriv != NULL
<f_> upriv->mmc == NULL
<f_> there's our culprit
<Kwiboo> did you remove too much from meson probe :)
* f_ looks at Kwiboo
<f_> uhhhhhhhh
<f_> maybe?
<f_> Definitely didn't see this
<f_> lol
<Kwiboo> that cfg->voltages down to upriv->mmc = mmc; must probably stay, everything else in probe can probably go
<Kwiboo> and just return 0 in meson_dm_mmc_set_ios
<f_> But then it hangs
<f_> clock is disabled (0Hz)
<f_> clock is enabled (380953Hz)
<f_> and apart from the printfs I added (just checking against NULL), it doesn't print a single thing
<f_> Possibly trying to load something but then failing.
<Kwiboo> possibe the different cfg-> values needs to be configured into a state that match what bl1 leaves the state in, or mmc core will try to change its state
<f_> Could also be a wrong offset ¯\_(ツ)_/¯
<f_> Let's see
<f_> fails at mmc_init again
<f_> So perhaps
<Kwiboo> maybe force mmc->version < 4: https://git.vitali64.duckdns.org/misc/u-boot-kii-pro.git/tree/drivers/mmc/mmc.c?h=wip/spl#n2137 so that core does not try to change mode
jacobk has quit [Ping timeout: 246 seconds]
<Kwiboo> is get_timer working? maybe some timeout is never reached because of not working timer/counter ?
jacobk has joined #linux-amlogic
<f_> That's what I suspect.
<Kwiboo> Let me know if you want me to test or investigate anything :-)
<f_> :)
<f_> mmc_start_init
<f_> ^ function hanging
<Kwiboo> I can take a look, just need to get my odroid-c2 to boot into something again :-)
luka177 has joined #linux-amlogic
luka177 has quit [Ping timeout: 260 seconds]
<f_> Kwiboo: nice
<f_> I should perhaps disable the watchdog
<f_> /* Reset the Card */
<f_> err = mmc_go_idle(mmc);
<f_> printf("%s: %d\n", __func__, __LINE__);
<f_> ^ that printf never gets ran
<f_> and I see udelay being used......
<f_> err = mmc_send_cmd(mmc, &cmd, NULL);
<f_> ^ this hangs
<f_> and I know exactly why this hangs
<f_> meson_read hangs
<f_> It's not the loop
<f_> this readl hangs
<f_> It can't read the register
<f_> It's different?
<Kwiboo> https://esr.arm64.dev/?#0xbf000002
<Kwiboo> I am still testing my old odroid-c2 config that have CONFIG_ARMV8_SPL_EXCEPTION_VECTORS=y
<f_> Ah
<f_> My config doesn't have tha
<f_> *that
<f_> I should enable it.
<f_> Kwiboo: Are you booting from eMMC or SD?
<f_> You're using an SD card.
<f_> I'm using an SD card too
<f_> Mostly similar to what I have
<Kwiboo> yeap, only dropped the serial hack I played with last weekend, like you mentioned, with "# CONFIG_SPL_SERIAL_PRESENT is not set" and not including the uart_AO in spl dtb, debug uart will be used
<Kwiboo> meson_write(mmc=d900e348): writel(23f, 72000) <<-- address translation is not working
<f_> Pretty clear what the problem is at this point.
<Kwiboo> pdata->regbase <<-- = 72000
<f_> Supposed to be 0xd0072000
<f_> :^)
jacobk has quit [Ping timeout: 248 seconds]
<Kwiboo> dev_read_addr at fault, it will at least with full of_live tree take parent reg / range into account
<Kwiboo> mayby not fylly in flat dt / platdata mode
<f_> Let's hardcode
<f_> (for now)
<f_> We do have apb@d0000000
<f_> and mmc@72000 is a child of it
<Kwiboo> Yeah, it is suppose to work, will look at patches on ML, have seen fixes for similar issues
<f_> Thanks!
<Kwiboo> LOL, that address issue has been hinted in the logs all this time: "fdtdec_get_addr_size_auto_parent: na=2, ns=2, fdtdec_get_addr_size_fixed: reg: addr=00000000x" <<-- addr = 0x0
<f_> haha
<f_> Always thought that `0000000x` thing was weird
<Kwiboo> it is possible that ranges is causing issues
<narmstrong> OF_TRANSLATE and OF_REAL should be enabled
<f_> cross-compile: aarch64, git branch: wip/spl, thelinuxmacbook:u-boot » grep OF_TRANSLATE .config
<f_> CONFIG_OF_TRANSLATE=y
<f_> # CONFIG_SPL_OF_TRANSLATE is not set
<Kwiboo> narmstrong: thanks :)
<f_> Explains a lot...
<f_> thanks narmstrong
<f_> Hacking SPL to run on Amlogic SoCs is always fun
<narmstrong> You’re welcome :-)
<f_> My uart cable sure likes the letter w
<f_> very hacky way to attach UART to a board with no header
<f_> Nice!
<f_> Can you try with a binary?
<f_> e.g. BL31
<f_> Or copy-paste whatever I set up in binman
<Kwiboo> Yeah, will do :-)
<f_> spl: mmc boot mode: raw
<f_> SPL: failed to boot from all boot devices (err=-6)
<f_> spl: mmc: wrong boot mode
<f_> ### ERROR ### Please RESET the board ###
<f_> ^ error I get
<f_> spl: mmc init failed with error: -110
<f_> ### ERROR ### Please RESET the board ###
<f_> SPL: failed to boot from all boot devices
<f_> ^ error you get
<Kwiboo> Yeah, lets see where spl tries to read from :) and if there is any data returned from mmc or if mmc just fails to init
<f_> I'll have to go.
<f_> See you tomorrow!
<Kwiboo> See you tomorrow!
jacobk has joined #linux-amlogic
<Kwiboo> still "spl: mmc init failed with error: -110" with u-boot proper in fit image
<Kwiboo> mine will never work, I did not include the dram init in my build :D
<Kwiboo> and CONFIG_FIT and CONFIG_SPL_FIT is needed
ldevulder has quit [Quit: Leaving]
JohnnyonFlame has joined #linux-amlogic
f_ has quit [Ping timeout: 248 seconds]
samueldr has quit [Server closed connection]
samueldr has joined #linux-amlogic
jacobk has quit [Ping timeout: 246 seconds]