Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / Documentation / spi / spi-lm70llp
blob154bd02220b9a7c232d01dd89951aee37c37b563
1 spi_lm70llp :  LM70-LLP parport-to-SPI adapter
2 ==============================================
4 Supported board/chip:
5   * National Semiconductor LM70 LLP evaluation board
6     Datasheet: http://www.national.com/pf/LM/LM70.html
8 Author:
9         Kaiwan N Billimoria <kaiwan@designergraphix.com>
11 Description
12 -----------
13 This driver provides glue code connecting a National Semiconductor LM70 LLP
14 temperature sensor evaluation board to the kernel's SPI core subsystem.
16 In effect, this driver turns the parallel port interface on the eval board
17 into a SPI bus with a single device, which will be driven by the generic
18 LM70 driver (drivers/hwmon/lm70.c).
20 The hardware interfacing on the LM70 LLP eval board is as follows:
22    Parallel                 LM70 LLP
23      Port      Direction   JP2 Header
24    ----------- --------- ----------------
25       D0     2      -         -
26       D1     3     -->      V+   5
27       D2     4     -->      V+   5
28       D3     5     -->      V+   5
29       D4     6     -->      V+   5
30       D5     7     -->      nCS  8
31       D6     8     -->      SCLK 3
32       D7     9     -->      SI/O 5
33      GND    25      -       GND  7
34     Select  13     <--      SI/O 1
35    ----------- --------- ----------------
37 Note that since the LM70 uses a "3-wire" variant of SPI, the SI/SO pin
38 is connected to both pin D7 (as Master Out) and Select (as Master In)
39 using an arrangment that lets either the parport or the LM70 pull the
40 pin low.  This can't be shared with true SPI devices, but other 3-wire
41 devices might share the same SI/SO pin.
43 The bitbanger routine in this driver (lm70_txrx) is called back from
44 the bound "hwmon/lm70" protocol driver through its sysfs hook, using a
45 spi_write_then_read() call.  It performs Mode 0 (SPI/Microwire) bitbanging.
46 The lm70 driver then inteprets the resulting digital temperature value
47 and exports it through sysfs.
49 A "gotcha": National Semiconductor's LM70 LLP eval board circuit schematic
50 shows that the SI/O line from the LM70 chip is connected to the base of a
51 transistor Q1 (and also a pullup, and a zener diode to D7); while the
52 collector is tied to VCC.
54 Interpreting this circuit, when the LM70 SI/O line is High (or tristate
55 and not grounded by the host via D7), the transistor conducts and switches
56 the collector to zero, which is reflected on pin 13 of the DB25 parport
57 connector.  When SI/O is Low (driven by the LM70 or the host) on the other
58 hand, the transistor is cut off and the voltage tied to it's collector is
59 reflected on pin 13 as a High level.
61 So: the getmiso inline routine in this driver takes this fact into account,
62 inverting the value read at pin 13.
65 Thanks to
66 ---------
67 o David Brownell for mentoring the SPI-side driver development.
68 o Dr.Craig Hollabaugh for the (early) "manual" bitbanging driver version.
69 o Nadir Billimoria for help interpreting the circuit schematic.