Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6537889 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (22 commits)
  pcmcia: synclink_cs: fix information leak to userland
  pcmcia: don't call flush_scheduled_work() spuriously
  serial_cs: drop spurious flush_scheduled_work() call
  pcmcia/yenta: guide users in case of problems with O2-bridges
  pcmcia: fix unused function compile warning
  pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device
  pcmcia: add a few debug statements
  pcmcia: remove obsolete and wrong comments
  pcmcia: avoid messages on module (un)loading
  pcmcia: move driver name to struct pcmcia_driver
  pcmcia: remove the "Finally, report what we've done" message
  pcmcia: use autoconfiguration feature for ioports and iomem
  pcmcia: introduce autoconfiguration feature
  pcmcia: Documentation update
  pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device
  pcmcia: move config_{base,index,regs} to struct pcmcia_device
  pcmcia: simplify IntType
  pcmcia: simplify Status, ExtStatus register access
  pcmcia: remove Pin, Copy configuration register access
  pcmcia: move Vpp setup to struct pcmcia_device
  ...
parents 157b6ceb 5b917a14
Loading
Loading
Loading
Loading
+25 −0
Original line number Original line Diff line number Diff line
This file details changes in 2.6 which affect PCMCIA card driver authors:
This file details changes in 2.6 which affect PCMCIA card driver authors:
* pcmcia_loop_config() and autoconfiguration (as of 2.6.36)
   If struct pcmcia_device *p_dev->config_flags is set accordingly,
   pcmcia_loop_config() now sets up certain configuration values
   automatically, though the driver may still override the settings
   in the callback function. The following autoconfiguration options
   are provided at the moment:
	CONF_AUTO_CHECK_VCC : check for matching Vcc
	CONF_AUTO_SET_VPP   : set Vpp
	CONF_AUTO_AUDIO     : auto-enable audio line, if required
	CONF_AUTO_SET_IO    : set ioport resources (->resource[0,1])
	CONF_AUTO_SET_IOMEM : set first iomem resource (->resource[2])

* pcmcia_request_configuration -> pcmcia_enable_device (as of 2.6.36)
   pcmcia_request_configuration() got renamed to pcmcia_enable_device(),
   as it mirrors pcmcia_disable_device(). Configuration settings are now
   stored in struct pcmcia_device, e.g. in the fields config_flags,
   config_index, config_base, vpp.

* pcmcia_request_window changes (as of 2.6.36)
   Instead of win_req_t, drivers are now requested to fill out
   struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four ioport
   ranges. After a call to pcmcia_request_window(), the regions found there
   are reserved and may be used immediately -- until pcmcia_release_window()
   is called.

* pcmcia_request_io changes (as of 2.6.36)
* pcmcia_request_io changes (as of 2.6.36)
   Instead of io_req_t, drivers are now requested to fill out
   Instead of io_req_t, drivers are now requested to fill out
   struct pcmcia_device *p_dev->resource[0,1] for up to two ioport
   struct pcmcia_device *p_dev->resource[0,1] for up to two ioport
+27 −77
Original line number Original line Diff line number Diff line
@@ -34,7 +34,6 @@
#include <linux/ata.h>
#include <linux/ata.h>
#include <linux/libata.h>
#include <linux/libata.h>


#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
#include <pcmcia/ds.h>
#include <pcmcia/cisreg.h>
#include <pcmcia/cisreg.h>
@@ -168,63 +167,26 @@ static struct ata_port_operations pcmcia_8bit_port_ops = {
};
};




struct pcmcia_config_check {
static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data)
	unsigned long ctl_base;
	int skip_vcc;
	int is_kme;
};

static int pcmcia_check_one_config(struct pcmcia_device *pdev,
				   cistpl_cftable_entry_t *cfg,
				   cistpl_cftable_entry_t *dflt,
				   unsigned int vcc,
				   void *priv_data)
{
{
	struct pcmcia_config_check *stk = priv_data;
	int *is_kme = priv_data;


	/* Check for matching Vcc, unless we're desperate */
	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
	if (!stk->skip_vcc) {
		if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
			if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
				return -ENODEV;
		} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
			if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
				return -ENODEV;
		}
	}

	if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
		pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
	else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
		pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;

	if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
		cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
		pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
		pdev->resource[0]->start = io->win[0].base;
		if (!(io->flags & CISTPL_IO_16BIT)) {
		pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
		pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
			pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
		pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
	}
	}
		if (io->nwin == 2) {
	pdev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
	pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;

	if (pdev->resource[1]->end) {
		pdev->resource[0]->end = 8;
		pdev->resource[0]->end = 8;
			pdev->resource[1]->start = io->win[1].base;
		pdev->resource[1]->end = (*is_kme) ? 2 : 1;
			pdev->resource[1]->end = (stk->is_kme) ? 2 : 1;
	} else {
			if (pcmcia_request_io(pdev) != 0)
		if (pdev->resource[0]->end < 16)
			return -ENODEV;
			return -ENODEV;
			stk->ctl_base = pdev->resource[1]->start;
		} else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
			pdev->resource[0]->end = io->win[0].len;
			pdev->resource[1]->end = 0;
			if (pcmcia_request_io(pdev) != 0)
				return -ENODEV;
			stk->ctl_base = pdev->resource[0]->start + 0x0e;
		} else
			return -ENODEV;
		/* If we've got this far, we're done */
		return 0;
	}
	}
	return -ENODEV;

	return pcmcia_request_io(pdev);
}
}


