Skip to content

Commit

Permalink
Merge branch 'i2c/for-4.3' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/wsa/linux

Pull i2c updates from Wolfram Sang:
 "Features:

   - new drivers: Renesas EMEV2, register based MUX, NXP LPC2xxx
   - core: scans DT and assigns wakeup interrupts.  no driver changes needed.
   - core: some refcouting issues fixed and better API for that
   - core: new helper function for best effort block read emulation
   - slave framework: proper DT bindings and userspace instantiation
   - some bigger work for xiic, pxa, omap drivers

  .. and quite a number of smaller driver fixes, cleanups, improvements"

* 'i2c/for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (65 commits)
  i2c: mux: reg Change ioread endianness for readback
  i2c: mux: reg: fix compilation warnings
  i2c: mux: reg: simplify register size checking
  i2c: muxes: fix leaked i2c adapter device node references
  i2c: allow specifying separate wakeup interrupt in device tree
  of/irq: export of_get_irq_byname()
  i2c: xgene-slimpro: dma_mapping_error() doesn't return an error code
  i2c: Replace I2C_CROS_EC_TUNNEL dependency
  eeprom: at24: use i2c_smbus_read_i2c_block_data_or_emulated
  i2c: core: Add support for best effort block read emulation
  i2c: lpc2k: add driver
  i2c: mux: Add register-based mux i2c-mux-reg
  i2c: dt: describe generic bindings
  i2c: slave: print warning if slave flag not set
  i2c: support 10 bit and slave addresses in sysfs 'new_device'
  i2c: take address space into account when checking for used addresses
  i2c: apply DT flags when probing
  i2c: make address check indpendent from client struct
  i2c: rename address check functions
  i2c: apply address offset for slaves, too
  ...
  • Loading branch information
torvalds committed Sep 8, 2015
2 parents c191761 + 5a73882 commit acceba5
Show file tree
Hide file tree
Showing 46 changed files with 2,189 additions and 524 deletions.
6 changes: 5 additions & 1 deletion Documentation/devicetree/bindings/i2c/i2c-cadence.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ Binding for the Cadence I2C controller

Required properties:
- reg: Physical base address and size of the controller's register area.
- compatible: Compatibility string. Must be 'cdns,i2c-r1p10'.
- compatible: Should contain one of:
* "cdns,i2c-r1p10"
Note: Use this when cadence i2c controller version 1.0 is used.
* "cdns,i2c-r1p14"
Note: Use this when cadence i2c controller version 1.4 is used.
- clocks: Input clock specifier. Refer to common clock bindings.
- interrupts: Interrupt specifier. Refer to interrupt bindings.
- #address-cells: Should be 1.
Expand Down
22 changes: 22 additions & 0 deletions Documentation/devicetree/bindings/i2c/i2c-emev2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Device tree configuration for Renesas EMEV2 IIC controller

Required properties:
- compatible : "renesas,iic-emev2"
- reg : address start and address range size of device
- interrupts : specifier for the IIC controller interrupt
- clocks : phandle to the IP core SCLK
- clock-names : must be "sclk"
- #address-cells : should be <1>
- #size-cells : should be <0>

Example:

iic0: i2c@e0070000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "renesas,iic-emev2";
reg = <0xe0070000 0x28>;
interrupts = <0 32 IRQ_TYPE_EDGE_RISING>;
clocks = <&iic0_sclk>;
clock-names = "sclk";
};
33 changes: 33 additions & 0 deletions Documentation/devicetree/bindings/i2c/i2c-lpc2k.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
NXP I2C controller for LPC2xxx/178x/18xx/43xx

Required properties:
- compatible: must be "nxp,lpc1788-i2c"
- reg: physical address and length of the device registers
- interrupts: a single interrupt specifier
- clocks: clock for the device
- #address-cells: should be <1>
- #size-cells: should be <0>

Optional properties:
- clock-frequency: the desired I2C bus clock frequency in Hz; in
absence of this property the default value is used (100 kHz).

Example:
i2c0: i2c@400a1000 {
compatible = "nxp,lpc1788-i2c";
reg = <0x400a1000 0x1000>;
interrupts = <18>;
clocks = <&ccu1 CLK_APB1_I2C0>;
#address-cells = <1>;
#size-cells = <0>;
};

&i2c0 {
clock-frequency = <400000>;

lm75@48 {
compatible = "nxp,lm75";
reg = <0x48>;
};
};

74 changes: 74 additions & 0 deletions Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
Register-based I2C Bus Mux

This binding describes an I2C bus multiplexer that uses a single register
to route the I2C signals.

Required properties:
- compatible: i2c-mux-reg
- i2c-parent: The phandle of the I2C bus that this multiplexer's master-side
port is connected to.
* Standard I2C mux properties. See mux.txt in this directory.
* I2C child bus nodes. See mux.txt in this directory.

Optional properties:
- reg: this pair of <offset size> specifies the register to control the mux.
The <offset size> depends on its parent node. It can be any memory-mapped
address. The size must be either 1, 2, or 4 bytes. If reg is omitted, the
resource of this device will be used.
- little-endian: The existence indicates the register is in little endian.
- big-endian: The existence indicates the register is in big endian.
If both little-endian and big-endian are omitted, the endianness of the
CPU will be used.
- write-only: The existence indicates the register is write-only.
- idle-state: value to set the muxer to when idle. When no value is
given, it defaults to the last value used.

Whenever an access is made to a device on a child bus, the value set
in the revelant node's reg property will be output to the register.

If an idle state is defined, using the idle-state (optional) property,
whenever an access is not being made to a device on a child bus, the
register will be set according to the idle value.

If an idle state is not defined, the most recently used value will be
left programmed into the register.

Example of a mux on PCIe card, the host is a powerpc SoC (big endian):

i2c-mux {
/* the <offset size> depends on the address translation
* of the parent device. If omitted, device resource
* will be used instead. The size is to determine
* whether iowrite32, iowrite16, or iowrite8 will be used.
*/
reg = <0x6028 0x4>;
little-endian; /* little endian register on PCIe */
compatible = "i2c-mux-reg";
#address-cells = <1>;
#size-cells = <0>;
i2c-parent = <&i2c1>;
i2c@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;

si5338: clock-generator@70 {
compatible = "silabs,si5338";
reg = <0x70>;
/* other stuff */
};
};

i2c@1 {
/* data is written using iowrite32 */
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;

si5338: clock-generator@70 {
compatible = "silabs,si5338";
reg = <0x70>;
/* other stuff */
};
};
};
45 changes: 45 additions & 0 deletions Documentation/devicetree/bindings/i2c/i2c.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Generic device tree bindings for I2C busses
===========================================

This document describes generic bindings which can be used to describe I2C
busses in a device tree.

Required properties
-------------------

- #address-cells - should be <1>. Read more about addresses below.
- #size-cells - should be <0>.
- compatible - name of I2C bus controller following generic names
recommended practice.

For other required properties e.g. to describe register sets,
clocks, etc. check the binding documentation of the specific driver.

The cells properties above define that an address of children of an I2C bus
are described by a single value. This is usually a 7 bit address. However,
flags can be attached to the address. I2C_TEN_BIT_ADDRESS is used to mark a 10
bit address. It is needed to avoid the ambiguity between e.g. a 7 bit address
of 0x50 and a 10 bit address of 0x050 which, in theory, can be on the same bus.
Another flag is I2C_OWN_SLAVE_ADDRESS to mark addresses on which we listen to
be devices ourselves.

Optional properties
-------------------

These properties may not be supported by all drivers. However, if a driver
wants to support one of the below features, it should adapt the bindings below.

- clock-frequency - frequency of bus clock in Hz.
- wakeup-source - device can be used as a wakeup source.

- interrupts - interrupts used by the device.
- interrupt-names - "irq" and "wakeup" names are recognized by I2C core,
other names are left to individual drivers.

Binding may contain optional "interrupts" property, describing interrupts
used by the device. I2C core will assign "irq" interrupt (or the very first
interrupt if not using interrupt names) as primary interrupt for the slave.

Also, if device is marked as a wakeup source, I2C core will set up "wakeup"
interrupt for the device. If "wakeup" interrupt name is not present in the
binding, then primary interrupt will be used as wakeup interrupt.
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/i2c/trivial-devices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ stm,m41t00 Serial Access TIMEKEEPER
stm,m41t62 Serial real-time clock (RTC) with alarm
stm,m41t80 M41T80 - SERIAL ACCESS RTC WITH ALARMS
taos,tsl2550 Ambient Light Sensor with SMBUS/Two Wire Serial Interface
ti,ads7828 8-Channels, 12-bit ADC
ti,ads7830 8-Channels, 8-bit ADC
ti,tsc2003 I2C Touch-Screen Controller
ti,tmp102 Low Power Digital Temperature Sensor with SMBUS/Two Wire Serial Interface
ti,tmp103 Low Power Digital Temperature Sensor with SMBUS/Two Wire Serial Interface
Expand Down
1 change: 1 addition & 0 deletions Documentation/i2c/busses/i2c-parport
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ It currently supports the following devices:
* (type=5) Analog Devices evaluation boards: ADM1025, ADM1030, ADM1031
* (type=6) Barco LPT->DVI (K5800236) adapter
* (type=7) One For All JP1 parallel port adapter
* (type=8) VCT-jig

These devices use different pinout configurations, so you have to tell
the driver what you have, using the type module parameter. There is no
Expand Down
9 changes: 6 additions & 3 deletions Documentation/i2c/slave-interface
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ User manual
===========

I2C slave backends behave like standard I2C clients. So, you can instantiate
them as described in the document 'instantiating-devices'. A quick example for
instantiating the slave-eeprom driver from userspace at address 0x64 on bus 1:
them as described in the document 'instantiating-devices'. The only difference
is that i2c slave backends have their own address space. So, you have to add
0x1000 to the address you would originally request. An example for
instantiating the slave-eeprom driver from userspace at the 7 bit address 0x64
on bus 1:

