Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6/
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6/:
  [PATCH] pcmcia: fix deadlock in pcmcia_parse_events
  [PATCH] com20020_cs: more device support
  [PATCH] au1xxx: pcmcia: fix __init called from non-init
  [PATCH] kill open-coded offsetof in cm4000_cs.c ZERO_DEV()
  [PATCH] pcmcia: convert pcmcia_cs to kthread
  [PATCH] pcmcia: fix kernel-doc function name
  [PATCH] pcmcia: hostap_cs.c - 0xc00f,0x0000 conflicts with pcnet_cs
  [PATCH] pcmcia: at91_cf suspend/resume/wakeup
  [PATCH] pcmcia: Make ide_cs work with the memory space of CF-Cards if IO space is not available
  [PATCH] pcmcia: TI PCIxx12 CardBus controller support
  [PATCH] pcmcia: warn if driver requests exclusive, but gets a shared IRQ
  [PATCH] pcmcia: expose tool in pcmcia/Documentation/pcmcia/
  [PATCH] pcmcia: another ID for serial_cs.c
  [PATCH] yenta: fix hidden PCI bus numbers
  [PATCH] yenta: do power-up only after socket is configured
  • Loading branch information
Linus Torvalds committed Jun 30, 2006
2 parents 1cfef5e + 4b7a89a commit 3930217
Show file tree
Hide file tree
Showing 14 changed files with 291 additions and 91 deletions.
32 changes: 32 additions & 0 deletions Documentation/pcmcia/crc32hash.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* crc32hash.c - derived from linux/lib/crc32.c, GNU GPL v2 */
/* Usage example:
$ ./crc32hash "Dual Speed"
*/

#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

unsigned int crc32(unsigned char const *p, unsigned int len)
{
int i;
unsigned int crc = 0;
while (len--) {
crc ^= *p++;
for (i = 0; i < 8; i++)
crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0);
}
return crc;
}

int main(int argc, char **argv) {
unsigned int result;
if (argc != 2) {
printf("no string passed as argument\n");
return -1;
}
result = crc32(argv[1], strlen(argv[1]));
printf("0x%x\n", result);
return 0;
}
36 changes: 3 additions & 33 deletions Documentation/pcmcia/devicetable.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,7 @@ pcmcia:m0149cC1ABf06pfn00fn00pa725B842DpbF1EFEE84pc0877B627pd00000000
The hex value after "pa" is the hash of product ID string 1, after "pb" for
string 2 and so on.

Alternatively, you can use this small tool to determine the crc32 hash.
simply pass the string you want to evaluate as argument to this program,
e.g.
Alternatively, you can use crc32hash (see Documentation/pcmcia/crc32hash.c)
to determine the crc32 hash. Simply pass the string you want to evaluate
as argument to this program, e.g.:
$ ./crc32hash "Dual Speed"

-------------------------------------------------------------------------
/* crc32hash.c - derived from linux/lib/crc32.c, GNU GPL v2 */
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

unsigned int crc32(unsigned char const *p, unsigned int len)
{
int i;
unsigned int crc = 0;
while (len--) {
crc ^= *p++;
for (i = 0; i < 8; i++)
crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0);
}
return crc;
}

int main(int argc, char **argv) {
unsigned int result;
if (argc != 2) {
printf("no string passed as argument\n");
return -1;
}
result = crc32(argv[1], strlen(argv[1]));
printf("0x%x\n", result);
return 0;
}
7 changes: 1 addition & 6 deletions drivers/char/pcmcia/cm4000_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,7 @@ struct cm4000_dev {
#define ZERO_DEV(dev) \
memset(&dev->atr_csum,0, \
sizeof(struct cm4000_dev) - \
/*link*/ sizeof(struct pcmcia_device *) - \
/*node*/ sizeof(dev_node_t) - \
/*atr*/ MAX_ATR*sizeof(char) - \
/*rbuf*/ 512*sizeof(char) - \
/*sbuf*/ 512*sizeof(char) - \
/*queue*/ 4*sizeof(wait_queue_head_t))
offsetof(struct cm4000_dev, atr_csum))

static struct pcmcia_device *dev_table[CM4000_MAX_DEV];
static struct class *cmm_class;
Expand Down
81 changes: 71 additions & 10 deletions drivers/ide/legacy/ide-cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,36 @@ static void ide_detach(struct pcmcia_device *link)
kfree(link->priv);
} /* ide_detach */

static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle)
static void idecs_mmio_fixup(ide_hwif_t *hwif)
{
default_hwif_mmiops(hwif);
hwif->mmio = 2;

ide_undecoded_slave(hwif);
}

