1422d05daSIan Lepore.\"- 2422d05daSIan Lepore.\" SPDX-License-Identifier: BSD-2-Clause 3422d05daSIan Lepore.\" 4422d05daSIan Lepore.\" Copyright (c) 2019 Ian Lepore <ian@freebsd.org> 5422d05daSIan Lepore.\" 6422d05daSIan Lepore.\" Redistribution and use in source and binary forms, with or without 7422d05daSIan Lepore.\" modification, are permitted provided that the following conditions 8422d05daSIan Lepore.\" are met: 9422d05daSIan Lepore.\" 1. Redistributions of source code must retain the above copyright 10422d05daSIan Lepore.\" notice, this list of conditions and the following disclaimer. 11422d05daSIan Lepore.\" 2. Redistributions in binary form must reproduce the above copyright 12422d05daSIan Lepore.\" notice, this list of conditions and the following disclaimer in the 13422d05daSIan Lepore.\" documentation and/or other materials provided with the distribution. 14422d05daSIan Lepore.\" 15422d05daSIan Lepore.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16422d05daSIan Lepore.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17422d05daSIan Lepore.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18422d05daSIan Lepore.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19422d05daSIan Lepore.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20422d05daSIan Lepore.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21422d05daSIan Lepore.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22422d05daSIan Lepore.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23422d05daSIan Lepore.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24422d05daSIan Lepore.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25422d05daSIan Lepore.\" SUCH DAMAGE. 26422d05daSIan Lepore.\" 27422d05daSIan Lepore.Dd January 1, 2020 28422d05daSIan Lepore.Dt IICMUX 4 29422d05daSIan Lepore.Os 30422d05daSIan Lepore.Sh NAME 31422d05daSIan Lepore.Nm iicmux 32422d05daSIan Lepore.Nd I2C bus mulitiplexer framework 33422d05daSIan Lepore.Sh SYNOPSIS 34422d05daSIan LeporeTo compile this driver into the kernel, 35422d05daSIan Leporeplace the following line in your 36422d05daSIan Leporekernel configuration file: 37422d05daSIan Lepore.Bd -ragged -offset indent 38422d05daSIan Lepore.Cd "device iicmux" 39422d05daSIan Lepore.Ed 40422d05daSIan Lepore.Pp 41422d05daSIan LeporeAlternatively, to load the driver as a 42422d05daSIan Leporemodule at boot time, place the following line in 43422d05daSIan Lepore.Xr loader.conf 5 : 44422d05daSIan Lepore.Bd -literal -offset indent 45422d05daSIan Leporeiicmux_load="YES" 46422d05daSIan Lepore.Ed 47422d05daSIan Lepore.Pp 48422d05daSIan LeporeNote that it is usually not necessary to explicitly load the 49422d05daSIan Leporedriver module, as it will be loaded automatically along with 50422d05daSIan Leporethe driver for the specific mux hardware in use. 51422d05daSIan Lepore.Sh DESCRIPTION 52422d05daSIan LeporeThe 53422d05daSIan Lepore.Nm 54422d05daSIan Leporeframework provides support code to help implement drivers for various 55422d05daSIan LeporeI2C bus multiplexer (mux) hardware. 56422d05daSIan Lepore.Nm 57422d05daSIan Leporeis not a standalone driver, 58422d05daSIan Leporeit is a collection of support functions and driver methods which are 59422d05daSIan Leporeused by individual mux hardware drivers. 60422d05daSIan LeporeIt will be loaded automatically when needed by a mux hardware driver. 61422d05daSIan LeporeThis manual page provides an overview of the I2C mux framework and its 62422d05daSIan Leporebehavior. 63422d05daSIan Lepore.Pp 64422d05daSIan LeporeGenerally speaking, an I2C mux is connected to an upstream I2C bus, and to 65422d05daSIan Leporeone or more downstream I2C buses, and it can be commanded to connect 66422d05daSIan Leporeany one of the downstream buses to the upstream bus. 67422d05daSIan LeporeSome hardware may be able to connect multiple downstream buses at the 68422d05daSIan Leporesame time, but that concept is not supported by 69422d05daSIan Lepore.Nm . 70422d05daSIan Lepore.Pp 71422d05daSIan LeporeThe 72422d05daSIan Lepore.Nm 73422d05daSIan Leporeframework operates automatically when I2C slave devices initiate I/O. 74422d05daSIan LeporeIt does not require (or even allow for) any external control to select 75422d05daSIan Leporethe active downstream bus. 76422d05daSIan Lepore.Pp 77422d05daSIan LeporeWhen there is no I/O in progress, the mux is said to be in the 78422d05daSIan Lepore.Dq idle 79422d05daSIan Leporestate. 80422d05daSIan LeporeSome mux hardware has the ability to disconnect all downstream buses 81422d05daSIan Leporewhen in an idle state. 82422d05daSIan LeporeOther hardware must always have one of the downstream buses connected. 83422d05daSIan LeporeIndividual mux hardware drivers typically provide a way to select which 84422d05daSIan Leporedownstream bus (if any) should be connected while in the idle state. 85422d05daSIan LeporeIn the absence of such configuration, whichever downstream bus was 86422d05daSIan Leporelast used remains connected to the upstream bus. 87422d05daSIan Lepore.Pp 88422d05daSIan LeporeWhen an I2C slave device on a bus downstream of a mux initiates I/O, 89422d05daSIan Leporeit first requests exclusive use of the bus by calling 90422d05daSIan Lepore.Fn iicbus_request_bus . 91422d05daSIan LeporeThis request is communicated to the bus's parent, which is the 92422d05daSIan Lepore.Nm 93422d05daSIan Leporeframework 94422d05daSIan Leporemux driver. 95422d05daSIan LeporeOnce exclusive bus ownership is obtained, the mux driver 96422d05daSIan Leporeconnects the upstream I2C bus to the downstream bus which hosts the 97422d05daSIan Leporeslave device that requested bus ownership. 98422d05daSIan LeporeThe mux hardware maintains that upstream-to-downstream connection until 99422d05daSIan Leporethe slave device calls 100422d05daSIan Lepore.Fn iicbus_release_bus . 101422d05daSIan LeporeBefore releasing ownership, the mux driver returns the mux hardware to 102422d05daSIan Leporethe idle state. 103422d05daSIan Lepore.Sh FDT CONFIGURATION 104422d05daSIan LeporeOn an 105422d05daSIan Lepore.Xr fdt 4 106422d05daSIan Leporebased system, an I2C mux device node is defined as a child node of its 107422d05daSIan Leporeupstream I2C bus when the mux device is an I2C slave itself. 108422d05daSIan LeporeIt may be defined as a child node of any other bus or device in the 109422d05daSIan Leporesystem when it is not an I2C slave, in which case the 110422d05daSIan Lepore.Va i2c-parent 111422d05daSIan Leporeproperty indicates which upstream bus the mux is attached to. 112422d05daSIan LeporeIn either case, the children of the mux node are additional I2C buses, which 113422d05daSIan Leporewill have one or more I2C slave devices described in their child nodes. 114422d05daSIan Lepore.Pp 115422d05daSIan LeporeDrivers using the 116422d05daSIan Lepore.Nm 117422d05daSIan Leporeframework conform to the standard 118422d05daSIan Lepore.Bk -words 119422d05daSIan Lepore.Li i2c/i2c-mux.txt 120422d05daSIan Lepore.Ek 121422d05daSIan Leporebindings document. 122422d05daSIan Lepore.Sh HINTS CONFIGURATION 123422d05daSIan LeporeOn a 124422d05daSIan Lepore.Xr device.hints 5 125422d05daSIan Leporebased system, these values are configurable for 126422d05daSIan Lepore.Nm 127422d05daSIan Leporeframework drivers : 128422d05daSIan Lepore.Bl -tag -width indent 129422d05daSIan Lepore.It Va hint.<driver>.<unit>.at 130422d05daSIan LeporeThe upstream 131422d05daSIan Lepore.Xr iicbus 4 132422d05daSIan Leporethe 133422d05daSIan Lepore.Nm 134422d05daSIan Leporeinstance is attached to. 135422d05daSIan Lepore.El 136422d05daSIan Lepore.Pp 137422d05daSIan LeporeWhen configured via hints, the driver automatically adds an iicbus 138422d05daSIan Leporeinstance for every downstream bus supported by the chip. 139422d05daSIan LeporeThere is currently no way to indicate used versus unused downstream buses. 140422d05daSIan Lepore.Sh SEE ALSO 141*d458747eSChristian Brueffer.Xr iicbus 4 142422d05daSIan Lepore.Sh HISTORY 143422d05daSIan LeporeThe 144422d05daSIan Lepore.Nm 145422d05daSIan Leporeframework first appeared in 146422d05daSIan Lepore.Fx 13.0 . 147