Commit Graph

12 Commits

Author SHA1 Message Date
Oleksandr Tymoshenko
b3e8ee5d05 [ig4] Add support for i2c controllers on Skylake and Kaby Lake
This was tested by Ben on  HP Chromebook 13 G1 with a
Skylake CPU and Sunrise Point-LP I2C controller and by me on
Minnowboard Turbot with Atom E3826 (formerly Bay Trail)

Submitted by:	Ben Pye <ben@curlybracket.co.uk>
Reviewed by:	gonzo
Obtained from:	DragonflyBSD (a4549657 by Imre Vadász)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D13654
2018-03-06 23:39:43 +00:00
Oleksandr Tymoshenko
5c5bcb1d70 [ig4] Add ACPI platform support for ig4 driver
Add ACPI part for ig4 driver to make it work on Intel BayTrail SoC where
ig4 device is available only through ACPI

Reviewed by:	avg
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8742
2016-12-26 22:13:43 +00:00
Conrad Meyer
00eb880d20 Add Braswell PCI IDs for Intel Cherryview
Submitted by:	Johannes Lundberg <yohanesu75 at gmail.com>
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D8861
2016-12-20 22:08:36 +00:00
Andriy Gapon
eb6befba30 fix typo in a comment
MFC after:	5 weeks
X-MFC with:	r308219
2016-11-02 17:12:15 +00:00
Andriy Gapon
e3d255499a ichiic/ig4: completely disengage from smbus
MFC after:	5 weeks
2016-11-02 17:04:00 +00:00
Andriy Gapon
448897d366 add iic interface to ig4 driver, move isl and cyapa to iicbus
Summary:
The hardware does not expose a classic SMBus interface.
Instead it has a lower level interface that can express a far richer
I2C protocol than what smbus offers.  However, the interface does not
provide a way to explicitly generate the I2C stop and start conditions.
It's only possible to request that the stop condition is generated
after transferring the next byte in either direction.  So, at least
one data byte must always be transferred.
Thus, some I2C sequences are impossible to generate, e.g., an equivalent
of smbus quick command (<start>-<slave addr>-<r/w bit>-<stop>).

At the same time isl(4) and cyapa(4) are moved to iicbus and now they use
iicbus_transfer for communication.  Previously they used smbus_trans()
interface that is not defined by the SMBus protocol and was implemented
only by ig4(4).  In fact, that interface was impossible to implement
for the typical SMBus controllers like intpm(4) or ichsmb(4) where
a type of the SMBus command must be programmed.

The plan is to remove smbus_trans() and all its uses.
As an aside, the smbus_trans() method deviates from the standard,
but perhaps backwards, FreeBSD convention of using 8-bit slave
addresses (shifted by 1 bit to the left).  The method expects
7-bit addresses.

There is a user facing consequence of this change.
A user must now provide device hints for isl and cyapa that specify an iicbus to use
and a slave address on it.
On Chromebook hardware where isl and cyapa devices are commonly found
it is also possible to use a new chromebook_platform(4) driver that
automatically configures isl and cyapa devices.  There is no need to
provide the device hints in that case,

Right now smbus(4) driver tries to discover all slaves on the bus.
That is very dangerous.  Fortunately, the probing code uses smbus_trans()
to do its job, so it is really enabled for ig4 only.
The plan is to remove that auto-probing code and smbus_trans().

Tested by:	grembo, Matthias Apitz <guru@unixarea.de> (w/o
		chromebook_platform)
Discussed with:	grembo, imp
Reviewed by:	wblock (docs)
MFC after:	1 month
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D8172
2016-10-30 12:15:33 +00:00
Michael Gmelin
0ba5622d8c Fix ig4 operation for certain machines
Some machine BIOSes use the I2C bus and leave it in a state that causes
interrupts to not work properly due to a pending interrupt having been
latched.

Refactor the code a bit to clear pending interrupts when I2C is enabled.
This fixes the primary problem.

Also fix a possible race condition in the interrupt handler where the
interrupt was being cleared after reading the status instead of before.

Reported by:	pfg
Reviewed by:	jhb
Approved by:	jhb
Obtained from:	DragonFly BSD
Differential Revision:	https://reviews.freebsd.org/D6586
2016-05-30 09:05:24 +00:00
Pedro F. Giffuni
453130d9bf sys/dev: minor spelling fixes.
Most affect comments, very few have user-visible effects.
2016-05-03 03:41:25 +00:00
John Baldwin
59e4a8cd1c Use DELAY() instead of sleeping during boot-time attach.
Tested by:	Wolfgang Zenker <wolfgang@lyxys.ka.sub.org>
2016-04-09 20:18:34 +00:00
Michael Gmelin
12e413be27 Allow building a kernel with baked in ig4, isl and cyapa drivers.
Also addresses jhb's remarks on D2811 and D3068.

PR:		202059
Differential Revision:	https://reviews.freebsd.org/D3351
Reviewed by:	jhb
Approved by:	jhb
2015-08-19 09:49:29 +00:00
Michael Gmelin
4cd6abddcd Protect smbus ioctls in ig4 driver using a shared lock.
Document locking semantics.

Differential Revision:	https://reviews.freebsd.org/D2744
Reviewed by:	jah, kib
Approved by:	kib
2015-06-25 07:52:51 +00:00
Michael Gmelin
71d51719ea ig4 - Intel fourth gen integrated I2C SMBus driver.
Differential Revision:	https://reviews.freebsd.org/D2372
Reviewed by:	jhb, wblock, adrian
Approved by:	jhb, wblock
Relnotes:	yes
2015-05-30 12:17:18 +00:00