mbox series

[v5,0/7] gpio: exar: refactor the driver

Message ID 20201116104242.19907-1-brgl@bgdev.pl
Headers show
Series gpio: exar: refactor the driver | expand

Message

Bartosz Golaszewski Nov. 16, 2020, 10:42 a.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

I just wanted to convert the driver to using simpler IDA API but ended up
quickly converting it to using regmap. Unfortunately I don't have the HW
to test it so marking the patches that introduce functional change as RFT
and Cc'ing the original author.

v1 -> v2:
- add new regmap helper: regmap_assign_bits()
- fix lvl vs sel register access
- set value in direction_output callback

v2 -> v3:
- drop the regmap helper from series

v3 -> v4:
- renamed the regmap variable to 'regmap' as leaving the old name caused me
  to miss an assignment leading to a crash (culprit spotted by Andy Shevchenko)

v4 -> v5:
- set the reg_bits to 11 in regmap config
- collect review tags from Andy

Bartosz Golaszewski (7):
  gpio: exar: add a newline after the copyright notice
  gpio: exar: include idr.h
  gpio: exar: switch to a simpler IDA interface
  gpio: exar: use a helper variable for &pdev->dev
  gpio: exar: unduplicate address and offset computation
  gpio: exar: switch to using regmap
  gpio: exar: use devm action for freeing the IDA and drop remove()

 drivers/gpio/Kconfig     |   1 +
 drivers/gpio/gpio-exar.c | 160 ++++++++++++++++++++-------------------
 2 files changed, 82 insertions(+), 79 deletions(-)

Comments

Bartosz Golaszewski Nov. 23, 2020, 11:38 a.m. UTC | #1
On Mon, Nov 16, 2020 at 11:42 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> I just wanted to convert the driver to using simpler IDA API but ended up
> quickly converting it to using regmap. Unfortunately I don't have the HW
> to test it so marking the patches that introduce functional change as RFT
> and Cc'ing the original author.
>

Hi Jan!

Could you give this last version a final spin before I merge it?

Bartosz
Jan Kiszka Nov. 23, 2020, 11:58 a.m. UTC | #2
On 23.11.20 12:38, Bartosz Golaszewski wrote:
> On Mon, Nov 16, 2020 at 11:42 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>>
>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>
>> I just wanted to convert the driver to using simpler IDA API but ended up
>> quickly converting it to using regmap. Unfortunately I don't have the HW
>> to test it so marking the patches that introduce functional change as RFT
>> and Cc'ing the original author.
>>
> 
> Hi Jan!
> 
> Could you give this last version a final spin before I merge it?
> 

[   14.250117] exar_serial 0000:02:00.0: enabling device (0000 -> 0002)
[   14.336622] 0000:02:00.0: ttyS2 at MMIO 0x90000000 (irq = 44, base_baud = 7812500) is a XR17V35X
[   14.391588] 0000:02:00.0: ttyS3 at MMIO 0x90000400 (irq = 44, base_baud = 7812500) is a XR17V35X
[   19.250510] gpio_exar: probe of gpio_exar.1.auto failed with error -22

That's "new"...

Jan
Jan Kiszka Nov. 23, 2020, 12:08 p.m. UTC | #3
On 23.11.20 12:58, Jan Kiszka wrote:
> On 23.11.20 12:38, Bartosz Golaszewski wrote:
>> On Mon, Nov 16, 2020 at 11:42 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>>>
>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>
>>> I just wanted to convert the driver to using simpler IDA API but ended up
>>> quickly converting it to using regmap. Unfortunately I don't have the HW
>>> to test it so marking the patches that introduce functional change as RFT
>>> and Cc'ing the original author.
>>>
>>
>> Hi Jan!
>>
>> Could you give this last version a final spin before I merge it?
>>
> 
> [   14.250117] exar_serial 0000:02:00.0: enabling device (0000 -> 0002)
> [   14.336622] 0000:02:00.0: ttyS2 at MMIO 0x90000000 (irq = 44, base_baud = 7812500) is a XR17V35X
> [   14.391588] 0000:02:00.0: ttyS3 at MMIO 0x90000400 (irq = 44, base_baud = 7812500) is a XR17V35X
> [   19.250510] gpio_exar: probe of gpio_exar.1.auto failed with error -22
> 
> That's "new"...
> 

