mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
board: samsung: exynos-mobile: add exynos7870 support and three devices
Add basic support for the Exynos7870 SoC, this includes device tree match logic using multiple boards, where devices use a stub dtb in Samsung's QCDT format. S-BOOT, the previous stage bootloader, places its cmdline arguments there, which has identifying information. This is added with support for three devices: * Samsung Galaxy A2 Core (codename: a2corelte) * Samsung Galaxy J6 (codename: j6lte) * Samsung Galaxy J7 Prime (codename: on7xelte) Add their device trees in the defconfig, and also enable the clock and pin controller drivers. Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
This commit is contained in:
committed by
Minkyu Kang
parent
ed9ba442ee
commit
8580ca964f
7
board/samsung/exynos-mobile/debug-exynos7870.config
Normal file
7
board/samsung/exynos-mobile/debug-exynos7870.config
Normal file
@@ -0,0 +1,7 @@
|
||||
CONFIG_DEBUG_UART=y
|
||||
CONFIG_DEBUG_UART_BASE=0x13820000
|
||||
CONFIG_DEBUG_UART_CLOCK=133250000
|
||||
CONFIG_DEBUG_UART_S5P=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LOG_CONSOLE=y
|
||||
CONFIG_LOG_MAX_LEVEL=8
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <env.h>
|
||||
#include <errno.h>
|
||||
#include <init.h>
|
||||
#include <limits.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <lmb.h>
|
||||
#include <part.h>
|
||||
@@ -53,6 +54,96 @@ static struct mm_region exynos_mem_map[CONFIG_NR_DRAM_BANKS + 2] = {
|
||||
|
||||
struct mm_region *mem_map = exynos_mem_map;
|
||||
|
||||
static const u64 exynos7870_common_dram_bank_bases[CONFIG_NR_DRAM_BANKS] = {
|
||||
0x40000000, 0x80000000, 0x100000000,
|
||||
};
|
||||
|
||||
static const char *exynos_prev_bl_get_bootargs(void)
|
||||
{
|
||||
void *prev_bl_fdt_base = (void *)get_prev_bl_fdt_addr();
|
||||
int chosen_node_offset, ret;
|
||||
const struct fdt_property *bootargs_prop;
|
||||
|
||||
ret = fdt_check_header(prev_bl_fdt_base);
|
||||
if (ret < 0) {
|
||||
log_err("%s: FDT is invalid (FDT_ERR %d)\n", __func__, ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = fdt_path_offset(prev_bl_fdt_base, "/chosen");
|
||||
chosen_node_offset = ret;
|
||||
if (ret < 0) {
|
||||
log_err("%s: /chosen node not found (FDT_ERR %d)\n", __func__,
|
||||
ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bootargs_prop = fdt_get_property(prev_bl_fdt_base, chosen_node_offset,
|
||||
"bootargs", &ret);
|
||||
if (!bootargs_prop) {
|
||||
log_err("%s: /chosen/bootargs property not found (FDT_ERR %d)\n",
|
||||
__func__, ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return bootargs_prop->data;
|
||||
}
|
||||
|
||||
static int exynos7870_fdt_match(struct exynos_board_info *board_info)
|
||||
{
|
||||
const char *prev_bl_bootargs;
|
||||
int val, ret;
|
||||
|
||||
prev_bl_bootargs = exynos_prev_bl_get_bootargs();
|
||||
if (!prev_bl_bootargs)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Read the cmdline property which stores the
|
||||
* bootloader/firmware version. An example value of the option
|
||||
* can be: "J600GDXU3ARH5". This can be used to verify the model
|
||||
* of the device.
|
||||
*/
|
||||
ret = cmdline_get_arg(prev_bl_bootargs, "androidboot.bootloader", &val);
|
||||
if (ret < 0) {
|
||||
log_err("%s: unable to find property for bootloader version (%d)\n",
|
||||
__func__, ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strncmp(prev_bl_bootargs + val, board_info->match_model,
|
||||
strlen(board_info->match_model)))
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Read the cmdline property which stores the hardware revision.
|
||||
* This is required to allow selecting one of multiple dtbs
|
||||
* available of a single device, varying in hardware changes in
|
||||
* different revisions.
|
||||
*/
|
||||
ret = cmdline_get_arg(prev_bl_bootargs, "androidboot.revision", &val);
|
||||
if (ret < 0)
|
||||
ret = cmdline_get_arg(prev_bl_bootargs, "androidboot.hw_rev", &val);
|
||||
if (ret < 0) {
|
||||
log_err("%s: unable to find property for bootloader revision (%d)\n",
|
||||
__func__, ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strtoul(prev_bl_bootargs + val, NULL, 10) > board_info->match_max_rev)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Read the cmdline property which stores the serial number.
|
||||
* Store this in the board info struct.
|
||||
*/
|
||||
ret = cmdline_get_arg(prev_bl_bootargs, "androidboot.serialno", &val);
|
||||
if (ret > 0)
|
||||
strlcpy(board_info->serial, prev_bl_bootargs + val, ret);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This array is used for matching the models and revisions with the
|
||||
* devicetree used by U-Boot. This allows a single U-Boot to work on
|
||||
@@ -62,6 +153,31 @@ struct mm_region *mem_map = exynos_mem_map;
|
||||
* board names.
|
||||
*/
|
||||
static struct exynos_board_info exynos_board_info_match[] = {
|
||||
{
|
||||
/* Samsung Galaxy A2 Core */
|
||||
.name = "a2corelte",
|
||||
.chip = "exynos7870",
|
||||
.dram_bank_bases = exynos7870_common_dram_bank_bases,
|
||||
.match = exynos7870_fdt_match,
|
||||
.match_model = "A260",
|
||||
.match_max_rev = U8_MAX,
|
||||
}, {
|
||||
/* Samsung Galaxy J6 */
|
||||
.name = "j6lte",
|
||||
.chip = "exynos7870",
|
||||
.dram_bank_bases = exynos7870_common_dram_bank_bases,
|
||||
.match = exynos7870_fdt_match,
|
||||
.match_model = "J600",
|
||||
.match_max_rev = U8_MAX,
|
||||
}, {
|
||||
/* Samsung Galaxy J7 Prime */
|
||||
.name = "on7xelte",
|
||||
.chip = "exynos7870",
|
||||
.dram_bank_bases = exynos7870_common_dram_bank_bases,
|
||||
.match = exynos7870_fdt_match,
|
||||
.match_model = "G610",
|
||||
.match_max_rev = U8_MAX,
|
||||
},
|
||||
};
|
||||
|
||||
static void exynos_parse_dram_banks(const struct exynos_board_info *board_info,
|
||||
|
||||
@@ -7,6 +7,7 @@ CONFIG_SYS_MALLOC_LEN=0x2000000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x16000
|
||||
CONFIG_TARGET_EXYNOS_MOBILE=y
|
||||
CONFIG_NR_DRAM_BANKS=3
|
||||
CONFIG_DEFAULT_DEVICE_TREE="exynos/exynos7870-a2corelte"
|
||||
CONFIG_SYS_BOOTM_LEN=0x2000000
|
||||
CONFIG_SYS_LOAD_ADDR=0x80000000
|
||||
CONFIG_ARMV8_CNTFRQ_BROKEN=y
|
||||
@@ -24,11 +25,13 @@ CONFIG_CMD_POWEROFF=y
|
||||
CONFIG_CMD_FS_GENERIC=y
|
||||
CONFIG_EFI_PARTITION=y
|
||||
CONFIG_OF_UPSTREAM=y
|
||||
CONFIG_OF_LIST="exynos/exynos7870-a2corelte exynos/exynos7870-j6lte exynos/exynos7870-on7xelte"
|
||||
CONFIG_MULTI_DTB_FIT=y
|
||||
CONFIG_BUTTON=y
|
||||
CONFIG_BUTTON_REMAP_PHONE_KEYS=y
|
||||
CONFIG_CLK=y
|
||||
CONFIG_CLK_CCF=y
|
||||
CONFIG_CLK_EXYNOS7870=y
|
||||
CONFIG_USB_FUNCTION_FASTBOOT=y
|
||||
CONFIG_FASTBOOT_BUF_ADDR=0xdead0000
|
||||
CONFIG_FASTBOOT_FLASH=y
|
||||
@@ -44,6 +47,7 @@ CONFIG_MMC_DW=y
|
||||
CONFIG_PHY=y
|
||||
CONFIG_PHY_EXYNOS_USBDRD=y
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCTRL_EXYNOS78x0=y
|
||||
CONFIG_DM_PMIC=y
|
||||
CONFIG_PMIC_S2MPS11=y
|
||||
CONFIG_DM_REGULATOR=y
|
||||
|
||||
Reference in New Issue
Block a user