Home | History | Annotate | Line # | Download | only in smdk2xx0
smdk2800_pci.c revision 1.1
      1 /*	$NetBSD: smdk2800_pci.c,v 1.1 2002/11/20 18:06:26 bsh Exp $ */
      2 
      3 /*
      4  * Copyright (c) 2002 Fujitsu Component Limited
      5  * Copyright (c) 2002 Genetec Corporation
      6  * All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  * 3. Neither the name of The Fujitsu Component Limited nor the name of
     17  *    Genetec corporation may not be used to endorse or promote products
     18  *    derived from this software without specific prior written permission.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY FUJITSU COMPONENT LIMITED AND GENETEC
     21  * CORPORATION ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
     22  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     23  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     24  * DISCLAIMED.  IN NO EVENT SHALL FUJITSU COMPONENT LIMITED OR GENETEC
     25  * CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
     28  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     29  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  * SUCH DAMAGE.
     33  */
     34 
     35 /*
     36  * Platform specific part for S3C2800 PCI support on SMDK2800
     37  */
     38 
     39 #include <sys/param.h>
     40 #include <sys/types.h>
     41 #include <sys/device.h>
     42 #include <sys/systm.h>
     43 #include <sys/extent.h>
     44 
     45 #define _ARM32_BUS_DMA_PRIVATE
     46 #include <machine/bus.h>
     47 
     48 #include <dev/pci/pcivar.h>
     49 #include <dev/pci/pciconf.h>
     50 
     51 #include <arm/s3c2xx0/s3c2800var.h>
     52 
     53 static struct arm32_dma_range smdk2800_dma_ranges[1];
     54 
     55 static struct arm32_bus_dma_tag smdk2800_bus_dma = {
     56 	NULL,			/* _ranges: set by init routine */
     57 	0,			/* _nranges */
     58 
     59 	_bus_dmamap_create,
     60 	_bus_dmamap_destroy,
     61 	_bus_dmamap_load,
     62 	_bus_dmamap_load_mbuf,
     63 	_bus_dmamap_load_uio,
     64 	_bus_dmamap_load_raw,
     65 	_bus_dmamap_unload,
     66 	_bus_dmamap_sync,
     67 	NULL,			/* sync_post */
     68 
     69 	_bus_dmamem_alloc,
     70 	_bus_dmamem_free,
     71 	_bus_dmamem_map,
     72 	_bus_dmamem_unmap,
     73 	_bus_dmamem_mmap,
     74 };
     75 
     76 bus_dma_tag_t
     77 s3c2800_pci_dma_init(void)
     78 {
     79 	extern paddr_t physical_start, physical_end;
     80 
     81 	smdk2800_dma_ranges[0].dr_sysbase = physical_start;
     82 	smdk2800_dma_ranges[0].dr_busbase =
     83 	    0x80000000 + physical_start - S3C2800_DBANK0_START;
     84 	smdk2800_dma_ranges[0].dr_len = physical_end - physical_start;
     85 
     86 	smdk2800_bus_dma._ranges = smdk2800_dma_ranges;
     87 	smdk2800_bus_dma._nranges = 1;
     88 
     89 	return &smdk2800_bus_dma;
     90 }
     91