aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/cmpxchg-local.h8
-rw-r--r--include/asm-generic/gpio.h86
-rw-r--r--include/asm-generic/io.h20
-rw-r--r--include/asm-generic/pgtable.h10
-rw-r--r--include/asm-generic/syscalls.h16
-rw-r--r--include/asm-generic/unistd.h3
-rw-r--r--include/asm-generic/vmlinux.lds.h32
7 files changed, 94 insertions, 81 deletions
diff --git a/include/asm-generic/cmpxchg-local.h b/include/asm-generic/cmpxchg-local.h
index 2533fddd34a6..d8d4c898c1bb 100644
--- a/include/asm-generic/cmpxchg-local.h
+++ b/include/asm-generic/cmpxchg-local.h
@@ -21,7 +21,7 @@ static inline unsigned long __cmpxchg_local_generic(volatile void *ptr,
21 if (size == 8 && sizeof(unsigned long) != 8) 21 if (size == 8 && sizeof(unsigned long) != 8)
22 wrong_size_cmpxchg(ptr); 22 wrong_size_cmpxchg(ptr);
23 23
24 local_irq_save(flags); 24 raw_local_irq_save(flags);
25 switch (size) { 25 switch (size) {
26 case 1: prev = *(u8 *)ptr; 26 case 1: prev = *(u8 *)ptr;
27 if (prev == old) 27 if (prev == old)
@@ -42,7 +42,7 @@ static inline unsigned long __cmpxchg_local_generic(volatile void *ptr,
42 default: 42 default:
43 wrong_size_cmpxchg(ptr); 43 wrong_size_cmpxchg(ptr);
44 } 44 }
45 local_irq_restore(flags); 45 raw_local_irq_restore(flags);
46 return prev; 46 return prev;
47} 47}
48 48
@@ -55,11 +55,11 @@ static inline u64 __cmpxchg64_local_generic(volatile void *ptr,
55 u64 prev; 55 u64 prev;
56 unsigned long flags; 56 unsigned long flags;
57 57
58 local_irq_save(flags); 58 raw_local_irq_save(flags);
59 prev = *(u64 *)ptr; 59 prev = *(u64 *)ptr;
60 if (prev == old) 60 if (prev == old)
61 *(u64 *)ptr = new; 61 *(u64 *)ptr = new;
62 local_irq_restore(flags); 62 raw_local_irq_restore(flags);
63 return prev; 63 return prev;
64} 64}
65 65
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 20ca7663975f..bde646995d10 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -47,12 +47,14 @@ struct gpio;
47struct seq_file; 47struct seq_file;
48struct module; 48struct module;
49struct device_node; 49struct device_node;
50struct gpio_desc;
50 51
51/** 52/**
52 * struct gpio_chip - abstract a GPIO controller 53 * struct gpio_chip - abstract a GPIO controller
53 * @label: for diagnostics 54 * @label: for diagnostics
54 * @dev: optional device providing the GPIOs 55 * @dev: optional device providing the GPIOs
55 * @owner: helps prevent removal of modules exporting active GPIOs 56 * @owner: helps prevent removal of modules exporting active GPIOs
57 * @list: links gpio_chips together for traversal
56 * @request: optional hook for chip-specific activation, such as 58 * @request: optional hook for chip-specific activation, such as
57 * enabling module power and clock; may sleep 59 * enabling module power and clock; may sleep
58 * @free: optional hook for chip-specific deactivation, such as 60 * @free: optional hook for chip-specific deactivation, such as
@@ -75,6 +77,7 @@ struct device_node;
75 * negative during registration, requests dynamic ID allocation. 77 * negative during registration, requests dynamic ID allocation.
76 * @ngpio: the number of GPIOs handled by this controller; the last GPIO 78 * @ngpio: the number of GPIOs handled by this controller; the last GPIO
77 * handled is (base + ngpio - 1). 79 * handled is (base + ngpio - 1).
80 * @desc: array of ngpio descriptors. Private.
78 * @can_sleep: flag must be set iff get()/set() methods sleep, as they 81 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
79 * must while accessing GPIO expander chips over I2C or SPI 82 * must while accessing GPIO expander chips over I2C or SPI
80 * @names: if set, must be an array of strings to use as alternative 83 * @names: if set, must be an array of strings to use as alternative
@@ -98,6 +101,7 @@ struct gpio_chip {
98 const char *label; 101 const char *label;
99 struct device *dev; 102 struct device *dev;
100 struct module *owner; 103 struct module *owner;
104 struct list_head list;
101 105
102 int (*request)(struct gpio_chip *chip, 106 int (*request)(struct gpio_chip *chip,
103 unsigned offset); 107 unsigned offset);
@@ -124,6 +128,7 @@ struct gpio_chip {
124 struct gpio_chip *chip); 128 struct gpio_chip *chip);
125 int base; 129 int base;
126 u16 ngpio; 130 u16 ngpio;
131 struct gpio_desc *desc;
127 const char *const *names; 132 const char *const *names;
128 unsigned can_sleep:1; 133 unsigned can_sleep:1;
129 unsigned exported:1; 134 unsigned exported:1;
@@ -152,7 +157,6 @@ struct gpio_chip {
152extern const char *gpiochip_is_requested(struct gpio_chip *chip, 157extern const char *gpiochip_is_requested(struct gpio_chip *chip,
153 unsigned offset); 158 unsigned offset);
154extern struct gpio_chip *gpio_to_chip(unsigned gpio); 159extern struct gpio_chip *gpio_to_chip(unsigned gpio);
155extern int __must_check gpiochip_reserve(int start, int ngpio);
156 160
157/* add/remove chips */ 161/* add/remove chips */
158extern int gpiochip_add(struct gpio_chip *chip); 162extern int gpiochip_add(struct gpio_chip *chip);
@@ -192,12 +196,6 @@ extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *labe
192extern int gpio_request_array(const struct gpio *array, size_t num); 196extern int gpio_request_array(const struct gpio *array, size_t num);
193extern void gpio_free_array(const struct gpio *array, size_t num); 197extern void gpio_free_array(const struct gpio *array, size_t num);
194 198
195/* bindings for managed devices that want to request gpios */
196int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
197int devm_gpio_request_one(struct device *dev, unsigned gpio,
198 unsigned long flags, const char *label);
199void devm_gpio_free(struct device *dev, unsigned int gpio);
200
201#ifdef CONFIG_GPIO_SYSFS 199#ifdef CONFIG_GPIO_SYSFS
202 200
203/* 201/*
@@ -212,6 +210,43 @@ extern void gpio_unexport(unsigned gpio);
212 210
213#endif /* CONFIG_GPIO_SYSFS */ 211#endif /* CONFIG_GPIO_SYSFS */
214 212
213#ifdef CONFIG_PINCTRL
214
215/**
216 * struct gpio_pin_range - pin range controlled by a gpio chip
217 * @head: list for maintaining set of pin ranges, used internally
218 * @pctldev: pinctrl device which handles corresponding pins
219 * @range: actual range of pins controlled by a gpio controller
220 */
221
222struct gpio_pin_range {
223 struct list_head node;
224 struct pinctrl_dev *pctldev;
225 struct pinctrl_gpio_range range;
226};
227
228int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
229 unsigned int gpio_offset, unsigned int pin_offset,
230 unsigned int npins);
231void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
232
233#else
234
235static inline int
236gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
237 unsigned int gpio_offset, unsigned int pin_offset,
238 unsigned int npins)
239{
240 return 0;
241}
242
243static inline void
244gpiochip_remove_pin_ranges(struct gpio_chip *chip)
245{
246}
247
248#endif /* CONFIG_PINCTRL */
249
215#else /* !CONFIG_GPIOLIB */ 250#else /* !CONFIG_GPIOLIB */
216 251
217static inline bool gpio_is_valid(int number) 252static inline bool gpio_is_valid(int number)
@@ -270,41 +305,4 @@ static inline void gpio_unexport(unsigned gpio)
270} 305}
271#endif /* CONFIG_GPIO_SYSFS */ 306#endif /* CONFIG_GPIO_SYSFS */
272 307
273#ifdef CONFIG_PINCTRL
274
275/**
276 * struct gpio_pin_range - pin range controlled by a gpio chip
277 * @head: list for maintaining set of pin ranges, used internally
278 * @pctldev: pinctrl device which handles corresponding pins
279 * @range: actual range of pins controlled by a gpio controller
280 */
281
282struct gpio_pin_range {
283 struct list_head node;
284 struct pinctrl_dev *pctldev;
285 struct pinctrl_gpio_range range;
286};
287
288int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
289 unsigned int gpio_offset, unsigned int pin_offset,
290 unsigned int npins);
291void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
292
293#else
294
295static inline int
296gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
297 unsigned int gpio_offset, unsigned int pin_offset,
298 unsigned int npins)
299{
300 return 0;
301}
302
303static inline void
304gpiochip_remove_pin_ranges(struct gpio_chip *chip)
305{
306}
307
308#endif /* CONFIG_PINCTRL */
309
310#endif /* _ASM_GENERIC_GPIO_H */ 308#endif /* _ASM_GENERIC_GPIO_H */
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 33bbbae4ddc6..8e260cf01351 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -53,8 +53,18 @@ static inline u32 __raw_readl(const volatile void __iomem *addr)
53#endif 53#endif
54 54
55#define readb __raw_readb 55#define readb __raw_readb
56#define readw(addr) __le16_to_cpu(__raw_readw(addr)) 56
57#define readl(addr) __le32_to_cpu(__raw_readl(addr)) 57#define readw readw
58static inline u16 readw(const volatile void __iomem *addr)
59{
60 return __le16_to_cpu(__raw_readw(addr));
61}
62
63#define readl readl
64static inline u32 readl(const volatile void __iomem *addr)
65{
66 return __le32_to_cpu(__raw_readl(addr));
67}
58 68
59#ifndef __raw_writeb 69#ifndef __raw_writeb
60static inline void __raw_writeb(u8 b, volatile void __iomem *addr) 70static inline void __raw_writeb(u8 b, volatile void __iomem *addr)
@@ -89,7 +99,11 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
89} 99}
90#endif 100#endif
91 101
92#define readq(addr) __le64_to_cpu(__raw_readq(addr)) 102#define readq readq
103static inline u64 readq(const volatile void __iomem *addr)
104{
105 return __le64_to_cpu(__raw_readq(addr));
106}
93 107
94#ifndef __raw_writeq 108#ifndef __raw_writeq
95static inline void __raw_writeq(u64 b, volatile void __iomem *addr) 109static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 5cf680a98f9b..bfd87685fc1f 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -197,16 +197,6 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
197#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 197#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
198#endif 198#endif
199 199
200#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
201#define page_test_and_clear_dirty(pfn, mapped) (0)
202#endif
203
204#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
205#define pte_maybe_dirty(pte) pte_dirty(pte)
206#else
207#define pte_maybe_dirty(pte) (1)
208#endif
209
210#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG 200#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
211#define page_test_and_clear_young(pfn) (0) 201#define page_test_and_clear_young(pfn) (0)
212#endif 202#endif
diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h
index 1db51b8524e9..1f74be5113b2 100644
--- a/include/asm-generic/syscalls.h
+++ b/include/asm-generic/syscalls.h
@@ -21,24 +21,8 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
21 unsigned long fd, off_t pgoff); 21 unsigned long fd, off_t pgoff);
22#endif 22#endif
23 23
24#ifndef CONFIG_GENERIC_SIGALTSTACK
25#ifndef sys_sigaltstack
26asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *,
27 struct pt_regs *);
28#endif
29#endif
30
31#ifndef sys_rt_sigreturn 24#ifndef sys_rt_sigreturn
32asmlinkage long sys_rt_sigreturn(struct pt_regs *regs); 25asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);
33#endif 26#endif
34 27
35#ifndef sys_rt_sigsuspend
36asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
37#endif
38
39#ifndef sys_rt_sigaction
40asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act,
41 struct sigaction __user *oact, size_t sigsetsize);
42#endif
43
44#endif /* __ASM_GENERIC_SYSCALLS_H */ 28#endif /* __ASM_GENERIC_SYSCALLS_H */
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index a36991ab334e..257c55ec4f77 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -9,9 +9,6 @@
9#define __ARCH_WANT_STAT64 9#define __ARCH_WANT_STAT64
10#define __ARCH_WANT_SYS_LLSEEK 10#define __ARCH_WANT_SYS_LLSEEK
11#endif 11#endif
12#define __ARCH_WANT_SYS_RT_SIGACTION
13#define __ARCH_WANT_SYS_RT_SIGSUSPEND
14#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
15 12
16/* 13/*
17 * "Conditional" syscalls 14 * "Conditional" syscalls
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index d1ea7ce0b4cb..afa12c7a025c 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -149,6 +149,33 @@
149#define TRACE_SYSCALLS() 149#define TRACE_SYSCALLS()
150#endif 150#endif
151 151
152#ifdef CONFIG_CLKSRC_OF
153#define CLKSRC_OF_TABLES() . = ALIGN(8); \
154 VMLINUX_SYMBOL(__clksrc_of_table) = .; \
155 *(__clksrc_of_table) \
156 *(__clksrc_of_table_end)
157#else
158#define CLKSRC_OF_TABLES()
159#endif
160
161#ifdef CONFIG_IRQCHIP
162#define IRQCHIP_OF_MATCH_TABLE() \
163 . = ALIGN(8); \
164 VMLINUX_SYMBOL(__irqchip_begin) = .; \
165 *(__irqchip_of_table) \
166 *(__irqchip_of_end)
167#else
168#define IRQCHIP_OF_MATCH_TABLE()
169#endif
170
171#ifdef CONFIG_COMMON_CLK
172#define CLK_OF_TABLES() . = ALIGN(8); \
173 VMLINUX_SYMBOL(__clk_of_table) = .; \
174 *(__clk_of_table) \
175 *(__clk_of_table_end)
176#else
177#define CLK_OF_TABLES()
178#endif
152 179
153#define KERNEL_DTB() \ 180#define KERNEL_DTB() \
154 STRUCT_ALIGN(); \ 181 STRUCT_ALIGN(); \
@@ -493,7 +520,10 @@
493 DEV_DISCARD(init.rodata) \ 520 DEV_DISCARD(init.rodata) \
494 CPU_DISCARD(init.rodata) \ 521 CPU_DISCARD(init.rodata) \
495 MEM_DISCARD(init.rodata) \ 522 MEM_DISCARD(init.rodata) \
496 KERNEL_DTB() 523 CLK_OF_TABLES() \
524 CLKSRC_OF_TABLES() \
525 KERNEL_DTB() \
526 IRQCHIP_OF_MATCH_TABLE()
497 527
498#define INIT_TEXT \ 528#define INIT_TEXT \
499 *(.init.text) \ 529 *(.init.text) \