LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM
User Name
Password
Slackware - ARM This forum is for the discussion of Slackware ARM.

Notices


Reply
  Search this Thread
Old 01-25-2020, 11:06 PM   #1
justwantin
Member
 
Registered: Aug 2003
Location: Melbourne, Australia
Distribution: Slackware, Slackwarearm
Posts: 878

Rep: Reputation: 120Reputation: 120
Patch to enable USB on Orange Pi Zero Expansion Board


The kernel maintainers do not enable anything that's not directly present on the board. Consequently the two USB ports on the Orangepi Zero Expansion board are not available when using the mainline sun8i-h2-plus-orangepi-zero.dtb. However, an OpenWrt patch to enable use of those USB ports is available here and it can be used to compile a new sun8i-h2-plus-orangepi-zero.dtb that with all three USB ports on the Orangepi Zero if that expansion board is onboard. Note that I am using the expansion board in the opi0-expansion-board.png image linked below and not the Orangepi Zero NAS Expansion board.

Here is the patch. The the paths for the dts file and patch have been changed from the original OpenWrt patch as I wanted to work outside of the kernel source tree.
Code:
@@ -0,0 +1,32 @@
--- sun8i-h2-plus-orangepi-zero.dts
+++ sun8i-h2-plus-orangepi-zero-3usb.patch
@@ -101,6 +101,14 @@
 &ehci1 {
 	status = "okay";
 };
+
+&ehci2 {
+	status = "okay";
+};
+
+&ehci3 {
+	status = "okay";
+};

 &mmc0 {
 	pinctrl-names = "default";
@@ -137,6 +145,14 @@
 &ohci1 {
        status = "okay";
 };
+
+&ohci2 {
+       status = "okay";
+};
+
+&ohci3 {
+       status = "okay";
+};

 &spi0 {
 	/* Disable SPI NOR by default: it optional on Orange Pi Zero boards */
For anyone unfamiliar with how to patch a dts file and compile a single dtb blob I'll explain how I did it below. Consider all lines begining wth '#' as comments and all other lines commnds or stdout.
Code:
# First a little housekeeping.
cd /usr/src/linux
make clean
mkdir /tmp/dtb

# Make a backup of the mainline sun8i-h2-plus-orangepi-zero.dts then copy the original to /tmp/dtb.
cp arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts-bu
mv arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts /tmp/dtb

# Create a file named sun8i-h2-plus-orangepi-zero-3usb.patch in /tmp/dtb  and then copy the patch into that file.

# cd into /tmp/dtb and patch the mainline sun8i-h2-plus-orangepi-zero.dts.
cd /tmp/dtb
ls
sun8i-h2-plus-orangepi-zero-3usb.patch	sun8i-h2-plus-orangepi-zero.dts

patch < sun8i-h2-plus-orangepi-zero-3usb.patch
patching file sun8i-h2-plus-orangepi-zero.dts
Hunk #1 succeeded at 130 with fuzz 1 (offset 29 lines).
Hunk #2 succeeded at 169 with fuzz 2 (offset 24 lines).

ls -l
total 20
-rw-r--r-- 1 root root  484 Jan 26 13:36 sun8i-h2-plus-orangepi-zero-3usb.patch
-rw-r--r-- 1 root root 5366 Jan 26 13:37 sun8i-h2-plus-orangepi-zero.dts
-rw-r--r-- 1 root root 5230 Jan  5 05:19 sun8i-h2-plus-orangepi-zero.dts.orig

# Copy the patched sun8i-h2-plus-orangepi-zero.dts into the kernel source tree.
cp  sun8i-h2-plus-orangepi-zero.dts  /usr/src/linux/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts

# cd into /usr/src linux and compile the new sun8i-h2-plus-orangepi-zero.dtb
cd /usr/src/linux
ARCH="arm" make sun8i-h2-plus-orangepi-zero.dtb
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  <snipped>
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTCC  scripts/dtc/yamltree.o
  HOSTLD  scripts/dtc/dtc
  DTC     arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dtb

# The new sun8i-h2-plus-orangepi-zero.dtb can be found in /usr/src/linuxarch/arm/boot/dts/.
ls arch/arm/boot/dts | grep 'orange'
rda8810pl-orangepi-2g-iot.dts
<snipped>
sun8i-h2-plus-orangepi-zero.dtb
sun8i-h2-plus-orangepi-zero.dts
sun8i-h2-plus-orangepi-zero.dts-bu
<snipped
sun8i-h3-orangepi-zero-plus2.dts
Replace the old sun8i-h2-plus-orangepi-zero.dtb with the new newly created sun8i-h2-plus-orangepi-zero.dtb in wherever your u-boot is configured to look for it. If you are booting with a boot.scr you should not have to edit your boot.cmd file and run mkimage again.
Code:
mkimage -C none -A arm -T script -d boot.cmd boot.scr
Attached Thumbnails
Click image for larger version

Name:	opi0-expansion-board.png
Views:	40
Size:	75.7 KB
ID:	32405  

Last edited by justwantin; 02-01-2020 at 04:09 AM.
 
  


Reply

Tags
3 usb ports, dtb, expansion board, orangepi zero, patch


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Orange PI Zero (H2+) as a GPS "compass" from box to works SCerovec Slackware - ARM 35 02-27-2019 04:42 AM
LXer: Orange Pi Zero Overview LXer Syndicated Linux News 0 04-04-2017 03:12 AM
LXer: $10 Orange Pi One pits quad-core Cortex-A7 against Pi Zero LXer Syndicated Linux News 0 01-29-2016 02:33 PM
variable expansion and pathname expansion ShadeLover Linux - General 6 04-22-2015 10:56 PM
Error trying to configure the touch screen on the Beagle Board XM Expansion Board marietto Linux - Hardware 0 06-30-2011 02:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM

All times are GMT -5. The time now is 03:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration