board: Add new Samsung "stemmy" board based on ST-Ericsson U8500
authorStephan Gerhold <stephan@gerhold.net>
Sat, 4 Jan 2020 17:45:19 +0000 (18:45 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 22 Jan 2020 22:47:57 +0000 (17:47 -0500)
The ST-Ericsson U8500 SoC has been used in mass-production for
some Android smartphones released around 2012.
In particular, Samsung has released more than 5 different
smartphones based on U8500, e.g.

  - Samsung Galaxy S III mini (GT-I8190) "golden"
  - Samsung Galaxy S Advance (GT-I9070)  "janice"
  - Samsung Galaxy Xcover 2 (GT-S7710)   "skomer"

and a few others.

Mainline Linux has great support for the Ux500 SoC, so these
smartphones can also run Linux mainline quite well.

Unfortunately, the original Samsung bootloader used on these devices
has limitations that prevent booting Linux mainline directly.
It keeps the L2 cache enabled, which causes Linux to crash very early,
shortly after decompressing the kernel.

Using U-Boot allows to circumvent these limitations. We can let the
Samsung bootloader chain-load U-Boot and U-Boot locks the L2 cache
before booting into Linux. U-Boot has several other advantages
- it supports device-trees directly and we are no longer limited to
flashing Android boot images through Samsung's proprietary download
mode.

The Samsung "stemmy" board covers all Samsung devices based on U8500.
Add minimal support for "stemmy". For now only UART is supported but
this will be extended later.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
arch/arm/dts/Makefile
arch/arm/dts/ste-ux500-samsung-stemmy.dts [new file with mode: 0644]
arch/arm/mach-u8500/Kconfig
board/ste/stemmy/Kconfig [new file with mode: 0644]
board/ste/stemmy/MAINTAINERS [new file with mode: 0644]
board/ste/stemmy/Makefile [new file with mode: 0644]
board/ste/stemmy/README [new file with mode: 0644]
board/ste/stemmy/stemmy.c [new file with mode: 0644]
configs/stemmy_defconfig [new file with mode: 0644]
include/configs/stemmy.h [new file with mode: 0644]

index 44f742017e51565f080ea1e973b7295cfde619d0..38d0c2a92c3dd79495d335dfa8cbfbceb7cd499a 100644 (file)
@@ -389,6 +389,8 @@ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \
 dtb-$(CONFIG_TARGET_DRAGONBOARD410C) += dragonboard410c.dtb
 dtb-$(CONFIG_TARGET_DRAGONBOARD820C) += dragonboard820c.dtb
 
+dtb-$(CONFIG_TARGET_STEMMY) += ste-ux500-samsung-stemmy.dtb
+
 dtb-$(CONFIG_STM32F4) += stm32f429-disco.dtb \
        stm32429i-eval.dtb \
        stm32f469-disco.dtb
diff --git a/arch/arm/dts/ste-ux500-samsung-stemmy.dts b/arch/arm/dts/ste-ux500-samsung-stemmy.dts
new file mode 100644 (file)
index 0000000..7e7f4c8
--- /dev/null
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/dts-v1/;
+
+#include "ste-dbx5x0-u-boot.dtsi"
+#include "ste-ab8500.dtsi"
+
+/ {
+       compatible = "samsung,stemmy", "st-ericsson,u8500";
+
+       chosen {
+               stdout-path = &serial2;
+       };
+
+       soc {
+               /* Debugging console UART */
+               uart@80007000 {
+                       status = "okay";
+               };
+       };
+};
index 3bc76295cb51161324a757f71a93b4e218a5555a..7478deb25f510670aa2cd49b844c0ea7e58a9f82 100644 (file)
@@ -3,4 +3,25 @@ if ARCH_U8500
 config SYS_SOC
        default "u8500"
 
+choice
+       prompt "U8500 board selection"
+
+config TARGET_STEMMY
+       bool "Samsung (stemmy) board"
+       help
+         The Samsung "stemmy" board supports Samsung smartphones released with
+         the ST-Ericsson NovaThor U8500 SoC, e.g.
+
+             - Samsung Galaxy S III mini (GT-I8190)    "golden"
+             - Samsung Galaxy S Advance (GT-I9070)     "janice"
+             - Samsung Galaxy Xcover 2 (GT-S7710)      "skomer"
+
+         and likely others as well (untested).
+
+         See board/ste/stemmy/README for details.
+
+endchoice
+
+source "board/ste/stemmy/Kconfig"
+
 endif
diff --git a/board/ste/stemmy/Kconfig b/board/ste/stemmy/Kconfig
new file mode 100644 (file)
index 0000000..b890ba5
--- /dev/null
@@ -0,0 +1,12 @@
+if TARGET_STEMMY
+
+config SYS_BOARD
+       default "stemmy"
+
+config SYS_VENDOR
+       default "ste"
+
+config SYS_CONFIG_NAME
+       default "stemmy"
+
+endif
diff --git a/board/ste/stemmy/MAINTAINERS b/board/ste/stemmy/MAINTAINERS
new file mode 100644 (file)
index 0000000..37daabe
--- /dev/null
@@ -0,0 +1,6 @@
+STEMMY BOARD
+M:     Stephan Gerhold <stephan@gerhold.net>
+S:     Maintained
+F:     board/ste/stemmy/
+F:     include/configs/stemmy.h
+F:     configs/stemmy_defconfig
diff --git a/board/ste/stemmy/Makefile b/board/ste/stemmy/Makefile
new file mode 100644 (file)
index 0000000..1245099
--- /dev/null
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+obj-y  := stemmy.o
diff --git a/board/ste/stemmy/README b/board/ste/stemmy/README
new file mode 100644 (file)
index 0000000..81f7242
--- /dev/null
@@ -0,0 +1,49 @@
+ST-Ericsson U8500 Samsung "stemmy" board
+========================================
+
+The "stemmy" board supports Samsung smartphones released with
+the ST-Ericsson NovaThor U8500 SoC, e.g.
+
+       - Samsung Galaxy S III mini (GT-I8190)  "golden"
+       - Samsung Galaxy S Advance (GT-I9070)   "janice"
+       - Samsung Galaxy Xcover 2 (GT-S7710)    "skomer"
+
+and likely others as well (untested).
+
+At the moment, U-Boot is intended to be chain-loaded from
+the original Samsung bootloader, not replacing it entirely.
+
+Installation
+------------
+
+1. Setup cross compiler, e.g. export CROSS_COMPILE=arm-none-eabi-
+2. make stemmy_defconfig
+3. make
+
+For newer devices (golden and skomer), the U-Boot binary has to be packed into
+an Android boot image. janice boots the raw U-Boot binary from the boot partition.
+
+4. Obtain mkbootimg, e.g. https://android.googlesource.com/platform/system/core/+/refs/tags/android-7.1.2_r37/mkbootimg/mkbootimg
+5. mkbootimg \
+    --kernel=u-boot.bin \
+    --base=0x00000000 \
+    --kernel_offset=0x00100000 \
+    --ramdisk_offset=0x02000000 \
+    --tags_offset=0x00000100 \
+    --output=u-boot.img
+
+6. Enter Samsung download mode (press Power + Home + Volume Down)
+7. Flash U-Boot image to Android boot partition using Heimdall:
+     https://gitlab.com/BenjaminDobell/Heimdall
+
+   heimdall flash --Kernel u-boot.(bin|img)
+
+8. After reboot U-Boot prompt should appear via UART.
+
+UART
+----
+
+UART is available through the micro USB port, similar to the Carkit standard.
+With a ~619kOhm resistor between ID and GND, 1.8V RX/TX is available at D+/D-.
+
+Make sure to connect the UART cable *before* turning on the phone.
diff --git a/board/ste/stemmy/stemmy.c b/board/ste/stemmy/stemmy.c
new file mode 100644 (file)
index 0000000..8cf6f18
--- /dev/null
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2019 Stephan Gerhold <stephan@gerhold.net>
+ */
+#include <common.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+       gd->ram_size = get_ram_size(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_SDRAM_SIZE);
+       return 0;
+}
+
+int board_init(void)
+{
+       return 0;
+}
diff --git a/configs/stemmy_defconfig b/configs/stemmy_defconfig
new file mode 100644 (file)
index 0000000..6908ef3
--- /dev/null
@@ -0,0 +1,18 @@
+CONFIG_ARM=y
+CONFIG_ARCH_U8500=y
+CONFIG_SYS_TEXT_BASE=0x100000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_CONFIG=y
+CONFIG_CMD_LICENSE=y
+CONFIG_CMD_DM=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_GETTIME=y
+CONFIG_EFI_PARTITION=y
+CONFIG_DEFAULT_DEVICE_TREE="ste-ux500-samsung-stemmy"
+# CONFIG_NET is not set
+# CONFIG_MMC_HW_PARTITIONING is not set
+# CONFIG_EFI_LOADER is not set
diff --git a/include/configs/stemmy.h b/include/configs/stemmy.h
new file mode 100644 (file)
index 0000000..922eec4
--- /dev/null
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2019 Stephan Gerhold <stephan@gerhold.net>
+ */
+#ifndef __CONFIGS_STEMMY_H
+#define __CONFIGS_STEMMY_H
+
+#include <linux/sizes.h>
+
+#define CONFIG_SKIP_LOWLEVEL_INIT      /* Loaded by another bootloader */
+#define CONFIG_SYS_MALLOC_LEN          SZ_2M
+
+/* Physical Memory Map */
+#define PHYS_SDRAM_1                   0x00000000      /* DDR-SDRAM Bank #1 */
+#define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
+#define CONFIG_SYS_SDRAM_SIZE          SZ_1G
+#define CONFIG_SYS_INIT_RAM_SIZE       0x00100000
+#define CONFIG_SYS_GBL_DATA_OFFSET     (CONFIG_SYS_SDRAM_BASE + \
+                                        CONFIG_SYS_INIT_RAM_SIZE - \
+                                        GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_INIT_SP_ADDR                CONFIG_SYS_GBL_DATA_OFFSET
+
+/* FIXME: This should be loaded from device tree... */
+#define CONFIG_SYS_L2_PL310
+#define CONFIG_SYS_PL310_BASE          0xa0412000
+
+#define CONFIG_SYS_LOAD_ADDR           0x00100000
+
+#endif