blob: 18544d75acc68ff1952b2917133048b8cd261ba9 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Jacob Chen63dc9712016-10-08 13:47:41 +08002/*
3 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
Jacob Chen63dc9712016-10-08 13:47:41 +08004 */
5
6#ifndef _ROCKCHIP_COMMON_H_
7#define _ROCKCHIP_COMMON_H_
8#include <linux/sizes.h>
9
Jonas Karlmanbe56bb52023-02-22 22:44:41 +000010#ifndef CFG_CPUID_OFFSET
11#define CFG_CPUID_OFFSET 0x7
12#endif
13
Jacob Chen63dc9712016-10-08 13:47:41 +080014#ifndef CONFIG_SPL_BUILD
Jacob Chen63dc9712016-10-08 13:47:41 +080015
Alex Bee1efba292021-06-17 11:01:12 +020016/* First try to boot from SD (index 1), then eMMC (index 0) */
Simon Glass69fbb762023-02-05 15:36:34 -070017#if IS_ENABLED(CONFIG_CMD_MMC)
Klaus Gogerf165eb22017-10-06 19:24:08 +020018 #define BOOT_TARGET_MMC(func) \
Alex Bee1efba292021-06-17 11:01:12 +020019 func(MMC, mmc, 1) \
20 func(MMC, mmc, 0)
Eddie Caid91ad1b2017-04-01 14:49:54 +080021#else
Klaus Gogerf165eb22017-10-06 19:24:08 +020022 #define BOOT_TARGET_MMC(func)
Eddie Caid91ad1b2017-04-01 14:49:54 +080023#endif
Jacob Chen63dc9712016-10-08 13:47:41 +080024
Simon Glassd519a7a2023-02-05 15:36:37 -070025#if IS_ENABLED(CONFIG_CMD_NVME)
Mark Kettenisd51157a2020-05-24 23:10:34 +020026 #define BOOT_TARGET_NVME(func) func(NVME, nvme, 0)
27#else
28 #define BOOT_TARGET_NVME(func)
29#endif
30
Simon Glass62f60132023-02-05 15:36:40 -070031#if IS_ENABLED(CONFIG_CMD_SCSI)
Vagrant Cascadianc67f9302022-04-06 13:42:03 -070032 #define BOOT_TARGET_SCSI(func) func(SCSI, scsi, 0)
33#else
34 #define BOOT_TARGET_SCSI(func)
35#endif
36
Simon Glass5ca5dd52023-02-05 15:36:46 -070037#if IS_ENABLED(CONFIG_CMD_USB)
Klaus Gogerf165eb22017-10-06 19:24:08 +020038 #define BOOT_TARGET_USB(func) func(USB, usb, 0)
39#else
40 #define BOOT_TARGET_USB(func)
41#endif
42
43#if CONFIG_IS_ENABLED(CMD_PXE)
44 #define BOOT_TARGET_PXE(func) func(PXE, pxe, na)
45#else
46 #define BOOT_TARGET_PXE(func)
47#endif
48
49#if CONFIG_IS_ENABLED(CMD_DHCP)
50 #define BOOT_TARGET_DHCP(func) func(DHCP, dhcp, na)
51#else
52 #define BOOT_TARGET_DHCP(func)
53#endif
54
Simon Glass5036ffd2023-02-05 15:36:41 -070055#if IS_ENABLED(CONFIG_CMD_SF)
Jagan Teki050fd9c2020-04-10 23:56:31 +053056 #define BOOT_TARGET_SF(func) func(SF, sf, 0)
57#else
58 #define BOOT_TARGET_SF(func)
59#endif
60
61#ifdef CONFIG_ROCKCHIP_RK3399
Klaus Gogerf165eb22017-10-06 19:24:08 +020062#define BOOT_TARGET_DEVICES(func) \
63 BOOT_TARGET_MMC(func) \
Mark Kettenisd51157a2020-05-24 23:10:34 +020064 BOOT_TARGET_NVME(func) \
Vagrant Cascadianc67f9302022-04-06 13:42:03 -070065 BOOT_TARGET_SCSI(func) \
Klaus Gogerf165eb22017-10-06 19:24:08 +020066 BOOT_TARGET_USB(func) \
67 BOOT_TARGET_PXE(func) \
Jagan Teki050fd9c2020-04-10 23:56:31 +053068 BOOT_TARGET_DHCP(func) \
69 BOOT_TARGET_SF(func)
Simon Glassa90f3272023-01-17 10:48:20 -070070#define BOOT_TARGETS "mmc1 mmc0 nvme scsi usb pxe dhcp spi"
Jagan Teki050fd9c2020-04-10 23:56:31 +053071#else
72#define BOOT_TARGET_DEVICES(func) \
73 BOOT_TARGET_MMC(func) \
74 BOOT_TARGET_USB(func) \
75 BOOT_TARGET_PXE(func) \
Klaus Gogerf165eb22017-10-06 19:24:08 +020076 BOOT_TARGET_DHCP(func)
Simon Glassa90f3272023-01-17 10:48:20 -070077#define BOOT_TARGETS "mmc1 mmc0 usb pxe dhcp"
Jagan Teki050fd9c2020-04-10 23:56:31 +053078#endif
Klaus Gogerf165eb22017-10-06 19:24:08 +020079
Kever Yang065386f2017-07-25 12:00:05 +080080#ifdef CONFIG_ARM64
81#define ROOT_UUID "B921B045-1DF0-41C3-AF44-4C6F280D3FAE;\0"
82#else
83#define ROOT_UUID "69DAD710-2CE4-4E3C-B16C-21A1D49ABED3;\0"
84#endif
Jacob Chen63dc9712016-10-08 13:47:41 +080085#define PARTS_DEFAULT \
86 "uuid_disk=${uuid_gpt_disk};" \
87 "name=loader1,start=32K,size=4000K,uuid=${uuid_gpt_loader1};" \
Kever Yang12fb1202017-10-31 16:52:23 +080088 "name=loader2,start=8MB,size=4MB,uuid=${uuid_gpt_loader2};" \
89 "name=trust,size=4M,uuid=${uuid_gpt_atf};" \
Jacob Chenc0662e52016-11-15 16:55:27 +080090 "name=boot,size=112M,bootable,uuid=${uuid_gpt_boot};" \
Kever Yang065386f2017-07-25 12:00:05 +080091 "name=rootfs,size=-,uuid="ROOT_UUID
Jacob Chen63dc9712016-10-08 13:47:41 +080092
93#endif
94
Jacob Chen63dc9712016-10-08 13:47:41 +080095#endif /* _ROCKCHIP_COMMON_H_ */