aesop-embedded-devel Mailing List for aesop-embedded
Status: Beta
Brought to you by:
linuxpark
You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: linux4go <lin...@li...> - 2005-07-07 15:54:44
|
linux4go 2005/07/07 08:54:32
Modified: common cmd_fat.c
Log:
Revision Changes Path
1.2 +2 -1 u-boot-aesop/common/cmd_fat.c
Index: cmd_fat.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/common/cmd_fat.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cmd_fat.c 27 Jun 2005 17:05:24 -0000 1.1
+++ cmd_fat.c 7 Jul 2005 15:54:31 -0000 1.2
@@ -110,6 +110,7 @@
count = simple_strtoul (argv[5], NULL, 16);
else
count = 0;
+
size = file_fat_read (argv[4], (unsigned char *) offset, count);
if(size==-1) {
@@ -117,7 +118,7 @@
return 1;
}
- printf ("\n%ld bytes read\n", size);
+ printf ("%ld bytes read\n\n", size);
sprintf(buf, "%lX", size);
setenv("filesize", buf);
|
|
From: linux4go <lin...@li...> - 2005-07-07 15:50:16
|
linux4go 2005/07/07 08:50:09
Modified: include/configs aesop2440.h
Log:
Revision Changes Path
1.3 +7 -1 u-boot-aesop/include/configs/aesop2440.h
Index: aesop2440.h
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/include/configs/aesop2440.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- aesop2440.h 5 Jul 2005 14:16:44 -0000 1.2
+++ aesop2440.h 7 Jul 2005 15:50:08 -0000 1.3
@@ -106,6 +106,11 @@
#define CONFIG_BAUDRATE 115200
+
+#define CONFIG_MMC 1
+#define CONFIG_DOS_PARTITION 1
+#define CONFIG_SUPPORT_VFAT 1
+
/***********************************************************
* Command definition
***********************************************************/
@@ -117,7 +122,8 @@
/*CFG_CMD_I2C |*/ \
/*CFG_CMD_USB |*/ \
CFG_CMD_FAT | \
- /*CFG_CMD_MMC |*/ \
+ CFG_CMD_SD | \
+ CFG_CMD_MMC | \
CFG_CMD_REGINFO | \
CFG_CMD_DATE | \
CFG_CMD_BSP | \
|
|
From: linux4go <lin...@li...> - 2005-07-07 15:49:35
|
linux4go 2005/07/07 08:49:27
Modified: fs/fat fat.c file.c
Log:
Revision Changes Path
1.2 +21 -6 u-boot-aesop/fs/fat/fat.c
Index: fat.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/fs/fat/fat.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- fat.c 27 Jun 2005 17:03:38 -0000 1.1
+++ fat.c 7 Jul 2005 15:49:27 -0000 1.2
@@ -33,6 +33,8 @@
#if (CONFIG_COMMANDS & CFG_CMD_FAT)
+//#define FAT_DPRINT printf
+
/*
* Convert a string to lowercase.
*/
@@ -59,6 +61,7 @@
if (cur_dev == NULL)
return -1;
if (cur_dev->block_read) {
+ FAT_DPRINT("startblock: %d, getsize: %d, offset: %d\n", startblock, getsize,part_offset);
return cur_dev->block_read (cur_dev->dev, startblock, getsize, (unsigned long *)bufptr);
}
return -1;
@@ -90,7 +93,7 @@
}
else {
#if (CONFIG_COMMANDS & CFG_CMD_IDE) || (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
- (CONFIG_COMMANDS & CFG_CMD_USB) || defined(CONFIG_SYSTEMACE)
+ (CONFIG_COMMANDS & CFG_CMD_USB) || (CONFIG_COMMANDS & CFG_CMD_MMC) ||defined(CONFIG_SYSTEMACE)
disk_partition_t info;
if(!get_partition_info(dev_desc, part_no, &info)) {
part_offset = info.start;
@@ -221,10 +224,12 @@
startblock += mydata->fat_sect; /* Offset from start of disk */
if (getsize > fatlength) getsize = fatlength;
+ //FAT_DPRINT("Before die\n");
if (disk_read(startblock, getsize, bufptr) < 0) {
FAT_DPRINT("Error reading FAT blocks\n");
return ret;
}
+ //FAT_DPRINT("After die\n");
mydata->fatbufnum = bufnum;
}
@@ -291,20 +296,23 @@
startsect = mydata->rootdir_sect;
}
- FAT_DPRINT("gc - clustnum: %d, startsect: %d\n", clustnum, startsect);
+ FAT_DPRINT("gc - clustnum: %d, startsect: %d, size: %d\n", clustnum, startsect, size);
+
if (disk_read(startsect, size/FS_BLOCK_SIZE , buffer) < 0) {
FAT_DPRINT("Error reading data\n");
return -1;
}
+
if(size % FS_BLOCK_SIZE) {
__u8 tmpbuf[FS_BLOCK_SIZE];
idx= size/FS_BLOCK_SIZE;
+ //FAT_DPRINT("Just before Disk reading!!");
if (disk_read(startsect + idx, 1, tmpbuf) < 0) {
FAT_DPRINT("Error reading data\n");
return -1;
}
buffer += idx*FS_BLOCK_SIZE;
-
+ //FAT_DPRINT("Just after Disk reading!!");
memcpy(buffer, tmpbuf, size % FS_BLOCK_SIZE);
return 0;
}
@@ -335,6 +343,7 @@
FAT_DPRINT("Reading: %ld bytes\n", filesize);
actsize=bytesperclust;
+ //FAT_DPRINT("bytesperclust = %d\n",bytesperclust);
endclust=curclust;
do {
/* search for consecutive clusters */
@@ -353,10 +362,13 @@
/* actsize >= file size */
actsize -= bytesperclust;
/* get remaining clusters */
+ if(actsize)
+ {
if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
FAT_ERROR("Error reading cluster\n");
return -1;
}
+ }
/* get remaining bytes */
gotsize += (int)actsize;
filesize -= actsize;
@@ -968,8 +980,11 @@
printf("No current device\n");
return 1;
}
-#if (CONFIG_COMMANDS & CFG_CMD_IDE) || (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
- (CONFIG_COMMANDS & CFG_CMD_USB) || (CONFIG_MMC)
+#if ( (CONFIG_COMMANDS & CFG_CMD_IDE) || \
+ (CONFIG_COMMANDS & CFG_CMD_SCSI)|| \
+ (CONFIG_COMMANDS & CFG_CMD_USB) || \
+ (CONFIG_COMMANDS & CFG_CMD_MMC) || \
+ (CONFIG_COMMANDS & CONFIG_MMC) )
printf("Interface: ");
switch(cur_dev->if_type) {
case IF_TYPE_IDE : printf("IDE"); break;
@@ -1005,7 +1020,7 @@
long
file_fat_read(const char *filename, void *buffer, unsigned long maxsize)
{
- printf("reading %s\n",filename);
+ FAT_DPRINT("reading %s\n",filename);
return do_fat_read(filename, buffer, maxsize, LS_NO);
}
1.2 +2 -0 u-boot-aesop/fs/fat/file.c
Index: file.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/fs/fat/file.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- file.c 27 Jun 2005 17:03:38 -0000 1.1
+++ file.c 7 Jul 2005 15:49:27 -0000 1.2
@@ -195,6 +195,8 @@
return -1;
}
+ //printf("File read entry!\n");
+
if (ISDIRDELIM(*filename)) {
arg = filename;
} else {
|
|
From: linux4go <lin...@li...> - 2005-07-07 15:48:26
|
linux4go 2005/07/07 08:48:20
Modified: disk part.c part_dos.c
Log:
Revision Changes Path
1.2 +8 -1 u-boot-aesop/disk/part.c
Index: part.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/disk/part.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- part.c 27 Jun 2005 17:03:51 -0000 1.1
+++ part.c 7 Jul 2005 15:48:19 -0000 1.2
@@ -25,7 +25,7 @@
#include <command.h>
#include <ide.h>
-#define CONFIG_DOS_PARTITION
+#define CONFIG_DOS_PARTITION 1
#undef PART_DEBUG
@@ -38,6 +38,7 @@
#if ((CONFIG_COMMANDS & CFG_CMD_IDE) || \
(CONFIG_COMMANDS & CFG_CMD_SCSI) || \
(CONFIG_COMMANDS & CFG_CMD_USB) || \
+ (CONFIG_COMMANDS & CFG_CMD_MMC) || \
(CONFIG_MMC) || (CONFIG_SYSTEMACE) )
/* ------------------------------------------------------------------------- */
@@ -127,6 +128,7 @@
#if ((CONFIG_COMMANDS & CFG_CMD_IDE) || \
(CONFIG_COMMANDS & CFG_CMD_SCSI) || \
(CONFIG_COMMANDS & CFG_CMD_USB) || \
+ (CONFIG_COMMANDS & CFG_CMD_MMC) || \
defined(CONFIG_SYSTEMACE) )
#if defined(CONFIG_MAC_PARTITION) || \
@@ -136,6 +138,7 @@
void init_part (block_dev_desc_t * dev_desc)
{
+ printf("Init Part!!\n");
#ifdef CONFIG_ISO_PARTITION
if (test_part_iso(dev_desc) == 0) {
dev_desc->part_type = PART_TYPE_ISO;
@@ -152,6 +155,7 @@
#ifdef CONFIG_DOS_PARTITION
if (test_part_dos(dev_desc) == 0) {
+ printf("I need DOS partition!");
dev_desc->part_type = PART_TYPE_DOS;
return;
}
@@ -180,6 +184,7 @@
#ifdef CONFIG_DOS_PARTITION
case PART_TYPE_DOS:
+ //printf("Part Type is DOS?\n");
if (get_partition_info_dos(dev_desc,part,info) == 0) {
PRINTF ("## Valid DOS partition found ##\n");
return (0);
@@ -225,6 +230,8 @@
break;
case IF_TYPE_DOC: puts ("DOC");
break;
+ case IF_TYPE_MMC: puts ("MMC");
+ break;
default: puts ("UNKNOWN");
break;
}
1.2 +2 -1 u-boot-aesop/disk/part_dos.c
Index: part_dos.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/disk/part_dos.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- part_dos.c 27 Jun 2005 17:03:50 -0000 1.1
+++ part_dos.c 7 Jul 2005 15:48:20 -0000 1.2
@@ -38,6 +38,7 @@
#if ((CONFIG_COMMANDS & CFG_CMD_IDE) || \
(CONFIG_COMMANDS & CFG_CMD_SCSI) || \
(CONFIG_COMMANDS & CFG_CMD_USB) || \
+ (CONFIG_COMMANDS & CFG_CMD_MMC) || \
(CONFIG_SYSTEMACE)) && defined(CONFIG_DOS_PARTITION)
/* Convert char[4] in little endian format to the host format integer
@@ -83,7 +84,7 @@
int test_part_dos (block_dev_desc_t *dev_desc)
{
unsigned char buffer[DEFAULT_SECTOR_SIZE];
-
+// printf("I must be hrer!!\n");
if ((dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *) buffer) != 1) ||
(buffer[DOS_PART_MAGIC_OFFSET + 0] != 0x55) ||
(buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) ) {
|
|
From: linux4go <lin...@li...> - 2005-07-07 15:47:07
|
linux4go 2005/07/07 08:47:01
Modified: board/aesop2440 aesop2440.c config.mk sd.c
Added: board/aesop2440 README.txt
Log:
Revision Changes Path
1.3 +12 -9 u-boot-aesop/board/aesop2440/aesop2440.c
Index: aesop2440.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/aesop2440.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- aesop2440.c 5 Jul 2005 14:16:41 -0000 1.2
+++ aesop2440.c 7 Jul 2005 15:46:59 -0000 1.3
@@ -27,8 +27,11 @@
* Created date : 2005. 06. 26. 22:56:57 KST
* Description :
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
* $Log: aesop2440.c,v $
+ * Revision 1.3 2005/07/07 15:46:59 linux4go
+ * *** empty log message ***
+ *
* Revision 1.2 2005/07/05 14:16:41 jeenspa
* usbdmass fixup, nand, mkyaffs
*
@@ -38,7 +41,7 @@
*
*
*/
-#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/aesop2440.c,v 1.2 2005/07/05 14:16:41 jeenspa Exp $"
+#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/aesop2440.c,v 1.3 2005/07/07 15:46:59 linux4go Exp $"
#include <common.h>
#include <s3c2440.h>
@@ -107,6 +110,7 @@
int usbdmass(char *);
int do_bmpload_sub(unsigned char *, int, int, int);
+extern unsigned int SD_card_init(void);
/* ------------------------------------------------------------------------- */
void init_lcd(void)
{
@@ -259,10 +263,10 @@
return 0;
}
-#if 0
+#if 1
unsigned char scratch[4096]; // buffer for SD read/write
unsigned int scratch1[4096]; // buffer for SD read/write
-void SD_FS(void) // Check Partition table
+int SD_FS(void) // Check Partition table
{
int MBR_exist;
int i;
@@ -282,12 +286,12 @@
if(MBR_exist) printf("(with MBR)\n\n");
else printf("(without MBR)\n\n");
-
- for (i = 0; i < 512; i++) {
+#if 0
+ for (i = 0; i < 512; i++) {
if (!(i % 16)) printf("\n%04x : ", i);
printf("%02x ", scratch[i]);
}
-#if 0
+
for(i=0;i<1024;i++) scratch1[i]=i;
SD_Write((unsigned char *)scratch1, 300000 , 8);
@@ -305,14 +309,13 @@
{
init_lcd();
-#if 0
if(!SD_card_init())
return 0; // No SD/MMC found !!
else
{
SD_FS(); // Check Master boot record !!
}
-#endif
+
return 1;
}
1.3 +8 -3 u-boot-aesop/board/aesop2440/config.mk
Index: config.mk
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/config.mk,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- config.mk 5 Jul 2005 14:16:41 -0000 1.2
+++ config.mk 7 Jul 2005 15:46:59 -0000 1.3
@@ -28,8 +28,11 @@
# Created date : 2005. 06. 26. 22:59:04 KST
# Description :
#
-# $Revision: 1.2 $
+# $Revision: 1.3 $
# $Log: config.mk,v $
+# Revision 1.3 2005/07/07 15:46:59 linux4go
+# *** empty log message ***
+#
# Revision 1.2 2005/07/05 14:16:41 jeenspa
# usbdmass fixup, nand, mkyaffs
#
@@ -39,7 +42,7 @@
#
#
#
-#ident "@(#) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/config.mk,v 1.2 2005/07/05 14:16:41 jeenspa Exp $"
+#ident "@(#) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/config.mk,v 1.3 2005/07/07 15:46:59 linux4go Exp $"
#
@@ -71,6 +74,8 @@
# LCD framebuffer address: 0x33000000(48M offset)
# ramdisk optionally with a ramdisk at 3080'0000
# parameter tag: 0x30000100
+# For ROM writing
TEXT_BASE = 0x33C00000
-
+# For debugging
+# TEXT_BASE = 0x33800000
1.2 +123 -9 u-boot-aesop/board/aesop2440/sd.c
Index: sd.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/sd.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sd.c 27 Jun 2005 17:03:53 -0000 1.1
+++ sd.c 7 Jul 2005 15:46:59 -0000 1.2
@@ -27,15 +27,18 @@
* Created date : 2005. 06. 26. 23:05:59 KST
* Description :
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
* $Log: sd.c,v $
- * Revision 1.1 2005/06/27 17:03:53 linuxpark
- * Initial revision
+ * Revision 1.2 2005/07/07 15:46:59 linux4go
+ * *** empty log message ***
+ *
+ * Revision 1.1.1.1 2005/06/27 17:03:53 linuxpark
+ * Initial import.
*
*
*
*/
-#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/sd.c,v 1.1 2005/06/27 17:03:53 linuxpark Exp $"
+#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/sd.c,v 1.2 2005/07/07 15:46:59 linux4go Exp $"
/*
@@ -63,9 +66,23 @@
#include <common.h>
#include <s3c2440.h>
-
+#include <part.h>
#if 1
+
+
+extern int
+fat_register_device(block_dev_desc_t *dev_desc, int part_no);
+
+static block_dev_desc_t mmc_dev;
+
+block_dev_desc_t * mmc_get_dev(int dev)
+{
+ return ((block_dev_desc_t *)&mmc_dev);
+}
+
+
+//#if 1
int isMMC; // 1:MMC, 0:SD
int RCA=0; // Relative card address
@@ -129,8 +146,10 @@
{
finish0=sdi->SDICSTA;
while((finish0&0x800) != 0x800) // Check cmd end
+ {
finish0=sdi->SDICSTA;
+ }
sdi->SDICSTA=finish0;// Clear cmd end state
return 1;
@@ -235,13 +254,14 @@
return 1;
}
+CSD_regs csd;
int CMD9(void)//SEND_CSD
{
S3C2410_SDI * const sdi = S3C2410_GetBase_SDI();
unsigned char buff[16];
// unsigned long card_size;
- CSD_regs csd;
+
sdi->SDICARG=RCA<<16; // CMD9(RCA,stuff bit)
sdi->SDICCON=(0x1<<10)|(0x1<<9)|(0x1<<8)|0x49; // long_resp, wait_resp, start, CMD9
@@ -411,11 +431,63 @@
}
}
+void SD_Read(unsigned char * pucdata, unsigned long ulLBA, unsigned long ulSectors);
+void SD_Write(unsigned char * pucdata, unsigned long ulLBA, unsigned long ulSectors);
+unsigned int SD_card_init(void);
+
+ulong mmc_bread(int dev_num, ulong blknr, ulong blkcnt, ulong *dst)
+{
+// int mmc_block_size = MMC_BLOCK_SIZE;
+// ulong src = blknr * mmc_block_size + CFG_MMC_BASE;
+
+ if(blkcnt==0)
+ {
+ printf("Why block_cnt == 0?? \n");
+ return 0;
+ }
+// mmc_read(src, (uchar *)dst, blkcnt*mmc_block_size);
+// printf("mmc_bread LBA=%d, Count=%d\n",blknr,blkcnt);
+ SD_Read((uchar *)dst, blknr, blkcnt);
+// printf("mmc_bread end\n");
+ return blkcnt;
+}
+
+int mmc_write(uchar *src, ulong dst, int size)
+{
+ printf("\nmmc_write should not be called !!!!\n");
+ //SD_Write(
+}
+
+
+int mmc_read(ulong src, uchar *dst, int size)
+{
+ printf("\nmmc_read should not be called !!!!\n");
+ //SD_Write(
+}
#define INICLK 400000
#define SDCLK 25000000
#define MMCCLK 15000000
+int mmc_init_once = 0;
+
+int mmc_init(int verbose)
+{
+ SD_card_init();
+ return 0;
+}
+
+#define CFG_MMC_BASE 0
+int mmc2info(ulong addr)
+{
+ /* FIXME hard codes to 32 MB device */
+ if (addr >= CFG_MMC_BASE && addr < CFG_MMC_BASE + (CardSize/512))
+ {
+ return 1;
+ }
+ return 0;
+}
+
unsigned int SD_card_init(void)
{
@@ -423,6 +495,10 @@
unsigned long pclk;
S3C2410_SDI * const sdi = S3C2410_GetBase_SDI();
+ if(mmc_init_once==1) return 1;// already done !!
+
+
+
pclk = get_PCLK();
//printf("\nSystem Frequency is %dHz\n",pclk);
@@ -492,6 +568,7 @@
RCA=( sdi->SDIRSP0 & 0xffff0000 )>>16;
//printf("RCA=0x%x\n",RCA);
sdi->SDIPRE=pclk/(SDCLK); // Salamander pclk=66Mhz, prescaler = 2, SD_CLK = 22Mhz
+ //sdi->SDIPRE=3; // test 16Mhz
//printf("SD Frequency is %dMHz\n",(pclk/(sdi->SDIPRE+1))/1000000);
}
//--State(stand-by) check
@@ -520,18 +597,54 @@
Card_sel_desel(1); // Select
- return CardSize;
+ {
+ /* fill in device description */
+ mmc_dev.if_type = IF_TYPE_MMC;
+ mmc_dev.dev = 0;
+ mmc_dev.lun = 0;
+ mmc_dev.type = 0;
+ /* FIXME fill in the correct size (is set to 32MByte) */
+ mmc_dev.blksz = 512;
+ //mmc_dev.lba = 0x10000;
+ mmc_dev.lba = CardSize / 512;
+ mmc_dev.part_type = PART_TYPE_DOS;
+ /*
+ sprintf(mmc_dev.vendor,"Man %02x%02x%02x Snr %02x%02x%02x",
+ cid->id[0], cid->id[1], cid->id[2],
+ cid->sn[0], cid->sn[1], cid->sn[2]);
+ sprintf(mmc_dev.product,"%s",cid->name);
+ sprintf(mmc_dev.revision,"%x %x",cid->hwrev, cid->fwrev);
+ */
+
+ sprintf(mmc_dev.vendor,"Man aESOP1 Snr 123456");
+ sprintf(mmc_dev.product,"%s","SDxxxMB");
+ sprintf(mmc_dev.revision,"%x %x",0x123,0x456);
+
+ mmc_dev.removable = 0;
+ mmc_dev.block_read = mmc_bread;
+
+ fat_register_device(&mmc_dev,1); /* partitions start counting with 1 */
+
+ }
+ mmc_init_once = 1;
+ return 1;
}
+
+unsigned int *Rx_buffer1; //128[word]*16[blk]=8192[byte]
void SD_Read(unsigned char * pucdata, unsigned long ulLBA, unsigned long ulSectors)
{
S3C2410_SDI * const sdi = S3C2410_GetBase_SDI();
- int status, state, rd_cnt;
+ int status, state, rd_cnt, total_word;
+
+ //unsigned int *Rx_buffer1; //128[word]*16[blk]=8192[byte]
- unsigned int *Rx_buffer1; //128[word]*16[blk]=8192[byte]
+// unsigned int *Rx_buffer1; //128[word]*16[blk]=8192[byte]
Rx_buffer1 = (unsigned int *)(pucdata);
+// printf("Rx_buffer1 = 0x%x\n",Rx_buffer1);
+
rd_cnt=0;
sdi->SDIFSTA = sdi->SDIFSTA|(1<<16); // FIFO reset
@@ -559,7 +672,8 @@
sdi->SDICSTA = state; // Clear cmd_end(with rsp)
//printf("\n Read CMD end\n");
- while(rd_cnt < (128*ulSectors)) // 512*block bytes
+ total_word = 128*ulSectors;
+ while(rd_cnt < total_word) // 512*block bytes
{
state = sdi->SDIDSTA;
if((state&0x20)==0x20) // Check timeout
1.1 u-boot-aesop/board/aesop2440/README.txt
Index: README.txt
===================================================================
======================================================================
Changes for U-Boot 1.1.2 for aESOP-2440
======================================================================
* Add SD-card initialize/read/write by Salamander, 19 Jun 2005
- Fix SDIDAT register bug (8bit -> 32bit) in /include/s3c24x0.h
- Add sd.c & sd.h in /board/aesop2440
- Modify aesop2440.c to show SDcard status
* USB mass storage class interface to SD-card by jeenspa(6-July-2005)
* Linux booting from NAND flash file system(yaffs) by jeenspa(6-July-2005).
* DOS-FAT file I/O for SD-card by Salamander(8-July-2005)
======================================================================
To Do list
======================================================================
* LCD_printf() function implementaion for SD-file list show.
* Key input function for file select and execute.
* Unicode display for VFAT file name.
* Linux booting from SD file system.
======================================================================
Tips
======================================================================
* Temporary modification of config.mk should be applied for debugging.
- If TEXT_BASE is 0x33C00000 in NOR-flash U-boot, change it to 0x33800000.
- With this temporary change, you can download u-boot via TFTP for development.
* How to change spalsh logo
- prepare a 480x272 24bpp bmp file(true color bitmap file without palette)
- convert bmp to simple C header file (ex. xxd -i logo01.bmp > aesop-logo-02.h)
- compile and enjoy your own splash screen.
|
|
From: linux4go <lin...@li...> - 2005-07-07 12:56:20
|
linux4go 2005/07/07 05:56:10 Log: Status: Vendor Tag: tcvs-vendor Release Tags: tcvs-release No conflicts created by this import |
|
From: jeenspa <je...@li...> - 2005-07-05 14:16:54
|
jeenspa 2005/07/05 07:16:45
Modified: include/configs aesop2440.h
Log:
usbdmass fixup, nand, mkyaffs
Revision Changes Path
1.2 +48 -7 u-boot-aesop/include/configs/aesop2440.h
Index: aesop2440.h
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/include/configs/aesop2440.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- aesop2440.h 27 Jun 2005 17:05:53 -0000 1.1
+++ aesop2440.h 5 Jul 2005 14:16:44 -0000 1.2
@@ -36,7 +36,7 @@
* so we MUST NOT initialize critical regs like mem-timing ...
*/
//#define CONFIG_INIT_CRITICAL /* undef for developing */
-#undef CONFIG_INIT_CRITICAL
+#define CONFIG_INIT_CRITICAL
/*
* High Level Configuration Options
* (easy to change)
@@ -46,8 +46,11 @@
#define CONFIG_AESOP2440 1 /* on a Kernelproject aESOP2440 Board */
/* input clock of PLL */
+#if 1
#define CONFIG_SYS_CLK_FREQ 16934400/* the SMDK2410 has 12MHz input clock */
-
+#else
+#define CONFIG_SYS_CLK_FREQ 12000000/* the SMDK2410 has 12MHz input clock */
+#endif
#define USE_920T_MMU 1
#undef CONFIG_USE_IRQ /* we don't need IRQ/FIQ stuff */
@@ -109,7 +112,7 @@
#define CONFIG_COMMANDS \
(CONFIG_CMD_DFL | \
CFG_CMD_CACHE | \
- /*CFG_CMD_NAND |*/ \
+ CFG_CMD_NAND | \
/*CFG_CMD_EEPROM |*/ \
/*CFG_CMD_I2C |*/ \
/*CFG_CMD_USB |*/ \
@@ -123,7 +126,7 @@
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
#include <cmd_confdefs.h>
-#define CONFIG_BOOTDELAY 3
+#define CONFIG_BOOTDELAY 1
/*#define CONFIG_BOOTARGS "root=ramfs devfs=mount console=ttySA0,9600" */
#define CONFIG_ETHADDR 08:00:3e:26:0a:5b
#define CONFIG_NETMASK 255.255.255.0
@@ -133,9 +136,14 @@
/*#define CONFIG_BOOTFILE "elinos-lart" */
/*#define CONFIG_BOOTCOMMAND "tftp; bootm" */
-
+/* jeenspa fix - nand boot */
+#if 0
/* ghcstop fix */
#define CONFIG_BOOTCOMMAND "tftp 32000000 aesopk;bootm 32000000"
+#else
+#define CONFIG_BOOTCOMMAND "nand read 32000000 0 200000;bootm 32000000"
+#endif
+
/*
* ghcstop add
* NFS setting howto
@@ -147,10 +155,14 @@
//#if UBOOT_FOR_LINUX_2420
#if 1 /* 2.4.x kernel */
//#define CONFIG_BOOTARGS "root=/dev/nfs rw nfsroot=192.168.1.1:/root/mmsp2nfs ip=192.168.1.9:192.168.1.1:192.168.1.1:255.255.255.0::eth0:off ethaddr=08:00:3e:26:0a:5b"
- #define CONFIG_BOOTARGS "root=/dev/nfs rw nfsroot=192.168.10.10:/korea-dokdo/nfsmount/rootfs-aesop ip=192.168.10.21:192.168.10.10:192.168.10.1:255.255.255.0::eth0:off ethaddr=08:00:3e:26:0a:5b"
+/* jeenspa fix - nand boot */
+#define CONFIG_BOOTARGS "root=/dev/mtdblock1 ip=192.168.10.21:192.168.10.10:192.168.10.1:255.255.255.0::eth0:off ethaddr=11:22:33:44:55:66 noinitrd console=ttyS0"
+ //#define CONFIG_BOOTARGS "root=/dev/nfs rw nfsroot=192.168.10.10:/korea-dokdo/nfsmount/rootfs-aesop ip=192.168.10.21:192.168.10.10:192.168.10.1:255.255.255.0::eth0:off ethaddr=08:00:3e:26:0a:5b"
//#define CONFIG_BOOTARGS "root=/dev/nfs rw nfsroot=192.168.10.10:/root/mmsp2nfs ip=192.168.10.4:192.168.10.10:192.168.10.1:255.255.255.0::eth0:off ethaddr=08:00:3e:26:0a:5b"
#else /* 2.6.x kernel */
- #define CONFIG_BOOTARGS "root=/dev/nfs rw nfsroot=192.168.10.10:/korea-dokdo/nfsmount/rootfs-aesop ip=192.168.10.21:192.168.10.10:192.168.10.1:255.255.255.0::eth0:off console=ttySAC0,115200n81 ethaddr=08:00:3e:26:0a:5b"
+/* jeenspa fix - nand boot */
+#define CONFIG_BOOTARGS "root=/dev/mtdblock1 ip=192.168.10.21:192.168.10.10:192.168.10.1:255.255.255.0::eth0:off ethaddr=11:22:33:44:55:66 noinitrd console=ttySAC0,115200n81"
+ //#define CONFIG_BOOTARGS "root=/dev/nfs rw nfsroot=192.168.10.10:/korea-dokdo/nfsmount/rootfs-aesop ip=192.168.10.21:192.168.10.10:192.168.10.1:255.255.255.0::eth0:off console=ttySAC0,115200n81 ethaddr=08:00:3e:26:0a:5b"
#endif
@@ -245,6 +257,35 @@
/* u-boot environment(in flash) area setting */
#define CFG_ENV_IS_IN_FLASH 1
+
+/*-----------------------------------------------------------------------
+ * NAND FLASH organization
+ */
+#define CONFIG_AESOP_YAFFS
+#define CFG_MAX_NAND_DEVICE 1
+#define SECTORSIZE 512
+#define ADDR_COLUMN 1
+#define ADDR_PAGE 3
+#define ADDR_COLUMN_PAGE 4
+#define NAND_ChipID_UNKNOWN 0x00
+#define NAND_MAX_FLOORS 1
+#define NAND_MAX_CHIPS 1
+#define NAND_WAIT_READY(nand) udelay(10); while(!(rNFSTAT & 0x01))
+#define WRITE_NAND_COMMAND(d, adr) rNFCMD = d
+#define WRITE_NAND_ADDRESS(d, adr) rNFADDR = d
+#define WRITE_NAND(d, adr) rNFDATA = d
+#define READ_NAND(adr) rNFDATA
+#define NAND_DISABLE_CE(nand) rNFCONT |= 0x02
+#define NAND_ENABLE_CE(nand) rNFCONT &= ~(0x02)
+#define NAND_CTL_CLRALE(nandptr)
+#define NAND_CTL_SETALE(nandptr)
+#define NAND_CTL_CLRCLE(nandptr)
+#define NAND_CTL_SETCLE(nandptr)
+
+/*-----------------------------------------------------------------------
+ * aESOP USB Device Mass-storage support
+ */
+#define CONFIG_AESOP_USBDMASS
/*-------------------------------------------------------------------------*/
|
|
From: jeenspa <je...@li...> - 2005-07-05 14:16:54
|
jeenspa 2005/07/05 07:16:44
Modified: include s3c2440.h s3c24x0.h
Log:
usbdmass fixup, nand, mkyaffs
Revision Changes Path
1.2 +3 -3 u-boot-aesop/include/s3c2440.h
Index: s3c2440.h
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/include/s3c2440.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- s3c2440.h 27 Jun 2005 17:05:51 -0000 1.1
+++ s3c2440.h 5 Jul 2005 14:16:44 -0000 1.2
@@ -51,7 +51,7 @@
#define S3C24X0_DMA_BASE 0x4B000000
#define S3C24X0_CLOCK_POWER_BASE 0x4C000000
#define S3C24X0_LCD_BASE 0x4D000000
-#define S3C2410_NAND_BASE 0x4E000000
+#define S3C2440_NAND_BASE 0x4E000000
#define S3C24X0_UART_BASE 0x50000000
#define S3C24X0_TIMER_BASE 0x51000000
#define S3C24X0_USB_DEVICE_BASE 0x52000140
@@ -93,9 +93,9 @@
{
return (S3C24X0_LCD * const)S3C24X0_LCD_BASE;
}
-static inline S3C2410_NAND * const S3C2410_GetBase_NAND(void)
+static inline S3C2440_NAND * const S3C2440_GetBase_NAND(void)
{
- return (S3C2410_NAND * const)S3C2410_NAND_BASE;
+ return (S3C2440_NAND * const)S3C2440_NAND_BASE;
}
static inline S3C24X0_UART * const S3C24X0_GetBase_UART(S3C24X0_UARTS_NR nr)
{
1.2 +44 -5 u-boot-aesop/include/s3c24x0.h
Index: s3c24x0.h
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/include/s3c24x0.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- s3c24x0.h 27 Jun 2005 17:05:52 -0000 1.1
+++ s3c24x0.h 5 Jul 2005 14:16:44 -0000 1.2
@@ -156,7 +156,7 @@
#endif
} /*__attribute__((__packed__))*/ S3C24X0_LCD;
-
+#if defined(CONFIG_S3C2410)
/* NAND FLASH (see S3C2410 manual chapter 6) */
typedef struct {
S3C24X0_REG32 NFCONF;
@@ -166,6 +166,27 @@
S3C24X0_REG32 NFSTAT;
S3C24X0_REG32 NFECC;
} /*__attribute__((__packed__))*/ S3C2410_NAND;
+#elif defined(CONFIG_S3C2440)
+/* NAND FLASH (see S3C2440 manual chapter 6) */
+typedef struct {
+ S3C24X0_REG32 NFCONF;
+ S3C24X0_REG32 NFCONT;
+ S3C24X0_REG32 NFCMD;
+ S3C24X0_REG32 NFADDR;
+ S3C24X0_REG32 NFDATA;
+ S3C24X0_REG32 NFMECCD0;
+ S3C24X0_REG32 NFMECCD1;
+ S3C24X0_REG32 NFSECCD;
+ S3C24X0_REG32 NFSTAT;
+ S3C24X0_REG32 NFESTAT0;
+ S3C24X0_REG32 NFESTAT1;
+ S3C24X0_REG32 NFMECC0;
+ S3C24X0_REG32 NFMECC1;
+ S3C24X0_REG32 NFSECC;
+ S3C24X0_REG32 NFSBLK;
+ S3C24X0_REG32 NFEBLK;
+} /*__attribute__((__packed__))*/ S3C2440_NAND;
+#endif
/* UART (see manual chapter 11) */
@@ -657,7 +678,7 @@
} /*__attribute__((__packed__))*/ S3C2410_SDI;
-#if 0
+#if 1
/* Memory control */
#define rBWSCON (*(volatile unsigned *)0x48000000)
#define rBANKCON0 (*(volatile unsigned *)0x48000004)
@@ -777,15 +798,33 @@
#define rLCDSRCPND (*(volatile unsigned *)0x4D000058)
#define rLCDINTMSK (*(volatile unsigned *)0x4D00005C)
-
-/* NAND FLASH */
+#if defined(CONFIG_S3C2410)
+/* NAND FLASH 2410 */
#define rNFCONF (*(volatile unsigned *)0x4E000000)
#define rNFCMD (*(volatile unsigned *)0x4E000004)
#define rNFADDR (*(volatile unsigned *)0x4E000008)
#define rNFDATA (*(volatile unsigned *)0x4E00000C)
#define rNFSTAT (*(volatile unsigned *)0x4E000010)
#define rNFECC (*(volatile unsigned *)0x4E000014)
-
+#elif defined(CONFIG_S3C2440)
+/* NAND FLASH 2440 */
+#define rNFCONF (*(volatile unsigned *)0x4E000000)
+#define rNFCONT (*(volatile unsigned *)0x4E000004)
+#define rNFCMD (*(volatile unsigned *)0x4E000008)
+#define rNFADDR (*(volatile unsigned *)0x4E00000C)
+#define rNFDATA (*(volatile unsigned char *)0x4E000010)
+#define rNFMECCD0 (*(volatile unsigned *)0x4E000014)
+#define rNFMECCD1 (*(volatile unsigned *)0x4E000018)
+#define rNFSECCD (*(volatile unsigned *)0x4E00001C)
+#define rNFSTAT (*(volatile unsigned *)0x4E000020)
+#define rNFESTAT0 (*(volatile unsigned *)0x4E000024)
+#define rNFESTAT1 (*(volatile unsigned *)0x4E000028)
+#define rNFMECC0 (*(volatile unsigned *)0x4E00002C)
+#define rNFMECC1 (*(volatile unsigned *)0x4E000030)
+#define rNFSECC (*(volatile unsigned *)0x4E000034)
+#define rNFSBLK (*(volatile unsigned *)0x4E000038)
+#define rNFEBLK (*(volatile unsigned *)0x4E00003C)
+#endif
/* UART */
#define rULCON0 (*(volatile unsigned *)0x50000000)
|
|
From: jeenspa <je...@li...> - 2005-07-05 14:16:49
|
jeenspa 2005/07/05 07:16:43
Modified: common cmd_nand.c
Log:
usbdmass fixup, nand, mkyaffs
Revision Changes Path
1.2 +94 -15 u-boot-aesop/common/cmd_nand.c
Index: cmd_nand.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/common/cmd_nand.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cmd_nand.c 27 Jun 2005 17:05:23 -0000 1.1
+++ cmd_nand.c 5 Jul 2005 14:16:43 -0000 1.2
@@ -24,6 +24,10 @@
#include <asm/arch/hardware.h>
#endif
+#ifdef CONFIG_S3C2440
+#include <s3c2440.h>
+#endif
+
#include <linux/mtd/nand.h>
#include <linux/mtd/nand_ids.h>
#include <jffs2/jffs2.h>
@@ -45,6 +49,8 @@
#undef NAND_DEBUG
#undef PSYCHO_DEBUG
+//#define NAND_DEBUG
+//#define PSYCHO_DEBUG
/* ****************** WARNING *********************
* When ALLOW_ERASE_BAD_DEBUG is non-zero the erase command will
@@ -83,9 +89,13 @@
static int nand_write_ecc (struct nand_chip* nand, size_t to, size_t len,
size_t * retlen, const u_char * buf, u_char * ecc_code);
static void nand_print_bad(struct nand_chip *nand);
-static int nand_read_oob(struct nand_chip* nand, size_t ofs, size_t len,
+/* static int nand_read_oob(struct nand_chip* nand, size_t ofs, size_t len,
+ size_t * retlen, u_char * buf); */
+int nand_read_oob(struct nand_chip* nand, size_t ofs, size_t len,
size_t * retlen, u_char * buf);
-static int nand_write_oob(struct nand_chip* nand, size_t ofs, size_t len,
+/* static int nand_write_oob(struct nand_chip* nand, size_t ofs, size_t len,
+ size_t * retlen, const u_char * buf); */
+int nand_write_oob(struct nand_chip* nand, size_t ofs, size_t len,
size_t * retlen, const u_char * buf);
static int NanD_WaitReady(struct nand_chip *nand, int ale_wait);
#ifdef CONFIG_MTD_NAND_ECC
@@ -553,8 +563,9 @@
static inline int NanD_Command(struct nand_chip *nand, unsigned char command)
{
+#ifndef CONFIG_S3C2440
unsigned long nandptr = nand->IO_ADDR;
-
+#endif
/* Assert the CLE (Command Latch Enable) line to the flash chip */
NAND_CTL_SETCLE(nandptr);
@@ -580,11 +591,10 @@
static int NanD_Address(struct nand_chip *nand, int numbytes, unsigned long ofs)
{
- unsigned long nandptr;
int i;
-
- nandptr = nand->IO_ADDR;
-
+#ifndef CONFIG_S3C2440
+ unsigned long nandptr = nand->IO_ADDR;
+#endif
/* Assert the ALE (Address Latch Enable) line to the flash chip */
NAND_CTL_SETALE(nandptr);
@@ -741,7 +751,6 @@
nand->mfr = 0;
nand->id = 0;
-
/* For each floor, find the number of valid chips it contains */
for (floor = 0; floor < NAND_MAX_FLOORS; floor++) {
ret = 1;
@@ -797,8 +806,9 @@
/* we need to be fast here, 1 us per read translates to 1 second per meg */
static void NanD_ReadBuf(struct nand_chip *nand, u_char *data_buf, int cntr)
{
+#ifndef CONFIG_S3C2440
unsigned long nandptr = nand->IO_ADDR;
-
+#endif
while (cntr >= 16) {
*data_buf++ = READ_NAND(nandptr);
*data_buf++ = READ_NAND(nandptr);
@@ -975,7 +985,9 @@
{
int i;
+#ifndef CONFIG_S3C2440
unsigned long nandptr = nand->IO_ADDR;
+#endif
#ifdef CONFIG_MTD_NAND_ECC
#ifdef CONFIG_MTD_NAND_VERIFY_WRITE
int ecc_bytes = (nand->oobblock == 512) ? 6 : 3;
@@ -1177,7 +1189,9 @@
/* read from the 16 bytes of oob data that correspond to a 512 byte
* page or 2 256-byte pages.
*/
-static int nand_read_oob(struct nand_chip* nand, size_t ofs, size_t len,
+/* static int nand_read_oob(struct nand_chip* nand, size_t ofs, size_t len,
+ size_t * retlen, u_char * buf) */
+int nand_read_oob(struct nand_chip* nand, size_t ofs, size_t len,
size_t * retlen, u_char * buf)
{
int len256 = 0;
@@ -1227,13 +1241,16 @@
/* write to the 16 bytes of oob data that correspond to a 512 byte
* page or 2 256-byte pages.
*/
-static int nand_write_oob(struct nand_chip* nand, size_t ofs, size_t len,
+/* static int nand_write_oob(struct nand_chip* nand, size_t ofs, size_t len,
+ size_t * retlen, const u_char * buf) */
+int nand_write_oob(struct nand_chip* nand, size_t ofs, size_t len,
size_t * retlen, const u_char * buf)
{
int len256 = 0;
int i;
+#ifndef CONFIG_S3C2440
unsigned long nandptr = nand->IO_ADDR;
-
+#endif
#ifdef PSYCHO_DEBUG
printf("nand_write_oob(%lx, %d): %2.2X %2.2X %2.2X %2.2X ... %2.2X %2.2X .. %2.2X %2.2X\n",
(long)ofs, len, buf[0], buf[1], buf[2], buf[3],
@@ -1326,7 +1343,10 @@
JFFS2_NODETYPE_CLEANMARKER,
8 /* 8 bytes in this node */
};
- unsigned long nandptr;
+
+#ifndef CONFIG_S3C2440
+ unsigned long nandptr = nand->IO_ADDR;
+#endif
struct Nand *mychip;
int ret = 0;
@@ -1336,8 +1356,6 @@
return -1;
}
- nandptr = nand->IO_ADDR;
-
/* Select the NAND device */
#ifdef CONFIG_OMAP1510
archflashwp(0,0);
@@ -1693,5 +1711,66 @@
#endif /* CONFIG_JFFS2_NAND */
+#ifdef CONFIG_AESOP_YAFFS
+/*
+ * NAND Flash Page write function for YAFFS image write
+ */
+int nand_write_page_yaffs (int, u_char *);
+int nand_write_page_yaffs (int page, u_char *buff)
+{
+
+ int i;
+ struct nand_chip *nand = &nand_dev_desc[curr_device];
+
+ NAND_ENABLE_CE(nand); /* set pin low */
+ /* Send command to begin auto page programming */
+ NanD_Command(nand, NAND_CMD_READ0);
+ NanD_Command(nand, NAND_CMD_SEQIN);
+ NanD_Address(nand, ADDR_COLUMN_PAGE, page << nand->page_shift);
+
+ /* Write out complete page of data with OOB */
+ for (i = 0; i < (nand->oobblock + nand->oobsize); i++)
+ WRITE_NAND(buff[i], nand->IO_ADDR);
+
+ /* Send command to actually program the data */
+ NanD_Command(nand, NAND_CMD_PAGEPROG);
+ NanD_Command(nand, NAND_CMD_STATUS);
+
+ /* See if device thinks it succeeded */
+ if (READ_NAND(nand->IO_ADDR) & 0x01) {
+ NAND_DISABLE_CE(nand); /* set pin high */
+ printf ("%s: Failed write, page 0x%08x, ", __FUNCTION__, page);
+ return -1;
+ }
+
+ /*
+ * The NAND device assumes that it is always writing to
+ * a cleanly erased page. Hence, it performs its internal
+ * write verification only on bits that transitioned from
+ * 1 to 0. The device does NOT verify the whole page on a
+ * byte by byte basis. It is possible that the page was
+ * not completely erased or the page is becoming unusable
+ * due to wear. The read with ECC would catch the error
+ * later when the ECC page check fails, but we would rather
+ * catch it early in the page write stage. Better to write
+ * no data than invalid data.
+ */
+
+ /* Send command to read back the page */
+ NanD_Command(nand, NAND_CMD_READ0);
+ NanD_Address(nand, ADDR_COLUMN_PAGE, page << nand->page_shift);
+
+ /* Loop through and verify the data */
+ for (i = 0; i < (nand->oobblock + nand->oobsize); i++) {
+ if (buff[i] != READ_NAND(nand->IO_ADDR)) {
+ NAND_DISABLE_CE(nand); /* set pin high */
+ printf ("%s: Failed write verify, page 0x%08x ", __FUNCTION__, page);
+ return -1;
+ }
+ }
+ NAND_DISABLE_CE(nand); /* set pin high */
+ return 0;
+}
+#endif /* CONFIG_AESOP_YAFFS */
#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */
|
|
From: jeenspa <je...@li...> - 2005-07-05 14:16:49
|
jeenspa 2005/07/05 07:16:42
Modified: board/aesop2440 aesop2440.c config.mk logo-howto.txt
usbd_24x0.c usbd_common.c usbd_mass.c usbd_media.c
usbd_scsi.c usbd_scsi.h
Log:
usbdmass fixup, nand, mkyaffs
Revision Changes Path
1.2 +190 -17 u-boot-aesop/board/aesop2440/aesop2440.c
Index: aesop2440.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/aesop2440.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- aesop2440.c 27 Jun 2005 17:04:23 -0000 1.1
+++ aesop2440.c 5 Jul 2005 14:16:41 -0000 1.2
@@ -27,47 +27,72 @@
* Created date : 2005. 06. 26. 22:56:57 KST
* Description :
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
* $Log: aesop2440.c,v $
- * Revision 1.1 2005/06/27 17:04:23 linuxpark
- * Initial revision
+ * Revision 1.2 2005/07/05 14:16:41 jeenspa
+ * usbdmass fixup, nand, mkyaffs
+ *
+ * Revision 1.1.1.1 2005/06/27 17:04:23 linuxpark
+ * Initial import.
*
*
*
*/
-#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/aesop2440.c,v 1.1 2005/06/27 17:04:23 linuxpark Exp $"
+#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/aesop2440.c,v 1.2 2005/07/05 14:16:41 jeenspa Exp $"
#include <common.h>
#include <s3c2440.h>
#include <command.h>
#include <bmp_layout.h>
+#include <asm/sizes.h>
#include "sd.h"
/* ------------------------------------------------------------------------- */
#define FCLK_SPEED 1
+#define USB_CLOCK 1
-#if FCLK_SPEED==0 /* Fout = 296.35MHz */
+#if CONFIG_SYS_CLK_FREQ == 16934400
+#if FCLK_SPEED == 0 /* Fout = 296.35MHz */
#define M_MDIV 0x61
#define M_PDIV 0x1
#define M_SDIV 0x2
-#elif FCLK_SPEED==1 /* Fout = 399.65MHz */
+#elif FCLK_SPEED == 1 /* Fout = 399.65MHz */
#define M_MDIV 0x6E
#define M_PDIV 0x3
#define M_SDIV 0x1
#endif
-
-#define USB_CLOCK 1
-
-#if USB_CLOCK==0
+#if USB_CLOCK == 0
#define U_M_MDIV 0x3C
#define U_M_PDIV 0x4
#define U_M_SDIV 0x1
-#elif USB_CLOCK==1
+#elif USB_CLOCK == 1
#define U_M_MDIV 0x3C
#define U_M_PDIV 0x4
#define U_M_SDIV 0x2
#endif
+#elif CONFIG_SYS_CLK_FREQ == 12000000
+#if FCLK_SPEED == 0 /* Fout = 304.00MHz */
+#define M_MDIV 0x44
+#define M_PDIV 0x1
+#define M_SDIV 0x1
+#elif FCLK_SPEED == 1 /* Fout = 405.00MHz */
+#define M_MDIV 0x7f
+#define M_PDIV 0x2
+#define M_SDIV 0x1
+#endif
+#if USB_CLOCK == 0
+#define U_M_MDIV 0x38
+#define U_M_PDIV 0x2
+#define U_M_SDIV 0x1
+#elif USB_CLOCK == 1
+#define U_M_MDIV 0x38
+#define U_M_PDIV 0x2
+#define U_M_SDIV 0x2
+#endif
+#else
+#error CONFIG_SYS_CLK_FREQ Not Defined
+#endif
#define LCD_WIDTH 480
#define LCD_HEIGHT 272
@@ -301,6 +326,25 @@
return 0;
}
+#if defined(CONFIG_COMMANDS) && defined(CFG_CMD_NAND)
+#include <linux/mtd/nand.h>
+int nand_init(void)
+{
+ S3C2440_NAND * const nand = S3C2440_GetBase_NAND();
+ extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];
+
+ nand->NFCONF = 1 << 12 | 5 << 8 | 1 << 4 | 0 << 0;
+ nand->NFCONT = 0 << 12 | 0 << 8 | 1 << 6 | 1 << 5 | 1 << 1 | 1 << 0;
+
+ nand_probe(0);
+ if (nand_dev_desc[0].ChipID != NAND_ChipID_UNKNOWN) {
+ print_size(nand_dev_desc[0].totlen, "\n");
+ }
+ return 0;
+}
+#endif /* defined(CONFIG_COMMANDS) && defined(CFG_CMD_NAND) */
+
+#if defined(CONFIG_COMMANDS) && defined(CFG_CMD_BSP)
#ifdef CONFIG_AESOP_LCD
int do_bmpload_sub(unsigned char *imgaddr, int pos_x, int pos_y, int disp_info)
@@ -376,11 +420,7 @@
}
return 0;
}
-#endif /* CONFIG_AESOP_LCD */
-#if (CONFIG_COMMANDS & CFG_CMD_BSP)
-
-#ifdef CONFIG_AESOP_LCD
/* ------------------------------------------------------------------------- */
int do_bmpload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
@@ -407,7 +447,7 @@
return do_bmpload_sub(imgaddr, x_off, y_off, 1);
}
U_BOOT_CMD(
- bmpload, 4, 1, do_bmpload,
+ bmpload, 4, 0, do_bmpload,
"bmpload - BMP Image load\n",
"[address] [x y] - BMP Image Load\n"
" address - BMP Image address\n"
@@ -417,6 +457,7 @@
#endif /* CONFIG_AESOP_LCD */
+#ifdef CONFIG_AESOP_USBDMASS
/* ------------------------------------------------------------------------- */
int do_usbdmass (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
@@ -428,11 +469,143 @@
}
U_BOOT_CMD(
- usbdmass, 2, 1, do_usbdmass,
+ usbdmass, 2, 0, do_usbdmass,
"usbdmass- USB Device Mass-storage\n",
"media - start USB Device Mass-storage class handler with specified media\n"
" media - ram, sd, nand\n"
);
+#endif /* CONFIG_AESOP_USBDMASS */
+
+#ifdef CONFIG_AESOP_YAFFS
+/* ------------------------------------------------------------------------- */
+#define MTDBLOCK0_OFFSET 0
+#define MTDBLOCK0_SIZE 4 * SZ_1M
+#define MTDBLOCK1_OFFSET MTDBLOCK0_OFFSET + MTDBLOCK0_SIZE
+#define MTDBLOCK1_SIZE 16 * SZ_1M
+#define MTDBLOCK2_OFFSET MTDBLOCK1_OFFSET + MTDBLOCK1_SIZE
+#define MTDBLOCK2_SIZE 44 * SZ_1M
+#define MTDBLOCK_MAX 3
+#define SZ_OOB 16
+#define SZ_PAGE_WOOB 528
+#define SZ_PAGE 512
+#define SZ_BLOCK 512 * 32
+#include <linux/mtd/nand.h>
+
+// countBits is a quick way of counting the number of bits in a byte.
+// ie. countBits[n] holds the number of 1 bits in a byte with the value n.
+static const char countBits[256] =
+{
+0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,
+1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
+1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
+2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
+2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
+1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
+2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
+2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
+3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
+4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8
+};
+
+int nand_read_oob(struct nand_chip *, size_t, size_t, size_t *, u_char *);
+int nand_write_oob(struct nand_chip *, size_t, size_t, size_t *, const u_char *);
+int nand_erase(struct nand_chip *, size_t, size_t, int);
+int nand_write_page_yaffs (int, u_char *);
+int do_mkyaffs(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];
+ struct nand_chip *nand = &nand_dev_desc[0];
+ struct {unsigned long offset; unsigned long size;}
+ mtdblk[MTDBLOCK_MAX] = {
+ { MTDBLOCK0_OFFSET, MTDBLOCK0_SIZE },
+ { MTDBLOCK1_OFFSET, MTDBLOCK1_SIZE },
+ { MTDBLOCK2_OFFSET, MTDBLOCK2_SIZE } };
+ unsigned long source, target, count, count_save, addr_blk, addr_sec;
+ unsigned char *src_ptr, *src_ptr_save, oob_buff[SZ_OOB];
+ int i, ret;
+ size_t retlen;
+
+ if (argc != 4) {
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return -1;
+ }
+
+ source = simple_strtoul(argv[1], NULL, 16);
+ target = simple_strtoul(argv[2], NULL, 10);
+ count = simple_strtoul(argv[3], NULL, 16);
+
+ if (target < 0 || target >= MTDBLOCK_MAX) {
+ printf ("Error - target block no. should be between 0 and %d\n", MTDBLOCK_MAX - 1);
+ return -1;
+ }
+
+ if (count % SZ_PAGE_WOOB) {
+ printf ("Error - Image not a multiple of 528 bytes\n");
+ return -1;
+ }
+
+ if (mtdblk[target].size < ((count / SZ_PAGE_WOOB) * SZ_PAGE)) {
+ printf ("Error - Image is too big for MTDBLOCK%d\n", target);
+ printf (" MTDBLOCK%d size - 0x%lx\n", target, mtdblk[target].size);
+ return -1;
+ }
+
+ src_ptr = (unsigned char *)source;
+ for (addr_blk = mtdblk[target].offset; addr_blk < mtdblk[target].offset + mtdblk[target].size; addr_blk += SZ_BLOCK) {
+ count_save = count;
+ src_ptr_save = src_ptr;
+ nand_read_oob(nand, addr_blk, SZ_OOB, &retlen, oob_buff);
+ if (countBits[oob_buff[5]] < 7) {
+ printf("Block at 0x%lx is marked BAD and is not being formatted\n",addr_blk);
+ continue;
+ }
+
+ ret = nand_erase(nand, addr_blk, nand->erasesize, 0);
+ if (ret == -1) {
+ for (i = 0; i < SZ_OOB; i++) oob_buff[i] = 0;
+ nand_write_oob( nand, addr_blk, SZ_OOB, &retlen, oob_buff);
+ printf("Block erase error at 0x%lx, not formatted\n",addr_blk);
+ continue;
+ }
+
+ if (addr_blk == mtdblk[target].offset) continue;
+ for (addr_sec = addr_blk; addr_sec < addr_blk + SZ_BLOCK; addr_sec += SZ_PAGE) {
+ if (src_ptr < (unsigned char *)(source + count)) {
+ ret = nand_write_page_yaffs(addr_sec >> 9, src_ptr);
+ if (ret == -1) {
+ src_ptr = src_ptr_save;
+ for (i = 0; i < SZ_OOB; i++) oob_buff[i] = 0;
+ nand_write_oob( nand, addr_blk, SZ_OOB, &retlen, oob_buff);
+ printf("Block write error at 0x%lx, mark bad and not formatted\n",addr_sec);
+ continue;
+ }
+ src_ptr += SZ_PAGE_WOOB;
+ }
+ }
+ }
+ if (src_ptr != (unsigned char *)(count + source)) {
+ printf("Error - Insufficient NAND flash space.\n");
+ printf(" mkyaffs failed\n");
+ return -1;
+ }
+ printf("mkyaffs completed.\n");
+ return 0;
+}
+U_BOOT_CMD(
+ mkyaffs, 4, 0, do_mkyaffs,
+ "mkyaffs - Write YAFFS Image to NAND Flash\n",
+ "source target count\n"
+ " source - YAFFS Image address\n"
+ " target - NAND Flash destination MTDBlock No.\n"
+ " count - byte count of YAFFS image\n"
+);
+#endif /* CONFIG_AESOP_YAFFS */
-#endif /* (CONFIG_COMMANDS & CFG_CMD_BSP) */
+#endif /* defined(CONFIG_COMMANDS) && defined(CFG_CMD_BSP) */
1.2 +7 -4 u-boot-aesop/board/aesop2440/config.mk
Index: config.mk
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/config.mk,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- config.mk 27 Jun 2005 17:03:53 -0000 1.1
+++ config.mk 5 Jul 2005 14:16:41 -0000 1.2
@@ -28,15 +28,18 @@
# Created date : 2005. 06. 26. 22:59:04 KST
# Description :
#
-# $Revision: 1.1 $
+# $Revision: 1.2 $
# $Log: config.mk,v $
-# Revision 1.1 2005/06/27 17:03:53 linuxpark
-# Initial revision
+# Revision 1.2 2005/07/05 14:16:41 jeenspa
+# usbdmass fixup, nand, mkyaffs
+#
+# Revision 1.1.1.1 2005/06/27 17:03:53 linuxpark
+# Initial import.
#
#
#
#
-#ident "@(#) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/config.mk,v 1.1 2005/06/27 17:03:53 linuxpark Exp $"
+#ident "@(#) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/config.mk,v 1.2 2005/07/05 14:16:41 jeenspa Exp $"
#
@@ -68,6 +71,6 @@
# LCD framebuffer address: 0x33000000(48M offset)
# ramdisk optionally with a ramdisk at 3080'0000
# parameter tag: 0x30000100
-TEXT_BASE = 0x33800000
+TEXT_BASE = 0x33C00000
1.2 +11 -4 u-boot-aesop/board/aesop2440/logo-howto.txt
<<Binary file>>
1.2 +22 -5 u-boot-aesop/board/aesop2440/usbd_24x0.c
Index: usbd_24x0.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_24x0.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- usbd_24x0.c 27 Jun 2005 17:04:30 -0000 1.1
+++ usbd_24x0.c 5 Jul 2005 14:16:41 -0000 1.2
@@ -27,15 +27,18 @@
* Created date : 2005. 06. 26. 23:07:52 KST
* Description :
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
* $Log: usbd_24x0.c,v $
- * Revision 1.1 2005/06/27 17:04:30 linuxpark
- * Initial revision
+ * Revision 1.2 2005/07/05 14:16:41 jeenspa
+ * usbdmass fixup, nand, mkyaffs
+ *
+ * Revision 1.1.1.1 2005/06/27 17:04:30 linuxpark
+ * Initial import.
*
*
*
*/
-#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_24x0.c,v 1.1 2005/06/27 17:04:30 linuxpark Exp $"
+#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_24x0.c,v 1.2 2005/07/05 14:16:41 jeenspa Exp $"
/*
@@ -66,7 +69,10 @@
#endif
#include <common.h>
-#include <s3c2410.h>
+
+#ifdef CONFIG_AESOP_USBDMASS
+
+#include <s3c2440.h>
#include "usbd_common.h"
#include "usbd_24x0.h"
@@ -305,11 +311,19 @@
usbd_24x0_init_gpio();
-/* clock & power init */
+/*
+#if 0
udelay(10000); // delay 10msec
clockpower->UPLLCON = (120 << 12) | (2 << 4) | (3 << 0);
udelay(10000); // delay 10msec
clockpower->CLKCON = clockpower->CLKCON | 0x80;
+#else
+ udelay(10000); // delay 10msec
+ clockpower->UPLLCON = (0x38 << 12) | (2 << 4) | (2 << 0);
+ udelay(10000); // delay 10msec
+ clockpower->CLKCON = clockpower->CLKCON | 0x80;
+#endif
+*/
#ifndef IGNORE_VBUS
if (!usbd_24x0_check_vbus()) return FALSE;
@@ -582,3 +596,6 @@
usbd->OUT_CSR1_REG = (( out_csr1 & (~EPO_WR_BITS)) & (~EPO_OUT_PKT_READY));
return TRUE;
}
+
+#endif /* CONFIG_AESOP_USBDMASS */
+
1.2 +12 -5 u-boot-aesop/board/aesop2440/usbd_common.c
Index: usbd_common.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_common.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- usbd_common.c 27 Jun 2005 17:04:29 -0000 1.1
+++ usbd_common.c 5 Jul 2005 14:16:41 -0000 1.2
@@ -27,15 +27,18 @@
* Created date : 2005. 06. 26. 23:08:57 KST
* Description :
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
* $Log: usbd_common.c,v $
- * Revision 1.1 2005/06/27 17:04:29 linuxpark
- * Initial revision
+ * Revision 1.2 2005/07/05 14:16:41 jeenspa
+ * usbdmass fixup, nand, mkyaffs
+ *
+ * Revision 1.1.1.1 2005/06/27 17:04:29 linuxpark
+ * Initial import.
*
*
*
*/
-#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_common.c,v 1.1 2005/06/27 17:04:29 linuxpark Exp $"
+#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_common.c,v 1.2 2005/07/05 14:16:41 jeenspa Exp $"
/*
@@ -60,10 +63,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
+#include <common.h>
+#ifdef CONFIG_AESOP_USBDMASS
-#include <common.h>
-#include <s3c2410.h>
+#include <s3c2440.h>
#include <stdarg.h>
#include "usbd_common.h"
@@ -151,3 +155,6 @@
printf("\n");
return;
}
+
+#endif /* CONFIG_AESOP_USBDMASS */
+
1.2 +11 -4 u-boot-aesop/board/aesop2440/usbd_mass.c
Index: usbd_mass.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_mass.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- usbd_mass.c 27 Jun 2005 17:04:30 -0000 1.1
+++ usbd_mass.c 5 Jul 2005 14:16:41 -0000 1.2
@@ -27,15 +27,18 @@
* Created date : 2005. 06. 26. 23:10:33 KST
* Description :
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
* $Log: usbd_mass.c,v $
- * Revision 1.1 2005/06/27 17:04:30 linuxpark
- * Initial revision
+ * Revision 1.2 2005/07/05 14:16:41 jeenspa
+ * usbdmass fixup, nand, mkyaffs
+ *
+ * Revision 1.1.1.1 2005/06/27 17:04:30 linuxpark
+ * Initial import.
*
*
*
*/
-#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_mass.c,v 1.1 2005/06/27 17:04:30 linuxpark Exp $"
+#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_mass.c,v 1.2 2005/07/05 14:16:41 jeenspa Exp $"
/*
@@ -66,7 +69,10 @@
#endif
#include <common.h>
-#include <s3c2410.h>
+
+#ifdef CONFIG_AESOP_USBDMASS
+
+#include <s3c2440.h>
#include <asm/types.h>
#include "usbd_common.h"
#include "usbd_24x0.h"
@@ -667,4 +673,5 @@
wide[i] = (u16) str[i];
}
+#endif /* CONFIG_AESOP_USBDMASS */
1.2 +10 -3 u-boot-aesop/board/aesop2440/usbd_media.c
Index: usbd_media.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_media.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- usbd_media.c 27 Jun 2005 17:03:53 -0000 1.1
+++ usbd_media.c 5 Jul 2005 14:16:41 -0000 1.2
@@ -27,15 +27,18 @@
* Created date : 2005. 06. 26. 23:11:58 KST
* Description :
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
* $Log: usbd_media.c,v $
- * Revision 1.1 2005/06/27 17:03:53 linuxpark
- * Initial revision
+ * Revision 1.2 2005/07/05 14:16:41 jeenspa
+ * usbdmass fixup, nand, mkyaffs
+ *
+ * Revision 1.1.1.1 2005/06/27 17:03:53 linuxpark
+ * Initial import.
*
*
*
*/
-#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_media.c,v 1.1 2005/06/27 17:03:53 linuxpark Exp $"
+#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_media.c,v 1.2 2005/07/05 14:16:41 jeenspa Exp $"
/*
@@ -66,6 +69,9 @@
#endif
#include <common.h>
+
+#ifdef CONFIG_AESOP_USBDMASS
+
#include "usbd_common.h"
#include "usbd_mass.h"
#include "usbd_media.h"
@@ -375,4 +381,5 @@
return;
}
+#endif /* CONFIG_AESOP_USBDMASS */
1.2 +41 -4 u-boot-aesop/board/aesop2440/usbd_scsi.c
Index: usbd_scsi.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_scsi.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- usbd_scsi.c 27 Jun 2005 17:04:30 -0000 1.1
+++ usbd_scsi.c 5 Jul 2005 14:16:41 -0000 1.2
@@ -27,15 +27,18 @@
* Created date : 2005. 06. 26. 23:13:50 KST
* Description :
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
* $Log: usbd_scsi.c,v $
- * Revision 1.1 2005/06/27 17:04:30 linuxpark
- * Initial revision
+ * Revision 1.2 2005/07/05 14:16:41 jeenspa
+ * usbdmass fixup, nand, mkyaffs
+ *
+ * Revision 1.1.1.1 2005/06/27 17:04:30 linuxpark
+ * Initial import.
*
*
*
*/
-#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_scsi.c,v 1.1 2005/06/27 17:04:30 linuxpark Exp $"
+#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_scsi.c,v 1.2 2005/07/05 14:16:41 jeenspa Exp $"
/*
@@ -66,7 +69,10 @@
#endif
#include <common.h>
-#include <s3c2410.h>
+
+#ifdef CONFIG_AESOP_USBDMASS
+
+#include <s3c2440.h>
#include "usbd_common.h"
#include "usbd_24x0.h"
#include "usbd_mass.h"
@@ -177,6 +183,9 @@
case SCSI_ComSendDiagnostic:
return usbd_scsi_com_senddiagnostic(ma);
+ case SCSI_ComReadFormatCapacities:
+ return usbd_scsi_com_readformatcapacities(ma);
+
case SCSI_ComReadCapacity:
return usbd_scsi_com_readcapacity(ma);
@@ -427,6 +436,31 @@
return usbd_scsi_command_end_send(ma);
}
+char usbd_scsi_com_readformatcapacities(usbd_mass_instance *ma)
+{
+ unsigned long lba;
+
+ debugvs(1, "%s : %s - SCSI ReadFormatCapacities\n", __FILE__, __FUNCTION__);
+ usbd_media_probe(ma);
+ if (ma->media.status == ABSENT) {
+ usbd_scsi_set_error(ma, SCSI_ERROR_MediumNotPresent, 0);
+ ma->state = SEND_CSW;
+ return CSW_STATUS_CommandFailed;
+ }
+
+ lba = ma->media.total_sector - 1;
+ usbd_scsi_put_bigendian(ma->buff, 0, 4); /* Capacity List Header */
+ usbd_scsi_put_bigendian(ma->buff + 4, lba, 4); /* Number of Blocks */
+ ma->buff[8] = 0x02; /* Descriptor type = Foratted Media */
+ usbd_scsi_put_bigendian(ma->buff + 9, 0x200, 3); /* Block Length */
+ ma->buff_ptr = 0;
+ ma->buff_length = 12;
+
+ debugvs(2, "%s : %s - SCSI ReadFormatCapacities : Report %ld Sectors\n", __FILE__, __FUNCTION__, lba);
+
+ return usbd_scsi_command_end_send(ma);
+}
+
char usbd_scsi_com_readcapacity(usbd_mass_instance *ma)
{
unsigned long lba;
@@ -724,3 +758,6 @@
ma->buff_ptr = 0;
return;
}
+
+#endif /* CONFIG_AESOP_USBDMASS */
+
1.2 +8 -3 u-boot-aesop/board/aesop2440/usbd_scsi.h
Index: usbd_scsi.h
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_scsi.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- usbd_scsi.h 27 Jun 2005 17:04:30 -0000 1.1
+++ usbd_scsi.h 5 Jul 2005 14:16:41 -0000 1.2
@@ -27,15 +27,18 @@
* Created date : 2005. 06. 26. 23:14:24 KST
* Description :
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
* $Log: usbd_scsi.h,v $
- * Revision 1.1 2005/06/27 17:04:30 linuxpark
- * Initial revision
+ * Revision 1.2 2005/07/05 14:16:41 jeenspa
+ * usbdmass fixup, nand, mkyaffs
+ *
+ * Revision 1.1.1.1 2005/06/27 17:04:30 linuxpark
+ * Initial import.
*
*
*
*/
-#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_scsi.h,v 1.1 2005/06/27 17:04:30 linuxpark Exp $"
+#ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_scsi.h,v 1.2 2005/07/05 14:16:41 jeenspa Exp $"
/*
@@ -81,6 +84,7 @@
#define SCSI_ComStartStopUnit 0x1b
#define SCSI_ComPreAllMedRemoval 0x1e
#define SCSI_ComSendDiagnostic 0x1d
+#define SCSI_ComReadFormatCapacities 0x23
#define SCSI_ComReadCapacity 0x25
#define SCSI_ComWriteVerify 0x2e
#define SCSI_ComVerify 0x2f
@@ -117,6 +121,7 @@
char usbd_scsi_com_(usbd_mass_instance *);
char usbd_scsi_com_unknown(usbd_mass_instance *);
char usbd_scsi_com_inquiry(usbd_mass_instance *);
+char usbd_scsi_com_readformatcapacities(usbd_mass_instance *);
char usbd_scsi_com_readcapacity(usbd_mass_instance *);
char usbd_scsi_com_testunitready(usbd_mass_instance *);
char usbd_scsi_com_requestsense(usbd_mass_instance *);
|