| Daniel Walker | 614ad98 | 2010-02-24 15:44:51 -0800 | [diff] [blame] | 1 | /* linux/arch/arm/mach-msm/board-sapphire.c | 
|  | 2 | * Copyright (C) 2007-2009 HTC Corporation. | 
|  | 3 | * Author: Thomas Tsai <thomas_tsai@htc.com> | 
|  | 4 | * | 
|  | 5 | * This software is licensed under the terms of the GNU General Public | 
|  | 6 | * License version 2, as published by the Free Software Foundation, and | 
|  | 7 | * may be copied, distributed, and modified under those terms. | 
|  | 8 | * | 
|  | 9 | * This program is distributed in the hope that it will be useful, | 
|  | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 12 | * GNU General Public License for more details. | 
|  | 13 | */ | 
|  | 14 |  | 
|  | 15 | #include <linux/kernel.h> | 
|  | 16 | #include <linux/init.h> | 
|  | 17 | #include <linux/platform_device.h> | 
|  | 18 | #include <linux/input.h> | 
|  | 19 | #include <linux/interrupt.h> | 
|  | 20 | #include <linux/irq.h> | 
|  | 21 | #include <linux/sysdev.h> | 
|  | 22 |  | 
|  | 23 | #include <linux/delay.h> | 
|  | 24 |  | 
|  | 25 | #include <asm/gpio.h> | 
|  | 26 | #include <mach/hardware.h> | 
|  | 27 | #include <asm/mach-types.h> | 
|  | 28 | #include <asm/mach/arch.h> | 
|  | 29 | #include <asm/mach/map.h> | 
|  | 30 | #include <asm/mach/flash.h> | 
|  | 31 | #include <asm/system.h> | 
|  | 32 | #include <mach/system.h> | 
|  | 33 | #include <mach/vreg.h> | 
|  | 34 | #include <mach/board.h> | 
|  | 35 |  | 
|  | 36 | #include <asm/io.h> | 
|  | 37 | #include <asm/delay.h> | 
|  | 38 | #include <asm/setup.h> | 
|  | 39 |  | 
|  | 40 | #include <linux/mtd/nand.h> | 
|  | 41 | #include <linux/mtd/partitions.h> | 
|  | 42 |  | 
|  | 43 | #include "gpio_chip.h" | 
|  | 44 | #include "board-sapphire.h" | 
|  | 45 | #include "proc_comm.h" | 
|  | 46 | #include "devices.h" | 
|  | 47 |  | 
|  | 48 | void msm_init_irq(void); | 
|  | 49 | void msm_init_gpio(void); | 
|  | 50 |  | 
|  | 51 | static struct platform_device *devices[] __initdata = { | 
|  | 52 | &msm_device_smd, | 
|  | 53 | &msm_device_dmov, | 
|  | 54 | &msm_device_nand, | 
|  | 55 | &msm_device_uart1, | 
|  | 56 | &msm_device_uart3, | 
|  | 57 | }; | 
|  | 58 |  | 
|  | 59 | extern struct sys_timer msm_timer; | 
|  | 60 |  | 
|  | 61 | static void __init sapphire_init_irq(void) | 
|  | 62 | { | 
|  | 63 | msm_init_irq(); | 
|  | 64 | } | 
|  | 65 |  | 
|  | 66 | static void __init sapphire_init(void) | 
|  | 67 | { | 
|  | 68 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 
|  | 69 | } | 
|  | 70 |  | 
|  | 71 | static struct map_desc sapphire_io_desc[] __initdata = { | 
|  | 72 | { | 
|  | 73 | .virtual = SAPPHIRE_CPLD_BASE, | 
|  | 74 | .pfn     = __phys_to_pfn(SAPPHIRE_CPLD_START), | 
|  | 75 | .length  = SAPPHIRE_CPLD_SIZE, | 
|  | 76 | .type    = MT_DEVICE_NONSHARED | 
|  | 77 | } | 
|  | 78 | }; | 
|  | 79 |  | 
|  | 80 | static void __init sapphire_fixup(struct machine_desc *desc, struct tag *tags, | 
|  | 81 | char **cmdline, struct meminfo *mi) | 
|  | 82 | { | 
|  | 83 | int smi_sz = parse_tag_smi((const struct tag *)tags); | 
|  | 84 |  | 
|  | 85 | mi->nr_banks = 1; | 
|  | 86 | mi->bank[0].start = PHYS_OFFSET; | 
|  | 87 | mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET); | 
|  | 88 | if (smi_sz == 32) { | 
|  | 89 | mi->bank[0].size = (84*1024*1024); | 
|  | 90 | } else if (smi_sz == 64) { | 
|  | 91 | mi->bank[0].size = (101*1024*1024); | 
|  | 92 | } else { | 
|  | 93 | /* Give a default value when not get smi size */ | 
|  | 94 | smi_sz = 64; | 
|  | 95 | mi->bank[0].size = (101*1024*1024); | 
|  | 96 | } | 
|  | 97 | } | 
|  | 98 |  | 
|  | 99 | static void __init sapphire_map_io(void) | 
|  | 100 | { | 
|  | 101 | msm_map_common_io(); | 
|  | 102 | iotable_init(sapphire_io_desc, ARRAY_SIZE(sapphire_io_desc)); | 
|  | 103 | msm_clock_init(); | 
|  | 104 | } | 
|  | 105 |  | 
|  | 106 | MACHINE_START(SAPPHIRE, "sapphire") | 
|  | 107 | /* Maintainer: Brian Swetland <swetland@google.com> */ | 
| Russell King | b75c178 | 2011-01-04 19:03:16 +0000 | [diff] [blame] | 108 | .boot_params    = PLAT_PHYS_OFFSET + 0x100, | 
| Daniel Walker | 614ad98 | 2010-02-24 15:44:51 -0800 | [diff] [blame] | 109 | .fixup          = sapphire_fixup, | 
|  | 110 | .map_io         = sapphire_map_io, | 
|  | 111 | .init_irq       = sapphire_init_irq, | 
|  | 112 | .init_machine   = sapphire_init, | 
|  | 113 | .timer          = &msm_timer, | 
|  | 114 | MACHINE_END |