Commit Graph

164 Commits

Author SHA1 Message Date
pgoyette 7bcb9558e0 1. Reorganize code into memory-type-specific routines instead of multiple
monstrous if-then-else-if constructs.
2. Display module capacity in GB if it is at least 1GB.
3. Indicate if a memory module is "registered".
4. For DDR3, indicate if a temp-sensor is present.

Inspired by similar changes in OpenBSD's spdmem(4).
2009-02-22 17:28:50 +00:00
pgoyette 704a9b346c Previous check for ADM1027 caused a kernel panic, since the read routine
can be called _before_ we've identified the chip.  Ensure that sc_chip
is initialized to NULL before chip is identified, and if it is NULL or
ADM1027, use the less-efficient send_byte/receive_byte.

While here, don't attempt to release the i2c bus if we failed to acquire
it.  This would cause a panic on a LOCKDEBUG kernel.

Thanks to Nicholas Joly for pointing out both of these bugs.
2009-02-09 20:27:21 +00:00
pgoyette 66a822fbe7 The ADM1027 chip doesn't support i2c read_byte protocol, so in this
case we use send_byte followed by receive_byte.
2009-02-08 17:48:02 +00:00
pgoyette d94df08c58 Use pre-scripted i2c protocols rather than re-inventing our own. No
functional change intended.

While here, change some indentation to use tabs vs spaces.
2009-02-08 14:34:40 +00:00
pgoyette cf99d387f4 Change the i2c bus scan routine to use the write_quick protocol for most
addresses, rather than trying to read a byte of data from the device.

Some devices don't like to be read from (certain clock devices are, I'm
told, write-only!), while others expect to be asked only for words (or
pairs of bytes).

While here, skip a bunch of i2c addresses that can't (or at the very
least, shouldn't) have any slave devices.

This is the only use in NetBSD of the quick_read/quick_write protocol,
and it remains disabled by default.  I've updated all the generic i2c
drivers to handle the quick_* protocols, but several port-specific
drivers have not been updated since I'm in no position to verify that
the changes work.  Assistance from sandpoint, arm/xscale, evbarm/gumstix,
mips/alchemy, and macppc would be greatly appreciated.
2009-02-03 16:41:31 +00:00
pgoyette b4d7d7bb1d Handle i2c quick_read/quick_write bus protocol in the generic i2c_exec()
routine, since we have already have the iic_smbus_* interfaces.

NOTE: i2c controllers that provide their own i2c_exec() routine also need
to be modified.  I'll be committing most of these shortly.
2009-02-03 16:17:54 +00:00
pgoyette c6125af1bb Include ADT7460 in chip table (it's identical to the ADT7463, except for
physical packaging).
2009-01-14 13:54:29 +00:00
briggs 9ee13eae71 According to the datasheet, temperatures on the LM75 are kept in
0.5 degC-precision the most-significant 9 bits of a 16-bit register.
Interpret them as such and simplify the conversion.
2009-01-09 17:20:31 +00:00
briggs c43973de4b Provide a utility routine to configure/write the watchdog.
XXX This watchdog should eventually be integrated into the generic
    watchdog framework.
