Commit Graph

179 Commits

Author SHA1 Message Date
Warner Losh
673c9ca931 Batch of changes:
o when turning off the socket for a 16-bit card, write 0 to INTR register
  rather than just tying to just clear the rest bit.  this seems to fix
  card insert detection after an eject on TI bridges (ricoh bridges work
  either way, apparently).  This is a MFp4.
o Cope better with TOPIC95 bridges on powerup.  According to NetBSD driver,
  these bridges don't set POWER_STATE, so cope accordingly in our power
  code.  They also need a little extra time to settle, so do that as well.
o It appears that we need to turn on/off one of the clocks to the card
  when we power up/down that socket on a TOPIC97, also from NetBSD.
o TOPIC97 bridges need to specifically enable LV card support.  Unconditionally
  do this in the hopes that all laptops that have these chips support LV
  voltages (they should, since they are required for CardBus).
o TOPIC register name regularization.  Registers specific to models of TOPIC
  are now called out as such.

# I need a machine with a TOPIC95 for testing.
2006-08-12 09:06:55 +00:00
Warner Losh
f99cc4ad59 We don't have a ISA specific shutdown routine at this time, so remove
it.  We just moved it to be pci specific, so this was causing compile
problems (linking problems, so I didn't notice since I unwisely just
built the module).
2006-06-03 21:10:50 +00:00
Warner Losh
5a535f681f Since we turn off the interrupts, we don't need to disestablish
our ISR.
2006-06-03 21:05:36 +00:00
Warner Losh
7490082f08 Move shutdown, and pci specific methods into pccbb_pci.c. Many more
are needed still.
2006-06-03 19:16:45 +00:00
Warner Losh
fc7119a71e The interrupt routine is pci specific. Move it into pccbb_pci.c. 2006-06-03 19:07:16 +00:00
Warner Losh
7dcc4efb74 Fix a couple printf's to be properly terminated.
Use a better name for the cbb thread.
2006-06-03 18:58:48 +00:00
Warner Losh
083f44a5a1 Succeed for writing bus value... nobody that calls must care :-( 2006-06-03 18:57:28 +00:00
Warner Losh
32b35e59a3 Zero out the devices when they are deleted. We can access the pointer after
the bus detaches which can lead to core dumps.  This is quite rare.
2006-06-02 06:33:35 +00:00
Warner Losh
fef035542a Export the pribus, secbus and subbus as sysctls for information
purposes only.  Additional information may be exported in the future.
2006-05-24 17:27:55 +00:00
Warner Losh
2f6303b0f6 Suspend the children before we turn off card events in hardware. This
was done, I believe, to work around some cards having issues in the
suspend case.  I think that this helped my Sony VAIO TS505 work better
when it had certain wireless cards in it and I did a apm -z.  I've not
tested suspend/resume on other laptops in a long time, so I hope this
doesn't cause greif.  Please let me know if it does.
2006-05-24 17:26:16 +00:00
Warner Losh
1b2ec08c94 Fix a race when detaching the cbb worker thread. There were a couple
of cases where we didn't take out the lock before setting or clearing
a bit.  This apparently can lead to a race at kldunload time (at least
on my Turion64 laptop, never saw it on my Sony Vaio).
2006-05-24 17:22:53 +00:00
Warner Losh
2c24bd34d6 Whitespace nits 2006-05-23 23:33:57 +00:00
Poul-Henning Kamp
c40da00ca3 Since DELAY() was moved, most <machine/clock.h> #includes have been
unnecessary.
2006-05-16 14:37:58 +00:00
Warner Losh
ebcd52935b Add missing ~. We want all the INVALID bits to be 0... Let's see if this
helps people with their interrupt storm problem on card eject.
2006-04-16 23:16:45 +00:00
Warner Losh
a49ed2a673 On some laptops, under very high loads, the socket event register read
in the ISR doesn't read the actual socket event register, but instead
reads garbage (usually 0xffffffff, but other times other things).
This totally violates the PCI spec, but happens rarely enough that a
workaround is in order.  This adds one test when we have a real
interrupt to service (which is very rare), and doesn't affect the
usualy 'nothing to see here' case at all.

Problem reported by many, but sam@ gave me this workaround after
diagnosing the problem.
2006-03-30 04:25:45 +00:00
Warner Losh
ee516cac43 Add a mask of valid socket events
While I'm hear, fix define<sp> to be define<tab>.
2006-03-30 04:12:28 +00:00
Warner Losh
1ab7d4c93d For each of the voltages that a card might support, make sure that the
socket also supports the voltage.  Some XV cards have appeared on the
scene (or cards that report they support XV), and in older machines
that have sockets that do not support XV, we were bogusly trying to
power them at XV rather than at 3.3V.  Now, power up the card at the
lowest voltage supported by both the card and the socket.

MFC After: 3 days
2006-03-24 07:52:00 +00:00
Warner Losh
22293c3afb Detach the children before we delete them. This is a little cleaner
than just deleting them.  Also add comments about why we do this.
Given the current behavior of delete_child, I don't think this changes
anything.  It just feels cleaner.
2006-02-07 18:38:51 +00:00
Warner Losh
44dc92eb94 Now that TUNABLE_ULONG is in the tree, and has been for a while, use it.
This also avoids typepunning.
2006-02-04 21:56:14 +00:00
Warner Losh
ef8984f5dc Remove extra debugging that crept in with the integration from p4. 2005-12-31 20:04:39 +00:00
Warner Losh
3ac604874c Simplify the opening of the resources for cardbus cards. Before we'd
try very hard to be perfect.  However, these attempts broke down when
there were large numbers of resources.  We'd not be able to map them all.

Instead, accept that we might pass more range to thse subbus than
might be optimal be able to compute.  However, there's little harm in
this and it allows us to pass greater resources through.

# it has been suggested that we allocate a fixed amount of resources
# on attach and give it out upon request.  This might not be a bad idea...
2005-12-29 23:38:45 +00:00
Warner Losh
0e6e3c1384 Ensure that we're aligned at leas tto the size of the resource being requested.
When cbb_debug is on, print the windows that we're mapping.
2005-12-27 19:18:11 +00:00
Warner Losh
0780312f3d nits 2005-12-27 18:55:21 +00:00
Warner Losh
fdb0b1368e Mollify the whitespace police 2005-11-08 15:42:12 +00:00
Warner Losh
ba61c672f6 Shutdown a little better by commenting the shutdown code and acknowledging
any interrupts after we turn off the interrupt mask.
2005-10-29 03:36:00 +00:00
Warner Losh
d9a423c36f Shut down the card bus bridge hardware on detach. Before we'd just
free the resoruces w/o actually turning off the interrupts.  This lead
to interrupt storms if you were to insert a card after kldunloading
the driver.
2005-10-29 03:27:43 +00:00
Warner Losh
d9efa52e17 Make sure we set bst and bsh in the softc.
This gets us probing, but not attaching to, ISA cards.  More work
needed since the ISA attach routine is return ENXIO right now :-)
2005-10-19 00:18:11 +00:00
Warner Losh
2ae7662803 Merge in WIP from p4 for supporting ISA pccard bridges conforming to
the ExCA spec, and close cousins:

o Write an activate routine that works.
o merge a couple of items from oldcard before they are lost
o write a deactivate routine

I suspect we're still a ways away from having this work, but maybe for
6.1/5.5?
2005-10-14 04:47:18 +00:00
Warner Losh
7f33c2df93 MFP4: More removal of unused stuff. 2005-10-08 06:58:51 +00:00
Warner Losh
f481fa4d29 MFP4: Changes to hopefully make the new power code work better
o Rather than just try to turn off EXCA_INTR_RESET, set the entire register
  to 0.  This is slightly faster, and a better hammer.
o Move attempted clearing of the output enable (EXCA_PWRCTL_OE) back to
  after we turn off the power.  Modify it to write 0 so that we don't get
  Bad Vcc messages on TI bridges (untested, but ru@ sent me a similar patch)
  while at the same time avoiding interrupt storms on Ricoh bridges (tested
  by me on my Sony).

# Many of my observations of 'breakage' for this patch are due to some bug
# in the load/unload of cbb.ko unlreated to this change.  I'll be investigating
# and fixing that bug in the fullness of time.
2005-10-08 06:57:13 +00:00
Warner Losh
f1abc0ea53 MFP4: We no longer use intr_handlers, so remove it. 2005-10-08 06:53:17 +00:00
Warner Losh
ed448ee4de MFP4: Note why we do the dance we do for waiting for the thread to die. 2005-10-08 06:51:47 +00:00
Warner Losh
550a624879 Fix bad compile. Pointy hat to: imp 2005-09-29 20:41:04 +00:00
Warner Losh
870d00144f o Add a bunch of o2micro controller IDs
o Add SMC34C90 to list as well, since I've found enough more data about it
  since my original research to know it is appropriate for this driver.
2005-09-29 19:59:03 +00:00
Warner Losh
aafbf20db0 I added the device IDs to the header, but not to the table. Add them
to the table.

