Merge pull request #175 from ThomasKaiser/master

Unified H3 image generation, include h3disp in H3 images
This commit is contained in:
Igor Pečovnik 2016-02-24 21:10:16 +01:00
commit 320d6bfe2b
15 changed files with 109 additions and 99 deletions

View File

@ -131,8 +131,8 @@ install_board_specific (){
else
cp $SRC/lib/config/boot.cmd $DEST/cache/sdcard/boot/boot.cmd
# orangepi h3 temp exceptions
[[ $LINUXFAMILY == "sun8i" ]] && sed -i '1s/^/gpio set PA15\nsetenv machid 1029\nsetenv bootm_boot_mode sec\n/' $DEST/cache/sdcard/boot/boot.cmd
[[ $BOARD == orangepip* ]] && sed -i '/^gpio set PA15/a gpio set PG11' $DEST/cache/sdcard/boot/boot.cmd
[[ $LINUXFAMILY == "sun8i" ]] && sed -i -e '1s/^/gpio set PA15\nsetenv machid 1029\nsetenv bootm_boot_mode sec\n/' -e 's/\ disp.screen0_output_mode=1920x1080p60//' $DEST/cache/sdcard/boot/boot.cmd
[[ $BOARD == orangepiplus ]] && sed -i '/^gpio set PA15/a gpio set PG11' $DEST/cache/sdcard/boot/boot.cmd
# let's prepare for old kernel too
chroot $DEST/cache/sdcard /bin/bash -c \
"ln -s /boot/bin/$BOARD.bin /boot/script.bin >/dev/null 2>&1 || cp /boot/bin/$BOARD.bin /boot/script.bin"

View File

@ -387,6 +387,11 @@ _EOF_
# TODO: Set the module to build automatically via dkms in the future here
fi
# h3disp for sun8i/3.4.x
if [ "$BOARD" = "orangepiplus" -o "$BOARD" = "orangepih3" ]; then
install -m 755 "$SRC/lib/scripts/h3disp" "$DEST/cache/sdcard/usr/local/bin"
fi
}

View File

@ -1,5 +1,4 @@
# disp.screen0_output_mode=1920x1080p60 to set video mode
setenv bootargs "console=tty1 root=/dev/mmcblk0p1 rootwait rootfstype=ext4 cgroup-enable=memory swapaccount=1 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve sunxi_fb_mem_reserve=16 hdmi.audio=EDID:0 panic=10 consoleblank=0 enforcing=0 loglevel=1"
setenv bootargs "console=tty1 root=/dev/mmcblk0p1 rootwait rootfstype=ext4 cgroup-enable=memory swapaccount=1 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve sunxi_fb_mem_reserve=16 hdmi.audio=EDID:0 disp.screen0_output_mode=1920x1080p60 panic=10 consoleblank=0 enforcing=0 loglevel=1"
#--------------------------------------------------------------------------------------------------------------------------------
# Boot loader script to boot with different boot methods for old and new kernel
#--------------------------------------------------------------------------------------------------------------------------------

View File

@ -698,7 +698,7 @@ di_used = 1
;--------------------------------------------------------------------------------
[mmc0_para]
sdc_used = 1
sdc_detmode = 1
sdc_detmode = 3
sdc_buswidth = 4
sdc_clk = port:PF02<2><1><2><default>
sdc_cmd = port:PF03<2><1><2><default>

View File

@ -436,7 +436,7 @@ di_used = 1
[mmc0_para]
sdc_used = 1
sdc_detmode = 1
sdc_detmode = 3
sdc_buswidth = 4
sdc_clk = port:PF02<2><1><2><default>
sdc_cmd = port:PF03<2><1><2><default>

View File

@ -436,7 +436,7 @@ di_used = 1
[mmc0_para]
sdc_used = 1
sdc_detmode = 1
sdc_detmode = 3
sdc_buswidth = 4
sdc_clk = port:PF02<2><1><2><default>
sdc_cmd = port:PF03<2><1><2><default>

View File

@ -438,7 +438,7 @@ di_used = 1
[mmc0_para]
sdc_used = 1
sdc_detmode = 1
sdc_detmode = 3
sdc_buswidth = 4
sdc_clk = port:PF02<2><1><2><default>
sdc_cmd = port:PF03<2><1><2><default>

View File

