Skip to content

Commit

Permalink
Merge branch 'nand/next' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/mtd/linux.git
  • Loading branch information
broonie committed Sep 29, 2022
2 parents d56580a + ba47a6a commit 0fce707
Show file tree
Hide file tree
Showing 20 changed files with 253 additions and 199 deletions.
60 changes: 0 additions & 60 deletions Documentation/devicetree/bindings/mtd/amlogic,meson-nand.txt

This file was deleted.

93 changes: 93 additions & 0 deletions Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mtd/amlogic,meson-nand.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Amlogic NAND Flash Controller (NFC) for GXBB/GXL/AXG family SoCs

allOf:
- $ref: nand-controller.yaml

maintainers:
- liang.yang@amlogic.com

properties:
compatible:
enum:
- amlogic,meson-gxl-nfc
- amlogic,meson-axg-nfc

reg:
maxItems: 2

reg-names:
items:
- const: nfc
- const: emmc

interrupts:
maxItems: 1

clocks:
minItems: 2

clock-names:
items:
- const: core
- const: device

patternProperties:
"^nand@[0-7]$":
type: object
properties:
reg:
minimum: 0
maximum: 1

nand-ecc-mode:
const: hw

nand-ecc-step-size:
const: 1024

nand-ecc-strength:
enum: [8, 16, 24, 30, 40, 50, 60]
description: |
The ECC configurations that can be supported are as follows.
meson-gxl-nfc 8, 16, 24, 30, 40, 50, 60
meson-axg-nfc 8
required:
- compatible
- reg
- interrupts
- clocks
- clock-names

unevaluatedProperties: false

examples:
- |
#include <dt-bindings/clock/axg-clkc.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
nand-controller@ffe07800 {
compatible = "amlogic,meson-axg-nfc";
reg = <0xffe07800 0x100>, <0xffe07000 0x800>;
reg-names = "nfc", "emmc";
interrupts = <GIC_SPI 34 IRQ_TYPE_EDGE_RISING>;
clocks = <&clkc CLKID_SD_EMMC_C>, <&clkc CLKID_FCLK_DIV2>;
clock-names = "core", "device";
pinctrl-0 = <&nand_pins>;
pinctrl-names = "default";
#address-cells = <1>;
#size-cells = <0>;
nand@0 {
reg = <0>;
};
};
...
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mtd/intel,lgm-nand.yaml#
$id: http://devicetree.org/schemas/mtd/intel,lgm-ebunand.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Intel LGM SoC NAND Controller Device Tree Bindings
Expand All @@ -14,7 +14,7 @@ maintainers:

properties:
compatible:
const: intel,lgm-nand
const: intel,lgm-ebunand

reg:
maxItems: 6
Expand Down Expand Up @@ -51,7 +51,7 @@ patternProperties:
properties:
reg:
minimum: 0
maximum: 7
maximum: 1

nand-ecc-mode: true

