2019-07-31 20:08:50 +00:00
|
|
|
==============================================
|
2007-07-17 11:04:05 +00:00
|
|
|
spi_lm70llp : LM70-LLP parport-to-SPI adapter
|
|
|
|
==============================================
|
|
|
|
|
|
|
|
Supported board/chip:
|
2019-07-31 20:08:50 +00:00
|
|
|
|
2007-07-17 11:04:05 +00:00
|
|
|
* National Semiconductor LM70 LLP evaluation board
|
2019-07-31 20:08:50 +00:00
|
|
|
|
2024-03-18 15:38:34 +00:00
|
|
|
Datasheet: https://www.ti.com/lit/gpn/lm70
|
2007-07-17 11:04:05 +00:00
|
|
|
|
|
|
|
Author:
|
|
|
|
Kaiwan N Billimoria <kaiwan@designergraphix.com>
|
|
|
|
|
|
|
|
Description
|
|
|
|
-----------
|
|
|
|
This driver provides glue code connecting a National Semiconductor LM70 LLP
|
|
|
|
temperature sensor evaluation board to the kernel's SPI core subsystem.
|
|
|
|
|
2009-01-07 15:37:34 +00:00
|
|
|
This is a SPI master controller driver. It can be used in conjunction with
|
|
|
|
(layered under) the LM70 logical driver (a "SPI protocol driver").
|
2007-07-17 11:04:05 +00:00
|
|
|
In effect, this driver turns the parallel port interface on the eval board
|
|
|
|
into a SPI bus with a single device, which will be driven by the generic
|
|
|
|
LM70 driver (drivers/hwmon/lm70.c).
|
|
|
|
|
2009-01-07 15:37:34 +00:00
|
|
|
|
|
|
|
Hardware Interfacing
|
|
|
|
--------------------
|
|
|
|
The schematic for this particular board (the LM70EVAL-LLP) is
|
|
|
|
available (on page 4) here:
|
|
|
|
|
2024-03-18 15:38:34 +00:00
|
|
|
https://download.datasheets.com/pdfs/documentation/nat/kit&board/lm70llpevalmanual.pdf
|
2009-01-07 15:37:34 +00:00
|
|
|
|
2007-07-17 11:04:05 +00:00
|
|
|
The hardware interfacing on the LM70 LLP eval board is as follows:
|
|
|
|
|
2019-07-31 20:08:50 +00:00
|
|
|
======== == ========= ==========
|
2007-07-17 11:04:05 +00:00
|
|
|
Parallel LM70 LLP
|
2019-07-31 20:08:50 +00:00
|
|
|
Port . Direction JP2 Header
|
|
|
|
======== == ========= ==========
|
2007-07-17 11:04:05 +00:00
|
|
|
D0 2 - -
|
|
|
|
D1 3 --> V+ 5
|
|
|
|
D2 4 --> V+ 5
|
|
|
|
D3 5 --> V+ 5
|
|
|
|
D4 6 --> V+ 5
|
|
|
|
D5 7 --> nCS 8
|
|
|
|
D6 8 --> SCLK 3
|
|
|
|
D7 9 --> SI/O 5
|
|
|
|
GND 25 - GND 7
|
|
|
|
Select 13 <-- SI/O 1
|
2019-07-31 20:08:50 +00:00
|
|
|
======== == ========= ==========
|
2007-07-17 11:04:05 +00:00
|
|
|
|
|
|
|
Note that since the LM70 uses a "3-wire" variant of SPI, the SI/SO pin
|
|
|
|
is connected to both pin D7 (as Master Out) and Select (as Master In)
|
2011-03-31 01:57:33 +00:00
|
|
|
using an arrangement that lets either the parport or the LM70 pull the
|
2007-07-17 11:04:05 +00:00
|
|
|
pin low. This can't be shared with true SPI devices, but other 3-wire
|
|
|
|
devices might share the same SI/SO pin.
|
|
|
|
|
|
|
|
The bitbanger routine in this driver (lm70_txrx) is called back from
|
|
|
|
the bound "hwmon/lm70" protocol driver through its sysfs hook, using a
|
|
|
|
spi_write_then_read() call. It performs Mode 0 (SPI/Microwire) bitbanging.
|
2023-01-27 06:39:57 +00:00
|
|
|
The lm70 driver then interprets the resulting digital temperature value
|
2007-07-17 11:04:05 +00:00
|
|
|
and exports it through sysfs.
|
|
|
|
|
|
|
|
A "gotcha": National Semiconductor's LM70 LLP eval board circuit schematic
|
|
|
|
shows that the SI/O line from the LM70 chip is connected to the base of a
|
|
|
|
transistor Q1 (and also a pullup, and a zener diode to D7); while the
|
|
|
|
collector is tied to VCC.
|
|
|
|
|
|
|
|
Interpreting this circuit, when the LM70 SI/O line is High (or tristate
|
|
|
|
and not grounded by the host via D7), the transistor conducts and switches
|
|
|
|
the collector to zero, which is reflected on pin 13 of the DB25 parport
|
|
|
|
connector. When SI/O is Low (driven by the LM70 or the host) on the other
|
2023-08-14 21:28:22 +00:00
|
|
|
hand, the transistor is cut off and the voltage tied to its collector is
|
2007-07-17 11:04:05 +00:00
|
|
|
reflected on pin 13 as a High level.
|
|
|
|
|
|
|
|
So: the getmiso inline routine in this driver takes this fact into account,
|
|
|
|
inverting the value read at pin 13.
|
|
|
|
|
|
|
|
|
|
|
|
Thanks to
|
|
|
|
---------
|
2019-07-31 20:08:50 +00:00
|
|
|
|
|
|
|
- David Brownell for mentoring the SPI-side driver development.
|
|
|
|
- Dr.Craig Hollabaugh for the (early) "manual" bitbanging driver version.
|
|
|
|
- Nadir Billimoria for help interpreting the circuit schematic.
|