* [PATCH 1/4] MIPS: rb532: gpio: use new line value setter callbacks
2025-04-07 7:25 [PATCH 0/4] MIPS: convert board-file GPIO drivers to using new value setters Bartosz Golaszewski
@ 2025-04-07 7:25 ` Bartosz Golaszewski
2025-04-07 7:25 ` [PATCH 2/4] MIPS: bcm63xx: " Bartosz Golaszewski
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-04-07 7:25 UTC (permalink / raw)
To: Thomas Bogendoerfer, Linus Walleij, Bartosz Golaszewski
Cc: linux-mips, linux-kernel, linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
arch/mips/rb532/gpio.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
index ea6ebfea4a67..0e47cd59b6cb 100644
--- a/arch/mips/rb532/gpio.c
+++ b/arch/mips/rb532/gpio.c
@@ -105,13 +105,15 @@ static int rb532_gpio_get(struct gpio_chip *chip, unsigned offset)
/*
* Set output GPIO level
*/
-static void rb532_gpio_set(struct gpio_chip *chip,
- unsigned offset, int value)
+static int rb532_gpio_set(struct gpio_chip *chip, unsigned int offset,
+ int value)
{
struct rb532_gpio_chip *gpch;
gpch = gpiochip_get_data(chip);
rb532_set_bit(value, offset, gpch->regbase + GPIOD);
+
+ return 0;
}
/*
@@ -162,7 +164,7 @@ static struct rb532_gpio_chip rb532_gpio_chip[] = {
.direction_input = rb532_gpio_direction_input,
.direction_output = rb532_gpio_direction_output,
.get = rb532_gpio_get,
- .set = rb532_gpio_set,
+ .set_rv = rb532_gpio_set,
.to_irq = rb532_gpio_to_irq,
.base = 0,
.ngpio = 32,
--
2.45.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] MIPS: bcm63xx: gpio: use new line value setter callbacks
2025-04-07 7:25 [PATCH 0/4] MIPS: convert board-file GPIO drivers to using new value setters Bartosz Golaszewski
2025-04-07 7:25 ` [PATCH 1/4] MIPS: rb532: gpio: use new line value setter callbacks Bartosz Golaszewski
@ 2025-04-07 7:25 ` Bartosz Golaszewski
2025-04-07 7:25 ` [PATCH 3/4] MIPS: alchemy: " Bartosz Golaszewski
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-04-07 7:25 UTC (permalink / raw)
To: Thomas Bogendoerfer, Linus Walleij, Bartosz Golaszewski
Cc: linux-mips, linux-kernel, linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
arch/mips/bcm63xx/gpio.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/mips/bcm63xx/gpio.c b/arch/mips/bcm63xx/gpio.c
index 5c4a233db55f..e7a53cd0dec5 100644
--- a/arch/mips/bcm63xx/gpio.c
+++ b/arch/mips/bcm63xx/gpio.c
@@ -35,8 +35,7 @@ static void bcm63xx_gpio_out_low_reg_init(void)
static DEFINE_SPINLOCK(bcm63xx_gpio_lock);
static u32 gpio_out_low, gpio_out_high;
-static void bcm63xx_gpio_set(struct gpio_chip *chip,
- unsigned gpio, int val)
+static int bcm63xx_gpio_set(struct gpio_chip *chip, unsigned int gpio, int val)
{
u32 reg;
u32 mask;
@@ -62,6 +61,8 @@ static void bcm63xx_gpio_set(struct gpio_chip *chip,
*v &= ~mask;
bcm_gpio_writel(*v, reg);
spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags);
+
+ return 0;
}
static int bcm63xx_gpio_get(struct gpio_chip *chip, unsigned gpio)
@@ -130,7 +131,7 @@ static struct gpio_chip bcm63xx_gpio_chip = {
.direction_input = bcm63xx_gpio_direction_input,
.direction_output = bcm63xx_gpio_direction_output,
.get = bcm63xx_gpio_get,
- .set = bcm63xx_gpio_set,
+ .set_rv = bcm63xx_gpio_set,
.base = 0,
};
--
2.45.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] MIPS: alchemy: gpio: use new line value setter callbacks
2025-04-07 7:25 [PATCH 0/4] MIPS: convert board-file GPIO drivers to using new value setters Bartosz Golaszewski
2025-04-07 7:25 ` [PATCH 1/4] MIPS: rb532: gpio: use new line value setter callbacks Bartosz Golaszewski
2025-04-07 7:25 ` [PATCH 2/4] MIPS: bcm63xx: " Bartosz Golaszewski
@ 2025-04-07 7:25 ` Bartosz Golaszewski
2025-04-07 7:25 ` [PATCH 4/4] MIPS: txx9: " Bartosz Golaszewski
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-04-07 7:25 UTC (permalink / raw)
To: Thomas Bogendoerfer, Linus Walleij, Bartosz Golaszewski
Cc: linux-mips, linux-kernel, linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
arch/mips/alchemy/common/gpiolib.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/mips/alchemy/common/gpiolib.c b/arch/mips/alchemy/common/gpiolib.c
index 1b16daaa86ae..411f70ceb762 100644
--- a/arch/mips/alchemy/common/gpiolib.c
+++ b/arch/mips/alchemy/common/gpiolib.c
@@ -119,9 +119,11 @@ static int alchemy_gpic_get(struct gpio_chip *chip, unsigned int off)
return !!au1300_gpio_get_value(off + AU1300_GPIO_BASE);
}
-static void alchemy_gpic_set(struct gpio_chip *chip, unsigned int off, int v)
+static int alchemy_gpic_set(struct gpio_chip *chip, unsigned int off, int v)
{
au1300_gpio_set_value(off + AU1300_GPIO_BASE, v);
+
+ return 0;
}
static int alchemy_gpic_dir_input(struct gpio_chip *chip, unsigned int off)
@@ -145,7 +147,7 @@ static struct gpio_chip au1300_gpiochip = {
.direction_input = alchemy_gpic_dir_input,
.direction_output = alchemy_gpic_dir_output,
.get = alchemy_gpic_get,
- .set = alchemy_gpic_set,
+ .set_rv = alchemy_gpic_set,
.to_irq = alchemy_gpic_gpio_to_irq,
.base = AU1300_GPIO_BASE,
.ngpio = AU1300_GPIO_NUM,
--
2.45.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] MIPS: txx9: gpio: use new line value setter callbacks
2025-04-07 7:25 [PATCH 0/4] MIPS: convert board-file GPIO drivers to using new value setters Bartosz Golaszewski
` (2 preceding siblings ...)
2025-04-07 7:25 ` [PATCH 3/4] MIPS: alchemy: " Bartosz Golaszewski
@ 2025-04-07 7:25 ` Bartosz Golaszewski
2025-04-15 8:32 ` [PATCH 0/4] MIPS: convert board-file GPIO drivers to using new value setters Linus Walleij
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-04-07 7:25 UTC (permalink / raw)
To: Thomas Bogendoerfer, Linus Walleij, Bartosz Golaszewski
Cc: linux-mips, linux-kernel, linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the drivers to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
arch/mips/kernel/gpio_txx9.c | 8 +++++---
arch/mips/txx9/generic/setup.c | 8 +++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/arch/mips/kernel/gpio_txx9.c b/arch/mips/kernel/gpio_txx9.c
index 8c083612df9d..027fb57d0d79 100644
--- a/arch/mips/kernel/gpio_txx9.c
+++ b/arch/mips/kernel/gpio_txx9.c
@@ -32,14 +32,16 @@ static void txx9_gpio_set_raw(unsigned int offset, int value)
__raw_writel(val, &txx9_pioptr->dout);
}
-static void txx9_gpio_set(struct gpio_chip *chip, unsigned int offset,
- int value)
+static int txx9_gpio_set(struct gpio_chip *chip, unsigned int offset,
+ int value)
{
unsigned long flags;
spin_lock_irqsave(&txx9_gpio_lock, flags);
txx9_gpio_set_raw(offset, value);
mmiowb();
spin_unlock_irqrestore(&txx9_gpio_lock, flags);
+
+ return 0;
}
static int txx9_gpio_dir_in(struct gpio_chip *chip, unsigned int offset)
@@ -68,7 +70,7 @@ static int txx9_gpio_dir_out(struct gpio_chip *chip, unsigned int offset,
static struct gpio_chip txx9_gpio_chip = {
.get = txx9_gpio_get,
- .set = txx9_gpio_set,
+ .set_rv = txx9_gpio_set,
.direction_input = txx9_gpio_dir_in,
.direction_output = txx9_gpio_dir_out,
.label = "TXx9",
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 1e67fecd466e..0586ca7668b4 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -603,8 +603,8 @@ static int txx9_iocled_get(struct gpio_chip *chip, unsigned int offset)
return !!(data->cur_val & (1 << offset));
}
-static void txx9_iocled_set(struct gpio_chip *chip, unsigned int offset,
- int value)
+static int txx9_iocled_set(struct gpio_chip *chip, unsigned int offset,
+ int value)
{
struct txx9_iocled_data *data = gpiochip_get_data(chip);
unsigned long flags;
@@ -616,6 +616,8 @@ static void txx9_iocled_set(struct gpio_chip *chip, unsigned int offset,
writeb(data->cur_val, data->mmioaddr);
mmiowb();
spin_unlock_irqrestore(&txx9_iocled_lock, flags);
+
+ return 0;
}
static int txx9_iocled_dir_in(struct gpio_chip *chip, unsigned int offset)
@@ -653,7 +655,7 @@ void __init txx9_iocled_init(unsigned long baseaddr,
if (!iocled->mmioaddr)
goto out_free;
iocled->chip.get = txx9_iocled_get;
- iocled->chip.set = txx9_iocled_set;
+ iocled->chip.set_rv = txx9_iocled_set;
iocled->chip.direction_input = txx9_iocled_dir_in;
iocled->chip.direction_output = txx9_iocled_dir_out;
iocled->chip.label = "iocled";
--
2.45.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] MIPS: convert board-file GPIO drivers to using new value setters
2025-04-07 7:25 [PATCH 0/4] MIPS: convert board-file GPIO drivers to using new value setters Bartosz Golaszewski
` (3 preceding siblings ...)
2025-04-07 7:25 ` [PATCH 4/4] MIPS: txx9: " Bartosz Golaszewski
@ 2025-04-15 8:32 ` Linus Walleij
2025-04-23 15:16 ` Bartosz Golaszewski
2025-04-27 7:55 ` Thomas Bogendoerfer
6 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2025-04-15 8:32 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Thomas Bogendoerfer, linux-mips, linux-kernel, linux-gpio,
Bartosz Golaszewski
On Mon, Apr 7, 2025 at 9:25 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> struct gpio_chip now has callbacks for setting line values that return
> an integer, allowing to indicate failures. We're in the process of
> converting all GPIO drivers to using the new API. This series converts
> all MIPS board-file level controllers.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
The series:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] MIPS: convert board-file GPIO drivers to using new value setters
2025-04-07 7:25 [PATCH 0/4] MIPS: convert board-file GPIO drivers to using new value setters Bartosz Golaszewski
` (4 preceding siblings ...)
2025-04-15 8:32 ` [PATCH 0/4] MIPS: convert board-file GPIO drivers to using new value setters Linus Walleij
@ 2025-04-23 15:16 ` Bartosz Golaszewski
2025-04-27 7:55 ` Thomas Bogendoerfer
6 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-04-23 15:16 UTC (permalink / raw)
To: Thomas Bogendoerfer, Linus Walleij, Bartosz Golaszewski
Cc: linux-mips, linux-kernel, linux-gpio, Bartosz Golaszewski
On Mon, Apr 7, 2025 at 9:25 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> struct gpio_chip now has callbacks for setting line values that return
> an integer, allowing to indicate failures. We're in the process of
> converting all GPIO drivers to using the new API. This series converts
> all MIPS board-file level controllers.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> Bartosz Golaszewski (4):
> MIPS: rb532: gpio: use new line value setter callbacks
> MIPS: bcm63xx: gpio: use new line value setter callbacks
> MIPS: alchemy: gpio: use new line value setter callbacks
> MIPS: txx9: gpio: use new line value setter callbacks
>
> arch/mips/alchemy/common/gpiolib.c | 6 ++++--
> arch/mips/bcm63xx/gpio.c | 7 ++++---
> arch/mips/kernel/gpio_txx9.c | 8 +++++---
> arch/mips/rb532/gpio.c | 8 +++++---
> arch/mips/txx9/generic/setup.c | 8 +++++---
> 5 files changed, 23 insertions(+), 14 deletions(-)
> ---
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
> change-id: 20250324-gpiochip-set-rv-mips-43c07e67328e
>
> Best regards,
> --
> Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
Gentle ping.
Bart
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] MIPS: convert board-file GPIO drivers to using new value setters
2025-04-07 7:25 [PATCH 0/4] MIPS: convert board-file GPIO drivers to using new value setters Bartosz Golaszewski
` (5 preceding siblings ...)
2025-04-23 15:16 ` Bartosz Golaszewski
@ 2025-04-27 7:55 ` Thomas Bogendoerfer
6 siblings, 0 replies; 8+ messages in thread
From: Thomas Bogendoerfer @ 2025-04-27 7:55 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Linus Walleij, linux-mips, linux-kernel, linux-gpio,
Bartosz Golaszewski
On Mon, Apr 07, 2025 at 09:25:06AM +0200, Bartosz Golaszewski wrote:
> struct gpio_chip now has callbacks for setting line values that return
> an integer, allowing to indicate failures. We're in the process of
> converting all GPIO drivers to using the new API. This series converts
> all MIPS board-file level controllers.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> Bartosz Golaszewski (4):
> MIPS: rb532: gpio: use new line value setter callbacks
> MIPS: bcm63xx: gpio: use new line value setter callbacks
> MIPS: alchemy: gpio: use new line value setter callbacks
> MIPS: txx9: gpio: use new line value setter callbacks
>
> arch/mips/alchemy/common/gpiolib.c | 6 ++++--
> arch/mips/bcm63xx/gpio.c | 7 ++++---
> arch/mips/kernel/gpio_txx9.c | 8 +++++---
> arch/mips/rb532/gpio.c | 8 +++++---
> arch/mips/txx9/generic/setup.c | 8 +++++---
> 5 files changed, 23 insertions(+), 14 deletions(-)
series applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 8+ messages in thread