gpio/xilinx: Use correct address when setting initial values.
Subsystems (3)
PATCH v2 1/1 gpio/xilinx: Use correct address when setting initial values.
xgpio_save_regs() is used in this driver to setup the initial values of the registers in the hardware.
The relevant registers at that time are:0x0 -> channel 0 data (32 bits, one for each GPIO on this channel). 0x4 -> channel 0 tri, controls in/out status for each GPIO of this channel. 0x8 -> channel 1 data0xC -> channel 1 tri
gpio-xilinx.c defines these:XGPIO_DATA_OFFSET (0x0)XGPIO_TRI_OFFSET (0x4)XGPIO_CHANNEL_OFFSET 0x8
Before this patch, the "data" register value of channel 1 was written at 0x4 intead of 0x8 (overwriting the channel 0 "tri" register), and the "tri" register value for channel 1 was written at 0x8 instead of 0xC.
--- drivers/gpio/gpio-xilinx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-xilinx.c +2 -2
@@ -220,9 +220,9 @@ static void xgpio_save_regs(struct of_mm_gpio_chip *mm_gc)if (!chip->gpio_width[1 ])return ; -xgpio_writereg (mm_gc->regs +XGPIO_DATA_OFFSET +XGPIO_TRI_OFFSET , +xgpio_writereg (mm_gc->regs +XGPIO_DATA_OFFSET +XGPIO_CHANNEL_OFFSET , chip->gpio_state[1 ]); -xgpio_writereg (mm_gc->regs +XGPIO_TRI_OFFSET +XGPIO_TRI_OFFSET , +xgpio_writereg (mm_gc->regs +XGPIO_TRI_OFFSET +XGPIO_CHANNEL_OFFSET , chip->gpio_dir[1 ]); }
Signature · 1 line
1.7.1
Quoted 28 lines · Rapha?l Teysseyre
xgpio_save_regs()is used in this driver to setup the initial values of the registers in the hardware.The relevant registers at that time are:
0x0-> channel 0 data (32 bits, one for each GPIO on this channel).0x4-> channel 0 tri, controls in/out status for each GPIO of this channel.0x8-> channel 1 data0xC-> channel 1 tri
gpio-xilinx.cdefines these:XGPIO_DATA_OFFSET(0x0)XGPIO_TRI_OFFSET(0x4)XGPIO_CHANNEL_OFFSET0x8Before this patch, the "data" register value of channel 1 was written at
0x4intead of0x8(overwriting the channel 0 "tri" register), and the "tri" register value for channel 1 was written at0x8instead of0xC.Signed-off-by Rapha?l Teysseyre <[email protected]>--- drivers/gpio/gpio-xilinx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)drivers/gpio/gpio-xilinx.c +0
-0
drivers/gpio/gpio-xilinx.c static void xgpio_save_regs(struct of_mm_gpio_chip *mm_gc) · line 227
Quoted 10 lines
drivers/gpio/gpio-xilinx.c +2
-2@@ -220,9 +220,9 @@ static void xgpio_save_regs(struct of_mm_gpio_chip *mm_gc)if (!chip->gpio_width[1 ])return ; -xgpio_writereg (mm_gc->regs +XGPIO_DATA_OFFSET +XGPIO_TRI_OFFSET , +xgpio_writereg (mm_gc->regs +XGPIO_DATA_OFFSET +XGPIO_CHANNEL_OFFSET , chip->gpio_state[1 ]); -xgpio_writereg (mm_gc->regs +XGPIO_TRI_OFFSET +XGPIO_TRI_OFFSET , +xgpio_writereg (mm_gc->regs +XGPIO_TRI_OFFSET +XGPIO_CHANNEL_OFFSET , chip->gpio_dir[1 ]); }
Thanks,
Michal
Quoted 9 lines · Rapha?l Teysseyre
xgpio_save_regs()is used in this driver to setup the initial values of the registers in the hardware.The relevant registers at that time are:
0x0-> channel 0 data (32 bits, one for each GPIO on this channel).0x4-> channel 0 tri, controls in/out status for each GPIO of this channel.0x8-> channel 1 data0xC-> channel 1 tri
Quoted 8 lines
gpio-xilinx.cdefines these:XGPIO_DATA_OFFSET(0x0)XGPIO_TRI_OFFSET(0x4)XGPIO_CHANNEL_OFFSET0x8Before this patch, the "data" register value of channel 1 was written at
0x4intead of0x8(overwriting the channel 0 "tri" register), and the "tri" register value for channel 1 was written at0x8instead of0xC.
Nice, descriptive commit log. ;)
Quoted 11 lines
Signed-off-by Rapha?l Teysseyre <[email protected]>--- drivers/gpio/gpio-xilinx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)drivers/gpio/gpio-xilinx.c +0
-0
drivers/gpio/gpio-xilinx.c static void xgpio_save_regs(struct of_mm_gpio_chip *mm_gc) · line 226
Quoted 9 lines
drivers/gpio/gpio-xilinx.c +2
-2@@ -220,9 +220,9 @@ static void xgpio_save_regs(struct of_mm_gpio_chip *mm_gc)if (!chip->gpio_width[1 ])return ; -xgpio_writereg (mm_gc->regs +XGPIO_DATA_OFFSET +XGPIO_TRI_OFFSET , +xgpio_writereg (mm_gc->regs +XGPIO_DATA_OFFSET +XGPIO_CHANNEL_OFFSET , chip->gpio_state[1 ]); -xgpio_writereg (mm_gc->regs +XGPIO_TRI_OFFSET +XGPIO_TRI_OFFSET , +xgpio_writereg (mm_gc->regs +XGPIO_TRI_OFFSET +XGPIO_CHANNEL_OFFSET , chip->gpio_dir[1 ]);
Nit: Maybe XGPIO_CHANNEL_OFFSET should have come before the other offset for clarity, but that's no big deal.
Quoted 14 lines · Rapha?l Teysseyre
xgpio_save_regs()is used in this driver to setup the initial values of the registers in the hardware.The relevant registers at that time are:
0x0-> channel 0 data (32 bits, one for each GPIO on this channel).0x4-> channel 0 tri, controls in/out status for each GPIO of this channel.0x8-> channel 1 data0xC-> channel 1 tri
gpio-xilinx.cdefines these:XGPIO_DATA_OFFSET(0x0)XGPIO_TRI_OFFSET(0x4)XGPIO_CHANNEL_OFFSET0x8
Quoted 5 lines
Before this patch, the "data" register value of channel 1 was written at
0x4intead of0x8(overwriting the channel 0 "tri" register), and the "tri" register value for channel 1 was written at0x8instead of0xC.Signed-off-by Rapha?l Teysseyre <[email protected]>
Patch applied with review tags.
Yours,
Linus Walleij