Deleted Added
full compact
pcf_ebus.c (133522) pcf_ebus.c (133589)
1/*-
2 * Copyright (c) 2004 Marius Strobl, Joerg Wunsch
3 *
4 * derived from sys/i386/isa/pcf.c which is:
5 *
6 * Copyright (c) 1998 Nicolas Souchu, Marc Bouget
7 * All rights reserved.
8 *

--- 14 unchanged lines hidden (view full) ---

23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004 Marius Strobl, Joerg Wunsch
3 *
4 * derived from sys/i386/isa/pcf.c which is:
5 *
6 * Copyright (c) 1998 Nicolas Souchu, Marc Bouget
7 * All rights reserved.
8 *

--- 14 unchanged lines hidden (view full) ---

23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/pcf/pcf_ebus.c 133522 2004-08-11 21:19:31Z marius $");
31__FBSDID("$FreeBSD: head/sys/dev/pcf/pcf_ebus.c 133589 2004-08-12 17:41:33Z marius $");
32
33/*
34 * Device specific driver for the EBus i2c devices found on some sun4u
35 * systems. On systems not having a boot-bus controller the i2c devices
36 * are PCF8584.
37 *
38 * Known onboard slave devices on the primary bus are:
39 *

--- 25 unchanged lines hidden (view full) ---

65
66#include <sys/param.h>
67#include <sys/systm.h>
68#include <sys/bus.h>
69#include <sys/kernel.h>
70#include <sys/module.h>
71#include <sys/resource.h>
72
32
33/*
34 * Device specific driver for the EBus i2c devices found on some sun4u
35 * systems. On systems not having a boot-bus controller the i2c devices
36 * are PCF8584.
37 *
38 * Known onboard slave devices on the primary bus are:
39 *

--- 25 unchanged lines hidden (view full) ---

65
66#include <sys/param.h>
67#include <sys/systm.h>
68#include <sys/bus.h>
69#include <sys/kernel.h>
70#include <sys/module.h>
71#include <sys/resource.h>
72
73#include <dev/ofw/ofw_bus.h>
74#include <dev/ofw/openfirm.h>
75
73#include <machine/bus.h>
74#include <machine/resource.h>
75
76#include <sys/rman.h>
77
76#include <machine/bus.h>
77#include <machine/resource.h>
78
79#include <sys/rman.h>
80
78#include <dev/ofw/openfirm.h>
79
80#include <sparc64/ebus/ebusvar.h>
81
82#include <dev/iicbus/iiconf.h>
83#include <dev/pcf/pcfvar.h>
84#include "iicbus_if.h"
85
86#define PCF_NAME "pcf"
87
88static int pcf_ebus_probe(device_t);
89static int pcf_ebus_attach(device_t);

--- 22 unchanged lines hidden (view full) ---

112 PCF_NAME,
113 pcf_ebus_methods,
114 sizeof(struct pcf_softc),
115};
116
117static int
118pcf_ebus_probe(device_t dev)
119{
81#include <dev/iicbus/iiconf.h>
82#include <dev/pcf/pcfvar.h>
83#include "iicbus_if.h"
84
85#define PCF_NAME "pcf"
86
87static int pcf_ebus_probe(device_t);
88static int pcf_ebus_attach(device_t);

--- 22 unchanged lines hidden (view full) ---

111 PCF_NAME,
112 pcf_ebus_methods,
113 sizeof(struct pcf_softc),
114};
115
116static int
117pcf_ebus_probe(device_t dev)
118{
120 char *compat;
119 const char *compat;
121
122 /*
123 * We must not attach to this i2c device if this is a system with
124 * a boot-bus controller. Additionally testing the compatibility
125 * property will hopefully take care of this.
126 */
120
121 /*
122 * We must not attach to this i2c device if this is a system with
123 * a boot-bus controller. Additionally testing the compatibility
124 * property will hopefully take care of this.
125 */
127 if (strcmp("i2c", ebus_get_name(dev)) == 0) {
128 compat = ebus_get_compat(dev);
126 if (strcmp("i2c", ofw_bus_get_name(dev)) == 0) {
127 compat = ofw_bus_get_compat(dev);
129 if (compat != NULL && strcmp("i2cpcf,8584", compat) == 0) {
130 device_set_desc(dev, "PCF8584 I2C bus controller");
131 return (0);
132 }
133 }
134 return (ENXIO);
135}
136

--- 4 unchanged lines hidden (view full) ---

141 int rv = ENXIO;
142 phandle_t node;
143 uint64_t own_addr;
144
145 sc = DEVTOSOFTC(dev);
146 bzero(sc, sizeof(struct pcf_softc));
147
148 /* get OFW node of the pcf */
128 if (compat != NULL && strcmp("i2cpcf,8584", compat) == 0) {
129 device_set_desc(dev, "PCF8584 I2C bus controller");
130 return (0);
131 }
132 }
133 return (ENXIO);
134}
135

--- 4 unchanged lines hidden (view full) ---

140 int rv = ENXIO;
141 phandle_t node;
142 uint64_t own_addr;
143
144 sc = DEVTOSOFTC(dev);
145 bzero(sc, sizeof(struct pcf_softc));
146
147 /* get OFW node of the pcf */
149 if ((node = ebus_get_node(dev)) <= 0) {
148 if ((node = ofw_bus_get_node(dev)) <= 0) {
150 device_printf(dev, "cannot get OFW node\n");
151 goto error;
152 }
153
154 /* IO port is mandatory */
155 sc->res_ioport = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
156 &sc->rid_ioport, RF_ACTIVE);
157 if (sc->res_ioport == 0) {

--- 106 unchanged lines hidden ---
149 device_printf(dev, "cannot get OFW node\n");
150 goto error;
151 }
152
153 /* IO port is mandatory */
154 sc->res_ioport = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
155 &sc->rid_ioport, RF_ACTIVE);
156 if (sc->res_ioport == 0) {

--- 106 unchanged lines hidden ---