r1808 - trunk/src/target/u-boot/patches

laforge at sita.openmoko.org laforge at sita.openmoko.org
Thu Apr 19 18:09:24 CEST 2007


Author: laforge
Date: 2007-04-19 18:09:23 +0200 (Thu, 19 Apr 2007)
New Revision: 1808

Modified:
   trunk/src/target/u-boot/patches/uboot-s3c2440.patch
Log:
* add S3C2440 NAND driver support


Modified: trunk/src/target/u-boot/patches/uboot-s3c2440.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-s3c2440.patch	2007-04-19 15:47:07 UTC (rev 1807)
+++ trunk/src/target/u-boot/patches/uboot-s3c2440.patch	2007-04-19 16:09:23 UTC (rev 1808)
@@ -2,8 +2,8 @@
 
 Index: u-boot/include/s3c24x0.h
 ===================================================================
---- u-boot.orig/include/s3c24x0.h	2007-03-28 21:10:45.000000000 +0200
-+++ u-boot/include/s3c24x0.h	2007-03-28 21:10:49.000000000 +0200
+--- u-boot.orig/include/s3c24x0.h
++++ u-boot/include/s3c24x0.h
 @@ -82,7 +82,7 @@
  	S3C24X0_REG32	PRIORITY;
  	S3C24X0_REG32	INTPND;
@@ -149,8 +149,8 @@
  
 Index: u-boot/rtc/s3c24x0_rtc.c
 ===================================================================
---- u-boot.orig/rtc/s3c24x0_rtc.c	2007-03-28 21:10:45.000000000 +0200
-+++ u-boot/rtc/s3c24x0_rtc.c	2007-03-28 21:10:49.000000000 +0200
+--- u-boot.orig/rtc/s3c24x0_rtc.c
++++ u-boot/rtc/s3c24x0_rtc.c
 @@ -34,6 +34,8 @@
  #include <s3c2400.h>
  #elif defined(CONFIG_S3C2410)
@@ -162,8 +162,8 @@
  #include <rtc.h>
 Index: u-boot/include/s3c2440.h
 ===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/include/s3c2440.h	2007-03-29 18:46:17.000000000 +0200
+--- /dev/null
++++ u-boot/include/s3c2440.h
 @@ -0,0 +1,300 @@
 +/*
 + * (C) Copyright 2003
@@ -467,8 +467,8 @@
 +#endif /*__S3C2440_H__*/
 Index: u-boot/include/common.h
 ===================================================================
---- u-boot.orig/include/common.h	2007-03-28 21:10:45.000000000 +0200
-+++ u-boot/include/common.h	2007-03-28 21:10:49.000000000 +0200
+--- u-boot.orig/include/common.h
++++ u-boot/include/common.h
 @@ -452,7 +452,7 @@
  ulong	get_OPB_freq (void);
  ulong	get_PCI_freq (void);
@@ -480,8 +480,8 @@
  ulong	get_FCLK (void);
 Index: u-boot/cpu/arm920t/s3c24x0/usb_ohci.c
 ===================================================================
---- u-boot.orig/cpu/arm920t/s3c24x0/usb_ohci.c	2007-03-28 21:10:45.000000000 +0200
-+++ u-boot/cpu/arm920t/s3c24x0/usb_ohci.c	2007-03-28 21:10:49.000000000 +0200
+--- u-boot.orig/cpu/arm920t/s3c24x0/usb_ohci.c
++++ u-boot/cpu/arm920t/s3c24x0/usb_ohci.c
 @@ -44,6 +44,8 @@
  #include <s3c2400.h>
  #elif defined(CONFIG_S3C2410)
@@ -493,8 +493,8 @@
  #include <malloc.h>
 Index: u-boot/cpu/arm920t/s3c24x0/speed.c
 ===================================================================
---- u-boot.orig/cpu/arm920t/s3c24x0/speed.c	2007-03-28 21:10:45.000000000 +0200
-+++ u-boot/cpu/arm920t/s3c24x0/speed.c	2007-03-28 21:10:49.000000000 +0200
+--- u-boot.orig/cpu/arm920t/s3c24x0/speed.c
++++ u-boot/cpu/arm920t/s3c24x0/speed.c
 @@ -30,12 +30,15 @@
   */
  
