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.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index b6c3644888cd..4eb6f986703b 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -82,7 +82,6 @@
82#include <linux/bitops.h> 82#include <linux/bitops.h>
83#include <linux/mii.h> 83#include <linux/mii.h>
84 84
85#include <pcmcia/cs_types.h>
86#include <pcmcia/cs.h> 85#include <pcmcia/cs.h>
87#include <pcmcia/cistpl.h> 86#include <pcmcia/cistpl.h>
88#include <pcmcia/cisreg.h> 87#include <pcmcia/cisreg.h>
@@ -678,9 +677,9 @@ xirc2ps_config_modem(struct pcmcia_device *p_dev,
678 677
679 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 678 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) {
680 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 679 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
681 p_dev->io.BasePort2 = cf->io.win[0].base; 680 p_dev->resource[1]->start = cf->io.win[0].base;
682 p_dev->io.BasePort1 = ioaddr; 681 p_dev->resource[0]->start = ioaddr;
683 if (!pcmcia_request_io(p_dev, &p_dev->io)) 682 if (!pcmcia_request_io(p_dev))
684 return 0; 683 return 0;
685 } 684 }
686 } 685 }
@@ -697,11 +696,11 @@ xirc2ps_config_check(struct pcmcia_device *p_dev,
697 int *pass = priv_data; 696 int *pass = priv_data;
698 697
699 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 698 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) {
700 p_dev->io.BasePort2 = cf->io.win[0].base; 699 p_dev->resource[1]->start = cf->io.win[0].base;
701 p_dev->io.BasePort1 = p_dev->io.BasePort2 700 p_dev->resource[0]->start = p_dev->resource[1]->start
702 + (*pass ? (cf->index & 0x20 ? -24:8) 701 + (*pass ? (cf->index & 0x20 ? -24:8)
703 : (cf->index & 0x20 ? 8:-24)); 702 : (cf->index & 0x20 ? 8:-24));
704 if (!pcmcia_request_io(p_dev, &p_dev->io)) 703 if (!pcmcia_request_io(p_dev))
705 return 0; 704 return 0;
706 } 705 }
707 return -ENODEV; 706 return -ENODEV;
@@ -808,8 +807,7 @@ xirc2ps_config(struct pcmcia_device * link)
808 goto failure; 807 goto failure;
809 } 808 }
810 809
811 link->io.IOAddrLines =10; 810 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
812 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
813 if (local->modem) { 811 if (local->modem) {
814 int pass; 812 int pass;
815 813
@@ -817,16 +815,16 @@ xirc2ps_config(struct pcmcia_device * link)
817 link->conf.Attributes |= CONF_ENABLE_SPKR; 815 link->conf.Attributes |= CONF_ENABLE_SPKR;
818 link->conf.Status |= CCSR_AUDIO_ENA; 816 link->conf.Status |= CCSR_AUDIO_ENA;
819 } 817 }
820 link->io.NumPorts2 = 8; 818 link->resource[1]->end = 8;
821 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 819 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
822 if (local->dingo) { 820 if (local->dingo) {
823 /* Take the Modem IO port from the CIS and scan for a free 821 /* Take the Modem IO port from the CIS and scan for a free
824 * Ethernet port */ 822 * Ethernet port */
825 link->io.NumPorts1 = 16; /* no Mako stuff anymore */ 823 link->resource[0]->end = 16; /* no Mako stuff anymore */
826 if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) 824 if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL))
827 goto port_found; 825 goto port_found;
828 } else { 826 } else {
829 link->io.NumPorts1 = 18; 827 link->resource[0]->end = 18;
830 /* We do 2 passes here: The first one uses the regular mapping and 828 /* We do 2 passes here: The first one uses the regular mapping and
831 * the second tries again, thereby considering that the 32 ports are 829 * the second tries again, thereby considering that the 32 ports are
832 * mirrored every 32 bytes. Actually we use a mirrored port for 830 * mirrored every 32 bytes. Actually we use a mirrored port for
@@ -841,14 +839,15 @@ xirc2ps_config(struct pcmcia_device * link)
841 } 839 }
842 printk(KNOT_XIRC "no ports available\n"); 840 printk(KNOT_XIRC "no ports available\n");
843 } else { 841 } else {
844 link->io.NumPorts1 = 16; 842 link->io_lines = 10;
843 link->resource[0]->end = 16;
845 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 844 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
846 link->io.BasePort1 = ioaddr; 845 link->resource[0]->start = ioaddr;
847 if (!(err=pcmcia_request_io(link, &link->io))) 846 if (!(err = pcmcia_request_io(link)))
848 goto port_found; 847 goto port_found;
849 } 848 }
850 link->io.BasePort1 = 0; /* let CS decide */ 849 link->resource[0]->start = 0; /* let CS decide */
851 if ((err=pcmcia_request_io(link, &link->io))) 850 if ((err = pcmcia_request_io(link)))
852 goto config_error; 851 goto config_error;
853 } 852 }
854 port_found: 853 port_found:
@@ -870,24 +869,21 @@ xirc2ps_config(struct pcmcia_device * link)
870 goto config_error; 869 goto config_error;
871 870
872 if (local->dingo) { 871 if (local->dingo) {
873 conf_reg_t reg;
874 win_req_t req; 872 win_req_t req;
875 memreq_t mem;
876 873
877 /* Reset the modem's BAR to the correct value 874 /* Reset the modem's BAR to the correct value
878 * This is necessary because in the RequestConfiguration call, 875 * This is necessary because in the RequestConfiguration call,
879 * the base address of the ethernet port (BasePort1) is written 876 * the base address of the ethernet port (BasePort1) is written
880 * to the BAR registers of the modem. 877 * to the BAR registers of the modem.
881 */ 878 */
882 reg.Action = CS_WRITE; 879 err = pcmcia_write_config_byte(link, CISREG_IOBASE_0, (u8)
883 reg.Offset = CISREG_IOBASE_0; 880 link->resource[1]->start & 0xff);
884 reg.Value = link->io.BasePort2 & 0xff; 881 if (err)
885 if ((err = pcmcia_access_configuration_register(link, &reg)))
886 goto config_error; 882 goto config_error;
887 reg.Action = CS_WRITE; 883
888 reg.Offset = CISREG_IOBASE_1; 884 err = pcmcia_write_config_byte(link, CISREG_IOBASE_1,
889 reg.Value = (link->io.BasePort2 >> 8) & 0xff; 885 (link->resource[1]->start >> 8) & 0xff);
890 if ((err = pcmcia_access_configuration_register(link, &reg))) 886 if (err)
891 goto config_error; 887 goto config_error;
892 888
893 /* There is no config entry for the Ethernet part which 889 /* There is no config entry for the Ethernet part which
@@ -901,16 +897,14 @@ xirc2ps_config(struct pcmcia_device * link)
901 goto config_error; 897 goto config_error;
902 898
903 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; 899 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800;
904 mem.CardOffset = 0x0; 900 if ((err = pcmcia_map_mem_page(link, link->win, 0)))
905 mem.Page = 0;
906 if ((err = pcmcia_map_mem_page(link, link->win, &mem)))
907 goto config_error; 901 goto config_error;
908 902
909 /* Setup the CCRs; there are no infos in the CIS about the Ethernet 903 /* Setup the CCRs; there are no infos in the CIS about the Ethernet
910 * part. 904 * part.
911 */ 905 */
912 writeb(0x47, local->dingo_ccr + CISREG_COR); 906 writeb(0x47, local->dingo_ccr + CISREG_COR);
913 ioaddr = link->io.BasePort1; 907 ioaddr = link->resource[0]->start;
914 writeb(ioaddr & 0xff , local->dingo_ccr + CISREG_IOBASE_0); 908 writeb(ioaddr & 0xff , local->dingo_ccr + CISREG_IOBASE_0);
915 writeb((ioaddr >> 8)&0xff , local->dingo_ccr + CISREG_IOBASE_1); 909 writeb((ioaddr >> 8)&0xff , local->dingo_ccr + CISREG_IOBASE_1);
916 910
@@ -957,7 +951,7 @@ xirc2ps_config(struct pcmcia_device * link)
957 951
958 /* we can now register the device with the net subsystem */ 952 /* we can now register the device with the net subsystem */
959 dev->irq = link->irq; 953 dev->irq = link->irq;
960 dev->base_addr = link->io.BasePort1; 954 dev->base_addr = link->resource[0]->start;
961 955
962 if (local->dingo) 956 if (local->dingo)
963 do_reset(dev, 1); /* a kludge to make the cem56 work */ 957 do_reset(dev, 1); /* a kludge to make the cem56 work */