summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bootstrap.h11
-rw-r--r--include/driver.h5
-rw-r--r--include/led.h3
-rw-r--r--include/linux/barebox-wrapper.h4
-rw-r--r--include/of.h19
5 files changed, 33 insertions, 9 deletions
diff --git a/include/bootstrap.h b/include/bootstrap.h
index 28852c0cb6..d3ee6be47c 100644
--- a/include/bootstrap.h
+++ b/include/bootstrap.h
@@ -11,13 +11,14 @@
#define bootstrap_err(fmt, arg...) printf(fmt, ##arg)
-void bootstrap_boot(int (*func)(void), bool barebox);
+typedef void (*kernel_entry_func)(int zero, int arch, void *params);
+void bootstrap_boot(kernel_entry_func func, bool barebox);
#ifdef CONFIG_BOOTSTRAP_DEVFS
-void* bootstrap_read_devfs(char *devname, bool use_bb, int offset,
+void* bootstrap_read_devfs(const char *devname, bool use_bb, int offset,
int default_size, int max_size);
#else
-static inline void* bootstrap_read_devfs(char *devname, bool use_bb, int offset,
+static inline void* bootstrap_read_devfs(const char *devname, bool use_bb, int offset,
int default_size, int max_size)
{
return NULL;
@@ -25,9 +26,9 @@ static inline void* bootstrap_read_devfs(char *devname, bool use_bb, int offset,
#endif
#ifdef CONFIG_BOOTSTRAP_DISK
-void* bootstrap_read_disk(char *devname, char *fstype);
+void* bootstrap_read_disk(const char *devname, const char *fstype);
#else
-static inline void* bootstrap_read_disk(char *devname, char *fstype)
+static inline void* bootstrap_read_disk(const char *devname, const char *fstype)
{
return NULL;
}
diff --git a/include/driver.h b/include/driver.h
index 046dd9079d..31c673452f 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -450,13 +450,18 @@ struct cdev {
int open;
struct mtd_info *mtd;
u8 dos_partition_type;
+ struct cdev *link;
+ struct list_head link_entry, links;
};
int devfs_create(struct cdev *);
+int devfs_create_link(struct cdev *, const char *name);
int devfs_remove(struct cdev *);
int cdev_find_free_index(const char *);
struct cdev *device_find_partition(struct device_d *dev, const char *name);
struct cdev *cdev_by_name(const char *filename);
+struct cdev *lcdev_by_name(const char *filename);
+struct cdev *cdev_readlink(struct cdev *cdev);
struct cdev *cdev_by_device_node(struct device_node *node);
struct cdev *cdev_open(const char *name, unsigned long flags);
int cdev_do_open(struct cdev *, unsigned long flags);
diff --git a/include/led.h b/include/led.h
index ddf8d90084..000267cdc5 100644
--- a/include/led.h
+++ b/include/led.h
@@ -1,7 +1,10 @@
#ifndef __LED_H
#define __LED_H
+#include <linux/list.h>
+
#include <errno.h>
+#include <of.h>
struct led {
void (*set)(struct led *, unsigned int value);
diff --git a/include/linux/barebox-wrapper.h b/include/linux/barebox-wrapper.h
index 3859185186..5fe7971018 100644
--- a/include/linux/barebox-wrapper.h
+++ b/include/linux/barebox-wrapper.h
@@ -39,8 +39,8 @@ typedef int spinlock_t;
#define spin_lock_init(...)
#define spin_lock(...)
#define spin_unlock(...)
-static inline void spin_lock_irqsave(spinlock_t *lock, unsigned long flags) {}
-static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) {}
+#define spin_lock_irqsave(lock, flags) do { flags = 0; } while (0)
+#define spin_unlock_irqrestore(lock, flags) do { flags = flags; } while (0)
#define mutex_init(...)
#define mutex_lock(...)
diff --git a/include/of.h b/include/of.h
index e60fe89825..75cc3c11c1 100644
--- a/include/of.h
+++ b/include/of.h
@@ -641,9 +641,13 @@ static inline struct device_node *of_find_node_by_path_or_alias(
#define for_each_node_by_name_from(dn, root, name) \
for (dn = of_find_node_by_name(root, name); dn; \
dn = of_find_node_by_name(dn, name))
-#define for_each_compatible_node(dn, type, compatible) \
- for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
+/* Iterate over compatible nodes starting from given root */
+#define for_each_compatible_node_from(dn, root, type, compatible) \
+ for (dn = of_find_compatible_node(root, type, compatible); dn; \
dn = of_find_compatible_node(dn, type, compatible))
+/* Iterate over compatible nodes in default device tree */
+#define for_each_compatible_node(dn, type, compatible) \
+ for_each_compatible_node_from(dn, NULL, type, compatible)
static inline struct device_node *of_find_matching_node(
struct device_node *from,
const struct of_device_id *matches)
@@ -732,6 +736,17 @@ static inline int of_property_read_u32(const struct device_node *np,
s; \
s = of_prop_next_string(prop, s))
+/*
+ * struct device_node *n;
+ *
+ * of_property_for_each_phandle(np, root, "propname", n)
+ * printk("phandle points to: %s\n", n->full_name);
+ */
+#define of_property_for_each_phandle(np, root, propname, n) \
+ for (int _i = 0; \
+ (n = of_parse_phandle_from(np, root, propname, _i));\
+ _i++)
+
static inline int of_property_write_u8(struct device_node *np,
const char *propname, u8 value)
{