diff options
Diffstat (limited to 'drivers/net/wireless/libertas/if_cs.c')
-rw-r--r-- | drivers/net/wireless/libertas/if_cs.c | 77 |
1 files changed, 34 insertions, 43 deletions
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 62381768f2d5..6d55439a7b97 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
@@ -22,6 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
26 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
27 | #include <linux/firmware.h> | 28 | #include <linux/firmware.h> |
@@ -48,6 +49,7 @@ | |||
48 | MODULE_AUTHOR("Holger Schurig <hs4233@mail.mn-solutions.de>"); | 49 | MODULE_AUTHOR("Holger Schurig <hs4233@mail.mn-solutions.de>"); |
49 | MODULE_DESCRIPTION("Driver for Marvell 83xx compact flash WLAN cards"); | 50 | MODULE_DESCRIPTION("Driver for Marvell 83xx compact flash WLAN cards"); |
50 | MODULE_LICENSE("GPL"); | 51 | MODULE_LICENSE("GPL"); |
52 | MODULE_FIRMWARE("libertas_cs_helper.fw"); | ||
51 | 53 | ||
52 | 54 | ||
53 | 55 | ||
@@ -590,7 +592,7 @@ static int if_cs_prog_helper(struct if_cs_card *card) | |||
590 | 592 | ||
591 | /* TODO: make firmware file configurable */ | 593 | /* TODO: make firmware file configurable */ |
592 | ret = request_firmware(&fw, "libertas_cs_helper.fw", | 594 | ret = request_firmware(&fw, "libertas_cs_helper.fw", |
593 | &handle_to_dev(card->p_dev)); | 595 | &card->p_dev->dev); |
594 | if (ret) { | 596 | if (ret) { |
595 | lbs_pr_err("can't load helper firmware\n"); | 597 | lbs_pr_err("can't load helper firmware\n"); |
596 | ret = -ENODEV; | 598 | ret = -ENODEV; |
@@ -663,7 +665,7 @@ static int if_cs_prog_real(struct if_cs_card *card) | |||
663 | 665 | ||
664 | /* TODO: make firmware file configurable */ | 666 | /* TODO: make firmware file configurable */ |
665 | ret = request_firmware(&fw, "libertas_cs.fw", | 667 | ret = request_firmware(&fw, "libertas_cs.fw", |
666 | &handle_to_dev(card->p_dev)); | 668 | &card->p_dev->dev); |
667 | if (ret) { | 669 | if (ret) { |
668 | lbs_pr_err("can't load firmware\n"); | 670 | lbs_pr_err("can't load firmware\n"); |
669 | ret = -ENODEV; | 671 | ret = -ENODEV; |
@@ -793,18 +795,37 @@ static void if_cs_release(struct pcmcia_device *p_dev) | |||
793 | * configure the card at this point -- we wait until we receive a card | 795 | * configure the card at this point -- we wait until we receive a card |
794 | * insertion event. | 796 | * insertion event. |
795 | */ | 797 | */ |
798 | |||
799 | static int if_cs_ioprobe(struct pcmcia_device *p_dev, | ||
800 | cistpl_cftable_entry_t *cfg, | ||
801 | cistpl_cftable_entry_t *dflt, | ||
802 | unsigned int vcc, | ||
803 | void *priv_data) | ||
804 | { | ||
805 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
806 | p_dev->io.BasePort1 = cfg->io.win[0].base; | ||
807 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | ||
808 | |||
809 | /* Do we need to allocate an interrupt? */ | ||
810 | if (cfg->irq.IRQInfo1) | ||
811 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
812 | |||
813 | /* IO window settings */ | ||
814 | if (cfg->io.nwin != 1) { | ||
815 | lbs_pr_err("wrong CIS (check number of IO windows)\n"); | ||
816 | return -ENODEV; | ||
817 | } | ||
818 | |||
819 | /* This reserves IO space but doesn't actually enable it */ | ||
820 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
821 | } | ||
822 | |||
796 | static int if_cs_probe(struct pcmcia_device *p_dev) | 823 | static int if_cs_probe(struct pcmcia_device *p_dev) |
797 | { | 824 | { |
798 | int ret = -ENOMEM; | 825 | int ret = -ENOMEM; |
799 | unsigned int prod_id; | 826 | unsigned int prod_id; |
800 | struct lbs_private *priv; | 827 | struct lbs_private *priv; |
801 | struct if_cs_card *card; | 828 | struct if_cs_card *card; |
802 | /* CIS parsing */ | ||
803 | tuple_t tuple; | ||
804 | cisparse_t parse; | ||
805 | cistpl_cftable_entry_t *cfg = &parse.cftable_entry; | ||
806 | cistpl_io_t *io = &cfg->io; | ||
807 | u_char buf[64]; | ||
808 | 829 | ||
809 | lbs_deb_enter(LBS_DEB_CS); | 830 | lbs_deb_enter(LBS_DEB_CS); |
810 | 831 | ||
@@ -818,48 +839,15 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
818 | 839 | ||
819 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 840 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
820 | p_dev->irq.Handler = NULL; | 841 | p_dev->irq.Handler = NULL; |
821 | p_dev->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID; | ||
822 | 842 | ||
823 | p_dev->conf.Attributes = 0; | 843 | p_dev->conf.Attributes = 0; |
824 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 844 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
825 | 845 | ||
826 | tuple.Attributes = 0; | 846 | if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { |
827 | tuple.TupleData = buf; | 847 | lbs_pr_err("error in pcmcia_loop_config\n"); |
828 | tuple.TupleDataMax = sizeof(buf); | ||
829 | tuple.TupleOffset = 0; | ||
830 | |||
831 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
832 | if ((ret = pcmcia_get_first_tuple(p_dev, &tuple)) != 0 || | ||
833 | (ret = pcmcia_get_tuple_data(p_dev, &tuple)) != 0 || | ||
834 | (ret = pcmcia_parse_tuple(&tuple, &parse)) != 0) | ||
835 | { | ||
836 | lbs_pr_err("error in pcmcia_get_first_tuple etc\n"); | ||
837 | goto out1; | ||
838 | } | ||
839 | |||
840 | p_dev->conf.ConfigIndex = cfg->index; | ||
841 | |||
842 | /* Do we need to allocate an interrupt? */ | ||
843 | if (cfg->irq.IRQInfo1) { | ||
844 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
845 | } | ||
846 | |||
847 | /* IO window settings */ | ||
848 | if (cfg->io.nwin != 1) { | ||
849 | lbs_pr_err("wrong CIS (check number of IO windows)\n"); | ||
850 | ret = -ENODEV; | ||
851 | goto out1; | 848 | goto out1; |
852 | } | 849 | } |
853 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
854 | p_dev->io.BasePort1 = io->win[0].base; | ||
855 | p_dev->io.NumPorts1 = io->win[0].len; | ||
856 | 850 | ||
857 | /* This reserves IO space but doesn't actually enable it */ | ||
858 | ret = pcmcia_request_io(p_dev, &p_dev->io); | ||
859 | if (ret) { | ||
860 | lbs_pr_err("error in pcmcia_request_io\n"); | ||
861 | goto out1; | ||
862 | } | ||
863 | 851 | ||
864 | /* | 852 | /* |
865 | * Allocate an interrupt line. Note that this does not assign | 853 | * Allocate an interrupt line. Note that this does not assign |
@@ -946,6 +934,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
946 | card->priv = priv; | 934 | card->priv = priv; |
947 | priv->card = card; | 935 | priv->card = card; |
948 | priv->hw_host_to_card = if_cs_host_to_card; | 936 | priv->hw_host_to_card = if_cs_host_to_card; |
937 | priv->enter_deep_sleep = NULL; | ||
938 | priv->exit_deep_sleep = NULL; | ||
939 | priv->reset_deep_sleep_wakeup = NULL; | ||
949 | priv->fw_ready = 1; | 940 | priv->fw_ready = 1; |
950 | 941 | ||
951 | /* Now actually get the IRQ */ | 942 | /* Now actually get the IRQ */ |