| 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 | */ | 
| Russell King | 2f8163b | 2011-07-26 10:53:52 +0100 | [diff] [blame] | 14 | #include <linux/gpio.h> | 
| Daniel Walker | 614ad98 | 2010-02-24 15:44:51 -0800 | [diff] [blame] | 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> | 
| Kay Sievers | edbaa60 | 2011-12-21 16:26:03 -0800 | [diff] [blame] | 21 | #include <linux/device.h> | 
| Daniel Walker | 614ad98 | 2010-02-24 15:44:51 -0800 | [diff] [blame] | 22 |  | 
 | 23 | #include <linux/delay.h> | 
 | 24 |  | 
| Daniel Walker | 614ad98 | 2010-02-24 15:44:51 -0800 | [diff] [blame] | 25 | #include <mach/hardware.h> | 
 | 26 | #include <asm/mach-types.h> | 
 | 27 | #include <asm/mach/arch.h> | 
 | 28 | #include <asm/mach/map.h> | 
 | 29 | #include <asm/mach/flash.h> | 
| Daniel Walker | 614ad98 | 2010-02-24 15:44:51 -0800 | [diff] [blame] | 30 | #include <mach/vreg.h> | 
 | 31 | #include <mach/board.h> | 
 | 32 |  | 
 | 33 | #include <asm/io.h> | 
 | 34 | #include <asm/delay.h> | 
 | 35 | #include <asm/setup.h> | 
 | 36 |  | 
 | 37 | #include <linux/mtd/nand.h> | 
 | 38 | #include <linux/mtd/partitions.h> | 
 | 39 |  | 
 | 40 | #include "gpio_chip.h" | 
 | 41 | #include "board-sapphire.h" | 
 | 42 | #include "proc_comm.h" | 
 | 43 | #include "devices.h" | 
 | 44 |  | 
 | 45 | void msm_init_irq(void); | 
 | 46 | void msm_init_gpio(void); | 
 | 47 |  | 
 | 48 | static struct platform_device *devices[] __initdata = { | 
 | 49 | 	&msm_device_smd, | 
 | 50 | 	&msm_device_dmov, | 
 | 51 | 	&msm_device_nand, | 
 | 52 | 	&msm_device_uart1, | 
 | 53 | 	&msm_device_uart3, | 
 | 54 | }; | 
 | 55 |  | 
| Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 56 | void msm_timer_init(void); | 
| Daniel Walker | 614ad98 | 2010-02-24 15:44:51 -0800 | [diff] [blame] | 57 |  | 
 | 58 | static void __init sapphire_init_irq(void) | 
 | 59 | { | 
 | 60 | 	msm_init_irq(); | 
 | 61 | } | 
 | 62 |  | 
 | 63 | static void __init sapphire_init(void) | 
 | 64 | { | 
 | 65 | 	platform_add_devices(devices, ARRAY_SIZE(devices)); | 
 | 66 | } | 
 | 67 |  | 
 | 68 | static struct map_desc sapphire_io_desc[] __initdata = { | 
 | 69 | 	{ | 
 | 70 | 		.virtual = SAPPHIRE_CPLD_BASE, | 
 | 71 | 		.pfn     = __phys_to_pfn(SAPPHIRE_CPLD_START), | 
 | 72 | 		.length  = SAPPHIRE_CPLD_SIZE, | 
 | 73 | 		.type    = MT_DEVICE_NONSHARED | 
 | 74 | 	} | 
 | 75 | }; | 
 | 76 |  | 
| Russell King | 0744a3e | 2010-12-20 10:37:50 +0000 | [diff] [blame] | 77 | static void __init sapphire_fixup(struct tag *tags, char **cmdline, | 
 | 78 | 				  struct meminfo *mi) | 
| Daniel Walker | 614ad98 | 2010-02-24 15:44:51 -0800 | [diff] [blame] | 79 | { | 
 | 80 | 	int smi_sz = parse_tag_smi((const struct tag *)tags); | 
 | 81 |  | 
 | 82 | 	mi->nr_banks = 1; | 
 | 83 | 	mi->bank[0].start = PHYS_OFFSET; | 
 | 84 | 	mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET); | 
 | 85 | 	if (smi_sz == 32) { | 
 | 86 | 		mi->bank[0].size = (84*1024*1024); | 
 | 87 | 	} else if (smi_sz == 64) { | 
 | 88 | 		mi->bank[0].size = (101*1024*1024); | 
 | 89 | 	} else { | 
 | 90 | 		/* Give a default value when not get smi size */ | 
 | 91 | 		smi_sz = 64; | 
 | 92 | 		mi->bank[0].size = (101*1024*1024); | 
 | 93 | 	} | 
 | 94 | } | 
 | 95 |  | 
 | 96 | static void __init sapphire_map_io(void) | 
 | 97 | { | 
 | 98 | 	msm_map_common_io(); | 
 | 99 | 	iotable_init(sapphire_io_desc, ARRAY_SIZE(sapphire_io_desc)); | 
 | 100 | 	msm_clock_init(); | 
 | 101 | } | 
 | 102 |  | 
| Shawn Guo | c633c53 | 2012-05-02 15:53:20 +0800 | [diff] [blame] | 103 | static void __init sapphire_init_late(void) | 
 | 104 | { | 
 | 105 | 	smd_debugfs_init(); | 
 | 106 | } | 
 | 107 |  | 
| Daniel Walker | 614ad98 | 2010-02-24 15:44:51 -0800 | [diff] [blame] | 108 | MACHINE_START(SAPPHIRE, "sapphire") | 
 | 109 | /* Maintainer: Brian Swetland <swetland@google.com> */ | 
| Nicolas Pitre | f631dd4 | 2011-07-05 22:38:14 -0400 | [diff] [blame] | 110 | 	.atag_offset    = 0x100, | 
| Daniel Walker | 614ad98 | 2010-02-24 15:44:51 -0800 | [diff] [blame] | 111 | 	.fixup          = sapphire_fixup, | 
 | 112 | 	.map_io         = sapphire_map_io, | 
 | 113 | 	.init_irq       = sapphire_init_irq, | 
 | 114 | 	.init_machine   = sapphire_init, | 
| Shawn Guo | c633c53 | 2012-05-02 15:53:20 +0800 | [diff] [blame] | 115 | 	.init_late      = sapphire_init_late, | 
| Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 116 | 	.init_time	= msm_timer_init, | 
| Daniel Walker | 614ad98 | 2010-02-24 15:44:51 -0800 | [diff] [blame] | 117 | MACHINE_END |