From patchwork Sun Oct 17 10:45:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 1542203 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=b2iJlUDF; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HXGsY1F0dz9s1l for ; Sun, 17 Oct 2021 21:46:57 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 805668362B; Sun, 17 Oct 2021 12:46:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="b2iJlUDF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 230578347D; Sun, 17 Oct 2021 12:46:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS,WEIRD_QUOTING autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 74560834AA for ; Sun, 17 Oct 2021 12:45:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dsankouski@gmail.com Received: by mail-ed1-x536.google.com with SMTP id w14so58021063edv.11 for ; Sun, 17 Oct 2021 03:45:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kYfHIaBvyuKJ3qiuq1oURQcems3YhhygzAu7jb9vQ+U=; b=b2iJlUDFKERit0wXaFYzvqp92ZHKqs13R0rIXdqYbL1I+MyqaOvPmhNxfWBY1Yf29F 990WdNydlK2SGZ4olUv698eAcNaYcUjpJJTXPJyxCRJaUUcZmBdutn3psZn9CEOV0+NX E5JdzM4+1tuARGt4qyhePhiFQZocYPjGgrV5NSjHm6YfsdoSjRiGeOwvMM+1LuWHHbVZ bm4VI4d2xQeheBRc9XAPRGpMHBbMDw5oZOORYiY8GPEOkNV47A5q3LXMmvNPTy/Xk6uP hBaFZf1mVvblA5ROwLWx/0Y/VYhlG2Jq6GTlwuJhO6wCAZgkodJiQ7c/PZJT4XZGkbWP XPwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kYfHIaBvyuKJ3qiuq1oURQcems3YhhygzAu7jb9vQ+U=; b=QdCfsg1oKb+OVzlc54+kL+WfFLR4/JJEcrkUKK5SnAy9Qqwg99tPjTz0M+aNoplUGF e33+5UsGv+LfoUbwRrrQEt3Bu2dioBUaqvNRgK0ilo5b4zo74my4xHXRn0vHaUdVU0BI GnNlw6GBjvh84SlXagc6QNA/M3EJ3qgNLP32p3Z44NcuqX9CYokRaKmNr5IAbrtgSJPd AYlImDjfD+zUO38gYVOWLKsDNPoGfj3OIxG8kMzn7gB3vnu6DbXuy5VjJ9WPk30ueduq lIaWLh2hxilPIHM/DKjbLOkByI3ymDFhziMy8QVWZ0NvIu43UfmgelijYVjTilMK2Ln5 pkDQ== X-Gm-Message-State: AOAM533mrLVKOHWiz9zLUoOpJG5UE1yaAhuXPQsYHKRvEG2bAny9gsIR 2ppZJuYVlwOw0JzgZ2td8iWALtNnZLsKeA== X-Google-Smtp-Source: ABdhPJxXGMI+FZUjPj9BPWE67vx8yVTgvah87SSXeOitgoJvSCWXcVt2RtS1uEPjQrTu3na+jGyxpg== X-Received: by 2002:a50:e005:: with SMTP id e5mr34212812edl.211.1634467551216; Sun, 17 Oct 2021 03:45:51 -0700 (PDT) Received: from localhost.localdomain ([46.216.16.109]) by smtp.gmail.com with ESMTPSA id l23sm7403576ejn.15.2021.10.17.03.45.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Oct 2021 03:45:50 -0700 (PDT) From: Dzmitry Sankouski To: u-boot@lists.denx.de Cc: Dzmitry Sankouski , Minkyu Kang Subject: [PATCH 4/4] board: samsung: add support for Galaxy A series of 2017 (a5y17lte) Date: Sun, 17 Oct 2021 13:45:42 +0300 Message-Id: <20211017104542.3821-5-dsankouski@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211017104542.3821-1-dsankouski@gmail.com> References: <20211017104542.3821-1-dsankouski@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Samsung Galaxy A3, A5, A7 (2017) - middle class Samsung smartphones. U-boot can be used as chain-loaded bootloader to gain control on booting vanilla linux(and possibly others) kernels Signed-off-by: Dzmitry Sankouski Cc: Minkyu Kang --- arch/arm/dts/Makefile | 3 + arch/arm/dts/exynos78x0-axy17lte.dts | 29 +++++++++ arch/arm/mach-exynos/Kconfig | 28 +++++++++ board/samsung/axy17lte/Kconfig | 58 ++++++++++++++++++ board/samsung/axy17lte/MAINTAINERS | 8 +++ board/samsung/axy17lte/Makefile | 3 + board/samsung/axy17lte/axy17lte.c | 11 ++++ configs/a3y17lte_defconfig | 24 ++++++++ configs/a5y17lte_defconfig | 24 ++++++++ configs/a7y17lte_defconfig | 24 ++++++++ doc/board/index.rst | 1 + doc/board/samsung/axy17lte.rst | 92 ++++++++++++++++++++++++++++ doc/board/samsung/index.rst | 9 +++ 13 files changed, 314 insertions(+) create mode 100644 arch/arm/dts/exynos78x0-axy17lte.dts create mode 100644 board/samsung/axy17lte/Kconfig create mode 100644 board/samsung/axy17lte/MAINTAINERS create mode 100644 board/samsung/axy17lte/Makefile create mode 100644 board/samsung/axy17lte/axy17lte.c create mode 100644 configs/a3y17lte_defconfig create mode 100644 configs/a5y17lte_defconfig create mode 100644 configs/a7y17lte_defconfig create mode 100644 doc/board/samsung/axy17lte.rst create mode 100644 doc/board/samsung/index.rst diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index b8a382d153..947c15aa50 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -28,6 +28,9 @@ dtb-$(CONFIG_EXYNOS5) += exynos5250-arndale.dtb \ exynos5800-peach-pi.dtb \ exynos5422-odroidxu3.dtb dtb-$(CONFIG_EXYNOS7420) += exynos7420-espresso7420.dtb +dtb-$(CONFIG_TARGET_A5Y17LTE) += exynos78x0-axy17lte.dtb +dtb-$(CONFIG_TARGET_A3Y17LTE) += exynos78x0-axy17lte.dtb +dtb-$(CONFIG_TARGET_A7Y17LTE) += exynos78x0-axy17lte.dtb dtb-$(CONFIG_ARCH_DAVINCI) += \ da850-evm.dtb \ diff --git a/arch/arm/dts/exynos78x0-axy17lte.dts b/arch/arm/dts/exynos78x0-axy17lte.dts new file mode 100644 index 0000000000..7fae8db874 --- /dev/null +++ b/arch/arm/dts/exynos78x0-axy17lte.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Samsung Exynos78x0 SoC device tree source + * + * Copyright (c) 2020 Dzmitry Sankouski (dsankouski@gmail.com) + */ + +/dts-v1/; +#include "exynos78x0.dtsi" +/ { + compatible = "samsung,exynos78x0", "samsung,exynos7880", "samsung,exynos7870"; + + aliases { + console = &uart2; + }; + + chosen { + stdout-path = &uart2; + }; +}; + +&gpioi2c0 { + status = "okay"; +}; + +&fin_pll { + clock-frequency = <26000000>; +}; + diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index 7df0e17617..7f3aee5712 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig @@ -151,6 +151,33 @@ config TARGET_ESPRESSO7420 select PINCTRL_EXYNOS7420 select SUPPORT_SPL +config TARGET_A5Y17LTE + bool "Samsung SM-A520F board" + select ARM64 + select CLK_EXYNOS + select OF_CONTROL + select PINCTRL + select PINCTRL_EXYNOS78x0 + select SUPPORT_SPL + +config TARGET_A7Y17LTE + bool "Samsung SM-A520F board" + select ARM64 + select CLK_EXYNOS + select OF_CONTROL + select PINCTRL + select PINCTRL_EXYNOS78x0 + select SUPPORT_SPL + +config TARGET_A3Y17LTE + bool "Samsung SM-A520F board" + select ARM64 + select CLK_EXYNOS + select OF_CONTROL + select PINCTRL + select PINCTRL_EXYNOS7880 + select SUPPORT_SPL + endchoice endif @@ -167,6 +194,7 @@ source "board/samsung/arndale/Kconfig" source "board/samsung/smdk5250/Kconfig" source "board/samsung/smdk5420/Kconfig" source "board/samsung/espresso7420/Kconfig" +source "board/samsung/axy17lte/Kconfig" config SPL_LDSCRIPT default "board/samsung/common/exynos-uboot-spl.lds" if ARCH_EXYNOS5 || ARCH_EXYNOS4 diff --git a/board/samsung/axy17lte/Kconfig b/board/samsung/axy17lte/Kconfig new file mode 100644 index 0000000000..2abf8e7acf --- /dev/null +++ b/board/samsung/axy17lte/Kconfig @@ -0,0 +1,58 @@ +config SYS_CONFIG_NAME + string "Board configuration name" + default "exynos78x0-common.h" + help + This option contains information about board configuration name. + Based on this option include/configs/.h header + will be used for board configuration. + +if TARGET_A5Y17LTE +config SYS_BOARD + default "axy17lte" + help + a5y17lte is a production board for SM-A520F phone on Exynos7880 SoC. + +config SYS_VENDOR + default "samsung" + +config SYS_CONFIG_NAME + default "a5y17lte" + +config EXYNOS7880 + bool "Exynos 7880 SOC support" + default y +endif + +if TARGET_A7Y17LTE +config SYS_BOARD + default "axy17lte" + help + a5y17lte is a production board for SM-A520F phone on Exynos7880 SoC. + +config SYS_VENDOR + default "samsung" + +config SYS_CONFIG_NAME + default "a5y17lte" + +config EXYNOS7880 + bool "Exynos 7880 SOC support" + default y +endif + +if TARGET_A3Y17LTE +config SYS_BOARD + default "axy17lte" + help + a3y17lte is a production board for SM-A520F phone on Exynos7880 SoC. + +config SYS_VENDOR + default "samsung" + +config SYS_CONFIG_NAME + default "a3y17lte" + +config EXYNOS7870 + bool "Exynos 7870 SOC support" + default y +endif diff --git a/board/samsung/axy17lte/MAINTAINERS b/board/samsung/axy17lte/MAINTAINERS new file mode 100644 index 0000000000..13feba62a7 --- /dev/null +++ b/board/samsung/axy17lte/MAINTAINERS @@ -0,0 +1,8 @@ +Samsung A series 2017 phones Board +M: Dzmitry Sankouski +S: Maintained +F: board/samsung/axy17lte/ +F: include/configs/exynos78x0-common.h +F: configs/a3y17lte_defconfig +F: configs/a5y17lte_defconfig +F: configs/a7y17lte_defconfig diff --git a/board/samsung/axy17lte/Makefile b/board/samsung/axy17lte/Makefile new file mode 100644 index 0000000000..4e11f289dc --- /dev/null +++ b/board/samsung/axy17lte/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +obj-y += axy17lte.o diff --git a/board/samsung/axy17lte/axy17lte.c b/board/samsung/axy17lte/axy17lte.c new file mode 100644 index 0000000000..c38297a05b --- /dev/null +++ b/board/samsung/axy17lte/axy17lte.c @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Samsung A5Y17 and A3Y17 LTE boards based on Exynos 7880 and Exynos 7870 SoCs + */ + +#include + +int exynos_init(void) +{ + return 0; +} diff --git a/configs/a3y17lte_defconfig b/configs/a3y17lte_defconfig new file mode 100644 index 0000000000..36404d15f7 --- /dev/null +++ b/configs/a3y17lte_defconfig @@ -0,0 +1,24 @@ +CONFIG_ARM=y +CONFIG_ARCH_EXYNOS=y +CONFIG_ARCH_EXYNOS7=y +CONFIG_S5P=y +CONFIG_TARGET_A3Y17LTE=y +# This option is a number of 256MB DRAM banks, i.e. (ram size) / 256MB. +# Used in samsung common board dram_init function. +CONFIG_NR_DRAM_BANKS=8 +CONFIG_SYS_CONFIG_NAME="exynos78x0-common" +CONFIG_DEFAULT_DEVICE_TREE="exynos78x0-axy17lte" +CONFIG_SYS_TEXT_BASE=0x40001000 +CONFIG_SYS_LOAD_ADDR=0x40001000 +CONFIG_HUSH_PARSER=y +CONFIG_FIT=y +CONFIG_BOARD_EARLY_INIT_F=n +CONFIG_SKIP_LOWLEVEL_INIT=y +CONFIG_CMD_GPIO=y +CONFIG_DISPLAY_CPUINFO=n +CONFIG_CMD_I2C=y +CONFIG_DM_I2C_GPIO=y +CONFIG_PINCTRL_EXYNOS78x0=y +CONFIG_PINCTRL_EXYNOS=y +# CONFIG_DEBUG_UART_S5P=y +# CONFIG_DEBUG_UART_BASE=0x13820000 \ No newline at end of file diff --git a/configs/a5y17lte_defconfig b/configs/a5y17lte_defconfig new file mode 100644 index 0000000000..273ad1078e --- /dev/null +++ b/configs/a5y17lte_defconfig @@ -0,0 +1,24 @@ +CONFIG_ARM=y +CONFIG_ARCH_EXYNOS=y +CONFIG_ARCH_EXYNOS7=y +CONFIG_S5P=y +CONFIG_TARGET_A5Y17LTE=y +# This option is a number of 256MB DRAM banks, i.e. (ram size) / 256MB. +# Used in samsung common board dram_init function. +CONFIG_NR_DRAM_BANKS=12 +CONFIG_SYS_CONFIG_NAME="exynos78x0-common" +CONFIG_DEFAULT_DEVICE_TREE="exynos78x0-axy17lte" +CONFIG_SYS_TEXT_BASE=0x40001000 +CONFIG_SYS_LOAD_ADDR=0x40001000 +CONFIG_HUSH_PARSER=y +CONFIG_FIT=y +CONFIG_BOARD_EARLY_INIT_F=n +CONFIG_SKIP_LOWLEVEL_INIT=y +CONFIG_CMD_GPIO=y +CONFIG_DISPLAY_CPUINFO=n +CONFIG_CMD_I2C=y +CONFIG_DM_I2C_GPIO=y +CONFIG_PINCTRL_EXYNOS78x0=y +CONFIG_PINCTRL_EXYNOS=y +# CONFIG_DEBUG_UART_S5P=y +# CONFIG_DEBUG_UART_BASE=0x13820000 \ No newline at end of file diff --git a/configs/a7y17lte_defconfig b/configs/a7y17lte_defconfig new file mode 100644 index 0000000000..f544f629ef --- /dev/null +++ b/configs/a7y17lte_defconfig @@ -0,0 +1,24 @@ +CONFIG_ARM=y +CONFIG_ARCH_EXYNOS=y +CONFIG_ARCH_EXYNOS7=y +CONFIG_S5P=y +CONFIG_TARGET_A7Y17LTE=y +# This option is a number of 256MB DRAM banks, i.e. (ram size) / 256MB. +# Used in samsung common board dram_init function. +CONFIG_NR_DRAM_BANKS=12 +CONFIG_SYS_CONFIG_NAME="exynos78x0-common" +CONFIG_DEFAULT_DEVICE_TREE="exynos78x0-axy17lte" +CONFIG_SYS_TEXT_BASE=0x40001000 +CONFIG_SYS_LOAD_ADDR=0x40001000 +CONFIG_HUSH_PARSER=y +CONFIG_FIT=y +CONFIG_BOARD_EARLY_INIT_F=n +CONFIG_SKIP_LOWLEVEL_INIT=y +CONFIG_CMD_GPIO=y +CONFIG_DISPLAY_CPUINFO=n +CONFIG_CMD_I2C=y +CONFIG_DM_I2C_GPIO=y +CONFIG_PINCTRL_EXYNOS78x0=y +CONFIG_PINCTRL_EXYNOS=y +# CONFIG_DEBUG_UART_S5P=y +# CONFIG_DEBUG_UART_BASE=0x13820000 \ No newline at end of file diff --git a/doc/board/index.rst b/doc/board/index.rst index aa397ab942..c09339480b 100644 --- a/doc/board/index.rst +++ b/doc/board/index.rst @@ -22,6 +22,7 @@ Board-specific doc openpiton/index qualcomm/index rockchip/index + samsung/index siemens/index sifive/index sipeed/index diff --git a/doc/board/samsung/axy17lte.rst b/doc/board/samsung/axy17lte.rst new file mode 100644 index 0000000000..b3f718dfc8 --- /dev/null +++ b/doc/board/samsung/axy17lte.rst @@ -0,0 +1,92 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. sectionauthor:: Dzmitry Sankouski + +Samsung 2017 A series phones +================ + +About this +---------- +This document describes the information about Samsung A(7/5/3) 2017 midrange +phones and u-boot usage steps. + +U-Boot can be used as a chain-loaded bootloader to replace Samsung's original SBOOT bootloader. +It is loaded as an Android boot image through SBOOT. + +Phone specs +---------- +A3 (SM-320) (a3y17lte) +^^^^^^^^^^ +- 4.7 AMOLED display +- Exynos 7870 SoC +- 16GB flash +- 2GB RAM + +.. A3 2017 wiki page: https://en.wikipedia.org/wiki/Samsung_Galaxy_A3_(2017) + +A5 (SM-520) (a5y17lte) +^^^^^^^^^^ +- 5.2 AMOLED display +- Exynos 7880 SoC +- 32GB flash +- 3GB RAM +.. A5 2017 wiki page: https://en.wikipedia.org/wiki/Samsung_Galaxy_A5_(2017) + +A7 (SM-720) (a5y17lte) +^^^^^^^^^^ +- 5.7 AMOLED display +- Exynos 7880 SoC +- 32GB flash +- 3GB RAM +.. A7 2017 wiki page: https://en.wikipedia.org/wiki/Samsung_Galaxy_A7_(2017) + +Installation +------------ + +Building u-boot +^^^^^^^^^^ + +First, setup ``CROSS_COMPILE`` for aarch64. +Then, build U-Boot for your phone, for example ``a5y17lte``:: + + $ export CROSS_COMPILE= + $ make a5y17lte_defconfig + $ make + +This will build ``u-boot.bin`` in the configured output directory. + +Payload +^^^^^^^^^^ +What is a payload? +"""""""""" +A payload file is a file to be used instead of linux kernel in android boot image. +This file will be loaded into memory, and executed by SBOOT, +and is therefore SBOOT's payload. +It may be pure u-boot (with loading u-boot's payload from flash in mind), +or u-boot + u-boot's payload. + +It should be kept in mind, that SBOOT binary patches it's payload after loading +in address range 0x401f8550-0x401f9280. Given SBOOT loads payload to 0x40001000, +a range of 0x1f7550-0x1f8280 (2061648-2065024) in a payload file +will be corrupted after loading to RAM. + +Creating payload file +"""""""""" +- Assemble FIT image for your kernel +- Create a file for u-boot payload ``touch sboot-payload`` +- Write zeroes till 0x200000 address to be sure SBOOT won't corrupt your info + ``dd if=/dev/zero of=sboot-payload bs=$((0x200000)) count=1`` +- Write u-boot to the start of the payload ``dd if= of=sboot-payload`` +- Write FIT image to payload from 0x200000 address + ``dd if= of=sboot-payload seek=1 bs=2M`` + +Creating android boot image +"""""""""" +Once payload created, it's time for android image:: + + mkbootimg --base 0x40000000 --kernel_offset 0x00000000 --ramdisk_offset 0x01000000 --tags_offset 0x00000100 --pagesize 2048 --second_offset 0x00f00000 --kernel -o uboot.img + +Note, that stock Samsung bootloader ignores offsets, set in mkbootimg. + +Flashing +"""""""""" +Flash like regular android boot image. diff --git a/doc/board/samsung/index.rst b/doc/board/samsung/index.rst new file mode 100644 index 0000000000..c904372dff --- /dev/null +++ b/doc/board/samsung/index.rst @@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Samsung +======== + +.. toctree:: + :maxdepth: 2 + + axy17lte