Skip to contentSkip to conversation

pca9539 I2C gpio expander

DISCUSSION Steven A. Falco 2 participants 2 messages Oct 14, 2008

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 12 lines · Steven A. Falco

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>;
	};
};
Quoted 4 lines

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).

Currently there is no way to pass platform_data to I2C devices (using device tree, that is). This is known limitation.

Quoted 8 lines

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?

We should write OF bindings for that driver. Unfortunately this isn't easy for I2C devices, since they don't (and probably should not) know anything about OF...

I have some ideas on how to teach all the I2C GPIO drivers about the OF (without actually showing them any OF details). I'll post it soon.

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2