Home | History | Annotate | Line # | Download | only in xscale
      1  1.18  thorpej /*	$NetBSD: ixp425.c,v 1.18 2021/08/07 16:18:46 thorpej Exp $ */
      2   1.1   ichiro 
      3   1.1   ichiro /*
      4   1.1   ichiro  * Copyright (c) 2003
      5   1.1   ichiro  *	Ichiro FUKUHARA <ichiro (at) ichiro.org>.
      6   1.1   ichiro  * All rights reserved.
      7   1.1   ichiro  *
      8   1.1   ichiro  * Redistribution and use in source and binary forms, with or without
      9   1.1   ichiro  * modification, are permitted provided that the following conditions
     10   1.1   ichiro  * are met:
     11   1.1   ichiro  * 1. Redistributions of source code must retain the above copyright
     12   1.1   ichiro  *    notice, this list of conditions and the following disclaimer.
     13   1.1   ichiro  * 2. Redistributions in binary form must reproduce the above copyright
     14   1.1   ichiro  *    notice, this list of conditions and the following disclaimer in the
     15   1.1   ichiro  *    documentation and/or other materials provided with the distribution.
     16   1.1   ichiro  *
     17   1.1   ichiro  * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR
     18   1.1   ichiro  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19   1.1   ichiro  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20   1.1   ichiro  * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
     21   1.1   ichiro  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     22   1.1   ichiro  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     23   1.1   ichiro  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     24   1.1   ichiro  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     25   1.1   ichiro  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     26   1.1   ichiro  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     27   1.1   ichiro  * SUCH DAMAGE.
     28   1.1   ichiro  */
     29   1.1   ichiro 
     30  1.12  msaitoh #include "pci.h"
     31  1.12  msaitoh 
     32   1.1   ichiro #include <sys/cdefs.h>
     33  1.18  thorpej __KERNEL_RCSID(0, "$NetBSD: ixp425.c,v 1.18 2021/08/07 16:18:46 thorpej Exp $");
     34   1.1   ichiro 
     35   1.1   ichiro #include <sys/param.h>
     36   1.1   ichiro #include <sys/systm.h>
     37   1.1   ichiro #include <sys/device.h>
     38   1.1   ichiro #include <uvm/uvm.h>
     39   1.1   ichiro 
     40  1.15   dyoung #include <sys/bus.h>
     41   1.1   ichiro 
     42   1.1   ichiro #include <arm/xscale/ixp425reg.h>
     43   1.1   ichiro #include <arm/xscale/ixp425var.h>
     44   1.3   ichiro 
     45   1.5   ichiro struct	ixp425_softc *ixp425_softc;
     46   1.1   ichiro 
     47   1.1   ichiro void
     48  1.16  msaitoh ixp425_attach(device_t self)
     49   1.1   ichiro {
     50  1.16  msaitoh 	struct ixp425_softc *sc = device_private(self);
     51  1.12  msaitoh #if NPCI > 0
     52   1.5   ichiro 	struct pcibus_attach_args pba;
     53  1.12  msaitoh #endif
     54   1.5   ichiro 
     55  1.16  msaitoh 	sc->sc_dev = self;
     56   1.5   ichiro 	sc->sc_iot = &ixp425_bs_tag;
     57   1.5   ichiro 
     58   1.1   ichiro 	ixp425_softc = sc;
     59   1.1   ichiro 
     60   1.1   ichiro 	printf("\n");
     61   1.4   ichiro 
     62   1.4   ichiro 	/*
     63   1.5   ichiro 	 * Mapping for GPIO Registers
     64   1.5   ichiro 	 */
     65   1.5   ichiro 	if (bus_space_map(sc->sc_iot, IXP425_GPIO_HWBASE, IXP425_GPIO_SIZE,
     66   1.5   ichiro 			  0, &sc->sc_gpio_ioh))
     67  1.16  msaitoh 		panic("%s: unable to map GPIO registers", device_xname(self));
     68   1.5   ichiro 
     69  1.11      scw 	if (bus_space_map(sc->sc_iot, IXP425_EXP_HWBASE, IXP425_EXP_SIZE,
     70  1.11      scw 			  0, &sc->sc_exp_ioh))
     71  1.11      scw 		panic("%s: unable to map Expansion Bus registers",
     72  1.16  msaitoh 		    device_xname(self));
     73  1.11      scw 
     74  1.12  msaitoh #if NPCI > 0
     75  1.12  msaitoh 	/*
     76  1.12  msaitoh 	 * Mapping for PCI CSR
     77  1.12  msaitoh 	 */
     78  1.12  msaitoh 	if (bus_space_map(sc->sc_iot, IXP425_PCI_HWBASE, IXP425_PCI_SIZE,
     79  1.12  msaitoh 			  0, &sc->sc_pci_ioh))
     80  1.16  msaitoh 		panic("%s: unable to map PCI registers", device_xname(self));
     81  1.12  msaitoh 
     82   1.5   ichiro 	/*
     83   1.6      scw 	 * Invoke the board-specific PCI initialization code
     84   1.5   ichiro 	 */
     85   1.6      scw 	ixp425_md_pci_init(sc);
     86   1.4   ichiro 
     87   1.4   ichiro 	/*
     88   1.6      scw 	 * Generic initialization of the PCI chipset.
     89   1.4   ichiro 	 */
     90   1.6      scw 	ixp425_pci_init(sc);
     91   1.4   ichiro 
     92   1.4   ichiro 	/*
     93   1.4   ichiro 	 * Initialize the DMA tags.
     94   1.4   ichiro 	 */
     95   1.4   ichiro 	ixp425_pci_dma_init(sc);
     96   1.4   ichiro 
     97   1.4   ichiro 	/*
     98   1.4   ichiro 	 * Attach the PCI bus.
     99   1.4   ichiro 	 */
    100   1.4   ichiro 	pba.pba_pc = &sc->ia_pci_chipset;
    101   1.5   ichiro 	pba.pba_iot = &sc->sc_pci_iot;
    102   1.5   ichiro 	pba.pba_memt = &sc->sc_pci_memt;
    103   1.4   ichiro 	pba.pba_dmat = &sc->ia_pci_dmat;
    104   1.4   ichiro 	pba.pba_bus = 0;	/* bus number = 0 */
    105   1.5   ichiro 	pba.pba_bridgetag = NULL;
    106   1.4   ichiro 	pba.pba_intrswiz = 0;	/* XXX */
    107   1.4   ichiro 	pba.pba_intrtag = 0;
    108  1.14   dyoung 	pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY |
    109   1.5   ichiro 			PCI_FLAGS_MRL_OKAY   | PCI_FLAGS_MRM_OKAY |
    110   1.4   ichiro 			PCI_FLAGS_MWI_OKAY;
    111  1.17  thorpej 	config_found(self, &pba, pcibusprint,
    112  1.18  thorpej 	    CFARGS(.iattr = "pcibus"));
    113  1.12  msaitoh #endif
    114   1.1   ichiro }
    115