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
dlan_ is now known as dlan
dlan has joined #linux-amlogic
dlan has quit [Changing host]
Daanct12 has joined #linux-amlogic
Daanct12 has quit [Remote host closed the connection]
Daanct12 has joined #linux-amlogic
Daanct12 has quit [Remote host closed the connection]
Daanct12 has joined #linux-amlogic
Daanct12 has quit [Ping timeout: 260 seconds]
Daanct12 has joined #linux-amlogic
Daanct12 has quit [Remote host closed the connection]
Daanct12 has joined #linux-amlogic
Daanct12 has quit [Read error: Connection reset by peer]
Daanct12 has joined #linux-amlogic
Daanct12 has quit [Remote host closed the connection]
vagrantc has joined #linux-amlogic
camus has joined #linux-amlogic
camus has quit [Quit: camus]
camus has joined #linux-amlogic
JohnnyonFlame has quit [Ping timeout: 256 seconds]
vagrantc has quit [Quit: leaving]
GNUtoo has quit [Remote host closed the connection]
GNUtoo has joined #linux-amlogic
tdebrouw has joined #linux-amlogic
<narmstrong> xdarklight: no prob take your time, I’ll need to spend some more time since there’s huge compatible mis usage in DT anyway (on arm64 especially)
warpme___ has joined #linux-amlogic
camus has quit [Remote host closed the connection]
JohnnyonFlame has joined #linux-amlogic
tolszak has joined #linux-amlogic
<tolszak> narmstrong: How to force Odroid C2 micro USB to work in host mode?
<narmstrong> tolszak: good question, xdarklight should know that
<tolszak> narmstrong: It doesn't work whatever I plug in. I can try to make it work with both CONFIG_USB_OTG, will check if it works.
<tolszak> narmstrong: Also I see something like that when I plug in the camera: http://dpaste.com//9Z2J9SPMZ
<narmstrong> WoW pretty bad indeed
<xdarklight> tolszak: to enable USB host on the micro USB connector I think you "just" need to set &usb0_phy and &usb0 to status = "okay" in meson-gxbb-odroidc2.dts
<xdarklight> tolszak: it won't have any OTG support though, so it's either host (default) or device, depending on what's set in the .dts
<tolszak> xdarklight: "just" - lmao, how could I forget that :-)
<tolszak> xdarklight: Thank you very much. I will givve it a try
<xdarklight> tolszak: to be clear: th ehardware supports OTG but I haven't managed to make that work in the driver(s) yet
<tolszak> xdarklight: Fortunately host mode is what I need.
steev has quit [Read error: Software caused connection abort]
steev has joined #linux-amlogic
<tolszak> xdarklight: I've added patch to linux-yocto. Seems it is there. Do I need to add it also to u-boot?
<tolszak> Seems like the micro usb still doesn't work
<tolszak> narmstrong: I added CONFIG_GPIO_SYSFS=y but the /sys/class/gpio is not present, any idea how to access gpio?
<narmstrong> Using the libgpiod tools
<tolszak> narmstrong: So only new way is available, understood.
<narmstrong> The older way should work but honestly I haven’t used it for a while so maybe there’s a trick to enabled it
naoki has quit [Quit: naoki]
Danct12 has quit [Ping timeout: 268 seconds]
<tolszak> narmstrong: There is /sys/firmware/devicetree/base/serial-number but no /sys/bus/platform/devices/secure-monitor/serial
<narmstrong> tolszak: on which soc ?
<tolszak> narmstrong: Still playing with Odroid C2.
<narmstrong> tolszak: gxbb doesn’t have a serial number
<tolszak> I see so probably /sys/firmware/devicetree/base/serial-number is the same for all right?
<tolszak> narmstrong: Any idea how to check if device tree has been modified instead of looking at yocto sources? It looks alright there but still the micro usb doesn't work
<narmstrong> I think serial-number is added by u-boot
<narmstrong> tolszak: no easy way to check
<narmstrong> You can explore DT in sysfs or procfs and see if the changes are present
<tolszak> I decompiled fdt
<mkorpershoek> Could you have a look at: https://gitlab.baylibre.com/baylibre/amlogic/atv/u-boot/-/commit/c3f496fc3afac93fc1782e3a4d1fd097abf3a92a I will polish/send to the list if this looks ok.
<mkorpershoek> narmstrong: i've not found any generic USB role switch via DM_USB. However, i've found another trick to do the mode switching with DM_USB_GADGET=y
<mkorpershoek> Besides testing fastboot, UMS and reading a flash drive from U-boot, anything else you want me to test for this ?
<tolszak> narmstrong: xdarklight: That's my decompile /sys/frimware/fdt http://dpaste.com//GCGQAZQPR no idea if usb0 is enabled or now. All devices related to usb have status "okay"
<narmstrong> mkorpershoek: this is a nice trick !
<tolszak> xdarklight: Disclaimer - I never configured device tree in past. But seems like in meson-gxbb.dtsi meson-gxl-usb2-phy is set as compatible but I don't see usb2_phy defind anywhere like on other models. Moreover usb0 and usb1 has phy-names = "usb2-phy". Is it ok?
<xdarklight> tolszak: can you please pastebin your kernel log? I have to head to my next meeting in a few minutes, but I'll get back to you later tonight
<xdarklight> tolszak: also now that I think about it again: we probably have to pull a GPIO HIGH/LOW to enable VBUS
<narmstrong> wait I think the C2 has a jumper to select the power source, no ?
<narmstrong> tolszak: yes both phys and usb controllers are enabled
<narmstrong> mkorpershoek: could you clean the serie so I can test if the same works on GX ?
<tolszak> narmstrong: There is J1 I need to check what it is. The jumper is not applied
<mkorpershoek> narmstrong: I'm on it. will clean and send to the mailing list.
<narmstrong> mkorpershoek: great !
<tolszak> narmstrong: It would be need to applied if micro usb act in device mode. docs: "Remove the Jumper on J1 if you don't use the USB OTG port as a power input"
<tolszak> xdarklight: Will send log soon.
<tolszak> xdarklight: That's dmesg just after boot http://dpaste.com//2ZHXJGP9J
<xdarklight> tolszak: great, your .dts changes are correct as it has identified both USB controllers. I think it's indeed the VBUS GPIO that's missing/in the incorrect state
<xdarklight> tolszak: I'll get back to you on this later - if you find a solution in the meantime then please ping me here again
<tolszak> xdarklight: Can I do it in dts? I mean enable vbus?
<tolszak> xdarklight: meson-gxbb-p20x.dtsi looks similar to odroidc2, it doesn't set phy-supply on &usb1_phy. I removed phy-supply = <&usb_otg_pwr>; and seems working. Is it a coincidence or correct solution?
<narmstrong> tolszak: it's probably a correct solution, USB is a mess on odroid-c2 anyway
<mkorpershoek> narmstrong: i've send the series. hope I covered enough with it
<tolszak> narmstrong: TY
jernej has joined #linux-amlogic
<narmstrong> mkorpershoek: thanks I’ll review and test it on my side
<mkorpershoek> please be extra cautious. I'm fairly novice on USB related things
<tolszak> xdarklight: Hello, seems like micro usb doesnt' start when nothing is plugged in during boot. When I plug in something I see: VCC3V3: disabling
<tolszak> xdarklight: The case to use microusb hub was to have separate power and be able to run 2 webcams 720p 60fps. seems like Micro USB and regular usb hub shares the same power source? Do you know if there is separate power source and have micro usb as separate hub?
JohnnyonF has joined #linux-amlogic
vagrantc has joined #linux-amlogic
JohnnyonFlame has quit [Ping timeout: 260 seconds]
Danct12 has joined #linux-amlogic
<xdarklight> tolszak: I need to check the schematics again. but it's a known issue (that I forgot to mention) that USB hotplug does not work on Odroid-C1/C2. the hotplug issue is also present for the USB host ports, but I see that you have something plugged in at boot so you probably haven't hit that case before yet
Daanct12 has joined #linux-amlogic
<xdarklight> tolszak: looking at https://dn.odroid.com/S905/Schematic/odroid-c2_rev0.2_20171114.pdf again - the USB part is confusing. I *believe* (but have no proof) that there's two separate PWREN signals for USB: 1) is for the USB host ports and derived from VCC3V3 2) is for the micro USB port and is managed by GPIOAO_5. based on *my* understanding dropping &usb_otg_pwr from &usb1_phy makes sense
Danct12 has quit [Ping timeout: 260 seconds]
<tolszak> xdarklight: Is it all that is needed? So now usb1 is regular host hub powered by VCC3v3 and usb 0 is powered by otg power
<tolszak> in dts it is signaled by: "GPIOAO_5 GPIO_ACTIVE_HIGH"
buzzmarshall has joined #linux-amlogic
<xdarklight> tolszak: hard to say for sure, I don't have an Odroid-C2 myself so I can just go with what I see in the schematics and what others find during testing
<tolszak> narmstrong: Seems like you are right though.
<tolszak> xdarklight: ^
<xdarklight> tolszak: can you please also pastebin the output of "cat /sys/kernel/debug/gpio"? (just for me to verify that everything matches my expectations)
<tolszak> xdarklight: http://dpaste.com//8TQCKDY73
<tolszak> xdarklight: I might have replug micro usb since last reboot
<tolszak> I'm not sure if it makes a difference
GNUtoo has quit [Ping timeout: 255 seconds]
<tolszak> xdarklight: Also reboot doesn't work on odroid c2
<xdarklight> tolszak: weird: "gpio-502 (USB OTG Power En |regulator-usb-pwrs ) out lo" - I expected this to be "out hi"
GNUtoo has joined #linux-amlogic
<xdarklight> tolszak: hmm, not sure what the issue with reboot is, can't remember anyone else reporting this
<tolszak> xdarklight: Sorry for that, it is irrelevant for now.
<tolszak> xdarklight: What about vin-supply = <&p5v0>; in usb_otg_pwr perhaps I don't understand schematics
<tolszak> xdarklight: Isn't it only used on USB_B hub?
<tolszak> xdarklight: gpio-502 (USB OTG Power En |regulator-usb-pwrs ) out hi
<tolszak> xdarklight: Only when booted with device plugged in
<tolszak> narmstrong: Dooh there is no crpufreq in Odroid C2 in /sys/devices/system/cpu
<narmstrong> xdarklight: this is not normal
<narmstrong> xdarklight: oops wrong person
<narmstrong> tolszak: this is normal
<tolszak> narmstrong: no scaling governors?
<narmstrong> tolszak: the scpi must have failed to probe
<tolszak> narmstrong:
<tolszak> &scpi_clocks {
<tolszak> >---status = "disabled";
<tolszak> };
<tolszak> in meson-gxbb-odroidc2.dts
<tolszak> narmstrong: You disabled it in 2017
<tolszak> f7bcd4b6f6983d668b057dc166799716690423a4
<narmstrong> :-/
<narmstrong> I don’t remember but the reason must have been solid
<tolszak> narmstrong: http://dpaste.com//FHDY77QLQ
<narmstrong> Yep it’s a problem when opp tables are in firmware and there’s no way to add limits of filter out some opps
<tolszak> narmstrong: If the hw is tested to work with max_freq "1752" and the software I use. Is it a way to set it in yocto?
<narmstrong> Anyway the cpu are at maximum freq at boot so you won’t gain anything with dvfs
<tolszak> I mean I think I need to that get fluent 60fps
<tolszak> actually only 2 cores are loaded like 60-70% all the time.
<tolszak> Or perhaps less I don't remember
JohnnyonFlame has joined #linux-amlogic
JohnnyonF has quit [Ping timeout: 260 seconds]
<tolszak> narmstrong: Does it mean I can't go higher that 1536?
<narmstrong> tolszak: you could re-enable scpi, use user space cpufreq governor and set 1752
<tolszak> narmstrong: Yeah I reverted your patch, but I think I need to enable CONFIG_CPU_FREQ cause still it is not in sysfs
<tolszak> narmstrong: forget about it, I forgot to copy patch to yocto layer. Working too long today
<xdarklight> tolszak: RE vin-supply = <&p5v0>; in &usb_otg_pwr - this means: "the P5V0 (main 5V power input) provides the input voltage for the USB_OTG_PWR regulator [which is controlled by GPIOAO_5]". the power for the USB hub is P5V0 directly, without an additional regulator (controlled by a GPIO) in between
<tolszak> xdarklight: Seems like it works stable as long as something is connected to microsd before boot and not disconnected afterwards
<xdarklight> tolszak: s/microsd/micro USB/ ?
<tolszak> yes, thanks, late a bit for me :)
<xdarklight> no worries :)
<tolszak> xdarklight: I suppose Neil is away already, maybe you know how to expose cpufreq?
<xdarklight> tolszak: still strange that the GPIO is toggling from "out lo" to "out hi" depending on whether something's connected to the hub
<xdarklight> tolszak: set &scpi_clocks to status = "okay", then boot Linux, hope that it doesn't crash (due to SCPI firmware with "too high frequencies") and then check "cat /sys/bus/cpu/devices/cpu0/cpufreq/scaling_max_freq"
<xdarklight> if scaling_max_freq returns 1.54GHz then everything is fine, if it returns a higher number then your system may be unstable. they did some weird thing with the SCPI firmware (responsible for managing the CPU clocks on the GXBB/GXL/GXM SoCs) where they allow up to 2GHz. the problem with that approach: 2GHz are only valid if only one core is enabled, but they're still exposing the 2GHz frequency point even if all four cores are enabled...
<tolszak> cpu0 has onlye this: cache/ cpu_capacity hotplug/ of_node/ online power/ regs/ subsystem/ topology/ uevent
<xdarklight> most likely because &scpi_clocks is still disabled
<tolszak> xdarklight: work-shared/hardkernel-odroidc2/kernel-source/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts has spi_clocks status = "okay"
<tolszak> I will decomplie fdt
<tolszak> xdarklight: seems like it is enabled https://dpaste.com//4MK9VM4QR
<xdarklight> tolszak: hmm, do you have CONFIG_ARM_SCPI_CPUFREQ=y and CONFIG_COMMON_CLK_SCPI=y in your kernel .config?
<tolszak> xdarklight: yes
<xdarklight> tolszak: can you please pastebin the output of "cat /sys/kernel/debug/clk/clk_summary"?
<tolszak> xdarklight: http://dpaste.com//G4F8Z3ZKS
<xdarklight> tolszak: weird, the "vcpu" (SCPI) clock is missing
<tolszak> xdarklight: But you see it is okay in decompiled fdt
<xdarklight> tolszak: yep, typically it's either the OF node being disabled or the driver not compiled (in). but you seem to have both
<tolszak> xdarklight: I have everything enabled in Clock support for Almogic platforms
<xdarklight> tolszak: that's good. please note that CONFIG_COMMON_CLK_SCPI is outside of the Amlogic menu. let me check something
<tolszak> xdarklight: Yes, I know, it is enabled too
<tolszak> xdarklight: Be back in 5 minutes
<xdarklight> tolszak: I'm missing the following line in your log: "scpi_protocol scpi: SCP Protocol legacy pre-1.0 firmware"
<xdarklight> tolszak: hmm, but I'm looking at http://dpaste.com//8TQCKDY73 which is probably before you enabled &scpi_clocks
<tolszak> xdarklight: where should it be? in dmesg?
<xdarklight> tolszak: yep, in dmesg
<tolszak> xdarklight: http://dpaste.com//BUYBNZEZT
<tolszak> That's clean boot
<tolszak> CONFIG_ARM_SCPI_PROTOCOL=y
<tolszak> CONFIG_ARM_SCPI_POWER_DOMAIN=y
<tolszak> In config
<tolszak> xdarklight: Instead of reverting this patch: f7bcd4b6f6983d668b057dc166799716690423a4 I just set scpi_clocks ststus to okay
<tolszak> in meson-gxbb-odroidc2.dts
<xdarklight> tolszak: that approach is fine
<xdarklight> tolszak: do you have CONFIG_PLATFORM_MHU=y ?
JohnnyonFlame has quit [Ping timeout: 248 seconds]
naoki has joined #linux-amlogic
<tolszak> xdarklight: nope
<tolszak> xdarklight: Onlye CONFIG_ARM_MHU=y
<xdarklight> tolszak: please enable it and try again. it's the mailbox driver that SCPI uses for communication
<tolszak> xdarklight: I;m sorry it will take a few minutes more. I;m rebuilding whole image again.
<tolszak> xdarklight: scpi_protocol scpi: SCP Protocol legacy pre-1.0 firmware and cpufreq is there
<tolszak> xdarklight: Many many thanks!
<tolszak> perhaps it should be added to default config
<xdarklight> tolszak: great! :-) it's already part of arch/arm64/configs/defconfig
<tolszak> xdarklight: So why I don't have it?
<tolszak> I use meta meson kirstone
<xdarklight> tolszak: maybe it's missing somewhere in the yocto configs? I'm not familiar with yocto though, so I don't have any starting point for you :/
<tolszak> xdarklight: Now I need to insert 1752 into scalin_availabel_frequencies
<xdarklight> tolszak: so you want to overclock?
<tolszak> xdarklight: previously the device was working ok with 1752
<tolszak> for many years
<tolszak> the stability requirements from https://wiki.odroid.com/odroid-c2/application_note/software/set_cpu_freq are met
<xdarklight> tolszak: ah, I've never done this on GXBB/GXL/GXM before. with newer SoCs it's easy as the frequency table is part of the .dtb. I thought that there's a toggle in the vendor u-boot, but I'm not sure
JohnnyonFlame has joined #linux-amlogic
<xdarklight> tolszak: ah, in that odroid wiki link: setenv max_freq "1752" # 1.752GHz
<xdarklight> tolszak: do you have vendor u-boot or mainline u-boot?
<tolszak> xdarklight: Yes but it is for vendor u-boot
<tolszak> I use meta-meson uboot which is stock one I think
<xdarklight> tolszak: ah, I never looked into how that max_freq setting is passed to the SCP firmware in vendor u-boot. but I'm sure this setting is not available in upstream u-boot yet
<xdarklight> tolszak: Linux just communicates with the SCP which presents all values it "knows" (or which are unlocked). so the question is: how to get this value into the SCP firmware
<tolszak> xdarklight: :-(
<tolszak> xdarklight: There is an option to boot using vendor u-boot
<tolszak> I will give it a try
tolszak has quit [Ping timeout: 260 seconds]
jernej has quit [Ping timeout: 248 seconds]