board-sapphire.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. #include <linux/gpio.h>
  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/device.h>
  22. #include <linux/delay.h>
  23. #include <mach/hardware.h>
  24. #include <asm/mach-types.h>
  25. #include <asm/mach/arch.h>
  26. #include <asm/mach/map.h>
  27. #include <asm/mach/flash.h>
  28. #include <mach/vreg.h>
  29. #include <mach/board.h>
  30. #include <asm/io.h>
  31. #include <asm/delay.h>
  32. #include <asm/setup.h>
  33. #include <linux/mtd/nand.h>
  34. #include <linux/mtd/partitions.h>
  35. #include "gpio_chip.h"
  36. #include "board-sapphire.h"
  37. #include "proc_comm.h"
  38. #include "devices.h"
  39. void msm_init_irq(void);
  40. void msm_init_gpio(void);
  41. static struct platform_device *devices[] __initdata = {
  42. &msm_device_smd,
  43. &msm_device_dmov,
  44. &msm_device_nand,
  45. &msm_device_uart1,
  46. &msm_device_uart3,
  47. };
  48. void msm_timer_init(void);
  49. static void __init sapphire_init_irq(void)
  50. {
  51. msm_init_irq();
  52. }
  53. static void __init sapphire_init(void)
  54. {
  55. platform_add_devices(devices, ARRAY_SIZE(devices));
  56. }
  57. static struct map_desc sapphire_io_desc[] __initdata = {
  58. {
  59. .virtual = SAPPHIRE_CPLD_BASE,
  60. .pfn = __phys_to_pfn(SAPPHIRE_CPLD_START),
  61. .length = SAPPHIRE_CPLD_SIZE,
  62. .type = MT_DEVICE_NONSHARED
  63. }
  64. };
  65. static void __init sapphire_fixup(struct tag *tags, char **cmdline,
  66. struct meminfo *mi)
  67. {
  68. int smi_sz = parse_tag_smi((const struct tag *)tags);
  69. mi->nr_banks = 1;
  70. mi->bank[0].start = PHYS_OFFSET;
  71. mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET);
  72. if (smi_sz == 32) {
  73. mi->bank[0].size = (84*1024*1024);
  74. } else if (smi_sz == 64) {
  75. mi->bank[0].size = (101*1024*1024);
  76. } else {
  77. /* Give a default value when not get smi size */
  78. smi_sz = 64;
  79. mi->bank[0].size = (101*1024*1024);
  80. }
  81. }
  82. static void __init sapphire_map_io(void)
  83. {
  84. msm_map_common_io();
  85. iotable_init(sapphire_io_desc, ARRAY_SIZE(sapphire_io_desc));
  86. msm_clock_init();
  87. }
  88. static void __init sapphire_init_late(void)
  89. {
  90. smd_debugfs_init();
  91. }
  92. MACHINE_START(SAPPHIRE, "sapphire")
  93. /* Maintainer: Brian Swetland <swetland@google.com> */
  94. .atag_offset = 0x100,
  95. .fixup = sapphire_fixup,
  96. .map_io = sapphire_map_io,
  97. .init_irq = sapphire_init_irq,
  98. .init_machine = sapphire_init,
  99. .init_late = sapphire_init_late,
  100. .init_time = msm_timer_init,
  101. MACHINE_END