@ -712,7 +712,7 @@ di_used = 1
;--------------------------------------------------------------------------------
[mmc0_para]
sdc_used = 1
sdc_detmode = 1
sdc_detmode = 3
sdc_buswidth = 4
sdc_clk = port:PF02<2><1><2><default>
sdc_cmd = port:PF03<2><1><2><default>

View File

@ -213,65 +213,29 @@
;;
orangepiplus)#enabled
#description H3 quad core 1Gb SoC Wifi GbE USB hub
#description H3 quad core (Orange Pi Plus or Plus 2)
#build 3wip
LINUXFAMILY="sun8i"
BOOTCONFIG="orangepi_plus_defconfig"
MODULES="8189es"
MODULES="8189es #gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #gc2035"
MODULES_NEXT=""
CPUMIN="480000"
CPUMAX="1296000"
GOVERNOR="interactive"
;;
orangepi2)#enabled
#description H3 quad core 1Gb SoC Wifi USB hub
orangepih3)#enabled
#description H3 quad core (Orange Pi PC/One/2/Lite)
#build 3wip
LINUXFAMILY="sun8i"
BOOTCONFIG="orangepi_pc_defconfig"
MODULES="8189es"
BOOTCONFIG="orangepi_h3_defconfig"
MODULES="8189es #gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #gc2035"
MODULES_NEXT=""
CPUMIN="480000"
CPUMAX="1296000"
GOVERNOR="interactive"
;;
orangepipc)#enabled
#description H3 quad core 1Gb SoC
#build 3wip
LINUXFAMILY="sun8i"
BOOTCONFIG="orangepi_pc_defconfig"
MODULES=""
MODULES_NEXT=""
CPUMIN="480000"
CPUMAX="1296000"
GOVERNOR="interactive"
;;
orangepione)#enabled
#description H3 quad core 512Mb SoC
#build 3wip
LINUXFAMILY="sun8i"
BOOTCONFIG="orangepi_one_defconfig"
MODULES=""
MODULES_NEXT=""
CPUMIN="648000"
CPUMAX="1200000"
GOVERNOR="interactive"
;;
orangepilite)#enabled
#description H3 quad core 512Mb SoC Wifi
#build 3wip
LINUXFAMILY="sun8i"
BOOTCONFIG="orangepi_pc_defconfig"
MODULES="8189es"
MODULES_NEXT=""
CPUMIN="648000"
CPUMAX="1200000"
GOVERNOR="interactive"
;;
cubox-i)#enabled
#description Freescale iMx dual/quad core Wifi
#build 6

View File

