18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1)
28c2ecf20Sopenharmony_ci/*======================================================================
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci    A driver for PCMCIA serial devices
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci    serial_cs.c 1.134 2002/05/04 05:48:53
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci    The contents of this file are subject to the Mozilla Public
98c2ecf20Sopenharmony_ci    License Version 1.1 (the "License"); you may not use this file
108c2ecf20Sopenharmony_ci    except in compliance with the License. You may obtain a copy of
118c2ecf20Sopenharmony_ci    the License at http://www.mozilla.org/MPL/
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci    Software distributed under the License is distributed on an "AS
148c2ecf20Sopenharmony_ci    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
158c2ecf20Sopenharmony_ci    implied. See the License for the specific language governing
168c2ecf20Sopenharmony_ci    rights and limitations under the License.
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci    The initial developer of the original code is David A. Hinds
198c2ecf20Sopenharmony_ci    <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
208c2ecf20Sopenharmony_ci    are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci    Alternatively, the contents of this file may be used under the
238c2ecf20Sopenharmony_ci    terms of the GNU General Public License version 2 (the "GPL"), in which
248c2ecf20Sopenharmony_ci    case the provisions of the GPL are applicable instead of the
258c2ecf20Sopenharmony_ci    above.  If you wish to allow the use of your version of this file
268c2ecf20Sopenharmony_ci    only under the terms of the GPL and not to allow others to use
278c2ecf20Sopenharmony_ci    your version of this file under the MPL, indicate your decision
288c2ecf20Sopenharmony_ci    by deleting the provisions above and replace them with the notice
298c2ecf20Sopenharmony_ci    and other provisions required by the GPL.  If you do not delete
308c2ecf20Sopenharmony_ci    the provisions above, a recipient may use your version of this
318c2ecf20Sopenharmony_ci    file under either the MPL or the GPL.
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci======================================================================*/
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#include <linux/module.h>
368c2ecf20Sopenharmony_ci#include <linux/moduleparam.h>
378c2ecf20Sopenharmony_ci#include <linux/kernel.h>
388c2ecf20Sopenharmony_ci#include <linux/ptrace.h>
398c2ecf20Sopenharmony_ci#include <linux/slab.h>
408c2ecf20Sopenharmony_ci#include <linux/string.h>
418c2ecf20Sopenharmony_ci#include <linux/timer.h>
428c2ecf20Sopenharmony_ci#include <linux/serial_core.h>
438c2ecf20Sopenharmony_ci#include <linux/delay.h>
448c2ecf20Sopenharmony_ci#include <linux/major.h>
458c2ecf20Sopenharmony_ci#include <asm/io.h>
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#include <pcmcia/cistpl.h>
488c2ecf20Sopenharmony_ci#include <pcmcia/ciscode.h>
498c2ecf20Sopenharmony_ci#include <pcmcia/ds.h>
508c2ecf20Sopenharmony_ci#include <pcmcia/cisreg.h>
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#include "8250.h"
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/*====================================================================*/
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci/* Parameters that can be set with 'insmod' */
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* Enable the speaker? */
608c2ecf20Sopenharmony_cistatic int do_sound = 1;
618c2ecf20Sopenharmony_ci/* Skip strict UART tests? */
628c2ecf20Sopenharmony_cistatic int buggy_uart;
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cimodule_param(do_sound, int, 0444);
658c2ecf20Sopenharmony_cimodule_param(buggy_uart, int, 0444);
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci/*====================================================================*/
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/* Table of multi-port card ID's */
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistruct serial_quirk {
728c2ecf20Sopenharmony_ci	unsigned int manfid;
738c2ecf20Sopenharmony_ci	unsigned int prodid;
748c2ecf20Sopenharmony_ci	int multi;		/* 1 = multifunction, > 1 = # ports */
758c2ecf20Sopenharmony_ci	void (*config)(struct pcmcia_device *);
768c2ecf20Sopenharmony_ci	void (*setup)(struct pcmcia_device *, struct uart_8250_port *);
778c2ecf20Sopenharmony_ci	void (*wakeup)(struct pcmcia_device *);
788c2ecf20Sopenharmony_ci	int (*post)(struct pcmcia_device *);
798c2ecf20Sopenharmony_ci};
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_cistruct serial_info {
828c2ecf20Sopenharmony_ci	struct pcmcia_device	*p_dev;
838c2ecf20Sopenharmony_ci	int			ndev;
848c2ecf20Sopenharmony_ci	int			multi;
858c2ecf20Sopenharmony_ci	int			slave;
868c2ecf20Sopenharmony_ci	int			manfid;
878c2ecf20Sopenharmony_ci	int			prodid;
888c2ecf20Sopenharmony_ci	int			c950ctrl;
898c2ecf20Sopenharmony_ci	int			line[4];
908c2ecf20Sopenharmony_ci	const struct serial_quirk *quirk;
918c2ecf20Sopenharmony_ci};
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_cistruct serial_cfg_mem {
948c2ecf20Sopenharmony_ci	tuple_t tuple;
958c2ecf20Sopenharmony_ci	cisparse_t parse;
968c2ecf20Sopenharmony_ci	u_char buf[256];
978c2ecf20Sopenharmony_ci};
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci/*
1008c2ecf20Sopenharmony_ci * vers_1 5.0, "Brain Boxes", "2-Port RS232 card", "r6"
1018c2ecf20Sopenharmony_ci * manfid 0x0160, 0x0104
1028c2ecf20Sopenharmony_ci * This card appears to have a 14.7456MHz clock.
1038c2ecf20Sopenharmony_ci */
1048c2ecf20Sopenharmony_ci/* Generic Modem: MD55x (GPRS/EDGE) have
1058c2ecf20Sopenharmony_ci * Elan VPU16551 UART with 14.7456MHz oscillator
1068c2ecf20Sopenharmony_ci * manfid 0x015D, 0x4C45
1078c2ecf20Sopenharmony_ci */
1088c2ecf20Sopenharmony_cistatic void quirk_setup_brainboxes_0104(struct pcmcia_device *link, struct uart_8250_port *uart)
1098c2ecf20Sopenharmony_ci{
1108c2ecf20Sopenharmony_ci	uart->port.uartclk = 14745600;
1118c2ecf20Sopenharmony_ci}
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_cistatic int quirk_post_ibm(struct pcmcia_device *link)
1148c2ecf20Sopenharmony_ci{
1158c2ecf20Sopenharmony_ci	u8 val;
1168c2ecf20Sopenharmony_ci	int ret;
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci	ret = pcmcia_read_config_byte(link, 0x800, &val);
1198c2ecf20Sopenharmony_ci	if (ret)
1208c2ecf20Sopenharmony_ci		goto failed;
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci	ret = pcmcia_write_config_byte(link, 0x800, val | 1);
1238c2ecf20Sopenharmony_ci	if (ret)
1248c2ecf20Sopenharmony_ci		goto failed;
1258c2ecf20Sopenharmony_ci	return 0;
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci failed:
1288c2ecf20Sopenharmony_ci	return -ENODEV;
1298c2ecf20Sopenharmony_ci}
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/*
1328c2ecf20Sopenharmony_ci * Nokia cards are not really multiport cards.  Shouldn't this
1338c2ecf20Sopenharmony_ci * be handled by setting the quirk entry .multi = 0 | 1 ?
1348c2ecf20Sopenharmony_ci */
1358c2ecf20Sopenharmony_cistatic void quirk_config_nokia(struct pcmcia_device *link)
1368c2ecf20Sopenharmony_ci{
1378c2ecf20Sopenharmony_ci	struct serial_info *info = link->priv;
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci	if (info->multi > 1)
1408c2ecf20Sopenharmony_ci		info->multi = 1;
1418c2ecf20Sopenharmony_ci}
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_cistatic void quirk_wakeup_oxsemi(struct pcmcia_device *link)
1448c2ecf20Sopenharmony_ci{
1458c2ecf20Sopenharmony_ci	struct serial_info *info = link->priv;
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci	if (info->c950ctrl)
1488c2ecf20Sopenharmony_ci		outb(12, info->c950ctrl + 1);
1498c2ecf20Sopenharmony_ci}
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci/* request_region? oxsemi branch does no request_region too... */
1528c2ecf20Sopenharmony_ci/*
1538c2ecf20Sopenharmony_ci * This sequence is needed to properly initialize MC45 attached to OXCF950.
1548c2ecf20Sopenharmony_ci * I tried decreasing these msleep()s, but it worked properly (survived
1558c2ecf20Sopenharmony_ci * 1000 stop/start operations) with these timeouts (or bigger).
1568c2ecf20Sopenharmony_ci */
1578c2ecf20Sopenharmony_cistatic void quirk_wakeup_possio_gcc(struct pcmcia_device *link)
1588c2ecf20Sopenharmony_ci{
1598c2ecf20Sopenharmony_ci	struct serial_info *info = link->priv;
1608c2ecf20Sopenharmony_ci	unsigned int ctrl = info->c950ctrl;
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci	outb(0xA, ctrl + 1);
1638c2ecf20Sopenharmony_ci	msleep(100);
1648c2ecf20Sopenharmony_ci	outb(0xE, ctrl + 1);
1658c2ecf20Sopenharmony_ci	msleep(300);
1668c2ecf20Sopenharmony_ci	outb(0xC, ctrl + 1);
1678c2ecf20Sopenharmony_ci	msleep(100);
1688c2ecf20Sopenharmony_ci	outb(0xE, ctrl + 1);
1698c2ecf20Sopenharmony_ci	msleep(200);
1708c2ecf20Sopenharmony_ci	outb(0xF, ctrl + 1);
1718c2ecf20Sopenharmony_ci	msleep(100);
1728c2ecf20Sopenharmony_ci	outb(0xE, ctrl + 1);
1738c2ecf20Sopenharmony_ci	msleep(100);
1748c2ecf20Sopenharmony_ci	outb(0xC, ctrl + 1);
1758c2ecf20Sopenharmony_ci}
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci/*
1788c2ecf20Sopenharmony_ci * Socket Dual IO: this enables irq's for second port
1798c2ecf20Sopenharmony_ci */
1808c2ecf20Sopenharmony_cistatic void quirk_config_socket(struct pcmcia_device *link)
1818c2ecf20Sopenharmony_ci{
1828c2ecf20Sopenharmony_ci	struct serial_info *info = link->priv;
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci	if (info->multi)
1858c2ecf20Sopenharmony_ci		link->config_flags |= CONF_ENABLE_ESR;
1868c2ecf20Sopenharmony_ci}
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_cistatic const struct serial_quirk quirks[] = {
1898c2ecf20Sopenharmony_ci	{
1908c2ecf20Sopenharmony_ci		.manfid	= 0x0160,
1918c2ecf20Sopenharmony_ci		.prodid	= 0x0104,
1928c2ecf20Sopenharmony_ci		.multi	= -1,
1938c2ecf20Sopenharmony_ci		.setup	= quirk_setup_brainboxes_0104,
1948c2ecf20Sopenharmony_ci	}, {
1958c2ecf20Sopenharmony_ci		.manfid	= 0x015D,
1968c2ecf20Sopenharmony_ci		.prodid	= 0x4C45,
1978c2ecf20Sopenharmony_ci		.multi	= -1,
1988c2ecf20Sopenharmony_ci		.setup	= quirk_setup_brainboxes_0104,
1998c2ecf20Sopenharmony_ci	}, {
2008c2ecf20Sopenharmony_ci		.manfid	= MANFID_IBM,
2018c2ecf20Sopenharmony_ci		.prodid	= ~0,
2028c2ecf20Sopenharmony_ci		.multi	= -1,
2038c2ecf20Sopenharmony_ci		.post	= quirk_post_ibm,
2048c2ecf20Sopenharmony_ci	}, {
2058c2ecf20Sopenharmony_ci		.manfid	= MANFID_INTEL,
2068c2ecf20Sopenharmony_ci		.prodid	= PRODID_INTEL_DUAL_RS232,
2078c2ecf20Sopenharmony_ci		.multi	= 2,
2088c2ecf20Sopenharmony_ci	}, {
2098c2ecf20Sopenharmony_ci		.manfid	= MANFID_NATINST,
2108c2ecf20Sopenharmony_ci		.prodid	= PRODID_NATINST_QUAD_RS232,
2118c2ecf20Sopenharmony_ci		.multi	= 4,
2128c2ecf20Sopenharmony_ci	}, {
2138c2ecf20Sopenharmony_ci		.manfid	= MANFID_NOKIA,
2148c2ecf20Sopenharmony_ci		.prodid	= ~0,
2158c2ecf20Sopenharmony_ci		.multi	= -1,
2168c2ecf20Sopenharmony_ci		.config	= quirk_config_nokia,
2178c2ecf20Sopenharmony_ci	}, {
2188c2ecf20Sopenharmony_ci		.manfid	= MANFID_OMEGA,
2198c2ecf20Sopenharmony_ci		.prodid	= PRODID_OMEGA_QSP_100,
2208c2ecf20Sopenharmony_ci		.multi	= 4,
2218c2ecf20Sopenharmony_ci	}, {
2228c2ecf20Sopenharmony_ci		.manfid	= MANFID_OXSEMI,
2238c2ecf20Sopenharmony_ci		.prodid	= ~0,
2248c2ecf20Sopenharmony_ci		.multi	= -1,
2258c2ecf20Sopenharmony_ci		.wakeup	= quirk_wakeup_oxsemi,
2268c2ecf20Sopenharmony_ci	}, {
2278c2ecf20Sopenharmony_ci		.manfid	= MANFID_POSSIO,
2288c2ecf20Sopenharmony_ci		.prodid	= PRODID_POSSIO_GCC,
2298c2ecf20Sopenharmony_ci		.multi	= -1,
2308c2ecf20Sopenharmony_ci		.wakeup	= quirk_wakeup_possio_gcc,
2318c2ecf20Sopenharmony_ci	}, {
2328c2ecf20Sopenharmony_ci		.manfid	= MANFID_QUATECH,
2338c2ecf20Sopenharmony_ci		.prodid	= PRODID_QUATECH_DUAL_RS232,
2348c2ecf20Sopenharmony_ci		.multi	= 2,
2358c2ecf20Sopenharmony_ci	}, {
2368c2ecf20Sopenharmony_ci		.manfid	= MANFID_QUATECH,
2378c2ecf20Sopenharmony_ci		.prodid	= PRODID_QUATECH_DUAL_RS232_D1,
2388c2ecf20Sopenharmony_ci		.multi	= 2,
2398c2ecf20Sopenharmony_ci	}, {
2408c2ecf20Sopenharmony_ci		.manfid	= MANFID_QUATECH,
2418c2ecf20Sopenharmony_ci		.prodid	= PRODID_QUATECH_DUAL_RS232_G,
2428c2ecf20Sopenharmony_ci		.multi	= 2,
2438c2ecf20Sopenharmony_ci	}, {
2448c2ecf20Sopenharmony_ci		.manfid	= MANFID_QUATECH,
2458c2ecf20Sopenharmony_ci		.prodid	= PRODID_QUATECH_QUAD_RS232,
2468c2ecf20Sopenharmony_ci		.multi	= 4,
2478c2ecf20Sopenharmony_ci	}, {
2488c2ecf20Sopenharmony_ci		.manfid	= MANFID_SOCKET,
2498c2ecf20Sopenharmony_ci		.prodid	= PRODID_SOCKET_DUAL_RS232,
2508c2ecf20Sopenharmony_ci		.multi	= 2,
2518c2ecf20Sopenharmony_ci		.config	= quirk_config_socket,
2528c2ecf20Sopenharmony_ci	}, {
2538c2ecf20Sopenharmony_ci		.manfid	= MANFID_SOCKET,
2548c2ecf20Sopenharmony_ci		.prodid	= ~0,
2558c2ecf20Sopenharmony_ci		.multi	= -1,
2568c2ecf20Sopenharmony_ci		.config	= quirk_config_socket,
2578c2ecf20Sopenharmony_ci	}
2588c2ecf20Sopenharmony_ci};
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_cistatic int serial_config(struct pcmcia_device *link);
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_cistatic void serial_remove(struct pcmcia_device *link)
2658c2ecf20Sopenharmony_ci{
2668c2ecf20Sopenharmony_ci	struct serial_info *info = link->priv;
2678c2ecf20Sopenharmony_ci	int i;
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci	dev_dbg(&link->dev, "serial_release\n");
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci	/*
2728c2ecf20Sopenharmony_ci	 * Recheck to see if the device is still configured.
2738c2ecf20Sopenharmony_ci	 */
2748c2ecf20Sopenharmony_ci	for (i = 0; i < info->ndev; i++)
2758c2ecf20Sopenharmony_ci		serial8250_unregister_port(info->line[i]);
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci	if (!info->slave)
2788c2ecf20Sopenharmony_ci		pcmcia_disable_device(link);
2798c2ecf20Sopenharmony_ci}
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_cistatic int serial_suspend(struct pcmcia_device *link)
2828c2ecf20Sopenharmony_ci{
2838c2ecf20Sopenharmony_ci	struct serial_info *info = link->priv;
2848c2ecf20Sopenharmony_ci	int i;
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci	for (i = 0; i < info->ndev; i++)
2878c2ecf20Sopenharmony_ci		serial8250_suspend_port(info->line[i]);
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci	return 0;
2908c2ecf20Sopenharmony_ci}
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_cistatic int serial_resume(struct pcmcia_device *link)
2938c2ecf20Sopenharmony_ci{
2948c2ecf20Sopenharmony_ci	struct serial_info *info = link->priv;
2958c2ecf20Sopenharmony_ci	int i;
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci	for (i = 0; i < info->ndev; i++)
2988c2ecf20Sopenharmony_ci		serial8250_resume_port(info->line[i]);
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci	if (info->quirk && info->quirk->wakeup)
3018c2ecf20Sopenharmony_ci		info->quirk->wakeup(link);
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci	return 0;
3048c2ecf20Sopenharmony_ci}
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_cistatic int serial_probe(struct pcmcia_device *link)
3078c2ecf20Sopenharmony_ci{
3088c2ecf20Sopenharmony_ci	struct serial_info *info;
3098c2ecf20Sopenharmony_ci	int ret;
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	dev_dbg(&link->dev, "serial_attach()\n");
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci	/* Create new serial device */
3148c2ecf20Sopenharmony_ci	info = kzalloc(sizeof(*info), GFP_KERNEL);
3158c2ecf20Sopenharmony_ci	if (!info)
3168c2ecf20Sopenharmony_ci		return -ENOMEM;
3178c2ecf20Sopenharmony_ci	info->p_dev = link;
3188c2ecf20Sopenharmony_ci	link->priv = info;
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci	link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
3218c2ecf20Sopenharmony_ci	if (do_sound)
3228c2ecf20Sopenharmony_ci		link->config_flags |= CONF_ENABLE_SPKR;
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci	ret = serial_config(link);
3258c2ecf20Sopenharmony_ci	if (ret)
3268c2ecf20Sopenharmony_ci		goto free_info;
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci	return 0;
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_cifree_info:
3318c2ecf20Sopenharmony_ci	kfree(info);
3328c2ecf20Sopenharmony_ci	return ret;
3338c2ecf20Sopenharmony_ci}
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_cistatic void serial_detach(struct pcmcia_device *link)
3368c2ecf20Sopenharmony_ci{
3378c2ecf20Sopenharmony_ci	struct serial_info *info = link->priv;
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci	dev_dbg(&link->dev, "serial_detach\n");
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_ci	/*
3428c2ecf20Sopenharmony_ci	 * Ensure that the ports have been released.
3438c2ecf20Sopenharmony_ci	 */
3448c2ecf20Sopenharmony_ci	serial_remove(link);
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci	/* free bits */
3478c2ecf20Sopenharmony_ci	kfree(info);
3488c2ecf20Sopenharmony_ci}
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci/*====================================================================*/
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_cistatic int setup_serial(struct pcmcia_device *handle, struct serial_info *info,
3538c2ecf20Sopenharmony_ci			unsigned int iobase, int irq)
3548c2ecf20Sopenharmony_ci{
3558c2ecf20Sopenharmony_ci	struct uart_8250_port uart;
3568c2ecf20Sopenharmony_ci	int line;
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci	memset(&uart, 0, sizeof(uart));
3598c2ecf20Sopenharmony_ci	uart.port.iobase = iobase;
3608c2ecf20Sopenharmony_ci	uart.port.irq = irq;
3618c2ecf20Sopenharmony_ci	uart.port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ;
3628c2ecf20Sopenharmony_ci	uart.port.uartclk = 1843200;
3638c2ecf20Sopenharmony_ci	uart.port.dev = &handle->dev;
3648c2ecf20Sopenharmony_ci	if (buggy_uart)
3658c2ecf20Sopenharmony_ci		uart.port.flags |= UPF_BUGGY_UART;
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci	if (info->quirk && info->quirk->setup)
3688c2ecf20Sopenharmony_ci		info->quirk->setup(handle, &uart);
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci	line = serial8250_register_8250_port(&uart);
3718c2ecf20Sopenharmony_ci	if (line < 0) {
3728c2ecf20Sopenharmony_ci		pr_err("serial_cs: serial8250_register_8250_port() at 0x%04lx, irq %d failed\n",
3738c2ecf20Sopenharmony_ci							(unsigned long)iobase, irq);
3748c2ecf20Sopenharmony_ci		return -EINVAL;
3758c2ecf20Sopenharmony_ci	}
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci	info->line[info->ndev] = line;
3788c2ecf20Sopenharmony_ci	info->ndev++;
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci	return 0;
3818c2ecf20Sopenharmony_ci}
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_ci/*====================================================================*/
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_cistatic int pfc_config(struct pcmcia_device *p_dev)
3868c2ecf20Sopenharmony_ci{
3878c2ecf20Sopenharmony_ci	unsigned int port = 0;
3888c2ecf20Sopenharmony_ci	struct serial_info *info = p_dev->priv;
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_ci	if ((p_dev->resource[1]->end != 0) &&
3918c2ecf20Sopenharmony_ci		(resource_size(p_dev->resource[1]) == 8)) {
3928c2ecf20Sopenharmony_ci		port = p_dev->resource[1]->start;
3938c2ecf20Sopenharmony_ci		info->slave = 1;
3948c2ecf20Sopenharmony_ci	} else if ((info->manfid == MANFID_OSITECH) &&
3958c2ecf20Sopenharmony_ci		(resource_size(p_dev->resource[0]) == 0x40)) {
3968c2ecf20Sopenharmony_ci		port = p_dev->resource[0]->start + 0x28;
3978c2ecf20Sopenharmony_ci		info->slave = 1;
3988c2ecf20Sopenharmony_ci	}
3998c2ecf20Sopenharmony_ci	if (info->slave)
4008c2ecf20Sopenharmony_ci		return setup_serial(p_dev, info, port, p_dev->irq);
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ci	dev_warn(&p_dev->dev, "no usable port range found, giving up\n");
4038c2ecf20Sopenharmony_ci	return -ENODEV;
4048c2ecf20Sopenharmony_ci}
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_cistatic int simple_config_check(struct pcmcia_device *p_dev, void *priv_data)
4078c2ecf20Sopenharmony_ci{
4088c2ecf20Sopenharmony_ci	static const int size_table[2] = { 8, 16 };
4098c2ecf20Sopenharmony_ci	int *try = priv_data;
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci	if (p_dev->resource[0]->start == 0)
4128c2ecf20Sopenharmony_ci		return -ENODEV;
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ci	if ((*try & 0x1) == 0)
4158c2ecf20Sopenharmony_ci		p_dev->io_lines = 16;
4168c2ecf20Sopenharmony_ci
4178c2ecf20Sopenharmony_ci	if (p_dev->resource[0]->end != size_table[(*try >> 1)])
4188c2ecf20Sopenharmony_ci		return -ENODEV;
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_ci	p_dev->resource[0]->end = 8;
4218c2ecf20Sopenharmony_ci	p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
4228c2ecf20Sopenharmony_ci	p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci	return pcmcia_request_io(p_dev);
4258c2ecf20Sopenharmony_ci}
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_cistatic int simple_config_check_notpicky(struct pcmcia_device *p_dev,
4288c2ecf20Sopenharmony_ci					void *priv_data)
4298c2ecf20Sopenharmony_ci{
4308c2ecf20Sopenharmony_ci	static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
4318c2ecf20Sopenharmony_ci	int j;
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci	if (p_dev->io_lines > 3)
4348c2ecf20Sopenharmony_ci		return -ENODEV;
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci	p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
4378c2ecf20Sopenharmony_ci	p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
4388c2ecf20Sopenharmony_ci	p_dev->resource[0]->end = 8;
4398c2ecf20Sopenharmony_ci
4408c2ecf20Sopenharmony_ci	for (j = 0; j < 5; j++) {
4418c2ecf20Sopenharmony_ci		p_dev->resource[0]->start = base[j];
4428c2ecf20Sopenharmony_ci		p_dev->io_lines = base[j] ? 16 : 3;
4438c2ecf20Sopenharmony_ci		if (!pcmcia_request_io(p_dev))
4448c2ecf20Sopenharmony_ci			return 0;
4458c2ecf20Sopenharmony_ci	}
4468c2ecf20Sopenharmony_ci	return -ENODEV;
4478c2ecf20Sopenharmony_ci}
4488c2ecf20Sopenharmony_ci
4498c2ecf20Sopenharmony_cistatic int simple_config(struct pcmcia_device *link)
4508c2ecf20Sopenharmony_ci{
4518c2ecf20Sopenharmony_ci	struct serial_info *info = link->priv;
4528c2ecf20Sopenharmony_ci	int ret, try;
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_ci	/*
4558c2ecf20Sopenharmony_ci	 * First pass: look for a config entry that looks normal.
4568c2ecf20Sopenharmony_ci	 * Two tries: without IO aliases, then with aliases.
4578c2ecf20Sopenharmony_ci	 */
4588c2ecf20Sopenharmony_ci	link->config_flags |= CONF_AUTO_SET_VPP;
4598c2ecf20Sopenharmony_ci	for (try = 0; try < 4; try++)
4608c2ecf20Sopenharmony_ci		if (!pcmcia_loop_config(link, simple_config_check, &try))
4618c2ecf20Sopenharmony_ci			goto found_port;
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci	/*
4648c2ecf20Sopenharmony_ci	 * Second pass: try to find an entry that isn't picky about
4658c2ecf20Sopenharmony_ci	 * its base address, then try to grab any standard serial port
4668c2ecf20Sopenharmony_ci	 * address, and finally try to get any free port.
4678c2ecf20Sopenharmony_ci	 */
4688c2ecf20Sopenharmony_ci	if (!pcmcia_loop_config(link, simple_config_check_notpicky, NULL))
4698c2ecf20Sopenharmony_ci		goto found_port;
4708c2ecf20Sopenharmony_ci
4718c2ecf20Sopenharmony_ci	dev_warn(&link->dev, "no usable port range found, giving up\n");
4728c2ecf20Sopenharmony_ci	return -1;
4738c2ecf20Sopenharmony_ci
4748c2ecf20Sopenharmony_cifound_port:
4758c2ecf20Sopenharmony_ci	if (info->multi && (info->manfid == MANFID_3COM))
4768c2ecf20Sopenharmony_ci		link->config_index &= ~(0x08);
4778c2ecf20Sopenharmony_ci
4788c2ecf20Sopenharmony_ci	/*
4798c2ecf20Sopenharmony_ci	 * Apply any configuration quirks.
4808c2ecf20Sopenharmony_ci	 */
4818c2ecf20Sopenharmony_ci	if (info->quirk && info->quirk->config)
4828c2ecf20Sopenharmony_ci		info->quirk->config(link);
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_ci	ret = pcmcia_enable_device(link);
4858c2ecf20Sopenharmony_ci	if (ret != 0)
4868c2ecf20Sopenharmony_ci		return -1;
4878c2ecf20Sopenharmony_ci	return setup_serial(link, info, link->resource[0]->start, link->irq);
4888c2ecf20Sopenharmony_ci}
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_cistatic int multi_config_check(struct pcmcia_device *p_dev, void *priv_data)
4918c2ecf20Sopenharmony_ci{
4928c2ecf20Sopenharmony_ci	int *multi = priv_data;
4938c2ecf20Sopenharmony_ci
4948c2ecf20Sopenharmony_ci	if (p_dev->resource[1]->end)
4958c2ecf20Sopenharmony_ci		return -EINVAL;
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ci	/*
4988c2ecf20Sopenharmony_ci	 * The quad port cards have bad CIS's, so just look for a
4998c2ecf20Sopenharmony_ci	 * window larger than 8 ports and assume it will be right.
5008c2ecf20Sopenharmony_ci	 */
5018c2ecf20Sopenharmony_ci	if (p_dev->resource[0]->end <= 8)
5028c2ecf20Sopenharmony_ci		return -EINVAL;
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ci	p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
5058c2ecf20Sopenharmony_ci	p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
5068c2ecf20Sopenharmony_ci	p_dev->resource[0]->end = *multi * 8;
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_ci	if (pcmcia_request_io(p_dev))
5098c2ecf20Sopenharmony_ci		return -ENODEV;
5108c2ecf20Sopenharmony_ci	return 0;
5118c2ecf20Sopenharmony_ci}
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_cistatic int multi_config_check_notpicky(struct pcmcia_device *p_dev,
5148c2ecf20Sopenharmony_ci				       void *priv_data)
5158c2ecf20Sopenharmony_ci{
5168c2ecf20Sopenharmony_ci	int *base2 = priv_data;
5178c2ecf20Sopenharmony_ci
5188c2ecf20Sopenharmony_ci	if (!p_dev->resource[0]->end || !p_dev->resource[1]->end ||
5198c2ecf20Sopenharmony_ci		p_dev->resource[0]->start + 8 != p_dev->resource[1]->start)
5208c2ecf20Sopenharmony_ci		return -ENODEV;
5218c2ecf20Sopenharmony_ci
5228c2ecf20Sopenharmony_ci	p_dev->resource[0]->end = p_dev->resource[1]->end = 8;
5238c2ecf20Sopenharmony_ci	p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
5248c2ecf20Sopenharmony_ci	p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
5258c2ecf20Sopenharmony_ci
5268c2ecf20Sopenharmony_ci	if (pcmcia_request_io(p_dev))
5278c2ecf20Sopenharmony_ci		return -ENODEV;
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_ci	*base2 = p_dev->resource[0]->start + 8;
5308c2ecf20Sopenharmony_ci	return 0;
5318c2ecf20Sopenharmony_ci}
5328c2ecf20Sopenharmony_ci
5338c2ecf20Sopenharmony_cistatic int multi_config(struct pcmcia_device *link)
5348c2ecf20Sopenharmony_ci{
5358c2ecf20Sopenharmony_ci	struct serial_info *info = link->priv;
5368c2ecf20Sopenharmony_ci	int i, base2 = 0;
5378c2ecf20Sopenharmony_ci
5388c2ecf20Sopenharmony_ci	/* First, look for a generic full-sized window */
5398c2ecf20Sopenharmony_ci	if (!pcmcia_loop_config(link, multi_config_check, &info->multi))
5408c2ecf20Sopenharmony_ci		base2 = link->resource[0]->start + 8;
5418c2ecf20Sopenharmony_ci	else {
5428c2ecf20Sopenharmony_ci		/* If that didn't work, look for two windows */
5438c2ecf20Sopenharmony_ci		info->multi = 2;
5448c2ecf20Sopenharmony_ci		if (pcmcia_loop_config(link, multi_config_check_notpicky,
5458c2ecf20Sopenharmony_ci				       &base2)) {
5468c2ecf20Sopenharmony_ci			dev_warn(&link->dev,
5478c2ecf20Sopenharmony_ci				 "no usable port range found, giving up\n");
5488c2ecf20Sopenharmony_ci			return -ENODEV;
5498c2ecf20Sopenharmony_ci		}
5508c2ecf20Sopenharmony_ci	}
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci	if (!link->irq)
5538c2ecf20Sopenharmony_ci		dev_warn(&link->dev, "no usable IRQ found, continuing...\n");
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_ci	/*
5568c2ecf20Sopenharmony_ci	 * Apply any configuration quirks.
5578c2ecf20Sopenharmony_ci	 */
5588c2ecf20Sopenharmony_ci	if (info->quirk && info->quirk->config)
5598c2ecf20Sopenharmony_ci		info->quirk->config(link);
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci	i = pcmcia_enable_device(link);
5628c2ecf20Sopenharmony_ci	if (i != 0)
5638c2ecf20Sopenharmony_ci		return -ENODEV;
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ci	/* The Oxford Semiconductor OXCF950 cards are in fact single-port:
5668c2ecf20Sopenharmony_ci	 * 8 registers are for the UART, the others are extra registers.
5678c2ecf20Sopenharmony_ci	 * Siemen's MC45 PCMCIA (Possio's GCC) is OXCF950 based too.
5688c2ecf20Sopenharmony_ci	 */
5698c2ecf20Sopenharmony_ci	if (info->manfid == MANFID_OXSEMI || (info->manfid == MANFID_POSSIO &&
5708c2ecf20Sopenharmony_ci				info->prodid == PRODID_POSSIO_GCC)) {
5718c2ecf20Sopenharmony_ci		int err;
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_ci		if (link->config_index == 1 ||
5748c2ecf20Sopenharmony_ci		    link->config_index == 3) {
5758c2ecf20Sopenharmony_ci			err = setup_serial(link, info, base2,
5768c2ecf20Sopenharmony_ci					link->irq);
5778c2ecf20Sopenharmony_ci			base2 = link->resource[0]->start;
5788c2ecf20Sopenharmony_ci		} else {
5798c2ecf20Sopenharmony_ci			err = setup_serial(link, info, link->resource[0]->start,
5808c2ecf20Sopenharmony_ci					link->irq);
5818c2ecf20Sopenharmony_ci		}
5828c2ecf20Sopenharmony_ci		info->c950ctrl = base2;
5838c2ecf20Sopenharmony_ci
5848c2ecf20Sopenharmony_ci		/*
5858c2ecf20Sopenharmony_ci		 * FIXME: We really should wake up the port prior to
5868c2ecf20Sopenharmony_ci		 * handing it over to the serial layer.
5878c2ecf20Sopenharmony_ci		 */
5888c2ecf20Sopenharmony_ci		if (info->quirk && info->quirk->wakeup)
5898c2ecf20Sopenharmony_ci			info->quirk->wakeup(link);
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci		return 0;
5928c2ecf20Sopenharmony_ci	}
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_ci	setup_serial(link, info, link->resource[0]->start, link->irq);
5958c2ecf20Sopenharmony_ci	for (i = 0; i < info->multi - 1; i++)
5968c2ecf20Sopenharmony_ci		setup_serial(link, info, base2 + (8 * i),
5978c2ecf20Sopenharmony_ci				link->irq);
5988c2ecf20Sopenharmony_ci	return 0;
5998c2ecf20Sopenharmony_ci}
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_cistatic int serial_check_for_multi(struct pcmcia_device *p_dev,  void *priv_data)
6028c2ecf20Sopenharmony_ci{
6038c2ecf20Sopenharmony_ci	struct serial_info *info = p_dev->priv;
6048c2ecf20Sopenharmony_ci
6058c2ecf20Sopenharmony_ci	if (!p_dev->resource[0]->end)
6068c2ecf20Sopenharmony_ci		return -EINVAL;
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ci	if ((!p_dev->resource[1]->end) && (p_dev->resource[0]->end % 8 == 0))
6098c2ecf20Sopenharmony_ci		info->multi = p_dev->resource[0]->end >> 3;
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci	if ((p_dev->resource[1]->end) && (p_dev->resource[0]->end == 8)
6128c2ecf20Sopenharmony_ci		&& (p_dev->resource[1]->end == 8))
6138c2ecf20Sopenharmony_ci		info->multi = 2;
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ci	return 0; /* break */
6168c2ecf20Sopenharmony_ci}
6178c2ecf20Sopenharmony_ci
6188c2ecf20Sopenharmony_ci
6198c2ecf20Sopenharmony_cistatic int serial_config(struct pcmcia_device *link)
6208c2ecf20Sopenharmony_ci{
6218c2ecf20Sopenharmony_ci	struct serial_info *info = link->priv;
6228c2ecf20Sopenharmony_ci	int i;
6238c2ecf20Sopenharmony_ci
6248c2ecf20Sopenharmony_ci	dev_dbg(&link->dev, "serial_config\n");
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_ci	/* Is this a compliant multifunction card? */
6278c2ecf20Sopenharmony_ci	info->multi = (link->socket->functions > 1);
6288c2ecf20Sopenharmony_ci
6298c2ecf20Sopenharmony_ci	/* Is this a multiport card? */
6308c2ecf20Sopenharmony_ci	info->manfid = link->manf_id;
6318c2ecf20Sopenharmony_ci	info->prodid = link->card_id;
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_ci	for (i = 0; i < ARRAY_SIZE(quirks); i++)
6348c2ecf20Sopenharmony_ci		if ((quirks[i].manfid == ~0 ||
6358c2ecf20Sopenharmony_ci		     quirks[i].manfid == info->manfid) &&
6368c2ecf20Sopenharmony_ci		    (quirks[i].prodid == ~0 ||
6378c2ecf20Sopenharmony_ci		     quirks[i].prodid == info->prodid)) {
6388c2ecf20Sopenharmony_ci			info->quirk = &quirks[i];
6398c2ecf20Sopenharmony_ci			break;
6408c2ecf20Sopenharmony_ci		}
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_ci	/*
6438c2ecf20Sopenharmony_ci	 * Another check for dual-serial cards: look for either serial or
6448c2ecf20Sopenharmony_ci	 * multifunction cards that ask for appropriate IO port ranges.
6458c2ecf20Sopenharmony_ci	 */
6468c2ecf20Sopenharmony_ci	if ((info->multi == 0) &&
6478c2ecf20Sopenharmony_ci	    (link->has_func_id) &&
6488c2ecf20Sopenharmony_ci	    (link->socket->pcmcia_pfc == 0) &&
6498c2ecf20Sopenharmony_ci	    ((link->func_id == CISTPL_FUNCID_MULTI) ||
6508c2ecf20Sopenharmony_ci	     (link->func_id == CISTPL_FUNCID_SERIAL))) {
6518c2ecf20Sopenharmony_ci		if (pcmcia_loop_config(link, serial_check_for_multi, info))
6528c2ecf20Sopenharmony_ci			goto failed;
6538c2ecf20Sopenharmony_ci	}
6548c2ecf20Sopenharmony_ci
6558c2ecf20Sopenharmony_ci	/*
6568c2ecf20Sopenharmony_ci	 * Apply any multi-port quirk.
6578c2ecf20Sopenharmony_ci	 */
6588c2ecf20Sopenharmony_ci	if (info->quirk && info->quirk->multi != -1)
6598c2ecf20Sopenharmony_ci		info->multi = info->quirk->multi;
6608c2ecf20Sopenharmony_ci
6618c2ecf20Sopenharmony_ci	dev_info(&link->dev,
6628c2ecf20Sopenharmony_ci		"trying to set up [0x%04x:0x%04x] (pfc: %d, multi: %d, quirk: %p)\n",
6638c2ecf20Sopenharmony_ci		link->manf_id, link->card_id,
6648c2ecf20Sopenharmony_ci		link->socket->pcmcia_pfc, info->multi, info->quirk);
6658c2ecf20Sopenharmony_ci	if (link->socket->pcmcia_pfc)
6668c2ecf20Sopenharmony_ci		i = pfc_config(link);
6678c2ecf20Sopenharmony_ci	else if (info->multi > 1)
6688c2ecf20Sopenharmony_ci		i = multi_config(link);
6698c2ecf20Sopenharmony_ci	else
6708c2ecf20Sopenharmony_ci		i = simple_config(link);
6718c2ecf20Sopenharmony_ci
6728c2ecf20Sopenharmony_ci	if (i || info->ndev == 0)
6738c2ecf20Sopenharmony_ci		goto failed;
6748c2ecf20Sopenharmony_ci
6758c2ecf20Sopenharmony_ci	/*
6768c2ecf20Sopenharmony_ci	 * Apply any post-init quirk.  FIXME: This should really happen
6778c2ecf20Sopenharmony_ci	 * before we register the port, since it might already be in use.
6788c2ecf20Sopenharmony_ci	 */
6798c2ecf20Sopenharmony_ci	if (info->quirk && info->quirk->post)
6808c2ecf20Sopenharmony_ci		if (info->quirk->post(link))
6818c2ecf20Sopenharmony_ci			goto failed;
6828c2ecf20Sopenharmony_ci
6838c2ecf20Sopenharmony_ci	return 0;
6848c2ecf20Sopenharmony_ci
6858c2ecf20Sopenharmony_cifailed:
6868c2ecf20Sopenharmony_ci	dev_warn(&link->dev, "failed to initialize\n");
6878c2ecf20Sopenharmony_ci	serial_remove(link);
6888c2ecf20Sopenharmony_ci	return -ENODEV;
6898c2ecf20Sopenharmony_ci}
6908c2ecf20Sopenharmony_ci
6918c2ecf20Sopenharmony_cistatic const struct pcmcia_device_id serial_ids[] = {
6928c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0057, 0x0021),
6938c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0089, 0x110a),
6948c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0104, 0x000a),
6958c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0105, 0x0d0a),
6968c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0105, 0x0e0a),
6978c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0105, 0xea15),
6988c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0109, 0x0501),
6998c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0138, 0x110a),
7008c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0140, 0x000a),
7018c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0143, 0x3341),
7028c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0143, 0xc0ab),
7038c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x016c, 0x0081),
7048c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x021b, 0x0101),
7058c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x08a1, 0xc0ab),
7068c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID123(1, "MEGAHERTZ", "CC/XJEM3288", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x04cd2988, 0x46a52d63),
7078c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID123(1, "MEGAHERTZ", "CC/XJEM3336", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x0143b773, 0x46a52d63),
7088c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID123(1, "MEGAHERTZ", "EM1144T", "PCMCIA MODEM", 0xf510db04, 0x856d66c8, 0xbd6c43ef),
7098c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID123(1, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef),
7108c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM28", 0x2e3ee845, 0x0ea978ea),
7118c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM33", 0x2e3ee845, 0x80609023),
7128c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a),
7138c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29),
7148c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719),
7158c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "AnyCom", "Fast Ethernet + 56K COMBO", 0x578ba6e7, 0xb0ac62c4),
7168c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "ATKK", "LM33-PCM-T", 0xba9eb7e2, 0x077c174e),
7178c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff),
7188c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c),
7198c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae),
7208c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033),
7218c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58),
7228c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e),
7238c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "MICRO RESEARCH", "COMBO-L/M-336", 0xb2ced065, 0x3ced0555),
7248c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "NEC", "PK-UG-J001", 0x18df0ba0, 0x831b1064),
7258c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard:Jack of Diamonds Modem+Ethernet", 0xc2f80cd, 0x656947b9),
7268c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard:Jack of Hearts Modem+Ethernet", 0xc2f80cd, 0xdc9ba5ed),
7278c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc),
7288c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f),
7298c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed),
7308c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf),
7318c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0e01),
7328c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0a05),
7338c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0b05),
7348c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x1101),
7358c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070),
7368c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562),
7378c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0104, 0x0070),
7388c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x016c, 0x0020),
7398c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID123(1, "APEX DATA", "MULTICARD", "ETHERNET-MODEM", 0x11c2da09, 0x7289dc5d, 0xaad95e1f),
7408c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(1, "IBM", "Home and Away 28.8 PC Card       ", 0xb569a6e5, 0x5bd4ff2c),
7418c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(1, "IBM", "Home and Away Credit Card Adapter", 0xb569a6e5, 0x4bdf15c3),
7428c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(1, "IBM", "w95 Home and Away Credit Card ", 0xb569a6e5, 0xae911c15),
7438c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID1(1, "Motorola MARQUIS", 0xf03e4e77),
7448c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID2(1, "FAX/Modem/Ethernet Combo Card ", 0x1ed59302),
7458c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0301),
7468c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x00a4, 0x0276),
7478c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0039),
7488c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0006),
7498c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0105, 0x0101), /* TDK DF2814 */
7508c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0105, 0x100a), /* Xircom CM-56G */
7518c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0105, 0x3e0a), /* TDK DF5660 */
7528c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0105, 0x410a),
7538c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0107, 0x0002), /* USRobotics 14,400 */
7548c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0d50),
7558c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0d51),
7568c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0d52),
7578c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0d53),
7588c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x010b, 0xd180),
7598c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0115, 0x3330), /* USRobotics/SUN 14,400 */
7608c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0124, 0x0100), /* Nokia DTP-2 ver II */
7618c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0134, 0x5600), /* LASAT COMMUNICATIONS A/S */
7628c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0137, 0x000e),
7638c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0137, 0x001b),
7648c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0025),
7658c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0045),
7668c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0052),
7678c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0006), /* Psion 56K+Fax */
7688c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0200, 0x0001), /* MultiMobile */
7698c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID134("ADV", "TECH", "COMpad-32/85", 0x67459937, 0x916d02ba, 0x8fbe92ae),
7708c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID124("GATEWAY2000", "CC3144", "PCMCIA MODEM", 0x506bccae, 0xcb3685f1, 0xbd6c43ef),
7718c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID14("MEGAHERTZ", "PCMCIA MODEM", 0xf510db04, 0xbd6c43ef),
7728c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID124("TOSHIBA", "T144PF", "PCMCIA MODEM", 0xb4585a1a, 0x7271409c, 0xbd6c43ef),
7738c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID123("FUJITSU", "FC14F ", "MBH10213", 0x6ee5a3d8, 0x30ead12b, 0xb00f05a0),
7748c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID123("Novatel Wireless", "Merlin UMTS Modem", "U630", 0x32607776, 0xd9e73b13, 0xe87332e),
7758c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID13("MEGAHERTZ", "V.34 PCMCIA MODEM", 0xf510db04, 0xbb2cce4a),
7768c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Brain Boxes", "Bluetooth PC Card", 0xee138382, 0xd4ce9b02),
7778c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("CIRRUS LOGIC", "FAX MODEM", 0xe625f451, 0xcecd6dfa),
7788c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("COMPAQ", "PCMCIA 28800 FAX/DATA MODEM", 0xa3a3062c, 0x8cbd7c76),
7798c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("COMPAQ", "PCMCIA 33600 FAX/DATA MODEM", 0xa3a3062c, 0x5a00ce95),
7808c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Computerboards, Inc.", "PCM-COM422", 0xd0b78f51, 0x7e2d49ed),
7818c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Dr. Neuhaus", "FURY CARD 14K4", 0x76942813, 0x8b96ce65),
7828c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("IBM", "ISDN/56K/GSM", 0xb569a6e5, 0xfee5297b),
7838c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Intelligent", "ANGIA FAX/MODEM", 0xb496e65e, 0xf31602a6),
7848c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Intel", "MODEM 2400+", 0x816cc815, 0x412729fb),
7858c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Intertex", "IX34-PCMCIA", 0xf8a097e3, 0x97880447),
7868c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("IOTech Inc ", "PCMCIA Dual RS-232 Serial Port Card", 0x3bd2d898, 0x92abc92f),
7878c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("MACRONIX", "FAX/MODEM", 0x668388b3, 0x3f9bdf2f),
7888c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT1432LT", 0x5f73be51, 0x0b3e2383),
7898c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT2834LT", 0x5f73be51, 0x4cd7c09e),
7908c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("OEM      ", "C288MX     ", 0xb572d360, 0xd2385b7a),
7918c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Option International", "V34bis GSM/PSTN Data/Fax Modem", 0x9d7cd6f5, 0x5cb8bf41),
7928c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Option International", "GSM-Ready 56K/ISDN", 0x9d7cd6f5, 0xb23844aa),
7938c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("PCMCIA   ", "C336MX     ", 0x99bcafe9, 0xaa25bcab),
7948c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Quatech Inc", "PCMCIA Dual RS-232 Serial Port Card", 0xc4420b35, 0x92abc92f),
7958c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Quatech Inc", "Dual RS-232 Serial Port PC Card", 0xc4420b35, 0x031a380d),
7968c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Telia", "SurfinBird 560P/A+", 0xe2cdd5e, 0xc9314b38),
7978c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID1("Smart Serial Port", 0x2d8ce292),
7988c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "PCMCIA", "EN2218-LAN/MODEM", 0x281f1c5d, 0x570f348e, "cis/PCMLM28.cis"),
7998c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "PCMCIA", "UE2218-LAN/MODEM", 0x281f1c5d, 0x6fdcacee, "cis/PCMLM28.cis"),
8008c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "cis/PCMLM28.cis"),
8018c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "cis/PCMLM28.cis"),
8028c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "cis/PCMLM28.cis"),
8038c2ecf20Sopenharmony_ci	PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "TOSHIBA", "Modem/LAN Card", 0xb4585a1a, 0x53f922f8, "cis/PCMLM28.cis"),
8048c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_CIS_PROD_ID12(1, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "cis/DP83903.cis"),
8058c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_CIS_PROD_ID4(1, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"),
8068c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0556, "cis/3CCFEM556.cis"),
8078c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0175, 0x0000, "cis/DP83903.cis"),
8088c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "cis/3CXEM556.cis"),
8098c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "cis/3CXEM556.cis"),
8108c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC850", 0xd85f6206, 0x42a2c018, "cis/SW_8xx_SER.cis"), /* Sierra Wireless AC850 3G Network Adapter R1 */
8118c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC860", 0xd85f6206, 0x698f93db, "cis/SW_8xx_SER.cis"), /* Sierra Wireless AC860 3G Network Adapter R1 */
8128c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC710/AC750", 0xd85f6206, 0x761b11e0, "cis/SW_7xx_SER.cis"),  /* Sierra Wireless AC710/AC750 GPRS Network Adapter R1 */
8138c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0xa555, "cis/SW_555_SER.cis"),  /* Sierra Aircard 555 CDMA 1xrtt Modem -- pre update */
8148c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_CIS_MANF_CARD(0x013f, 0xa555, "cis/SW_555_SER.cis"),  /* Sierra Aircard 555 CDMA 1xrtt Modem -- post update */
8158c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_CIS_PROD_ID12("MultiTech", "PCMCIA 56K DataFax", 0x842047ee, 0xc2efcf03, "cis/MT5634ZLX.cis"),
8168c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-2", 0x96913a85, 0x27ab5437, "cis/COMpad2.cis"),
8178c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "cis/COMpad4.cis"),
8188c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "cis/COMpad2.cis"),
8198c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "cis/RS-COM-2P.cis"),
8208c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.", "SERIAL CARD: SL100  1.00.", 0x19ca78af, 0xf964f42b),
8218c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.", "SERIAL CARD: SL100", 0x19ca78af, 0x71d98e83),
8228c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.", "SERIAL CARD: SL232  1.00.", 0x19ca78af, 0x69fb7490),
8238c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.", "SERIAL CARD: SL232", 0x19ca78af, 0xb6bc0235),
8248c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c2000.", "SERIAL CARD: CF232", 0x63f2e0bd, 0xb9e175d3),
8258c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c2000.", "SERIAL CARD: CF232-5", 0x63f2e0bd, 0xfce33442),
8268c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Elan", "Serial Port: CF232", 0x3beb8cf2, 0x171e7190),
8278c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Elan", "Serial Port: CF232-5", 0x3beb8cf2, 0x20da4262),
8288c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Elan", "Serial Port: CF428", 0x3beb8cf2, 0xea5dd57d),
8298c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Elan", "Serial Port: CF500", 0x3beb8cf2, 0xd77255fa),
8308c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Elan", "Serial Port: IC232", 0x3beb8cf2, 0x6a709903),
8318c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Elan", "Serial Port: SL232", 0x3beb8cf2, 0x18430676),
8328c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_PROD_ID12("Elan", "Serial Port: XL232", 0x3beb8cf2, 0x6f933767),
8338c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(0, "Elan", "Serial Port: CF332", 0x3beb8cf2, 0x16dc1ba7),
8348c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(0, "Elan", "Serial Port: SL332", 0x3beb8cf2, 0x19816c41),
8358c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(0, "Elan", "Serial Port: SL385", 0x3beb8cf2, 0x64112029),
8368c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(0, "Elan", "Serial Port: SL432", 0x3beb8cf2, 0x1cce7ac4),
8378c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(0, "Elan", "Serial+Parallel Port: SP230", 0x3beb8cf2, 0xdb9e58bc),
8388c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(1, "Elan", "Serial Port: CF332", 0x3beb8cf2, 0x16dc1ba7),
8398c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(1, "Elan", "Serial Port: SL332", 0x3beb8cf2, 0x19816c41),
8408c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(1, "Elan", "Serial Port: SL385", 0x3beb8cf2, 0x64112029),
8418c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(1, "Elan", "Serial Port: SL432", 0x3beb8cf2, 0x1cce7ac4),
8428c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(2, "Elan", "Serial Port: SL432", 0x3beb8cf2, 0x1cce7ac4),
8438c2ecf20Sopenharmony_ci	PCMCIA_MFC_DEVICE_PROD_ID12(3, "Elan", "Serial Port: SL432", 0x3beb8cf2, 0x1cce7ac4),
8448c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_MANF_CARD(0x0279, 0x950b),
8458c2ecf20Sopenharmony_ci	/* too generic */
8468c2ecf20Sopenharmony_ci	/* PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0160, 0x0002), */
8478c2ecf20Sopenharmony_ci	/* PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0160, 0x0002), */
8488c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_FUNC_ID(2),
8498c2ecf20Sopenharmony_ci	PCMCIA_DEVICE_NULL,
8508c2ecf20Sopenharmony_ci};
8518c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(pcmcia, serial_ids);
8528c2ecf20Sopenharmony_ci
8538c2ecf20Sopenharmony_ciMODULE_FIRMWARE("cis/PCMLM28.cis");
8548c2ecf20Sopenharmony_ciMODULE_FIRMWARE("cis/DP83903.cis");
8558c2ecf20Sopenharmony_ciMODULE_FIRMWARE("cis/3CCFEM556.cis");
8568c2ecf20Sopenharmony_ciMODULE_FIRMWARE("cis/3CXEM556.cis");
8578c2ecf20Sopenharmony_ciMODULE_FIRMWARE("cis/SW_8xx_SER.cis");
8588c2ecf20Sopenharmony_ciMODULE_FIRMWARE("cis/SW_7xx_SER.cis");
8598c2ecf20Sopenharmony_ciMODULE_FIRMWARE("cis/SW_555_SER.cis");
8608c2ecf20Sopenharmony_ciMODULE_FIRMWARE("cis/MT5634ZLX.cis");
8618c2ecf20Sopenharmony_ciMODULE_FIRMWARE("cis/COMpad2.cis");
8628c2ecf20Sopenharmony_ciMODULE_FIRMWARE("cis/COMpad4.cis");
8638c2ecf20Sopenharmony_ciMODULE_FIRMWARE("cis/RS-COM-2P.cis");
8648c2ecf20Sopenharmony_ci
8658c2ecf20Sopenharmony_cistatic struct pcmcia_driver serial_cs_driver = {
8668c2ecf20Sopenharmony_ci	.owner		= THIS_MODULE,
8678c2ecf20Sopenharmony_ci	.name		= "serial_cs",
8688c2ecf20Sopenharmony_ci	.probe		= serial_probe,
8698c2ecf20Sopenharmony_ci	.remove		= serial_detach,
8708c2ecf20Sopenharmony_ci	.id_table	= serial_ids,
8718c2ecf20Sopenharmony_ci	.suspend	= serial_suspend,
8728c2ecf20Sopenharmony_ci	.resume		= serial_resume,
8738c2ecf20Sopenharmony_ci};
8748c2ecf20Sopenharmony_cimodule_pcmcia_driver(serial_cs_driver);
8758c2ecf20Sopenharmony_ci
8768c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL");
877