Commit Graph

1143 Commits

Author SHA1 Message Date
mycroft a6bd4c05d7 GC some unneeded struct elements. 2004-08-10 23:34:32 +00:00
mycroft 76ad292990 Move the socket reference counting into pcmcia_socket_{enable,disable}(), and
use that where needed.
2004-08-10 23:34:06 +00:00
mycroft 8c50dac2a1 Rather than the silly state machine, set whatever higher-level reference
count there is (for SCSI, adapt_refcnt) to 1 and call the appropriate
"delref" function afterwards to disable the controller.  This is a bit
simpler.

In a couple of cases, just remove the state machine, because it wasn't
really necessary.
2004-08-10 22:49:12 +00:00
mycroft c2ecd3e635 Update to the new world order. While I'm here, simplify a lot. 2004-08-10 21:14:50 +00:00
mycroft 8355db5e7a Update to the new world order. 2004-08-10 20:47:17 +00:00
mycroft ab96663a2a Use the right function for disabling after attach. 2004-08-10 20:25:03 +00:00
mycroft 22d0dd0aab Whoops. This goes with the esl_pcmcia.c commit. 2004-08-10 19:55:20 +00:00
mycroft 2f2f7913ed This code was pretty far from even compiling before. It also doesn't implement
detach support.  However, update other parts of it.
2004-08-10 19:54:30 +00:00
mycroft a2606a74af Update to the new world order.
XXX This driver's backend should really be merged with ess.
2004-08-10 19:47:11 +00:00
mycroft 43a768d1a7 Remove an extra printf(). 2004-08-10 19:23:21 +00:00
mycroft 8534032c92 Constify. 2004-08-10 19:20:20 +00:00
mycroft bf4a3f1523 Whoops, look at both the ID numbers and the CIS strings in each pcmcia_product.
It's dumb that drivers depend on this, but...
2004-08-10 19:15:08 +00:00
mycroft 96221eb572 Constify. 2004-08-10 19:12:25 +00:00
mycroft 1e7c425a39 Replace another home-grown matching function. 2004-08-10 19:08:37 +00:00
mycroft 3a3d934204 Regen. 2004-08-10 18:45:36 +00:00
mycroft 99e8c8ddca Copyright maintenance. 2004-08-10 18:45:25 +00:00
mycroft 0515828a46 Now that all the silly string printing is gone, move the location where we
print a newline so it doesn't have to be done in every driver.
2004-08-10 18:43:49 +00:00
mycroft adbea3511a Enhance pcmcia_product_lookup():
* Remove the "expected function" value.  This was just causing problems with
  multifunction cards.  Differentiating the functions is better done by
  checking the function type (which we now do in ep and sm).
* Add support for matching CIS strings.  This necessitated changing the calling
  pattern a little too.

Use this enhanced version rather than driver-specific versions that do the
same thing.

Also, remove the last vestiges of PCMCIA_STR_*.
2004-08-10 18:39:08 +00:00
mycroft f185d2861f Remove some CIS strings that we don't actually want to match on -- in some
cases they contain minor revision numbers, and one was even someone's MAC
address!
2004-08-10 18:00:15 +00:00
mycroft e489df60f6 Take a shot at updating this to the new world order. Hopefully someone will
test it for me...
2004-08-10 16:43:47 +00:00
mycroft d11fb31edb More careful about cleaning up pointers. 2004-08-10 16:04:16 +00:00
mycroft 70ca4b2fa7 Print diagnostics in only one place if intr_establish() or function_enable()
fails.

