2003-09-23 Marcel Telka <marcel@telka.sk>

* flash/amd.c (amd_flash_autodetect16): New function (Bradley D. LaRonde).
	(amd_flash_print_info): Added support for Am29LV800B (Bradley D. LaRonde).
	(amd_16_flash_driver): New driver (Bradley D. LaRonde).
	* flash/jedec.c: New file (Bradley D. LaRonde).
	* flash/detectflash.c (detectflash): Added jedec_detect() call.
	* Makefile.am (libbrux_a_SOURCES): Added flash/jedec.c.


git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@569 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Marcel Telka 21 years ago
parent 3a1bb84aa4
commit 414b50e704

@ -1,3 +1,12 @@
2003-09-23 Marcel Telka <marcel@telka.sk>
* flash/amd.c (amd_flash_autodetect16): New function (Bradley D. LaRonde).
(amd_flash_print_info): Added support for Am29LV800B (Bradley D. LaRonde).
(amd_16_flash_driver): New driver (Bradley D. LaRonde).
* flash/jedec.c: New file (Bradley D. LaRonde).
* flash/detectflash.c (detectflash): Added jedec_detect() call.
* Makefile.am (libbrux_a_SOURCES): Added flash/jedec.c.
2003-09-15 Marcel Telka <marcel@telka.sk>
* cmd/help.c (cmd_help_run): Fixed spelling (patch 805108, Andreas Mohr).

@ -37,6 +37,7 @@ libbrux_a_SOURCES = \
cmd/quit.c \
cmd/cmd_detectflash.c \
flash/cfi.c \
flash/jedec.c \
flash/detectflash.c \
flash/amd.c \
flash/intel.c

@ -1,5 +1,8 @@
$Id$
2003-09-23: Added initial JEDEC detection for flash chips (Bradley D. LaRonde).
2003-09-23: Added support for AMD Am29LV800B flash (Bradley D. LaRonde).
2003-09-23: Added support for 1 x 16 AMD flash (Bradley D. LaRonde).
2003-09-15: Fixed spelling (patch 805108, Andreas Mohr).
2003-08-13: Added support for Intel SCS command set (patch 787978, Jani Monoses).
2003-08-11: Added support for 1 x 8 bit AMD Flash (patch 772499, Matan Ziv-Av).

@ -1,5 +1,6 @@
$Id$
Bradley D. LaRonde
Andreas Mohr
Jani Monoses
Matan Ziv-Av

@ -58,7 +58,15 @@ static int
amd_flash_autodetect32( cfi_array_t *cfi_array )
{
if(cfi_array->bus_width != 4) return 0;
o = 2; /* Heuristic */
o = 2; /* Heuristic */
return (cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_AMD_SCS);
}
static int
amd_flash_autodetect16( cfi_array_t *cfi_array )
{
if(cfi_array->bus_width != 2) return 0;
o = 1; /* Heuristic */
return (cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_AMD_SCS);
}
@ -183,6 +191,9 @@ amd_flash_print_info( cfi_array_t *cfi_array )
case 0x22D7:
printf( _("Am29LV640D/Am29LV641D/Am29LV642D") );
break;
case 0x225B:
printf( _("Am29LV800B") );
break;
default:
printf ( _("Unknown (ID 0x%04x)"), cid );
break;
@ -264,6 +275,18 @@ flash_driver_t amd_32_flash_driver = {
amd_flash_read_array,
};
flash_driver_t amd_16_flash_driver = {
2, /* buswidth */
N_("AMD/Fujitsu Standard Command Set"),
N_("supported: AMD 29LV800B; 1x16 Bit"),
amd_flash_autodetect16,
amd_flash_print_info,
amd_flash_erase_block,
amd_flash_unlock_block,
amd_flash_program,
amd_flash_read_array,
};
flash_driver_t amd_8_flash_driver = {
1, /* buswidth */
N_("AMD/Fujitsu Standard Command Set"),

@ -40,6 +40,8 @@
#include <brux/cfi.h>
#include <brux/bus.h>
int jedec_detect( bus_t *bus, uint32_t adr, cfi_array_t **cfi_array );
void
detectflash( bus_t *bus )
{
@ -56,8 +58,12 @@ detectflash( bus_t *bus )
if (cfi_detect( bus, 0, &cfi_array )) {
cfi_array_free( cfi_array );
printf( _("Flash not found!\n") );
return;
cfi_array = NULL;
if (jedec_detect( bus, 0, &cfi_array ) != 0) {
cfi_array_free( cfi_array );
printf( _("Flash not found!\n") );
return;
}
}
cfi = &cfi_array->cfi_chips[0]->cfi;

@ -0,0 +1,81 @@
/*
* $Id$
*
* Copyright (C) 2003 ETC s.r.o.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by Bradley D. LaRonde <brad@ltc.com>, 2003.
*
*/
#include "sysdep.h"
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <flash/cfi.h>
#include <brux/cfi.h>
#include <brux/bus.h>
int
jedec_detect( bus_t *bus, uint32_t adr, cfi_array_t **cfi_array )
{
int mid;
int did;
/* Query flash. */
bus_write( bus, 0x0, 0xf0 );
bus_write( bus, 0xaaa, 0xaa );
bus_write( bus, 0x555, 0x55 );
bus_write( bus, 0xaaa, 0x90 );
mid = bus_read( bus, 0x0);
did = bus_read( bus, 0x2);
bus_write( bus, 0x0, 0xf0 );
printf( "%s: mid %x, did %x\n", __FUNCTION__, mid, did );
if (mid != 0x01)
return -1;
(*cfi_array)->cfi_chips[0] = calloc( 1, sizeof (cfi_chip_t) );
if (!(*cfi_array)->cfi_chips[0])
return -2; /* out of memory */
cfi_query_structure_t *cfi = &(*cfi_array)->cfi_chips[0]->cfi;
cfi->identification_string.pri_id_code = CFI_VENDOR_AMD_SCS;
cfi->identification_string.pri_vendor_tbl = NULL;
cfi->identification_string.alt_id_code = 0;
cfi->identification_string.alt_vendor_tbl = NULL;
cfi->device_geometry.number_of_erase_regions = 4;
cfi->device_geometry.erase_block_regions =
malloc( cfi->device_geometry.number_of_erase_regions * sizeof (cfi_erase_block_region_t) );
if (!cfi->device_geometry.erase_block_regions)
return -2; /* out of memory */
cfi->device_geometry.erase_block_regions[0].erase_block_size = 16 * 1024;
cfi->device_geometry.erase_block_regions[0].number_of_erase_blocks = 1;
cfi->device_geometry.erase_block_regions[1].erase_block_size = 8 * 1024;
cfi->device_geometry.erase_block_regions[1].number_of_erase_blocks = 2;
cfi->device_geometry.erase_block_regions[2].erase_block_size = 32 * 1024;
cfi->device_geometry.erase_block_regions[2].number_of_erase_blocks = 1;
cfi->device_geometry.erase_block_regions[3].erase_block_size = 64 * 1024;
cfi->device_geometry.erase_block_regions[3].number_of_erase_blocks = 15;
return 0;
}
Loading…
Cancel
Save