From: Russ D. <ru...@us...> - 2003-11-27 08:03:08
|
Update of /cvsroot/blob/blob/include/blob In directory sc8-pr-cvs1:/tmp/cvs-serv9521/include/blob Modified Files: Makefile.am flash.h Added Files: cfi.h Log Message: flesh out cfi probing, and only compile it in if requested by the arch file --- NEW FILE: cfi.h --- /*------------------------------------------------------------------------- * Filename: cfi.h * Version: $Id: cfi.h,v 1.1 2003/11/27 08:02:31 russd Exp $ * Copyright: Copyright (C) 1999, Jan-Derk Bakker * Author: Jan-Derk Bakker <J.D...@it...> * Description: CFI functions for the blob loader * Created at: Mon Aug 23 20:00:00 1999 * Modified by: Erik Mouw <J.A...@it...> * Modified at: Sun Oct 3 21:35:12 1999 *-----------------------------------------------------------------------*/ /* * cfi.h: CFI functions for the blob bootloader * * Copyright (C) 1999 Jan-Derk Bakker (J.D...@it...) * * 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 * */ #ident "$Id: cfi.h,v 1.1 2003/11/27 08:02:31 russd Exp $" #ifndef BLOB_CFI_H #define BLOB_CFI_H #include <blob/types.h> /* exported functions */ int flash_query_descriptors_cfi16(u32 *flashAddr, flash_descriptor_t **out); int flash_query_descriptors_cfi32(u32 *flashAddr, flash_descriptor_t **out); /* CFI offsets ... useful to many flavors of flash */ #define CFI_MANUF_CODE 0x00 #define CFI_DEVICE_CODE 0x01 #define CFI_DEVICE_SIZE_LG2 0x27 #define CFI_ERASE_REGION_COUNT 0x2c #define CFI_ERASE_REGION_XBLKS(n) (0x2d + 4 * (n)) #define CFI_ERASE_REGION_XSIZE(n) (0x2f + 4 * (n)) #define CFI16_MANUF_CODE CFI_MANUF_CODE #define CFI16_DEVICE_CODE CFI_DEVICE_CODE #define CFI16_DEVICE_SIZE_LG2 CFI_DEVICE_SIZE_LG2 #define CFI16_ERASE_REGION_COUNT CFI_ERASE_REGION_COUNT #define CFI16_ERASE_REGION_XBLKS(n) CFI_ERASE_REGION_XBLKS(n) #define CFI16_ERASE_REGION_XSIZE(n) CFI_ERASE_REGION_XSIZE(n) #define CFI32_MANUF_CODE (CFI_MANUF_CODE << 1) #define CFI32_DEVICE_CODE (CFI_DEVICE_CODE << 1) #define CFI32_DEVICE_SIZE_LG2 (CFI_DEVICE_SIZE_LG2 << 1) #define CFI32_ERASE_REGION_COUNT (CFI_ERASE_REGION_COUNT << 1) #define CFI32_ERASE_REGION_XBLKS(n) (CFI_ERASE_REGION_XBLKS(n) << 1) #define CFI32_ERASE_REGION_XSIZE(n) (CFI_ERASE_REGION_XSIZE(n) << 1) #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/include/blob/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Makefile.am 4 Sep 2003 17:46:59 -0000 1.21 +++ Makefile.am 27 Nov 2003 08:02:31 -0000 1.22 @@ -18,6 +18,7 @@ noinst_HEADERS = \ arch.h \ cf.h \ + cfi.h \ command.h \ command_hist.h \ compr_rubin.h \ Index: flash.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/flash.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- flash.h 3 Sep 2003 01:44:27 -0000 1.14 +++ flash.h 27 Nov 2003 08:02:31 -0000 1.15 @@ -82,12 +82,21 @@ /* should be filled out by the architecture dependent files */ extern flash_driver_t *flash_driver; -/* should be filled out by the architecture dependent files; can - * be set to QUERY_FLASH_FOR_DESCRIPTORS() if driver supports that */ -#define QUERY_FLASH_FOR_DESCRIPTORS(flash_addr) \ - { { .size = (u32) flash_addr, .num = -1 } } +/* Two methods of getting flash descriptors: */ + +/* Method 1: Define the below struct in your achitecture + * file. This is the most compact way of doing it */ extern const flash_descriptor_t *flash_descriptors; +/* Method 2: Set flash_driver->query_descriptors to the + * proper cfi function. This will construct the table on + * the fly and will adapt to differnt flash configurations. + * However, this method will pull in another 600 or 700 + * bytes. */ + +/* architecture dependent files should set this if the flash + * memory does not reside at 0x0 */ +extern u32 flash_base; /* flash data mangle functions */ u32 data_from_flash(u32 what); @@ -105,13 +114,5 @@ int flash_get_next_block_address(u32* addr, u32 current); int flash_get_block_size(u32 address); u32 flash_get_size( void ); - -/* CFI offsets ... useful to many flavors of flash */ -#define CFI_MANUF_CODE 0x00 -#define CFI_DEVICE_CODE 0x01 -#define CFI_DEVICE_SIZE_LG2 0x27 -#define CFI_ERASE_REGION_COUNT 0x2c -#define CFI_ERASE_REGION_XBLKS(n) (0x2d + 4 * (n)) -#define CFI_ERASE_REGION_XSIZE(n) (0x2f + 4 * (n)) #endif |