Also, be a little more careful about passing up error values, and consistently
clear our interrupt handler pointer.
2004-08-10 15:29:56 +00:00
mycroft 90f47f6065 Better fix for the previous. 2004-08-10 08:57:50 +00:00
mycroft 8ccc950011 Copyright maintenance. 2004-08-10 08:56:08 +00:00
mycroft 51376df968 Fix a reference count problem I introduced here. 2004-08-10 08:29:27 +00:00
mycroft 03515f2f84 Update to the new world order.
XXX Note: This eliminates some register writes that were done in the "init"
routine during attach.  If these are necessary, they need to do done somewhere
else, quite possibly the enable routine.
2004-08-10 07:04:19 +00:00
mycroft aebf4d4a6e Update to the new world order. 2004-08-10 07:03:14 +00:00
mycroft 26df0f0126 Fix a printf(). 2004-08-10 06:23:50 +00:00
mycroft 6d1b8921aa Copyright maintenance. 2004-08-10 06:10:38 +00:00
mycroft 6c47211011 Update to the new world order. 2004-08-10 06:08:58 +00:00
mycroft ac82590655 Remove some useless code. 2004-08-10 06:05:40 +00:00
mycroft d55195e28b Update to the new world order.
"While I'm here..."
All that grotesque code allegedly for the 88190 and 88790 is actually just
mapping the CCR and writing to it.  So, enable the device normally and use
pcmcia_ccr_{read,write}() rather than doing this crap ourselves.
2004-08-10 05:24:56 +00:00
mycroft 1234bb195c Update to the new world order. 2004-08-10 05:23:04 +00:00
mycroft 9e12fe4182 Minor change to a printf(). 2004-08-10 05:22:33 +00:00
mycroft 1641421432 Move the location of a printf() I added. 2004-08-10 05:21:59 +00:00
mycroft 1a0a3e5f59 Update to the new world order. 2004-08-10 03:54:37 +00:00
mycroft baa0e65038 Make the enable state machine during attach more robust. 2004-08-10 03:54:26 +00:00
mycroft dae3551db2 Regen. 2004-08-10 03:03:29 +00:00
mycroft a866720a7e Remove a very silly hack WRT the Digital vendor ID. 2004-08-10 03:03:11 +00:00
mycroft 71e7860bbf GC the "quirk" code. 2004-08-10 03:00:29 +00:00
mycroft f96037f43b Use pcmcia_function_{configure,unconfigure}().
XXX Memory mapped mode seems to be flaky with my CF cards, so I have
disabled it for now.
2004-08-10 02:56:42 +00:00
mycroft 7f6dd84dc4 Use pcmcia_function_{configure,unconfigure}(). 2004-08-10 02:54:19 +00:00
mycroft 2137977a97 Be robust against child devices failing to handle the socket refcnt properly --
force it to 0 when a card is detached, possibly disabling the socket in the
process.

Add several new functions:
* pcmcia_config_alloc(pf, cfe)
  Tries to allocate all the I/O and memory spaces in a config entry.
* pcmcia_config_free(pf)
  Frees all the I/O and memory spaces for the active configuration.
* pcmcia_config_map(pf)
  Maps all the allocated I/O and memory spaces for the active configuration.
* pcmcia_config_unmap(pf)
  Unmaps all the allocated I/O and memory spaces for the active configuration.

And two higher-level functions:
* pcmcia_function_configure(pf, validator)
  Tries to find a CIS config entry that it can allocate the spaces for.  Each
  entry is verified by calling the "validator" function -- which can also do
  card- and driver-specific fixups.  If successful, the regions are all mapped.
* pcmcia_function_unconfigure(pf)
  Equivalent to calling both pcmcia_config_unmap() and pcmcia_config_free().

Most drivers are expected to use the latter two functions, which will greatly
reduce the amount of crufty code.
2004-08-10 02:50:52 +00:00
mycroft 16e317876a Minor change. 2004-08-09 22:24:37 +00:00
mycroft 125ba6ee0c Adapt to the new world order. 2004-08-09 22:02:11 +00:00
mycroft 975673d3f6 Adapt to the new world order. 2004-08-09 21:30:18 +00:00
mycroft 285bec8287 Minor code reduction. 2004-08-09 20:30:19 +00:00
mycroft b37b3de94e Adapt to the new world order. Now all my sm cards work. 2004-08-09 20:30:08 +00:00
mycroft 36c30a2f1a Dispense with all the interrupt multiplexing code here, and assume that the
underlying implementation DTRT.  This has the side effect of causing us to
ignore the INTR and INTRACK bits in the CCR -- but this seems for the best
anyway, since they are not reliably implemented.  (I note that Linux doesn't
bother either.)
2004-08-09 20:02:36 +00:00
mycroft 7848004c46 Do the I/O mapping in the main attach routine.
Also, we don't need to bother cleaning up on a failed attach -- we keep enough
state for the detach routine to do it.
2004-08-09 19:34:00 +00:00
mycroft bc7b11e4ff Add newlines to the messages... 2004-08-09 19:33:07 +00:00
mycroft b7a991ceb6 Whoops, nuke an unused variable. 2004-08-09 19:09:06 +00:00
mycroft 65d47754b3 Assume that io_map/unmap and intr_establish/disestablish will not be called
with the function enabled.  If this happens, issue a warning.  (This is only
really important for multifunction cards.)