2009-01-09 16:09:43 +00:00
pgoyette 3ed3895de3 Add i2c bus address checking for these chips. All supported chips live
at predefined addresses 0x2c, 0x2d, or 0x2e.
2008-12-18 20:41:35 +00:00
pgoyette 986177f217 Ouch - too many bits to fit in a byte. 2008-11-22 19:25:38 +00:00
pgoyette b016fe8ba2 JEDEC has published the DDR3 SPD standard; update driver to match.
Verified on my single DDR3 machine to still produce correct data.
2008-11-22 13:21:21 +00:00
jnemeth cc34b6178d PR/39947 - Juan RP -- dbcool_detach implicitly called
sysmon_envsys_destroy() twice
2008-11-18 10:49:45 +00:00
pgoyette 3dbe765413 For DDR3, the number of physical banks stored in the EEPROM needs to be
incremented by 1.
2008-11-16 14:03:48 +00:00
nakayama 0b0fb12976 Add dependency on sysmon_envsys to admtemp. 2008-10-30 12:52:46 +00:00
jkunz fb8ec4c35a Ported alipm(4) and admtemp(4) from OpenBSD. 2008-10-29 17:26:56 +00:00
pgoyette fffe1c84a7 Remove duplicated copy of the file - no idea where it came from. 2008-10-13 11:16:00 +00:00
pgoyette eacec974a3 Add an i2c attachment for the LM78 family of temp sensor/fan control
Tested by Martin Husemann
2008-10-12 13:17:28 +00:00
pgoyette a3cdedf605 Move the {read,write}reg() routine addresses into the dbcool_softc so
that we can use different routines for macppc's ki2c attachment.  Fixes
problems reported by Robert Fritzsche on current-users@ list.
2008-10-12 12:49:04 +00:00
pgoyette 13579c9401 sysctl doesn't like names that start with digits, nor does it like names
with embedded '.' so change the names to be better-conforming.  Reported
by njoly
2008-10-10 13:08:29 +00:00
pgoyette 691525189c It's not necessary to #include "sysmon_envsys.h" any more. 2008-10-09 10:25:47 +00:00
pgoyette 94ba92bdd7 Increase accuracy in nominal voltage table. 2008-10-07 22:50:33 +00:00
pgoyette 379328cb93 Remove chip-specific drivers for ADT7463, ADT7467, and ADM1030; these
have been superseded by the dbcool(4) driver.
2008-10-07 19:32:29 +00:00
pgoyette aef4db128d Various clean-ups:
1. Trange sysctl's belong to the temp sensors, not to the fan controllers
  2. Trange really describes a slope on many chips, so modify the description
  3. Most of the sysctl's are read/write even if the chip's config is
     locked;  reflect that in the CTLFLAGs
  4. Apply correct 'nominal' values for voltage sensors/limits, specify
     them in microVolts, and calculate once rather than each time needed
  5. Be more consistent in register names - for example, use VCC instead of
     SUPPLY_VOLTAGE, to match VCC_LOWLIM & VCC_HIGHLIM
  6. Type of dbcool_islocked() should be bool, not int
  7. Reduce some unnecessary code indentation
  8. Define Vtt and Imon, and add ADT7490 support (excluding PECI sensors)
  9. Split the huge (250+ lines) dbcool_setup() function into a few smaller
     routines for better readability
 10. Update sensor tables for ADT7476 and ADT7468 - these chips have five
     voltage sensors, not two
 11. Adjust flags for ADT7463 and ADM1027 - these chips can monitor CPU
     VID data bits
 12. Update man page
2008-10-06 01:35:35 +00:00
pgoyette 0219f2ad21 Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476.  Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.

Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 00:47:51 +00:00
pgoyette d17ee48907 When scanning i2c bus for responding devices, skip over the multicast
i2c Alert Response Address.  Skipping this won't hurt (the address is
allegedly reserved), and it might avoid the lock-ups that have been
seen by others.
2008-09-29 22:55:08 +00:00
pgoyette d3676b5978 Add support for DDR3.
OK garbled@
2008-09-28 12:59:54 +00:00
pgoyette b73f29cbc7 Display memory latency/timing data via aprint_verbose()
spdmem0: tAA-tRCD-tRP-tRAS: 5-5-5-18

OK garbled@
2008-09-27 16:37:40 +00:00
pgoyette f9eb81cfb1 Miscellaneous clean-ups:
1. Use proper CRc check for FB-DIMMs rather than simple checksum
  2. Provide access to entire SPD ROM contents via sysctl, rather than
     only the first 64 bytes
  3. Use macros to define i2c bus address checking
  4. General fix-up for RAMBUS memory (not that anyone I know has one)

OK garbled@
2008-09-27 06:58:08 +00:00
pgoyette ab6abfafd3 Add verification of proper chip before blindly matching for consistency
with other drivers (notably adt7463).

