Date: Fri, 24 May 2013 14:51:58 +0400 From: Alexander Fedorov <alexander.fedorov@rtlservice.com> To: current@freebsd.org Subject: Re: [PATCH] NAND Framework ONFI chip detection Message-ID: <CAOcOT_y3Lfkmj4RJGt2%2Bi1CKe9cJoCoDOdqa0iKxSDwFgQ_6kQ@mail.gmail.com> In-Reply-To: <CAOcOT_z9wCPj7yf-TjGjdyQf7mEQZug0ppAGGZMwpe2H5Sgxbg@mail.gmail.com> References: <CAOcOT_z9wCPj7yf-TjGjdyQf7mEQZug0ppAGGZMwpe2H5Sgxbg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Hi, current! I received a positive feedback from Grzegorz Bernacki (semihalf). He said that my patch is ok. Can anyone commit a proposed patch? 2013/5/21 Alexander Fedorov <alexander.fedorov@rtlservice.com>: > Hi all! > > I'm writing NAND Flash controller driver for my Hackberry board. > And I found that NAND Framework does not properly detecting ONFI > compiliant chips. > > First, ONFI specification says (p. 40 > http://www.onfi.org/~/media/ONFI/specs/ONFI_1_0_Gold.pdf): > >>The ONFI signature is the ASCII encoding of 'ONFI' where 'O' = 4Fh, 'N' = 4Eh, 'F' = 46h, 'I' = 49h. > > But, current code check it for 'o', 'n', 'f', 'I'. > > Second, function "onfi_read_parameter" (nand_generic.c) read > parameters page using this construction: >>NANDBUS_READ_BUFFER(nandbus, params, sizeof(struct onfi_params)); > > So, structure onfi_params must be declared as packed. > > Proposed patch solves the problem for me. > Is this patch ok? [-- Attachment #2 --] Index: nand.h =================================================================== --- nand.h (revision 250857) +++ nand.h (working copy) @@ -219,7 +219,7 @@ uint16_t vendor_rev; uint8_t vendor_spec[8]; uint16_t crc; -}; +}__attribute__((packed)); struct nand_ecc_data { int eccsize; /* Number of data bytes per ECC step */ Index: nandbus.c =================================================================== --- nandbus.c (revision 250857) +++ nandbus.c (working copy) @@ -331,7 +331,7 @@ nand_probe_onfi(device_t bus, uint8_t *onfi_compliant) { device_t nfc; - char onfi_id[] = {'o', 'n', 'f', 'i', '\0'}; + char onfi_id[] = {'O', 'N', 'F', 'I', '\0'}; int i; nand_debug(NDBG_BUS,"probing ONFI");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOcOT_y3Lfkmj4RJGt2%2Bi1CKe9cJoCoDOdqa0iKxSDwFgQ_6kQ>