Bisected to "gpio: exar: switch to using regmap" again.

Jan
Bartosz Golaszewski Nov. 23, 2020, 12:12 p.m. UTC | #4
Thanks!On Mon, Nov 23, 2020 at 1:03 PM Jan Kiszka
<jan.kiszka@siemens.com> wrote:
>
> On 23.11.20 12:38, Bartosz Golaszewski wrote:
> > On Mon, Nov 16, 2020 at 11:42 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >>
> >> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >>
> >> I just wanted to convert the driver to using simpler IDA API but ended up
> >> quickly converting it to using regmap. Unfortunately I don't have the HW
> >> to test it so marking the patches that introduce functional change as RFT
> >> and Cc'ing the original author.
> >>
> >
> > Hi Jan!
> >
> > Could you give this last version a final spin before I merge it?
> >
>
> [   14.250117] exar_serial 0000:02:00.0: enabling device (0000 -> 0002)
> [   14.336622] 0000:02:00.0: ttyS2 at MMIO 0x90000000 (irq = 44, base_baud = 7812500) is a XR17V35X
> [   14.391588] 0000:02:00.0: ttyS3 at MMIO 0x90000400 (irq = 44, base_baud = 7812500) is a XR17V35X
> [   19.250510] gpio_exar: probe of gpio_exar.1.auto failed with error -22
>
> That's "new"...
>

And if you change reg_bits from 11 to 16?

Bartosz
Bartosz Golaszewski Nov. 23, 2020, 12:51 p.m. UTC | #5
On Mon, Nov 23, 2020 at 1:12 PM Jan Kiszka <jan.kiszka@siemens.com> wrote:
>
> On 23.11.20 12:58, Jan Kiszka wrote:
> > On 23.11.20 12:38, Bartosz Golaszewski wrote:
> >> On Mon, Nov 16, 2020 at 11:42 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >>>
> >>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >>>
> >>> I just wanted to convert the driver to using simpler IDA API but ended up
> >>> quickly converting it to using regmap. Unfortunately I don't have the HW
> >>> to test it so marking the patches that introduce functional change as RFT
> >>> and Cc'ing the original author.
> >>>
> >>
> >> Hi Jan!
> >>
> >> Could you give this last version a final spin before I merge it?
> >>
> >
> > [   14.250117] exar_serial 0000:02:00.0: enabling device (0000 -> 0002)
> > [   14.336622] 0000:02:00.0: ttyS2 at MMIO 0x90000000 (irq = 44, base_baud = 7812500) is a XR17V35X
> > [   14.391588] 0000:02:00.0: ttyS3 at MMIO 0x90000400 (irq = 44, base_baud = 7812500) is a XR17V35X
> > [   19.250510] gpio_exar: probe of gpio_exar.1.auto failed with error -22
> >
> > That's "new"...
> >
>
> Bisected to "gpio: exar: switch to using regmap" again.
>

I'm not sure if you saw my email which I sent at the same time as you
- but does reverting reg_bits to 16 help?

Bart
Jan Kiszka Nov. 23, 2020, 12:57 p.m. UTC | #6
On 23.11.20 13:12, Bartosz Golaszewski wrote:
> Thanks!On Mon, Nov 23, 2020 at 1:03 PM Jan Kiszka
> <jan.kiszka@siemens.com> wrote:
>>
>> On 23.11.20 12:38, Bartosz Golaszewski wrote:
>>> On Mon, Nov 16, 2020 at 11:42 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>>>>
>>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>>
>>>> I just wanted to convert the driver to using simpler IDA API but ended up
>>>> quickly converting it to using regmap. Unfortunately I don't have the HW
>>>> to test it so marking the patches that introduce functional change as RFT
>>>> and Cc'ing the original author.
>>>>
>>>
>>> Hi Jan!
>>>
>>> Could you give this last version a final spin before I merge it?
>>>
>>
>> [   14.250117] exar_serial 0000:02:00.0: enabling device (0000 -> 0002)
>> [   14.336622] 0000:02:00.0: ttyS2 at MMIO 0x90000000 (irq = 44, base_baud = 7812500) is a XR17V35X
>> [   14.391588] 0000:02:00.0: ttyS3 at MMIO 0x90000400 (irq = 44, base_baud = 7812500) is a XR17V35X
>> [   19.250510] gpio_exar: probe of gpio_exar.1.auto failed with error -22
>>
>> That's "new"...
>>
> 
> And if you change reg_bits from 11 to 16?
> 

