Odroid C2 mainline kernel support

Moderators: mdrjr, odroid

Re: Odroid C2 mainline kernel support

Unread postby graysky » Sun Jul 23, 2017 1:40 am

brad wrote:
graysky wrote:I can't try myself, but since you built that kernel with those patches, can you comment on whether or not cpu governors are available under it?

CODE: SELECT ALL
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor


not by default as on some versions of the bootloader it can run to fast and crash on startup. to enable you have to edit the device tree and remove the scpi_clocks disabled https://github.com/ioft/linux/commit/31 ... 3c6f18bfb1

once done this and recompiled the meson-gxbb-odroidc2.dtb it becomes avaliable
Code: Select all
odroid@odroid64:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
250000
odroid@odroid64:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
ondemand


Wow, that's great to learn, thank you.
User avatar
graysky
 
Posts: 122
Joined: Wed Jul 13, 2016 9:11 am
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Sun Jul 23, 2017 1:10 pm

graysky wrote:you have to edit the device tree and remove the scpi_clocks disabled


Is there an fdt command that can be stuck in boot.ini to do this?
campbell
 
Posts: 296
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby brad » Mon Jul 24, 2017 11:14 am

campbell wrote:
graysky wrote:you have to edit the device tree and remove the scpi_clocks disabled


Is there an fdt command that can be stuck in boot.ini to do this?


It appears it would be possible, I want to use ftd feature as well to change other things in the device tree I will try enabling the scpi clocks first using this method and report back when I have a chance.
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby best_odroidfreak » Tue Jul 25, 2017 6:59 am

brad wrote:
campbell wrote:
graysky wrote:clocks
.

