Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54833
b: refs/heads/master
c: d0d4f69
h: refs/heads/master
i:
  54831: 1a785a2
v: v3
  • Loading branch information
Bjorn Helgaas authored and Linus Torvalds committed May 8, 2007
1 parent b595f3f commit 2b94cec
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 916f11c760fc1c835d3fe10bebc97a02e2ac6b41
refs/heads/master: d0d4f69bb65a8c1c1430c577a583632709b874c6
11 changes: 11 additions & 0 deletions trunk/Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,17 @@ and is between 256 and 4096 characters. It is defined in the file
smp-alt-once [IA-32,SMP] On a hotplug CPU system, only
attempt to substitute SMP alternatives once at boot.

smsc-ircc2.nopnp [HW] Don't use PNP to discover SMC devices
smsc-ircc2.ircc_cfg= [HW] Device configuration I/O port
smsc-ircc2.ircc_sir= [HW] SIR base I/O port
smsc-ircc2.ircc_fir= [HW] FIR base I/O port
smsc-ircc2.ircc_irq= [HW] IRQ line
smsc-ircc2.ircc_dma= [HW] DMA channel
smsc-ircc2.ircc_transceiver= [HW] Transceiver type:
0: Toshiba Satellite 1800 (GP data pin select)
1: Fast pin select (default)
2: ATC IRMode

snd-ad1816a= [HW,ALSA]

snd-ad1848= [HW,ALSA]
Expand Down
98 changes: 75 additions & 23 deletions trunk/drivers/net/irda/smsc-ircc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ MODULE_AUTHOR("Daniele Peri <peri@csai.unipa.it>");
MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver");
MODULE_LICENSE("GPL");

static int smsc_nopnp;
module_param_named(nopnp, smsc_nopnp, bool, 0);
MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings");

#define DMA_INVAL 255
static int ircc_dma = DMA_INVAL;
module_param(ircc_dma, int, 0);
Expand Down Expand Up @@ -362,15 +366,42 @@ static inline void register_bank(int iobase, int bank)
iobase + IRCC_MASTER);
}

#ifdef CONFIG_PNP
/* PNP hotplug support */
static const struct pnp_device_id smsc_ircc_pnp_table[] = {
{ .id = "SMCf010", .driver_data = 0 },
/* and presumably others */
{ }
};
MODULE_DEVICE_TABLE(pnp, smsc_ircc_pnp_table);
#endif

static int pnp_driver_registered;

static int __init smsc_ircc_pnp_probe(struct pnp_dev *dev,
const struct pnp_device_id *dev_id)
{
unsigned int firbase, sirbase;
u8 dma, irq;

if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) &&
pnp_dma_valid(dev, 0) && pnp_irq_valid(dev, 0)))
return -EINVAL;

sirbase = pnp_port_start(dev, 0);
firbase = pnp_port_start(dev, 1);
dma = pnp_dma(dev, 0);
irq = pnp_irq(dev, 0);

if (smsc_ircc_open(firbase, sirbase, dma, irq))
return -ENODEV;

return 0;
}

static struct pnp_driver smsc_ircc_pnp_driver = {
.name = "smsc-ircc2",
.id_table = smsc_ircc_pnp_table,
.probe = smsc_ircc_pnp_probe,
};


/*******************************************************************************
Expand All @@ -381,6 +412,35 @@ MODULE_DEVICE_TABLE(pnp, smsc_ircc_pnp_table);
*
*******************************************************************************/

static int __init smsc_ircc_legacy_probe(void)
{
int ret = 0;

if (ircc_fir > 0 && ircc_sir > 0) {
IRDA_MESSAGE(" Overriding FIR address 0x%04x\n", ircc_fir);
IRDA_MESSAGE(" Overriding SIR address 0x%04x\n", ircc_sir);

if (smsc_ircc_open(ircc_fir, ircc_sir, ircc_dma, ircc_irq))
ret = -ENODEV;
} else {
ret = -ENODEV;

/* try user provided configuration register base address */
if (ircc_cfg > 0) {
IRDA_MESSAGE(" Overriding configuration address "
"0x%04x\n", ircc_cfg);
if (!smsc_superio_fdc(ircc_cfg))
ret = 0;
if (!smsc_superio_lpc(ircc_cfg))
ret = 0;
}

if (smsc_ircc_look_for_chips() > 0)
ret = 0;
}
return ret;
}

/*
* Function smsc_ircc_init ()
*
Expand Down Expand Up @@ -408,31 +468,20 @@ static int __init smsc_ircc_init(void)

dev_count = 0;

if (ircc_fir > 0 && ircc_sir > 0) {
IRDA_MESSAGE(" Overriding FIR address 0x%04x\n", ircc_fir);
IRDA_MESSAGE(" Overriding SIR address 0x%04x\n", ircc_sir);

if (smsc_ircc_open(ircc_fir, ircc_sir, ircc_dma, ircc_irq))
ret = -ENODEV;
if (smsc_nopnp || !pnp_platform_devices ||
ircc_cfg || ircc_fir || ircc_sir ||
ircc_dma != DMA_INVAL || ircc_irq != IRQ_INVAL) {
ret = smsc_ircc_legacy_probe();
} else {
ret = -ENODEV;

/* try user provided configuration register base address */
if (ircc_cfg > 0) {
IRDA_MESSAGE(" Overriding configuration address "
"0x%04x\n", ircc_cfg);
if (!smsc_superio_fdc(ircc_cfg))
ret = 0;
if (!smsc_superio_lpc(ircc_cfg))
ret = 0;
}

if (smsc_ircc_look_for_chips() > 0)
ret = 0;
if (pnp_register_driver(&smsc_ircc_pnp_driver) == 0)
pnp_driver_registered = 1;
}

if (ret)
if (ret) {
if (pnp_driver_registered)
pnp_unregister_driver(&smsc_ircc_pnp_driver);
platform_driver_unregister(&smsc_ircc_driver);
}

return ret;
}
Expand Down Expand Up @@ -1842,6 +1891,9 @@ static void __exit smsc_ircc_cleanup(void)
smsc_ircc_close(dev_self[i]);
}

if (pnp_driver_registered)
pnp_unregister_driver(&smsc_ircc_pnp_driver);

platform_driver_unregister(&smsc_ircc_driver);
}

Expand Down

0 comments on commit 2b94cec

Please sign in to comment.