[Letux-kernel] X1600 Pullup/down

Paul Boddie paul at boddie.org.uk
Fri Mar 15 12:06:19 CET 2024


On 2024-03-15 06:48, H. Nikolaus Schaller wrote:
> 
> it may be that we have a bug for setting the pullup/down registers for 
> the x1600.
> 
> This is done in ingenic_set_bias().
> 
> Since the ID_X1600 >= ID_JZ4770 it calls
> 
> 	ingenic_config_pin(jzpc, pin, JZ4770_GPIO_PEN, !bias);
> 
> Now JZ4770_GPIO_PEN is defined as 0x70.
> 
> But the PULL-UP/DOWN enabled State register is at offset 0x80 and
> there are SET and CLEAR registers at 0x84 and 0x88. There seems to be 
> no equivalent
> with any other chip, not even the X1830 or X2000.

Indeed. The X1600 has a pull enable register at 0x80 and a different 
edge-related register at 0x70. I hadn't looked at this initially, but my 
own separate code does pull-up/down configuration and appears to work, 
at least as far as I have tested it (which isn't much).

> So we have to add new register constants. Something like
> 
> #define X1600_GPIO_PEN                         0x80
> 
>         } else if (is_soc_or_above(jzpc, ID_X1600)) {
>                  ingenic_config_pin(jzpc, pin, X1600_GPIO_PEN, !bias);
>         } else if (is_soc_or_above(jzpc, ID_JZ4770)) {
>                  ingenic_config_pin(jzpc, pin, JZ4770_GPIO_PEN, !bias);
> 
> BTW: we have the same issue in our letux-5.10.y-lx16 kernel.
> And it got unnoticed since I had no application so far that relies on
> pullup/down...
> 
> Do you think this is the right way to go?

Yes, I think some kind of test involving the new register is required. 
Unlike earlier SoCs like the JZ4780, however, it is used to enable, not 
disable, pull-up/down.

Paul


More information about the Letux-kernel mailing list