diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/abort.h | 4 | ||||
-rw-r--r-- | include/ata_drive.h | 4 | ||||
-rw-r--r-- | include/common.h | 4 | ||||
-rw-r--r-- | include/console.h | 2 | ||||
-rw-r--r-- | include/elf.h | 29 | ||||
-rw-r--r-- | include/fdt.h | 69 | ||||
-rw-r--r-- | include/gpio.h | 18 | ||||
-rw-r--r-- | include/i2c/i2c.h | 20 | ||||
-rw-r--r-- | include/linux/libfdt.h | 8 | ||||
-rw-r--r-- | include/linux/libfdt_env.h | 19 | ||||
-rw-r--r-- | include/linux/mfd/rave-sp.h | 1 | ||||
-rw-r--r-- | include/linux/mtd/mtd-abi.h | 2 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 7 | ||||
-rw-r--r-- | include/linux/mtd/spi-nor.h | 1 | ||||
-rw-r--r-- | include/mci.h | 1 | ||||
-rw-r--r-- | include/mtd/mtd-peb.h | 2 | ||||
-rw-r--r-- | include/param.h | 2 | ||||
-rw-r--r-- | include/pbl.h | 2 | ||||
-rw-r--r-- | include/platform_data/elm.h | 53 | ||||
-rw-r--r-- | include/reset_source.h | 46 |
20 files changed, 198 insertions, 96 deletions
diff --git a/include/abort.h b/include/abort.h index 326467c25f..89ee549e34 100644 --- a/include/abort.h +++ b/include/abort.h @@ -1,9 +1,7 @@ #ifndef __ABORT_H #define __ABORT_H -#include <asm/barebox.h> - -#if defined ARCH_HAS_DATA_ABORT_MASK && !defined __PBL__ +#if defined CONFIG_ARCH_HAS_DATA_ABORT_MASK && !defined __PBL__ /* * data_abort_mask - ignore data aborts 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/common.h b/include/common.h index 8cc8e14fb7..6563068467 100644 --- a/include/common.h +++ b/include/common.h @@ -51,8 +51,6 @@ #error "None of __LITTLE_ENDIAN and __BIG_ENDIAN are defined" #endif -#include <asm/barebox.h> /* boot information for Linux kernel */ - /* * Function Prototypes */ @@ -72,7 +70,7 @@ int ctrlc(void); int arch_ctrlc(void); void ctrlc_handled(void); -#ifdef ARCH_HAS_STACK_DUMP +#ifdef CONFIG_ARCH_HAS_STACK_DUMP void dump_stack(void); #else static inline void dump_stack(void) 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/fdt.h b/include/fdt.h index 1ccd4c6734..38a2d27b02 100644 --- a/include/fdt.h +++ b/include/fdt.h @@ -3,73 +3,6 @@ #include <linux/types.h> -#ifndef __ASSEMBLY__ - -#define _B(n) ((unsigned long long)((uint8_t *)&x)[n]) - -#define fdt32_to_cpu(x) be32_to_cpu(x) -#define cpu_to_fdt32(x) cpu_to_be32(x) - -static inline uint64_t fdt64_to_cpu(uint64_t x) -{ - return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32) - | (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7); -} -#define cpu_to_fdt64(x) fdt64_to_cpu(x) -#undef _B - -struct fdt_header { - uint32_t magic; /* magic word FDT_MAGIC */ - uint32_t totalsize; /* total size of DT block */ - uint32_t off_dt_struct; /* offset to structure */ - uint32_t off_dt_strings; /* offset to strings */ - uint32_t off_mem_rsvmap; /* offset to memory reserve map */ - uint32_t version; /* format version */ - uint32_t last_comp_version; /* last compatible version */ - - /* version 2 fields below */ - uint32_t boot_cpuid_phys; /* Which physical CPU id we're - booting on */ - /* version 3 fields below */ - uint32_t size_dt_strings; /* size of the strings block */ - - /* version 17 fields below */ - uint32_t size_dt_struct; /* size of the structure block */ -}; - -struct fdt_reserve_entry { - uint64_t address; - uint64_t size; -}; - -struct fdt_node_header { - uint32_t tag; - char name[0]; -}; - -struct fdt_property { - uint32_t tag; - uint32_t len; - uint32_t nameoff; - char data[0]; -}; - -#endif /* !__ASSEMBLY */ - -#define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ -#define FDT_TAGSIZE sizeof(uint32_t) - -#define FDT_BEGIN_NODE 0x1 /* Start node: full name */ -#define FDT_END_NODE 0x2 /* End node */ -#define FDT_PROP 0x3 /* Property: name off, - size, content */ -#define FDT_NOP 0x4 /* nop */ -#define FDT_END 0x9 - -#define FDT_V1_SIZE (7*sizeof(uint32_t)) -#define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(uint32_t)) -#define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(uint32_t)) -#define FDT_V16_SIZE FDT_V3_SIZE -#define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(uint32_t)) +#include <linux/libfdt.h> #endif /* _FDT_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/i2c/i2c.h b/include/i2c/i2c.h index 17b507ca22..a694e4ab2f 100644 --- a/include/i2c/i2c.h +++ b/include/i2c/i2c.h @@ -239,6 +239,24 @@ struct i2c_board_info { }; /** + * struct i2c_timings - I2C timing information + * @bus_freq_hz: the bus frequency in Hz + * @scl_rise_ns: time SCL signal takes to rise in ns; t(r) in the I2C specification + * @scl_fall_ns: time SCL signal takes to fall in ns; t(f) in the I2C specification + * @scl_int_delay_ns: time IP core additionally needs to setup SCL in ns + * @sda_fall_ns: time SDA signal takes to fall in ns; t(f) in the I2C specification + * @sda_hold_ns: time IP core additionally needs to hold SDA in ns + */ +struct i2c_timings { + u32 bus_freq_hz; + u32 scl_rise_ns; + u32 scl_fall_ns; + u32 scl_int_delay_ns; + u32 sda_fall_ns; + u32 sda_hold_ns; +}; + +/** * I2C_BOARD_INFO - macro used to list an i2c device and its address * @dev_type: identifies the device type * @dev_addr: the device's address on the bus. @@ -264,6 +282,8 @@ extern int i2c_add_numbered_adapter(struct i2c_adapter *adapter); struct i2c_adapter *i2c_get_adapter(int busnum); struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node); +void i2c_parse_fw_timings(struct device_d *dev, struct i2c_timings *t, bool use_defaults); + extern struct list_head i2c_adapter_list; #define for_each_i2c_adapter(adap) \ list_for_each_entry(adap, &i2c_adapter_list, list) diff --git a/include/linux/libfdt.h b/include/linux/libfdt.h new file mode 100644 index 0000000000..ef2467213b --- /dev/null +++ b/include/linux/libfdt.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _INCLUDE_LIBFDT_H_ +#define _INCLUDE_LIBFDT_H_ + +#include <linux/libfdt_env.h> +#include "../scripts/dtc/libfdt/libfdt.h" + +#endif /* _INCLUDE_LIBFDT_H_ */ diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h new file mode 100644 index 0000000000..edb0f0c309 --- /dev/null +++ b/include/linux/libfdt_env.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef LIBFDT_ENV_H +#define LIBFDT_ENV_H + +#include <linux/kernel.h> /* For INT_MAX */ +#include <linux/string.h> + +#include <asm/byteorder.h> + +typedef __be16 fdt16_t; +typedef __be32 fdt32_t; +typedef __be64 fdt64_t; + +#define fdt32_to_cpu(x) be32_to_cpu(x) +#define cpu_to_fdt32(x) cpu_to_be32(x) +#define fdt64_to_cpu(x) be64_to_cpu(x) +#define cpu_to_fdt64(x) cpu_to_be64(x) + +#endif /* LIBFDT_ENV_H */ 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/linux/mtd/mtd-abi.h b/include/linux/mtd/mtd-abi.h index 9bca9b5e06..dfcb3554fb 100644 --- a/include/linux/mtd/mtd-abi.h +++ b/include/linux/mtd/mtd-abi.h @@ -137,7 +137,7 @@ struct nand_oobfree { }; #define MTD_MAX_OOBFREE_ENTRIES_LARGE 32 -#define MTD_MAX_ECCPOS_ENTRIES_LARGE 128 /* FIXME : understand why 448 is not working */ +#define MTD_MAX_ECCPOS_ENTRIES_LARGE 640 /* * ECC layout control structure. Exported to userspace for * diagnosis and to allow creation of raw images diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 7f17767c69..762f9c4f2a 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -543,6 +543,8 @@ struct nand_chip { void *priv; unsigned int bbt_type; + + struct mtd_info mtd; }; /* @@ -799,4 +801,9 @@ struct nand_sdr_timings { /* get timing characteristics from ONFI timing mode. */ const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode); +static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd) +{ + return mtd->priv; +} + #endif /* __LINUX_MTD_NAND_H */ diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index 33413ff955..105f381ada 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -64,6 +64,7 @@ #define SPINOR_OP_CLFSR 0x50 /* Clear flag status register */ #define SPINOR_OP_RDEAR 0xc8 /* Read Extended Address Register */ #define SPINOR_OP_WREAR 0xc5 /* Write Extended Address Register */ +#define SPINOR_OP_GBULK 0x98 /* Global Block Unlock Protection */ /* 4-byte address opcodes - used on Spansion and some Macronix flashes. */ #define SPINOR_OP_READ_4B 0x13 /* Read data bytes (low frequency) */ 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/mtd/mtd-peb.h b/include/mtd/mtd-peb.h index 23f89d89a8..311f25c3df 100644 --- a/include/mtd/mtd-peb.h +++ b/include/mtd/mtd-peb.h @@ -21,5 +21,7 @@ int mtd_num_pebs(struct mtd_info *mtd); int mtd_peb_create_bitflips(struct mtd_info *mtd, int pnum, int offset, int len, int num_bitflips, int random, int info); +int mtd_peb_write_file(struct mtd_info *mtd, int peb_start, int max_pebs, + const void *buf, size_t len); #endif /* __LINUX_MTD_MTDPEB_H */ 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); } diff --git a/include/pbl.h b/include/pbl.h index 1917a7633f..787bd8293f 100644 --- a/include/pbl.h +++ b/include/pbl.h @@ -11,8 +11,6 @@ extern unsigned long free_mem_ptr; extern unsigned long free_mem_end_ptr; void pbl_barebox_uncompress(void *dest, void *compressed_start, unsigned int len); -int pbl_barebox_verify(void *compressed_start, unsigned int len, void *hash, - unsigned int hash_len); #ifdef __PBL__ #define IN_PBL 1 diff --git a/include/platform_data/elm.h b/include/platform_data/elm.h new file mode 100644 index 0000000000..bc5d2edb1d --- /dev/null +++ b/include/platform_data/elm.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * BCH Error Location Module + * + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ + */ + +#ifndef __ELM_H +#define __ELM_H + +enum bch_ecc { + BCH4_ECC = 0, + BCH8_ECC, + BCH16_ECC, +}; + +/* ELM support 8 error syndrome process */ +#define ERROR_VECTOR_MAX 8 + +/** + * struct elm_errorvec - error vector for elm + * @error_reported: set true for vectors error is reported + * @error_uncorrectable: number of uncorrectable errors + * @error_count: number of correctable errors in the sector + * @error_loc: buffer for error location + * + */ +struct elm_errorvec { + bool error_reported; + bool error_uncorrectable; + int error_count; + int error_loc[16]; +}; + +#if IS_ENABLED(CONFIG_MTD_NAND_OMAP_ELM) +int elm_decode_bch_error_page(u8 *ecc_calc, struct elm_errorvec *err_vec); +int elm_config(enum bch_ecc bch_type, int ecc_steps, int ecc_step_size, + int ecc_syndrome_size); +#else +static inline int +elm_decode_bch_error_page(u8 *ecc_calc, struct elm_errorvec *err_vec) +{ + return -ENODEV; +} + +static inline int elm_config(enum bch_ecc bch_type, int ecc_steps, + int ecc_step_size, int ecc_syndrome_size) +{ + return -ENOSYS; +} +#endif /* CONFIG_MTD_NAND_OMAP_ELM */ + +#endif /* __ELM_H */ diff --git a/include/reset_source.h b/include/reset_source.h index 13bc3bcfde..3ccd529fdd 100644 --- a/include/reset_source.h +++ b/include/reset_source.h @@ -26,45 +26,63 @@ enum reset_src_type { }; #ifdef CONFIG_RESET_SOURCE -void reset_source_set_priority(enum reset_src_type, unsigned int priority); + enum reset_src_type reset_source_get(void); -void reset_source_set_instance(enum reset_src_type type, int instance); +const char *reset_source_name(void); int reset_source_get_instance(void); +struct device_d *reset_source_get_device(void); + +void reset_source_set_device(struct device_d *dev, enum reset_src_type st); +void reset_source_set_prinst(enum reset_src_type, + unsigned int priority, int instance); + unsigned int of_get_reset_source_priority(struct device_node *node); -const char *reset_source_name(void); + #else -static inline void reset_source_set_priority(enum reset_src_type type, - unsigned int priority) + +static inline enum reset_src_type reset_source_get(void) { + return RESET_UKWN; } -static inline void reset_source_set_instance(enum reset_src_type type, int instance) +static inline const char *reset_source_name(void) { + return "unknown"; } -static inline enum reset_src_type reset_source_get(void) +static inline int reset_source_get_instance(void) { - return RESET_UKWN; + return -1; } -static inline int reset_source_get_instance(void) +static inline struct device_d *reset_source_get_device(void) { - return 0; + return NULL; } -static inline unsigned int of_get_reset_source_priority(struct device_node *node) +static inline void reset_source_set_prinst(enum reset_src_type type, + unsigned int priority, int instance) { - return 0; } -static inline const char *reset_source_name(void) +static inline void reset_source_set_instance(enum reset_src_type type, int instance) { - return "unknown"; +} + +static inline unsigned int of_get_reset_source_priority(struct device_node *node) +{ + return 0; } #endif #define RESET_SOURCE_DEFAULT_PRIORITY 100 +static inline void reset_source_set_priority(enum reset_src_type type, + unsigned int priority) +{ + reset_source_set_prinst(type, priority, -1); +} + static inline void reset_source_set(enum reset_src_type type) { reset_source_set_priority(type, RESET_SOURCE_DEFAULT_PRIORITY); |