diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-04-17 02:05:19 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-04-17 02:05:19 -0400 |
commit | 4e7b7fdb129995640f144b7de114e109c6b46a2a (patch) | |
tree | 9f3b7bc00884fa35c23a737bc70c8271384b6a89 /arch/sh/drivers | |
parent | 0bbc9bc3189f24de946777af43c9033c8c4871e4 (diff) |
sh: pci: Rework SH7780 host controller detection.
This reworks how the host controller is probed, and makes it a bit more
verbose in the event a new type of controller is detected. Additionally,
we also log the revision information.
This now uses the proper access sizes for the vendor/device registers,
rather than relying on a larger access that encapsulated both of them.
Not all devices support 32-bit read cycles for these registers.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/drivers')
-rw-r--r-- | arch/sh/drivers/pci/pci-sh7780.c | 42 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci-sh7780.h | 5 |
2 files changed, 26 insertions, 21 deletions
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c index 7f4f59037544..63b5151e9aaa 100644 --- a/arch/sh/drivers/pci/pci-sh7780.c +++ b/arch/sh/drivers/pci/pci-sh7780.c | |||
@@ -34,33 +34,39 @@ | |||
34 | int __init sh7780_pci_init(struct pci_channel *chan) | 34 | int __init sh7780_pci_init(struct pci_channel *chan) |
35 | { | 35 | { |
36 | unsigned int id; | 36 | unsigned int id; |
37 | int ret, match = 0; | 37 | const char *type = NULL; |
38 | int ret; | ||
38 | 39 | ||
39 | pr_debug("PCI: Starting intialization.\n"); | 40 | printk(KERN_NOTICE "PCI: Starting intialization.\n"); |
40 | 41 | ||
41 | chan->reg_base = 0xfe040000; | 42 | chan->reg_base = 0xfe040000; |
42 | chan->io_base = 0xfe200000; | 43 | chan->io_base = 0xfe200000; |
43 | 44 | ||
44 | ctrl_outl(0x00000001, SH7780_PCI_VCR2); /* Enable PCIC */ | 45 | /* Enable CPU access to the PCIC registers. */ |
45 | 46 | __raw_writel(PCIECR_ENBL, PCIECR); | |
46 | /* check for SH7780/SH7780R hardware */ | ||
47 | id = pci_read_reg(chan, SH7780_PCIVID); | ||
48 | if ((id & 0xffff) == SH7780_VENDOR_ID) { | ||
49 | switch ((id >> 16) & 0xffff) { | ||
50 | case SH7763_DEVICE_ID: | ||
51 | case SH7780_DEVICE_ID: | ||
52 | case SH7781_DEVICE_ID: | ||
53 | case SH7785_DEVICE_ID: | ||
54 | match = 1; | ||
55 | break; | ||
56 | } | ||
57 | } | ||
58 | 47 | ||
59 | if (unlikely(!match)) { | 48 | id = __raw_readw(chan->reg_base + SH7780_PCIVID); |
60 | printk(KERN_ERR "PCI: This is not an SH7780 (%x)\n", id); | 49 | if (id != SH7780_VENDOR_ID) { |
50 | printk(KERN_ERR "PCI: Unknown vendor ID 0x%04x.\n", id); | ||
61 | return -ENODEV; | 51 | return -ENODEV; |
62 | } | 52 | } |
63 | 53 | ||
54 | id = __raw_readw(chan->reg_base + SH7780_PCIDID); | ||
55 | type = (id == SH7763_DEVICE_ID) ? "SH7763" : | ||
56 | (id == SH7780_DEVICE_ID) ? "SH7780" : | ||
57 | (id == SH7781_DEVICE_ID) ? "SH7781" : | ||
58 | (id == SH7785_DEVICE_ID) ? "SH7785" : | ||
59 | NULL; | ||
60 | if (unlikely(!type)) { | ||
61 | printk(KERN_ERR "PCI: Found an unsupported Renesas host " | ||
62 | "controller, device id 0x%04x.\n", id); | ||
63 | return -EINVAL; | ||
64 | } | ||
65 | |||
66 | printk(KERN_NOTICE "PCI: Found a Renesas %s host " | ||
67 | "controller, revision %d.\n", type, | ||
68 | __raw_readb(chan->reg_base + SH7780_PCIRID)); | ||
69 | |||
64 | if ((ret = sh4_pci_check_direct(chan)) != 0) | 70 | if ((ret = sh4_pci_check_direct(chan)) != 0) |
65 | return ret; | 71 | return ret; |
66 | 72 | ||
diff --git a/arch/sh/drivers/pci/pci-sh7780.h b/arch/sh/drivers/pci/pci-sh7780.h index fffcf1dcfedf..213f1d8c9ca5 100644 --- a/arch/sh/drivers/pci/pci-sh7780.h +++ b/arch/sh/drivers/pci/pci-sh7780.h | |||
@@ -20,9 +20,8 @@ | |||
20 | #define SH7785_DEVICE_ID 0x0007 | 20 | #define SH7785_DEVICE_ID 0x0007 |
21 | 21 | ||
22 | /* SH7780 Control Registers */ | 22 | /* SH7780 Control Registers */ |
23 | #define SH7780_PCI_VCR0 0xFE000000 | 23 | #define PCIECR 0xFE000008 |
24 | #define SH7780_PCI_VCR1 0xFE000004 | 24 | #define PCIECR_ENBL 0x01 |
25 | #define SH7780_PCI_VCR2 0xFE000008 | ||
26 | 25 | ||
27 | /* SH7780 Specific Values */ | 26 | /* SH7780 Specific Values */ |
28 | #define SH7780_PCI_CONFIG_BASE 0xFD000000 /* Config space base addr */ | 27 | #define SH7780_PCI_CONFIG_BASE 0xFD000000 /* Config space base addr */ |