aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/xirc2ps_cs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:12:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:12:40 -0400
commit2be4ff2f084842839b041b793ed6237e8d1d315a (patch)
tree1d776ac1717edeff4ee7d59ab0aea2782cb86dba /drivers/net/pcmcia/xirc2ps_cs.c
parentcf2fa66055d718ae13e62451bb546505f63906a2 (diff)
parenta45b3fb19ba1e4dfc3fc53563a072612092930a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (49 commits) pcmcia: ioctl-internal definitions pcmcia: cistpl header cleanup pcmcia: remove unused argument to pcmcia_parse_tuple() pcmcia: card services header cleanup pcmcia: device_id header cleanup pcmcia: encapsulate ioaddr_t pcmcia: cleanup device driver header file pcmcia: cleanup socket services header file pcmcia: merge ds_internal.h into cs_internal.h pcmcia: cleanup cs_internal.h pcmcia: cs_internal.h is internal pcmcia: use dev_printk for cs_error() pcmcia: remove CS_ error codes alltogether pcmcia: deprecate CS_BAD_TUPLE pcmcia: deprecate CS_BAD_ARGS pcmcia: deprecate CS_BAD_BASE, CS_BAD_IRQ, CS_BAD_OFFSET and CS_BAD_SIZE pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE pcmcia: deprecate CS_NO_MORE_ITEMS pcmcia: deprecate CS_IN_USE pcmcia: deprecate CS_CONFIGURATION_LOCKED ... Fix trivial conflict in drivers/pcmcia/ds.c manually
Diffstat (limited to 'drivers/net/pcmcia/xirc2ps_cs.c')
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c79
1 files changed, 48 insertions, 31 deletions
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index c33a3d523566..e1fd585e7131 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -377,7 +377,7 @@ first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
377 377
378 if ((err = pcmcia_get_first_tuple(handle, tuple)) == 0 && 378 if ((err = pcmcia_get_first_tuple(handle, tuple)) == 0 &&
379 (err = pcmcia_get_tuple_data(handle, tuple)) == 0) 379 (err = pcmcia_get_tuple_data(handle, tuple)) == 0)
380 err = pcmcia_parse_tuple(handle, tuple, parse); 380 err = pcmcia_parse_tuple(tuple, parse);
381 return err; 381 return err;
382} 382}
383 383
@@ -388,7 +388,7 @@ next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
388 388
389 if ((err = pcmcia_get_next_tuple(handle, tuple)) == 0 && 389 if ((err = pcmcia_get_next_tuple(handle, tuple)) == 0 &&
390 (err = pcmcia_get_tuple_data(handle, tuple)) == 0) 390 (err = pcmcia_get_tuple_data(handle, tuple)) == 0)
391 err = pcmcia_parse_tuple(handle, tuple, parse); 391 err = pcmcia_parse_tuple(tuple, parse);
392 return err; 392 return err;
393} 393}
394 394
@@ -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 * .... */