summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/barebox.lds.h13
-rw-r--r--include/byteorder.h24
-rw-r--r--include/common.h3
-rw-r--r--include/driver.h3
-rw-r--r--include/envfs.h36
-rw-r--r--include/filetype.h1
-rw-r--r--include/fs.h6
-rw-r--r--include/gpio_keys.h7
-rw-r--r--include/input/keyboard.h10
-rw-r--r--include/linux/mbus.h61
-rw-r--r--include/linux/mtd/mtd.h5
-rw-r--r--include/linux/mtd/nand.h3
-rw-r--r--include/linux/phy.h14
-rw-r--r--include/mfd/mc13xxx.h11
-rw-r--r--include/net.h22
-rw-r--r--include/readkey.h34
-rw-r--r--include/usb/dfu.h3
17 files changed, 217 insertions, 39 deletions
diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
index 6d3a69ef20..5dabda3fbb 100644
--- a/include/asm-generic/barebox.lds.h
+++ b/include/asm-generic/barebox.lds.h
@@ -60,6 +60,13 @@ CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE < CONFIG_BAREBOX_MAX_BARE_INIT_SIZE
#define MAX_BARE_INIT_SIZE CONFIG_BAREBOX_MAX_BARE_INIT_SIZE
#endif
+#if defined(CONFIG_ARCH_BAREBOX_MAX_PBL_SIZE) && \
+CONFIG_ARCH_BAREBOX_MAX_PBL_SIZE < CONFIG_BAREBOX_MAX_PBL_SIZE
+#define MAX_PBL_SIZE CONFIG_ARCH_BAREBOX_MAX_PBL_SIZE
+#else
+#define MAX_PBL_SIZE CONFIG_BAREBOX_MAX_PBL_SIZE
+#endif
+
#include <linux/stringify.h>
/* use 2 ASSERT because ld can not accept '"size" "10"' format */
#define BAREBOX_BARE_INIT_SIZE \
@@ -67,3 +74,9 @@ CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE < CONFIG_BAREBOX_MAX_BARE_INIT_SIZE
ASSERT(_barebox_bare_init_size < MAX_BARE_INIT_SIZE, "Barebox bare_init size > ") \
ASSERT(_barebox_bare_init_size < MAX_BARE_INIT_SIZE, __stringify(MAX_BARE_INIT_SIZE)) \
+#define BAREBOX_PBL_SIZE \
+ _barebox_pbl_size = __bss_start - _text; \
+ ASSERT(MAX_BARE_INIT_SIZE <= MAX_PBL_SIZE, "bare_init cannot be bigger than pbl") \
+ ASSERT(_barebox_pbl_size < MAX_PBL_SIZE, "Barebox pbl size > ") \
+ ASSERT(_barebox_pbl_size < MAX_PBL_SIZE, __stringify(MAX_PBL_SIZE)) \
+
diff --git a/include/byteorder.h b/include/byteorder.h
new file mode 100644
index 0000000000..4b255a5fab
--- /dev/null
+++ b/include/byteorder.h
@@ -0,0 +1,24 @@
+#ifndef __BYTEORDER_H__
+#define __BYTEORDER_H__
+
+/*
+ * The standard macros for converting between host and network byte order are
+ * badly named. So ntohl converts 32 bits even on architectures where a long is
+ * 64 bit wide although the 'l' suffix suggests that it's working on longs.
+ *
+ * So this file introduces variants that use the bitcount as suffix instead of
+ * 's' or 'l'.
+ */
+
+#include <asm/byteorder.h>
+
+#define ntoh16(x) __be16_to_cpu(x)
+#define hton16(x) __cpu_to_be16(x)
+
+#define ntoh32(x) __be32_to_cpu(x)
+#define hton32(x) __cpu_to_be32(x)
+
+#define ntoh64(x) __be64_to_cpu(x)
+#define hton64(x) __cpu_to_be64(x)
+
+#endif /* __BYTEORDER_H__ */
diff --git a/include/common.h b/include/common.h
index 293f5041af..6987b4f16d 100644
--- a/include/common.h
+++ b/include/common.h
@@ -92,8 +92,7 @@ void __noreturn panic(const char *fmt, ...);
char *size_human_readable(unsigned long long size);
-/* common/main.c */
-int run_command (const char *cmd, int flag);
+int run_command(const char *cmd);
int readline (const char *prompt, char *buf, int len);
/* common/memsize.c */
diff --git a/include/driver.h b/include/driver.h
index 31bdecf6d8..01b181ddbd 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -529,5 +529,6 @@ int devfs_create_partitions(const char *devname,
int dev_get_drvdata(struct device_d *dev, unsigned long *data);
-#endif /* DRIVER_H */
+int device_match_of_modalias(struct device_d *dev, struct driver_d *drv);
+#endif /* DRIVER_H */
diff --git a/include/envfs.h b/include/envfs.h
index f8b24eda39..ae98808ede 100644
--- a/include/envfs.h
+++ b/include/envfs.h
@@ -3,6 +3,7 @@
#ifdef __BAREBOX__
#include <asm/byteorder.h>
+#include <linux/stringify.h>
#endif
#define ENVFS_MAJOR 1
@@ -90,8 +91,9 @@ struct envfs_super {
#endif
#define ENV_FLAG_NO_OVERWRITE (1 << 0)
-int envfs_load(const char *filename, char *dirname, unsigned flags);
-int envfs_save(const char *filename, char *dirname);
+int envfs_load(const char *filename, const char *dirname, unsigned flags);
+int envfs_save(const char *filename, const char *dirname);
+int envfs_load_from_buf(void *buf, int len, const char *dir, unsigned flags);
/* defaults to /dev/env0 */
#ifdef CONFIG_ENV_HANDLING
@@ -110,4 +112,34 @@ static inline char *default_environment_path_get(void)
int envfs_register_partition(const char *devname, unsigned int partnr);
+#ifdef CONFIG_DEFAULT_ENVIRONMENT
+void defaultenv_append(void *buf, unsigned int size, const char *name);
+int defaultenv_load(const char *dir, unsigned flags);
+#else
+static inline void defaultenv_append(void *buf, unsigned int size, const char *name)
+{
+}
+
+static inline int defaultenv_load(const char *dir, unsigned flags)
+{
+ return -ENOSYS;
+}
+#endif
+
+/*
+ * Append environment directory compiled into barebox with bbenv-y
+ * to the default environment. The symbol is generated from the filename
+ * during the build process. Replace '-' with '_' to get the name
+ * from the filename.
+ */
+#define defaultenv_append_directory(name) \
+ { \
+ extern char __bbenv_##name##_start[]; \
+ extern char __bbenv_##name##_end[]; \
+ defaultenv_append(__bbenv_##name##_start, \
+ __bbenv_##name##_end - \
+ __bbenv_##name##_start, \
+ __stringify(name)); \
+ }
+
#endif /* _ENVFS_H */
diff --git a/include/filetype.h b/include/filetype.h
index ffefe1c905..c20a4f9395 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -29,6 +29,7 @@ enum filetype {
filetype_gpt,
filetype_ubifs,
filetype_bpk,
+ filetype_barebox_env,
filetype_max,
};
diff --git a/include/fs.h b/include/fs.h
index 856e00abb0..073641c747 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -99,6 +99,7 @@ struct fs_device_d {
char *path;
struct device_d *parent_device;
struct list_head list;
+ char *options;
};
#define drv_to_fs_driver(d) container_of(d, struct fs_driver_d, drv)
@@ -140,7 +141,8 @@ int closedir(DIR *dir);
int symlink(const char *pathname, const char *newpath);
int readlink(const char *path, char *buf, size_t bufsiz);
-int mount (const char *device, const char *fsname, const char *path);
+int mount (const char *device, const char *fsname, const char *path,
+ const char *fsoptions);
int umount(const char *pathname);
/* not-so-standard functions */
@@ -197,7 +199,7 @@ int unlink_recursive(const char *path, char **failedpath);
int fsdev_open_cdev(struct fs_device_d *fsdev);
const char *cdev_get_mount_path(struct cdev *cdev);
-const char *cdev_mount_default(struct cdev *cdev);
+const char *cdev_mount_default(struct cdev *cdev, const char *fsoptions);
void mount_all(void);
#endif /* __FS_H */
diff --git a/include/gpio_keys.h b/include/gpio_keys.h
index fc548fabcd..f4a22e16db 100644
--- a/include/gpio_keys.h
+++ b/include/gpio_keys.h
@@ -10,9 +10,6 @@ struct gpio_keys_button {
int gpio;
int active_low;
-
- /* internal */
- int previous_state;
};
struct gpio_keys_platform_data {
@@ -21,10 +18,6 @@ struct gpio_keys_platform_data {
/* optional */
int fifo_size;
-
- struct kfifo *recv_fifo;
- struct poller_struct poller;
- struct console_device cdev;
};
#endif
diff --git a/include/input/keyboard.h b/include/input/keyboard.h
new file mode 100644
index 0000000000..dd04690304
--- /dev/null
+++ b/include/input/keyboard.h
@@ -0,0 +1,10 @@
+#ifndef __INPUT_KEYBOARD_H
+#define __INPUT_KEYBOARD_H
+
+#include <linux/types.h>
+
+#define NR_KEYS 256
+
+extern uint8_t keycode_bb_keys[NR_KEYS];
+
+#endif
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
new file mode 100644
index 0000000000..578ff33146
--- /dev/null
+++ b/include/linux/mbus.h
@@ -0,0 +1,61 @@
+/*
+ * Marvell MBUS common definitions.
+ *
+ * Copyright (C) 2008 Marvell Semiconductor
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef __LINUX_MBUS_H
+#define __LINUX_MBUS_H
+
+struct resource;
+
+struct mbus_dram_target_info {
+ /*
+ * The 4-bit MBUS target ID of the DRAM controller.
+ */
+ u8 mbus_dram_target_id;
+
+ /*
+ * The base address, size, and MBUS attribute ID for each
+ * of the possible DRAM chip selects. Peripherals are
+ * required to support at least 4 decode windows.
+ */
+ int num_cs;
+ struct mbus_dram_window {
+ u8 cs_index;
+ u8 mbus_attr;
+ u32 base;
+ u32 size;
+ } cs[4];
+};
+
+/* Flags for PCI/PCIe address decoding regions */
+#define MVEBU_MBUS_PCI_IO 0x1
+#define MVEBU_MBUS_PCI_MEM 0x2
+#define MVEBU_MBUS_PCI_WA 0x3
+
+/*
+ * Magic value that explicits that we don't need a remapping-capable
+ * address decoding window.
+ */
+#define MVEBU_MBUS_NO_REMAP (0xffffffff)
+
+/* Maximum size of a mbus window name */
+#define MVEBU_MBUS_MAX_WINNAME_SZ 32
+
+const struct mbus_dram_target_info *mvebu_mbus_dram_info(void);
+void mvebu_mbus_get_pcie_mem_aperture(struct resource *res);
+void mvebu_mbus_get_pcie_io_aperture(struct resource *res);
+int mvebu_mbus_add_window_remap_by_id(unsigned int target,
+ unsigned int attribute,
+ phys_addr_t base, size_t size,
+ phys_addr_t remap);
+int mvebu_mbus_add_window_by_id(unsigned int target, unsigned int attribute,
+ phys_addr_t base, size_t size);
+int mvebu_mbus_del_window(phys_addr_t base, size_t size);
+
+#endif /* __LINUX_MBUS_H */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 402e4978b1..e02204a503 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -217,6 +217,9 @@ struct mtd_info {
/* If true erasing bad blocks is allowed, this is set via a device parameter */
bool allow_erasebad;
int p_allow_erasebad;
+
+ struct mtd_info *master;
+ uint32_t master_offset;
};
int mtd_erase(struct mtd_info *mtd, struct erase_info *instr);
@@ -272,7 +275,7 @@ struct mtd_notifier {
struct mtd_info *mtd_add_partition(struct mtd_info *mtd, off_t offset, size_t size,
unsigned long flags, const char *name);
-void mtd_del_partition(struct mtd_info *mtd);
+int mtd_del_partition(struct mtd_info *mtd);
extern void register_mtd_user (struct mtd_notifier *new);
extern int unregister_mtd_user (struct mtd_notifier *old);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 74ea0b4e02..3c7509f9af 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -162,7 +162,8 @@ typedef enum {
#define NAND_ROM 0x00000800
/* Device supports subpage reads */
-#define NAND_SUBPAGE_READ 0x00001000
+/* Disabled in barebox for smaller binary sizes */
+#define NAND_SUBPAGE_READ (__BAREBOX__ ? 0x0 : 0x00001000)
/* Options valid for Samsung large page devices */
#define NAND_SAMSUNG_LP_OPTIONS NAND_CACHEPRG
diff --git a/include/linux/phy.h b/include/linux/phy.h
index c8980b0191..9567c43e38 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -280,6 +280,20 @@ int phy_device_connect(struct eth_device *dev, struct mii_bus *bus, int addr,
void (*adjust_link) (struct eth_device *edev),
u32 flags, phy_interface_t interface);
+#if defined(CONFIG_OFTREE)
+int of_phy_device_connect(struct eth_device *edev, struct device_node *phy_np,
+ void (*adjust_link) (struct eth_device *edev),
+ u32 flags, phy_interface_t interface);
+#else
+static inline int of_phy_device_connect(struct eth_device *edev,
+ struct device_node *phy_np,
+ void (*adjust_link) (struct eth_device *edev),
+ u32 flags, phy_interface_t interface)
+{
+ return -ENOSYS;
+}
+#endif
+
int phy_update_status(struct phy_device *phydev);
int phy_wait_aneg_done(struct phy_device *phydev);
diff --git a/include/mfd/mc13xxx.h b/include/mfd/mc13xxx.h
index cba85890c1..1946b1a1c3 100644
--- a/include/mfd/mc13xxx.h
+++ b/include/mfd/mc13xxx.h
@@ -152,6 +152,17 @@
#define MC13783_SW1B_SOFTSTART (1 << 17)
#define MC13783_SW_PLL_FACTOR(x) (((x) - 28) << 19)
+/* MC34708 Definitions */
+#define SWx_VOLT_MASK_MC34708 0x3F
+#define SWx_1_250V_MC34708 0x30
+#define SWx_1_300V_MC34708 0x34
+#define TIMER_MASK_MC34708 0x300
+#define TIMER_4S_MC34708 0x100
+#define VUSBSEL_MC34708 (1 << 2)
+#define VUSBEN_MC34708 (1 << 3)
+#define SWBST_CTRL 31
+#define SWBST_AUTO 0x8
+
struct mc13xxx;
#ifdef CONFIG_MFD_MC13XXX
diff --git a/include/net.h b/include/net.h
index a4cfec7123..3b800b78f0 100644
--- a/include/net.h
+++ b/include/net.h
@@ -269,11 +269,18 @@ static inline IPaddr_t net_read_ip(void *from)
}
/* return uint32 *in network byteorder* */
-static inline uint32_t net_read_uint32(uint32_t *from)
+static inline uint32_t net_read_uint32(void *from)
{
- ulong l;
- memcpy((void*)&l, (void*)from, sizeof(l));
- return l;
+ uint32_t tmp;
+ memcpy(&tmp, from, sizeof(tmp));
+ return tmp;
+}
+
+static inline uint64_t net_read_uint64(void *from)
+{
+ uint64_t tmp;
+ memcpy(&tmp, from, sizeof(tmp));
+ return tmp;
}
/* write IP *in network byteorder* */
@@ -397,7 +404,7 @@ typedef void rx_handler_f(void *ctx, char *packet, unsigned int len);
void eth_set_current(struct eth_device *eth);
struct eth_device *eth_get_current(void);
-struct eth_device *eth_get_byname(char *name);
+struct eth_device *eth_get_byname(const char *name);
/**
* net_receive - Pass a received packet from an ethernet driver to the protocol stack
@@ -450,4 +457,9 @@ int net_icmp_send(struct net_connection *con, int len);
void led_trigger_network(enum led_trigger trigger);
+#define IFUP_FLAG_FORCE (1 << 0)
+
+int ifup(const char *name, unsigned flags);
+int ifup_all(unsigned flags);
+
#endif /* __NET_H__ */
diff --git a/include/readkey.h b/include/readkey.h
index 2793f3f70b..8398ec2e51 100644
--- a/include/readkey.h
+++ b/include/readkey.h
@@ -4,25 +4,25 @@
#define CTL_CH(c) ((c) - 'a' + 1)
/* Ascii keys */
-#define KEY_ENTER '\n'
-#define KEY_RETURN '\r'
+#define BB_KEY_ENTER '\n'
+#define BB_KEY_RETURN '\r'
/* Misc. non-Ascii keys */
-#define KEY_UP CTL_CH('p') /* cursor key Up */
-#define KEY_DOWN CTL_CH('n') /* cursor key Down */
-#define KEY_RIGHT CTL_CH('f') /* Cursor Key Right */
-#define KEY_LEFT CTL_CH('b') /* cursor key Left */
-#define KEY_HOME CTL_CH('a') /* Cursor Key Home */
-#define KEY_ERASE_TO_EOL CTL_CH('k')
-#define KEY_REFRESH_TO_EOL CTL_CH('e')
-#define KEY_ERASE_LINE CTL_CH('x')
-#define KEY_INSERT CTL_CH('o')
-#define KEY_CLEAR_SCREEN CTL_CH('l')
-#define KEY_DEL7 127
-#define KEY_END 133 /* Cursor Key End */
-#define KEY_PAGEUP 135 /* Cursor Key Page Up */
-#define KEY_PAGEDOWN 136 /* Cursor Key Page Down */
-#define KEY_DEL 137 /* Cursor Key Del */
+#define BB_KEY_UP CTL_CH('p') /* cursor key Up */
+#define BB_KEY_DOWN CTL_CH('n') /* cursor key Down */
+#define BB_KEY_RIGHT CTL_CH('f') /* Cursor Key Right */
+#define BB_KEY_LEFT CTL_CH('b') /* cursor key Left */
+#define BB_KEY_HOME CTL_CH('a') /* Cursor Key Home */
+#define BB_KEY_ERASE_TO_EOL CTL_CH('k')
+#define BB_KEY_REFRESH_TO_EOL CTL_CH('e')
+#define BB_KEY_ERASE_LINE CTL_CH('x')
+#define BB_KEY_INSERT CTL_CH('o')
+#define BB_KEY_CLEAR_SCREEN CTL_CH('l')
+#define BB_KEY_DEL7 127
+#define BB_KEY_END 133 /* Cursor Key End */
+#define BB_KEY_PAGEUP 135 /* Cursor Key Page Up */
+#define BB_KEY_PAGEDOWN 136 /* Cursor Key Page Down */
+#define BB_KEY_DEL 137 /* Cursor Key Del */
#define ANSI_CLEAR_SCREEN "\e[2J\e[;H"
diff --git a/include/usb/dfu.h b/include/usb/dfu.h
index 698ba9d5a1..df4f2fd4d6 100644
--- a/include/usb/dfu.h
+++ b/include/usb/dfu.h
@@ -22,8 +22,9 @@
#include <linux/types.h>
-#define DFU_FLAG_SAVE (1 << 0)
+#define DFU_FLAG_SAFE (1 << 0)
#define DFU_FLAG_READBACK (1 << 1)
+#define DFU_FLAG_CREATE (1 << 2)
struct usb_dfu_dev {
char *name;