You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'for-linus-20160801' of git://git.infradead.org/linux-mtd
Pull MTD updates from Brian Norris:
"NAND:
Quoting Boris:
'This pull request contains only one notable change:
- Addition of the MTK NAND controller driver
And a bunch of specific NAND driver improvements/fixes. Here are the
changes that are worth mentioning:
- A few fixes/improvements for the xway NAND controller driver
- A few fixes for the sunxi NAND controller driver
- Support for DMA in the sunxi NAND driver
- Support for the sunxi NAND controller IP embedded in A23/A33 SoCs
- Addition for bitflips detection in erased pages to the brcmnand driver
- Support for new brcmnand IPs
- Update of the OMAP-GPMC binding to support DMA channel description'
In addition, some small fixes around error handling, etc., as well
as one long-standing corner case issue (2.6.20, I think?) with
writing 1 byte less than a page.
NOR:
- rework some error handling on reads and writes, so we can better
handle (for instance) SPI controllers which have limitations on
their maximum transfer size
- add new Cadence Quad SPI flash controller driver
- add new Atmel QSPI flash controller driver
- add new Hisilicon SPI flash controller driver
- support a few new flash, and update supported features on others
- fix the logic used for detecting a fully-unlocked flash
And other miscellaneous small fixes"
* tag 'for-linus-20160801' of git://git.infradead.org/linux-mtd: (60 commits)
mtd: spi-nor: don't build Cadence QuadSPI on non-ARM
mtd: mtk-nor: remove duplicated include from mtk-quadspi.c
mtd: nand: fix bug writing 1 byte less than page size
mtd: update description of MTD_BCM47XXSFLASH symbol
mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller
mtd: spi-nor: Bindings for Cadence Quad SPI Flash Controller driver
mtd: nand: brcmnand: Change BUG_ON in brcmnand_send_cmd
mtd: pmcmsp-flash: Allocating too much in init_msp_flash()
mtd: maps: sa1100-flash: potential NULL dereference
mtd: atmel-quadspi: add driver for Atmel QSPI controller
mtd: nand: omap2: fix return value check in omap_nand_probe()
Documentation: atmel-quadspi: add binding file for Atmel QSPI driver
mtd: spi-nor: add hisilicon spi-nor flash controller driver
mtd: spi-nor: support dual, quad, and WP for Gigadevice
mtd: spi-nor: Added support for n25q00a.
memory: Update dependency of IFC for Layerscape
mtd: nand: jz4780: Update MODULE_AUTHOR email address
mtd: nand: sunxi: prevent a small memory leak
mtd: nand: sunxi: add reset line support
mtd: nand: sunxi: update DT bindings
...
This commit is contained in:
@@ -46,6 +46,10 @@ Required properties:
|
||||
0 maps to GPMC_WAIT0 pin.
|
||||
- gpio-cells: Must be set to 2
|
||||
|
||||
Required properties when using NAND prefetch dma:
|
||||
- dmas GPMC NAND prefetch dma channel
|
||||
- dma-names Must be set to "rxtx"
|
||||
|
||||
Timing properties for child nodes. All are optional and default to 0.
|
||||
|
||||
- gpmc,sync-clk-ps: Minimum clock period for synchronous mode, in picoseconds
|
||||
@@ -137,7 +141,8 @@ Example for an AM33xx board:
|
||||
ti,hwmods = "gpmc";
|
||||
reg = <0x50000000 0x2000>;
|
||||
interrupts = <100>;
|
||||
|
||||
dmas = <&edma 52 0>;
|
||||
dma-names = "rxtx";
|
||||
gpmc,num-cs = <8>;
|
||||
gpmc,num-waitpins = <2>;
|
||||
#address-cells = <2>;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
* Atmel Quad Serial Peripheral Interface (QSPI)
|
||||
|
||||
Required properties:
|
||||
- compatible: Should be "atmel,sama5d2-qspi".
|
||||
- reg: Should contain the locations and lengths of the base registers
|
||||
and the mapped memory.
|
||||
- reg-names: Should contain the resource reg names:
|
||||
- qspi_base: configuration register address space
|
||||
- qspi_mmap: memory mapped address space
|
||||
- interrupts: Should contain the interrupt for the device.
|
||||
- clocks: The phandle of the clock needed by the QSPI controller.
|
||||
- #address-cells: Should be <1>.
|
||||
- #size-cells: Should be <0>.
|
||||
|
||||
Example:
|
||||
|
||||
spi@f0020000 {
|
||||
compatible = "atmel,sama5d2-qspi";
|
||||
reg = <0xf0020000 0x100>, <0xd0000000 0x8000000>;
|
||||
reg-names = "qspi_base", "qspi_mmap";
|
||||
interrupts = <52 IRQ_TYPE_LEVEL_HIGH 7>;
|
||||
clocks = <&spi0_clk>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_spi0_default>;
|
||||
status = "okay";
|
||||
|
||||
m25p80@0 {
|
||||
...
|
||||
};
|
||||
};
|
||||
@@ -27,6 +27,7 @@ Required properties:
|
||||
brcm,brcmnand-v6.2
|
||||
brcm,brcmnand-v7.0
|
||||
brcm,brcmnand-v7.1
|
||||
brcm,brcmnand-v7.2
|
||||
brcm,brcmnand
|
||||
- reg : the register start and length for NAND register region.
|
||||
(optional) Flash DMA register range (if present)
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
* Cadence Quad SPI controller
|
||||
|
||||
Required properties:
|
||||
- compatible : Should be "cdns,qspi-nor".
|
||||
- reg : Contains two entries, each of which is a tuple consisting of a
|
||||
physical address and length. The first entry is the address and
|
||||
length of the controller register set. The second entry is the
|
||||
address and length of the QSPI Controller data area.
|
||||
- interrupts : Unit interrupt specifier for the controller interrupt.
|
||||
- clocks : phandle to the Quad SPI clock.
|
||||
- cdns,fifo-depth : Size of the data FIFO in words.
|
||||
- cdns,fifo-width : Bus width of the data FIFO in bytes.
|
||||
- cdns,trigger-address : 32-bit indirect AHB trigger address.
|
||||
|
||||
Optional properties:
|
||||
- cdns,is-decoded-cs : Flag to indicate whether decoder is used or not.
|
||||
|
||||
Optional subnodes:
|
||||
Subnodes of the Cadence Quad SPI controller are spi slave nodes with additional
|
||||
custom properties:
|
||||
- cdns,read-delay : Delay for read capture logic, in clock cycles
|
||||
- cdns,tshsl-ns : Delay in nanoseconds for the length that the master
|
||||
mode chip select outputs are de-asserted between
|
||||
transactions.
|
||||
- cdns,tsd2d-ns : Delay in nanoseconds between one chip select being
|
||||
de-activated and the activation of another.
|
||||
- cdns,tchsh-ns : Delay in nanoseconds between last bit of current
|
||||
transaction and deasserting the device chip select
|
||||
(qspi_n_ss_out).
|
||||
- cdns,tslch-ns : Delay in nanoseconds between setting qspi_n_ss_out low
|
||||
and first bit transfer.
|
||||
|
||||
Example:
|
||||
|
||||
qspi: spi@ff705000 {
|
||||
compatible = "cdns,qspi-nor";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0xff705000 0x1000>,
|
||||
<0xffa00000 0x1000>;
|
||||
interrupts = <0 151 4>;
|
||||
clocks = <&qspi_clk>;
|
||||
cdns,is-decoded-cs;
|
||||
cdns,fifo-depth = <128>;
|
||||
cdns,fifo-width = <4>;
|
||||
cdns,trigger-address = <0x00000000>;
|
||||
|
||||
flash0: n25q00@0 {
|
||||
...
|
||||
cdns,read-delay = <4>;
|
||||
cdns,tshsl-ns = <50>;
|
||||
cdns,tsd2d-ns = <50>;
|
||||
cdns,tchsh-ns = <4>;
|
||||
cdns,tslch-ns = <4>;
|
||||
};
|
||||
};
|
||||
@@ -39,7 +39,7 @@ Optional properties:
|
||||
|
||||
"prefetch-polled" Prefetch polled mode (default)
|
||||
"polled" Polled mode, without prefetch
|
||||
"prefetch-dma" Prefetch enabled sDMA mode
|
||||
"prefetch-dma" Prefetch enabled DMA mode
|
||||
"prefetch-irq" Prefetch enabled irq mode
|
||||
|
||||
- elm_id: <deprecated> use "ti,elm-id" instead
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
HiSilicon SPI-NOR Flash Controller
|
||||
|
||||
Required properties:
|
||||
- compatible : Should be "hisilicon,fmc-spi-nor" and one of the following strings:
|
||||
"hisilicon,hi3519-spi-nor"
|
||||
- address-cells : Should be 1.
|
||||
- size-cells : Should be 0.
|
||||
- reg : Offset and length of the register set for the controller device.
|
||||
- reg-names : Must include the following two entries: "control", "memory".
|
||||
- clocks : handle to spi-nor flash controller clock.
|
||||
|
||||
Example:
|
||||
spi-nor-controller@10000000 {
|
||||
compatible = "hisilicon,hi3519-spi-nor", "hisilicon,fmc-spi-nor";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0x10000000 0x1000>, <0x14000000 0x1000000>;
|
||||
reg-names = "control", "memory";
|
||||
clocks = <&clock HI3519_FMC_CLK>;
|
||||
spi-nor@0 {
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0>;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,160 @@
|
||||
MTK SoCs NAND FLASH controller (NFC) DT binding
|
||||
|
||||
This file documents the device tree bindings for MTK SoCs NAND controllers.
|
||||
The functional split of the controller requires two drivers to operate:
|
||||
the nand controller interface driver and the ECC engine driver.
|
||||
|
||||
The hardware description for both devices must be captured as device
|
||||
tree nodes.
|
||||
|
||||
1) NFC NAND Controller Interface (NFI):
|
||||
=======================================
|
||||
|
||||
The first part of NFC is NAND Controller Interface (NFI) HW.
|
||||
Required NFI properties:
|
||||
- compatible: Should be "mediatek,mtxxxx-nfc".
|
||||
- reg: Base physical address and size of NFI.
|
||||
- interrupts: Interrupts of NFI.
|
||||
- clocks: NFI required clocks.
|
||||
- clock-names: NFI clocks internal name.
|
||||
- status: Disabled default. Then set "okay" by platform.
|
||||
- ecc-engine: Required ECC Engine node.
|
||||
- #address-cells: NAND chip index, should be 1.
|
||||
- #size-cells: Should be 0.
|
||||
|
||||
Example:
|
||||
|
||||
nandc: nfi@1100d000 {
|
||||
compatible = "mediatek,mt2701-nfc";
|
||||
reg = <0 0x1100d000 0 0x1000>;
|
||||
interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_LOW>;
|
||||
clocks = <&pericfg CLK_PERI_NFI>,
|
||||
<&pericfg CLK_PERI_NFI_PAD>;
|
||||
clock-names = "nfi_clk", "pad_clk";
|
||||
status = "disabled";
|
||||
ecc-engine = <&bch>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
Platform related properties, should be set in {platform_name}.dts:
|
||||
- children nodes: NAND chips.
|
||||
|
||||
Children nodes properties:
|
||||
- reg: Chip Select Signal, default 0.
|
||||
Set as reg = <0>, <1> when need 2 CS.
|
||||
Optional:
|
||||
- nand-on-flash-bbt: Store BBT on NAND Flash.
|
||||
- nand-ecc-mode: the NAND ecc mode (check driver for supported modes)
|
||||
- nand-ecc-step-size: Number of data bytes covered by a single ECC step.
|
||||
valid values: 512 and 1024.
|
||||
1024 is recommended for large page NANDs.
|
||||
- nand-ecc-strength: Number of bits to correct per ECC step.
|
||||
The valid values that the controller supports are: 4, 6,
|
||||
8, 10, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36, 40, 44,
|
||||
48, 52, 56, 60.
|
||||
The strength should be calculated as follows:
|
||||
E = (S - F) * 8 / 14
|
||||
S = O / (P / Q)
|
||||
E : nand-ecc-strength.
|
||||
S : spare size per sector.
|
||||
F : FDM size, should be in the range [1,8].
|
||||
It is used to store free oob data.
|
||||
O : oob size.
|
||||
P : page size.
|
||||
Q : nand-ecc-step-size.
|
||||
If the result does not match any one of the listed
|
||||
choices above, please select the smaller valid value from
|
||||
the list.
|
||||
(otherwise the driver will do the adjustment at runtime)
|
||||
- pinctrl-names: Default NAND pin GPIO setting name.
|
||||
- pinctrl-0: GPIO setting node.
|
||||
|
||||
Example:
|
||||
&pio {
|
||||
nand_pins_default: nanddefault {
|
||||
pins_dat {
|
||||
pinmux = <MT2701_PIN_111_MSDC0_DAT7__FUNC_NLD7>,
|
||||
<MT2701_PIN_112_MSDC0_DAT6__FUNC_NLD6>,
|
||||
<MT2701_PIN_114_MSDC0_DAT4__FUNC_NLD4>,
|
||||
<MT2701_PIN_118_MSDC0_DAT3__FUNC_NLD3>,
|
||||
<MT2701_PIN_121_MSDC0_DAT0__FUNC_NLD0>,
|
||||
<MT2701_PIN_120_MSDC0_DAT1__FUNC_NLD1>,
|
||||
<MT2701_PIN_113_MSDC0_DAT5__FUNC_NLD5>,
|
||||
<MT2701_PIN_115_MSDC0_RSTB__FUNC_NLD8>,
|
||||
<MT2701_PIN_119_MSDC0_DAT2__FUNC_NLD2>;
|
||||
input-enable;
|
||||
drive-strength = <MTK_DRIVE_8mA>;
|
||||
bias-pull-up;
|
||||
};
|
||||
|
||||
pins_we {
|
||||
pinmux = <MT2701_PIN_117_MSDC0_CLK__FUNC_NWEB>;
|
||||
drive-strength = <MTK_DRIVE_8mA>;
|
||||
bias-pull-up = <MTK_PUPD_SET_R1R0_10>;
|
||||
};
|
||||
|
||||
pins_ale {
|
||||
pinmux = <MT2701_PIN_116_MSDC0_CMD__FUNC_NALE>;
|
||||
drive-strength = <MTK_DRIVE_8mA>;
|
||||
bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&nandc {
|
||||
status = "okay";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&nand_pins_default>;
|
||||
nand@0 {
|
||||
reg = <0>;
|
||||
nand-on-flash-bbt;
|
||||
nand-ecc-mode = "hw";
|
||||
nand-ecc-strength = <24>;
|
||||
nand-ecc-step-size = <1024>;
|
||||
};
|
||||
};
|
||||
|
||||
NAND chip optional subnodes:
|
||||
- Partitions, see Documentation/devicetree/bindings/mtd/partition.txt
|
||||
|
||||
Example:
|
||||
nand@0 {
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
preloader@0 {
|
||||
label = "pl";
|
||||
read-only;
|
||||
reg = <0x00000000 0x00400000>;
|
||||
};
|
||||
android@0x00400000 {
|
||||
label = "android";
|
||||
reg = <0x00400000 0x12c00000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
2) ECC Engine:
|
||||
==============
|
||||
|
||||
Required BCH properties:
|
||||
- compatible: Should be "mediatek,mtxxxx-ecc".
|
||||
- reg: Base physical address and size of ECC.
|
||||
- interrupts: Interrupts of ECC.
|
||||
- clocks: ECC required clocks.
|
||||
- clock-names: ECC clocks internal name.
|
||||
- status: Disabled default. Then set "okay" by platform.
|
||||
|
||||
Example:
|
||||
|
||||
bch: ecc@1100e000 {
|
||||
compatible = "mediatek,mt2701-ecc";
|
||||
reg = <0 0x1100e000 0 0x1000>;
|
||||
interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_LOW>;
|
||||
clocks = <&pericfg CLK_PERI_NFI_ECC>;
|
||||
clock-names = "nfiecc_clk";
|
||||
status = "disabled";
|
||||
};
|
||||
@@ -11,10 +11,16 @@ Required properties:
|
||||
* "ahb" : AHB gating clock
|
||||
* "mod" : nand controller clock
|
||||
|
||||
Optional properties:
|
||||
- dmas : shall reference DMA channel associated to the NAND controller.
|
||||
- dma-names : shall be "rxtx".
|
||||
|
||||
Optional children nodes:
|
||||
Children nodes represent the available nand chips.
|
||||
|
||||
Optional properties:
|
||||
- reset : phandle + reset specifier pair
|
||||
- reset-names : must contain "ahb"
|
||||
- allwinner,rb : shall contain the native Ready/Busy ids.
|
||||
or
|
||||
- rb-gpios : shall contain the gpios used as R/B pins.
|
||||
|
||||
@@ -397,7 +397,7 @@ static int __init init_axis_flash(void)
|
||||
if (!romfs_in_flash) {
|
||||
/* Create an RAM device for the root partition (romfs). */
|
||||
|
||||
#if !defined(CONFIG_MTD_MTDRAM) || (CONFIG_MTDRAM_TOTAL_SIZE != 0) || (CONFIG_MTDRAM_ABS_POS != 0)
|
||||
#if !defined(CONFIG_MTD_MTDRAM) || (CONFIG_MTDRAM_TOTAL_SIZE != 0)
|
||||
/* No use trying to boot this kernel from RAM. Panic! */
|
||||
printk(KERN_EMERG "axisflashmap: Cannot create an MTD RAM "
|
||||
"device due to kernel (mis)configuration!\n");
|
||||
|
||||
@@ -320,7 +320,7 @@ static int __init init_axis_flash(void)
|
||||
* but its size must be configured as 0 so as not to conflict
|
||||
* with our usage.
|
||||
*/
|
||||
#if !defined(CONFIG_MTD_MTDRAM) || (CONFIG_MTDRAM_TOTAL_SIZE != 0) || (CONFIG_MTDRAM_ABS_POS != 0)
|
||||
#if !defined(CONFIG_MTD_MTDRAM) || (CONFIG_MTDRAM_TOTAL_SIZE != 0)
|
||||
if (!romfs_in_flash && !nand_boot) {
|
||||
printk(KERN_EMERG "axisflashmap: Cannot create an MTD RAM "
|
||||
"device; configure CONFIG_MTD_MTDRAM with size = 0!\n");
|
||||
|
||||
@@ -115,7 +115,7 @@ config FSL_CORENET_CF
|
||||
|
||||
config FSL_IFC
|
||||
bool
|
||||
depends on FSL_SOC
|
||||
depends on FSL_SOC || ARCH_LAYERSCAPE
|
||||
|
||||
config JZ4780_NEMC
|
||||
bool "Ingenic JZ4780 SoC NEMC driver"
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/fsl_ifc.h>
|
||||
#include <asm/prom.h>
|
||||
#include <linux/irqdomain.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
|
||||
struct fsl_ifc_ctrl *fsl_ifc_ctrl_dev;
|
||||
EXPORT_SYMBOL(fsl_ifc_ctrl_dev);
|
||||
|
||||
@@ -416,7 +416,7 @@ static int cfi_staa_read (struct mtd_info *mtd, loff_t from, size_t len, size_t
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int do_write_buffer(struct map_info *map, struct flchip *chip,
|
||||
static int do_write_buffer(struct map_info *map, struct flchip *chip,
|
||||
unsigned long adr, const u_char *buf, int len)
|
||||
{
|
||||
struct cfi_private *cfi = map->fldrv_priv;
|
||||
|
||||
@@ -113,12 +113,12 @@ config MTD_SST25L
|
||||
if you want to specify device partitioning.
|
||||
|
||||
config MTD_BCM47XXSFLASH
|
||||
tristate "R/O support for serial flash on BCMA bus"
|
||||
tristate "Support for serial flash on BCMA bus"
|
||||
depends on BCMA_SFLASH && (MIPS || ARM)
|
||||
help
|
||||
BCMA bus can have various flash memories attached, they are
|
||||
registered by bcma as platform devices. This enables driver for
|
||||
serial flash memories (only read-only mode is implemented).
|
||||
serial flash memories.
|
||||
|
||||
config MTD_SLRAM
|
||||
tristate "Uncached system RAM"
|
||||
@@ -171,18 +171,6 @@ config MTDRAM_ERASE_SIZE
|
||||
as a module, it is also possible to specify this as a parameter when
|
||||
loading the module.
|
||||
|
||||
#If not a module (I don't want to test it as a module)
|
||||
config MTDRAM_ABS_POS
|
||||
hex "SRAM Hexadecimal Absolute position or 0"
|
||||
depends on MTD_MTDRAM=y
|
||||
default "0"
|
||||
help
|
||||
If you have system RAM accessible by the CPU but not used by Linux
|
||||
in normal operation, you can give the physical address at which the
|
||||
available RAM starts, and the MTDRAM driver will use it instead of
|
||||
allocating space from Linux's available memory. Otherwise, leave
|
||||
this set to zero. Most people will want to leave this as zero.
|
||||
|
||||
config MTD_BLOCK2MTD
|
||||
tristate "MTD using block device"
|
||||
depends on BLOCK
|
||||
|
||||
@@ -73,14 +73,15 @@ static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
|
||||
return spi_write(spi, flash->command, len + 1);
|
||||
}
|
||||
|
||||
static void m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
|
||||
size_t *retlen, const u_char *buf)
|
||||
static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
|
||||
const u_char *buf)
|
||||
{
|
||||
struct m25p *flash = nor->priv;
|
||||
struct spi_device *spi = flash->spi;
|
||||
struct spi_transfer t[2] = {};
|
||||
struct spi_message m;
|
||||
int cmd_sz = m25p_cmdsz(nor);
|
||||
ssize_t ret;
|
||||
|
||||
spi_message_init(&m);
|
||||
|
||||
@@ -98,9 +99,14 @@ static void m25p80_write(struct spi_nor *nor, loff_t to, size_t len,
|
||||
t[1].len = len;
|
||||
spi_message_add_tail(&t[1], &m);
|
||||
|
||||
spi_sync(spi, &m);
|
||||
ret = spi_sync(spi, &m);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
*retlen += m.actual_length - cmd_sz;
|
||||
ret = m.actual_length - cmd_sz;
|
||||
if (ret < 0)
|
||||
return -EIO;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor)
|
||||
@@ -119,21 +125,21 @@ static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor)
|
||||
* Read an address range from the nor chip. The address range
|
||||
* may be any size provided it is within the physical boundaries.
|
||||
*/
|
||||
static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
|
||||
size_t *retlen, u_char *buf)
|
||||
static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
|
||||
u_char *buf)
|
||||
{
|
||||
struct m25p *flash = nor->priv;
|
||||
struct spi_device *spi = flash->spi;
|
||||
struct spi_transfer t[2];
|
||||
struct spi_message m;
|
||||
unsigned int dummy = nor->read_dummy;
|
||||
ssize_t ret;
|
||||
|
||||
/* convert the dummy cycles to the number of bytes */
|
||||
dummy /= 8;
|
||||
|
||||
if (spi_flash_read_supported(spi)) {
|
||||
struct spi_flash_read_message msg;
|
||||
int ret;
|
||||
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
|
||||
@@ -149,8 +155,9 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
|
||||
msg.data_nbits = m25p80_rx_nbits(nor);
|
||||
|
||||
ret = spi_flash_read(spi, &msg);
|
||||
*retlen = msg.retlen;
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return msg.retlen;
|
||||
}
|
||||
|
||||
spi_message_init(&m);
|
||||
@@ -165,13 +172,17 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
|
||||
|
||||
t[1].rx_buf = buf;
|
||||
t[1].rx_nbits = m25p80_rx_nbits(nor);
|
||||
t[1].len = len;
|
||||
t[1].len = min(len, spi_max_transfer_size(spi));
|
||||
spi_message_add_tail(&t[1], &m);
|
||||
|
||||
spi_sync(spi, &m);
|
||||
ret = spi_sync(spi, &m);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
*retlen = m.actual_length - m25p_cmdsz(nor) - dummy;
|
||||
return 0;
|
||||
ret = m.actual_length - m25p_cmdsz(nor) - dummy;
|
||||
if (ret < 0)
|
||||
return -EIO;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -186,7 +186,7 @@ static int of_flash_probe(struct platform_device *dev)
|
||||
* consists internally of 2 non-identical NOR chips on one die.
|
||||
*/
|
||||
p = of_get_property(dp, "reg", &count);
|
||||
if (count % reg_tuple_size != 0) {
|
||||
if (!p || count % reg_tuple_size != 0) {
|
||||
dev_err(&dev->dev, "Malformed reg property on %s\n",
|
||||
dev->dev.of_node->full_name);
|
||||
err = -EINVAL;
|
||||
|
||||
@@ -75,15 +75,15 @@ static int __init init_msp_flash(void)
|
||||
|
||||
printk(KERN_NOTICE "Found %d PMC flash devices\n", fcnt);
|
||||
|
||||
msp_flash = kmalloc(fcnt * sizeof(struct map_info *), GFP_KERNEL);
|
||||
msp_flash = kcalloc(fcnt, sizeof(*msp_flash), GFP_KERNEL);
|
||||
if (!msp_flash)
|
||||
return -ENOMEM;
|
||||
|
||||
msp_parts = kmalloc(fcnt * sizeof(struct mtd_partition *), GFP_KERNEL);
|
||||
msp_parts = kcalloc(fcnt, sizeof(*msp_parts), GFP_KERNEL);
|
||||
if (!msp_parts)
|
||||
goto free_msp_flash;
|
||||
|
||||
msp_maps = kcalloc(fcnt, sizeof(struct mtd_info), GFP_KERNEL);
|
||||
msp_maps = kcalloc(fcnt, sizeof(*msp_maps), GFP_KERNEL);
|
||||
if (!msp_maps)
|
||||
goto free_msp_parts;
|
||||
|
||||
|
||||
@@ -230,8 +230,10 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev,
|
||||
|
||||
info->mtd = mtd_concat_create(cdev, info->num_subdev,
|
||||
plat->name);
|
||||
if (info->mtd == NULL)
|
||||
if (info->mtd == NULL) {
|
||||
ret = -ENXIO;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
info->mtd->dev.parent = &pdev->dev;
|
||||
|
||||
|
||||
@@ -438,7 +438,7 @@ config MTD_NAND_FSL_ELBC
|
||||
|
||||
config MTD_NAND_FSL_IFC
|
||||
tristate "NAND support for Freescale IFC controller"
|
||||
depends on MTD_NAND && FSL_SOC
|
||||
depends on MTD_NAND && (FSL_SOC || ARCH_LAYERSCAPE)
|
||||
select FSL_IFC
|
||||
select MEMORY
|
||||
help
|
||||
@@ -539,7 +539,6 @@ config MTD_NAND_FSMC
|
||||
config MTD_NAND_XWAY
|
||||
tristate "Support for NAND on Lantiq XWAY SoC"
|
||||
depends on LANTIQ && SOC_TYPE_XWAY
|
||||
select MTD_NAND_PLATFORM
|
||||
help
|
||||
Enables support for NAND Flash chips on Lantiq XWAY SoCs. NAND is attached
|
||||
to the External Bus Unit (EBU).
|
||||
@@ -563,4 +562,11 @@ config MTD_NAND_QCOM
|
||||
Enables support for NAND flash chips on SoCs containing the EBI2 NAND
|
||||
controller. This controller is found on IPQ806x SoC.
|
||||
|
||||
config MTD_NAND_MTK
|
||||
tristate "Support for NAND controller on MTK SoCs"
|
||||
depends on HAS_DMA
|
||||
help
|
||||
Enables support for NAND controller on MTK SoCs.
|
||||
This controller is found on mt27xx, mt81xx, mt65xx SoCs.
|
||||
|
||||
endif # MTD_NAND
|
||||
|
||||
@@ -57,5 +57,6 @@ obj-$(CONFIG_MTD_NAND_SUNXI) += sunxi_nand.o
|
||||
obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o
|
||||
obj-$(CONFIG_MTD_NAND_BRCMNAND) += brcmnand/
|
||||
obj-$(CONFIG_MTD_NAND_QCOM) += qcom_nandc.o
|
||||
obj-$(CONFIG_MTD_NAND_MTK) += mtk_nand.o mtk_ecc.o
|
||||
|
||||
nand-objs := nand_base.o nand_bbt.o nand_timings.o
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user