static int idecs_register(unsigned long io, unsigned long ctl,
unsigned long irq, struct pcmcia_device *handle, int is_mmio)
{
hw_regs_t hw;
memset(&hw, 0, sizeof(hw));
ide_init_hwif_ports(&hw, io, ctl, NULL);
hw.irq = irq;
hw.chipset = ide_pci;
hw.dev = &handle->dev;
return ide_register_hw_with_fixup(&hw, NULL, ide_undecoded_slave);

if(is_mmio)
return ide_register_hw_with_fixup(&hw, NULL, idecs_mmio_fixup);
else
return ide_register_hw_with_fixup(&hw, NULL, ide_undecoded_slave);
}

void outb_io(unsigned char value, unsigned long port) {
outb(value, port);
}

void outb_mem(unsigned char value, unsigned long port) {
writeb(value, (void __iomem *) port);
}

/*======================================================================
Expand All @@ -180,7 +201,8 @@ static int ide_config(struct pcmcia_device *link)
} *stk = NULL;
cistpl_cftable_entry_t *cfg;
int i, pass, last_ret = 0, last_fn = 0, hd, is_kme = 0;
unsigned long io_base, ctl_base;
unsigned long io_base, ctl_base, is_mmio, try_slave;
void (*my_outb)(unsigned char, unsigned long);

DEBUG(0, "ide_config(0x%p)\n", link);

Expand Down Expand Up @@ -210,7 +232,7 @@ static int ide_config(struct pcmcia_device *link)
/* Not sure if this is right... look up the current Vcc */
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf));

pass = io_base = ctl_base = 0;
pass = io_base = ctl_base = is_mmio = try_slave = 0;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
tuple.Attributes = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
Expand Down Expand Up @@ -258,11 +280,45 @@ static int ide_config(struct pcmcia_device *link)
goto next_entry;
io_base = link->io.BasePort1;
ctl_base = link->io.BasePort1 + 0x0e;

if (io->win[0].len >= 0x20)
try_slave = 1;

} else goto next_entry;
/* If we've got this far, we're done */
break;
}

if ((cfg->mem.nwin > 0) || (stk->dflt.mem.nwin > 0)) {
win_req_t req;
memreq_t map;
cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &stk->dflt.mem;

if (mem->win[0].len < 16)
goto next_entry;

req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
req.Attributes |= WIN_ENABLE;
req.Base = mem->win[0].host_addr;
req.Size = 0;

req.AccessSpeed = 0;
if (pcmcia_request_window(&link, &req, &link->win) != 0)
goto next_entry;
map.Page = 0; map.CardOffset = mem->win[0].card_addr;
if (pcmcia_map_mem_page(link->win, &map) != 0)
goto next_entry;

io_base = (unsigned long) ioremap(req.Base, req.Size);
ctl_base = io_base + 0x0e;
is_mmio = 1;

if (mem->win[0].len >= 0x20)
try_slave = 1;

break;
}

next_entry:
if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
memcpy(&stk->dflt, cfg, sizeof(stk->dflt));
Expand All @@ -278,21 +334,26 @@ static int ide_config(struct pcmcia_device *link)
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));

if(is_mmio)
my_outb = outb_mem;
else
my_outb = outb_io;

/* disable drive interrupts during IDE probe */
outb(0x02, ctl_base);
my_outb(0x02, ctl_base);

/* special setup for KXLC005 card */
if (is_kme)
outb(0x81, ctl_base+1);
my_outb(0x81, ctl_base+1);

