Add support for attaching on-chip peripherals to the BECC using
indirect configuration (because the BECC is a soft-core, it could have a variety of peripherals in the FPGA). Also add support for local untranslated DMA.
This commit is contained in:
parent
68fc25182e
commit
891be168b5
|
@ -1,7 +1,7 @@
|
||||||
/* $NetBSD: becc.c,v 1.1 2003/01/25 01:57:17 thorpej Exp $ */
|
/* $NetBSD: becc.c,v 1.2 2003/03/25 19:45:52 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002 Wasabi Systems, Inc.
|
* Copyright (c) 2002, 2003 Wasabi Systems, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
|
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
|
||||||
|
@ -76,7 +76,11 @@ struct becc_softc *becc_softc;
|
||||||
|
|
||||||
static int becc_pcibus_print(void *, const char *);
|
static int becc_pcibus_print(void *, const char *);
|
||||||
|
|
||||||
|
static int becc_search(struct device *, struct cfdata *, void *);
|
||||||
|
static int becc_print(void *, const char *);
|
||||||
|
|
||||||
static void becc_pci_dma_init(struct becc_softc *);
|
static void becc_pci_dma_init(struct becc_softc *);
|
||||||
|
static void becc_local_dma_init(struct becc_softc *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* becc_attach:
|
* becc_attach:
|
||||||
|
@ -96,7 +100,7 @@ becc_attach(struct becc_softc *sc)
|
||||||
* This allows the BECC to return the requested 4-byte word
|
* This allows the BECC to return the requested 4-byte word
|
||||||
* first when filling a cache line.
|
* first when filling a cache line.
|
||||||
*/
|
*/
|
||||||
__asm __volatile("mrc p13, 0, %0, c1, c1, 0" : "=r" (reg) );
|
__asm __volatile("mrc p13, 0, %0, c1, c1, 0" : "=r" (reg));
|
||||||
__asm __volatile("mcr p13, 0, %0, c1, c1, 0" : : "r" (reg | BCUMOD_AF));
|
__asm __volatile("mcr p13, 0, %0, c1, c1, 0" : : "r" (reg | BCUMOD_AF));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -190,6 +194,14 @@ becc_attach(struct becc_softc *sc)
|
||||||
|
|
||||||
/* Initialize the DMA tags. */
|
/* Initialize the DMA tags. */
|
||||||
becc_pci_dma_init(sc);
|
becc_pci_dma_init(sc);
|
||||||
|
becc_local_dma_init(sc);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Attach any on-chip peripherals. We used indirect config, since
|
||||||
|
* the BECC is a soft-core with a variety of peripherals, depending
|
||||||
|
* on configuration.
|
||||||
|
*/
|
||||||
|
config_search(becc_search, &sc->sc_dev, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attach the PCI bus.
|
* Attach the PCI bus.
|
||||||
|
@ -227,6 +239,38 @@ becc_pcibus_print(void *aux, const char *pnp)
|
||||||
return (UNCONF);
|
return (UNCONF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* becc_search:
|
||||||
|
*
|
||||||
|
* Indirect autoconfiguration glue for BECC.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
becc_search(struct device *parent, struct cfdata *cf, void *aux)
|
||||||
|
{
|
||||||
|
struct becc_softc *sc = (void *) parent;
|
||||||
|
struct becc_attach_args ba;
|
||||||
|
|
||||||
|
ba.ba_dmat = &sc->sc_local_dmat;
|
||||||
|
|
||||||
|
if (config_match(parent, cf, &ba) > 0)
|
||||||
|
config_attach(parent, cf, &ba, becc_print);
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* becc_print:
|
||||||
|
*
|
||||||
|
* Autoconfiguration cfprint routine when attaching
|
||||||
|
* to the BECC.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
becc_print(void *aux, const char *pnp)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (UNCONF);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* becc_pci_dma_init:
|
* becc_pci_dma_init:
|
||||||
*
|
*
|
||||||
|
@ -280,6 +324,36 @@ becc_pci_dma_init(struct becc_softc *sc)
|
||||||
dmat->_dmamem_mmap = _bus_dmamem_mmap;
|
dmat->_dmamem_mmap = _bus_dmamem_mmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* becc_local_dma_init:
|
||||||
|
*
|
||||||
|
* Initialize the local DMA tag.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
becc_local_dma_init(struct becc_softc *sc)
|
||||||
|
{
|
||||||
|
bus_dma_tag_t dmat = &sc->sc_local_dmat;
|
||||||
|
|
||||||
|
dmat->_ranges = NULL;
|
||||||
|
dmat->_nranges = 0;
|
||||||
|
|
||||||
|
dmat->_dmamap_create = _bus_dmamap_create;
|
||||||
|
dmat->_dmamap_destroy = _bus_dmamap_destroy;
|
||||||
|
dmat->_dmamap_load = _bus_dmamap_load;
|
||||||
|
dmat->_dmamap_load_mbuf = _bus_dmamap_load_mbuf;
|
||||||
|
dmat->_dmamap_load_uio = _bus_dmamap_load_uio;
|
||||||
|
dmat->_dmamap_load_raw = _bus_dmamap_load_raw;
|
||||||
|
dmat->_dmamap_unload = _bus_dmamap_unload;
|
||||||
|
dmat->_dmamap_sync_pre = _bus_dmamap_sync;
|
||||||
|
dmat->_dmamap_sync_post = NULL;
|
||||||
|
|
||||||
|
dmat->_dmamem_alloc = _bus_dmamem_alloc;
|
||||||
|
dmat->_dmamem_free = _bus_dmamem_free;
|
||||||
|
dmat->_dmamem_map = _bus_dmamem_map;
|
||||||
|
dmat->_dmamem_unmap = _bus_dmamem_unmap;
|
||||||
|
dmat->_dmamem_mmap = _bus_dmamem_mmap;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
becc_pcicore_read(struct becc_softc *sc, bus_addr_t reg)
|
becc_pcicore_read(struct becc_softc *sc, bus_addr_t reg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: beccvar.h,v 1.1 2003/01/25 01:57:20 thorpej Exp $ */
|
/* $NetBSD: beccvar.h,v 1.2 2003/03/25 19:45:52 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002 Wasabi Systems, Inc.
|
* Copyright (c) 2002 Wasabi Systems, Inc.
|
||||||
|
@ -101,6 +101,13 @@ struct becc_softc {
|
||||||
|
|
||||||
/* DMA window info for PCI DMA. */
|
/* DMA window info for PCI DMA. */
|
||||||
struct arm32_dma_range sc_pci_dma_range[3];
|
struct arm32_dma_range sc_pci_dma_range[3];
|
||||||
|
|
||||||
|
/* DMA tag for local DMA. */
|
||||||
|
struct arm32_bus_dma_tag sc_local_dmat;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct becc_attach_args {
|
||||||
|
bus_dma_tag_t ba_dmat;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int becc_rev; /* Set by early bootstrap code */
|
extern int becc_rev; /* Set by early bootstrap code */
|
||||||
|
|
Loading…
Reference in New Issue