From: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
To: "\"Peter Pan 潘栋 (peterpandong)\"" <peterpandong@micron.com>,
"dwmw2@infradead.org" <dwmw2@infradead.org>,
"Brian Norris" <computersforpeace@gmail.com>
Cc: "\"Melanie Zhang 张燕 (melaniezhang)\"" <melaniezhang@micron.com>,
"\"Qi Wang 王起 (qiwang)\"" <qiwang@micron.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"\"Frank Liu 刘群 (frankliu)\"" <frankliu@micron.com>
Subject: Re: [PATCH 1/3] mtd: spi-nand framework
Date: Thu, 8 Jan 2015 00:14:23 -0300 [thread overview]
Message-ID: <54ADF60F.9070300@imgtec.com> (raw)
In-Reply-To: <87F60714EC601C4C83DFF1D2E3D390A04AB404@NTXXIAMBX02.xacn.micron.com>
On 01/07/2015 09:48 PM, Peter Pan 潘栋 (peterpandong) wrote:
[..]
> +
> +static void spi_nand_set_defaults(struct spi_nand_chip *chip)
> +{
> + struct spi_device *spi = chip->spi;
> +
> + if (spi->mode & SPI_RX_QUAD)
> + chip->read_cache = spi_nand_read_from_cache_x4;
> + else if (spi->mode & SPI_RX_DUAL)
> + chip->read_cache = spi_nand_read_from_cache_x2;
> + else
> + chip->read_cache = spi_nand_read_from_cache;
> +
> + if (!chip->reset)
> + chip->reset = spi_nand_reset;
> + if (!chip->erase_block)
> + chip->erase_block = spi_nand_erase_block;
> + if (!chip->load_page)
> + chip->load_page = spi_nand_read_page_to_cache;
> + if (!chip->store_cache)
> + chip->store_cache = spi_nand_program_data_to_cache;
IMO, this is a mistake and one of the reasons why this whole file is so big.
Do you have any reason for keeping the SPI commands (read page to cache,
program data to cache, etc.) in the spi-nand-base.c ?
This shouldn't belong to the framework, but to some spi-nand-device.c
implementing the SPI NAND commands for the devices we have seen so far.
In fact, I don't think you should inherit this "default" hook stuff from
NAND, it only makes the code more obscure.
As Brian noted, such a separation would be benefitial to support a
potential SPI-NAND-specific controller.
However, I think the stronger reason is that it results in a much
simpler and clean initial code.
--
Ezequiel
WARNING: multiple messages have this Message-ID (diff)
From: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
To: "\"Peter Pan 潘栋 (peterpandong)\"" <peterpandong@micron.com>,
"dwmw2@infradead.org" <dwmw2@infradead.org>,
"Brian Norris" <computersforpeace@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"\"Qi Wang 王起 (qiwang)\"" <qiwang@micron.com>,
"\"Frank Liu 刘群 (frankliu)\"" <frankliu@micron.com>,
"\"Melanie Zhang 张燕 (melaniezhang)\"" <melaniezhang@micron.com>
Subject: Re: [PATCH 1/3] mtd: spi-nand framework
Date: Thu, 8 Jan 2015 00:14:23 -0300 [thread overview]
Message-ID: <54ADF60F.9070300@imgtec.com> (raw)
In-Reply-To: <87F60714EC601C4C83DFF1D2E3D390A04AB404@NTXXIAMBX02.xacn.micron.com>
On 01/07/2015 09:48 PM, Peter Pan 潘栋 (peterpandong) wrote:
[..]
> +
> +static void spi_nand_set_defaults(struct spi_nand_chip *chip)
> +{
> + struct spi_device *spi = chip->spi;
> +
> + if (spi->mode & SPI_RX_QUAD)
> + chip->read_cache = spi_nand_read_from_cache_x4;
> + else if (spi->mode & SPI_RX_DUAL)
> + chip->read_cache = spi_nand_read_from_cache_x2;
> + else
> + chip->read_cache = spi_nand_read_from_cache;
> +
> + if (!chip->reset)
> + chip->reset = spi_nand_reset;
> + if (!chip->erase_block)
> + chip->erase_block = spi_nand_erase_block;
> + if (!chip->load_page)
> + chip->load_page = spi_nand_read_page_to_cache;
> + if (!chip->store_cache)
> + chip->store_cache = spi_nand_program_data_to_cache;
IMO, this is a mistake and one of the reasons why this whole file is so big.
Do you have any reason for keeping the SPI commands (read page to cache,
program data to cache, etc.) in the spi-nand-base.c ?
This shouldn't belong to the framework, but to some spi-nand-device.c
implementing the SPI NAND commands for the devices we have seen so far.
In fact, I don't think you should inherit this "default" hook stuff from
NAND, it only makes the code more obscure.
As Brian noted, such a separation would be benefitial to support a
potential SPI-NAND-specific controller.
However, I think the stronger reason is that it results in a much
simpler and clean initial code.
--
Ezequiel
next prev parent reply other threads:[~2015-01-08 3:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-08 0:48 [PATCH 1/3] mtd: spi-nand framework Peter Pan 潘栋 (peterpandong)
2015-01-08 0:48 ` Peter Pan 潘栋 (peterpandong)
2015-01-08 3:14 ` Ezequiel Garcia [this message]
2015-01-08 3:14 ` Ezequiel Garcia
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=54ADF60F.9070300@imgtec.com \
--to=ezequiel.garcia@imgtec.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=frankliu@micron.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=melaniezhang@micron.com \
--cc=peterpandong@micron.com \
--cc=qiwang@micron.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.