freebsd-skq/sys/dev/spibus/spibusvar.h
loos 24ff0743fa Add an OFW SPI compatible bus. Fix the spibus probe to return
BUS_PROBE_GENERIC and not BUS_PROBE_SPECIFIC (0) so the OFW SPI bus can
attach when enabled.  Export the spibus devclass_t and driver_t
declarations.

Submitted by:	ray
Approved by:	adrian (mentor)
2013-10-24 16:56:38 +00:00

32 lines
619 B
C

/* $FreeBSD$ */
#define SPIBUS_IVAR(d) (struct spibus_ivar *) device_get_ivars(d)
#define SPIBUS_SOFTC(d) (struct spibus_softc *) device_get_softc(d)
struct spibus_softc
{
device_t dev;
};
struct spibus_ivar
{
uint32_t cs;
};
enum {
SPIBUS_IVAR_CS /* chip select that we're on */
};
#define SPIBUS_ACCESSOR(A, B, T) \
static inline int \
spibus_get_ ## A(device_t dev, T *t) \
{ \
return BUS_READ_IVAR(device_get_parent(dev), dev, \
SPIBUS_IVAR_ ## B, (uintptr_t *) t); \
}
SPIBUS_ACCESSOR(cs, CS, uint32_t)
extern driver_t spibus_driver;
extern devclass_t spibus_devclass;