Commit afd5e44a authored by Paul Mundt's avatar Paul Mundt Committed by Linus Torvalds

[PATCH] sh: PCI updates

This updates some of the PCI drivers.  SH7751, the sh03 board-specific PCI
code, and some ST40 PCI updates are grouped in this.  
Signed-off-by: default avatarPaul Mundt <paul.mundt@nokia.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4a97bdc5
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <asm/addrspace.h> #include <asm/addrspace.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <asm/pci-sh7751.h> #include "../../../drivers/pci/pci-sh7751.h"
#if 0 #if 0
/****************************************************************** /******************************************************************
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/pci-sh7751.h> #include "../../../drivers/pci/pci-sh7751.h"
#define PCIMCR_MRSET_OFF 0xBFFFFFFF #define PCIMCR_MRSET_OFF 0xBFFFFFFF
#define PCIMCR_RFSH_OFF 0xFFFFFFFB #define PCIMCR_RFSH_OFF 0xFFFFFFFB
......
...@@ -13,4 +13,4 @@ obj-$(CONFIG_SH_DREAMCAST) += ops-dreamcast.o fixups-dreamcast.o \ ...@@ -13,4 +13,4 @@ obj-$(CONFIG_SH_DREAMCAST) += ops-dreamcast.o fixups-dreamcast.o \
obj-$(CONFIG_SH_SECUREEDGE5410) += ops-snapgear.o obj-$(CONFIG_SH_SECUREEDGE5410) += ops-snapgear.o
obj-$(CONFIG_SH_BIGSUR) += ops-bigsur.o obj-$(CONFIG_SH_BIGSUR) += ops-bigsur.o
obj-$(CONFIG_SH_RTS7751R2D) += ops-rts7751r2d.o fixups-rts7751r2d.o obj-$(CONFIG_SH_RTS7751R2D) += ops-rts7751r2d.o fixups-rts7751r2d.o
obj-$(CONFIG_SH_SH03) += ops-sh03.o fixups-sh03.o
...@@ -18,15 +18,26 @@ ...@@ -18,15 +18,26 @@
int pci_fixup_pcic(void) int pci_fixup_pcic(void)
{ {
unsigned long mcr; unsigned long bcr1, mcr;
outl(0xfb900047, SH7751_PCICONF1); bcr1 = inl(SH7751_BCR1);
outl(0xab000001, SH7751_PCICONF4); bcr1 |= 0x40080000; /* Enable Bit 19 BREQEN, set PCIC to slave */
outl(bcr1, PCI_REG(SH7751_PCIBCR1));
/* Enable all interrupts, so we known what to fix */
outl(0x0000c3ff, PCI_REG(SH7751_PCIINTM));
outl(0x0000380f, PCI_REG(SH7751_PCIAINTM));
outl(0xfb900047, PCI_REG(SH7751_PCICONF1));
outl(0xab000001, PCI_REG(SH7751_PCICONF4));
mcr = inl(SH7751_MCR); mcr = inl(SH7751_MCR);
mcr = (mcr & PCIMCR_MRSET_OFF) & PCIMCR_RFSH_OFF; mcr = (mcr & PCIMCR_MRSET_OFF) & PCIMCR_RFSH_OFF;
outl(mcr, SH7751_PCIMCR); outl(mcr, PCI_REG(SH7751_PCIMCR));
outl(0x0c000000, PCI_REG(SH7751_PCICONF5));
outl(0xd0000000, PCI_REG(SH7751_PCICONF6));
outl(0x0c000000, PCI_REG(SH7751_PCILAR0));
outl(0x00000000, PCI_REG(SH7751_PCILAR1));
return 0; return 0;
} }
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/pci.h>
/*
* IRQ functions
*/
int __init pcibios_map_platform_irq(u8 slot, u8 pin, struct pci_dev *dev)
{
int irq;
if (dev->bus->number == 0) {
switch (slot) {
case 4: return 5; /* eth0 */
case 8: return 5; /* eth1 */
case 6: return 2; /* PCI bridge */
default:
printk("PCI: Bad IRQ mapping request for slot %d\n", slot);
return 2;
}
} else {
switch (pin) {
case 0: irq = 2; break;
case 1: irq = 2; break;
case 2: irq = 2; break;
case 3: irq = 2; break;
case 4: irq = 2; break;
default: irq = -1; break;
}
}
return irq;
}
static u8 __init sh03_no_swizzle(struct pci_dev *dev, u8 *pin)
{
/* no swizzling */
return PCI_SLOT(dev->devfn);
}
static int sh03_pci_lookup_irq(struct pci_dev *dev, u8 slot, u8 pin)
{
int irq = -1;
/* now lookup the actual IRQ on a platform specific basis (pci-'platform'.c) */
irq = pcibios_map_platform_irq(slot, pin, dev);
if( irq < 0 ) {
pr_debug("PCI: Error mapping IRQ on device %s\n", dev->slot_name);
return irq;
}
pr_debug("Setting IRQ for slot %s to %d\n", dev->slot_name, irq);
return irq;
}
void __init pcibios_fixup_irqs(void)
{
pci_fixup_irqs(sh03_no_swizzle, sh03_pci_lookup_irq);
}
...@@ -61,7 +61,12 @@ EXPORT_SYMBOL(board_pci_channels); ...@@ -61,7 +61,12 @@ EXPORT_SYMBOL(board_pci_channels);
static struct sh7751_pci_address_map sh7751_pci_map = { static struct sh7751_pci_address_map sh7751_pci_map = {
.window0 = { .window0 = {
.base = SH7751_CS3_BASE_ADDR, .base = SH7751_CS3_BASE_ADDR,
.size = 0x03f00000, .size = 0x04000000,
},
.window1 = {
.base = 0x00000000, /* Unused */
.size = 0x00000000, /* Unused */
}, },
.flags = SH7751_PCIC_NO_RESET, .flags = SH7751_PCIC_NO_RESET,
......
/*
* linux/arch/sh/drivers/pci/ops-sh03.c
*
* PCI initialization for the Interface CTP/PCI-SH03 board
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <asm/io.h>
#include "pci-sh7751.h"
/*
* Description: This function sets up and initializes the pcic, sets
* up the BARS, maps the DRAM into the address space etc, etc.
*/
int __init pcibios_init_platform(void)
{
return 1;
}
static struct resource sh7751_io_resource = {
.name = "SH03 IO",
.start = SH7751_PCI_IO_BASE,
.end = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1,
.flags = IORESOURCE_IO
};
static struct resource sh7751_mem_resource = {
.name = "SH03 mem",
.start = SH7751_PCI_MEMORY_BASE,
.end = SH7751_PCI_MEMORY_BASE + SH7751_PCI_MEM_SIZE - 1,
.flags = IORESOURCE_MEM
};
extern struct pci_ops sh7751_pci_ops;
struct pci_channel board_pci_channels[] = {
{ &sh7751_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
{ NULL, NULL, NULL, 0, 0 },
};
...@@ -524,8 +524,10 @@ pciauto_bus_scan(struct pci_channel *hose, int top_bus, int current_bus) ...@@ -524,8 +524,10 @@ pciauto_bus_scan(struct pci_channel *hose, int top_bus, int current_bus)
PCI_COMMAND, cmdstat | PCI_COMMAND_IO | PCI_COMMAND, cmdstat | PCI_COMMAND_IO |
PCI_COMMAND_MEMORY | PCI_COMMAND_MEMORY |
PCI_COMMAND_MASTER); PCI_COMMAND_MASTER);
#if !defined(CONFIG_SH_HS7751RVOIP) && !defined(CONFIG_SH_RTS7751R2D)
early_write_config_byte(hose, top_bus, current_bus, pci_devfn, early_write_config_byte(hose, top_bus, current_bus, pci_devfn,
PCI_LATENCY_TIMER, 0x80); PCI_LATENCY_TIMER, 0x80);
#endif
/* Allocate PCI I/O and/or memory space */ /* Allocate PCI I/O and/or memory space */
pciauto_setup_bars(hose, top_bus, current_bus, pci_devfn, PCI_BASE_ADDRESS_5); pciauto_setup_bars(hose, top_bus, current_bus, pci_devfn, PCI_BASE_ADDRESS_5);
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
static unsigned int pci_probe = PCI_PROBE_CONF1; static unsigned int pci_probe = PCI_PROBE_CONF1;
extern int pci_fixup_pcic(void); extern int pci_fixup_pcic(void);
void pcibios_fixup_irqs(void) __attribute__ ((weak));
/* /*
* Direct access to PCI hardware... * Direct access to PCI hardware...
*/ */
...@@ -158,7 +160,6 @@ static int __init pci_check_direct(void) ...@@ -158,7 +160,6 @@ static int __init pci_check_direct(void)
* Handle bus scanning and fixups .... * Handle bus scanning and fixups ....
*/ */
#if !defined(CONFIG_SH_HS7751RVOIP) && !defined(CONFIG_SH_RTS7751R2D)
static void __init pci_fixup_ide_bases(struct pci_dev *d) static void __init pci_fixup_ide_bases(struct pci_dev *d)
{ {
int i; int i;
...@@ -256,7 +257,7 @@ int __init sh7751_pcic_init(struct sh7751_pci_address_map *map) ...@@ -256,7 +257,7 @@ int __init sh7751_pcic_init(struct sh7751_pci_address_map *map)
outl(0, PCI_REG(SH7751_PCICLKR)); outl(0, PCI_REG(SH7751_PCICLKR));
/* Clear Powerdown IRQ's (not done in reset) */ /* Clear Powerdown IRQ's (not done in reset) */
word = SH7751_PCIPINT_D3 | SH7751_PCIPINT_D0; word = SH7751_PCIPINT_D3 | SH7751_PCIPINT_D0;
outl(word, PCI_REG(SH7751_PCICLKR)); outl(word, PCI_REG(SH7751_PCIPINT));
/* /*
* This code is unused for some boards as it is done in the * This code is unused for some boards as it is done in the
...@@ -361,7 +362,7 @@ int __init sh7751_pcic_init(struct sh7751_pci_address_map *map) ...@@ -361,7 +362,7 @@ int __init sh7751_pcic_init(struct sh7751_pci_address_map *map)
* TODO: add support for the internal error interrupts and * TODO: add support for the internal error interrupts and
* DMA interrupts... * DMA interrupts...
*/ */
#ifdef CONFIG_SH_RTS7751R2D #ifdef CONFIG_SH_RTS7751R2D
pci_fixup_pcic(); pci_fixup_pcic();
#endif #endif
......
This diff is collapsed.
...@@ -33,13 +33,36 @@ ...@@ -33,13 +33,36 @@
#define ST40PCI_LAR0 0x1c #define ST40PCI_LAR0 0x1c
#define ST40PCI_INT 0x24 #define ST40PCI_INT 0x24
#define INT_MNLTDIM (1<<15)
#define INT_TTADI (1<<14)
#define INT_TMTO (1<<9)
#define INT_MDEI (1<<8)
#define INT_APEDI (1<<7)
#define INT_SDI (1<<6)
#define INT_DPEITW (1<<5)
#define INT_PEDITR (1<<4)
#define INT_TADIM (1<<3)
#define INT_MADIM (1<<2) #define INT_MADIM (1<<2)
#define INT_MWPDI (1<<1)
#define INT_MRDPEI (1<<0)
#define ST40PCI_INTM 0x28 #define ST40PCI_INTM 0x28
#define ST40PCI_AIR 0x2c #define ST40PCI_AIR 0x2c
#define ST40PCI_CIR 0x30 #define ST40PCI_CIR 0x30
#define CIR_PIOTEM (1<<31)
#define CIR_RWTET (1<<26)
#define ST40PCI_AINT 0x40 #define ST40PCI_AINT 0x40
#define AINT_MBI (1<<13)
#define AINT_TBTOI (1<<12)
#define AINT_MBTOI (1<<11)
#define AINT_TAI (1<<3)
#define AINT_MAI (1<<2)
#define AINT_RDPEI (1<<1)
#define AINT_WDPE (1<<0)
#define ST40PCI_AINTM 0x44 #define ST40PCI_AINTM 0x44
#define ST40PCI_BMIR 0x48 #define ST40PCI_BMIR 0x48
#define ST40PCI_PAR 0x4c #define ST40PCI_PAR 0x4c
...@@ -51,6 +74,53 @@ ...@@ -51,6 +74,53 @@
#define ST40PCI_IOBMR 0x74 #define ST40PCI_IOBMR 0x74
#define ST40PCI_PDR 0x78 #define ST40PCI_PDR 0x78
/* H8 specific registers start here */
#define ST40PCI_WCBAR 0x7c
#define ST40PCI_LOCCFG_UNLOCK 0x34
#define ST40PCI_RBAR0 0x100
#define ST40PCI_RSR0 0x104
#define ST40PCI_RLAR0 0x108
#define ST40PCI_RBAR1 0x110
#define ST40PCI_RSR1 0x114
#define ST40PCI_RLAR1 0x118
#define ST40PCI_RBAR2 0x120
#define ST40PCI_RSR2 0x124
#define ST40PCI_RLAR2 0x128
#define ST40PCI_RBAR3 0x130
#define ST40PCI_RSR3 0x134
#define ST40PCI_RLAR3 0x138
#define ST40PCI_RBAR4 0x140
#define ST40PCI_RSR4 0x144
#define ST40PCI_RLAR4 0x148
#define ST40PCI_RBAR5 0x150
#define ST40PCI_RSR5 0x154
#define ST40PCI_RLAR5 0x158
#define ST40PCI_RBAR6 0x160
#define ST40PCI_RSR6 0x164
#define ST40PCI_RLAR6 0x168
#define ST40PCI_RBAR7 0x170
#define ST40PCI_RSR7 0x174
#define ST40PCI_RLAR7 0x178
#define ST40PCI_RBAR(n) (0x100+(0x10*(n)))
#define ST40PCI_RSR(n) (0x104+(0x10*(n)))
#define ST40PCI_RLAR(n) (0x108+(0x10*(n)))
#define ST40PCI_PERF 0x80
#define PERF_MASTER_WRITE_POSTING (1<<4)
/* H8 specific registers end here */
/* These are configs space registers */ /* These are configs space registers */
#define ST40PCI_CSR_VID 0x10000 #define ST40PCI_CSR_VID 0x10000
#define ST40PCI_CSR_DID 0x10002 #define ST40PCI_CSR_DID 0x10002
......
...@@ -106,6 +106,8 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) ...@@ -106,6 +106,8 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
pci_read_config_word(dev, PCI_COMMAND, &cmd); pci_read_config_word(dev, PCI_COMMAND, &cmd);
old_cmd = cmd; old_cmd = cmd;
for(idx=0; idx<6; idx++) { for(idx=0; idx<6; idx++) {
if (!(mask & (1 << idx)))
continue;
r = &dev->resource[idx]; r = &dev->resource[idx];
if (!r->start && r->end) { if (!r->start && r->end) {
printk(KERN_ERR "PCI: Device %s not available because " printk(KERN_ERR "PCI: Device %s not available because "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment