John Crispin wrote: > Hi Tobias, > > i have been working on an update to ramips the last weeks, which > bumps the kernel tot the upstream OF enabled one. This update will > superseed your patch. we are currently not merging any patches based > on the old code pattern.
Awesome. Device trees are a nice step forward from specific mach-files I think. :) > i will try to make an image for you to test using a devicetree with > the i2c-gpio driver enabled and i2c-tools added if that is ok. Sure, thanks. Ideally you could add the INA2XX module, since that is what I have hooked up on the bus. > On 01/04/13 00:59, Tobias Diedrich wrote: > >Add I2C gpio platform data. > > > >This is useful for the Carambola dev board (and maybe others if they > >use I2C). > > > >Signed-off-by: Tobias Diedrich<ranma+open...@tdiedrich.de> > > > >Index: a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c > >=================================================================== > >--- b/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c > >2013-03-31 23:21:42.992809485 +0200 > >+++ a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c > >2013-03-31 23:21:50.142819472 +0200 > >@@ -12,6 +12,7 @@ > > #include<linux/platform_device.h> > > #include<linux/err.h> > > #include<linux/clk.h> > >+#include<linux/i2c-gpio.h> > > #include<linux/mtd/mtd.h> > > #include<linux/mtd/physmap.h> > > #include<linux/spi/spi.h> > >@@ -260,6 +261,33 @@ > > platform_device_register(&rt305x_wdt_device); > > } > > > >+static struct i2c_gpio_platform_data rt305x_i2c_pdata = { > >+ .sda_pin = RT305X_GPIO_I2C_SD, > >+ .scl_pin = RT305X_GPIO_I2C_SCLK, > >+ .sda_is_open_drain = 0, > >+ .scl_is_open_drain = 0, > >+ .udelay = 10, > >+}; > >+ > >+static struct platform_device rt305x_i2c_device = { > >+ .name = "i2c-gpio", > >+ .id = 0, > >+ .dev = { > >+ .platform_data =&rt305x_i2c_pdata, > >+ }, > >+}; > >+ > >+void __init rt305x_register_i2c(void) > >+{ > >+ /* > >+ * There is even a dedicated i2c controller block, but it is probably > >+ * not worth implementing support for the minimal speed gain. > >+ * Just use the generic linux bitbanging and register the necessary > >+ * platform data for the default I2C pin mapping the HW would use. > >+ */ > >+ platform_device_register(&rt305x_i2c_device); > >+} > >+ > > static struct resource rt305x_spi_resources[] = { > > { > > .flags = IORESOURCE_MEM, > >Index: a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h > >=================================================================== > >--- b/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h > >2013-03-31 23:21:42.992809485 +0200 > >+++ a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h > >2013-03-31 23:21:42.982809471 +0200 > >@@ -23,6 +23,7 @@ > > > > void rt305x_register_flash(unsigned int id); > > void rt305x_register_ethernet(void); > >+void rt305x_register_i2c(void); > > void rt305x_register_wifi(void); > > void rt305x_register_wdt(void); > > void rt305x_register_spi(struct spi_board_info *info, int n); > >Index: a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-carambola.c > >=================================================================== > >--- b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-carambola.c > >2013-03-31 23:21:42.992809485 +0200 > >+++ a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-carambola.c > >2013-03-31 23:21:42.982809471 +0200 > >@@ -36,6 +36,7 @@ > > rt305x_register_wifi(); > > rt305x_register_wdt(); > > rt305x_register_usb(); > >+ rt305x_register_i2c(); /* platform data for i2c-gpio */ > > } > > > > MIPS_MACHINE(RAMIPS_MACH_CARAMBOLA, "CARAMBOLA", "8devices Carambola", > > > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel > -- Tobias PGP: http://8ef7ddba.uguu.de _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel