diff mbox series

[v1] USB: serial: ftdi_sio: add IDs for NEW FTDI Products

Message ID ac28f2c5eba23a645b3b9299c224f2755a233eef.1658385786.git.mallikarjuna.reddy@ftdichip.com
State New
Headers show
Series [v1] USB: serial: ftdi_sio: add IDs for NEW FTDI Products | expand

Commit Message

Amireddy Mallikarjuna Reddy (FTDI-SG) July 21, 2022, 7:02 a.m. UTC
Add the product IDs for the USB-to-Serial devices FT2233HP, FT2233HP,
FT4233HP, FT4232HP, FT233HP, FT232HP, and FT4232HAQ.
Also include BCD values so that the chiptype can be determined.

Signed-off-by: Amireddy mallikarjuna reddy <mallikarjuna.reddy@ftdichip.com>
---
v1:
- Initial version.
---
 drivers/usb/serial/ftdi_sio.c     | 74 +++++++++++++++++++++++++++++--
 drivers/usb/serial/ftdi_sio.h     |  9 +++-
 drivers/usb/serial/ftdi_sio_ids.h |  7 +++
 3 files changed, 86 insertions(+), 4 deletions(-)

Comments

Amireddy Mallikarjuna Reddy (FTDI-SG) Aug. 10, 2022, 3:55 a.m. UTC | #1
Thank you very much for the review Johan.

mallik

On 5/8/2022 7:48 pm, Johan Hovold wrote:
> On Thu, Jul 21, 2022 at 03:02:44PM +0800, Amireddy mallikarjuna reddy wrote:
>> Add the product IDs for the USB-to-Serial devices FT2233HP, FT2233HP,
>> FT4233HP, FT4232HP, FT233HP, FT232HP, and FT4232HAQ.
>> Also include BCD values so that the chiptype can be determined.
>>
>> Signed-off-by: Amireddy mallikarjuna reddy <mallikarjuna.reddy@ftdichip.com>
>> ---
>> v1:
>> - Initial version.
> Thanks for the patch. This looks mostly good even I should revisit some
> clean-up patches I have laying around that gets rid of the unnecessary
> device-type conditionals that you're now extending.
>
> I'll either rebase this patch on top or the other way around, but either
> way I'll get this in in some form in a few weeks (e.g. after the merge
> window closes).
>
> Johan
diff mbox series

Patch

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index b440d338a895..01417f20a106 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -178,6 +178,13 @@  static const struct usb_device_id id_table_combined[] = {
 	{ USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) ,
 		.driver_info = (kernel_ulong_t)&ftdi_8u2232c_quirk },
 	{ USB_DEVICE(FTDI_VID, FTDI_4232H_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_FT2233HP_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_FT4233HP_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_FT2232HP_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_FT4232HP_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_FT233HP_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_FT232HP_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_4232HAQ_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_232H_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_FTX_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) },
@@ -1064,6 +1071,13 @@  static const char *ftdi_chip_name[] = {
 	[FT2232H] = "FT2232H",
 	[FT4232H] = "FT4232H",
 	[FT232H]  = "FT232H",
+	[FT4232HAQ] = "FT4232HAQ",
+	[FT2233HP] = "FT2233HP",
+	[FT4233HP] = "FT4233HP",
+	[FT2232HP] = "FT2232HP",
+	[FT4232HP] = "FT4232HP",
+	[FT233HP] = "FT233HP",
+	[FT232HP] = "FT232HP",
 	[FTX]     = "FT-X"
 };
 
@@ -1357,6 +1371,13 @@  static u32 get_ftdi_divisor(struct tty_struct *tty,
 		}
 		break;
 	case FT2232H: /* FT2232H chip */
