common-smdk.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 "devs.h"
  34. #include "pm.h"
  35. /* NAND parititon from 2.4.18-swl5 */
  36. static struct mtd_partition smdk_default_nand_part[] = {
  37. [0] = {
  38. .name = "Boot Agent",
  39. .size = SZ_16K,
  40. .offset = 0,
  41. },
  42. [1] = {
  43. .name = "S3C2410 flash parition 1",
  44. .offset = 0,
  45. .size = SZ_2M,
  46. },
  47. [2] = {
  48. .name = "S3C2410 flash partition 2",
  49. .offset = SZ_4M,
  50. .size = SZ_4M,
  51. },
  52. [3] = {
  53. .name = "S3C2410 flash partition 3",
  54. .offset = SZ_8M,
  55. .size = SZ_2M,
  56. },
  57. [4] = {
  58. .name = "S3C2410 flash partition 4",
  59. .offset = SZ_1M * 10,
  60. .size = SZ_4M,
  61. },
  62. [5] = {
  63. .name = "S3C2410 flash partition 5",
  64. .offset = SZ_1M * 14,
  65. .size = SZ_1M * 10,
  66. },
  67. [6] = {
  68. .name = "S3C2410 flash partition 6",
  69. .offset = SZ_1M * 24,
  70. .size = SZ_1M * 24,
  71. },
  72. [7] = {
  73. .name = "S3C2410 flash partition 7",
  74. .offset = SZ_1M * 48,
  75. .size = SZ_16M,
  76. }
  77. };
  78. static struct s3c2410_nand_set smdk_nand_sets[] = {
  79. [0] = {
  80. .name = "NAND",
  81. .nr_chips = 1,
  82. .nr_partitions = ARRAY_SIZE(smdk_default_nand_part),
  83. .partitions = smdk_default_nand_part,
  84. },
  85. };
  86. /* choose a set of timings which should suit most 512Mbit
  87. * chips and beyond.
  88. */
  89. static struct s3c2410_platform_nand smdk_nand_info = {
  90. .tacls = 20,
  91. .twrph0 = 60,
  92. .twrph1 = 20,
  93. .nr_sets = ARRAY_SIZE(smdk_nand_sets),
  94. .sets = smdk_nand_sets,
  95. };
  96. /* devices we initialise */
  97. static struct platform_device __initdata *smdk_devs[] = {
  98. &s3c_device_nand,
  99. };
  100. void __init smdk_machine_init(void)
  101. {
  102. /* Configure the LEDs (even if we have no LED support)*/
  103. s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_OUTP);
  104. s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
  105. s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_OUTP);
  106. s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_OUTP);
  107. s3c2410_gpio_setpin(S3C2410_GPF4, 1);
  108. s3c2410_gpio_setpin(S3C2410_GPF5, 1);
  109. s3c2410_gpio_setpin(S3C2410_GPF6, 1);
  110. s3c2410_gpio_setpin(S3C2410_GPF7, 1);
  111. s3c_device_nand.dev.platform_data = &smdk_nand_info;
  112. platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));
  113. s3c2410_pm_init();
  114. }