aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia/cm4000_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/pcmcia/cm4000_cs.c')
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c73
1 files changed, 24 insertions, 49 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index f070ae7bd91a..1c5bf99895ed 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1759,65 +1759,40 @@ static void cmm_cm4000_release(struct pcmcia_device * link)
1759 1759
1760/*==== Interface to PCMCIA Layer =======================================*/ 1760/*==== Interface to PCMCIA Layer =======================================*/
1761 1761
1762static int cm4000_config_check(struct pcmcia_device *p_dev,
1763 cistpl_cftable_entry_t *cfg,
1764 cistpl_cftable_entry_t *dflt,
1765 unsigned int vcc,
1766 void *priv_data)
1767{
1768 if (!cfg->io.nwin)
1769 return -ENODEV;
1770
1771 /* Get the IOaddr */
1772 p_dev->io.BasePort1 = cfg->io.win[0].base;
1773 p_dev->io.NumPorts1 = cfg->io.win[0].len;
1774 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
1775 if (!(cfg->io.flags & CISTPL_IO_8BIT))
1776 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
1777 if (!(cfg->io.flags & CISTPL_IO_16BIT))
1778 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
1779 p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK;
1780
1781 return pcmcia_request_io(p_dev, &p_dev->io);
1782}
1783
1762static int cm4000_config(struct pcmcia_device * link, int devno) 1784static int cm4000_config(struct pcmcia_device * link, int devno)
1763{ 1785{
1764 struct cm4000_dev *dev; 1786 struct cm4000_dev *dev;
1765 tuple_t tuple;
1766 cisparse_t parse;
1767 u_char buf[64];
1768 int fail_fn, fail_rc;
1769 int rc;
1770 1787
1771 /* read the config-tuples */ 1788 /* read the config-tuples */
1772 tuple.Attributes = 0; 1789 if (pcmcia_loop_config(link, cm4000_config_check, NULL))
1773 tuple.TupleData = buf;
1774 tuple.TupleDataMax = sizeof(buf);
1775 tuple.TupleOffset = 0;
1776
1777 link->io.BasePort2 = 0;
1778 link->io.NumPorts2 = 0;
1779 link->io.Attributes2 = 0;
1780 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
1781 for (rc = pcmcia_get_first_tuple(link, &tuple);
1782 rc == CS_SUCCESS; rc = pcmcia_get_next_tuple(link, &tuple)) {
1783
1784 rc = pcmcia_get_tuple_data(link, &tuple);
1785 if (rc != CS_SUCCESS)
1786 continue;
1787 rc = pcmcia_parse_tuple(link, &tuple, &parse);
1788 if (rc != CS_SUCCESS)
1789 continue;
1790
1791 link->conf.ConfigIndex = parse.cftable_entry.index;
1792
1793 if (!parse.cftable_entry.io.nwin)
1794 continue;
1795
1796 /* Get the IOaddr */
1797 link->io.BasePort1 = parse.cftable_entry.io.win[0].base;
1798 link->io.NumPorts1 = parse.cftable_entry.io.win[0].len;
1799 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
1800 if (!(parse.cftable_entry.io.flags & CISTPL_IO_8BIT))
1801 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
1802 if (!(parse.cftable_entry.io.flags & CISTPL_IO_16BIT))
1803 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
1804 link->io.IOAddrLines = parse.cftable_entry.io.flags
1805 & CISTPL_IO_LINES_MASK;
1806
1807 rc = pcmcia_request_io(link, &link->io);
1808 if (rc == CS_SUCCESS)
1809 break; /* we are done */
1810 }
1811 if (rc != CS_SUCCESS)
1812 goto cs_release; 1790 goto cs_release;
1813 1791
1814 link->conf.IntType = 00000002; 1792 link->conf.IntType = 00000002;
1815 1793
1816 if ((fail_rc = 1794 if (pcmcia_request_configuration(link, &link->conf))
1817 pcmcia_request_configuration(link, &link->conf)) != CS_SUCCESS) {
1818 fail_fn = RequestConfiguration;
1819 goto cs_release; 1795 goto cs_release;
1820 }
1821 1796
1822 dev = link->priv; 1797 dev = link->priv;
1823 sprintf(dev->node.dev_name, DEVICE_NAME "%d", devno); 1798 sprintf(dev->node.dev_name, DEVICE_NAME "%d", devno);