1 From b17597be763621ba63534fda6e1ea0a802be2087 Mon Sep 17 00:00:00 2001
2 From: Maxime Bizon <mbizon@freebox.fr>
3 Date: Fri, 18 Jul 2008 21:18:51 +0200
4 Subject: [PATCH] [MIPS] BCM63XX: Add PCMCIA & Cardbus support.
6 Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
8 arch/mips/bcm63xx/Makefile | 1 +
9 arch/mips/bcm63xx/dev-pcmcia.c | 135 +++++
10 drivers/pcmcia/Kconfig | 4 +
11 drivers/pcmcia/Makefile | 1 +
12 drivers/pcmcia/bcm63xx_pcmcia.c | 521 ++++++++++++++++++++
13 drivers/pcmcia/bcm63xx_pcmcia.h | 65 +++
14 include/asm-mips/mach-bcm63xx/bcm63xx_dev_pcmcia.h | 13 +
15 7 files changed, 740 insertions(+), 0 deletions(-)
16 create mode 100644 arch/mips/bcm63xx/dev-pcmcia.c
17 create mode 100644 drivers/pcmcia/bcm63xx_pcmcia.c
18 create mode 100644 drivers/pcmcia/bcm63xx_pcmcia.h
19 create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_dev_pcmcia.h
21 --- a/arch/mips/bcm63xx/Makefile
22 +++ b/arch/mips/bcm63xx/Makefile
24 obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o
26 +obj-y += dev-pcmcia.o
27 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
29 +++ b/arch/mips/bcm63xx/dev-pcmcia.c
32 + * This file is subject to the terms and conditions of the GNU General Public
33 + * License. See the file "COPYING" in the main directory of this archive
36 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
39 +#include <linux/init.h>
40 +#include <linux/kernel.h>
41 +#include <asm/bootinfo.h>
42 +#include <linux/platform_device.h>
43 +#include <bcm63xx_cs.h>
44 +#include <bcm63xx_cpu.h>
45 +#include <bcm63xx_dev_pcmcia.h>
46 +#include <bcm63xx_io.h>
47 +#include <bcm63xx_regs.h>
49 +static struct resource pcmcia_resources[] = {
50 + /* pcmcia registers */
52 + .start = -1, /* filled at runtime */
53 + .end = -1, /* filled at runtime */
54 + .flags = IORESOURCE_MEM,
57 + /* pcmcia memory zone resources */
59 + .start = BCM_PCMCIA_COMMON_BASE_PA,
60 + .end = BCM_PCMCIA_COMMON_END_PA,
61 + .flags = IORESOURCE_MEM,
64 + .start = BCM_PCMCIA_ATTR_BASE_PA,
65 + .end = BCM_PCMCIA_ATTR_END_PA,
66 + .flags = IORESOURCE_MEM,
69 + .start = BCM_PCMCIA_IO_BASE_PA,
70 + .end = BCM_PCMCIA_IO_END_PA,
71 + .flags = IORESOURCE_MEM,
76 + .start = -1, /* filled at runtime */
77 + .flags = IORESOURCE_IRQ,
80 + /* declare PCMCIA IO resource also */
82 + .start = BCM_PCMCIA_IO_BASE_PA,
83 + .end = BCM_PCMCIA_IO_END_PA,
84 + .flags = IORESOURCE_IO,
88 +static struct bcm63xx_pcmcia_platform_data pd;
90 +static struct platform_device bcm63xx_pcmcia_device = {
91 + .name = "bcm63xx_pcmcia",
93 + .num_resources = ARRAY_SIZE(pcmcia_resources),
94 + .resource = pcmcia_resources,
96 + .platform_data = &pd,
100 +static int __init config_pcmcia_cs(unsigned int cs,
101 + u32 base, unsigned int size)
105 + ret = bcm63xx_set_cs_status(cs, 0);
107 + ret = bcm63xx_set_cs_base(cs, base, size);
109 + ret = bcm63xx_set_cs_status(cs, 1);
113 +static const __initdata unsigned int pcmcia_cs[3][3] = {
114 + /* cs, base address, size */
115 + { MPI_CS_PCMCIA_COMMON, BCM_PCMCIA_COMMON_BASE_PA,
116 + BCM_PCMCIA_COMMON_SIZE },
118 + { MPI_CS_PCMCIA_ATTR, BCM_PCMCIA_ATTR_BASE_PA,
119 + BCM_PCMCIA_ATTR_SIZE },
121 + { MPI_CS_PCMCIA_IO, BCM_PCMCIA_IO_BASE_PA,
122 + BCM_PCMCIA_IO_SIZE },
125 +int __init bcm63xx_pcmcia_register(void)
129 + if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358())
132 + /* use correct pcmcia ready gpio depending on processor */
133 + switch (bcm63xx_get_cpu_id()) {
134 + case BCM6348_CPU_ID:
135 + pd.ready_gpio = 22;
138 + case BCM6358_CPU_ID:
139 + pd.ready_gpio = 22;
146 + pcmcia_resources[0].start = bcm63xx_regset_address(RSET_PCMCIA);
147 + pcmcia_resources[0].end = pcmcia_resources[0].start;
148 + pcmcia_resources[0].end += RSET_PCMCIA_SIZE - 1;
149 + pcmcia_resources[4].start = bcm63xx_get_irq_number(IRQ_PCMCIA);
151 + /* configure pcmcia chip selects */
152 + for (i = 0; i < 3; i++) {
153 + ret = config_pcmcia_cs(pcmcia_cs[i][0],
160 + return platform_device_register(&bcm63xx_pcmcia_device);
163 + printk(KERN_ERR "unable to set pcmcia chip select");
166 --- a/drivers/pcmcia/Kconfig
167 +++ b/drivers/pcmcia/Kconfig
168 @@ -196,6 +196,10 @@ config PCMCIA_AU1X00
169 tristate "Au1x00 pcmcia support"
170 depends on SOC_AU1X00 && PCMCIA
172 +config PCMCIA_BCM63XX
173 + tristate "bcm63xx pcmcia support"
174 + depends on BCM63XX && PCMCIA
177 tristate "SA1100 support"
178 depends on ARM && ARCH_SA1100 && PCMCIA
179 --- a/drivers/pcmcia/Makefile
180 +++ b/drivers/pcmcia/Makefile
181 @@ -33,6 +33,7 @@ obj-$(CONFIG_PCMCIA_PXA2XX)
182 obj-$(CONFIG_M32R_PCC) += m32r_pcc.o
183 obj-$(CONFIG_M32R_CFC) += m32r_cfc.o
184 obj-$(CONFIG_PCMCIA_AU1X00) += au1x00_ss.o
185 +obj-$(CONFIG_PCMCIA_BCM63XX) += bcm63xx_pcmcia.o
186 obj-$(CONFIG_PCMCIA_VRC4171) += vrc4171_card.o
187 obj-$(CONFIG_PCMCIA_VRC4173) += vrc4173_cardu.o
188 obj-$(CONFIG_OMAP_CF) += omap_cf.o
190 +++ b/drivers/pcmcia/bcm63xx_pcmcia.c
193 + * This file is subject to the terms and conditions of the GNU General Public
194 + * License. See the file "COPYING" in the main directory of this archive
195 + * for more details.
197 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
200 +#include <linux/kernel.h>
201 +#include <linux/module.h>
202 +#include <linux/ioport.h>
203 +#include <linux/timer.h>
204 +#include <linux/platform_device.h>
205 +#include <linux/delay.h>
206 +#include <linux/pci.h>
207 +#include <linux/gpio.h>
209 +#include <bcm63xx_regs.h>
210 +#include <bcm63xx_io.h>
211 +#include "bcm63xx_pcmcia.h"
213 +#define PFX "bcm63xx_pcmcia: "
215 +#ifdef CONFIG_CARDBUS
216 +/* if cardbus is used, platform device needs reference to actual pci
218 +static struct pci_dev *bcm63xx_cb_dev;
222 + * read/write helper for pcmcia regs
224 +static inline u32 pcmcia_readl(struct bcm63xx_pcmcia_socket *skt, u32 off)
226 + return bcm_readl(skt->base + off);
229 +static inline void pcmcia_writel(struct bcm63xx_pcmcia_socket *skt,
232 + bcm_writel(val, skt->base + off);
236 + * (Re-)Initialise the socket, turning on status interrupts and PCMCIA
237 + * bus. This must wait for power to stabilise so that the card status
238 + * signals report correctly.
240 +static int bcm63xx_pcmcia_sock_init(struct pcmcia_socket *sock)
242 + struct bcm63xx_pcmcia_socket *skt;
243 + skt = sock->driver_data;
248 + * Remove power on the socket, disable IRQs from the card.
249 + * Turn off status interrupts, and disable the PCMCIA bus.
251 +static int bcm63xx_pcmcia_suspend(struct pcmcia_socket *sock)
253 + struct bcm63xx_pcmcia_socket *skt;
254 + skt = sock->driver_data;
259 + * Implements the set_socket() operation for the in-kernel PCMCIA
260 + * service (formerly SS_SetSocket in Card Services). We more or
261 + * less punt all of this work and let the kernel handle the details
262 + * of power configuration, reset, &c. We also record the value of
263 + * `state' in order to regurgitate it to the PCMCIA core later.
265 +static int bcm63xx_pcmcia_set_socket(struct pcmcia_socket *sock,
266 + socket_state_t *state)
268 + struct bcm63xx_pcmcia_socket *skt;
269 + unsigned long flags;
272 + skt = sock->driver_data;
274 + spin_lock_irqsave(&skt->lock, flags);
276 + /* apply requested socket power */
277 + /* FIXME: hardware can't do this */
279 + /* apply socket reset */
280 + val = pcmcia_readl(skt, PCMCIA_C1_REG);
281 + if (state->flags & SS_RESET)
282 + val |= PCMCIA_C1_RESET_MASK;
284 + val &= ~PCMCIA_C1_RESET_MASK;
286 + /* reverse reset logic for cardbus card */
287 + if (skt->card_detected && (skt->card_type & CARD_CARDBUS))
288 + val ^= PCMCIA_C1_RESET_MASK;
290 + pcmcia_writel(skt, val, PCMCIA_C1_REG);
292 + /* keep requested state for event reporting */
293 + skt->requested_state = *state;
295 + spin_unlock_irqrestore(&skt->lock, flags);
301 + * identity cardtype from VS[12] input, CD[12] input while only VS2 is
302 + * floating, and CD[12] input while only VS1 is floating
307 + IN_CD1_VS2H = (1 << 2),
308 + IN_CD2_VS2H = (1 << 3),
309 + IN_CD1_VS1H = (1 << 4),
310 + IN_CD2_VS1H = (1 << 5),
313 +static const u8 vscd_to_cardtype[] = {
315 + /* VS1 float, VS2 float */
316 + [IN_VS1 | IN_VS2] = (CARD_PCCARD | CARD_5V),
318 + /* VS1 grounded, VS2 float */
319 + [IN_VS2] = (CARD_PCCARD | CARD_5V | CARD_3V),
321 + /* VS1 grounded, VS2 grounded */
322 + [0] = (CARD_PCCARD | CARD_5V | CARD_3V | CARD_XV),
324 + /* VS1 tied to CD1, VS2 float */
325 + [IN_VS1 | IN_VS2 | IN_CD1_VS1H] = (CARD_CARDBUS | CARD_3V),
327 + /* VS1 grounded, VS2 tied to CD2 */
328 + [IN_VS2 | IN_CD2_VS2H] = (CARD_CARDBUS | CARD_3V | CARD_XV),
330 + /* VS1 tied to CD2, VS2 grounded */
331 + [IN_VS1 | IN_CD2_VS1H] = (CARD_CARDBUS | CARD_3V | CARD_XV | CARD_YV),
333 + /* VS1 float, VS2 grounded */
334 + [IN_VS1] = (CARD_PCCARD | CARD_XV),
336 + /* VS1 float, VS2 tied to CD2 */
337 + [IN_VS1 | IN_VS2 | IN_CD2_VS2H] = (CARD_CARDBUS | CARD_3V),
339 + /* VS1 float, VS2 tied to CD1 */
340 + [IN_VS1 | IN_VS2 | IN_CD1_VS2H] = (CARD_CARDBUS | CARD_XV | CARD_YV),
342 + /* VS1 tied to CD2, VS2 float */
343 + [IN_VS1 | IN_VS2 | IN_CD2_VS1H] = (CARD_CARDBUS | CARD_YV),
345 + /* VS2 grounded, VS1 is tied to CD1, CD2 is grounded */
346 + [IN_VS1 | IN_CD1_VS1H] = 0, /* ignore cardbay */
350 + * poll hardware to check card insertion status
352 +static unsigned int __get_socket_status(struct bcm63xx_pcmcia_socket *skt)
359 + /* check CD for card presence */
360 + val = pcmcia_readl(skt, PCMCIA_C1_REG);
362 + if (!(val & PCMCIA_C1_CD1_MASK) && !(val & PCMCIA_C1_CD2_MASK))
365 + /* if new insertion, detect cardtype */
366 + if ((stat & SS_DETECT) && !skt->card_detected) {
367 + unsigned int stat = 0;
369 + /* float VS1, float VS2 */
370 + val |= PCMCIA_C1_VS1OE_MASK;
371 + val |= PCMCIA_C1_VS2OE_MASK;
372 + pcmcia_writel(skt, val, PCMCIA_C1_REG);
374 + /* wait for output to stabilize and read VS[12] */
376 + val = pcmcia_readl(skt, PCMCIA_C1_REG);
377 + stat |= (val & PCMCIA_C1_VS1_MASK) ? IN_VS1 : 0;
378 + stat |= (val & PCMCIA_C1_VS2_MASK) ? IN_VS2 : 0;
380 + /* drive VS1 low, float VS2 */
381 + val &= ~PCMCIA_C1_VS1OE_MASK;
382 + val |= PCMCIA_C1_VS2OE_MASK;
383 + pcmcia_writel(skt, val, PCMCIA_C1_REG);
385 + /* wait for output to stabilize and read CD[12] */
387 + val = pcmcia_readl(skt, PCMCIA_C1_REG);
388 + stat |= (val & PCMCIA_C1_CD1_MASK) ? IN_CD1_VS2H : 0;
389 + stat |= (val & PCMCIA_C1_CD2_MASK) ? IN_CD2_VS2H : 0;
391 + /* float VS1, drive VS2 low */
392 + val |= PCMCIA_C1_VS1OE_MASK;
393 + val &= ~PCMCIA_C1_VS2OE_MASK;
394 + pcmcia_writel(skt, val, PCMCIA_C1_REG);
396 + /* wait for output to stabilize and read CD[12] */
398 + val = pcmcia_readl(skt, PCMCIA_C1_REG);
399 + stat |= (val & PCMCIA_C1_CD1_MASK) ? IN_CD1_VS1H : 0;
400 + stat |= (val & PCMCIA_C1_CD2_MASK) ? IN_CD2_VS1H : 0;
402 + /* guess cardtype from all this */
403 + skt->card_type = vscd_to_cardtype[stat];
404 + if (!skt->card_type)
405 + printk(KERN_ERR PFX "unsupported card type\n");
407 + /* drive both VS pin to 0 again */
408 + val &= ~(PCMCIA_C1_VS1OE_MASK | PCMCIA_C1_VS2OE_MASK);
410 + /* enable correct logic */
411 + val &= ~(PCMCIA_C1_EN_PCMCIA_MASK | PCMCIA_C1_EN_CARDBUS_MASK);
412 + if (skt->card_type & CARD_PCCARD)
413 + val |= PCMCIA_C1_EN_PCMCIA_MASK;
415 + val |= PCMCIA_C1_EN_CARDBUS_MASK;
417 + pcmcia_writel(skt, val, PCMCIA_C1_REG);
419 + skt->card_detected = (stat & SS_DETECT) ? 1 : 0;
421 + /* report card type/voltage */
422 + if (skt->card_type & CARD_CARDBUS)
423 + stat |= SS_CARDBUS;
424 + if (skt->card_type & CARD_3V)
426 + if (skt->card_type & CARD_XV)
428 + stat |= SS_POWERON;
430 + if (gpio_get_value(skt->pd->ready_gpio))
437 + * core request to get current socket status
439 +static int bcm63xx_pcmcia_get_status(struct pcmcia_socket *sock,
440 + unsigned int *status)
442 + struct bcm63xx_pcmcia_socket *skt;
444 + skt = sock->driver_data;
446 + spin_lock_bh(&skt->lock);
447 + *status = __get_socket_status(skt);
448 + spin_unlock_bh(&skt->lock);
454 + * socket polling timer callback
456 +static void bcm63xx_pcmcia_poll(unsigned long data)
458 + struct bcm63xx_pcmcia_socket *skt;
459 + unsigned int stat, events;
461 + skt = (struct bcm63xx_pcmcia_socket *)data;
463 + spin_lock_bh(&skt->lock);
465 + stat = __get_socket_status(skt);
467 + /* keep only changed bits, and mask with required one from the
469 + events = (stat ^ skt->old_status) & skt->requested_state.csc_mask;
470 + skt->old_status = stat;
471 + spin_unlock_bh(&skt->lock);
474 + pcmcia_parse_events(&skt->socket, events);
476 + mod_timer(&skt->timer,
477 + jiffies + msecs_to_jiffies(BCM63XX_PCMCIA_POLL_RATE));
480 +static int bcm63xx_pcmcia_set_io_map(struct pcmcia_socket *sock,
481 + struct pccard_io_map *map)
483 + /* this doesn't seem to be called by pcmcia layer if static
484 + * mapping is used */
488 +static int bcm63xx_pcmcia_set_mem_map(struct pcmcia_socket *sock,
489 + struct pccard_mem_map *map)
491 + struct bcm63xx_pcmcia_socket *skt;
492 + struct resource *res;
494 + skt = sock->driver_data;
495 + if (map->flags & MAP_ATTRIB)
496 + res = skt->attr_res;
498 + res = skt->common_res;
500 + map->static_start = res->start + map->card_start;
504 +static struct pccard_operations bcm63xx_pcmcia_operations = {
505 + .init = bcm63xx_pcmcia_sock_init,
506 + .suspend = bcm63xx_pcmcia_suspend,
507 + .get_status = bcm63xx_pcmcia_get_status,
508 + .set_socket = bcm63xx_pcmcia_set_socket,
509 + .set_io_map = bcm63xx_pcmcia_set_io_map,
510 + .set_mem_map = bcm63xx_pcmcia_set_mem_map,
514 + * register pcmcia socket to core
516 +static int bcm63xx_drv_pcmcia_probe(struct platform_device *pdev)
518 + struct bcm63xx_pcmcia_socket *skt;
519 + struct pcmcia_socket *sock;
520 + struct resource *res, *irq_res;
521 + unsigned int regmem_size = 0, iomem_size = 0;
525 + skt = kzalloc(sizeof(*skt), GFP_KERNEL);
528 + spin_lock_init(&skt->lock);
529 + sock = &skt->socket;
530 + sock->driver_data = skt;
532 + /* make sure we have all resources we need */
533 + skt->common_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
534 + skt->attr_res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
535 + irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
536 + skt->pd = pdev->dev.platform_data;
537 + if (!skt->common_res || !skt->attr_res || !irq_res || !skt->pd) {
542 + /* remap pcmcia registers */
543 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
544 + regmem_size = res->end - res->start + 1;
545 + if (!request_mem_region(res->start, regmem_size, "bcm63xx_pcmcia")) {
549 + skt->reg_res = res;
551 + skt->base = ioremap(res->start, regmem_size);
557 + /* remap io registers */
558 + res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
559 + iomem_size = res->end - res->start + 1;
560 + skt->io_base = ioremap(res->start, iomem_size);
561 + if (!skt->io_base) {
566 + /* resources are static */
567 + sock->resource_ops = &pccard_static_ops;
568 + sock->ops = &bcm63xx_pcmcia_operations;
569 + sock->owner = THIS_MODULE;
570 + sock->dev.parent = &pdev->dev;
571 + sock->features = SS_CAP_STATIC_MAP | SS_CAP_PCCARD;
572 + sock->io_offset = (unsigned long)skt->io_base;
573 + sock->pci_irq = irq_res->start;
575 +#ifdef CONFIG_CARDBUS
576 + sock->cb_dev = bcm63xx_cb_dev;
577 + if (bcm63xx_cb_dev)
578 + sock->features |= SS_CAP_CARDBUS;
581 + /* assume common & attribute memory have the same size */
582 + sock->map_size = skt->common_res->end - skt->common_res->start + 1;
584 + /* initialize polling timer */
585 + setup_timer(&skt->timer, bcm63xx_pcmcia_poll, (unsigned long)skt);
587 + /* initialize pcmcia control register, drive VS[12] to 0,
588 + * leave CB IDSEL to the old value since it is set by the PCI
590 + val = pcmcia_readl(skt, PCMCIA_C1_REG);
591 + val &= PCMCIA_C1_CBIDSEL_MASK;
592 + val |= PCMCIA_C1_EN_PCMCIA_GPIO_MASK;
593 + pcmcia_writel(skt, val, PCMCIA_C1_REG);
595 + /* FIXME set correct pcmcia timings */
596 + val = PCMCIA_C2_DATA16_MASK;
597 + val |= 10 << PCMCIA_C2_RWCOUNT_SHIFT;
598 + val |= 6 << PCMCIA_C2_INACTIVE_SHIFT;
599 + val |= 3 << PCMCIA_C2_SETUP_SHIFT;
600 + val |= 3 << PCMCIA_C2_HOLD_SHIFT;
601 + pcmcia_writel(skt, val, PCMCIA_C2_REG);
603 + ret = pcmcia_register_socket(sock);
607 + /* start polling socket */
608 + mod_timer(&skt->timer,
609 + jiffies + msecs_to_jiffies(BCM63XX_PCMCIA_POLL_RATE));
611 + platform_set_drvdata(pdev, skt);
616 + iounmap(skt->io_base);
618 + iounmap(skt->base);
620 + release_mem_region(skt->reg_res->start, regmem_size);
625 +static int bcm63xx_drv_pcmcia_remove(struct platform_device *pdev)
627 + struct bcm63xx_pcmcia_socket *skt;
628 + struct resource *res;
630 + skt = platform_get_drvdata(pdev);
631 + del_timer_sync(&skt->timer);
632 + iounmap(skt->base);
633 + iounmap(skt->io_base);
634 + res = skt->reg_res;
635 + release_mem_region(res->start, res->end - res->start + 1);
640 +struct platform_driver bcm63xx_pcmcia_driver = {
641 + .probe = bcm63xx_drv_pcmcia_probe,
642 + .remove = __devexit_p(bcm63xx_drv_pcmcia_remove),
644 + .name = "bcm63xx_pcmcia",
645 + .owner = THIS_MODULE,
649 +#ifdef CONFIG_CARDBUS
650 +static int __devinit bcm63xx_cb_probe(struct pci_dev *dev,
651 + const struct pci_device_id *id)
653 + /* keep pci device */
654 + bcm63xx_cb_dev = dev;
655 + return platform_driver_register(&bcm63xx_pcmcia_driver);
658 +static void __devexit bcm63xx_cb_exit(struct pci_dev *dev)
660 + platform_driver_unregister(&bcm63xx_pcmcia_driver);
661 + bcm63xx_cb_dev = NULL;
664 +static struct pci_device_id bcm63xx_cb_table[] = {
666 + .vendor = PCI_VENDOR_ID_BROADCOM,
667 + .device = PCI_ANY_ID,
668 + .subvendor = PCI_VENDOR_ID_BROADCOM,
669 + .subdevice = PCI_ANY_ID,
670 + .class = PCI_CLASS_BRIDGE_CARDBUS << 8,
676 +MODULE_DEVICE_TABLE(pci, bcm63xx_cb_table);
678 +static struct pci_driver bcm63xx_cardbus_driver = {
679 + .name = "yenta_cardbus",
680 + .id_table = bcm63xx_cb_table,
681 + .probe = bcm63xx_cb_probe,
682 + .remove = __devexit_p(bcm63xx_cb_exit),
687 + * if cardbus support is enabled, register our platform device after
688 + * our fake cardbus bridge has been registered
690 +static int __init bcm63xx_pcmcia_init(void)
692 +#ifdef CONFIG_CARDBUS
693 + return pci_register_driver(&bcm63xx_cardbus_driver);
695 + return platform_driver_register(&bcm63xx_pcmcia_driver);
699 +static void __exit bcm63xx_pcmcia_exit(void)
701 +#ifdef CONFIG_CARDBUS
702 + return pci_unregister_driver(&bcm63xx_cardbus_driver);
704 + platform_driver_unregister(&bcm63xx_pcmcia_driver);
708 +module_init(bcm63xx_pcmcia_init);
709 +module_exit(bcm63xx_pcmcia_exit);
711 +MODULE_LICENSE("GPL");
712 +MODULE_AUTHOR("Maxime Bizon <mbizon@freebox.fr>");
713 +MODULE_DESCRIPTION("Linux PCMCIA Card Services: bcm63xx Socket Controller");
715 +++ b/drivers/pcmcia/bcm63xx_pcmcia.h
717 +#ifndef BCM63XX_PCMCIA_H_
718 +#define BCM63XX_PCMCIA_H_
720 +#include <linux/types.h>
721 +#include <linux/timer.h>
722 +#include <pcmcia/ss.h>
723 +#include <bcm63xx_dev_pcmcia.h>
725 +/* socket polling rate in ms */
726 +#define BCM63XX_PCMCIA_POLL_RATE 500
729 + CARD_CARDBUS = (1 << 0),
731 + CARD_PCCARD = (1 << 1),
733 + CARD_5V = (1 << 2),
735 + CARD_3V = (1 << 3),
737 + CARD_XV = (1 << 4),
739 + CARD_YV = (1 << 5),
742 +struct bcm63xx_pcmcia_socket {
743 + struct pcmcia_socket socket;
745 + /* platform specific data */
746 + struct bcm63xx_pcmcia_platform_data *pd;
748 + /* all regs access are protected by this spinlock */
751 + /* pcmcia registers resource */
752 + struct resource *reg_res;
754 + /* base remapped address of registers */
755 + void __iomem *base;
757 + /* whether a card is detected at the moment */
760 + /* type of detected card (mask of above enum) */
763 + /* keep last socket status to implement event reporting */
764 + unsigned int old_status;
766 + /* backup of requested socket state */
767 + socket_state_t requested_state;
769 + /* timer used for socket status polling */
770 + struct timer_list timer;
772 + /* attribute/common memory resources */
773 + struct resource *attr_res;
774 + struct resource *common_res;
775 + struct resource *io_res;
777 + /* base address of io memory */
778 + void __iomem *io_base;
781 +#endif /* BCM63XX_PCMCIA_H_ */
783 +++ b/include/asm-mips/mach-bcm63xx/bcm63xx_dev_pcmcia.h
785 +#ifndef BCM63XX_DEV_PCMCIA_H_
786 +#define BCM63XX_DEV_PCMCIA_H_
789 + * PCMCIA driver platform data
791 +struct bcm63xx_pcmcia_platform_data {
792 + unsigned int ready_gpio;
795 +int bcm63xx_pcmcia_register(void);
797 +#endif /* BCM63XX_DEV_PCMCIA_H_ */