Skip to content

RFC Handle I2C GPIO controllers with the OF (was: pca9539 I2C gpio expander)

Anton Vorontsov linux-i2c linuxppc-dev lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest7 patches 35 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7powerpc and sparc: introduce dev_archdata node accessorsarch/powerpc/include/asm/device.h arch/sparc/include/asm/device.h+24 -02 replies
2/7i2c: add info->archdata fielddrivers/i2c/i2c-core.c include/linux/i2c.h+5 -07 replies
3/7of: fill the archdata for I2C devicesdrivers/of/of_i2c.c+11 -01 reply
4/7gpiolib: implement dev_gpiochip_{add,remove} callsinclude/asm-generic/gpio.h+44 -031 replies
5/7of/gpio: implement of_dev_gpiochip_{add,remove} callsarch/powerpc/include/asm/gpio.h drivers/of/gpio.c include/linux/of_gpio.h+86 -32 replies
6/7gpio/pca953x: convert to dev_gpiochip_add and make it work with the OFdrivers/gpio/pca953x.c+13 -110 replies
7/7i2c/mcu_mpc8349emitx: convert to the new I2C/OF/GPIO infrastructuredrivers/i2c/chips/mcu_mpc8349emitx.c+12 -530 replies

Reviews trailers per patch

3 of 7 patches have a Reviewed-by or Acked-by.

PatchDavid S. MillerGrant LikelyJean Delvare
1/7A-b A-b
2/7A-b
3/7A-b
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 0/7 RFC] Handle I2C GPIO controllers with the OF (was: pca9539 I2C gpio expander)

Hi all,

Recently there was a question about I2C GPIO controllers and how should we handle them with the OpenFirmware and such.

Here is the attempt to "connect" I2C GPIO controllers to the "OpenFirmware" device tree, without writing an OF-specific bindings for each driver.

The salt is in these two patches:

[PATCH 3/7] of: fill the archdata for I2C devices
^ Here we're storing the device tree node into the I2C device.

[PATCH 5/7] of/gpio: implement of_dev_gpiochip_{add,remove} calls ^ And here we extracting the the stored node to put the registered
of_gpio_chip into that node.

How does it look?

p.s. The original question:

----- Forwarded message from "Steven A. Falco" <[email protected]> -----

Date: Tue, 14 Oct 2008 14:10:25 -0400
From: "Steven A. Falco" <[email protected]>
To: "[email protected]" <[email protected]>
Subject: pca9539 I2C gpio expander
List-Id: Linux on PowerPC Developers Mail List <linuxppc-dev.ozlabs.org>

I am attempting to use a pca9539 I2C gpio driver on a PPC440EPx board. The driver is "drivers/gpio/pca953x.c". I've added an entry to the .dts file:

IIC0: i2c@ef600700 {
	compatible = "ibm,iic-440epx", "ibm,iic";
	...
	pca9539@76 {
		compatible = "ti,pca9539";
		reg = <76>;
	};
};

of_register_i2c_devices sees this entry and calls i2c_new_device. i2c_new_device copies info->platform_data to client->dev.platform_data, but I think that this structure is empty (at least I don't see where of_register_i2c_devices would set it).

pca953x_probe is eventually called, but it expects to find its "lowest gpio number" in client->dev.platform_data->gpio_base, which has not been set. So pca953x_probe returns -ENODEV.

I don't understand where the disconnect is. Should I be able to use the pca953x.c driver, or is it somehow incompatible?

If it is incompatible, is there a strategy for making it compatible?

Steve
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

----- End forwarded message -----