@ -0,0 +1,48 @@
# Armbian H3 mini FAQ
**OS images with legacy Kernel (3.4.110)**
Armbian supports starting with release 5.04 all available H3 based Orange Pi boards (also [One](http://forum.armbian.com/index.php/topic/724-quick-review-of-orange-pi-one/) and Lite when available). Compared to the preliminary releases the following has been fixed:
- HDMI/DVI works (bug in boot.cmd settings)
- Reboot issues fixed (bug in fex settings)
- 1-Wire useable (we chose to stay compatible to loboris' images so the data pin is 37 by default. You can change this in the [fex file](https://github.com/igorpecovnik/lib/blob/6d995e31583e5361c758b401ea44634d406ac3da/config/orangepiplus.fex#L1284-L1286)
- changing display resolution and choosing between HDMI and DVI now possible with the included _h3disp_ tool (should also work in the [stand-alone version](http://forum.armbian.com/index.php/topic/617-wip-orange-pi-one-support-for-the-upcoming-orange-pi-one/?p=5480) with Debian based OS images from loboris/Xunlong)
- Ethernet issues fixed (combination of kernel and fex fixes)
- USB-to-SATA bridge on the Orange Pi Plus works
- stability problems on Orange Pi One fixed (due to undervoltage based on wrong fex settings)
- problems with 2 USB ports on the PC fixed (wrong kernel config)
- already useable as stable headless/server board
***Important to know***
- [User documentation](http://www.armbian.com/documentation/)
- [Geek documentation](http://www.armbian.com/using-armbian-tools/)
- 1st boot takes longer (up to 5 minutes). Please do not interrupt while the red LED is blinking, the board reboots automatically one time
- CPU frequency settings are 648-1200 MHz on OPi One/Lite and 480-1296 MHz on the other boards (cpufreq governor is _interactive_ therefore the board only increases CPU speed and consumption when needed)
- These are still test images regarding everything beyond headless/server usage
- In case you experience instabilities, think about installing [RPi-Monitor for H3](http://forum.armbian.com/index.php/topic/617-wip-orange-pi-one-support-for-the-upcoming-orange-pi-one/?p=5076) to get an idea whether you suffer from overheating
***Areas that need testing***
- SPI
- I2C
- GPIO in general
- GPU acceleration (needs _boot.cmd_ adjustments and at least _mali_ module loaded)
- Wi-Fi on OPi Plus, Plus 2 and 2
- USB wireless dongles
***What you can do to improve the situation***
- improve software support for Orange Pi One by [testing DRAM reliability](http://forum.armbian.com/index.php/topic/617-wip-orange-pi-one-support-for-the-upcoming-orange-pi-one/?p=5455)!
- get back to us with [feedback regarding our OS images](http://forum.armbian.com/index.php/topic/617-wip-orange-pi-one-support-for-the-upcoming-orange-pi-one/?view=getlastpost)
- fork our repo, fix things and send pull requests
***Known to *not* work yet***
- camera support. We included [@lex' patches](http://www.orangepi.org/orangepibbsen/forum.php?mod=redirect&goto=findpost&ptid=443&pid=7263) but miss [phelum's basic patches](http://www.orangepi.org/orangepibbsen/forum.php?mod=redirect&goto=findpost&ptid=70&pid=2905). Fixes welcome
- HW accelerated video decoding. Fixes welcome (anyone willing to port the stuff from the [H3 OpenELEC port](https://github.com/jernejsk/OpenELEC-OPi2)?)
**OS images with vanilla Kernel (4.x)**

View File

@ -115,18 +115,9 @@ create_board_package (){
mkdir -p $destination/boot/bin
for i in $(ls -w1 $SRC/lib/config/*.fex | xargs -n1 basename); do
fex2bin $SRC/lib/config/${i%*.fex}.fex $destination/boot/bin/${i%*.fex}.bin;
case ${i%*.fex} in
orangepiplus|orangepi2|orangepipc|orangepione|orangepilite)
# H3 based devices need a fix when used with DVI displays
# so we provide a 2nd script.bin to be replaced manually
# when using kernel 3.4.x
sed '/\[hdmi_para\]/a \
hdcp_enable = 0\
hdmi_cts_compatibility = 1\
' <"${SRC}/lib/config/${i%*.fex}.fex" | fex2bin - "${destination}/boot/bin/${i%*.fex}_hdmi2dvi.bin"
;;
esac
done
# One H3 image for all Fast Ethernet equipped Orange Pi H3
cp -p "$destination/boot/bin/orangepi2.bin" "$destination/boot/bin/orangepih3.bin"
# bluetooth device enabler - for cubietruck
install -m 755 $SRC/lib/bin/brcm_patchram_plus $destination/usr/local/bin

View File

@ -1,5 +1,5 @@
diff --git a/drivers/video/sunxi/disp2/disp/dev_disp.c b/drivers/video/sunxi/disp2/disp/dev_disp.c
index 7ad900b..27f56c6 100755
index 7ad900b..1761309 100755
--- a/drivers/video/sunxi/disp2/disp/dev_disp.c
+++ b/drivers/video/sunxi/disp2/disp/dev_disp.c
@@ -12,6 +12,38 @@
@ -27,7 +27,7 @@ index 7ad900b..27f56c6 100755
+
+static char *screen1_output_mode;
+module_param(screen1_output_mode, charp, 0444);
+MODULE_PARM_DESC(screen1_output_mode, "See screen0_output_mode");
+MODULE_PARM_DESC(screen1_output_mode, "See screen1_output_mode");
+
+static int screen2_output_type = -1;
+module_param(screen2_output_type, int, 0444);
@ -35,7 +35,7 @@ index 7ad900b..27f56c6 100755
+
+static char *screen2_output_mode;
+module_param(screen2_output_mode, charp, 0444);
+MODULE_PARM_DESC(screen2_output_mode, "See screen0_output_mode");
+MODULE_PARM_DESC(screen2_output_mode, "See screen2_output_mode");
+#endif
+
disp_drv_info g_disp_drv;
@ -93,7 +93,7 @@ index 7ad900b..27f56c6 100755
+ if (screen1_output_mode != NULL) {
+ // TODO: support sunxi mode
+ sscanf(screen1_output_mode, "%d", &value);
+ pr_info("[DISP]%s: screen1_output_mode(%s) value(%d)\n", __func__, screen0_output_mode, value);
+ pr_info("[DISP]%s: screen1_output_mode(%s) value(%d)\n", __func__, screen1_output_mode, value);
+ }
+ else
+#endif
@ -129,19 +129,17 @@ index 7ad900b..27f56c6 100755
if(disp_sys_script_get_item("disp_init", "screen2_output_mode", &value, 1) < 0) {
__inf("fetch script data disp_init.screen2_output_mode fail\n");
}
@@ -902,7 +980,10 @@ static s32 disp_init(struct platform_device *pdev)
@@ -902,7 +980,8 @@ static s32 disp_init(struct platform_device *pdev)
para->start_process = start_process;
//para.capture_event = capture_event;
- value = disp_boot_para_parse();
+ //Justin Porting 20150707 Start
+ //value = disp_boot_para_parse();
+ //Justin Porting 20150707 End
+
output_type = (value >> 8) & 0xff;
output_mode = (value) & 0xff;
if(output_type != (int)DISP_OUTPUT_TYPE_NONE) {
@@ -1126,7 +1207,8 @@ static int disp_remove(struct platform_device *pdev)
@@ -1126,7 +1205,8 @@ static int disp_remove(struct platform_device *pdev)
return 0;
}
@ -151,7 +149,7 @@ index 7ad900b..27f56c6 100755
{
u32 screen_id = 0;
int num_screens;
@@ -1137,23 +1219,18 @@ void suspend()
@@ -1137,23 +1217,18 @@ void suspend()
num_screens = bsp_disp_feat_get_num_screens();
@ -177,7 +175,7 @@ index 7ad900b..27f56c6 100755
disp_list = disp_device_get_list_head();
list_for_each_entry(dispdev_suspend, disp_list, list) {
if (dispdev_suspend->suspend) {
@@ -1161,9 +1238,13 @@ void suspend()
@@ -1161,9 +1236,13 @@ void suspend()
}
}
@ -192,7 +190,7 @@ index 7ad900b..27f56c6 100755
{
u32 screen_id = 0;
int num_screens;
@@ -1171,8 +1252,6 @@ void resume()
@@ -1171,8 +1250,6 @@ void resume()
struct disp_device* dispdev = NULL;
struct list_head* disp_list= NULL;
pr_info("%s\n", __func__);
@ -201,7 +199,7 @@ index 7ad900b..27f56c6 100755
num_screens = bsp_disp_feat_get_num_screens();
disp_list = disp_device_get_list_head();
@@ -1186,13 +1265,15 @@ void resume()
@@ -1186,13 +1263,15 @@ void resume()
mgr = g_disp_drv.mgr[screen_id];
if(!mgr || !mgr->device)
continue;
@ -220,7 +218,7 @@ index 7ad900b..27f56c6 100755
mgr->device->backlight_enable(mgr->device);
}
} else if(suspend_output_type[screen_id] != DISP_OUTPUT_TYPE_NONE) {
@@ -1205,25 +1286,11 @@ void resume()
@@ -1205,25 +1284,11 @@ void resume()
}
}
@ -249,7 +247,7 @@ index 7ad900b..27f56c6 100755
pr_info("%s finish\n", __func__);
}
@@ -1237,30 +1304,120 @@ static struct early_suspend backlight_early_suspend_handler =
@@ -1237,30 +1302,120 @@ static struct early_suspend backlight_early_suspend_handler =
static int disp_suspend(struct platform_device *pdev, pm_message_t state)
{
@ -280,14 +278,14 @@ index 7ad900b..27f56c6 100755
+ }
+
+ /*suspend for all display device*/
+
+ disp_list = disp_device_get_list_head();
+ list_for_each_entry(dispdev_suspend, disp_list, list) {
+ if (dispdev_suspend->suspend) {
+ dispdev_suspend->suspend(dispdev_suspend);
+ }
+ }
+
+#else
+ pr_info("%s\n", __func__);
+ num_screens = bsp_disp_feat_get_num_screens();
@ -378,9 +376,4 @@ index 7ad900b..27f56c6 100755
return 0;
}
@@ -1783,4 +1940,3 @@ MODULE_DESCRIPTION("display driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:disp");
-

View File

@ -1,7 +1,7 @@
diff -Nur a/configs/orangepi_one_defconfig b/configs/orangepi_one_defconfig
--- a/configs/orangepi_one_defconfig 1970-01-01 01:00:00.000000000 +0100
+++ b/configs/orangepi_one_defconfig 2016-02-19 00:58:31.007705977 +0100
@@ -0,0 +1,17 @@
diff -Nur a/configs/orangepi_h3_defconfig b/configs/orangepi_h3_defconfig
--- a/configs/orangepi_h3_defconfig 1970-01-01 01:00:00.000000000 +0100
+++ b/configs/orangepi_h3_defconfig 2016-02-19 00:58:31.007705977 +0100
@@ -0,0 +1,16 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN8I_H3=y
@ -18,7 +18,6 @@ diff -Nur a/configs/orangepi_one_defconfig b/configs/orangepi_one_defconfig
+CONFIG_CMD_GPIO=y
+CONFIG_DM=y
+CONFIG_DM_GPIO=y
+CONFIG_SUNXI_NO_PMIC=y
diff -Nur a/configs/orangepi_pc_defconfig b/configs/orangepi_pc_defconfig
--- a/configs/orangepi_pc_defconfig 2016-02-18 17:59:46.843681159 +0100
+++ b/configs/orangepi_pc_defconfig 2016-02-19 00:58:41.071856141 +0100
@ -31,15 +30,6 @@ diff -Nur a/configs/orangepi_pc_defconfig b/configs/orangepi_pc_defconfig
diff -Nur a/configs/orangepi_plus_defconfig b/configs/orangepi_plus_defconfig
--- a/configs/orangepi_plus_defconfig 2016-02-15 22:44:30.000000000 +0100
+++ b/configs/orangepi_plus_defconfig 2016-02-19 00:59:04.440204776 +0100
@@ -1,7 +1,7 @@
CONFIG_ARM=y
CONFIG_ARCH_SUNXI=y
CONFIG_MACH_SUN8I_H3=y
-CONFIG_DRAM_CLK=672
+CONFIG_DRAM_CLK=624
CONFIG_DRAM_ZQ=3881979
CONFIG_DRAM_ODT_EN=y
# CONFIG_VIDEO is not set
@@ -12,3 +12,5 @@
# CONFIG_CMD_FLASH is not set
# CONFIG_CMD_FPGA is not set

View File

@ -96,6 +96,9 @@ autodetect_h3() {
# This function adjusts script.bin, hostname and cpufreq settings based on
# /run/machine.id so that two OS images (one built for Orange Pi Plus and one
# for the other H3 devices using the internal Ethernet PHY) can be shipped.
# trigger red LED as user feedback
echo heartbeat >/sys/class/leds/red_led/trigger
# wait for armhwinfo
sleep 3
@ -121,8 +124,10 @@ autodetect_h3() {
-e 's/MAX_SPEED=1296000/MAX_SPEED=1200000/' /etc/default/cpufrequtils
;;
esac
echo "${MACHINE}" | tr '[:upper:]' '[:lower:]' | sed -e 's/+/plus/' \
-e 's/\ //g' >/etc/hostname
NEWHOSTNAME="$(echo "${MACHINE}" | tr '[:upper:]' '[:lower:]' | sed -e 's/+/plus/' -e 's/\ //g')"
echo "${NEWHOSTNAME}" >/etc/hostname
sed -i "s/orangepih3/${NEWHOSTNAME}/" /etc/hosts
rm /boot/bin/orangepih3.bin
touch /var/run/reboot
} # autodetect_h3

View File

@ -0,0 +1,15 @@
#!/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Main() {
read MACHINE </run/machine.id
case ${MACHINE} in
"Orange Pi+"*|"Orange Pi 2"*|"Orange Pi PC"|"Orange Pi One"|"Orange Pi Lite")
echo -e "\nNew to Armbian? Check the Armbian H3 Mini FAQ first:\nhttps://github.com/igorpecovnik/lib/blob/master/documentation/H3_mini_faq.md\n\n"
(sleep 1 && rm "$0") &
;;
esac
} # Main
Main