.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2013 TangoTec Ltd. |
---|
3 | 4 | * Author: Baruch Siach <baruch@tkos.co.il> |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify |
---|
6 | | - * it under the terms of the GNU General Public License version 2 as |
---|
7 | | - * published by the Free Software Foundation. |
---|
8 | 5 | * |
---|
9 | 6 | * Driver for the Xtensa LX4 GPIO32 Option |
---|
10 | 7 | * |
---|
.. | .. |
---|
30 | 27 | |
---|
31 | 28 | #include <linux/err.h> |
---|
32 | 29 | #include <linux/module.h> |
---|
33 | | -#include <linux/gpio.h> |
---|
| 30 | +#include <linux/gpio/driver.h> |
---|
34 | 31 | #include <linux/bitops.h> |
---|
35 | 32 | #include <linux/platform_device.h> |
---|
36 | 33 | |
---|
.. | .. |
---|
47 | 44 | unsigned long flags; |
---|
48 | 45 | |
---|
49 | 46 | local_irq_save(flags); |
---|
50 | | - RSR_CPENABLE(*cpenable); |
---|
51 | | - WSR_CPENABLE(*cpenable | BIT(XCHAL_CP_ID_XTIOP)); |
---|
52 | | - |
---|
| 47 | + *cpenable = xtensa_get_sr(cpenable); |
---|
| 48 | + xtensa_set_sr(*cpenable | BIT(XCHAL_CP_ID_XTIOP), cpenable); |
---|
53 | 49 | return flags; |
---|
54 | 50 | } |
---|
55 | 51 | |
---|
56 | 52 | static inline void disable_cp(unsigned long flags, unsigned long cpenable) |
---|
57 | 53 | { |
---|
58 | | - WSR_CPENABLE(cpenable); |
---|
| 54 | + xtensa_set_sr(cpenable, cpenable); |
---|
59 | 55 | local_irq_restore(flags); |
---|
60 | 56 | } |
---|
61 | 57 | |
---|
.. | .. |
---|
75 | 71 | |
---|
76 | 72 | static int xtensa_impwire_get_direction(struct gpio_chip *gc, unsigned offset) |
---|
77 | 73 | { |
---|
78 | | - return 1; /* input only */ |
---|
| 74 | + return GPIO_LINE_DIRECTION_IN; /* input only */ |
---|
79 | 75 | } |
---|
80 | 76 | |
---|
81 | 77 | static int xtensa_impwire_get_value(struct gpio_chip *gc, unsigned offset) |
---|
.. | .. |
---|
98 | 94 | |
---|
99 | 95 | static int xtensa_expstate_get_direction(struct gpio_chip *gc, unsigned offset) |
---|
100 | 96 | { |
---|
101 | | - return 0; /* output only */ |
---|
| 97 | + return GPIO_LINE_DIRECTION_OUT; /* output only */ |
---|
102 | 98 | } |
---|
103 | 99 | |
---|
104 | 100 | static int xtensa_expstate_get_value(struct gpio_chip *gc, unsigned offset) |
---|