Re: [PATCH 3/6] tty: mxser: serial: 8250: Relocate device IDs from mxser to 8250_pci

Jiri Slaby
2024-06-11T07:42:39Z

On 07. 06. 24, 13:43, Crescent Hsieh wrote:
> The devices in mxser could be supported by 8250_pci, so this patch
> relocates these device IDs from mxser into 8250_pci.
>
> Signed-off-by: Crescent Hsieh <crescentcy.hsieh@moxa.com>
> ---
> drivers/tty/mxser.c | 50 ------------------------------
> drivers/tty/serial/8250/8250_pci.c | 50 ++++++++++++++++++++++++++++++
> 2 files changed, 50 insertions(+), 50 deletions(-)
>
> diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
> index 458bb1280ebf..b0e7ea6611bf 100644
> --- a/drivers/tty/mxser.c
> +++ b/drivers/tty/mxser.c
> @@ -160,31 +160,6 @@
> #define MXSER_CUSTOM_DIVISOR (MXSER_BAUD_BASE * 16)
>
> #define PCI_DEVICE_ID_MOXA_RC7000 0x0001
> -#define PCI_DEVICE_ID_MOXA_CP102 0x1020
> -#define PCI_DEVICE_ID_MOXA_CP102UL 0x1021
> -#define PCI_DEVICE_ID_MOXA_CP102U 0x1022
> -#define PCI_DEVICE_ID_MOXA_CP102UF 0x1023
> -#define PCI_DEVICE_ID_MOXA_C104 0x1040
> -#define PCI_DEVICE_ID_MOXA_CP104U 0x1041
> -#define PCI_DEVICE_ID_MOXA_CP104JU 0x1042
> -#define PCI_DEVICE_ID_MOXA_CP104EL 0x1043
> -#define PCI_DEVICE_ID_MOXA_POS104UL 0x1044
> -#define PCI_DEVICE_ID_MOXA_CB108 0x1080
> -#define PCI_DEVICE_ID_MOXA_CP112UL 0x1120
> -#define PCI_DEVICE_ID_MOXA_CT114 0x1140
> -#define PCI_DEVICE_ID_MOXA_CP114 0x1141
> -#define PCI_DEVICE_ID_MOXA_CB114 0x1142
> -#define PCI_DEVICE_ID_MOXA_CP114UL 0x1143
> -#define PCI_DEVICE_ID_MOXA_CP118U 0x1180
> -#define PCI_DEVICE_ID_MOXA_CP118EL 0x1181
> -#define PCI_DEVICE_ID_MOXA_CP132 0x1320
> -#define PCI_DEVICE_ID_MOXA_CP132U 0x1321
> -#define PCI_DEVICE_ID_MOXA_CP134U 0x1340
> -#define PCI_DEVICE_ID_MOXA_CB134I 0x1341
> -#define PCI_DEVICE_ID_MOXA_CP138U 0x1380
> -#define PCI_DEVICE_ID_MOXA_C168 0x1680
> -#define PCI_DEVICE_ID_MOXA_CP168U 0x1681
> -#define PCI_DEVICE_ID_MOXA_CP168EL 0x1682
>
> #define MXSER_NPORTS(ddata) ((ddata) & 0xffU)
> #define MXSER_HIGHBAUD 0x0100
> @@ -212,32 +187,7 @@ static const struct {
> /* driver_data correspond to the lines in the structure above
> see also ISA probe function before you change something */
> static const struct pci_device_id mxser_pcibrds[] = {
> - { PCI_DEVICE_DATA(MOXA, C168, 8) },
> - { PCI_DEVICE_DATA(MOXA, C104, 4) },
> - { PCI_DEVICE_DATA(MOXA, CP132, 2) },
> - { PCI_DEVICE_DATA(MOXA, CP114, 4) },
> - { PCI_DEVICE_DATA(MOXA, CT114, 4) },
> - { PCI_DEVICE_DATA(MOXA, CP102, 2 | MXSER_HIGHBAUD) },

How is this MXSER_HIGHBAUD handled in 8250_pci?

> - { PCI_DEVICE_DATA(MOXA, CP104U, 4) },
> - { PCI_DEVICE_DATA(MOXA, CP168U, 8) },
> - { PCI_DEVICE_DATA(MOXA, CP132U, 2) },
> - { PCI_DEVICE_DATA(MOXA, CP134U, 4) },
> - { PCI_DEVICE_DATA(MOXA, CP104JU, 4) },
> { PCI_DEVICE_DATA(MOXA, RC7000, 8) }, /* RC7000 */

Can you simply add this exception to mxser_get_nports() I suggested in
1/6 and drop the whole mxser then \o/?

I had a long-term plan to mount mxser onto serial-core (or 8250). I
haven't managed the conversion yet. So I am glad to see this.

> - { PCI_DEVICE_DATA(MOXA, CP118U, 8) },
> - { PCI_DEVICE_DATA(MOXA, CP102UL, 2) },
> - { PCI_DEVICE_DATA(MOXA, CP102U, 2) },
> - { PCI_DEVICE_DATA(MOXA, CP118EL, 8) },
> - { PCI_DEVICE_DATA(MOXA, CP168EL, 8) },
> - { PCI_DEVICE_DATA(MOXA, CP104EL, 4) },
> - { PCI_DEVICE_DATA(MOXA, CB108, 8) },
> - { PCI_DEVICE_DATA(MOXA, CB114, 4) },
> - { PCI_DEVICE_DATA(MOXA, CB134I, 4) },
> - { PCI_DEVICE_DATA(MOXA, CP138U, 8) },
> - { PCI_DEVICE_DATA(MOXA, POS104UL, 4) },
> - { PCI_DEVICE_DATA(MOXA, CP114UL, 4) },
> - { PCI_DEVICE_DATA(MOXA, CP102UF, 2) },
> - { PCI_DEVICE_DATA(MOXA, CP112UL, 2) },
> { }
> };
--
js