MFC After: 3 days
2005-09-29 14:57:51 +00:00
Warner Losh
c82f53f61d 'PC Card' instead of other variants 2005-09-22 06:01:44 +00:00
Warner Losh
5c4f7048b8 This appears to be good for some folks, but really bad for others.
Until we know why, back out 1.127.
2005-09-12 05:35:11 +00:00
Warner Losh
8fe5efa81f Minor improvement for the suspend case for Ricoh based (and others)
CardBus bridges.
2005-09-08 17:18:42 +00:00
Warner Losh
b32757b431 o The ricoh bridge needs us to turn off the function interrupts for
16-bit cards when we're powering them up.  Other bridges may have
  similar issues, so we do this for all of them by setting the
  interrupt in the PCIC register 3 to be 0 (done always anyway)
  and turning on the bit in the bridge control register to route these
  interrupts via the ISA bus (or via the interrupt configured in the
  PCIC register 3).  '0' means disable completely.  There's a small
  chance this may interfere with the o2micro power hacks, but I'll
  wait for reports to come in from o2micro users.
o Expand some of the comments about why we do certain things.

# this gets rid of the interrupt storm warnings on my 505TS.  I think
# that we may need to do something similar on suspend, but I'm unsure
# since I don't have a laptop that supports suspened/resume with a
# ricoh chipset in it.
2005-07-17 19:40:05 +00:00
Warner Losh
f99298f422 Rename a bit to make it clearer that it enables routing of the function
interrupts to the ISA bus.
2005-07-17 19:31:39 +00:00
Warner Losh
85ef2343c4 The CD interrupt should only be enabled after we've initialized the
card.  Mask it while we're doing power things, as the PC Card standard
suggests.  Also, poll the POWER_CYCLE bit 10x a second as well as
providing a timeout for power cycle interrupt to happen.

The Ricoh '475 that I have doesn't seem to generate an interrupt for
power at the present time, so the polling is necessary for reasons as
yet unknown.  This results in an interrupt storm warning that I'm
still trying to quantify (the o2micro trick doesn't work to mitigate
this storm).  At the very least, this should help those users that
lost pccards on boot with the prior rev of this code.  My VAIO
PCG-505TS is now happier, but more investigation is necessary.
2005-07-17 07:48:28 +00:00
Warner Losh
ce71e8d87f s/_us// 2005-07-15 04:11:42 +00:00
Warner Losh
d224ede0da Move to using tsleeps in the cardbus reset case as well. This
eliminates the last of the DELAYs in pccbb.
2005-07-15 03:25:22 +00:00
Warner Losh
fd4e475233 Omnibus power and interrupt fixes:
o Don't busy wait on powerup.  Instead, use the power up interrupt to wait
  for the card to power up.  Don't wait when we're turning the card off,
  since no interrupt happens in that case.
o Convert many of the long DELAYs to tsleeps.  We do not run before
  the timer have stared, so DELAY isn't necessary.  More DELAYs can likely
  be eliminated in the future.
o When powering up the card, don't do anything if the card is already
  powered up (before we'd power cycle it).  This means that for most
  cards we power them up once and then never change the power.
o On card eject, mask (by clearing) the CD bit.  Before we set it, which
  was wrong.  We don't want to see any CD events past the first one since
  they need to be debounced.

With these changes, I can insert/eject 16bit cards without glitching xmms'
sound output.  Something very important to the development of better pccard
drivers :-)
2005-07-14 20:46:59 +00:00
Warner Losh
8e656629c7 Not yet ready to burn this, so unmark power stuff.... non-type 0 busses still need to do this 2005-06-06 06:05:32 +00:00
Warner Losh
3f7d3c1e3c Since cbb implements the pcib_ interface, it must also implement the
pcib_route_interrupt interface.  Since there's only one interrupt pin
in the CardBus form factor, everybody gets to share it.  Implement
cbb_route_interrupt to return the interrupt we have.

Suggested by: bms
2005-04-13 16:35:15 +00:00
Warner Losh
6b9907e7f8 Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 18:10:49 +00:00
Warner Losh
523675f64c Use the standard FreeBSD license for these files.
Approved by: imp, jon
2005-01-13 19:05:25 +00:00
Warner Losh
eb523c72cf The card activation failured message is lame, and not done for other
busses, nor for the 16-bit cards.  Eliminate it.
2005-01-11 05:38:01 +00:00
Warner Losh
afa87f87c8 /* -> /*- for a second clause 2005-01-11 05:34:14 +00:00