This allows me to get rid of a bunch of extra code.
2004-08-09 19:08:19 +00:00
mycroft f65dd54152 Correct the intr_establish order here. 2004-08-09 18:51:32 +00:00
mycroft 7b96c587dc Fix the intr_establish/disestablish order here too. 2004-08-09 18:41:36 +00:00
mycroft 9092e2c97e Make pcmcia_function_disable() primarily responsible for disabling the CCR
bits.  pcmcia_intr_disestablish() continues to do this as a stopgap.
2004-08-09 18:30:51 +00:00
mycroft 2ae40d3e4f Do our io_map()s and intr_establish()es earlier. 2004-08-09 18:11:01 +00:00
mycroft af19b73069 Do io_map() and intr_establish() before enabling the function, always. This
prevents "stray interrupts" during attach.
2004-08-09 17:00:53 +00:00
mycroft deca9207b3 If the function is not enabled, do not attempt to immediately update the CCR.
XXX This is a stopgap until all drivers are converted to do their io_maps and
intr_establishes before function_enable.
2004-08-09 16:59:10 +00:00
mycroft c74553663e Add some code to deal with the interrupt mask register on early CEM cards.
Doesn't seem to work yet, but it's marginal progress.
2004-08-09 16:05:00 +00:00
mycroft c8180f49fd Use PCMCIA_WIDTH_AUTO, not PCMCIA_WIDTH_IO16, since we (sometimes) do 8-bit
access.
2004-08-09 15:40:56 +00:00
mycroft b03f5b32c7 Pass a valid alignment to pcmcia_io_alloc(). 2004-08-09 14:24:10 +00:00
mycroft 4e92489373 Add detach support for spc@pcmcia, modeled after aic@pcmcia. 2004-08-09 14:07:57 +00:00
mycroft 10121549dd Add a hack that makes the address register programming more reliable on my
CE2 cards.
2004-08-09 13:30:16 +00:00
mycroft eaae9fcf2b The "savedpage" stuff is nonsense. Every place we touch the device is
protected by splnet(), so there's no reason to even try.
2004-08-09 05:11:33 +00:00
mycroft a271b4e6ab Go online in xi_init(), not xi_full_reset(). Enable/disable receive in
xi_init()/xi_stop().
2004-08-09 04:47:40 +00:00
mycroft 0e261f0935 Fix a debugging printf(). 2004-08-09 02:10:25 +00:00
mycroft 105470da05 Do not set INTRACK ourselves. 2004-08-09 02:01:16 +00:00
mycroft cafa5cc2d1 Implement the correct (I think) interrupt acknowledgement sequence. 2004-08-09 01:49:26 +00:00
mycroft 00a9c911e6 Multifunction fixes:
* Don't call handlers for functions that are not enabled.
* Always call the handler if the function doesn't support the STATUS register.
While I'm here, divide the CCR numbers by 2.
2004-08-09 01:32:04 +00:00
mycroft 213233a551 Access to this device is strictly 16-bit, so use PCMCIA_WIDTH_IO16. 2004-08-09 00:33:17 +00:00
mycroft c52e6e82ec Create two windows iff the config table asks for it. Try to make them
contiguous.  Map windows with mode AUTO since we have mixed size access.
2004-08-09 00:00:36 +00:00
mycroft 8231a1a314 Copyright maintenance. 2004-08-08 23:19:59 +00:00
mycroft ebed70c6e6 Remove the "offset" and "size" arguments to pcmcia_io_map(). In the singular
case (ne@pcmcia) where we were using these to create a subregion, it is better
handled by calling bus_space_subregion().

Now there is a 1:1 mapping between I/O spaces in the config table and windows
mapped in the function.  Rework the multifunction mapping code to take
advantage of this by using both I/O base addresses if necessary.
2004-08-08 23:17:12 +00:00
mycroft fa9798d4c2 Search all the configuration entries. 2004-08-08 15:44:13 +00:00
mycroft 91ad7491a9 AFAICT, there's no reason not to use PCMCIA_WIDTH_AUTO here. 2004-08-08 15:12:20 +00:00
mycroft e4250cc050 Nuke an extra printf(). 2004-08-08 09:23:01 +00:00
mycroft bff77eedb1 Don't try to use the MII media status if we're not using MII. 2004-08-08 07:48:46 +00:00
mycroft 019f8a0d02 * Some rearrangement of where the power control hooks are called.
* Don't splnet() in xi_init() -- the callers do that.
* Don't do the enable call in xi_init() -- it should be done only in a process
  context so it can sleep.
* Call xi_start() at the end of xi_init() to restart output.
* If the interface is already up, we only need to call xi_set_address() to
  change state on SIOCSIFFLAGS.
