]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/mtd/cfi_flash.h
Update from 2013.01 to 2013.07
[karo-tx-uboot.git] / include / mtd / cfi_flash.h
index 966b5e00cac20a3cd36a60917ff226980908ffee..048b4773fcad230d41ef8353d7f660bff6d9be38 100644 (file)
@@ -2,24 +2,7 @@
  * (C) Copyright 2009
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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
- *
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef __CFI_FLASH_H__
@@ -129,12 +112,16 @@ typedef union {
 } cfiword_t;
 
 /* CFI standard query structure */
+/* The offsets and sizes of this packed structure members correspond
+ * to the actual layout in CFI Flash chips. Some 16- and 32-bit members
+ * are unaligned and must be accessed with explicit unaligned access macros.
+ */
 struct cfi_qry {
        u8      qry[3];
-       u16     p_id;
-       u16     p_adr;
-       u16     a_id;
-       u16     a_adr;
+       u16     p_id;                   /* unaligned */
+       u16     p_adr;                  /* unaligned */
+       u16     a_id;                   /* unaligned */
+       u16     a_adr;                  /* unaligned */
        u8      vcc_min;
        u8      vcc_max;
        u8      vpp_min;
@@ -148,10 +135,10 @@ struct cfi_qry {
        u8      block_erase_timeout_max;
        u8      chip_erase_timeout_max;
        u8      dev_size;
-       u16     interface_desc;
-       u16     max_buf_write_size;
+       u16     interface_desc;         /* aligned */
+       u16     max_buf_write_size;     /* aligned */
        u8      num_erase_regions;
-       u32     erase_region_info[NUM_ERASE_REGIONS];
+       u32     erase_region_info[NUM_ERASE_REGIONS];   /* unaligned */
 } __attribute__((packed));
 
 struct cfi_pri_hdr {
@@ -180,5 +167,19 @@ extern int cfi_flash_num_flash_banks;
 
 void flash_write_cmd(flash_info_t * info, flash_sect_t sect,
                     uint offset, u32 cmd);
+phys_addr_t cfi_flash_bank_addr(int i);
+unsigned long cfi_flash_bank_size(int i);
+void flash_cmd_reset(flash_info_t *info);
+
+#ifdef CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS
+void flash_write8(u8 value, void *addr);
+void flash_write16(u16 value, void *addr);
+void flash_write32(u32 value, void *addr);
+void flash_write64(u64 value, void *addr);
+u8 flash_read8(void *addr);
+u16 flash_read16(void *addr);
+u32 flash_read32(void *addr);
+u64 flash_read64(void *addr);
+#endif
 
 #endif /* __CFI_FLASH_H__ */