common-smdk.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* linux/arch/arm/mach-s3c2410/common-smdk.c
  2. *
  3. * Copyright (c) 2006 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * Common code for SMDK2410 and SMDK2440 boards
  7. *
  8. * http://www.fluff.org/ben/smdk2440/
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/types.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/list.h>
  18. #include <linux/timer.h>
  19. #include <linux/init.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/mtd/mtd.h>
  22. #include <linux/mtd/nand.h>
  23. #include <linux/mtd/nand_ecc.h>
  24. #include <linux/mtd/partitions.h>
  25. #include <asm/mach/arch.h>
  26. #include <asm/mach/map.h>
  27. #include <asm/mach/irq.h>
  28. #include <asm/hardware.h>
  29. #include <asm/io.h>
  30. #include <asm/irq.h>
  31. #include <asm/arch/regs-gpio.h>
  32. #include <asm/arch/nand.h>
  33. #include "common-smdk.h"
  34. #include "devs.h"
  35. #include "pm.h"
  36. /* NAND parititon from 2.4.18-swl5 */
  37. static struct mtd_partition smdk_default_nand_part[] = {
  38. [0] = {
  39. .name = "Boot Agent",
  40. .size = SZ_16K,
  41. .offset = 0,
  42. },
  43. [1] = {
  44. .name = "S3C2410 flash partition 1",
  45. .offset = 0,
  46. .size = SZ_2M,
  47. },
  48. [2] = {
  49. .name = "S3C2410 flash partition 2",
  50. .offset = SZ_4M,
  51. .size = SZ_4M,
  52. },
  53. [3] = {
  54. .name = "S3C2410 flash partition 3",
  55. .offset = SZ_8M,
  56. .size = SZ_2M,
  57. },
  58. [4] = {
  59. .name = "S3C2410 flash partition 4",
  60. .offset = SZ_1M * 10,
  61. .size = SZ_4M,
  62. },
  63. [5] = {
  64. .name = "S3C2410 flash partition 5",
  65. .offset = SZ_1M * 14,
  66. .size = SZ_1M * 10,
  67. },
  68. [6] = {
  69. .name = "S3C2410 flash partition 6",
  70. .offset = SZ_1M * 24,
  71. .size = SZ_1M * 24,
  72. },
  73. [7] = {
  74. .name = "S3C2410 flash partition 7",
  75. .offset = SZ_1M * 48,
  76. .size = SZ_16M,
  77. }
  78. };
  79. static struct s3c2410_nand_set smdk_nand_sets[] = {
  80. [0] = {
  81. .name = "NAND",
  82. .nr_chips = 1,
  83. .nr_partitions = ARRAY_SIZE(smdk_default_nand_part),
  84. .partitions = smdk_default_nand_part,
  85. },
  86. };
  87. /* choose a set of timings which should suit most 512Mbit
  88. * chips and beyond.
  89. */
  90. static struct s3c2410_platform_nand smdk_nand_info = {
  91. .tacls = 20,
  92. .twrph0 = 60,
  93. .twrph1 = 20,
  94. .nr_sets = ARRAY_SIZE(smdk_nand_sets),
  95. .sets = smdk_nand_sets,
  96. };
  97. /* devices we initialise */
  98. static struct platform_device __initdata *smdk_devs[] = {
  99. &s3c_device_nand,
  100. };
  101. void __init smdk_machine_init(void)
  102. {
  103. /* Configure the LEDs (even if we have no LED support)*/
  104. s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_OUTP);
  105. s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
  106. s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_OUTP);
  107. s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_OUTP);
  108. s3c2410_gpio_setpin(S3C2410_GPF4, 1);
  109. s3c2410_gpio_setpin(S3C2410_GPF5, 1);
  110. s3c2410_gpio_setpin(S3C2410_GPF6, 1);
  111. s3c2410_gpio_setpin(S3C2410_GPF7, 1);
  112. s3c_device_nand.dev.platform_data = &smdk_nand_info;
  113. platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));
  114. s3c2410_pm_init();
  115. }