diff options
Diffstat (limited to 'drivers/ssb/pcmcia.c')
-rw-r--r-- | drivers/ssb/pcmcia.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index cd49f7c65531..d674cef7210d 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c | |||
@@ -28,11 +28,6 @@ | |||
28 | 28 | ||
29 | 29 | ||
30 | /* PCMCIA configuration registers */ | 30 | /* PCMCIA configuration registers */ |
31 | #define SSB_PCMCIA_CORECTL 0x00 | ||
32 | #define SSB_PCMCIA_CORECTL_RESET 0x80 /* Core reset */ | ||
33 | #define SSB_PCMCIA_CORECTL_IRQEN 0x04 /* IRQ enable */ | ||
34 | #define SSB_PCMCIA_CORECTL_FUNCEN 0x01 /* Function enable */ | ||
35 | #define SSB_PCMCIA_CORECTL2 0x80 | ||
36 | #define SSB_PCMCIA_ADDRESS0 0x2E | 31 | #define SSB_PCMCIA_ADDRESS0 0x2E |
37 | #define SSB_PCMCIA_ADDRESS1 0x30 | 32 | #define SSB_PCMCIA_ADDRESS1 0x30 |
38 | #define SSB_PCMCIA_ADDRESS2 0x32 | 33 | #define SSB_PCMCIA_ADDRESS2 0x32 |
@@ -671,6 +666,24 @@ static DEVICE_ATTR(ssb_sprom, 0600, | |||
671 | ssb_pcmcia_attr_sprom_show, | 666 | ssb_pcmcia_attr_sprom_show, |
672 | ssb_pcmcia_attr_sprom_store); | 667 | ssb_pcmcia_attr_sprom_store); |
673 | 668 | ||
669 | static int ssb_pcmcia_cor_setup(struct ssb_bus *bus, u8 cor) | ||
670 | { | ||
671 | u8 val; | ||
672 | int err; | ||
673 | |||
674 | err = ssb_pcmcia_cfg_read(bus, cor, &val); | ||
675 | if (err) | ||
676 | return err; | ||
677 | val &= ~COR_SOFT_RESET; | ||
678 | val |= COR_FUNC_ENA | COR_IREQ_ENA | COR_LEVEL_REQ; | ||
679 | err = ssb_pcmcia_cfg_write(bus, cor, val); | ||
680 | if (err) | ||
681 | return err; | ||
682 | msleep(40); | ||
683 | |||
684 | return 0; | ||
685 | } | ||
686 | |||
674 | void ssb_pcmcia_exit(struct ssb_bus *bus) | 687 | void ssb_pcmcia_exit(struct ssb_bus *bus) |
675 | { | 688 | { |
676 | if (bus->bustype != SSB_BUSTYPE_PCMCIA) | 689 | if (bus->bustype != SSB_BUSTYPE_PCMCIA) |
@@ -681,7 +694,6 @@ void ssb_pcmcia_exit(struct ssb_bus *bus) | |||
681 | 694 | ||
682 | int ssb_pcmcia_init(struct ssb_bus *bus) | 695 | int ssb_pcmcia_init(struct ssb_bus *bus) |
683 | { | 696 | { |
684 | u8 val, offset; | ||
685 | int err; | 697 | int err; |
686 | 698 | ||
687 | if (bus->bustype != SSB_BUSTYPE_PCMCIA) | 699 | if (bus->bustype != SSB_BUSTYPE_PCMCIA) |
@@ -691,16 +703,12 @@ int ssb_pcmcia_init(struct ssb_bus *bus) | |||
691 | * bus->mapped_pcmcia_seg with hardware state. */ | 703 | * bus->mapped_pcmcia_seg with hardware state. */ |
692 | ssb_pcmcia_switch_segment(bus, 0); | 704 | ssb_pcmcia_switch_segment(bus, 0); |
693 | 705 | ||
694 | /* Init IRQ routing */ | 706 | /* Init the COR register. */ |
695 | if (bus->chip_id == 0x4306) | 707 | err = ssb_pcmcia_cor_setup(bus, CISREG_COR); |
696 | offset = SSB_PCMCIA_CORECTL; | ||
697 | else | ||
698 | offset = SSB_PCMCIA_CORECTL2; | ||
699 | err = ssb_pcmcia_cfg_read(bus, offset, &val); | ||
700 | if (err) | 708 | if (err) |
701 | goto error; | 709 | goto error; |
702 | val |= SSB_PCMCIA_CORECTL_IRQEN | SSB_PCMCIA_CORECTL_FUNCEN; | 710 | /* Some cards also need this register to get poked. */ |
703 | err = ssb_pcmcia_cfg_write(bus, offset, val); | 711 | err = ssb_pcmcia_cor_setup(bus, CISREG_COR + 0x80); |
704 | if (err) | 712 | if (err) |
705 | goto error; | 713 | goto error; |
706 | 714 | ||