+	case FT232HP:  /* FT232HP chip */
+	case FT2232HP: /* FT2232HP chip */
+	case FT4232HP: /* FT4232HP chip */
+	case FT233HP:  /* FT233HP chip */
+	case FT2233HP: /* FT2233HP chip */
+	case FT4233HP: /* FT4233HP chip */
+	case FT4232HAQ: /* FT4232HAQ chip */
 	case FT4232H: /* FT4232H chip */
 	case FT232H:  /* FT232H chip */
 		if ((baud <= 12000000) && (baud >= 1200)) {
@@ -1395,7 +1416,10 @@  static int change_speed(struct tty_struct *tty, struct usb_serial_port *port)
 	index = (u16)(index_value >> 16);
 	if (priv->chip_type == FT2232C || priv->chip_type == FT2232H ||
 			priv->chip_type == FT4232H || priv->chip_type == FT232H ||
-			priv->chip_type == FTX) {
+			priv->chip_type == FT232HP || priv->chip_type == FT2232HP ||
+			priv->chip_type == FT4232HP || priv->chip_type == FT233HP ||
+			priv->chip_type == FT2233HP || priv->chip_type == FT4233HP ||
+			priv->chip_type == FT4232HAQ || priv->chip_type == FTX) {
 		/* Probably the BM type needs the MSB of the encoded fractional
 		 * divider also moved like for the chips above. Any infos? */
 		index = (u16)((index << 8) | priv->interface);
@@ -1555,7 +1579,25 @@  static void ftdi_determine_type(struct usb_serial_port *port)
 		int ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
 
 		/* Multiple interfaces.*/
-		if (version == 0x0800) {
+		if (version == 0x3600) {
+			priv->chip_type = FT4232HAQ;
+		} else if (version == 0x3100) {
+			priv->chip_type = FT4232HP;
+			/* Hi-speed - baud clock runs at 120MHz */
+			priv->baud_base = 120000000 / 2;
+		} else if (version == 0x3000) {
+			priv->chip_type = FT2232HP;
+			/* Hi-speed - baud clock runs at 120MHz */
+			priv->baud_base = 120000000 / 2;
+		} else if (version == 0x2900) {
+			priv->chip_type = FT4233HP;
+			/* Hi-speed - baud clock runs at 120MHz */
+			priv->baud_base = 120000000 / 2;
+		} else if (version == 0x2800) {
+			priv->chip_type = FT2233HP;
+			/* Hi-speed - baud clock runs at 120MHz */
+			priv->baud_base = 120000000 / 2;
+		} else if (version == 0x0800) {
 			priv->chip_type = FT4232H;
 			/* Hi-speed - baud clock runs at 120MHz */
 			priv->baud_base = 120000000 / 2;
@@ -1611,6 +1653,12 @@  static void ftdi_determine_type(struct usb_serial_port *port)
 	} else if (version < 0x1000) {
 		/* Assume it's an FT232H */
 		priv->chip_type = FT232H;
+	} else if (version == 0x3200) {
+		/* Assume it's an FT233HP */
+		priv->chip_type = FT233HP;
+	} else if (version == 0x3300) {
+		/* Assume it's an FT232HP */
+		priv->chip_type = FT232HP;
 	} else {
 		/* Assume it's an FT-X series device */
 		priv->chip_type = FTX;
@@ -1743,6 +1791,13 @@  static int create_sysfs_attrs(struct usb_serial_port *port)
 		     priv->chip_type == FT2232H ||
 		     priv->chip_type == FT4232H ||
 		     priv->chip_type == FT232H ||
+		     priv->chip_type == FT232HP ||
+		     priv->chip_type == FT2232HP ||
+		     priv->chip_type == FT4232HP ||
+		     priv->chip_type == FT4232HAQ ||
+		     priv->chip_type == FT233HP ||
+		     priv->chip_type == FT2233HP ||
+		     priv->chip_type == FT4233HP ||
 		     priv->chip_type == FTX)) {
 			retval = device_create_file(&port->dev,
 						    &dev_attr_latency_timer);
@@ -1764,11 +1819,17 @@  static void remove_sysfs_attrs(struct usb_serial_port *port)
 		    priv->chip_type == FT2232H ||
 		    priv->chip_type == FT4232H ||
 		    priv->chip_type == FT232H ||
+		    priv->chip_type == FT232HP ||
+		    priv->chip_type == FT2232HP ||
+		    priv->chip_type == FT4232HP ||
+		    priv->chip_type == FT4232HAQ ||
+		    priv->chip_type == FT233HP ||
+		    priv->chip_type == FT2233HP ||
+		    priv->chip_type == FT4233HP ||
 		    priv->chip_type == FTX) {
 			device_remove_file(&port->dev, &dev_attr_latency_timer);
 		}
 	}
-
 }
 
 #ifdef CONFIG_GPIOLIB
@@ -2830,6 +2891,13 @@  static int ftdi_get_modem_status(struct usb_serial_port *port,
 	case FT2232H:
 	case FT4232H:
 	case FT232H:
+	case FT232HP:  /* FT232HP chip */
+	case FT2232HP: /* FT2232HP chip */
+	case FT4232HP: /* FT4232HP chip */
+	case FT233HP:  /* FT233HP chip */
+	case FT2233HP: /* FT2233HP chip */
+	case FT4233HP: /* FT4233HP chip */
+	case FT4232HAQ: /* FT4232HAQ chip */
 	case FTX:
 		len = 2;
 		break;
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index be1641e0408b..fdc108da030f 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -162,7 +162,14 @@  enum ftdi_chip_type {
 	FT2232H = 6,
 	FT4232H = 7,
 	FT232H  = 8,
-	FTX     = 9,
+	FT4232HAQ = 9,
+	FT2233HP = 10,
+	FT4233HP = 11,
+	FT2232HP = 12,
+	FT4232HP = 13,
+	FT233HP = 14,
+	FT232HP = 15,
+	FTX     = 16,
 };
 
 enum ftdi_sio_baudrate {
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index d1a9564697a4..f6547935f923 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -25,6 +25,13 @@ 
 #define FTDI_4232H_PID 0x6011 /* Quad channel hi-speed device */
 #define FTDI_232H_PID  0x6014 /* Single channel hi-speed device */
 #define FTDI_FTX_PID   0x6015 /* FT-X series (FT201X, FT230X, FT231X, etc) */
+#define FTDI_FT2233HP_PID 0x6040 /* Dual Channel Hi-Speed device with PD */
+#define FTDI_FT4233HP_PID 0x6041 /* Quad channel hi-speed device with PD */
+#define FTDI_FT2232HP_PID 0x6042 /* Dual Channel Hi-Speed device with PD */
+#define FTDI_FT4232HP_PID 0x6043 /* Quad channel hi-speed device with PD */
+#define FTDI_FT233HP_PID 0x6044 /* Dual Channel Hi-Speed device with PD */
+#define FTDI_FT232HP_PID 0x6045 /* Dual Channel Hi-Speed device with PD */
+#define FTDI_4232HAQ_PID 0x6048 /* Automotive grade Hi-Speed device */
 #define FTDI_SIO_PID	0x8372	/* Product Id SIO application of 8U100AX */
 #define FTDI_232RL_PID  0xFBFA  /* Product ID for FT232RL */