2 * linux/arch/arm/mach-footbridge/mm.c
4 * Copyright (C) 1998-2000 Russell King, Dave Gilbert.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Extra MM routines for the EBSA285 architecture
12 #include <linux/config.h>
13 #include <linux/kernel.h>
15 #include <linux/init.h>
17 #include <asm/pgtable.h>
20 #include <asm/hardware/dec21285.h>
21 #include <asm/mach-types.h>
23 #include <asm/mach/map.h>
26 * Common mapping for all systems. Note that the outbound write flush is
27 * commented out since there is a "No Fix" problem with it. Not mapping
28 * it means that we have extra bullet protection on our feet.
30 static struct map_desc fb_common_io_desc[] __initdata = {
31 { ARMCSR_BASE, DC21285_ARMCSR_BASE, ARMCSR_SIZE, MT_DEVICE },
32 { XBUS_BASE, 0x40000000, XBUS_SIZE, MT_DEVICE }
36 * The mapping when the footbridge is in host mode. We don't map any of
37 * this when we are in add-in mode.
39 static struct map_desc ebsa285_host_io_desc[] __initdata = {
40 #if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_FOOTBRIDGE_HOST)
41 { PCIMEM_BASE, DC21285_PCI_MEM, PCIMEM_SIZE, MT_DEVICE },
42 { PCICFG0_BASE, DC21285_PCI_TYPE_0_CONFIG, PCICFG0_SIZE, MT_DEVICE },
43 { PCICFG1_BASE, DC21285_PCI_TYPE_1_CONFIG, PCICFG1_SIZE, MT_DEVICE },
44 { PCIIACK_BASE, DC21285_PCI_IACK, PCIIACK_SIZE, MT_DEVICE },
45 { PCIO_BASE, DC21285_PCI_IO, PCIO_SIZE, MT_DEVICE }
50 * The CO-ebsa285 mapping.
52 static struct map_desc co285_io_desc[] __initdata = {
53 #ifdef CONFIG_ARCH_CO285
54 { PCIO_BASE, DC21285_PCI_IO, PCIO_SIZE, MT_DEVICE },
55 { PCIMEM_BASE, DC21285_PCI_MEM, PCIMEM_SIZE, MT_DEVICE }
59 void __init footbridge_map_io(void)
62 * Set up the common mapping first; we need this to
63 * determine whether we're in host mode or not.
65 iotable_init(fb_common_io_desc, ARRAY_SIZE(fb_common_io_desc));
68 * Now, work out what we've got to map in addition on this
71 if (machine_is_co285())
72 iotable_init(co285_io_desc, ARRAY_SIZE(co285_io_desc));
73 if (footbridge_cfn_mode())
74 iotable_init(ebsa285_host_io_desc, ARRAY_SIZE(ebsa285_host_io_desc));
77 #ifdef CONFIG_FOOTBRIDGE_ADDIN
80 * These two functions convert virtual addresses to PCI addresses and PCI
81 * addresses to virtual addresses. Note that it is only legal to use these
82 * on memory obtained via get_zeroed_page or kmalloc.
84 unsigned long __virt_to_bus(unsigned long res)
86 WARN_ON(res < PAGE_OFFSET || res >= (unsigned long)high_memory);
88 return (res - PAGE_OFFSET) + (*CSR_PCISDRAMBASE & 0xfffffff0);
90 EXPORT_SYMBOL(__virt_to_bus);
92 unsigned long __bus_to_virt(unsigned long res)
94 res -= (*CSR_PCISDRAMBASE & 0xfffffff0);
97 WARN_ON(res < PAGE_OFFSET || res >= (unsigned long)high_memory);
101 EXPORT_SYMBOL(__bus_to_virt);