Chinaunix首页 | 论坛 | 博客
  • 博客访问: 97771
  • 博文数量: 38
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 384
  • 用 户 组: 普通用户
  • 注册时间: 2014-04-06 16:52
文章分类

全部博文(38)

文章存档

2014年(38)

我的朋友

分类: 嵌入式

2014-04-06 20:47:41

1.从开发板厂家提供的源码中找到s3c_nand.c,放到drivers/mtd/nand目录下,修改其Makefile,加入:obj-$(CONFIG_MTD_NAND_S3C)        += s3c_nand.o 
    把nand.h放到arch/arm/plat-samsung/include/plat/目录下

    修改Kconfig,加入

点击(此处)折叠或打开

  1. config MTD_NAND_S3C
  2.     tristate "NAND Flash support for S3C SoC"
  3.     depends on (ARCH_S3C64XX || ARCH_S5P64XX || ARCH_S5PC1XX) && MTD_NAND
  4.     help
  5.      This enables the NAND flash controller on the S3C.
  6.      No board specific support is done by this driver, each board
  7.      must advertise a platform_device for the driver to attach.

  8. config MTD_NAND_S3C_DEBUG
  9.     bool "S3C NAND driver debug"
  10.     depends on MTD_NAND_S3C
  11.     help
  12.      Enable debugging of the S3C NAND driver

  13. config MTD_NAND_S3C_HWECC
  14.     bool "S3C NAND Hardware ECC"
  15.     depends on MTD_NAND_S3C
  16.     help
  17.      Enable the use of the S3C

2.arch/arm/plat-samsung/include/plat/regs_nand.h的最后的#endif之前加入寄存器定义:

点击(此处)折叠或打开

  1. #if 1
  2. //zzq-> by 2013-3-16
  3. /* for s3c_nand.c */
  4. #define S3C_NFCONF S3C2410_NFREG(0x00)
  5. #define S3C_NFCONT S3C2410_NFREG(0x04)
  6. #define S3C_NFCMMD S3C2410_NFREG(0x08)
  7. #define S3C_NFADDR S3C2410_NFREG(0x0c)
  8. #define S3C_NFDATA8 S3C2410_NFREG(0x10)
  9. #define S3C_NFDATA S3C2410_NFREG(0x10)
  10. #define S3C_NFMECCDATA0 S3C2410_NFREG(0x14)
  11. #define S3C_NFMECCDATA1 S3C2410_NFREG(0x18)
  12. #define S3C_NFSECCDATA S3C2410_NFREG(0x1c)
  13. #define S3C_NFSBLK S3C2410_NFREG(0x20)
  14. #define S3C_NFEBLK S3C2410_NFREG(0x24)
  15. #define S3C_NFSTAT S3C2410_NFREG(0x28)
  16. #define S3C_NFMECCERR0 S3C2410_NFREG(0x2c)
  17. #define S3C_NFMECCERR1 S3C2410_NFREG(0x30)
  18. #define S3C_NFMECC0 S3C2410_NFREG(0x34)
  19. #define S3C_NFMECC1 S3C2410_NFREG(0x38)
  20. #define S3C_NFSECC S3C2410_NFREG(0x3c)
  21. #define S3C_NFMLCBITPT S3C2410_NFREG(0x40)
  22. #define S3C_NF8ECCERR0 S3C2410_NFREG(0x44)
  23. #define S3C_NF8ECCERR1 S3C2410_NFREG(0x48)
  24. #define S3C_NF8ECCERR2 S3C2410_NFREG(0x4c)
  25. #define S3C_NFM8ECC0 S3C2410_NFREG(0x50)
  26. #define S3C_NFM8ECC1 S3C2410_NFREG(0x54)
  27. #define S3C_NFM8ECC2 S3C2410_NFREG(0x58)
  28. #define S3C_NFM8ECC3 S3C2410_NFREG(0x5c)
  29. #define S3C_NFMLC8BITPT0 S3C2410_NFREG(0x60)
  30. #define S3C_NFMLC8BITPT1 S3C2410_NFREG(0x64)

  31. #define S3C_NFCONF_NANDBOOT (1<<31)
  32. #define S3C_NFCONF_ECCCLKCON (1<<30)
  33. #define S3C_NFCONF_ECC_MLC (1<<24)
  34. #define S3C_NFCONF_ECC_1BIT (0<<23)
  35. #define S3C_NFCONF_ECC_4BIT (2<<23)
  36. #define S3C_NFCONF_ECC_8BIT (1<<23)
  37. #define S3C_NFCONF_TACLS(x) ((x)<<12)
  38. #define S3C_NFCONF_TWRPH0(x) ((x)<<8)
  39. #define S3C_NFCONF_TWRPH1(x) ((x)<<4)
  40. #define S3C_NFCONF_ADVFLASH (1<<3)
  41. #define S3C_NFCONF_PAGESIZE (1<<2)
  42. #define S3C_NFCONF_ADDRCYCLE (1<<1)
  43. #define S3C_NFCONF_BUSWIDTH (1<<0)

  44. #define S3C_NFCONT_ECC_ENC (1<<18)
  45. #define S3C_NFCONT_LOCKTGHT (1<<17)
  46. #define S3C_NFCONT_LOCKSOFT (1<<16)
  47. #define S3C_NFCONT_8BITSTOP (1<<11)
  48. #define S3C_NFCONT_MECCLOCK (1<<7)
  49. #define S3C_NFCONT_SECCLOCK (1<<6)
  50. #define S3C_NFCONT_INITMECC (1<<5)
  51. #define S3C_NFCONT_INITSECC (1<<4)
  52. #define S3C_NFCONT_nFCE1 (1<<2)
  53. #define S3C_NFCONT_nFCE0 (1<<1)
  54. #define S3C_NFCONT_INITECC (S3C_NFCONT_INITSECC | S3C_NFCONT_INITMECC)

  55. #define S3C_NFSTAT_ECCENCDONE (1<<7)
  56. #define S3C_NFSTAT_ECCDECDONE (1<<6)
  57. #define S3C_NFSTAT_BUSY (1<<0)

  58. #define S3C_NFECCERR0_ECCBUSY (1<<31)

  59. //<-zzq
  60. #endif

