forked from torvalds/linux
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
USB: serial: cp210x: Add support for GPIOs on CP2108
Similar to other CP210x devices, GPIO interfaces (gpiochip) should be supported for CP2108. CP2108 has 4 serial interfaces but only 1 set of GPIO pins are shared to all of those interfaces. So, just need to initialize GPIOs of CP2108 with only one interface (I use interface 0). It means just only 1 gpiochip device file will be created for CP2108. CP2108 has 16 GPIOs, So data types of several variables need to be is u16 instead of u8(in struct cp210x_serial_private). This doesn't affect other CP210x devices. Because CP2108 has 16 GPIO pins, the parameter passed by cp210x functions will be different from other CP210x devices. So need to check part number of the device to use correct data format before sending commands to devices. Like CP2104, CP2108 have GPIO pins with configurable options. Therefore, should be mask all pins which are not in GPIO mode in cp2108_gpio_init() function. Alternate functions of GPIO0 to GPIO3 is determine by enhancedfxn_IFC[0] and similar for enhancedfxn_IFC[1] and enhancedfxn_IFC[2]. Refer to CP2108 datasheet at sector "9: GPIO and UART pins" for more detail: https://www.silabs.com/documents/public/data-sheets/cp2108-datasheet.pdf Signed-off-by: Pho Tran <pho.tran@silabs.com>
- Loading branch information
1 parent
5fec21e
commit a465807
Showing
1 changed file
with
219 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters