Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm Use fdtbus_attach_i2cbus



details:   https://anonhg.NetBSD.org/src/rev/1d030f1955a5
branches:  trunk
changeset: 324391:1d030f1955a5
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Jul 01 21:22:16 2018 +0000

description:
Use fdtbus_attach_i2cbus

diffstat:

 sys/arch/arm/broadcom/bcm2835_bsc.c |  22 +++-------------------
 sys/arch/arm/samsung/exynos_i2c.c   |  22 +++-------------------
 2 files changed, 6 insertions(+), 38 deletions(-)

diffs (107 lines):

diff -r bf1f6dc6ca65 -r 1d030f1955a5 sys/arch/arm/broadcom/bcm2835_bsc.c
--- a/sys/arch/arm/broadcom/bcm2835_bsc.c       Sun Jul 01 21:21:56 2018 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_bsc.c       Sun Jul 01 21:22:16 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_bsc.c,v 1.12 2018/06/07 05:07:28 thorpej Exp $ */
+/*     $NetBSD: bcm2835_bsc.c,v 1.13 2018/07/01 21:23:16 jmcneill Exp $        */
 
 /*
  * Copyright (c) 2012 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.12 2018/06/07 05:07:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.13 2018/07/01 21:23:16 jmcneill Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_kernhist.h"
@@ -102,9 +102,6 @@
        struct fdt_attach_args * const faa = aux;
        const int phandle = faa->faa_phandle;
        prop_dictionary_t prop = device_properties(self);
-       prop_dictionary_t devs;
-       uint32_t address_cells;
-       struct i2cbus_attach_args iba;
        bool disable = false;
 
        static ONCE_DECL(control);
@@ -172,20 +169,7 @@
        sc->sc_i2c.ic_release_bus = bsciic_release_bus;
        sc->sc_i2c.ic_exec = bsciic_exec;
 
-       devs = prop_dictionary_create();
-       if (of_getprop_uint32(phandle, "#address-cells", &address_cells))
-               address_cells = 1;
-
-       of_enter_i2c_devs(devs, phandle, address_cells * 4, 0);
-
-       memset(&iba, 0, sizeof(iba));
-       iba.iba_tag = &sc->sc_i2c;
-       iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
-       if (iba.iba_child_devices)
-               prop_object_retain(iba.iba_child_devices);
-       prop_object_release(devs);
-
-       config_found_ia(self, "i2cbus", &iba, iicbus_print);
+       fdtbus_attach_i2cbus(self, phandle, &sc->sc_i2c, iicbus_print);
 }
 
 void
diff -r bf1f6dc6ca65 -r 1d030f1955a5 sys/arch/arm/samsung/exynos_i2c.c
--- a/sys/arch/arm/samsung/exynos_i2c.c Sun Jul 01 21:21:56 2018 +0000
+++ b/sys/arch/arm/samsung/exynos_i2c.c Sun Jul 01 21:22:16 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exynos_i2c.c,v 1.14 2018/05/09 02:53:00 thorpej Exp $ */
+/*     $NetBSD: exynos_i2c.c,v 1.15 2018/07/01 21:22:16 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
 #include "opt_arm_debug.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.14 2018/05/09 02:53:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.15 2018/07/01 21:22:16 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -67,7 +67,6 @@
        struct i2c_controller   sc_ic;
        kmutex_t                sc_lock;
        kcondvar_t              sc_cv;
-       device_t                sc_i2cdev;
 };
 
 static int     exynos_i2c_intr(void *);
@@ -137,9 +136,6 @@
         struct exynos_i2c_softc * const sc =  device_private(self);
        struct fdt_attach_args * const faa = aux;
        const int phandle = faa->faa_phandle;
-       struct i2cbus_attach_args iba;
-       prop_dictionary_t devs;
-       uint32_t address_cells;
        char intrstr[128];
        bus_addr_t addr;
        bus_size_t size;
@@ -188,19 +184,7 @@
 
        fdtbus_register_i2c_controller(self, phandle, &exynos_i2c_funcs);
 
-       devs = prop_dictionary_create();
-       if (of_getprop_uint32(phandle, "#address-cells", &address_cells))
-               address_cells = 1;
-       of_enter_i2c_devs(devs, phandle, address_cells * 4, 0);
-
-       memset(&iba, 0, sizeof(iba));
-       iba.iba_tag = &sc->sc_ic;
-       iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
-       if (iba.iba_child_devices != NULL)
-               prop_object_retain(iba.iba_child_devices);
-       prop_object_release(devs);
-
-       sc->sc_i2cdev = config_found_ia(self, "i2cbus", &iba, iicbus_print);
+       fdtbus_attach_i2cbus(self, phandle, &sc->sc_ic, iicbus_print);
 }
 
 static i2c_tag_t



Home | Main Index | Thread Index | Old Index