Commit Graph

17 Commits

Author SHA1 Message Date
Warner Losh
f86e60008b Regularize my copyright notice
o Remove All Rights Reserved from my notices
o imp@FreeBSD.org everywhere
o regularize punctiation, eliminate date ranges
o Make sure that it's clear that I don't claim All Rights reserved by listing
  All Rights Reserved on same line as other copyright holders (but not
  me). Other such holders are also listed last where it's clear.
2019-12-04 16:56:11 +00:00
Ian Lepore
7a038f29d9 Rename IICBUS_FDT_PNPINFO -> IICBUS_FDT_PNP_INFO because all the other
existing pnpinfo-related macros right now use PNP_INFO, not PNPINFO.
2019-05-23 16:03:30 +00:00
Ian Lepore
06cd525fe3 Add pnpinfo for icee(4) on fdt systems. 2019-05-23 15:51:51 +00:00
Ian Lepore
5af4ab6524 Export the eeprom device size via readonly sysctl. Also export the write
page size and address size, although they are likely to be inherently
less-interesting values outside of the driver.
2018-08-13 23:53:11 +00:00
Warner Losh
e4eef18848 Use M. Warner Losh everywhere on my copyrights.
Remove 'All Rights Reserved' where I can.
2018-05-01 16:29:22 +00:00
Pedro F. Giffuni
718cf2ccb9 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 14:52:40 +00:00
Ian Lepore
d18915fadb Give icee(4) a detach() method so it can be used as a module. Add a
module makefile for it.
2017-09-17 22:58:13 +00:00
Ian Lepore
b180eb215d Add FDT compatibility to the icee driver.
The FDT bindings for eeprom parts don't include any metadata about the
device other than the part name encoded in the compatible property.
Instead, a driver is required to have a compiled-in table of information
about the various parts (page size, device capacity, addressing scheme).  So
much for FDT being an abstract description of hardware characteristics, huh?

In addition to the FDT-specific changes, this also switches to using the
newer iicbus_transfer_excl() mechanism which holds bus ownership for the
duration of the transfer.  Previously this code held the bus across all
the transfers needed to complete the user's IO request, which could be
up to 128KB of data which might occupy the bus for 10-20 seconds.  Now the
bus will be released and re-aquired between every page-sized (8-256 byte)
transfer, making this driver a much nicer citizen on the i2c bus.

The hint-based configuration mechanism is still in place for non-FDT systems.

Michal Meloun contributed some of the code for these changes.
2015-10-22 01:04:31 +00:00
Ian Lepore
73440c336d Replace a local sx lock that allowed only one client at a time to access
an eeprom device with iicbus_request/release_bus(), which achieves the
same effect and also keeps other i2c slave drivers from clashing on the bus.
2015-10-10 19:51:00 +00:00
Ian Lepore
b16c6d237b Translate iic hardware layer status values to errno return values. 2015-10-10 02:29:02 +00:00
Ian Lepore
6f279052a2 Style and whitespace cleanups. The only functional change is removal of
a printf that appears to be left over from development debugging.
2015-10-09 21:27:30 +00:00
Sofian Brabez
61bfd86762 Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays
Reviewed by:	cognet
Approved by:	cognet
2013-01-30 18:01:20 +00:00
Nathan Whitehorn
789c4b9d08 Change the way I2C bus attachment works to allow firmware-assisted bus
subclasses as are available with PCI. Changes I2C device drivers without
real probe logic to return BUS_PROBE_NOWILDWARD to avoid interference with
firmware bus enumeration, and reduces the probe priority of the iicbus
base driver to allow subclass attachment at higher priority.

Discussed on:	freebsd-arch
2009-01-06 17:23:37 +00:00
Stanislav Sedov
4bdfea0f50 - Reflect the iicbus infrastructure changes.
Approved by:	raj
2008-08-05 08:38:33 +00:00
John Baldwin
225f9723dc Lock the consumers of the iicbus(4) infrastructure:
- ad7418(4) uses an sx lock instead of a mtx since the iicbus(4) stuff it
  calls can sleep (request_bus()).  Also, I expanded the locking slightly
  to serialize writes to data stored in the softc.
- Similarly, the icee(4) driver now uses an sx lock instead of a mutex.
  I also removed the pointless OPENED flag and flags field from the softc.
- The locking for the ic(4) driver was a bit trickier:
  - Add a mutex to the softc to protect softc data.
  - The driver uses malloc'd buffers that are the size of the interface
    MTU to send and receive packets.  Previously, these were allocated
    every time the interface was brought up and anytime the MTU was
    changed, with various races that could result in memory leaks.  I
    changed this to be a bit simpler and more like other NIC drivers in
    that we allocate buffers during attach for the default MTU size and
    only reallocate them on MTU changes.  The reallocation procedure
    goes to some lengths with various flags to not replace either the
    the receive or transmit buffers while the driver is busy receiving
    or transmitting a packet.
  - Store the device_t of the driver in the softc instead of detours into
    new-bus using if_dunit from the ifnet and an even more bizarre detour
    to get the softc instead of using if_softc.
  - Drop the driver mutex when invoking netisr_dispatch() to pass the
    packet up to IP.
  - Use if_printf().
2008-08-04 21:14:24 +00:00
Warner Losh
1a13e01f7f Don't use spinlocks here. The iicbus transactions can take a long
time, and this prevents interrupts (say for Hz/hardclock) from
happening.  Time stands still during the transfers...
2007-04-17 05:48:35 +00:00
Warner Losh
66c7612a8d New device: icee. Generic i2c eeprom driver. 2007-03-23 23:10:35 +00:00