Lennert Buytenhek | e7736d4 | 2006-03-20 17:10:13 +0000 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-ep93xx/ts72xx.c |
| 3 | * Technologic Systems TS72xx SBC support. |
| 4 | * |
| 5 | * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/config.h> |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/mm.h> |
| 17 | #include <linux/sched.h> |
| 18 | #include <linux/interrupt.h> |
| 19 | #include <linux/mtd/physmap.h> |
| 20 | #include <asm/io.h> |
| 21 | #include <asm/hardware.h> |
| 22 | #include <asm/mach-types.h> |
| 23 | #include <asm/mach/arch.h> |
| 24 | #include <asm/mach/map.h> |
| 25 | |
| 26 | static struct map_desc ts72xx_io_desc[] __initdata = { |
| 27 | { |
| 28 | .virtual = TS72XX_MODEL_VIRT_BASE, |
| 29 | .pfn = __phys_to_pfn(TS72XX_MODEL_PHYS_BASE), |
| 30 | .length = TS72XX_MODEL_SIZE, |
| 31 | .type = MT_DEVICE, |
| 32 | }, { |
| 33 | .virtual = TS72XX_OPTIONS_VIRT_BASE, |
| 34 | .pfn = __phys_to_pfn(TS72XX_OPTIONS_PHYS_BASE), |
| 35 | .length = TS72XX_OPTIONS_SIZE, |
| 36 | .type = MT_DEVICE, |
| 37 | }, { |
| 38 | .virtual = TS72XX_OPTIONS2_VIRT_BASE, |
| 39 | .pfn = __phys_to_pfn(TS72XX_OPTIONS2_PHYS_BASE), |
| 40 | .length = TS72XX_OPTIONS2_SIZE, |
| 41 | .type = MT_DEVICE, |
| 42 | } |
| 43 | }; |
| 44 | |
| 45 | static struct map_desc ts72xx_nand_io_desc[] __initdata = { |
| 46 | { |
| 47 | .virtual = TS72XX_NAND_DATA_VIRT_BASE, |
| 48 | .pfn = __phys_to_pfn(TS72XX_NAND1_DATA_PHYS_BASE), |
| 49 | .length = TS72XX_NAND_DATA_SIZE, |
| 50 | .type = MT_DEVICE, |
| 51 | }, { |
| 52 | .virtual = TS72XX_NAND_CONTROL_VIRT_BASE, |
| 53 | .pfn = __phys_to_pfn(TS72XX_NAND1_CONTROL_PHYS_BASE), |
| 54 | .length = TS72XX_NAND_CONTROL_SIZE, |
| 55 | .type = MT_DEVICE, |
| 56 | }, { |
| 57 | .virtual = TS72XX_NAND_BUSY_VIRT_BASE, |
| 58 | .pfn = __phys_to_pfn(TS72XX_NAND1_BUSY_PHYS_BASE), |
| 59 | .length = TS72XX_NAND_BUSY_SIZE, |
| 60 | .type = MT_DEVICE, |
| 61 | } |
| 62 | }; |
| 63 | |
| 64 | static struct map_desc ts72xx_alternate_nand_io_desc[] __initdata = { |
| 65 | { |
| 66 | .virtual = TS72XX_NAND_DATA_VIRT_BASE, |
| 67 | .pfn = __phys_to_pfn(TS72XX_NAND2_DATA_PHYS_BASE), |
| 68 | .length = TS72XX_NAND_DATA_SIZE, |
| 69 | .type = MT_DEVICE, |
| 70 | }, { |
| 71 | .virtual = TS72XX_NAND_CONTROL_VIRT_BASE, |
| 72 | .pfn = __phys_to_pfn(TS72XX_NAND2_CONTROL_PHYS_BASE), |
| 73 | .length = TS72XX_NAND_CONTROL_SIZE, |
| 74 | .type = MT_DEVICE, |
| 75 | }, { |
| 76 | .virtual = TS72XX_NAND_BUSY_VIRT_BASE, |
| 77 | .pfn = __phys_to_pfn(TS72XX_NAND2_BUSY_PHYS_BASE), |
| 78 | .length = TS72XX_NAND_BUSY_SIZE, |
| 79 | .type = MT_DEVICE, |
| 80 | } |
| 81 | }; |
| 82 | |
| 83 | static void __init ts72xx_map_io(void) |
| 84 | { |
| 85 | ep93xx_map_io(); |
| 86 | iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc)); |
| 87 | |
| 88 | /* |
| 89 | * The TS-7200 has NOR flash, the other models have NAND flash. |
| 90 | */ |
| 91 | if (!board_is_ts7200()) { |
| 92 | if (is_ts9420_installed()) { |
| 93 | iotable_init(ts72xx_alternate_nand_io_desc, |
| 94 | ARRAY_SIZE(ts72xx_alternate_nand_io_desc)); |
| 95 | } else { |
| 96 | iotable_init(ts72xx_nand_io_desc, |
| 97 | ARRAY_SIZE(ts72xx_nand_io_desc)); |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | static void __init ts72xx_init_machine(void) |
| 103 | { |
| 104 | ep93xx_init_devices(); |
| 105 | if (board_is_ts7200()) |
| 106 | physmap_configure(TS72XX_NOR_PHYS_BASE, 0x01000000, 1, NULL); |
| 107 | } |
| 108 | |
| 109 | MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC") |
| 110 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ |
| 111 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 112 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 113 | .boot_params = 0x00000100, |
| 114 | .map_io = ts72xx_map_io, |
| 115 | .init_irq = ep93xx_init_irq, |
| 116 | .timer = &ep93xx_timer, |
| 117 | .init_machine = ts72xx_init_machine, |
| 118 | MACHINE_END |