diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/bitsperlong.h | 4 | ||||
-rw-r--r-- | include/asm-generic/bug.h | 12 | ||||
-rw-r--r-- | include/driver.h | 22 | ||||
-rw-r--r-- | include/filetype.h | 1 | ||||
-rw-r--r-- | include/linux/clk.h | 99 | ||||
-rw-r--r-- | include/linux/compiler_types.h | 4 | ||||
-rw-r--r-- | include/linux/reset/reset-simple.h | 45 | ||||
-rw-r--r-- | include/linux/string.h | 3 | ||||
-rw-r--r-- | include/state.h | 12 |
9 files changed, 189 insertions, 13 deletions
diff --git a/include/asm-generic/bitsperlong.h b/include/asm-generic/bitsperlong.h index 836a1d4c83..20c055c6bd 100644 --- a/include/asm-generic/bitsperlong.h +++ b/include/asm-generic/bitsperlong.h @@ -9,4 +9,8 @@ #define BITS_PER_LONG 32 #endif /* CONFIG_64BIT */ +#ifndef BITS_PER_LONG_LONG +#define BITS_PER_LONG_LONG 64 +#endif + #endif /* __ASM_GENERIC_BITS_PER_LONG */ diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index f20e1b4d65..5d0a458eae 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -50,4 +50,16 @@ } \ unlikely(__ret_warn_once); \ }) + +#define WARN_ON_ONCE(condition) ({ \ + static int __warned; \ + int __ret_warn_once = !!(condition); \ + \ + if (unlikely(__ret_warn_once && !__warned)) { \ + __warned = 1; \ + __WARN(); \ + } \ + unlikely(__ret_warn_once); \ +}) + #endif diff --git a/include/driver.h b/include/driver.h index 1215a2d57a..a787f985a0 100644 --- a/include/driver.h +++ b/include/driver.h @@ -141,6 +141,10 @@ void device_detect_all(void); */ int unregister_device(struct device_d *); +void free_device_res(struct device_d *dev); +void free_device(struct device_d *dev); + + /* Iterate over a devices children */ #define device_for_each_child(dev, child) \ @@ -451,7 +455,7 @@ struct cdev_operations { int (*truncate)(struct cdev*, size_t size); }; -#define MAX_PARTUUID_STR sizeof("00112233-4455-6677-8899-AABBCCDDEEFF") +#define MAX_UUID_STR sizeof("00112233-4455-6677-8899-AABBCCDDEEFF") struct cdev { const struct cdev_operations *ops; @@ -464,7 +468,7 @@ struct cdev { char *partname; /* the partition name, usually the above without the * device part, i.e. name = "nand0.barebox" -> partname = "barebox" */ - char partuuid[MAX_PARTUUID_STR]; + char uuid[MAX_UUID_STR]; loff_t offset; loff_t size; unsigned int flags; @@ -488,18 +492,28 @@ 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_by_partuuid(const char *partuuid); -struct cdev *cdev_open(const char *name, unsigned long flags); +struct cdev *cdev_by_diskuuid(const char *partuuid); +struct cdev *cdev_open_by_name(const char *name, unsigned long flags); struct cdev *cdev_create_loop(const char *path, ulong flags, loff_t offset); void cdev_remove_loop(struct cdev *cdev); -int cdev_do_open(struct cdev *, unsigned long flags); +int cdev_open(struct cdev *, unsigned long flags); void cdev_close(struct cdev *cdev); int cdev_flush(struct cdev *cdev); ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags); ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags); int cdev_ioctl(struct cdev *cdev, int cmd, void *buf); int cdev_erase(struct cdev *cdev, loff_t count, loff_t offset); +int cdev_lseek(struct cdev*, loff_t); +int cdev_protect(struct cdev*, size_t count, loff_t offset, int prot); +int cdev_discard_range(struct cdev*, loff_t count, loff_t offset); +int cdev_memmap(struct cdev*, void **map, int flags); +int cdev_truncate(struct cdev*, size_t size); loff_t cdev_unallocated_space(struct cdev *cdev); +extern struct list_head cdev_list; +#define for_each_cdev(c) \ + list_for_each_entry(cdev, &cdev_list, list) + #define DEVFS_PARTITION_FIXED (1U << 0) #define DEVFS_PARTITION_READONLY (1U << 1) #define DEVFS_IS_CHARACTER_DEV (1U << 3) diff --git a/include/filetype.h b/include/filetype.h index 2640847e1f..8bc179ac08 100644 --- a/include/filetype.h +++ b/include/filetype.h @@ -28,6 +28,7 @@ enum filetype { filetype_mbr, filetype_bmp, filetype_png, + filetype_qoi, filetype_ext, filetype_gpt, filetype_ubifs, diff --git a/include/linux/clk.h b/include/linux/clk.h index ffc1ac8489..9bee204652 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -13,6 +13,7 @@ #include <linux/err.h> #include <linux/spinlock.h> #include <linux/stringify.h> +#include <xfuncs.h> struct device_d; @@ -449,6 +450,10 @@ struct clk *clk_register_fixed_rate(const char *name, const char *parent_name, unsigned long flags, unsigned long fixed_rate); +struct clk_hw *clk_hw_register_fixed_rate(struct device_d *dev, const char *name, + const char *parent_name, unsigned long flags, + unsigned long rate); + static inline struct clk *clk_fixed(const char *name, int rate) { return clk_register_fixed_rate(name, NULL, 0, rate); @@ -519,6 +524,17 @@ struct clk *clk_register_divider_table(struct device_d *dev, const char *name, u8 clk_divider_flags, const struct clk_div_table *table, spinlock_t *lock); +struct clk_hw *clk_hw_register_divider_table(struct device_d *dev, const char *name, + const char *parent_name, unsigned long flags, + void __iomem *reg, u8 shift, u8 width, + u8 clk_divider_flags, const struct clk_div_table *table, + spinlock_t *lock); + +struct clk_hw *clk_hw_register_divider(struct device_d *dev, const char *name, + const char *parent_name, unsigned long flags, + void __iomem *reg, u8 shift, u8 width, + u8 clk_divider_flags, spinlock_t *lock); + struct clk_fixed_factor { struct clk_hw hw; int mult; @@ -540,6 +556,10 @@ struct clk *clk_register_fixed_factor(struct device_d *dev, const char *name, const char *parent_name, unsigned long flags, unsigned int mult, unsigned int div); +struct clk_hw *clk_hw_register_fixed_factor(struct device_d *dev, + const char *name, const char *parent_name, unsigned long flags, + unsigned int mult, unsigned int div); + /** * struct clk_fractional_divider - adjustable fractional divider clock * @@ -600,6 +620,7 @@ struct clk_mux { int shift; int width; unsigned flags; + u32 *table; spinlock_t *lock; }; @@ -622,6 +643,35 @@ struct clk *clk_register_mux(struct device_d *dev, const char *name, void __iomem *reg, u8 shift, u8 width, u8 clk_mux_flags, spinlock_t *lock); +struct clk_hw *__clk_hw_register_mux(struct device_d *dev, + const char *name, u8 num_parents, + const char * const *parent_names, + unsigned long flags, void __iomem *reg, u8 shift, u32 mask, + u8 clk_mux_flags, u32 *table, spinlock_t *lock); + +#define clk_hw_register_mux(dev, name, parent_names, \ + num_parents, flags, reg, shift, mask, \ + clk_mux_flags, lock) \ + __clk_hw_register_mux((dev), (name), (num_parents), \ + (parent_names), \ + (flags), (reg), (shift), (mask), \ + (clk_mux_flags), NULL, (lock)) + +#define clk_hw_register_mux_table(dev, name, parent_names, num_parents, \ + flags, reg, shift, mask, clk_mux_flags, \ + table, lock) \ + __clk_hw_register_mux((dev), (name), (num_parents), \ + (parent_names), (flags), (reg), \ + (shift), (mask), (clk_mux_flags), (table), \ + (lock)) + +int clk_mux_val_to_index(struct clk_hw *hw, u32 *table, unsigned int flags, + unsigned int val); +unsigned int clk_mux_index_to_val(u32 *table, unsigned int flags, u8 index); + +long clk_mux_round_rate(struct clk_hw *hw, unsigned long rate, + unsigned long *prate); + struct clk_gate { struct clk_hw hw; void __iomem *reg; @@ -652,6 +702,16 @@ struct clk *clk_register_gate(struct device_d *dev, const char *name, void __iomem *reg, u8 bit_idx, u8 clk_gate_flags, spinlock_t *lock); +static inline struct clk_hw *clk_hw_register_gate(struct device_d *dev, + const char *name, const char *parent_name, + unsigned long flags, void __iomem *reg, u8 bit_idx, + u8 clk_gate_flags, spinlock_t *lock) +{ + return clk_to_clk_hw(clk_register_gate(dev, xstrdup(name), xstrdup(parent_name), + flags, reg, bit_idx, + clk_gate_flags, lock)); +} + int clk_is_enabled(struct clk *clk); int clk_hw_is_enabled(struct clk_hw *hw); @@ -664,6 +724,11 @@ int clk_parent_set_rate(struct clk_hw *hw, unsigned long rate, int bclk_register(struct clk *clk); struct clk *clk_register(struct device_d *dev, struct clk_hw *hw); +static inline int clk_hw_register(struct device_d *dev, struct clk_hw *hw) +{ + return PTR_ERR_OR_ZERO(clk_register(dev, hw)); +} + struct clk *clk_lookup(const char *name); void clk_dump(int verbose); @@ -676,11 +741,29 @@ struct clk *clk_register_composite(const char *name, struct clk *gate_clk, unsigned long flags); +struct clk_hw *clk_hw_register_composite(struct device_d *dev, + const char *name, const char * const *parent_names, + int num_parents, + struct clk_hw *mux_hw, const struct clk_ops *mux_ops, + struct clk_hw *rate_hw, const struct clk_ops *rate_ops, + struct clk_hw *gate_hw, const struct clk_ops *gate_ops, + unsigned long flags); + static inline const char *clk_hw_get_name(struct clk_hw *hw) { return hw->clk.name; } +static inline unsigned int clk_hw_get_num_parents(const struct clk_hw *hw) +{ + return hw->clk.num_parents; +} + +static inline unsigned long clk_hw_get_flags(const struct clk_hw *hw) +{ + return hw->clk.flags; +} + int clk_name_set_parent(const char *clkname, const char *clkparentname); int clk_name_set_rate(const char *clkname, unsigned long rate); @@ -721,10 +804,10 @@ int of_clk_add_provider(struct device_node *np, void *data), void *data); -static inline unsigned int clk_hw_get_num_parents(const struct clk_hw *hw) -{ - return hw->clk.num_parents; -} +int of_clk_add_hw_provider(struct device_node *np, + struct clk_hw *(*clk_hw_src_get)(struct of_phandle_args *clkspec, + void *data), + void *data); #else @@ -773,6 +856,14 @@ static inline int of_clk_add_provider(struct device_node *np, { return 0; } + +static inline int of_clk_add_hw_provider(struct device_node *np, + struct clk_hw *(*clk_hw_src_get)(struct of_phandle_args *clkspec, + void *data), + void *data) +{ + return 0; +} #endif #define CLK_OF_DECLARE_DRIVER(name, compat, fn) CLK_OF_DECLARE(name, compat, fn) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 9a5a6f0e8b..aa9cbcac77 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -201,8 +201,8 @@ struct ftrace_likely_data { #define __pure __attribute__((pure)) #define __aligned(x) __attribute__((aligned(x))) #define __aligned_largest __attribute__((aligned)) -#define __printf(a, b) __attribute__((format(printf, a, b))) -#define __scanf(a, b) __attribute__((format(scanf, a, b))) +#define __printf(a, b) __attribute__((format(__printf__, a, b))) +#define __scanf(a, b) __attribute__((format(__scanf__, a, b))) #define __maybe_unused __attribute__((unused)) #define __always_unused __attribute__((unused)) #define __mode(x) __attribute__((mode(x))) diff --git a/include/linux/reset/reset-simple.h b/include/linux/reset/reset-simple.h new file mode 100644 index 0000000000..cb38a4b597 --- /dev/null +++ b/include/linux/reset/reset-simple.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Simple Reset Controller ops + * + * Based on Allwinner SoCs Reset Controller driver + * + * Copyright 2013 Maxime Ripard + * + * Maxime Ripard <maxime.ripard@free-electrons.com> + */ + +#ifndef __RESET_SIMPLE_H__ +#define __RESET_SIMPLE_H__ + +#include <io.h> +#include <linux/reset-controller.h> + +/** + * struct reset_simple_data - driver data for simple reset controllers + * @membase: memory mapped I/O register range + * @rcdev: reset controller device base structure + * @active_low: if true, bits are cleared to assert the reset. Otherwise, bits + * are set to assert the reset. Note that this says nothing about + * the voltage level of the actual reset line. + * @status_active_low: if true, bits read back as cleared while the reset is + * asserted. Otherwise, bits read back as set while the + * reset is asserted. + * @reset_us: Minimum delay in microseconds needed that needs to be + * waited for between an assert and a deassert to reset the + * device. If multiple consumers with different delay + * requirements are connected to this controller, it must + * be the largest minimum delay. 0 means that such a delay is + * unknown and the reset operation is unsupported. + */ +struct reset_simple_data { + void __iomem *membase; + struct reset_controller_dev rcdev; + bool active_low; + bool status_active_low; + unsigned int reset_us; +}; + +extern const struct reset_control_ops reset_simple_ops; + +#endif /* __RESET_SIMPLE_H__ */ diff --git a/include/linux/string.h b/include/linux/string.h index 3da174116a..ae5e5bca8d 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -5,6 +5,7 @@ #include <linux/types.h> /* for size_t */ #include <linux/stddef.h> /* for NULL */ +#include <linux/overflow.h> /* for array_size */ #ifdef __cplusplus extern "C" { @@ -133,6 +134,8 @@ static inline const char *kbasename(const char *path) void *memdup(const void *, size_t); +#define memdup_array(arr, count) memdup(arr, array_size(count, sizeof(*arr))); + static inline void *kmemdup(const void *src, size_t len, gfp_t gfp) { return memdup(src, len); diff --git a/include/state.h b/include/state.h index be1b592576..bffcd5a900 100644 --- a/include/state.h +++ b/include/state.h @@ -12,7 +12,8 @@ struct state *state_new_from_node(struct device_node *node, bool readonly); void state_release(struct state *state); struct state *state_by_name(const char *name); -struct state *state_by_node(const struct device_node *node); +struct state *state_by_node(struct device_node *node); +struct state *state_by_alias(const char *alias); int state_load_no_auth(struct state *state); int state_load(struct state *state); @@ -34,10 +35,15 @@ static inline struct state *state_by_name(const char *name) return NULL; } -static inline struct state *state_by_node(const struct device_node *node) +static inline struct state *state_by_node(struct device_node *node) { return NULL; -}; +} + +static inline struct state *state_by_alias(const char *alias) +{ + return NULL; +} static inline int state_load(struct state *state) { |