summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/adc.h4
-rw-r--r--include/asm-generic/global_data.h32
-rw-r--r--include/atf_common.h42
-rw-r--r--include/atmel_lcd.h4
-rw-r--r--include/blk.h2
-rw-r--r--include/bootm.h40
-rw-r--r--include/cli.h4
-rw-r--r--include/clk-uclass.h8
-rw-r--r--include/clk.h28
-rw-r--r--include/command.h43
-rw-r--r--include/configs/am65x_evm.h6
-rw-r--r--include/configs/apalis-imx8.h1
-rw-r--r--include/configs/colibri-imx8x.h1
-rw-r--r--include/configs/imx8mm_beacon.h1
-rw-r--r--include/configs/imx8mm_evk.h1
-rw-r--r--include/configs/imx8mn_evk.h1
-rw-r--r--include/configs/imx8mp_evk.h1
-rw-r--r--include/configs/imx8mq_evk.h1
-rw-r--r--include/configs/imx8mq_phanbell.h1
-rw-r--r--include/configs/k2g_evm.h2
-rw-r--r--include/configs/km/keymile-common.h4
-rw-r--r--include/configs/km/km_arm.h2
-rw-r--r--include/configs/microblaze-generic.h17
-rw-r--r--include/configs/nokia_rx51.h17
-rw-r--r--include/configs/pdu001.h3
-rw-r--r--include/configs/s5p4418_nanopi2.h4
-rw-r--r--include/configs/sama7g5ek.h45
-rw-r--r--include/configs/sunxi-common.h2
-rw-r--r--include/configs/verdin-imx8mm.h1
-rw-r--r--include/configs/xenguest_arm64.h1
-rw-r--r--include/cpu.h6
-rw-r--r--include/dm/device-internal.h107
-rw-r--r--include/dm/device.h204
-rw-r--r--include/dm/lists.h4
-rw-r--r--include/dm/ofnode.h57
-rw-r--r--include/dm/pci.h2
-rw-r--r--include/dm/platdata.h38
-rw-r--r--include/dm/platform_data/fsl_espi.h2
-rw-r--r--include/dm/platform_data/lpc32xx_hsuart.h4
-rw-r--r--include/dm/platform_data/pxa_mmc_gen.h2
-rw-r--r--include/dm/platform_data/serial_bcm283x_mu.h2
-rw-r--r--include/dm/platform_data/serial_coldfire.h4
-rw-r--r--include/dm/platform_data/serial_mxc.h2
-rw-r--r--include/dm/platform_data/serial_pl01x.h2
-rw-r--r--include/dm/platform_data/serial_pxa.h4
-rw-r--r--include/dm/platform_data/serial_sh.h2
-rw-r--r--include/dm/platform_data/spi_coldfire.h4
-rw-r--r--include/dm/platform_data/spi_davinci.h2
-rw-r--r--include/dm/platform_data/spi_pl022.h4
-rw-r--r--include/dm/read.h42
-rw-r--r--include/dm/root.h14
-rw-r--r--include/dm/simple_bus.h15
-rw-r--r--include/dm/test.h20
-rw-r--r--include/dm/uclass-id.h1
-rw-r--r--include/dm/uclass-internal.h51
-rw-r--r--include/dm/uclass.h58
-rw-r--r--include/dt-bindings/bus/ti-sysc.h6
-rw-r--r--include/dwmmc.h4
-rw-r--r--include/efi_api.h188
-rw-r--r--include/efi_loader.h50
-rw-r--r--include/efi_tcg2.h71
-rw-r--r--include/fat.h20
-rw-r--r--include/fs_loader.h2
-rw-r--r--include/i2c.h12
-rw-r--r--include/image.h1
-rw-r--r--include/linker_lists.h3
-rw-r--r--include/linux/clk-provider.h59
-rw-r--r--include/linux/mtd/mtd.h9
-rw-r--r--include/linux/mtd/nand.h14
-rw-r--r--include/linux/mtd/spi-nor.h6
-rw-r--r--include/linux/mtd/spinand.h15
-rw-r--r--include/net.h2
-rw-r--r--include/ns16550.h31
-rw-r--r--include/os.h17
-rw-r--r--include/p2sb.h4
-rw-r--r--include/pci.h8
-rw-r--r--include/power/acpi_pmc.h2
-rw-r--r--include/power/regulator.h26
-rw-r--r--include/regmap.h6
-rw-r--r--include/remoteproc.h2
-rw-r--r--include/scsi.h4
-rw-r--r--include/sdhci.h4
-rw-r--r--include/search.h11
-rw-r--r--include/spi.h41
-rw-r--r--include/spl.h88
-rw-r--r--include/sunxi_image.h82
-rw-r--r--include/syscon.h2
-rw-r--r--include/test/suites.h3
-rw-r--r--include/test/test.h9
-rw-r--r--include/tpm-v2.h87
-rw-r--r--include/usb.h18
-rw-r--r--include/vbe.h4
-rw-r--r--include/video.h32
-rw-r--r--include/virtio.h2
94 files changed, 1524 insertions, 393 deletions
diff --git a/include/adc.h b/include/adc.h
index 5841dfb54b..0d1a666908 100644
--- a/include/adc.h
+++ b/include/adc.h
@@ -40,7 +40,7 @@ struct adc_channel {
};
/**
- * struct adc_uclass_platdata - basic ADC info
+ * struct adc_uclass_plat - basic ADC info
*
* Note: The positive/negative reference Voltage is only a name and it doesn't
* provide an information about the value polarity. It is possible, for both
@@ -71,7 +71,7 @@ struct adc_channel {
* @vdd_microvolts - positive reference Voltage value
* @vss_microvolts - negative reference Voltage value
*/
-struct adc_uclass_platdata {
+struct adc_uclass_plat {
int data_format;
unsigned int data_mask;
unsigned int data_timeout_us;
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 887b5c268d..efa09a1943 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -184,6 +184,12 @@ struct global_data {
#ifdef CONFIG_DM
/**
+ * @dm_flags: additional flags for Driver Model
+ *
+ * See &enum gd_dm_flags
+ */
+ unsigned long dm_flags;
+ /**
* @dm_root: root instance for Driver Model
*/
struct udevice *dm_root;
@@ -194,7 +200,13 @@ struct global_data {
/**
* @uclass_root: head of core tree
*/
- struct list_head uclass_root;
+ struct list_head uclass_root_s;
+ /**
+ * @uclass_root: pointer to head of core tree, if uclasses are in
+ * read-only memory and cannot be adjusted to use @uclass_root as a
+ * list head.
+ */
+ struct list_head *uclass_root;
# if CONFIG_IS_ENABLED(OF_PLATDATA)
/** @dm_driver_rt: Dynamic info about the driver */
struct driver_rt *dm_driver_rt;
@@ -465,6 +477,12 @@ struct global_data {
#define gd_acpi_ctx() NULL
#endif
+#if CONFIG_IS_ENABLED(DM)
+#define gd_size_cells_0() (gd->dm_flags & GD_DM_FLG_SIZE_CELLS_0)
+#else
+#define gd_size_cells_0() (0)
+#endif
+
/**
* enum gd_flags - global data flags
*
@@ -549,6 +567,18 @@ enum gd_flags {
GD_FLG_SMP_READY = 0x40000,
};
+/**
+ * enum gd_dm_flags - global data flags for Driver Model
+ *
+ * See field dm_flags of &struct global_data.
+ */
+enum gd_dm_flags {
+ /**
+ * @GD_DM_FLG_SIZE_CELLS_0: Enable #size-cells=<0> translation
+ */
+ GD_DM_FLG_SIZE_CELLS_0 = 0x00001,
+};
+
#endif /* __ASSEMBLY__ */
#endif /* __ASM_GENERIC_GBL_DATA_H */
diff --git a/include/atf_common.h b/include/atf_common.h
index fd5454c55b..d69892fac6 100644
--- a/include/atf_common.h
+++ b/include/atf_common.h
@@ -14,8 +14,14 @@
#define ATF_PARAM_EP 0x01
#define ATF_PARAM_IMAGE_BINARY 0x02
#define ATF_PARAM_BL31 0x03
+#define ATF_PARAM_BL_PARAMS 0x05
#define ATF_VERSION_1 0x01
+#define ATF_VERSION_2 0x02
+
+#define ATF_BL31_IMAGE_ID 0x03
+#define ATF_BL32_IMAGE_ID 0x04
+#define ATF_BL33_IMAGE_ID 0x05
#define ATF_EP_SECURE 0x0
#define ATF_EP_NON_SECURE 0x1
@@ -121,6 +127,9 @@ struct atf_image_info {
struct param_header h;
uintptr_t image_base; /* physical address of base of image */
uint32_t image_size; /* bytes read from image file */
+#if CONFIG_IS_ENABLED(ATF_LOAD_IMAGE_V2)
+ uint32_t image_max_size;
+#endif
};
/*****************************************************************************
@@ -162,21 +171,28 @@ struct bl31_params {
struct atf_image_info *bl33_image_info;
};
-/*******************************************************************************
- * This structure represents the superset of information that is passed to
- * BL31, e.g. while passing control to it from BL2, bl31_params
- * and other platform specific params
- ******************************************************************************/
-struct bl2_to_bl31_params_mem {
- struct bl31_params bl31_params;
- struct atf_image_info bl31_image_info;
- struct atf_image_info bl32_image_info;
- struct atf_image_info bl33_image_info;
- struct entry_point_info bl33_ep_info;
- struct entry_point_info bl32_ep_info;
- struct entry_point_info bl31_ep_info;
+/* BL image node in the BL image execution sequence */
+struct bl_params_node {
+ unsigned int image_id;
+ struct atf_image_info *image_info;
+ struct entry_point_info *ep_info;
+ struct bl_params_node *next_params_info;
+};
+
+/*
+ * BL image head node in the BL image execution sequence
+ * It is also used to pass information to next BL image.
+ */
+struct bl_params {
+ struct param_header h;
+ struct bl_params_node *head;
};
+#define for_each_bl_params_node(bl_params, node) \
+ for ((node) = (bl_params)->head; \
+ (node); \
+ (node) = (node)->next_params_info)
+
#endif /*__ASSEMBLY__ */
#endif /* __BL_COMMON_H__ */
diff --git a/include/atmel_lcd.h b/include/atmel_lcd.h
index 4aa955b6b2..66436b9b27 100644
--- a/include/atmel_lcd.h
+++ b/include/atmel_lcd.h
@@ -10,11 +10,11 @@
#define _ATMEL_LCD_H_
/**
- * struct atmel_lcd_platdata - platform data for Atmel LCDs with driver model
+ * struct atmel_lcd_plat - platform data for Atmel LCDs with driver model
*
* @timing_index: Index of LCD timing to use in device tree node
*/
-struct atmel_lcd_platdata {
+struct atmel_lcd_plat {
int timing_index;
};
diff --git a/include/blk.h b/include/blk.h
index 9ee10fb80e..c4401b0025 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -56,7 +56,7 @@ enum sig_type {
/*
* With driver model (CONFIG_BLK) this is uclass platform data, accessible
- * with dev_get_uclass_platdata(dev)
+ * with dev_get_uclass_plat(dev)
*/
struct blk_desc {
/*
diff --git a/include/bootm.h b/include/bootm.h
index a812a6bf24..7f88ec718b 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -75,6 +75,14 @@ void board_quiesce_devices(void);
*/
void switch_to_non_secure_mode(void);
+/* Flags to control bootm_process_cmdline() */
+enum bootm_cmdline_t {
+ BOOTM_CL_SILENT = 1 << 0, /* Do silent console processing */
+ BOOTM_CL_SUBST = 1 << 1, /* Do substitution */
+
+ BOOTM_CL_ALL = 3, /* All substitutions */
+};
+
/**
* arch_preboot_os() - arch specific configuration before booting
*/
@@ -85,4 +93,36 @@ void arch_preboot_os(void);
*/
void board_preboot_os(void);
+/*
+ * bootm_process_cmdline() - Process fix-ups for the command line
+ *
+ * This handles:
+ *
+ * - making Linux boot silently if requested ('silent_linux' envvar)
+ * - performing substitutions in the command line ('bootargs_subst' envvar)
+ *
+ * @maxlen must provide enough space for the string being processed plus the
+ * resulting string
+ *
+ * @buf: buffer holding commandline string to adjust
+ * @maxlen: Maximum length of buffer at @buf (including \0)
+ * @flags: Flags to control what happens (see bootm_cmdline_t)
+ * @return 0 if OK, -ENOMEM if out of memory, -ENOSPC if the commandline is too
+ * long
+ */
+int bootm_process_cmdline(char *buf, int maxlen, int flags);
+
+/**
+ * bootm_process_cmdline_env() - Process fix-ups for the command line
+ *
+ * Updates the 'bootargs' envvar as required. This handles:
+ *
+ * - making Linux boot silently if requested ('silent_linux' envvar)
+ * - performing substitutions in the command line ('bootargs_subst' envvar)
+ *
+ * @flags: Flags to control what happens (see bootm_cmdline_t)
+ * @return 0 if OK, -ENOMEM if out of memory
+ */
+int bootm_process_cmdline_env(int flags);
+
#endif
diff --git a/include/cli.h b/include/cli.h
index 39b913743b..3449fa6ae7 100644
--- a/include/cli.h
+++ b/include/cli.h
@@ -34,8 +34,10 @@ int cli_simple_run_command(const char *cmd, int flag);
*
* @param input Input string possible containing $() / ${} vars
* @param output Output string with $() / ${} vars expanded
+ * @param max_size Maximum size of @output (including terminator)
+ * @return 0 if OK, -ENOSPC if we ran out of space in @output
*/
-void cli_simple_process_macros(const char *input, char *output);
+int cli_simple_process_macros(const char *input, char *output, int max_size);
/**
* cli_simple_run_command_list() - Execute a list of command
diff --git a/include/clk-uclass.h b/include/clk-uclass.h
index dac42dab36..50e8681b55 100644
--- a/include/clk-uclass.h
+++ b/include/clk-uclass.h
@@ -62,6 +62,14 @@ struct clk_ops {
*/
int (*rfree)(struct clk *clock);
/**
+ * round_rate() - Adjust a rate to the exact rate a clock can provide.
+ *
+ * @clk: The clock to manipulate.
+ * @rate: Desidered clock rate in Hz.
+ * @return rounded rate in Hz, or -ve error code.
+ */
+ ulong (*round_rate)(struct clk *clk, ulong rate);
+ /**
* get_rate() - Get current clock rate.
*
* @clk: The clock to query.
diff --git a/include/clk.h b/include/clk.h
index a62e2efa2c..ca6b85fa6f 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -367,6 +367,29 @@ struct clk *clk_get_parent(struct clk *clk);
long long clk_get_parent_rate(struct clk *clk);
/**
+ * clk_round_rate() - Adjust a rate to the exact rate a clock can provide
+ *
+ * This answers the question "if I were to pass @rate to clk_set_rate(),
+ * what clock rate would I end up with?" without changing the hardware
+ * in any way. In other words:
+ *
+ * rate = clk_round_rate(clk, r);
+ *
+ * and:
+ *
+ * rate = clk_set_rate(clk, r);
+ *
+ * are equivalent except the former does not modify the clock hardware
+ * in any way.
+ *
+ * @clk: A clock struct that was previously successfully requested by
+ * clk_request/get_by_*().
+ * @rate: desired clock rate in Hz.
+ * @return rounded rate in Hz, or -ve error code.
+ */
+ulong clk_round_rate(struct clk *clk, ulong rate);
+
+/**
* clk_set_rate() - Set current clock rate.
*
* @clk: A clock struct that was previously successfully requested by
@@ -482,6 +505,11 @@ static inline long long clk_get_parent_rate(struct clk *clk)
return -ENOSYS;
}
+static inline ulong clk_round_rate(struct clk *clk, ulong rate)
+{
+ return -ENOSYS;
+}
+
static inline ulong clk_set_rate(struct clk *clk, ulong rate)
{
return -ENOSYS;
diff --git a/include/command.h b/include/command.h
index b9b5ec1afa..e229bf2825 100644
--- a/include/command.h
+++ b/include/command.h
@@ -117,7 +117,31 @@ int cmd_process_error(struct cmd_tbl *cmdtp, int err);
defined(CONFIG_CMD_PCI) || \
defined(CONFIG_CMD_SETEXPR)
#define CMD_DATA_SIZE
-extern int cmd_get_data_size(char* arg, int default_size);
+#define CMD_DATA_SIZE_ERR (-1)
+#define CMD_DATA_SIZE_STR (-2)
+
+/**
+ * cmd_get_data_size() - Get the data-size specifier from a command
+ *
+ * This reads a '.x' size specifier appended to a command. For example 'md.b'
+ * is the 'md' command with a '.b' specifier, meaning that the command should
+ * use bytes.
+ *
+ * Valid characters are:
+ *
+ * b - byte
+ * w - word (16 bits)
+ * l - long (32 bits)
+ * q - quad (64 bits)
+ * s - string
+ *
+ * @arg: Pointers to the command to check. If a valid specifier is present it
+ * will be the last character of the string, following a '.'
+ * @default_size: Default size to return if there is no specifier
+ * @return data size in bytes (1, 2, 4, 8) or CMD_DATA_SIZE_ERR for an invalid
+ * character, or CMD_DATA_SIZE_STR for a string
+ */
+int cmd_get_data_size(char *arg, int default_size);
#endif
#ifdef CONFIG_CMD_BOOTD
@@ -159,6 +183,23 @@ extern int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[]);
#endif
+/**
+ * setexpr_regex_sub() - Replace a regex pattern with a string
+ *
+ * @data: Buffer containing the string to update
+ * @data_size: Size of buffer (must be large enough for the new string)
+ * @nbuf: Back-reference buffer
+ * @nbuf_size: Size of back-reference buffer (must be larger enough for @s plus
+ * all back-reference expansions)
+ * @r: Regular expression to find
+ * @s: String to replace with
+ * @global: true to replace all matches in @data, false to replace just the
+ * first
+ * @return 0 if OK, 1 on error
+ */
+int setexpr_regex_sub(char *data, uint data_size, char *nbuf, uint nbuf_size,
+ const char *r, const char *s, bool global);
+
/*
* Error codes that commands return to cmd_process(). We use the standard 0
* and 1 for success and failure, but add one more case - failure with a
diff --git a/include/configs/am65x_evm.h b/include/configs/am65x_evm.h
index 9eed0ea203..b39a5b4ca4 100644
--- a/include/configs/am65x_evm.h
+++ b/include/configs/am65x_evm.h
@@ -56,6 +56,12 @@
#define CONFIG_SKIP_LOWLEVEL_INIT
#endif
+/*
+ * If the maximum size is not declared then it is defined as
+ * CONFIG_SYS_DFU_DATA_BUF_SIZE.
+ */
+#define CONFIG_SYS_DFU_MAX_FILE_SIZE (1024 * 1024 * 8) /* 8 MiB */
+
#define CONFIG_SPL_MAX_SIZE CONFIG_SYS_K3_MAX_DOWNLODABLE_IMAGE_SIZE
#define CONFIG_SYS_BOOTM_LEN SZ_64M
diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index db4e9011c0..b474b2f522 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -98,7 +98,6 @@
#define PHYS_SDRAM_2_SIZE SZ_2G /* 2 GB */
/* Monitor Command Prompt */
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#define CONFIG_SYS_CBSIZE SZ_2K
#define CONFIG_SYS_MAXARGS 64
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
diff --git a/include/configs/colibri-imx8x.h b/include/configs/colibri-imx8x.h
index 29a37ed44f..fc2c191594 100644
--- a/include/configs/colibri-imx8x.h
+++ b/include/configs/colibri-imx8x.h
@@ -132,7 +132,6 @@
#define PHYS_SDRAM_2_SIZE 0x00000000 /* 0 GB */
/* Monitor Command Prompt */
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#define CONFIG_SYS_CBSIZE SZ_2K
#define CONFIG_SYS_MAXARGS 64
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
diff --git a/include/configs/imx8mm_beacon.h b/include/configs/imx8mm_beacon.h
index 3c9541187f..9a93dba1c5 100644
--- a/include/configs/imx8mm_beacon.h
+++ b/include/configs/imx8mm_beacon.h
@@ -119,7 +119,6 @@
#define CONFIG_MXC_UART_BASE UART2_BASE_ADDR
/* Monitor Command Prompt */
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#define CONFIG_SYS_CBSIZE 2048
#define CONFIG_SYS_MAXARGS 64
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
diff --git a/include/configs/imx8mm_evk.h b/include/configs/imx8mm_evk.h
index 83521ad401..92eb85553e 100644
--- a/include/configs/imx8mm_evk.h
+++ b/include/configs/imx8mm_evk.h
@@ -120,7 +120,6 @@
#define CONFIG_MXC_UART_BASE UART2_BASE_ADDR
/* Monitor Command Prompt */
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#define CONFIG_SYS_CBSIZE 2048
#define CONFIG_SYS_MAXARGS 64
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
diff --git a/include/configs/imx8mn_evk.h b/include/configs/imx8mn_evk.h
index a6333085fe..cda8fc2ef7 100644
--- a/include/configs/imx8mn_evk.h
+++ b/include/configs/imx8mn_evk.h
@@ -124,7 +124,6 @@
#define CONFIG_MXC_UART_BASE UART2_BASE_ADDR
/* Monitor Command Prompt */
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#define CONFIG_SYS_CBSIZE 2048
#define CONFIG_SYS_MAXARGS 64
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
diff --git a/include/configs/imx8mp_evk.h b/include/configs/imx8mp_evk.h
index 8253c6aa2f..92091dfd6b 100644
--- a/include/configs/imx8mp_evk.h
+++ b/include/configs/imx8mp_evk.h
@@ -135,7 +135,6 @@
#define CONFIG_MXC_UART_BASE UART2_BASE_ADDR
/* Monitor Command Prompt */
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#define CONFIG_SYS_CBSIZE 2048
#define CONFIG_SYS_MAXARGS 64
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
diff --git a/include/configs/imx8mq_evk.h b/include/configs/imx8mq_evk.h
index 3f9a3bc100..96bfff749c 100644
--- a/include/configs/imx8mq_evk.h
+++ b/include/configs/imx8mq_evk.h
@@ -175,7 +175,6 @@
/* Monitor Command Prompt */
#undef CONFIG_SYS_PROMPT
#define CONFIG_SYS_PROMPT "u-boot=> "
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#define CONFIG_SYS_CBSIZE 1024
#define CONFIG_SYS_MAXARGS 64
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
diff --git a/include/configs/imx8mq_phanbell.h b/include/configs/imx8mq_phanbell.h
index e8b65a4ba5..66c2c3a8d8 100644
--- a/include/configs/imx8mq_phanbell.h
+++ b/include/configs/imx8mq_phanbell.h
@@ -169,7 +169,6 @@
#define CONFIG_MXC_UART_BASE UART1_BASE_ADDR
/* Monitor Command Prompt */
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#define CONFIG_SYS_CBSIZE 1024
#define CONFIG_SYS_MAXARGS 64
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
diff --git a/include/configs/k2g_evm.h b/include/configs/k2g_evm.h
index 83466b9e0c..4471eb4f6a 100644
--- a/include/configs/k2g_evm.h
+++ b/include/configs/k2g_evm.h
@@ -35,6 +35,8 @@
"setenv name_fdt keystone-k2g-evm.dtb; " \
"else if test $board_name = 66AK2GIC; then " \
"setenv name_fdt keystone-k2g-ice.dtb; " \
+ "else if test $board_name = 66AK2GI1; then " \
+ "setenv name_fdt keystone-k2g-ice.dtb; " \
"else if test $name_fdt = undefined; then " \
"echo WARNING: Could not determine device tree to use;"\
"fi;fi;fi;fi; setenv fdtfile ${name_fdt}\0" \
diff --git a/include/configs/km/keymile-common.h b/include/configs/km/keymile-common.h
index ad0041d8a9..d321ebdb63 100644
--- a/include/configs/km/keymile-common.h
+++ b/include/configs/km/keymile-common.h
@@ -181,9 +181,9 @@
"cramfsloadfdt=" \
"cramfsload ${fdt_addr_r} " \
"fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \
- "fdt_addr_r="__stringify(CONFIG_KM_FDT_ADDR) "\0" \
+ "fdt_addr_r=" __stringify(CONFIG_KM_FDT_ADDR) "\0" \
"init=/sbin/init-overlay.sh\0" \
- "load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
+ "load_addr_r=" __stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
"load=tftpboot ${load_addr_r} ${u-boot}\0" \
"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h
index 98e0ce1c24..29060fa96b 100644
--- a/include/configs/km/km_arm.h
+++ b/include/configs/km/km_arm.h
@@ -48,7 +48,7 @@
" boardid=0x${IVM_BoardId} hwkey=0x${IVM_HWKey}"
#define CONFIG_KM_DEF_ENV_CPU \
- "u-boot="CONFIG_HOSTNAME "/u-boot.kwb\0" \
+ "u-boot=" CONFIG_HOSTNAME "/u-boot.kwb\0" \
CONFIG_KM_UPDATE_UBOOT \
"set_fdthigh=setenv fdt_high ${kernelmem}\0" \
"checkfdt=" \
diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
index bc0bf04973..59b20cf116 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -81,6 +81,20 @@
# define BOOT_TARGET_DEVICES_QSPI(func)
#endif
+#if defined(CONFIG_MTD_NOR_FLASH)
+# define BOOT_TARGET_DEVICES_NOR(func) func(NOR, nor, na)
+#else
+# define BOOT_TARGET_DEVICES_NOR(func)
+#endif
+
+#define BOOTENV_DEV_NOR(devtypeu, devtypel, instance) \
+ "bootcmd_nor=cp.b ${script_offset_nor} ${scriptaddr} ${script_size_f} && " \
+ "echo NOR: Trying to boot script at ${scriptaddr} && " \
+ "source ${scriptaddr}; echo NOR: SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_NOR(devtypeu, devtypel, instance) \
+ "nor "
+
#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
"bootcmd_qspi=sf probe 0 0 0 && " \
"sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
@@ -101,7 +115,8 @@
#define BOOT_TARGET_DEVICES(func) \
BOOT_TARGET_DEVICES_JTAG(func) \
- BOOT_TARGET_DEVICES_QSPI(func) \
+ BOOT_TARGET_DEVICES_QSPI(func) \
+ BOOT_TARGET_DEVICES_NOR(func) \
BOOT_TARGET_DEVICES_DHCP(func) \
BOOT_TARGET_DEVICES_PXE(func)
diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h
index 6879f52a0c..3f2700d8e2 100644
--- a/include/configs/nokia_rx51.h
+++ b/include/configs/nokia_rx51.h
@@ -169,8 +169,6 @@ int rx51_kp_getc(struct stdio_dev *sdev);
"trymmcboot=if run switchmmc; then " \
"setenv mmctype fat;" \
"run trymmcallpartboot;" \
- "setenv mmctype ext2;" \
- "run trymmcallpartboot;" \
"setenv mmctype ext4;" \
"run trymmcallpartboot;" \
"fi\0" \
@@ -179,19 +177,10 @@ int rx51_kp_getc(struct stdio_dev *sdev);
"preboot=setenv mmcnum 1; setenv mmcpart 1;" \
"setenv mmcscriptfile bootmenu.scr;" \
"if run switchmmc; then " \
- "setenv mmcdone true;" \
"setenv mmctype fat;" \
- "if run scriptload; then true; else " \
- "setenv mmctype ext2;" \
- "if run scriptload; then true; else " \
- "setenv mmctype ext4;" \
- "if run scriptload; then true; else " \
- "setenv mmcdone false;" \
- "fi;" \
- "fi;" \
- "fi;" \
- "if ${mmcdone}; then " \
- "run scriptboot;" \
+ "if run scriptload; then run scriptboot; else " \
+ "setenv mmctype ext4;" \
+ "if run scriptload; then run scriptboot; fi;" \
"fi;" \
"fi;" \
"if run slide; then true; else " \
diff --git a/include/configs/pdu001.h b/include/configs/pdu001.h
index e4b14c5ecd..53342ce193 100644
--- a/include/configs/pdu001.h
+++ b/include/configs/pdu001.h
@@ -37,9 +37,10 @@
#define CONFIG_BOOTCOMMAND \
"run eval_boot_device;" \
+ "part uuid mmc ${mmc_boot}:${root_fs_partition} root_fs_partuuid;" \
"setenv bootargs console=${console} " \
"vt.global_cursor_default=0 " \
- "root=/dev/mmcblk${mmc_boot}p${root_fs_partition} " \
+ "root=PARTUUID=${root_fs_partuuid} " \
"rootfstype=ext4 " \
"rootwait " \
"rootdelay=1;" \
diff --git a/include/configs/s5p4418_nanopi2.h b/include/configs/s5p4418_nanopi2.h
index 6dd1f3bc04..1e2180b970 100644
--- a/include/configs/s5p4418_nanopi2.h
+++ b/include/configs/s5p4418_nanopi2.h
@@ -102,10 +102,6 @@
/* Boot Argument Buffer Size */
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
-#ifdef CONFIG_HUSH_PARSER
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
-#endif
-
/*-----------------------------------------------------------------------
* Etc Command definition
*/
diff --git a/include/configs/sama7g5ek.h b/include/configs/sama7g5ek.h
new file mode 100644
index 0000000000..ef3bfa36fd
--- /dev/null
+++ b/include/configs/sama7g5ek.h
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration file for the SAMA7G5EK Board.
+ *
+ * Copyright (C) 2020 Microchip Corporation
+ * Eugen Hristev <eugen.hristev@microchip.com>
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_SYS_AT91_SLOW_CLOCK 32768
+#define CONFIG_SYS_AT91_MAIN_CLOCK 24000000 /* from 24 MHz crystal */
+
+/* SDRAM */
+#define CONFIG_SYS_SDRAM_BASE 0x60000000
+#define CONFIG_SYS_SDRAM_SIZE 0x20000000
+
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_SYS_INIT_SP_ADDR 0x218000
+#else
+#define CONFIG_SYS_INIT_SP_ADDR \
+ (CONFIG_SYS_SDRAM_BASE + 16 * 1024 + CONFIG_SYS_MALLOC_F_LEN - \
+ GENERATED_GBL_DATA_SIZE)
+#endif
+
+#define CONFIG_SYS_LOAD_ADDR 0x62000000 /* load address */
+
+#undef CONFIG_BOOTCOMMAND
+#ifdef CONFIG_SD_BOOT
+/* u-boot env in sd/mmc card */
+
+/* bootstrap + u-boot + env in sd card */
+#define CONFIG_BOOTCOMMAND "fatload mmc " CONFIG_ENV_FAT_DEVICE_AND_PART " 0x61000000 at91-sama7g5ek.dtb; " \
+ "fatload mmc " CONFIG_ENV_FAT_DEVICE_AND_PART " 0x62000000 zImage; " \
+ "bootz 0x62000000 - 0x61000000"
+#endif
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
+
+#define CONFIG_ARP_TIMEOUT 200
+#define CONFIG_NET_RETRY_COUNT 50
+
+#endif
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index a6a4879523..203cb10fba 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -163,9 +163,7 @@
#define CONFIG_SYS_MONITOR_LEN (768 << 10) /* 768 KiB */
-#ifndef CONFIG_ARM64 /* AArch64 FEL support is not ready yet */
#define CONFIG_SPL_BOARD_LOAD_IMAGE
-#endif
/*
* We cannot use expressions here, because expressions won't be evaluated in
diff --git a/include/configs/verdin-imx8mm.h b/include/configs/verdin-imx8mm.h
index fd8405433d..4751bf5a5a 100644
--- a/include/configs/verdin-imx8mm.h
+++ b/include/configs/verdin-imx8mm.h
@@ -98,7 +98,6 @@
#define CONFIG_MXC_UART_BASE UART1_BASE_ADDR
/* Monitor Command Prompt */
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#define CONFIG_SYS_CBSIZE SZ_2K
#define CONFIG_SYS_MAXARGS 64
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
diff --git a/include/configs/xenguest_arm64.h b/include/configs/xenguest_arm64.h
index c44381e966..d76ce13d14 100644
--- a/include/configs/xenguest_arm64.h
+++ b/include/configs/xenguest_arm64.h
@@ -27,7 +27,6 @@
#define CONFIG_SYS_MALLOC_LEN (32 * 1024 * 1024)
/* Monitor Command Prompt */
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
#define CONFIG_SYS_CBSIZE 1024
#define CONFIG_SYS_MAXARGS 64
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
diff --git a/include/cpu.h b/include/cpu.h
index 78e88b9ed0..5831bfa742 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -8,7 +8,7 @@
#define __CPU_H
/**
- * struct cpu_platdata - platform data for a CPU
+ * struct cpu_plat - platform data for a CPU
* @cpu_id: Platform-specific way of identifying the CPU.
* @ucode_version: Microcode version, if CPU_FEAT_UCODE is set
* @device_id: Driver-defined device identifier
@@ -17,10 +17,10 @@
* @timebase_freq: the current frequency at which the cpu timer timebase
* registers are updated (in Hz)
*
- * This can be accessed with dev_get_parent_platdata() for any UCLASS_CPU
+ * This can be accessed with dev_get_parent_plat() for any UCLASS_CPU
* device.
*/
-struct cpu_platdata {
+struct cpu_plat {
int cpu_id;
int ucode_version;
ulong device_id;
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index c5d7ec0650..639bbd293d 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -19,8 +19,8 @@ struct udevice;
* device_bind() - Create a device and bind it to a driver
*
* Called to set up a new device attached to a driver. The device will either
- * have platdata, or a device tree node which can be used to create the
- * platdata.
+ * have plat, or a device tree node which can be used to create the
+ * plat.
*
* Once bound a device exists but is not yet active until device_probe() is
* called.
@@ -28,22 +28,18 @@ struct udevice;
* @parent: Pointer to device's parent, under which this driver will exist
* @drv: Device's driver
* @name: Name of device (e.g. device tree node name)
- * @platdata: Pointer to data for this device - the structure is device-
+ * @plat: Pointer to data for this device - the structure is device-
* specific but may include the device's I/O address, etc.. This is NULL for
* devices which use device tree.
- * @of_offset: Offset of device tree node for this device. This is -1 for
- * devices which don't use device tree.
+ * @ofnode: Devicetree node for this device. This is ofnode_null() for
+ * devices which don't use devicetree or don't have a node.
* @devp: if non-NULL, returns a pointer to the bound device
* @return 0 if OK, -ve on error
*/
int device_bind(struct udevice *parent, const struct driver *drv,
- const char *name, void *platdata, int of_offset,
+ const char *name, void *plat, ofnode node,
struct udevice **devp);
-int device_bind_ofnode(struct udevice *parent, const struct driver *drv,
- const char *name, void *platdata, ofnode node,
- struct udevice **devp);
-
/**
* device_bind_with_driver_data() - Create a device and bind it to a driver
*
@@ -76,7 +72,7 @@ int device_bind_with_driver_data(struct udevice *parent,
* @parent: Pointer to device's parent
* @pre_reloc_only: If true, bind the driver only if its DM_FLAG_PRE_RELOC flag
* is set. If false bind the driver always.
- * @info: Name and platdata for this device
+ * @info: Name and plat for this device
* @devp: if non-NULL, returns a pointer to the bound device
* @return 0 if OK, -ve on error
*/
@@ -93,7 +89,7 @@ int device_bind_by_name(struct udevice *parent, bool pre_reloc_only,
int device_reparent(struct udevice *dev, struct udevice *new_parent);
/**
- * device_ofdata_to_platdata() - Read platform data for a device
+ * device_of_to_plat() - Read platform data for a device
*
* Read platform data for a device (typically from the device tree) so that
* the information needed to probe the device is present.
@@ -106,7 +102,7 @@ int device_reparent(struct udevice *dev, struct udevice *new_parent);
* @dev: Pointer to device to process
* @return 0 if OK, -ve on error
*/
-int device_ofdata_to_platdata(struct udevice *dev);
+int device_of_to_plat(struct udevice *dev);
/**
* device_probe() - Probe a device, activating it
@@ -194,6 +190,90 @@ static inline int device_chld_remove(struct udevice *dev, struct driver *drv,
#endif
/**
+ * dev_set_priv() - Set the private data for a device
+ *
+ * This is normally handled by driver model, which automatically allocates
+ * private data when an 'auto' size if provided by the driver.
+ *
+ * Use this function to override normal operation for special situations, such
+ * as needing to allocate a variable amount of data.
+ *
+ * @dev Device to check
+ * @priv New private-data pointer
+ */
+void dev_set_priv(struct udevice *dev, void *priv);
+
+/**
+ * dev_set_parent_priv() - Set the parent-private data for a device
+ *
+ * This is normally handled by driver model, which automatically allocates
+ * parent-private data when an 'auto' size if provided by the driver.
+ *
+ * Use this function to override normal operation for special situations, such
+ * as needing to allocate a variable amount of data.
+ *
+ * @dev: Device to update
+ * @parent_priv: New parent-private data
+ */
+void dev_set_parent_priv(struct udevice *dev, void *parent_priv);
+
+/**
+ * dev_set_uclass_priv() - Set the uclass private data for a device
+ *
+ * This is normally handled by driver model, which automatically allocates
+ * uclass-private data when an 'auto' size if provided by the driver.
+ *
+ * Use this function to override normal operation for special situations, such
+ * as needing to allocate a variable amount of data.
+ *
+ * @dev: Device to update
+ * @uclass_priv: New uclass private data
+ */
+void dev_set_uclass_priv(struct udevice *dev, void *uclass_priv);
+
+/**
+ * dev_set_plat() - Set the platform data for a device
+ *
+ * This is normally handled by driver model, which automatically allocates
+ * platform data when an 'auto' size if provided by the driver.
+ *
+ * Use this function to override normal operation for special situations, such
+ * as needing to allocate a variable amount of data.
+ *
+ * @dev Device to check
+ * @plat New platform-data pointer
+ */
+void dev_set_plat(struct udevice *dev, void *priv);
+
+/**
+ * dev_set_parent_plat() - Set the parent platform data for a device
+ *
+ * This is normally handled by driver model, which automatically allocates
+ * parent platform data when an 'auto' size if provided by the driver.
+ *
+ * Use this function to override normal operation for special situations, such
+ * as needing to allocate a variable amount of data.
+ *
+ * @dev: Device to update
+ * @parent_plat: New parent platform data
+ */
+void dev_set_parent_plat(struct udevice *dev, void *parent_plat);
+
+/**
+ * dev_set_uclass_plat() - Set the uclass platform data for a device
+ *
+ * This is normally handled by driver model, which automatically allocates
+ * uclass platform data when an 'auto' size if provided by the driver.
+ *
+ * Use this function to override normal operation for special situations, such
+ * as needing to allocate a variable amount of data.
+ *
+ * @dev: Device to update
+ * @uclass_plat: New uclass platform data
+ */
+void dev_set_uclass_plat(struct udevice *dev, void *uclass_plat);
+
+/**
* simple_bus_translate() - translate a bus address to a system address
*
* This handles the 'ranges' property in a simple bus. It translates the
@@ -208,6 +288,7 @@ fdt_addr_t simple_bus_translate(struct udevice *dev, fdt_addr_t addr);
/* Cast away any volatile pointer */
#define DM_ROOT_NON_CONST (((gd_t *)gd)->dm_root)
#define DM_UCLASS_ROOT_NON_CONST (((gd_t *)gd)->uclass_root)
+#define DM_UCLASS_ROOT_S_NON_CONST (((gd_t *)gd)->uclass_root_s)
/* device resource management */
#ifdef CONFIG_DEVRES
diff --git a/include/dm/device.h b/include/dm/device.h
index 5bef484247..f5b4cd6876 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -23,16 +23,16 @@ struct driver_info;
/* Driver is active (probed). Cleared when it is removed */
#define DM_FLAG_ACTIVATED (1 << 0)
-/* DM is responsible for allocating and freeing platdata */
+/* DM is responsible for allocating and freeing plat */
#define DM_FLAG_ALLOC_PDATA (1 << 1)
/* DM should init this device prior to relocation */
#define DM_FLAG_PRE_RELOC (1 << 2)
-/* DM is responsible for allocating and freeing parent_platdata */
+/* DM is responsible for allocating and freeing parent_plat */
#define DM_FLAG_ALLOC_PARENT_PDATA (1 << 3)
-/* DM is responsible for allocating and freeing uclass_platdata */
+/* DM is responsible for allocating and freeing uclass_plat */
#define DM_FLAG_ALLOC_UCLASS_PDATA (1 << 4)
/* Allocate driver private data on a DMA boundary */
@@ -64,7 +64,7 @@ struct driver_info;
/* DM does not enable/disable the power domains corresponding to this device */
#define DM_FLAG_DEFAULT_PD_CTRL_OFF (1 << 11)
-/* Driver platdata has been read. Cleared when the device is removed */
+/* Driver plat has been read. Cleared when the device is removed */
#define DM_FLAG_PLATDATA_VALID (1 << 12)
/*
@@ -104,36 +104,46 @@ enum {
* particular port or peripheral (essentially a driver instance).
*
* A device will come into existence through a 'bind' call, either due to
- * a U_BOOT_DEVICE() macro (in which case platdata is non-NULL) or a node
+ * a U_BOOT_DRVINFO() macro (in which case plat is non-NULL) or a node
* in the device tree (in which case of_offset is >= 0). In the latter case
- * we translate the device tree information into platdata in a function
- * implemented by the driver ofdata_to_platdata method (called just before the
+ * we translate the device tree information into plat in a function
+ * implemented by the driver of_to_plat method (called just before the
* probe method if the device has a device tree node.
*
- * All three of platdata, priv and uclass_priv can be allocated by the
+ * All three of plat, priv and uclass_priv can be allocated by the
* driver, or you can use the auto_alloc_size members of struct driver and
* struct uclass_driver to have driver model do this automatically.
*
* @driver: The driver used by this device
* @name: Name of device, typically the FDT node name
- * @platdata: Configuration data for this device
- * @parent_platdata: The parent bus's configuration data for this device
- * @uclass_platdata: The uclass's configuration data for this device
- * @node: Reference to device tree node for this device
+ * @plat_: Configuration data for this device (do not access outside driver
+ * model)
+ * @parent_plat_: The parent bus's configuration data for this device (do not
+ * access outside driver model)
+ * @uclass_plat_: The uclass's configuration data for this device (do not access
+ * outside driver model)
* @driver_data: Driver data word for the entry that matched this device with
* its driver
* @parent: Parent of this device, or NULL for the top level device
- * @priv: Private data for this device
+ * @priv_: Private data for this device (do not access outside driver model)
* @uclass: Pointer to uclass for this device
- * @uclass_priv: The uclass's private data for this device
- * @parent_priv: The parent's private data for this device
+ * @uclass_priv_: The uclass's private data for this device (do not access
+ * outside driver model)
+ * @parent_priv_: The parent's private data for this device (do not access
+ * outside driver model)
* @uclass_node: Used by uclass to link its devices
* @child_head: List of children of this device
* @sibling_node: Next device in list of all devices
- * @flags: Flags for this device DM_FLAG_...
- * @req_seq: Requested sequence number for this device (-1 = any)
- * @seq: Allocated sequence number for this device (-1 = none). This is set up
- * when the device is probed and will be unique within the device's uclass.
+ * @flags_: Flags for this device DM_FLAG_... (do not access outside driver
+ * model)
+ * @seq_: Allocated sequence number for this device (-1 = none). This is set up
+ * when the device is bound and is unique within the device's uclass. If the
+ * device has an alias in the devicetree then that is used to set the sequence
+ * number. Otherwise, the next available number is used. Sequence numbers are
+ * used by certain commands that need device to be numbered (e.g. 'mmc dev').
+ * (do not access outside driver model)
+ * @node_: Reference to device tree node for this device (do not access outside
+ * driver model)
* @devres_head: List of memory allocations associated with this device.
* When CONFIG_DEVRES is enabled, devm_kmalloc() and friends will
* add to this list. Memory so-allocated will be freed
@@ -142,22 +152,23 @@ enum {
struct udevice {
const struct driver *driver;
const char *name;
- void *platdata;
- void *parent_platdata;
- void *uclass_platdata;
- ofnode node;
+ void *plat_;
+ void *parent_plat_;
+ void *uclass_plat_;
ulong driver_data;
struct udevice *parent;
- void *priv;
+ void *priv_;
struct uclass *uclass;
- void *uclass_priv;
- void *parent_priv;
+ void *uclass_priv_;
+ void *parent_priv_;
struct list_head uclass_node;
struct list_head child_head;
struct list_head sibling_node;
- uint32_t flags;
- int req_seq;
- int seq;
+ u32 flags_;
+ int seq_;
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+ ofnode node_;
+#endif
#ifdef CONFIG_DEVRES
struct list_head devres_head;
#endif
@@ -169,22 +180,67 @@ struct udevice {
/* Returns the operations for a device */
#define device_get_ops(dev) (dev->driver->ops)
+static inline u32 dev_get_flags(const struct udevice *dev)
+{
+ return dev->flags_;
+}
+
+static inline void dev_or_flags(struct udevice *dev, u32 or)
+{
+ dev->flags_ |= or;
+}
+
+static inline void dev_bic_flags(struct udevice *dev, u32 bic)
+{
+ dev->flags_ &= ~bic;
+}
+
+/**
+ * dev_ofnode() - get the DT node reference associated with a udevice
+ *
+ * @dev: device to check
+ * @return reference of the the device's DT node
+ */
+static inline ofnode dev_ofnode(const struct udevice *dev)
+{
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+ return dev->node_;
+#else
+ return ofnode_null();
+#endif
+}
+
/* Returns non-zero if the device is active (probed and not removed) */
-#define device_active(dev) ((dev)->flags & DM_FLAG_ACTIVATED)
+#define device_active(dev) (dev_get_flags(dev) & DM_FLAG_ACTIVATED)
static inline int dev_of_offset(const struct udevice *dev)
{
- return ofnode_to_offset(dev->node);
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+ return ofnode_to_offset(dev_ofnode(dev));
+#else
+ return -1;
+#endif
}
-static inline void dev_set_of_offset(struct udevice *dev, int of_offset)
+static inline bool dev_has_ofnode(const struct udevice *dev)
{
- dev->node = offset_to_ofnode(of_offset);
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+ return ofnode_valid(dev_ofnode(dev));
+#else
+ return false;
+#endif
}
-static inline bool dev_has_of_node(struct udevice *dev)
+static inline void dev_set_ofnode(struct udevice *dev, ofnode node)
{
- return ofnode_valid(dev->node);
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+ dev->node_ = node;
+#endif
+}
+
+static inline int dev_seq(const struct udevice *dev)
+{
+ return dev->seq_;
}
/**
@@ -208,7 +264,7 @@ struct udevice_id {
*
* This holds methods for setting up a new device, and also removing it.
* The device needs information to set itself up - this is provided either
- * by platdata or a device tree node (which we find by looking up
+ * by plat or a device tree node (which we find by looking up
* matching compatible strings with of_match).
*
* Drivers all belong to a uclass, representing a class of devices of the
@@ -224,26 +280,26 @@ struct udevice_id {
* @probe: Called to probe a device, i.e. activate it
* @remove: Called to remove a device, i.e. de-activate it
* @unbind: Called to unbind a device from its driver
- * @ofdata_to_platdata: Called before probe to decode device tree data
+ * @of_to_plat: Called before probe to decode device tree data
* @child_post_bind: Called after a new child has been bound
* @child_pre_probe: Called before a child device is probed. The device has
* memory allocated but it has not yet been probed.
* @child_post_remove: Called after a child device is removed. The device
* has memory allocated but its device_remove() method has been called.
- * @priv_auto_alloc_size: If non-zero this is the size of the private data
+ * @priv_auto: If non-zero this is the size of the private data
* to be allocated in the device's ->priv pointer. If zero, then the driver
* is responsible for allocating any data required.
- * @platdata_auto_alloc_size: If non-zero this is the size of the
- * platform data to be allocated in the device's ->platdata pointer.
+ * @plat_auto: If non-zero this is the size of the
+ * platform data to be allocated in the device's ->plat pointer.
* This is typically only useful for device-tree-aware drivers (those with
- * an of_match), since drivers which use platdata will have the data
- * provided in the U_BOOT_DEVICE() instantiation.
- * @per_child_auto_alloc_size: Each device can hold private data owned by
+ * an of_match), since drivers which use plat will have the data
+ * provided in the U_BOOT_DRVINFO() instantiation.
+ * @per_child_auto: Each device can hold private data owned by
* its parent. If required this will be automatically allocated if this
* value is non-zero.
- * @per_child_platdata_auto_alloc_size: A bus likes to store information about
+ * @per_child_plat_auto: A bus likes to store information about
* its children. If non-zero this is the size of this data, to be allocated
- * in the child's parent_platdata pointer.
+ * in the child's parent_plat pointer.
* @ops: Driver-specific operations. This is typically a list of function
* pointers defined by the driver, to implement driver functions required by
* the uclass.
@@ -259,14 +315,14 @@ struct driver {
int (*probe)(struct udevice *dev);
int (*remove)(struct udevice *dev);
int (*unbind)(struct udevice *dev);
- int (*ofdata_to_platdata)(struct udevice *dev);
+ int (*of_to_plat)(struct udevice *dev);
int (*child_post_bind)(struct udevice *dev);
int (*child_pre_probe)(struct udevice *dev);
int (*child_post_remove)(struct udevice *dev);
- int priv_auto_alloc_size;
- int platdata_auto_alloc_size;
- int per_child_auto_alloc_size;
- int per_child_platdata_auto_alloc_size;
+ int priv_auto;
+ int plat_auto;
+ int per_child_auto;
+ int per_child_plat_auto;
const void *ops; /* driver-specific operations */
uint32_t flags;
#if CONFIG_IS_ENABLED(ACPIGEN)
@@ -279,7 +335,7 @@ struct driver {
ll_entry_declare(struct driver, __name, driver)
/* Get a pointer to a given driver */
-#define DM_GET_DRIVER(__name) \
+#define DM_DRIVER_GET(__name) \
ll_entry_get(struct driver, __name, driver)
/**
@@ -287,37 +343,37 @@ struct driver {
* produce no code but its information will be parsed by tools like
* dtoc
*/
-#define U_BOOT_DRIVER_ALIAS(__name, __alias)
+#define DM_DRIVER_ALIAS(__name, __alias)
/**
- * dev_get_platdata() - Get the platform data for a device
+ * dev_get_plat() - Get the platform data for a device
*
* This checks that dev is not NULL, but no other checks for now
*
* @dev Device to check
* @return platform data, or NULL if none
*/
-void *dev_get_platdata(const struct udevice *dev);
+void *dev_get_plat(const struct udevice *dev);
/**
- * dev_get_parent_platdata() - Get the parent platform data for a device
+ * dev_get_parent_plat() - Get the parent platform data for a device
*
* This checks that dev is not NULL, but no other checks for now
*
* @dev Device to check
* @return parent's platform data, or NULL if none
*/
-void *dev_get_parent_platdata(const struct udevice *dev);
+void *dev_get_parent_plat(const struct udevice *dev);
/**
- * dev_get_uclass_platdata() - Get the uclass platform data for a device
+ * dev_get_uclass_plat() - Get the uclass platform data for a device
*
* This checks that dev is not NULL, but no other checks for now
*
* @dev Device to check
* @return uclass's platform data, or NULL if none
*/
-void *dev_get_uclass_platdata(const struct udevice *dev);
+void *dev_get_uclass_plat(const struct udevice *dev);
/**
* dev_get_priv() - Get the private data for a device
@@ -444,24 +500,16 @@ int device_get_child_count(const struct udevice *parent);
/**
* device_find_child_by_seq() - Find a child device based on a sequence
*
- * This searches for a device with the given seq or req_seq.
- *
- * For seq, if an active device has this sequence it will be returned.
- * If there is no such device then this will return -ENODEV.
- *
- * For req_seq, if a device (whether activated or not) has this req_seq
- * value, that device will be returned. This is a strong indication that
- * the device will receive that sequence when activated.
+ * This searches for a device with the given seq.
*
* @parent: Parent device
- * @seq_or_req_seq: Sequence number to find (0=first)
- * @find_req_seq: true to find req_seq, false to find seq
+ * @seq: Sequence number to find (0=first)
* @devp: Returns pointer to device (there is only one per for each seq).
* Set to NULL if none is found
- * @return 0 if OK, -ve on error
+ * @return 0 if OK, -ENODEV if not found
*/
-int device_find_child_by_seq(const struct udevice *parent, int seq_or_req_seq,
- bool find_req_seq, struct udevice **devp);
+int device_find_child_by_seq(const struct udevice *parent, int seq,
+ struct udevice **devp);
/**
* device_get_child_by_seq() - Get a child device based on a sequence
@@ -627,9 +675,9 @@ int device_find_child_by_name(const struct udevice *parent, const char *name,
struct udevice **devp);
/**
- * device_first_child_ofdata_err() - Find the first child and reads its platdata
+ * device_first_child_ofdata_err() - Find the first child and reads its plat
*
- * The ofdata_to_platdata() method is called on the child before it is returned,
+ * The of_to_plat() method is called on the child before it is returned,
* but the child is not probed.
*
* @parent: Parent to check
@@ -640,9 +688,9 @@ int device_first_child_ofdata_err(struct udevice *parent,
struct udevice **devp);
/*
- * device_next_child_ofdata_err() - Find the next child and read its platdata
+ * device_next_child_ofdata_err() - Find the next child and read its plat
*
- * The ofdata_to_platdata() method is called on the child before it is returned,
+ * The of_to_plat() method is called on the child before it is returned,
* but the child is not probed.
*
* @devp: On entry, points to the previous child; on exit returns the child that
@@ -803,19 +851,19 @@ static inline bool device_is_on_pci_bus(const struct udevice *dev)
list_for_each_entry(pos, &parent->child_head, sibling_node)
/**
- * device_foreach_child_ofdata_to_platdata() - iterate through children
+ * device_foreach_child_of_to_plat() - iterate through children
*
* This stops when it gets an error, with @pos set to the device that failed to
* read ofdata.
* This creates a for() loop which works through the available children of
* a device in order from start to end. Device ofdata is read by calling
- * device_ofdata_to_platdata() on each one. The devices are not probed.
+ * device_of_to_plat() on each one. The devices are not probed.
*
* @pos: struct udevice * for the current device
* @parent: parent device to scan
*/
-#define device_foreach_child_ofdata_to_platdata(pos, parent) \
+#define device_foreach_child_of_to_plat(pos, parent) \
for (int _ret = device_first_child_ofdata_err(parent, &dev); !_ret; \
_ret = device_next_child_ofdata_err(&dev))
diff --git a/include/dm/lists.h b/include/dm/lists.h
index 810e244d9e..1a86552546 100644
--- a/include/dm/lists.h
+++ b/include/dm/lists.h
@@ -16,7 +16,7 @@
* lists_driver_lookup_name() - Return u_boot_driver corresponding to name
*
* This function returns a pointer to a driver given its name. This is used
- * for binding a driver given its name and platdata.
+ * for binding a driver given its name and plat.
*
* @name: Name of driver to look up
* @return pointer to driver, or NULL if not found
@@ -35,7 +35,7 @@ struct uclass_driver *lists_uclass_lookup(enum uclass_id id);
/**
* lists_bind_drivers() - search for and bind all drivers to parent
*
- * This searches the U_BOOT_DEVICE() structures and creates new devices for
+ * This searches the U_BOOT_DRVINFO() structures and creates new devices for
* each one. The devices will have @parent as their parent.
*
* @parent: parent device (root)
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index ced7f6ffb2..5b088650d3 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -10,6 +10,7 @@
/* TODO(sjg@chromium.org): Drop fdtdec.h include */
#include <fdtdec.h>
#include <dm/of.h>
+#include <dm/of_access.h>
#include <log.h>
/* Enable checks to protect against invalid calls */
@@ -218,6 +219,18 @@ static inline ofnode ofnode_null(void)
return node;
}
+static inline ofnode ofnode_root(void)
+{
+ ofnode node;
+
+ if (of_live_active())
+ node.np = gd_of_root();
+ else
+ node.of_offset = 0;
+
+ return node;
+}
+
/**
* ofnode_read_u32() - Read a 32-bit integer from a property
*
@@ -365,6 +378,49 @@ bool ofnode_read_bool(ofnode node, const char *propname);
*/
ofnode ofnode_find_subnode(ofnode node, const char *subnode_name);
+#if CONFIG_IS_ENABLED(DM_INLINE_OFNODE)
+static inline bool ofnode_is_enabled(ofnode node)
+{
+ if (ofnode_is_np(node)) {
+ return of_device_is_available(ofnode_to_np(node));
+ } else {
+ return fdtdec_get_is_enabled(gd->fdt_blob,
+ ofnode_to_offset(node));
+ }
+}
+
+static inline ofnode ofnode_first_subnode(ofnode node)
+{
+ assert(ofnode_valid(node));
+ if (ofnode_is_np(node))
+ return np_to_ofnode(node.np->child);
+
+ return offset_to_ofnode(
+ fdt_first_subnode(gd->fdt_blob, ofnode_to_offset(node)));
+}
+
+static inline ofnode ofnode_next_subnode(ofnode node)
+{
+ assert(ofnode_valid(node));
+ if (ofnode_is_np(node))
+ return np_to_ofnode(node.np->sibling);
+
+ return offset_to_ofnode(
+ fdt_next_subnode(gd->fdt_blob, ofnode_to_offset(node)));
+}
+#else
+/**
+ * ofnode_is_enabled() - Checks whether a node is enabled.
+ * This looks for a 'status' property. If this exists, then returns true if
+ * the status is 'okay' and false otherwise. If there is no status property,
+ * it returns true on the assumption that anything mentioned should be enabled
+ * by default.
+ *
+ * @node: node to examine
+ * @return false (not enabled) or true (enabled)
+ */
+bool ofnode_is_enabled(ofnode node);
+
/**
* ofnode_first_subnode() - find the first subnode of a parent node
*
@@ -382,6 +438,7 @@ ofnode ofnode_first_subnode(ofnode node);
* has no more siblings)
*/
ofnode ofnode_next_subnode(ofnode node);
+#endif /* DM_INLINE_OFNODE */
/**
* ofnode_get_parent() - get the ofnode's parent (enclosing ofnode)
diff --git a/include/dm/pci.h b/include/dm/pci.h
index 10f9fd9e37..bddacbf599 100644
--- a/include/dm/pci.h
+++ b/include/dm/pci.h
@@ -30,7 +30,7 @@ int pci_get_devfn(struct udevice *dev);
*
* This returns an int to avoid a dependency on pci.h
*
- * @reg: reg value from dt-platdata.c array (first member). This is not a
+ * @reg: reg value from dt-plat.c array (first member). This is not a
* pointer type, since the caller may use fdt32_t or fdt64_t depending on
* the address sizes.
* @return device/function for that device (pci_dev_t format)
diff --git a/include/dm/platdata.h b/include/dm/platdata.h
index 216efa8ef7..3821a56f2c 100644
--- a/include/dm/platdata.h
+++ b/include/dm/platdata.h
@@ -20,15 +20,15 @@
* available). U-Boot's driver model uses device tree for configuration.
*
* @name: Driver name
- * @platdata: Driver-specific platform data
- * @platdata_size: Size of platform data structure
+ * @plat: Driver-specific platform data
+ * @plat_size: Size of platform data structure
* @parent_idx: Index of the parent driver_info structure
*/
struct driver_info {
const char *name;
- const void *platdata;
+ const void *plat;
#if CONFIG_IS_ENABLED(OF_PLATDATA)
- unsigned short platdata_size;
+ unsigned short plat_size;
short parent_idx;
#endif
};
@@ -56,46 +56,34 @@ struct driver_rt {
* is not feasible (e.g. serial driver in SPL where <8KB of SRAM is
* available). U-Boot's driver model uses device tree for configuration.
*
- * When of-platdata is in use, U_BOOT_DEVICE() cannot be used outside of the
- * dt-platdata.c file created by dtoc
+ * When of-platdata is in use, U_BOOT_DRVINFO() cannot be used outside of the
+ * dt-plat.c file created by dtoc
*/
-#if CONFIG_IS_ENABLED(OF_PLATDATA) && !defined(DT_PLATDATA_C)
-#define U_BOOT_DEVICE(__name) _Static_assert(false, \
- "Cannot use U_BOOT_DEVICE with of-platdata. Please use devicetree instead")
+#if CONFIG_IS_ENABLED(OF_PLATDATA) && !defined(DT_PLAT_C)
+#define U_BOOT_DRVINFO(__name) _Static_assert(false, \
+ "Cannot use U_BOOT_DRVINFO with of-platdata. Please use devicetree instead")
#else
-#define U_BOOT_DEVICE(__name) \
+#define U_BOOT_DRVINFO(__name) \
ll_entry_declare(struct driver_info, __name, driver_info)
#endif
/* Declare a list of devices. The argument is a driver_info[] array */
-#define U_BOOT_DEVICES(__name) \
+#define U_BOOT_DRVINFOS(__name) \
ll_entry_declare_list(struct driver_info, __name, driver_info)
/**
* Get a pointer to a given device info given its name
*
- * With the declaration U_BOOT_DEVICE(name), DM_GET_DEVICE(name) will return a
+ * With the declaration U_BOOT_DRVINFO(name), DM_DRVINFO_GET(name) will return a
* pointer to the struct driver_info created by that declaration.
*
* if OF_PLATDATA is enabled, from this it is possible to use the @dev member of
* struct driver_info to find the device pointer itself.
*
- * TODO(sjg@chromium.org): U_BOOT_DEVICE() tells U-Boot to create a device, so
- * the naming seems sensible, but DM_GET_DEVICE() is a bit of misnomer, since it
- * finds the driver_info record, not the device.
- *
* @__name: Driver name (C identifier, not a string. E.g. gpio7_at_ff7e0000)
* @return struct driver_info * to the driver that created the device
*/
-#define DM_GET_DEVICE(__name) \
+#define DM_DRVINFO_GET(__name) \
ll_entry_get(struct driver_info, __name, driver_info)
-/**
- * dm_populate_phandle_data() - Populates phandle data in platda
- *
- * This populates phandle data with an U_BOOT_DEVICE entry get by
- * DM_GET_DEVICE. The implementation of this function will be done
- * by dtoc when parsing dtb.
- */
-void dm_populate_phandle_data(void);
#endif
diff --git a/include/dm/platform_data/fsl_espi.h b/include/dm/platform_data/fsl_espi.h
index 812933f51c..de2307f7fb 100644
--- a/include/dm/platform_data/fsl_espi.h
+++ b/include/dm/platform_data/fsl_espi.h
@@ -6,7 +6,7 @@
#ifndef __fsl_espi_h
#define __fsl_espi_h
-struct fsl_espi_platdata {
+struct fsl_espi_plat {
uint flags;
uint speed_hz;
uint num_chipselect;
diff --git a/include/dm/platform_data/lpc32xx_hsuart.h b/include/dm/platform_data/lpc32xx_hsuart.h
index 9bfd62833c..6f41e0e734 100644
--- a/include/dm/platform_data/lpc32xx_hsuart.h
+++ b/include/dm/platform_data/lpc32xx_hsuart.h
@@ -7,11 +7,11 @@
#define _LPC32XX_HSUART_PLAT_H
/**
- * struct lpc32xx_hsuart_platdata - NXP LPC32xx HSUART platform data
+ * struct lpc32xx_hsuart_plat - NXP LPC32xx HSUART platform data
*
* @base: Base register address
*/
-struct lpc32xx_hsuart_platdata {
+struct lpc32xx_hsuart_plat {
unsigned long base;
};
diff --git a/include/dm/platform_data/pxa_mmc_gen.h b/include/dm/platform_data/pxa_mmc_gen.h
index 9875bab2cf..d15c1551f4 100644
--- a/include/dm/platform_data/pxa_mmc_gen.h
+++ b/include/dm/platform_data/pxa_mmc_gen.h
@@ -9,7 +9,7 @@
#include <mmc.h>
/*
- * struct pxa_mmc_platdata - information about a PXA MMC controller
+ * struct pxa_mmc_plat - information about a PXA MMC controller
*
* @base: MMC controller base register address
*/
diff --git a/include/dm/platform_data/serial_bcm283x_mu.h b/include/dm/platform_data/serial_bcm283x_mu.h
index 37f5174dbf..6c77272e80 100644
--- a/include/dm/platform_data/serial_bcm283x_mu.h
+++ b/include/dm/platform_data/serial_bcm283x_mu.h
@@ -14,7 +14,7 @@
*
* @base: Register base address
*/
-struct bcm283x_mu_serial_platdata {
+struct bcm283x_mu_serial_plat {
unsigned long base;
unsigned int clock;
bool skip_init;
diff --git a/include/dm/platform_data/serial_coldfire.h b/include/dm/platform_data/serial_coldfire.h
index ba916fece3..5e265e9087 100644
--- a/include/dm/platform_data/serial_coldfire.h
+++ b/include/dm/platform_data/serial_coldfire.h
@@ -7,13 +7,13 @@
#define __serial_coldfire_h
/*
- * struct coldfire_serial_platdata - information about a coldfire port
+ * struct coldfire_serial_plat - information about a coldfire port
*
* @base: Uart port base register address
* @port: Uart port index, for cpu with pinmux for uart / gpio
* baudrtatre: Uart port baudrate
*/
-struct coldfire_serial_platdata {
+struct coldfire_serial_plat {
unsigned long base;
int port;
int baudrate;
diff --git a/include/dm/platform_data/serial_mxc.h b/include/dm/platform_data/serial_mxc.h
index 86cd3bcf62..cc59eeb1dd 100644
--- a/include/dm/platform_data/serial_mxc.h
+++ b/include/dm/platform_data/serial_mxc.h
@@ -7,7 +7,7 @@
#define __serial_mxc_h
/* Information about a serial port */
-struct mxc_serial_platdata {
+struct mxc_serial_plat {
struct mxc_uart *reg; /* address of registers in physical memory */
bool use_dte;
};
diff --git a/include/dm/platform_data/serial_pl01x.h b/include/dm/platform_data/serial_pl01x.h
index 77d96c49f0..e3d4e308a1 100644
--- a/include/dm/platform_data/serial_pl01x.h
+++ b/include/dm/platform_data/serial_pl01x.h
@@ -20,7 +20,7 @@ enum pl01x_type {
* @skip_init: Don't attempt to change port configuration (also means @clock
* is ignored)
*/
-struct pl01x_serial_platdata {
+struct pl01x_serial_plat {
unsigned long base;
enum pl01x_type type;
unsigned int clock;
diff --git a/include/dm/platform_data/serial_pxa.h b/include/dm/platform_data/serial_pxa.h
index b78bdb6409..0d7dc4c462 100644
--- a/include/dm/platform_data/serial_pxa.h
+++ b/include/dm/platform_data/serial_pxa.h
@@ -40,13 +40,13 @@
#endif
/*
- * struct pxa_serial_platdata - information about a PXA port
+ * struct pxa_serial_plat - information about a PXA port
*
* @base: Uart port base register address
* @port: Uart port index, for cpu with pinmux for uart / gpio
* baudrtatre: Uart port baudrate
*/
-struct pxa_serial_platdata {
+struct pxa_serial_plat {
struct pxa_uart_regs *base;
int port;
int baudrate;
diff --git a/include/dm/platform_data/serial_sh.h b/include/dm/platform_data/serial_sh.h
index 711435d8f6..69cd012fc5 100644
--- a/include/dm/platform_data/serial_sh.h
+++ b/include/dm/platform_data/serial_sh.h
@@ -27,7 +27,7 @@ enum sh_serial_type {
* @clk_mode: Clock mode, set internal (INT) or external (EXT)
* @type: Type of SCIF
*/
-struct sh_serial_platdata {
+struct sh_serial_plat {
unsigned long base;
unsigned int clk;
enum sh_clk_mode clk_mode;
diff --git a/include/dm/platform_data/spi_coldfire.h b/include/dm/platform_data/spi_coldfire.h
index 8ad8eaedfd..da514bad0d 100644
--- a/include/dm/platform_data/spi_coldfire.h
+++ b/include/dm/platform_data/spi_coldfire.h
@@ -10,14 +10,14 @@
#define MAX_CTAR_FIELDS 8
/*
- * struct coldfire_spi_platdata - information about a coldfire spi module
+ * struct coldfire_spi_plat - information about a coldfire spi module
*
* @regs_addr: base address for module registers
* @speed_hz: default SCK frequency
* @mode: default SPI mode
* @num_cs: number of DSPI chipselect signals
*/
-struct coldfire_spi_platdata {
+struct coldfire_spi_plat {
fdt_addr_t regs_addr;
uint speed_hz;
uint mode;
diff --git a/include/dm/platform_data/spi_davinci.h b/include/dm/platform_data/spi_davinci.h
index fbc62c262a..42a467e40b 100644
--- a/include/dm/platform_data/spi_davinci.h
+++ b/include/dm/platform_data/spi_davinci.h
@@ -7,7 +7,7 @@
#ifndef __spi_davinci_h
#define __spi_davinci_h
-struct davinci_spi_platdata {
+struct davinci_spi_plat {
struct davinci_spi_regs *regs;
u8 num_cs; /* total no. of CS available */
};
diff --git a/include/dm/platform_data/spi_pl022.h b/include/dm/platform_data/spi_pl022.h
index 63a58ee453..7f74b3cbc5 100644
--- a/include/dm/platform_data/spi_pl022.h
+++ b/include/dm/platform_data/spi_pl022.h
@@ -3,8 +3,8 @@
* (C) Copyright 2018
* Quentin Schulz, Bootlin, quentin.schulz@bootlin.com
*
- * Structure for use with U_BOOT_DEVICE for pl022 SPI devices or to use
- * in ofdata_to_platdata.
+ * Structure for use with U_BOOT_DRVINFO for pl022 SPI devices or to use
+ * in of_to_plat.
*/
#ifndef __spi_pl022_h
diff --git a/include/dm/read.h b/include/dm/read.h
index 0585eb1228..c875e11a13 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -21,7 +21,7 @@ struct resource;
#if CONFIG_IS_ENABLED(OF_LIVE)
static inline const struct device_node *dev_np(const struct udevice *dev)
{
- return ofnode_to_np(dev->node);
+ return ofnode_to_np(dev_ofnode(dev));
}
#else
static inline const struct device_node *dev_np(const struct udevice *dev)
@@ -30,22 +30,6 @@ static inline const struct device_node *dev_np(const struct udevice *dev)
}
#endif
-/**
- * dev_ofnode() - get the DT node reference associated with a udevice
- *
- * @dev: device to check
- * @return reference of the the device's DT node
- */
-static inline ofnode dev_ofnode(const struct udevice *dev)
-{
- return dev->node;
-}
-
-static inline bool dev_of_valid(const struct udevice *dev)
-{
- return ofnode_valid(dev_ofnode(dev));
-}
-
#ifndef CONFIG_DM_DEV_READ_INLINE
/**
@@ -694,6 +678,23 @@ int dev_get_child_count(const struct udevice *dev);
*/
int dev_read_pci_bus_range(const struct udevice *dev, struct resource *res);
+/**
+ * dev_decode_display_timing() - decode display timings
+ *
+ * Decode display timings from the supplied 'display-timings' node.
+ * See doc/device-tree-bindings/video/display-timing.txt for binding
+ * information.
+ *
+ * @dev: device to read DT display timings from. The node linked to the device
+ * contains a child node called 'display-timings' which in turn contains
+ * one or more display timing nodes.
+ * @index: index number to read (0=first timing subnode)
+ * @config: place to put timings
+ * @return 0 if OK, -FDT_ERR_NOTFOUND if not found
+ */
+int dev_decode_display_timing(const struct udevice *dev, int index,
+ struct display_timing *config);
+
#else /* CONFIG_DM_DEV_READ_INLINE is enabled */
static inline int dev_read_u32(const struct udevice *dev,
@@ -1016,6 +1017,13 @@ static inline int dev_get_child_count(const struct udevice *dev)
return ofnode_get_child_count(dev_ofnode(dev));
}
+static inline int dev_decode_display_timing(const struct udevice *dev,
+ int index,
+ struct display_timing *config)
+{
+ return ofnode_decode_display_timing(dev_ofnode(dev), index, config);
+}
+
#endif /* CONFIG_DM_DEV_READ_INLINE */
/**
diff --git a/include/dm/root.h b/include/dm/root.h
index c8d629ba9b..89afbee619 100644
--- a/include/dm/root.h
+++ b/include/dm/root.h
@@ -31,15 +31,15 @@ struct global_data;
void dm_fixup_for_gd_move(struct global_data *new_gd);
/**
- * dm_scan_platdata() - Scan all platform data and bind drivers
+ * dm_scan_plat() - Scan all platform data and bind drivers
*
- * This scans all available platdata and creates drivers for each
+ * This scans all available plat and creates drivers for each
*
* @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC
* flag. If false bind all drivers.
* @return 0 if OK, -ve on error
*/
-int dm_scan_platdata(bool pre_reloc_only);
+int dm_scan_plat(bool pre_reloc_only);
/**
* dm_scan_fdt() - Scan the device tree and bind drivers
@@ -47,26 +47,24 @@ int dm_scan_platdata(bool pre_reloc_only);
* This scans the device tree and creates a driver for each node. Only
* the top-level subnodes are examined.
*
- * @blob: Pointer to device tree blob
* @pre_reloc_only: If true, bind only nodes with special devicetree properties,
* or drivers with the DM_FLAG_PRE_RELOC flag. If false bind all drivers.
* @return 0 if OK, -ve on error
*/
-int dm_scan_fdt(const void *blob, bool pre_reloc_only);
+int dm_scan_fdt(bool pre_reloc_only);
/**
- * dm_extended_scan_fdt() - Scan the device tree and bind drivers
+ * dm_extended_scan() - Scan the device tree and bind drivers
*
* This calls dm_scna_dft() which scans the device tree and creates a driver
* for each node. the top-level subnodes are examined and also all sub-nodes
* of "clocks" node.
*
- * @blob: Pointer to device tree blob
* @pre_reloc_only: If true, bind only nodes with special devicetree properties,
* or drivers with the DM_FLAG_PRE_RELOC flag. If false bind all drivers.
* @return 0 if OK, -ve on error
*/
-int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only);
+int dm_extended_scan(bool pre_reloc_only);
/**
* dm_scan_other() - Scan for other devices
diff --git a/include/dm/simple_bus.h b/include/dm/simple_bus.h
new file mode 100644
index 0000000000..4ad4cc4051
--- /dev/null
+++ b/include/dm/simple_bus.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2020 Google LLC
+ */
+
+#ifndef __DM_SIMPLE_BUS_H
+#define __DM_SIMPLE_BUS_H
+
+struct simple_bus_plat {
+ u32 base;
+ u32 size;
+ u32 target;
+};
+
+#endif
diff --git a/include/dm/test.h b/include/dm/test.h
index b2adce730a..6ac6672cd6 100644
--- a/include/dm/test.h
+++ b/include/dm/test.h
@@ -134,14 +134,12 @@ extern struct unit_test_state global_dm_test_state;
* @testdev: Test device
* @force_fail_alloc: Force all memory allocs to fail
* @skip_post_probe: Skip uclass post-probe processing
- * @removed: Used to keep track of a device that was removed
*/
struct dm_test_state {
struct udevice *root;
struct udevice *testdev;
int force_fail_alloc;
int skip_post_probe;
- struct udevice *removed;
};
/* Declare a new driver model test */
@@ -169,6 +167,24 @@ struct sandbox_sdl_plat {
int font_size;
};
+/**
+ * struct dm_test_parent_plat - Used to track state in bus tests
+ *
+ * @count:
+ * @bind_flag: Indicates that the child post-bind method was called
+ * @uclass_bind_flag: Also indicates that the child post-bind method was called
+ */
+struct dm_test_parent_plat {
+ int count;
+ int bind_flag;
+ int uclass_bind_flag;
+};
+
+enum {
+ TEST_FLAG_CHILD_PROBED = 10,
+ TEST_FLAG_CHILD_REMOVED = -7,
+};
+
/* Declare ping methods for the drivers */
int test_ping(struct udevice *dev, int pingval, int *pingret);
int testfdt_ping(struct udevice *dev, int pingval, int *pingret);
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index e952a9967c..ae4425d7a5 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -16,6 +16,7 @@ enum uclass_id {
UCLASS_DEMO,
UCLASS_TEST,
UCLASS_TEST_FDT,
+ UCLASS_TEST_FDT_MANUAL,
UCLASS_TEST_BUS,
UCLASS_TEST_PROBE,
UCLASS_TEST_DUMMY,
diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h
index 6e3f15c2b0..c5a464be7c 100644
--- a/include/dm/uclass-internal.h
+++ b/include/dm/uclass-internal.h
@@ -12,17 +12,34 @@
#include <dm/ofnode.h>
/**
- * uclass_find_next_free_req_seq() - Get the next free req_seq number
+ * uclass_set_priv() - Set the private data for a uclass
*
- * This returns the next free req_seq number. This is useful only if
- * OF_CONTROL is not used. The next free req_seq number is simply the
- * maximum req_seq of the uclass + 1.
- * This allows assiging req_seq number in the binding order.
+ * This is normally handled by driver model, which automatically allocates
+ * private data when an 'auto' size if provided by the uclass driver.
*
- * @id: Id number of the uclass
- * @return The next free req_seq number
+ * Use this function to override normal operation for special situations, such
+ * as needing to allocate a variable amount of data.
+ *
+ * @uc Uclass to update
+ * @priv New private-data pointer
*/
-int uclass_find_next_free_req_seq(enum uclass_id id);
+void uclass_set_priv(struct uclass *uc, void *priv);
+
+/**
+ * uclass_find_next_free_seq() - Get the next free sequence number
+ *
+ * This returns the next free sequence number. This is useful only if
+ * OF_CONTROL is not used. The next free sequence number is simply the
+ * maximum sequence number used by all devices in the uclass + 1. The value
+ * returned is always greater than the largest alias, if DM_SEQ_ALIAS is enabled
+ * and the uclass has the DM_UC_FLAG_SEQ_ALIAS flag.
+ *
+ * This allows assigning the sequence number in the binding order.
+ *
+ * @uc: uclass to check
+ * @return The next free sequence number
+ */
+int uclass_find_next_free_seq(struct uclass *uc);
/**
* uclass_get_device_tail() - handle the end of a get_device call
@@ -103,25 +120,17 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,
/**
* uclass_find_device_by_seq() - Find uclass device based on ID and sequence
*
- * This searches for a device with the given seq or req_seq.
- *
- * For seq, if an active device has this sequence it will be returned.
- * If there is no such device then this will return -ENODEV.
- *
- * For req_seq, if a device (whether activated or not) has this req_seq
- * value, that device will be returned. This is a strong indication that
- * the device will receive that sequence when activated.
+ * This searches for a device with the given seq.
*
* The device is NOT probed, it is merely returned.
*
* @id: ID to look up
- * @seq_or_req_seq: Sequence number to find (0=first)
- * @find_req_seq: true to find req_seq, false to find seq
+ * @seq: Sequence number to find (0=first)
* @devp: Returns pointer to device (there is only one per for each seq)
- * @return 0 if OK, -ve on error
+ * @return 0 if OK, -ENODEV if not found
*/
-int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
- bool find_req_seq, struct udevice **devp);
+int uclass_find_device_by_seq(enum uclass_id id, int seq,
+ struct udevice **devp);
/**
* uclass_find_device_by_of_offset() - Find a uclass device by device tree node
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 7188304304..b5f066dbf4 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -24,7 +24,7 @@
* There may be drivers for on-chip SoC GPIO banks, I2C GPIO expanders and
* PMIC IO lines, all made available in a unified way through the uclass.
*
- * @priv: Private data for this uclass
+ * @priv_: Private data for this uclass (do not access outside driver model)
* @uc_drv: The driver for the uclass itself, not to be confused with a
* 'struct driver'
* @dev_head: List of devices in this uclass (devices are attached to their
@@ -32,7 +32,7 @@
* @sibling_node: Next uclass in the linked list of uclasses
*/
struct uclass {
- void *priv;
+ void *priv_;
struct uclass_driver *uc_drv;
struct list_head dev_head;
struct list_head sibling_node;
@@ -44,6 +44,9 @@ struct udevice;
/* Members of this uclass sequence themselves with aliases */
#define DM_UC_FLAG_SEQ_ALIAS (1 << 0)
+/* Members of this uclass without aliases don't get a sequence number */
+#define DM_UC_FLAG_NO_AUTO_SEQ (1 << 1)
+
/* Same as DM_FLAG_ALLOC_PRIV_DMA */
#define DM_UC_FLAG_ALLOC_PRIV_DMA (1 << 5)
@@ -65,21 +68,21 @@ struct udevice;
* @child_post_probe: Called after a child in this uclass is probed
* @init: Called to set up the uclass
* @destroy: Called to destroy the uclass
- * @priv_auto_alloc_size: If non-zero this is the size of the private data
+ * @priv_auto: If non-zero this is the size of the private data
* to be allocated in the uclass's ->priv pointer. If zero, then the uclass
* driver is responsible for allocating any data required.
- * @per_device_auto_alloc_size: Each device can hold private data owned
+ * @per_device_auto: Each device can hold private data owned
* by the uclass. If required this will be automatically allocated if this
* value is non-zero.
- * @per_device_platdata_auto_alloc_size: Each device can hold platform data
- * owned by the uclass as 'dev->uclass_platdata'. If the value is non-zero,
+ * @per_device_plat_auto: Each device can hold platform data
+ * owned by the uclass as 'dev->uclass_plat'. If the value is non-zero,
* then this will be automatically allocated.
- * @per_child_auto_alloc_size: Each child device (of a parent in this
+ * @per_child_auto: Each child device (of a parent in this
* uclass) can hold parent data for the device/uclass. This value is only
* used as a fallback if this member is 0 in the driver.
- * @per_child_platdata_auto_alloc_size: A bus likes to store information about
+ * @per_child_plat_auto: A bus likes to store information about
* its children. If non-zero this is the size of this data, to be allocated
- * in the child device's parent_platdata pointer. This value is only used as
+ * in the child device's parent_plat pointer. This value is only used as
* a fallback if this member is 0 in the driver.
* @ops: Uclass operations, providing the consistent interface to devices
* within the uclass.
@@ -98,18 +101,26 @@ struct uclass_driver {
int (*child_post_probe)(struct udevice *dev);
int (*init)(struct uclass *class);
int (*destroy)(struct uclass *class);
- int priv_auto_alloc_size;
- int per_device_auto_alloc_size;
- int per_device_platdata_auto_alloc_size;
- int per_child_auto_alloc_size;
- int per_child_platdata_auto_alloc_size;
+ int priv_auto;
+ int per_device_auto;
+ int per_device_plat_auto;
+ int per_child_auto;
+ int per_child_plat_auto;
const void *ops;
uint32_t flags;
};
/* Declare a new uclass_driver */
#define UCLASS_DRIVER(__name) \
- ll_entry_declare(struct uclass_driver, __name, uclass)
+ ll_entry_declare(struct uclass_driver, __name, uclass_driver)
+
+/**
+ * uclass_get_priv() - Get the private data for a uclass
+ *
+ * @uc Uclass to check
+ * @return private data, or NULL if none
+ */
+void *uclass_get_priv(const struct uclass *uc);
/**
* uclass_get() - Get a uclass based on an ID, creating it if needed
@@ -253,7 +264,7 @@ int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent,
* uclass_get_device_by_driver() - Get a uclass device for a driver
*
* This searches the devices in the uclass for one that uses the given
- * driver. Use DM_GET_DRIVER(name) for the @drv argument, where 'name' is
+ * driver. Use DM_DRIVER_GET(name) for the @drv argument, where 'name' is
* the driver name - as used in U_BOOT_DRIVER(name).
*
* The device is probed to activate it ready for use.
@@ -366,21 +377,6 @@ int uclass_first_device_drvdata(enum uclass_id id, ulong driver_data,
struct udevice **devp);
/**
- * uclass_resolve_seq() - Resolve a device's sequence number
- *
- * On entry dev->seq is -1, and dev->req_seq may be -1 (to allocate a
- * sequence number automatically, or >= 0 to select a particular number.
- * If the requested sequence number is in use, then this device will
- * be allocated another one.
- *
- * Note that the device's seq value is not changed by this function.
- *
- * @dev: Device for which to allocate sequence number
- * @return sequence number allocated, or -ve on error
- */
-int uclass_resolve_seq(struct udevice *dev);
-
-/**
* uclass_id_foreach_dev() - Helper function to iteration through devices
*
* This creates a for() loop which works through the available devices in
diff --git a/include/dt-bindings/bus/ti-sysc.h b/include/dt-bindings/bus/ti-sysc.h
index 2c005376ac..eae4274543 100644
--- a/include/dt-bindings/bus/ti-sysc.h
+++ b/include/dt-bindings/bus/ti-sysc.h
@@ -15,6 +15,12 @@
/* SmartReflex sysc found on 36xx and later */
#define SYSC_OMAP3_SR_ENAWAKEUP (1 << 26)
+#define SYSC_DRA7_MCAN_ENAWAKEUP (1 << 4)
+
+/* PRUSS sysc found on AM33xx/AM43xx/AM57xx */
+#define SYSC_PRUSS_SUB_MWAIT (1 << 5)
+#define SYSC_PRUSS_STANDBY_INIT (1 << 4)
+
/* SYSCONFIG STANDBYMODE/MIDLEMODE/SIDLEMODE supported by hardware */
#define SYSC_IDLE_FORCE 0
#define SYSC_IDLE_NO 1
diff --git a/include/dwmmc.h b/include/dwmmc.h
index d8a8355a0a..51ab74ead3 100644
--- a/include/dwmmc.h
+++ b/include/dwmmc.h
@@ -256,10 +256,10 @@ static inline u8 dwmci_readb(struct dwmci_host *host, int reg)
* ...
*
* Inside U_BOOT_DRIVER():
- * .platdata_auto_alloc_size = sizeof(struct rockchip_mmc_plat),
+ * .plat_auto = sizeof(struct rockchip_mmc_plat),
*
* To access platform data:
- * struct rockchip_mmc_plat *plat = dev_get_platdata(dev);
+ * struct rockchip_mmc_plat *plat = dev_get_plat(dev);
*
* See rockchip_dw_mmc.c for an example.
*
diff --git a/include/efi_api.h b/include/efi_api.h
index 5744f6aed8..ecb43a0607 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -217,6 +217,21 @@ enum efi_reset_type {
#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
#define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
+#define CAPSULE_SUPPORT_AUTHENTICATION 0x0000000000000001
+#define CAPSULE_SUPPORT_DEPENDENCY 0x0000000000000002
+
+#define EFI_CAPSULE_REPORT_GUID \
+ EFI_GUID(0x39b68c46, 0xf7fb, 0x441b, 0xb6, 0xec, \
+ 0x16, 0xb0, 0xf6, 0x98, 0x21, 0xf3)
+
+#define EFI_MEMORY_RANGE_CAPSULE_GUID \
+ EFI_GUID(0xde9f0ec, 0x88b6, 0x428f, 0x97, 0x7a, \
+ 0x25, 0x8f, 0x1d, 0xe, 0x5e, 0x72)
+
+#define EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID \
+ EFI_GUID(0x6dcbd5ed, 0xe82d, 0x4c44, 0xbd, 0xa1, \
+ 0x71, 0x94, 0x19, 0x9a, 0xd9, 0x2a)
+
struct efi_capsule_header {
efi_guid_t capsule_guid;
u32 header_size;
@@ -224,6 +239,54 @@ struct efi_capsule_header {
u32 capsule_image_size;
} __packed;
+struct efi_capsule_result_variable_header {
+ u32 variable_total_size;
+ u32 reserved;
+ efi_guid_t capsule_guid;
+ struct efi_time capsule_processed;
+ efi_status_t capsule_status;
+} __packed;
+
+struct efi_memory_range {
+ efi_physical_addr_t address;
+ u64 length;
+};
+
+struct efi_memory_range_capsule {
+ struct efi_capsule_header *header;
+ /* EFI_MEMORY_TYPE: 0x80000000-0xFFFFFFFF */
+ enum efi_mem_type os_requested_memory_type;
+ u64 number_of_memory_ranges;
+ struct efi_memory_range memory_ranges[];
+} __packed;
+
+struct efi_firmware_management_capsule_header {
+ u32 version;
+ u16 embedded_driver_count;
+ u16 payload_item_count;
+ u64 item_offset_list[];
+} __packed;
+
+struct efi_firmware_management_capsule_image_header {
+ u32 version;
+ efi_guid_t update_image_type_id;
+ u8 update_image_index;
+ u8 reserved[3];
+ u32 update_image_size;
+ u32 update_vendor_code_size;
+ u64 update_hardware_instance;
+ u64 image_capsule_support;
+} __packed;
+
+struct efi_capsule_result_variable_fmp {
+ u16 version;
+ u8 payload_index;
+ u8 update_image_index;
+ efi_guid_t update_image_type_id;
+ // u16 capsule_file_name[];
+ // u16 capsule_target[];
+} __packed;
+
#define EFI_RT_SUPPORTED_GET_TIME 0x0001
#define EFI_RT_SUPPORTED_SET_TIME 0x0002
#define EFI_RT_SUPPORTED_GET_WAKEUP_TIME 0x0004
@@ -356,6 +419,10 @@ struct efi_runtime_services {
EFI_GUID(0x4006c0c1, 0xfcb3, 0x403e, \
0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d)
+#define EFI_TCG2_FINAL_EVENTS_TABLE_GUID \
+ EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, \
+ 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25)
+
struct efi_configuration_table {
efi_guid_t guid;
void *table;
@@ -1746,6 +1813,24 @@ struct efi_variable_authentication_2 {
} __attribute__((__packed__));
/**
+ * efi_firmware_image_authentication - Capsule authentication method
+ * descriptor
+ *
+ * This structure describes an authentication information for
+ * a capsule with IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED set
+ * and should be included as part of the capsule.
+ * Only EFI_CERT_TYPE_PKCS7_GUID is accepted.
+ *
+ * @monotonic_count: Count to prevent replay
+ * @auth_info: Authentication info
+ */
+struct efi_firmware_image_authentication {
+ uint64_t monotonic_count;
+ struct win_certificate_uefi_guid auth_info;
+} __attribute__((__packed__));
+
+
+/**
* efi_signature_data - A format of signature
*
* This structure describes a single signature in signature database.
@@ -1779,4 +1864,107 @@ struct efi_signature_list {
/* struct efi_signature_data signatures[...][signature_size]; */
} __attribute__((__packed__));
+/*
+ * Firmware management protocol
+ */
+#define EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GUID \
+ EFI_GUID(0x86c77a67, 0x0b97, 0x4633, 0xa1, 0x87, \
+ 0x49, 0x10, 0x4d, 0x06, 0x85, 0xc7)
+
+#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID \
+ EFI_GUID(0xae13ff2d, 0x9ad4, 0x4e25, 0x9a, 0xc8, \
+ 0x6d, 0x80, 0xb3, 0xb2, 0x21, 0x47)
+
+#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID \
+ EFI_GUID(0xe2bb9c06, 0x70e9, 0x4b14, 0x97, 0xa3, \
+ 0x5a, 0x79, 0x13, 0x17, 0x6e, 0x3f)
+
+#define IMAGE_ATTRIBUTE_IMAGE_UPDATABLE 0x0000000000000001
+#define IMAGE_ATTRIBUTE_RESET_REQUIRED 0x0000000000000002
+#define IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED 0x0000000000000004
+#define IMAGE_ATTRIBUTE_IN_USE 0x0000000000000008
+#define IMAGE_ATTRIBUTE_UEFI_IMAGE 0x0000000000000010
+#define IMAGE_ATTRIBUTE_DEPENDENCY 0x0000000000000020
+
+#define IMAGE_COMPATIBILITY_CHECK_SUPPORTED 0x0000000000000001
+
+#define IMAGE_UPDATABLE_VALID 0x0000000000000001
+#define IMAGE_UPDATABLE_INVALID 0x0000000000000002
+#define IMAGE_UPDATABLE_INVALID_TYPE 0x0000000000000004
+#define IMAGE_UPDATABLE_INVALID_OLLD 0x0000000000000008
+#define IMAGE_UPDATABLE_VALID_WITH_VENDOR_CODE 0x0000000000000010
+
+#define PACKAGE_ATTRIBUTE_VERSION_UPDATABLE 0x0000000000000001
+#define PACKAGE_ATTRIBUTE_RESET_REQUIRED 0x0000000000000002
+#define PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED 0x0000000000000004
+
+#define EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION 4
+
+typedef struct efi_firmware_image_dependencies {
+ u8 dependencies[0];
+} efi_firmware_image_dep_t;
+
+struct efi_firmware_image_descriptor {
+ u8 image_index;
+ efi_guid_t image_type_id;
+ u64 image_id;
+ u16 *image_id_name;
+ u32 version;
+ u16 *version_name;
+ efi_uintn_t size;
+ u64 attributes_supported;
+ u64 attributes_setting;
+ u64 compatibilities;
+ u32 lowest_supported_image_version;
+ u32 last_attempt_version;
+ u32 last_attempt_status;
+ u64 hardware_instance;
+ efi_firmware_image_dep_t *dependencies;
+};
+
+struct efi_firmware_management_protocol {
+ efi_status_t (EFIAPI *get_image_info)(
+ struct efi_firmware_management_protocol *this,
+ efi_uintn_t *image_info_size,
+ struct efi_firmware_image_descriptor *image_info,
+ u32 *descriptor_version,
+ u8 *descriptor_count,
+ efi_uintn_t *descriptor_size,
+ u32 *package_version,
+ u16 **package_version_name);
+ efi_status_t (EFIAPI *get_image)(
+ struct efi_firmware_management_protocol *this,
+ u8 image_index,
+ void *image,
+ efi_uintn_t *image_size);
+ efi_status_t (EFIAPI *set_image)(
+ struct efi_firmware_management_protocol *this,
+ u8 image_index,
+ const void *image,
+ efi_uintn_t image_size,
+ const void *vendor_code,
+ efi_status_t (*progress)(efi_uintn_t completion),
+ u16 **abort_reason);
+ efi_status_t (EFIAPI *check_image)(
+ struct efi_firmware_management_protocol *this,
+ u8 image_index,
+ const void *image,
+ efi_uintn_t *image_size,
+ u32 *image_updatable);
+ efi_status_t (EFIAPI *get_package_info)(
+ struct efi_firmware_management_protocol *this,
+ u32 *package_version,
+ u16 **package_version_name,
+ u32 *package_version_name_maxlen,
+ u64 *attributes_supported,
+ u64 *attributes_setting);
+ efi_status_t (EFIAPI *set_package_info)(
+ struct efi_firmware_management_protocol *this,
+ const void *image,
+ efi_uintn_t *image_size,
+ const void *vendor_code,
+ u32 package_version,
+ const u16 *package_version_name);
+};
+
#endif
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 0fc2255f3f..4719fa93f0 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -195,6 +195,9 @@ extern const efi_guid_t efi_file_system_info_guid;
extern const efi_guid_t efi_guid_device_path_utilities_protocol;
/* GUID of the deprecated Unicode collation protocol */
extern const efi_guid_t efi_guid_unicode_collation_protocol;
+/* GUIDs of the Load File and Load File2 protocol */
+extern const efi_guid_t efi_guid_load_file_protocol;
+extern const efi_guid_t efi_guid_load_file2_protocol;
/* GUID of the Unicode collation protocol */
extern const efi_guid_t efi_guid_unicode_collation_protocol2;
extern const efi_guid_t efi_guid_hii_config_routing_protocol;
@@ -210,6 +213,10 @@ extern const efi_guid_t efi_guid_cert_type_pkcs7;
/* GUID of RNG protocol */
extern const efi_guid_t efi_guid_rng_protocol;
+/* GUID of capsule update result */
+extern const efi_guid_t efi_guid_capsule_report;
+/* GUID of firmware management protocol */
+extern const efi_guid_t efi_guid_firmware_management_protocol;
extern unsigned int __efi_runtime_start, __efi_runtime_stop;
extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop;
@@ -495,6 +502,11 @@ efi_status_t efi_search_protocol(const efi_handle_t handle,
efi_status_t efi_add_protocol(const efi_handle_t handle,
const efi_guid_t *protocol,
void *protocol_interface);
+/* Open protocol */
+efi_status_t efi_protocol_open(struct efi_handler *handler,
+ void **protocol_interface, void *agent_handle,
+ void *controller_handle, uint32_t attributes);
+
/* Delete protocol from a handle */
efi_status_t efi_remove_protocol(const efi_handle_t handle,
const efi_guid_t *protocol,
@@ -801,18 +813,50 @@ efi_status_t efi_image_region_add(struct efi_image_regions *regs,
int nocheck);
void efi_sigstore_free(struct efi_signature_store *sigstore);
+struct efi_signature_store *efi_build_signature_store(void *sig_list,
+ efi_uintn_t size);
struct efi_signature_store *efi_sigstore_parse_sigdb(u16 *name);
bool efi_secure_boot_enabled(void);
+bool efi_capsule_auth_enabled(void);
+
bool efi_image_parse(void *efi, size_t len, struct efi_image_regions **regp,
WIN_CERTIFICATE **auth, size_t *auth_len);
+struct pkcs7_message *efi_parse_pkcs7_header(const void *buf,
+ size_t buflen,
+ u8 **tmpbuf);
+
/* runtime implementation of memcpy() */
void efi_memcpy_runtime(void *dest, const void *src, size_t n);
/* commonly used helper function */
-u16 *efi_create_indexed_name(u16 *buffer, const char *name, unsigned int index);
+u16 *efi_create_indexed_name(u16 *buffer, size_t buffer_size, const char *name,
+ unsigned int index);
+
+extern const struct efi_firmware_management_protocol efi_fmp_fit;
+extern const struct efi_firmware_management_protocol efi_fmp_raw;
+
+/* Capsule update */
+efi_status_t EFIAPI efi_update_capsule(
+ struct efi_capsule_header **capsule_header_array,
+ efi_uintn_t capsule_count,
+ u64 scatter_gather_list);
+efi_status_t EFIAPI efi_query_capsule_caps(
+ struct efi_capsule_header **capsule_header_array,
+ efi_uintn_t capsule_count,
+ u64 *maximum_capsule_size,
+ u32 *reset_type);
+
+efi_status_t efi_capsule_authenticate(const void *capsule,
+ efi_uintn_t capsule_size,
+ void **image, efi_uintn_t *image_size);
+
+#define EFI_CAPSULE_DIR L"\\EFI\\UpdateCapsule\\"
+
+/* Hook at initialization */
+efi_status_t efi_launch_capsules(void);
#else /* CONFIG_IS_ENABLED(EFI_LOADER) */
@@ -830,6 +874,10 @@ static inline void efi_set_bootdev(const char *dev, const char *devnr,
const char *path) { }
static inline void efi_net_set_dhcp_ack(void *pkt, int len) { }
static inline void efi_print_image_infos(void *pc) { }
+static inline efi_status_t efi_launch_capsules(void)
+{
+ return EFI_SUCCESS;
+}
#endif /* CONFIG_IS_ENABLED(EFI_LOADER) */
diff --git a/include/efi_tcg2.h b/include/efi_tcg2.h
index 86b8fe4c01..40e241ce31 100644
--- a/include/efi_tcg2.h
+++ b/include/efi_tcg2.h
@@ -17,6 +17,8 @@
/* TPMV2 only */
#define TCG2_EVENT_LOG_FORMAT_TCG_2 0x00000002
+#define EFI_TCG2_EXTEND_ONLY 0x0000000000000001
+#define PE_COFF_IMAGE 0x0000000000000010
/* Algorithm Registry */
#define EFI_TCG2_BOOT_HASH_ALG_SHA1 0x00000001
@@ -25,6 +27,10 @@
#define EFI_TCG2_BOOT_HASH_ALG_SHA512 0x00000008
#define EFI_TCG2_BOOT_HASH_ALG_SM3_256 0x00000010
+#define EFI_TCG2_FINAL_EVENTS_TABLE_VERSION 1
+
+#define TPM2_EVENT_LOG_SIZE CONFIG_EFI_TCG2_PROTOCOL_EVENTLOG_SIZE
+
typedef u32 efi_tcg_event_log_bitmap;
typedef u32 efi_tcg_event_log_format;
typedef u32 efi_tcg_event_algorithm_bitmap;
@@ -65,6 +71,68 @@ struct efi_tcg2_boot_service_capability {
sizeof(struct efi_tcg2_boot_service_capability) - \
offsetof(struct efi_tcg2_boot_service_capability, number_of_pcr_banks)
+#define TCG_EFI_SPEC_ID_EVENT_SIGNATURE_03 "Spec ID Event03"
+#define TCG_EFI_SPEC_ID_EVENT_SPEC_VERSION_MAJOR_TPM2 2
+#define TCG_EFI_SPEC_ID_EVENT_SPEC_VERSION_MINOR_TPM2 0
+#define TCG_EFI_SPEC_ID_EVENT_SPEC_VERSION_ERRATA_TPM2 2
+
+/**
+ * struct TCG_EfiSpecIdEventAlgorithmSize
+ *
+ * @algorithm_id: algorithm defined in enum tpm2_algorithms
+ * @digest_size: size of the algorithm
+ */
+struct tcg_efi_spec_id_event_algorithm_size {
+ u16 algorithm_id;
+ u16 digest_size;
+} __packed;
+
+/**
+ * struct TCG_EfiSpecIDEventStruct
+ *
+ * @signature: signature, set to Spec ID Event03
+ * @platform_class: class defined in TCG ACPI Specification
+ * Client Common Header.
+ * @spec_version_minor: minor version
+ * @spec_version_major: major version
+ * @spec_version_errata: major version
+ * @uintn_size: size of the efi_uintn_t fields used in various
+ * data structures used in this specification.
+ * 0x01 indicates u32 and 0x02 indicates u64
+ * @number_of_algorithms: hashing algorithms used in this event log
+ * @digest_sizes: array of number_of_algorithms pairs
+ * 1st member defines the algorithm id
+ * 2nd member defines the algorithm size
+ * @vendor_info_size: size in bytes for vendor specific info
+ * @vendor_info: vendor specific info
+ */
+struct tcg_efi_spec_id_event {
+ u8 signature[16];
+ u32 platform_class;
+ u8 spec_version_minor;
+ u8 spec_version_major;
+ u8 spec_errata;
+ u8 uintn_size;
+ u32 number_of_algorithms;
+ struct tcg_efi_spec_id_event_algorithm_size digest_sizes[TPM2_NUM_PCR_BANKS];
+ u8 vendor_info_size;
+ /* U-Boot does not provide any vendor info */
+ u8 vendor_info[];
+} __packed;
+
+/**
+ * struct tdEFI_TCG2_FINAL_EVENTS_TABLE
+ * @version: version number for this structure
+ * @number_of_events: number of events recorded after invocation of
+ * GetEventLog()
+ * @event: List of events of type tcg_pcr_event2
+ */
+struct efi_tcg2_final_events_table {
+ u64 version;
+ u64 number_of_events;
+ struct tcg_pcr_event2 event[];
+};
+
struct efi_tcg2_protocol {
efi_status_t (EFIAPI * get_capability)(struct efi_tcg2_protocol *this,
struct efi_tcg2_boot_service_capability *capability);
@@ -73,7 +141,8 @@ struct efi_tcg2_protocol {
u64 *event_log_location, u64 *event_log_last_entry,
bool *event_log_truncated);
efi_status_t (EFIAPI * hash_log_extend_event)(struct efi_tcg2_protocol *this,
- u64 flags, u64 data_to_hash,
+ u64 flags,
+ efi_physical_addr_t data_to_hash,
u64 data_to_hash_len,
struct efi_tcg2_event *efi_tcg_event);
efi_status_t (EFIAPI * submit_command)(struct efi_tcg2_protocol *this,
diff --git a/include/fat.h b/include/fat.h
index 02742f92a5..b9f273f381 100644
--- a/include/fat.h
+++ b/include/fat.h
@@ -9,8 +9,9 @@
#ifndef _FAT_H_
#define _FAT_H_
-#include <asm/byteorder.h>
#include <fs.h>
+#include <asm/byteorder.h>
+#include <asm/cache.h>
struct disk_partition;
@@ -21,7 +22,6 @@ struct disk_partition;
#define MAX_CLUSTSIZE CONFIG_FS_FAT_MAX_CLUSTSIZE
-#define DIRENTSPERBLOCK (mydata->sect_size / sizeof(dir_entry))
#define DIRENTSPERCLUST ((mydata->clust_size * mydata->sect_size) / \
sizeof(dir_entry))
@@ -179,6 +179,9 @@ typedef struct {
int fats; /* Number of FATs */
} fsdata;
+struct fat_itr;
+typedef struct fat_itr fat_itr;
+
static inline u32 clust_to_sect(fsdata *fsdata, u32 clust)
{
return fsdata->data_begin + clust * fsdata->clust_size;
@@ -208,4 +211,17 @@ void fat_closedir(struct fs_dir_stream *dirs);
int fat_unlink(const char *filename);
int fat_mkdir(const char *dirname);
void fat_close(void);
+void *fat_next_cluster(fat_itr *itr, unsigned int *nbytes);
+
+/**
+ * fat_uuid() - get FAT volume ID
+ *
+ * The FAT volume ID returned in @uuid_str as hexadecimal number in XXXX-XXXX
+ * format.
+ *
+ * @uuid_str: caller allocated buffer of at least 10 bytes for the volume ID
+ * Return: 0 on success
+ */
+int fat_uuid(char *uuid_str);
+
#endif /* _FAT_H_ */
diff --git a/include/fs_loader.h b/include/fs_loader.h
index 1b3c58086f..8de7cb18dc 100644
--- a/include/fs_loader.h
+++ b/include/fs_loader.h
@@ -31,7 +31,7 @@ struct phandle_part {
* @mtdpart: MTD partition for ubi partition.
* @ubivol: UBI volume-name for ubifsmount.
*/
-struct device_platdata {
+struct device_plat {
struct phandle_part phandlepart;
char *mtdpart;
char *ubivol;
diff --git a/include/i2c.h b/include/i2c.h
index 880aa8032b..e45e33f503 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -71,7 +71,7 @@ struct udevice;
* An I2C chip is a device on the I2C bus. It sits at a particular address
* and normally supports 7-bit or 10-bit addressing.
*
- * To obtain this structure, use dev_get_parent_platdata(dev) where dev is
+ * To obtain this structure, use dev_get_parent_plat(dev) where dev is
* the chip to examine.
*
* @chip_addr: Chip address on bus
@@ -521,17 +521,17 @@ int i2c_get_chip_for_busnum(int busnum, int chip_addr, uint offset_len,
struct udevice **devp);
/**
- * i2c_chip_ofdata_to_platdata() - Decode standard I2C platform data
+ * i2c_chip_of_to_plat() - Decode standard I2C platform data
*
* This decodes the chip address from a device tree node and puts it into
* its dm_i2c_chip structure. This should be called in your driver's
- * ofdata_to_platdata() method.
+ * of_to_plat() method.
*
* @blob: Device tree blob
* @node: Node offset to read from
* @spi: Place to put the decoded information
*/
-int i2c_chip_ofdata_to_platdata(struct udevice *dev, struct dm_i2c_chip *chip);
+int i2c_chip_of_to_plat(struct udevice *dev, struct dm_i2c_chip *chip);
/**
* i2c_dump_msgs() - Dump a list of I2C messages
@@ -568,7 +568,7 @@ struct udevice *i2c_emul_get_device(struct udevice *emul);
extern struct acpi_ops i2c_acpi_ops;
/**
- * acpi_i2c_ofdata_to_platdata() - Read properties intended for ACPI
+ * acpi_i2c_of_to_plat() - Read properties intended for ACPI
*
* This reads the generic I2C properties from the device tree, so that these
* can be used to create ACPI information for the device.
@@ -579,7 +579,7 @@ extern struct acpi_ops i2c_acpi_ops;
* @dev: I2C device to process
* @return 0 if OK, -EINVAL if acpi,hid is not present
*/
-int acpi_i2c_ofdata_to_platdata(struct udevice *dev);
+int acpi_i2c_of_to_plat(struct udevice *dev);
#ifndef CONFIG_DM_I2C
diff --git a/include/image.h b/include/image.h
index 41473dbb9c..856bc3e1b2 100644
--- a/include/image.h
+++ b/include/image.h
@@ -308,6 +308,7 @@ enum {
IH_TYPE_IMX8MIMAGE, /* Freescale IMX8MBoot Image */
IH_TYPE_IMX8IMAGE, /* Freescale IMX8Boot Image */
IH_TYPE_COPRO, /* Coprocessor Image for remoteproc*/
+ IH_TYPE_SUNXI_EGON, /* Allwinner eGON Boot Image */
IH_TYPE_COUNT, /* Number of image types */
};
diff --git a/include/linker_lists.h b/include/linker_lists.h
index d775d041e0..fd98ecd297 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -124,7 +124,8 @@
*/
#define ll_entry_start(_type, _list) \
({ \
- static char start[0] __aligned(4) __attribute__((unused, \
+ static char start[0] __aligned(CONFIG_LINKER_LIST_ALIGN) \
+ __attribute__((unused, \
section(".u_boot_list_2_"#_list"_1"))); \
(_type *)&start; \
})
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 79dce8f0ad..c871ea646d 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -76,6 +76,19 @@ struct clk_mux {
extern const struct clk_ops clk_mux_ops;
u8 clk_mux_get_parent(struct clk *clk);
+/**
+ * clk_mux_index_to_val() - Convert the parent index to the register value
+ *
+ * It returns the value to write in the hardware register to output the selected
+ * input clock parent.
+ *
+ * @table: array of register values corresponding to the parent index (optional)
+ * @flags: hardware-specific flags
+ * @index: parent clock index
+ * @return the register value
+ */
+unsigned int clk_mux_index_to_val(u32 *table, unsigned int flags, u8 index);
+
struct clk_gate {
struct clk clk;
void __iomem *reg;
@@ -125,6 +138,50 @@ struct clk_divider {
#define CLK_DIVIDER_READ_ONLY BIT(5)
#define CLK_DIVIDER_MAX_AT_ZERO BIT(6)
extern const struct clk_ops clk_divider_ops;
+
+/**
+ * clk_divider_get_table_div() - convert the register value to the divider
+ *
+ * @table: array of register values corresponding to valid dividers
+ * @val: value to convert
+ * @return the divider
+ */
+unsigned int clk_divider_get_table_div(const struct clk_div_table *table,
+ unsigned int val);
+
+/**
+ * clk_divider_get_table_val() - convert the divider to the register value
+ *
+ * It returns the value to write in the hardware register to divide the input
+ * clock rate by @div.
+ *
+ * @table: array of register values corresponding to valid dividers
+ * @div: requested divider
+ * @return the register value
+ */
+unsigned int clk_divider_get_table_val(const struct clk_div_table *table,
+ unsigned int div);
+
+/**
+ * clk_divider_is_valid_div() - check if the divider is valid
+ *
+ * @table: array of valid dividers (optional)
+ * @div: divider to check
+ * @flags: hardware-specific flags
+ * @return true if the divider is valid, false otherwise
+ */
+bool clk_divider_is_valid_div(const struct clk_div_table *table,
+ unsigned int div, unsigned long flags);
+
+/**
+ * clk_divider_is_valid_table_div - check if the divider is in the @table array
+ *
+ * @table: array of valid dividers
+ * @div: divider to check
+ * @return true if the divider is found in the @table array, false otherwise
+ */
+bool clk_divider_is_valid_table_div(const struct clk_div_table *table,
+ unsigned int div);
unsigned long divider_recalc_rate(struct clk *hw, unsigned long parent_rate,
unsigned int val,
const struct clk_div_table *table,
@@ -144,7 +201,7 @@ struct clk_fixed_rate {
unsigned long fixed_rate;
};
-#define to_clk_fixed_rate(dev) ((struct clk_fixed_rate *)dev_get_platdata(dev))
+#define to_clk_fixed_rate(dev) ((struct clk_fixed_rate *)dev_get_plat(dev))
struct clk_composite {
struct clk clk;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 1b9151714c..927854950a 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -332,15 +332,14 @@ struct mtd_info {
};
#if IS_ENABLED(CONFIG_DM)
-static inline void mtd_set_of_node(struct mtd_info *mtd,
- const struct device_node *np)
+static inline void mtd_set_ofnode(struct mtd_info *mtd, ofnode node)
{
- mtd->dev->node.np = np;
+ dev_set_ofnode(mtd->dev, node);
}
-static inline const struct device_node *mtd_get_of_node(struct mtd_info *mtd)
+static inline const ofnode mtd_get_ofnode(struct mtd_info *mtd)
{
- return mtd->dev->node.np;
+ return dev_ofnode(mtd->dev);
}
#else
struct device_node;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 13e8dd1103..7774c17ad5 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -389,6 +389,7 @@ static inline int nanddev_unregister(struct nand_device *nand)
return mtd_device_unregister(nand->mtd);
}
+#ifndef __UBOOT__
/**
* nanddev_set_of_node() - Attach a DT node to a NAND device
* @nand: NAND device
@@ -412,6 +413,19 @@ static inline const struct device_node *nanddev_get_of_node(struct nand_device *
{
return mtd_get_of_node(nand->mtd);
}
+#else
+/**
+ * nanddev_set_of_node() - Attach a DT node to a NAND device
+ * @nand: NAND device
+ * @node: ofnode
+ *
+ * Attach a DT node to a NAND device.
+ */
+static inline void nanddev_set_ofnode(struct nand_device *nand, ofnode node)
+{
+ mtd_set_ofnode(nand->mtd, node);
+}
+#endif /* __UBOOT__ */
/**
* nanddev_offs_to_pos() - Convert an absolute NAND offset into a NAND position
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 233fdc341a..4a8e19ee4f 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -258,11 +258,13 @@ struct flash_info;
/*
* TODO: Remove, once all users of spi_flash interface are moved to MTD
*
- * struct spi_flash {
+struct spi_flash {
* Defined below (keep this text to enable searching for spi_flash decl)
* }
*/
+#ifndef DT_PLAT_C
#define spi_flash spi_nor
+#endif
/**
* struct spi_nor - Structure for defining a the SPI NOR layer
@@ -352,6 +354,7 @@ struct spi_nor {
u32 erase_size;
};
+#ifndef __UBOOT__
static inline void spi_nor_set_flash_node(struct spi_nor *nor,
const struct device_node *np)
{
@@ -363,6 +366,7 @@ device_node *spi_nor_get_flash_node(struct spi_nor *nor)
{
return mtd_get_of_node(&nor->mtd);
}
+#endif /* __UBOOT__ */
/**
* struct spi_nor_hwcaps - Structure for describing the hardware capabilies
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index 88bacde91e..15bcd59f34 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -412,6 +412,7 @@ spinand_to_nand(struct spinand_device *spinand)
return &spinand->base;
}
+#ifndef __UBOOT__
/**
* spinand_set_of_node - Attach a DT node to a SPI NAND device
* @spinand: SPI NAND device
@@ -424,6 +425,20 @@ static inline void spinand_set_of_node(struct spinand_device *spinand,
{
nanddev_set_of_node(&spinand->base, np);
}
+#else
+/**
+ * spinand_set_of_node - Attach a DT node to a SPI NAND device
+ * @spinand: SPI NAND device
+ * @node: ofnode
+ *
+ * Attach a DT node to a SPI NAND device.
+ */
+static inline void spinand_set_ofnode(struct spinand_device *spinand,
+ ofnode node)
+{
+ nanddev_set_ofnode(&spinand->base, node);
+}
+#endif /* __UBOOT__ */
int spinand_match_and_init(struct spinand_device *dev,
const struct spinand_info *table,
diff --git a/include/net.h b/include/net.h
index aff6674bb3..13da69b7c1 100644
--- a/include/net.h
+++ b/include/net.h
@@ -115,7 +115,7 @@ enum eth_state_t {
* @enetaddr: The Ethernet MAC address that is loaded from EEPROM or env
* @phy_interface: PHY interface to use - see PHY_INTERFACE_MODE_...
* @max_speed: Maximum speed of Ethernet connection supported by MAC
- * @priv_pdata: device specific platdata
+ * @priv_pdata: device specific plat
*/
struct eth_pdata {
phys_addr_t iobase;
diff --git a/include/ns16550.h b/include/ns16550.h
index 18c9077755..bef2071998 100644
--- a/include/ns16550.h
+++ b/include/ns16550.h
@@ -21,6 +21,9 @@
* will not allocate storage for arrays of size 0
*/
+#ifndef __ns16550_h
+#define __ns16550_h
+
#include <linux/types.h>
#ifdef CONFIG_DM_SERIAL
@@ -56,7 +59,7 @@ enum ns16550_flags {
};
/**
- * struct ns16550_platdata - information about a NS16550 port
+ * struct ns16550_plat - information about a NS16550 port
*
* @base: Base register address
* @reg_width: IO accesses size of registers (in bytes, 1 or 4)
@@ -67,7 +70,7 @@ enum ns16550_flags {
* @flags: A few flags (enum ns16550_flags)
* @bdf: PCI slot/function (pci_dev_t)
*/
-struct ns16550_platdata {
+struct ns16550_plat {
unsigned long base;
int reg_width;
int reg_shift;
@@ -82,7 +85,7 @@ struct ns16550_platdata {
struct udevice;
-struct NS16550 {
+struct ns16550 {
UART_REG(rbr); /* 0 */
UART_REG(ier); /* 1 */
UART_REG(fcr); /* 2 */
@@ -111,7 +114,7 @@ struct NS16550 {
UART_REG(ssr); /* 11*/
#endif
#ifdef CONFIG_DM_SERIAL
- struct ns16550_platdata *plat;
+ struct ns16550_plat *plat;
#endif
};
@@ -120,8 +123,6 @@ struct NS16550 {
#define dll rbr
#define dlm ier
-typedef struct NS16550 *NS16550_t;
-
/*
* These are the definitions for the FIFO Control Register
*/
@@ -221,11 +222,11 @@ typedef struct NS16550 *NS16550_t;
/* useful defaults for LCR */
#define UART_LCR_8N1 0x03
-void NS16550_init(NS16550_t com_port, int baud_divisor);
-void NS16550_putc(NS16550_t com_port, char c);
-char NS16550_getc(NS16550_t com_port);
-int NS16550_tstc(NS16550_t com_port);
-void NS16550_reinit(NS16550_t com_port, int baud_divisor);
+void ns16550_init(struct ns16550 *com_port, int baud_divisor);
+void ns16550_putc(struct ns16550 *com_port, char c);
+char ns16550_getc(struct ns16550 *com_port);
+int ns16550_tstc(struct ns16550 *com_port);
+void ns16550_reinit(struct ns16550 *com_port, int baud_divisor);
/**
* ns16550_calc_divisor() - calculate the divisor given clock and baud rate
@@ -238,10 +239,10 @@ void NS16550_reinit(NS16550_t com_port, int baud_divisor);
* @baudrate: Required baud rate
* @return baud rate divisor that should be used
*/
-int ns16550_calc_divisor(NS16550_t port, int clock, int baudrate);
+int ns16550_calc_divisor(struct ns16550 *port, int clock, int baudrate);
/**
- * ns16550_serial_ofdata_to_platdata() - convert DT to platform data
+ * ns16550_serial_of_to_plat() - convert DT to platform data
*
* Decode a device tree node for an ns16550 device. This includes the
* register base address and register shift properties. The caller must set
@@ -250,7 +251,7 @@ int ns16550_calc_divisor(NS16550_t port, int clock, int baudrate);
* @dev: dev to decode platform data for
* @return: 0 if OK, -EINVAL on error
*/
-int ns16550_serial_ofdata_to_platdata(struct udevice *dev);
+int ns16550_serial_of_to_plat(struct udevice *dev);
/**
* ns16550_serial_probe() - probe a serial port
@@ -266,3 +267,5 @@ int ns16550_serial_probe(struct udevice *dev);
* These should be used by the client driver for the driver's 'ops' member
*/
extern const struct dm_serial_ops ns16550_serial_ops;
+
+#endif /* __ns16550_h */
diff --git a/include/os.h b/include/os.h
index 1fe44f3510..0913b47b3a 100644
--- a/include/os.h
+++ b/include/os.h
@@ -407,4 +407,21 @@ void *os_find_text_base(void);
*/
void os_relaunch(char *argv[]);
+/**
+ * os_setup_signal_handlers() - setup signal handlers
+ *
+ * Install signal handlers for SIGBUS and SIGSEGV.
+ *
+ * Return: 0 for success
+ */
+int os_setup_signal_handlers(void);
+
+/**
+ * os_signal_action() - handle a signal
+ *
+ * @sig: signal
+ * @pc: program counter
+ */
+void os_signal_action(int sig, unsigned long pc);
+
#endif
diff --git a/include/p2sb.h b/include/p2sb.h
index a25170e3d1..ddbc8d5e14 100644
--- a/include/p2sb.h
+++ b/include/p2sb.h
@@ -17,11 +17,11 @@
#define PCH_P2SB_HBDF 0x70
/**
- * struct p2sb_child_platdata - Information about each child of a p2sb device
+ * struct p2sb_child_plat - Information about each child of a p2sb device
*
* @pid: Port ID for this child
*/
-struct p2sb_child_platdata {
+struct p2sb_child_plat {
uint pid;
};
diff --git a/include/pci.h b/include/pci.h
index d1ccf6c963..5f36537b72 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -899,11 +899,11 @@ struct udevice;
#ifdef CONFIG_DM_PCI
/**
- * struct pci_child_platdata - information stored about each PCI device
+ * struct pci_child_plat - information stored about each PCI device
*
* Every device on a PCI bus has this per-child data.
*
- * It can be accessed using dev_get_parent_platdata(dev) if dev->parent is a
+ * It can be accessed using dev_get_parent_plat(dev) if dev->parent is a
* PCI bus (i.e. UCLASS_PCI)
*
* @devfn: Encoded device and function index - see PCI_DEVFN()
@@ -914,7 +914,7 @@ struct udevice;
* @pfdev: Handle to Physical Function device
* @virtid: Virtual Function Index
*/
-struct pci_child_platdata {
+struct pci_child_plat {
int devfn;
unsigned short vendor;
unsigned short device;
@@ -934,7 +934,7 @@ struct dm_pci_ops {
* PCI buses must support reading and writing configuration values
* so that the bus can be scanned and its devices configured.
*
- * Normally PCI_BUS(@bdf) is the same as @bus->seq, but not always.
+ * Normally PCI_BUS(@bdf) is the same as @dev_seq(bus), but not always.
* If bridges exist it is possible to use the top-level bus to
* access a sub-bus. In that case @bus will be the top-level bus
* and PCI_BUS(bdf) will be a different (higher) value
diff --git a/include/power/acpi_pmc.h b/include/power/acpi_pmc.h
index 222288b71a..64176d79bc 100644
--- a/include/power/acpi_pmc.h
+++ b/include/power/acpi_pmc.h
@@ -180,7 +180,7 @@ int pmc_disable_tco(struct udevice *dev);
*/
int pmc_global_reset_set_enable(struct udevice *dev, bool enable);
-int pmc_ofdata_to_uc_platdata(struct udevice *dev);
+int pmc_ofdata_to_uc_plat(struct udevice *dev);
int pmc_disable_tco_base(ulong tco_base);
diff --git a/include/power/regulator.h b/include/power/regulator.h
index 7f278e8c7d..19a3b7b502 100644
--- a/include/power/regulator.h
+++ b/include/power/regulator.h
@@ -16,15 +16,15 @@
* 'UCLASS_REGULATOR' and the regulator driver API.
*
* The regulator uclass - is based on uclass platform data which is allocated,
- * automatically for each regulator device on bind and 'dev->uclass_platdata'
- * points to it. The data type is: 'struct dm_regulator_uclass_platdata'.
+ * automatically for each regulator device on bind and 'dev->uclass_plat'
+ * points to it. The data type is: 'struct dm_regulator_uclass_plat'.
* The uclass file: 'drivers/power/regulator/regulator-uclass.c'
*
* The regulator device - is based on driver's model 'struct udevice'.
* The API can use regulator name in two meanings:
* - devname - the regulator device's name: 'dev->name'
- * - platname - the device's platdata's name. So in the code it looks like:
- * 'uc_pdata = dev->uclass_platdata'; 'name = uc_pdata->name'.
+ * - platname - the device's plat's name. So in the code it looks like:
+ * 'uc_pdata = dev->uclass_plat'; 'name = uc_pdata->name'.
*
* The regulator device driver - provide an implementation of uclass operations
* pointed by 'dev->driver->ops' as a struct of type 'struct dm_regulator_ops'.
@@ -135,7 +135,7 @@ enum regulator_flag {
};
/**
- * struct dm_regulator_uclass_platdata - pointed by dev->uclass_platdata, and
+ * struct dm_regulator_uclass_plat - pointed by dev->uclass_plat, and
* allocated on each regulator bind. This structure holds an information
* about each regulator's constraints and supported operation modes.
* There is no "step" voltage value - so driver should take care of this.
@@ -162,7 +162,7 @@ enum regulator_flag {
* The constraints: type, mode, mode_count, can be set by device driver, e.g.
* by the driver '.probe' method.
*/
-struct dm_regulator_uclass_platdata {
+struct dm_regulator_uclass_plat {
enum regulator_type type;
struct dm_regulator_mode *mode;
int mode_count;
@@ -422,7 +422,7 @@ int regulators_enable_boot_on(bool verbose);
* regulator_autoset: setup the voltage/current on a regulator
*
* The setup depends on constraints found in device's uclass's platform data
- * (struct dm_regulator_uclass_platdata):
+ * (struct dm_regulator_uclass_plat):
*
* - Enable - will set - if any of: 'always_on' or 'boot_on' is set to true,
* or if both are unset, then the function returns
@@ -431,7 +431,7 @@ int regulators_enable_boot_on(bool verbose);
*
* The function returns on the first-encountered error.
*
- * @platname - expected string for dm_regulator_uclass_platdata .name field
+ * @platname - expected string for dm_regulator_uclass_plat .name field
* @devp - returned pointer to the regulator device - if non-NULL passed
* @return: 0 on success or negative value of errno.
*/
@@ -440,7 +440,7 @@ int regulator_autoset(struct udevice *dev);
/**
* regulator_autoset_by_name: setup the regulator given by its uclass's
* platform data name field. The setup depends on constraints found in device's
- * uclass's platform data (struct dm_regulator_uclass_platdata):
+ * uclass's platform data (struct dm_regulator_uclass_plat):
* - Enable - will set - if any of: 'always_on' or 'boot_on' is set to true,
* or if both are unset, then the function returns
* - Voltage value - will set - if '.min_uV' and '.max_uV' values are equal
@@ -448,7 +448,7 @@ int regulator_autoset(struct udevice *dev);
*
* The function returns on first encountered error.
*
- * @platname - expected string for dm_regulator_uclass_platdata .name field
+ * @platname - expected string for dm_regulator_uclass_plat .name field
* @devp - returned pointer to the regulator device - if non-NULL passed
* @return: 0 on success or negative value of errno.
*
@@ -464,7 +464,7 @@ int regulator_autoset_by_name(const char *platname, struct udevice **devp);
* regulator_autoset_by_name() for each name from the list.
*
* @list_platname - an array of expected strings for .name field of each
- * regulator's uclass platdata
+ * regulator's uclass plat
* @list_devp - an array of returned pointers to the successfully setup
* regulator devices if non-NULL passed
* @verbose - (true/false) print each regulator setup info, or be quiet
@@ -499,9 +499,9 @@ int regulator_get_by_devname(const char *devname, struct udevice **devp);
/**
* regulator_get_by_platname: returns the pointer to the pmic regulator device.
- * Search by name, found in regulator uclass platdata.
+ * Search by name, found in regulator uclass plat.
*
- * @platname - expected string for uc_pdata->name of regulator uclass platdata
+ * @platname - expected string for uc_pdata->name of regulator uclass plat
* @devp - returns pointer to the regulator device or NULL on error
* @return 0 on success or negative value of errno.
*
diff --git a/include/regmap.h b/include/regmap.h
index c6258face3..8216de015d 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -373,7 +373,7 @@ int regmap_update_bits(struct regmap *map, uint offset, uint mask, uint val);
int regmap_init_mem(ofnode node, struct regmap **mapp);
/**
- * regmap_init_mem_platdata() - Set up a new memory register map for
+ * regmap_init_mem_plat() - Set up a new memory register map for
* of-platdata
*
* @dev: Device that uses this map
@@ -388,8 +388,8 @@ int regmap_init_mem(ofnode node, struct regmap **mapp);
* Use regmap_uninit() to free it.
*
*/
-int regmap_init_mem_platdata(struct udevice *dev, fdt_val_t *reg, int count,
- struct regmap **mapp);
+int regmap_init_mem_plat(struct udevice *dev, fdt_val_t *reg, int count,
+ struct regmap **mapp);
int regmap_init_mem_index(ofnode node, struct regmap **mapp, int index);
diff --git a/include/remoteproc.h b/include/remoteproc.h
index 74d01723f6..089131f65f 100644
--- a/include/remoteproc.h
+++ b/include/remoteproc.h
@@ -34,7 +34,7 @@ enum rproc_mem_type {
* @mem_type: one of 'enum rproc_mem_type'
* @driver_plat_data: driver specific platform data that may be needed.
*
- * This can be accessed with dev_get_uclass_platdata() for any UCLASS_REMOTEPROC
+ * This can be accessed with dev_get_uclass_plat() for any UCLASS_REMOTEPROC
* device.
*
*/
diff --git a/include/scsi.h b/include/scsi.h
index 96cb726676..90cec99e32 100644
--- a/include/scsi.h
+++ b/include/scsi.h
@@ -162,14 +162,14 @@ struct scsi_cmd {
#define SCSI_WRITE_SAME 0x41 /* Write Same (O) */
/**
- * struct scsi_platdata - stores information about SCSI controller
+ * struct scsi_plat - stores information about SCSI controller
*
* @base: Controller base address
* @max_lun: Maximum number of logical units
* @max_id: Maximum number of target ids
* @max_bytes_per_req: Maximum number of bytes per read/write request
*/
-struct scsi_platdata {
+struct scsi_plat {
unsigned long base;
unsigned long max_lun;
unsigned long max_id;
diff --git a/include/sdhci.h b/include/sdhci.h
index 1fd20ec086..3e5a649818 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -440,10 +440,10 @@ static inline u8 sdhci_readb(struct sdhci_host *host, int reg)
* ...
*
* Inside U_BOOT_DRIVER():
- * .platdata_auto_alloc_size = sizeof(struct msm_sdhc_plat),
+ * .plat_auto = sizeof(struct msm_sdhc_plat),
*
* To access platform data:
- * struct msm_sdhc_plat *plat = dev_get_platdata(dev);
+ * struct msm_sdhc_plat *plat = dev_get_plat(dev);
*
* See msm_sdhci.c for an example.
*
diff --git a/include/search.h b/include/search.h
index e56843c26f..d0bb44388e 100644
--- a/include/search.h
+++ b/include/search.h
@@ -80,7 +80,16 @@ int hsearch_r(struct env_entry item, enum env_action action,
int hmatch_r(const char *match, int last_idx, struct env_entry **retval,
struct hsearch_data *htab);
-/* Search and delete entry matching "key" in internal hash table. */
+/**
+ * hdelete_r() - Search and delete entry in internal hash table
+ *
+ * @key: Name of entry to delete
+ * @htab: Hash table
+ * @flag: Flags to use (H_...)
+ * @return 0 on success, -ENOENT if not found, -EPERM if the hash table callback
+ * rejected changing the variable, -EINVAL if the hash table refused to
+ * delete the variable
+ */
int hdelete_r(const char *key, struct hsearch_data *htab, int flag);
ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag,
diff --git a/include/spi.h b/include/spi.h
index 2d34e4af11..dc3b21132a 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -39,17 +39,30 @@
#define SPI_DEFAULT_WORDLEN 8
-/* TODO(sjg@chromium.org): Remove this and use max_hz from struct spi_slave */
+/**
+ * struct dm_spi_bus - SPI bus info
+ *
+ * This contains information about a SPI bus. To obtain this structure, use
+ * dev_get_uclass_priv(bus) where bus is the SPI bus udevice.
+ *
+ * @max_hz: Maximum speed that the bus can tolerate.
+ * @speed: Current bus speed. This is 0 until the bus is first claimed.
+ * @mode: Current bus mode. This is 0 until the bus is first claimed.
+ *
+ * TODO(sjg@chromium.org): Remove this and use max_hz from struct spi_slave.
+ */
struct dm_spi_bus {
uint max_hz;
+ uint speed;
+ uint mode;
};
/**
- * struct dm_spi_platdata - platform data for all SPI slaves
+ * struct dm_spi_plat - platform data for all SPI slaves
*
* This describes a SPI slave, a child device of the SPI bus. To obtain this
- * struct from a spi_slave, use dev_get_parent_platdata(dev) or
- * dev_get_parent_platdata(slave->dev).
+ * struct from a spi_slave, use dev_get_parent_plat(dev) or
+ * dev_get_parent_plat(slave->dev).
*
* This data is immutable. Each time the device is probed, @max_hz and @mode
* will be copied to struct spi_slave.
@@ -58,7 +71,7 @@ struct dm_spi_bus {
* @max_hz: Maximum bus speed that this slave can tolerate
* @mode: SPI mode to use for this device (see SPI mode flags)
*/
-struct dm_spi_slave_platdata {
+struct dm_spi_slave_plat {
unsigned int cs;
uint max_hz;
uint mode;
@@ -102,7 +115,7 @@ enum spi_polarity {
*
* For driver model this is the per-child data used by the SPI bus. It can
* be accessed using dev_get_parent_priv() on the slave device. The SPI uclass
- * sets uip per_child_auto_alloc_size to sizeof(struct spi_slave), and the
+ * sets up per_child_auto to sizeof(struct spi_slave), and the
* driver should not override it. Two platform data fields (max_hz and mode)
* are copied into this structure to provide an initial value. This allows
* them to be changed, since we should never change platform data in drivers.
@@ -112,11 +125,9 @@ enum spi_polarity {
*
* @dev: SPI slave device
* @max_hz: Maximum speed for this slave
- * @speed: Current bus speed. This is 0 until the bus is first
- * claimed.
* @bus: ID of the bus that the slave is attached to. For
* driver model this is the sequence number of the SPI
- * bus (bus->seq) so does not need to be stored
+ * bus (dev_seq(bus)) so does not need to be stored
* @cs: ID of the chip select connected to the slave.
* @mode: SPI mode to use for this slave (see SPI mode flags)
* @wordlen: Size of SPI word in number of bits
@@ -131,7 +142,6 @@ struct spi_slave {
#if CONFIG_IS_ENABLED(DM_SPI)
struct udevice *dev; /* struct spi_slave is dev->parentdata */
uint max_hz;
- uint speed;
#else
unsigned int bus;
unsigned int cs;
@@ -566,12 +576,12 @@ int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp,
* is automatically bound on this chip select with requested speed and mode.
*
* Ths new slave device is probed ready for use with the speed and mode
- * from platdata when available or the requested values.
+ * from plat when available or the requested values.
*
* @busnum: SPI bus number
* @cs: Chip select to look for
- * @speed: SPI speed to use for this slave when not available in platdata
- * @mode: SPI mode to use for this slave when not available in platdata
+ * @speed: SPI speed to use for this slave when not available in plat
+ * @mode: SPI mode to use for this slave when not available in plat
* @drv_name: Name of driver to attach to this chip select
* @dev_name: Name of the new device thus created
* @busp: Returns bus device
@@ -601,7 +611,7 @@ int spi_chip_select(struct udevice *slave);
int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp);
/**
- * spi_slave_ofdata_to_platdata() - decode standard SPI platform data
+ * spi_slave_of_to_plat() - decode standard SPI platform data
*
* This decodes the speed and mode for a slave from a device tree node
*
@@ -609,8 +619,7 @@ int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp);
* @node: Node offset to read from
* @plat: Place to put the decoded information
*/
-int spi_slave_ofdata_to_platdata(struct udevice *dev,
- struct dm_spi_slave_platdata *plat);
+int spi_slave_of_to_plat(struct udevice *dev, struct dm_spi_slave_plat *plat);
/**
* spi_cs_info() - Check information on a chip select
diff --git a/include/spl.h b/include/spl.h
index b72dfc7e3d..a7648787b7 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -285,7 +285,15 @@ u32 spl_mmc_boot_mode(const u32 boot_device);
* If not overridden, it is weakly defined in common/spl/spl_mmc.c.
*/
int spl_mmc_boot_partition(const u32 boot_device);
-void spl_set_bd(void);
+
+/**
+ * spl_alloc_bd() - Allocate space for bd_info
+ *
+ * This sets up the gd->bd pointer by allocating memory for it
+ *
+ * @return 0 if OK, -ENOMEM if out of memory
+ */
+int spl_alloc_bd(void);
/**
* spl_set_header_raw_uboot() - Set up a standard SPL image structure
@@ -526,26 +534,80 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image,
void spl_invoke_atf(struct spl_image_info *spl_image);
/**
- * bl2_plat_get_bl31_params() - prepare params for bl31.
- * @bl32_entry address of BL32 executable (secure)
- * @bl33_entry address of BL33 executable (non secure)
- * @fdt_addr address of Flat Device Tree
+ * bl2_plat_get_bl31_params() - return params for bl31.
+ * @bl32_entry: address of BL32 executable (secure)
+ * @bl33_entry: address of BL33 executable (non secure)
+ * @fdt_addr: address of Flat Device Tree
+ *
+ * This is a weak function which might be overridden by the board code. By
+ * default it will just call bl2_plat_get_bl31_params_default().
*
- * This function assigns a pointer to the memory that the platform has kept
- * aside to pass platform specific and trusted firmware related information
- * to BL31. This memory is allocated by allocating memory to
- * bl2_to_bl31_params_mem structure which is a superset of all the
- * structure whose information is passed to BL31
- * NOTE: This function should be called only once and should be done
- * before generating params to BL31
+ * If you just want to manipulate or add some parameters, you can override
+ * this function, call bl2_plat_get_bl31_params_default and operate on the
+ * returned bl31 params.
*
- * @return bl31 params structure pointer
+ * Return: bl31 params structure pointer
*/
struct bl31_params *bl2_plat_get_bl31_params(uintptr_t bl32_entry,
uintptr_t bl33_entry,
uintptr_t fdt_addr);
/**
+ * bl2_plat_get_bl31_params_default() - prepare params for bl31.
+ * @bl32_entry: address of BL32 executable (secure)
+ * @bl33_entry: address of BL33 executable (non secure)
+ * @fdt_addr: address of Flat Device Tree
+ *
+ * This is the default implementation of bl2_plat_get_bl31_params(). It assigns
+ * a pointer to the memory that the platform has kept aside to pass platform
+ * specific and trusted firmware related information to BL31. This memory is
+ * allocated by allocating memory to bl2_to_bl31_params_mem structure which is
+ * a superset of all the structure whose information is passed to BL31
+ *
+ * NOTE: The memory is statically allocated, thus this function should be
+ * called only once. All subsequent calls will overwrite any changes.
+ *
+ * Return: bl31 params structure pointer
+ */
+struct bl31_params *bl2_plat_get_bl31_params_default(uintptr_t bl32_entry,
+ uintptr_t bl33_entry,
+ uintptr_t fdt_addr);
+
+/**
+ * bl2_plat_get_bl31_params_v2() - return params for bl31
+ * @bl32_entry: address of BL32 executable (secure)
+ * @bl33_entry: address of BL33 executable (non secure)
+ * @fdt_addr: address of Flat Device Tree
+ *
+ * This function does the same as bl2_plat_get_bl31_params() except that is is
+ * used for the new LOAD_IMAGE_V2 option, which uses a slightly different
+ * method to pass the parameters.
+ *
+ * Return: bl31 params structure pointer
+ */
+struct bl_params *bl2_plat_get_bl31_params_v2(uintptr_t bl32_entry,
+ uintptr_t bl33_entry,
+ uintptr_t fdt_addr);
+
+/**
+ * bl2_plat_get_bl31_params_v2_default() - prepare params for bl31.
+ * @bl32_entry: address of BL32 executable (secure)
+ * @bl33_entry: address of BL33 executable (non secure)
+ * @fdt_addr: address of Flat Device Tree
+ *
+ * This is the default implementation of bl2_plat_get_bl31_params_v2(). It
+ * prepares the linked list of the bl31 params, populates the image types and
+ * set the entry points for bl32 and bl33 (if available).
+ *
+ * NOTE: The memory is statically allocated, thus this function should be
+ * called only once. All subsequent calls will overwrite any changes.
+ *
+ * Return: bl31 params structure pointer
+ */
+struct bl_params *bl2_plat_get_bl31_params_v2_default(uintptr_t bl32_entry,
+ uintptr_t bl33_entry,
+ uintptr_t fdt_addr);
+/**
* spl_optee_entry - entry function for optee
*
* args defind in op-tee project
diff --git a/include/sunxi_image.h b/include/sunxi_image.h
new file mode 100644
index 0000000000..5b2055c0af
--- /dev/null
+++ b/include/sunxi_image.h
@@ -0,0 +1,82 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * Constants and data structures used in Allwinner "eGON" images, as
+ * parsed by the Boot-ROM.
+ *
+ * Shared between mkimage and the SPL.
+ */
+#ifndef SUNXI_IMAGE_H
+#define SUNXI_IMAGE_H
+
+#define BOOT0_MAGIC "eGON.BT0"
+#define BROM_STAMP_VALUE 0x5f0a6c39
+#define SPL_SIGNATURE "SPL" /* marks "sunxi" SPL header */
+#define SPL_MAJOR_BITS 3
+#define SPL_MINOR_BITS 5
+#define SPL_VERSION(maj, min) \
+ ((((maj) & ((1U << SPL_MAJOR_BITS) - 1)) << SPL_MINOR_BITS) | \
+ ((min) & ((1U << SPL_MINOR_BITS) - 1)))
+
+#define SPL_HEADER_VERSION SPL_VERSION(0, 2)
+
+#define SPL_ENV_HEADER_VERSION SPL_VERSION(0, 1)
+#define SPL_DT_HEADER_VERSION SPL_VERSION(0, 2)
+#define SPL_DRAM_HEADER_VERSION SPL_VERSION(0, 3)
+
+/* boot head definition from sun4i boot code */
+struct boot_file_head {
+ uint32_t b_instruction; /* one intruction jumping to real code */
+ uint8_t magic[8]; /* ="eGON.BT0" or "eGON.BT1", not C-style str */
+ uint32_t check_sum; /* generated by PC */
+ uint32_t length; /* generated by PC */
+ /*
+ * We use a simplified header, only filling in what is needed
+ * by the boot ROM. To be compatible with Allwinner tools we
+ * would need to implement the proper fields here instead of
+ * padding.
+ *
+ * Actually we want the ability to recognize our "sunxi" variant
+ * of the SPL. To do so, let's place a special signature into the
+ * "pub_head_size" field. We can reasonably expect Allwinner's
+ * boot0 to always have the upper 16 bits of this set to 0 (after
+ * all the value shouldn't be larger than the limit imposed by
+ * SRAM size).
+ * If the signature is present (at 0x14), then we know it's safe
+ * to use the remaining 8 bytes (at 0x18) for our own purposes.
+ * (E.g. sunxi-tools "fel" utility can pass information there.)
+ */
+ union {
+ uint32_t pub_head_size;
+ uint8_t spl_signature[4];
+ };
+ uint32_t fel_script_address; /* since v0.1, set by sunxi-fel */
+ /*
+ * If the fel_uEnv_length member below is set to a non-zero value,
+ * it specifies the size (byte count) of data at fel_script_address.
+ * At the same time this indicates that the data is in uEnv.txt
+ * compatible format, ready to be imported via "env import -t".
+ */
+ uint32_t fel_uEnv_length; /* since v0.1, set by sunxi-fel */
+ /*
+ * Offset of an ASCIIZ string (relative to the SPL header), which
+ * contains the default device tree name (CONFIG_DEFAULT_DEVICE_TREE).
+ * This is optional and may be set to NULL. Is intended to be used
+ * by flash programming tools for providing nice informative messages
+ * to the users.
+ */
+ uint32_t dt_name_offset; /* since v0.2, set by mksunxiboot */
+ uint32_t dram_size; /* in MiB, since v0.3, set by SPL */
+ uint32_t boot_media; /* written here by the boot ROM */
+ /* A padding area (may be used for storing text strings) */
+ uint32_t string_pool[13]; /* since v0.2, filled by mksunxiboot */
+ /* The header must be a multiple of 32 bytes (for VBAR alignment) */
+};
+
+/* Compile time check to assure proper alignment of structure */
+typedef char boot_file_head_not_multiple_of_32[1 - 2*(sizeof(struct boot_file_head) % 32)];
+
+#endif
diff --git a/include/syscon.h b/include/syscon.h
index 3df96e3276..2e02199c05 100644
--- a/include/syscon.h
+++ b/include/syscon.h
@@ -33,7 +33,7 @@ struct syscon_ops {
*
* Update: 64-bit is now supported and we have an education crisis.
*/
-struct syscon_base_platdata {
+struct syscon_base_plat {
fdt_val_t reg[2];
};
#endif
diff --git a/include/test/suites.h b/include/test/suites.h
index ab7b3bd9ca..52e8fc8155 100644
--- a/include/test/suites.h
+++ b/include/test/suites.h
@@ -26,6 +26,7 @@ int cmd_ut_category(const char *name, const char *prefix,
struct unit_test *tests, int n_ents,
int argc, char *const argv[]);
+int do_ut_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[]);
int do_ut_compression(struct cmd_tbl *cmdtp, int flag, int argc,
@@ -38,6 +39,8 @@ int do_ut_mem(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
int do_ut_optee(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
int do_ut_overlay(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[]);
+int do_ut_setexpr(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);
int do_ut_str(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
int do_ut_time(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
int do_ut_unicode(struct cmd_tbl *cmdtp, int flag, int argc,
diff --git a/include/test/test.h b/include/test/test.h
index 03e29290bf..3fdaa2b5e5 100644
--- a/include/test/test.h
+++ b/include/test/test.h
@@ -95,6 +95,15 @@ enum {
};
/**
+ * testbus_get_clear_removed() - Test function to obtain removed device
+ *
+ * This is used in testbus to find out which device was removed. Calling this
+ * function returns a pointer to the device and then clears it back to NULL, so
+ * that a future test can check it.
+ */
+struct udevice *testbus_get_clear_removed(void);
+
+/**
* dm_test_main() - Run driver model tests
*
* Run all the available driver model tests, or a selection
diff --git a/include/tpm-v2.h b/include/tpm-v2.h
index 74c14fe7c5..fab6b86ca2 100644
--- a/include/tpm-v2.h
+++ b/include/tpm-v2.h
@@ -18,6 +18,12 @@
#define TPM2_DIGEST_LEN 32
+#define TPM2_SHA1_DIGEST_SIZE 20
+#define TPM2_SHA256_DIGEST_SIZE 32
+#define TPM2_SHA384_DIGEST_SIZE 48
+#define TPM2_SHA512_DIGEST_SIZE 64
+#define TPM2_SM3_256_DIGEST_SIZE 32
+
#define TPM2_MAX_PCRS 32
#define TPM2_PCR_SELECT_MAX ((TPM2_MAX_PCRS + 7) / 8)
#define TPM2_MAX_CAP_BUFFER 1024
@@ -45,6 +51,15 @@
#define TPM2_PT_MAX_COMMAND_SIZE (u32)(TPM2_PT_FIXED + 30)
#define TPM2_PT_MAX_RESPONSE_SIZE (u32)(TPM2_PT_FIXED + 31)
+/* event types */
+#define EV_POST_CODE ((u32)0x00000001)
+#define EV_NO_ACTION ((u32)0x00000003)
+#define EV_SEPARATOR ((u32)0x00000004)
+#define EV_S_CRTM_CONTENTS ((u32)0x00000007)
+#define EV_S_CRTM_VERSION ((u32)0x00000008)
+#define EV_CPU_MICROCODE ((u32)0x00000009)
+#define EV_TABLE_OF_DEVICES ((u32)0x0000000B)
+
/* TPMS_TAGGED_PROPERTY Structure */
struct tpms_tagged_property {
u32 property;
@@ -87,6 +102,73 @@ struct tpms_capability_data {
} __packed;
/**
+ * SHA1 Event Log Entry Format
+ *
+ * @pcr_index: PCRIndex event extended to
+ * @event_type: Type of event (see EFI specs)
+ * @digest: Value extended into PCR index
+ * @event_size: Size of event
+ * @event: Event data
+ */
+struct tcg_pcr_event {
+ u32 pcr_index;
+ u32 event_type;
+ u8 digest[TPM2_SHA1_DIGEST_SIZE];
+ u32 event_size;
+ u8 event[];
+} __packed;
+
+/**
+ * Definition of TPMU_HA Union
+ */
+union tmpu_ha {
+ u8 sha1[TPM2_SHA1_DIGEST_SIZE];
+ u8 sha256[TPM2_SHA256_DIGEST_SIZE];
+ u8 sm3_256[TPM2_SM3_256_DIGEST_SIZE];
+ u8 sha384[TPM2_SHA384_DIGEST_SIZE];
+ u8 sha512[TPM2_SHA512_DIGEST_SIZE];
+} __packed;
+
+/**
+ * Definition of TPMT_HA Structure
+ *
+ * @hash_alg: Hash algorithm defined in enum tpm2_algorithms
+ * @digest: Digest value for a given algorithm
+ */
+struct tpmt_ha {
+ u16 hash_alg;
+ union tmpu_ha digest;
+} __packed;
+
+/**
+ * Definition of TPML_DIGEST_VALUES Structure
+ *
+ * @count: Number of algorithms supported by hardware
+ * @digests: struct for algorithm id and hash value
+ */
+struct tpml_digest_values {
+ u32 count;
+ struct tpmt_ha digests[TPM2_NUM_PCR_BANKS];
+} __packed;
+
+/**
+ * Crypto Agile Log Entry Format
+ *
+ * @pcr_index: PCRIndex event extended to
+ * @event_type: Type of event
+ * @digests: List of digestsextended to PCR index
+ * @event_size: Size of the event data
+ * @event: Event data
+ */
+struct tcg_pcr_event2 {
+ u32 pcr_index;
+ u32 event_type;
+ struct tpml_digest_values digests;
+ u32 event_size;
+ u8 event[];
+} __packed;
+
+/**
* TPM2 Structure Tags for command/response buffers.
*
* @TPM2_ST_NO_SESSIONS: the command does not need an authentication.
@@ -309,11 +391,14 @@ u32 tpm2_clear(struct udevice *dev, u32 handle, const char *pw,
*
* @dev TPM device
* @index Index of the PCR
+ * @algorithm Algorithm used, defined in 'enum tpm2_algorithms'
* @digest Value representing the event to be recorded
+ * @digest_len len of the hash
*
* @return code of the operation
*/
-u32 tpm2_pcr_extend(struct udevice *dev, u32 index, const uint8_t *digest);
+u32 tpm2_pcr_extend(struct udevice *dev, u32 index, u32 algorithm,
+ const u8 *digest, u32 digest_len);
/**
* Issue a TPM2_PCR_Read command.
diff --git a/include/usb.h b/include/usb.h
index 5a7af882fb..b3851fdb4f 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -597,18 +597,18 @@ struct usb_hub_device {
#if CONFIG_IS_ENABLED(DM_USB)
/**
- * struct usb_platdata - Platform data about a USB controller
+ * struct usb_plat - Platform data about a USB controller
*
- * Given a USB controller (UCLASS_USB) dev this is dev_get_platdata(dev)
+ * Given a USB controller (UCLASS_USB) dev this is dev_get_plat(dev)
*/
-struct usb_platdata {
+struct usb_plat {
enum usb_init_type init_type;
};
/**
- * struct usb_dev_platdata - Platform data about a USB device
+ * struct usb_dev_plat - Platform data about a USB device
*
- * Given a USB device dev this structure is dev_get_parent_platdata(dev).
+ * Given a USB device dev this structure is dev_get_parent_plat(dev).
* This is used by sandbox to provide emulation data also.
*
* @id: ID used to match this device
@@ -617,7 +617,7 @@ struct usb_platdata {
* @strings: List of descriptor strings (for sandbox emulation purposes)
* @desc_list: List of descriptors (for sandbox emulation purposes)
*/
-struct usb_dev_platdata {
+struct usb_dev_plat {
struct usb_device_id id;
int devnum;
/*
@@ -659,14 +659,14 @@ struct usb_bus_priv {
};
/**
- * struct usb_emul_platdata - platform data about the USB emulator
+ * struct usb_emul_plat - platform data about the USB emulator
*
* Given a USB emulator (UCLASS_USB_EMUL) 'dev', this is
- * dev_get_uclass_platdata(dev).
+ * dev_get_uclass_plat(dev).
*
* @port1: USB emulator device port number on the parent hub
*/
-struct usb_emul_platdata {
+struct usb_emul_plat {
int port1; /* Port number (numbered from 1) */
};
diff --git a/include/vbe.h b/include/vbe.h
index f420f493ee..1631260eb7 100644
--- a/include/vbe.h
+++ b/include/vbe.h
@@ -104,10 +104,10 @@ struct vbe_ddc_info {
extern struct vbe_mode_info mode_info;
struct video_priv;
-struct video_uc_platdata;
+struct video_uc_plat;
int vbe_setup_video_priv(struct vesa_mode_info *vesa,
struct video_priv *uc_priv,
- struct video_uc_platdata *plat);
+ struct video_uc_plat *plat);
int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void));
#endif
diff --git a/include/video.h b/include/video.h
index 9d09d2409a..74d822fadb 100644
--- a/include/video.h
+++ b/include/video.h
@@ -18,10 +18,10 @@
struct udevice;
/**
- * struct video_uc_platdata - uclass platform data for a video device
+ * struct video_uc_plat - uclass platform data for a video device
*
* This holds information that the uclass needs to know about each device. It
- * is accessed using dev_get_uclass_platdata(dev). See 'Theory of operation' at
+ * is accessed using dev_get_uclass_plat(dev). See 'Theory of operation' at
* the top of video-uclass.c for details on how this information is set.
*
* @align: Frame-buffer alignment, indicating the memory boundary the frame
@@ -31,7 +31,7 @@ struct udevice;
* @copy_base: Base address of a hardware copy of the frame buffer. See
* CONFIG_VIDEO_COPY.
*/
-struct video_uc_platdata {
+struct video_uc_plat {
uint align;
uint size;
ulong base;
@@ -77,7 +77,7 @@ enum video_log2_bpp {
* @fb: Frame buffer
* @fb_size: Frame buffer size
* @copy_fb: Copy of the frame buffer to keep up to date; see struct
- * video_uc_platdata
+ * video_uc_plat
* @line_length: Length of each frame buffer line, in bytes. This can be
* set by the driver, but if not, the uclass will set it after
* probing
@@ -114,8 +114,16 @@ struct video_priv {
u8 bg_col_idx;
};
-/* Placeholder - there are no video operations at present */
+/**
+ * struct video_ops - structure for keeping video operations
+ * @video_sync: Synchronize FB with device. Some device like SPI based LCD
+ * displays needs synchronization when data in an FB is available.
+ * For these devices implement video_sync hook to call a sync
+ * function. vid is pointer to video device udevice. Function
+ * should return 0 on success video_sync and error code otherwise
+ */
struct video_ops {
+ int (*video_sync)(struct udevice *vid);
};
#define video_get_ops(dev) ((struct video_ops *)(dev)->driver->ops)
@@ -125,7 +133,7 @@ struct video_ops {
*
* Note: This function is for internal use.
*
- * This uses the uclass platdata's @size and @align members to figure out
+ * This uses the uclass plat's @size and @align members to figure out
* a size and position for each frame buffer as part of the pre-relocation
* process of determining the post-relocation memory layout.
*
@@ -151,15 +159,17 @@ int video_clear(struct udevice *dev);
/**
* video_sync() - Sync a device's frame buffer with its hardware
*
+ * @vid: Device to sync
+ * @force: True to force a sync even if there was one recently (this is
+ * very expensive on sandbox)
+ *
+ * @return: 0 on success, error code otherwise
+ *
* Some frame buffers are cached or have a secondary frame buffer. This
* function syncs these up so that the current contents of the U-Boot frame
* buffer are displayed to the user.
- *
- * @dev: Device to sync
- * @force: True to force a sync even if there was one recently (this is
- * very expensive on sandbox)
*/
-void video_sync(struct udevice *vid, bool force);
+int video_sync(struct udevice *vid, bool force);
/**
* video_sync_all() - Sync all devices' frame buffers with there hardware
diff --git a/include/virtio.h b/include/virtio.h
index 10a9c073ba..a42bdad6b8 100644
--- a/include/virtio.h
+++ b/include/virtio.h
@@ -492,7 +492,7 @@ static inline void __virtio_clear_bit(struct udevice *udev, unsigned int fbit)
*/
static inline bool virtio_has_feature(struct udevice *vdev, unsigned int fbit)
{
- if (!(vdev->flags & DM_FLAG_BOUND))
+ if (!(dev_get_flags(vdev) & DM_FLAG_BOUND))
WARN_ON(true);
return __virtio_test_bit(vdev->parent, fbit);