ti_i2c.c (302408) | ti_i2c.c (323931) |
---|---|
1/*- 2 * Copyright (c) 2011 Ben Gray <ben.r.gray@gmail.com>. 3 * Copyright (c) 2014 Luiz Otavio O Souza <loos@freebsd.org>. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 23 unchanged lines hidden (view full) --- 32 * 33 * CAUTION: The I2Ci registers are limited to 16 bit and 8 bit data accesses, 34 * 32 bit data access is not allowed and can corrupt register content. 35 * 36 * This driver currently doesn't use DMA for the transfer, although I hope to 37 * incorporate that sometime in the future. The idea being that for transaction 38 * larger than a certain size the DMA engine is used, for anything less the 39 * normal interrupt/fifo driven option is used. | 1/*- 2 * Copyright (c) 2011 Ben Gray <ben.r.gray@gmail.com>. 3 * Copyright (c) 2014 Luiz Otavio O Souza <loos@freebsd.org>. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 23 unchanged lines hidden (view full) --- 32 * 33 * CAUTION: The I2Ci registers are limited to 16 bit and 8 bit data accesses, 34 * 32 bit data access is not allowed and can corrupt register content. 35 * 36 * This driver currently doesn't use DMA for the transfer, although I hope to 37 * incorporate that sometime in the future. The idea being that for transaction 38 * larger than a certain size the DMA engine is used, for anything less the 39 * normal interrupt/fifo driven option is used. |
40 * 41 * 42 * WARNING: This driver uses mtx_sleep and interrupts to perform transactions, 43 * which means you can't do a transaction during startup before the interrupts 44 * have been enabled. Hint - the freebsd function config_intrhook_establish(). | |
45 */ 46 47#include <sys/cdefs.h> | 40 */ 41 42#include <sys/cdefs.h> |
48__FBSDID("$FreeBSD: stable/11/sys/arm/ti/ti_i2c.c 299069 2016-05-04 15:48:59Z pfg $"); | 43__FBSDID("$FreeBSD: stable/11/sys/arm/ti/ti_i2c.c 323931 2017-09-22 15:53:22Z ian $"); |
49 50#include <sys/param.h> 51#include <sys/systm.h> 52#include <sys/bus.h> 53#include <sys/conf.h> 54#include <sys/kernel.h> 55#include <sys/lock.h> 56#include <sys/mbuf.h> --- 847 unchanged lines hidden (view full) --- 904 905 /* Attach the iicbus. */ 906 if ((sc->sc_iicbus = device_add_child(dev, "iicbus", -1)) == NULL) { 907 device_printf(dev, "could not allocate iicbus instance\n"); 908 err = ENXIO; 909 goto out; 910 } 911 | 44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/bus.h> 48#include <sys/conf.h> 49#include <sys/kernel.h> 50#include <sys/lock.h> 51#include <sys/mbuf.h> --- 847 unchanged lines hidden (view full) --- 899 900 /* Attach the iicbus. */ 901 if ((sc->sc_iicbus = device_add_child(dev, "iicbus", -1)) == NULL) { 902 device_printf(dev, "could not allocate iicbus instance\n"); 903 err = ENXIO; 904 goto out; 905 } 906 |
912 /* Probe and attach the iicbus */ 913 bus_generic_attach(dev); | 907 /* Probe and attach the iicbus when interrupts are available. */ 908 config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev); |
914 915out: 916 if (err) { 917 ti_i2c_deactivate(dev); 918 TI_I2C_LOCK_DESTROY(sc); 919 } 920 921 return (err); --- 67 unchanged lines hidden --- | 909 910out: 911 if (err) { 912 ti_i2c_deactivate(dev); 913 TI_I2C_LOCK_DESTROY(sc); 914 } 915 916 return (err); --- 67 unchanged lines hidden --- |