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