Expand All @@ -75,7 +75,7 @@ additionalProperties: false
examples:
- |
nand-controller@e0f00000 {
compatible = "intel,lgm-nand";
compatible = "intel,lgm-ebunand";
reg = <0xe0f00000 0x100>,
<0xe1000000 0x300>,
<0xe1400000 0x8000>,
Expand Down
7 changes: 2 additions & 5 deletions drivers/mtd/nand/bbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ int nanddev_bbt_init(struct nand_device *nand)
{
unsigned int bits_per_block = fls(NAND_BBT_BLOCK_NUM_STATUS);
unsigned int nblocks = nanddev_neraseblocks(nand);
unsigned int nwords = DIV_ROUND_UP(nblocks * bits_per_block,
BITS_PER_LONG);

nand->bbt.cache = kcalloc(nwords, sizeof(*nand->bbt.cache),
GFP_KERNEL);
nand->bbt.cache = bitmap_zalloc(nblocks * bits_per_block, GFP_KERNEL);
if (!nand->bbt.cache)
return -ENOMEM;

Expand All @@ -44,7 +41,7 @@ EXPORT_SYMBOL_GPL(nanddev_bbt_init);
*/
void nanddev_bbt_cleanup(struct nand_device *nand)
{
kfree(nand->bbt.cache);
bitmap_free(nand->bbt.cache);
}
EXPORT_SYMBOL_GPL(nanddev_bbt_cleanup);

Expand Down
24 changes: 2 additions & 22 deletions drivers/mtd/nand/raw/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -200,27 +200,7 @@ config MTD_NAND_TMIO
Support for NAND flash connected to a Toshiba Mobile IO
Controller in some PDAs, including the Sharp SL6000x.

config MTD_NAND_BRCMNAND
tristate "Broadcom STB NAND controller"
depends on ARM || ARM64 || MIPS || COMPILE_TEST
depends on HAS_IOMEM
help
Enables the Broadcom NAND controller driver. The controller was
originally designed for Set-Top Box but is used on various BCM7xxx,
BCM3xxx, BCM63xxx, iProc/Cygnus and more.

if MTD_NAND_BRCMNAND

config MTD_NAND_BRCMNAND_BCMA
tristate "Broadcom BCMA NAND controller"
depends on BCMA_NFLASH
depends on BCMA
help
Enables the BRCMNAND controller over BCMA on BCM47186/BCM5358 SoCs.
The glue driver will take care of performing the low-level I/O
operations to interface the BRCMNAND controller over the BCMA bus.

endif # MTD_NAND_BRCMNAND
source "drivers/mtd/nand/raw/brcmnand/Kconfig"

config MTD_NAND_BCM47XXNFLASH
tristate "BCM4706 BCMA NAND controller"
Expand Down Expand Up @@ -410,7 +390,7 @@ config MTD_NAND_STM32_FMC2

config MTD_NAND_MESON
tristate "Support for NAND controller on Amlogic's Meson SoCs"
depends on ARCH_MESON || COMPILE_TEST
depends on COMMON_CLK && (ARCH_MESON || COMPILE_TEST)
select MFD_SYSCON
help
Enables support for NAND controller on Amlogic's Meson SoCs.
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/nand/raw/arasan-nand-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ static int anfc_check_op(struct nand_chip *chip,
if (instr->ctx.data.len > ANFC_MAX_CHUNK_SIZE)
return -ENOTSUPP;

if (anfc_pkt_len_config(instr->ctx.data.len, 0, 0))
if (anfc_pkt_len_config(instr->ctx.data.len, NULL, NULL))
return -ENOTSUPP;

break;
Expand Down
1 change: 1 addition & 0 deletions drivers/mtd/nand/raw/atmel/nand-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ static int atmel_nand_dma_transfer(struct atmel_nand_controller *nc,

dma_async_issue_pending(nc->dmac);
wait_for_completion(&finished);
dma_unmap_single(nc->dev, buf_dma, len, dir);

return 0;

Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/nand/raw/bcm47xxnflash/ops_bcm4706.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <linux/bcma/bcma.h>

/* Broadcom uses 1'000'000 but it seems to be too many. Tests on WNDR4500 has
* shown ~1000 retries as maxiumum. */
* shown ~1000 retries as maximum. */
#define NFLASH_READY_RETRIES 10000

#define NFLASH_SECTOR_SIZE 512
Expand Down
49 changes: 49 additions & 0 deletions drivers/mtd/nand/raw/brcmnand/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
config MTD_NAND_BRCMNAND
tristate "Broadcom STB NAND controller"
depends on ARM || ARM64 || MIPS || COMPILE_TEST
depends on HAS_IOMEM
help
Enables the Broadcom NAND controller driver. The controller was
originally designed for Set-Top Box but is used on various BCM7xxx,
BCM3xxx, BCM63xxx, iProc/Cygnus and more.

if MTD_NAND_BRCMNAND

config MTD_NAND_BRCMNAND_BCM63XX
tristate "Broadcom BCM63xx NAND controller glue"
default BCM63XX
help
Enables the BRCMNAND glue driver to register the NAND controller
on Broadcom BCM63xx MIPS-based DSL platforms.

config MTD_NAND_BRCMNAND_BCMA
tristate "Broadcom BCMA NAND controller"
depends on BCMA_NFLASH
depends on BCMA
help
Enables the BRCMNAND controller over BCMA on BCM47186/BCM5358 SoCs.
The glue driver will take care of performing the low-level I/O
operations to interface the BRCMNAND controller over the BCMA bus.

config MTD_NAND_BRCMNAND_BCMBCA
tristate "Broadcom BCMBCA NAND controller glue"
default ARCH_BCMBCA
help
Enables the BRCMNAND glue driver to register the NAND controller
on Broadcom BCA platforms.

config MTD_NAND_BRCMNAND_BRCMSTB
tristate "Broadcom STB Nand controller glue"
default ARCH_BRCMSTB
help
Enables the BRCMNAND glue driver to register the NAND controller
on Broadcom STB platforms.

config MTD_NAND_BRCMNAND_IPROC
tristate "Broadcom iProc NAND controller glue"
default ARCH_BCM_IPROC
help
Enables the BRCMNAND controller glue driver to register the NAND
controller on Broadcom iProc platforms.

endif # MTD_NAND_BRCMNAND
8 changes: 4 additions & 4 deletions drivers/mtd/nand/raw/brcmnand/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# SPDX-License-Identifier: GPL-2.0
# link order matters; don't link the more generic brcmstb_nand.o before the
# more specific iproc_nand.o, for instance
obj-$(CONFIG_MTD_NAND_BRCMNAND) += iproc_nand.o
obj-$(CONFIG_MTD_NAND_BRCMNAND) += bcm63138_nand.o
obj-$(CONFIG_MTD_NAND_BRCMNAND) += bcm6368_nand.o
obj-$(CONFIG_MTD_NAND_BRCMNAND) += brcmstb_nand.o
obj-$(CONFIG_MTD_NAND_BRCMNAND_IPROC) += iproc_nand.o
obj-$(CONFIG_MTD_NAND_BRCMNAND_BCMBCA) += bcm63138_nand.o
obj-$(CONFIG_MTD_NAND_BRCMNAND_BCM63XX) += bcm6368_nand.o
obj-$(CONFIG_MTD_NAND_BRCMNAND_BRCMSTB) += brcmstb_nand.o
obj-$(CONFIG_MTD_NAND_BRCMNAND) += brcmnand.o

obj-$(CONFIG_MTD_NAND_BRCMNAND_BCMA) += bcma_nand.o
5 changes: 1 addition & 4 deletions drivers/mtd/nand/raw/cadence-nand-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,6 @@ static int cadence_nand_force_byte_access(struct nand_chip *chip,
bool force_8bit)
{
struct cdns_nand_ctrl *cdns_ctrl = to_cdns_nand_ctrl(chip->controller);
int status;

/*
* Callers of this function do not verify if the NAND is using a 16-bit
Expand All @@ -1990,9 +1989,7 @@ static int cadence_nand_force_byte_access(struct nand_chip *chip,
if (!(chip->options & NAND_BUSWIDTH_16))
return 0;

status = cadence_nand_set_access_width16(cdns_ctrl, !force_8bit);

return status;
return cadence_nand_set_access_width16(cdns_ctrl, !force_8bit);
}

static int cadence_nand_cmd_opcode(struct nand_chip *chip,
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/nand/raw/cafe_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static int cafe_nand_read_oob(struct nand_chip *chip, int page)
return nand_read_oob_op(chip, page, 0, chip->oob_poi, mtd->oobsize);
}
/**
* cafe_nand_read_page_syndrome - [REPLACEABLE] hardware ecc syndrome based page read
* cafe_nand_read_page - [REPLACEABLE] hardware ecc syndrome based page read
* @chip: nand chip info structure
* @buf: buffer to store read data
* @oob_required: caller expects OOB data read to chip->oob_poi
Expand Down
Loading

0 comments on commit 0fce707

Please sign in to comment.