2004-08-08 07:25:20 +00:00
mycroft 0cc7712b97 Hey, my LEDs work now. 2004-08-08 06:37:17 +00:00
mycroft ea155978ee Use the correct data port, for compatibility with old cards. Without this,
some of my CE2 cards are unable to transfer data successfully; they send
bogus packets and every received packet is all 0s.
"Special."
2004-08-08 06:22:50 +00:00
mycroft d643fea8d1 Set xidebug to 0 by default. 2004-08-08 05:56:50 +00:00
mycroft 2d5fe6edb4 Split "xi" into a "xirc" frontend (similar to mhzc; it attaches two child
devices) and a "xi" backend.

My CE2 and CEM2 cards are now probed correctly.  However, there are still
some problems with one model of the CE2, and the CEM2 doesn't seem to get
any modem interrupts.

While I'm at it, fix several bugs:

* The tuple scan for the MAC address was broken in multiple ways.
* xi_intr() did not deal well with a shared interrupt.
* We were setting the wrong page number to look at the receive status.  (How
  did this work???)
* Remove the xi_full_reset() from xi_reset().  Move the parts of
  xi_full_reset() needed to undo the effect of xi_stop() into xi_init().  This
  allows a stop/init pair to DTRT, and much quicker, as used by various
  ioctl()s.
* Set the TRS register before reading the TSO register, as the Linux driver
  does.  While I'm at it, fix the name.
* Fix numerous problems with xi_set_address().  "Where do I begin?"  There's a
  chance that multicast works now, but I haven't tested it.
* Explicitly clear the MSR register, and also force SELECT_MII to 0 if we
  didn't find any PHYs.
* Clean up some cruft that appears to be bogus.

Probably needs more work, but it's a start.
2004-08-08 05:56:08 +00:00
mycroft 961619ae0e pcmcia_socket_{enable,disable}() weren't used. Reimplement them as public
functions taking a pcmcia* device structure.

XXX This is a method of last resort for dealing with stupid/insane cards that
we need to probe harder before we can choose a config entry.  It should not be
used by most drivers.
2004-08-08 05:33:04 +00:00
mycroft 9918238ca5 Regen. 2004-08-07 17:18:20 +00:00
mycroft 7e01821c61 Clean up the Lucent (and clone) entries a bit.
Add the Hermes II (doesn't work yet, but it's harmless).
2004-08-07 17:18:09 +00:00
mycroft 5ef4913a65 Remove extra space. 2004-08-07 05:46:39 +00:00
mycroft c4fbc53cad Clean up attach messages. 2004-08-07 05:27:39 +00:00
mycroft dddef3e3c4 Clean up attach messages. 2004-08-07 04:55:25 +00:00
mycroft ea0d4e378a Swap around the output in some other cases so it's consistent.
Remove some more DELAY()s.
2004-08-07 01:52:42 +00:00
mycroft 15f2664423 Simplify the revision matching code. This is more like what the current
Linux driver does.
2004-08-07 01:44:45 +00:00
mycroft bbfd8cfd32 Oops; forgot a return. 2004-08-07 01:18:06 +00:00
mycroft 001ca3bd72 Tighten up the CIS parsing code a little.
Fix a double-free in a failure case.
Turn off the card if it doesn't fully attach.
2004-08-07 01:09:26 +00:00
mycroft 4e96eb2bd9 The generic code already looked for a LAN ID tuple, so look at what it found
rather than reparsing.
2004-08-07 01:07:31 +00:00
mycroft 4343cdf0c1 Only DELAY() once per CIS region, not once per tuple.
For PCMCIACISDEBUG, print out the tuple *before* parsing it or calling the
callback, so that we can see the tuple that the callback claimed.
2004-08-07 01:06:38 +00:00
mycroft da7483a558 Don't call rnd_detach_source() if we never called rnd_attach_source().
Very minor other cleanup.
2004-08-06 20:38:09 +00:00
mycroft 632742c13d Put a comma before the last CIS string too. 2004-08-06 20:30:05 +00:00
mycroft cce74b1050 Make a couple of Megahertz cards (one straight Ethernet, one multifunction)
work by:
* adding another product to the table,
* checking the function type (to reject the serial port),
* trying harder to find the MAC address in the CIS strings (it may occur in
  one of two different places).
Also, PCMCIA_STR_* elimination.
2004-08-06 19:38:49 +00:00
mycroft 7942a229b2 Regen. 2004-08-06 19:07:27 +00:00
mycroft 5bce4931d3 A few things:
* The DEPCM-XX cards don't need to be recognized by OUI or string -- they
  work just fine with the IO-DATA PC-LAT/E attachment, and are probable OEM.
  So, remove the DEPCM case.
* PCMCIA_STR_* elimination.
* The Megahertz EM3336 is not always an X-Jack device, so take the "XJ" out
  of the product number.
2004-08-06 19:07:12 +00:00