16 works. Didn't we have that already?

Jan
Bartosz Golaszewski Nov. 23, 2020, 1:33 p.m. UTC | #7
On Mon, Nov 23, 2020 at 2:00 PM Jan Kiszka <jan.kiszka@siemens.com> wrote:
>
> On 23.11.20 13:12, Bartosz Golaszewski wrote:
> > Thanks!On Mon, Nov 23, 2020 at 1:03 PM Jan Kiszka
> > <jan.kiszka@siemens.com> wrote:
> >>
> >> On 23.11.20 12:38, Bartosz Golaszewski wrote:
> >>> On Mon, Nov 16, 2020 at 11:42 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >>>>
> >>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >>>>
> >>>> I just wanted to convert the driver to using simpler IDA API but ended up
> >>>> quickly converting it to using regmap. Unfortunately I don't have the HW
> >>>> to test it so marking the patches that introduce functional change as RFT
> >>>> and Cc'ing the original author.
> >>>>
> >>>
> >>> Hi Jan!
> >>>
> >>> Could you give this last version a final spin before I merge it?
> >>>
> >>
> >> [   14.250117] exar_serial 0000:02:00.0: enabling device (0000 -> 0002)
> >> [   14.336622] 0000:02:00.0: ttyS2 at MMIO 0x90000000 (irq = 44, base_baud = 7812500) is a XR17V35X
> >> [   14.391588] 0000:02:00.0: ttyS3 at MMIO 0x90000400 (irq = 44, base_baud = 7812500) is a XR17V35X
> >> [   19.250510] gpio_exar: probe of gpio_exar.1.auto failed with error -22
> >>
> >> That's "new"...
> >>
> >
> > And if you change reg_bits from 11 to 16?
> >
>
> 16 works. Didn't we have that already?
>
> Jan

Yes we have, Andy suggested 11 is fine because it fits the highest
address we need to access but it seems regmap doesn't like this value.
Ok so I'll change it when applying, is that fine with you?

Bart
Andy Shevchenko Nov. 23, 2020, 1:37 p.m. UTC | #8
On Mon, Nov 23, 2020 at 01:57:07PM +0100, Jan Kiszka wrote:
> On 23.11.20 13:12, Bartosz Golaszewski wrote:
> > Thanks!On Mon, Nov 23, 2020 at 1:03 PM Jan Kiszka
> > <jan.kiszka@siemens.com> wrote:
> >>
> >> On 23.11.20 12:38, Bartosz Golaszewski wrote:
> >>> On Mon, Nov 16, 2020 at 11:42 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >>>>
> >>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >>>>
> >>>> I just wanted to convert the driver to using simpler IDA API but ended up
> >>>> quickly converting it to using regmap. Unfortunately I don't have the HW
> >>>> to test it so marking the patches that introduce functional change as RFT
> >>>> and Cc'ing the original author.
> >>>>
> >>>
> >>> Hi Jan!
> >>>
> >>> Could you give this last version a final spin before I merge it?
> >>>
> >>
> >> [   14.250117] exar_serial 0000:02:00.0: enabling device (0000 -> 0002)
> >> [   14.336622] 0000:02:00.0: ttyS2 at MMIO 0x90000000 (irq = 44, base_baud = 7812500) is a XR17V35X
> >> [   14.391588] 0000:02:00.0: ttyS3 at MMIO 0x90000400 (irq = 44, base_baud = 7812500) is a XR17V35X
> >> [   19.250510] gpio_exar: probe of gpio_exar.1.auto failed with error -22
> >>
> >> That's "new"...
> >>
> > 
> > And if you change reg_bits from 11 to 16?
> > 
> 
> 16 works. Didn't we have that already?

Yes, but it puzzles me what the idea behind it and don't we see the regmap
issue here.  In any case, I'm fine with 16 there, although it's not clear
to me why 11 is not working...