@@ -557,8 +557,8 @@
 +          defined(CONFIG_S3C2440) || defined (CONFIG_TRAB) */
 Index: u-boot/cpu/arm920t/s3c24x0/interrupts.c
 ===================================================================
---- u-boot.orig/cpu/arm920t/s3c24x0/interrupts.c	2007-03-28 21:10:45.000000000 +0200
-+++ u-boot/cpu/arm920t/s3c24x0/interrupts.c	2007-03-28 21:10:49.000000000 +0200
+--- u-boot.orig/cpu/arm920t/s3c24x0/interrupts.c
++++ u-boot/cpu/arm920t/s3c24x0/interrupts.c
 @@ -30,13 +30,16 @@
   */
  
@@ -612,8 +612,8 @@
 +	  defined(CONFIG_S3C2440) || defined (CONFIG_TRAB) */
 Index: u-boot/cpu/arm920t/s3c24x0/serial.c
 ===================================================================
---- u-boot.orig/cpu/arm920t/s3c24x0/serial.c	2007-03-28 21:10:45.000000000 +0200
-+++ u-boot/cpu/arm920t/s3c24x0/serial.c	2007-03-28 21:10:49.000000000 +0200
+--- u-boot.orig/cpu/arm920t/s3c24x0/serial.c
++++ u-boot/cpu/arm920t/s3c24x0/serial.c
 @@ -19,12 +19,15 @@
   */
  
@@ -640,8 +640,8 @@
 +	  defined(CONFIG_S3C2440) || defined (CONFIG_TRAB) */
 Index: u-boot/cpu/arm920t/s3c24x0/i2c.c
 ===================================================================
---- u-boot.orig/cpu/arm920t/s3c24x0/i2c.c	2007-03-28 21:10:45.000000000 +0200
-+++ u-boot/cpu/arm920t/s3c24x0/i2c.c	2007-03-28 21:10:49.000000000 +0200
+--- u-boot.orig/cpu/arm920t/s3c24x0/i2c.c
++++ u-boot/cpu/arm920t/s3c24x0/i2c.c
 @@ -34,6 +34,8 @@
  #include <s3c2400.h>
  #elif defined(CONFIG_S3C2410)
@@ -698,8 +698,8 @@
  #ifdef CONFIG_S3C2400
 Index: u-boot/drivers/usbdcore_s3c2410.c
 ===================================================================
---- u-boot.orig/drivers/usbdcore_s3c2410.c	2007-03-28 21:10:45.000000000 +0200
-+++ u-boot/drivers/usbdcore_s3c2410.c	2007-03-28 21:10:49.000000000 +0200
+--- u-boot.orig/drivers/usbdcore_s3c2410.c
++++ u-boot/drivers/usbdcore_s3c2410.c
 @@ -24,7 +24,7 @@
  
  #include <config.h>
@@ -711,8 +711,8 @@
  
 Index: u-boot/drivers/usbtty.h
 ===================================================================
---- u-boot.orig/drivers/usbtty.h	2007-03-28 21:10:49.000000000 +0200
-+++ u-boot/drivers/usbtty.h	2007-03-28 21:10:49.000000000 +0200
+--- u-boot.orig/drivers/usbtty.h
++++ u-boot/drivers/usbtty.h
 @@ -29,7 +29,7 @@
  #include "usbdcore_mpc8xx.h"
  #elif defined(CONFIG_OMAP1510)
@@ -724,8 +724,8 @@
  
 Index: u-boot/cpu/arm920t/start.S
 ===================================================================
---- u-boot.orig/cpu/arm920t/start.S	2007-03-28 21:11:04.000000000 +0200
-+++ u-boot/cpu/arm920t/start.S	2007-03-29 20:28:29.000000000 +0200
+--- u-boot.orig/cpu/arm920t/start.S
++++ u-boot/cpu/arm920t/start.S
 @@ -31,7 +31,11 @@
  
  #include <config.h>
