/*1* BRIEF MODULE DESCRIPTION2* Alchemy/AMD Au1x00 PCI support.3*4* Copyright 2001-2003, 2007-2008 MontaVista Software Inc.5* Author: MontaVista Software, Inc. <[email protected]>6*7* Copyright (C) 2004 by Ralf Baechle ([email protected])8*9* Support for all devices (greater than 16) added by David Gathright.10*11* This program is free software; you can redistribute it and/or modify it12* under the terms of the GNU General Public License as published by the13* Free Software Foundation; either version 2 of the License, or (at your14* option) any later version.15*16* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED17* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF18* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN19* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,20* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT21* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF22* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON23* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF25* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.26*27* You should have received a copy of the GNU General Public License along28* with this program; if not, write to the Free Software Foundation, Inc.,29* 675 Mass Ave, Cambridge, MA 02139, USA.30*/3132#include <linux/pci.h>33#include <linux/kernel.h>34#include <linux/init.h>3536#include <asm/mach-au1x00/au1000.h>3738/* TBD */39static struct resource pci_io_resource = {40.start = PCI_IO_START,41.end = PCI_IO_END,42.name = "PCI IO space",43.flags = IORESOURCE_IO44};4546static struct resource pci_mem_resource = {47.start = PCI_MEM_START,48.end = PCI_MEM_END,49.name = "PCI memory space",50.flags = IORESOURCE_MEM51};5253extern struct pci_ops au1x_pci_ops;5455static struct pci_controller au1x_controller = {56.pci_ops = &au1x_pci_ops,57.io_resource = &pci_io_resource,58.mem_resource = &pci_mem_resource,59};6061#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)62static unsigned long virt_io_addr;63#endif6465static int __init au1x_pci_setup(void)66{67extern void au1x_pci_cfg_init(void);6869#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)70virt_io_addr = (unsigned long)ioremap(Au1500_PCI_IO_START,71Au1500_PCI_IO_END - Au1500_PCI_IO_START + 1);7273if (!virt_io_addr) {74printk(KERN_ERR "Unable to ioremap pci space\n");75return 1;76}77au1x_controller.io_map_base = virt_io_addr;7879#ifdef CONFIG_DMA_NONCOHERENT80{81/*82* Set the NC bit in controller for Au1500 pre-AC silicon83*/84u32 prid = read_c0_prid();8586if ((prid & 0xFF000000) == 0x01000000 && prid < 0x01030202) {87au_writel((1 << 16) | au_readl(Au1500_PCI_CFG),88Au1500_PCI_CFG);89printk(KERN_INFO "Non-coherent PCI accesses enabled\n");90}91}92#endif9394set_io_port_base(virt_io_addr);95#endif9697au1x_pci_cfg_init();9899register_pci_controller(&au1x_controller);100return 0;101}102103arch_initcall(au1x_pci_setup);104105106