aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-09-27 11:09:23 -0400
committerTom Rini <trini@konsulko.com>2021-09-27 11:09:23 -0400
commit1d1f98c8eed7bb4792300e655c2cb70136928f74 (patch)
treed08df140d52bd1298fa0e81ce908e2e09a880e5d /include
parente908d20fcbd847e17345591fc171b59d9a156516 (diff)
parent933bf2644591281ed96f9d5771cbb35fe95bcb00 (diff)
downloadu-boot-1d1f98c8eed7bb4792300e655c2cb70136928f74.zip
u-boot-1d1f98c8eed7bb4792300e655c2cb70136928f74.tar.gz
u-boot-1d1f98c8eed7bb4792300e655c2cb70136928f74.tar.bz2
Merge tag 'dm-pull-next-27sep21' of https://source.denx.de/u-boot/custodians/u-boot-dm into nextWIP/27Sep2021-next
Various of-platdata improvements, including CONFIG_OF_REAL
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/gpio.h5
-rw-r--r--include/clk.h35
-rw-r--r--include/dm/device.h12
-rw-r--r--include/dm/ofnode.h37
-rw-r--r--include/dt-structs.h27
-rw-r--r--include/fdt_support.h2
-rw-r--r--include/fdtdec.h33
-rw-r--r--include/irq.h29
-rw-r--r--include/power-domain.h6
9 files changed, 135 insertions, 51 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index e33cde7..6de13d9 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -608,6 +608,11 @@ int gpio_request_list_by_name(struct udevice *dev, const char *list_name,
*/
int dm_gpio_request(struct gpio_desc *desc, const char *label);
+struct phandle_2_arg;
+int gpio_request_by_phandle(struct udevice *dev,
+ const struct phandle_2_arg *cells,
+ struct gpio_desc *desc, int flags);
+
/**
* gpio_get_list_count() - Returns the number of GPIOs in a list
*
diff --git a/include/clk.h b/include/clk.h
index f3c88fe..a928879 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -89,11 +89,36 @@ struct clk_bulk {
#if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK)
struct phandle_1_arg;
-int clk_get_by_driver_info(struct udevice *dev,
- struct phandle_1_arg *cells, struct clk *clk);
+/**
+ * clk_get_by_phandle() - Get a clock by its phandle information (of-platadata)
+ *
+ * This function is used when of-platdata is enabled.
+ *
+ * This looks up a clock using the phandle info. With dtoc, each phandle in the
+ * 'clocks' property is transformed into an idx representing the device. For
+ * example:
+ *
+ * clocks = <&dpll_mpu_ck 23>;
+ *
+ * might result in:
+ *
+ * .clocks = {1, {23}},},
+ *
+ * indicating that the clock is udevice idx 1 in dt-plat.c with an argument of
+ * 23. This function can return a valid clock given the above information. In
+ * this example it would return a clock containing the 'dpll_mpu_ck' device and
+ * the clock ID 23.
+ *
+ * @dev: Device containing the phandle
+ * @cells: Phandle info
+ * @clock: A pointer to a clock struct to initialise
+ * @return 0 if OK, or a negative error code.
+ */
+int clk_get_by_phandle(struct udevice *dev, const struct phandle_1_arg *cells,
+ struct clk *clk);
/**
- * clk_get_by_index - Get/request a clock by integer index.
+ * clk_get_by_index() - Get/request a clock by integer index.
*
* This looks up and requests a clock. The index is relative to the client
* device; each device is assumed to have n clocks associated with it somehow,
@@ -300,9 +325,7 @@ enum clk_defaults_stage {
CLK_DEFAULTS_POST_FORCE,
};
-#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) && \
- CONFIG_IS_ENABLED(CLK)
-
+#if CONFIG_IS_ENABLED(OF_REAL) && CONFIG_IS_ENABLED(CLK)
/**
* clk_set_defaults - Process 'assigned-{clocks/clock-parents/clock-rates}'
* properties to configure clocks
diff --git a/include/dm/device.h b/include/dm/device.h
index ef6241b..fac9961 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -181,7 +181,7 @@ struct udevice {
u32 flags_;
#endif
int seq_;
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_REAL)
ofnode node_;
#endif
#ifdef CONFIG_DEVRES
@@ -242,7 +242,7 @@ static inline void dev_bic_flags(struct udevice *dev, u32 bic)
*/
static inline ofnode dev_ofnode(const struct udevice *dev)
{
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_REAL)
return dev->node_;
#else
return ofnode_null();
@@ -262,7 +262,7 @@ static inline ofnode dev_ofnode(const struct udevice *dev)
static inline int dev_of_offset(const struct udevice *dev)
{
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_REAL)
return ofnode_to_offset(dev_ofnode(dev));
#else
return -1;
@@ -271,7 +271,7 @@ static inline int dev_of_offset(const struct udevice *dev)
static inline bool dev_has_ofnode(const struct udevice *dev)
{
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_REAL)
return ofnode_valid(dev_ofnode(dev));
#else
return false;
@@ -280,7 +280,7 @@ static inline bool dev_has_ofnode(const struct udevice *dev)
static inline void dev_set_ofnode(struct udevice *dev, ofnode node)
{
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_REAL)
dev->node_ = node;
#endif
}
@@ -300,7 +300,7 @@ struct udevice_id {
ulong data;
};
-#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_REAL)
#define of_match_ptr(_ptr) (_ptr)
#else
#define of_match_ptr(_ptr) NULL
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 4e1a844..6a714d0 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1117,4 +1117,41 @@ int ofnode_write_string(ofnode node, const char *propname, const char *value);
*/
int ofnode_set_enabled(ofnode node, bool value);
+/**
+ * ofnode_conf_read_bool() - Read a boolean value from the U-Boot config
+ *
+ * This reads a property from the /config node of the devicetree.
+ *
+ * See doc/config.txt for bindings
+ *
+ * @prop_name property name to look up
+ * @return true, if it exists, false if not
+ */
+bool ofnode_conf_read_bool(const char *prop_name);
+
+/**
+ * ofnode_conf_read_int() - Read an integer value from the U-Boot config
+ *
+ * This reads a property from the /config node of the devicetree.
+ *
+ * See doc/config.txt for bindings
+ *
+ * @prop_name: property name to look up
+ * @default_val: default value to return if the property is not found
+ * @return integer value, if found, or @default_val if not
+ */
+int ofnode_conf_read_int(const char *prop_name, int default_val);
+
+/**
+ * ofnode_conf_read_str() - Read a string value from the U-Boot config
+ *
+ * This reads a property from the /config node of the devicetree.
+ *
+ * See doc/config.txt for bindings
+ *
+ * @prop_name: property name to look up
+ * @return string value, if found, or NULL if not
+ */
+const char *ofnode_conf_read_str(const char *prop_name);
+
#endif
diff --git a/include/dt-structs.h b/include/dt-structs.h
index f9ccaf5..fa1622c 100644
--- a/include/dt-structs.h
+++ b/include/dt-structs.h
@@ -10,16 +10,43 @@
#if CONFIG_IS_ENABLED(OF_PLATDATA)
struct driver_info;
+/**
+ * struct phandle_0_arg - hold a phandle record with no arguments
+ *
+ * This holds a phandle pointing to another device. See 'Indexes' in the
+ * of-plat-rst documentation.
+ *
+ * @idx: udevice index (or driver_info index if !OF_PLATDATA_INST)
+ * @arg: arguments
+ */
struct phandle_0_arg {
uint idx;
int arg[0];
};
+/**
+ * struct phandle_2_arg - hold a phandle record with up to one argument
+ *
+ * This holds a phandle pointing to another device. See 'Indexes' in the
+ * of-plat-rst documentation.
+ *
+ * @idx: udevice index (or driver_info index if !OF_PLATDATA_INST)
+ * @arg: arguments
+ */
struct phandle_1_arg {
uint idx;
int arg[1];
};
+/**
+ * struct phandle_2_arg - hold a phandle record with up to two arguments
+ *
+ * This holds a phandle pointing to another device. See 'Indexes' in the
+ * of-plat-rst documentation.
+ *
+ * @idx: udevice index (or driver_info index if !OF_PLATDATA_INST)
+ * @arg: arguments
+ */
struct phandle_2_arg {
uint idx;
int arg[2];
diff --git a/include/fdt_support.h b/include/fdt_support.h
index f6f46bb..72a5b90 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -203,8 +203,6 @@ char *board_fdt_chosen_bootargs(void);
* called at the end of the image_setup_libfdt() is to do that convertion.
*/
void ft_board_setup_ex(void *blob, struct bd_info *bd);
-void ft_cpu_setup(void *blob, struct bd_info *bd);
-void ft_pci_setup(void *blob, struct bd_info *bd);
/**
* Add system-specific data to the FDT before booting the OS.
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 8ac20c9..23efbe7 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -746,39 +746,6 @@ int fdtdec_get_bool(const void *blob, int node, const char *prop_name);
*/
int fdtdec_get_child_count(const void *blob, int node);
-/**
- * Look in the FDT for a config item with the given name and return its value
- * as a 32-bit integer. The property must have at least 4 bytes of data. The
- * value of the first cell is returned.
- *
- * @param blob FDT blob to use
- * @param prop_name Node property name
- * @param default_val default value to return if the property is not found
- * @return integer value, if found, or default_val if not
- */
-int fdtdec_get_config_int(const void *blob, const char *prop_name,
- int default_val);
-
-/**
- * Look in the FDT for a config item with the given name
- * and return whether it exists.
- *
- * @param blob FDT blob
- * @param prop_name property name to look up
- * @return 1, if it exists, or 0 if not
- */
-int fdtdec_get_config_bool(const void *blob, const char *prop_name);
-
-/**
- * Look in the FDT for a config item with the given name and return its value
- * as a string.
- *
- * @param blob FDT blob
- * @param prop_name property name to look up
- * @returns property string, NULL on error.
- */
-char *fdtdec_get_config_string(const void *blob, const char *prop_name);
-
/*
* Look up a property in a node and return its contents in a byte
* array of given length. The property must have at least enough data for
diff --git a/include/irq.h b/include/irq.h
index 8527e4d..a0965e4 100644
--- a/include/irq.h
+++ b/include/irq.h
@@ -200,6 +200,35 @@ int irq_restore_polarities(struct udevice *dev);
*/
int irq_read_and_clear(struct irq *irq);
+struct phandle_2_arg;
+/**
+ * irq_get_by_phandle() - Get an irq by its phandle information (of-platadata)
+ *
+ * This function is used when of-platdata is enabled.
+ *
+ * This looks up an irq using the phandle info. With dtoc, each phandle in the
+ * 'interrupts-extended ' property is transformed into an idx representing the
+ * device. For example:
+ *
+ * interrupts-extended = <&acpi_gpe 0x3c 0>;
+ *
+ * might result in:
+ *
+ * .interrupts_extended = {6, {0x3c, 0}},},
+ *
+ * indicating that the irq is udevice idx 6 in dt-plat.c with a arguments of
+ * 0x3c and 0.This function can return a valid irq given the above
+ * information. In this example it would return an irq containing the
+ * 'acpi_gpe' device and the irq ID 0x3c.
+ *
+ * @dev: Device containing the phandle
+ * @cells: Phandle info
+ * @irq: A pointer to a irq struct to initialise
+ * @return 0 if OK, or a negative error code
+ */
+int irq_get_by_phandle(struct udevice *dev, const struct phandle_2_arg *cells,
+ struct irq *irq);
+
/**
* irq_get_by_index - Get/request an irq by integer index.
*
diff --git a/include/power-domain.h b/include/power-domain.h
index 72ff2ff..62ff199 100644
--- a/include/power-domain.h
+++ b/include/power-domain.h
@@ -162,8 +162,7 @@ static inline int power_domain_off(struct power_domain *power_domain)
*
* @return 0 if OK, or a negative error code.
*/
-#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) && \
- CONFIG_IS_ENABLED(POWER_DOMAIN)
+#if CONFIG_IS_ENABLED(OF_REAL) && CONFIG_IS_ENABLED(POWER_DOMAIN)
int dev_power_domain_on(struct udevice *dev);
#else
static inline int dev_power_domain_on(struct udevice *dev)
@@ -179,8 +178,7 @@ static inline int dev_power_domain_on(struct udevice *dev)
*
* @return 0 if OK, or a negative error code.
*/
-#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) && \
- CONFIG_IS_ENABLED(POWER_DOMAIN)
+#if CONFIG_IS_ENABLED(OF_REAL) && CONFIG_IS_ENABLED(POWER_DOMAIN)
int dev_power_domain_off(struct udevice *dev);
#else
static inline int dev_power_domain_off(struct udevice *dev)