You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[MIPS] TXx9: Reorganize PCI code
Split out PCIC dependent code and SoC dependent code from board dependent code. Now TX4927 PCIC code is independent from TX4927/TX4938 SoC code. Also fix some build problems on CONFIG_PCI=n. As a bonus, "FPCIB0 Backplane Support" is available for all TX39/TX49 boards and PCI66 support is available for all TX49 boards. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
committed by
Ralf Baechle
parent
22b1d707ff
commit
89d63fe179
+2
-1
@@ -575,7 +575,7 @@ config TOSHIBA_RBTX4927
|
||||
select HW_HAS_PCI
|
||||
select IRQ_CPU
|
||||
select IRQ_TXX9
|
||||
select I8259 if TOSHIBA_FPCIB0
|
||||
select PCI_TX4927
|
||||
select SWAP_IO_SPACE
|
||||
select SYS_HAS_CPU_TX49XX
|
||||
select SYS_SUPPORTS_32BIT_KERNEL
|
||||
@@ -598,6 +598,7 @@ config TOSHIBA_RBTX4938
|
||||
select HW_HAS_PCI
|
||||
select IRQ_CPU
|
||||
select IRQ_TXX9
|
||||
select PCI_TX4927
|
||||
select SWAP_IO_SPACE
|
||||
select SYS_HAS_CPU_TX49XX
|
||||
select SYS_SUPPORTS_32BIT_KERNEL
|
||||
|
||||
@@ -15,6 +15,8 @@ obj-$(CONFIG_MIPS_TX3927) += ops-tx3927.o
|
||||
obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
|
||||
obj-$(CONFIG_NEC_CMBVR4133) += fixup-vr4133.o
|
||||
obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
|
||||
obj-$(CONFIG_PCI_TX3927) += ops-tx3927.o
|
||||
obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o
|
||||
|
||||
#
|
||||
# These are still pretty much in the old state, watch, go blind.
|
||||
@@ -41,9 +43,9 @@ obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o
|
||||
obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o
|
||||
obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o
|
||||
obj-$(CONFIG_TANBAC_TB0287) += fixup-tb0287.o
|
||||
obj-$(CONFIG_TOSHIBA_JMR3927) += fixup-jmr3927.o pci-jmr3927.o
|
||||
obj-$(CONFIG_TOSHIBA_RBTX4927) += fixup-rbtx4927.o ops-tx4927.o
|
||||
obj-$(CONFIG_TOSHIBA_RBTX4938) += fixup-rbtx4938.o ops-tx4938.o
|
||||
obj-$(CONFIG_TOSHIBA_JMR3927) += fixup-jmr3927.o
|
||||
obj-$(CONFIG_TOSHIBA_RBTX4927) += fixup-rbtx4927.o pci-tx4927.o pci-tx4938.o
|
||||
obj-$(CONFIG_TOSHIBA_RBTX4938) += fixup-rbtx4938.o pci-tx4938.o
|
||||
obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o
|
||||
obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o
|
||||
obj-$(CONFIG_WR_PPMC) += fixup-wrppmc.o
|
||||
|
||||
@@ -28,35 +28,30 @@
|
||||
* 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <asm/txx9/pci.h>
|
||||
#include <asm/txx9/jmr3927.h>
|
||||
|
||||
int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
||||
{
|
||||
unsigned char irq = pin;
|
||||
|
||||
/* SMSC SLC90E66 IDE uses irq 14, 15 (default) */
|
||||
if (dev->vendor == PCI_VENDOR_ID_EFAR &&
|
||||
dev->device == PCI_DEVICE_ID_EFAR_SLC90E66_1)
|
||||
return irq;
|
||||
/* IRQ rotation (PICMG) */
|
||||
irq--; /* 0-3 */
|
||||
if (dev->bus->parent == NULL &&
|
||||
slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(23)) {
|
||||
if (slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(23)) {
|
||||
/* PCI CardSlot (IDSEL=A23, DevNu=12) */
|
||||
/* PCIA => PCIC (IDSEL=A23) */
|
||||
/* NOTE: JMR3927 JP1 must be set to OPEN */
|
||||
irq = (irq + 2) % 4;
|
||||
} else if (dev->bus->parent == NULL &&
|
||||
slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(22)) {
|
||||
} else if (slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(22)) {
|
||||
/* PCI CardSlot (IDSEL=A22, DevNu=11) */
|
||||
/* PCIA => PCIA (IDSEL=A22) */
|
||||
/* NOTE: JMR3927 JP1 must be set to OPEN */
|
||||
irq = (irq + 0) % 4;
|
||||
} else {
|
||||
/* PCI Backplane */
|
||||
if (txx9_pci_option & TXX9_PCI_OPT_PICMG)
|
||||
irq = (irq + 33 - slot) % 4;
|
||||
else
|
||||
irq = (irq + 3 + slot) % 4;
|
||||
}
|
||||
irq++; /* 1-4 */
|
||||
@@ -66,15 +61,13 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
||||
irq = JMR3927_IRQ_IOC_PCIA;
|
||||
break;
|
||||
case 2:
|
||||
// wrong for backplane irq = JMR3927_IRQ_IOC_PCIB;
|
||||
irq = JMR3927_IRQ_IOC_PCID;
|
||||
irq = JMR3927_IRQ_IOC_PCIB;
|
||||
break;
|
||||
case 3:
|
||||
irq = JMR3927_IRQ_IOC_PCIC;
|
||||
break;
|
||||
case 4:
|
||||
// wrong for backplane irq = JMR3927_IRQ_IOC_PCID;
|
||||
irq = JMR3927_IRQ_IOC_PCIB;
|
||||
irq = JMR3927_IRQ_IOC_PCID;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,102 +33,42 @@
|
||||
* 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <asm/txx9/tx4927.h>
|
||||
|
||||
#undef DEBUG
|
||||
#ifdef DEBUG
|
||||
#define DBG(x...) printk(x)
|
||||
#else
|
||||
#define DBG(x...)
|
||||
#endif
|
||||
|
||||
/* look up table for backplane pci irq for slots 17-20 by pin # */
|
||||
static unsigned char backplane_pci_irq[4][4] = {
|
||||
/* PJ6 SLOT: 17, PIN: 1 */ {TX4927_IRQ_IOC_PCIA,
|
||||
/* PJ6 SLOT: 17, PIN: 2 */
|
||||
TX4927_IRQ_IOC_PCIB,
|
||||
/* PJ6 SLOT: 17, PIN: 3 */
|
||||
TX4927_IRQ_IOC_PCIC,
|
||||
/* PJ6 SLOT: 17, PIN: 4 */
|
||||
TX4927_IRQ_IOC_PCID},
|
||||
/* SB SLOT: 18, PIN: 1 */ {TX4927_IRQ_IOC_PCIB,
|
||||
/* SB SLOT: 18, PIN: 2 */
|
||||
TX4927_IRQ_IOC_PCIC,
|
||||
/* SB SLOT: 18, PIN: 3 */
|
||||
TX4927_IRQ_IOC_PCID,
|
||||
/* SB SLOT: 18, PIN: 4 */
|
||||
TX4927_IRQ_IOC_PCIA},
|
||||
/* PJ5 SLOT: 19, PIN: 1 */ {TX4927_IRQ_IOC_PCIC,
|
||||
/* PJ5 SLOT: 19, PIN: 2 */
|
||||
TX4927_IRQ_IOC_PCID,
|
||||
/* PJ5 SLOT: 19, PIN: 3 */
|
||||
TX4927_IRQ_IOC_PCIA,
|
||||
/* PJ5 SLOT: 19, PIN: 4 */
|
||||
TX4927_IRQ_IOC_PCIB},
|
||||
/* PJ4 SLOT: 20, PIN: 1 */ {TX4927_IRQ_IOC_PCID,
|
||||
/* PJ4 SLOT: 20, PIN: 2 */
|
||||
TX4927_IRQ_IOC_PCIA,
|
||||
/* PJ4 SLOT: 20, PIN: 3 */
|
||||
TX4927_IRQ_IOC_PCIB,
|
||||
/* PJ4 SLOT: 20, PIN: 4 */
|
||||
TX4927_IRQ_IOC_PCIC}
|
||||
};
|
||||
|
||||
static int pci_get_irq(const struct pci_dev *dev, int pin)
|
||||
{
|
||||
unsigned char irq = pin;
|
||||
|
||||
DBG("pci_get_irq: pin is %d\n", pin);
|
||||
/* IRQ rotation */
|
||||
irq--; /* 0-3 */
|
||||
if (dev->bus->parent == NULL &&
|
||||
PCI_SLOT(dev->devfn) == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) {
|
||||
printk("Onboard PCI_SLOT(dev->devfn) is %d\n",
|
||||
PCI_SLOT(dev->devfn));
|
||||
/* IDSEL=A23 is tx4927 onboard pci slot */
|
||||
irq = (irq + PCI_SLOT(dev->devfn)) % 4;
|
||||
irq++; /* 1-4 */
|
||||
DBG("irq is now %d\n", irq);
|
||||
|
||||
switch (irq) {
|
||||
case 1:
|
||||
irq = TX4927_IRQ_IOC_PCIA;
|
||||
break;
|
||||
case 2:
|
||||
irq = TX4927_IRQ_IOC_PCIB;
|
||||
break;
|
||||
case 3:
|
||||
irq = TX4927_IRQ_IOC_PCIC;
|
||||
break;
|
||||
case 4:
|
||||
irq = TX4927_IRQ_IOC_PCID;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* PCI Backplane */
|
||||
DBG("PCI Backplane PCI_SLOT(dev->devfn) is %d\n",
|
||||
PCI_SLOT(dev->devfn));
|
||||
irq = backplane_pci_irq[PCI_SLOT(dev->devfn) - 17][irq];
|
||||
}
|
||||
DBG("assigned irq %d\n", irq);
|
||||
return irq;
|
||||
}
|
||||
#include <asm/txx9/pci.h>
|
||||
#include <asm/txx9/rbtx4927.h>
|
||||
|
||||
int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
||||
{
|
||||
unsigned char irq;
|
||||
unsigned char irq = pin;
|
||||
|
||||
printk("PCI Setup for pin %d \n", pin);
|
||||
|
||||
if (dev->device == 0x9130) /* IDE */
|
||||
irq = 14;
|
||||
/* IRQ rotation */
|
||||
irq--; /* 0-3 */
|
||||
if (slot == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) {
|
||||
/* PCI CardSlot (IDSEL=A23) */
|
||||
/* PCIA => PCIA */
|
||||
irq = (irq + 0 + slot) % 4;
|
||||
} else {
|
||||
/* PCI Backplane */
|
||||
if (txx9_pci_option & TXX9_PCI_OPT_PICMG)
|
||||
irq = (irq + 33 - slot) % 4;
|
||||
else
|
||||
irq = pci_get_irq(dev, pin);
|
||||
irq = (irq + 3 + slot) % 4;
|
||||
}
|
||||
irq++; /* 1-4 */
|
||||
|
||||
switch (irq) {
|
||||
case 1:
|
||||
irq = RBTX4927_IRQ_IOC_PCIA;
|
||||
break;
|
||||
case 2:
|
||||
irq = RBTX4927_IRQ_IOC_PCIB;
|
||||
break;
|
||||
case 3:
|
||||
irq = RBTX4927_IRQ_IOC_PCIC;
|
||||
break;
|
||||
case 4:
|
||||
irq = RBTX4927_IRQ_IOC_PCID;
|
||||
break;
|
||||
}
|
||||
return irq;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,45 +10,28 @@
|
||||
* Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <asm/txx9/pci.h>
|
||||
#include <asm/txx9/rbtx4938.h>
|
||||
|
||||
extern struct pci_controller tx4938_pci_controller[];
|
||||
|
||||
static int pci_get_irq(const struct pci_dev *dev, int pin)
|
||||
int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
||||
{
|
||||
int irq = pin;
|
||||
u8 slot = PCI_SLOT(dev->devfn);
|
||||
struct pci_controller *controller = (struct pci_controller *)dev->sysdata;
|
||||
|
||||
if (controller == &tx4938_pci_controller[1]) {
|
||||
/* TX4938 PCIC1 */
|
||||
switch (slot) {
|
||||
case TX4938_PCIC_IDSEL_AD_TO_SLOT(31):
|
||||
if (tx4938_ccfgptr->pcfg & TX4938_PCFG_ETH0_SEL)
|
||||
return RBTX4938_IRQ_IRC + TX4938_IR_ETH0;
|
||||
break;
|
||||
case TX4938_PCIC_IDSEL_AD_TO_SLOT(30):
|
||||
if (tx4938_ccfgptr->pcfg & TX4938_PCFG_ETH1_SEL)
|
||||
return RBTX4938_IRQ_IRC + TX4938_IR_ETH1;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int irq = tx4938_pcic1_map_irq(dev, slot);
|
||||
|
||||
if (irq >= 0)
|
||||
return irq;
|
||||
irq = pin;
|
||||
/* IRQ rotation */
|
||||
irq--; /* 0-3 */
|
||||
if (dev->bus->parent == NULL &&
|
||||
(slot == TX4938_PCIC_IDSEL_AD_TO_SLOT(23))) {
|
||||
if (slot == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) {
|
||||
/* PCI CardSlot (IDSEL=A23) */
|
||||
/* PCIA => PCIA (IDSEL=A23) */
|
||||
irq = (irq + 0 + slot) % 4;
|
||||
} else {
|
||||
/* PCI Backplane */
|
||||
if (txx9_pci_option & TXX9_PCI_OPT_PICMG)
|
||||
irq = (irq + 33 - slot) % 4;
|
||||
else
|
||||
irq = (irq + 3 + slot) % 4;
|
||||
}
|
||||
irq++; /* 1-4 */
|
||||
|
||||
@@ -69,19 +52,6 @@ static int pci_get_irq(const struct pci_dev *dev, int pin)
|
||||
return irq;
|
||||
}
|
||||
|
||||
int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
||||
{
|
||||
unsigned char irq = 0;
|
||||
|
||||
irq = pci_get_irq(dev, pin);
|
||||
|
||||
printk(KERN_INFO "PCI: 0x%02x:0x%02x(0x%02x,0x%02x) IRQ=%d\n",
|
||||
dev->bus->number, dev->devfn, PCI_SLOT(dev->devfn),
|
||||
PCI_FUNC(dev->devfn), irq);
|
||||
|
||||
return irq;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do platform specific device initialization at pci_enable_device() time
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Based on arch/mips/ddb5xxx/ddb5477/pci_ops.c
|
||||
*
|
||||
* Define the pci_ops for JMR3927.
|
||||
* Define the pci_ops for TX3927.
|
||||
*
|
||||
* Much of the code is derived from the original DDB5074 port by
|
||||
* Geert Uytterhoeven <geert@sonycom.com>
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/txx9/jmr3927.h>
|
||||
#include <asm/txx9/tx3927.h>
|
||||
|
||||
static inline int mkaddr(unsigned char bus, unsigned char dev_fn,
|
||||
unsigned char where)
|
||||
@@ -68,7 +68,7 @@ static inline int check_abort(void)
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static int jmr3927_pci_read_config(struct pci_bus *bus, unsigned int devfn,
|
||||
static int tx3927_pci_read_config(struct pci_bus *bus, unsigned int devfn,
|
||||
int where, int size, u32 * val)
|
||||
{
|
||||
int ret;
|
||||
@@ -94,7 +94,7 @@ static int jmr3927_pci_read_config(struct pci_bus *bus, unsigned int devfn,
|
||||
return check_abort();
|
||||
}
|
||||
|
||||
static int jmr3927_pci_write_config(struct pci_bus *bus, unsigned int devfn,
|
||||
static int tx3927_pci_write_config(struct pci_bus *bus, unsigned int devfn,
|
||||
int where, int size, u32 val)
|
||||
{
|
||||
int ret;
|
||||
@@ -125,7 +125,80 @@ static int jmr3927_pci_write_config(struct pci_bus *bus, unsigned int devfn,
|
||||
return check_abort();
|
||||
}
|
||||
|
||||
struct pci_ops jmr3927_pci_ops = {
|
||||
jmr3927_pci_read_config,
|
||||
jmr3927_pci_write_config,
|
||||
static struct pci_ops tx3927_pci_ops = {
|
||||
.read = tx3927_pci_read_config,
|
||||
.write = tx3927_pci_write_config,
|
||||
};
|
||||
|
||||
void __init tx3927_pcic_setup(struct pci_controller *channel,
|
||||
unsigned long sdram_size, int extarb)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned long io_base =
|
||||
channel->io_resource->start + mips_io_port_base - IO_BASE;
|
||||
unsigned long io_size =
|
||||
channel->io_resource->end - channel->io_resource->start;
|
||||
unsigned long io_pciaddr =
|
||||
channel->io_resource->start - channel->io_offset;
|
||||
unsigned long mem_base =
|
||||
channel->mem_resource->start;
|
||||
unsigned long mem_size =
|
||||
channel->mem_resource->end - channel->mem_resource->start;
|
||||
unsigned long mem_pciaddr =
|
||||
channel->mem_resource->start - channel->mem_offset;
|
||||
|
||||
printk(KERN_INFO "TX3927 PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s",
|
||||
tx3927_pcicptr->did, tx3927_pcicptr->vid,
|
||||
tx3927_pcicptr->rid,
|
||||
extarb ? "External" : "Internal");
|
||||
channel->pci_ops = &tx3927_pci_ops;
|
||||
|
||||
local_irq_save(flags);
|
||||
/* Disable External PCI Config. Access */
|
||||
tx3927_pcicptr->lbc = TX3927_PCIC_LBC_EPCAD;
|
||||
#ifdef __BIG_ENDIAN
|
||||
tx3927_pcicptr->lbc |= TX3927_PCIC_LBC_IBSE |
|
||||
TX3927_PCIC_LBC_TIBSE |
|
||||
TX3927_PCIC_LBC_TMFBSE | TX3927_PCIC_LBC_MSDSE;
|
||||
#endif
|
||||
/* LB->PCI mappings */
|
||||
tx3927_pcicptr->iomas = ~(io_size - 1);
|
||||
tx3927_pcicptr->ilbioma = io_base;
|
||||
tx3927_pcicptr->ipbioma = io_pciaddr;
|
||||
tx3927_pcicptr->mmas = ~(mem_size - 1);
|
||||
tx3927_pcicptr->ilbmma = mem_base;
|
||||
tx3927_pcicptr->ipbmma = mem_pciaddr;
|
||||
/* PCI->LB mappings */
|
||||
tx3927_pcicptr->iobas = 0xffffffff;
|
||||
tx3927_pcicptr->ioba = 0;
|
||||
tx3927_pcicptr->tlbioma = 0;
|
||||
tx3927_pcicptr->mbas = ~(sdram_size - 1);
|
||||
tx3927_pcicptr->mba = 0;
|
||||
tx3927_pcicptr->tlbmma = 0;
|
||||
/* Enable Direct mapping Address Space Decoder */
|
||||
tx3927_pcicptr->lbc |= TX3927_PCIC_LBC_ILMDE | TX3927_PCIC_LBC_ILIDE;
|
||||
|
||||
/* Clear All Local Bus Status */
|
||||
tx3927_pcicptr->lbstat = TX3927_PCIC_LBIM_ALL;
|
||||
/* Enable All Local Bus Interrupts */
|
||||
tx3927_pcicptr->lbim = TX3927_PCIC_LBIM_ALL;
|
||||
/* Clear All PCI Status Error */
|
||||
tx3927_pcicptr->pcistat = TX3927_PCIC_PCISTATIM_ALL;
|
||||
/* Enable All PCI Status Error Interrupts */
|
||||
tx3927_pcicptr->pcistatim = TX3927_PCIC_PCISTATIM_ALL;
|
||||
|
||||
/* PCIC Int => IRC IRQ10 */
|
||||
tx3927_pcicptr->il = TX3927_IR_PCI;
|
||||
/* Target Control (per errata) */
|
||||
tx3927_pcicptr->tc = TX3927_PCIC_TC_OF8E | TX3927_PCIC_TC_IF8E;
|
||||
|
||||
/* Enable Bus Arbiter */
|
||||
if (!extarb)
|
||||
tx3927_pcicptr->pbapmc = TX3927_PCIC_PBAPMC_PBAEN;
|
||||
|
||||
tx3927_pcicptr->pcicmd = PCI_COMMAND_MASTER |
|
||||
PCI_COMMAND_MEMORY |
|
||||
PCI_COMMAND_IO |
|
||||
PCI_COMMAND_PARITY | PCI_COMMAND_SERR;
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
+365
-163
File diff suppressed because it is too large
Load Diff
@@ -1,214 +0,0 @@
|
||||
/*
|
||||
* Define the pci_ops for the Toshiba rbtx4938
|
||||
* Copyright (C) 2000-2001 Toshiba Corporation
|
||||
*
|
||||
* 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
|
||||
* terms of the GNU General Public License version 2. This program is
|
||||
* licensed "as is" without any warranty of any kind, whether express
|
||||
* or implied.
|
||||
*
|
||||
* Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/txx9/rbtx4938.h>
|
||||
|
||||
/* initialize in setup */
|
||||
struct resource pci_io_resource = {
|
||||
.name = "pci IO space",
|
||||
.start = 0,
|
||||
.end = 0,
|
||||
.flags = IORESOURCE_IO
|
||||
};
|
||||
|
||||
/* initialize in setup */
|
||||
struct resource pci_mem_resource = {
|
||||
.name = "pci memory space",
|
||||
.start = 0,
|
||||
.end = 0,
|
||||
.flags = IORESOURCE_MEM
|
||||
};
|
||||
|
||||
struct resource tx4938_pcic1_pci_io_resource = {
|
||||
.name = "PCI1 IO",
|
||||
.start = 0,
|
||||
.end = 0,
|
||||
.flags = IORESOURCE_IO
|
||||
};
|
||||
struct resource tx4938_pcic1_pci_mem_resource = {
|
||||
.name = "PCI1 mem",
|
||||
.start = 0,
|
||||
.end = 0,
|
||||
.flags = IORESOURCE_MEM
|
||||
};
|
||||
|
||||
static int mkaddr(int bus, int dev_fn, int where,
|
||||
struct tx4938_pcic_reg *pcicptr)
|
||||
{
|
||||
if (bus > 0) {
|
||||
/* Type 1 configuration */
|
||||
pcicptr->g2pcfgadrs = ((bus & 0xff) << 0x10) |
|
||||
((dev_fn & 0xff) << 0x08) | (where & 0xfc) | 1;
|
||||
} else {
|
||||
if (dev_fn >= PCI_DEVFN(TX4938_PCIC_MAX_DEVNU, 0))
|
||||
return -1;
|
||||
|
||||
/* Type 0 configuration */
|
||||
pcicptr->g2pcfgadrs = ((bus & 0xff) << 0x10) |
|
||||
((dev_fn & 0xff) << 0x08) | (where & 0xfc);
|
||||
}
|
||||
/* clear M_ABORT and Disable M_ABORT Int. */
|
||||
pcicptr->pcistatus =
|
||||
(pcicptr->pcistatus & 0x0000ffff) |
|
||||
(PCI_STATUS_REC_MASTER_ABORT << 16);
|
||||
pcicptr->pcimask &= ~PCI_STATUS_REC_MASTER_ABORT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_abort(struct tx4938_pcic_reg *pcicptr)
|
||||
{
|
||||
int code = PCIBIOS_SUCCESSFUL;
|
||||
/* wait write cycle completion before checking error status */
|
||||
while (pcicptr->pcicstatus & TX4938_PCIC_PCICSTATUS_IWB)
|
||||
;
|
||||
if (pcicptr->pcistatus & (PCI_STATUS_REC_MASTER_ABORT << 16)) {
|
||||
pcicptr->pcistatus =
|
||||
(pcicptr->
|
||||
pcistatus & 0x0000ffff) | (PCI_STATUS_REC_MASTER_ABORT
|
||||
<< 16);
|
||||
pcicptr->pcimask |= PCI_STATUS_REC_MASTER_ABORT;
|
||||
code = PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
extern struct pci_controller tx4938_pci_controller[];
|
||||
extern struct tx4938_pcic_reg *get_tx4938_pcicptr(int ch);
|
||||
|
||||
static struct tx4938_pcic_reg *pci_bus_to_pcicptr(struct pci_bus *bus)
|
||||
{
|
||||
struct pci_controller *channel = bus->sysdata;
|
||||
return get_tx4938_pcicptr(channel - &tx4938_pci_controller[0]);
|
||||
}
|
||||
|
||||
static int tx4938_pcibios_read_config(struct pci_bus *bus, unsigned int devfn,
|
||||
int where, int size, u32 * val)
|
||||
{
|
||||
int retval, dev, busno, func;
|
||||
struct tx4938_pcic_reg *pcicptr = pci_bus_to_pcicptr(bus);
|
||||
void __iomem *cfgdata =
|
||||
(void __iomem *)(unsigned long)&pcicptr->g2pcfgdata;
|
||||
|
||||
dev = PCI_SLOT(devfn);
|
||||
func = PCI_FUNC(devfn);
|
||||
|
||||
/* check if the bus is top-level */
|
||||
if (bus->parent != NULL)
|
||||
busno = bus->number;
|
||||
else {
|
||||
busno = 0;
|
||||
}
|
||||
|
||||
if (mkaddr(busno, devfn, where, pcicptr))
|
||||
return -1;
|
||||
|
||||
switch (size) {
|
||||
case 1:
|
||||
#ifdef __BIG_ENDIAN
|
||||
cfgdata += (where & 3) ^ 3;
|
||||
#else
|
||||
cfgdata += where & 3;
|
||||
#endif
|
||||
*val = __raw_readb(cfgdata);
|
||||
break;
|
||||
case 2:
|
||||
#ifdef __BIG_ENDIAN
|
||||
cfgdata += (where & 2) ^ 2;
|
||||
#else
|
||||
cfgdata += where & 2;
|
||||
#endif
|
||||
*val = __raw_readw(cfgdata);
|
||||
break;
|
||||
case 4:
|
||||
*val = __raw_readl(cfgdata);
|
||||
break;
|
||||
}
|
||||
|
||||
retval = check_abort(pcicptr);
|
||||
if (retval == PCIBIOS_DEVICE_NOT_FOUND)
|
||||
*val = 0xffffffff;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int tx4938_pcibios_write_config(struct pci_bus *bus, unsigned int devfn, int where,
|
||||
int size, u32 val)
|
||||
{
|
||||
int dev, busno, func;
|
||||
struct tx4938_pcic_reg *pcicptr = pci_bus_to_pcicptr(bus);
|
||||
void __iomem *cfgdata =
|
||||
(void __iomem *)(unsigned long)&pcicptr->g2pcfgdata;
|
||||
|
||||
busno = bus->number;
|
||||
dev = PCI_SLOT(devfn);
|
||||
func = PCI_FUNC(devfn);
|
||||
|
||||
/* check if the bus is top-level */
|
||||
if (bus->parent != NULL) {
|
||||
busno = bus->number;
|
||||
} else {
|
||||
busno = 0;
|
||||
}
|
||||
|
||||
if (mkaddr(busno, devfn, where, pcicptr))
|
||||
return -1;
|
||||
|
||||
switch (size) {
|
||||
case 1:
|
||||
#ifdef __BIG_ENDIAN
|
||||
cfgdata += (where & 3) ^ 3;
|
||||
#else
|
||||
cfgdata += where & 3;
|
||||
#endif
|
||||
__raw_writeb(val, cfgdata);
|
||||
break;
|
||||
case 2:
|
||||
#ifdef __BIG_ENDIAN
|
||||
cfgdata += (where & 2) ^ 2;
|
||||
#else
|
||||
cfgdata += where & 2;
|
||||
#endif
|
||||
__raw_writew(val, cfgdata);
|
||||
break;
|
||||
case 4:
|
||||
__raw_writel(val, cfgdata);
|
||||
break;
|
||||
}
|
||||
|
||||
return check_abort(pcicptr);
|
||||
}
|
||||
|
||||
struct pci_ops tx4938_pci_ops = {
|
||||
tx4938_pcibios_read_config,
|
||||
tx4938_pcibios_write_config
|
||||
};
|
||||
|
||||
struct pci_controller tx4938_pci_controller[] = {
|
||||
/* h/w only supports devices 0x00 to 0x14 */
|
||||
{
|
||||
.pci_ops = &tx4938_pci_ops,
|
||||
.io_resource = &pci_io_resource,
|
||||
.mem_resource = &pci_mem_resource,
|
||||
},
|
||||
/* h/w only supports devices 0x00 to 0x14 */
|
||||
{
|
||||
.pci_ops = &tx4938_pci_ops,
|
||||
.io_resource = &tx4938_pcic1_pci_io_resource,
|
||||
.mem_resource = &tx4938_pcic1_pci_mem_resource,
|
||||
}
|
||||
};
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2001 MontaVista Software Inc.
|
||||
* Author: MontaVista Software, Inc.
|
||||
* ahennessy@mvista.com
|
||||
*
|
||||
* Copyright (C) 2000-2001 Toshiba Corporation
|
||||
* Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <asm/txx9/jmr3927.h>
|
||||
#include <asm/debug.h>
|
||||
|
||||
struct resource pci_io_resource = {
|
||||
.name = "IO MEM",
|
||||
.start = 0x1000, /* reserve regacy I/O space */
|
||||
.end = 0x1000 + JMR3927_PCIIO_SIZE - 1,
|
||||
.flags = IORESOURCE_IO
|
||||
};
|
||||
|
||||
struct resource pci_mem_resource = {
|
||||
.name = "PCI MEM",
|
||||
.start = JMR3927_PCIMEM,
|
||||
.end = JMR3927_PCIMEM + JMR3927_PCIMEM_SIZE - 1,
|
||||
.flags = IORESOURCE_MEM
|
||||
};
|
||||
|
||||
extern struct pci_ops jmr3927_pci_ops;
|
||||
|
||||
struct pci_controller jmr3927_controller = {
|
||||
.pci_ops = &jmr3927_pci_ops,
|
||||
.io_resource = &pci_io_resource,
|
||||
.mem_resource = &pci_mem_resource,
|
||||
.mem_offset = JMR3927_PCIMEM
|
||||
};
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* linux/arch/mips/pci/pci-tx4927.c
|
||||
*
|
||||
* Based on linux/arch/mips/txx9/rbtx4938/setup.c,
|
||||
* and RBTX49xx patch from CELF patch archive.
|
||||
*
|
||||
* Copyright 2001, 2003-2005 MontaVista Software Inc.
|
||||
* Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
|
||||
* (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
#include <linux/init.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <asm/txx9/generic.h>
|
||||
#include <asm/txx9/tx4927.h>
|
||||
|
||||
int __init tx4927_report_pciclk(void)
|
||||
{
|
||||
int pciclk = 0;
|
||||
|
||||
printk(KERN_INFO "PCIC --%s PCICLK:",
|
||||
(__raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCI66) ?
|
||||
" PCI66" : "");
|
||||
if (__raw_readq(&tx4927_ccfgptr->pcfg) & TX4927_PCFG_PCICLKEN_ALL) {
|
||||
u64 ccfg = __raw_readq(&tx4927_ccfgptr->ccfg);
|
||||
switch ((unsigned long)ccfg &
|
||||
TX4927_CCFG_PCIDIVMODE_MASK) {
|
||||
case TX4927_CCFG_PCIDIVMODE_2_5:
|
||||
pciclk = txx9_cpu_clock * 2 / 5; break;
|
||||
case TX4927_CCFG_PCIDIVMODE_3:
|
||||
pciclk = txx9_cpu_clock / 3; break;
|
||||
case TX4927_CCFG_PCIDIVMODE_5:
|
||||
pciclk = txx9_cpu_clock / 5; break;
|
||||
case TX4927_CCFG_PCIDIVMODE_6:
|
||||
pciclk = txx9_cpu_clock / 6; break;
|
||||
}
|
||||
printk("Internal(%u.%uMHz)",
|
||||
(pciclk + 50000) / 1000000,
|
||||
((pciclk + 50000) / 100000) % 10);
|
||||
} else {
|
||||
printk("External");
|
||||
pciclk = -1;
|
||||
}
|
||||
printk("\n");
|
||||
return pciclk;
|
||||
}
|
||||
|
||||
int __init tx4927_pciclk66_setup(void)
|
||||
{
|
||||
int pciclk;
|
||||
|
||||
/* Assert M66EN */
|
||||
tx4927_ccfg_set(TX4927_CCFG_PCI66);
|
||||
/* Double PCICLK (if possible) */
|
||||
if (__raw_readq(&tx4927_ccfgptr->pcfg) & TX4927_PCFG_PCICLKEN_ALL) {
|
||||
unsigned int pcidivmode = 0;
|
||||
u64 ccfg = __raw_readq(&tx4927_ccfgptr->ccfg);
|
||||
pcidivmode = (unsigned long)ccfg &
|
||||
TX4927_CCFG_PCIDIVMODE_MASK;
|
||||
switch (pcidivmode) {
|
||||
case TX4927_CCFG_PCIDIVMODE_5:
|
||||
case TX4927_CCFG_PCIDIVMODE_2_5:
|
||||
pcidivmode = TX4927_CCFG_PCIDIVMODE_2_5;
|
||||
pciclk = txx9_cpu_clock * 2 / 5;
|
||||
break;
|
||||
case TX4927_CCFG_PCIDIVMODE_6:
|
||||
case TX4927_CCFG_PCIDIVMODE_3:
|
||||
default:
|
||||
pcidivmode = TX4927_CCFG_PCIDIVMODE_3;
|
||||
pciclk = txx9_cpu_clock / 3;
|
||||
}
|
||||
tx4927_ccfg_change(TX4927_CCFG_PCIDIVMODE_MASK,
|
||||
pcidivmode);
|
||||
printk(KERN_DEBUG "PCICLK: ccfg:%08lx\n",
|
||||
(unsigned long)__raw_readq(&tx4927_ccfgptr->ccfg));
|
||||
} else
|
||||
pciclk = -1;
|
||||
return pciclk;
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* linux/arch/mips/pci/pci-tx4938.c
|
||||
*
|
||||
* Based on linux/arch/mips/txx9/rbtx4938/setup.c,
|
||||
* and RBTX49xx patch from CELF patch archive.
|
||||
*
|
||||
* Copyright 2001, 2003-2005 MontaVista Software Inc.
|
||||
* Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
|
||||
* (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
#include <linux/init.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <asm/txx9/generic.h>
|
||||
#include <asm/txx9/tx4938.h>
|
||||
|
||||
int __init tx4938_report_pciclk(void)
|
||||
{
|
||||
int pciclk = 0;
|
||||
|
||||
printk(KERN_INFO "PCIC --%s PCICLK:",
|
||||
(__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCI66) ?
|
||||
" PCI66" : "");
|
||||
if (__raw_readq(&tx4938_ccfgptr->pcfg) & TX4938_PCFG_PCICLKEN_ALL) {
|
||||
u64 ccfg = __raw_readq(&tx4938_ccfgptr->ccfg);
|
||||
switch ((unsigned long)ccfg &
|
||||
TX4938_CCFG_PCIDIVMODE_MASK) {
|
||||
case TX4938_CCFG_PCIDIVMODE_4:
|
||||
pciclk = txx9_cpu_clock / 4; break;
|
||||
case TX4938_CCFG_PCIDIVMODE_4_5:
|
||||
pciclk = txx9_cpu_clock * 2 / 9; break;
|
||||
case TX4938_CCFG_PCIDIVMODE_5:
|
||||
pciclk = txx9_cpu_clock / 5; break;
|
||||
case TX4938_CCFG_PCIDIVMODE_5_5:
|
||||
pciclk = txx9_cpu_clock * 2 / 11; break;
|
||||
case TX4938_CCFG_PCIDIVMODE_8:
|
||||
pciclk = txx9_cpu_clock / 8; break;
|
||||
case TX4938_CCFG_PCIDIVMODE_9:
|
||||
pciclk = txx9_cpu_clock / 9; break;
|
||||
case TX4938_CCFG_PCIDIVMODE_10:
|
||||
pciclk = txx9_cpu_clock / 10; break;
|
||||
case TX4938_CCFG_PCIDIVMODE_11:
|
||||
pciclk = txx9_cpu_clock / 11; break;
|
||||
}
|
||||
printk("Internal(%u.%uMHz)",
|
||||
(pciclk + 50000) / 1000000,
|
||||
((pciclk + 50000) / 100000) % 10);
|
||||
} else {
|
||||
printk("External");
|
||||
pciclk = -1;
|
||||
}
|
||||
printk("\n");
|
||||
return pciclk;
|
||||
}
|
||||
|
||||
void __init tx4938_report_pci1clk(void)
|
||||
{
|
||||
__u64 ccfg = __raw_readq(&tx4938_ccfgptr->ccfg);
|
||||
unsigned int pciclk =
|
||||
txx9_gbus_clock / ((ccfg & TX4938_CCFG_PCI1DMD) ? 4 : 2);
|
||||
|
||||
printk(KERN_INFO "PCIC1 -- %sPCICLK:%u.%uMHz\n",
|
||||
(ccfg & TX4938_CCFG_PCI1_66) ? "PCI66 " : "",
|
||||
(pciclk + 50000) / 1000000,
|
||||
((pciclk + 50000) / 100000) % 10);
|
||||
}
|
||||
|
||||
int __init tx4938_pciclk66_setup(void)
|
||||
{
|
||||
int pciclk;
|
||||
|
||||
/* Assert M66EN */
|
||||
tx4938_ccfg_set(TX4938_CCFG_PCI66);
|
||||
/* Double PCICLK (if possible) */
|
||||
if (__raw_readq(&tx4938_ccfgptr->pcfg) & TX4938_PCFG_PCICLKEN_ALL) {
|
||||
unsigned int pcidivmode = 0;
|
||||
u64 ccfg = __raw_readq(&tx4938_ccfgptr->ccfg);
|
||||
pcidivmode = (unsigned long)ccfg &
|
||||
TX4938_CCFG_PCIDIVMODE_MASK;
|
||||
switch (pcidivmode) {
|
||||
case TX4938_CCFG_PCIDIVMODE_8:
|
||||
case TX4938_CCFG_PCIDIVMODE_4:
|
||||
pcidivmode = TX4938_CCFG_PCIDIVMODE_4;
|
||||
pciclk = txx9_cpu_clock / 4;
|
||||
break;
|
||||
case TX4938_CCFG_PCIDIVMODE_9:
|
||||
case TX4938_CCFG_PCIDIVMODE_4_5:
|
||||
pcidivmode = TX4938_CCFG_PCIDIVMODE_4_5;
|
||||
pciclk = txx9_cpu_clock * 2 / 9;
|
||||
break;
|
||||
case TX4938_CCFG_PCIDIVMODE_10:
|
||||
case TX4938_CCFG_PCIDIVMODE_5:
|
||||
pcidivmode = TX4938_CCFG_PCIDIVMODE_5;
|
||||
pciclk = txx9_cpu_clock / 5;
|
||||
break;
|
||||
case TX4938_CCFG_PCIDIVMODE_11:
|
||||
case TX4938_CCFG_PCIDIVMODE_5_5:
|
||||
default:
|
||||
pcidivmode = TX4938_CCFG_PCIDIVMODE_5_5;
|
||||
pciclk = txx9_cpu_clock * 2 / 11;
|
||||
break;
|
||||
}
|
||||
tx4938_ccfg_change(TX4938_CCFG_PCIDIVMODE_MASK,
|
||||
pcidivmode);
|
||||
printk(KERN_DEBUG "PCICLK: ccfg:%08lx\n",
|
||||
(unsigned long)__raw_readq(&tx4938_ccfgptr->ccfg));
|
||||
} else
|
||||
pciclk = -1;
|
||||
return pciclk;
|
||||
}
|
||||
|
||||
int tx4938_pcic1_map_irq(const struct pci_dev *dev, u8 slot)
|
||||
{
|
||||
if (get_tx4927_pcicptr(dev->bus->sysdata) == tx4938_pcic1ptr) {
|
||||
switch (slot) {
|
||||
case TX4927_PCIC_IDSEL_AD_TO_SLOT(31):
|
||||
if (__raw_readq(&tx4938_ccfgptr->pcfg) &
|
||||
TX4938_PCFG_ETH0_SEL)
|
||||
return TXX9_IRQ_BASE + TX4938_IR_ETH0;
|
||||
break;
|
||||
case TX4927_PCIC_IDSEL_AD_TO_SLOT(30):
|
||||
if (__raw_readq(&tx4938_ccfgptr->pcfg) &
|
||||
TX4938_PCFG_ETH1_SEL)
|
||||
return TXX9_IRQ_BASE + TX4938_IR_ETH1;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
+10
-1
@@ -1,6 +1,12 @@
|
||||
config TOSHIBA_FPCIB0
|
||||
bool "FPCIB0 Backplane Support"
|
||||
depends on TOSHIBA_RBTX4927
|
||||
depends on PCI && (SYS_HAS_CPU_TX49XX || SYS_HAS_CPU_TX39XX)
|
||||
select I8259
|
||||
|
||||
config PICMG_PCI_BACKPLANE_DEFAULT
|
||||
bool "Support for PICMG PCI Backplane"
|
||||
depends on PCI && (SYS_HAS_CPU_TX49XX || SYS_HAS_CPU_TX39XX)
|
||||
default y if !TOSHIBA_FPCIB0
|
||||
|
||||
if TOSHIBA_RBTX4938
|
||||
|
||||
@@ -26,3 +32,6 @@ config TX4938_NAND_BOOT
|
||||
Select this option if you need to use NAND boot.
|
||||
|
||||
endif
|
||||
|
||||
config PCI_TX4927
|
||||
bool
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
# Makefile for common code for TXx9 based systems
|
||||
#
|
||||
|
||||
obj-y += setup.o
|
||||
obj-$(CONFIG_PCI) += pci.o
|
||||
obj-$(CONFIG_TOSHIBA_RBTX4927) += mem_tx4927.o irq_tx4927.o
|
||||
obj-$(CONFIG_TOSHIBA_RBTX4938) += mem_tx4938.o irq_tx4938.o
|
||||
obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o
|
||||
|
||||
@@ -0,0 +1,377 @@
|
||||
/*
|
||||
* linux/arch/mips/txx9/pci.c
|
||||
*
|
||||
* Based on linux/arch/mips/txx9/rbtx4927/setup.c,
|
||||
* linux/arch/mips/txx9/rbtx4938/setup.c,
|
||||
* and RBTX49xx patch from CELF patch archive.
|
||||
*
|
||||
* Copyright 2001-2005 MontaVista Software Inc.
|
||||
* Copyright (C) 1996, 97, 2001, 04 Ralf Baechle (ralf@linux-mips.org)
|
||||
* (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
#include <linux/delay.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/io.h>
|
||||
#include <asm/txx9/pci.h>
|
||||
#ifdef CONFIG_TOSHIBA_FPCIB0
|
||||
#include <linux/interrupt.h>
|
||||
#include <asm/i8259.h>
|
||||
#include <asm/txx9/smsc_fdc37m81x.h>
|
||||
#endif
|
||||
|
||||
static int __init
|
||||
early_read_config_word(struct pci_controller *hose,
|
||||
int top_bus, int bus, int devfn, int offset, u16 *value)
|
||||
{
|
||||
struct pci_dev fake_dev;
|
||||
struct pci_bus fake_bus;
|
||||
|
||||
fake_dev.bus = &fake_bus;
|
||||
fake_dev.sysdata = hose;
|
||||
fake_dev.devfn = devfn;
|
||||
fake_bus.number = bus;
|
||||
fake_bus.sysdata = hose;
|
||||
fake_bus.ops = hose->pci_ops;
|
||||
|
||||
if (bus != top_bus)
|
||||
/* Fake a parent bus structure. */
|
||||
fake_bus.parent = &fake_bus;
|
||||
else
|
||||
fake_bus.parent = NULL;
|
||||
|
||||
return pci_read_config_word(&fake_dev, offset, value);
|
||||
}
|
||||
|
||||
int __init txx9_pci66_check(struct pci_controller *hose, int top_bus,
|
||||
int current_bus)
|
||||
{
|
||||
u32 pci_devfn;
|
||||
unsigned short vid;
|
||||
int cap66 = -1;
|
||||
u16 stat;
|
||||
|
||||
/* It seems SLC90E66 needs some time after PCI reset... */
|
||||
mdelay(80);
|
||||
|
||||
printk(KERN_INFO "PCI: Checking 66MHz capabilities...\n");
|
||||
|
||||
for (pci_devfn = 0; pci_devfn < 0xff; pci_devfn++) {
|
||||
if (PCI_FUNC(pci_devfn))
|
||||
continue;
|
||||
if (early_read_config_word(hose, top_bus, current_bus,
|
||||
pci_devfn, PCI_VENDOR_ID, &vid) !=
|
||||
PCIBIOS_SUCCESSFUL)
|
||||
continue;
|
||||
if (vid == 0xffff)
|
||||
continue;
|
||||
|
||||
/* check 66MHz capability */
|
||||
if (cap66 < 0)
|
||||
cap66 = 1;
|
||||
if (cap66) {
|
||||
early_read_config_word(hose, top_bus, current_bus,
|
||||
pci_devfn, PCI_STATUS, &stat);
|
||||
if (!(stat & PCI_STATUS_66MHZ)) {
|
||||
printk(KERN_DEBUG
|
||||
"PCI: %02x:%02x not 66MHz capable.\n",
|
||||
current_bus, pci_devfn);
|
||||
cap66 = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cap66 > 0;
|
||||
}
|
||||
|
||||
static struct resource primary_pci_mem_res[2] = {
|
||||
{ .name = "PCI MEM" },
|
||||
{ .name = "PCI MMIO" },
|
||||
};
|
||||
static struct resource primary_pci_io_res = { .name = "PCI IO" };
|
||||
struct pci_controller txx9_primary_pcic = {
|
||||
.mem_resource = &primary_pci_mem_res[0],
|
||||
.io_resource = &primary_pci_io_res,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
int txx9_pci_mem_high __initdata = 1;
|
||||
#else
|
||||
int txx9_pci_mem_high __initdata;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* allocate pci_controller and resources.
|
||||
* mem_base, io_base: physical addresss. 0 for auto assignment.
|
||||
* mem_size and io_size means max size on auto assignment.
|
||||
* pcic must be &txx9_primary_pcic or NULL.
|
||||
*/
|
||||
struct pci_controller *__init
|
||||
txx9_alloc_pci_controller(struct pci_controller *pcic,
|
||||
unsigned long mem_base, unsigned long mem_size,
|
||||
unsigned long io_base, unsigned long io_size)
|
||||
{
|
||||
struct pcic {
|
||||
struct pci_controller c;
|
||||
struct resource r_mem[2];
|
||||
struct resource r_io;
|
||||
} *new = NULL;
|
||||
int min_size = 0x10000;
|
||||
|
||||
if (!pcic) {
|
||||
new = kzalloc(sizeof(*new), GFP_KERNEL);
|
||||
if (!new)
|
||||
return NULL;
|
||||
new->r_mem[0].name = "PCI mem";
|
||||
new->r_mem[1].name = "PCI mmio";
|
||||
new->r_io.name = "PCI io";
|
||||
new->c.mem_resource = new->r_mem;
|
||||
new->c.io_resource = &new->r_io;
|
||||
pcic = &new->c;
|
||||
} else
|
||||
BUG_ON(pcic != &txx9_primary_pcic);
|
||||
pcic->io_resource->flags = IORESOURCE_IO;
|
||||
|
||||
/*
|
||||
* for auto assignment, first search a (big) region for PCI
|
||||
* MEM, then search a region for PCI IO.
|
||||
*/
|
||||
if (mem_base) {
|
||||
pcic->mem_resource[0].start = mem_base;
|
||||
pcic->mem_resource[0].end = mem_base + mem_size - 1;
|
||||
if (request_resource(&iomem_resource, &pcic->mem_resource[0]))
|
||||
goto free_and_exit;
|
||||
} else {
|
||||
unsigned long min = 0, max = 0x20000000; /* low 512MB */
|
||||
if (!mem_size) {
|
||||
/* default size for auto assignment */
|
||||
if (txx9_pci_mem_high)
|
||||
mem_size = 0x20000000; /* mem:512M(max) */
|
||||
else
|
||||
mem_size = 0x08000000; /* mem:128M(max) */
|
||||
}
|
||||
if (txx9_pci_mem_high) {
|
||||
min = 0x20000000;
|
||||
max = 0xe0000000;
|
||||
}
|
||||
/* search free region for PCI MEM */
|
||||
for (; mem_size >= min_size; mem_size /= 2) {
|
||||
if (allocate_resource(&iomem_resource,
|
||||
&pcic->mem_resource[0],
|
||||
mem_size, min, max,
|
||||
mem_size, NULL, NULL) == 0)
|
||||
break;
|
||||
}
|
||||
if (mem_size < min_size)
|
||||
goto free_and_exit;
|
||||
}
|
||||
|
||||
pcic->mem_resource[1].flags = IORESOURCE_MEM | IORESOURCE_BUSY;
|
||||
if (io_base) {
|
||||
pcic->mem_resource[1].start = io_base;
|
||||
pcic->mem_resource[1].end = io_base + io_size - 1;
|
||||
if (request_resource(&iomem_resource, &pcic->mem_resource[1]))
|
||||
goto release_and_exit;
|
||||
} else {
|
||||
if (!io_size)
|
||||
/* default size for auto assignment */
|
||||
io_size = 0x01000000; /* io:16M(max) */
|
||||
/* search free region for PCI IO in low 512MB */
|
||||
for (; io_size >= min_size; io_size /= 2) {
|
||||
if (allocate_resource(&iomem_resource,
|
||||
&pcic->mem_resource[1],
|
||||
io_size, 0, 0x20000000,
|
||||
io_size, NULL, NULL) == 0)
|
||||
break;
|
||||
}
|
||||
if (io_size < min_size)
|
||||
goto release_and_exit;
|
||||
io_base = pcic->mem_resource[1].start;
|
||||
}
|
||||
|
||||
pcic->mem_resource[0].flags = IORESOURCE_MEM;
|
||||
if (pcic == &txx9_primary_pcic &&
|
||||
mips_io_port_base == (unsigned long)-1) {
|
||||
/* map ioport 0 to PCI I/O space address 0 */
|
||||
set_io_port_base(IO_BASE + pcic->mem_resource[1].start);
|
||||
pcic->io_resource->start = 0;
|
||||
pcic->io_offset = 0; /* busaddr == ioaddr */
|
||||
pcic->io_map_base = IO_BASE + pcic->mem_resource[1].start;
|
||||
} else {
|
||||
/* physaddr to ioaddr */
|
||||
pcic->io_resource->start =
|
||||
io_base - (mips_io_port_base - IO_BASE);
|
||||
pcic->io_offset = io_base - (mips_io_port_base - IO_BASE);
|
||||
pcic->io_map_base = mips_io_port_base;
|
||||
}
|
||||
pcic->io_resource->end = pcic->io_resource->start + io_size - 1;
|
||||
|
||||
pcic->mem_offset = 0; /* busaddr == physaddr */
|
||||
|
||||
printk(KERN_INFO "PCI: IO 0x%08llx-0x%08llx MEM 0x%08llx-0x%08llx\n",
|
||||
(unsigned long long)pcic->mem_resource[1].start,
|
||||
(unsigned long long)pcic->mem_resource[1].end,
|
||||
(unsigned long long)pcic->mem_resource[0].start,
|
||||
(unsigned long long)pcic->mem_resource[0].end);
|
||||
|
||||
/* register_pci_controller() will request MEM resource */
|
||||
release_resource(&pcic->mem_resource[0]);
|
||||
return pcic;
|
||||
release_and_exit:
|
||||
release_resource(&pcic->mem_resource[0]);
|
||||
free_and_exit:
|
||||
kfree(new);
|
||||
printk(KERN_ERR "PCI: Failed to allocate resources.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int __init
|
||||
txx9_arch_pci_init(void)
|
||||
{
|
||||
PCIBIOS_MIN_IO = 0x8000; /* reseve legacy I/O space */
|
||||
return 0;
|
||||
}
|
||||
arch_initcall(txx9_arch_pci_init);
|
||||
|
||||
/* IRQ/IDSEL mapping */
|
||||
int txx9_pci_option =
|
||||
#ifdef CONFIG_PICMG_PCI_BACKPLANE_DEFAULT
|
||||
TXX9_PCI_OPT_PICMG |
|
||||
#endif
|
||||
TXX9_PCI_OPT_CLK_AUTO;
|
||||
|
||||
enum txx9_pci_err_action txx9_pci_err_action = TXX9_PCI_ERR_REPORT;
|
||||
|
||||
#ifdef CONFIG_TOSHIBA_FPCIB0
|
||||
static irqreturn_t i8259_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
int isairq;
|
||||
|
||||
isairq = i8259_irq();
|
||||
if (unlikely(isairq <= I8259A_IRQ_BASE))
|
||||
return IRQ_NONE;
|
||||
generic_handle_irq(isairq);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int __init
|
||||
txx9_i8259_irq_setup(int irq)
|
||||
{
|
||||
int err;
|
||||
|
||||
init_i8259_irqs();
|
||||
err = request_irq(irq, &i8259_interrupt, IRQF_DISABLED|IRQF_SHARED,
|
||||
"cascade(i8259)", (void *)(long)irq);
|
||||
if (!err)
|
||||
printk(KERN_INFO "PCI-ISA bridge PIC (irq %d)\n", irq);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void __init quirk_slc90e66_bridge(struct pci_dev *dev)
|
||||
{
|
||||
int irq; /* PCI/ISA Bridge interrupt */
|
||||
u8 reg_64;
|
||||
u32 reg_b0;
|
||||
u8 reg_e1;
|
||||
irq = pcibios_map_irq(dev, PCI_SLOT(dev->devfn), 1); /* INTA */
|
||||
if (!irq)
|
||||
return;
|
||||
txx9_i8259_irq_setup(irq);
|
||||
pci_read_config_byte(dev, 0x64, ®_64);
|
||||
pci_read_config_dword(dev, 0xb0, ®_b0);
|
||||
pci_read_config_byte(dev, 0xe1, ®_e1);
|
||||
/* serial irq control */
|
||||
reg_64 = 0xd0;
|
||||
/* serial irq pin */
|
||||
reg_b0 |= 0x00010000;
|
||||
/* ide irq on isa14 */
|
||||
reg_e1 &= 0xf0;
|
||||
reg_e1 |= 0x0d;
|
||||
pci_write_config_byte(dev, 0x64, reg_64);
|
||||
pci_write_config_dword(dev, 0xb0, reg_b0);
|
||||
pci_write_config_byte(dev, 0xe1, reg_e1);
|
||||
|
||||
smsc_fdc37m81x_init(0x3f0);
|
||||
smsc_fdc37m81x_config_beg();
|
||||
smsc_fdc37m81x_config_set(SMSC_FDC37M81X_DNUM,
|
||||
SMSC_FDC37M81X_KBD);
|
||||
smsc_fdc37m81x_config_set(SMSC_FDC37M81X_INT, 1);
|
||||
smsc_fdc37m81x_config_set(SMSC_FDC37M81X_INT2, 12);
|
||||
smsc_fdc37m81x_config_set(SMSC_FDC37M81X_ACTIVE,
|
||||
1);
|
||||
smsc_fdc37m81x_config_end();
|
||||
}
|
||||
|
||||
static void quirk_slc90e66_ide(struct pci_dev *dev)
|
||||
{
|
||||
unsigned char dat;
|
||||
int regs[2] = {0x41, 0x43};
|
||||
int i;
|
||||
|
||||
/* SMSC SLC90E66 IDE uses irq 14, 15 (default) */
|
||||
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 14);
|
||||
pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &dat);
|
||||
printk(KERN_INFO "PCI: %s: IRQ %02x", pci_name(dev), dat);
|
||||
/* enable SMSC SLC90E66 IDE */
|
||||
for (i = 0; i < ARRAY_SIZE(regs); i++) {
|
||||
pci_read_config_byte(dev, regs[i], &dat);
|
||||
pci_write_config_byte(dev, regs[i], dat | 0x80);
|
||||
pci_read_config_byte(dev, regs[i], &dat);
|
||||
printk(KERN_CONT " IDETIM%d %02x", i, dat);
|
||||
}
|
||||
pci_read_config_byte(dev, 0x5c, &dat);
|
||||
/*
|
||||
* !!! DO NOT REMOVE THIS COMMENT IT IS REQUIRED BY SMSC !!!
|
||||
*
|
||||
* This line of code is intended to provide the user with a work
|
||||
* around solution to the anomalies cited in SMSC's anomaly sheet
|
||||
* entitled, "SLC90E66 Functional Rev.J_0.1 Anomalies"".
|
||||
*
|
||||
* !!! DO NOT REMOVE THIS COMMENT IT IS REQUIRED BY SMSC !!!
|
||||
*/
|
||||
dat |= 0x01;
|
||||
pci_write_config_byte(dev, regs[i], dat);
|
||||
pci_read_config_byte(dev, 0x5c, &dat);
|
||||
printk(KERN_CONT " REG5C %02x", dat);
|
||||
printk(KERN_CONT "\n");
|
||||
}
|
||||
#endif /* CONFIG_TOSHIBA_FPCIB0 */
|
||||
|
||||
static void final_fixup(struct pci_dev *dev)
|
||||
{
|
||||
unsigned char bist;
|
||||
|
||||
/* Do build-in self test */
|
||||
if (pci_read_config_byte(dev, PCI_BIST, &bist) == PCIBIOS_SUCCESSFUL &&
|
||||
(bist & PCI_BIST_CAPABLE)) {
|
||||
unsigned long timeout;
|
||||
pci_set_power_state(dev, PCI_D0);
|
||||
printk(KERN_INFO "PCI: %s BIST...", pci_name(dev));
|
||||
pci_write_config_byte(dev, PCI_BIST, PCI_BIST_START);
|
||||
timeout = jiffies + HZ * 2; /* timeout after 2 sec */
|
||||
do {
|
||||
pci_read_config_byte(dev, PCI_BIST, &bist);
|
||||
if (time_after(jiffies, timeout))
|
||||
break;
|
||||
} while (bist & PCI_BIST_START);
|
||||
if (bist & (PCI_BIST_CODE_MASK | PCI_BIST_START))
|
||||
printk(KERN_CONT "failed. (0x%x)\n", bist);
|
||||
else
|
||||
printk(KERN_CONT "OK.\n");
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TOSHIBA_FPCIB0
|
||||
#define PCI_DEVICE_ID_EFAR_SLC90E66_0 0x9460
|
||||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_0,
|
||||
quirk_slc90e66_bridge);
|
||||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1,
|
||||
quirk_slc90e66_ide);
|
||||
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1,
|
||||
quirk_slc90e66_ide);
|
||||
#endif
|
||||
DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, final_fixup);
|
||||
DECLARE_PCI_FIXUP_RESUME(PCI_ANY_ID, PCI_ANY_ID, final_fixup);
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* linux/arch/mips/txx9/generic/setup.c
|
||||
*
|
||||
* Based on linux/arch/mips/txx9/rbtx4938/setup.c,
|
||||
* and RBTX49xx patch from CELF patch archive.
|
||||
*
|
||||
* 2003-2005 (c) MontaVista Software, Inc.
|
||||
* (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/txx9/generic.h>
|
||||
|
||||
/* EBUSC settings of TX4927, etc. */
|
||||
struct resource txx9_ce_res[8];
|
||||
static char txx9_ce_res_name[8][4]; /* "CEn" */
|
||||
|
||||
/* pcode, internal register */
|
||||
char txx9_pcode_str[8];
|
||||
static struct resource txx9_reg_res = {
|
||||
.name = txx9_pcode_str,
|
||||
.flags = IORESOURCE_MEM,
|
||||
};
|
||||
void __init
|
||||
txx9_reg_res_init(unsigned int pcode, unsigned long base, unsigned long size)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(txx9_ce_res); i++) {
|
||||
sprintf(txx9_ce_res_name[i], "CE%d", i);
|
||||
txx9_ce_res[i].flags = IORESOURCE_MEM;
|
||||
txx9_ce_res[i].name = txx9_ce_res_name[i];
|
||||
}
|
||||
|
||||
sprintf(txx9_pcode_str, "TX%x", pcode);
|
||||
if (base) {
|
||||
txx9_reg_res.start = base & 0xfffffffffULL;
|
||||
txx9_reg_res.end = (base & 0xfffffffffULL) + (size - 1);
|
||||
request_resource(&iomem_resource, &txx9_reg_res);
|
||||
}
|
||||
}
|
||||
|
||||
/* clocks */
|
||||
unsigned int txx9_master_clock;
|
||||
unsigned int txx9_cpu_clock;
|
||||
unsigned int txx9_gbus_clock;
|
||||
@@ -109,6 +109,7 @@ static struct irqaction ioc_action = {
|
||||
.name = "IOC",
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
static irqreturn_t jmr3927_pcierr_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
printk(KERN_WARNING "PCI error interrupt (irq 0x%x).\n", irq);
|
||||
@@ -122,6 +123,7 @@ static struct irqaction pcierr_action = {
|
||||
.mask = CPU_MASK_NONE,
|
||||
.name = "PCI error",
|
||||
};
|
||||
#endif
|
||||
|
||||
static void __init jmr3927_irq_init(void);
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pm.h>
|
||||
@@ -44,6 +43,7 @@
|
||||
#include <asm/txx9tmr.h>
|
||||
#include <asm/txx9pio.h>
|
||||
#include <asm/reboot.h>
|
||||
#include <asm/txx9/pci.h>
|
||||
#include <asm/txx9/jmr3927.h>
|
||||
#include <asm/mipsregs.h>
|
||||
|
||||
@@ -96,8 +96,6 @@ void __init plat_time_init(void)
|
||||
|
||||
extern char * __init prom_getcmdline(void);
|
||||
static void jmr3927_board_init(void);
|
||||
extern struct resource pci_io_resource;
|
||||
extern struct resource pci_mem_resource;
|
||||
|
||||
void __init plat_mem_setup(void)
|
||||
{
|
||||
@@ -112,8 +110,8 @@ void __init plat_mem_setup(void)
|
||||
/*
|
||||
* IO/MEM resources.
|
||||
*/
|
||||
ioport_resource.start = pci_io_resource.start;
|
||||
ioport_resource.end = pci_io_resource.end;
|
||||
ioport_resource.start = 0;
|
||||
ioport_resource.end = 0xffffffff;
|
||||
iomem_resource.start = 0;
|
||||
iomem_resource.end = 0xffffffff;
|
||||
|
||||
@@ -191,9 +189,33 @@ void __init plat_mem_setup(void)
|
||||
|
||||
static void tx3927_setup(void);
|
||||
|
||||
static void __init jmr3927_pci_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_PCI
|
||||
int extarb = !(tx3927_ccfgptr->ccfg & TX3927_CCFG_PCIXARB);
|
||||
struct pci_controller *c;
|
||||
|
||||
c = txx9_alloc_pci_controller(&txx9_primary_pcic,
|
||||
JMR3927_PCIMEM, JMR3927_PCIMEM_SIZE,
|
||||
JMR3927_PCIIO, JMR3927_PCIIO_SIZE);
|
||||
register_pci_controller(c);
|
||||
if (!extarb) {
|
||||
/* Reset PCI Bus */
|
||||
jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
|
||||
udelay(100);
|
||||
jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI,
|
||||
JMR3927_IOC_RESET_ADDR);
|
||||
udelay(100);
|
||||
jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
|
||||
}
|
||||
tx3927_pcic_setup(c, JMR3927_SDRAM_SIZE, extarb);
|
||||
#endif /* CONFIG_PCI */
|
||||
}
|
||||
|
||||
static void __init jmr3927_board_init(void)
|
||||
{
|
||||
tx3927_setup();
|
||||
jmr3927_pci_setup();
|
||||
|
||||
/* SIO0 DTR on */
|
||||
jmr3927_ioc_reg_out(0, JMR3927_IOC_DTR_ADDR);
|
||||
@@ -210,14 +232,6 @@ static void __init jmr3927_board_init(void)
|
||||
static void __init tx3927_setup(void)
|
||||
{
|
||||
int i;
|
||||
#ifdef CONFIG_PCI
|
||||
unsigned long mips_pci_io_base = JMR3927_PCIIO;
|
||||
unsigned long mips_pci_io_size = JMR3927_PCIIO_SIZE;
|
||||
unsigned long mips_pci_mem_base = JMR3927_PCIMEM;
|
||||
unsigned long mips_pci_mem_size = JMR3927_PCIMEM_SIZE;
|
||||
/* for legacy I/O, PCI I/O PCI Bus address must be 0 */
|
||||
unsigned long mips_pci_io_pciaddr = 0;
|
||||
#endif
|
||||
|
||||
/* SDRAMC are configured by PROM */
|
||||
|
||||
@@ -272,74 +286,6 @@ static void __init tx3927_setup(void)
|
||||
tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN | TX3927_DMA_MCR_LE;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
/* PCIC */
|
||||
printk("TX3927 PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:",
|
||||
tx3927_pcicptr->did, tx3927_pcicptr->vid,
|
||||
tx3927_pcicptr->rid);
|
||||
if (!(tx3927_ccfgptr->ccfg & TX3927_CCFG_PCIXARB)) {
|
||||
printk("External\n");
|
||||
/* XXX */
|
||||
} else {
|
||||
printk("Internal\n");
|
||||
|
||||
/* Reset PCI Bus */
|
||||
jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
|
||||
udelay(100);
|
||||
jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI,
|
||||
JMR3927_IOC_RESET_ADDR);
|
||||
udelay(100);
|
||||
jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
|
||||
|
||||
|
||||
/* Disable External PCI Config. Access */
|
||||
tx3927_pcicptr->lbc = TX3927_PCIC_LBC_EPCAD;
|
||||
#ifdef __BIG_ENDIAN
|
||||
tx3927_pcicptr->lbc |= TX3927_PCIC_LBC_IBSE |
|
||||
TX3927_PCIC_LBC_TIBSE |
|
||||
TX3927_PCIC_LBC_TMFBSE | TX3927_PCIC_LBC_MSDSE;
|
||||
#endif
|
||||
/* LB->PCI mappings */
|
||||
tx3927_pcicptr->iomas = ~(mips_pci_io_size - 1);
|
||||
tx3927_pcicptr->ilbioma = mips_pci_io_base;
|
||||
tx3927_pcicptr->ipbioma = mips_pci_io_pciaddr;
|
||||
tx3927_pcicptr->mmas = ~(mips_pci_mem_size - 1);
|
||||
tx3927_pcicptr->ilbmma = mips_pci_mem_base;
|
||||
tx3927_pcicptr->ipbmma = mips_pci_mem_base;
|
||||
/* PCI->LB mappings */
|
||||
tx3927_pcicptr->iobas = 0xffffffff;
|
||||
tx3927_pcicptr->ioba = 0;
|
||||
tx3927_pcicptr->tlbioma = 0;
|
||||
tx3927_pcicptr->mbas = ~(mips_pci_mem_size - 1);
|
||||
tx3927_pcicptr->mba = 0;
|
||||
tx3927_pcicptr->tlbmma = 0;
|
||||
/* Enable Direct mapping Address Space Decoder */
|
||||
tx3927_pcicptr->lbc |= TX3927_PCIC_LBC_ILMDE | TX3927_PCIC_LBC_ILIDE;
|
||||
|
||||
/* Clear All Local Bus Status */
|
||||
tx3927_pcicptr->lbstat = TX3927_PCIC_LBIM_ALL;
|
||||
/* Enable All Local Bus Interrupts */
|
||||
tx3927_pcicptr->lbim = TX3927_PCIC_LBIM_ALL;
|
||||
/* Clear All PCI Status Error */
|
||||
tx3927_pcicptr->pcistat = TX3927_PCIC_PCISTATIM_ALL;
|
||||
/* Enable All PCI Status Error Interrupts */
|
||||
tx3927_pcicptr->pcistatim = TX3927_PCIC_PCISTATIM_ALL;
|
||||
|
||||
/* PCIC Int => IRC IRQ10 */
|
||||
tx3927_pcicptr->il = TX3927_IR_PCI;
|
||||
/* Target Control (per errata) */
|
||||
tx3927_pcicptr->tc = TX3927_PCIC_TC_OF8E | TX3927_PCIC_TC_IF8E;
|
||||
|
||||
/* Enable Bus Arbiter */
|
||||
tx3927_pcicptr->pbapmc = TX3927_PCIC_PBAPMC_PBAEN;
|
||||
|
||||
tx3927_pcicptr->pcicmd = PCI_COMMAND_MASTER |
|
||||
PCI_COMMAND_MEMORY |
|
||||
PCI_COMMAND_IO |
|
||||
PCI_COMMAND_PARITY | PCI_COMMAND_SERR;
|
||||
}
|
||||
#endif /* CONFIG_PCI */
|
||||
|
||||
/* PIO */
|
||||
/* PIO[15:12] connected to LEDs */
|
||||
__raw_writel(0x0000f000, &tx3927_pioptr->dir);
|
||||
|
||||
@@ -111,9 +111,6 @@ JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthB
|
||||
#include <linux/types.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <asm/io.h>
|
||||
#ifdef CONFIG_TOSHIBA_FPCIB0
|
||||
#include <asm/i8259.h>
|
||||
#endif
|
||||
#include <asm/txx9/rbtx4927.h>
|
||||
|
||||
#define TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG 0
|
||||
@@ -125,8 +122,6 @@ JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthB
|
||||
#define TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC TX4927_IRQ_NEST_EXT_ON_PIC
|
||||
#define TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC (TOSHIBA_RBTX4927_IRQ_IOC_BEG+2)
|
||||
|
||||
extern int tx4927_using_backplane;
|
||||
|
||||
static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq);
|
||||
static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq);
|
||||
|
||||
@@ -146,17 +141,8 @@ int toshiba_rbtx4927_irq_nested(int sw_irq)
|
||||
u8 level3;
|
||||
|
||||
level3 = readb(TOSHIBA_RBTX4927_IOC_INTR_STAT) & 0x1f;
|
||||
if (level3) {
|
||||
if (level3)
|
||||
sw_irq = TOSHIBA_RBTX4927_IRQ_IOC_BEG + fls(level3) - 1;
|
||||
#ifdef CONFIG_TOSHIBA_FPCIB0
|
||||
if (sw_irq == TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC &&
|
||||
tx4927_using_backplane) {
|
||||
int irq = i8259_irq();
|
||||
if (irq >= 0)
|
||||
sw_irq = irq;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return (sw_irq);
|
||||
}
|
||||
|
||||
@@ -205,10 +191,6 @@ void __init arch_init_irq(void)
|
||||
|
||||
tx4927_irq_init();
|
||||
toshiba_rbtx4927_irq_ioc_init();
|
||||
#ifdef CONFIG_TOSHIBA_FPCIB0
|
||||
if (tx4927_using_backplane)
|
||||
init_i8259_irqs();
|
||||
#endif
|
||||
/* Onboard 10M Ether: High Active */
|
||||
set_irq_type(RBTX4927_RTL_8019_IRQ, IRQF_TRIGGER_HIGH);
|
||||
}
|
||||
|
||||
+120
-377
File diff suppressed because it is too large
Load Diff
+91
-562
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user