Module Name: src Committed By: jmcneill Date: Sun Jul 1 21:16:19 UTC 2018
Modified Files: src/sys/arch/arm/sunxi: sunxi_twi.c Log Message: Use fdtbus_attach_i2cbus To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sunxi_twi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/sunxi/sunxi_twi.c diff -u src/sys/arch/arm/sunxi/sunxi_twi.c:1.9 src/sys/arch/arm/sunxi/sunxi_twi.c:1.10 --- src/sys/arch/arm/sunxi/sunxi_twi.c:1.9 Wed May 9 02:53:00 2018 +++ src/sys/arch/arm/sunxi/sunxi_twi.c Sun Jul 1 21:16:19 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_twi.c,v 1.9 2018/05/09 02:53:00 thorpej Exp $ */ +/* $NetBSD: sunxi_twi.c,v 1.10 2018/07/01 21:16:19 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared McNeill <jmcne...@invisible.ca> @@ -33,7 +33,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c,v 1.9 2018/05/09 02:53:00 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c,v 1.10 2018/07/01 21:16:19 jmcneill Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -161,12 +161,9 @@ sunxi_twi_attach(device_t parent, device struct gttwsi_softc * const sc = device_private(self); struct fdt_attach_args * const faa = aux; const struct sunxi_twi_config *conf; - struct i2cbus_attach_args iba; const int phandle = faa->faa_phandle; bus_space_tag_t bst = faa->faa_bst; bus_space_handle_t bsh; - prop_dictionary_t devs; - uint32_t address_cells; struct fdtbus_reset *rst; struct clk *clk; char intrstr[128]; @@ -225,18 +222,5 @@ sunxi_twi_attach(device_t parent, device fdtbus_register_i2c_controller(self, phandle, &sunxi_twi_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_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); }