aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/drivers/pci/ops-sh4.c
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-03-11 02:41:51 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-04-16 03:00:12 -0400
commitb8b47bfbe4eb1ae0e6891e49c86a5f4fb00413be (patch)
treeea54e39235d29b7f96fd24611ff507dfdaa1d178 /arch/sh/drivers/pci/ops-sh4.c
parent3ee8da87ba6151ec91b2b8bbd27633bb248ea0d5 (diff)
sh: pass along struct pci_channel
These patches rework the pci code for the sh architecture. Currently each board implements some kind of ioport to address mapping. Some boards use generic_io_base others try passing addresses as io ports. This is the first set of patches that try to unify the pci code as much as possible to avoid duplicated code. This will in the end lead to fewer lines board specific code and more generic code. This patch makes sure a struct pci_channel pointer is passed along to various pci functions such as pci_read_reg(), pci_write_reg(), pci_fixup_pcic(), sh7751_pcic_init() and sh7780_pcic_init(). Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/drivers/pci/ops-sh4.c')
-rw-r--r--arch/sh/drivers/pci/ops-sh4.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/arch/sh/drivers/pci/ops-sh4.c b/arch/sh/drivers/pci/ops-sh4.c
index 710a3b0306e5..92d27f734f2e 100644
--- a/arch/sh/drivers/pci/ops-sh4.c
+++ b/arch/sh/drivers/pci/ops-sh4.c
@@ -34,8 +34,8 @@ static int sh4_pci_read(struct pci_bus *bus, unsigned int devfn,
34 * so we must do byte alignment by hand 34 * so we must do byte alignment by hand
35 */ 35 */
36 spin_lock_irqsave(&sh4_pci_lock, flags); 36 spin_lock_irqsave(&sh4_pci_lock, flags);
37 pci_write_reg(CONFIG_CMD(bus, devfn, where), SH4_PCIPAR); 37 pci_write_reg(NULL, CONFIG_CMD(bus, devfn, where), SH4_PCIPAR);
38 data = pci_read_reg(SH4_PCIPDR); 38 data = pci_read_reg(NULL, SH4_PCIPDR);
39 spin_unlock_irqrestore(&sh4_pci_lock, flags); 39 spin_unlock_irqrestore(&sh4_pci_lock, flags);
40 40
41 switch (size) { 41 switch (size) {
@@ -68,8 +68,8 @@ static int sh4_pci_write(struct pci_bus *bus, unsigned int devfn,
68 u32 data; 68 u32 data;
69 69
70 spin_lock_irqsave(&sh4_pci_lock, flags); 70 spin_lock_irqsave(&sh4_pci_lock, flags);
71 pci_write_reg(CONFIG_CMD(bus, devfn, where), SH4_PCIPAR); 71 pci_write_reg(NULL, CONFIG_CMD(bus, devfn, where), SH4_PCIPAR);
72 data = pci_read_reg(SH4_PCIPDR); 72 data = pci_read_reg(NULL, SH4_PCIPDR);
73 spin_unlock_irqrestore(&sh4_pci_lock, flags); 73 spin_unlock_irqrestore(&sh4_pci_lock, flags);
74 74
75 switch (size) { 75 switch (size) {
@@ -90,7 +90,7 @@ static int sh4_pci_write(struct pci_bus *bus, unsigned int devfn,
90 return PCIBIOS_FUNC_NOT_SUPPORTED; 90 return PCIBIOS_FUNC_NOT_SUPPORTED;
91 } 91 }
92 92
93 pci_write_reg(data, SH4_PCIPDR); 93 pci_write_reg(NULL, data, SH4_PCIPDR);
94 94
95 return PCIBIOS_SUCCESSFUL; 95 return PCIBIOS_SUCCESSFUL;
96} 96}
@@ -106,25 +106,25 @@ struct pci_ops sh4_pci_ops = {
106 */ 106 */
107static unsigned int pci_probe = PCI_PROBE_CONF1; 107static unsigned int pci_probe = PCI_PROBE_CONF1;
108 108
109int __init sh4_pci_check_direct(void) 109int __init sh4_pci_check_direct(struct pci_channel *chan)
110{ 110{
111 /* 111 /*
112 * Check if configuration works. 112 * Check if configuration works.
113 */ 113 */
114 if (pci_probe & PCI_PROBE_CONF1) { 114 if (pci_probe & PCI_PROBE_CONF1) {
115 unsigned int tmp = pci_read_reg(SH4_PCIPAR); 115 unsigned int tmp = pci_read_reg(chan, SH4_PCIPAR);
116 116
117 pci_write_reg(P1SEG, SH4_PCIPAR); 117 pci_write_reg(chan, P1SEG, SH4_PCIPAR);
118 118
119 if (pci_read_reg(SH4_PCIPAR) == P1SEG) { 119 if (pci_read_reg(chan, SH4_PCIPAR) == P1SEG) {
120 pci_write_reg(tmp, SH4_PCIPAR); 120 pci_write_reg(chan, tmp, SH4_PCIPAR);
121 printk(KERN_INFO "PCI: Using configuration type 1\n"); 121 printk(KERN_INFO "PCI: Using configuration type 1\n");
122 request_region(PCI_REG(SH4_PCIPAR), 8, "PCI conf1"); 122 request_region(PCI_REG(SH4_PCIPAR), 8, "PCI conf1");
123 123
124 return 0; 124 return 0;
125 } 125 }
126 126
127 pci_write_reg(tmp, SH4_PCIPAR); 127 pci_write_reg(chan, tmp, SH4_PCIPAR);
128 } 128 }
129 129
130 pr_debug("PCI: pci_check_direct failed\n"); 130 pr_debug("PCI: pci_check_direct failed\n");
@@ -163,7 +163,7 @@ char * __devinit pcibios_setup(char *str)
163 return str; 163 return str;
164} 164}
165 165
166int __attribute__((weak)) pci_fixup_pcic(void) 166int __attribute__((weak)) pci_fixup_pcic(struct pci_channel *chan)
167{ 167{
168 /* Nothing to do. */ 168 /* Nothing to do. */
169 return 0; 169 return 0;