Skip to contentSkip to conversation

zx279128s pinmux questions

DISCUSSION Stefan Dösinger 2 participants 4 messages Nov 20 – Nov 22

lore
Share & tools
lore
#0 lore raw

Hi Navid, Agustin,

My next goal is to clean up my zx297520v3 pin control driver and write a proper binding. Before I do that I would like to understand how pinctrl works on your board to decide how much code reuse makes sense.

My main question is if the zx27 board can control individual pins or if multiple pins need to be controlled together. On zx297520v3 I can set every pin individually. Does the same apply to your boards?

The background: There are two ways to write pinctrl bindings and drivers:
Either exposing a simple pinmux=<int> setting, that sets pin 123 to a specified function. The other way is to collect groups of pins and possible functions they can be assigned to in the driver. They are controlled via strings. I prefer to go via the former one, but as far as I understand it, this is not possible if hardware links two or more pins together.

Can you advise me on what you know about your board's pin control?

Cheers,
Stefan

#1 lore raw

Hi Stefan,

On the ZX279128S the pins are individually controllable.

The chip's manual has a table of the pads (GPIO 0-63, in order) with up to four functions each; e.g. JTAG_TDO can be JTAG_TDO, SIM_VCCEN, UART1_TXD or GPIO2. It doesn't give the register bits, so I mapped those from the stock U-Boot (it writes a per-board table into the block) and by flipping bits on my H3600 and watching the GPIO inputs:

- 0x94200000 + 0x00..0x0c hold the mux, one field per pin, 2 bits where the pad has several functions and 1 bit (function or GPIO) where it has one. E.g. bits 2k+1:2k of +0x00 are GPIO k for k = 0..10, and +0x08 holds the NAND/SPI-NAND pads.
- +0x30..+0x38 have one bit per pin; clearing it makes the pin read 0, so probably an input enable.
- +0x50..+0xa4 have a 6-bit config field per pin, five per word. Bits 1:0 are the pull (01 up, 10 down); I haven't decoded the rest.

The layout is irregular, though (GPIO 11-21 sit in +0x04, GPIO 36-41 at the top of +0x00, and the 1-bit pads in +0x0c are out of order), so a driver needs a table per pin with the mux and config positions, much like the old pinctrl-zx296718. With that table, a pinmux = <pin function> binding like yours should work for us too.

I have the per-pin table (manual functions plus the register positions found so far, some still unverified) if it's useful to you or Navid.

Agustin

#2 lore raw

Hi Stefan,

A follow-up to my earlier mail, with the details behind it. No mux field on the ZX279128S controls more than one pin: each pin has its own field, so nothing is linked together and a pinmux = <pin function> binding works for us too. The fields are just not in pin order, so the driver needs a table of where each pin's field is. This is what we have so far.

Pin numbers are GPIO numbers; the functions come from the manual's pad table, listed by mux value (0/1/2/3). For 1-bit fields, 0 = function and 1 = GPIO. The last column says where each position comes from:
"hw" = flipped on my board and seen on the GPIO input, "code" = written by the stock U-Boot or kernel for that pin, "inf" = inferred from the manual and the board tables, not tested.

Mux, 0x94200000:

  reg   bits       pins       functions                         src
  0x00  2k+1:2k    GPIO0-10   e.g. GPIO2 = JTAG_TDO/SIM_VCCEN/   hw: 1-3,8,9
                   (k=0..10)  UART1_TXD/GPIO2                    code: 5
                                                                 inf: rest
  0x00  22, 23     GPIO36,37  UART0 RXD, TXD                     hw
  0x00  24..27     GPIO38-41  I2C0 SCL/SDA, I2C1 SCL/SDA         hw
  0x04  1:0        GPIO11     SSP0_FS0                           inf
  0x04  3:2        GPIO12     SSP0_FS1                           hw
  0x04  5:4        GPIO14     SSP0_FS3                           hw
  0x04  7:6        GPIO15     SSP0_RXD                           code
  0x04  9:8        GPIO16     SSP0_TXD                           hw
  0x04  11:10..    GPIO17-21  SSP0_SCLK, PCM CLK/FS/TXD/RXD      inf
        19:18
  0x04  21:20      GPIO13     SSP0_FS2                           hw
  0x04  23:22      GPIO42     RGMII TXCLK                        inf
  0x08  2k+1:2k    GPIO22-35  NAND ADQ0-7 and control pads;      code
        (k=0..13)             1 on the control pads = SPI-NAND
  0x0c  0          GPIO53     PCIE0_nCLKREQ                      hw
  0x0c  1          GPIO54     PCIE1_RSTB                         code
  0x0c  2          GPIO55     PCIE1_nCLKREQ                      hw
  0x0c  3..6       GPIO56-59  GEPHY LED0-3                       hw
  0x0c  7..11      GPIO43-47  RGMII TXCTL, TXD0-3                inf
  0x0c  12, 13     GPIO50,51  TX/RX_PWRDOWN                      hw
  0x0c  14         GPIO52     PCIE0_RSTB                         code
  0x0c  15, 16     GPIO48,49  TX_SD, RX_LOS                      hw
  0x0c  18         GPIO60     SDMMC_DATA0                        hw
  0x0c  19, 20     GPIO61,62  MDC0, MDIO0                        code
  0x0c  21         GPIO63     STRAP_NAND_PAGE_SIZE0              hw

