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/sched.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, DOMAIN_IO, 0, 1, 0, 0 },
32 { XBUS_BASE, 0x40000000, XBUS_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
37 * The mapping when the footbridge is in host mode. We don't map any of
38 * this when we are in add-in mode.
40 static struct map_desc ebsa285_host_io_desc[] __initdata = {
41 #if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_FOOTBRIDGE_HOST)
42 { PCIMEM_BASE, DC21285_PCI_MEM, PCIMEM_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
43 { PCICFG0_BASE, DC21285_PCI_TYPE_0_CONFIG, PCICFG0_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
44 { PCICFG1_BASE, DC21285_PCI_TYPE_1_CONFIG, PCICFG1_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
45 { PCIIACK_BASE, DC21285_PCI_IACK, PCIIACK_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
46 { PCIO_BASE, DC21285_PCI_IO, PCIO_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
52 * The CO-ebsa285 mapping.
54 static struct map_desc co285_io_desc[] __initdata = {
55 #ifdef CONFIG_ARCH_CO285
56 { PCIO_BASE, DC21285_PCI_IO, PCIO_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
57 { PCIMEM_BASE, DC21285_PCI_MEM, PCIMEM_SIZE, DOMAIN_IO, 0, 1, 0, 0 },
62 void __init footbridge_map_io(void)
64 struct map_desc *desc = NULL;
67 * Set up the common mapping first; we need this to
68 * determine whether we're in host mode or not.
70 iotable_init(fb_common_io_desc);
73 * Now, work out what we've got to map in addition on this
76 if (machine_is_co285())
78 else if (footbridge_cfn_mode())
79 desc = ebsa285_host_io_desc;
85 #ifdef CONFIG_FOOTBRIDGE_ADDIN
88 * These two functions convert virtual addresses to PCI addresses and PCI
89 * addresses to virtual addresses. Note that it is only legal to use these
90 * on memory obtained via get_free_page or kmalloc.
92 unsigned long __virt_to_bus(unsigned long res)
94 #ifdef CONFIG_DEBUG_ERRORS
95 if (res < PAGE_OFFSET || res >= (unsigned long)high_memory) {
96 printk("__virt_to_bus: invalid virtual address 0x%08lx\n", res);
100 return (res - PAGE_OFFSET) + (*CSR_PCISDRAMBASE & 0xfffffff0);
103 unsigned long __bus_to_virt(unsigned long res)
105 res -= (*CSR_PCISDRAMBASE & 0xfffffff0);
108 #ifdef CONFIG_DEBUG_ERRORS
109 if (res < PAGE_OFFSET || res >= (unsigned long)high_memory) {
110 printk("__bus_to_virt: invalid virtual address 0x%08lx\n", res);