mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/5] nand omap: use standard debug functions
Date: Mon, 11 Apr 2011 16:10:34 +0200	[thread overview]
Message-ID: <1302531036-27906-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1302531036-27906-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/nand/nand_omap_gpmc.c |   27 ++++++++-------------------
 1 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/drivers/mtd/nand/nand_omap_gpmc.c b/drivers/mtd/nand/nand_omap_gpmc.c
index 74f2da6..7874810 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -76,16 +76,6 @@
 #include <mach/gpmc.h>
 #include <mach/gpmc_nand.h>
 
-/* Enable me to get tons of debug messages -for use without jtag */
-#if 0
-#define gpmcnand_dbg(FORMAT, ARGS...) fprintf(stdout,\
-		"gpmc_nand:%s:%d:Entry:"FORMAT"\n",\
-		__func__, __LINE__, ARGS)
-#else
-#define gpmcnand_dbg(FORMAT, ARGS...)
-#endif
-#define gpmcnand_err(ARGS...) fprintf(stderr, "omapnand: " ARGS);
-
 int decode_bch(int select_4_8, unsigned char *ecc, unsigned int *err_loc);
 
 static char *ecc_mode_strings[] = {
@@ -190,14 +180,14 @@ static int omap_dev_ready(struct mtd_info *mtd)
 	uint64_t start = get_time_ns();
 	unsigned long comp;
 
-	gpmcnand_dbg("mtd=%x", (unsigned int)mtd);
+	debug("mtd=%x", (unsigned int)mtd);
 	/* What do we mean by assert and de-assert? */
 	comp = (oinfo->wait_pol == NAND_WAITPOL_HIGH) ?
 	    oinfo->wait_mon_mask : 0x0;
 	while (1) {
 		/* Breakout condition */
 		if (is_timeout(start, oinfo->timeout)) {
-			gpmcnand_err("timedout\n");
+			debug("timedout\n");
 			return -ETIMEDOUT;
 		}
 		/* if the wait is released, we are good to go */
@@ -222,7 +212,7 @@ static void gpmc_nand_wp(struct gpmc_nand_info *oinfo, int mode)
 {
 	unsigned long config = readl(oinfo->gpmc_base + GPMC_CFG);
 
-	gpmcnand_dbg("mode=%x", mode);
+	debug("mode=%x", mode);
 	if (mode)
 		config &= ~(NAND_WP_BIT);	/* WP is ON */
 	else
@@ -247,7 +237,7 @@ static void omap_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 {
 	struct nand_chip *nand = (struct nand_chip *)(mtd->priv);
 	struct gpmc_nand_info *oinfo = (struct gpmc_nand_info *)(nand->priv);
-	gpmcnand_dbg("mtd=%x nand=%x cmd=%x ctrl = %x", (unsigned int)mtd, nand,
+	debug("mtd=%x nand=%x cmd=%x ctrl = %x", (unsigned int)mtd, nand,
 		  cmd, ctrl);
 	switch (ctrl) {
 	case NAND_CTRL_CHANGE | NAND_CTRL_CLE:
@@ -281,7 +271,7 @@ static void omap_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
  */
 static unsigned int gen_true_ecc(u8 *ecc_buf)
 {
-	gpmcnand_dbg("ecc_buf=%x 1, 2 3 = %x %x %x", (unsigned int)ecc_buf,
+	debug("ecc_buf=%x 1, 2 3 = %x %x %x", (unsigned int)ecc_buf,
 		  ecc_buf[0], ecc_buf[1], ecc_buf[2]);
 	return ecc_buf[0] | (ecc_buf[1] << 16) | ((ecc_buf[2] & 0xF0) << 20) |
 	    ((ecc_buf[2] & 0x0F) << 8);
@@ -375,7 +365,7 @@ static int omap_correct_data(struct mtd_info *mtd, uint8_t *dat,
 	int blockCnt = 0;
 	int select_4_8;
 
-	gpmcnand_dbg("mtd=%x dat=%x read_ecc=%x calc_ecc=%x", (unsigned int)mtd,
+	debug("mtd=%x dat=%x read_ecc=%x calc_ecc=%x", (unsigned int)mtd,
 		  (unsigned int)dat, (unsigned int)read_ecc,
 		  (unsigned int)calc_ecc);
 
@@ -404,11 +394,11 @@ static int omap_correct_data(struct mtd_info *mtd, uint8_t *dat,
 				/* Flip the bit to correct */
 				dat[byte] ^= (0x1 << bit);
 			} else if (hm == 1) {
-				gpmcnand_err("Ecc is wrong\n");
+				printf("Ecc is wrong\n");
 				/* ECC itself is corrupted */
 				return 2;
 			} else {
-				gpmcnand_err("bad compare! failed\n");
+				printf("bad compare! failed\n");
 				/* detected 2 bit error */
 				return -1;
 			}
@@ -679,7 +669,6 @@ static int gpmc_nand_probe(struct device_d *pdev)
 	int err;
 	struct nand_ecclayout *layout, *lsp, *llp;
 
-	gpmcnand_dbg("pdev=%x", (unsigned int)pdev);
 	pdata = (struct gpmc_nand_platform_data *)pdev->platform_data;
 	if (pdata == NULL) {
 		dev_dbg(pdev, "platform data missing\n");
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2011-04-11 14:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-11 14:10 omap nand patches Sascha Hauer
2011-04-11 14:10 ` [PATCH 1/5] nand omap: fix hamming romcode ecc code Sascha Hauer
2011-04-11 14:10 ` [PATCH 2/5] nand omap: turn debug messages into dev_dbg Sascha Hauer
2011-04-11 14:10 ` Sascha Hauer [this message]
2011-04-11 14:10 ` [PATCH 4/5] nand omap: use xzalloc instead of calloc Sascha Hauer
2011-04-11 14:10 ` [PATCH 5/5] nand omap: handle erased pages correctly in hamming ecc mode Sascha Hauer

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=1302531036-27906-4-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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