aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/drivers
diff options
context:
space:
mode:
authorJamie Lenehan <lenehan@twibble.org>2006-09-27 02:05:39 -0400
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 02:05:39 -0400
commita09749dd86e9e93de10f12ab4ce4e90815b5650a (patch)
tree013d7deabb31dea70063a2acdc50ee86fb3c7b9a /arch/sh/drivers
parentb7e108ee63624176af85b97d4d80bef6fe099395 (diff)
sh: Titan board support.
Add support for the titan board. Signed-off-by: Jamie Lenehan <lenehan@twibble.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/drivers')
-rw-r--r--arch/sh/drivers/pci/Makefile1
-rw-r--r--arch/sh/drivers/pci/ops-titan.c84
-rw-r--r--arch/sh/drivers/pci/pci.c58
3 files changed, 131 insertions, 12 deletions
diff --git a/arch/sh/drivers/pci/Makefile b/arch/sh/drivers/pci/Makefile
index 365bc16a4a83..86d6d0660d4c 100644
--- a/arch/sh/drivers/pci/Makefile
+++ b/arch/sh/drivers/pci/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_SH_SECUREEDGE5410) += ops-snapgear.o
14obj-$(CONFIG_SH_BIGSUR) += ops-bigsur.o 14obj-$(CONFIG_SH_BIGSUR) += ops-bigsur.o
15obj-$(CONFIG_SH_RTS7751R2D) += ops-rts7751r2d.o fixups-rts7751r2d.o 15obj-$(CONFIG_SH_RTS7751R2D) += ops-rts7751r2d.o fixups-rts7751r2d.o
16obj-$(CONFIG_SH_SH03) += ops-sh03.o fixups-sh03.o 16obj-$(CONFIG_SH_SH03) += ops-sh03.o fixups-sh03.o
17obj-$(CONFIG_SH_TITAN) += ops-titan.o
diff --git a/arch/sh/drivers/pci/ops-titan.c b/arch/sh/drivers/pci/ops-titan.c
new file mode 100644
index 000000000000..f76e4e963ac1
--- /dev/null
+++ b/arch/sh/drivers/pci/ops-titan.c
@@ -0,0 +1,84 @@
1/*
2 * arch/sh/drivers/pci/ops-titan.c
3 *
4 * Ported to new API by Paul Mundt <lethal@linux-sh.org>
5 *
6 * Modified from ops-snapgear.c written by David McCullough
7 * Highly leveraged from pci-bigsur.c, written by Dustin McIntire.
8 *
9 * May be copied or modified under the terms of the GNU General Public
10 * License. See linux/COPYING for more information.
11 *
12 * PCI initialization for the Titan boards
13 */
14
15#include <linux/config.h>
16#include <linux/kernel.h>
17#include <linux/types.h>
18#include <linux/init.h>
19#include <linux/delay.h>
20#include <asm/io.h>
21#include <asm/titan.h>
22#include "pci-sh7751.h"
23
24int __init pcibios_map_platform_irq(u8 slot, u8 pin)
25{
26 int irq = -1;
27
28 switch (slot) {
29 case 0: irq = TITAN_IRQ_WAN; break; /* eth0 (WAN) */
30 case 1: irq = TITAN_IRQ_LAN; break; /* eth1 (LAN) */
31 case 2: irq = TITAN_IRQ_MPCIA; break; /* mPCI A */
32 case 3: irq = TITAN_IRQ_MPCIB; break; /* mPCI B */
33 case 4: irq = TITAN_IRQ_USB; break; /* USB */
34 default:
35 printk(KERN_INFO "PCI: Bad IRQ mapping request for slot %d\n", slot);
36 return -1;
37 }
38
39 printk("PCI: Mapping TITAN IRQ for slot %d, pin %c to irq %d\n",
40 slot, pin - 1 + 'A', irq);
41
42 return irq;
43}
44
45static struct resource sh7751_io_resource = {
46 .name = "SH7751_IO",
47 .start = SH7751_PCI_IO_BASE,
48 .end = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1,
49 .flags = IORESOURCE_IO
50};
51
52static struct resource sh7751_mem_resource = {
53 .name = "SH7751_mem",
54 .start = SH7751_PCI_MEMORY_BASE,
55 .end = SH7751_PCI_MEMORY_BASE + SH7751_PCI_MEM_SIZE - 1,
56 .flags = IORESOURCE_MEM
57};
58
59extern struct pci_ops sh7751_pci_ops;
60
61struct pci_channel board_pci_channels[] = {
62 { &sh7751_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
63 { NULL, NULL, NULL, 0, 0 },
64};
65EXPORT_SYMBOL(board_pci_channels);
66
67static struct sh7751_pci_address_map sh7751_pci_map = {
68 .window0 = {
69 .base = SH7751_CS2_BASE_ADDR,
70 .size = SH7751_MEM_REGION_SIZE*2, /* cs2 and cs3 */
71 },
72
73 .window1 = {
74 .base = SH7751_CS2_BASE_ADDR,
75 .size = SH7751_MEM_REGION_SIZE*2,
76 },
77
78 .flags = SH7751_PCIC_NO_RESET,
79};
80
81int __init pcibios_init_platform(void)
82{
83 return sh7751_pcic_init(&sh7751_pci_map);
84}
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 3d546ba329cf..1f5e23e8b163 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -1,21 +1,25 @@
1/* arch/sh/kernel/pci.c 1/*
2 * $Id: pci.c,v 1.1 2003/08/24 19:15:45 lethal Exp $ 2 * arch/sh/drivers/pci/pci.c
3 * 3 *
4 * Copyright (c) 2002 M. R. Brown <mrbrown@linux-sh.org> 4 * Copyright (c) 2002 M. R. Brown <mrbrown@linux-sh.org>
5 * 5 * Copyright (c) 2004, 2005 Paul Mundt <lethal@linux-sh.org>
6 * 6 *
7 * These functions are collected here to reduce duplication of common 7 * These functions are collected here to reduce duplication of common
8 * code amongst the many platform-specific PCI support code files. 8 * code amongst the many platform-specific PCI support code files.
9 * 9 *
10 * These routines require the following board-specific routines: 10 * These routines require the following board-specific routines:
11 * void pcibios_fixup_irqs(); 11 * void pcibios_fixup_irqs();
12 * 12 *
13 * See include/asm-sh/pci.h for more information. 13 * See include/asm-sh/pci.h for more information.
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
14 */ 18 */
15
16#include <linux/kernel.h> 19#include <linux/kernel.h>
17#include <linux/pci.h> 20#include <linux/pci.h>
18#include <linux/init.h> 21#include <linux/init.h>
22#include <asm/io.h>
19 23
20static int __init pcibios_init(void) 24static int __init pcibios_init(void)
21{ 25{
@@ -26,9 +30,8 @@ static int __init pcibios_init(void)
26#ifdef CONFIG_PCI_AUTO 30#ifdef CONFIG_PCI_AUTO
27 /* assign resources */ 31 /* assign resources */
28 busno = 0; 32 busno = 0;
29 for (p = board_pci_channels; p->pci_ops != NULL; p++) { 33 for (p = board_pci_channels; p->pci_ops != NULL; p++)
30 busno = pciauto_assign_resources(busno, p) + 1; 34 busno = pciauto_assign_resources(busno, p) + 1;
31 }
32#endif 35#endif
33 36
34 /* scan the buses */ 37 /* scan the buses */
@@ -61,13 +64,17 @@ pcibios_update_resource(struct pci_dev *dev, struct resource *root,
61 new |= PCI_ROM_ADDRESS_ENABLE; 64 new |= PCI_ROM_ADDRESS_ENABLE;
62 reg = dev->rom_base_reg; 65 reg = dev->rom_base_reg;
63 } else { 66 } else {
64 /* Somebody might have asked allocation of a non-standard resource */ 67 /*
68 * Somebody might have asked allocation of a non-standard
69 * resource
70 */
65 return; 71 return;
66 } 72 }
67 73
68 pci_write_config_dword(dev, reg, new); 74 pci_write_config_dword(dev, reg, new);
69 pci_read_config_dword(dev, reg, &check); 75 pci_read_config_dword(dev, reg, &check);
70 if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) { 76 if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ?
77 PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
71 printk(KERN_ERR "PCI: Error while updating region " 78 printk(KERN_ERR "PCI: Error while updating region "
72 "%s/%d (%08x != %08x)\n", pci_name(dev), resource, 79 "%s/%d (%08x != %08x)\n", pci_name(dev), resource,
73 new, check); 80 new, check);
@@ -145,7 +152,8 @@ void pcibios_set_master(struct pci_dev *dev)
145 lat = pcibios_max_latency; 152 lat = pcibios_max_latency;
146 else 153 else
147 return; 154 return;
148 printk(KERN_INFO "PCI: Setting latency timer of device %s to %d\n", pci_name(dev), lat); 155 printk(KERN_INFO "PCI: Setting latency timer of device %s to %d\n",
156 pci_name(dev), lat);
149 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); 157 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
150} 158}
151 159
@@ -153,3 +161,29 @@ void __init pcibios_update_irq(struct pci_dev *dev, int irq)
153{ 161{
154 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); 162 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
155} 163}
164
165void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
166{
167 unsigned long start = pci_resource_start(dev, bar);
168 unsigned long len = pci_resource_len(dev, bar);
169 unsigned long flags = pci_resource_flags(dev, bar);
170
171 if (!len || !start)
172 return NULL;
173 if (maxlen && len > maxlen)
174 len = maxlen;
175 if (flags & IORESOURCE_IO)
176 return ioport_map(start, len);
177 if (flags & IORESOURCE_MEM)
178 return ioremap(start, len);
179
180 return NULL;
181}
182
183void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
184{
185 iounmap(addr);
186}
187
188EXPORT_SYMBOL(pci_iomap);
189EXPORT_SYMBOL(pci_iounmap);