Re: [PATCH v2 3/3] dt-bindings: gpio: Add Nuvoton NPCM750 serial I/O expansion interface(SGPIO)
From: Jim Liu
Date: Wed Nov 16 2022 - 02:58:39 EST
Hi Krzysztof
Thanks for your reply.
Our sgpio has 8 regs to control output and 8 regs to control input.
Each reg size is one byte.
and the sgpio interface has 4 pins(s_clk, d_out, d_in, LDSH).
The clock is generated by APB3, and one operation cycle includes input
and output
beginning the signal, the LDSH is low and now will send output serial data ,
after finished output serial data the LDSH will be high and get serial
input data.
The in/out serial data size is byte * ports , and direct to update the regs.
> the driver will open the ports to use.
> ex: if i set d_out=9 and d_in=20
The Soc is controlled by port, not by each bit.
So if users need 9 output pins, the driver needs to open two ports,
because each reg is one byte.
if users need 20 input pins ,the driver needs to open three ports.
The list has some rules for use, The first half is the output and the
second half is the input.
the example as below:
if i set d_out=8 d_in=8
root@buv-runbmc:~# gpioinfo 8
gpiochip8 - 16 lines:
line 0: unnamed unused output active-high
line 1: unnamed unused output active-high
line 2: unnamed unused output active-high
line 3: unnamed unused output active-high
line 4: unnamed unused output active-high
line 5: unnamed unused output active-high
line 6: unnamed unused output active-high
line 7: unnamed unused output active-high
line 8: unnamed unused input active-high
line 9: unnamed unused input active-high
line 10: unnamed unused input active-high
line 11: unnamed unused input active-high
line 12: unnamed unused input active-high
line 13: unnamed unused input active-high
line 14: unnamed unused input active-high
line 15: unnamed unused input active-high
the line0~line7 will map to output reg1 and line8~line15 will map to
input reg1 and so on.
and thanks again for your suggestions and information for dts naming.
So I need to modify it from sgpio1 to gpio8
am i correct?
Best regards,
Jim
On Tue, Nov 15, 2022 at 5:58 PM Krzysztof Kozlowski
<krzysztof.kozlowski@xxxxxxxxxx> wrote:
>
> On 15/11/2022 10:21, Jim Liu wrote:
> > Hi Linus and Krzysztof
> >
> > Thanks for your understanding and your suggestion.
> > I will follow your suggestion to modify the yaml file.
> > -> nuvoton,input-ngpios = <...>
> > -> nuvoton,output-ngpios = <...>
> >
> > And I don't think the node name needs to use gpio.
> > because it's not a general gpio, so I reference aspeed dts and use sgpio.
> > Could I use the sgpio node name or could you provide some suggestions?
>
> Aspeed DTS has poor code readability (not following several common DT
> conventions), so using it as an example or argument is not correct
> approach. Nodes have name "gpio" for GPIO controllers or one of
> pinctrl.yaml for pin controllers.
>
> Best regards,
> Krzysztof
>