diff options
Diffstat (limited to 'drivers/net/pcmcia/xirc2ps_cs.c')
-rw-r--r-- | drivers/net/pcmcia/xirc2ps_cs.c | 73 |
1 files changed, 44 insertions, 29 deletions
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index f6c4698ce738..b57f022952b4 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -715,6 +715,45 @@ has_ce2_string(struct pcmcia_device * p_dev) | |||
715 | return 0; | 715 | return 0; |
716 | } | 716 | } |
717 | 717 | ||
718 | static int | ||
719 | xirc2ps_config_modem(struct pcmcia_device *p_dev, | ||
720 | cistpl_cftable_entry_t *cf, | ||
721 | void *priv_data) | ||
722 | { | ||
723 | unsigned int ioaddr; | ||
724 | |||
725 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { | ||
726 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { | ||
727 | p_dev->conf.ConfigIndex = cf->index ; | ||
728 | p_dev->io.BasePort2 = cf->io.win[0].base; | ||
729 | p_dev->io.BasePort1 = ioaddr; | ||
730 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
731 | return 0; | ||
732 | } | ||
733 | } | ||
734 | return -ENODEV; | ||
735 | } | ||
736 | |||
737 | static int | ||
738 | xirc2ps_config_check(struct pcmcia_device *p_dev, | ||
739 | cistpl_cftable_entry_t *cf, | ||
740 | void *priv_data) | ||
741 | { | ||
742 | int *pass = priv_data; | ||
743 | |||
744 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { | ||
745 | p_dev->conf.ConfigIndex = cf->index ; | ||
746 | p_dev->io.BasePort2 = cf->io.win[0].base; | ||
747 | p_dev->io.BasePort1 = p_dev->io.BasePort2 | ||
748 | + (*pass ? (cf->index & 0x20 ? -24:8) | ||
749 | : (cf->index & 0x20 ? 8:-24)); | ||
750 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
751 | return 0; | ||
752 | } | ||
753 | return -ENODEV; | ||
754 | |||
755 | } | ||
756 | |||
718 | /**************** | 757 | /**************** |
719 | * xirc2ps_config() is scheduled to run after a CARD_INSERTION event | 758 | * xirc2ps_config() is scheduled to run after a CARD_INSERTION event |
720 | * is received, to configure the PCMCIA socket, and to make the | 759 | * is received, to configure the PCMCIA socket, and to make the |
@@ -725,13 +764,12 @@ xirc2ps_config(struct pcmcia_device * link) | |||
725 | { | 764 | { |
726 | struct net_device *dev = link->priv; | 765 | struct net_device *dev = link->priv; |
727 | local_info_t *local = netdev_priv(dev); | 766 | local_info_t *local = netdev_priv(dev); |
767 | unsigned int ioaddr; | ||
728 | tuple_t tuple; | 768 | tuple_t tuple; |
729 | cisparse_t parse; | 769 | cisparse_t parse; |
730 | unsigned int ioaddr; | ||
731 | int err, i; | 770 | int err, i; |
732 | u_char buf[64]; | 771 | u_char buf[64]; |
733 | cistpl_lan_node_id_t *node_id = (cistpl_lan_node_id_t*)parse.funce.data; | 772 | cistpl_lan_node_id_t *node_id = (cistpl_lan_node_id_t*)parse.funce.data; |
734 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | ||
735 | DECLARE_MAC_BUF(mac); | 773 | DECLARE_MAC_BUF(mac); |
736 | 774 | ||
737 | local->dingo_ccr = NULL; | 775 | local->dingo_ccr = NULL; |
@@ -846,19 +884,8 @@ xirc2ps_config(struct pcmcia_device * link) | |||
846 | /* Take the Modem IO port from the CIS and scan for a free | 884 | /* Take the Modem IO port from the CIS and scan for a free |
847 | * Ethernet port */ | 885 | * Ethernet port */ |
848 | link->io.NumPorts1 = 16; /* no Mako stuff anymore */ | 886 | link->io.NumPorts1 = 16; /* no Mako stuff anymore */ |
849 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 887 | if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) |
850 | for (err = first_tuple(link, &tuple, &parse); !err; | 888 | goto port_found; |
851 | err = next_tuple(link, &tuple, &parse)) { | ||
852 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { | ||
853 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { | ||
854 | link->conf.ConfigIndex = cf->index ; | ||
855 | link->io.BasePort2 = cf->io.win[0].base; | ||
856 | link->io.BasePort1 = ioaddr; | ||
857 | if (!(err=pcmcia_request_io(link, &link->io))) | ||
858 | goto port_found; | ||
859 | } | ||
860 | } | ||
861 | } | ||
862 | } else { | 889 | } else { |
863 | link->io.NumPorts1 = 18; | 890 | link->io.NumPorts1 = 18; |
864 | /* We do 2 passes here: The first one uses the regular mapping and | 891 | /* We do 2 passes here: The first one uses the regular mapping and |
@@ -866,21 +893,9 @@ xirc2ps_config(struct pcmcia_device * link) | |||
866 | * mirrored every 32 bytes. Actually we use a mirrored port for | 893 | * mirrored every 32 bytes. Actually we use a mirrored port for |
867 | * the Mako if (on the first pass) the COR bit 5 is set. | 894 | * the Mako if (on the first pass) the COR bit 5 is set. |
868 | */ | 895 | */ |
869 | for (pass=0; pass < 2; pass++) { | 896 | for (pass=0; pass < 2; pass++) |
870 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 897 | if (!pcmcia_loop_config(link, xirc2ps_config_check, &pass)) |
871 | for (err = first_tuple(link, &tuple, &parse); !err; | ||
872 | err = next_tuple(link, &tuple, &parse)){ | ||
873 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8){ | ||
874 | link->conf.ConfigIndex = cf->index ; | ||
875 | link->io.BasePort2 = cf->io.win[0].base; | ||
876 | link->io.BasePort1 = link->io.BasePort2 | ||
877 | + (pass ? (cf->index & 0x20 ? -24:8) | ||
878 | : (cf->index & 0x20 ? 8:-24)); | ||
879 | if (!(err=pcmcia_request_io(link, &link->io))) | ||
880 | goto port_found; | 898 | goto port_found; |
881 | } | ||
882 | } | ||
883 | } | ||
884 | /* if special option: | 899 | /* if special option: |
885 | * try to configure as Ethernet only. | 900 | * try to configure as Ethernet only. |
886 | * .... */ | 901 | * .... */ |