u-boot: update to 2018.03

todo: check wandboard version. there are internal changes to merge
the different wandboard images to one and u-boot.imx is not build
anymore. Which file is needed to boot on wandboard?

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
Arne Fitzenreiter
2018-03-24 11:14:24 +01:00
parent 832770a868
commit 2a0947f2e3
15 changed files with 155 additions and 11786 deletions

View File

@@ -1,16 +1,26 @@
#boot/MLO
#boot/u-boot.img
boot/MLO
boot/boot.cmd
boot/boot.mk
boot/boot.scr
boot/kernel.img
boot/kernel7.img
boot/kernel8-32.img
boot/u-boot.img
boot/uEnv.txt
usr/bin/mkimage
boot/uboot.env
#usr/share/u-boot
#usr/share/u-boot/banana_pi
usr/share/u-boot/banana_pi/u-boot-sunxi-with-spl.bin
#usr/share/u-boot/orangepi_pc
usr/share/u-boot/orangepi_pc/u-boot-sunxi-with-spl.bin
#usr/share/u-boot/orangepi_zero
usr/share/u-boot/orangepi_zero/u-boot-sunxi-with-spl.bin
#usr/share/u-boot/pandaboard
usr/share/u-boot/pandaboard/MLO
usr/share/u-boot/pandaboard/u-boot.img
#usr/share/u-boot/wandboard_dl
usr/share/u-boot/wandboard_dl/u-boot.imx
#usr/share/u-boot/wandboard_quad
usr/share/u-boot/wandboard_quad/u-boot.imx
#usr/share/u-boot/wandboard_solo
usr/share/u-boot/wandboard_solo/u-boot.imx
#usr/share/u-boot/rpi
usr/share/u-boot/rpi/kernel.img
#usr/share/u-boot/rpi2
usr/share/u-boot/rpi2/kernel7.img
#usr/share/u-boot/rpi3
usr/share/u-boot/rpi3/kernel8-32.img

View File

@@ -0,0 +1 @@
usr/bin/mkimage

50
config/u-boot/boot.cmd Normal file
View File

@@ -0,0 +1,50 @@
# Import uEnv txt...
if fatload mmc 0 ${kernel_addr_r} uEnv.txt; then
echo Load uEnv.txt...;
env import -t ${kernel_addr_r} ${filesize};
if test "${uenvcmd}" = ""; then
echo ...;
else
echo Boot with uEnv.txt...;
run uenvcmd;
fi;
fi;
# for compatiblity reasons set DTBSUNXI if we run on sunxi
if test "${board}" = "sunxi"; then
setenv fdtfile ${DTBSUNXI};
fi;
# Check if serial console is enabled
if test "${SERIAL-CONSOLE}" = "ON"; then
if test ${console} = ""; then
if test "${board}" = "rpi"; then
if test "${fdtfile}" = "bcm2837-rpi-3-b.dtb"; then
setenv console ttyS1,115200n8;
else
setenv console ttyAMA0,115200n8;
fi;
else
setenv console ttyS0,115200n8;
fi;
fi
echo Set console to ${console};
setenv bootargs console=${console} rootwait root=/dev/mmcblk0p3 rootwait;
else
echo Set console to tty1 ;
setenv bootargs console=tty1 rootwait root=/dev/mmcblk0p3 rootwait;
fi;
setenv fdt_high ffffffff;
fatload mmc 0:1 ${kernel_addr_r} vmlinuz-${KVER}-ipfire-multi;
fatload mmc 0:1 ${fdt_addr_r} dtb-${KVER}-ipfire-multi/${fdtfile};
if fatload mmc 0:1 ${ramdisk_addr_r} uInit-${KVER}-ipfire-multi; then
echo Ramdisk loaded...;
else
echo Ramdisk not loaded...;
setenv ramdisk_addr_r -;
fi ;
bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r};
# Recompile with:
# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr

2
config/u-boot/boot.mk Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
mkimage -C none -A arm -T script -d boot.cmd boot.scr

BIN
config/u-boot/boot.scr Normal file

Binary file not shown.

6
config/u-boot/uEnv.txt Executable file → Normal file
View File

@@ -1,5 +1,3 @@
KVER=xxxKVERxxx
DTBSUNXI=sun7i-a20-bananapi.dtb
uenvcmd=if test "$board" = "panda" ;then run bootpanda; else run bootsunxi; fi;
bootpanda=setenv initrd_high 90000000; fatload mmc 0:1 0x82000000 zImage-ipfire-multi; fatload mmc 0:1 ${fdtaddr} dtb-${KVER}-ipfire-multi/${fdtfile}; setenv bootargs video=800x600 console=tty1 rootwait smsc95xx.macaddr=$usbethaddr root=/dev/mmcblk0p3; bootz 0x82000000 - ${fdtaddr};
bootsunxi=setenv fdt_high ffffffff; fatload mmc 0:1 0x46000000 zImage-ipfire-multi; fatload mmc 0:1 0x49000000 dtb-${KVER}-ipfire-multi/${DTBSUNXI}; fatload mmc 0:1 0x49100000 uInit-ipfire-multi; setenv bootargs console=ttyS0,115200n8 rootwait root=/dev/mmcblk0p3 rootwait; bootz 0x46000000 0x49100000 0x49000000;
DTBSUNXI=xxxDTBSUNXIxxx
SERIAL-CONSOLE=OFF

View File

@@ -24,13 +24,13 @@
include Config
VER = 2014.04
VER = 2018.03
THISAPP = u-boot-$(VER)
DL_FILE = $(THISAPP).tar.bz2
DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)-$(MKIMAGE)
SUP_ARCH = armv5tel
###############################################################################
@@ -41,7 +41,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE)_MD5 = 6d2116d1385a66e9a59742caa9d62a54
$(DL_FILE)_MD5 = 02922bdf0ee003fe25bfc32749ffdeab
install : $(TARGET)
@@ -75,15 +75,11 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/U-Boot-v2-fs-fat-read-fix-fat16-ls-read-issue.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/u-boot-support-gcc-6.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/u-boot-c99-inline-fix.patch
cd $(DIR_APP)/include/linux && ln -s compiler-gcc6.h compiler-gcc7.h
ifneq "$(MKIMAGE)" "1"
# Pandaboard
-mkdir -pv /usr/share/u-boot/pandaboard
cd $(DIR_APP) && make CROSS_COMPILE="" omap4_panda_config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" IPFire.org"!' .config
cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
cd $(DIR_APP) && install -v -m 644 MLO u-boot.img \
/usr/share/u-boot/pandaboard
@@ -92,48 +88,83 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
cd $(DIR_APP) && install u-boot.img /boot/
cd $(DIR_APP) && make distclean
# Wandboard Quad
-mkdir -pv /usr/share/u-boot/wandboard_quad
cd $(DIR_APP) && make CROSS_COMPILE="" wandboard_quad_config
cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
cd $(DIR_APP) && install -v -m 644 u-boot.imx \
/usr/share/u-boot/wandboard_quad
cd $(DIR_APP) && make distclean
# Wandboard
# -mkdir -pv /usr/share/u-boot/wandboard
# cd $(DIR_APP) && make CROSS_COMPILE="" wandboard_config
# cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
# cd $(DIR_APP) && install -v -m 644 u-boot.imx \
# /usr/share/u-boot/wandboard
# cd $(DIR_APP) && make distclean
# Wandboard Dual
-mkdir -pv /usr/share/u-boot/wandboard_dl
cd $(DIR_APP) && make CROSS_COMPILE="" wandboard_dl_config
# Raspberry Pi
-mkdir -pv /usr/share/u-boot/rpi
cd $(DIR_APP) && make CROSS_COMPILE="" rpi_config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" IPFire.org"!' .config
cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
cd $(DIR_APP) && install -v -m 644 u-boot.imx \
/usr/share/u-boot/wandboard_dl
cd $(DIR_APP) && make distclean
cd $(DIR_APP) && install -v -m 644 u-boot.bin \
/usr/share/u-boot/rpi/kernel.img
# Install rpi u-boot as default rpi kernel
cd $(DIR_APP) && install u-boot.bin /boot/kernel.img
# Wandboard Solo
-mkdir -pv /usr/share/u-boot/wandboard_solo
cd $(DIR_APP) && make CROSS_COMPILE="" wandboard_solo_config
# Raspberry Pi 2
-mkdir -pv /usr/share/u-boot/rpi2
cd $(DIR_APP) && make CROSS_COMPILE="" rpi_2_config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" IPFire.org"!' .config
cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
cd $(DIR_APP) && install -v -m 644 u-boot.imx \
/usr/share/u-boot/wandboard_solo
cd $(DIR_APP) && make distclean
cd $(DIR_APP) && install -v -m 644 u-boot.bin \
/usr/share/u-boot/rpi2/kernel7.img
# Install rpi2 u-boot as default rpi kernel7
cd $(DIR_APP) && install u-boot.bin /boot/kernel7.img
# Raspberry Pi 3
-mkdir -pv /usr/share/u-boot/rpi3
cd $(DIR_APP) && make CROSS_COMPILE="" rpi_3_32b_config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" IPFire.org"!' .config
cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
cd $(DIR_APP) && install -v -m 644 u-boot.bin \
/usr/share/u-boot/rpi3/kernel8-32.img
# Install rpi2 u-boot as default rpi kernel8-32
cd $(DIR_APP) && install u-boot.bin /boot/kernel8-32.img
# Orange Pi Zero
-mkdir -pv /usr/share/u-boot/orangepi_zero
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/u-boot/sunxi/orangepi-zero-add-macs.diff
cd $(DIR_APP) && make CROSS_COMPILE="" orangepi_zero_config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" IPFire.org"!' .config
cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \
/usr/share/u-boot/orangepi_zero
# Orange Pi PC
-mkdir -pv /usr/share/u-boot/orangepi_pc
cd $(DIR_APP) && make CROSS_COMPILE="" orangepi_pc_config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" IPFire.org"!' .config
cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \
/usr/share/u-boot/orangepi_pc
# LeMaker Banana Pi
-mkdir -pv /usr/share/u-boot/banana_pi
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/u-boot/sunxi/001-uboot-sunxi-509d96d4f1f602d62d36db660973249e16f9d088.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/u-boot/sunxi/002-uboot-jwrdegoede-psci-support.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/u-boot/sunxi/003-uboot-fix-gmac-not-working-reliable-on-bananapi.patch
cd $(DIR_APP) && make CROSS_COMPILE="" Bananapi_config
cd $(DIR_APP) && sed -i -e 's!^CONFIG_IDENT_STRING=.*!CONFIG_IDENT_STRING=" IPFire.org"!' .config
cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)"
cd $(DIR_APP) && install -v -m 644 u-boot-sunxi-with-spl.bin \
/usr/share/u-boot/banana_pi
# mkimage
cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" tools
cd $(DIR_APP) && install -v -m 755 tools/mkimage /usr/bin
# config (uEnv.txt)
# create an empty 128 KB File for the u-boot env
dd if=/dev/zero of=/boot/uboot.env bs=1K count=128
# config (uEnv.txt and boot.*)
cp -vf $(DIR_SRC)/config/u-boot/* /boot/
# patch real Kernel version to uEnv.txt
sed -e "s/xxxKVERxxx/$(KVER)/g" -i /boot/uEnv.txt
else
# mkimage
cd $(DIR_APP) && make CROSS_COMPILE="" omap4_panda_config
cd $(DIR_APP) && make CROSS_COMPILE="" HOSTCC="gcc $(CFLAGS)" tools
cd $(DIR_APP) && install -v -m 755 tools/mkimage /usr/bin
endif
@rm -rf $(DIR_APP)
@$(POSTBUILD)

View File

@@ -1048,7 +1048,7 @@ buildipfire() {
lfsmake2 zd1211-firmware
lfsmake2 rpi-firmware
lfsmake2 bc
lfsmake2 u-boot
lfsmake2 u-boot MKIMAGE=1
lfsmake2 cpio
lfsmake2 mdadm
lfsmake2 dracut
@@ -1427,6 +1427,7 @@ buildipfire() {
lfsmake2 powertop
lfsmake2 parted
lfsmake2 swig
lfsmake2 u-boot
lfsmake2 python-m2crypto
lfsmake2 wireless-regdb
lfsmake2 crda

View File

@@ -1,128 +0,0 @@
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 04a51db..bccc3e3 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -823,8 +823,11 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer,
int ret = -1;
int firsttime;
__u32 root_cluster = 0;
+ __u32 read_blk;
int rootdir_size = 0;
- int j;
+ int buffer_blk_cnt;
+ int do_read;
+ __u8 *dir_ptr;
if (read_bootsectandvi(&bs, &volinfo, &mydata->fatsize)) {
debug("Error: reading boot sector\n");
@@ -909,24 +912,54 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer,
isdir = 1;
}
- j = 0;
+ buffer_blk_cnt = 0;
+ firsttime = 1;
while (1) {
int i;
- if (j == 0) {
- debug("FAT read sect=%d, clust_size=%d, DIRENTSPERBLOCK=%zd\n",
- cursect, mydata->clust_size, DIRENTSPERBLOCK);
+ if (mydata->fatsize == 32 || firsttime) {
+ dir_ptr = do_fat_read_at_block;
+ firsttime = 0;
+ } else {
+ /**
+ * FAT16 sector buffer modification:
+ * Each loop, the second buffered block is moved to
+ * the buffer begin, and two next sectors are read
+ * next to the previously moved one. So the sector
+ * buffer keeps always 3 sectors for fat16.
+ * And the current sector is the buffer second sector
+ * beside the "firsttime" read, when it is the first one.
+ *
+ * PREFETCH_BLOCKS is 2 for FAT16 == loop[0:1]
+ * n = computed root dir sector
+ * loop | cursect-1 | cursect | cursect+1 |
+ * 0 | sector n+0 | sector n+1 | none |
+ * 1 | none | sector n+0 | sector n+1 |
+ * 0 | sector n+1 | sector n+2 | sector n+3 |
+ * 1 | sector n+3 | ...
+ */
+ dir_ptr = (do_fat_read_at_block + mydata->sect_size);
+ memcpy(do_fat_read_at_block, dir_ptr, mydata->sect_size);
+ }
+
+ do_read = 1;
+
+ if (mydata->fatsize == 32 && buffer_blk_cnt)
+ do_read = 0;
+
+ if (do_read) {
+ read_blk = (mydata->fatsize == 32) ?
+ mydata->clust_size : PREFETCH_BLOCKS;
+
+ debug("FAT read(sect=%d, cnt:%d), clust_size=%d, DIRENTSPERBLOCK=%zd\n",
+ cursect, read_blk, mydata->clust_size, DIRENTSPERBLOCK);
- if (disk_read(cursect,
- (mydata->fatsize == 32) ?
- (mydata->clust_size) :
- PREFETCH_BLOCKS,
- do_fat_read_at_block) < 0) {
+ if (disk_read(cursect, read_blk, dir_ptr) < 0) {
debug("Error: reading rootdir block\n");
goto exit;
}
- dentptr = (dir_entry *) do_fat_read_at_block;
+ dentptr = (dir_entry *)dir_ptr;
}
for (i = 0; i < DIRENTSPERBLOCK; i++) {
@@ -951,7 +984,7 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer,
get_vfatname(mydata,
root_cluster,
- do_fat_read_at_block,
+ dir_ptr,
dentptr, l_name);
if (dols == LS_ROOT) {
@@ -1062,7 +1095,7 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer,
goto rootdir_done; /* We got a match */
}
- debug("END LOOP: j=%d clust_size=%d\n", j,
+ debug("END LOOP: buffer_blk_cnt=%d clust_size=%d\n", buffer_blk_cnt,
mydata->clust_size);
/*
@@ -1070,10 +1103,10 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer,
* root directory clusters when a cluster has been
* completely processed.
*/
- ++j;
+ ++buffer_blk_cnt;
int rootdir_end = 0;
if (mydata->fatsize == 32) {
- if (j == mydata->clust_size) {
+ if (buffer_blk_cnt == mydata->clust_size) {
int nxtsect = 0;
int nxt_clust = 0;
@@ -1086,11 +1119,11 @@ int do_fat_read_at(const char *filename, loff_t pos, void *buffer,
root_cluster = nxt_clust;
cursect = nxtsect;
- j = 0;
+ buffer_blk_cnt = 0;
}
} else {
- if (j == PREFETCH_BLOCKS)
- j = 0;
+ if (buffer_blk_cnt == PREFETCH_BLOCKS)
+ buffer_blk_cnt = 0;
rootdir_end = (++cursect - mydata->rootdir_sect >=
rootdir_size);

View File

@@ -1,20 +0,0 @@
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 9896e54..99c6dcc 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -44,9 +44,10 @@
*/
#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
!defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
-# define inline inline __attribute__((always_inline))
-# define __inline__ __inline__ __attribute__((always_inline))
-# define __inline __inline __attribute__((always_inline))
+/* XXX: check __GNUC_STDC_INLINE__, fix line length */
+# define inline inline __attribute__((always_inline)) __attribute__((__gnu_inline__))
+# define __inline__ __inline__ __attribute__((always_inline)) __attribute__((__gnu_inline__))
+# define __inline __inline __attribute__((always_inline)) __attribute__((__gnu_inline__))
#endif
#define __deprecated __attribute__((deprecated))
--
1.8.3.2

View File

@@ -1,71 +0,0 @@
diff --git a/include/linux/compiler-gcc6.h b/include/linux/compiler-gcc6.h
new file mode 100644
index 0000000..622117b
--- /dev/null
+++ b/include/linux/compiler-gcc6.h
@@ -0,0 +1,65 @@
+#ifndef __LINUX_COMPILER_H
+#error "Please don't include <linux/compiler-gcc6.h> directly, include <linux/compiler.h> instead."
+#endif
+
+#define __used __attribute__((__used__))
+#define __must_check __attribute__((warn_unused_result))
+#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
+
+/* Mark functions as cold. gcc will assume any path leading to a call
+ to them will be unlikely. This means a lot of manual unlikely()s
+ are unnecessary now for any paths leading to the usual suspects
+ like BUG(), printk(), panic() etc. [but let's keep them for now for
+ older compilers]
+
+ Early snapshots of gcc 4.3 don't support this and we can't detect this
+ in the preprocessor, but we can live with this because they're unreleased.
+ Maketime probing would be overkill here.
+
+ gcc also has a __attribute__((__hot__)) to move hot functions into
+ a special section, but I don't see any sense in this right now in
+ the kernel context */
+#define __cold __attribute__((__cold__))
+
+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
+
+#ifndef __CHECKER__
+# define __compiletime_warning(message) __attribute__((warning(message)))
+# define __compiletime_error(message) __attribute__((error(message)))
+#endif /* __CHECKER__ */
+
+/*
+ * Mark a position in code as unreachable. This can be used to
+ * suppress control flow warnings after asm blocks that transfer
+ * control elsewhere.
+ *
+ * Early snapshots of gcc 4.5 don't support this and we can't detect
+ * this in the preprocessor, but we can live with this because they're
+ * unreleased. Really, we need to have autoconf for the kernel.
+ */
+#define unreachable() __builtin_unreachable()
+
+/* Mark a function definition as prohibited from being cloned. */
+#define __noclone __attribute__((__noclone__))
+
+/*
+ * Tell the optimizer that something else uses this function or variable.
+ */
+#define __visible __attribute__((externally_visible))
+
+/*
+ * GCC 'asm goto' miscompiles certain code sequences:
+ *
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
+ *
+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
+ *
+ * (asm goto is automatically volatile - the naming reflects this.)
+ */
+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
+
+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
+#define __HAVE_BUILTIN_BSWAP32__
+#define __HAVE_BUILTIN_BSWAP64__
+#define __HAVE_BUILTIN_BSWAP16__
+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */

View File

@@ -1,20 +0,0 @@
diff --git a/board/sunxi/gmac.c b/board/sunxi/gmac.c
index e7ff952..f58c963 100644
--- a/board/sunxi/gmac.c
+++ b/board/sunxi/gmac.c
@@ -24,6 +24,15 @@ int sunxi_gmac_initialize(bd_t *bis)
CCM_GMAC_CTRL_GPIT_MII);
#endif
+ /*
+ * HdG: this is necessary to get GMAC to work reliable on the
+ * Bananapi. We don't know what these undocumented bits do, so this
+ * is a Bananapi specific hack for now.
+ */
+#ifdef CONFIG_BANANAPI
+ setbits_le32(&ccm->gmac_clk_cfg, 0x3 << 10);
+#endif
+
/* Configure pin mux settings for GMAC */
for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(16); pin++) {
#ifdef CONFIG_RGMII

View File

@@ -0,0 +1,12 @@
diff -Naur org/sun8i-h2-plus-orangepi-zero.dts new/sun8i-h2-plus-orangepi-zero.dts
--- org/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts 2018-01-09 01:25:29.000000000 +0000
+++ new/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts 2018-03-09 16:32:32.233836000 +0000
@@ -59,6 +59,8 @@
serial0 = &uart0;
/* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
ethernet1 = &xr819;
+ ethernet2 = &xr819;
+ //ethernet3 = &xr819;
};
chosen {