diff options
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/pxa2xx_base.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_mainstone.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_sharpsl.c | 116 | ||||
-rw-r--r-- | drivers/pcmcia/sa1100_generic.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/sa1111_generic.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/sa11xx_base.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/topic.h | 17 | ||||
-rw-r--r-- | drivers/pcmcia/yenta_socket.c | 125 | ||||
-rw-r--r-- | drivers/pcmcia/yenta_socket.h | 8 |
9 files changed, 190 insertions, 86 deletions
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 3e23cd461fb..325c992f7d8 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c @@ -246,7 +246,7 @@ static void __exit pxa2xx_pcmcia_exit(void) driver_unregister(&pxa2xx_pcmcia_driver); } -module_init(pxa2xx_pcmcia_init); +fs_initcall(pxa2xx_pcmcia_init); module_exit(pxa2xx_pcmcia_exit); MODULE_AUTHOR("Stefan Eletzhofer <stefan.eletzhofer@inquant.de> and Ian Molton <spyro@f2s.com>"); diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c index 5309734e168..bbe69b07ce5 100644 --- a/drivers/pcmcia/pxa2xx_mainstone.c +++ b/drivers/pcmcia/pxa2xx_mainstone.c @@ -196,7 +196,7 @@ static void __exit mst_pcmcia_exit(void) platform_device_unregister(mst_pcmcia_device); } -module_init(mst_pcmcia_init); +fs_initcall(mst_pcmcia_init); module_exit(mst_pcmcia_exit); MODULE_LICENSE("GPL"); diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c index 42efe218867..a1178a600e3 100644 --- a/drivers/pcmcia/pxa2xx_sharpsl.c +++ b/drivers/pcmcia/pxa2xx_sharpsl.c @@ -20,27 +20,18 @@ #include <asm/hardware.h> #include <asm/irq.h> - #include <asm/hardware/scoop.h> -#include <asm/arch/corgi.h> #include <asm/arch/pxa-regs.h> #include "soc_common.h" #define NO_KEEP_VS 0x0001 -static unsigned char keep_vs; -static unsigned char keep_rd; - -static struct pcmcia_irqs irqs[] = { - { 0, CORGI_IRQ_GPIO_CF_CD, "PCMCIA0 CD"}, -}; - -static void sharpsl_pcmcia_init_reset(void) +static void sharpsl_pcmcia_init_reset(struct scoop_pcmcia_dev *scoopdev) { - reset_scoop(&corgiscoop_device.dev); - keep_vs = NO_KEEP_VS; - keep_rd = 0; + reset_scoop(scoopdev->dev); + scoopdev->keep_vs = NO_KEEP_VS; + scoopdev->keep_rd = 0; } static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt) @@ -71,29 +62,35 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt) pxa_gpio_mode(GPIO57_nIOIS16_MD); /* Register interrupts */ - ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); - - if (ret) { - printk(KERN_ERR "Request for Compact Flash IRQ failed\n"); - return ret; + if (scoop_devs[skt->nr].cd_irq >= 0) { + struct pcmcia_irqs cd_irq; + + cd_irq.sock = skt->nr; + cd_irq.irq = scoop_devs[skt->nr].cd_irq; + cd_irq.str = scoop_devs[skt->nr].cd_irq_str; + ret = soc_pcmcia_request_irqs(skt, &cd_irq, 1); + + if (ret) { + printk(KERN_ERR "Request for Compact Flash IRQ failed\n"); + return ret; + } } - /* Enable interrupt */ - write_scoop_reg(&corgiscoop_device.dev, SCOOP_IMR, 0x00C0); - write_scoop_reg(&corgiscoop_device.dev, SCOOP_MCR, 0x0101); - keep_vs = NO_KEEP_VS; - - skt->irq = CORGI_IRQ_GPIO_CF_IRQ; + skt->irq = scoop_devs[skt->nr].irq; return 0; } static void sharpsl_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) { - soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); + if (scoop_devs[skt->nr].cd_irq >= 0) { + struct pcmcia_irqs cd_irq; - /* CF_BUS_OFF */ - sharpsl_pcmcia_init_reset(); + cd_irq.sock = skt->nr; + cd_irq.irq = scoop_devs[skt->nr].cd_irq; + cd_irq.str = scoop_devs[skt->nr].cd_irq_str; + soc_pcmcia_free_irqs(skt, &cd_irq, 1); + } } @@ -101,31 +98,32 @@ static void sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) { unsigned short cpr, csr; + struct device *scoop = scoop_devs[skt->nr].dev; - cpr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_CPR); + cpr = read_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR); - write_scoop_reg(&corgiscoop_device.dev, SCOOP_IRM, 0x00FF); - write_scoop_reg(&corgiscoop_device.dev, SCOOP_ISR, 0x0000); - write_scoop_reg(&corgiscoop_device.dev, SCOOP_IRM, 0x0000); - csr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_CSR); + write_scoop_reg(scoop, SCOOP_IRM, 0x00FF); + write_scoop_reg(scoop, SCOOP_ISR, 0x0000); + write_scoop_reg(scoop, SCOOP_IRM, 0x0000); + csr = read_scoop_reg(scoop, SCOOP_CSR); if (csr & 0x0004) { /* card eject */ - write_scoop_reg(&corgiscoop_device.dev, SCOOP_CDR, 0x0000); - keep_vs = NO_KEEP_VS; + write_scoop_reg(scoop, SCOOP_CDR, 0x0000); + scoop_devs[skt->nr].keep_vs = NO_KEEP_VS; } - else if (!(keep_vs & NO_KEEP_VS)) { + else if (!(scoop_devs[skt->nr].keep_vs & NO_KEEP_VS)) { /* keep vs1,vs2 */ - write_scoop_reg(&corgiscoop_device.dev, SCOOP_CDR, 0x0000); - csr |= keep_vs; + write_scoop_reg(scoop, SCOOP_CDR, 0x0000); + csr |= scoop_devs[skt->nr].keep_vs; } else if (cpr & 0x0003) { /* power on */ - write_scoop_reg(&corgiscoop_device.dev, SCOOP_CDR, 0x0000); - keep_vs = (csr & 0x00C0); + write_scoop_reg(scoop, SCOOP_CDR, 0x0000); + scoop_devs[skt->nr].keep_vs = (csr & 0x00C0); } else { /* card detect */ - write_scoop_reg(&corgiscoop_device.dev, SCOOP_CDR, 0x0002); + write_scoop_reg(scoop, SCOOP_CDR, 0x0002); } state->detect = (csr & 0x0004) ? 0 : 1; @@ -147,6 +145,7 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) { unsigned long flags; + struct device *scoop = scoop_devs[skt->nr].dev; unsigned short cpr, ncpr, ccr, nccr, mcr, nmcr, imr, nimr; @@ -166,10 +165,10 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, local_irq_save(flags); - nmcr = (mcr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_MCR)) & ~0x0010; - ncpr = (cpr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_CPR)) & ~0x0083; - nccr = (ccr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_CCR)) & ~0x0080; - nimr = (imr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_IMR)) & ~0x003E; + nmcr = (mcr = read_scoop_reg(scoop, SCOOP_MCR)) & ~0x0010; + ncpr = (cpr = read_scoop_reg(scoop, SCOOP_CPR)) & ~0x0083; + nccr = (ccr = read_scoop_reg(scoop, SCOOP_CCR)) & ~0x0080; + nimr = (imr = read_scoop_reg(scoop, SCOOP_IMR)) & ~0x003E; ncpr |= (state->Vcc == 33) ? 0x0001 : (state->Vcc == 50) ? 0x0002 : 0; @@ -184,22 +183,22 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, ((skt->status&SS_WRPROT) ? 0x0008 : 0); if (!(ncpr & 0x0003)) { - keep_rd = 0; - } else if (!keep_rd) { + scoop_devs[skt->nr].keep_rd = 0; + } else if (!scoop_devs[skt->nr].keep_rd) { if (nccr & 0x0080) - keep_rd = 1; + scoop_devs[skt->nr].keep_rd = 1; else nccr |= 0x0080; } if (mcr != nmcr) - write_scoop_reg(&corgiscoop_device.dev, SCOOP_MCR, nmcr); + write_scoop_reg(scoop, SCOOP_MCR, nmcr); if (cpr != ncpr) - write_scoop_reg(&corgiscoop_device.dev, SCOOP_CPR, ncpr); + write_scoop_reg(scoop, SCOOP_CPR, ncpr); if (ccr != nccr) - write_scoop_reg(&corgiscoop_device.dev, SCOOP_CCR, nccr); + write_scoop_reg(scoop, SCOOP_CCR, nccr); if (imr != nimr) - write_scoop_reg(&corgiscoop_device.dev, SCOOP_IMR, nimr); + write_scoop_reg(scoop, SCOOP_IMR, nimr); local_irq_restore(flags); @@ -208,10 +207,18 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, static void sharpsl_pcmcia_socket_init(struct soc_pcmcia_socket *skt) { + sharpsl_pcmcia_init_reset(&scoop_devs[skt->nr]); + + /* Enable interrupt */ + write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_IMR, 0x00C0); + write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_MCR, 0x0101); + scoop_devs[skt->nr].keep_vs = NO_KEEP_VS; } static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) { + /* CF_BUS_OFF */ + sharpsl_pcmcia_init_reset(&scoop_devs[skt->nr]); } static struct pcmcia_low_level sharpsl_pcmcia_ops = { @@ -223,7 +230,7 @@ static struct pcmcia_low_level sharpsl_pcmcia_ops = { .socket_init = sharpsl_pcmcia_socket_init, .socket_suspend = sharpsl_pcmcia_socket_suspend, .first = 0, - .nr = 1, + .nr = 0, }; static struct platform_device *sharpsl_pcmcia_device; @@ -232,12 +239,15 @@ static int __init sharpsl_pcmcia_init(void) { int ret; + sharpsl_pcmcia_ops.nr=scoop_num; sharpsl_pcmcia_device = kmalloc(sizeof(*sharpsl_pcmcia_device), GFP_KERNEL); if (!sharpsl_pcmcia_device) return -ENOMEM; + memset(sharpsl_pcmcia_device, 0, sizeof(*sharpsl_pcmcia_device)); sharpsl_pcmcia_device->name = "pxa2xx-pcmcia"; sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops; + sharpsl_pcmcia_device->dev.parent=scoop_devs[0].dev; ret = platform_device_register(sharpsl_pcmcia_device); if (ret) @@ -257,7 +267,7 @@ static void __exit sharpsl_pcmcia_exit(void) platform_device_unregister(sharpsl_pcmcia_device); } -module_init(sharpsl_pcmcia_init); +fs_initcall(sharpsl_pcmcia_init); module_exit(sharpsl_pcmcia_exit); MODULE_DESCRIPTION("Sharp SL Series PCMCIA Support"); diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index e98bb3d80e7..d4ed508b38b 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c @@ -126,5 +126,5 @@ MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>"); MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11x0 Socket Controller"); MODULE_LICENSE("Dual MPL/GPL"); -module_init(sa11x0_pcmcia_init); +fs_initcall(sa11x0_pcmcia_init); module_exit(sa11x0_pcmcia_exit); diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c index b441f43a6a5..bb90a1448a5 100644 --- a/drivers/pcmcia/sa1111_generic.c +++ b/drivers/pcmcia/sa1111_generic.c @@ -189,7 +189,7 @@ static void __exit sa1111_drv_pcmcia_exit(void) sa1111_driver_unregister(&pcmcia_driver); } -module_init(sa1111_drv_pcmcia_init); +fs_initcall(sa1111_drv_pcmcia_init); module_exit(sa1111_drv_pcmcia_exit); MODULE_DESCRIPTION("SA1111 PCMCIA card socket driver"); diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c index db04ffb6f68..59c5d968e9f 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c @@ -189,7 +189,7 @@ static int __init sa11xx_pcmcia_init(void) { return 0; } -module_init(sa11xx_pcmcia_init); +fs_initcall(sa11xx_pcmcia_init); static void __exit sa11xx_pcmcia_exit(void) {} diff --git a/drivers/pcmcia/topic.h b/drivers/pcmcia/topic.h index be420bb2911..edccfa5bb40 100644 --- a/drivers/pcmcia/topic.h +++ b/drivers/pcmcia/topic.h @@ -101,6 +101,8 @@ #define TOPIC97_AVS_AUDIO_CONTROL 0x02 #define TOPIC97_AVS_VIDEO_CONTROL 0x01 +#define TOPIC_EXCA_IF_CONTROL 0x3e /* 8 bit */ +#define TOPIC_EXCA_IFC_33V_ENA 0x01 static void topic97_zoom_video(struct pcmcia_socket *sock, int onoff) { @@ -137,4 +139,19 @@ static int topic97_override(struct yenta_socket *socket) return 0; } + +static int topic95_override(struct yenta_socket *socket) +{ + u8 fctrl; + + /* enable 3.3V support for 16bit cards */ + fctrl = exca_readb(socket, TOPIC_EXCA_IF_CONTROL); + exca_writeb(socket, TOPIC_EXCA_IF_CONTROL, fctrl | TOPIC_EXCA_IFC_33V_ENA); + + /* tell yenta to use exca registers to power 16bit cards */ + socket->flags |= YENTA_16BIT_POWER_EXCA | YENTA_16BIT_POWER_DF; + + return 0; +} + #endif /* _LINUX_TOPIC_H */ diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 62fd705203f..0347a29f297 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c @@ -184,22 +184,52 @@ static int yenta_get_status(struct pcmcia_socket *sock, unsigned int *value) return 0; } -static int yenta_Vcc_power(u32 control) +static void yenta_get_power(struct yenta_socket *socket, socket_state_t *state) { - switch (control & CB_SC_VCC_MASK) { - case CB_SC_VCC_5V: return 50; - case CB_SC_VCC_3V: return 33; - default: return 0; - } -} + if (!(cb_readl(socket, CB_SOCKET_STATE) & CB_CBCARD) && + (socket->flags & YENTA_16BIT_POWER_EXCA)) { + u8 reg, vcc, vpp; + + reg = exca_readb(socket, I365_POWER); + vcc = reg & I365_VCC_MASK; + vpp = reg & I365_VPP1_MASK; + state->Vcc = state->Vpp = 0; + + if (socket->flags & YENTA_16BIT_POWER_DF) { + if (vcc == I365_VCC_3V) + state->Vcc = 33; + if (vcc == I365_VCC_5V) + state->Vcc = 50; + if (vpp == I365_VPP1_5V) + state->Vpp = state->Vcc; + if (vpp == I365_VPP1_12V) + state->Vpp = 120; + } else { + if (reg & I365_VCC_5V) { + state->Vcc = 50; + if (vpp == I365_VPP1_5V) + state->Vpp = 50; + if (vpp == I365_VPP1_12V) + state->Vpp = 120; + } + } + } else { + u32 control; -static int yenta_Vpp_power(u32 control) -{ - switch (control & CB_SC_VPP_MASK) { - case CB_SC_VPP_12V: return 120; - case CB_SC_VPP_5V: return 50; - case CB_SC_VPP_3V: return 33; - default: return 0; + control = cb_readl(socket, CB_SOCKET_CONTROL); + + switch (control & CB_SC_VCC_MASK) { + case CB_SC_VCC_5V: state->Vcc = 50; break; + case CB_SC_VCC_3V: state->Vcc = 33; break; + default: state->Vcc = 0; + } + + switch (control & CB_SC_VPP_MASK) { + case CB_SC_VPP_12V: state->Vpp = 120; break; + case CB_SC_VPP_5V: state->Vpp = 50; break; + case CB_SC_VPP_3V: state->Vpp = 33; break; + default: state->Vpp = 0; + } } } @@ -211,8 +241,7 @@ static int yenta_get_socket(struct pcmcia_socket *sock, socket_state_t *state) control = cb_readl(socket, CB_SOCKET_CONTROL); - state->Vcc = yenta_Vcc_power(control); - state->Vpp = yenta_Vpp_power(control); + yenta_get_power(socket, state); state->io_irq = socket->io_irq; if (cb_readl(socket, CB_SOCKET_STATE) & CB_CBCARD) { @@ -246,19 +275,54 @@ static int yenta_get_socket(struct pcmcia_socket *sock, socket_state_t *state) static void yenta_set_power(struct yenta_socket *socket, socket_state_t *state) { - u32 reg = 0; /* CB_SC_STPCLK? */ - switch (state->Vcc) { - case 33: reg = CB_SC_VCC_3V; break; - case 50: reg = CB_SC_VCC_5V; break; - default: reg = 0; break; - } - switch (state->Vpp) { - case 33: reg |= CB_SC_VPP_3V; break; - case 50: reg |= CB_SC_VPP_5V; break; - case 120: reg |= CB_SC_VPP_12V; break; + /* some birdges require to use the ExCA registers to power 16bit cards */ + if (!(cb_readl(socket, CB_SOCKET_STATE) & CB_CBCARD) && + (socket->flags & YENTA_16BIT_POWER_EXCA)) { + u8 reg, old; + reg = old = exca_readb(socket, I365_POWER); + reg &= ~(I365_VCC_MASK | I365_VPP1_MASK | I365_VPP2_MASK); + + /* i82365SL-DF style */ + if (socket->flags & YENTA_16BIT_POWER_DF) { + switch (state->Vcc) { + case 33: reg |= I365_VCC_3V; break; + case 50: reg |= I365_VCC_5V; break; + default: reg = 0; break; + } + switch (state->Vpp) { + case 33: + case 50: reg |= I365_VPP1_5V; break; + case 120: reg |= I365_VPP1_12V; break; + } + } else { + /* i82365SL-B style */ + switch (state->Vcc) { + case 50: reg |= I365_VCC_5V; break; + default: reg = 0; break; + } + switch (state->Vpp) { + case 50: reg |= I365_VPP1_5V | I365_VPP2_5V; break; + case 120: reg |= I365_VPP1_12V | I365_VPP2_12V; break; + } + } + + if (reg != old) + exca_writeb(socket, I365_POWER, reg); + } else { + u32 reg = 0; /* CB_SC_STPCLK? */ + switch (state->Vcc) { + case 33: reg = CB_SC_VCC_3V; break; + case 50: reg = CB_SC_VCC_5V; break; + default: reg = 0; break; + } + switch (state->Vpp) { + case 33: reg |= CB_SC_VPP_3V; break; + case 50: reg |= CB_SC_VPP_5V; break; + case 120: reg |= CB_SC_VPP_12V; break; + } + if (reg != cb_readl(socket, CB_SOCKET_CONTROL)) + cb_writel(socket, CB_SOCKET_CONTROL, reg); } - if (reg != cb_readl(socket, CB_SOCKET_CONTROL)) - cb_writel(socket, CB_SOCKET_CONTROL, reg); } static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state) @@ -751,6 +815,7 @@ enum { CARDBUS_TYPE_TI12XX, CARDBUS_TYPE_TI1250, CARDBUS_TYPE_RICOH, + CARDBUS_TYPE_TOPIC95, CARDBUS_TYPE_TOPIC97, CARDBUS_TYPE_O2MICRO, }; @@ -789,6 +854,9 @@ static struct cardbus_type cardbus_type[] = { .save_state = ricoh_save_state, .restore_state = ricoh_restore_state, }, + [CARDBUS_TYPE_TOPIC95] = { + .override = topic95_override, + }, [CARDBUS_TYPE_TOPIC97] = { .override = topic97_override, }, @@ -1196,6 +1264,7 @@ static struct pci_device_id yenta_table [] = { CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C476, RICOH), CB_ID(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_RL5C478, RICOH), + CB_ID(PCI_VENDOR_ID_TOSHIBA, PCI_DEVICE_ID_TOSHIBA_TOPIC95, TOPIC95), CB_ID(PCI_VENDOR_ID_TOSHIBA, PCI_DEVICE_ID_TOSHIBA_TOPIC97, TOPIC97), CB_ID(PCI_VENDOR_ID_TOSHIBA, PCI_DEVICE_ID_TOSHIBA_TOPIC100, TOPIC97), diff --git a/drivers/pcmcia/yenta_socket.h b/drivers/pcmcia/yenta_socket.h index 4e637eef207..4e75e9e258c 100644 --- a/drivers/pcmcia/yenta_socket.h +++ b/drivers/pcmcia/yenta_socket.h @@ -95,6 +95,12 @@ */ #define CB_MEM_PAGE(map) (0x40 + (map)) + +/* control how 16bit cards are powered */ +#define YENTA_16BIT_POWER_EXCA 0x00000001 +#define YENTA_16BIT_POWER_DF 0x00000002 + + struct yenta_socket; struct cardbus_type { @@ -113,6 +119,8 @@ struct yenta_socket { struct pcmcia_socket socket; struct cardbus_type *type; + u32 flags; + /* for PCI interrupt probing */ unsigned int probe_status; |