From: Hanna Hawa <hidden> Date: 2021-03-19 15:22:48
These patches fix the pcs_pin_dbg_show() function for the scenario where
a single register controls multiple pins (i.e. bits_per_mux is not zero)
Additionally, the common formula is moved to a separate function to
allow reuse.
Changes since v3:
-----------------
- define and set variable 'mux_bytes' in one line
- update commit message
Changes since v2:
-----------------
- move read() register to be outside of if condition (as it common
read()).
- Remove extra parentheses
- replace offset variable by direct return statements
Changes since v1:
-----------------
- remove unused variable in In function 'pcs_allocate_pin_table'
(Reported-by: kernel test robot [off-list ref])
Hanna Hawa (3):
pinctrl: pinctrl-single: remove unused variable
pinctrl: pinctrl-single: remove unused parameter
pinctrl: pinctrl-single: fix pcs_pin_dbg_show() when bits_per_mux is
not zero
drivers/pinctrl/pinctrl-single.c | 65 ++++++++++++++++++--------------
1 file changed, 37 insertions(+), 28 deletions(-)
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Hanna Hawa <hidden> Date: 2021-03-19 15:23:20
A System Error (SError, followed by kernel panic) was detected when
trying to print the supported pins in a pinctrl device which supports
multiple pins per register. This change fixes the pcs_pin_dbg_show() in
pinctrl-single driver when bits_per_mux is not zero. In addition move
offset calculation and pin offset in register to common function.
Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules")
Signed-off-by: Hanna Hawa <redacted>
Reviewed-by: Andy Shevchenko <redacted>
---
drivers/pinctrl/pinctrl-single.c | 55 ++++++++++++++++++++------------
1 file changed, 35 insertions(+), 20 deletions(-)
@@ -384,7 +408,6 @@ static int pcs_request_gpio(struct pinctrl_dev *pctldev,structpcs_device*pcs=pinctrl_dev_get_drvdata(pctldev);structpcs_gpiofunc_range*frange=NULL;structlist_head*pos,*tmp;-intmux_bytes=0;unsigneddata;/* If function mask is null, return directly. */
@@ -392,29 +415,27 @@ static int pcs_request_gpio(struct pinctrl_dev *pctldev,return-ENOTSUPP;list_for_each_safe(pos,tmp,&pcs->gpiofuncs){+u32offset;+frange=list_entry(pos,structpcs_gpiofunc_range,node);if(pin>=frange->offset+frange->npins||pin<frange->offset)continue;-mux_bytes=pcs->width/BITS_PER_BYTE;-if(pcs->bits_per_mux){-intbyte_num,offset,pin_shift;+offset=pcs_pin_reg_offset_get(pcs,pin);-byte_num=(pcs->bits_per_pin*pin)/BITS_PER_BYTE;-offset=(byte_num/mux_bytes)*mux_bytes;-pin_shift=pin%(pcs->width/pcs->bits_per_pin)*-pcs->bits_per_pin;+if(pcs->bits_per_mux){+intpin_shift=pcs_pin_shift_reg_get(pcs,pin);data=pcs->read(pcs->base+offset);data&=~(pcs->fmask<<pin_shift);data|=frange->gpiofunc<<pin_shift;pcs->write(data,pcs->base+offset);}else{-data=pcs->read(pcs->base+pin*mux_bytes);+data=pcs->read(pcs->base+offset);data&=~pcs->fmask;data|=frange->gpiofunc;-pcs->write(data,pcs->base+pin*mux_bytes);+pcs->write(data,pcs->base+offset);}break;}
From: Tony Lindgren <tony@atomide.com> Date: 2021-03-24 12:18:53
* Hanna Hawa [off-list ref] [700101 02:00]:
A System Error (SError, followed by kernel panic) was detected when
trying to print the supported pins in a pinctrl device which supports
multiple pins per register. This change fixes the pcs_pin_dbg_show() in
pinctrl-single driver when bits_per_mux is not zero. In addition move
offset calculation and pin offset in register to common function.
On Fri, Mar 19, 2021 at 05:21:30PM +0200, Hanna Hawa wrote:
These patches fix the pcs_pin_dbg_show() function for the scenario where
a single register controls multiple pins (i.e. bits_per_mux is not zero)
Additionally, the common formula is moved to a separate function to
allow reuse.
Changes since v3:
-----------------
- define and set variable 'mux_bytes' in one line
- update commit message
Changes since v2:
-----------------
- move read() register to be outside of if condition (as it common
read()).
- Remove extra parentheses
- replace offset variable by direct return statements
Changes since v1:
-----------------
- remove unused variable in In function 'pcs_allocate_pin_table'
(Reported-by: kernel test robot [off-list ref])
Hanna Hawa (3):
pinctrl: pinctrl-single: remove unused variable
pinctrl: pinctrl-single: remove unused parameter
pinctrl: pinctrl-single: fix pcs_pin_dbg_show() when bits_per_mux is
not zero
drivers/pinctrl/pinctrl-single.c | 65 ++++++++++++++++++--------------
1 file changed, 37 insertions(+), 28 deletions(-)
--
2.17.1
I'm curious what SoC are you using?
It's good to know who has hardware to test bits_per_mux in the future.
I pay attention to pinctrl-single as that is the driver used for the TI
AM3358 SoC used in a variety of BeagleBone boards. It does not use
bits_per_mux, but I can verify that this does not cause any regression
for the AM3358 SoC:
/sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single# cat pins
registered pins: 142
pin 0 (PIN0) 0:? 44e10800 00000027 pinctrl-single
pin 1 (PIN1) 0:? 44e10804 00000027 pinctrl-single
pin 2 (PIN2) 0:? 44e10808 00000027 pinctrl-single
pin 3 (PIN3) 0:? 44e1080c 00000027 pinctrl-single
pin 4 (PIN4) 0:? 44e10810 00000027 pinctrl-single
pin 5 (PIN5) 0:? 44e10814 00000027 pinctrl-single
pin 6 (PIN6) 0:? 44e10818 00000027 pinctrl-single
pin 7 (PIN7) 0:? 44e1081c 00000027 pinctrl-single
pin 8 (PIN8) 22:gpio-96-127 44e10820 00000027 pinctrl-single
pin 9 (PIN9) 23:gpio-96-127 44e10824 00000037 pinctrl-single
pin 10 (PIN10) 26:gpio-96-127 44e10828 00000037 pinctrl-single
pin 11 (PIN11) 27:gpio-96-127 44e1082c 00000037 pinctrl-single
pin 12 (PIN12) 0:? 44e10830 00000037 pinctrl-single
<snip>
pin 140 (PIN140) 0:? 44e10a30 00000028 pinctrl-single
pin 141 (PIN141) 13:gpio-64-95 44e10a34 00000020 pinctrl-single
Reviewed-by: Drew Fustini <redacted>
Thanks,
Drew
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Hawa, Hanna <hidden> Date: 2021-03-24 14:04:51
On 3/22/2021 7:56 AM, Drew Fustini wrote:
I'm curious what SoC are you using?
I'm working on Amazon Annapurna Labs SoCs (based on ARM cortex
processors). That include multiple pins controlled with same register.
It's good to know who has hardware to test bits_per_mux in the future.
I pay attention to pinctrl-single as that is the driver used for the TI
AM3358 SoC used in a variety of BeagleBone boards. It does not use
bits_per_mux, but I can verify that this does not cause any regression
for the AM3358 SoC:
/sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single# cat pins
registered pins: 142
pin 0 (PIN0) 0:? 44e10800 00000027 pinctrl-single
pin 1 (PIN1) 0:? 44e10804 00000027 pinctrl-single
pin 2 (PIN2) 0:? 44e10808 00000027 pinctrl-single
pin 3 (PIN3) 0:? 44e1080c 00000027 pinctrl-single
pin 4 (PIN4) 0:? 44e10810 00000027 pinctrl-single
pin 5 (PIN5) 0:? 44e10814 00000027 pinctrl-single
pin 6 (PIN6) 0:? 44e10818 00000027 pinctrl-single
pin 7 (PIN7) 0:? 44e1081c 00000027 pinctrl-single
pin 8 (PIN8) 22:gpio-96-127 44e10820 00000027 pinctrl-single
pin 9 (PIN9) 23:gpio-96-127 44e10824 00000037 pinctrl-single
pin 10 (PIN10) 26:gpio-96-127 44e10828 00000037 pinctrl-single
pin 11 (PIN11) 27:gpio-96-127 44e1082c 00000037 pinctrl-single
pin 12 (PIN12) 0:? 44e10830 00000037 pinctrl-single
<snip>
pin 140 (PIN140) 0:? 44e10a30 00000028 pinctrl-single
pin 141 (PIN141) 13:gpio-64-95 44e10a34 00000020 pinctrl-single
Reviewed-by: Drew Fustini<redacted>
Thanks for review and verify the change.
Thanks,
Hanna
On Fri, Mar 19, 2021 at 4:22 PM Hanna Hawa [off-list ref] wrote:
These patches fix the pcs_pin_dbg_show() function for the scenario where
a single register controls multiple pins (i.e. bits_per_mux is not zero)
Additionally, the common formula is moved to a separate function to
allow reuse.