summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/clk.h4
-rw-r--r--include/configs/sandbox.h4
-rw-r--r--include/configs/sandbox_spl.h20
-rw-r--r--include/dm/device.h6
-rw-r--r--include/dm/platdata.h5
-rw-r--r--include/dt-structs.h19
-rw-r--r--include/os.h25
-rw-r--r--include/regmap.h16
-rw-r--r--include/syscon.h11
9 files changed, 108 insertions, 2 deletions
diff --git a/include/clk.h b/include/clk.h
index 2f31cf7..161bc28 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -60,6 +60,10 @@ struct clk {
};
#if CONFIG_IS_ENABLED(OF_CONTROL)
+struct phandle_2_cell;
+int clk_get_by_index_platdata(struct udevice *dev, int index,
+ struct phandle_2_cell *cells, struct clk *clk);
+
/**
* clock_get_by_index - Get/request a clock by integer index.
*
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 23a0c40..4de89f8 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -16,8 +16,10 @@
#endif
+#ifndef CONFIG_SPL_BUILD
#define CONFIG_IO_TRACE
#define CONFIG_CMD_IOTRACE
+#endif
#ifndef CONFIG_TIMER
#define CONFIG_SYS_TIMER_RATE 1000000
@@ -192,6 +194,7 @@
#define CONFIG_CMD_LZMADEC
#define CONFIG_CMD_DATE
+#ifndef CONFIG_SPL_BUILD
#define CONFIG_CMD_IDE
#define CONFIG_SYS_IDE_MAXBUS 1
#define CONFIG_SYS_ATA_IDE0_OFFSET 0
@@ -201,6 +204,7 @@
#define CONFIG_SYS_ATA_REG_OFFSET 1
#define CONFIG_SYS_ATA_ALT_OFFSET 2
#define CONFIG_SYS_ATA_STRIDE 4
+#endif
#define CONFIG_SCSI
#define CONFIG_SCSI_AHCI_PLAT
diff --git a/include/configs/sandbox_spl.h b/include/configs/sandbox_spl.h
new file mode 100644
index 0000000..ffc3098
--- /dev/null
+++ b/include/configs/sandbox_spl.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2016 Google, Inc
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __SANDBOX_SPL_CONFIG_H
+#define __SANDBOX_SPL_CONFIG_H
+
+#include <configs/sandbox.h>
+
+#define CONFIG_SPL_BOARD_INIT
+
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
+#define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+
+#endif
diff --git a/include/dm/device.h b/include/dm/device.h
index 1bfcf3b..c825d47 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -42,7 +42,9 @@ struct driver_info;
#define DM_FLAG_BOUND (1 << 6)
/* Device name is allocated and should be freed on unbind() */
-#define DM_NAME_ALLOCED (1 << 7)
+#define DM_FLAG_NAME_ALLOCED (1 << 7)
+
+#define DM_FLAG_OF_PLATDATA (1 << 8)
/**
* struct udevice - An instance of a driver
@@ -553,7 +555,7 @@ int device_set_name(struct udevice *dev, const char *name);
/**
* device_set_name_alloced() - note that a device name is allocated
*
- * This sets the DM_NAME_ALLOCED flag for the device, so that when it is
+ * This sets the DM_FLAG_NAME_ALLOCED flag for the device, so that when it is
* unbound the name will be freed. This avoids memory leaks.
*
* @dev: Device to update
diff --git a/include/dm/platdata.h b/include/dm/platdata.h
index 6f4f001..488b2ab 100644
--- a/include/dm/platdata.h
+++ b/include/dm/platdata.h
@@ -22,10 +22,15 @@
*
* @name: Driver name
* @platdata: Driver-specific platform data
+ * @platdata_size: Size of platform data structure
+ * @flags: Platform data flags (DM_FLAG_...)
*/
struct driver_info {
const char *name;
const void *platdata;
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+ uint platdata_size;
+#endif
};
/**
diff --git a/include/dt-structs.h b/include/dt-structs.h
new file mode 100644
index 0000000..e13afa6
--- /dev/null
+++ b/include/dt-structs.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2016 Google, Inc
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __DT_STTUCTS
+#define __DT_STTUCTS
+
+/* These structures may only be used in SPL */
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+struct phandle_2_cell {
+ const void *node;
+ int id;
+};
+#include <generated/dt-structs.h>
+#endif
+
+#endif
diff --git a/include/os.h b/include/os.h
index 954a48c..1782e50 100644
--- a/include/os.h
+++ b/include/os.h
@@ -287,6 +287,31 @@ int os_read_ram_buf(const char *fname);
int os_jump_to_image(const void *dest, int size);
/**
+ * os_find_u_boot() - Determine the path to U-Boot proper
+ *
+ * This function is intended to be called from within sandbox SPL. It uses
+ * a few heuristics to find U-Boot proper. Normally it is either in the same
+ * directory, or the directory above (since u-boot-spl is normally in an
+ * spl/ subdirectory when built).
+ *
+ * @fname: Place to put full path to U-Boot
+ * @maxlen: Maximum size of @fname
+ * @return 0 if OK, -NOSPC if the filename is too large, -ENOENT if not found
+ */
+int os_find_u_boot(char *fname, int maxlen);
+
+/**
+ * os_spl_to_uboot() - Run U-Boot proper
+ *
+ * When called from SPL, this runs U-Boot proper. The filename is obtained by
+ * calling os_find_u_boot().
+ *
+ * @fname: Full pathname to U-Boot executable
+ * @return 0 if OK, -ve on error
+ */
+int os_spl_to_uboot(const char *fname);
+
+/**
* Read the current system time
*
* This reads the current Local Time and places it into the provided
diff --git a/include/regmap.h b/include/regmap.h
index eccf770..1eed94e 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -57,6 +57,22 @@ int regmap_read(struct regmap *map, uint offset, uint *valp);
int regmap_init_mem(struct udevice *dev, struct regmap **mapp);
/**
+ * regmap_init_mem_platdata() - Set up a new memory register map for of-platdata
+ *
+ * This creates a new regmap with a list of regions passed in, rather than
+ * using the device tree. It only supports 32-bit machines.
+ *
+ * Use regmap_uninit() to free it.
+ *
+ * @dev: Device that uses this map
+ * @reg: List of address, size pairs
+ * @count: Number of pairs (e.g. 1 if the regmap has a single entry)
+ * @mapp: Returns allocated map
+ */
+int regmap_init_mem_platdata(struct udevice *dev, u32 *reg, int count,
+ struct regmap **mapp);
+
+/**
* regmap_get_range() - Obtain the base memory address of a regmap range
*
* @map: Regmap to query
diff --git a/include/syscon.h b/include/syscon.h
index 4593b6e..34842aa 100644
--- a/include/syscon.h
+++ b/include/syscon.h
@@ -23,6 +23,17 @@ struct syscon_ops {
#define syscon_get_ops(dev) ((struct syscon_ops *)(dev)->driver->ops)
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+/*
+ * We don't support 64-bit machines. If they are so resource-contrained that
+ * they need to use OF_PLATDATA, something is horribly wrong with the
+ * education of our hardware engineers.
+ */
+struct syscon_base_platdata {
+ u32 reg[2];
+};
+#endif
+
/**
* syscon_get_regmap() - Get access to a register map
*