linux/drivers/pcmcia/yenta_socket.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Regular cardbus driver ("yenta_socket")
 *
 * (C) Copyright 1999, 2000 Linus Torvalds
 *
 * Changelog:
 * Aug 2002: Manfred Spraul <[email protected]>
 * 	Dynamically adjust the size of the bridge resource
 *
 * May 2003: Dominik Brodowski <[email protected]>
 * 	Merge pci_socket.c and yenta.c into one file
 */
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/io.h>
#include <linux/slab.h>

#include <pcmcia/ss.h>

#include "yenta_socket.h"
#include "i82365.h"

static bool disable_clkrun;
module_param(disable_clkrun, bool, 0444);
MODULE_PARM_DESC();

static bool isa_probe =;
module_param(isa_probe, bool, 0444);
MODULE_PARM_DESC();

static bool pwr_irqs_off;
module_param(pwr_irqs_off, bool, 0644);
MODULE_PARM_DESC();

static char o2_speedup[] =;
module_param_string();
MODULE_PARM_DESC();

/*
 * Only probe "regular" interrupts, don't
 * touch dangerous spots like the mouse irq,
 * because there are mice that apparently
 * get really confused if they get fondled
 * too intimately.
 *
 * Default to 11, 10, 9, 7, 6, 5, 4, 3.
 */
static u32 isa_interrupts =;


#define debug(x, s, args...)

/* Don't ask.. */
#define to_cycles(ns)
#define to_ns(cycles)

/*
 * yenta PCI irq probing.
 * currently only used in the TI/EnE initialization code
 */
#ifdef CONFIG_YENTA_TI
static int yenta_probe_cb_irq(struct yenta_socket *socket);
static unsigned int yenta_probe_irq(struct yenta_socket *socket,
				u32 isa_irq_mask);
#endif


static unsigned int override_bios;
module_param(override_bios, uint, 0000);
MODULE_PARM_DESC();

/*
 * Generate easy-to-use ways of reading a cardbus sockets
 * regular memory space ("cb_xxx"), configuration space
 * ("config_xxx") and compatibility space ("exca_xxxx")
 */
static inline u32 cb_readl(struct yenta_socket *socket, unsigned reg)
{}

static inline void cb_writel(struct yenta_socket *socket, unsigned reg, u32 val)
{}

static inline u8 config_readb(struct yenta_socket *socket, unsigned offset)
{}

static inline u16 config_readw(struct yenta_socket *socket, unsigned offset)
{}

static inline u32 config_readl(struct yenta_socket *socket, unsigned offset)
{}

static inline void config_writeb(struct yenta_socket *socket, unsigned offset, u8 val)
{}

static inline void config_writew(struct yenta_socket *socket, unsigned offset, u16 val)
{}

static inline void config_writel(struct yenta_socket *socket, unsigned offset, u32 val)
{}

static inline u8 exca_readb(struct yenta_socket *socket, unsigned reg)
{}

/*
static inline u8 exca_readw(struct yenta_socket *socket, unsigned reg)
{
	u16 val;
	val = readb(socket->base + 0x800 + reg);
	val |= readb(socket->base + 0x800 + reg + 1) << 8;
	debug("%04x %04x\n", socket, reg, val);
	return val;
}
*/

static inline void exca_writeb(struct yenta_socket *socket, unsigned reg, u8 val)
{}

static void exca_writew(struct yenta_socket *socket, unsigned reg, u16 val)
{}

static ssize_t show_yenta_registers(struct device *yentadev, struct device_attribute *attr, char *buf)
{}

static DEVICE_ATTR(yenta_registers, S_IRUSR, show_yenta_registers, NULL);

/*
 * Ugh, mixed-mode cardbus and 16-bit pccard state: things depend
 * on what kind of card is inserted..
 */
static int yenta_get_status(struct pcmcia_socket *sock, unsigned int *value)
{}

static void yenta_set_power(struct yenta_socket *socket, socket_state_t *state)
{}

static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
{}

static int yenta_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io)
{}

static int yenta_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *mem)
{}



static irqreturn_t yenta_interrupt(int irq, void *dev_id)
{}

static void yenta_interrupt_wrapper(struct timer_list *t)
{}

static void yenta_clear_maps(struct yenta_socket *socket)
{}