@@ -862,8 +862,8 @@
  	@ get ready to call C functions (for nand_read())
 Index: u-boot/cpu/arm920t/s3c24x0/nand_read.c
 ===================================================================
---- u-boot.orig/cpu/arm920t/s3c24x0/nand_read.c	2007-03-28 22:40:45.000000000 +0200
-+++ u-boot/cpu/arm920t/s3c24x0/nand_read.c	2007-03-29 21:40:30.000000000 +0200
+--- u-boot.orig/cpu/arm920t/s3c24x0/nand_read.c
++++ u-boot/cpu/arm920t/s3c24x0/nand_read.c
 @@ -16,30 +16,141 @@
   */
  
@@ -1070,3 +1070,153 @@
  
  	return 0;
  }
+Index: u-boot/cpu/arm920t/s3c24x0/nand.c
+===================================================================
+--- u-boot.orig/cpu/arm920t/s3c24x0/nand.c
++++ u-boot/cpu/arm920t/s3c24x0/nand.c
+@@ -36,24 +36,54 @@
+ #define __REGi(x)	(*(volatile unsigned int *)(x))
+ 
+ #define	NF_BASE		0x4e000000
++
+ #define	NFCONF		__REGi(NF_BASE + 0x0)
+-#define	NFCMD		__REGb(NF_BASE + 0x4)
+-#define	NFADDR		__REGb(NF_BASE + 0x8)
+-#define	NFDATA		__REGb(NF_BASE + 0xc)
+-#define	NFSTAT		__REGb(NF_BASE + 0x10)
++
++#if defined(CONFIG_S3C2410)
++
++#define oNFCMD		0x4
++#define	oNFADDR		0x8
++#define oNFDATA		0xc
++#define oNFSTAT		0x10
+ #define NFECC0		__REGb(NF_BASE + 0x14)
+ #define NFECC1		__REGb(NF_BASE + 0x15)
+ #define NFECC2		__REGb(NF_BASE + 0x16)
++#define NFCONF_nFCE	(1<<11)
+ 
+ #define S3C2410_NFCONF_EN          (1<<15)
+ #define S3C2410_NFCONF_512BYTE     (1<<14)
+ #define S3C2410_NFCONF_4STEP       (1<<13)
+ #define S3C2410_NFCONF_INITECC     (1<<12)
+-#define S3C2410_NFCONF_nFCE        (1<<11)
+ #define S3C2410_NFCONF_TACLS(x)    ((x)<<8)
+ #define S3C2410_NFCONF_TWRPH0(x)   ((x)<<4)
+ #define S3C2410_NFCONF_TWRPH1(x)   ((x)<<0)
+ 
++#elif defined(CONFIG_S3C2440)
++
++#define oNFCMD		0x8
++#define oNFADDR		0xc
++#define oNFDATA		0x10
++#define oNFSTAT		0x20
++
++#define	NFCONT		__REGi(NF_BASE + 0x04)
++#define	NFMECC0		__REGi(NF_BASE + 0x2C)
++#define NFCONF_nFCE	(1<<1)
++#define S3C2440_NFCONF_INITECC		(1<<4)
++#define S3C2440_NFCONF_MAINECCLOCK	(1<<5)
++#define nand_select()		(NFCONT &= ~(1 << 1))
++#define nand_deselect()		(NFCONT |= (1 << 1))
++#define nand_clear_RnB()	(NFSTAT |= (1 << 2))
++#define nand_detect_RB()	{ while(!(NFSTAT&(1<<2))); }
++#define nand_wait()		{ while(!(NFSTAT & 0x4)); } /* RnB_TransDectect */
++
++#endif
++
++#define	NFCMD		__REGb(NF_BASE + oNFCMD)
++#define	NFADDR		__REGb(NF_BASE + oNFADDR)
++#define	NFDATA		__REGb(NF_BASE + oNFDATA)
++#define	NFSTAT		__REGb(NF_BASE + oNFSTAT)
++
++
+ static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd)
+ {
+ 	struct nand_chip *chip = mtd->priv;
+@@ -62,23 +92,31 @@
+ 
+ 	switch (cmd) {
+ 	case NAND_CTL_SETNCE:
+-		NFCONF &= ~S3C2410_NFCONF_nFCE;
++#if defined(CONFIG_S3C2410)
++		NFCONF &= ~NFCONF_nFCE;
++#elif defined(CONFIG_S3C2440)
++		NFCONT &= ~NFCONF_nFCE;
++#endif
+ 		DEBUGN("NFCONF=0x%08x\n", NFCONF);
+ 		break;
+ 	case NAND_CTL_CLRNCE:
+-		NFCONF |= S3C2410_NFCONF_nFCE;
++#if defined(CONFIG_S3C2410)
++		NFCONF |= NFCONF_nFCE;
++#elif defined(CONFIG_S3C2440)
++		NFCONT &= ~NFCONF_nFCE;
++#endif
+ 		DEBUGN("NFCONF=0x%08x\n", NFCONF);
+ 		break;
+ 	case NAND_CTL_SETALE:
+-		chip->IO_ADDR_W = NF_BASE + 0x8;
++		chip->IO_ADDR_W = NF_BASE + oNFADDR;
+ 		DEBUGN("SETALE\n");
+ 		break;
+ 	case NAND_CTL_SETCLE:
+-		chip->IO_ADDR_W = NF_BASE + 0x4;
++		chip->IO_ADDR_W = NF_BASE + oNFCMD;
+ 		DEBUGN("SETCLE\n");
+ 		break;
+ 	default:
+-		chip->IO_ADDR_W = NF_BASE + 0xc;
++		chip->IO_ADDR_W = NF_BASE + oNFDATA;
+ 		break;
+ 	}
+ 	return;
+@@ -180,16 +218,21 @@
+ 	/* initialize hardware */
+ 	twrph0 = 3; twrph1 = 0; tacls = 0;
+ 
++#if defined(CONFIG_S3C2410)
+ 	cfg = S3C2410_NFCONF_EN;
+ 	cfg |= S3C2410_NFCONF_TACLS(tacls - 1);
+ 	cfg |= S3C2410_NFCONF_TWRPH0(twrph0 - 1);
+ 	cfg |= S3C2410_NFCONF_TWRPH1(twrph1 - 1);
+ 
+ 	NFCONF = cfg;
+-	//NFCONF = 0xf842;
++#elif defined(CONFIG_S3C2440)
++	twrph0 = 7; twrph1 = 7; tacls = 7;
++	NFCONF = (tacls<<12)|(twrph0<<8)|(twrph1<<4)|(0<<0);
++	NFCONT = (0<<13)|(0<<12)|(0<<10)|(0<<9)|(0<<8)|(1<<6)|(1<<5)|(1<<4)|(1<<1)|(1<<0);
++#endif
+ 
+ 	/* initialize nand_chip data structure */
+-	nand->IO_ADDR_R = nand->IO_ADDR_W = 0x4e00000c;
++	nand->IO_ADDR_R = nand->IO_ADDR_W = NF_BASE + oNFDATA;
+ 
+ 	/* read_buf and write_buf are default */
+ 	/* read_byte and write_byte are default */
+@@ -214,12 +257,23 @@
+ 	nand->options = 0;
+ #endif
+ 
++#if defined(CONFIG_S3C2440)
++/*
++	nand_select();
++	nand_clear_RnB();
++	NFCMD = NAND_CMD_RESET;
++	{ volatile int i; for (i = 0; i < 10; i ++); }
++	nand_detect_RB();
++	nand_deselect();
++*/
++#endif
++
+ 	DEBUGN("end of nand_init\n");
+ 
+ 	return 0;
+ }
+ 
+ #else
+- #error "U-Boot legacy NAND support not available for S3C2410"
++ #error "U-Boot legacy NAND support not available for S3C24xx"
+ #endif
+ #endif





More information about the commitlog mailing list