2 # Copyright (C) 2009-2012 Semihalf
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
8 # 1. Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
14 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 # NAND controller interface description
32 #include <dev/nand/nand.h>
37 static int nfc_default_method(device_t dev)
42 static int nfc_softecc_get(device_t dev, void *buf, int pagesize,
43 void *ecc, int *needwrite)
46 return (nand_softecc_get(dev, buf, pagesize, ecc));
49 static int nfc_softecc_correct(device_t dev, void *buf, int pagesize,
50 void *readecc, void *calcecc)
52 return (nand_softecc_correct(dev, buf, pagesize, readecc,
57 # Send command to a NAND chip
62 METHOD int send_command {
67 # Send address to a NAND chip
72 METHOD int send_address {
82 METHOD uint8_t read_byte {
88 METHOD void write_byte {
98 METHOD uint16_t read_word {
104 METHOD void write_word {
111 METHOD void read_buf {
119 METHOD void write_buf {
127 METHOD int select_cs {
132 # Read ready/busy signal
134 METHOD int read_rnb {
143 METHOD int start_command {
145 } DEFAULT nfc_default_method;
147 # Generate ECC or get it from H/W
155 } DEFAULT nfc_softecc_get;
159 METHOD int correct_ecc {
165 } DEFAULT nfc_softecc_correct;