Hi Brad!
Please answer, can anybody modify and compile the i2s driver (Linux Kernel 4.14) to allow Odroid C2 works in slave mode for bit-perfect playback?
Maybe is it possible to avoid using that boards (see this link http://bbb.ieero.com ) to connect DAC to Odroid C2 via I2s interface ?
best_odroidfreak
 
Posts: 364
Joined: Wed May 04, 2016 1:07 am
languages_spoken: english

Re: Odroid C2 mainline kernel support

Unread postby brad » Tue Jul 25, 2017 10:57 am

best_odroidfreak wrote:
brad wrote:
campbell wrote:
graysky wrote:clocks
.

Hi Brad!
Please answer, can anybody modify and compile the i2s driver (Linux Kernel 4.14) to allow Odroid C2 works in slave mode for bit-perfect playback?
Maybe is it possible to avoid using that boards (see this link http://bbb.ieero.com ) to connect DAC to Odroid C2 via I2s interface ?


Im not really sure, I now have uda1380 board which I am attempting to control via i2c interface but having some troubles incorporating the control into the device tree.

I haven't attempted anything in i2s slave mode as yet.
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby brad » Tue Jul 25, 2017 5:33 pm

campbell wrote:
graysky wrote:you have to edit the device tree and remove the scpi_clocks disabled


Is there an fdt command that can be stuck in boot.ini to do this?


It seems to work well in the hardkernel uboot im using at the moment, 1 new line to setup a dtbmods command and added ${dtbmods} to the bootcmd line.

Ensure you have your firmware up to date in uboot as some versions can allow the kernel to run to fast and crash on boot.

Code: Select all
setenv kernel  "fatload mmc 0:1 0x1080000 uImage"
setenv dtb     "fatload mmc 0:1 0x1000000 meson-gxbb-odroidc2.dtb"
setenv bootseq "bootm 0x1080000 - 0x1000000"
setenv dtbmods "fdt addr 0x1000000; fdt set /scpi/clocks status okay"
setenv bootcmd "${kernel}; ${dtb}; ${dtbmods}; ${bootseq}"
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby oreggin » Wed Jul 26, 2017 10:54 pm

Hi everybody,

I using Arch Linux ARM distro to follow mainline development.
With mainline kernel 4.13-rc2 and mainline uboot 2017.07, could I see anything on HDMI output? If so, how to get it work?

Thanks!
oreggin
oreggin
 
Posts: 3
Joined: Thu Feb 23, 2017 8:10 pm
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Thu Jul 27, 2017 2:03 am

brad wrote:Ensure you have your firmware up to date in uboot

What exactly does this mean, and how do we check it? Is it a property of the sd card image, or does it have to be flashed onto the board itself?
campbell
 
Posts: 296
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby moon.linux » Thu Jul 27, 2017 2:35 am

Here is Neil suggested in the mailing list on getting the drm to work.
Code: Select all
The blobs delivered by HardKernel has been tweaked to work with their Amlogic kernel
fork, and it will won't work on mainline.

To have X11 running :
- a mainline meson version of xf86-video-armsoc : https://github.com/superna9999/xf86-video-armsoc
- you need to get the Amlogic libMali in : http://openlinux.amlogic.com:8000/download/ARM/filesystem/arm-buildroot-2016-08-18-5aaca1b35f.tar.gz

You can follow the HOWTO at :
https://github.com/superna9999/meson_gx_mali_450#howto
to find the correct libMali for X11.

- add an udev rule for mali (if not already the case) :
 Add a file to /etc/udev/rules.d/, perhaps called 50-mali.rules, with the following content:
KERNEL=="mali", MODE="0660", GROUP="video"

- Change the xorg configuration :
Then you should also change the /etc/X11/xorg.conf to something like :

Section "Device"
        Identifier      "Amlogic Meson DRM driver"
        Driver          "armsoc"
        Option  "DRI2"  "true"
EndSection

When X11 is running, you can get the status by running the glesgears.

There is some more docs here :
https://github.com/superna9999/OpenArenaPandora#amlogic-s905-mainline-linux


sorry: Well I have not tested this yet.
moon.linux
 
Posts: 1162
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english

Re: Odroid C2 mainline kernel support

Unread postby umiddelb » Thu Jul 27, 2017 2:42 am

campbell wrote:
brad wrote:Ensure you have your firmware up to date in uboot

What exactly does this mean, and how do we check it? Is it a property of the sd card image, or does it have to be flashed onto the board itself?

The firmware is stored on the first 2048 sectors of the µSD /eMMC card. Instructions to flash it can be found here.
You need the latest firmware in order to run a mainline kernel with cpufreq support.
umiddelb
 
Posts: 440
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Thu Jul 27, 2017 3:33 am

Also, is there anything that needs to appear in the device tree in order to enable /sys/class/gpio ?
campbell
 
Posts: 296
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby brad » Thu Jul 27, 2017 8:07 pm

campbell wrote:Also, is there anything that needs to appear in the device tree in order to enable /sys/class/gpio ?


gpio should be working. The numbers are different to hardkernel kernel pins though.

List of of pin numbers from current mainline https://git.kernel.org/pub/scm/linux/ke ... xbb-gpio.h
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Thu Jul 27, 2017 11:49 pm

I am using the Armbian mainline image from this thread viewtopic.php?f=138&t=26991 and /sys/class/gpio does not exist. What I'm wondering is if it needs to be enabled at kernel compile time, or through the device tree?
campbell
 
Posts: 296
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby campbell » Fri Jul 28, 2017 1:08 am

Does the pin number difference affect mmap access to the pins, or just sysfs? I.e. does this code http://odroid.com/dokuwiki/doku.php?id= ... ck_program need to be modified in order to work correctly with the new kernel?
campbell
 
Posts: 296
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby brad » Fri Jul 28, 2017 10:45 am

campbell wrote:Does the pin number difference affect mmap access to the pins, or just sysfs? I.e. does this code http://odroid.com/dokuwiki/doku.php?id= ... ck_program need to be modified in order to work correctly with the new kernel?


That program looks at the registers rather than in the kernel for details. It will report the incorrect pin numbers for mainline kernel (pin numbers are hardcoded into that program)

Im not sure what version of kernel Arch is using but I was of the understanding GPIO had been enabled by default for some time
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Fri Jul 28, 2017 12:58 pm

So if I want to write a C program that toggles gpio126 (in the kernel 3.14.x numbering) and run it under kernel 4.12, what should I do?
campbell
 
Posts: 296
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby brad » Fri Jul 28, 2017 4:52 pm

campbell wrote:So if I want to write a C program that toggles gpio126 (in the kernel 3.14.x numbering) and run it under kernel 4.12, what should I do?


Let me look at this further tomorrow, I may have set an option in my kernel config to export the gpio control to /sys (this may be non default)

Another way to access GPIO control from C might be directly through the gpio API in the kernel http://elixir.free-electrons.com/linux/ ... nux/gpio.h
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby mad_ady » Fri Jul 28, 2017 8:13 pm

Regarding gpio numbers, as far as I remember they were all shifted by a fixed offset
User avatar
mad_ady
 
Posts: 4601
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid C2 mainline kernel support

Unread postby hhh1 » Sat Jul 29, 2017 4:11 am

campbell wrote:So if I want to write a C program that toggles gpio126 (in the kernel 3.14.x numbering) and run it under kernel 4.12, what should I do?

read the previous page of this thread.
hhh1
 
Posts: 46
Joined: Wed Jun 15, 2016 3:35 am
languages_spoken: english
ODROIDs: c1 c1+ c2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Sat Jul 29, 2017 11:39 am

hhh1 wrote:
campbell wrote:So if I want to write a C program that toggles gpio126 (in the kernel 3.14.x numbering) and run it under kernel 4.12, what should I do?

read the previous page of this thread.

Yes, but I want to do it from C via mmap(), not via /sys/class/gpio (because it doesn't appear to be enabled yet in the Armbian mainline image) and what I'm asking about is how to do that for pin 126 in the old numbering (since it's not one of the ones in that gpio_status tool), and whether there would be any difference between the 3.14 and 4.12 numbering if NOT going through sysfs.

The reason I want to do this is to see if the USB bus is powered up or not, by measuring whether the overall power consumption goes up or down from its baseline value depending on the state of that pin. I DON'T want USB, and I want to make sure I'm getting the full power savings from having it powered down. In the old kernel I would do this by driving pin 126 low via sysfs.
campbell
 
Posts: 296
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby brad » Sun Jul 30, 2017 9:39 am

campbell wrote:Yes, but I want to do it from C via mmap(), not via /sys/class/gpio (because it doesn't appear to be enabled yet in the Armbian mainline image) and what I'm asking about is how to do that for pin 126 in the old numbering (since it's not one of the ones in that gpio_status tool), and whether there would be any difference between the 3.14 and 4.12 numbering if NOT going through sysfs.

The reason I want to do this is to see if the USB bus is powered up or not, by measuring whether the overall power consumption goes up or down from its baseline value depending on the state of that pin. I DON'T want USB, and I want to make sure I'm getting the full power savings from having it powered down. In the old kernel I would do this by driving pin 126 low via sysfs.


CONFIG_GPIO_SYSFS is the kernel config parameter you need for /sys/class/gpio something that is not normally enabled by default. It appear the USB power control pin is GPIOAO_5 (pin 5) but it is is under control by the usb drivers when usb drivers are loaded....

Code: Select all
root@odroid64:~# echo "5" > /sys/class/gpio/export
-su: echo: write error: Device or resource busy


We can enable scpi for cpufreq and disable usb in the device tree at boot...

Code: Select all
setenv dtbmods "fdt addr 0x1000000; fdt set /scpi/clocks status okay; fdt rm /soc/phy@c0000000; fdt rm /soc/phy@c0000020; fdt rm /soc/usb@c9000000; fdt rm /soc/usb@c9100000; fdt rm /regulator-usb-pwrs"
setenv bootcmd "${kernel}; ${dtb}; ${dtbmods}; ${bootseq}"


To confirm (I have /sys/class/gpio interface enabled in kernel config) I can now export pin 5 (usb power) and check its value which is disabled...

Code: Select all
odroid@odroid64:~$ lsusb
odroid@odroid64:~$ su -
Password:
root@odroid64:~# echo "5" > /sys/class/gpio/export
root@odroid64:~#
root@odroid64:~# cat /sys/class/gpio/gpio5/
active_low  direction   subsystem/  value       
device/     power/      uevent     
root@odroid64:~# cat /sys/class/gpio/gpio5/value
0


Edit: alternatively you might have some luck disabling power to all of the usb ports in the running kernel allowing it to suspend usb power (Something like this for all 5 ports but im not sure if it will set the usb power pin low for the controller testing would be required)...

Code: Select all
root@odroid64:~# echo 0 >  /sys/bus/usb/devices/1-1\:1.0/1-1-port1/power/pm_qos_no_power_off
root@odroid64:~# echo 0 >  /sys/bus/usb/devices/1-1\:1.0/1-1-port2/power/pm_qos_no_power_off
root@odroid64:~# echo 0 >  /sys/bus/usb/devices/1-1\:1.0/1-1-port3/power/pm_qos_no_power_off
root@odroid64:~# echo 0 >  /sys/bus/usb/devices/1-1\:1.0/1-1-port4/power/pm_qos_no_power_off
root@odroid64:~# echo 0 >  /sys/bus/usb/devices/1-0\:1.0/usb1-port1/power/pm_qos_no_power_off
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Sun Jul 30, 2017 10:54 am

brad,

Do you think setting all five of those pins low results in more power savings than setting pin 126 low did in the old kernel? I'm still trying to figure out the source of the >170 mW difference between the old and new kernels.
campbell
 
Posts: 296
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby brad » Sun Jul 30, 2017 11:20 am

campbell wrote:brad,

Do you think setting all five of those pins low results in more power savings than setting pin 126 low did in the old kernel? I'm still trying to figure out the source of the >170 mW difference between the old and new kernels.


Setting all USB port to low I was hoping would then suspend the usb power regulator (we cant actually control each port (no pin) individually due to hardware design so im not too sure)

I dont have a current meter to test at the moment sorry.
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby best_odroidfreak » Sun Jul 30, 2017 3:02 pm

Сan anybody write a driver to use Odroid C2 in Slave Mode (DAC in Master Mode) or use Miroslav Rudišin I2s driver https://github.com/miero if it possible for Odroid C2?
best_odroidfreak
 
Posts: 364
Joined: Wed May 04, 2016 1:07 am
languages_spoken: english

Re: Odroid C2 mainline kernel support

Unread postby campbell » Mon Jul 31, 2017 6:57 am

brad wrote:
Code: Select all
setenv dtbmods "fdt addr 0x1000000; fdt set /scpi/clocks status okay; fdt rm /soc/phy@c0000000; fdt rm /soc/phy@c0000020; fdt rm /soc/usb@c9000000; fdt rm /soc/usb@c9100000; fdt rm /regulator-usb-pwrs"
setenv bootcmd "${kernel}; ${dtb}; ${dtbmods}; ${bootseq}"

This results in a reduction of about 50 milliwatts. On the Armbian mainline image, in a warm room, with the stock heatsink, with ifconfig eth0 down and the conservative governor, I get about 0.893 W at idle before applying the above. After applying the above it drops to 0.839 W. I'd like to try this same change in the 3.14 kernel but most of the above doesn't seem to exist in the device tree on the stock Hardkernel odroid image. Any hints?

brad wrote:
Code: Select all
root@odroid64:~# echo 0 >  /sys/bus/usb/devices/1-1\:1.0/1-1-port1/power/pm_qos_no_power_off
root@odroid64:~# echo 0 >  /sys/bus/usb/devices/1-1\:1.0/1-1-port2/power/pm_qos_no_power_off
root@odroid64:~# echo 0 >  /sys/bus/usb/devices/1-1\:1.0/1-1-port3/power/pm_qos_no_power_off
root@odroid64:~# echo 0 >  /sys/bus/usb/devices/1-1\:1.0/1-1-port4/power/pm_qos_no_power_off
root@odroid64:~# echo 0 >  /sys/bus/usb/devices/1-0\:1.0/usb1-port1/power/pm_qos_no_power_off

Applying this (separately from the above) results in no change at all.
campbell
 
Posts: 296
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby campbell » Mon Jul 31, 2017 10:31 am

hhh1 wrote:The offset is -122
For example gpio 233 on 3.14 is gpio 111 on 4.12

brad wrote:CONFIG_GPIO_SYSFS is the kernel config parameter you need for /sys/class/gpio something that is not normally enabled by default. It appear the USB power control pin is GPIOAO_5 (pin 5) but it is is under control by the usb drivers when usb drivers are loaded....

Code: Select all
root@odroid64:~# echo "5" > /sys/class/gpio/export
-su: echo: write error: Device or resource busy

Wouldn't an offset of -122 mean that it pin 126 becomes pin 4, rather than 5, in the new numbering?
campbell
 
Posts: 296
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby brad » Mon Jul 31, 2017 8:59 pm

campbell wrote:
hhh1 wrote:The offset is -122
For example gpio 233 on 3.14 is gpio 111 on 4.12

brad wrote:CONFIG_GPIO_SYSFS is the kernel config parameter you need for /sys/class/gpio something that is not normally enabled by default. It appear the USB power control pin is GPIOAO_5 (pin 5) but it is is under control by the usb drivers when usb drivers are loaded....

Code: Select all
root@odroid64:~# echo "5" > /sys/class/gpio/export
-su: echo: write error: Device or resource busy

Wouldn't an offset of -122 mean that it pin 126 becomes pin 4, rather than 5, in the new numbering?


This seems correct and I think I am misunderstanding, from the odroid c2 schematics

Amlogic GPIOAO_4 - Pin 126 hardkernel (4 new kernel) is USB hub RST_N
Amlogic GPIOAO_5 - Pin 127 hardkernel (5 new kernel) is OTG power enable

When I check the device tree in new kernel again

Code: Select all
/*
    * WARNING: The USB Hub on the Odroid-C2 needs a reset signal
    * to be turned high in order to be detected by the USB Controller
    * This signal should be handled by a USB specific power sequence
    * in order to reset the Hub when USB bus is powered down.
    */
   usb-hub {
      gpio-hog;
      gpios = <GPIOAO_4 GPIO_ACTIVE_HIGH>;
      output-high;
      line-name = "usb-hub-reset";
   };


And for OTG power enable

Code: Select all
   usb_otg_pwr: regulator-usb-pwrs {
      compatible = "regulator-fixed";

      regulator-name = "USB_OTG_PWR";

      regulator-min-microvolt = <5000000>;
      regulator-max-microvolt = <5000000>;

      gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
      enable-active-high;
   };


So it seems the reset signal (hardkernel 126) acts similar to power enable for 4 port hub (ie must be high for it to stay powered on)
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Tue Aug 01, 2017 12:30 am

So one thing that makes me a bit nervous is we seem to have lost the ability to toggle the USB bus on and off by toggling that pin from userland...now it requires a device tree edit and a reboot?
campbell
 
Posts: 296
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby brad » Tue Aug 01, 2017 6:47 am

campbell wrote:So one thing that makes me a bit nervous is we seem to have lost the ability to toggle the USB bus on and off by toggling that pin from userland...now it requires a device tree edit and a reboot?


Yes the usb driver takes hold of the pins, they are not avaliabe for gpio with driver loaded
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby campbell » Tue Aug 01, 2017 6:50 am

brad wrote:
campbell wrote:So one thing that makes me a bit nervous is we seem to have lost the ability to toggle the USB bus on and off by toggling that pin from userland...now it requires a device tree edit and a reboot?

Yes the usb driver takes hold of the pins, they are not avaliabe for gpio with driver loaded

Can the usb driver be unloaded? Is there anything at all to be done about this?
campbell
 
Posts: 296
Joined: Thu Sep 03, 2015 1:13 pm
languages_spoken: english
ODROIDs: XU3, XU4, C2, C1+, Cloudshell, Smart Power

Re: Odroid C2 mainline kernel support

Unread postby brad » Tue Aug 01, 2017 4:53 pm

campbell wrote:
brad wrote:
campbell wrote:So one thing that makes me a bit nervous is we seem to have lost the ability to toggle the USB bus on and off by toggling that pin from userland...now it requires a device tree edit and a reboot?

Yes the usb driver takes hold of the pins, they are not avaliabe for gpio with driver loaded

Can the usb driver be unloaded? Is there anything at all to be done about this?


The USB driver is builtin to the kernel (not a module) so im not sure it can be unloaded. Only real way I know is to not load it in the first place by removing from the device tree.

It might be possible to suspend all ports and then suspend the controllers but this would require investigation and testing.

The usb calls to /sys I posted earlier allow ports to be configured as suspended (pm_qos_no_power_off) . I suspect it might be possible to then suspend each of the controllers using sysfs. Its somewhat difficult for me to test anything here as I can not see the power consumption of the odroid.
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby mad_ady » Tue Aug 01, 2017 5:09 pm

Is there anything preventing the driver to be built as a module instead? Then it could be unloaded with rmmod.
User avatar
mad_ady
 
Posts: 4601
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Odroid C2 mainline kernel support

Unread postby brad » Tue Aug 01, 2017 5:26 pm

mad_ady wrote:Is there anything preventing the driver to be built as a module instead? Then it could be unloaded with rmmod.


It might, I think you would also need to build the USB PHY drivers as a module I believe. Both of these options...


CONFIG_PHY_MESON8B_USB2: │
│ │
│ Enable this to support the Meson USB2 PHYs found in Meson8b │
│ and GXBB SoCs. │
│ If unsure, say N.

CONFIG_USB_DWC2: │
│ │
│ Say Y here if your system has a Dual Role Hi-Speed USB │
│ controller based on the DesignWare HSOTG IP Core.
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby Flole » Thu Aug 03, 2017 2:41 am

Hi brad,

do you have any precompiled mainline kernel available that supports NFS and USB? Everytime I selfcompile it seems like its superslow, time is going way to slow and also refresh times of htop for examples are way to slow.

Greetings

Flole
Flole
 
Posts: 26
Joined: Thu Apr 13, 2017 10:14 pm
languages_spoken: english, german
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby crashoverride » Thu Aug 03, 2017 10:37 am

Flole wrote:time is going way to slow and also refresh times of htop for examples are way to slow.

This usually happens when a timer (arm/meson) is not properly set. Check the device tree to ensure the proper timer is enabled.
crashoverride
 
Posts: 3998
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Odroid C2 mainline kernel support

Unread postby moon.linux » Fri Aug 04, 2017 12:01 am

brad wrote:It might, I think you would also need to build the USB PHY drivers as a module I believe. Both of these options...

CONFIG_PHY_MESON8B_USB2: │
│ │
│ Enable this to support the Meson USB2 PHYs found in Meson8b │
│ and GXBB SoCs. │
│ If unsure, say N.

CONFIG_USB_DWC2: │
│ │
│ Say Y here if your system has a Dual Role Hi-Speed USB │
│ controller based on the DesignWare HSOTG IP Core.


Additional to their is another host meson-dwc2 driver needed to handle and tune runtime pm and the user-space inputs.
moon.linux
 
Posts: 1162
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english

Re: Odroid C2 mainline kernel support

Unread postby brad » Fri Aug 04, 2017 5:28 pm

Flole wrote:Hi brad,

do you have any precompiled mainline kernel available that supports NFS and USB?


I will look into that shortly, what version of NFS and mount options are you using?
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby Flole » Fri Aug 04, 2017 5:32 pm

I'm using NFS v3 as root fs (so dhcp is also needed on boot)
Flole
 
Posts: 26
Joined: Thu Apr 13, 2017 10:14 pm
languages_spoken: english, german
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby Flole » Mon Aug 07, 2017 10:28 pm

I tried to compile again and I am having the same issues. I used the same device tree that works with a different kernel. Can someone please help me out and provide me with a working build?
Flole
 
Posts: 26
Joined: Thu Apr 13, 2017 10:14 pm
languages_spoken: english, german
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby daggs » Wed Aug 09, 2017 6:56 pm

does anyone uses uboot non hardkernel without initrd/ramfs?
if so, can you share your boot.cmd?

I'm unable to get the board to boot, uboot doesn't loads up at all.
daggs
 
Posts: 219
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2

Re: Odroid C2 mainline kernel support

Unread postby daggs » Thu Aug 10, 2017 8:59 pm

now I've got stuck in both fronts :(
either uboot upgrade or kernel upgrade.
this time I'm trying to use kernel 4.12.5 with hardkernel uboot.
what I've did is took buildroot, updated the kernel version, fixed the needed entries, added the patches and compiled it with the provided config from Neil's repo.
it compiles well, I dd the image into the device, connect the power, both red and blue leds are lighted up, no flushing and serial doesn't display anything.

any idea?
daggs
 
Posts: 219
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2

Re: Odroid C2 mainline kernel support

Unread postby moon.linux » Thu Aug 10, 2017 11:33 pm

daggs wrote:now I've got stuck in both fronts :(
either uboot upgrade or kernel upgrade.
this time I'm trying to use kernel 4.12.5 with hardkernel uboot.
what I've did is took buildroot, updated the kernel version, fixed the needed entries, added the patches and compiled it with the provided config from Neil's repo.
it compiles well, I dd the image into the device, connect the power, both red and blue leds are lighted up, no flushing and serial doesn't display anything.

any idea?


First thing you need to do is use the u-boot provided by HK.
You need to modify the boot.ini as per brad's links viewtopic.php?f=135&t=22717&start=250#p188335
Code: Select all
$ mv boot.ini boot.ini.hardkernel
$ wget http://repo.builtonline.net/testing/custom/4.10.10-testing/boot.ini


Append the bootargs as per below.
Code: Select all
# Populate the final bootcmd
setenv bootargs "${console} ${bootrootfs} ${odroid} ${libreelec} fsck.repair=yes net.ifnames=0"


just compile the kernel and update the relevant files /media/boot/ partition.
moon.linux
 
Posts: 1162
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english

Re: Odroid C2 mainline kernel support

Unread postby brad » Fri Aug 11, 2017 4:47 pm

Flole wrote:I tried to compile again and I am having the same issues. I used the same device tree that works with a different kernel. Can someone please help me out and provide me with a working build?


Sorry Flole for the delay I have been away and busy, I will try to organise this weekend for you.
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby daggs » Fri Aug 11, 2017 8:29 pm

moon.linux wrote:
daggs wrote:now I've got stuck in both fronts :(
either uboot upgrade or kernel upgrade.
this time I'm trying to use kernel 4.12.5 with hardkernel uboot.
what I've did is took buildroot, updated the kernel version, fixed the needed entries, added the patches and compiled it with the provided config from Neil's repo.
it compiles well, I dd the image into the device, connect the power, both red and blue leds are lighted up, no flushing and serial doesn't display anything.

any idea?


First thing you need to do is use the u-boot provided by HK.
You need to modify the boot.ini as per brad's links viewtopic.php?f=135&t=22717&start=250#p188335
Code: Select all
$ mv boot.ini boot.ini.hardkernel
$ wget http://repo.builtonline.net/testing/custom/4.10.10-testing/boot.ini


Append the bootargs as per below.
Code: Select all
# Populate the final bootcmd
setenv bootargs "${console} ${bootrootfs} ${odroid} ${libreelec} fsck.repair=yes net.ifnames=0"


just compile the kernel and update the relevant files /media/boot/ partition.

as said, this is a different issue than the uboot upgrade.
will try and report back
daggs
 
Posts: 219
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2

Re: Odroid C2 mainline kernel support

Unread postby daggs » Fri Aug 11, 2017 8:31 pm

was fast, got the same behavior, the hk uboot commit id used is eb5d2d16fd45f52ec49e9b4ff9d562630c08e61c
daggs
 
Posts: 219
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2

Re: Odroid C2 mainline kernel support

Unread postby daggs » Fri Aug 11, 2017 10:02 pm

daggs wrote:was fast, got the same behavior, the hk uboot commit id used is eb5d2d16fd45f52ec49e9b4ff9d562630c08e61c

ok, got my serial to work, new info:
Code: Select all
GXBB:BL1:08dafd:0a8993;FEAT:EDFC318C;POC:3;RCY:0;EMMC:800;NAND:81;SD:0;READ:0;CHK:0;
TE: 309255
no sdio debug board detected

BL2 Built : 11:44:26, Nov 25 2015.
gxb gfb13a3b-c2 - jcao@wonton

Board ID = 8
set vcck to 1100 mv
set vddee to 1050 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 912MHz(2T)-13
DataBus test pass!
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x000000b0
Load bl30 from SD, src: 0x00010200, des: 0x01000000, size: 0x00009ef0
Sending bl30........................................OK.
Run bl30...
Load bl301 from SD, src: 0x0001c200, des: 0x01000000, size: 0x000012d0
Wait bl30...Done
Sending bl301.....OK.
Run bl301...
 bl31 from SD, src: 0x00020200, des: 0x10100000, size: 0x00011130


--- UART initialized after reboot ---
[Reset cause: unknown]
[Image: unknown, amlogic_v1.1.3046-00db630-dirty 2016-08-31 09:24:14 tao.zeng@droid04]
bl30: check_permit, count is 1
bl30: check_permit: ok!
chipid: ef be ad de d f0 ad ba ef be aLoad bl33 from SD, src: 0x00034200, des: 0x01000000, size: 0x00069fe0
d de not ES chip
[0.423906 Inits done]
secure task start!
high task start!
low task start!
NOTICE:  BL3-1: v1.0(debug):4d2e34d
NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
INFO:    BL3-1: Initializing runtime services
INFO:    BL3-1: Preparing for EL3 exit to normal world
INFO:    BL3-1: Next image address = 0x1000000
INFO:    BL3-1: Next image spsr = 0x3c9


U-Boot 2015.01 (Aug 10 2017 - 14:31:36)

DRAM:  2 GiB
Relocation Offset is: 76f3c000
-------------------------------------------------
* Welcome to Hardkernel's ODROID-C2
-------------------------------------------------
CPU : AMLogic S905
S/N : HKC213254DFEA579
MAC : 00:1e:06:34:f1:f9
BID : HKC2211707
-------------------------------------------------
register usb cfg[1][0] = 0000000077f97298
register usb cfg[0][1] = 0000000077f972c0
vpu detect type: 5
vpu clk_level = 7
set vpu clk: 666667000Hz, readback: 666660000Hz(0x300)
MMC:   aml_priv->desc_buf = 0x0000000073f34d30
aml_priv->desc_buf = 0x0000000073f36ec0
SDIO Port B: 0, SDIO Port C: 1
ret = 1 .[mmc_init] mmc init success
In:    serial
Out:   serial
Err:   serial
----------------------------------
MMC Size : 8 GB
----------------------------------
reading boot-logo.bmp.gz
** Unable to read file boot-logo.bmp.gz **
reading boot-logo.bmp
** Unable to read file boot-logo.bmp **
movi: the partiton 'logo' is reading...

MMC read: dev # 0, block # 61024, count 2048 ... 2048 blocks read: OK
hpd_state=1
[CANVAS]addr=0x3f800000 width=3840, height=1440

set hdmitx VIC = 16
hdmitx phy setting done
set hdmitx VIC = 16
hdmitx phy setting done
Error: Bad gzipped data
There is no valid bmp file at the given address
Net:   Meson_Ethernet
Hit [Enter] key twice to stop autoboot:  0
reading boot.ini
3346 bytes read in 4 ms (816.4 KiB/s)
cfgload: applying boot.ini...
cfgload: setenv bootrootfs "boot=/dev/mmcblk1p1 disk=/dev/mmcblk1p2 root=/dev/mmcblk1p2"
cfgload: setenv console "console=tty0 console=ttyAML0,115200n8"
cfgload: setenv odroid   "no_console_suspend consoleblank=0 loglevel=8 debug ro rootwait"
cfgload: setenv maxcpus "4"
cfgload: setenv max_freq "1536"  # 1.536GHz
cfgload: setenv kernel  "fatload mmc 0:1 0x1080000 Image"
cfgload: setenv dtb     "fatload mmc 0:1 0x1000000 meson-gxbb-odroidc2.dtb"
cfgload: setenv bootseq "bootm 0x1080000 - 0x1000000"
cfgload: setenv bootcmd "${kernel}; ${dtb}; ${bootseq}"
cfgload: setenv bootargs "${console} ${bootrootfs} ${odroid} ${libreelec} fsck.repair=yes net.ifnames=0"
cfgload: run bootcmd
reading Image
10397704 bytes read in 1006 ms (9.9 MiB/s)
reading meson-gxbb-odroidc2.dtb
20176 bytes read in 6 ms (3.2 MiB/s)
ee_gate_off ...
Wrong Image Format for bootm command
ERROR: can't get kernel image!
ee_gate_on ...
reading boot-logo.bmp.gz
** Unable to read file boot-logo.bmp.gz **
reading boot-logo.bmp
** Unable to read file boot-logo.bmp **
movi: the partiton 'logo' is reading...

MMC read: dev # 0, block # 61024, count 2048 ... 2048 blocks read: OK
hpd_state=1
set hdmitx VIC = 16
hdmitx phy setting done
set hdmitx VIC = 16
hdmitx phy setting done
Error: Bad gzipped data
There is no valid bmp file at the given address
movi: the partiton 'dtb' is reading...

MMC read: dev # 0, block # 1504, count 128 ... 128 blocks read: OK
movi: the partiton 'boot' is reading...

MMC read: dev # 0, block # 1632, count 32768 ... 32768 blocks read: OK
Bad Linux ARM64 Image magic!


from the config:
Code: Select all
dagg@NCC-5001-D ~/workspace/buildroots/buildroot-master4 $ grep -i arm board/hardkernel/odroidc2/kernel-4.12.x.config  | head
# Linux/arm64 4.12.0 Kernel Configuration
CONFIG_ARM64=y


any ideas?
daggs
 
Posts: 219
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2

Re: Odroid C2 mainline kernel support

Unread postby brad » Sat Aug 12, 2017 4:47 pm

daggs wrote:any ideas?


The hk uboot wont load mainline kernel via an Image format you need to use a uImage format so it can load from the correct entry point by using the mkimage command.
Code: Select all
mkimage -A arm64 -O linux -T kernel -C none -a 0x1080000 -e 0x1080000 -n linux -d arch/arm64/boot/Image uImage
brad
 
Posts: 709
Joined: Tue Mar 29, 2016 1:22 pm
Location: Australia
languages_spoken: english
ODROIDs: C2

Re: Odroid C2 mainline kernel support

Unread postby best_odroidfreak » Sat Aug 12, 2017 6:01 pm

brad wrote:
daggs wrote:any ideas?[/code]

What is needed for Odroid C2 audio is a general purpose I2S driver which can have its parameters set by editing a text file. We would need to be able to choose master/slave and I2S, left-justified or right-justified output format. Can any body modify this driver?
best_odroidfreak
 
Posts: 364
Joined: Wed May 04, 2016 1:07 am
languages_spoken: english

Re: Odroid C2 mainline kernel support

Unread postby daggs » Sat Aug 12, 2017 11:44 pm

brad wrote:
daggs wrote:any ideas?


The hk uboot wont load mainline kernel via an Image format you need to use a uImage format so it can load from the correct entry point by using the mkimage command.
Code: Select all
mkimage -A arm64 -O linux -T kernel -C none -a 0x1080000 -e 0x1080000 -n linux -d arch/arm64/boot/Image uImage

ok, one question, whats the diff between uImage and Image?
daggs
 
Posts: 219
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2

Re: Odroid C2 mainline kernel support

Unread postby daggs » Sun Aug 13, 2017 12:32 am

daggs wrote:
brad wrote:
daggs wrote:any ideas?


The hk uboot wont load mainline kernel via an Image format you need to use a uImage format so it can load from the correct entry point by using the mkimage command.
Code: Select all
mkimage -A arm64 -O linux -T kernel -C none -a 0x1080000 -e 0x1080000 -n linux -d arch/arm64/boot/Image uImage

ok, one question, whats the diff between uImage and Image?

found the diff, ignore.
will try your suggestion, thanks.
daggs
 
Posts: 219
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2

PreviousNext

Return to General Chat

Who is online

Users browsing this forum: No registered users and 2 guests