# echo slave-24c02 0x64 > /sys/bus/i2c/devices/i2c-1/new_device
# echo slave-24c02 0x1064 > /sys/bus/i2c/devices/i2c-1/new_device

Each backend should come with separate documentation to describe its specific
behaviour and setup.
Expand Down
4 changes: 4 additions & 0 deletions Documentation/i2c/ten-bit-addresses
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ The I2C protocol knows about two kinds of device addresses: normal 7 bit
addresses, and an extended set of 10 bit addresses. The sets of addresses
do not intersect: the 7 bit address 0x10 is not the same as the 10 bit
address 0x10 (though a single device could respond to both of them).
To avoid ambiguity, the user sees 10 bit addresses mapped to a different
address space, namely 0xa000-0xa3ff. The leading 0xa (= 10) represents the
10 bit mode. This is used for creating device names in sysfs. It is also
needed when instantiating 10 bit devices via the new_device file in sysfs.

I2C messages to and from 10-bit address devices have a different format.
See the I2C specification for the details.
Expand Down
6 changes: 6 additions & 0 deletions drivers/clk/shmobile/clk-emev2.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#define USIBU1_RSTCTRL 0x0ac
#define USIBU2_RSTCTRL 0x0b0
#define USIBU3_RSTCTRL 0x0b4
#define IIC0_RSTCTRL 0x0dc
#define IIC1_RSTCTRL 0x0e0
#define STI_RSTCTRL 0x124
#define STI_CLKSEL 0x688

Expand Down Expand Up @@ -66,6 +68,10 @@ static void __init emev2_smu_init(void)
emev2_smu_write(2, USIBU1_RSTCTRL);
emev2_smu_write(2, USIBU2_RSTCTRL);
emev2_smu_write(2, USIBU3_RSTCTRL);

/* deassert reset for IIC0->IIC1 */
emev2_smu_write(1, IIC0_RSTCTRL);
emev2_smu_write(1, IIC1_RSTCTRL);
}

static void __init emev2_smu_clkdiv_init(struct device_node *np)
Expand Down
19 changes: 18 additions & 1 deletion drivers/i2c/busses/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,13 @@ config I2C_EG20T
ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series.
ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH.

config I2C_EMEV2
tristate "EMMA Mobile series I2C adapter"
depends on HAVE_CLK
help
If you say yes to this option, support will be included for the
I2C interface on the Renesas Electronics EM/EV family of processors.

config I2C_EXYNOS5
tristate "Exynos5 high-speed I2C driver"
depends on ARCH_EXYNOS && OF
Expand Down Expand Up @@ -612,6 +619,16 @@ config I2C_KEMPLD
This driver can also be built as a module. If so, the module
will be called i2c-kempld.

config I2C_LPC2K
tristate "I2C bus support for NXP LPC2K/LPC178x/18xx/43xx"
depends on OF && (ARCH_LPC18XX || COMPILE_TEST)
help
This driver supports the I2C interface found several NXP
devices including LPC2xxx, LPC178x/7x and LPC18xx/43xx.

This driver can also be built as a module. If so, the module
will be called i2c-lpc2k.

config I2C_MESON
tristate "Amlogic Meson I2C controller"
depends on ARCH_MESON
Expand Down Expand Up @@ -1123,7 +1140,7 @@ config I2C_SIBYTE

config I2C_CROS_EC_TUNNEL
tristate "ChromeOS EC tunnel I2C bus"
depends on CROS_EC_PROTO
depends on MFD_CROS_EC
help
If you say yes here you get an I2C bus that will tunnel i2c commands
through to the other side of the ChromeOS EC to the i2c bus
Expand Down
2 changes: 2 additions & 0 deletions drivers/i2c/busses/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ i2c-designware-pci-objs := i2c-designware-pcidrv.o
obj-$(CONFIG_I2C_DIGICOLOR) += i2c-digicolor.o
obj-$(CONFIG_I2C_EFM32) += i2c-efm32.o
obj-$(CONFIG_I2C_EG20T) += i2c-eg20t.o
obj-$(CONFIG_I2C_EMEV2) += i2c-emev2.o
obj-$(CONFIG_I2C_EXYNOS5) += i2c-exynos5.o
obj-$(CONFIG_I2C_GPIO) += i2c-gpio.o
obj-$(CONFIG_I2C_HIGHLANDER) += i2c-highlander.o
Expand All @@ -58,6 +59,7 @@ obj-$(CONFIG_I2C_IMX) += i2c-imx.o
obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o
obj-$(CONFIG_I2C_JZ4780) += i2c-jz4780.o
obj-$(CONFIG_I2C_KEMPLD) += i2c-kempld.o
obj-$(CONFIG_I2C_LPC2K) += i2c-lpc2k.o
obj-$(CONFIG_I2C_MESON) += i2c-meson.o
obj-$(CONFIG_I2C_MPC) += i2c-mpc.o
obj-$(CONFIG_I2C_MT65XX) += i2c-mt65xx.o
Expand Down
Loading

0 comments on commit acceba5

Please sign in to comment.