public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] nand_get_device() and nand_release_device()
Date: Mon, 7 May 2012 11:14:50 -0500	[thread overview]
Message-ID: <4FA7F4FA.1080900@freescale.com> (raw)

Scott,

As you know, the P1022 has this weird LBC/DIU muxing problem.  I'd like to
add support for the 'nand' command while the DIU is active.  Looking at
the NAND code, I see functions nand_get_device() and
nand_release_device().  What is the idea behind these functions?  Would it
make sense to do something like this:


static int __board_start_nand(void)
{
	return 0;
}
int board_start_nand(void) __attribute__((weak, alias("__board_start_nand")));

static void __board_finish_nand(void)
{
}
void board_finish_nand(void) __attribute__((weak,
alias("__board_finish_nand")));


static int nand_get_device(struct nand_chip *chip, struct mtd_info *mtd,
int new_state)
{
	chip->state = new_state;

	return board_start_nand();
}

static void nand_release_device(struct mtd_info *mtd)
{
	struct nand_chip *chip = mtd->priv;

	board_finish_nand();

	/* De-select the NAND device */
	chip->select_chip(mtd, -1);
}

-- 
Timur Tabi
Linux kernel developer at Freescale

             reply	other threads:[~2012-05-07 16:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-07 16:14 Timur Tabi [this message]
2012-05-15 20:32 ` [U-Boot] nand_get_device() and nand_release_device() Scott Wood

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=4FA7F4FA.1080900@freescale.com \
    --to=timur@freescale.com \
    --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