Re: [PATCH V2 7/7] USB: serial: f81232: Add gpiolib to GPIO device

From: Ji-Ze Hong (Peter Hong)
Date: Wed Jan 08 2020 - 21:43:52 EST


Hi Johan,

Johan Hovold æ 2020/1/8 äå 10:46 åé:
On Wed, Oct 30, 2019 at 10:00:12AM +0800, Ji-Ze Hong (Peter Hong) wrote:

We had 2 type about GPIO pins, MODEx_y & GPIOxx. All MODEx_y & GPIOxx
are GPIOs and can be controlled by GPIO device, but they had some
difference about usage.
MODEx_y:
1. 3 pins(x: 0/1/2) can be access by UART port y.
2. Used to control UART's transceiver normally, but it
also can be configure as GPIO when UART disabled by
H/W (DTR strap to GND).
GPIOxx:
1. Access only by GPIO device.

The series patch only support RS233 mode for all serial port, So we'll
direct set all MODEx_y to (0/0/1) for our demo board for default. If
user really want to use the pin, we had provide the gpiolib with GPIO
device, but we'll recommend user to use GPIOxy first.

Do you mean that you'd need to register a separate gpio chip per port in
order to expose an interface for changing the MODEx_y pins for an
enabled UART? Or can you do that through the "global" gpio device?

No, I still implement the gpiolib in GPIO Device. Sorry for bad
describe.

Is any suggest about this ? Could I maintain this for this series patch?

I understood from your other mail that the gpio device would not be able
to control the pins of an enabled port. In either case, I think you need
to refuse a request for a pin that's already in use by the corresponding
port.

OK, I'll change the code as previous mail as following:

I can read the UART enable state from GPIO Device, so I can do when the
GPIO is associated with UART enabled, change it as output only otherwise
can be set to input/output.

Also is there a way to determine the number of available pins by
detecting the chip/package type? I'm assuming not all 36 pins are always
accessible?

Yes, we had register to get package type, I'll add UART enable & package
type to determinate final GPIO pin out.

--
With Best Regards,
Peter Hong