linux/drivers/pcmcia/cs.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * cs.c -- Kernel Card Services - core services
 *
 * The initial developer of the original code is David A. Hinds
 * <[email protected]>.  Portions created by David A. Hinds
 * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
 *
 * (C) 1999		David A. Hinds
 */

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/major.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/timer.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/device.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <asm/irq.h>

#include <pcmcia/ss.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h>
#include <pcmcia/ds.h>
#include "cs_internal.h"


/* Module parameters */

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

#define INT_MODULE_PARM(n, v)

INT_MODULE_PARM(setup_delay,	10);		/* centiseconds */
INT_MODULE_PARM(resume_delay,	20);		/* centiseconds */
INT_MODULE_PARM(shutdown_delay,	3);		/* centiseconds */
INT_MODULE_PARM(vcc_settle,	40);		/* centiseconds */
INT_MODULE_PARM(reset_time,	10);		/* usecs */
INT_MODULE_PARM(unreset_delay,	10);		/* centiseconds */
INT_MODULE_PARM(unreset_check,	10);		/* centiseconds */
INT_MODULE_PARM(unreset_limit,	30);		/* unreset_check's */

/* Access speed for attribute memory windows */
INT_MODULE_PARM(cis_speed,	300);		/* ns */


socket_state_t dead_socket =;
EXPORT_SYMBOL();


/* List of all sockets, protected by a rwsem */
LIST_HEAD();
EXPORT_SYMBOL();

DECLARE_RWSEM();
EXPORT_SYMBOL();


struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt)
{}
EXPORT_SYMBOL();


void pcmcia_put_socket(struct pcmcia_socket *skt)
{}
EXPORT_SYMBOL();


static void pcmcia_release_socket(struct device *dev)
{}

static int pccardd(void *__skt);

/**
 * pcmcia_register_socket - add a new pcmcia socket device
 * @socket: the &socket to register
 */
int pcmcia_register_socket(struct pcmcia_socket *socket)
{} /* pcmcia_register_socket */
EXPORT_SYMBOL();


/**
 * pcmcia_unregister_socket - remove a pcmcia socket device
 * @socket: the &socket to unregister
 */
void pcmcia_unregister_socket(struct pcmcia_socket *socket)
{} /* pcmcia_unregister_socket */
EXPORT_SYMBOL();


struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr)
{}
EXPORT_SYMBOL();

static int socket_reset(struct pcmcia_socket *skt)
{}

/*
 * socket_setup() and socket_shutdown() are called by the main event handler
 * when card insertion and removal events are received.
 * socket_setup() turns on socket power and resets the socket, in two stages.
 * socket_shutdown() unconfigures a socket and turns off socket power.
 */
static void socket_shutdown(struct pcmcia_socket *s)
{}

static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
{}

/*
 * Handle card insertion.  Setup the socket, reset the card,
 * and then tell the rest of PCMCIA that a card is present.
 */
static int socket_insert(struct pcmcia_socket *skt)
{}

static int socket_suspend(struct pcmcia_socket *skt)
{}

static int socket_early_resume(struct pcmcia_socket *skt)
{}

static int socket_late_resume(struct pcmcia_socket *skt)
{}

/*
 * Finalize the resume. In case of a cardbus socket, we have
 * to rebind the devices as we can't be certain that it has been
 * replaced, or not.
 */
static int socket_complete_resume(struct pcmcia_socket *skt)
{}

/*
 * Resume a socket.  If a card is present, verify its CIS against
 * our cached copy.  If they are different, the card has been
 * replaced, and we need to tell the drivers.
 */
static int socket_resume(struct pcmcia_socket *skt)
{}

static void socket_remove(struct pcmcia_socket *skt)
{}

/*
 * Process a socket card detect status change.
 *
 * If we don't have a card already present, delay the detect event for
 * about 20ms (to be on the safe side) before reading the socket status.
 *
 * Some i82365-based systems send multiple SS_DETECT events during card
 * insertion, and the "card present" status bit seems to bounce.  This
 * will probably be true with GPIO-based card detection systems after
 * the product has aged.
 */
static void socket_detect_change(struct pcmcia_socket *skt)
{}

static int pccardd(void *__skt)
{}

/*
 * Yenta (at least) probes interrupts before registering the socket and
 * starting the handler thread.
 */
void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)
{} /* pcmcia_parse_events */
EXPORT_SYMBOL();

/**
 * pcmcia_parse_uevents() - tell pccardd to issue manual commands
 * @s:		the PCMCIA socket we wan't to command
 * @events:	events to pass to pccardd
 *
 * userspace-issued insert, eject, suspend and resume commands must be
 * handled by pccardd to avoid any sysfs-related deadlocks. Valid events
 * are PCMCIA_UEVENT_EJECT (for eject), PCMCIA_UEVENT__INSERT (for insert),
 * PCMCIA_UEVENT_RESUME (for resume), PCMCIA_UEVENT_SUSPEND (for suspend)
 * and PCMCIA_UEVENT_REQUERY (for re-querying the PCMCIA card).
 */
void pcmcia_parse_uevents(struct pcmcia_socket *s, u_int events)
{}
EXPORT_SYMBOL();


/* register pcmcia_callback */
int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c)
{}
EXPORT_SYMBOL();


/* I'm not sure which "reset" function this is supposed to use,
 * but for now, it uses the low-level interface's reset, not the
 * CIS register.
 */

int pcmcia_reset_card(struct pcmcia_socket *skt)
{} /* reset_card */
EXPORT_SYMBOL();


static int pcmcia_socket_uevent(const struct device *dev,
				struct kobj_uevent_env *env)
{}


static struct completion pcmcia_unload;

static void pcmcia_release_socket_class(const struct class *data)
{}


#ifdef CONFIG_PM

static int __pcmcia_pm_op(struct device *dev,
			  int (*callback) (struct pcmcia_socket *skt))
{}

static int pcmcia_socket_dev_suspend_noirq(struct device *dev)
{}

static int pcmcia_socket_dev_resume_noirq(struct device *dev)
{}

static int __used pcmcia_socket_dev_resume(struct device *dev)
{}

static void __used pcmcia_socket_dev_complete(struct device *dev)
{}

static const struct dev_pm_ops pcmcia_socket_pm_ops =;

#define PCMCIA_SOCKET_CLASS_PM_OPS

#else /* CONFIG_PM */

#define PCMCIA_SOCKET_CLASS_PM_OPS

#endif /* CONFIG_PM */

const struct class pcmcia_socket_class =;
EXPORT_SYMBOL();


static int __init init_pcmcia_cs(void)
{}

static void __exit exit_pcmcia_cs(void)
{}

subsys_initcall(init_pcmcia_cs);
module_exit(exit_pcmcia_cs);