This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
[PATCH] Support for AM29DL640D flash part
- From: Ian Campbell <icampbell at arcomcontrols dot com>
- To: eCos Patches <ecos-patches at sources dot redhat dot com>
- Date: 27 Sep 2002 10:13:45 +0100
- Subject: [PATCH] Support for AM29DL640D flash part
Hello all,
The attached patch adds support for the AM29DL640D flash part, it can be
applied from within the devs/flash/amd/am29xxxxx/current directory.
In order to support the part I needed to expand the query routine to
support triple byte part numbers as well as increase the number of
possible banks.
I'm not subscribed to ecos-patches, so please CC me any followups.
Regards,
Ian.
--
Ian Campbell
Design Engineer
Arcom Control Systems Ltd,
Clifton Road,
Cambridge CB1 7EA
United Kingdom
Tel: +44 (0)1223 403465
E-Mail: icampbell@arcomcontrols.com
Web: http://www.arcomcontrols.com
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxx/current/ChangeLog,v
retrieving revision 1.15
diff -u -r1.15 ChangeLog
--- ChangeLog 30 Jul 2002 03:41:12 -0000 1.15
+++ ChangeLog 26 Sep 2002 14:55:02 -0000
@@ -1,3 +1,13 @@
+2002-09-26 Ian Campbell <icampbell@arcomcontrols.com>
+
+ * include/flash_am29xxxxx_parts.inl:
+ * cdl/flash_amd_am29xxxxx.cdl: Add support for AM29DL640D.
+
+ * include/flash_am29xxxxx.inl: Add support for triple byte part id
+ numbers, such as those used by the AM29DL640D. Allow for parts
+ with up to 5 banks, rather than two -- also to support AM29DL640D
+ parts.
+
2002-07-29 Gary Thomas <gary@chez-thomas.org>
2002-07-29 Motoya Kurotsu <kurotsu@allied-telesis.co.jp>
Index: cdl/flash_amd_am29xxxxx.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl,v
retrieving revision 1.8
diff -u -r1.8 flash_amd_am29xxxxx.cdl
--- cdl/flash_amd_am29xxxxx.cdl 20 Jun 2002 23:08:05 -0000 1.8
+++ cdl/flash_amd_am29xxxxx.cdl 26 Sep 2002 14:55:02 -0000
@@ -137,6 +137,16 @@
part in the family."
}
+ cdl_option CYGHWR_DEVS_FLASH_AMD_AM29DL640D {
+ display "AMD AM29DL640D flash memory support"
+ default_value 0
+ implements CYGINT_DEVS_FLASH_AMD_VARIANTS
+ description "
+ When this option is enabled, the AMD flash driver will be
+ able to recognize and handle the AM29DL640D
+ part in the family."
+ }
+
cdl_option CYGHWR_DEVS_FLASH_AMD_AM29F800 {
display "AMD AM29F800 flash memory support"
default_value 0
Index: include/flash_am29xxxxx.inl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl,v
retrieving revision 1.14
diff -u -r1.14 flash_am29xxxxx.inl
--- include/flash_am29xxxxx.inl 30 Jul 2002 03:41:12 -0000 1.14
+++ include/flash_am29xxxxx.inl 26 Sep 2002 14:55:02 -0000
@@ -92,12 +92,16 @@
# define FLASH_Setup_Addr2 (0x2AA)
# define FLASH_VendorID_Addr (0)
# define FLASH_DeviceID_Addr (1)
+# define FLASH_DeviceID_Addr2 (0x0e)
+# define FLASH_DeviceID_Addr3 (0x0f)
# define FLASH_WP_Addr (2)
#else
# define FLASH_Setup_Addr1 (0xAAA)
# define FLASH_Setup_Addr2 (0x555)
# define FLASH_VendorID_Addr (0)
# define FLASH_DeviceID_Addr (2)
+# define FLASH_DeviceID_Addr2 (0x1c)
+# define FLASH_DeviceID_Addr3 (0x1e)
# define FLASH_WP_Addr (4)
#endif
#define FLASH_Setup_Code1 FLASHWORD( 0xAA )
@@ -127,7 +131,10 @@
//----------------------------------------------------------------------------
// Information about supported devices
typedef struct flash_dev_info {
+ cyg_bool long_device_id;
flash_data_t device_id;
+ flash_data_t device_id2;
+ flash_data_t device_id3;
cyg_uint32 block_size;
cyg_int32 block_count;
cyg_uint32 base_mask;
@@ -135,7 +142,7 @@
cyg_bool bootblock;
cyg_uint32 bootblocks[12]; // 0 is bootblock offset, 1-11 sub-sector sizes (or 0)
cyg_bool banked;
- cyg_uint32 banks[2]; // bank offets, highest to lowest (lowest should be 0)
+ cyg_uint32 banks[5]; // bank offets, highest to lowest (lowest should be 0)
// (only one entry for now, increase to support devices
// with more banks).
} flash_dev_info_t;
@@ -194,6 +201,9 @@
id[0] = *(FLASH_P2V(ROM+FLASH_VendorID_Addr));
// Part number
id[1] = *(FLASH_P2V(ROM+FLASH_DeviceID_Addr));
+ id[2] = *(FLASH_P2V(ROM+FLASH_DeviceID_Addr2));
+ id[3] = *(FLASH_P2V(ROM+FLASH_DeviceID_Addr3));
+
*(FLASH_P2V(ROM)) = FLASH_Reset;
@@ -222,7 +232,7 @@
int
flash_hwr_init(void)
{
- flash_data_t id[2];
+ flash_data_t id[4];
int i;
CYGHWR_FLASH_AM29XXXXX_PLF_INIT();
@@ -232,7 +242,11 @@
// Look through table for device data
flash_dev_info = supported_devices;
for (i = 0; i < NUM_DEVICES; i++) {
- if (flash_dev_info->device_id == id[1])
+ if (!flash_dev_info->long_device_id && flash_dev_info->device_id == id[1])
+ break;
+ else if ( flash_dev_info->long_device_id && flash_dev_info->device_id == id[1]
+ && flash_dev_info->device_id2 == id[2]
+ && flash_dev_info->device_id3 == id[3] )
break;
flash_dev_info++;
}
Index: include/flash_am29xxxxx_parts.inl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl,v
retrieving revision 1.7
diff -u -r1.7 flash_am29xxxxx_parts.inl
--- include/flash_am29xxxxx_parts.inl 20 Jun 2002 23:08:06 -0000 1.7
+++ include/flash_am29xxxxx_parts.inl 26 Sep 2002 14:55:02 -0000
@@ -225,6 +225,35 @@
}
},
#endif
+#ifdef CYGHWR_DEVS_FLASH_AMD_AM29DL640D
+{ // AM29DL640D
+ long_device_id: true,
+ device_id : FLASHWORD(0x7e),
+ device_id2 : FLASHWORD(0x02),
+ device_id3 : FLASHWORD(0x01),
+ block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
+ block_count: 142,
+ device_size: 0x0800000 * CYGNUM_FLASH_INTERLEAVE,
+ base_mask : ~(0x8000000 * CYGNUM_FLASH_INTERLEAVE - 1),
+ bootblocks : { 0x07F0000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x0002000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x0002000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x0002000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x0002000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x0002000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x0002000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x0002000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x0002000 * CYGNUM_FLASH_INTERLEAVE,
+ 0
+ },
+ banked : true,
+ banks : { 0x0700000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x0400000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x0100000 * CYGNUM_FLASH_INTERLEAVE,
+ 0
+ }
+ }
+#endif
#ifdef CYGHWR_DEVS_FLASH_AMD_AM29F800
{ // AM29F800-T
device_id : FLASHWORD(0xd6),
@@ -506,6 +535,35 @@
0
}
},
+#endif
+#ifdef CYGHWR_DEVS_FLASH_AMD_AM29DL640D
+{ // AM29DL640D
+ long_device_id: true,
+ device_id : FLASHWORD(0x227e),
+ device_id2 : FLASHWORD(0x2202),
+ device_id3 : FLASHWORD(0x2201),
+ block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
+ block_count: 142,
+ device_size: 0x800000 * CYGNUM_FLASH_INTERLEAVE,
+ base_mask : ~(0x800000 * CYGNUM_FLASH_INTERLEAVE - 1),
+ bootblocks : { 0x7F0000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x2000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x2000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x2000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x2000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x2000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x2000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x2000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x2000 * CYGNUM_FLASH_INTERLEAVE,
+ 0
+ },
+ banked : true,
+ banks : { 0x700000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x400000 * CYGNUM_FLASH_INTERLEAVE,
+ 0x100000 * CYGNUM_FLASH_INTERLEAVE,
+ 0
+ }
+ }
#endif
#ifdef CYGHWR_DEVS_FLASH_AMD_AM29F800
{ // AM29F800-T