ixp425_iic.c (186352) | ixp425_iic.c (194015) |
---|---|
1/* 2 * Copyright (c) 2006 Kevin Lo. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 10 unchanged lines hidden (view full) --- 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 23 * POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2006 Kevin Lo. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 10 unchanged lines hidden (view full) --- 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 23 * POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: head/sys/arm/xscale/ixp425/ixp425_iic.c 186352 2008-12-20 03:26:09Z sam $"); | 27__FBSDID("$FreeBSD: head/sys/arm/xscale/ixp425/ixp425_iic.c 194015 2009-06-11 17:05:13Z avg $"); |
28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32#include <sys/module.h> 33#include <sys/bus.h> 34#include <sys/uio.h> 35 --- 54 unchanged lines hidden (view full) --- 90 91 /* probe and attach the bit-banging code */ 92 device_probe_and_attach(sc->iicbb); 93 94 return (0); 95} 96 97static int | 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32#include <sys/module.h> 33#include <sys/bus.h> 34#include <sys/uio.h> 35 --- 54 unchanged lines hidden (view full) --- 90 91 /* probe and attach the bit-banging code */ 92 device_probe_and_attach(sc->iicbb); 93 94 return (0); 95} 96 97static int |
98ixpiic_callback(device_t dev, int index, caddr_t *data) | 98ixpiic_callback(device_t dev, int index, caddr_t data) |
99{ 100 return (0); 101} 102 103static int 104ixpiic_getscl(device_t dev) 105{ 106 struct ixpiic_softc *sc = ixpiic_sc; --- 17 unchanged lines hidden (view full) --- 124 GPIO_CONF_SET(sc, IXP425_GPIO_GPOER, GPIO_I2C_SDA_BIT); 125 126 reg = GPIO_CONF_READ_4(sc, IXP425_GPIO_GPINR); 127 mtx_unlock(&Giant); 128 return (reg & GPIO_I2C_SDA_BIT); 129} 130 131static void | 99{ 100 return (0); 101} 102 103static int 104ixpiic_getscl(device_t dev) 105{ 106 struct ixpiic_softc *sc = ixpiic_sc; --- 17 unchanged lines hidden (view full) --- 124 GPIO_CONF_SET(sc, IXP425_GPIO_GPOER, GPIO_I2C_SDA_BIT); 125 126 reg = GPIO_CONF_READ_4(sc, IXP425_GPIO_GPINR); 127 mtx_unlock(&Giant); 128 return (reg & GPIO_I2C_SDA_BIT); 129} 130 131static void |
132ixpiic_setsda(device_t dev, char val) | 132ixpiic_setsda(device_t dev, int val) |
133{ 134 struct ixpiic_softc *sc = ixpiic_sc; 135 136 mtx_lock(&Giant); 137 GPIO_CONF_CLR(sc, IXP425_GPIO_GPOUTR, GPIO_I2C_SDA_BIT); 138 if (val) 139 GPIO_CONF_SET(sc, IXP425_GPIO_GPOER, GPIO_I2C_SDA_BIT); 140 else 141 GPIO_CONF_CLR(sc, IXP425_GPIO_GPOER, GPIO_I2C_SDA_BIT); 142 mtx_unlock(&Giant); 143 DELAY(I2C_DELAY); 144} 145 146static void | 133{ 134 struct ixpiic_softc *sc = ixpiic_sc; 135 136 mtx_lock(&Giant); 137 GPIO_CONF_CLR(sc, IXP425_GPIO_GPOUTR, GPIO_I2C_SDA_BIT); 138 if (val) 139 GPIO_CONF_SET(sc, IXP425_GPIO_GPOER, GPIO_I2C_SDA_BIT); 140 else 141 GPIO_CONF_CLR(sc, IXP425_GPIO_GPOER, GPIO_I2C_SDA_BIT); 142 mtx_unlock(&Giant); 143 DELAY(I2C_DELAY); 144} 145 146static void |
147ixpiic_setscl(device_t dev, char val) | 147ixpiic_setscl(device_t dev, int val) |
148{ 149 struct ixpiic_softc *sc = ixpiic_sc; 150 151 mtx_lock(&Giant); 152 GPIO_CONF_CLR(sc, IXP425_GPIO_GPOUTR, GPIO_I2C_SCL_BIT); 153 if (val) 154 GPIO_CONF_SET(sc, IXP425_GPIO_GPOER, GPIO_I2C_SCL_BIT); 155 else --- 40 unchanged lines hidden --- | 148{ 149 struct ixpiic_softc *sc = ixpiic_sc; 150 151 mtx_lock(&Giant); 152 GPIO_CONF_CLR(sc, IXP425_GPIO_GPOUTR, GPIO_I2C_SCL_BIT); 153 if (val) 154 GPIO_CONF_SET(sc, IXP425_GPIO_GPOER, GPIO_I2C_SCL_BIT); 155 else --- 40 unchanged lines hidden --- |