diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-01-31 23:01:42 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-01-31 23:01:42 -0500 |
commit | 85b59f5bb24aeca1a987cbb206e228bf630c8327 (patch) | |
tree | 0bf1e2e46f58d04f597cf62f0fbf8ae5d7ada52d /arch/sh/drivers/pci/pci-sh7780.c | |
parent | aee4467b5ce5047401efb4175b1360ec1734affc (diff) |
sh: Enable PCI66 support for SH7780 host controller.
This adds some helper glue for scanning the bus and determining if all
of the devices are 66MHz capable or not before flipping on 66MHz mode.
This isn't quite to spec, but it's fairly consistent with what other
embedded controllers end up having to do.
Scanning code cribbed from the MIPS txx9 PCI code.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/drivers/pci/pci-sh7780.c')
-rw-r--r-- | arch/sh/drivers/pci/pci-sh7780.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c index 8405c8fded6f..b68f45b6451a 100644 --- a/arch/sh/drivers/pci/pci-sh7780.c +++ b/arch/sh/drivers/pci/pci-sh7780.c | |||
@@ -41,6 +41,29 @@ static struct pci_channel sh7780_pci_controller = { | |||
41 | .io_map_base = SH7780_PCI_IO_BASE, | 41 | .io_map_base = SH7780_PCI_IO_BASE, |
42 | }; | 42 | }; |
43 | 43 | ||
44 | static void __init sh7780_pci66_init(struct pci_channel *hose) | ||
45 | { | ||
46 | unsigned int tmp; | ||
47 | |||
48 | if (!pci_is_66mhz_capable(hose, 0, 0)) | ||
49 | return; | ||
50 | |||
51 | /* Enable register access */ | ||
52 | tmp = __raw_readl(hose->reg_base + SH4_PCICR); | ||
53 | tmp |= SH4_PCICR_PREFIX; | ||
54 | __raw_writel(tmp, hose->reg_base + SH4_PCICR); | ||
55 | |||
56 | /* Enable 66MHz operation */ | ||
57 | tmp = __raw_readw(hose->reg_base + PCI_STATUS); | ||
58 | tmp |= PCI_STATUS_66MHZ; | ||
59 | __raw_writew(tmp, hose->reg_base + PCI_STATUS); | ||
60 | |||
61 | /* Done */ | ||
62 | tmp = __raw_readl(hose->reg_base + SH4_PCICR); | ||
63 | tmp |= SH4_PCICR_PREFIX | SH4_PCICR_CFIN; | ||
64 | __raw_writel(tmp, hose->reg_base + SH4_PCICR); | ||
65 | } | ||
66 | |||
44 | static int __init sh7780_pci_init(void) | 67 | static int __init sh7780_pci_init(void) |
45 | { | 68 | { |
46 | struct pci_channel *chan = &sh7780_pci_controller; | 69 | struct pci_channel *chan = &sh7780_pci_controller; |
@@ -176,6 +199,12 @@ static int __init sh7780_pci_init(void) | |||
176 | 199 | ||
177 | register_pci_controller(chan); | 200 | register_pci_controller(chan); |
178 | 201 | ||
202 | sh7780_pci66_init(chan); | ||
203 | |||
204 | printk(KERN_NOTICE "PCI: Running at %dMHz.\n", | ||
205 | (__raw_readw(chan->reg_base + PCI_STATUS) & PCI_STATUS_66MHZ) ? | ||
206 | 66 : 33); | ||
207 | |||
179 | return 0; | 208 | return 0; |
180 | } | 209 | } |
181 | arch_initcall(sh7780_pci_init); | 210 | arch_initcall(sh7780_pci_init); |