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