/**
/**
@@ -239,7 +201,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
{
{
	struct ata_host *host;
	struct ata_host *host;
	struct ata_port *ap;
	struct ata_port *ap;
	struct pcmcia_config_check *stk = NULL;
	int is_kme = 0, ret = -ENOMEM, p;
	int is_kme = 0, ret = -ENOMEM, p;
	unsigned long io_base, ctl_base;
	unsigned long io_base, ctl_base;
	void __iomem *io_addr, *ctl_addr;
	void __iomem *io_addr, *ctl_addr;
@@ -247,10 +208,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
	struct ata_port_operations *ops = &pcmcia_port_ops;
	struct ata_port_operations *ops = &pcmcia_port_ops;


	/* Set up attributes in order to probe card and get resources */
	/* Set up attributes in order to probe card and get resources */
	pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
	pdev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO |
	pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
		CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC;
	pdev->conf.Attributes = CONF_ENABLE_IRQ;
	pdev->conf.IntType = INT_MEMORY_AND_IO;


	/* See if we have a manufacturer identifier. Use it to set is_kme for
	/* See if we have a manufacturer identifier. Use it to set is_kme for
	   vendor quirks */
	   vendor quirks */
@@ -258,25 +217,21 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
		  ((pdev->card_id == PRODID_KME_KXLC005_A) ||
		  ((pdev->card_id == PRODID_KME_KXLC005_A) ||
		   (pdev->card_id == PRODID_KME_KXLC005_B)));
		   (pdev->card_id == PRODID_KME_KXLC005_B)));


	/* Allocate resoure probing structures */
	if (pcmcia_loop_config(pdev, pcmcia_check_one_config, &is_kme)) {

		pdev->config_flags &= ~CONF_AUTO_CHECK_VCC;
	stk = kzalloc(sizeof(*stk), GFP_KERNEL);
		if (pcmcia_loop_config(pdev, pcmcia_check_one_config, &is_kme))
	if (!stk)
		goto out1;
	stk->is_kme = is_kme;
	stk->skip_vcc = io_base = ctl_base = 0;

	if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) {
		stk->skip_vcc = 1;
		if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk))
			goto failed; /* No suitable config found */
			goto failed; /* No suitable config found */
	}
	}
	io_base = pdev->resource[0]->start;
	io_base = pdev->resource[0]->start;
	ctl_base = stk->ctl_base;
	if (pdev->resource[1]->end)
		ctl_base = pdev->resource[1]->start;
	else
		ctl_base = pdev->resource[0]->start + 0x0e;

	if (!pdev->irq)
	if (!pdev->irq)
		goto failed;
		goto failed;


	ret = pcmcia_request_configuration(pdev, &pdev->conf);
	ret = pcmcia_enable_device(pdev);
	if (ret)
	if (ret)
		goto failed;
		goto failed;


@@ -329,13 +284,10 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
		goto failed;
		goto failed;


	pdev->priv = host;
	pdev->priv = host;
	kfree(stk);
	return 0;
	return 0;


failed:
failed:
	kfree(stk);
	pcmcia_disable_device(pdev);
	pcmcia_disable_device(pdev);
out1:
	return ret;
	return ret;
}
}


@@ -430,9 +382,7 @@ MODULE_DEVICE_TABLE(pcmcia, pcmcia_devices);


static struct pcmcia_driver pcmcia_driver = {
static struct pcmcia_driver pcmcia_driver = {
	.owner		= THIS_MODULE,
	.owner		= THIS_MODULE,
	.drv = {
	.name		= DRV_NAME,
	.name		= DRV_NAME,
	},
	.id_table	= pcmcia_devices,
	.id_table	= pcmcia_devices,
	.probe		= pcmcia_init_one,
	.probe		= pcmcia_init_one,
	.remove		= pcmcia_remove_one,
	.remove		= pcmcia_remove_one,
+4 −8
Original line number Original line Diff line number Diff line
@@ -39,7 +39,6 @@
#include <linux/skbuff.h>
#include <linux/skbuff.h>
#include <linux/io.h>
#include <linux/io.h>


#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h>
#include <pcmcia/ciscode.h>
#include <pcmcia/ds.h>
#include <pcmcia/ds.h>
@@ -865,8 +864,7 @@ static int bluecard_probe(struct pcmcia_device *link)
	info->p_dev = link;
	info->p_dev = link;
	link->priv = info;
	link->priv = info;


