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

TOMOYO Linux Cross Reference
Linux/arch/mips/pci/pci-tx4927.c

Version: ~ [ linux-5.5-rc7 ] ~ [ linux-5.4.13 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.97 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.166 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.210 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.210 ] ~ [ 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.81 ] ~ [ 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  * Based on linux/arch/mips/txx9/rbtx4938/setup.c,
  3  *          and RBTX49xx patch from CELF patch archive.
  4  *
  5  * Copyright 2001, 2003-2005 MontaVista Software Inc.
  6  * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
  7  * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007
  8  *
  9  * This file is subject to the terms and conditions of the GNU General Public
 10  * License.  See the file "COPYING" in the main directory of this archive
 11  * for more details.
 12  */
 13 #include <linux/init.h>
 14 #include <linux/pci.h>
 15 #include <linux/kernel.h>
 16 #include <linux/interrupt.h>
 17 #include <asm/txx9/generic.h>
 18 #include <asm/txx9/tx4927.h>
 19 
 20 int __init tx4927_report_pciclk(void)
 21 {
 22         int pciclk = 0;
 23 
 24         printk(KERN_INFO "PCIC --%s PCICLK:",
 25                (__raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCI66) ?
 26                " PCI66" : "");
 27         if (__raw_readq(&tx4927_ccfgptr->pcfg) & TX4927_PCFG_PCICLKEN_ALL) {
 28                 u64 ccfg = __raw_readq(&tx4927_ccfgptr->ccfg);
 29                 switch ((unsigned long)ccfg &
 30                         TX4927_CCFG_PCIDIVMODE_MASK) {
 31                 case TX4927_CCFG_PCIDIVMODE_2_5:
 32                         pciclk = txx9_cpu_clock * 2 / 5; break;
 33                 case TX4927_CCFG_PCIDIVMODE_3:
 34                         pciclk = txx9_cpu_clock / 3; break;
 35                 case TX4927_CCFG_PCIDIVMODE_5:
 36                         pciclk = txx9_cpu_clock / 5; break;
 37                 case TX4927_CCFG_PCIDIVMODE_6:
 38                         pciclk = txx9_cpu_clock / 6; break;
 39                 }
 40                 printk("Internal(%u.%uMHz)",
 41                        (pciclk + 50000) / 1000000,
 42                        ((pciclk + 50000) / 100000) % 10);
 43         } else {
 44                 printk("External");
 45                 pciclk = -1;
 46         }
 47         printk("\n");
 48         return pciclk;
 49 }
 50 
 51 int __init tx4927_pciclk66_setup(void)
 52 {
 53         int pciclk;
 54 
 55         /* Assert M66EN */
 56         tx4927_ccfg_set(TX4927_CCFG_PCI66);
 57         /* Double PCICLK (if possible) */
 58         if (__raw_readq(&tx4927_ccfgptr->pcfg) & TX4927_PCFG_PCICLKEN_ALL) {
 59                 unsigned int pcidivmode = 0;
 60                 u64 ccfg = __raw_readq(&tx4927_ccfgptr->ccfg);
 61                 pcidivmode = (unsigned long)ccfg &
 62                         TX4927_CCFG_PCIDIVMODE_MASK;
 63                 switch (pcidivmode) {
 64                 case TX4927_CCFG_PCIDIVMODE_5:
 65                 case TX4927_CCFG_PCIDIVMODE_2_5:
 66                         pcidivmode = TX4927_CCFG_PCIDIVMODE_2_5;
 67                         pciclk = txx9_cpu_clock * 2 / 5;
 68                         break;
 69                 case TX4927_CCFG_PCIDIVMODE_6:
 70                 case TX4927_CCFG_PCIDIVMODE_3:
 71                 default:
 72                         pcidivmode = TX4927_CCFG_PCIDIVMODE_3;
 73                         pciclk = txx9_cpu_clock / 3;
 74                 }
 75                 tx4927_ccfg_change(TX4927_CCFG_PCIDIVMODE_MASK,
 76                                    pcidivmode);
 77                 printk(KERN_DEBUG "PCICLK: ccfg:%08lx\n",
 78                        (unsigned long)__raw_readq(&tx4927_ccfgptr->ccfg));
 79         } else
 80                 pciclk = -1;
 81         return pciclk;
 82 }
 83 
 84 void __init tx4927_setup_pcierr_irq(void)
 85 {
 86         if (request_irq(TXX9_IRQ_BASE + TX4927_IR_PCIERR,
 87                         tx4927_pcierr_interrupt,
 88                         0, "PCI error",
 89                         (void *)TX4927_PCIC_REG))
 90                 printk(KERN_WARNING "Failed to request irq for PCIERR\n");
 91 }
 92 

~ [ 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