Merge pull request #1300 from vpeter4/imx6-uboot

imx6/u-boot: update to c8d1200 [backport]
This commit is contained in:
CvH 2017-02-08 13:15:19 +01:00 committed by GitHub
commit 62f9fb4246
6 changed files with 135 additions and 14 deletions

View File

@ -19,10 +19,12 @@
PKG_NAME="u-boot"
PKG_DEPENDS_TARGET="toolchain"
if [ "$UBOOT_VERSION" = "imx6-cuboxi" ]; then
PKG_VERSION="imx6-408544d"
PKG_SITE="http://imx.solid-run.com/wiki/index.php?title=Building_the_kernel_and_u-boot_for_the_CuBox-i_and_the_HummingBoard"
# https://github.com/SolidRun/u-boot-imx6.git
PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz"
PKG_COMMIT="c8d1200"
PKG_VERSION="imx6-$PKG_COMMIT"
PKG_SITE="http://solid-run.com/wiki/doku.php?id=products:imx6:software:development:u-boot"
PKG_URL="https://github.com/SolidRun/u-boot-imx6/archive/$PKG_COMMIT.tar.gz"
PKG_SOURCE_NAME="$PKG_NAME-sr-$PKG_VERSION.tar.gz"
PKG_SOURCE_DIR="$PKG_NAME-imx6-${PKG_COMMIT}*"
[ -n "$UBOOT_CONFIG_V2" ] && PKG_DEPENDS_TARGET="toolchain u-boot-v2"
elif [ "$UBOOT_VERSION" = "hardkernel" ]; then
PKG_VERSION="6e4e886"
@ -58,7 +60,6 @@ pre_configure_target() {
# copy compiler-gcc5.h to compiler-gcc6. for fake building
cp include/linux/compiler-gcc5.h include/linux/compiler-gcc6.h
}
make_target() {

View File

@ -41,8 +41,8 @@
UBOOT_VERSION="imx6-cuboxi"
# Configuration for u-boot
UBOOT_CONFIG="mx6_cubox-i_config"
UBOOT_CONFIG="$UBOOT_CONFIG matrix"
UBOOT_CONFIG="mx6_cubox-i_config \
matrix"
# for second u-boot
UBOOT_CONFIG_V2="udoo_config \
@ -55,13 +55,13 @@
KERNEL_TARGET="zImage"
# Kernel extra targets to build
KERNEL_UBOOT_EXTRA_TARGET="imx6q-cubox-i.dtb imx6dl-cubox-i.dtb"
KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-hummingboard.dtb imx6dl-hummingboard.dtb"
KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-hummingboard2.dtb imx6dl-hummingboard2.dtb"
KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-tbs2910.dtb"
KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-udoo.dtb imx6dl-udoo.dtb"
KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-udoo-15lvds.dtb imx6q-udoo-7lvds.dtb"
KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6dl-udoo-15lvds.dtb imx6dl-udoo-7lvds.dtb"
KERNEL_UBOOT_EXTRA_TARGET="imx6q-cubox-i.dtb imx6dl-cubox-i.dtb \
imx6q-hummingboard.dtb imx6dl-hummingboard.dtb \
imx6q-hummingboard2.dtb imx6dl-hummingboard2.dtb \
imx6q-tbs2910.dtb \
imx6q-udoo.dtb imx6dl-udoo.dtb \
imx6q-udoo-7lvds.dtb imx6dl-udoo-7lvds.dtb \
imx6q-udoo-15lvds.dtb imx6dl-udoo-15lvds.dtb"
# Additional kernel make parameters (for example to specify the u-boot loadaddress)
KERNEL_MAKE_EXTRACMD=""

View File

@ -0,0 +1,120 @@
--- a/board/solidrun/mx6_cubox-i/mx6_cubox-i.c 2016-12-22 18:58:59.769716356 +0100
+++ b/board/solidrun/mx6_cubox-i/mx6_cubox-i.c 2016-12-22 18:59:11.293716827 +0100
@@ -79,9 +79,85 @@
int hb_cuboxi_ = 0; /* 2 is HummingBoard2, 1 is HummingBoard, 0 is CuBox-i */
int ver_15_ = 0; /* 0 is original som, 1 is the rev 1.5 */
+/*
+ * Check memory range for valid RAM. A simple memory test determines
+ * the actually available RAM size between addresses `base' and
+ * `base + maxsize'.
+ * This algorithm uses value MEM_STRIDE (like 128MByte) steps instead of the one bit right shift
+ * algorithm originally used in get_ram_size() since a 4GByte memory setup in
+ * a 32bit architecture forbids addressing all the memory, so right shift
+ * algorithm that assumes total memory size is exponents of 2 would fail.
+ */
+#define MEM_STRIDE 0x04000000
+static u32 get_ram_size_stride_test(u32 *base, u32 maxsize)
+{
+ volatile u32 *addr;
+ u32 save[64];
+ u32 cnt;
+ long size;
+ u32 size_tmp;
+ int i = 0;
+ cnt = maxsize;
+ /* First save the data */
+ for (cnt = 0; cnt < maxsize; cnt += MEM_STRIDE) {
+ addr = (volatile u32 *)((u32)base + cnt); /* pointer arith! */
+ sync ();
+ save[i] = *addr;
+ i++;
+ sync ();
+ }
+ /* First write a signature */
+ * (volatile u32 *) base = 0x12345678;
+ for (size_tmp = MEM_STRIDE; size_tmp < (u32)maxsize; size_tmp += MEM_STRIDE) {
+ long tmp;
+ * (volatile u32 *)((u32)base + (u32)size_tmp) = (u32)size_tmp;
+ sync ();
+ tmp = * (volatile u32 *)((u32)base + (u32)size);
+ if (tmp == size_tmp) { /* Looks we reached overlapping address */
+ break;
+ }
+ }
+ /* Resotre the data */
+ for (cnt = (maxsize - MEM_STRIDE); i > 0; cnt -= MEM_STRIDE) {
+ i--;
+ addr = (volatile u32 *)((u32)base + cnt); /* pointer arith! */
+ sync ();
+ * addr = save[i];
+ sync ();
+ }
+ maxsize = size_tmp;
+
+ return (maxsize);
+}
+
int dram_init(void)
{
- gd->ram_size = imx_ddr_size();
+ uint cpurev, imxtype;
+ u32 sdram_size;
+
+ cpurev = get_cpu_rev();
+ imxtype = (cpurev & 0xFF000) >> 12;
+
+ switch (imxtype){
+ case MXC_CPU_MX6SOLO:
+ sdram_size = 0x20000000;
+ break;
+ case MXC_CPU_MX6Q:
+ {
+ /* Read first the snoop control unit config register */
+ u32 scu_config = *(u32 *)(SCU_BASE_ADDR + 0x4);
+ if ((scu_config & 0x3) == 0x3) /* Quad core */
+ sdram_size = 0xf0000000;
+ else /* Dual core */
+ sdram_size = 0x40000000;
+ break;
+ }
+ case MXC_CPU_MX6DL:
+ default:
+ sdram_size = 0x40000000;
+ break;
+ }
+ gd->ram_size = get_ram_size_stride_test((void *)PHYS_SDRAM, sdram_size);
return 0;
}
--- a/board/solidrun/mx6_cubox-i/mx6_cubox-i.c 2015-07-12 20:18:36.781791390 +0200
+++ b/board/solidrun/mx6_cubox-i/mx6_cubox-i.c 2015-07-12 20:18:36.817791389 +0200
@@ -94,10 +94,9 @@
volatile u32 *addr;
u32 save[64];
u32 cnt;
- long size;
u32 size_tmp;
int i = 0;
- cnt = maxsize;
+
/* First save the data */
for (cnt = 0; cnt < maxsize; cnt += MEM_STRIDE) {
addr = (volatile u32 *)((u32)base + cnt); /* pointer arith! */
@@ -112,12 +111,12 @@
long tmp;
* (volatile u32 *)((u32)base + (u32)size_tmp) = (u32)size_tmp;
sync ();
- tmp = * (volatile u32 *)((u32)base + (u32)size);
+ tmp = * (volatile u32 *) base;
if (tmp == size_tmp) { /* Looks we reached overlapping address */
break;
}
}
- /* Resotre the data */
+ /* Restore the data */
for (cnt = (maxsize - MEM_STRIDE); i > 0; cnt -= MEM_STRIDE) {
i--;
addr = (volatile u32 *)((u32)base + cnt); /* pointer arith! */