Unknown: 0x00 bits 31:28, 0x04 bits 27:24, 0x08 bits 31:28, 0x0c bit 17.

0x30..0x38, one bit per pin: bit n of 0x30 is GPIO n (hw for 1, 2, 3, 8, 9, 12-14, 28, 29); in 0x34 the order is mostly GPIO 32+n but shifts by one from bit 18. Clearing a bit makes the pin read 0.

0x50..0xa4, 6-bit pad config, five fields per word. Three are tested (0x54 field 0 = GPIO6, 0x60 fields 0 and 2 = GPIO18 and GPIO21). The rest seem to follow the manual's pad order (JTAG at 0x50, UART0 at 0x74, I2C at 0x78, PCIe at 0x94/0x98, ...), which puts the pull-ups on UART0_RXD, the I2C pads, the PCIe nCLKREQ pins and JTAG. Bits 1:0 are the pull (01 up, 10 down); bits 5:2 are unknown.

Agustin

#3 lore raw

Hi,

Am Samstag, 21. November 2026, 13:16:15 Ostafrikanische Zeit schrieb Agustin Santiago Isasmendi:

Quoted 8 lines

Hi Stefan,

A follow-up to my earlier mail, with the details behind it. No mux field on the ZX279128S controls more than one pin: each pin has its own field, so nothing is linked together and a pinmux = <pin function> binding works for us too. The fields are just not in pin order, so the driver needs a table of where each pin's field is. This is what we have so far.

Thanks, this looks very similar to zx297520v3. I'll write the driver in the next days and send an RFC when I have something working for my board. Then we can see what changes to the infrastructure are necessary for yours.

I expect the general outline to look like this:

1) Board specific .yamls

2) A zte,zx specific, but SoC independent header that contains a generic macro similar to dt-bindings/pinctrl/stm32-pinfunc.h

3) board-specific macros that define the possible configurations for each pin

4) Board specific driver tables that define the register locations of each pin

5) A generic driver that binds it all together

Am Samstag, 21. November 2026, 12:26:01 Ostafrikanische Zeit schrieben Sie:

Quoted 8 lines

- 0x94200000 + 0x00..0x0c hold the mux, one field per pin, 2 bits where the pad has several functions and 1 bit (function or GPIO) where it has one. E.g. bits 2k+1:2k of +0x00 are GPIO k for k = 0..10, and +0x08 holds the NAND/SPI-NAND pads.
- +0x30..+0x38 have one bit per pin; clearing it makes the pin read 0, so probably an input enable.
- +0x50..+0xa4 have a 6-bit config field per pin, five per word. Bits 1:0 are the pull (01 up, 10 down); I haven't decoded the rest.

My hardware is similar, although it has 3 muxes:

1) "AON" (presumably means "always on")
2) "TOP"
3) "PDCFG"

Whatever is selected in AON is connected to the pin, period. If TOP is enabled, it additionally connects something else - either a hardwired function or whatever is selected in PDCFG.

The result is that two devices can be connected to the same pin at the same time. To prevent them from stepping on each other's toes, it is necessary to set AON to select GPIO and configure the GPIO to input. This also allows snooping on other devices via GPIO - I used this to measure the frequencies of clk0, clk1 and clk2 and confirm how the clock tree works.

The reverse is possible too, on paper. E.g. both Pins 33 and 122 can select UART2_TXD. But in my testing neither pin is connected if I try to do that, so the muxes likely have some checks built into hardware.

There is of course also electrical configuration. It either has 2 bits (bias enable, bias direction) or 8 (bias, input enable, Schmitt trigger, drive strength, slew rate)