From 2b902e0cab4f30211e4161fe57d4ca62ee7b4289 Mon Sep 17 00:00:00 2001 From: Michael Shalayeff Date: Thu, 25 Sep 2003 22:06:01 +0000 Subject: update fom form@ including support for 891 chips and more --- sys/dev/pci/if_mtd_pci.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'sys/dev/pci/if_mtd_pci.c') diff --git a/sys/dev/pci/if_mtd_pci.c b/sys/dev/pci/if_mtd_pci.c index be8e0eb147e..9e66cd9acec 100644 --- a/sys/dev/pci/if_mtd_pci.c +++ b/sys/dev/pci/if_mtd_pci.c @@ -1,7 +1,7 @@ -/* $OpenBSD: if_mtd_pci.c,v 1.5 2003/08/19 12:25:52 mickey Exp $ */ +/* $OpenBSD: if_mtd_pci.c,v 1.6 2003/09/25 22:06:00 mickey Exp $ */ /* - * Copyright (c) 2003 Oleg Safiullin + * Copyright (c) 2003 Oleg Safiullin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,20 +49,24 @@ #include #include -#include -#include +#include +#include static int mtd_pci_match(struct device *, void *, void *); static void mtd_pci_attach(struct device *, struct device *, void *); + struct cfattach mtd_pci_ca = { sizeof(struct mtd_softc), mtd_pci_match, mtd_pci_attach }; const static struct pci_matchid mtd_pci_devices[] = { + { PCI_VENDOR_MYSON, PCI_PRODUCT_MYSON_MTD800 }, { PCI_VENDOR_MYSON, PCI_PRODUCT_MYSON_MTD803 }, + { PCI_VENDOR_MYSON, PCI_PRODUCT_MYSON_MTD891 }, }; + static int mtd_pci_match(struct device *parent, void *match, void *aux) { @@ -70,6 +74,7 @@ mtd_pci_match(struct device *parent, void *match, void *aux) sizeof(mtd_pci_devices) / sizeof(mtd_pci_devices[0]))); } + static void mtd_pci_attach(struct device *parent, struct device *self, void *aux) { @@ -81,13 +86,13 @@ mtd_pci_attach(struct device *parent, struct device *self, void *aux) #ifndef MTD_USE_IO if (pci_mapreg_map(pa, MTD_PCI_LOMEM, PCI_MAPREG_TYPE_MEM, 0, - &sc->bus_tag, &sc->bus_handle, NULL, &iosize, 0)) { + &sc->sc_bust, &sc->sc_bush, NULL, &iosize, 0)) { printf(": can't map mem space\n"); return; } #else /* MTD_USE_IO */ if (pci_mapreg_map(pa, MTD_PCI_LOIO, PCI_MAPREG_TYPE_IO, 0, - &sc->bus_tag, &sc->bus_handle, NULL, &iosize, 0)) { + &sc->sc_bust, &sc->sc_bush, NULL, &iosize, 0)) { printf(": can't map io space\n"); return; } @@ -98,22 +103,22 @@ mtd_pci_attach(struct device *parent, struct device *self, void *aux) */ if (pci_intr_map(pa, &ih)) { printf(": couldn't map interrupt\n"); - bus_space_unmap(sc->bus_tag, sc->bus_handle, iosize); + bus_space_unmap(sc->sc_bust, sc->sc_bush, iosize); return; } intrstr = pci_intr_string(pa->pa_pc, ih); - if (pci_intr_establish(pa->pa_pc, ih, IPL_NET, mtd_irq_h, sc, + if (pci_intr_establish(pa->pa_pc, ih, IPL_NET, mtd_intr, sc, self->dv_xname) == NULL) { printf(": couldn't establish interrupt"); if (intrstr != NULL) printf(" at %s", intrstr); printf("\n"); - bus_space_unmap(sc->bus_tag, sc->bus_handle, iosize); + bus_space_unmap(sc->sc_bust, sc->sc_bush, iosize); return; } printf(": %s", intrstr); - sc->dma_tag = pa->pa_dmat; - mtd_config(sc); + sc->sc_dmat = pa->pa_dmat; + mtd_attach(sc); } -- cgit v1.2.3