From: vipin.kumar@st•com (Vipin Kumar)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 03/11] fsmc/nand: Support multiple banks connected to controller
Date: Wed, 10 Oct 2012 15:58:54 +0530 [thread overview]
Message-ID: <50754DE6.3080409@st.com> (raw)
In-Reply-To: <20121009115523.GM12801@game.jcrosoft.org>
On 10/9/2012 5:25 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 16:14 Tue 09 Oct , Vipin Kumar wrote:
>> Support up to max_banks number of banks in fsmc driver.
>>
>> Signed-off-by: Vipin Kumar<vipin.kumar@st•com>
> please rebase this over my patch that drop -off to resource
Sure, I will do that. I actually planned to do it but forgot while
sending it
>> ---
>> .../devicetree/bindings/mtd/fsmc-nand.txt | 2 ++
>> arch/arm/boot/dts/spear300.dtsi | 1 +
>> arch/arm/boot/dts/spear310.dtsi | 1 +
>> arch/arm/boot/dts/spear320.dtsi | 1 +
>> arch/arm/boot/dts/spear600.dtsi | 1 +
>> arch/arm/mach-u300/core.c | 1 +
>> drivers/mtd/nand/fsmc_nand.c | 26 +++++++++++++++-------
>> include/linux/mtd/fsmc.h | 2 +-
>> 8 files changed, 26 insertions(+), 9 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/mtd/fsmc-nand.txt b/Documentation/devicetree/bindings/mtd/fsmc-nand.txt
>> index e2c663b..29d1a2f 100644
>> --- a/Documentation/devicetree/bindings/mtd/fsmc-nand.txt
>> +++ b/Documentation/devicetree/bindings/mtd/fsmc-nand.txt
>> @@ -6,6 +6,7 @@ Required properties:
>> - reg-names: Should contain the reg names "fsmc_regs" and "nand_data"
>> - st,ale-off : Chip specific offset to ALE
>> - st,cle-off : Chip specific offset to CLE
>> +- maxbanks: Number of banks supported by SoC
> make it optionnal will simplify the binding with 1 by default and will allow
> to avoid issue
>
hmmm....OK
I think you are right. May be optional with a default of 1 is a better
option
>>
>> Optional properties:
>> - bank-width : Width (in bytes) of the device. If not present, the width
>> @@ -23,6 +24,7 @@ Example:
>> reg-names = "fsmc_regs", "nand_data";
>> st,ale-off =<0x20000>;
>> st,cle-off =<0x10000>;
>> + maxbanks =<1>;
>>
>> bank-width =<1>;
>> nand-skip-bbtscan;
>> diff --git a/arch/arm/boot/dts/spear300.dtsi b/arch/arm/boot/dts/spear300.dtsi
>> index ed3627c..19e2328 100644
>> --- a/arch/arm/boot/dts/spear300.dtsi
>> +++ b/arch/arm/boot/dts/spear300.dtsi
>> @@ -42,6 +42,7 @@
>> reg-names = "fsmc_regs", "nand_data";
>> st,ale-off =<0x20000>;
>> st,cle-off =<0x10000>;
>> + maxbanks =<1>;
>> status = "disabled";
>> };
>>
>> diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
>> index 62fc4fb..0272afb3 100644
>> --- a/arch/arm/boot/dts/spear310.dtsi
>> +++ b/arch/arm/boot/dts/spear310.dtsi
>> @@ -36,6 +36,7 @@
>> reg-names = "fsmc_regs", "nand_data";
>> st,ale-off =<0x10000>;
>> st,cle-off =<0x20000>;
>> + maxbanks =<1>;
>> status = "disabled";
>> };
>>
>> diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
>> index 1f49d69..69fe50d 100644
>> --- a/arch/arm/boot/dts/spear320.dtsi
>> +++ b/arch/arm/boot/dts/spear320.dtsi
>> @@ -42,6 +42,7 @@
>> reg-names = "fsmc_regs", "nand_data";
>> st,ale-off =<0x20000>;
>> st,cle-off =<0x10000>;
>> + maxbanks =<1>;
>> status = "disabled";
>> };
>>
>> diff --git a/arch/arm/boot/dts/spear600.dtsi b/arch/arm/boot/dts/spear600.dtsi
>> index a3c36e4..6ed57c8 100644
>> --- a/arch/arm/boot/dts/spear600.dtsi
>> +++ b/arch/arm/boot/dts/spear600.dtsi
>> @@ -71,6 +71,7 @@
>> reg-names = "fsmc_regs", "nand_data";
>> st,ale-off =<0x20000>;
>> st,cle-off =<0x10000>;
>> + maxbanks =<1>;
>> status = "disabled";
>> };
>>
>> diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
>> index 03acf18..5ea9f71 100644
>> --- a/arch/arm/mach-u300/core.c
>> +++ b/arch/arm/mach-u300/core.c
>> @@ -1546,6 +1546,7 @@ static struct fsmc_nand_platform_data nand_platform_data = {
>> .width = FSMC_NAND_BW8,
>> .ale_off = PLAT_NAND_ALE,
>> .cle_off = PLAT_NAND_CLE,
>> + .max_banks = 1,
>> };
>>
>> static struct platform_device nand_device = {
>> diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
>> index bd89580..fc6a044 100644
>> --- a/drivers/mtd/nand/fsmc_nand.c
>> +++ b/drivers/mtd/nand/fsmc_nand.c
>> @@ -298,6 +298,7 @@ static struct fsmc_eccplace fsmc_ecc4_sp_place = {
>> * - Word access (CPU)
>> * - None (Use driver default ie bus width specific
>> * CPU access)
>> + * @max_banks: Maximum number of banks supported
>> * @select_chip: Select a particular bank
>> *
>> * @data_pa: NAND Physical port for Data
>> @@ -325,6 +326,7 @@ struct fsmc_nand_data {
>> struct mtd_partition *partitions;
>> unsigned int nr_partitions;
>> enum access_mode mode;
>> + uint32_t max_banks;
>> void (*select_chip)(uint32_t bank, uint32_t busw);
>>
>> /* Virtual/Physical addresses for CPU/DMA access */
>> @@ -343,6 +345,7 @@ static void fsmc_select_chip(struct mtd_info *mtd, int chipnr)
>>
>> host = container_of(mtd, struct fsmc_nand_data, mtd);
>>
>> + host->bank = chipnr;
>> switch (chipnr) {
>> case -1:
>> chip->cmd_ctrl(mtd, NAND_CMD_NONE, 0 | NAND_CTRL_CHANGE);
>> @@ -889,6 +892,7 @@ static int __devinit fsmc_nand_probe_config_dt(struct platform_device *pdev,
>> of_property_read_u32(np, "st,cle-off",&pdata->cle_off);
>> if (of_get_property(np, "nand-skip-bbtscan", NULL))
>> pdata->options = NAND_SKIP_BBTSCAN;
>> + of_property_read_u32(np, "maxbanks",&pdata->max_banks);
>>
>> return 0;
>> }
>> @@ -915,7 +919,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
>> struct resource *res;
>> dma_cap_mask_t mask;
>> int ret = 0;
>> - u32 pid;
>> + u32 pid, bank;
>> int i;
>>
>> if (np) {
>> @@ -1023,13 +1027,13 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
>> AMBA_PART_BITS(pid), AMBA_MANF_BITS(pid),
>> AMBA_REV_BITS(pid), AMBA_CONFIG_BITS(pid));
>>
>> - host->bank = pdata->bank;
>> host->select_chip = pdata->select_bank;
>> host->partitions = pdata->partitions;
>> host->nr_partitions = pdata->nr_partitions;
>> host->dev =&pdev->dev;
>> host->dev_timings = pdata->nand_timings;
>> host->mode = pdata->mode;
>> + host->max_banks = pdata->max_banks;
>>
>> if (host->mode == USE_DMA_ACCESS)
>> init_completion(&host->dma_access_complete);
>> @@ -1083,9 +1087,10 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
>> break;
>> }
>>
>> - fsmc_nand_setup(host->regs_va, host->bank,
>> - nand->options& NAND_BUSWIDTH_16,
>> - host->dev_timings);
>> + for (bank = 0; bank< host->max_banks; bank++)
>> + fsmc_nand_setup(host->regs_va, bank,
>> + nand->options& NAND_BUSWIDTH_16,
>> + host->dev_timings);
>>
>> if (AMBA_REV_BITS(host->pid)>= 8) {
>> nand->ecc.read_page = fsmc_read_page_hwecc;
>> @@ -1230,11 +1235,16 @@ static int fsmc_nand_suspend(struct device *dev)
>> static int fsmc_nand_resume(struct device *dev)
>> {
>> struct fsmc_nand_data *host = dev_get_drvdata(dev);
>> + uint32_t bank;
>> +
>> if (host) {
>> clk_prepare_enable(host->clk);
>> - fsmc_nand_setup(host->regs_va, host->bank,
>> - host->nand.options& NAND_BUSWIDTH_16,
>> - host->dev_timings);
>> +
>> + for (bank = 0; bank< host->max_banks; bank++)
>> + fsmc_nand_setup(host->regs_va, bank,
>> + host->nand.options& NAND_BUSWIDTH_16,
>> + host->dev_timings);
>> +
>> }
>> return 0;
>> }
>> diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h
>> index b200292..f0ab734 100644
>> --- a/include/linux/mtd/fsmc.h
>> +++ b/include/linux/mtd/fsmc.h
>> @@ -153,7 +153,7 @@ struct fsmc_nand_platform_data {
>> unsigned int nr_partitions;
>> unsigned int options;
>> unsigned int width;
>> - unsigned int bank;
>> + unsigned int max_banks;
>>
>> /* CLE, ALE offsets */
>> unsigned int cle_off;
>> --
>> 1.7.11.4
>>
> .
>
next prev parent reply other threads:[~2012-10-10 10:28 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-09 10:44 [PATCH 00/11] mtd/nand: fsmc driver updates Vipin Kumar
2012-10-09 10:44 ` [PATCH 01/11] fsmc/nand:FIX: Change the type for regs to void __iomem * Vipin Kumar
2012-10-09 17:14 ` viresh kumar
2012-10-10 16:49 ` Linus Walleij
2012-10-17 12:30 ` Artem Bityutskiy
2012-10-09 10:44 ` [PATCH 02/11] fsmc/nand: Rearrange the fsmc_nand_data structure and update comments Vipin Kumar
2012-10-09 11:52 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-11 4:24 ` Vipin Kumar
2012-10-09 17:15 ` viresh kumar
2012-10-09 10:44 ` [PATCH 03/11] fsmc/nand: Support multiple banks connected to controller Vipin Kumar
2012-10-09 11:55 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-10 10:28 ` Vipin Kumar [this message]
2012-10-17 12:31 ` Artem Bityutskiy
2012-10-09 10:44 ` [PATCH 04/11] fsmc/nand: Accept nand timing parameters via DT Vipin Kumar
2012-10-09 11:57 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-11 4:25 ` Vipin Kumar
2012-10-09 17:20 ` viresh kumar
2012-10-09 10:44 ` [PATCH 05/11] fsmc: Implement ready/busy through gpio pin Vipin Kumar
2012-10-09 11:59 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-09 17:34 ` viresh kumar
2012-10-09 10:44 ` [PATCH 06/11] fsmc/nand: Modify the wait to uninterruptible Vipin Kumar
2012-10-10 17:10 ` Linus Walleij
2012-10-17 12:47 ` Artem Bityutskiy
2012-10-09 10:44 ` [PATCH 07/11] fsmc/nand: Provide contiguous buffers to dma Vipin Kumar
2012-10-09 17:41 ` viresh kumar
2012-10-10 17:07 ` Linus Walleij
2012-10-11 3:16 ` viresh kumar
2012-10-11 4:07 ` Vipin Kumar
2012-10-11 4:08 ` Vipin Kumar
2012-10-11 4:15 ` viresh kumar
2012-10-11 16:06 ` Linus Walleij
2012-10-11 17:07 ` viresh kumar
2012-10-11 21:51 ` Linus Walleij
2012-10-12 3:55 ` Vipin Kumar
2012-10-15 13:18 ` Artem Bityutskiy
2012-10-15 16:27 ` Brian Norris
2012-10-15 19:51 ` Linus Walleij
2012-10-16 7:14 ` Artem Bityutskiy
2012-10-16 10:05 ` Linus Walleij
2012-10-21 7:38 ` Brian Norris
2012-10-21 11:00 ` Artem Bityutskiy
2012-10-21 12:02 ` Artem Bityutskiy
2012-10-16 7:11 ` Artem Bityutskiy
2012-10-21 7:21 ` Brian Norris
2012-10-09 10:44 ` [PATCH 08/11] fsmc/nand: Use relaxed variants of io accessors Vipin Kumar
2012-10-09 17:42 ` viresh kumar
2012-10-10 17:09 ` Linus Walleij
2012-10-09 10:44 ` [PATCH 09/11] fsmc/nand:FIX: replace change_bit routine Vipin Kumar
2012-10-10 17:22 ` Linus Walleij
2012-10-10 20:21 ` Nicolas Pitre
2012-10-11 4:17 ` Vipin Kumar
2012-10-10 20:45 ` Russell King - ARM Linux
2012-10-11 4:20 ` Vipin Kumar
2012-10-09 10:44 ` [PATCH 10/11] fsmc/nand: Add sw bch support for ecc calculation/correction Vipin Kumar
2012-10-09 11:50 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-10 10:33 ` Vipin Kumar
2012-10-09 10:44 ` [PATCH 11/11] nand: Increase the ecc placement locations to 640 Vipin Kumar
2012-10-17 12:47 ` Artem Bityutskiy
2012-10-18 6:36 ` Brian Norris
2012-10-17 12:48 ` [PATCH 00/11] mtd/nand: fsmc driver updates Artem Bityutskiy
2012-10-18 4:13 ` Vipin Kumar
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=50754DE6.3080409@st.com \
--to=vipin.kumar@st$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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