/* retry registration in case device is still spinning up */
for (hd = -1, i = 0; i < 10; i++) {
hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link, is_mmio);
if (hd >= 0) break;
if (link->io.NumPorts1 == 0x20) {
outb(0x02, ctl_base + 0x10);
if (try_slave) {
my_outb(0x02, ctl_base + 0x10);
hd = idecs_register(io_base + 0x10, ctl_base + 0x10,
link->irq.AssignedIRQ, link);
link->irq.AssignedIRQ, link, is_mmio);
if (hd >= 0) {
io_base += 0x10;
ctl_base += 0x10;
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/pcmcia/com20020_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,10 @@ static int com20020_resume(struct pcmcia_device *link)
}

static struct pcmcia_device_id com20020_ids[] = {
PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf),
PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.",
"PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf),
PCMCIA_DEVICE_PROD_ID12("SoHard AG",
"SH ARC PCMCIA", 0xf8991729, 0x69dff0c7),
PCMCIA_DEVICE_NULL
};
MODULE_DEVICE_TABLE(pcmcia, com20020_ids);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/hostap/hostap_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ static struct pcmcia_device_id hostap_cs_ids[] = {
PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001),
PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001),
PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000),
/* PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), conflict with pcnet_cs */
PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
Expand Down
75 changes: 59 additions & 16 deletions drivers/pcmcia/at91_cf.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,10 @@ static struct pccard_operations at91_cf_ops = {

/*--------------------------------------------------------------------------*/

static int __init at91_cf_probe(struct device *dev)
static int __init at91_cf_probe(struct platform_device *pdev)
{
struct at91_cf_socket *cf;
struct at91_cf_data *board = dev->platform_data;
struct platform_device *pdev = to_platform_device(dev);
struct at91_cf_data *board = pdev->dev.platform_data;
struct resource *io;
unsigned int csa;
int status;
Expand All @@ -236,7 +235,7 @@ static int __init at91_cf_probe(struct device *dev)

cf->board = board;
cf->pdev = pdev;
dev_set_drvdata(dev, cf);
platform_set_drvdata(pdev, cf);

/* CF takes over CS4, CS5, CS6 */
csa = at91_sys_read(AT91_EBI_CSA);
Expand Down Expand Up @@ -271,6 +270,7 @@ static int __init at91_cf_probe(struct device *dev)
SA_SAMPLE_RANDOM, driver_name, cf);
if (status < 0)
goto fail0;
device_init_wakeup(&pdev->dev, 1);

/*
* The card driver will request this irq later as needed.
Expand Down Expand Up @@ -301,7 +301,7 @@ static int __init at91_cf_probe(struct device *dev)
board->det_pin, board->irq_pin);

cf->socket.owner = THIS_MODULE;
cf->socket.dev.dev = dev;
cf->socket.dev.dev = &pdev->dev;
cf->socket.ops = &at91_cf_ops;
cf->socket.resource_ops = &pccard_static_ops;
cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP
Expand All @@ -323,21 +323,25 @@ static int __init at91_cf_probe(struct device *dev)
free_irq(board->irq_pin, cf);
fail0a:
free_irq(board->det_pin, cf);
device_init_wakeup(&pdev->dev, 0);
fail0:
at91_sys_write(AT91_EBI_CSA, csa);
kfree(cf);
return status;
}

static int __exit at91_cf_remove(struct device *dev)
static int __exit at91_cf_remove(struct platform_device *pdev)
{
struct at91_cf_socket *cf = dev_get_drvdata(dev);
struct at91_cf_socket *cf = platform_get_drvdata(pdev);
struct at91_cf_data *board = cf->board;
struct resource *io = cf->socket.io[0].res;
unsigned int csa;

pcmcia_unregister_socket(&cf->socket);
free_irq(cf->board->irq_pin, cf);
free_irq(cf->board->det_pin, cf);
if (board->irq_pin)
free_irq(board->irq_pin, cf);
free_irq(board->det_pin, cf);
device_init_wakeup(&pdev->dev, 0);
iounmap((void __iomem *) cf->socket.io_offset);
release_mem_region(io->start, io->end + 1 - io->start);

Expand All @@ -348,26 +352,65 @@ static int __exit at91_cf_remove(struct device *dev)
return 0;
}

static struct device_driver at91_cf_driver = {
.name = (char *) driver_name,
.bus = &platform_bus_type,
#ifdef CONFIG_PM

static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
{
struct at91_cf_socket *cf = platform_get_drvdata(pdev);
struct at91_cf_data *board = cf->board;

pcmcia_socket_dev_suspend(&pdev->dev, mesg);
if (device_may_wakeup(&pdev->dev))
enable_irq_wake(board->det_pin);
else {
disable_irq_wake(board->det_pin);
disable_irq(board->det_pin);
}
if (board->irq_pin)
disable_irq(board->irq_pin);
return 0;
}

static int at91_cf_resume(struct platform_device *pdev)
{
struct at91_cf_socket *cf = platform_get_drvdata(pdev);
struct at91_cf_data *board = cf->board;

if (board->irq_pin)
enable_irq(board->irq_pin);
if (!device_may_wakeup(&pdev->dev))
enable_irq(board->det_pin);
pcmcia_socket_dev_resume(&pdev->dev);
return 0;
}

#else
#define at91_cf_suspend NULL
#define at91_cf_resume NULL
#endif

static struct platform_driver at91_cf_driver = {
.driver = {
.name = (char *) driver_name,
.owner = THIS_MODULE,
},
.probe = at91_cf_probe,
.remove = __exit_p(at91_cf_remove),
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
.suspend = at91_cf_suspend,
.resume = at91_cf_resume,
};

/*--------------------------------------------------------------------------*/

static int __init at91_cf_init(void)
{
return driver_register(&at91_cf_driver);
return platform_driver_register(&at91_cf_driver);
}
module_init(at91_cf_init);

static void __exit at91_cf_exit(void)
{
driver_unregister(&at91_cf_driver);
platform_driver_unregister(&at91_cf_driver);
}
module_exit(at91_cf_exit);

Expand Down
2 changes: 1 addition & 1 deletion drivers/pcmcia/au1000_db1x00.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ struct pcmcia_low_level db1x00_pcmcia_ops = {
.socket_suspend = db1x00_socket_suspend
};

int __init au1x_board_init(struct device *dev)
int au1x_board_init(struct device *dev)
{
int ret = -ENODEV;
bcsr->pcmcia = 0; /* turn off power, if it's not already off */
Expand Down
Loading

0 comments on commit 3930217

Please sign in to comment.