diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-04-17 07:37:16 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-04-17 07:37:16 -0400 |
commit | 62c7ae87cb5962d3dfaa6d916a15e4faa9e07363 (patch) | |
tree | 3ab00d7c857edeb864b204bf041444fb4197af9b /arch/sh | |
parent | a6d377b6969235a3b5a6e87bdcef387d0976b41c (diff) |
sh: pci: Start unifying the SH7780 PCIC initialization.
This starts moving out the common initialization bits from the various
fixup paths in to the shared init path.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/drivers/pci/fixups-r7780rp.c | 20 | ||||
-rw-r--r-- | arch/sh/drivers/pci/fixups-sdk7780.c | 32 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci-sh7780.c | 50 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci-sh7780.h | 5 |
4 files changed, 37 insertions, 70 deletions
diff --git a/arch/sh/drivers/pci/fixups-r7780rp.c b/arch/sh/drivers/pci/fixups-r7780rp.c index 864e92f69702..15ca65cb667e 100644 --- a/arch/sh/drivers/pci/fixups-r7780rp.c +++ b/arch/sh/drivers/pci/fixups-r7780rp.c | |||
@@ -22,33 +22,15 @@ int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) | |||
22 | { | 22 | { |
23 | return irq_tab[slot]; | 23 | return irq_tab[slot]; |
24 | } | 24 | } |
25 | |||
25 | int pci_fixup_pcic(struct pci_channel *chan) | 26 | int pci_fixup_pcic(struct pci_channel *chan) |
26 | { | 27 | { |
27 | pci_write_reg(chan, 0x000043ff, SH4_PCIINTM); | 28 | pci_write_reg(chan, 0x000043ff, SH4_PCIINTM); |
28 | pci_write_reg(chan, 0x0000380f, SH4_PCIAINTM); | ||
29 | |||
30 | pci_write_reg(chan, 0xfbb00047, SH7780_PCICMD); | ||
31 | pci_write_reg(chan, 0x00000000, SH7780_PCIIBAR); | 29 | pci_write_reg(chan, 0x00000000, SH7780_PCIIBAR); |
32 | |||
33 | pci_write_reg(chan, 0x00011912, SH7780_PCISVID); | ||
34 | pci_write_reg(chan, 0x08000000, SH7780_PCICSCR0); | 30 | pci_write_reg(chan, 0x08000000, SH7780_PCICSCR0); |
35 | pci_write_reg(chan, 0x0000001b, SH7780_PCICSAR0); | 31 | pci_write_reg(chan, 0x0000001b, SH7780_PCICSAR0); |
36 | pci_write_reg(chan, 0xfd000000, SH7780_PCICSCR1); | 32 | pci_write_reg(chan, 0xfd000000, SH7780_PCICSCR1); |
37 | pci_write_reg(chan, 0x0000000f, SH7780_PCICSAR1); | 33 | pci_write_reg(chan, 0x0000000f, SH7780_PCICSAR1); |
38 | 34 | ||
39 | pci_write_reg(chan, 0xfd000000, SH7780_PCIMBR0); | ||
40 | pci_write_reg(chan, 0x00fc0000, SH7780_PCIMBMR0); | ||
41 | |||
42 | #ifdef CONFIG_32BIT | ||
43 | pci_write_reg(chan, 0xc0000000, SH7780_PCIMBR2); | ||
44 | pci_write_reg(chan, 0x20000000 - SH7780_PCI_IO_SIZE, SH7780_PCIMBMR2); | ||
45 | #endif | ||
46 | |||
47 | /* Set IOBR for windows containing area specified in pci.h */ | ||
48 | pci_write_reg(chan, chan->io_resource->start & ~(SH7780_PCI_IO_SIZE-1), | ||
49 | SH7780_PCIIOBR); | ||
50 | pci_write_reg(chan, ((SH7780_PCI_IO_SIZE-1) & (7<<18)), | ||
51 | SH7780_PCIIOBMR); | ||
52 | |||
53 | return 0; | 35 | return 0; |
54 | } | 36 | } |
diff --git a/arch/sh/drivers/pci/fixups-sdk7780.c b/arch/sh/drivers/pci/fixups-sdk7780.c index da60e99894b8..250b0edd7365 100644 --- a/arch/sh/drivers/pci/fixups-sdk7780.c +++ b/arch/sh/drivers/pci/fixups-sdk7780.c | |||
@@ -35,40 +35,18 @@ int pci_fixup_pcic(struct pci_channel *chan) | |||
35 | { | 35 | { |
36 | /* Enable all interrupts, so we know what to fix */ | 36 | /* Enable all interrupts, so we know what to fix */ |
37 | pci_write_reg(chan, 0x0000C3FF, SH7780_PCIIMR); | 37 | pci_write_reg(chan, 0x0000C3FF, SH7780_PCIIMR); |
38 | pci_write_reg(chan, 0x0000380F, SH7780_PCIAINTM); | ||
39 | 38 | ||
40 | /* Set up standard PCI config registers */ | 39 | /* Set up standard PCI config registers */ |
41 | pci_write_reg(chan, 0xFB00, SH7780_PCISTATUS); | ||
42 | pci_write_reg(chan, 0x0047, SH7780_PCICMD); | ||
43 | pci_write_reg(chan, 0x00, SH7780_PCIPIF); | ||
44 | pci_write_reg(chan, 0x1912, SH7780_PCISVID); | ||
45 | pci_write_reg(chan, 0x0001, SH7780_PCISID); | ||
46 | |||
47 | pci_write_reg(chan, 0x08000000, SH7780_PCIMBAR0); /* PCI */ | 40 | pci_write_reg(chan, 0x08000000, SH7780_PCIMBAR0); /* PCI */ |
48 | pci_write_reg(chan, 0x08000000, SH7780_PCILAR0); /* SHwy */ | 41 | pci_write_reg(chan, 0x08000000, SH4_PCILAR0); /* SHwy */ |
49 | pci_write_reg(chan, 0x07F00001, SH7780_PCILSR); /* size 128M w/ MBAR */ | 42 | pci_write_reg(chan, 0x07F00001, SH4_PCILSR0); /* size 128M w/ MBAR */ |
50 | 43 | ||
51 | pci_write_reg(chan, 0x00000000, SH7780_PCIMBAR1); | 44 | pci_write_reg(chan, 0x00000000, SH7780_PCIMBAR1); |
52 | pci_write_reg(chan, 0x00000000, SH7780_PCILAR1); | 45 | pci_write_reg(chan, 0x00000000, SH4_PCILAR1); |
53 | pci_write_reg(chan, 0x00000000, SH7780_PCILSR1); | 46 | pci_write_reg(chan, 0x00000000, SH4_PCILSR1); |
54 | 47 | ||
55 | pci_write_reg(chan, 0xAB000801, SH7780_PCIIBAR); | 48 | pci_write_reg(chan, 0xAB000801, SH7780_PCIIBAR); |
56 | 49 | pci_write_reg(chan, 0xA5000C01, SH4_PCICR); | |
57 | /* | ||
58 | * Set the MBR so PCI address is one-to-one with window, | ||
59 | * meaning all calls go straight through... use ifdef to | ||
60 | * catch erroneous assumption. | ||
61 | */ | ||
62 | pci_write_reg(chan, 0xFD000000 , SH7780_PCIMBR0); | ||
63 | pci_write_reg(chan, 0x00FC0000 , SH7780_PCIMBMR0); /* 16M */ | ||
64 | |||
65 | /* Set IOBR for window containing area specified in pci.h */ | ||
66 | pci_write_reg(chan, chan->io_resource->start & ~(SH7780_PCI_IO_SIZE-1), | ||
67 | SH7780_PCIIOBR); | ||
68 | pci_write_reg(chan, (SH7780_PCI_IO_SIZE-1) & (7 << 18), | ||
69 | SH7780_PCIIOBMR); | ||
70 | |||
71 | pci_write_reg(chan, 0xA5000C01, SH7780_PCICR); | ||
72 | 50 | ||
73 | return 0; | 51 | return 0; |
74 | } | 52 | } |
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c index 07c5529a273b..f02d9dfcf252 100644 --- a/arch/sh/drivers/pci/pci-sh7780.c +++ b/arch/sh/drivers/pci/pci-sh7780.c | |||
@@ -1,19 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Low-Level PCI Support for the SH7780 | 2 | * Low-Level PCI Support for the SH7780 |
3 | * | 3 | * |
4 | * Dustin McIntire (dustin@sensoria.com) | 4 | * Copyright (C) 2005 - 2009 Paul Mundt |
5 | * Derived from arch/i386/kernel/pci-*.c which bore the message: | ||
6 | * (c) 1999--2000 Martin Mares <mj@ucw.cz> | ||
7 | * | ||
8 | * Ported to the new API by Paul Mundt <lethal@linux-sh.org> | ||
9 | * With cleanup by Paul van Gool <pvangool@mimotech.com> | ||
10 | * | ||
11 | * May be copied or modified under the terms of the GNU General Public | ||
12 | * License. See linux/COPYING for more information. | ||
13 | * | 5 | * |
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
14 | */ | 9 | */ |
15 | #undef DEBUG | ||
16 | |||
17 | #include <linux/types.h> | 10 | #include <linux/types.h> |
18 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
19 | #include <linux/init.h> | 12 | #include <linux/init.h> |
@@ -117,13 +110,8 @@ int __init pcibios_init_platform(void) | |||
117 | 110 | ||
118 | pci_cache_line_size = pci_read_reg(chan, SH7780_PCICLS) / 4; | 111 | pci_cache_line_size = pci_read_reg(chan, SH7780_PCICLS) / 4; |
119 | 112 | ||
120 | /* set the command/status bits to: | 113 | /* |
121 | * Wait Cycle Control + Parity Enable + Bus Master + | 114 | * Set IO and Mem windows to local address |
122 | * Mem space enable | ||
123 | */ | ||
124 | pci_write_reg(chan, 0x00000046, SH7780_PCICMD); | ||
125 | |||
126 | /* Set IO and Mem windows to local address | ||
127 | * Make PCI and local address the same for easy 1 to 1 mapping | 115 | * Make PCI and local address the same for easy 1 to 1 mapping |
128 | */ | 116 | */ |
129 | pci_write_reg(chan, sh7780_pci_map.window0.size - 0xfffff, SH4_PCILSR0); | 117 | pci_write_reg(chan, sh7780_pci_map.window0.size - 0xfffff, SH4_PCILSR0); |
@@ -131,9 +119,33 @@ int __init pcibios_init_platform(void) | |||
131 | pci_write_reg(chan, sh7780_pci_map.window0.base, SH4_PCILAR0); | 119 | pci_write_reg(chan, sh7780_pci_map.window0.base, SH4_PCILAR0); |
132 | pci_write_reg(chan, sh7780_pci_map.window0.base, SH7780_PCIMBAR0); | 120 | pci_write_reg(chan, sh7780_pci_map.window0.base, SH7780_PCIMBAR0); |
133 | 121 | ||
122 | pci_write_reg(chan, 0x0000380f, SH4_PCIAINTM); | ||
123 | |||
124 | /* Set up standard PCI config registers */ | ||
125 | __raw_writew(0xFB00, chan->reg_base + SH7780_PCISTATUS); | ||
126 | __raw_writew(0x0047, chan->reg_base + SH7780_PCICMD); | ||
127 | __raw_writew(0x1912, chan->reg_base + SH7780_PCISVID); | ||
128 | __raw_writew(0x0001, chan->reg_base + SH7780_PCISID); | ||
129 | |||
130 | __raw_writeb(0x00, chan->reg_base + SH7780_PCIPIF); | ||
131 | |||
134 | /* Apply any last-minute PCIC fixups */ | 132 | /* Apply any last-minute PCIC fixups */ |
135 | pci_fixup_pcic(chan); | 133 | pci_fixup_pcic(chan); |
136 | 134 | ||
135 | pci_write_reg(chan, 0xfd000000, SH7780_PCIMBR0); | ||
136 | pci_write_reg(chan, 0x00fc0000, SH7780_PCIMBMR0); | ||
137 | |||
138 | #ifdef CONFIG_32BIT | ||
139 | pci_write_reg(chan, 0xc0000000, SH7780_PCIMBR2); | ||
140 | pci_write_reg(chan, 0x20000000 - SH7780_PCI_IO_SIZE, SH7780_PCIMBMR2); | ||
141 | #endif | ||
142 | |||
143 | /* Set IOBR for windows containing area specified in pci.h */ | ||
144 | pci_write_reg(chan, chan->io_resource->start & ~(SH7780_PCI_IO_SIZE-1), | ||
145 | SH7780_PCIIOBR); | ||
146 | pci_write_reg(chan, ((SH7780_PCI_IO_SIZE-1) & (7<<18)), | ||
147 | SH7780_PCIIOBMR); | ||
148 | |||
137 | /* SH7780 init done, set central function init complete */ | 149 | /* SH7780 init done, set central function init complete */ |
138 | /* use round robin mode to stop a device starving/overruning */ | 150 | /* use round robin mode to stop a device starving/overruning */ |
139 | word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO; | 151 | word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO; |
diff --git a/arch/sh/drivers/pci/pci-sh7780.h b/arch/sh/drivers/pci/pci-sh7780.h index 4b65d4b26f75..4a52478c97cf 100644 --- a/arch/sh/drivers/pci/pci-sh7780.h +++ b/arch/sh/drivers/pci/pci-sh7780.h | |||
@@ -65,11 +65,6 @@ | |||
65 | #define SH7780_PCIPMCSR_BSE 0x046 | 65 | #define SH7780_PCIPMCSR_BSE 0x046 |
66 | #define SH7780_PCICDD 0x047 | 66 | #define SH7780_PCICDD 0x047 |
67 | 67 | ||
68 | #define SH7780_PCICR 0x100 /* PCI Control Register */ | ||
69 | #define SH7780_PCILSR 0x104 /* PCI Local Space Register0 */ | ||
70 | #define SH7780_PCILSR1 0x108 /* PCI Local Space Register1 */ | ||
71 | #define SH7780_PCILAR0 0x10C /* PCI Local Address Register1 */ | ||
72 | #define SH7780_PCILAR1 0x110 /* PCI Local Address Register1 */ | ||
73 | #define SH7780_PCIIR 0x114 /* PCI Interrupt Register */ | 68 | #define SH7780_PCIIR 0x114 /* PCI Interrupt Register */ |
74 | #define SH7780_PCIIMR 0x118 /* PCI Interrupt Mask Register */ | 69 | #define SH7780_PCIIMR 0x118 /* PCI Interrupt Mask Register */ |
75 | #define SH7780_PCIAIR 0x11C /* Error Address Register */ | 70 | #define SH7780_PCIAIR 0x11C /* Error Address Register */ |