📄 u-boot-lfc.patch
字号:
+ int i; unsigned int reg = 0; @@ -82,8 +84,12 @@ */ int serial_init (void) {- serial_setbrg ();+ + S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();//hema + serial_setbrg ();+// gpio->GPFDAT = (gpio->GPFDAT & ~(0xf<<4))|((~(0x4) & 0xf)<<4);+ return (0); } diff -ruN u-boot-20060523/cpu/arm920t/start.S u-boot/cpu/arm920t/start.S--- u-boot-20060523/cpu/arm920t/start.S 2006-09-25 17:04:03.000000000 +0800+++ u-boot/cpu/arm920t/start.S 2006-10-22 17:51:13.000000000 +0800@@ -140,10 +140,10 @@ ldr r0, =INTMSK str r1, [r0] # if defined(CONFIG_S3C2410)- ldr r1, =0x3ff+ ldr r1, =0x7ff ldr r0, =INTSUBMSK str r1, [r0]-# endif+# endif /*CONFIG_S3C2410*/ /* FCLK:HCLK:PCLK = 1:2:4 */ /* default FCLK is 120 MHz ! */@@ -220,6 +220,20 @@ /* END stuff after relocation */ #endif +#ifdef CONFIG_S3C2410_NAND_BOOT+ bl copy_myself+ + @ jump to ram+ ldr r1, =on_the_ram+ add pc, r1, #0+ nop+ nop+1: b 1b @ infinite loop+ +on_the_ram:+#endif+ + ldr pc, _start_armboot _start_armboot: .word start_armboot@@ -236,6 +250,111 @@ ************************************************************************* */ +#ifdef CONFIG_S3C2410_NAND_BOOT+copy_myself:+ mov r10, lr+@ reset NAND+ mov r1, #NAND_CTL_BASE+ ldr r2, =0xf830 @ initial value+ str r2, [r1, #oNFCONF]+ ldr r2, [r1, #oNFCONF]+ bic r2, r2, #0x800 @ enable chip+ str r2, [r1, #oNFCONF]+ mov r2, #0xff @ RESET command+ strb r2, [r1, #oNFCMD]+ mov r3, #0 @ wait++1: add r3, r3, #0x1+ cmp r3, #0xa+ blt 1b+2: ldr r2, [r1, #oNFSTAT] @ wait ready+ tst r2, #0x1+ beq 2b+ ldr r2, [r1, #oNFCONF]+ orr r2, r2, #0x800 @ disable chip+ str r2, [r1, #oNFCONF]++ @ get read to call C functions (for nand_read())+ ldr sp, DW_STACK_START @ setup stack pointer+ mov fp, #0 @ no previous frame, so fp=0++ @ copy vivi to RAM+ ldr r0, =UBOOT_RAM_BASE+ mov r1, #0x0 @address + mov r2, #0x30000 @size+ bl nand_read_ll++ tst r0, #0x0+ beq ok_nand_read++#ifdef CONFIG_DEBUG_LL+bad_nand_read:+ ldr r0, STR_FAIL+ ldr r1, SerBase+ bl PrintWord+1: b 1b @ infinite loop+#endif++ok_nand_read:+#ifdef CONFIG_DEBUG_LL+ ldr r0, STR_OK+ ldr r1, SerBase+ bl PrintWord+#endif++@ verify+ mov r0, #0+ ldr r1, =UBOOT_RAM_BASE+ mov r2, #0x400 @ 4 bytes * 1024 = 4K-bytes+go_next:+ ldr r3, [r0], #4+ ldr r4, [r1], #4+ teq r3, r4+ bne notmatch+ subs r2, r2, #4+ beq done_nand_read+ bne go_next++notmatch:+#ifdef CONFIG_DEBUG_LL+ sub r0, r0, #4+ ldr r1, SerBase+ bl PrintHexWord+ ldr r0, STR_FAIL+ ldr r1, SerBase+ bl PrintWord+#endif+1: b 1b++done_nand_read:+#ifdef CONFIG_DEBUG_LL+ ldr r0, STR_OK+ ldr r1, SerBase+ bl PrintWord+#endif+ mov pc, r10+++@ clear memory+@ r0: start address+@ r1: length+ mem_clear:+ mov r2, #0+ mov r3, r2+ mov r4, r2+ mov r5, r2+ mov r6, r2+ mov r7, r2+ mov r8, r2+ mov r9, r2+clear_loop:+ stmia r0!, {r2-r9}+ subs r1, r1, #(8 * 4)+ bne clear_loop+ mov pc, lr++#endif @ CONFIG_S3C2410_NAND_BOOT+ #ifndef CONFIG_SKIP_LOWLEVEL_INIT cpu_init_crit:@@ -278,6 +397,7 @@ @ @ IRQ stack frame. @+ #define S_FRAME_SIZE 72 #define S_OLD_R0 68@@ -300,8 +420,8 @@ #define S_R1 4 #define S_R0 0 -#define MODE_SVC 0x13-#define I_BIT 0x80+#define MODE_SVC 0x13+#define I_BIT 0x80 /* * use bad_save_user_regs for abort/prefetch/undef/swi ...@@ -432,3 +552,8 @@ bl do_fiq #endif+#ifdef CONFIG_S3C2410_NAND_BOOT+ .align 2+ DW_STACK_START:+ .word STACK_BASE+STACK_SIZE-4+#endif diff -ruN u-boot-20060523/drivers/nand/cvs/Entries u-boot/drivers/nand/cvs/Entries--- u-boot-20060523/drivers/nand/cvs/Entries 2006-09-25 17:04:05.000000000 +0800+++ u-boot/drivers/nand/cvs/Entries 1970-01-01 08:00:00.000000000 +0800@@ -1,8 +0,0 @@-/Makefile/1.1/Mon Mar 6 11:02:37 2006/-ko/D2006.05.22.16.00.00-/diskonchip.c/1.2/Wed Apr 12 10:30:57 2006/-ko/D2006.05.22.16.00.00-/nand.c/1.2/Wed Apr 12 10:30:57 2006/-ko/D2006.05.22.16.00.00-/nand_base.c/1.4/Wed Apr 12 10:30:57 2006/-ko/D2006.05.22.16.00.00-/nand_bbt.c/1.2/Wed Apr 12 10:30:58 2006/-ko/D2006.05.22.16.00.00-/nand_ecc.c/1.2/Wed Apr 12 10:30:58 2006/-ko/D2006.05.22.16.00.00-/nand_ids.c/1.2/Wed Apr 12 10:30:58 2006/-ko/D2006.05.22.16.00.00-Ddiff -ruN u-boot-20060523/drivers/nand/cvs/Repository u-boot/drivers/nand/cvs/Repository--- u-boot-20060523/drivers/nand/cvs/Repository 2006-09-25 17:04:05.000000000 +0800+++ u-boot/drivers/nand/cvs/Repository 1970-01-01 08:00:00.000000000 +0800@@ -1 +0,0 @@-u-boot/drivers/nanddiff -ruN u-boot-20060523/drivers/nand/cvs/Root u-boot/drivers/nand/cvs/Root--- u-boot-20060523/drivers/nand/cvs/Root 2006-09-25 17:04:05.000000000 +0800+++ u-boot/drivers/nand/cvs/Root 1970-01-01 08:00:00.000000000 +0800@@ -1 +0,0 @@-:pserver:anonymous@uboot.cvs.sourceforge.net:/cvsroot/u-bootdiff -ruN u-boot-20060523/drivers/nand/cvs/Tag u-boot/drivers/nand/cvs/Tag--- u-boot-20060523/drivers/nand/cvs/Tag 2006-09-25 17:04:05.000000000 +0800+++ u-boot/drivers/nand/cvs/Tag 1970-01-01 08:00:00.000000000 +0800@@ -1 +0,0 @@-D2006.05.22.16.00.00diff -ruN u-boot-20060523/drivers/nand/diskonchip.c u-boot/drivers/nand/diskonchip.c--- u-boot-20060523/drivers/nand/diskonchip.c 2006-09-25 17:04:05.000000000 +0800+++ u-boot/drivers/nand/diskonchip.c 1970-01-01 08:00:00.000000000 +0800@@ -1,1787 +0,0 @@-/*- * drivers/mtd/nand/diskonchip.c- *- * (C) 2003 Red Hat, Inc.- * (C) 2004 Dan Brown <dan_brown@ieee.org>- * (C) 2004 Kalev Lember <kalev@smartlink.ee>- *- * Author: David Woodhouse <dwmw2@infradead.org>- * Additional Diskonchip 2000 and Millennium support by Dan Brown <dan_brown@ieee.org>- * Diskonchip Millennium Plus support by Kalev Lember <kalev@smartlink.ee>- *- * Error correction code lifted from the old docecc code- * Author: Fabrice Bellard (fabrice.bellard@netgem.com)- * Copyright (C) 2000 Netgem S.A.- * converted to the generic Reed-Solomon library by Thomas Gleixner <tglx@linutronix.de>- *- * Interface to generic NAND code for M-Systems DiskOnChip devices- *- * $Id: diskonchip.c,v 1.45 2005/01/05 18:05:14 dwmw2 Exp $- */--#include <common.h>--#if !defined(CFG_NAND_LEGACY)--#include <linux/kernel.h>-#include <linux/init.h>-#include <linux/sched.h>-#include <linux/delay.h>-#include <linux/rslib.h>-#include <linux/moduleparam.h>-#include <asm/io.h>--#include <linux/mtd/mtd.h>-#include <linux/mtd/nand.h>-#include <linux/mtd/doc2000.h>-#include <linux/mtd/compatmac.h>-#include <linux/mtd/partitions.h>-#include <linux/mtd/inftl.h>--/* Where to look for the devices? */-#ifndef CONFIG_MTD_DISKONCHIP_PROBE_ADDRESS-#define CONFIG_MTD_DISKONCHIP_PROBE_ADDRESS 0-#endif--static unsigned long __initdata doc_locations[] = {-#if defined (__alpha__) || defined(__i386__) || defined(__x86_64__)-#ifdef CONFIG_MTD_DISKONCHIP_PROBE_HIGH- 0xfffc8000, 0xfffca000, 0xfffcc000, 0xfffce000,- 0xfffd0000, 0xfffd2000, 0xfffd4000, 0xfffd6000,- 0xfffd8000, 0xfffda000, 0xfffdc000, 0xfffde000,- 0xfffe0000, 0xfffe2000, 0xfffe4000, 0xfffe6000,- 0xfffe8000, 0xfffea000, 0xfffec000, 0xfffee000,-#else /* CONFIG_MTD_DOCPROBE_HIGH */- 0xc8000, 0xca000, 0xcc000, 0xce000,- 0xd0000, 0xd2000, 0xd4000, 0xd6000,- 0xd8000, 0xda000, 0xdc000, 0xde000,- 0xe0000, 0xe2000, 0xe4000, 0xe6000,- 0xe8000, 0xea000, 0xec000, 0xee000,-#endif /* CONFIG_MTD_DOCPROBE_HIGH */-#elif defined(__PPC__)- 0xe4000000,-#elif defined(CONFIG_MOMENCO_OCELOT)- 0x2f000000,- 0xff000000,-#elif defined(CONFIG_MOMENCO_OCELOT_G) || defined (CONFIG_MOMENCO_OCELOT_C)- 0xff000000,-##else-#warning Unknown architecture for DiskOnChip. No default probe locations defined-#endif- 0xffffffff };--static struct mtd_info *doclist = NULL;--struct doc_priv {- void __iomem *virtadr;- unsigned long physadr;- u_char ChipID;- u_char CDSNControl;- int chips_per_floor; /* The number of chips detected on each floor */- int curfloor;- int curchip;- int mh0_page;- int mh1_page;- struct mtd_info *nextdoc;-};--/* Max number of eraseblocks to scan (from start of device) for the (I)NFTL- MediaHeader. The spec says to just keep going, I think, but that's just- silly. */-#define MAX_MEDIAHEADER_SCAN 8--/* This is the syndrome computed by the HW ecc generator upon reading an empty- page, one with all 0xff for data and stored ecc code. */-static u_char empty_read_syndrome[6] = { 0x26, 0xff, 0x6d, 0x47, 0x73, 0x7a };-/* This is the ecc value computed by the HW ecc generator upon writing an empty- page, one with all 0xff for data. */-static u_char empty_write_ecc[6] = { 0x4b, 0x00, 0xe2, 0x0e, 0x93, 0xf7 };--#define INFTL_BBT_RESERVED_BLOCKS 4--#define DoC_is_MillenniumPlus(doc) ((doc)->ChipID == DOC_ChipID_DocMilPlus16 || (doc)->ChipID == DOC_ChipID_DocMilPlus32)-#define DoC_is_Millennium(doc) ((doc)->ChipID == DOC_ChipID_DocMil)-#define DoC_is_2000(doc) ((doc)->ChipID == DOC_ChipID_Doc2k)--static void doc200x_hwcontrol(struct mtd_info *mtd, int cmd);-static void doc200x_select_chip(struct mtd_info *mtd, int chip);--static int debug=0;-module_param(debug, int, 0);--static int try_dword=1;-module_param(try_dword, int, 0);--static int no_ecc_failures=0;-module_param(no_ecc_failures, int, 0);--#ifdef CONFIG_MTD_PARTITIONS-static int no_autopart=0;-module_param(no_autopart, int, 0);-#endif--#ifdef MTD_NAND_DISKONCHIP_BBTWRITE-static int inftl_bbt_write=1;-#else-static int inftl_bbt_write=0;-#endif-module_param(inftl_bbt_write, int, 0);--static unsigned long doc_config_location = CONFIG_MTD_DISKONCHIP_PROBE_ADDRESS;-module_param(doc_config_location, ulong, 0);-MODULE_PARM_DESC(doc_config_location, "Physical memory address at which to probe for DiskOnChip");---/* Sector size for HW ECC */-#define SECTOR_SIZE 512-/* The sector bytes are packed into NB_DATA 10 bit words */-#define NB_DATA (((SECTOR_SIZE + 1) * 8 + 6) / 10)-/* Number of roots */-#define NROOTS 4-/* First consective root */-#define FCR 510-/* Number of symbols */-#define NN 1023--/* the Reed Solomon control structure */-static struct rs_control *rs_decoder;--/*- * The HW decoder in the DoC ASIC's provides us a error syndrome,- * which we must convert to a standard syndrom usable by the generic- * Reed-Solomon library code.- *- * Fabrice Bellard figured this out in the old docecc code. I added- * some comments, improved a minor bit and converted it to make use- * of the generic Reed-Solomon libary. tglx- */-static int doc_ecc_decode (struct rs_control *rs, uint8_t *data, uint8_t *ecc)-{- int i, j, nerr, errpos[8];- uint8_t parity;- uint16_t ds[4], s[5], tmp, errval[8], syn[4];-- /* Convert the ecc bytes into words */- ds[0] = ((ecc[4] & 0xff) >> 0) | ((ecc[5] & 0x03) << 8);- ds[1] = ((ecc[5] & 0xfc) >> 2) | ((ecc[2] & 0x0f) << 6);- ds[2] = ((ecc[2] & 0xf0) >> 4) | ((ecc[3] & 0x3f) << 4);- ds[3] = ((ecc[3] & 0xc0) >> 6) | ((ecc[0] & 0xff) << 2);- parity = ecc[1];-- /* Initialize the syndrom buffer */- for (i = 0; i < NROOTS; i++)- s[i] = ds[0];- /*- * Evaluate- * s[i] = ds[3]x^3 + ds[2]x^2 + ds[1]x^1 + ds[0]- * where x = alpha^(FCR + i)- */- for(j = 1; j < NROOTS; j++) {- if(ds[j] == 0)- continue;- tmp = rs->index_of[ds[j]];- for(i = 0; i < NROOTS; i++)- s[i] ^= rs->alpha_to[rs_modnn(rs, tmp + (FCR + i) * j)];- }-- /* Calc s[i] = s[i] / alpha^(v + i) */- for (i = 0; i < NROOTS; i++) {- if (syn[i])- syn[i] = rs_modnn(rs, rs->index_of[s[i]] + (NN - FCR - i));- }- /* Call the decoder library */- nerr = decode_rs16(rs, NULL, NULL, 1019, syn, 0, errpos, 0, errval);-- /* Incorrectable errors ? */- if (nerr < 0)- return nerr;-- /*- * Correct the errors. The bitpositions are a bit of magic,- * but they are given by the design of the de/encoder circuit- * in the DoC ASIC's.- */- for(i = 0;i < nerr; i++) {- int index, bitpos, pos = 1015 - errpos[i];- uint8_t val;- if (pos >= NB_DATA && pos < 1019)- continue;- if (pos < NB_DATA) {- /* extract bit position (MSB first) */- pos = 10 * (NB_DATA - 1 - pos) - 6;- /* now correct the following 10 bits. At most two bytes- can be modified since pos is even */- index = (pos >> 3) ^ 1;- bitpos = pos & 7;- if ((index >= 0 && index < SECTOR_SIZE) ||- index == (SECTOR_SIZE + 1)) {- val = (uint8_t) (errval[i] >> (2 + bitpos));- parity ^= val;- if (index < SECTOR_SIZE)- data[index] ^= val;- }- index = ((pos >> 3) + 1) ^ 1;- bitpos = (bitpos + 10) & 7;- if (bitpos == 0)- bitpos = 8;- if ((index >= 0 && index < SECTOR_SIZE) ||- index == (SECTOR_SIZE + 1)) {- val = (uint8_t)(errval[i] << (8 - bitpos));- parity ^= val;- if (index < SECTOR_SIZE)- data[index] ^= val;- }- }- }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -