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

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

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php