blob: 004efd486ee356953ba95d97306091ea6eb30d09 [file] [log] [blame]
Nicholas Beck4862ec02008-01-23 12:50:51 +09001/*
2 * arch/sh/drivers/pci/fixups-sdk7780.c
3 *
4 * PCI fixups for the SDK7780SE03
5 *
6 * Copyright (C) 2003 Lineo uSolutions, Inc.
7 * Copyright (C) 2004 - 2006 Paul Mundt
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/pci.h>
14#include "pci-sh4.h"
15#include <asm/io.h>
16
Magnus Dammb8b47bf2009-03-11 15:41:51 +090017int pci_fixup_pcic(struct pci_channel *chan)
Nicholas Beck4862ec02008-01-23 12:50:51 +090018{
Nicholas Beck4862ec02008-01-23 12:50:51 +090019 /* Enable all interrupts, so we know what to fix */
Magnus Dammb8b47bf2009-03-11 15:41:51 +090020 pci_write_reg(chan, 0x0000C3FF, SH7780_PCIIMR);
21 pci_write_reg(chan, 0x0000380F, SH7780_PCIAINTM);
Nicholas Beck4862ec02008-01-23 12:50:51 +090022
23 /* Set up standard PCI config registers */
Magnus Dammb8b47bf2009-03-11 15:41:51 +090024 pci_write_reg(chan, 0xFB00, SH7780_PCISTATUS);
25 pci_write_reg(chan, 0x0047, SH7780_PCICMD);
26 pci_write_reg(chan, 0x00, SH7780_PCIPIF);
Magnus Dammb8b47bf2009-03-11 15:41:51 +090027 pci_write_reg(chan, 0x1912, SH7780_PCISVID);
28 pci_write_reg(chan, 0x0001, SH7780_PCISID);
Nicholas Beck4862ec02008-01-23 12:50:51 +090029
Magnus Dammb8b47bf2009-03-11 15:41:51 +090030 pci_write_reg(chan, 0x08000000, SH7780_PCIMBAR0); /* PCI */
31 pci_write_reg(chan, 0x08000000, SH7780_PCILAR0); /* SHwy */
32 pci_write_reg(chan, 0x07F00001, SH7780_PCILSR); /* size 128M w/ MBAR */
Nicholas Beck4862ec02008-01-23 12:50:51 +090033
Magnus Dammb8b47bf2009-03-11 15:41:51 +090034 pci_write_reg(chan, 0x00000000, SH7780_PCIMBAR1);
35 pci_write_reg(chan, 0x00000000, SH7780_PCILAR1);
36 pci_write_reg(chan, 0x00000000, SH7780_PCILSR1);
Nicholas Beck4862ec02008-01-23 12:50:51 +090037
Magnus Dammb8b47bf2009-03-11 15:41:51 +090038 pci_write_reg(chan, 0xAB000801, SH7780_PCIIBAR);
Nicholas Beck4862ec02008-01-23 12:50:51 +090039
40 /*
41 * Set the MBR so PCI address is one-to-one with window,
42 * meaning all calls go straight through... use ifdef to
43 * catch erroneous assumption.
44 */
Magnus Dammb8b47bf2009-03-11 15:41:51 +090045 pci_write_reg(chan, 0xFD000000 , SH7780_PCIMBR0);
46 pci_write_reg(chan, 0x00FC0000 , SH7780_PCIMBMR0); /* 16M */
Nicholas Beck4862ec02008-01-23 12:50:51 +090047
48 /* Set IOBR for window containing area specified in pci.h */
Magnus Damm710fa3c2009-03-11 15:47:23 +090049 pci_write_reg(chan, chan->io_resource->start & ~(SH7780_PCI_IO_SIZE-1),
Magnus Dammb8b47bf2009-03-11 15:41:51 +090050 SH7780_PCIIOBR);
51 pci_write_reg(chan, (SH7780_PCI_IO_SIZE-1) & (7 << 18),
52 SH7780_PCIIOBMR);
Nicholas Beck4862ec02008-01-23 12:50:51 +090053
Magnus Dammb8b47bf2009-03-11 15:41:51 +090054 pci_write_reg(chan, 0xA5000C01, SH7780_PCICR);
Nicholas Beck4862ec02008-01-23 12:50:51 +090055
56 return 0;
57}