diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-09-12 07:53:05 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-09-12 07:53:05 +0200 |
commit | 9b1102c02bfd39352e0d2995c733edb7be3b0601 (patch) | |
tree | 3f089c640bab75c020b69f5dcf44d744a0a7f2e4 /include | |
parent | f48a1596f4e911d4516b986e4778f18321b39b48 (diff) | |
parent | a10dbfc4175867c0d15f02b7f244837c5d41478e (diff) | |
download | barebox-9b1102c02bfd39352e0d2995c733edb7be3b0601.tar.gz barebox-9b1102c02bfd39352e0d2995c733edb7be3b0601.tar.xz |
Merge branch 'for-next/misc'
Diffstat (limited to 'include')
-rw-r--r-- | include/ata_drive.h | 4 | ||||
-rw-r--r-- | include/console.h | 2 | ||||
-rw-r--r-- | include/elf.h | 29 | ||||
-rw-r--r-- | include/gpio.h | 18 | ||||
-rw-r--r-- | include/linux/mfd/rave-sp.h | 1 | ||||
-rw-r--r-- | include/mci.h | 1 | ||||
-rw-r--r-- | include/param.h | 2 |
7 files changed, 52 insertions, 5 deletions
diff --git a/include/ata_drive.h b/include/ata_drive.h index 11685eef12..d61c6f11d4 100644 --- a/include/ata_drive.h +++ b/include/ata_drive.h @@ -14,7 +14,7 @@ */ #ifndef ATA_DISK_H -# define ATA_DISK +#define ATA_DISK_H #include <block.h> @@ -197,4 +197,4 @@ struct device_d; * 0x400 data data 16 bit area with 1 kiB in size */ -#endif /* ATA_DISK */ +#endif /* ATA_DISK_H */ diff --git a/include/console.h b/include/console.h index 4062e5abf6..7afe59e93a 100644 --- a/include/console.h +++ b/include/console.h @@ -42,7 +42,7 @@ struct console_device { int (*tstc)(struct console_device *cdev); void (*putc)(struct console_device *cdev, char c); - int (*puts)(struct console_device *cdev, const char *s); + int (*puts)(struct console_device *cdev, const char *s, size_t nbytes); int (*getc)(struct console_device *cdev); int (*setbrg)(struct console_device *cdev, int baudrate); void (*flush)(struct console_device *cdev); diff --git a/include/elf.h b/include/elf.h index 92c8d9c127..633f4992dd 100644 --- a/include/elf.h +++ b/include/elf.h @@ -400,11 +400,38 @@ static inline void arch_write_notes(struct file *file) { } struct elf_image { struct list_head list; - unsigned long entry; + u8 class; + u64 entry; void *buf; }; struct elf_image *elf_load_image(void *buf); void elf_release_image(struct elf_image *elf); +#define ELF_GET_FIELD(__s, __field, __type) \ +static inline __type elf_##__s##_##__field(struct elf_image *elf, void *arg) { \ + if (elf->class == ELFCLASS32) \ + return (__type) ((struct elf32_##__s *) arg)->__field; \ + else \ + return (__type) ((struct elf64_##__s *) arg)->__field; \ +} + +ELF_GET_FIELD(hdr, e_entry, u64) +ELF_GET_FIELD(hdr, e_phnum, u16) +ELF_GET_FIELD(hdr, e_phoff, u64) +ELF_GET_FIELD(hdr, e_type, u16) +ELF_GET_FIELD(phdr, p_paddr, u64) +ELF_GET_FIELD(phdr, p_filesz, u64) +ELF_GET_FIELD(phdr, p_memsz, u64) +ELF_GET_FIELD(phdr, p_type, u32) +ELF_GET_FIELD(phdr, p_offset, u64) + +static inline unsigned long elf_size_of_phdr(struct elf_image *elf) +{ + if (elf->class == ELFCLASS32) + return sizeof(Elf32_Phdr); + else + return sizeof(Elf64_Phdr); +} + #endif /* _LINUX_ELF_H */ diff --git a/include/gpio.h b/include/gpio.h index 1926edeca7..4d5f2c25c7 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -3,6 +3,7 @@ #include <linux/types.h> #include <linux/list.h> +#include <linux/iopoll.h> #ifdef CONFIG_GENERIC_GPIO void gpio_set_value(unsigned gpio, int value); @@ -31,6 +32,21 @@ static inline int gpio_direction_input(unsigned gpio) void gpio_set_active(unsigned gpio, bool state); int gpio_is_active(unsigned gpio); int gpio_direction_active(unsigned gpio, bool state); + +/** + * gpio_poll_timeout_us - Poll till GPIO reaches requested active state + * @gpio: gpio to poll + * @active: wait till GPIO is active if true, wait till it's inactive if false + * @timeout_us: timeout in microseconds + * + * During the wait barebox pollers are called, if any. + */ +#define gpio_poll_timeout_us(gpio, active, timeout_us) \ + ({ \ + int __state; \ + readx_poll_timeout(gpio_is_active, gpio, __state, \ + __state == (active), timeout_us); \ + }) #else static inline void gpio_set_active(unsigned gpio, int value) { @@ -43,6 +59,8 @@ static inline int gpio_direction_active(unsigned gpio, int value) { return -EINVAL; } + +#define gpio_poll_timeout_us(gpio, val, timeout_us) (-ENOSYS) #endif #if defined(CONFIG_ARCH_NR_GPIO) && CONFIG_ARCH_NR_GPIO > 0 diff --git a/include/linux/mfd/rave-sp.h b/include/linux/mfd/rave-sp.h index 7b3187cb74..92315c6e12 100644 --- a/include/linux/mfd/rave-sp.h +++ b/include/linux/mfd/rave-sp.h @@ -14,6 +14,7 @@ enum rave_sp_command { RAVE_SP_CMD_GET_FIRMWARE_VERSION = 0x20, RAVE_SP_CMD_GET_BOOTLOADER_VERSION = 0x21, + RAVE_SP_CMD_GET_OPERATIONAL_MODE = 0x25, RAVE_SP_CMD_BOOT_SOURCE = 0x26, RAVE_SP_CMD_GET_BOARD_COPPER_REV = 0x2B, RAVE_SP_CMD_GET_GPIO_STATE = 0x2F, diff --git a/include/mci.h b/include/mci.h index 072008ef9d..77625ea8e9 100644 --- a/include/mci.h +++ b/include/mci.h @@ -164,6 +164,7 @@ #define EXT_CSD_EXT_PARTITIONS_ATTRIBUTE 52 /* R/W, 2 bytes */ #define EXT_CSD_EXCEPTION_EVENTS_STATUS 54 /* RO, 2 bytes */ #define EXT_CSD_EXCEPTION_EVENTS_CTRL 56 /* R/W, 2 bytes */ +#define EXT_CSD_EXCEPTION_DYNCAP_NEEDED 58 /* RO, 1 byte */ #define EXT_CSD_CLASS_6_CTRL 59 /* R/W */ #define EXT_CSD_INI_TIMEOUT_EMU 60 /* RO */ #define EXT_CSD_DATA_SECTOR_SIZE 61 /* RO */ diff --git a/include/param.h b/include/param.h index b618a2305d..dea6990497 100644 --- a/include/param.h +++ b/include/param.h @@ -272,7 +272,7 @@ static inline struct param_d *dev_add_param_string_ro(struct device_d *dev, cons } static inline struct param_d *dev_add_param_string_fixed(struct device_d *dev, const char *name, - char *value) + const char *value) { return dev_add_param_fixed(dev, name, value); } |