diff options
author | Tom Rini <trini@konsulko.com> | 2020-07-23 15:56:06 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-07-23 15:56:06 -0400 |
commit | 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7 (patch) | |
tree | 5de77f2861f6856866c5bf4ffa7cab22d371ccf3 /include | |
parent | 56d37f1c564107e27d873181d838571b7d7860e7 (diff) | |
parent | 60e7fa8b3b8538aae1e644dac61d5e4076901edb (diff) |
Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm
binman support for FIT
new UCLASS_SOC
patman switch 'test' command
minor fdt fixes
patman usability improvements
Diffstat (limited to 'include')
-rw-r--r-- | include/cpu.h | 16 | ||||
-rw-r--r-- | include/dm/uclass-id.h | 1 | ||||
-rw-r--r-- | include/fdtdec.h | 39 | ||||
-rw-r--r-- | include/soc.h | 145 |
4 files changed, 154 insertions, 47 deletions
diff --git a/include/cpu.h b/include/cpu.h index 2f283fe244..78e88b9ed0 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -61,7 +61,7 @@ struct cpu_ops { * @size: Size of string space * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error */ - int (*get_desc)(struct udevice *dev, char *buf, int size); + int (*get_desc)(const struct udevice *dev, char *buf, int size); /** * get_info() - Get information about a CPU @@ -70,7 +70,7 @@ struct cpu_ops { * @info: Returns CPU info * @return 0 if OK, -ve on error */ - int (*get_info)(struct udevice *dev, struct cpu_info *info); + int (*get_info)(const struct udevice *dev, struct cpu_info *info); /** * get_count() - Get number of CPUs @@ -78,7 +78,7 @@ struct cpu_ops { * @dev: Device to check (UCLASS_CPU) * @return CPU count if OK, -ve on error */ - int (*get_count)(struct udevice *dev); + int (*get_count)(const struct udevice *dev); /** * get_vendor() - Get vendor name of a CPU @@ -88,7 +88,7 @@ struct cpu_ops { * @size: Size of string space * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error */ - int (*get_vendor)(struct udevice *dev, char *buf, int size); + int (*get_vendor)(const struct udevice *dev, char *buf, int size); /** * is_current() - Check if the CPU that U-Boot is currently running from @@ -110,7 +110,7 @@ struct cpu_ops { * * Return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error */ -int cpu_get_desc(struct udevice *dev, char *buf, int size); +int cpu_get_desc(const struct udevice *dev, char *buf, int size); /** * cpu_get_info() - Get information about a CPU @@ -119,7 +119,7 @@ int cpu_get_desc(struct udevice *dev, char *buf, int size); * * Return: 0 if OK, -ve on error */ -int cpu_get_info(struct udevice *dev, struct cpu_info *info); +int cpu_get_info(const struct udevice *dev, struct cpu_info *info); /** * cpu_get_count() - Get number of CPUs @@ -127,7 +127,7 @@ int cpu_get_info(struct udevice *dev, struct cpu_info *info); * * Return: CPU count if OK, -ve on error */ -int cpu_get_count(struct udevice *dev); +int cpu_get_count(const struct udevice *dev); /** * cpu_get_vendor() - Get vendor name of a CPU @@ -137,7 +137,7 @@ int cpu_get_count(struct udevice *dev); * * Return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error */ -int cpu_get_vendor(struct udevice *dev, char *buf, int size); +int cpu_get_vendor(const struct udevice *dev, char *buf, int size); /** * cpu_probe_all() - Probe all available CPUs diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 7837d459f1..690a8ed4df 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -97,6 +97,7 @@ enum uclass_id { UCLASS_SERIAL, /* Serial UART */ UCLASS_SIMPLE_BUS, /* Bus with child devices */ UCLASS_SMEM, /* Shared memory interface */ + UCLASS_SOC, /* SOC Device */ UCLASS_SOUND, /* Playing simple sounds */ UCLASS_SPI, /* SPI bus */ UCLASS_SPI_FLASH, /* SPI flash */ diff --git a/include/fdtdec.h b/include/fdtdec.h index abd6d42671..760b392bdf 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -909,26 +909,6 @@ int fdtdec_decode_display_timing(const void *blob, int node, int index, struct display_timing *config); /** - * fdtdec_setup_mem_size_base_fdt() - decode and setup gd->ram_size and - * gd->ram_start - * - * Decode the /memory 'reg' property to determine the size and start of the - * first memory bank, populate the global data with the size and start of the - * first bank of memory. - * - * This function should be called from a boards dram_init(). This helper - * function allows for boards to query the device tree for DRAM size and start - * address instead of hard coding the value in the case where the memory size - * and start address cannot be detected automatically. - * - * @param blob FDT blob - * - * @return 0 if OK, -EINVAL if the /memory node or reg property is missing or - * invalid - */ -int fdtdec_setup_mem_size_base_fdt(const void *blob); - -/** * fdtdec_setup_mem_size_base() - decode and setup gd->ram_size and * gd->ram_start * @@ -947,25 +927,6 @@ int fdtdec_setup_mem_size_base_fdt(const void *blob); int fdtdec_setup_mem_size_base(void); /** - * fdtdec_setup_memory_banksize_fdt() - decode and populate gd->bd->bi_dram - * - * Decode the /memory 'reg' property to determine the address and size of the - * memory banks. Use this data to populate the global data board info with the - * phys address and size of memory banks. - * - * This function should be called from a boards dram_init_banksize(). This - * helper function allows for boards to query the device tree for memory bank - * information instead of hard coding the information in cases where it cannot - * be detected automatically. - * - * @param blob FDT blob - * - * @return 0 if OK, -EINVAL if the /memory node or reg property is missing or - * invalid - */ -int fdtdec_setup_memory_banksize_fdt(const void *blob); - -/** * fdtdec_setup_memory_banksize() - decode and populate gd->bd->bi_dram * * Decode the /memory 'reg' property to determine the address and size of the diff --git a/include/soc.h b/include/soc.h new file mode 100644 index 0000000000..a55eb1b572 --- /dev/null +++ b/include/soc.h @@ -0,0 +1,145 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * (C) Copyright 2020 - Texas Instruments Incorporated - http://www.ti.com/ + * Dave Gerlach <d-gerlach@ti.com> + */ + +#ifndef __SOC_H +#define __SOC_H + +#define SOC_MAX_STR_SIZE 128 + +/** + * struct soc_attr - Contains SoC identify information to be used in + * SoC matching. An array of these structs + * representing different SoCs can be passed to + * soc_device_match and the struct matching the SoC + * in use will be returned. + * + * @family - Name of SoC family that can include multiple related SoC + * variants. Example: am33 + * @machine - Name of a specific SoC. Example: am3352 + * @revision - Name of a specific SoC revision. Example: SR1.1 + * @data - A pointer to user data for the SoC variant + */ +struct soc_attr { + const char *family; + const char *machine; + const char *revision; + const void *data; +}; + +struct soc_ops { + /** + * get_machine() - Get machine name of an SOC + * + * @dev: Device to check (UCLASS_SOC) + * @buf: Buffer to place string + * @size: Size of string space + * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error + */ + int (*get_machine)(struct udevice *dev, char *buf, int size); + + /** + * get_revision() - Get revision name of a SOC + * + * @dev: Device to check (UCLASS_SOC) + * @buf: Buffer to place string + * @size: Size of string space + * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error + */ + int (*get_revision)(struct udevice *dev, char *buf, int size); + + /** + * get_family() - Get family name of an SOC + * + * @dev: Device to check (UCLASS_SOC) + * @buf: Buffer to place string + * @size: Size of string space + * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error + */ + int (*get_family)(struct udevice *dev, char *buf, int size); +}; + +#define soc_get_ops(dev) ((struct soc_ops *)(dev)->driver->ops) + +#ifdef CONFIG_SOC_DEVICE +/** + * soc_get() - Return the soc device for the soc in use. + * @devp: Pointer to structure to receive the soc device. + * + * Since there can only be at most one SOC instance, the API can supply a + * function that returns the unique device. + * + * Return: 0 if OK, -ve on error. + */ +int soc_get(struct udevice **devp); + +/** + * soc_get_machine() - Get machine name of an SOC + * @dev: Device to check (UCLASS_SOC) + * @buf: Buffer to place string + * @size: Size of string space + * + * Return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error + */ +int soc_get_machine(struct udevice *dev, char *buf, int size); + +/** + * soc_get_revision() - Get revision name of an SOC + * @dev: Device to check (UCLASS_SOC) + * @buf: Buffer to place string + * @size: Size of string space + * + * Return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error + */ +int soc_get_revision(struct udevice *dev, char *buf, int size); + +/** + * soc_get_family() - Get family name of an SOC + * @dev: Device to check (UCLASS_SOC) + * @buf: Buffer to place string + * @size: Size of string space + * + * Return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error + */ +int soc_get_family(struct udevice *dev, char *buf, int size); + +/** + * soc_device_match() - Return match from an array of soc_attr + * @matches: Array with any combination of family, revision or machine set + * + * Return: Pointer to struct from matches array with set attributes matching + * those provided by the soc device, or NULL if no match found. + */ +const struct soc_attr * +soc_device_match(const struct soc_attr *matches); + +#else +static inline int soc_get(struct udevice **devp) +{ + return -ENOSYS; +} + +static inline int soc_get_machine(struct udevice *dev, char *buf, int size) +{ + return -ENOSYS; +} + +static inline int soc_get_revision(struct udevice *dev, char *buf, int size) +{ + return -ENOSYS; +} + +static inline int soc_get_family(struct udevice *dev, char *buf, int size) +{ + return -ENOSYS; +} + +static inline const struct soc_attr * +soc_device_match(const struct soc_attr *matches) +{ + return NULL; +} +#endif +#endif /* _SOC_H */ |