<snip> > > You could do the same thing to the U-Boot pca953x driver. > > Eg at the top you could add: > > #ifdef CONFIG_PCA953X_16BIT > > #define NGPIO = 16 > > #else > > #define NGPIO = 8 > > #endif > > I have a small problem with this due to the fact that we have some > designs here that use a pca9534 and a pca9539. Having a compile-time > conditional like this means you can only support one or the other. > Linux can handle this because it's actually got a structure that > contains the 8 vs 16 whereas u-boot only has the address an no other > information. Any suggestions on handling this would be welcome.
Some ideas: - Do a series of byte reads and determine the number of GPIOs based on mirroring of registers, or reads failing if they are past the "end" of the device. eg reading register 4 on a 8-bit device might fail, or wrap around and return the same data as register 0. - Make CONFIG_PCA953X_16BIT an array that lists which I2C address support 16 bits, then use it to determine which devices are 8 vs 16 bits dynamically. - Convert the driver to be more intelligent. eg add an interface like pca953x_add_dev(u8 addr, u8 bits) which each board calls to add a device to a list of devices maintained by the pca953x driver. Eg in my board code I'd do: pca953x_add_dev(0x18, 8); pca953x_add_dev(0x1c, 8); pca953x_add_dev(0x1e, 8); pca953x_add_dev(0x1f, 8); Best, Peter _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot