You can subscribe to this list here.
2001 |
Jan
|
Feb
(4) |
Mar
(47) |
Apr
(27) |
May
(113) |
Jun
|
Jul
|
Aug
(1) |
Sep
(15) |
Oct
(25) |
Nov
|
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(17) |
Feb
(5) |
Mar
(5) |
Apr
(2) |
May
(16) |
Jun
|
Jul
|
Aug
(15) |
Sep
(28) |
Oct
(78) |
Nov
(39) |
Dec
|
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Adrian M. <zx8...@us...> - 2002-08-31 18:17:16
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps In directory usw-pr-cvs1:/tmp/cvs-serv23778/drivers/mtd/maps Modified Files: vmu-flash.c Log Message: VMU reads now verified as working Index: vmu-flash.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps/vmu-flash.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- vmu-flash.c 31 Aug 2002 11:40:30 -0000 1.6 +++ vmu-flash.c 31 Aug 2002 18:17:13 -0000 1.7 @@ -23,11 +23,11 @@ #include <asm/io.h> -static int VMU_NUM_BLOCKS; /* This is a dynamic property */ +static int VMU_NUM_BLOCKS; /* This is a dynamic property */ static int VMU_BLOCK_SIZE; /* Maple Device */ -static struct maple_device *vmu_flash_mdev __initdata = NULL; +static struct maple_device *vmu_flash_mdev = NULL; /* MTD Information */ static struct mtd_info *vmu_flash_mtd = NULL; @@ -42,7 +42,7 @@ /* Memory card details */ typedef struct memcard_s { long partitions; - long blocklen; + long blocklen; long writecnt; long readcnt; long removable; @@ -116,7 +116,7 @@ /* Now check if we've got a proper return */ if (block_buffer) { - memcpy(block_buffer, buf, 512); + memcpy(buf, block_buffer, 512); kfree(block_buffer); block_buffer = NULL; return 0; @@ -153,7 +153,7 @@ cpu_to_be32(MAPLE_FUNC_MEMCARD); ((unsigned long *) (mqu->recvbuf))[1] = num; - memcpy((mqu->recvbuf) + 8, buf, 512); + memcpy(buf, (mqu->recvbuf) + 8, 512); mqu->sendbuf = mqu->recvbuf; if (maple_add_packet(mqu) != 0) { @@ -248,7 +248,7 @@ if (vmu_cache->valid) { if (vmu_cache->block == block->num) { if ((vmu_cache->jiffies_atc + 10) >= jiffies) { /* short lifespan */ - memcpy(vmu_cache->buffer, buf, 512); + memcpy(buf, vmu_cache->buffer, 512); u_char *buf2 = buf; buf2 += block->ofs; @@ -332,7 +332,7 @@ /* Read and Write routines */ static int vmu_flash_read(struct mtd_info *mtd, loff_t from, size_t len, - size_t * retlen, u_char * buf) + size_t * retlen, u_char * buf) { /* printk("Reading from %llx with length %llx\n", from, len); */ if (len < 1) @@ -358,7 +358,7 @@ static int vmu_flash_write(struct mtd_info *mtd, loff_t from, size_t len, - size_t * retlen, const u_char * buf) + size_t * retlen, const u_char * buf) { if (len < 1) return -1; @@ -428,22 +428,22 @@ /***********Maple functions***************/ -static void dc_flashmap_callback(struct maple_driver_data *data) +void dc_flashmap_callback(struct maple_driver_data *data) { - struct mapleq *mq = &data->mq; - if (flash_queried == 0) { if (mq->recvbuf[0] == 5) { lastmq = mq; - flash_queried = 1; wake_up_interruptible(&wq_mq); /* Wake sleeping code */ return; + } else if (mq->recvbuf[0] == 8) { + lastmq = mq; + wake_up_interruptible(&wq_mq); /* Wake sleeping code */ + flash_queried = 1; + return; } - } - - + } if (mq->recvbuf[0] == 8) { /* int res = mq->recvbuf[0]; @@ -458,19 +458,17 @@ */ block_buffer = kmalloc(512, GFP_KERNEL); /* Copy over */ - memcpy(mq->recvbuf + 12, block_buffer, 512); + memcpy(block_buffer, mq->recvbuf + 12, 512); lastmq = mq; wake_up_interruptible(&wq_mq); /* Wake sleeping code */ - memcpy(block_buffer, vmu_cache->buffer, 512); + memcpy(vmu_cache->buffer, block_buffer, 512); vmu_cache->block = mq->recvbuf[11] & 0xff; vmu_cache->jiffies_atc = jiffies; /* Mark the creation time */ vmu_cache->valid = 1; /* Block is now valid */ return; } lastmq = mq; - - } @@ -487,7 +485,7 @@ mqu->command = 1; mqu->length = 0; - + lastmq = NULL; mqu->sendbuf = mqu->recvbuf; if (maple_add_packet(mqu) != 0) { printk(KERN_WARNING @@ -495,32 +493,28 @@ return -1; } - lastmq = NULL; - do { interruptible_sleep_on_timeout(&wq_mq, 1); } while (lastmq == NULL); - /* Read off the flash data */ - - - /* How many devices are here? */ int bit_cnt = 0; - unsigned long test_flash_data = be32_to_cpu(((unsigned long *)(lastmq->recvbuf))[1]); + unsigned long test_flash_data = + be32_to_cpu(((unsigned long *) (lastmq->recvbuf))[1]); int controller_here = test_flash_data & 0x01; int x; - for (x = 0; x < 32; x++) - { - if (test_flash_data & 0x01) bit_cnt++; - test_flash_data = test_flash_data >> 1; - } + for (x = 0; x < 32; x++) { + if (test_flash_data & 0x01) + bit_cnt++; + test_flash_data = test_flash_data >> 1; + } /* Only device with a lower index is a controller */ unsigned long basic_flash_data = - be32_to_cpu(((unsigned long *) (lastmq->recvbuf))[1 + bit_cnt - controller_here]); + be32_to_cpu(((unsigned long *) (lastmq->recvbuf))[1 + bit_cnt - + controller_here]); /* Create a permanent record */ @@ -529,24 +523,57 @@ memcard_t *card = kmalloc(sizeof(memcard_t), GFP_KERNEL); card->partitions = ((basic_flash_data >> 24) & 0xff) + 1; - printk(KERN_NOTICE " Flash device has %ld partitions\n", card->partitions); + printk(KERN_NOTICE " Flash device has %ld partitions\n", + card->partitions); card->blocklen = (((basic_flash_data >> 16) & 0xff) + 1) << 5; - printk(KERN_NOTICE " Flash device has block length of %ld bytes\n", card->blocklen); + printk(KERN_NOTICE + " Flash device has block length of %ld bytes\n", + card->blocklen); card->writecnt = (basic_flash_data >> 12) & 0xf; - printk(KERN_NOTICE " Flash device has write count of %ld\n", card->writecnt); + printk(KERN_NOTICE " Flash device has write count of %ld\n", + card->writecnt); card->readcnt = (basic_flash_data >> 8) & 0xf; - printk(KERN_NOTICE " Flash device has read count of %ld\n", card->readcnt); + printk(KERN_NOTICE " Flash device has read count of %ld\n", + card->readcnt); card->removable = (basic_flash_data >> 7) & 1; printk(KERN_NOTICE " Flash device removable status is %ld\n", card->removable); - VMU_NUM_BLOCKS = 256; /* TO DO: Read this off */ VMU_BLOCK_SIZE = card->blocklen; - d->private_data = card; + /* Now query flash partition 0 to find definitve block size */ + mqu = (struct mapleq *) &(d->mq); + mqu->command = 10; + mqu->length = 2; + ((unsigned long *) (mqu->recvbuf))[0] = + cpu_to_be32(MAPLE_FUNC_MEMCARD); + ((unsigned long *) (mqu->recvbuf))[1] = 0; // Assuming only have one partition + lastmq = NULL; - /* Now query each flash partition 0 */ + mqu->sendbuf = mqu->recvbuf; + if (maple_add_packet(mqu) != 0) { + printk(KERN_WARNING + "VMU FLASH: Could not add packet to query device\n"); + return -1; + } + + + do { + interruptible_sleep_on_timeout(&wq_mq, 1); + } while (lastmq == NULL); + + int user_blocks = ((unsigned short *) (lastmq->recvbuf))[12]; // User accessible blocks + int root_block = ((unsigned short *) (lastmq->recvbuf))[6]; // Root block location + printk(KERN_INFO + " Flash device has %d blocks available to user\n", + user_blocks); + printk(KERN_INFO " Flash root block is at block %d\n", + root_block); + VMU_NUM_BLOCKS = root_block + 1; + + + /* Register the flash with mtd subsystem */ @@ -558,8 +585,8 @@ /* This is 'other' */ vmu_flash_mtd->type = MTD_OTHER; vmu_flash_mtd->flags = 0; - vmu_flash_mtd->size = VMU_NUM_BLOCKS * VMU_BLOCK_SIZE; - vmu_flash_mtd->erasesize = VMU_BLOCK_SIZE/card->writecnt; + vmu_flash_mtd->size = VMU_NUM_BLOCKS * VMU_BLOCK_SIZE; + vmu_flash_mtd->erasesize = VMU_BLOCK_SIZE / card->writecnt; /* Mandatory functions */ vmu_flash_mtd->write = vmu_flash_write; |
From: Adrian M. <zx8...@us...> - 2002-08-31 18:17:16
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv23778 Modified Files: ChangeLog.dc Log Message: VMU reads now verified as working Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- ChangeLog.dc 31 Aug 2002 11:40:30 -0000 1.40 +++ ChangeLog.dc 31 Aug 2002 18:17:13 -0000 1.41 @@ -1,4 +1,12 @@ 2002-08-31 Adrian McMenamin <ad...@mc...> + + VMU reads now work + + * drivers/mtd/maps/vmu-flash.c: memcopy code + corrected and further diagnostic code inserted + - now correctly reads VMU data. Writes to follow. + +2002-08-31 Adrian McMenamin <ad...@mc...> * drivers/mtd/maps/vmu-flash.c: Code corrected |
From: Adrian M. <zx8...@us...> - 2002-08-31 11:40:33
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv2764 Modified Files: ChangeLog.dc Log Message: VMU Flash code updated Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- ChangeLog.dc 30 Aug 2002 23:31:52 -0000 1.39 +++ ChangeLog.dc 31 Aug 2002 11:40:30 -0000 1.40 @@ -1,5 +1,9 @@ 2002-08-31 Adrian McMenamin <ad...@mc...> + * drivers/mtd/maps/vmu-flash.c: Code corrected + +2002-08-31 Adrian McMenamin <ad...@mc...> + Enhanced diagnostics of flash chips - reading now broadly works * drivers/mtd/maps/vmu-flash.c: Further code updates |
From: Adrian M. <zx8...@us...> - 2002-08-31 11:40:33
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps In directory usw-pr-cvs1:/tmp/cvs-serv2764/drivers/mtd/maps Modified Files: vmu-flash.c Log Message: VMU Flash code updated Index: vmu-flash.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps/vmu-flash.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- vmu-flash.c 30 Aug 2002 23:31:52 -0000 1.5 +++ vmu-flash.c 31 Aug 2002 11:40:30 -0000 1.6 @@ -22,26 +22,27 @@ #include <linux/mtd/map.h> #include <asm/io.h> -#define VMU_NUM_BLOCKS 0x100 /* Standard VMU has 256 blocks */ -#define VMU_BLOCK_SIZE 0x200 /* Standard VMU block is 512 bytes */ + +static int VMU_NUM_BLOCKS; /* This is a dynamic property */ +static int VMU_BLOCK_SIZE; /* Maple Device */ -struct maple_device *vmu_flash_mdev __initdata = NULL; +static struct maple_device *vmu_flash_mdev __initdata = NULL; /* MTD Information */ -struct mtd_info *vmu_flash_mtd = NULL; +static struct mtd_info *vmu_flash_mtd = NULL; -/* Instance variables - not statics */ -struct mapleq *lastmq; -struct maple_driver dc_flashmap_driver; -int flash_queried = 0; +static struct mapleq *lastmq; +static struct maple_driver dc_flashmap_driver; -char *block_buffer = NULL; +static int flash_queried = 0; + +static char *block_buffer = NULL; /* Memory card details */ typedef struct memcard_s { long partitions; - long blocks; + long blocklen; long writecnt; long readcnt; long removable; @@ -64,7 +65,7 @@ } vmu_cache_t; -vmu_cache_t *vmu_cache = NULL; +static vmu_cache_t *vmu_cache = NULL; wait_queue_head_t wq_mq; DECLARE_WAIT_QUEUE_HEAD(wq_mq); @@ -72,7 +73,7 @@ /*************************************/ /**********Read and write routines*************/ -int maple_vmu_read_block(unsigned int num, u_char * buf) +static int maple_vmu_read_block(unsigned int num, u_char * buf) { /* async maple call @@ -130,7 +131,7 @@ } -int maple_vmu_write_block(unsigned int num, u_char * buf) +static int maple_vmu_write_block(unsigned int num, u_char * buf) { /* This function does not have to sleep */ @@ -330,7 +331,7 @@ /***********************************************/ /* Read and Write routines */ -int vmu_flash_read(struct mtd_info *mtd, loff_t from, size_t len, +static int vmu_flash_read(struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf) { /* printk("Reading from %llx with length %llx\n", from, len); */ @@ -356,7 +357,7 @@ } -int vmu_flash_write(struct mtd_info *mtd, loff_t from, size_t len, +static int vmu_flash_write(struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, const u_char * buf) { if (len < 1) @@ -370,7 +371,7 @@ return 0; } -int vmu_flash_erase(struct mtd_info *mtd, struct erase_info *erase) +static int vmu_flash_erase(struct mtd_info *mtd, struct erase_info *erase) { int z; vmu_flash_write(mtd, erase->addr, erase->len, &z, "\0"); @@ -378,7 +379,7 @@ return 0; } -void vmu_flash_sync(struct mtd_info *mtd) +static void vmu_flash_sync(struct mtd_info *mtd) { /* Do nothing */ } @@ -434,8 +435,6 @@ if (flash_queried == 0) { if (mq->recvbuf[0] == 5) { - int res = mq->recvbuf[0]; - lastmq = mq; flash_queried = 1; wake_up_interruptible(&wq_mq); /* Wake sleeping code */ @@ -504,44 +503,63 @@ /* Read off the flash data */ + + + + + /* How many devices are here? */ + int bit_cnt = 0; + unsigned long test_flash_data = be32_to_cpu(((unsigned long *)(lastmq->recvbuf))[1]); + int controller_here = test_flash_data & 0x01; + int x; + for (x = 0; x < 32; x++) + { + if (test_flash_data & 0x01) bit_cnt++; + test_flash_data = test_flash_data >> 1; + } + + /* Only device with a lower index is a controller */ unsigned long basic_flash_data = - be32_to_cpu(((unsigned long *) (lastmq->recvbuf))[4]); + be32_to_cpu(((unsigned long *) (lastmq->recvbuf))[1 + bit_cnt - controller_here]); + + /* Create a permanent record */ /* With thanks to Marcus Comstedt */ memcard_t *card = kmalloc(sizeof(memcard_t), GFP_KERNEL); card->partitions = ((basic_flash_data >> 24) & 0xff) + 1; - printk("\tFlash device has %ld partitions\n", card->partitions); - card->blocks = (((basic_flash_data >> 16) & 0xff) + 1) << 5; - printk("\tFlash device has %ld blocks \n", card->blocks); + printk(KERN_NOTICE " Flash device has %ld partitions\n", card->partitions); + card->blocklen = (((basic_flash_data >> 16) & 0xff) + 1) << 5; + printk(KERN_NOTICE " Flash device has block length of %ld bytes\n", card->blocklen); card->writecnt = (basic_flash_data >> 12) & 0xf; - printk("\tFlash device has write count of %ld\n", card->writecnt); + printk(KERN_NOTICE " Flash device has write count of %ld\n", card->writecnt); card->readcnt = (basic_flash_data >> 8) & 0xf; - printk("\tFlash device has read count of %ld\n", card->readcnt); + printk(KERN_NOTICE " Flash device has read count of %ld\n", card->readcnt); card->removable = (basic_flash_data >> 7) & 1; - printk("\tFlash device removable status is %ld\n", + printk(KERN_NOTICE " Flash device removable status is %ld\n", card->removable); - + VMU_NUM_BLOCKS = 256; /* TO DO: Read this off */ + VMU_BLOCK_SIZE = card->blocklen; d->private_data = card; lastmq = NULL; - /* Now query each flash partition */ + /* Now query each flash partition 0 */ /* Register the flash with mtd subsystem */ if (!vmu_flash_mtd) { /* Populate a mtd_info */ - vmu_flash_mtd = kmalloc(1000, GFP_KERNEL); + vmu_flash_mtd = kmalloc(512, GFP_KERNEL); vmu_flash_mtd->name = "Dreamcast VMU Flash"; /* This is 'other' */ vmu_flash_mtd->type = MTD_OTHER; vmu_flash_mtd->flags = 0; - vmu_flash_mtd->size = 1024 * 128; /* 128k */ - vmu_flash_mtd->erasesize = 512; + vmu_flash_mtd->size = VMU_NUM_BLOCKS * VMU_BLOCK_SIZE; + vmu_flash_mtd->erasesize = VMU_BLOCK_SIZE/card->writecnt; /* Mandatory functions */ vmu_flash_mtd->write = vmu_flash_write; @@ -605,7 +623,7 @@ /***********Maple device*****************/ -struct maple_driver dc_flashmap_driver = { +static struct maple_driver dc_flashmap_driver = { function:MAPLE_FUNC_MEMCARD, name:"VMU Flash Memory", connect:dc_flashmap_connect, |
From: Adrian M. <zx8...@us...> - 2002-08-30 23:31:55
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps In directory usw-pr-cvs1:/tmp/cvs-serv8706/drivers/mtd/maps Modified Files: vmu-flash.c Log Message: Further updates to VMU Flash driver Index: vmu-flash.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps/vmu-flash.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- vmu-flash.c 28 Aug 2002 00:02:53 -0000 1.4 +++ vmu-flash.c 30 Aug 2002 23:31:52 -0000 1.5 @@ -26,16 +26,29 @@ #define VMU_BLOCK_SIZE 0x200 /* Standard VMU block is 512 bytes */ /* Maple Device */ -static struct maple_device *vmu_flash_mdev __initdata = NULL; +struct maple_device *vmu_flash_mdev __initdata = NULL; /* MTD Information */ -static struct mtd_info *vmu_flash_mtd = NULL; +struct mtd_info *vmu_flash_mtd = NULL; + +/* Instance variables - not statics */ +struct mapleq *lastmq; +struct maple_driver dc_flashmap_driver; + +int flash_queried = 0; -/* Persistent result */ -static struct mapleq *lastmq; -static struct maple_driver dc_flashmap_driver; char *block_buffer = NULL; -int waken_up = 1; +/* Memory card details */ +typedef struct memcard_s { + long partitions; + long blocks; + long writecnt; + long readcnt; + long removable; +} memcard_t; + + + /* VMU Block */ typedef struct block_s { @@ -417,8 +430,22 @@ static void dc_flashmap_callback(struct maple_driver_data *data) { - struct mapleq *mq = &data->mq; + + if (flash_queried == 0) { + if (mq->recvbuf[0] == 5) { + int res = mq->recvbuf[0]; + + lastmq = mq; + flash_queried = 1; + wake_up_interruptible(&wq_mq); /* Wake sleeping code */ + return; + } + } + + + + if (mq->recvbuf[0] == 8) { /* int res = mq->recvbuf[0]; @@ -453,7 +480,58 @@ { printk ("Registering VMU Flash mapping and loading VMU Flash driver\n"); - /* Look for the flash */ + + /* What are the characteristics of the flash we have? */ + + + struct mapleq *mqu = (struct mapleq *) &(d->mq); + mqu->command = 1; + mqu->length = 0; + + + mqu->sendbuf = mqu->recvbuf; + if (maple_add_packet(mqu) != 0) { + printk(KERN_WARNING + "VMU FLASH: Could not add packet to query device\n"); + return -1; + } + + lastmq = NULL; + + do { + interruptible_sleep_on_timeout(&wq_mq, 1); + } while (lastmq == NULL); + + + /* Read off the flash data */ + unsigned long basic_flash_data = + be32_to_cpu(((unsigned long *) (lastmq->recvbuf))[4]); + /* Create a permanent record */ + + /* With thanks to Marcus Comstedt */ + + memcard_t *card = kmalloc(sizeof(memcard_t), GFP_KERNEL); + card->partitions = ((basic_flash_data >> 24) & 0xff) + 1; + printk("\tFlash device has %ld partitions\n", card->partitions); + card->blocks = (((basic_flash_data >> 16) & 0xff) + 1) << 5; + printk("\tFlash device has %ld blocks \n", card->blocks); + card->writecnt = (basic_flash_data >> 12) & 0xf; + printk("\tFlash device has write count of %ld\n", card->writecnt); + card->readcnt = (basic_flash_data >> 8) & 0xf; + printk("\tFlash device has read count of %ld\n", card->readcnt); + card->removable = (basic_flash_data >> 7) & 1; + printk("\tFlash device removable status is %ld\n", + card->removable); + + + + d->private_data = card; + + lastmq = NULL; + /* Now query each flash partition */ + + + /* Register the flash with mtd subsystem */ if (!vmu_flash_mtd) { /* Populate a mtd_info */ vmu_flash_mtd = kmalloc(1000, GFP_KERNEL); @@ -487,6 +565,7 @@ return -1; } + /* Create the cache */ vmu_cache = kmalloc(64, GFP_KERNEL); vmu_cache->buffer = kmalloc(512, GFP_KERNEL); @@ -518,13 +597,15 @@ kfree(vmu_cache->buffer); vmu_cache->valid = 0; kfree(vmu_cache); + kfree((struct memcard_t *) d->private_data); + flash_queried = 0; } /***********Maple device*****************/ -static struct maple_driver dc_flashmap_driver = { +struct maple_driver dc_flashmap_driver = { function:MAPLE_FUNC_MEMCARD, name:"VMU Flash Memory", connect:dc_flashmap_connect, |
From: Adrian M. <zx8...@us...> - 2002-08-30 23:31:55
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv8706 Modified Files: ChangeLog.dc Log Message: Further updates to VMU Flash driver Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- ChangeLog.dc 28 Aug 2002 00:02:53 -0000 1.38 +++ ChangeLog.dc 30 Aug 2002 23:31:52 -0000 1.39 @@ -1,3 +1,9 @@ +2002-08-31 Adrian McMenamin <ad...@mc...> + + Enhanced diagnostics of flash chips - reading now broadly works + + * drivers/mtd/maps/vmu-flash.c: Further code updates + 2002-08-28 Adrian McMenamin <ad...@mc...> * drivers/mtd/maps/vmu-flash.c: Updated code - almost works |
From: Adrian M. <zx8...@us...> - 2002-08-28 00:02:57
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps In directory usw-pr-cvs1:/tmp/cvs-serv14607/drivers/mtd/maps Modified Files: vmu-flash.c Log Message: Updated VMU Flash driver Index: vmu-flash.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps/vmu-flash.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- vmu-flash.c 24 Aug 2002 10:05:41 -0000 1.3 +++ vmu-flash.c 28 Aug 2002 00:02:53 -0000 1.4 @@ -43,6 +43,20 @@ unsigned int ofs; /* Block Offset */ } block_t; +typedef struct vmu_cache_s { + char *buffer; /* Cached memory block */ + unsigned int block; /* Which block was cached */ + unsigned long jiffies_atc; /* When was it cached */ + int valid; /* Cache currently valid? */ +} vmu_cache_t; + + +vmu_cache_t *vmu_cache = NULL; + +wait_queue_head_t wq_mq; +DECLARE_WAIT_QUEUE_HEAD(wq_mq); + + /*************************************/ /**********Read and write routines*************/ int maple_vmu_read_block(unsigned int num, u_char * buf) @@ -69,7 +83,10 @@ ((unsigned long *) (mqu->recvbuf))[0] = cpu_to_be32(MAPLE_FUNC_MEMCARD); - ((unsigned long *) (mqu->recvbuf))[1] = num; + + /* With thanks to KOS */ + ((unsigned long *) (mqu->recvbuf))[1] = + /*((num & 0xff) << 24) | ((num >> 8) << 16) */ num << 24; mqu->sendbuf = mqu->recvbuf; if (maple_add_packet(mqu) != 0) { printk(KERN_WARNING "VMU FLASH: Could not add packet\n"); @@ -77,22 +94,24 @@ } lastmq = NULL; - wait_queue_head_t wq_mq; - init_waitqueue_head(&wq_mq); + do { interruptible_sleep_on_timeout(&wq_mq, 1); } while (lastmq == NULL); /* Now check if we've got a proper return */ - if (block_buffer){ - memcpy(block_buffer, buf, 512); - kfree(block_buffer); - block_buffer = NULL; - return 0; + if (block_buffer) { + memcpy(block_buffer, buf, 512); + kfree(block_buffer); + block_buffer = NULL; + return 0; } - printk(KERN_WARNING "VMU FLASH: Read has failed\n"); + printk(KERN_WARNING + "VMU FLASH: Read has failed - return is 0x%X\n", + lastmq->recvbuf[0]); + printk(KERN_WARNING "ERROR code is 0x%X\n", lastmq->recvbuf[1]); return -1; @@ -195,6 +214,7 @@ * Reads a byte from a VMU at the specified offset. * */ + static __u8 vmu_flash_read8(unsigned long ofs, long *retval) { block_t *block; @@ -209,6 +229,27 @@ *retval = 1; return -1; } + + /* Is this cached? */ + if (vmu_cache->valid) { + if (vmu_cache->block == block->num) { + if ((vmu_cache->jiffies_atc + 10) >= jiffies) { /* short lifespan */ + memcpy(vmu_cache->buffer, buf, 512); + u_char *buf2 = buf; + buf2 += block->ofs; + + kfree(block); + __u8 ret = (__u8) * buf2; + kfree(buf); + + return ret; + } else + vmu_cache->valid = 0; /* Force a read faster */ + } + } + + + /* Read the block */ if (maple_vmu_read_block(block->num, buf) == -1) { printk(KERN_WARNING "Can't read block: %d\n", block->num); @@ -221,7 +262,7 @@ buf2 += block->ofs; kfree(block); - __u8 ret = (__u8) *buf2; + __u8 ret = (__u8) * buf2; kfree(buf); return ret; @@ -251,6 +292,7 @@ return; } + /* Read the block */ if (maple_vmu_read_block(block->num, buf)) { printk(KERN_WARNING "Can't read block: %d\n", block->num); @@ -276,38 +318,39 @@ /* Read and Write routines */ int vmu_flash_read(struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, u_char * buf) + size_t * retlen, u_char * buf) { - printk("Reading from %llx with length %llx\n", from, len); + /* printk("Reading from %llx with length %llx\n", from, len); */ if (len < 1) return -1; - if (len > (128 * 1024)) len = 128 * 1024; - int start_here = (int)(from & 0xffffffff); + if (len > (128 * 1024)) + len = 128 * 1024; + int start_here = (int) (from & 0xffffffff); long retval = 0; int index = 0; do { - u8 cx = vmu_flash_read8(start_here + index, &retval ); - if (retval){ - *retlen = index; - return -1; + u8 cx = vmu_flash_read8(start_here + index, &retval); + if (retval) { + *retlen = index; + return -1; } memset(buf + index, cx, 1); index++; } while (len > index); - *retlen = index; + *retlen = index; return 0; } -int vmu_flash_write(struct mtd_info *mtd, loff_t to, size_t *retlen, size_t len, - const u_char * buf) +int vmu_flash_write(struct mtd_info *mtd, loff_t from, size_t len, + size_t * retlen, const u_char * buf) { if (len < 1) return -1; int index = 0; do { - vmu_flash_write8(buf[index], to + index); + vmu_flash_write8(buf[index], from + index); index++; } while (len > index); *retlen = index; @@ -316,9 +359,9 @@ int vmu_flash_erase(struct mtd_info *mtd, struct erase_info *erase) { - int *z = (int *)kmalloc(4, GFP_KERNEL); - vmu_flash_write(mtd, erase->addr, erase->len, z, "\0"); - kfree(z); + int z; + vmu_flash_write(mtd, erase->addr, erase->len, &z, "\0"); + return 0; } @@ -377,16 +420,31 @@ struct mapleq *mq = &data->mq; if (mq->recvbuf[0] == 8) { + /* int res = mq->recvbuf[0]; + + printk + ("Maple reply (%d, %d) cmd=%d => %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n", + mq->port, mq->unit, mq->command, res, mq->recvbuf[1], + mq->recvbuf[2], mq->recvbuf[3], mq->recvbuf[4], + mq->recvbuf[5], mq->recvbuf[6], mq->recvbuf[7], + mq->recvbuf[8], mq->recvbuf[9], mq->recvbuf[10], + mq->recvbuf[11]); + */ block_buffer = kmalloc(512, GFP_KERNEL); - /* How big a transfer is it? */ - memcpy(mq->recvbuf + 12, block_buffer, - (__u8)(mq->recvbuf[3]) * 2 - 8); - + /* Copy over */ + memcpy(mq->recvbuf + 12, block_buffer, 512); lastmq = mq; + wake_up_interruptible(&wq_mq); /* Wake sleeping code */ + memcpy(block_buffer, vmu_cache->buffer, 512); + vmu_cache->block = mq->recvbuf[11] & 0xff; + vmu_cache->jiffies_atc = jiffies; /* Mark the creation time */ + vmu_cache->valid = 1; /* Block is now valid */ return; - } + } lastmq = mq; + + } @@ -428,6 +486,12 @@ "VMU Flash driver initialisation failed\n"); return -1; } + + /* Create the cache */ + vmu_cache = kmalloc(64, GFP_KERNEL); + vmu_cache->buffer = kmalloc(512, GFP_KERNEL); + vmu_cache->valid = 0; + return 0; } @@ -449,6 +513,11 @@ kfree(vmu_flash_mtd); vmu_flash_mtd = NULL; } + + /* Clear the cache */ + kfree(vmu_cache->buffer); + vmu_cache->valid = 0; + kfree(vmu_cache); } |
From: Adrian M. <zx8...@us...> - 2002-08-28 00:02:56
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv14607 Modified Files: ChangeLog.dc Log Message: Updated VMU Flash driver Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- ChangeLog.dc 24 Aug 2002 10:05:41 -0000 1.37 +++ ChangeLog.dc 28 Aug 2002 00:02:53 -0000 1.38 @@ -1,3 +1,7 @@ +2002-08-28 Adrian McMenamin <ad...@mc...> + + * drivers/mtd/maps/vmu-flash.c: Updated code - almost works + 2002-08-24 Adrian McMenamin <ad...@mc...> * drivers/mtd/maps/vmu-flash.c: Cleaned up kmalloc code @@ -61,7 +65,7 @@ 2002-03-20 Adrian McMenamin <ad...@mc...> - Changed config.in file to reflect Puru Puru diver only supports NAKI rockerpak at present + Changed config.in file to reflect Puru Puru driver only supports NAKI rockerpak at present * drivers/char/joystick/Config.in: Puru Puru pack driver support correctly described |
From: Adrian M. <zx8...@us...> - 2002-08-24 10:05:45
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv3694 Modified Files: ChangeLog.dc Log Message: Updated vmu-flash.c and made licencing clear for microphone.c Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- ChangeLog.dc 22 Aug 2002 22:20:18 -0000 1.36 +++ ChangeLog.dc 24 Aug 2002 10:05:41 -0000 1.37 @@ -1,3 +1,9 @@ +2002-08-24 Adrian McMenamin <ad...@mc...> + + * drivers/mtd/maps/vmu-flash.c: Cleaned up kmalloc code + * drivers/sound/microphone.c: Made clear this is licensed + under GPL + 2002-08-22 Adrian McMenamin <ad...@mc...> * drivers/sound/microphone.c: Very experimental microphone @@ -55,7 +61,7 @@ 2002-03-20 Adrian McMenamin <ad...@mc...> - Changed config.in file to reflect Puru Pur diver only supports NAKI rockerpak at present + Changed config.in file to reflect Puru Puru diver only supports NAKI rockerpak at present * drivers/char/joystick/Config.in: Puru Puru pack driver support correctly described |
From: Adrian M. <zx8...@us...> - 2002-08-24 10:05:45
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/sound In directory usw-pr-cvs1:/tmp/cvs-serv3694/drivers/sound Modified Files: microphone.c Log Message: Updated vmu-flash.c and made licencing clear for microphone.c Index: microphone.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/drivers/sound/microphone.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- microphone.c 22 Aug 2002 22:20:18 -0000 1.1 +++ microphone.c 24 Aug 2002 10:05:41 -0000 1.2 @@ -3,7 +3,7 @@ * for SEGA Dreamcast * Copyright (c) Adrian McMenamin, 2002 * - * This code is not for general release (yet) + * This code is licenced under the GPL v2 * No warranties of any kind offered * * |
From: Adrian M. <zx8...@us...> - 2002-08-24 10:05:44
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps In directory usw-pr-cvs1:/tmp/cvs-serv3694/drivers/mtd/maps Modified Files: vmu-flash.c Log Message: Updated vmu-flash.c and made licencing clear for microphone.c Index: vmu-flash.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps/vmu-flash.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- vmu-flash.c 22 Aug 2002 22:15:22 -0000 1.2 +++ vmu-flash.c 24 Aug 2002 10:05:41 -0000 1.3 @@ -199,7 +199,7 @@ { block_t *block; *retval = 0; - u_char *buf = kmalloc(GFP_KERNEL, 512); + u_char *buf = kmalloc(512, GFP_KERNEL); /* Find the block */ block = __ofs_to_block(ofs); @@ -240,7 +240,7 @@ static void vmu_flash_write8(__u8 d, unsigned long ofs) { block_t *block; - u_char *buf = kmalloc(GFP_KERNEL, 512); + u_char *buf = kmalloc(512, GFP_KERNEL); /* Find the block */ block = __ofs_to_block(ofs); @@ -316,7 +316,7 @@ int vmu_flash_erase(struct mtd_info *mtd, struct erase_info *erase) { - int *z = (int *)kmalloc(GFP_KERNEL, 4); + int *z = (int *)kmalloc(4, GFP_KERNEL); vmu_flash_write(mtd, erase->addr, erase->len, z, "\0"); kfree(z); return 0; @@ -377,7 +377,7 @@ struct mapleq *mq = &data->mq; if (mq->recvbuf[0] == 8) { - block_buffer = kmalloc(GFP_KERNEL, 512); + block_buffer = kmalloc(512, GFP_KERNEL); /* How big a transfer is it? */ memcpy(mq->recvbuf + 12, block_buffer, (__u8)(mq->recvbuf[3]) * 2 - 8); @@ -398,7 +398,7 @@ /* Look for the flash */ if (!vmu_flash_mtd) { /* Populate a mtd_info */ - vmu_flash_mtd = kmalloc(GFP_KERNEL, 1000); + vmu_flash_mtd = kmalloc(1000, GFP_KERNEL); vmu_flash_mtd->name = "Dreamcast VMU Flash"; /* This is 'other' */ |
From: Adrian M. <zx8...@us...> - 2002-08-22 22:20:21
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv32422 Modified Files: ChangeLog.dc Log Message: Experimental and non-working microphone driver Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- ChangeLog.dc 22 Aug 2002 22:15:23 -0000 1.35 +++ ChangeLog.dc 22 Aug 2002 22:20:18 -0000 1.36 @@ -1,5 +1,11 @@ 2002-08-22 Adrian McMenamin <ad...@mc...> + * drivers/sound/microphone.c: Very experimental microphone + driver code (not working at present) + + +2002-08-22 Adrian McMenamin <ad...@mc...> + * drivers/mtd/maps/vmu-flash.c: Updated and semi-working VMU flash driver |
From: Adrian M. <zx8...@us...> - 2002-08-22 22:20:21
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/sound In directory usw-pr-cvs1:/tmp/cvs-serv32422/drivers/sound Added Files: microphone.c Log Message: Experimental and non-working microphone driver --- NEW FILE: microphone.c --- /* * Microphone driver * for SEGA Dreamcast * Copyright (c) Adrian McMenamin, 2002 * * This code is not for general release (yet) * No warranties of any kind offered * * * Based on existing Maple device coding * Copyright MR Brown, YAEGASHI Takeshi and others * * */ #include <linux/kernel.h> #include <linux/slab.h> #include <linux/input.h> #include <linux/module.h> #include <linux/init.h> #include <linux/timer.h> #include <linux/maple.h> #include "sound_config.h" #define _DEBUG_ #ifdef _DEBUG_ #define DEBGM(fmt, args...) (printk(KERN_ERR fmt, ##args)) #else #define DEBGM(fmt, args...) ((void) 0) #endif /* Sound minor device number */ int mic_minor; struct dc_microphone { struct input_dev dev; struct maple_driver_data *data; unsigned char snd[1024]; int open; }; static struct dc_microphone *mic = NULL; static int length = 0; /* * Although this is a Maple * device, it has to connect * through to OSS driver to * be of any use to anybody * who uses standard sound * APIs */ static int mic_audio_open(struct inode *inode, struct file *file) { return 0; } static ssize_t mic_audio_read(struct file *filp, char *buf, size_t count, loff_t * f_pos) { /* Copy from maple generated buffer to OSS buffer and return */ int oldlength = length * 2; copy_to_user(buf, mic->snd, oldlength); length = 0; DEBGM("Length is...%i, count is...%i\n", oldlength, count); return oldlength + 2; } static int mic_audio_release(struct inode *inode, struct file *file) { return 0; } static int mic_audio_ioctl(struct inode *inode, struct file *filip, unsigned int cmd, unsigned long arg) { return -ENOTTY; } static int dc_microphone_open(struct input_dev *dev) { DEBGM("Microphone: open called by input susbsystem\n"); MOD_INC_USE_COUNT; return 0; } static void dc_microphone_release(struct input_dev *dev) { MOD_DEC_USE_COUNT; } static int dc_microphone_connect(struct maple_driver_data *d) { //unsigned long data = d->function_data; if (!(mic = kmalloc(sizeof(struct dc_microphone), GFP_KERNEL))) { DEBGM("Memory allocation failure\n"); return -ENOMEM; } memset(mic, 0, sizeof(struct dc_microphone)); mic->data = d; d->private_data = mic; mic->dev.private = mic; mic->dev.open = dc_microphone_open; mic->dev.close = dc_microphone_release; mic->dev.name = d->dev->product_name; mic->dev.event = NULL; mic->dev.idbus = BUS_MAPLE; /* input_register_device(&mic->dev); */ //printk("Connected...%s\n", mic->dev.name); return 0; } static void dc_microphone_disconnect(struct maple_driver_data *d) { struct dc_microphone *mic = d->private_data; /* input_unregister_device(&mic->dev); */ kfree(mic); } static void dc_microphone_callback(struct maple_driver_data *data) { //int x = 12; struct mapleq *mq = &data->mq; int res = mq->recvbuf[0]; printk ("Maple reply (%d, %d) cmd=%d => %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n", mq->port, mq->unit, mq->command, res, mq->recvbuf[1], mq->recvbuf[2], mq->recvbuf[3], mq->recvbuf[4], mq->recvbuf[5], mq->recvbuf[6], mq->recvbuf[7], mq->recvbuf[8], mq->recvbuf[9], mq->recvbuf[10], mq->recvbuf[11]); //printk("Next round %d, %d, %d, %d, %d, %d, %d, %d\n", mq->recvbuf[12], mq->recvbuf[13], mq->recvbuf[14], mq->recvbuf[15], mq->recvbuf[16], mq->recvbuf[17], mq->recvbuf[18], mq->recvbuf[19]); //unsigned long tmp=*(unsigned long *)0xA05F80C4; //printk("Gunport data is %d\n", tmp); /* if (res == 8) */ /* { */ /* for (x = 8; x < 32; x++) */ /* { */ /* printk("%d,", mq->recvbuf[x]); */ /* } */ /* printk("\n"); */ /* } */ } static int firstup = 0; void dc_microphone_vblank_callback(struct maple_driver_data *data) { if (data->mq.done) { data->mq.command = 15; data->mq.length = 2; ((unsigned long *) (data->mq.recvbuf))[0] = cpu_to_be32(MAPLE_FUNC_MICROPHONE); if (firstup == 0) ((unsigned long *) (data->mq.recvbuf))[1] = 0x00000501; else if (firstup == 1) { data->mq.command = 15; data->mq.length = 2; ((unsigned long *) (data->mq.recvbuf))[1] = 0x00000102; } else{ data->mq.command = 15; data->mq.length = 3; ((unsigned long *) (data->mq.recvbuf))[1] = 0x01020104; ((unsigned long *) (data->mq.recvbuf))[2] = 0x0001; ; /*65295 */ } /*printk("Send buffer is %i, %i\n", ((unsigned long *)(data->mq.recvbuf))[0], ((unsigned long *)(data->mq.recvbuf))[1]); */ /* 0x00 generates a -3 response 0x01 generates an 0x08 response - volume? 0x0101 returns 0x00 0x00 0x00 0x10 0x00 0x01 0x00 0x00 0x0201 returns 0x00 0x00 0x00 0x10 0x00 0x02 0x00 0x00 0x0301 returns 0x00 0x00 0x00 0x10 0x00 0x03 0x00 0x00 and so until 0x2001 returns -3 0x02 generates an 0x07 response 0x0002 returns 0x00 0x00 0x00 0x10 0x00 0x00 0x00 0x00 from 0x01 0x0102 returns 0x00 0x00 0x00 0x10 0x02 0x00 0x00 0x00 from 0x01 0x0202 returns -3 0x03 generates an 0x07 response 0x0103 generates an 0x07 response and default from 0x01 0x0203 generates an 0x07 response and default from 0x01 0x0303 as above 0x0403 as above 0x0503 as above 0x04 generates an 0x07 repsonse - bit size? 0x0104 generates 0x00 0x00 0x00 0x10 0x08 0x00 0x00 0x00 from 0x01 0x0204 generates 0x00 0x00 0x00 0x10 0x10 0x00 0x00 0x00 from 0x01 0x0304 generates -3 0x05 generates a -3 response 0x08 generates a -3 response 0x09 generates a -3 response */ data->mq.sendbuf = data->mq.recvbuf; if (maple_add_packet(&data->mq) != 0) printk("Could not add packet\n"); firstup++; if (firstup > 7) firstup = 0; } } static struct maple_driver dc_microphone_driver = { function:MAPLE_FUNC_MICROPHONE, name:"SoundInputPeripheral (S.I.P.)", connect:dc_microphone_connect, disconnect:dc_microphone_disconnect, reply:dc_microphone_callback, vblank:dc_microphone_vblank_callback, }; /* * Handle sound (OSS) * initialisation */ static struct file_operations mic_audio_fops = { owner:THIS_MODULE, open:mic_audio_open, release:mic_audio_release, read:mic_audio_read, ioctl:mic_audio_ioctl, }; /* TODO: Mixer registration */ static int attach_microphone() { printk("Microphone driver for SEGA Dreamcast, v 0.1.1\n"); /* Register with OSS */ mic_minor = register_sound_dsp(&mic_audio_fops, -1); if (mic_minor < 0) { DEBGM ("Maple: Could not register microphone with sound system.\n"); return -ENODEV; } return 0; } static int unload_microphone() { unregister_sound_dsp(mic_minor); return 0; } static int __init dc_microphone_init(void) { maple_register_driver(&dc_microphone_driver); if (attach_microphone()) { DEBGM("Maple: Failed to attach microphone\n"); return -ENOMEM; } return 0; } static void __exit dc_microphone_exit(void) { maple_unregister_driver(&dc_microphone_driver); if (unload_microphone()) { DEBGM("Maple: Microphone did not unload cleanly\n"); } } module_init(dc_microphone_init); module_exit(dc_microphone_exit); MODULE_AUTHOR("Adrian McMenamin <ad...@mc...>"); MODULE_DESCRIPTION("SEGA Dreamcast microphone driver"); |
From: Adrian M. <zx8...@us...> - 2002-08-22 22:15:29
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps In directory usw-pr-cvs1:/tmp/cvs-serv31168/drivers/mtd/maps Modified Files: vmu-flash.c Log Message: Updated and almost working VMU Flash driver Index: vmu-flash.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps/vmu-flash.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- vmu-flash.c 28 Sep 2001 06:31:47 -0000 1.1 +++ vmu-flash.c 22 Aug 2002 22:15:22 -0000 1.2 @@ -2,6 +2,10 @@ * drivers/mtd/maps/vmu-flash.c * * (C)opyright 2001 Paul Mundt <le...@ch...> + + + + + + Messed about with and fragments copyright 2002, Adrian McMenamin <ad...@mc...> + + * * Flash mapping handler for the Sega Dreamcast VMU. * @@ -26,12 +30,111 @@ /* MTD Information */ static struct mtd_info *vmu_flash_mtd = NULL; +/* Persistent result */ +static struct mapleq *lastmq; +static struct maple_driver dc_flashmap_driver; +char *block_buffer = NULL; + +int waken_up = 1; + /* VMU Block */ typedef struct block_s { unsigned int num; /* Block Number */ unsigned int ofs; /* Block Offset */ } block_t; +/*************************************/ +/**********Read and write routines*************/ +int maple_vmu_read_block(unsigned int num, u_char * buf) +{ + + /* async maple call + assemble maple call + wait for return */ + + + /* Sanity check */ + if (!vmu_flash_mtd) { + printk(KERN_WARNING + "VMU FLASH: Attempting to read data without having set up mtd.\n"); + return -1; + } + + struct maple_driver_data *mdd = + (struct maple_driver_data *) (vmu_flash_mtd->priv); + struct mapleq *mqu = (struct mapleq *) &(mdd->mq); + mqu->command = 11; + mqu->length = 2; + + ((unsigned long *) (mqu->recvbuf))[0] = + cpu_to_be32(MAPLE_FUNC_MEMCARD); + + ((unsigned long *) (mqu->recvbuf))[1] = num; + mqu->sendbuf = mqu->recvbuf; + if (maple_add_packet(mqu) != 0) { + printk(KERN_WARNING "VMU FLASH: Could not add packet\n"); + return -1; + } + + lastmq = NULL; + wait_queue_head_t wq_mq; + init_waitqueue_head(&wq_mq); + do { + interruptible_sleep_on_timeout(&wq_mq, 1); + } while (lastmq == NULL); + + /* Now check if we've got a proper return */ + + if (block_buffer){ + memcpy(block_buffer, buf, 512); + kfree(block_buffer); + block_buffer = NULL; + return 0; + } + + printk(KERN_WARNING "VMU FLASH: Read has failed\n"); + + return -1; + +} + +int maple_vmu_write_block(unsigned int num, u_char * buf) +{ + + /* This function does not have to sleep */ + + /* Sanity check */ + if (!vmu_flash_mtd) { + printk(KERN_WARNING + "VMU FLASH: Attempting to write data without having set up mtd.\n"); + return -1; + } + + struct maple_driver_data *mdd = + (struct maple_driver_data *) (vmu_flash_mtd->priv); + struct mapleq *mqu = (struct mapleq *) &(mdd->mq); + mqu->command = 12; + mqu->length = 514; + + ((unsigned long *) (mqu->recvbuf))[0] = + cpu_to_be32(MAPLE_FUNC_MEMCARD); + + ((unsigned long *) (mqu->recvbuf))[1] = num; + memcpy((mqu->recvbuf) + 8, buf, 512); + + mqu->sendbuf = mqu->recvbuf; + if (maple_add_packet(mqu) != 0) { + printk(KERN_WARNING "VMU FLASH: Could not add packet\n"); + return -1; + } + + return 0; + +} + +/*************************************/ + + /** * __ofs_to_block - Offset to Block Conversion * @@ -56,27 +159,29 @@ /* Zero the block */ memset(block, 0, sizeof(struct block_s)); - + /* Make sure we don't overstep our boundaries */ if (src_ofs >= VMU_NUM_BLOCKS * VMU_BLOCK_SIZE) { - printk(KERN_WARNING "Source offset exceeds total offset\n"); + printk(KERN_WARNING + "Source offset exceeds total offset\n"); kfree(block); return NULL; } /* Find the block number */ - block->num = (unsigned int)(src_ofs / VMU_BLOCK_SIZE); + block->num = (unsigned int) (src_ofs / VMU_BLOCK_SIZE); /* Validate we've got a valid block */ if (block->num > VMU_NUM_BLOCKS) { - printk(KERN_WARNING "Block number exceeds number of blocks\n"); + printk(KERN_WARNING + "Block number exceeds number of blocks\n"); kfree(block); return NULL; } - + /* Calculate remaining offset in block */ - block->ofs = (unsigned int)(src_ofs % VMU_BLOCK_SIZE); - + block->ofs = (unsigned int) (src_ofs % VMU_BLOCK_SIZE); + return block; } @@ -90,33 +195,36 @@ * Reads a byte from a VMU at the specified offset. * */ -static __u8 vmu_flash_read8(struct map_info *map, unsigned long ofs) +static __u8 vmu_flash_read8(unsigned long ofs, long *retval) { block_t *block; - u_char *buf = NULL; - + *retval = 0; + u_char *buf = kmalloc(GFP_KERNEL, 512); /* Find the block */ block = __ofs_to_block(ofs); /* Validate it was found */ if (!block) { printk(KERN_WARNING "Got an invalid block\n"); - return 1; + *retval = 1; + return -1; } - /* Read the block */ - if (maple_vmu_read_block(vmu_flash_mdev, block->num, buf)) { + if (maple_vmu_read_block(block->num, buf) == -1) { printk(KERN_WARNING "Can't read block: %d\n", block->num); kfree(block); - return 1; + *retval = 2; + return -1; } - /* Handle the remaining offset */ - buf += block->ofs; - + u_char *buf2 = buf; + buf2 += block->ofs; + kfree(block); + __u8 ret = (__u8) *buf2; + kfree(buf); - return (__u8)(*buf); + return ret; } /** @@ -129,10 +237,10 @@ * Writes a byte to a VMU at the specified offset. * */ -static void vmu_flash_write8(struct map_info *map, __u8 d, unsigned long ofs) +static void vmu_flash_write8(__u8 d, unsigned long ofs) { block_t *block; - u_char *buf = NULL; + u_char *buf = kmalloc(GFP_KERNEL, 512); /* Find the block */ block = __ofs_to_block(ofs); @@ -144,31 +252,80 @@ } /* Read the block */ - if (maple_vmu_read_block(vmu_flash_mdev, block->num, buf)) { + if (maple_vmu_read_block(block->num, buf)) { printk(KERN_WARNING "Can't read block: %d\n", block->num); kfree(block); return; } /* Copy the byte to the block */ - (__u8)(*(buf + block->ofs)) = d; + (__u8) (*(buf + block->ofs)) = d; /* Write the block */ - if (maple_vmu_write_block(vmu_flash_mdev, block->num, buf)) { + if (maple_vmu_write_block(block->num, buf)) { printk(KERN_WARNING "Can't write block: %d\n", block->num); kfree(block); return; } kfree(block); + kfree(buf); } -static struct map_info vmu_flash_map = { - name: "VMU Flash", - size: VMU_NUM_BLOCKS * VMU_BLOCK_SIZE, - read8: vmu_flash_read8, - write8: vmu_flash_write8, -}; +/***********************************************/ +/* Read and Write routines */ + +int vmu_flash_read(struct mtd_info *mtd, loff_t from, size_t len, + size_t *retlen, u_char * buf) +{ + printk("Reading from %llx with length %llx\n", from, len); + if (len < 1) + return -1; + if (len > (128 * 1024)) len = 128 * 1024; + int start_here = (int)(from & 0xffffffff); + long retval = 0; + int index = 0; + do { + u8 cx = vmu_flash_read8(start_here + index, &retval ); + if (retval){ + *retlen = index; + return -1; + } + memset(buf + index, cx, 1); + index++; + } while (len > index); + *retlen = index; + return 0; + +} + + +int vmu_flash_write(struct mtd_info *mtd, loff_t to, size_t *retlen, size_t len, + const u_char * buf) +{ + if (len < 1) + return -1; + int index = 0; + do { + vmu_flash_write8(buf[index], to + index); + index++; + } while (len > index); + *retlen = index; + return 0; +} + +int vmu_flash_erase(struct mtd_info *mtd, struct erase_info *erase) +{ + int *z = (int *)kmalloc(GFP_KERNEL, 4); + vmu_flash_write(mtd, erase->addr, erase->len, z, "\0"); + kfree(z); + return 0; +} + +void vmu_flash_sync(struct mtd_info *mtd) +{ + /* Do nothing */ +} /** * vmu_flash_map_init - Initialization @@ -178,27 +335,18 @@ */ static int __init vmu_flash_map_init(void) { - printk(KERN_NOTICE "Regestering VMU flash mapping\n"); + printk(KERN_NOTICE "VMU flash driver available\n"); + maple_register_driver(&dc_flashmap_driver); /* FIXME: We need to do something with the vmu_flash_mdev */ - /* Look for the flash */ - vmu_flash_mtd = do_map_probe("cfi", &vmu_flash_map); - /* See if it's valid */ - if (!vmu_flash_mtd) { - printk(KERN_ERR "Failed to setup flash map\n"); - return -ENXIO; - } - - vmu_flash_mtd->module = THIS_MODULE; - - /* Register with MTD */ - add_mtd_device(vmu_flash_mtd); return 0; } + + /** * vmu_flash_map_exit - Cleanup * @@ -208,7 +356,7 @@ static void __exit vmu_flash_map_exit(void) { printk(KERN_NOTICE "Unregestering VMU flash mapping\n"); - + maple_unregister_driver(&dc_flashmap_driver); /* See if there's anything to unregister */ if (!vmu_flash_mtd) { printk(KERN_WARNING "Nothing to unregister\n"); @@ -220,6 +368,107 @@ map_destroy(vmu_flash_mtd); } +/***********Maple functions***************/ + + +static void dc_flashmap_callback(struct maple_driver_data *data) +{ + + + struct mapleq *mq = &data->mq; + if (mq->recvbuf[0] == 8) { + block_buffer = kmalloc(GFP_KERNEL, 512); + /* How big a transfer is it? */ + memcpy(mq->recvbuf + 12, block_buffer, + (__u8)(mq->recvbuf[3]) * 2 - 8); + + + lastmq = mq; + return; + } + lastmq = mq; +} + + + +static int dc_flashmap_connect(struct maple_driver_data *d) +{ + printk + ("Registering VMU Flash mapping and loading VMU Flash driver\n"); + /* Look for the flash */ + if (!vmu_flash_mtd) { + /* Populate a mtd_info */ + vmu_flash_mtd = kmalloc(GFP_KERNEL, 1000); + vmu_flash_mtd->name = "Dreamcast VMU Flash"; + + /* This is 'other' */ + vmu_flash_mtd->type = MTD_OTHER; + vmu_flash_mtd->flags = 0; + vmu_flash_mtd->size = 1024 * 128; /* 128k */ + vmu_flash_mtd->erasesize = 512; + + /* Mandatory functions */ + vmu_flash_mtd->write = vmu_flash_write; + vmu_flash_mtd->read = vmu_flash_read; + vmu_flash_mtd->erase = vmu_flash_erase; + vmu_flash_mtd->sync = vmu_flash_sync; + /* Use private data to point to d */ + vmu_flash_mtd->priv = d; + } + + + vmu_flash_mtd->module = THIS_MODULE; + + /* Register with MTD */ + add_mtd_device(vmu_flash_mtd); + /* Lock the device in */ + vmu_flash_mtd = get_mtd_device(vmu_flash_mtd, -1); + if (!vmu_flash_mtd) { + printk(KERN_ERR + "VMU Flash driver initialisation failed\n"); + return -1; + } + return 0; +} + +static void dc_flashmap_disconnect(struct maple_driver_data *d) +{ + printk(KERN_NOTICE "Unregistering VMU flash mapping\n"); + + /* See if there's anything to unregister */ + if (!vmu_flash_mtd) { + printk(KERN_WARNING "Nothing to unregister\n"); + return; + } + + + if (vmu_flash_mtd) { + /* Unregister from MTD */ + put_mtd_device(vmu_flash_mtd); + del_mtd_device(vmu_flash_mtd); + kfree(vmu_flash_mtd); + vmu_flash_mtd = NULL; + } + + +} + + +/***********Maple device*****************/ +static struct maple_driver dc_flashmap_driver = { + function:MAPLE_FUNC_MEMCARD, + name:"VMU Flash Memory", + connect:dc_flashmap_connect, + disconnect:dc_flashmap_disconnect, + reply:dc_flashmap_callback, + + +}; + + + + + + module_init(vmu_flash_map_init); module_exit(vmu_flash_map_exit); - |
From: Adrian M. <zx8...@us...> - 2002-08-22 22:15:29
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv31168 Modified Files: ChangeLog.dc Log Message: Updated and almost working VMU Flash driver Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- ChangeLog.dc 1 May 2002 19:00:09 -0000 1.34 +++ ChangeLog.dc 22 Aug 2002 22:15:23 -0000 1.35 @@ -1,3 +1,9 @@ +2002-08-22 Adrian McMenamin <ad...@mc...> + + * drivers/mtd/maps/vmu-flash.c: Updated and semi-working VMU + flash driver + + 2002-05-01 Paul Mundt <le...@ch...> * Makefile: Set ARCH explicitly to sh. |
From: M. R. B. <mr...@us...> - 2002-05-01 19:00:20
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv22002 Modified Files: ChangeLog.dc Log Message: Fix offset for 0x1fx address Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- ChangeLog.dc 1 May 2002 18:36:23 -0000 1.33 +++ ChangeLog.dc 1 May 2002 19:00:09 -0000 1.34 @@ -14,6 +14,9 @@ 2002-05-01 M. R. Brown <mr...@0x...> + * arch/sh/kernel/io_dc.c (dreamcast_isa_port2addr): Fixed offset + returned for 0x1f0-0x1f7 addresses. + Initial IDE support. * include/asm-sh/ide.h (ide_default_irq_dreamcast): New function. |
From: M. R. B. <mr...@us...> - 2002-05-01 19:00:19
|
Update of /cvsroot/linuxdc/linux-sh-dc/arch/sh/kernel In directory usw-pr-cvs1:/tmp/cvs-serv22002/arch/sh/kernel Modified Files: io_dc.c Log Message: Fix offset for 0x1fx address Index: io_dc.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/arch/sh/kernel/io_dc.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- io_dc.c 1 May 2002 18:36:23 -0000 1.1 +++ io_dc.c 1 May 2002 19:00:10 -0000 1.2 @@ -12,7 +12,7 @@ unsigned long dreamcast_isa_port2addr(unsigned long offset) { if ((offset >= 0x1f0) && (offset <= 0x1f7)) { - return EXTERNAL_IDE_BASE + offset; + return EXTERNAL_IDE_BASE + (offset - 0x1f0); } if (offset == 0x3f6) { return EXTERNAL_IDE_ALTSTAT; |
From: M. R. B. <mr...@us...> - 2002-05-01 18:36:32
|
Update of /cvsroot/linuxdc/linux-sh-dc/include/asm-sh In directory usw-pr-cvs1:/tmp/cvs-serv12155/include/asm-sh Modified Files: dc_sysasic.h Added Files: ide.h Log Message: Initial IDE support --- NEW FILE: ide.h --- /* * linux/include/asm-sh/ide.h * * Copyright (C) 1994-1996 Linus Torvalds & authors */ /* * This file contains the i386 architecture specific IDE code. * In future, SuperH code. */ #ifndef __ASM_SH_IDE_H #define __ASM_SH_IDE_H #ifdef __KERNEL__ #include <linux/config.h> #include <asm/machvec.h> #include <asm/dc_sysasic.h> #ifndef MAX_HWIFS /* Should never have less than 2, ide-pci.c(ide_match_hwif) requires it */ #define MAX_HWIFS 2 #endif #define ide__sti() __sti() static __inline__ int ide_default_irq_hp600(ide_ioreg_t base) { switch (base) { case 0x01f0: return 93; case 0x0170: return 94; default: return 0; } } static __inline__ int ide_default_irq_dreamcast(ide_ioreg_t base) { switch (base) { case 0x1f0: return HW_EVENT_EXT0; case 0x170: return HW_EVENT_EXT1; default: return 0; } } static __inline__ int ide_default_irq(ide_ioreg_t base) { if (MACH_HP600) { return ide_default_irq_hp600(base); } if (MACH_DREAMCAST) { return ide_default_irq_dreamcast(base); } switch (base) { case 0x01f0: return 14; case 0x0170: return 15; default: return 0; } } static __inline__ ide_ioreg_t ide_default_io_base_hp600(int index) { switch (index) { case 0: return 0x01f0; case 1: return 0x0170; default: return 0; } } static __inline__ ide_ioreg_t ide_default_io_base(int index) { if (MACH_HP600) { return ide_default_io_base_hp600(index); } switch (index) { case 0: return 0x1f0; case 1: return 0x170; default: return 0; } } static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq) { ide_ioreg_t reg = data_port; int i; for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { hw->io_ports[i] = reg; reg += 1; } if (ctrl_port) { hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; } else { hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; } if (irq != NULL) *irq = 0; hw->io_ports[IDE_IRQ_OFFSET] = 0; } static __inline__ void ide_init_default_hwifs(void) { #ifndef CONFIG_BLK_DEV_IDEPCI hw_regs_t hw; int index; for(index = 0; index < MAX_HWIFS; index++) { ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL); hw.irq = ide_default_irq(ide_default_io_base(index)); ide_register_hw(&hw, NULL); } #endif /* CONFIG_BLK_DEV_IDEPCI */ } typedef union { unsigned all : 8; /* all of the bits together */ struct { unsigned head : 4; /* always zeros here */ unsigned unit : 1; /* drive select number, 0 or 1 */ unsigned bit5 : 1; /* always 1 */ unsigned lba : 1; /* using LBA instead of CHS */ unsigned bit7 : 1; /* always 1 */ } b; } select_t; #define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) #define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id)) #define ide_check_region(from,extent) check_region((from), (extent)) #define ide_request_region(from,extent,name) request_region((from), (extent), (name)) #define ide_release_region(from,extent) release_region((from), (extent)) /* * The following are not needed for the non-m68k ports */ #define ide_ack_intr(hwif) (1) #define ide_fix_driveid(id) do {} while (0) #define ide_release_lock(lock) do {} while (0) #define ide_get_lock(lock, hdlr, data) do {} while (0) #endif /* __KERNEL__ */ #endif /* __ASM_SH_IDE_H */ Index: dc_sysasic.h =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/include/asm-sh/dc_sysasic.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- dc_sysasic.h 1 Oct 2001 07:51:10 -0000 1.3 +++ dc_sysasic.h 1 May 2002 18:36:23 -0000 1.4 @@ -30,6 +30,7 @@ /* IRQ 11 */ #define HW_EVENT_GDROM_CMD (HW_EVENT_IRQ_BASE + 32) /* GD-ROM cmd. complete */ #define HW_EVENT_AICA_SYS (HW_EVENT_IRQ_BASE + 33) /* AICA-related */ -#define HW_EVENT_EXTERNAL (HW_EVENT_IRQ_BASE + 35) /* Ext. (expansion) */ +#define HW_EVENT_EXT0 (HW_EVENT_IRQ_BASE + 34) /* External 0 (modem) */ +#define HW_EVENT_EXT1 (HW_EVENT_IRQ_BASE + 35) /* External 1 (BBA) */ #define HW_EVENT_IRQ_MAX (HW_EVENT_IRQ_BASE + 95) |
From: M. R. B. <mr...@us...> - 2002-05-01 18:36:32
|
Update of /cvsroot/linuxdc/linux-sh-dc/arch/sh/kernel In directory usw-pr-cvs1:/tmp/cvs-serv12155/arch/sh/kernel Modified Files: pci-dc.c Added Files: io_dc.c Log Message: Initial IDE support --- NEW FILE: io_dc.c --- /* * $Id: io_dc.c,v 1.1 2002/05/01 18:36:23 mrbrown Exp $ * I/O routines for SEGA Dreamcast */ #include <asm/io.h> #include <asm/machvec.h> #define EXTERNAL_IDE_BASE 0xb4000020 #define EXTERNAL_IDE_ALTSTAT 0xb4000058 unsigned long dreamcast_isa_port2addr(unsigned long offset) { if ((offset >= 0x1f0) && (offset <= 0x1f7)) { return EXTERNAL_IDE_BASE + offset; } if (offset == 0x3f6) { return EXTERNAL_IDE_ALTSTAT; } return offset + 0xa0000000; } Index: pci-dc.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/arch/sh/kernel/pci-dc.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pci-dc.c 1 Oct 2001 07:51:10 -0000 1.1 +++ pci-dc.c 1 May 2002 18:36:23 -0000 1.2 @@ -21,7 +21,7 @@ #define GAPSPCI_DMA_SIZE 32768 #define GAPSPCI_BBA_CONFIG 0x01001600 -#define GAPSPCI_IRQ HW_EVENT_EXTERNAL +#define GAPSPCI_IRQ HW_EVENT_EXT1 static int gapspci_dma_used; |
From: M. R. B. <mr...@us...> - 2002-05-01 18:36:30
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv12155 Modified Files: ChangeLog.dc Log Message: Initial IDE support Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- ChangeLog.dc 1 May 2002 16:32:27 -0000 1.32 +++ ChangeLog.dc 1 May 2002 18:36:23 -0000 1.33 @@ -14,6 +14,18 @@ 2002-05-01 M. R. Brown <mr...@0x...> + Initial IDE support. + + * include/asm-sh/ide.h (ide_default_irq_dreamcast): New function. + (ide_default_irq): Added check for MACH_DREAMCAST. + * include/asm-sh/dc_sysasic.h: Added HW_EVENT_EXT0. Renamed + HW_EVENT_EXTERNAL to HW_EVENT_EXT1. + * arch/sh/kernel/pci-dc.c: We now use HW_EVENT_EXT1. + * arch/sh/kernel/io_dc.c (dreamcast_isa_port2addr): Added checks for + primary IDE command and control (status) registers. + * include/asm-sh/ide.h, arch/sh/kernel/io_dc.c: Imported from LinuxSH + 2.4.18. + * Makefile: Added. Add "-dc" to EXTRAVERSION to distinguish ourselves from LinuxSH kernels. |
From: Paul M. <le...@us...> - 2002-05-01 16:32:33
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv5554 Modified Files: ChangeLog.dc Makefile Log Message: ARCH=sh. Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- ChangeLog.dc 1 May 2002 16:01:26 -0000 1.31 +++ ChangeLog.dc 1 May 2002 16:32:27 -0000 1.32 @@ -1,5 +1,7 @@ 2002-05-01 Paul Mundt <le...@ch...> + * Makefile: Set ARCH explicitly to sh. + * drivers/maple/maple.c: Add a MODULE_LICENSE() tag to avoid accidentally tainting the kernel. Index: Makefile =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 1 May 2002 10:25:35 -0000 1.1 +++ Makefile 1 May 2002 16:32:27 -0000 1.2 @@ -5,7 +5,7 @@ KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) -ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) +ARCH := sh KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//g") CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ |
From: Paul M. <le...@us...> - 2002-05-01 16:01:33
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/maple In directory usw-pr-cvs1:/tmp/cvs-serv27583/drivers/maple Modified Files: maple.c Log Message: Further cleanup. Make sure to free all those fun happy things that are allocated. Make sure to shoot kmapled on request_irq() failure, etc. Index: maple.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/drivers/maple/maple.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- maple.c 1 May 2002 15:47:13 -0000 1.6 +++ maple.c 1 May 2002 16:01:26 -0000 1.7 @@ -449,8 +449,12 @@ return 0; cleanup: + if (maple_sendbuf) + free_pages((unsigned long)maple_sendbuf, MAPLE_DMA_PAGES); + printk(KERN_INFO "maple: Register failed\n"); - return -ENOMEM; + + return -EINVAL; } static void exit_maple_low(void) @@ -1026,10 +1030,17 @@ return 0; - cleanup: - /* XXX: Must do proper clean-up */ +cleanup: + if (kmapled_pid) { + kill_proc(kmapled_pid, SIGTERM, 1); + wait_for_completion(&kmapled_exited); + } + + exit_maple_low(); + printk(KERN_INFO "maple: Register failed\n"); - return -ENOMEM; + + return -EINVAL; } |
From: Paul M. <le...@us...> - 2002-05-01 16:01:32
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv27583 Modified Files: ChangeLog.dc Log Message: Further cleanup. Make sure to free all those fun happy things that are allocated. Make sure to shoot kmapled on request_irq() failure, etc. Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- ChangeLog.dc 1 May 2002 15:47:13 -0000 1.30 +++ ChangeLog.dc 1 May 2002 16:01:26 -0000 1.31 @@ -2,6 +2,13 @@ * drivers/maple/maple.c: Add a MODULE_LICENSE() tag to avoid accidentally tainting the kernel. + + (maple_init): Further cleanup. Make sure kmapled gets shot when + request_irq() fails .. also remember to exit_maple_low() to get + rid of some of those pesky allocations. + + (init_maple_low): Free up maple_sendbuf in the event that + request_irq() fails. 2002-05-01 M. R. Brown <mr...@0x...> |
From: Paul M. <le...@us...> - 2002-05-01 15:47:18
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv22561 Modified Files: ChangeLog.dc Log Message: Add a MODULE_LICENSE() tag. Tainted kernel == instant unhapiness. Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- ChangeLog.dc 1 May 2002 10:25:35 -0000 1.29 +++ ChangeLog.dc 1 May 2002 15:47:13 -0000 1.30 @@ -1,3 +1,8 @@ +2002-05-01 Paul Mundt <le...@ch...> + + * drivers/maple/maple.c: Add a MODULE_LICENSE() tag to avoid + accidentally tainting the kernel. + 2002-05-01 M. R. Brown <mr...@0x...> * Makefile: Added. Add "-dc" to EXTRAVERSION to distinguish ourselves |
From: Paul M. <le...@us...> - 2002-05-01 15:47:18
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/maple In directory usw-pr-cvs1:/tmp/cvs-serv22561/drivers/maple Modified Files: maple.c Log Message: Add a MODULE_LICENSE() tag. Tainted kernel == instant unhapiness. Index: maple.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/drivers/maple/maple.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- maple.c 3 Feb 2002 07:46:40 -0000 1.5 +++ maple.c 1 May 2002 15:47:13 -0000 1.6 @@ -1049,6 +1049,8 @@ module_init(maple_init); module_exit(maple_exit); +MODULE_LICENSE("GPL"); + EXPORT_SYMBOL(maple_init_mq); EXPORT_SYMBOL(maple_allocq); EXPORT_SYMBOL(maple_freeq); |