	link->conf.Attributes = CONF_ENABLE_IRQ;
	link->config_flags |= CONF_ENABLE_IRQ;
	link->conf.IntType = INT_MEMORY_AND_IO;


	return bluecard_config(link);
	return bluecard_config(link);
}
}
@@ -886,7 +884,7 @@ static int bluecard_config(struct pcmcia_device *link)
	bluecard_info_t *info = link->priv;
	bluecard_info_t *info = link->priv;
	int i, n;
	int i, n;


	link->conf.ConfigIndex = 0x20;
	link->config_index = 0x20;


	link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
	link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
	link->resource[0]->end = 64;
	link->resource[0]->end = 64;
@@ -906,7 +904,7 @@ static int bluecard_config(struct pcmcia_device *link)
	if (i != 0)
	if (i != 0)
		goto failed;
		goto failed;


	i = pcmcia_request_configuration(link, &link->conf);
	i = pcmcia_enable_device(link);
	if (i != 0)
	if (i != 0)
		goto failed;
		goto failed;


@@ -942,9 +940,7 @@ MODULE_DEVICE_TABLE(pcmcia, bluecard_ids);


static struct pcmcia_driver bluecard_driver = {
static struct pcmcia_driver bluecard_driver = {
	.owner		= THIS_MODULE,
	.owner		= THIS_MODULE,
	.drv		= {
	.name		= "bluecard_cs",
	.name		= "bluecard_cs",
	},
	.probe		= bluecard_probe,
	.probe		= bluecard_probe,
	.remove		= bluecard_detach,
	.remove		= bluecard_detach,
	.id_table	= bluecard_ids,
	.id_table	= bluecard_ids,
+28 −36
Original line number Original line Diff line number Diff line
@@ -45,7 +45,6 @@
#include <linux/device.h>
#include <linux/device.h>
#include <linux/firmware.h>
#include <linux/firmware.h>


#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h>
#include <pcmcia/ciscode.h>
#include <pcmcia/ds.h>
#include <pcmcia/ds.h>
@@ -657,11 +656,8 @@ static int bt3c_probe(struct pcmcia_device *link)
	info->p_dev = link;
	info->p_dev = link;
	link->priv = info;
	link->priv = info;


	link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
	link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
	link->resource[0]->end = 8;
		CONF_AUTO_SET_IO;

	link->conf.Attributes = CONF_ENABLE_IRQ;
	link->conf.IntType = INT_MEMORY_AND_IO;


	return bt3c_config(link);
	return bt3c_config(link);
}
}
@@ -675,44 +671,42 @@ static void bt3c_detach(struct pcmcia_device *link)
	kfree(info);
	kfree(info);
}
}


static int bt3c_check_config(struct pcmcia_device *p_dev,
static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data)
			     cistpl_cftable_entry_t *cf,
			     cistpl_cftable_entry_t *dflt,
			     unsigned int vcc,
			     void *priv_data)
{
{
	unsigned long try = (unsigned long) priv_data;
	int *try = priv_data;


	p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
	if (try == 0)
		p_dev->io_lines = 16;


	if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
	if ((p_dev->resource[0]->end != 8) || (p_dev->resource[0]->start == 0))
		p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
		return -EINVAL;
	if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&

	    (cf->io.win[0].base != 0)) {
	p_dev->resource[0]->end = 8;
		p_dev->resource[0]->start = cf->io.win[0].base;
	p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
		if (!pcmcia_request_io(p_dev))
	p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
			return 0;

	}
	return pcmcia_request_io(p_dev);
	return -ENODEV;
}
}


static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
				      cistpl_cftable_entry_t *cf,
				      cistpl_cftable_entry_t *dflt,
				      unsigned int vcc,
				      void *priv_data)
				      void *priv_data)
{
{
	static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
	static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
	int j;
	int j;


	if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
	if (p_dev->io_lines > 3)
		return -ENODEV;

	p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
	p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
	p_dev->resource[0]->end = 8;

	for (j = 0; j < 5; j++) {
	for (j = 0; j < 5; j++) {
		p_dev->resource[0]->start = base[j];
		p_dev->resource[0]->start = base[j];
		p_dev->io_lines = base[j] ? 16 : 3;
		p_dev->io_lines = base[j] ? 16 : 3;
		if (!pcmcia_request_io(p_dev))
		if (!pcmcia_request_io(p_dev))
			return 0;
			return 0;
	}
	}
	}
	return -ENODEV;
	return -ENODEV;
}
}


