diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/global_data.h | 8 | ||||
-rw-r--r-- | include/dm/device-internal.h | 85 | ||||
-rw-r--r-- | include/dm/device.h | 111 | ||||
-rw-r--r-- | include/dm/lists.h | 2 | ||||
-rw-r--r-- | include/dm/platdata.h | 28 | ||||
-rw-r--r-- | include/dm/platform_data/spi_pl022.h | 2 | ||||
-rw-r--r-- | include/dm/read.h | 18 | ||||
-rw-r--r-- | include/dm/simple_bus.h | 15 | ||||
-rw-r--r-- | include/dm/test.h | 20 | ||||
-rw-r--r-- | include/dm/uclass-internal.h | 14 | ||||
-rw-r--r-- | include/dm/uclass.h | 16 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 9 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 14 | ||||
-rw-r--r-- | include/linux/mtd/spi-nor.h | 6 | ||||
-rw-r--r-- | include/linux/mtd/spinand.h | 15 | ||||
-rw-r--r-- | include/ns16550.h | 21 | ||||
-rw-r--r-- | include/spl.h | 10 | ||||
-rw-r--r-- | include/test/test.h | 9 | ||||
-rw-r--r-- | include/virtio.h | 2 |
19 files changed, 314 insertions, 91 deletions
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 887b5c268de..31e249177c3 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -194,7 +194,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; diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h index af3b6b2b054..639bbd293d9 100644 --- a/include/dm/device-internal.h +++ b/include/dm/device-internal.h @@ -190,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 @@ -204,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 30fc98dc345..f5b4cd6876e 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -104,7 +104,7 @@ 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 plat 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 plat in a function * implemented by the driver of_to_plat method (called just before the @@ -116,26 +116,34 @@ enum { * * @driver: The driver used by this device * @name: Name of device, typically the FDT node name - * @plat: Configuration data for this device - * @parent_plat: The parent bus's configuration data for this device - * @uclass_plat: 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_... - * @seq: Allocated sequence number for this device (-1 = none). This is set up + * @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') + * 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 @@ -144,21 +152,23 @@ enum { struct udevice { const struct driver *driver; const char *name; - void *plat; - void *parent_plat; - void *uclass_plat; - 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 sqq; + u32 flags_; + int seq_; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) + ofnode node_; +#endif #ifdef CONFIG_DEVRES struct list_head devres_head; #endif @@ -170,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 bool dev_has_of_node(struct udevice *dev) +static inline bool dev_has_ofnode(const struct udevice *dev) { - return ofnode_valid(dev->node); +#if !CONFIG_IS_ENABLED(OF_PLATDATA) + return ofnode_valid(dev_ofnode(dev)); +#else + return false; +#endif +} + +static inline void dev_set_ofnode(struct udevice *dev, ofnode node) +{ +#if !CONFIG_IS_ENABLED(OF_PLATDATA) + dev->node_ = node; +#endif } static inline int dev_seq(const struct udevice *dev) { - return dev->sqq; + return dev->seq_; } /** @@ -238,7 +293,7 @@ struct udevice_id { * 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 plat will have the data - * provided in the U_BOOT_DEVICE() instantiation. + * 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. @@ -280,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) /** @@ -288,7 +343,7 @@ 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_plat() - Get the platform data for a device diff --git a/include/dm/lists.h b/include/dm/lists.h index 070bc9c19f6..1a865525461 100644 --- a/include/dm/lists.h +++ b/include/dm/lists.h @@ -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/platdata.h b/include/dm/platdata.h index d650fb39190..3821a56f2ca 100644 --- a/include/dm/platdata.h +++ b/include/dm/platdata.h @@ -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 + * 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/spi_pl022.h b/include/dm/platform_data/spi_pl022.h index c5aa3212915..7f74b3cbc5c 100644 --- a/include/dm/platform_data/spi_pl022.h +++ b/include/dm/platform_data/spi_pl022.h @@ -3,7 +3,7 @@ * (C) Copyright 2018 * Quentin Schulz, Bootlin, quentin.schulz@bootlin.com * - * Structure for use with U_BOOT_DEVICE for pl022 SPI devices or to use + * Structure for use with U_BOOT_DRVINFO for pl022 SPI devices or to use * in of_to_plat. */ diff --git a/include/dm/read.h b/include/dm/read.h index 0585eb12281..fc987f77598 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 /** diff --git a/include/dm/simple_bus.h b/include/dm/simple_bus.h new file mode 100644 index 00000000000..4ad4cc4051d --- /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 b2adce730ad..6ac6672cd6f 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-internal.h b/include/dm/uclass-internal.h index 3e052f95d32..c5a464be7c4 100644 --- a/include/dm/uclass-internal.h +++ b/include/dm/uclass-internal.h @@ -12,6 +12,20 @@ #include <dm/ofnode.h> /** + * uclass_set_priv() - Set the private data for a uclass + * + * This is normally handled by driver model, which automatically allocates + * private data when an 'auto' size if provided by the uclass driver. + * + * 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 + */ +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 diff --git a/include/dm/uclass.h b/include/dm/uclass.h index 91edbfb47d4..b5f066dbf48 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; @@ -112,7 +112,15 @@ struct uclass_driver { /* 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 @@ -256,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. diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 1b9151714c0..927854950a0 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 13e8dd11035..7774c17ad5d 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 233fdc341a7..4a8e19ee4f9 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 88bacde91e5..15bcd59f341 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/ns16550.h b/include/ns16550.h index bef29610325..bef20719980 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 @@ -82,7 +85,7 @@ struct ns16550_plat { struct udevice; -struct NS16550 { +struct ns16550 { UART_REG(rbr); /* 0 */ UART_REG(ier); /* 1 */ UART_REG(fcr); /* 2 */ @@ -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,7 +239,7 @@ 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_of_to_plat() - convert DT to platform data @@ -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/spl.h b/include/spl.h index 374a295fa36..a7648787b74 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 diff --git a/include/test/test.h b/include/test/test.h index 03e29290bf4..3fdaa2b5e51 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/virtio.h b/include/virtio.h index 10a9c073ba1..a42bdad6b87 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); |