]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
Xilinx: ARM: I2C: Updated to support sub-devices in device tree
authorJohn Linn <john.linn@xilinx.com>
Tue, 28 Jun 2011 20:57:57 +0000 (14:57 -0600)
committerJohn Linn <john.linn@xilinx.com>
Tue, 28 Jun 2011 20:59:26 +0000 (14:59 -0600)
This allows the i2c eeproms and rtc to be moved into the
device tree so it is a more complete solution.

arch/arm/mach-xilinx/xilinx.c
arch/arm/mach-xilinx/xilinx.dts
drivers/i2c/busses/i2c-xilinx_ps.c

index c32ea61579e4ef43c9a8cb0bc8d01c505b8ee58e..ac5efdefd46e67993a2abd78d7a3c2ab41ecc08a 100644 (file)
@@ -79,6 +79,8 @@ void __iomem *xsram_base;
 /* The 1st I2C bus has an eeprom and a real time clock on
    it.
 */
+#ifndef CONFIG_OF
+
 static struct i2c_board_info i2c_devs_0[] __initdata = {
        {
                I2C_BOARD_INFO("24c02", 0x50),
@@ -95,7 +97,7 @@ static struct i2c_board_info i2c_devs_1[] __initdata = {
                I2C_BOARD_INFO("24c02", 0x55),
        },
 };
-
+#endif
 
 #ifndef CONFIG_SPI_SPIDEV
 
@@ -232,8 +234,10 @@ static void __init board_init(void)
        l2x0_init(l2cache_base, 0x02060000, 0xF0F0FFFF);
 #endif
 
+#ifndef CONFIG_OF
        i2c_register_board_info(0, i2c_devs_0, ARRAY_SIZE(i2c_devs_0));
        i2c_register_board_info(1, i2c_devs_1, ARRAY_SIZE(i2c_devs_1));
+#endif
 
 #ifndef CONFIG_SPI_SPIDEV
        spi_register_board_info(spi_devs,
index 7eec43ebc9495aa4668fed67a1f8ae829cb8c4f9..95dcd9883e5d62cbca7c07f43014200cbaebb719 100755 (executable)
                        bus-id = <0>;
                        input-clk = <50000000>;
                        i2c-clk = <100000>;
+                       
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       m24c02_eeprom@50 {
+                               compatible = "at,24c02";
+                               reg = <0x50>;
+                       };
+
+                       rtc8564@51 {
+                               compatible = "rtc8564";
+                               reg = <0x51>;
+                       };
                };
 
                i2c1: i2c@e0005000 {
                        bus-id = <1>;
                        input-clk = <50000000>;
                        i2c-clk = <100000>;
+
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       m24c02_eeprom@55 {
+                               compatible = "at,24c02";
+                               reg = <0x55>;
+                       };
                };
 
                gpio0: gpio@e000a000 {
index f0cfc775bbf983a56741f71de4c064592169b2e2..a6c5080930aa859bd7cff5ae7db98eed63287e4e 100755 (executable)
@@ -45,6 +45,7 @@
 #include <linux/xilinx_devices.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
+#include <linux/of_i2c.h>
 
 /*
  * Register Map
@@ -611,6 +612,7 @@ static int __devinit xi2cps_probe(struct platform_device *pdev)
                dev_err(&pdev->dev, "couldn't determine bus-id\n");
                goto err_unmap ;
        }
+       id->adap.dev.of_node = pdev->dev.of_node;
 #else
        id->adap.nr = pdev->id;
 #endif
@@ -674,6 +676,11 @@ static int __devinit xi2cps_probe(struct platform_device *pdev)
                goto err_free_irq;
        }
 
+
+#ifdef CONFIG_OF
+       of_i2c_register_devices(&id->adap);
+#endif
+
        dev_info(&pdev->dev, "%d kHz mmio %08lx irq %d\n",
                 i2c_clk/1000, (unsigned long)r_mem->start, id->irq);