ofw_iicbus.c (289704) | ofw_iicbus.c (290373) |
---|---|
1/*- 2 * Copyright (c) 2009, Nathan Whitehorn <nwhitehorn@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009, Nathan Whitehorn <nwhitehorn@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_iicbus.c 289704 2015-10-21 15:41:16Z ian $"); | 28__FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_iicbus.c 290373 2015-11-04 22:46:30Z andreast $"); |
29 30#include <sys/param.h> 31#include <sys/bus.h> 32#include <sys/kernel.h> 33#include <sys/libkern.h> 34#include <sys/lock.h> 35#include <sys/module.h> 36#include <sys/mutex.h> --- 106 unchanged lines hidden (view full) --- 143 * Now set up the I2C and OFW bus layer devinfo and add it 144 * to the bus. 145 */ 146 dinfo = malloc(sizeof(struct ofw_iicbus_devinfo), M_DEVBUF, 147 M_NOWAIT | M_ZERO); 148 if (dinfo == NULL) 149 continue; 150 /* | 29 30#include <sys/param.h> 31#include <sys/bus.h> 32#include <sys/kernel.h> 33#include <sys/libkern.h> 34#include <sys/lock.h> 35#include <sys/module.h> 36#include <sys/mutex.h> --- 106 unchanged lines hidden (view full) --- 143 * Now set up the I2C and OFW bus layer devinfo and add it 144 * to the bus. 145 */ 146 dinfo = malloc(sizeof(struct ofw_iicbus_devinfo), M_DEVBUF, 147 M_NOWAIT | M_ZERO); 148 if (dinfo == NULL) 149 continue; 150 /* |
151 * OFW uses 7-bit I2C address format (see ePAPR), 152 * but system expect 8-bit. | 151 * FreeBSD drivers expect I2C addresses to be expressed as 152 * 8-bit values. Apple OFW data contains 8-bit values, but 153 * Linux FDT data contains 7-bit values, so shift them up to 154 * 8-bit format. |
153 */ | 155 */ |
156#ifdef AIM 157 dinfo->opd_dinfo.addr = paddr; 158#else |
|
154 dinfo->opd_dinfo.addr = paddr << 1; | 159 dinfo->opd_dinfo.addr = paddr << 1; |
160#endif |
|
155 if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != 156 0) { 157 free(dinfo, M_DEVBUF); 158 continue; 159 } 160 161 childdev = device_add_child(dev, NULL, -1); 162 resource_list_init(&dinfo->opd_dinfo.rl); --- 47 unchanged lines hidden --- | 161 if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != 162 0) { 163 free(dinfo, M_DEVBUF); 164 continue; 165 } 166 167 childdev = device_add_child(dev, NULL, -1); 168 resource_list_init(&dinfo->opd_dinfo.rl); --- 47 unchanged lines hidden --- |