/* redoes voltage interrogation if required */
static void yenta_interrogate(struct yenta_socket *socket)
{}

/* Called at resume and initialization events */
static int yenta_sock_init(struct pcmcia_socket *sock)
{}

static int yenta_sock_suspend(struct pcmcia_socket *sock)
{}

/*
 * Use an adaptive allocation for the memory resource,
 * sometimes the memory behind pci bridges is limited:
 * 1/8 of the size of the io window of the parent.
 * max 4 MB, min 16 kB. We try very hard to not get below
 * the "ACC" values, though.
 */
#define BRIDGE_MEM_MAX
#define BRIDGE_MEM_ACC
#define BRIDGE_MEM_MIN

#define BRIDGE_IO_MAX
#define BRIDGE_IO_ACC
#define BRIDGE_IO_MIN

#ifndef PCIBIOS_MIN_CARDBUS_IO
#define PCIBIOS_MIN_CARDBUS_IO
#endif

static int yenta_search_one_res(struct resource *root, struct resource *res,
				u32 min)
{}


static int yenta_search_res(struct yenta_socket *socket, struct resource *res,
			    u32 min)
{}

static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end)
{}

static void yenta_free_res(struct yenta_socket *socket, int nr)
{}

/*
 * Allocate the bridge mappings for the device..
 */
static void yenta_allocate_resources(struct yenta_socket *socket)
{}


/*
 * Free the bridge mappings for the device..
 */
static void yenta_free_resources(struct yenta_socket *socket)
{}


/*
 * Close it down - release our resources and go home..
 */
static void yenta_close(struct pci_dev *dev)
{}


static struct pccard_operations yenta_socket_operations =;


#ifdef CONFIG_YENTA_TI
#include "ti113x.h"
#endif
#ifdef CONFIG_YENTA_RICOH
#include "ricoh.h"
#endif
#ifdef CONFIG_YENTA_TOSHIBA
#include "topic.h"
#endif
#ifdef CONFIG_YENTA_O2
#include "o2micro.h"
#endif

enum {};

/*
 * Different cardbus controllers have slightly different
 * initialization sequences etc details. List them here..
 */
static struct cardbus_type cardbus_type[] =;


static unsigned int yenta_probe_irq(struct yenta_socket *socket, u32 isa_irq_mask)
{}


/*
 * yenta PCI irq probing.
 * currently only used in the TI/EnE initialization code
 */
#ifdef CONFIG_YENTA_TI

/* interrupt handler, only used during probing */
static irqreturn_t yenta_probe_handler(int irq, void *dev_id)
{}

/* probes the PCI interrupt, use only on override functions */
static int yenta_probe_cb_irq(struct yenta_socket *socket)
{}

#endif /* CONFIG_YENTA_TI */


/*
 * Set static data that doesn't need re-initializing..
 */
static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_irq_mask)
{}

/*
 * Initialize the standard cardbus registers
 */
static void yenta_config_init(struct yenta_socket *socket)
{}

/**
 * yenta_fixup_parent_bridge - Fix subordinate bus# of the parent bridge
 * @cardbus_bridge: The PCI bus which the CardBus bridge bridges to
 *
 * Checks if devices on the bus which the CardBus bridge bridges to would be
 * invisible during PCI scans because of a misconfigured subordinate number
 * of the parent brige - some BIOSes seem to be too lazy to set it right.
 * Does the fixup carefully by checking how far it can go without conflicts.
 * See http://bugzilla.kernel.org/show_bug.cgi?id=2944 for more information.
 */
static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
{}

/*
 * Initialize a cardbus controller. Make sure we have a usable
 * interrupt, and that we can map the cardbus area. Fill in the
 * socket information structure..
 */
static int yenta_probe(struct pci_dev *dev, const struct pci_device_id *id)
{}

#ifdef CONFIG_PM_SLEEP
static int yenta_dev_suspend_noirq(struct device *dev)
{}

static int yenta_dev_resume_noirq(struct device *dev)
{}

static const struct dev_pm_ops yenta_pm_ops =;

#define YENTA_PM_OPS
#else
#define YENTA_PM_OPS
#endif

#define CB_ID(vend, dev, type)

static const struct pci_device_id yenta_table[] =;
MODULE_DEVICE_TABLE(pci, yenta_table);


static struct pci_driver yenta_cardbus_driver =;

module_pci_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();