#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: plmmc_ifpga.c,v 1.2 2021/07/27 21:13:41 skrll Exp $");
#include <sys/param.h>
#include <sys/types.h>
#include <sys/bus.h>
#include <sys/device.h>
#include <sys/systm.h>
#include <sys/termios.h>
#include <machine/intr.h>
#include <dev/ic/pl181reg.h>
#include <dev/ic/pl181var.h>
#include <evbarm/ifpga/ifpgareg.h>
#include <evbarm/ifpga/ifpgavar.h>
static int plmmc_ifpga_match(device_t, cfdata_t, void *);
static void plmmc_ifpga_attach(device_t, device_t, void *);
static void plmmc_ifpga_attach_i(device_t);
CFATTACH_DECL_NEW(plmmc_ifpga, sizeof(struct plmmc_softc),
plmmc_ifpga_match, plmmc_ifpga_attach, NULL, NULL);
static int
plmmc_ifpga_match(device_t parent, cfdata_t cf, void *aux)
{
return 1;
}
static void
plmmc_ifpga_attach(device_t parent, device_t self, void *aux)
{
struct plmmc_softc *sc = device_private(self);
struct ifpga_attach_args *ifa = aux;
sc->sc_dev = self;
sc->sc_clock_freq = IFPGA_MMC_CLK;
sc->sc_bst = ifa->ifa_iot;
if (bus_space_map(ifa->ifa_iot, ifa->ifa_addr, IFPGA_MMC_SIZE, 0,
&sc->sc_bsh)) {
printf("%s: unable to map device\n", device_xname(sc->sc_dev));
return;
}
aprint_naive("\n");
aprint_normal("\n");
#if 0
sc->sc_ih = ifpga_intr_establish(ifa->ifa_irq, IPL_BIO, plmmc_intr, sc);
#endif
config_interrupts(self, plmmc_ifpga_attach_i);
}
static void
plmmc_ifpga_attach_i(device_t self)
{
struct plmmc_softc *sc = device_private(self);
plmmc_init(sc);
}