Commit Graph

72567 Commits

Author SHA1 Message Date
mycroft 306522b970 I can't actually use the FORCE register this way. Just try turning the socket
power off.
2004-08-12 13:42:17 +00:00
mycroft 6269226dde Copyright maintenance. 2004-08-12 13:39:38 +00:00
mycroft 768040dd66 Various cleanup:
* Clean up the socket state earlier in the attach process -- not relying on
  the socket attachment to do it.
* Get rid of PCIC_LASTSTATE_HALF.  It's pointless.
* In pcic_wait_ready(), also check for the card vanishing, like in pccbb.
* Assert #RESET before powering up the card, not after.  (I think it was
  actually okay because the value was left as 0 from a previous disable or
  the initial socket attach, but...
* If the card fails to come ready, don't bother reinstating windows or
  anything -- just power it down.
2004-08-12 13:37:40 +00:00
hannken bc4af00256 Make it compile again for sparc64/DIAGNOSTIC.
All archs should use `cpuid_t ci_cpuid' ...
2004-08-12 12:15:21 +00:00
mycroft 6b8a90b3fe A bunch of random cleanup:
* Like the i82365 code, add a "delay" function that uses tsleep() to wait, and
  use this in the socket enable/disable paths.  This gets rid of the annoying
  system pauses during card insertion and removal.  (There are still some
  issues related to this in various drivers -- notably big delay()s in wi and
  xi.)
* Move the power-change delay out of pccbb_power() and into the PCMCIA backend
  code -- specifically, once in the disable path and once in the enable path.
  We were being pretty schizo about this before.  Make these use tsleep().
  (Note: This should be safe because card insertion/removal is handled by a
  kernel process, not in an interrupt handler.  It works for me with
  DIAGNOSTIC.)
* If we get a "bad Vcc" error, attempt to force the socket to power off, and
  return an error.  If we don't do this, we will get "bad Vcc" errors forever
  and never be able to use another card without rebooting, which is dumb.
  XXX I haven't been able to test this very well, because it doesn't fail for
  me in the first place.  :-)
* Clean up the socket mappings earlier in the enable path.
* Try to be consistent about clearing PWRCTL (which contains OE) before turning
  off power.
2004-08-12 07:15:49 +00:00
thorpej 9167731c79 Rename some constants:
WDC_COMPLETE -> ATACMD_COMPLETE
WDC_QUEUED -> ATACMD_QUEUED
WDC_TRY_AGAIN -> ATACMD_TRY_AGAIN
2004-08-12 05:02:50 +00:00
thorpej 3ddac9b2da Rename "struct wdc_command" to "struct ata_command". 2004-08-12 04:57:19 +00:00
thorpej 2e08b82ed7 Protect against multiple inclusion. 2004-08-12 04:31:33 +00:00
thorpej f45b99ef1d Add SATA queued read/write commands. 2004-08-12 04:26:06 +00:00
thorpej 77cc762658 Don't assume wdc-specific ATA / ATAPI code should be brought in if atabus
or atapibus are configured; use a separate wdc_common attribute to indicate
that the shared wdc code is also present.
2004-08-12 04:23:02 +00:00
mycroft d24f7ca79e Close a race condition in the datain loop. If we receive another byte between
reading the FIFO status and reading the interrupt status, we could end up
leaving it in the FIFO.  Force another round through the loop after reading the
interrupt status until the FIFO reads empty again.

Also, there is no point in having the extra loop to wait for the transfer
command to the controller to be acknowledged, because the transfer loop handles
that just fine -- and getting rid of it fixes another race condition.
2004-08-12 03:39:11 +00:00
mycroft 0ed22a5ae1 Output a message if we fail to find anything useful in the CIS, rather than
appearing to do nothing.
2004-08-11 20:57:40 +00:00
mycroft b2e0a4015a We don't need to implement DRIVE_NOSTREAM here, 'cause we never set
WDC_CAPABILITY_NOSTREAM.
2004-08-11 20:27:42 +00:00
mycroft 6e3decbf8a "I was mistaken."
The memory window is not actually activate in I/O card configurations.  It was
transparently falling back to 16-bit I/O mode.
Implement "memory card" mode correctly, with polling.
2004-08-11 19:48:57 +00:00
mycroft 6741190fbc Make datain_pio and dataout_pio function pointers in wdc_softc, which can
be overridden by the backend if desired.  Add experimental code to wdc_pcmcia
to use this in memory-mapped mode, disabled by default.
2004-08-11 18:41:46 +00:00
mycroft c8e7b2a367 The memory mode we were trying to use before is a total loss -- we don't get
any interrupts, and therefore wedge on any access.  However, there is another
memory mode that gives us a memory-mapped data register, which we can use.
Also set the new "DATA1K" flag to tell the wdc backend that we have a large
data area to read from -- this can be used with the region methods.
2004-08-11 18:06:22 +00:00
mycroft 139ff2a55b Change the behavior when a transfer mode setting is rejected. For PIO, fall
back to mode 3.  For DMA, fall back to mode 0.  These are the minimums for
ATAPI.  For UDMA, fail.
2004-08-11 17:51:24 +00:00
mycroft 04a46876e5 Add two helper functions -- wdc_datain_pio() and wdc_dataout_pio() -- which
encapsulate the logic for the various methods of transferring data.  Use these
throughout.
2004-08-11 17:49:27 +00:00
christos 5647899427 make the reset time a DIAGNOSTIC, and print the cpu#. 2004-08-11 16:25:51 +00:00
drochner ad1c914cc3 adapt to esl_pcmcia changes 2004-08-11 16:20:05 +00:00
mycroft c6c0aabf57 Correct the overrun loop while I'm at it. 2004-08-11 14:28:44 +00:00
mycroft 0ef13a458b Recode the datain_pio loop. This improves performance substantially (almost
2x) with my spc@pcmcia.
2004-08-11 14:22:34 +00:00
sekiya 1a682ebd64 Add 64-bit ABI bootloader (for IP30). Needs a slightly modified toolchain
and a 64-bit-clean libkern.a; once those bits are committed, this should be
100% good to go.
2004-08-11 11:45:26 +00:00
sekiya 8a3d53f346 Start routine for 64-bit ABI. 2004-08-11 11:41:19 +00:00
mycroft a1d101ba64 Add a settype function.
Nuke address windows earlier in power up sequence.
2004-08-11 06:56:57 +00:00
mycroft 3ebcfd93ee Forget to reset to memory mode on power up.
The hd64465 looks a bit incomplete, but "not my problem".
2004-08-11 06:30:15 +00:00
mycroft 7e4288f8a6 Attempt to fix these up, but I have no way to test them. 2004-08-11 06:16:10 +00:00
mycroft 9de9d325ad And the settype pointer. 2004-08-11 06:05:21 +00:00
mycroft d54277f76c Do not ever set IOIS8. We are not running on an 8088. 2004-08-11 04:35:35 +00:00
mycroft 8f96fc7c75 Always use PCMCIA_WIDTH_AUTO rather than PCMCIA_WIDTH_IO16. This spec is
pretty clear on how this works.
2004-08-11 04:25:28 +00:00
mycroft 310c1dab88 Do the read of the MAC address before enabling the function the first time,
so we're still in memory mode.
2004-08-11 03:56:03 +00:00
mycroft 70c487b124 Add a settype() function. Also clear the window enables when powering up or
down a socket, just to be safe.  (I've had problems with WinCE trashing my CF
card if there's state left behind...)
2004-08-11 01:54:46 +00:00
mycroft 8605b5b9c0 Nuke the address windows earlier, before the socket is powered up. Just in
case there are remnants left behind.
2004-08-11 01:51:41 +00:00
perseant a315d33325 Allow compilation in the absence of DIAGNOSTIC and/or DEBUG options. 2004-08-11 01:23:47 +00:00
mycroft 33ee9cbce7 Oops; fix a compile error. 2004-08-11 01:05:42 +00:00
mycroft 51be90e8ac Be more liberal in torching the old state in the disable and settype routines. 2004-08-11 01:04:40 +00:00
mycroft 38ce741470 Clear IOIE in settype(), too. Not that we currently change modes without
powering down the socket, but...
2004-08-11 00:59:40 +00:00
mycroft d978001d30 Clear some more ICR0 bits on socket enable/disable. 2004-08-11 00:58:08 +00:00
mycroft b9798ff4a2 Add a settype() function.
XXX Note that I haven't even compiled this, but any problems are likely to be
more straightforward than crashing with a null pointer dereference.
2004-08-11 00:55:38 +00:00
mycroft faaea66252 Fix uninitialized variable warnings (which did not appear on x86). 2004-08-11 00:32:44 +00:00
mycroft a23e15bcbe Rather than having a call up from the low-level driver to get the card type,
instead have a call down from the PCMCIA mid-layer to set it.  Use this from
pcmcia_function_enable().  (Currently the policy is the same, but this would
allow for more flexibility in deciding which mode to use.)

Now it is safe to hold the socket enabled during attach, so do that.  Only
one enable/disable cycle to attach a card now!
2004-08-11 00:18:18 +00:00
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 32dee96c25 Hold a reference between atabus_attach() and atabusconfig() to avoid an extra
enable/disable cycle.  Now my CF card attaches a bit faster.

XXX This code is split strangely between files.
2004-08-10 23:09:38 +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
dyoung 90691ca787 Cosmetic: remove extraneous blank line. 2004-08-10 21:58:31 +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 0a960e80ec +cs@pcmcia 2004-08-10 20:50:11 +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