public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/5] jz4740 nand spl files
Date: Thu, 11 Nov 2010 08:32:40 +0100	[thread overview]
Message-ID: <20101111073240.80E98B195@gemini.denx.de> (raw)
In-Reply-To: <1289446657-12499-4-git-send-email-xiangfu@openmobilefree.net>

Dear Xiangfu Liu,

In message <1289446657-12499-4-git-send-email-xiangfu@openmobilefree.net> you wrote:
> From: Xiangfu Liu <xiangfu@sharism.cc>
> 
> Signed-off-by: Xiangfu Liu <xiangfu@openmobilefree.net>
> ---
>  nand_spl/board/xburst/nanonote/Makefile   |   96 +++++++
>  nand_spl/board/xburst/nanonote/u-boot.lds |   63 +++++
>  nand_spl/nand_boot_jz4740.c               |  395 +++++++++++++++++++++++++++++
>  3 files changed, 554 insertions(+), 0 deletions(-)
>  create mode 100644 nand_spl/board/xburst/nanonote/Makefile
>  create mode 100644 nand_spl/board/xburst/nanonote/u-boot.lds
>  create mode 100644 nand_spl/nand_boot_jz4740.c

You need to rework the splitting of your code into commits - as is,
these patches make no sense to me.  Please re-read
http://www.denx.de/wiki/view/U-Boot/Patches#General_Patch_Submission_Rules

> diff --git a/nand_spl/nand_boot_jz4740.c b/nand_spl/nand_boot_jz4740.c
> new file mode 100644
...
> +#define __nand_enable()		(REG_EMC_NFCSR |= EMC_NFCSR_NFE1 | EMC_NFCSR_NFCE1)
> +#define __nand_disable()	(REG_EMC_NFCSR &= ~(EMC_NFCSR_NFCE1))
> +#define __nand_ecc_rs_encoding() \
> +	(REG_EMC_NFECR = EMC_NFECR_ECCE | EMC_NFECR_ERST | EMC_NFECR_RS | EMC_NFECR_RS_ENCODING)
> +#define __nand_ecc_rs_decoding() \
> +	(REG_EMC_NFECR = EMC_NFECR_ECCE | EMC_NFECR_ERST | EMC_NFECR_RS | EMC_NFECR_RS_DECODING)
> +#define __nand_ecc_disable()	(REG_EMC_NFECR &= ~EMC_NFECR_ECCE)
> +#define __nand_ecc_encode_sync() while (!(REG_EMC_NFINTS & EMC_NFINTS_ENCF))
> +#define __nand_ecc_decode_sync() while (!(REG_EMC_NFINTS & EMC_NFINTS_DECF))
> +#define __nand_cmd(n)		(REG8(NAND_COMMPORT) = (n))
> +#define __nand_addr(n)		(REG8(NAND_ADDRPORT) = (n))
> +#define __nand_data8()		REG8(NAND_DATAPORT)
> +#define __nand_data16()		REG16(NAND_DATAPORT)

You seem to have a tendency to use "__" a lot in front of
indentifiers.  The C standard says:

   -- All identifiers that begin with an underscore and either an
      uppercase letter or another underscore are always reserved for
      any use.

   -- All identifiers that begin with an underscore are always
      reserved for use as identifiers with file scope in both the
      ordinary and tag name spaces.

Please recheck your identifier names with this in mind.

As mentioned before, this code needs to be converted to use I/O
accessors instead of these REG*() volatile pointer accesses.

Both comments apply globally.

...
> +		/* Check result of decoding */
> +		stat = REG_EMC_NFINTS;
> +		if (stat & EMC_NFINTS_ERR) {
> +			/* Error occurred */
> +			/* serial_puts("Error occurred\n"); */
> +			if (stat & EMC_NFINTS_UNCOR) {
> +				/* Uncorrectable error occurred */
> +				/* serial_puts("Uncorrectable error occurred\n"); */
> +			} else {
> +				unsigned int errcnt, index, mask;
> +
> +				errcnt = (stat & EMC_NFINTS_ERRCNT_MASK) >> EMC_NFINTS_ERRCNT_BIT;
> +				switch (errcnt) {
> +				case 4:
> +					index = (REG_EMC_NFERR3 & EMC_NFERR_INDEX_MASK) >> EMC_NFERR_INDEX_BIT;
> +					mask = (REG_EMC_NFERR3 & EMC_NFERR_MASK_MASK) >> EMC_NFERR_MASK_BIT;
> +					rs_correct(tmpbuf, index, mask);
> +					/* FALL-THROUGH */
> +				case 3:
> +					index = (REG_EMC_NFERR2 & EMC_NFERR_INDEX_MASK) >> EMC_NFERR_INDEX_BIT;
> +					mask = (REG_EMC_NFERR2 & EMC_NFERR_MASK_MASK) >> EMC_NFERR_MASK_BIT;
> +					rs_correct(tmpbuf, index, mask);
> +					/* FALL-THROUGH */
> +				case 2:
> +					index = (REG_EMC_NFERR1 & EMC_NFERR_INDEX_MASK) >> EMC_NFERR_INDEX_BIT;
> +					mask = (REG_EMC_NFERR1 & EMC_NFERR_MASK_MASK) >> EMC_NFERR_MASK_BIT;
> +					rs_correct(tmpbuf, index, mask);
> +					/* FALL-THROUGH */
> +				case 1:
> +					index = (REG_EMC_NFERR0 & EMC_NFERR_INDEX_MASK) >> EMC_NFERR_INDEX_BIT;
> +					mask = (REG_EMC_NFERR0 & EMC_NFERR_MASK_MASK) >> EMC_NFERR_MASK_BIT;
> +					rs_correct(tmpbuf, index, mask);
> +					break;

Lines too long.


I stop reviewing here.

Please fix the code, and resubmit.

Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There's no honorable way to kill, no gentle way to destroy.  There is
nothing good in war.  Except its ending.
	-- Abraham Lincoln, "The Savage Curtain", stardate 5906.5

  parent reply	other threads:[~2010-11-11  7:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11  3:37 [U-Boot] [PATCH 0/5] [MIPS] add jz4740 base file and Ben NanoNote Xiangfu Liu
2010-11-11  3:37 ` [U-Boot] [PATCH 1/5] those files are jz4740 base files Xiangfu Liu
     [not found]   ` <1289446657-12499-3-git-send-email-xiangfu@openmobilefree.net>
2010-11-11  3:37     ` [U-Boot] [PATCH 3/5] jz4740 nand spl files Xiangfu Liu
2010-11-11  3:37       ` [U-Boot] [PATCH 4/5] jz4740 nand driver Xiangfu Liu
2010-11-11  3:37         ` [U-Boot] [PATCH 5/5] add Ben NanoNote board Xiangfu Liu
2010-11-11  8:28           ` Wolfgang Denk
2010-11-15 23:02         ` [U-Boot] [PATCH 4/5] jz4740 nand driver Scott Wood
2010-11-11  7:32       ` Wolfgang Denk [this message]
2010-11-15 22:56       ` [U-Boot] [PATCH 3/5] jz4740 nand spl files Scott Wood
2010-11-11  7:14   ` [U-Boot] [PATCH 1/5] those files are jz4740 base files Wolfgang Denk
2010-11-14 15:03   ` Shinya Kuribayashi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101111073240.80E98B195@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox