How can I build latest Linux kernel(not android branch) for hikey960

Hi @Robert Are you sure @xlazom00 is using the below config ?[quote=“Robert, post:32, topic:2075”]
http://paste.ubuntu.com/24976454/
[/quote]

@vchong Is it possible for you to share the config file used for kernel 4.9 building which has USB/ethernet working?

this is my .config
http://paste.ubuntu.com/25361369/

try make menuconfig to disable stuff that you don’t need
maybe you will need this ddr frequency management patch
http://paste.ubuntu.com/25361370/
or you can disable it with make menuconfig

I was also able to apply linux patch-set for kernel 4.9.x for latest version

this should enable USB on hikey 960
CONFIG_PHY_HI6220_USB=y

Thank you for the response @xlazom00. I will test this configuration and get back here.
In the meanwhile, did you build and load the modules as well?

Thank you sir,

so, for the lastest patch I got “patch-4.9.44.xz” from https://www.kernel.org/

I will try again nd get back here soon.

Kernel is configured without modules
so usb drivers should work just fine :slight_smile:

Hi @Robert, any update at your end? The kernel seems to register new interfaces when i build with http://paste.ubuntu.com/25361369/ config after applying http://paste.ubuntu.com/25361370/ patch.

{{{
root@hikey960:~# dmesg | grep -i usb
[ 1.716389] usbcore: registered new interface driver usbfs
[ 1.716416] usbcore: registered new interface driver hub
[ 1.716475] usbcore: registered new device driver usb
[ 1.860198] pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver
[ 1.860229] usbcore: registered new interface driver pegasus
[ 1.860252] usbcore: registered new interface driver rtl8150
[ 1.860275] usbcore: registered new interface driver r8152
[ 1.860298] usbcore: registered new interface driver asix
[ 1.860322] usbcore: registered new interface driver ax88179_178a
[ 1.860346] usbcore: registered new interface driver cdc_ether
[ 1.860369] usbcore: registered new interface driver dm9601
[ 1.860393] usbcore: registered new interface driver CoreChips
[ 1.860417] usbcore: registered new interface driver smsc75xx
[ 1.860439] usbcore: registered new interface driver smsc95xx
[ 1.860462] usbcore: registered new interface driver net1080
[ 1.860486] usbcore: registered new interface driver plusb
[ 1.860510] usbcore: registered new interface driver cdc_subset
[ 1.860533] usbcore: registered new interface driver zaurus
[ 1.860557] usbcore: registered new interface driver MOSCHIP usb-ethernet driver
[ 1.860584] usbcore: registered new interface driver cdc_ncm
[ 1.860743] [USB3][hisi_dwc3_probe]+
[ 1.860860] [USB3][get_phy_param]eye diagram param: 0x1c466e3
[ 1.860865] [USB3][get_phy_param]eye diagram host param: 0x1c466e3
[ 1.860870] [USB3][get_phy_param]usb3_phy_cr_param: 0xb80
[ 1.860874] [USB3][get_phy_param]usb3_phy_host_cr_param: 0x980
[ 1.860878] [USB3][get_phy_param]usb3_phy_tx_vboost_lvl: 5
[ 1.860900] [USB3][get_resource]this is asic platform (fpga flag 0)
[ 1.860904] [USB3][create_attr_file]+
[ 1.860961] [USB3][create_attr_file]-
[ 1.860967] [USB3][hi3660_usb3phy_init]+
[ 1.878090] [USB3][config_femtophy_param]set hs phy param 0x1c466e3 for device
[ 1.878497] [USB3][config_femtophy_param]set ss phy rx equalization 0xb80
[ 1.879205] [USB3][config_femtophy_param]set ss RX_SCOPE_VDCC 0x1
[ 1.879210] [USB3][config_femtophy_param]set ss phy tx vboost lvl 0x5
[ 1.879214] [USB3][set_hisi_dwc3_power_flag]set hisi_dwc3_power_flag 1
[ 1.879217] [USB3][hi3660_usb3phy_init]-
[ 1.879890] [USB3][hisi_dwc3_wake_lock]usb otg wake lock
[ 1.879896] [USB3][hisi_dwc3_probe]init state: OFF
[ 1.879901] [USB3][hisi_usb_otg_event]hisi_usb_otg_event in otg:1
[ 1.879913] [USB3][hisi_usb_otg_event]event: 1
[ 1.879918] [USB3][hisi_usb_otg_event]hisi_usb_otg_event in:1
[ 1.879922] [USB3][event_work]+
[ 1.879925] [USB3][handle_event][handle_event] type: 1
[ 1.879931] [USB3][handle_event]cancel bc_again_work sync:0
[ 1.879936] [USB3][hisi_dwc3_probe]-
[ 1.879939] [USB3][hisi_dwc3_wake_unlock]usb otg wake unlock
[ 1.879945] [USB3][handle_event]hisi usb status: DEVICE → OFF
[ 1.879948] [USB3][event_work]-
[ 1.880368] ehci_hcd: USB 2.0 ‘Enhanced’ Host Controller (EHCI) Driver
[ 1.880506] ohci_hcd: USB 1.1 ‘Open’ Host Controller (OHCI) Driver
[ 1.880834] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[ 1.881247] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 1.881253] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1.881258] usb usb1: Product: xHCI Host Controller
[ 1.881262] usb usb1: Manufacturer: Linux 4.9.20_nl-00044-gde0e3c4 xhci-hcd
[ 1.881267] usb usb1: SerialNumber: xhci-hcd.0.auto
[ 1.881596] hub 1-0:1.0: USB hub found
[ 1.881798] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
[ 1.881833] usb usb2: We don’t know the algorithms for LPM for this host, disabling LPM.
[ 1.881884] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
[ 1.881889] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1.881893] usb usb2: Product: xHCI Host Controller
[ 1.881897] usb usb2: Manufacturer: Linux 4.9.20_nl-00044-gde0e3c4 xhci-hcd
[ 1.881901] usb usb2: SerialNumber: xhci-hcd.0.auto
[ 1.882190] hub 2-0:1.0: USB hub found
[ 1.882426] usbcore: registered new interface driver cdc_acm
[ 1.882430] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 1.882470] usbcore: registered new interface driver usb-storage
[ 1.882524] usbcore: registered new interface driver usbserial
[ 1.882547] usbcore: registered new interface driver usbserial_generic
[ 1.882570] usbserial: USB Serial support registered for generic
[ 1.882596] usbcore: registered new interface driver ftdi_sio
[ 1.882617] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 1.882671] usbcore: registered new interface driver option
[ 1.882692] usbserial: USB Serial support registered for GSM modem (1-port)
[ 1.882760] usbcore: registered new interface driver pl2303
[ 1.882782] usbserial: USB Serial support registered for pl2303
[ 1.882810] usbcore: registered new interface driver qcserial
[ 1.882831] usbserial: USB Serial support registered for Qualcomm USB modem
[ 1.882863] usbcore: registered new interface driver usb_serial_simple
[ 1.882884] usbserial: USB Serial support registered for carelink
[ 1.882905] usbserial: USB Serial support registered for zio
[ 1.882925] usbserial: USB Serial support registered for funsoft
[ 1.882945] usbserial: USB Serial support registered for flashloader
[ 1.882967] usbserial: USB Serial support registered for google
[ 1.882988] usbserial: USB Serial support registered for vivopay
[ 1.883008] usbserial: USB Serial support registered for moto_modem
[ 1.883029] usbserial: USB Serial support registered for novatel_gps
[ 1.883051] usbserial: USB Serial support registered for hp4x
[ 1.883071] usbserial: USB Serial support registered for suunto
[ 1.883091] usbserial: USB Serial support registered for siemens_mpi
[ 1.941850] usbcore: registered new interface driver usbhid
[ 1.941852] usbhid: USB HID core driver
[ 1.942729] usbcore: registered new interface driver snd-usb-audio
[ 2.218381] dpm_caps: local_usb_comm
[ 2.218384] dpm_caps: local_usb_suspend
[ 3.080847] [USB3][hisi_usb_otg_event]hisi_usb_otg_event in otg:1
[ 3.086948] [USB3][hisi_usb_otg_event]hisi_usb_otg_event in:1
[ 3.092695] [USB3][hisi_usb_otg_event]hisi_usb_otg_event in otg:2
[ 3.098789] [USB3][hisi_usb_otg_event]event: 2
[ 3.098795] [USB3][hisi_usb_otg_event]hisi_usb_otg_event in:2
[ 3.099607] [USB3][event_work]+
[ 3.099612] [USB3][handle_event][handle_event] type: 2
[ 3.099616] [USB3][set_vbus_power]set port power 1
[ 3.099625] [USB3][hisi_dwc3_wake_lock]usb otg wake lock
[ 3.099630] [USB3][handle_event]hisi usb_status: OFF → HOST
[ 3.099632] [USB3][event_work]-

}}}

But, hot plugging USB flash drive or an Ethernet adapter is not showing up on dmesg ATM.
Not sure what the issue is.
Everything seems to be working on the kernel side.

@xlazom00 I applied the patch from http://paste.ubuntu.com/25361370/ and used your .config file to build my kernel Image.

The target boots registering USB interfaces as seen from How can I build latest Linux kernel(not android branch) for hikey960 - #43 by rakshithpatkar. But hotplug is not working ATM. Any other tweaks on the kernel side you might have done? Or attaching a working Image and hi3660-hikey960.dtb would do a world of good to confirm the configs. Or even a /proc/config.gz file from the booted board will do.

USB not working for me ATM.

Hi rakshithpatkar,

the usb is not working, almost the same as you:

Hi @xlazom00 @Robert Which reference build number did you take the following from?

boot-0.0+AUTOINC+7efa39f363-c906d2a849-r0-hikey960-20170722144217-76.uefi.img
rpb-console-image-hikey960-20170722144217-76.rootfs.img

Hi,

I tried both 84 and 79. not working, what’s your plan?

@Robert Plan is to use the exact same environment where USB was working for @xlazom00. And then try to narrow in on the problem from there, if it doesn’t work. If everything is kept same, ideally, it should work. Although, rootfs has nothing to do with USB.

I am suspecting an issue in the dtb file we are using for boot.

This is why i asked the above information.

I reported this and received confirmation of an issue with uefi. Please refer to https://bugs.96boards.org/show_bug.cgi?id=573 (no new updates atm) and continue to help test. Thanks!

Issue should be fixed in the next OE release or two. In the meantime, please try rebuilding the kernel with:

--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -557,15 +557,6 @@
 			status = "ok";
 		};
 
-		hubv1: gpio_hubv1 {
-			compatible = "hisilicon,gpio_hubv1";
-			typc_vbus_int_gpio,typec-gpios = <&gpio25 2 0>;
-			typc_vbus_enable_val = <0>;
-			hub_vdd12_en_gpio = <&gpio9 1 0>;
-			hub_vdd33_en_gpio = <&gpio9 2 0>;
-			status = "disabled";
-		};
-
 		hubv2: gpio_hubv2 {
 			compatible = "hisilicon,gpio_hubv2";
 			typc_vbus_int_gpio,typec-gpios = <&gpio25 2 0>;
@@ -576,7 +567,6 @@
 			hub_reset_en_gpio = <&gpio4 4 0>;
 			pinctrl-names = "default";
 			pinctrl-0 = <&usbhub5734_pmx_func>;
-			status = "disabled";
 		};
 
 		i2c3: i2c@fdf0c000 {

Did the download location change?

From
https://builds.96boards.org/snapshots/reference-platform/openembedded/morty/hikey960/rpb/
to
http://snapshots.linaro.org/reference-platform/embedded/morty/hikey960/

yes it did also build >=84 works

Thanks, it does work, I just tried build 90 and I am able to access USB devices. I used:
rpb-console-image-hikey960-20170825074418-90.rootfs.img
boot-0.0+AUTOINC+7efa39f363-c906d2a849-r0-hikey960-20170825074418-90.uefi.img

Is anyone able to use a Debian rootfs instead of a OE rootfs? What are the steps?

A post was split to a new topic: Which kernel branch is used by the current RPB 4.14 kernel?