aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/drivers/pci/pci-sh7780.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/pci-sh7780.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/pci-sh7780.c')
-rw-r--r--arch/sh/drivers/pci/pci-sh7780.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c
index bae6a2cf047d..56f673f66cb5 100644
--- a/arch/sh/drivers/pci/pci-sh7780.c
+++ b/arch/sh/drivers/pci/pci-sh7780.c
@@ -55,7 +55,7 @@ static int __init sh7780_pci_init(void)
55 ctrl_outl(0x00000001, SH7780_PCI_VCR2); /* Enable PCIC */ 55 ctrl_outl(0x00000001, SH7780_PCI_VCR2); /* Enable PCIC */
56 56
57 /* check for SH7780/SH7780R hardware */ 57 /* check for SH7780/SH7780R hardware */
58 id = pci_read_reg(SH7780_PCIVID); 58 id = pci_read_reg(NULL, SH7780_PCIVID);
59 if ((id & 0xffff) == SH7780_VENDOR_ID) { 59 if ((id & 0xffff) == SH7780_VENDOR_ID) {
60 switch ((id >> 16) & 0xffff) { 60 switch ((id >> 16) & 0xffff) {
61 case SH7763_DEVICE_ID: 61 case SH7763_DEVICE_ID:
@@ -82,14 +82,15 @@ static int __init sh7780_pci_init(void)
82 ctrl_outl(0x33333333, INTC_INTPRI); 82 ctrl_outl(0x33333333, INTC_INTPRI);
83 } 83 }
84 84
85 if ((ret = sh4_pci_check_direct()) != 0) 85 if ((ret = sh4_pci_check_direct(NULL)) != 0)
86 return ret; 86 return ret;
87 87
88 return pcibios_init_platform(); 88 return pcibios_init_platform();
89} 89}
90core_initcall(sh7780_pci_init); 90core_initcall(sh7780_pci_init);
91 91
92int __init sh7780_pcic_init(struct sh4_pci_address_map *map) 92int __init sh7780_pcic_init(struct pci_channel *chan,
93 struct sh4_pci_address_map *map)
93{ 94{
94 u32 word; 95 u32 word;
95 96
@@ -101,34 +102,34 @@ int __init sh7780_pcic_init(struct sh4_pci_address_map *map)
101 if (!(map->flags & SH4_PCIC_NO_RESET)) { 102 if (!(map->flags & SH4_PCIC_NO_RESET)) {
102 /* toggle PCI reset pin */ 103 /* toggle PCI reset pin */
103 word = SH4_PCICR_PREFIX | SH4_PCICR_PRST; 104 word = SH4_PCICR_PREFIX | SH4_PCICR_PRST;
104 pci_write_reg(word, SH4_PCICR); 105 pci_write_reg(chan, word, SH4_PCICR);
105 /* Wait for a long time... not 1 sec. but long enough */ 106 /* Wait for a long time... not 1 sec. but long enough */
106 mdelay(100); 107 mdelay(100);
107 word = SH4_PCICR_PREFIX; 108 word = SH4_PCICR_PREFIX;
108 pci_write_reg(word, SH4_PCICR); 109 pci_write_reg(chan, word, SH4_PCICR);
109 } 110 }
110 111
111 /* set the command/status bits to: 112 /* set the command/status bits to:
112 * Wait Cycle Control + Parity Enable + Bus Master + 113 * Wait Cycle Control + Parity Enable + Bus Master +
113 * Mem space enable 114 * Mem space enable
114 */ 115 */
115 pci_write_reg(0x00000046, SH7780_PCICMD); 116 pci_write_reg(chan, 0x00000046, SH7780_PCICMD);
116 117
117 /* define this host as the host bridge */ 118 /* define this host as the host bridge */
118 word = PCI_BASE_CLASS_BRIDGE << 24; 119 word = PCI_BASE_CLASS_BRIDGE << 24;
119 pci_write_reg(word, SH7780_PCIRID); 120 pci_write_reg(chan, word, SH7780_PCIRID);
120 121
121 /* Set IO and Mem windows to local address 122 /* Set IO and Mem windows to local address
122 * Make PCI and local address the same for easy 1 to 1 mapping 123 * Make PCI and local address the same for easy 1 to 1 mapping
123 */ 124 */
124 pci_write_reg(map->window0.size - 0xfffff, SH4_PCILSR0); 125 pci_write_reg(chan, map->window0.size - 0xfffff, SH4_PCILSR0);
125 pci_write_reg(map->window1.size - 0xfffff, SH4_PCILSR1); 126 pci_write_reg(chan, map->window1.size - 0xfffff, SH4_PCILSR1);
126 /* Set the values on window 0 PCI config registers */ 127 /* Set the values on window 0 PCI config registers */
127 pci_write_reg(map->window0.base, SH4_PCILAR0); 128 pci_write_reg(chan, map->window0.base, SH4_PCILAR0);
128 pci_write_reg(map->window0.base, SH7780_PCIMBAR0); 129 pci_write_reg(chan, map->window0.base, SH7780_PCIMBAR0);
129 /* Set the values on window 1 PCI config registers */ 130 /* Set the values on window 1 PCI config registers */
130 pci_write_reg(map->window1.base, SH4_PCILAR1); 131 pci_write_reg(chan, map->window1.base, SH4_PCILAR1);
131 pci_write_reg(map->window1.base, SH7780_PCIMBAR1); 132 pci_write_reg(chan, map->window1.base, SH7780_PCIMBAR1);
132 133
133 /* Map IO space into PCI IO window 134 /* Map IO space into PCI IO window
134 * The IO window is 64K-PCIBIOS_MIN_IO in size 135 * The IO window is 64K-PCIBIOS_MIN_IO in size
@@ -145,12 +146,12 @@ int __init sh7780_pcic_init(struct sh4_pci_address_map *map)
145 */ 146 */
146 147
147 /* Apply any last-minute PCIC fixups */ 148 /* Apply any last-minute PCIC fixups */
148 pci_fixup_pcic(); 149 pci_fixup_pcic(chan);
149 150
150 /* SH7780 init done, set central function init complete */ 151 /* SH7780 init done, set central function init complete */
151 /* use round robin mode to stop a device starving/overruning */ 152 /* use round robin mode to stop a device starving/overruning */
152 word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO; 153 word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO;
153 pci_write_reg(word, SH4_PCICR); 154 pci_write_reg(chan, word, SH4_PCICR);
154 155
155 return 1; 156 return 1;
156} 157}