@@ -742,7 +736,7 @@ static int bt3c_config(struct pcmcia_device *link)
	if (i != 0)
	if (i != 0)
		goto failed;
		goto failed;


	i = pcmcia_request_configuration(link, &link->conf);
	i = pcmcia_enable_device(link);
	if (i != 0)
	if (i != 0)
		goto failed;
		goto failed;


@@ -775,9 +769,7 @@ MODULE_DEVICE_TABLE(pcmcia, bt3c_ids);


static struct pcmcia_driver bt3c_driver = {
static struct pcmcia_driver bt3c_driver = {
	.owner		= THIS_MODULE,
	.owner		= THIS_MODULE,
	.drv		= {
	.name		= "bt3c_cs",
	.name		= "bt3c_cs",
	},
	.probe		= bt3c_probe,
	.probe		= bt3c_probe,
	.remove		= bt3c_detach,
	.remove		= bt3c_detach,
	.id_table	= bt3c_ids,
	.id_table	= bt3c_ids,
+27 −35
Original line number Original line Diff line number Diff line
@@ -41,7 +41,6 @@
#include <asm/system.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/io.h>


#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h>
#include <pcmcia/ciscode.h>
#include <pcmcia/ds.h>
#include <pcmcia/ds.h>
@@ -586,11 +585,8 @@ static int btuart_probe(struct pcmcia_device *link)
	info->p_dev = link;
	info->p_dev = link;
	link->priv = info;
	link->priv = info;


	link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
	link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
	link->resource[0]->end = 8;
		CONF_AUTO_SET_IO;

	link->conf.Attributes = CONF_ENABLE_IRQ;
	link->conf.IntType = INT_MEMORY_AND_IO;


	return btuart_config(link);
	return btuart_config(link);
}
}
@@ -604,44 +600,42 @@ static void btuart_detach(struct pcmcia_device *link)
	kfree(info);
	kfree(info);
}
}


static int btuart_check_config(struct pcmcia_device *p_dev,
static int btuart_check_config(struct pcmcia_device *p_dev, void *priv_data)
			       cistpl_cftable_entry_t *cf,
			       cistpl_cftable_entry_t *dflt,
			       unsigned int vcc,
			       void *priv_data)
{
{
	int *try = priv_data;
	int *try = priv_data;


	p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
	if (try == 0)
		p_dev->io_lines = 16;


	if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
	if ((p_dev->resource[0]->end != 8) || (p_dev->resource[0]->start == 0))
		p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
		return -EINVAL;
	if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&

	    (cf->io.win[0].base != 0)) {
	p_dev->resource[0]->end = 8;
		p_dev->resource[0]->start = cf->io.win[0].base;
	p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
		if (!pcmcia_request_io(p_dev))
	p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
			return 0;

	}
	return pcmcia_request_io(p_dev);
	return -ENODEV;
}
}


static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
					cistpl_cftable_entry_t *cf,
					cistpl_cftable_entry_t *dflt,
					unsigned int vcc,
					void *priv_data)
					void *priv_data)
{
{
	static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
	static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
	int j;
	int j;


	if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
	if (p_dev->io_lines > 3)
		return -ENODEV;

	p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
	p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
	p_dev->resource[0]->end = 8;

	for (j = 0; j < 5; j++) {
	for (j = 0; j < 5; j++) {
		p_dev->resource[0]->start = base[j];
		p_dev->resource[0]->start = base[j];
		p_dev->io_lines = base[j] ? 16 : 3;
		p_dev->io_lines = base[j] ? 16 : 3;
		if (!pcmcia_request_io(p_dev))
		if (!pcmcia_request_io(p_dev))
			return 0;
			return 0;
	}
	}
	}
	return -ENODEV;
	return -ENODEV;
}
}


@@ -671,7 +665,7 @@ static int btuart_config(struct pcmcia_device *link)
	if (i != 0)
	if (i != 0)
		goto failed;
		goto failed;


	i = pcmcia_request_configuration(link, &link->conf);
	i = pcmcia_enable_device(link);
	if (i != 0)
	if (i != 0)
		goto failed;
		goto failed;


@@ -703,9 +697,7 @@ MODULE_DEVICE_TABLE(pcmcia, btuart_ids);


static struct pcmcia_driver btuart_driver = {
static struct pcmcia_driver btuart_driver = {
	.owner		= THIS_MODULE,
	.owner		= THIS_MODULE,
	.drv		= {
	.name		= "btuart_cs",
	.name		= "btuart_cs",
	},
	.probe		= btuart_probe,
	.probe		= btuart_probe,
	.remove		= btuart_detach,
	.remove		= btuart_detach,
	.id_table	= btuart_ids,
	.id_table	= btuart_ids,
Loading