2 * Broadcom NAND flash controller interface
4 * Copyright (C) 2011, Broadcom Corporation. All Rights Reserved.
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 #ifndef _BRCMNAND_PRIV_H_
23 #define _BRCMNAND_PRIV_H_
25 #include <linux/autoconf.h>
26 #include <linux/vmalloc.h>
28 #include <linux/mtd/nand.h>
30 #define BRCMNAND_malloc(size) vmalloc(size)
31 #define BRCMNAND_free(addr) vfree(addr)
35 BRCMNAND_ECC_DISABLE
= 0u,
36 BRCMNAND_ECC_BCH_1
= 1u,
37 BRCMNAND_ECC_BCH_2
= 2u,
38 BRCMNAND_ECC_BCH_3
= 3u,
39 BRCMNAND_ECC_BCH_4
= 4u,
40 BRCMNAND_ECC_BCH_5
= 5u,
41 BRCMNAND_ECC_BCH_6
= 6u,
42 BRCMNAND_ECC_BCH_7
= 7u,
43 BRCMNAND_ECC_BCH_8
= 8u,
44 BRCMNAND_ECC_BCH_9
= 9u,
45 BRCMNAND_ECC_BCH_10
= 10u,
46 BRCMNAND_ECC_BCH_11
= 11u,
47 BRCMNAND_ECC_BCH_12
= 12u,
48 BRCMNAND_ECC_RESVD_1
= 13u,
49 BRCMNAND_ECC_RESVD_2
= 14u,
50 BRCMNAND_ECC_HAMMING
= 15u
51 } brcmnand_ecc_level_t
;
57 struct nand_chip chip
;
58 #ifdef CONFIG_MTD_PARTITIONS
59 struct mtd_partition
*parts
;
65 * brcmnand_scan - [BrcmNAND Interface] Scan for the BrcmNAND device
66 * @param mtd MTD device structure
67 * @param maxchips Number of chips to scan for
69 * This fills out all the not initialized function pointers
71 * The flash ID is read and the mtd/chip structures are
72 * filled with the appropriate values.
74 * THT: For now, maxchips should always be 1.
76 extern int brcmnand_scan(struct mtd_info
*mtd
, int maxchips
);
79 * brcmnand_release - [BrcmNAND Interface] Free resources held by the
81 * @param mtd MTD device structure
83 extern void brcmnand_release(struct mtd_info
*mtd
);
85 extern int brcmnand_scan_bbt(struct mtd_info
*mtd
, struct nand_bbt_descr
*bd
);
86 extern int brcmnand_default_bbt(struct mtd_info
*mtd
);
87 extern int brcmnand_isbad_bbt(struct mtd_info
*mtd
, loff_t offs
, int allowbbt
);
89 extern int brcmnand_update_bbt(struct mtd_info
*mtd
, loff_t offs
);
91 extern void* get_brcmnand_handle(void);
93 extern void print_oobbuf(const unsigned char* buf
, int len
);
94 extern void print_databuf(const unsigned char* buf
, int len
);
96 #ifdef CONFIG_MTD_BRCMNAND_CORRECTABLE_ERR_HANDLING
97 extern int brcmnand_cet_update(struct mtd_info
*mtd
, loff_t from
, int *status
);
98 extern int brcmnand_cet_prepare_reboot(struct mtd_info
*mtd
);
99 extern int brcmnand_cet_erasecallback(struct mtd_info
*mtd
, u_int32_t addr
);
100 extern int brcmnand_create_cet(struct mtd_info
*mtd
);
101 #endif /* CONFIG_MTD_BRCMNAND_CORRECTABLE_ERR_HANDLING */
103 extern int __brcmnand_read(struct mtd_info
*mtd
, loff_t from
,
104 size_t len
, size_t *retlen
, u_char
*buf
);
105 extern int __brcmnand_read_oob(struct mtd_info
*mtd
, loff_t from
,
106 struct mtd_oob_ops
*ops
);
107 extern int __brcmnand_write_oob(struct mtd_info
*mtd
, loff_t to
,
108 struct mtd_oob_ops
*ops
);
109 #endif /* _BRCMNAND_PRIV_H_ */