Commit Graph

22 Commits

Author SHA1 Message Date
mrg 58e3c9ef87 initialise chuck_rptr as well, instead of chuck_read twice. 2011-07-08 03:29:15 +00:00
pgoyette 564fdf67d5 Initialize sensor state before registering 2011-06-20 17:31:37 +00:00
rmind b1d9d10d78 - Use IPL_BIO (instead of IPL_SERIAL) for SPI.
- Convert simple_lock/ltsleep to mutex/condvar.
2011-06-08 23:05:48 +00:00
jym c44a6702cd Fix the while condition: sleep while the SPI_F_DONE bit is not set.
'!' takes precedence over bitwise operation '&', so use parenthesis.
2010-08-14 20:49:21 +00:00
cegger 7cf2991222 struct device * -> device_t, no functional changes intended. 2009-05-12 14:38:26 +00:00
yamt 70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
cegger 6a2e2c8cfd use device_lookup_private to get softc 2008-06-11 19:28:52 +00:00
xtraeme 5232253e58 device_t/softc split. 2008-05-04 14:21:55 +00:00
cegger 395c8c3fd3 use aprint_*_dev and device_xname 2008-04-05 16:35:35 +00:00
xtraeme 63e2f604f6 Split device_t/softc and other related cosmetic changes. 2008-04-04 10:11:01 +00:00
dogcow ca9c510ab2 explicitly include simplelock.h 2008-01-08 13:28:22 +00:00
xtraeme 31962fc6e5 Extend the envsys2 API (one more time, sorry) as defined in:
http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
2007-11-16 08:00:11 +00:00
ad 66fefd117b It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
2007-07-29 12:15:35 +00:00
dyoung b22ec706cf Fix the kthread_create(9) call so this compiles again. 2007-07-19 00:00:09 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
xtraeme da3f163bd2 Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
  and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
  sysmon_power(9) and powerd(8), that means there is no 32 bytes event
  size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
2007-07-01 07:37:12 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
wiz 3ed1aa9185 Spell "separate" correctly. From Zafer Aydogan. 2006-12-25 18:39:47 +00:00
christos 1665d5e960 fix spelling of accommodate; from Zapher. 2006-11-24 19:46:58 +00:00
gdamore e8ac1cad77 This commit provides substantial fixes and functionality for SPI flash.
Specifically, the SPI flash now operates as a nearly fully functional block
device (other than lacking disklabel support).  It does some basic translation
stuff, so that if you attempt to write a block, the underlying flash sectors
(usually 64k in size) will be read, erased and rewritten.

To minize thrashing, the spiflash strategy routine attempts to gather writes
to the same sector together, so that in the typical case you will not have to
repeatedly erase/rewrite the sector.  It also attempts to check and verify
whether an erase cycle is truly needed.  There are still access patterns that
will cause multiple erases to occur, and so I heartily discourage the use
of these flash devices for storing anything other than small configuration
data, or write-once images.  If you want to do more than that, then someone
should try to write a real flash translation layer.

The drivers attempt to provide some level of asynchronous operation, so that
while you are erasing or writing to the flash, other things can reasonably
take place.

Note that spiflash does not do bad block remapping.  It also doesn't detect
when a device is in read-only mode, or if some sectors are read-only.  It
only supports uniform sectored NOR flash.  It lacks any code to deal with
disklabels, and does not offer any disk related ioctls.

These limitations aside, it would not be terribly hard, I think, to break
out the code I've done to create a generic "norflash" driver, backed by
a "common" spiflash module.  Then other flash drivers (e.g. athflash, etc.)
could benefit from the ability to use this as a block device.  I've tried
to architect it to support that, if someone else wants to do the work.
(Hi Jared!)

The primary reason that I've not added code to deal with disklabels is that
I had a difficult time figuring out which framework (disklabels or wedges)
to use, and which bits of code were necessary to implement.  In the case of
the flash devices I'm working with, a parser to deal with redboot FIS images
(partitions) would need to be added.  I was prepared to do this, but gave
up owing to the complete and total lack of any API or design documentation
pertaining to the requirements for disk drivers and disklabel management or
wedges.   I would strongly encourage someone who knows something about
wedges or disklabels to write a simple document (or even a dummy driver)
showing which interfaces should be provided in new mass storage drivers.

This work was funded by the Champaign-Urbana Community Wireless Network
Project.
2006-10-20 06:41:46 +00:00
gdamore c36ea7cf37 Add spiflash driver, and M25P instance, used for STMicro flash devices
found on Meraki Mini (for example).
2006-10-07 07:21:13 +00:00
gdamore 5c050c465e Initial commit of SPI bus (also known as Microwire) framework, along with
a sample driver for the TI TMP121 temperature sensor.  This has been
moderately tested on Au1550, and it is not enabled in sys/conf (yet).  So
the change is harmless at worst, and useful at best.

Alchemy Au1550 bus driver forthcoming, along with a driver for SPI flash
devices, such as found on the Meraki Mini

This development was partially funded by the Champaign-Urbana Community
Wireless Network Project.

Note that there are some MD-specific SPI drivers that could probably be
made MI under this new framework.
2006-10-02 07:18:19 +00:00