NOTE: The verify routine in _both_ drivers might better be placed in-line
in the _match() routine.  But these drivers will soon be superseded by the
dbcool driver any way.

OK gmcgarry@
2008-09-17 15:39:05 +00:00
pgoyette 6d5a4d28bb Provide an option I2C_SCAN to enable sanning i2c bus for responses. This
is disabled by default, preserving current behavior.

OK garbled@
2008-09-11 20:48:50 +00:00
pgoyette ca20a59d5d Fix typo - no functional changes.
OK macallan@
2008-09-08 23:07:51 +00:00
pgoyette 63a1d80294 Provide correct URL for current data sheet. This device is now owned
by ON Semi.
2008-09-08 16:05:44 +00:00
pgoyette 9b30bc57d1 Note that previous URL for ADT7463 datasheet is no longer operative, and
provide link to an earlier, but still active, revision.
2008-09-07 19:07:21 +00:00
macallan 5eb6bd1c4f allow wildcard for addr so we can have spdmem* at iic? addr ? 2008-08-26 16:29:14 +00:00
macallan f675bba464 fix incomplete device_t-ification
Now it works again.
2008-08-01 19:33:07 +00:00
tsutsui b7ae6e7fa1 Set SDA High (it means turning off open-collector driver
regardless of DIR() on the formal I2C hardware implementation)
during DIR() is set to INPUT. Some MD drivers might assume it.

tl(4) still works with this change.
2008-07-12 02:11:32 +00:00
tsutsui b3d67eaca7 Remove unnecessary casts against void pointers. 2008-06-08 03:56:09 +00:00
tsutsui ec3c45aecf Replace device_lookup() with device_lookup_private() to get softc
after device_t/softc split.  PR kern/38885 from Jonathan A. Kollasch.
2008-06-08 03:49:26 +00:00
tsutsui 3a70013d4e Reorganize I2C bitbang ops:
- don't set DIR(INPUT) in i2c_wait_for_scl() because it could cause
  unexpected stop condition in SCL=H, SDL=L and DIR(OUTPUT) case,
  and DIR() should be used only to switch SDA direction, not SCL
  that is always output on the master device
  (I'm not sure if reading SCL on the master is defined in the I2C spec)
- set SDA right after SCL H->L edge on Tx, fetch SDA at SCL L->H edge on Rx,
  and make sure not to change SDA during SCL=H except start/stop conditions
  so that we don't have to rely on data setup time which might be critical
- don't set DIR(OUTPUT) during SDA bit read in i2c_bitbang_read_byte()
- explicitly specify both SDA and SCL bits in SETBITS() for readability
- sprinkle comments

Fixes "tl0: error reading Ethernet address" problem on tl(4).
2008-06-01 01:13:18 +00:00
tsutsui a2180d724d - use 'us' for microsecond rather than 'uS'
- unwrap not so long lines
- some KNF
2008-05-31 18:26:43 +00:00
macallan 1da90a4ef8 nuke clause 3 2008-05-08 02:32:48 +00:00
macallan 92b89da10e nuke clause 3 2008-05-08 02:03:22 +00:00
jmcneill 729313d52c Use 2-clause license. 2008-05-05 00:12:49 +00:00
xtraeme 9fbdf1594f device_t/softc split and other related cosmetic changes. 2008-05-04 15:26:29 +00:00
xtraeme 07c2a78bc8 device_t/softc split for adt7467c(4) and adm1030, and other related
cosmetic changes.
2008-05-04 14:45:01 +00:00
cegger f98b30fb5e Re-add chunk of code that got lost in rev. 1.10. Makes this file build/work again. vi sometimes plays games with me. Spotted by dogcow. 2008-04-09 06:13:26 +00:00
dogcow 9bad45d03e deparenthesize 'return (x);' and add missing close-brace. 2008-04-09 05:57:00 +00:00
cegger 0e50a9464d use aprint_*_dev and device_xname 2008-04-06 20:25:59 +00:00
xtraeme 63e2f604f6 Split device_t/softc and other related cosmetic changes. 2008-04-04 10:11:01 +00:00