3. 修改drivers/mtd/nand/nand_base.c文件,
    找到

点击(此处)折叠或打开

  1. if (!chip->ecc.strength) {
  2.                 pr_warn("Driver must set ecc.strength when using hardware ECC\n");
  3.                 BUG();
  4.             }
    把BUG();屏蔽掉


4.重新编译烧写后,结果如下

点击(此处)折叠或打开

  1. ## Booting kernel from Legacy Image at 50008000 ...

  2.    Image Name: Linux-3.8.3

  3.    Image Type: ARM Linux Kernel Image (uncompressed)

  4.    Data Size: 1665512 Bytes = 1.6 MiB

  5.    Load Address: 50008000

  6.    Entry Point: 50008040

  7.    Verifying Checksum ... OK

  8.    XIP Kernel Image ... OK

  9. OK


  10. Starting kernel ...


  11. Uncompressing Linux... done, booting the kernel.
  12. Booting Linux on physical CPU 0x0
  13. Linux version 3.8.3 (ymseven@ymseven) (gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67) ) #3 Sun Apr 6 20:40:22 CST 2014
  14. CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387d
  15. CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
  16. Machine: OK6410
  17. Memory policy: ECC disabled, Data cache writeback
  18. CPU S3C6410 (id 0x36410101)
  19. S3C24XX Clocks, Copyright 2004 Simtec Electronics
  20. S3C64XX: PLL settings, A=533000000, M=533000000, E=24000000
  21. S3C64XX: HCLK2=266500000, HCLK=133250000, PCLK=66625000
  22. mout_apll: source is fout_apll (1), rate is 533000000
  23. mout_epll: source is epll (1), rate is 24000000
  24. mout_mpll: source is mpll (1), rate is 533000000
  25. usb-bus-host: source is clk_48m (0), rate is 48000000
  26. irda-bus: source is mout_epll (0), rate is 24000000
  27. CPU: found DTCM0 8k @ 00000000, not enabled
  28. CPU: moved DTCM0 8k to fffe8000, enabled
  29. CPU: found DTCM1 8k @ 00000000, not enabled
  30. CPU: moved DTCM1 8k to fffea000, enabled
  31. CPU: found ITCM0 8k @ 00000000, not enabled
  32. CPU: moved ITCM0 8k to fffe0000, enabled
  33. CPU: found ITCM1 8k @ 00000000, not enabled
  34. CPU: moved ITCM1 8k to fffe2000, enabled
  35. Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
  36. Kernel command line: console=ttySAC,115200
  37. PID hash table entries: 1024 (order: 0, 4096 bytes)
  38. Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
  39. Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
  40. __ex_table already sorted, skipping sort
  41. Memory: 256MB = 256MB total
  42. Memory: 256524k/256524k available, 5620k reserved, 0K highmem
  43. Virtual kernel memory layout:
  44.     vector : 0xffff0000 - 0xffff1000 ( 4 kB)
  45.     DTCM : 0xfffe8000 - 0xfffec000 ( 16 kB)
  46.     ITCM : 0xfffe0000 - 0xfffe4000 ( 16 kB)
  47.     fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
  48.     vmalloc : 0xd0800000 - 0xff000000 ( 744 MB)
  49.     lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
  50.     modules : 0xbf000000 - 0xc0000000 ( 16 MB)
  51.       .text : 0xc0008000 - 0xc02bfdf4 (2784 kB)
  52.       .init : 0xc02c0000 - 0xc02db7e4 ( 110 kB)
  53.       .data : 0xc02dc000 - 0xc0309880 ( 183 kB)
  54.        .bss : 0xc030a000 - 0xc033af58 ( 196 kB)
  55. SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
  56. NR_IRQS:246
  57. VIC @f6000000: id 0x00041192, vendor 0x41
  58. VIC @f6010000: id 0x00041192, vendor 0x41
  59. sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
  60. Console: colour dummy device 80x30
  61. Calibrating delay loop... 353.89 BogoMIPS (lpj=1769472)
  62. pid_max: default: 32768 minimum: 301
  63. Mount-cache hash table entries: 512
  64. CPU: Testing write buffer coherency: ok
  65. Setting up static identity map for 0x50215860 - 0x502158bc
  66. DMA: preallocated 256 KiB pool for atomic coherent allocations
  67. OK6410: Option string ok6410=0
  68. OK6410: selected LCD display is 480x272
  69. s3c64xx_dma_init: Registering DMA channels
  70. PL080: IRQ 73, at d0846000, channels 0..8
  71. PL080: IRQ 74, at d0848000, channels 8..16
  72. S3C6410: Initialising architecture
  73. bio: create slab <bio-0> at 0
  74. usbcore: registered new interface driver usbfs
  75. usbcore: registered new interface driver hub
  76. usbcore: registered new device driver usb
  77. ROMFS MTD (C) 2007 Red Hat, Inc.
  78. io scheduler noop registered
  79. io scheduler deadline registered
  80. io scheduler cfq registered (default)
  81. s3c-fb s3c-fb: window 0: fb
  82. Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
  83. s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 69) is a S3C6400/10
  84. console [ttySAC0] enabled
  85. s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 70) is a S3C6400/10
  86. s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 71) is a S3C6400/10
  87. s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 72) is a S3C6400/10
  88. brd: module loaded
  89. loop: module loaded
  90. S3C NAND Driver, (c) 2008 Samsung Electronics
  91. S3C NAND Driver is using hardware ECC.
  92. NAND device: Manufacturer ID: 0x2c, Chip ID: 0x38 (Micron NAND 1GiB 1,8V 8-bit), 1024MiB, page size: 4096, OOB size: 128
  93. Driver must set ecc.strength when using hardware ECC
  94. Creating 4 MTD partitions on "NAND 1GiB 1,8V 8-bit":
  95. 0x000000000000-0x000000100000 : "Bootloader"
  96. 0x000000100000-0x000000600000 : "Kernel"
  97. 0x000000600000-0x00000ce00000 : "File System"
  98. 0x00000ce00000-0x000040000000 : "User"
  99. ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
  100. s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
  101. s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
  102. s3c2410-ohci s3c2410-ohci: irq 79, io mem 0x74300000
  103. s3c2410-ohci s3c2410-ohci: init err (00000000 0000)
  104. s3c2410-ohci s3c2410-ohci: cancan't start s3c24xx
    s3c2410-ohci s3c2410-ohci: startup error -75
    s3c2410-ohci s3c2410-ohci: USB bus 1 deregistered
    s3c2410-ohci: probe of s3c2410-ohci failed with error -75
    mousedev: PS/2 mouse device common for all mice
    i2c /dev entries driver
    sdhci: Secure Digital Host Controller Interface driver
    sdhci: Copyright(c) Pierre Ossman
    s3c-sdhci s3c-sdhci.0: clock source 0: mmc_busclk.0 (133250000 Hz)
    s3c-sdhci s3c-sdhci.0: clock source 2: mmc_busclk.2 (24000000 Hz)
    mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0] using ADMA
    s3c-sdhci s3c-sdhci.1: clock source 0: mmc_busclk.0 (133250000 Hz)
    s3c-sdhci s3c-sdhci.1: clock source 2: mmc_busclk.2 (24000000 Hz)
    mmc0: mmc_rescan_try_freq: trying to init card at 400000 Hz
    mmc0: mmc_rescan_try_freq: trying to init card at 300000 Hz
    mmc1: SDHCI controller on samsung-hsmmc [s3c-sdhci.1] using ADMA
    mmc0: mmc_rescan_try_freq: trying to init card at 200000 Hz
    usbcore: registered new interface driver usbhid
    usbhid: USB HID core driver
    VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
    drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
    VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
    Please append a correct "root=" boot option; here are the available partitions:
    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
    [] (unwind_backtrace+0x0/0xf4) from [] (panic+0x8c/0x1dc)
    [] (panic+0x8c/0x1dc) from [] (mount_block_root+0x218/0x2e0)
    [] (mount_block_root+0x218/0x2e0) from [] (prepare_namespace+0x160/0x1b8)
    [] (prepare_namespace+0x160/0x1b8) from [] (kernel_init+0x8/0xe4)
    [] (kernel_init+0x8/0xe4) from [] (ret_from_fork+0x14/0x3c)





阅读(2297) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~