~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sh/drivers/pci/pci-dreamcast.c

Version: ~ [ linux-5.6.3 ] ~ [ linux-5.5.16 ] ~ [ linux-5.4.31 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.114 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.175 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.218 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.218 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.82 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * PCI support for the Sega Dreamcast
  3  *
  4  * Copyright (C) 2001, 2002  M. R. Brown
  5  * Copyright (C) 2002, 2003  Paul Mundt
  6  *
  7  * This file originally bore the message (with enclosed-$):
  8  *      Id: pci.c,v 1.3 2003/05/04 19:29:46 lethal Exp
  9  *      Dreamcast PCI: Supports SEGA Broadband Adaptor only.
 10  *
 11  * This file is subject to the terms and conditions of the GNU General Public
 12  * License.  See the file "COPYING" in the main directory of this archive
 13  * for more details.
 14  */
 15 
 16 #include <linux/sched.h>
 17 #include <linux/kernel.h>
 18 #include <linux/param.h>
 19 #include <linux/interrupt.h>
 20 #include <linux/init.h>
 21 #include <linux/irq.h>
 22 #include <linux/pci.h>
 23 #include <linux/module.h>
 24 #include <asm/io.h>
 25 #include <asm/irq.h>
 26 #include <mach/pci.h>
 27 
 28 static struct resource gapspci_resources[] = {
 29         {
 30                 .name   = "GAPSPCI IO",
 31                 .start  = GAPSPCI_BBA_CONFIG,
 32                 .end    = GAPSPCI_BBA_CONFIG + GAPSPCI_BBA_CONFIG_SIZE - 1,
 33                 .flags  = IORESOURCE_IO,
 34         },  {
 35                 .name   = "GAPSPCI mem",
 36                 .start  = GAPSPCI_DMA_BASE,
 37                 .end    = GAPSPCI_DMA_BASE + GAPSPCI_DMA_SIZE - 1,
 38                 .flags  = IORESOURCE_MEM,
 39         },
 40 };
 41 
 42 static struct pci_channel dreamcast_pci_controller = {
 43         .pci_ops        = &gapspci_pci_ops,
 44         .resources      = gapspci_resources,
 45         .nr_resources   = ARRAY_SIZE(gapspci_resources),
 46         .io_offset      = 0x00000000,
 47         .mem_offset     = 0x00000000,
 48 };
 49 
 50 /*
 51  * gapspci init
 52  */
 53 
 54 static int __init gapspci_init(void)
 55 {
 56         char idbuf[16];
 57         int i;
 58 
 59         /*
 60          * FIXME: All of this wants documenting to some degree,
 61          * even some basic register definitions would be nice.
 62          *
 63          * I haven't seen anything this ugly since.. maple.
 64          */
 65 
 66         for (i=0; i<16; i++)
 67                 idbuf[i] = inb(GAPSPCI_REGS+i);
 68 
 69         if (strncmp(idbuf, "GAPSPCI_BRIDGE_2", 16))
 70                 return -ENODEV;
 71 
 72         outl(0x5a14a501, GAPSPCI_REGS+0x18);
 73 
 74         for (i=0; i<1000000; i++)
 75                 cpu_relax();
 76 
 77         if (inl(GAPSPCI_REGS+0x18) != 1)
 78                 return -EINVAL;
 79 
 80         outl(0x01000000, GAPSPCI_REGS+0x20);
 81         outl(0x01000000, GAPSPCI_REGS+0x24);
 82 
 83         outl(GAPSPCI_DMA_BASE, GAPSPCI_REGS+0x28);
 84         outl(GAPSPCI_DMA_BASE+GAPSPCI_DMA_SIZE, GAPSPCI_REGS+0x2c);
 85 
 86         outl(1, GAPSPCI_REGS+0x14);
 87         outl(1, GAPSPCI_REGS+0x34);
 88 
 89         /* Setting Broadband Adapter */
 90         outw(0xf900, GAPSPCI_BBA_CONFIG+0x06);
 91         outl(0x00000000, GAPSPCI_BBA_CONFIG+0x30);
 92         outb(0x00, GAPSPCI_BBA_CONFIG+0x3c);
 93         outb(0xf0, GAPSPCI_BBA_CONFIG+0x0d);
 94         outw(0x0006, GAPSPCI_BBA_CONFIG+0x04);
 95         outl(0x00002001, GAPSPCI_BBA_CONFIG+0x10);
 96         outl(0x01000000, GAPSPCI_BBA_CONFIG+0x14);
 97 
 98         return register_pci_controller(&dreamcast_pci_controller);
 99 }
100 arch_initcall(gapspci_init);
101 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp