Index: stable/10/sys/boot/fdt/dts/arm/beaglebone-black.dts =================================================================== --- stable/10/sys/boot/fdt/dts/arm/beaglebone-black.dts (revision 294671) +++ stable/10/sys/boot/fdt/dts/arm/beaglebone-black.dts (revision 294672) @@ -1,184 +1,184 @@ /*- * Copyright (c) 2012 Damjan Marion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ /dts-v1/; /include/ "am335x.dtsi" / { model = "beaglebone-black"; compatible = "beaglebone-black", "beaglebone", "ti,am335x"; aliases { soc = &SOC; uart0 = &uart0; }; memory { device_type = "memory"; reg = < 0x80000000 0x20000000 >; /* 512MB RAM */ }; am335x { scm@44e10000 { /* Set of triplets < padname, muxname, padstate> */ scm-pad-config = /* I2C0 */ "I2C0_SDA", "I2C0_SDA","i2c", "I2C0_SCL", "I2C0_SCL","i2c", /* I2C1 */ "SPI0_D1", "I2C1_SDA", "i2c", "SPI0_CS0", "I2C1_SCL", "i2c", /* I2C2 */ "UART1_CTSn", "I2C2_SDA", "i2c", "UART1_RTSn", "I2C2_SCL", "i2c", /* Ethernet */ "MII1_RX_ER", "gmii1_rxerr", "input_pulldown", "MII1_TX_EN", "gmii1_txen", "output", "MII1_RX_DV", "gmii1_rxdv", "input_pulldown", "MII1_TXD3", "gmii1_txd3", "output", "MII1_TXD2", "gmii1_txd2", "output", "MII1_TXD1", "gmii1_txd1", "output", "MII1_TXD0", "gmii1_txd0", "output", "MII1_TX_CLK", "gmii1_txclk", "input_pulldown", "MII1_RX_CLK", "gmii1_rxclk", "input_pulldown", "MII1_RXD3", "gmii1_rxd3", "input_pulldown", "MII1_RXD2", "gmii1_rxd2", "input_pulldown", "MII1_RXD1", "gmii1_rxd1", "input_pulldown", "MII1_RXD0", "gmii1_rxd0", "input_pulldown", "MDIO", "mdio_data", "input_pullup", "MDC", "mdio_clk", "output_pullup", /* MMCSD0 */ "MMC0_CMD", "mmc0_cmd", "input_pullup", "MMC0_CLK", "mmc0_clk", "input_pullup", "MMC0_DAT0", "mmc0_dat0", "input_pullup", "MMC0_DAT1", "mmc0_dat1", "input_pullup", "MMC0_DAT2", "mmc0_dat2", "input_pullup", "MMC0_DAT3", "mmc0_dat3", "input_pullup", /* MMC1 */ "GPMC_CSn1", "mmc1_clk", "input_pullup", "GPMC_CSn2", "mmc1_cmd", "input_pullup", "GPMC_CSn3", "gpio2_0", "output_pullup", /* Reset */ "GPMC_AD0", "mmc1_dat0", "input_pullup", "GPMC_AD1", "mmc1_dat1", "input_pullup", "GPMC_AD2", "mmc1_dat2", "input_pullup", "GPMC_AD3", "mmc1_dat3", "input_pullup", "GPMC_AD4", "mmc1_dat4", "input_pullup", "GPMC_AD5", "mmc1_dat5", "input_pullup", "GPMC_AD6", "mmc1_dat6", "input_pullup", "GPMC_AD7", "mmc1_dat7", "input_pullup", /* GPIO */ "ECAP0_IN_PWM0_OUT", "gpio0_7", "input_pulldown", "GPMC_AD10", "gpio0_26", "input_pulldown", "GPMC_AD11", "gpio0_27", "input_pulldown", "GPMC_AD12", "gpio1_12", "input_pulldown", "GPMC_AD13", "gpio1_13", "input_pulldown", "GPMC_AD14", "gpio1_14", "input_pulldown", "GPMC_AD15", "gpio1_15", "input_pulldown", "GPMC_A0", "gpio1_16", "input_pulldown", "GPMC_A1", "gpio1_17", "input_pulldown", "GPMC_A5", "gpio1_21", "output", /* User LED 1 */ "GPMC_A6", "gpio1_22", "output", /* User LED 2 */ "GPMC_A7", "gpio1_23", "output", /* User LED 3 */ "GPMC_A8", "gpio1_24", "output", /* User LED 4 */ "GPMC_BEn1", "gpio1_28", "input_pulldown", "GPMC_CSn0", "gpio1_29", "input_pulldown", "GPMC_CLK", "gpio2_1", "input_pulldown", "LCD_DATA0", "gpio2_6", "input_pulldown", "LCD_DATA1", "gpio2_7", "input_pulldown", "LCD_DATA2", "gpio2_8", "input_pulldown", "LCD_DATA3", "gpio2_9", "input_pulldown", "LCD_DATA4", "gpio2_10", "input_pulldown", "LCD_DATA5", "gpio2_11", "input_pulldown", "LCD_DATA6", "gpio2_12", "input_pulldown", "LCD_DATA7", "gpio2_13", "input_pulldown", "LCD_VSYNC", "gpio2_22", "input_pulldown", "LCD_HSYNC", "gpio2_23", "input_pulldown", "LCD_PCLK", "gpio2_24", "input_pulldown", "LCD_AC_BIAS_EN", "gpio2_25", "input_pulldown", "MCASP0_FSR", "gpio3_19", "input_pulldown", "MCASP0_AHCLKX", "gpio3_21", "input_pulldown", /* TIMERs */ "GPMC_ADVn_ALE", "timer4", "output", "GPMC_BEn0_CLE", "timer5", "output", "GPMC_WEn", "timer6", "output", "GPMC_OEn_REn", "timer7", "output", /* USB0 and USB1 */ "USB0_DRVVBUS", "USB0_DRVVBUS", "output", "USB1_DRVVBUS", "USB1_DRVVBUS", "output", /* PWM */ "GPMC_A2", "ehrpwm1A", "output", "GPMC_A3", "ehrpwm1B", "output", "GPMC_AD8", "ehrpwm2A", "output", "GPMC_AD9", "ehrpwm2B", "output"; }; mmchs1@481D8000 { bus-width = <8>; status = "okay"; non-removable; }; i2c@44e0b000 { - pmic@48 { + pmic@24 { compatible = "ti,am335x-pmic"; - reg = <0x48>; + reg = <0x24>; }; }; }; leds { compatible = "gpio-leds"; led1 { gpios = <&GPIO 53 2 0>; name = "led1"; }; led2 { gpios = <&GPIO 54 2 0>; name = "led2"; }; led3 { gpios = <&GPIO 55 2 0>; name = "led3"; }; led4 { gpios = <&GPIO 56 2 0>; name = "led4"; }; }; chosen { stdin = "uart0"; stdout = "uart0"; }; }; Index: stable/10/sys/boot/fdt/dts/arm/beaglebone.dts =================================================================== --- stable/10/sys/boot/fdt/dts/arm/beaglebone.dts (revision 294671) +++ stable/10/sys/boot/fdt/dts/arm/beaglebone.dts (revision 294672) @@ -1,145 +1,145 @@ /*- * Copyright (c) 2012 Damjan Marion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ /dts-v1/; /include/ "am335x.dtsi" / { model = "beaglebone"; compatible = "beaglebone", "ti,am335x"; aliases { soc = &SOC; uart0 = &uart0; }; memory { device_type = "memory"; reg = < 0x80000000 0x10000000 >; /* 256MB RAM */ }; am335x { scm@44e10000 { /* Set of triplets < padname, muxname, padstate> */ scm-pad-config = /* I2C0 */ "I2C0_SDA", "I2C0_SDA","i2c", "I2C0_SCL", "I2C0_SCL","i2c", /* Ethernet */ "MII1_RX_ER", "gmii1_rxerr", "input_pulldown", "MII1_TX_EN", "gmii1_txen", "output", "MII1_RX_DV", "gmii1_rxdv", "input_pulldown", "MII1_TXD3", "gmii1_txd3", "output", "MII1_TXD2", "gmii1_txd2", "output", "MII1_TXD1", "gmii1_txd1", "output", "MII1_TXD0", "gmii1_txd0", "output", "MII1_TX_CLK", "gmii1_txclk", "input_pulldown", "MII1_RX_CLK", "gmii1_rxclk", "input_pulldown", "MII1_RXD3", "gmii1_rxd3", "input_pulldown", "MII1_RXD2", "gmii1_rxd2", "input_pulldown", "MII1_RXD1", "gmii1_rxd1", "input_pulldown", "MII1_RXD0", "gmii1_rxd0", "input_pulldown", "MDIO", "mdio_data", "input_pullup", "MDC", "mdio_clk", "output_pullup", /* MMCSD0 */ "MMC0_CMD", "mmc0_cmd", "input_pullup", "MMC0_CLK", "mmc0_clk", "input_pullup", "MMC0_DAT0", "mmc0_dat0", "input_pullup", "MMC0_DAT1", "mmc0_dat1", "input_pullup", "MMC0_DAT2", "mmc0_dat2", "input_pullup", "MMC0_DAT3", "mmc0_dat3", "input_pullup", /* USB0 and USB1 */ "USB0_DRVVBUS", "USB0_DRVVBUS", "output", "USB1_DRVVBUS", "USB1_DRVVBUS", "output", /* GPIO */ "ECAP0_IN_PWM0_OUT", "gpio0_7", "input_pulldown", "GPMC_AD10", "gpio0_26", "input_pulldown", "GPMC_AD11", "gpio0_27", "input_pulldown", "GPMC_AD0", "gpio1_0", "input_pulldown", "GPMC_AD1", "gpio1_1", "input_pulldown", "GPMC_AD2", "gpio1_2", "input_pulldown", "GPMC_AD3", "gpio1_3", "input_pulldown", "GPMC_AD4", "gpio1_4", "input_pulldown", "GPMC_AD5", "gpio1_5", "input_pulldown", "GPMC_AD6", "gpio1_6", "input_pulldown", "GPMC_AD7", "gpio1_7", "input_pulldown", "GPMC_AD12", "gpio1_12", "input_pulldown", "GPMC_AD13", "gpio1_13", "input_pulldown", "GPMC_AD14", "gpio1_14", "input_pulldown", "GPMC_AD15", "gpio1_15", "input_pulldown", "GPMC_A0", "gpio1_16", "input_pulldown", "GPMC_A1", "gpio1_17", "input_pulldown", "GPMC_A5", "gpio1_21", "output", /* User LED 1 */ "GPMC_A6", "gpio1_22", "output", /* User LED 2 */ "GPMC_A7", "gpio1_23", "output", /* User LED 3 */ "GPMC_A8", "gpio1_24", "output", /* User LED 4 */ "GPMC_BEn1", "gpio1_28", "input_pulldown", "GPMC_CSn0", "gpio1_29", "input_pulldown", "GPMC_CSn1", "gpio1_30", "input_pulldown", "GPMC_CSn2", "gpio1_31", "input_pulldown", "GPMC_CLK", "gpio2_1", "input_pulldown", "LCD_DATA0", "gpio2_6", "input_pulldown", "LCD_DATA1", "gpio2_7", "input_pulldown", "LCD_DATA2", "gpio2_8", "input_pulldown", "LCD_DATA3", "gpio2_9", "input_pulldown", "LCD_DATA4", "gpio2_10", "input_pulldown", "LCD_DATA5", "gpio2_11", "input_pulldown", "LCD_DATA6", "gpio2_12", "input_pulldown", "LCD_DATA7", "gpio2_13", "input_pulldown", "LCD_VSYNC", "gpio2_22", "input_pulldown", "LCD_HSYNC", "gpio2_23", "input_pulldown", "LCD_PCLK", "gpio2_24", "input_pulldown", "LCD_AC_BIAS_EN", "gpio2_25", "input_pulldown", "MCASP0_FSR", "gpio3_19", "input_pulldown", "MCASP0_AHCLKX", "gpio3_21", "input_pulldown", /* TIMERs */ "GPMC_ADVn_ALE", "timer4", "output", "GPMC_BEn0_CLE", "timer5", "output", "GPMC_WEn", "timer6", "output", "GPMC_OEn_REn", "timer7", "output", /* PWM */ "GPMC_A2", "ehrpwm1A", "output", "GPMC_A3", "ehrpwm1B", "output", "GPMC_AD8", "ehrpwm2A", "output", "GPMC_AD9", "ehrpwm2B", "output"; }; i2c@44e0b000 { pmic@24 { compatible = "ti,am335x-pmic"; - reg = <0x48>; + reg = <0x24>; }; }; }; chosen { stdin = "uart0"; stdout = "uart0"; }; }; Index: stable/10/sys/dev/ofw/ofw_iicbus.c =================================================================== --- stable/10/sys/dev/ofw/ofw_iicbus.c (revision 294671) +++ stable/10/sys/dev/ofw/ofw_iicbus.c (revision 294672) @@ -1,201 +1,205 @@ /*- * Copyright (c) 2009, Nathan Whitehorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include "iicbus_if.h" /* Methods */ static device_probe_t ofw_iicbus_probe; static device_attach_t ofw_iicbus_attach; static device_t ofw_iicbus_add_child(device_t dev, u_int order, const char *name, int unit); static const struct ofw_bus_devinfo *ofw_iicbus_get_devinfo(device_t bus, device_t dev); static device_method_t ofw_iicbus_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ofw_iicbus_probe), DEVMETHOD(device_attach, ofw_iicbus_attach), /* Bus interface */ DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str), DEVMETHOD(bus_add_child, ofw_iicbus_add_child), /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_devinfo, ofw_iicbus_get_devinfo), DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), DEVMETHOD_END }; struct ofw_iicbus_devinfo { struct iicbus_ivar opd_dinfo; struct ofw_bus_devinfo opd_obdinfo; }; static devclass_t ofwiicbus_devclass; DEFINE_CLASS_1(iicbus, ofw_iicbus_driver, ofw_iicbus_methods, sizeof(struct iicbus_softc), iicbus_driver); DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofwiicbus_devclass, 0, 0); DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofwiicbus_devclass, 0, 0); MODULE_VERSION(ofw_iicbus, 1); MODULE_DEPEND(ofw_iicbus, iicbus, 1, 1, 1); static int ofw_iicbus_probe(device_t dev) { if (ofw_bus_get_node(dev) == -1) return (ENXIO); device_set_desc(dev, "OFW I2C bus"); return (0); } static int ofw_iicbus_attach(device_t dev) { struct iicbus_softc *sc = IICBUS_SOFTC(dev); struct ofw_iicbus_devinfo *dinfo; phandle_t child, node; pcell_t freq, paddr; device_t childdev; sc->dev = dev; mtx_init(&sc->lock, "iicbus", NULL, MTX_DEF); /* * If there is a clock-frequency property for the device node, use it as * the starting value for the bus frequency. Then call the common * routine that handles the tunable/sysctl which allows the FDT value to * be overridden by the user. */ node = ofw_bus_get_node(dev); freq = 0; OF_getencprop(node, "clock-frequency", &freq, sizeof(freq)); iicbus_init_frequency(dev, freq); iicbus_reset(dev, IIC_FASTEST, 0, NULL); bus_generic_probe(dev); bus_enumerate_hinted_children(dev); /* * Attach those children represented in the device tree. */ for (child = OF_child(node); child != 0; child = OF_peer(child)) { /* * Try to get the I2C address first from the i2c-address * property, then try the reg property. It moves around * on different systems. */ if (OF_getencprop(child, "i2c-address", &paddr, sizeof(paddr)) == -1) if (OF_getencprop(child, "reg", &paddr, sizeof(paddr)) == -1) continue; /* * Now set up the I2C and OFW bus layer devinfo and add it * to the bus. */ dinfo = malloc(sizeof(struct ofw_iicbus_devinfo), M_DEVBUF, M_NOWAIT | M_ZERO); if (dinfo == NULL) continue; - dinfo->opd_dinfo.addr = paddr; + /* + * OFW uses 7-bit I2C address format (see ePAPR), + * but system expect 8-bit. + */ + dinfo->opd_dinfo.addr = paddr << 1; if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != 0) { free(dinfo, M_DEVBUF); continue; } childdev = device_add_child(dev, NULL, -1); device_set_ivars(childdev, dinfo); } return (bus_generic_attach(dev)); } static device_t ofw_iicbus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct ofw_iicbus_devinfo *devi; child = device_add_child_ordered(dev, order, name, unit); if (child == NULL) return (child); devi = malloc(sizeof(struct ofw_iicbus_devinfo), M_DEVBUF, M_NOWAIT | M_ZERO); if (devi == NULL) { device_delete_child(dev, child); return (0); } /* * NULL all the OFW-related parts of the ivars for non-OFW * children. */ devi->opd_obdinfo.obd_node = -1; devi->opd_obdinfo.obd_name = NULL; devi->opd_obdinfo.obd_compat = NULL; devi->opd_obdinfo.obd_type = NULL; devi->opd_obdinfo.obd_model = NULL; device_set_ivars(child, devi); return (child); } static const struct ofw_bus_devinfo * ofw_iicbus_get_devinfo(device_t bus, device_t dev) { struct ofw_iicbus_devinfo *dinfo; dinfo = device_get_ivars(dev); return (&dinfo->opd_obdinfo); } Index: stable/10 =================================================================== --- stable/10 (revision 294671) +++ stable/10 (revision 294672) Property changes on: stable/10 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r289704