linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 03/10] mtd: mxc_nand: move function pointers to a per-SOC struct
Date: Tue, 24 Apr 2012 09:24:57 +0200	[thread overview]
Message-ID: <20120424072457.GL3852@pengutronix.de> (raw)
In-Reply-To: <1335173022-22371-3-git-send-email-u.kleine-koenig@pengutronix.de>

On Mon, Apr 23, 2012 at 11:23:35AM +0200, Uwe Kleine-K?nig wrote:
> This prepares switching to platform ids and of-tree probing.
> 
> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/mtd/nand/mxc_nand.c |  197 ++++++++++++++++++++++++++-----------------
>  1 file changed, 118 insertions(+), 79 deletions(-)
> 
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index a78e763..1672e4b 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -140,6 +140,19 @@
>  
>  #define NFC_V3_DELAY_LINE		(host->regs_ip + 0x34)
>  
> +struct mxc_nand_host;
> +
> +struct mxc_nand_devtype_data {
> +	void (*preset)(struct mtd_info *);
> +	void (*send_cmd)(struct mxc_nand_host *, uint16_t, int);
> +	void (*send_addr)(struct mxc_nand_host *, uint16_t, int);
> +	void (*send_page)(struct mtd_info *, unsigned int);
> +	void (*send_read_id)(struct mxc_nand_host *);
> +	uint16_t (*get_dev_status)(struct mxc_nand_host *);
> +	int (*check_int)(struct mxc_nand_host *);
> +	void (*irq_control)(struct mxc_nand_host *, int);
> +};
> +
>  struct mxc_nand_host {
>  	struct mtd_info		mtd;
>  	struct nand_chip	nand;
> @@ -165,14 +178,7 @@ struct mxc_nand_host {
>  	unsigned int		buf_start;
>  	int			spare_len;
>  
> -	void			(*preset)(struct mtd_info *);
> -	void			(*send_cmd)(struct mxc_nand_host *, uint16_t, int);
> -	void			(*send_addr)(struct mxc_nand_host *, uint16_t, int);
> -	void			(*send_page)(struct mtd_info *, unsigned int);
> -	void			(*send_read_id)(struct mxc_nand_host *);
> -	uint16_t		(*get_dev_status)(struct mxc_nand_host *);
> -	int			(*check_int)(struct mxc_nand_host *);
> -	void			(*irq_control)(struct mxc_nand_host *, int);
> +	const struct mxc_nand_devtype_data *devtype_data;
>  
>  	/*
>  	 * On i.MX21 the CONFIG2:INT bit cannot be read if interrupts are masked
> @@ -251,20 +257,6 @@ static struct nand_ecclayout nandv2_hw_eccoob_4k = {
>  
>  static const char *part_probes[] = { "RedBoot", "cmdlinepart", NULL };
>  
> -static irqreturn_t mxc_nfc_irq(int irq, void *dev_id)
> -{
> -	struct mxc_nand_host *host = dev_id;
> -
> -	if (!host->check_int(host))
> -		return IRQ_NONE;
> -
> -	irq_control(host, 0);
> -
> -	complete(&host->op_completion);
> -
> -	return IRQ_HANDLED;
> -}
> -
>  static int check_int_v3(struct mxc_nand_host *host)
>  {
>  	uint32_t tmp;
> @@ -329,10 +321,25 @@ static void irq_control(struct mxc_nand_host *host, int activate)
>  		else
>  			disable_irq_nosync(host->irq);
>  	} else {
> -		host->irq_control(host, activate);
> +		host->devtype_data->irq_control(host, activate);
>  	}
>  }
>  
> +static irqreturn_t mxc_nfc_irq(int irq, void *dev_id)
> +{
> +	struct mxc_nand_host *host = dev_id;
> +
> +	if (!host->devtype_data->check_int(host))
> +		return IRQ_NONE;
> +
> +	irq_control(host, 0);
> +
> +	complete(&host->op_completion);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +

The move of mxc_nfc_irq seems unnecessary. Also one blank line too much.

>  
> +/* v1: 21, 27, 31 */

Can we have imx21 here? People familiar with i.MX may instantly
recognize these numbers, others do not.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2012-04-24  7:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23  9:22 [PATCH 00/10] allow mxc_nand to be probed via device tree Uwe Kleine-König
2012-04-23  9:23 ` [PATCH 01/10] mtd: mxc_nand: set owner field to prevent module unloading when in use Uwe Kleine-König
2012-04-23  9:23 ` [PATCH 02/10] mtd: mxc_nand: use a flag to detect if the mx21 quirk is necessary Uwe Kleine-König
2012-04-23  9:23 ` [PATCH 03/10] mtd: mxc_nand: move function pointers to a per-SOC struct Uwe Kleine-König
2012-04-24  7:24   ` Sascha Hauer [this message]
2012-04-24  8:10     ` Uwe Kleine-König
2012-04-24  8:12       ` [PATCH] mtd: mxc_nand: fix several sparse warnings about incorrect address space Uwe Kleine-König
2012-04-23  9:23 ` [PATCH 04/10] mtd: mxc_nand: split some functions to get rid of more nfc_is_vX() Uwe Kleine-König
2012-04-23  9:23 ` [PATCH 05/10] mtd: mxc_nand: put ecc layout into devtype structs Uwe Kleine-König
2012-04-23  9:23 ` [PATCH 06/10] mtd: mxc_nand: split chip_select function and put it into devtype struct Uwe Kleine-König
2012-04-23  9:23 ` [PATCH 07/10] mtd: mxc_nand: put callback for data correction " Uwe Kleine-König
2012-04-23  9:23 ` [PATCH 08/10] mtd: mxc_nand: put several more fields into devtype_data Uwe Kleine-König
2012-04-23  9:23 ` [PATCH 09/10] mtd: mxc_nand: implement device tree probing Uwe Kleine-König
2012-04-23  9:23 ` [PATCH 10/10] ARM: imx: add mxc_nand to imx27 device tree Uwe Kleine-König
2012-04-28 12:20 ` [PATCH 00/10] allow mxc_nand to be probed via " Artem Bityutskiy
2012-04-29  9:27   ` Uwe Kleine-König
2012-04-29 11:10     ` Artem Bityutskiy

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=20120424072457.GL3852@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=linux-arm-kernel@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;
as well as URLs for NNTP newsgroup(s).