kernel: update 4.1 to 4.1.5

Changelog:
 * https://www.kernel.org/pub/linux/kernel/v4.x/ChangeLog-4.1.5

Signed-off-by: Jonas Gorski <jogo@openwrt.org>

SVN-Revision: 46598
v19.07.3_mercusys_ac12_duma
Jonas Gorski 9 years ago
parent 8e69c9f7ef
commit 6be2305da8

@ -4,11 +4,11 @@ LINUX_RELEASE?=1
LINUX_VERSION-3.18 = .20
LINUX_VERSION-4.0 = .9
LINUX_VERSION-4.1 = .4
LINUX_VERSION-4.1 = .5
LINUX_KERNEL_MD5SUM-3.18.20 = 952c9159acdf4efbc96e08a27109d994
LINUX_KERNEL_MD5SUM-4.0.9 = 40fc5f6e2d718e539b45e6601c71985b
LINUX_KERNEL_MD5SUM-4.1.4 = 32cb4dd9f14d37bf71bafa6ed368f769
LINUX_KERNEL_MD5SUM-4.1.5 = f23e1d4ce8f63e46db81d56e36281885
ifdef KERNEL_PATCHVER
LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))

@ -268,9 +268,9 @@
#endif
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -38,6 +38,9 @@
#include <asm/traps.h>
@@ -39,6 +39,9 @@
#include <asm/dma-coherence.h>
#include <asm/mips-cm.h>
+/* For enabling BCM4710 cache workarounds */
+int bcm4710 = 0;
@ -278,7 +278,7 @@
/*
* Special Variant of smp_call_function for use by cache functions:
*
@@ -149,6 +152,9 @@ static void r4k_blast_dcache_user_page_s
@@ -157,6 +160,9 @@ static void r4k_blast_dcache_user_page_s
{
unsigned long dc_lsize = cpu_dcache_line_size();
@ -288,7 +288,7 @@
if (dc_lsize == 0)
r4k_blast_dcache_user_page = (void *)cache_noop;
else if (dc_lsize == 16)
@@ -167,6 +173,9 @@ static void r4k_blast_dcache_page_indexe
@@ -175,6 +181,9 @@ static void r4k_blast_dcache_page_indexe
{
unsigned long dc_lsize = cpu_dcache_line_size();
@ -298,7 +298,7 @@
if (dc_lsize == 0)
r4k_blast_dcache_page_indexed = (void *)cache_noop;
else if (dc_lsize == 16)
@@ -186,6 +195,9 @@ static void r4k_blast_dcache_setup(void)
@@ -194,6 +203,9 @@ static void r4k_blast_dcache_setup(void)
{
unsigned long dc_lsize = cpu_dcache_line_size();
@ -308,7 +308,7 @@
if (dc_lsize == 0)
r4k_blast_dcache = (void *)cache_noop;
else if (dc_lsize == 16)
@@ -785,6 +797,8 @@ static void local_r4k_flush_cache_sigtra
@@ -793,6 +805,8 @@ static void local_r4k_flush_cache_sigtra
unsigned long addr = (unsigned long) arg;
R4600_HIT_CACHEOP_WAR_IMPL;
@ -317,7 +317,7 @@
if (dc_lsize)
protected_writeback_dcache_line(addr & ~(dc_lsize - 1));
if (!cpu_icache_snoops_remote_store && scache_size)
@@ -1591,6 +1605,17 @@ static void coherency_setup(void)
@@ -1599,6 +1613,17 @@ static void coherency_setup(void)
* silly idea of putting something else there ...
*/
switch (current_cpu_type()) {
@ -335,7 +335,7 @@
case CPU_R4000PC:
case CPU_R4000SC:
case CPU_R4000MC:
@@ -1637,6 +1662,15 @@ void r4k_cache_init(void)
@@ -1645,6 +1670,15 @@ void r4k_cache_init(void)
extern void build_copy_page(void);
struct cpuinfo_mips *c = &current_cpu_data;
@ -351,7 +351,7 @@
probe_pcache();
setup_scache();
@@ -1706,7 +1740,15 @@ void r4k_cache_init(void)
@@ -1714,7 +1748,15 @@ void r4k_cache_init(void)
*/
local_r4k___flush_cache_all(NULL);

@ -21,7 +21,7 @@
#endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -592,7 +592,7 @@ static inline void local_r4k_flush_cache
@@ -600,7 +600,7 @@ static inline void local_r4k_flush_cache
*/
map_coherent = (cpu_has_dc_aliases &&
page_mapped(page) && !Page_dcache_dirty(page));
@ -30,7 +30,7 @@
vaddr = kmap_coherent(page, addr);
else
vaddr = kmap_atomic(page);
@@ -617,7 +617,7 @@ static inline void local_r4k_flush_cache
@@ -625,7 +625,7 @@ static inline void local_r4k_flush_cache
}
if (vaddr) {

@ -33,7 +33,7 @@ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2702,6 +2702,33 @@ config BOOT_RAW
@@ -2703,6 +2703,33 @@ config BOOT_RAW

@ -28,9 +28,6 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
1 file changed, 10 deletions(-)
delete mode 100644 arch/mips/include/asm/mach-bcm63xx/dma-coherence.h
diff --git a/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h b/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h
deleted file mode 100644
index 11d3b57..0000000
--- a/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h
+++ /dev/null
@@ -1,10 +0,0 @@
@ -44,6 +41,3 @@ index 11d3b57..0000000
-#include <asm/mach-generic/dma-coherence.h>
-
-#endif /* __ASM_MACH_BCM63XX_DMA_COHERENCE_H */
--
2.1.4

@ -1,6 +1,6 @@
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -225,6 +225,46 @@ static struct board_info __initdata board_dsl_2751b_d1 = {
@@ -225,6 +225,46 @@ static struct board_info __initdata boar
.num_board_fixups = ARRAY_SIZE(dsl2751b_e1_fixups),
},
};
@ -47,7 +47,7 @@
#endif /* CONFIG_BCM63XX_CPU_6318 */
/*
@@ -2352,6 +2392,7 @@ static const struct board_info __initconst *bcm963xx_boards[] = {
@@ -2352,6 +2392,7 @@ static const struct board_info __initcon
&board_96318ref,
&board_96318ref_p300,
&board_dsl_2751b_d1,
@ -55,7 +55,7 @@
#endif
#ifdef CONFIG_BCM63XX_CPU_6328
&board_96328avng,
@@ -2449,6 +2490,7 @@ static struct of_device_id const bcm963xx_boards_dt[] = {
@@ -2449,6 +2490,7 @@ static struct of_device_id const bcm963x
{ .compatible = "brcm,bcm96318ref", .data = &board_96318ref, },
{ .compatible = "brcm,bcm96318ref_p300", .data = &board_96318ref_p300, },
{ .compatible = "d-link,dsl-275xb-d", .data = &board_dsl_2751b_d1, },

@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1570,6 +1570,7 @@ config CPU_CAVIUM_OCTEON
@@ -1571,6 +1571,7 @@ config CPU_CAVIUM_OCTEON
select CPU_SUPPORTS_HUGEPAGES
select USB_EHCI_BIG_ENDIAN_MMIO
select MIPS_L1_CACHE_SHIFT_7
@ -27,7 +27,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
help
The Cavium Octeon processor is a highly integrated chip containing
many ethernet hardware widgets for networking tasks. The processor
@@ -1865,6 +1866,9 @@ config MIPS_MALTA_PM
@@ -1866,6 +1867,9 @@ config MIPS_MALTA_PM
bool
default y

@ -18,7 +18,7 @@ Acked-by: Rob Landley <rob@landley.net>
config CEVT_BCM1480
bool
@@ -2675,6 +2672,18 @@ config USE_OF
@@ -2676,6 +2673,18 @@ config USE_OF
config BUILTIN_DTB
bool

@ -26,7 +26,7 @@ v2: incorporated changes suggested by Jonas Gorski
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2667,6 +2667,20 @@ config MIPS_O32_FP64_SUPPORT
@@ -2668,6 +2668,20 @@ config MIPS_O32_FP64_SUPPORT
If unsure, say N.

@ -75,7 +75,7 @@
uart->tx_loadsz = up->tx_loadsz;
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2176,6 +2176,7 @@ uart_report_port(struct uart_driver *drv
@@ -2177,6 +2177,7 @@ uart_report_port(struct uart_driver *drv
snprintf(address, sizeof(address),
"I/O 0x%lx offset 0x%x", port->iobase, port->hub6);
break;
@ -83,7 +83,7 @@
case UPIO_MEM:
case UPIO_MEM32:
case UPIO_MEM32BE:
@@ -2823,6 +2824,7 @@ int uart_match_port(struct uart_port *po
@@ -2824,6 +2825,7 @@ int uart_match_port(struct uart_port *po
case UPIO_HUB6:
return (port1->iobase == port2->iobase) &&
(port1->hub6 == port2->hub6);

@ -28,8 +28,6 @@ Signed-off-by: Lee Jones <lee.jones@linaro.org>
include/linux/mfd/axp20x.h | 86 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 184 insertions(+)
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index d18029b..cfbb7d7 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -32,6 +32,7 @@
@ -40,7 +38,7 @@ index d18029b..cfbb7d7 100644
"AXP288",
};
@@ -54,6 +55,25 @@ static const struct regmap_access_table axp20x_volatile_table = {
@@ -54,6 +55,25 @@ static const struct regmap_access_table
.n_yes_ranges = ARRAY_SIZE(axp20x_volatile_ranges),
};
@ -66,7 +64,7 @@ index d18029b..cfbb7d7 100644
static const struct regmap_range axp288_writeable_ranges[] = {
regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE),
regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5),
@@ -87,6 +107,20 @@ static struct resource axp20x_pek_resources[] = {
@@ -87,6 +107,20 @@ static struct resource axp20x_pek_resour
},
};
@ -87,7 +85,7 @@ index d18029b..cfbb7d7 100644
static struct resource axp288_fuel_gauge_resources[] = {
{
.start = AXP288_IRQ_QWBTU,
@@ -129,6 +163,15 @@ static const struct regmap_config axp20x_regmap_config = {
@@ -129,6 +163,15 @@ static const struct regmap_config axp20x
.cache_type = REGCACHE_RBTREE,
};
@ -103,7 +101,7 @@ index d18029b..cfbb7d7 100644
static const struct regmap_config axp288_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
@@ -181,6 +224,34 @@ static const struct regmap_irq axp20x_regmap_irqs[] = {
@@ -181,6 +224,34 @@ static const struct regmap_irq axp20x_re
INIT_REGMAP_IRQ(AXP20X, GPIO0_INPUT, 4, 0),
};
@ -138,7 +136,7 @@ index d18029b..cfbb7d7 100644
/* some IRQs are compatible with axp20x models */
static const struct regmap_irq axp288_regmap_irqs[] = {
INIT_REGMAP_IRQ(AXP288, VBUS_FALL, 0, 2),
@@ -224,6 +295,7 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
@@ -224,6 +295,7 @@ static const struct regmap_irq axp288_re
static const struct of_device_id axp20x_of_match[] = {
{ .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
{ .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
@ -146,7 +144,7 @@ index d18029b..cfbb7d7 100644
{ },
};
MODULE_DEVICE_TABLE(of, axp20x_of_match);
@@ -258,6 +330,18 @@ static const struct regmap_irq_chip axp20x_regmap_irq_chip = {
@@ -258,6 +330,18 @@ static const struct regmap_irq_chip axp2
};
@ -165,7 +163,7 @@ index d18029b..cfbb7d7 100644
static const struct regmap_irq_chip axp288_regmap_irq_chip = {
.name = "axp288_irq_chip",
.status_base = AXP20X_IRQ1_STATE,
@@ -281,6 +365,14 @@ static struct mfd_cell axp20x_cells[] = {
@@ -281,6 +365,14 @@ static struct mfd_cell axp20x_cells[] =
},
};
@ -180,7 +178,7 @@ index d18029b..cfbb7d7 100644
static struct resource axp288_adc_resources[] = {
{
.name = "GPADC",
@@ -426,6 +518,12 @@ static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
@@ -426,6 +518,12 @@ static int axp20x_match_device(struct ax
axp20x->regmap_cfg = &axp20x_regmap_config;
axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
break;
@ -193,8 +191,6 @@ index d18029b..cfbb7d7 100644
case AXP288_ID:
axp20x->cells = axp288_cells;
axp20x->nr_cells = ARRAY_SIZE(axp288_cells);
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index dfabd6d..95568eb 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -14,6 +14,7 @@

@ -16,8 +16,6 @@ Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/regulator/axp20x-regulator.c | 143 +++++++++++++++++++++++------------
1 file changed, 94 insertions(+), 49 deletions(-)
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index e4331f5..50ae0b5 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -32,15 +32,15 @@
@ -97,7 +95,7 @@ index e4331f5..50ae0b5 100644
.n_voltages = ARRAY_SIZE(_table), \
.owner = THIS_MODULE, \
.vsel_reg = (_vreg), \
@@ -136,37 +136,57 @@ static struct regulator_ops axp20x_ops = {
@@ -136,37 +136,57 @@ static struct regulator_ops axp20x_ops =
};
static const struct regulator_desc axp20x_regulators[] = {
@ -135,7 +133,10 @@ index e4331f5..50ae0b5 100644
{
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
+ u32 min, max, def, step;
+
- if (dcdcfreq < 750) {
- dcdcfreq = 750;
- dev_warn(&pdev->dev, "DCDC frequency too low. Set to 750kHz\n");
+ switch (axp20x->variant) {
+ case AXP202_ID:
+ case AXP209_ID:
@ -148,35 +149,32 @@ index e4331f5..50ae0b5 100644
+ dev_err(&pdev->dev,
+ "Setting DCDC frequency for unsupported AXP variant\n");
+ return -EINVAL;
+ }
+
}
- if (dcdcfreq > 1875) {
- dcdcfreq = 1875;
- dev_warn(&pdev->dev, "DCDC frequency too high. Set to 1875kHz\n");
+ if (dcdcfreq == 0)
+ dcdcfreq = def;
- if (dcdcfreq < 750) {
- dcdcfreq = 750;
- dev_warn(&pdev->dev, "DCDC frequency too low. Set to 750kHz\n");
+
+ if (dcdcfreq < min) {
+ dcdcfreq = min;
+ dev_warn(&pdev->dev, "DCDC frequency too low. Set to %ukHz\n",
+ min);
}
- if (dcdcfreq > 1875) {
- dcdcfreq = 1875;
- dev_warn(&pdev->dev, "DCDC frequency too high. Set to 1875kHz\n");
- dcdcfreq = (dcdcfreq - 750) / 75;
+ if (dcdcfreq > max) {
+ dcdcfreq = max;
+ dev_warn(&pdev->dev, "DCDC frequency too high. Set to %ukHz\n",
+ max);
}
- dcdcfreq = (dcdcfreq - 750) / 75;
+ }
+
+ dcdcfreq = (dcdcfreq - min) / step;
return regmap_update_bits(axp20x->regmap, AXP20X_DCDC_FREQ,
AXP20X_FREQ_DCDC_MASK, dcdcfreq);
@@ -176,7 +196,7 @@ static int axp20x_regulator_parse_dt(struct platform_device *pdev)
@@ -176,7 +196,7 @@ static int axp20x_regulator_parse_dt(str
{
struct device_node *np, *regulators;
int ret;
@ -185,7 +183,7 @@ index e4331f5..50ae0b5 100644
np = of_node_get(pdev->dev.parent->of_node);
if (!np)
@@ -186,7 +206,6 @@ static int axp20x_regulator_parse_dt(struct platform_device *pdev)
@@ -186,7 +206,6 @@ static int axp20x_regulator_parse_dt(str
if (!regulators) {
dev_warn(&pdev->dev, "regulators node not found\n");
} else {
@ -193,7 +191,7 @@ index e4331f5..50ae0b5 100644
of_property_read_u32(regulators, "x-powers,dcdc-freq", &dcdcfreq);
ret = axp20x_set_dcdc_freq(pdev, dcdcfreq);
if (ret < 0) {
@@ -202,15 +221,27 @@ static int axp20x_regulator_parse_dt(struct platform_device *pdev)
@@ -202,15 +221,27 @@ static int axp20x_regulator_parse_dt(str
static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 workmode)
{
@ -202,7 +200,6 @@ index e4331f5..50ae0b5 100644
+ unsigned int mask;
- if ((id != AXP20X_DCDC2) && (id != AXP20X_DCDC3))
- return -EINVAL;
+ switch (axp20x->variant) {
+ case AXP202_ID:
+ case AXP209_ID:
@ -212,22 +209,24 @@ index e4331f5..50ae0b5 100644
+ mask = AXP20X_WORKMODE_DCDC2_MASK;
+ if (id == AXP20X_DCDC3)
+ mask = AXP20X_WORKMODE_DCDC3_MASK;
- if (id == AXP20X_DCDC3)
- mask = AXP20X_WORKMODE_DCDC3_MASK;
+
+ workmode <<= ffs(mask) - 1;
+ break;
- workmode <<= ffs(mask) - 1;
+
+ default:
+ /* should not happen */
+ WARN_ON(1);
+ return -EINVAL;
return -EINVAL;
-
- if (id == AXP20X_DCDC3)
- mask = AXP20X_WORKMODE_DCDC3_MASK;
-
- workmode <<= ffs(mask) - 1;
+ }
return regmap_update_bits(rdev->regmap, AXP20X_DCDC_MODE, mask, workmode);
}
@@ -219,22 +250,36 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
@@ -219,22 +250,36 @@ static int axp20x_regulator_probe(struct
{
struct regulator_dev *rdev;
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
@ -268,7 +267,7 @@ index e4331f5..50ae0b5 100644
return PTR_ERR(rdev);
}
@@ -245,7 +290,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
@@ -245,7 +290,7 @@ static int axp20x_regulator_probe(struct
if (!ret) {
if (axp20x_set_dcdc_workmode(rdev, i, workmode))
dev_err(&pdev->dev, "Failed to set workmode on %s\n",

@ -19,8 +19,6 @@ Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/regulator/axp20x-regulator.c | 96 ++++++++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 50ae0b5..6468291 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -27,8 +27,12 @@
@ -63,7 +61,7 @@ index 50ae0b5..6468291 100644
#define AXP_DESC_FIXED(_family, _id, _match, _supply, _volt) \
[_family##_##_id] = { \
.name = #_id, \
@@ -135,6 +159,14 @@ static struct regulator_ops axp20x_ops = {
@@ -135,6 +159,14 @@ static struct regulator_ops axp20x_ops =
.is_enabled = regulator_is_enabled_regmap,
};
@ -78,7 +76,7 @@ index 50ae0b5..6468291 100644
static const struct regulator_desc axp20x_regulators[] = {
AXP_DESC(AXP20X, DCDC2, "dcdc2", "vin2", 700, 2275, 25,
AXP20X_DCDC2_V_OUT, 0x3f, AXP20X_PWR_OUT_CTRL, 0x10),
@@ -152,6 +184,52 @@ static const struct regulator_desc axp20x_regulators[] = {
@@ -152,6 +184,52 @@ static const struct regulator_desc axp20
AXP20X_IO_ENABLED, AXP20X_IO_DISABLED),
};
@ -131,7 +129,7 @@ index 50ae0b5..6468291 100644
static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
{
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
@@ -165,6 +243,12 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
@@ -165,6 +243,12 @@ static int axp20x_set_dcdc_freq(struct p
def = 1500;
step = 75;
break;
@ -144,7 +142,7 @@ index 50ae0b5..6468291 100644
default:
dev_err(&pdev->dev,
"Setting DCDC frequency for unsupported AXP variant\n");
@@ -237,6 +321,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
@@ -237,6 +321,14 @@ static int axp20x_set_dcdc_workmode(stru
workmode <<= ffs(mask) - 1;
break;
@ -159,7 +157,7 @@ index 50ae0b5..6468291 100644
default:
/* should not happen */
WARN_ON(1);
@@ -265,6 +357,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
@@ -265,6 +357,10 @@ static int axp20x_regulator_probe(struct
regulators = axp20x_regulators;
nregulators = AXP20X_REG_ID_MAX;
break;

@ -26,11 +26,9 @@ Changes in v3:
include/linux/mfd/axp20x.h | 6 ++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index b369cfc..8bd3283 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -61,10 +61,16 @@ static const struct regmap_access_table axp152_volatile_table = {
@@ -39,10 +39,16 @@ static const char * const axp20x_model_n
static const struct regmap_range axp20x_writeable_ranges[] = {
regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES),
@ -47,7 +45,7 @@ index b369cfc..8bd3283 100644
};
static const struct regmap_access_table axp20x_writeable_table = {
@@ -195,7 +201,7 @@ static const struct regmap_config axp20x_regmap_config = {
@@ -159,7 +165,7 @@ static const struct regmap_config axp20x
.val_bits = 8,
.wr_table = &axp20x_writeable_table,
.volatile_table = &axp20x_volatile_table,
@ -56,11 +54,9 @@ index b369cfc..8bd3283 100644
.cache_type = REGCACHE_RBTREE,
};
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 52203d5..cc8ad1e 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -190,6 +190,12 @@ enum {
@@ -151,6 +151,12 @@ enum {
#define AXP20X_CC_CTRL 0xb8
#define AXP20X_FG_RES 0xb9

@ -13,11 +13,9 @@ Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/axp20x.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index cfbb7d7..6df9155 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -370,6 +370,8 @@ static struct mfd_cell axp22x_cells[] = {
@@ -376,6 +376,8 @@ static struct mfd_cell axp22x_cells[] =
.name = "axp20x-pek",
.num_resources = ARRAY_SIZE(axp22x_pek_resources),
.resources = axp22x_pek_resources,

@ -14,8 +14,6 @@ Signed-off-by: Lee Jones <lee.jones@linaro.org>
include/linux/mfd/axp20x.h | 61 +++++++++++++++++++++++++++++++++-
2 files changed, 143 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 8c2c3c4..b369cfc 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -30,12 +30,34 @@
@ -53,7 +51,7 @@ index 8c2c3c4..b369cfc 100644
static const struct regmap_range axp20x_writeable_ranges[] = {
regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES),
@@ -93,6 +115,11 @@ static const struct regmap_access_table axp288_volatile_table = {
@@ -99,6 +121,11 @@ static const struct regmap_access_table
.n_yes_ranges = ARRAY_SIZE(axp288_volatile_ranges),
};
@ -65,7 +63,7 @@ index 8c2c3c4..b369cfc 100644
static struct resource axp20x_pek_resources[] = {
{
.name = "PEK_DBR",
@@ -154,6 +181,15 @@ static struct resource axp288_fuel_gauge_resources[] = {
@@ -160,6 +187,15 @@ static struct resource axp288_fuel_gauge
},
};
@ -81,7 +79,7 @@ index 8c2c3c4..b369cfc 100644
static const struct regmap_config axp20x_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
@@ -184,6 +220,26 @@ static const struct regmap_config axp288_regmap_config = {
@@ -190,6 +226,26 @@ static const struct regmap_config axp288
#define INIT_REGMAP_IRQ(_variant, _irq, _off, _mask) \
[_variant##_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
@ -108,7 +106,7 @@ index 8c2c3c4..b369cfc 100644
static const struct regmap_irq axp20x_regmap_irqs[] = {
INIT_REGMAP_IRQ(AXP20X, ACIN_OVER_V, 0, 7),
INIT_REGMAP_IRQ(AXP20X, ACIN_PLUGIN, 0, 6),
@@ -293,6 +349,7 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
@@ -299,6 +355,7 @@ static const struct regmap_irq axp288_re
};
static const struct of_device_id axp20x_of_match[] = {
@ -116,7 +114,7 @@ index 8c2c3c4..b369cfc 100644
{ .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
{ .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
{ .compatible = "x-powers,axp221", .data = (void *) AXP221_ID },
@@ -317,6 +374,18 @@ static const struct acpi_device_id axp20x_acpi_match[] = {
@@ -323,6 +380,18 @@ static const struct acpi_device_id axp20
};
MODULE_DEVICE_TABLE(acpi, axp20x_acpi_match);
@ -135,7 +133,7 @@ index 8c2c3c4..b369cfc 100644
static const struct regmap_irq_chip axp20x_regmap_irq_chip = {
.name = "axp20x_irq_chip",
.status_base = AXP20X_IRQ1_STATE,
@@ -375,6 +444,14 @@ static struct mfd_cell axp22x_cells[] = {
@@ -381,6 +450,14 @@ static struct mfd_cell axp22x_cells[] =
},
};
@ -150,7 +148,7 @@ index 8c2c3c4..b369cfc 100644
static struct resource axp288_adc_resources[] = {
{
.name = "GPADC",
@@ -513,6 +590,12 @@ static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
@@ -519,6 +596,12 @@ static int axp20x_match_device(struct ax
}
switch (axp20x->variant) {
@ -163,8 +161,6 @@ index 8c2c3c4..b369cfc 100644
case AXP202_ID:
case AXP209_ID:
axp20x->nr_cells = ARRAY_SIZE(axp20x_cells);
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index c2aa853..52203d5 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -12,7 +12,8 @@
@ -236,7 +232,7 @@ index c2aa853..52203d5 100644
#define AXP20X_GPIO0_CTRL 0x90
#define AXP20X_LDO5_V_OUT 0x91
#define AXP20X_GPIO1_CTRL 0x92
@@ -218,6 +257,26 @@ enum {
@@ -224,6 +263,26 @@ enum {
/* IRQs */
enum {

@ -15,11 +15,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/mtd/nand/nand_base.c | 91 +++++++++++++++++++++++++++-----------------
1 file changed, 56 insertions(+), 35 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index c2e1232..f580ed1 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3892,42 +3892,15 @@ static bool nand_ecc_strength_good(struct mtd_info *mtd)
@@ -3892,42 +3892,15 @@ static bool nand_ecc_strength_good(struc
return corr >= ds_corr && ecc->strength >= chip->ecc_strength_ds;
}
@ -42,7 +40,7 @@ index c2e1232..f580ed1 100644
- struct nand_chip *chip = mtd->priv;
- struct nand_ecc_ctrl *ecc = &chip->ecc;
- struct nand_buffers *nbuf;
-
- /* New bad blocks should be marked in OOB, flash-based BBT, or both */
- BUG_ON((chip->bbt_options & NAND_BBT_NO_OOB_BBM) &&
- !(chip->bbt_options & NAND_BBT_USE_FLASH));
@ -55,7 +53,7 @@ index c2e1232..f580ed1 100644
- nbuf->ecccalc = (uint8_t *)(nbuf + 1);
- nbuf->ecccode = nbuf->ecccalc + mtd->oobsize;
- nbuf->databuf = nbuf->ecccode + mtd->oobsize;
-
- chip->buffers = nbuf;
- } else {
- if (!chip->buffers)

@ -27,8 +27,6 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
include/linux/mtd/nand.h | 38 +++
6 files changed, 635 insertions(+), 141 deletions(-)
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 5897d8d..8242470 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -22,6 +22,10 @@ menuconfig MTD_NAND
@ -42,22 +40,18 @@ index 5897d8d..8242470 100644
config MTD_NAND_BCH
tristate
select BCH
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 582bbd05..fcbe032 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -53,4 +53,6 @@ obj-$(CONFIG_MTD_NAND_BCM47XXNFLASH) += bcm47xxnflash/
@@ -53,4 +53,6 @@ obj-$(CONFIG_MTD_NAND_BCM47XXNFLASH) +=
obj-$(CONFIG_MTD_NAND_SUNXI) += sunxi_nand.o
obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o
+obj-$(CONFIG_MTD_OF_NAND_PARTS) += ofnandpart.o
+
nand-objs := nand_base.o nand_bbt.o nand_timings.o
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index f580ed1..a30b67f 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1134,26 +1134,26 @@ static int nand_read_page_raw_syndrome(struct mtd_info *mtd,
@@ -1134,26 +1134,26 @@ static int nand_read_page_raw_syndrome(s
struct nand_chip *chip, uint8_t *buf,
int oob_required, int page)
{
@ -93,7 +87,7 @@ index f580ed1..a30b67f 100644
}
}
@@ -1175,30 +1175,31 @@ static int nand_read_page_raw_syndrome(struct mtd_info *mtd,
@@ -1175,30 +1175,31 @@ static int nand_read_page_raw_syndrome(s
static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
uint8_t *buf, int oob_required, int page)
{
@ -134,7 +128,7 @@ index f580ed1..a30b67f 100644
if (stat < 0) {
mtd->ecc_stats.failed++;
} else {
@@ -1223,7 +1224,7 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1223,7 +1224,7 @@ static int nand_read_subpage(struct mtd_
int page)
{
int start_step, end_step, num_steps;
@ -143,7 +137,7 @@ index f580ed1..a30b67f 100644
uint8_t *p;
int data_col_addr, i, gaps = 0;
int datafrag_len, eccfrag_len, aligned_len, aligned_pos;
@@ -1232,16 +1233,16 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1232,16 +1233,16 @@ static int nand_read_subpage(struct mtd_
unsigned int max_bitflips = 0;
/* Column address within the page aligned to ECC size (256bytes) */
@ -166,7 +160,7 @@ index f580ed1..a30b67f 100644
/* If we read not a page aligned data */
if (data_col_addr != 0)
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_col_addr, -1);
@@ -1250,8 +1251,9 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1250,8 +1251,9 @@ static int nand_read_subpage(struct mtd_
chip->read_buf(mtd, p, datafrag_len);
/* Calculate ECC */
@ -178,7 +172,7 @@ index f580ed1..a30b67f 100644
/*
* The performance is faster if we position offsets according to
@@ -1275,7 +1277,8 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1275,7 +1277,8 @@ static int nand_read_subpage(struct mtd_
aligned_len = eccfrag_len;
if (eccpos[index] & (busw - 1))
aligned_len++;
@ -188,7 +182,7 @@ index f580ed1..a30b67f 100644
aligned_len++;
chip->cmdfunc(mtd, NAND_CMD_RNDOUT,
@@ -1287,11 +1290,13 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1287,11 +1290,13 @@ static int nand_read_subpage(struct mtd_
chip->buffers->ecccode[i] = chip->oob_poi[eccpos[i + index]];
p = bufpoi + data_col_addr;
@ -205,7 +199,7 @@ index f580ed1..a30b67f 100644
if (stat < 0) {
mtd->ecc_stats.failed++;
} else {
@@ -1315,32 +1320,33 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1315,32 +1320,33 @@ static int nand_read_subpage(struct mtd_
static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
uint8_t *buf, int oob_required, int page)
{
@ -248,7 +242,7 @@ index f580ed1..a30b67f 100644
if (stat < 0) {
mtd->ecc_stats.failed++;
} else {
@@ -1368,12 +1374,12 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1368,12 +1374,12 @@ static int nand_read_page_hwecc(struct m
static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd,
struct nand_chip *chip, uint8_t *buf, int oob_required, int page)
{
@ -265,7 +259,7 @@ index f580ed1..a30b67f 100644
uint8_t *ecc_calc = chip->buffers->ecccalc;
unsigned int max_bitflips = 0;
@@ -1382,17 +1388,17 @@ static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd,
@@ -1382,17 +1388,17 @@ static int nand_read_page_hwecc_oob_firs
chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
@ -287,7 +281,7 @@ index f580ed1..a30b67f 100644
if (stat < 0) {
mtd->ecc_stats.failed++;
} else {
@@ -1417,9 +1423,9 @@ static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd,
@@ -1417,9 +1423,9 @@ static int nand_read_page_hwecc_oob_firs
static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
uint8_t *buf, int oob_required, int page)
{
@ -300,7 +294,7 @@ index f580ed1..a30b67f 100644
uint8_t *p = buf;
uint8_t *oob = chip->oob_poi;
unsigned int max_bitflips = 0;
@@ -1427,17 +1433,17 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1427,17 +1433,17 @@ static int nand_read_page_syndrome(struc
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
int stat;
@ -324,7 +318,7 @@ index f580ed1..a30b67f 100644
if (stat < 0) {
mtd->ecc_stats.failed++;
@@ -1448,9 +1454,9 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1448,9 +1454,9 @@ static int nand_read_page_syndrome(struc
oob += eccbytes;
@ -337,7 +331,7 @@ index f580ed1..a30b67f 100644
}
}
@@ -1480,7 +1486,7 @@ static uint8_t *nand_transfer_oob(struct nand_chip *chip, uint8_t *oob,
@@ -1480,7 +1486,7 @@ static uint8_t *nand_transfer_oob(struct
return oob + len;
case MTD_OPS_AUTO_OOB: {
@ -346,7 +340,7 @@ index f580ed1..a30b67f 100644
uint32_t boffs = 0, roffs = ops->ooboffs;
size_t bytes = 0;
@@ -1600,17 +1606,21 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
@@ -1600,17 +1606,21 @@ read_retry:
* the read methods return max bitflips per ecc step.
*/
if (unlikely(ops->mode == MTD_OPS_RAW))
@ -376,7 +370,7 @@ index f580ed1..a30b67f 100644
if (ret < 0) {
if (use_bufpoi)
/* Invalidate page cache */
@@ -1746,6 +1756,39 @@ static int nand_read(struct mtd_info *mtd, loff_t from, size_t len,
@@ -1746,6 +1756,39 @@ static int nand_read(struct mtd_info *mt
}
/**
@ -416,7 +410,7 @@ index f580ed1..a30b67f 100644
* nand_read_oob_std - [REPLACEABLE] the most common OOB data read function
* @mtd: mtd info structure
* @chip: nand chip info structure
@@ -1770,13 +1813,14 @@ static int nand_read_oob_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1770,13 +1813,14 @@ static int nand_read_oob_syndrome(struct
int page)
{
int length = mtd->oobsize;
@ -435,7 +429,7 @@ index f580ed1..a30b67f 100644
if (sndrnd) {
pos = eccsize + i * (eccsize + chunk);
if (mtd->writesize > 512)
@@ -1829,9 +1873,10 @@ static int nand_write_oob_std(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1829,9 +1873,10 @@ static int nand_write_oob_std(struct mtd
static int nand_write_oob_syndrome(struct mtd_info *mtd,
struct nand_chip *chip, int page)
{
@ -449,7 +443,7 @@ index f580ed1..a30b67f 100644
const uint8_t *bufpoi = chip->oob_poi;
/*
@@ -1839,7 +1884,7 @@ static int nand_write_oob_syndrome(struct mtd_info *mtd,
@@ -1839,7 +1884,7 @@ static int nand_write_oob_syndrome(struc
* or
* data-pad-ecc-pad-data-pad .... ecc-pad-oob
*/
@ -458,7 +452,7 @@ index f580ed1..a30b67f 100644
pos = steps * (eccsize + chunk);
steps = 0;
} else
@@ -1903,7 +1948,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
@@ -1903,7 +1948,7 @@ static int nand_do_read_oob(struct mtd_i
stats = mtd->ecc_stats;
if (ops->mode == MTD_OPS_AUTO_OOB)
@ -467,7 +461,7 @@ index f580ed1..a30b67f 100644
else
len = mtd->oobsize;
@@ -1931,9 +1976,9 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
@@ -1931,9 +1976,9 @@ static int nand_do_read_oob(struct mtd_i
while (1) {
if (ops->mode == MTD_OPS_RAW)
@ -479,7 +473,7 @@ index f580ed1..a30b67f 100644
if (ret < 0)
break;
@@ -2021,6 +2066,56 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
@@ -2021,6 +2066,56 @@ out:
return ret;
}
@ -536,7 +530,7 @@ index f580ed1..a30b67f 100644
/**
* nand_write_page_raw - [INTERN] raw page write function
@@ -2054,26 +2149,26 @@ static int nand_write_page_raw_syndrome(struct mtd_info *mtd,
@@ -2054,26 +2149,26 @@ static int nand_write_page_raw_syndrome(
struct nand_chip *chip,
const uint8_t *buf, int oob_required)
{
@ -572,7 +566,7 @@ index f580ed1..a30b67f 100644
}
}
@@ -2093,21 +2188,21 @@ static int nand_write_page_raw_syndrome(struct mtd_info *mtd,
@@ -2093,21 +2188,21 @@ static int nand_write_page_raw_syndrome(
static int nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
const uint8_t *buf, int oob_required)
{
@ -601,7 +595,7 @@ index f580ed1..a30b67f 100644
}
/**
@@ -2120,20 +2215,20 @@ static int nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
@@ -2120,20 +2215,20 @@ static int nand_write_page_swecc(struct
static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
const uint8_t *buf, int oob_required)
{
@ -629,7 +623,7 @@ index f580ed1..a30b67f 100644
chip->oob_poi[eccpos[i]] = ecc_calc[i];
chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
@@ -2158,10 +2253,10 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd,
@@ -2158,10 +2253,10 @@ static int nand_write_subpage_hwecc(stru
{
uint8_t *oob_buf = chip->oob_poi;
uint8_t *ecc_calc = chip->buffers->ecccalc;
@ -644,7 +638,7 @@ index f580ed1..a30b67f 100644
uint32_t start_step = offset / ecc_size;
uint32_t end_step = (offset + data_len - 1) / ecc_size;
int oob_bytes = mtd->oobsize / ecc_steps;
@@ -2169,7 +2264,7 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd,
@@ -2169,7 +2264,7 @@ static int nand_write_subpage_hwecc(stru
for (step = 0; step < ecc_steps; step++) {
/* configure controller for WRITE access */
@ -653,7 +647,7 @@ index f580ed1..a30b67f 100644
/* write data (untouched subpages already masked by 0xFF) */
chip->write_buf(mtd, buf, ecc_size);
@@ -2178,7 +2273,7 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd,
@@ -2178,7 +2273,7 @@ static int nand_write_subpage_hwecc(stru
if ((step < start_step) || (step > end_step))
memset(ecc_calc, 0xff, ecc_bytes);
else
@ -662,7 +656,7 @@ index f580ed1..a30b67f 100644
/* mask OOB of un-touched subpages by padding 0xFF */
/* if oob_required, preserve OOB metadata of written subpage */
@@ -2193,7 +2288,7 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd,
@@ -2193,7 +2288,7 @@ static int nand_write_subpage_hwecc(stru
/* copy calculated ECC for whole page to chip->buffer->oob */
/* this include masked-value(0xFF) for unwritten subpages */
ecc_calc = chip->buffers->ecccalc;
@ -671,7 +665,7 @@ index f580ed1..a30b67f 100644
chip->oob_poi[eccpos[i]] = ecc_calc[i];
/* write OOB buffer to NAND device */
@@ -2217,29 +2312,29 @@ static int nand_write_page_syndrome(struct mtd_info *mtd,
@@ -2217,29 +2312,29 @@ static int nand_write_page_syndrome(stru
struct nand_chip *chip,
const uint8_t *buf, int oob_required)
{
@ -712,7 +706,7 @@ index f580ed1..a30b67f 100644
}
}
@@ -2270,7 +2365,7 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
@@ -2270,7 +2365,7 @@ static int nand_write_page(struct mtd_in
int status, subpage;
if (!(chip->options & NAND_NO_SUBPAGE_WRITE) &&
@ -721,7 +715,7 @@ index f580ed1..a30b67f 100644
subpage = offset || (data_len < mtd->writesize);
else
subpage = 0;
@@ -2278,13 +2373,15 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
@@ -2278,13 +2373,15 @@ static int nand_write_page(struct mtd_in
chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0x00, page);
if (unlikely(raw))
@ -742,7 +736,7 @@ index f580ed1..a30b67f 100644
if (status < 0)
return status;
@@ -2343,7 +2440,7 @@ static uint8_t *nand_fill_oob(struct mtd_info *mtd, uint8_t *oob, size_t len,
@@ -2343,7 +2440,7 @@ static uint8_t *nand_fill_oob(struct mtd
return oob + len;
case MTD_OPS_AUTO_OOB: {
@ -751,7 +745,7 @@ index f580ed1..a30b67f 100644
uint32_t boffs = 0, woffs = ops->ooboffs;
size_t bytes = 0;
@@ -2539,6 +2636,46 @@ static int panic_nand_write(struct mtd_info *mtd, loff_t to, size_t len,
@@ -2539,6 +2636,46 @@ static int panic_nand_write(struct mtd_i
}
/**
@ -798,7 +792,7 @@ index f580ed1..a30b67f 100644
* nand_write - [MTD Interface] NAND write with ECC
* @mtd: MTD device structure
* @to: offset to write to
@@ -2566,6 +2703,39 @@ static int nand_write(struct mtd_info *mtd, loff_t to, size_t len,
@@ -2566,6 +2703,39 @@ static int nand_write(struct mtd_info *m
}
/**
@ -838,7 +832,7 @@ index f580ed1..a30b67f 100644
* nand_do_write_oob - [MTD Interface] NAND write out-of-band
* @mtd: MTD device structure
* @to: offset to write to
@@ -2583,7 +2753,7 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
@@ -2583,7 +2753,7 @@ static int nand_do_write_oob(struct mtd_
__func__, (unsigned int)to, (int)ops->ooblen);
if (ops->mode == MTD_OPS_AUTO_OOB)
@ -847,7 +841,7 @@ index f580ed1..a30b67f 100644
else
len = mtd->oobsize;
@@ -2637,9 +2807,11 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
@@ -2637,9 +2807,11 @@ static int nand_do_write_oob(struct mtd_
nand_fill_oob(mtd, ops->oobbuf, ops->ooblen, ops);
if (ops->mode == MTD_OPS_RAW)
@ -861,7 +855,7 @@ index f580ed1..a30b67f 100644
chip->select_chip(mtd, -1);
@@ -2694,6 +2866,54 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to,
@@ -2694,6 +2866,54 @@ out:
}
/**
@ -916,7 +910,7 @@ index f580ed1..a30b67f 100644
* single_erase - [GENERIC] NAND standard block erase command function
* @mtd: MTD device structure
* @page: the page address of the block which will be erased
@@ -2723,6 +2943,29 @@ static int nand_erase(struct mtd_info *mtd, struct erase_info *instr)
@@ -2723,6 +2943,29 @@ static int nand_erase(struct mtd_info *m
}
/**
@ -946,7 +940,7 @@ index f580ed1..a30b67f 100644
* nand_erase_nand - [INTERN] erase block(s)
* @mtd: MTD device structure
* @instr: erase instruction
@@ -2864,6 +3107,18 @@ static int nand_block_isbad(struct mtd_info *mtd, loff_t offs)
@@ -2864,6 +3107,18 @@ static int nand_block_isbad(struct mtd_i
}
/**
@ -965,7 +959,7 @@ index f580ed1..a30b67f 100644
* nand_block_markbad - [MTD Interface] Mark block at the given offset as bad
* @mtd: MTD device structure
* @ofs: offset relative to mtd start
@@ -2884,6 +3139,33 @@ static int nand_block_markbad(struct mtd_info *mtd, loff_t ofs)
@@ -2884,6 +3139,33 @@ static int nand_block_markbad(struct mtd
}
/**
@ -999,7 +993,7 @@ index f580ed1..a30b67f 100644
* nand_onfi_set_features- [REPLACEABLE] set features for ONFI nand
* @mtd: MTD device structure
* @chip: nand chip info structure
@@ -4099,6 +4381,169 @@ static int nand_ecc_ctrl_init(struct mtd_info *mtd, struct nand_ecc_ctrl *ecc)
@@ -4099,6 +4381,169 @@ static int nand_ecc_ctrl_init(struct mtd
}
/**
@ -1181,11 +1175,9 @@ index f580ed1..a30b67f 100644
/* Allow subpage writes up to ecc.steps. Not possible for MLC flash */
if (!(chip->options & NAND_NO_SUBPAGE_WRITE) && nand_is_slc(chip)) {
switch (ecc->steps) {
diff --git a/drivers/mtd/nand/nand_bch.c b/drivers/mtd/nand/nand_bch.c
index 3803e0b..b82b976 100644
--- a/drivers/mtd/nand/nand_bch.c
+++ b/drivers/mtd/nand/nand_bch.c
@@ -53,14 +53,14 @@ int nand_bch_calculate_ecc(struct mtd_info *mtd, const unsigned char *buf,
@@ -53,14 +53,14 @@ int nand_bch_calculate_ecc(struct mtd_in
unsigned char *code)
{
const struct nand_chip *chip = mtd->priv;
@ -1204,7 +1196,7 @@ index 3803e0b..b82b976 100644
code[i] ^= nbc->eccmask[i];
return 0;
@@ -80,15 +80,15 @@ int nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf,
@@ -80,15 +80,15 @@ int nand_bch_correct_data(struct mtd_inf
unsigned char *read_ecc, unsigned char *calc_ecc)
{
const struct nand_chip *chip = mtd->priv;
@ -1224,11 +1216,9 @@ index 3803e0b..b82b976 100644
/* error is located in data, correct it */
buf[errloc[i] >> 3] ^= (1 << (errloc[i] & 7));
/* else error in ecc, no action needed */
diff --git a/drivers/mtd/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c
index 97c4c02..f35c418 100644
--- a/drivers/mtd/nand/nand_ecc.c
+++ b/drivers/mtd/nand/nand_ecc.c
@@ -424,7 +424,7 @@ int nand_calculate_ecc(struct mtd_info *mtd, const unsigned char *buf,
@@ -424,7 +424,7 @@ int nand_calculate_ecc(struct mtd_info *
unsigned char *code)
{
__nand_calculate_ecc(buf,
@ -1237,7 +1227,7 @@ index 97c4c02..f35c418 100644
return 0;
}
@@ -524,7 +524,7 @@ int nand_correct_data(struct mtd_info *mtd, unsigned char *buf,
@@ -524,7 +524,7 @@ int nand_correct_data(struct mtd_info *m
unsigned char *read_ecc, unsigned char *calc_ecc)
{
return __nand_correct_data(buf, read_ecc, calc_ecc,
@ -1246,8 +1236,6 @@ index 97c4c02..f35c418 100644
}
EXPORT_SYMBOL(nand_correct_data);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 3d4ea7e..510e09b 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -708,6 +708,7 @@ struct nand_chip {

@ -17,9 +17,6 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2 files changed, 121 insertions(+)
create mode 100644 drivers/mtd/nand/ofnandpart.c
diff --git a/drivers/mtd/nand/ofnandpart.c b/drivers/mtd/nand/ofnandpart.c
new file mode 100644
index 0000000..293daee
--- /dev/null
+++ b/drivers/mtd/nand/ofnandpart.c
@@ -0,0 +1,104 @@
@ -127,11 +124,9 @@ index 0000000..293daee
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Parser for NAND flash partitioning information in device tree");
+MODULE_AUTHOR("Boris BREZILLON");
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 510e09b..5616f51 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -1013,6 +1013,23 @@ static inline int jedec_feature(struct nand_chip *chip)
@@ -1014,6 +1014,23 @@ static inline int jedec_feature(struct n
: 0;
}

@ -24,11 +24,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
include/linux/mtd/nand.h | 21 ++++++
2 files changed, 175 insertions(+)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index a30b67f..8a5d12e 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1102,6 +1102,138 @@ int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
@@ -1102,6 +1102,138 @@ out:
EXPORT_SYMBOL(nand_lock);
/**
@ -167,7 +165,7 @@ index a30b67f..8a5d12e 100644
* nand_read_page_raw - [INTERN] read raw page data without ecc
* @mtd: mtd info structure
* @chip: nand chip info structure
@@ -2539,6 +2671,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
@@ -2539,6 +2671,7 @@ static int nand_do_write_ops(struct mtd_
uint8_t *wbuf = buf;
int use_bufpoi;
int part_pagewr = (column || writelen < (mtd->writesize - 1));
@ -175,7 +173,7 @@ index a30b67f..8a5d12e 100644
if (part_pagewr)
use_bufpoi = 1;
@@ -2574,6 +2707,14 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
@@ -2574,6 +2707,14 @@ static int nand_do_write_ops(struct mtd_
if (ret)
break;
@ -190,7 +188,7 @@ index a30b67f..8a5d12e 100644
writelen -= bytes;
if (!writelen)
break;
@@ -2979,6 +3120,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
@@ -2979,6 +3120,7 @@ int nand_erase_nand(struct mtd_info *mtd
int page, status, pages_per_block, ret, chipnr;
struct nand_chip *chip = mtd->priv;
loff_t len;
@ -198,7 +196,7 @@ index a30b67f..8a5d12e 100644
pr_debug("%s: start = 0x%012llx, len = %llu\n",
__func__, (unsigned long long)instr->addr,
@@ -3051,6 +3193,18 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
@@ -3051,6 +3193,18 @@ int nand_erase_nand(struct mtd_info *mtd
goto erase_exit;
}
@ -217,8 +215,6 @@ index a30b67f..8a5d12e 100644
/* Increment page address and decrement length */
len -= (1ULL << chip->phys_erase_shift);
page += pages_per_block;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 5616f51..4f7ca8d 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -521,6 +521,24 @@ struct nand_ecc_ctrl {

@ -34,11 +34,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
include/linux/mtd/nand.h | 98 +++++++++++++++
2 files changed, 321 insertions(+), 55 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 8a5d12e..577cb9e 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1102,6 +1102,62 @@ int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
@@ -1102,6 +1102,62 @@ out:
EXPORT_SYMBOL(nand_lock);
/**
@ -119,7 +117,7 @@ index 8a5d12e..577cb9e 100644
return 0;
}
@@ -1270,28 +1331,40 @@ static int nand_read_page_raw_syndrome(struct mtd_info *mtd,
@@ -1270,28 +1331,40 @@ static int nand_read_page_raw_syndrome(s
int eccbytes = chip->cur_ecc->bytes;
uint8_t *oob = chip->oob_poi;
int steps, size;
@ -166,7 +164,7 @@ index 8a5d12e..577cb9e 100644
return 0;
}
@@ -1380,7 +1453,8 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1380,7 +1453,8 @@ static int nand_read_subpage(struct mtd_
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_col_addr, -1);
p = bufpoi + data_col_addr;
@ -176,7 +174,7 @@ index 8a5d12e..577cb9e 100644
/* Calculate ECC */
for (i = 0; i < eccfrag_len;
@@ -1399,7 +1473,8 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1399,7 +1473,8 @@ static int nand_read_subpage(struct mtd_
}
if (gaps) {
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
@ -186,7 +184,7 @@ index 8a5d12e..577cb9e 100644
} else {
/*
* Send the command to read the particular ECC bytes take care
@@ -1415,7 +1490,8 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1415,7 +1490,8 @@ static int nand_read_subpage(struct mtd_
chip->cmdfunc(mtd, NAND_CMD_RNDOUT,
mtd->writesize + aligned_pos, -1);
@ -196,7 +194,7 @@ index 8a5d12e..577cb9e 100644
}
for (i = 0; i < eccfrag_len; i++)
@@ -1436,6 +1512,7 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1436,6 +1512,7 @@ static int nand_read_subpage(struct mtd_
max_bitflips = max_t(unsigned int, max_bitflips, stat);
}
}
@ -204,7 +202,7 @@ index 8a5d12e..577cb9e 100644
return max_bitflips;
}
@@ -1460,13 +1537,17 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1460,13 +1537,17 @@ static int nand_read_page_hwecc(struct m
uint8_t *ecc_code = chip->buffers->ecccode;
uint32_t *eccpos = chip->cur_ecc->layout->eccpos;
unsigned int max_bitflips = 0;
@ -224,7 +222,7 @@ index 8a5d12e..577cb9e 100644
for (i = 0; i < chip->cur_ecc->total; i++)
ecc_code[i] = chip->oob_poi[eccpos[i]];
@@ -1486,6 +1567,7 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1486,6 +1567,7 @@ static int nand_read_page_hwecc(struct m
max_bitflips = max_t(unsigned int, max_bitflips, stat);
}
}
@ -232,7 +230,7 @@ index 8a5d12e..577cb9e 100644
return max_bitflips;
}
@@ -1514,11 +1596,14 @@ static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd,
@@ -1514,11 +1596,14 @@ static int nand_read_page_hwecc_oob_firs
uint32_t *eccpos = chip->cur_ecc->layout->eccpos;
uint8_t *ecc_calc = chip->buffers->ecccalc;
unsigned int max_bitflips = 0;
@ -248,7 +246,7 @@ index 8a5d12e..577cb9e 100644
for (i = 0; i < chip->cur_ecc->total; i++)
ecc_code[i] = chip->oob_poi[eccpos[i]];
@@ -1527,7 +1612,8 @@ static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd,
@@ -1527,7 +1612,8 @@ static int nand_read_page_hwecc_oob_firs
int stat;
chip->cur_ecc->hwctl(mtd, NAND_ECC_READ);
@ -258,7 +256,7 @@ index 8a5d12e..577cb9e 100644
chip->cur_ecc->calculate(mtd, p, &ecc_calc[i]);
stat = chip->cur_ecc->correct(mtd, p, &ecc_code[i], NULL);
@@ -1538,6 +1624,7 @@ static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd,
@@ -1538,6 +1624,7 @@ static int nand_read_page_hwecc_oob_firs
max_bitflips = max_t(unsigned int, max_bitflips, stat);
}
}
@ -266,7 +264,7 @@ index 8a5d12e..577cb9e 100644
return max_bitflips;
}
@@ -1561,20 +1648,27 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1561,20 +1648,27 @@ static int nand_read_page_syndrome(struc
uint8_t *p = buf;
uint8_t *oob = chip->oob_poi;
unsigned int max_bitflips = 0;
@ -297,7 +295,7 @@ index 8a5d12e..577cb9e 100644
stat = chip->cur_ecc->correct(mtd, p, oob, NULL);
if (stat < 0) {
@@ -1587,29 +1681,36 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1587,29 +1681,36 @@ static int nand_read_page_syndrome(struc
oob += eccbytes;
if (chip->cur_ecc->postpad) {
@ -339,7 +337,7 @@ index 8a5d12e..577cb9e 100644
switch (ops->mode) {
case MTD_OPS_PLACE_OOB:
@@ -1737,6 +1838,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
@@ -1737,6 +1838,7 @@ read_retry:
* Now read the page into the buffer. Absent an error,
* the read methods return max bitflips per ecc step.
*/
@ -347,7 +345,7 @@ index 8a5d12e..577cb9e 100644
if (unlikely(ops->mode == MTD_OPS_RAW))
ret = chip->cur_ecc->read_page_raw(mtd, chip,
bufpoi,
@@ -1753,6 +1855,8 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
@@ -1753,6 +1855,8 @@ read_retry:
bufpoi,
oob_required,
page);
@ -356,7 +354,7 @@ index 8a5d12e..577cb9e 100644
if (ret < 0) {
if (use_bufpoi)
/* Invalidate page cache */
@@ -1780,8 +1884,8 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
@@ -1780,8 +1884,8 @@ read_retry:
int toread = min(oobreadlen, max_oobsize);
if (toread) {
@ -367,7 +365,7 @@ index 8a5d12e..577cb9e 100644
oobreadlen -= toread;
}
}
@@ -1909,12 +2013,15 @@ static int nand_part_read(struct mtd_info *mtd, loff_t from, size_t len,
@@ -1909,12 +2013,15 @@ static int nand_part_read(struct mtd_inf
nand_get_device(part->master, FL_READING);
if (part->ecc)
chip->cur_ecc = part->ecc;
@ -383,7 +381,7 @@ index 8a5d12e..577cb9e 100644
chip->cur_ecc = &chip->ecc;
nand_release_device(part->master);
return ret;
@@ -1930,7 +2037,9 @@ static int nand_read_oob_std(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1930,7 +2037,9 @@ static int nand_read_oob_std(struct mtd_
int page)
{
chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
@ -394,7 +392,7 @@ index 8a5d12e..577cb9e 100644
return 0;
}
@@ -1949,7 +2058,7 @@ static int nand_read_oob_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1949,7 +2058,7 @@ static int nand_read_oob_syndrome(struct
chip->cur_ecc->postpad;
int eccsize = chip->cur_ecc->size;
uint8_t *bufpoi = chip->oob_poi;
@ -403,7 +401,7 @@ index 8a5d12e..577cb9e 100644
chip->cmdfunc(mtd, NAND_CMD_READ0, chip->cur_ecc->size, page);
for (i = 0; i < chip->cur_ecc->steps; i++) {
@@ -1962,12 +2071,17 @@ static int nand_read_oob_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1962,12 +2071,17 @@ static int nand_read_oob_syndrome(struct
} else
sndrnd = 1;
toread = min_t(int, length, chunk);
@ -424,7 +422,7 @@ index 8a5d12e..577cb9e 100644
return 0;
}
@@ -1986,7 +2100,9 @@ static int nand_write_oob_std(struct mtd_info *mtd, struct nand_chip *chip,
@@ -1986,7 +2100,9 @@ static int nand_write_oob_std(struct mtd
int length = mtd->oobsize;
chip->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize, page);
@ -435,7 +433,7 @@ index 8a5d12e..577cb9e 100644
/* Send command to program the OOB data */
chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
@@ -2042,12 +2158,18 @@ static int nand_write_oob_syndrome(struct mtd_info *mtd,
@@ -2042,12 +2158,18 @@ static int nand_write_oob_syndrome(struc
} else
sndcmd = 1;
len = min_t(int, length, chunk);
@ -457,7 +455,7 @@ index 8a5d12e..577cb9e 100644
chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
status = chip->waitfunc(mtd, chip);
@@ -2116,7 +2238,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
@@ -2116,7 +2238,7 @@ static int nand_do_read_oob(struct mtd_i
break;
len = min(len, readlen);
@ -466,7 +464,7 @@ index 8a5d12e..577cb9e 100644
if (chip->options & NAND_NEED_READRDY) {
/* Apply delay or wait for ready/busy pin */
@@ -2226,6 +2348,8 @@ static int nand_part_read_oob(struct mtd_info *mtd, loff_t from,
@@ -2226,6 +2348,8 @@ static int nand_part_read_oob(struct mtd
nand_get_device(part->master, FL_READING);
if (part->ecc)
chip->cur_ecc = part->ecc;
@ -475,7 +473,7 @@ index 8a5d12e..577cb9e 100644
switch (ops->mode) {
case MTD_OPS_PLACE_OOB:
@@ -2243,6 +2367,7 @@ static int nand_part_read_oob(struct mtd_info *mtd, loff_t from,
@@ -2243,6 +2367,7 @@ static int nand_part_read_oob(struct mtd
ret = nand_do_read_ops(part->master, from, ops);
out:
@ -483,7 +481,7 @@ index 8a5d12e..577cb9e 100644
chip->cur_ecc = &chip->ecc;
nand_release_device(part->master);
return ret;
@@ -2261,9 +2386,11 @@ static int nand_part_read_oob(struct mtd_info *mtd, loff_t from,
@@ -2261,9 +2386,11 @@ out:
static int nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
const uint8_t *buf, int oob_required)
{
@ -498,7 +496,7 @@ index 8a5d12e..577cb9e 100644
return 0;
}
@@ -2285,28 +2412,39 @@ static int nand_write_page_raw_syndrome(struct mtd_info *mtd,
@@ -2285,28 +2412,39 @@ static int nand_write_page_raw_syndrome(
int eccbytes = chip->cur_ecc->bytes;
uint8_t *oob = chip->oob_poi;
int steps, size;
@ -544,7 +542,7 @@ index 8a5d12e..577cb9e 100644
return 0;
}
@@ -2353,17 +2491,21 @@ static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
@@ -2353,17 +2491,21 @@ static int nand_write_page_hwecc(struct
uint8_t *ecc_calc = chip->buffers->ecccalc;
const uint8_t *p = buf;
uint32_t *eccpos = chip->cur_ecc->layout->eccpos;
@ -568,7 +566,7 @@ index 8a5d12e..577cb9e 100644
return 0;
}
@@ -2399,7 +2541,9 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd,
@@ -2399,7 +2541,9 @@ static int nand_write_subpage_hwecc(stru
chip->cur_ecc->hwctl(mtd, NAND_ECC_WRITE);
/* write data (untouched subpages already masked by 0xFF) */
@ -579,7 +577,7 @@ index 8a5d12e..577cb9e 100644
/* mask ECC of un-touched subpages by padding 0xFF */
if ((step < start_step) || (step > end_step))
@@ -2424,7 +2568,8 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd,
@@ -2424,7 +2568,8 @@ static int nand_write_subpage_hwecc(stru
chip->oob_poi[eccpos[i]] = ecc_calc[i];
/* write OOB buffer to NAND device */
@ -589,7 +587,7 @@ index 8a5d12e..577cb9e 100644
return 0;
}
@@ -2449,31 +2594,42 @@ static int nand_write_page_syndrome(struct mtd_info *mtd,
@@ -2449,31 +2594,42 @@ static int nand_write_page_syndrome(stru
int eccsteps = chip->cur_ecc->steps;
const uint8_t *p = buf;
uint8_t *oob = chip->oob_poi;
@ -638,7 +636,7 @@ index 8a5d12e..577cb9e 100644
return 0;
}
@@ -2504,6 +2660,7 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
@@ -2504,6 +2660,7 @@ static int nand_write_page(struct mtd_in
chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0x00, page);
@ -646,7 +644,7 @@ index 8a5d12e..577cb9e 100644
if (unlikely(raw))
status = chip->cur_ecc->write_page_raw(mtd, chip, buf,
oob_required);
@@ -2514,6 +2671,7 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
@@ -2514,6 +2671,7 @@ static int nand_write_page(struct mtd_in
else
status = chip->cur_ecc->write_page(mtd, chip, buf,
oob_required);
@ -654,7 +652,7 @@ index 8a5d12e..577cb9e 100644
if (status < 0)
return status;
@@ -2803,6 +2961,8 @@ static int panic_nand_part_write(struct mtd_info *mtd, loff_t to, size_t len,
@@ -2803,6 +2961,8 @@ static int panic_nand_part_write(struct
panic_nand_get_device(chip, part->master, FL_WRITING);
if (part->ecc)
chip->cur_ecc = part->ecc;
@ -663,7 +661,7 @@ index 8a5d12e..577cb9e 100644
ops.len = len;
ops.datbuf = (uint8_t *)buf;
@@ -2811,6 +2971,7 @@ static int panic_nand_part_write(struct mtd_info *mtd, loff_t to, size_t len,
@@ -2811,6 +2971,7 @@ static int panic_nand_part_write(struct
ret = nand_do_write_ops(part->master, to, &ops);
@ -671,7 +669,7 @@ index 8a5d12e..577cb9e 100644
chip->cur_ecc = &chip->ecc;
*retlen = ops.retlen;
return ret;
@@ -2865,12 +3026,15 @@ static int nand_part_write(struct mtd_info *mtd, loff_t to, size_t len,
@@ -2865,12 +3026,15 @@ static int nand_part_write(struct mtd_in
nand_get_device(part->master, FL_WRITING);
if (part->ecc)
chip->cur_ecc = part->ecc;
@ -687,7 +685,7 @@ index 8a5d12e..577cb9e 100644
chip->cur_ecc = &chip->ecc;
nand_release_device(part->master);
return ret;
@@ -3032,6 +3196,8 @@ static int nand_part_write_oob(struct mtd_info *mtd, loff_t to,
@@ -3032,6 +3196,8 @@ static int nand_part_write_oob(struct mt
nand_get_device(part->master, FL_WRITING);
if (part->ecc)
chip->cur_ecc = part->ecc;
@ -696,7 +694,7 @@ index 8a5d12e..577cb9e 100644
switch (ops->mode) {
case MTD_OPS_PLACE_OOB:
@@ -3049,6 +3215,7 @@ static int nand_part_write_oob(struct mtd_info *mtd, loff_t to,
@@ -3049,6 +3215,7 @@ static int nand_part_write_oob(struct mt
ret = nand_do_write_ops(part->master, to, ops);
out:
@ -712,11 +710,9 @@ index 8a5d12e..577cb9e 100644
/* Allow subpage writes up to ecc.steps. Not possible for MLC flash */
if (!(chip->options & NAND_NO_SUBPAGE_WRITE) && nand_is_slc(chip)) {
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 4f7ca8d..6cbd06a3 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -539,6 +539,64 @@ void nand_page_set_status(struct mtd_info *mtd, int page,
@@ -539,6 +539,64 @@ void nand_page_set_status(struct mtd_inf
int nand_pst_create(struct mtd_info *mtd);
@ -807,7 +803,7 @@ index 4f7ca8d..6cbd06a3 100644
void (*release)(struct nand_part *part);
};
@@ -902,6 +965,41 @@ extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
@@ -902,6 +965,41 @@ extern int nand_erase_nand(struct mtd_in
extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, uint8_t *buf);

@ -12,11 +12,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
include/linux/of_mtd.h | 6 ++++++
2 files changed, 41 insertions(+)
diff --git a/drivers/of/of_mtd.c b/drivers/of/of_mtd.c
index b7361ed..4e42c26 100644
--- a/drivers/of/of_mtd.c
+++ b/drivers/of/of_mtd.c
@@ -84,6 +84,41 @@ int of_get_nand_ecc_strength(struct device_node *np)
@@ -84,6 +84,41 @@ int of_get_nand_ecc_strength(struct devi
EXPORT_SYMBOL_GPL(of_get_nand_ecc_strength);
/**
@ -58,8 +56,6 @@ index b7361ed..4e42c26 100644
* of_get_nand_bus_width - Get nand bus witdh for given device_node
* @np: Pointer to the given device_node
*
diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h
index e266caa..1059472 100644
--- a/include/linux/of_mtd.h
+++ b/include/linux/of_mtd.h
@@ -15,6 +15,7 @@
@ -70,15 +66,15 @@ index e266caa..1059472 100644
int of_get_nand_bus_width(struct device_node *np);
bool of_get_nand_on_flash_bbt(struct device_node *np);
@@ -35,6 +36,11 @@ static inline int of_get_nand_ecc_strength(struct device_node *np)
@@ -34,6 +35,11 @@ static inline int of_get_nand_ecc_streng
{
return -ENOSYS;
}
+
+static inline int of_get_nand_rnd_mode(struct device_node *np)
+{
+ return -ENOSYS;
+}
+
static inline int of_get_nand_bus_width(struct device_node *np)
{
return -ENOSYS;

@ -13,11 +13,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
include/linux/mtd/nand.h | 4 ++++
2 files changed, 11 insertions(+)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 577cb9e..51642c6 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -4382,6 +4382,13 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
@@ -4382,6 +4382,13 @@ ident_done:
if (mtd->writesize > 512 && chip->cmdfunc == nand_command)
chip->cmdfunc = nand_command_lp;
@ -31,8 +29,6 @@ index 577cb9e..51642c6 100644
pr_info("device found, Manufacturer ID: 0x%02x, Chip ID: 0x%02x\n",
*maf_id, *dev_id);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 6cbd06a3..5844d6f 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -748,6 +748,9 @@ struct nand_chip {

@ -15,8 +15,6 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
4 files changed, 164 insertions(+), 2 deletions(-)
create mode 100644 drivers/mtd/nand/nand_hynix.c
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index fcbe032..07b7c8c 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -5,7 +5,7 @@
@ -28,9 +26,6 @@ index fcbe032..07b7c8c 100644
obj-$(CONFIG_MTD_SM_COMMON) += sm_common.o
obj-$(CONFIG_MTD_NAND_CAFE) += cafe_nand.o
diff --git a/drivers/mtd/nand/nand_hynix.c b/drivers/mtd/nand/nand_hynix.c
new file mode 100644
index 0000000..0d051bf5
--- /dev/null
+++ b/drivers/mtd/nand/nand_hynix.c
@@ -0,0 +1,159 @@
@ -193,11 +188,9 @@ index 0000000..0d051bf5
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Boris BREZILLON <b.brezillon.dev@gmail.com>");
+MODULE_DESCRIPTION("Hynix NAND specific code");
diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c
index dd620c1..b786718 100644
--- a/drivers/mtd/nand/nand_ids.c
+++ b/drivers/mtd/nand/nand_ids.c
@@ -163,6 +163,7 @@ struct nand_flash_dev nand_flash_ids[] = {
@@ -163,6 +163,7 @@ struct nand_flash_dev nand_flash_ids[] =
{NULL}
};
@ -205,7 +198,7 @@ index dd620c1..b786718 100644
/* Manufacturer IDs */
struct nand_manufacturers nand_manuf_ids[] = {
{NAND_MFR_TOSHIBA, "Toshiba"},
@@ -171,7 +172,7 @@ struct nand_manufacturers nand_manuf_ids[] = {
@@ -171,7 +172,7 @@ struct nand_manufacturers nand_manuf_ids
{NAND_MFR_NATIONAL, "National"},
{NAND_MFR_RENESAS, "Renesas"},
{NAND_MFR_STMICRO, "ST Micro"},
@ -214,8 +207,6 @@ index dd620c1..b786718 100644
{NAND_MFR_MICRON, "Micron"},
{NAND_MFR_AMD, "AMD/Spansion"},
{NAND_MFR_MACRONIX, "Macronix"},
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 5844d6f..328aab2 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -959,6 +959,8 @@ struct nand_manufacturers {

@ -13,8 +13,6 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
include/linux/mtd/nand.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 328aab2..c20f35b 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -176,17 +176,17 @@ typedef enum {

@ -22,11 +22,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/mtd/nand/nand_base.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 51642c6..e3d4d8e 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -4063,6 +4063,41 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
@@ -4063,6 +4063,41 @@ static void nand_decode_ext_id(struct mt
mtd->erasesize = (128 * 1024) <<
(((extid >> 1) & 0x04) | (extid & 0x03));
*busw = 0;

@ -11,11 +11,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/mtd/nand/nand_base.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index e3d4d8e..5c6f465 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -4437,9 +4437,11 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
@@ -4437,9 +4437,11 @@ ident_done:
pr_info("%s %s\n", nand_manuf_ids[maf_idx].name,
type->name);

@ -12,11 +12,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/mtd/nand/nand_base.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 5c6f465..05ec786 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -4247,7 +4247,7 @@ static inline bool is_full_id_nand(struct nand_flash_dev *type)
@@ -4247,7 +4247,7 @@ static inline bool is_full_id_nand(struc
}
static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
@ -25,7 +23,7 @@ index 5c6f465..05ec786 100644
{
if (!strncmp(type->id, id_data, type->id_len)) {
mtd->writesize = type->pagesize;
@@ -4273,6 +4273,21 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
@@ -4273,6 +4273,21 @@ static bool find_full_id_nand(struct mtd
}
/*
@ -47,7 +45,7 @@ index 5c6f465..05ec786 100644
* Get the flash and manufacturer id and lookup if the type is supported.
*/
static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
@@ -4385,8 +4400,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
@@ -4385,8 +4400,7 @@ ident_done:
* Check, if buswidth is correct. Hardware drivers should set
* chip correct!
*/
@ -57,7 +55,7 @@ index 5c6f465..05ec786 100644
pr_info("%s %s\n", nand_manuf_ids[maf_idx].name, mtd->name);
pr_warn("bus width %d instead %d bit\n",
(chip->options & NAND_BUSWIDTH_16) ? 16 : 8,
@@ -4424,8 +4438,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
@@ -4424,8 +4438,7 @@ ident_done:
return ERR_PTR(err);
}

@ -12,8 +12,6 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/mtd/nand/sunxi_nand.c | 73 +++++++++++++++++++++++++++++++++++++------
2 files changed, 65 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 8242470..7df88c6 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -525,6 +525,7 @@ config MTD_NAND_XWAY
@ -24,8 +22,6 @@ index 8242470..7df88c6 100644
help
Enables support for NAND Flash chips on Allwinner SoCs.
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index 6f93b29..c3e0473 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -202,6 +202,23 @@ struct sunxi_nand_hw_ecc {
@ -52,7 +48,7 @@ index 6f93b29..c3e0473 100644
* NAND chip structure: stores NAND chip device related information
*
* @node: used to store NAND chips into a list
@@ -521,7 +538,7 @@ static int sunxi_nfc_hw_ecc_read_page(struct mtd_info *mtd,
@@ -521,7 +538,7 @@ static int sunxi_nfc_hw_ecc_read_page(st
int oob_required, int page)
{
struct sunxi_nfc *nfc = to_sunxi_nfc(chip->controller);
@ -61,7 +57,7 @@ index 6f93b29..c3e0473 100644
struct nand_ecclayout *layout = ecc->layout;
struct sunxi_nand_hw_ecc *data = ecc->priv;
unsigned int max_bitflips = 0;
@@ -607,7 +624,7 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
@@ -607,7 +624,7 @@ static int sunxi_nfc_hw_ecc_write_page(s
const uint8_t *buf, int oob_required)
{
struct sunxi_nfc *nfc = to_sunxi_nfc(chip->controller);
@ -70,7 +66,7 @@ index 6f93b29..c3e0473 100644
struct nand_ecclayout *layout = ecc->layout;
struct sunxi_nand_hw_ecc *data = ecc->priv;
int offset;
@@ -681,7 +698,7 @@ static int sunxi_nfc_hw_syndrome_ecc_read_page(struct mtd_info *mtd,
@@ -681,7 +698,7 @@ static int sunxi_nfc_hw_syndrome_ecc_rea
int page)
{
struct sunxi_nfc *nfc = to_sunxi_nfc(chip->controller);
@ -79,7 +75,7 @@ index 6f93b29..c3e0473 100644
struct sunxi_nand_hw_ecc *data = ecc->priv;
unsigned int max_bitflips = 0;
uint8_t *oob = chip->oob_poi;
@@ -749,7 +766,7 @@ static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,
@@ -749,7 +766,7 @@ static int sunxi_nfc_hw_syndrome_ecc_wri
int oob_required)
{
struct sunxi_nfc *nfc = to_sunxi_nfc(chip->controller);
@ -88,7 +84,7 @@ index 6f93b29..c3e0473 100644
struct sunxi_nand_hw_ecc *data = ecc->priv;
uint8_t *oob = chip->oob_poi;
int offset = 0;
@@ -1099,8 +1116,13 @@ static int sunxi_nand_ecc_init(struct mtd_info *mtd, struct nand_ecc_ctrl *ecc,
@@ -1099,8 +1116,13 @@ static int sunxi_nand_ecc_init(struct mt
ecc->strength = nand->ecc_strength_ds;
}
@ -104,7 +100,7 @@ index 6f93b29..c3e0473 100644
ecc->mode = NAND_ECC_HW;
@@ -1135,12 +1157,39 @@ static int sunxi_nand_ecc_init(struct mtd_info *mtd, struct nand_ecc_ctrl *ecc,
@@ -1135,12 +1157,39 @@ static int sunxi_nand_ecc_init(struct mt
return 0;
}
@ -145,7 +141,7 @@ index 6f93b29..c3e0473 100644
struct mtd_info *mtd;
struct nand_chip *nand;
int nsels;
@@ -1269,8 +1318,14 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
@@ -1269,8 +1318,14 @@ static int sunxi_nand_chip_init(struct d
return ret;
}

@ -11,8 +11,6 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/mtd/nand/sunxi_nand.c | 603 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 585 insertions(+), 18 deletions(-)
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index c3e0473..2f6ab39 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -206,10 +206,12 @@ struct sunxi_nand_hw_ecc {
@ -28,7 +26,7 @@ index c3e0473..2f6ab39 100644
};
static inline struct sunxi_nand_part *
@@ -219,6 +221,29 @@ to_sunxi_nand_part(struct nand_part *part)
@@ -219,6 +221,29 @@ to_sunxi_nand_part(struct nand_part *par
}
/*
@ -66,7 +64,7 @@ index c3e0473..2f6ab39 100644
unsigned long clk_rate;
int selected;
int nsels;
@@ -489,6 +515,185 @@ static void sunxi_nfc_write_buf(struct mtd_info *mtd, const uint8_t *buf,
@@ -489,6 +515,185 @@ static void sunxi_nfc_write_buf(struct m
}
}
@ -252,7 +250,7 @@ index c3e0473..2f6ab39 100644
static uint8_t sunxi_nfc_read_byte(struct mtd_info *mtd)
{
uint8_t ret;
@@ -538,16 +743,43 @@ static int sunxi_nfc_hw_ecc_read_page(struct mtd_info *mtd,
@@ -538,16 +743,43 @@ static int sunxi_nfc_hw_ecc_read_page(st
int oob_required, int page)
{
struct sunxi_nfc *nfc = to_sunxi_nfc(chip->controller);
@ -296,7 +294,7 @@ index c3e0473..2f6ab39 100644
tmp = readl(nfc->regs + NFC_REG_ECC_CTL);
tmp &= ~(NFC_ECC_MODE | NFC_ECC_PIPELINE | NFC_ECC_BLOCK_SIZE);
tmp |= NFC_ECC_EN | (data->mode << NFC_ECC_MODE_SHIFT) |
@@ -556,12 +788,15 @@ static int sunxi_nfc_hw_ecc_read_page(struct mtd_info *mtd,
@@ -556,12 +788,15 @@ static int sunxi_nfc_hw_ecc_read_page(st
writel(tmp, nfc->regs + NFC_REG_ECC_CTL);
for (i = 0; i < ecc->steps; i++) {
@ -313,7 +311,7 @@ index c3e0473..2f6ab39 100644
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, offset, -1);
@@ -569,6 +804,25 @@ static int sunxi_nfc_hw_ecc_read_page(struct mtd_info *mtd,
@@ -569,6 +804,25 @@ static int sunxi_nfc_hw_ecc_read_page(st
if (ret)
return ret;
@ -339,7 +337,7 @@ index c3e0473..2f6ab39 100644
tmp = NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD | (1 << 30);
writel(tmp, nfc->regs + NFC_REG_CMD);
@@ -579,6 +833,9 @@ static int sunxi_nfc_hw_ecc_read_page(struct mtd_info *mtd,
@@ -579,6 +833,9 @@ static int sunxi_nfc_hw_ecc_read_page(st
memcpy_fromio(buf + (i * ecc->size),
nfc->regs + NFC_RAM0_BASE, ecc->size);
@ -349,7 +347,7 @@ index c3e0473..2f6ab39 100644
if (readl(nfc->regs + NFC_REG_ECC_ST) & 0x1) {
mtd->ecc_stats.failed++;
} else {
@@ -594,9 +851,10 @@ static int sunxi_nfc_hw_ecc_read_page(struct mtd_info *mtd,
@@ -594,9 +851,10 @@ static int sunxi_nfc_hw_ecc_read_page(st
if (ret)
return ret;
@ -362,7 +360,7 @@ index c3e0473..2f6ab39 100644
}
}
@@ -606,11 +864,14 @@ static int sunxi_nfc_hw_ecc_read_page(struct mtd_info *mtd,
@@ -606,11 +864,14 @@ static int sunxi_nfc_hw_ecc_read_page(st
offset = mtd->writesize +
ecc->layout->oobfree[ecc->steps].offset;
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, offset, -1);
@ -378,7 +376,7 @@ index c3e0473..2f6ab39 100644
tmp = readl(nfc->regs + NFC_REG_ECC_CTL);
tmp &= ~NFC_ECC_EN;
@@ -627,6 +888,7 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
@@ -627,6 +888,7 @@ static int sunxi_nfc_hw_ecc_write_page(s
struct nand_ecc_ctrl *ecc = chip->cur_ecc;
struct nand_ecclayout *layout = ecc->layout;
struct sunxi_nand_hw_ecc *data = ecc->priv;
@ -386,7 +384,7 @@ index c3e0473..2f6ab39 100644
int offset;
int ret;
u32 tmp;
@@ -641,22 +903,56 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
@@ -641,22 +903,56 @@ static int sunxi_nfc_hw_ecc_write_page(s
writel(tmp, nfc->regs + NFC_REG_ECC_CTL);
for (i = 0; i < ecc->steps; i++) {
@ -451,7 +449,7 @@ index c3e0473..2f6ab39 100644
}
chip->cmdfunc(mtd, NAND_CMD_RNDIN, offset, -1);
@@ -671,6 +967,9 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
@@ -671,6 +967,9 @@ static int sunxi_nfc_hw_ecc_write_page(s
ret = sunxi_nfc_wait_int(nfc, NFC_CMD_INT_FLAG, 0);
if (ret)
return ret;
@ -461,7 +459,7 @@ index c3e0473..2f6ab39 100644
}
if (oob_required) {
@@ -679,11 +978,14 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
@@ -679,11 +978,14 @@ static int sunxi_nfc_hw_ecc_write_page(s
offset = mtd->writesize +
ecc->layout->oobfree[i].offset;
chip->cmdfunc(mtd, NAND_CMD_RNDIN, offset, -1);
@ -477,7 +475,7 @@ index c3e0473..2f6ab39 100644
tmp = readl(nfc->regs + NFC_REG_ECC_CTL);
tmp &= ~NFC_ECC_EN;
@@ -692,22 +994,76 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
@@ -692,22 +994,76 @@ static int sunxi_nfc_hw_ecc_write_page(s
return 0;
}
@ -554,7 +552,7 @@ index c3e0473..2f6ab39 100644
tmp = readl(nfc->regs + NFC_REG_ECC_CTL);
tmp &= ~(NFC_ECC_MODE | NFC_ECC_PIPELINE | NFC_ECC_BLOCK_SIZE);
tmp |= NFC_ECC_EN | (data->mode << NFC_ECC_MODE_SHIFT) |
@@ -716,7 +1072,17 @@ static int sunxi_nfc_hw_syndrome_ecc_read_page(struct mtd_info *mtd,
@@ -716,7 +1072,17 @@ static int sunxi_nfc_hw_syndrome_ecc_rea
writel(tmp, nfc->regs + NFC_REG_ECC_CTL);
for (i = 0; i < ecc->steps; i++) {
@ -573,7 +571,7 @@ index c3e0473..2f6ab39 100644
tmp = NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD | (1 << 30);
writel(tmp, nfc->regs + NFC_REG_CMD);
@@ -729,6 +1095,9 @@ static int sunxi_nfc_hw_syndrome_ecc_read_page(struct mtd_info *mtd,
@@ -729,6 +1095,9 @@ static int sunxi_nfc_hw_syndrome_ecc_rea
buf += ecc->size;
offset += ecc->size;
@ -583,7 +581,7 @@ index c3e0473..2f6ab39 100644
if (readl(nfc->regs + NFC_REG_ECC_ST) & 0x1) {
mtd->ecc_stats.failed++;
} else {
@@ -739,7 +1108,8 @@ static int sunxi_nfc_hw_syndrome_ecc_read_page(struct mtd_info *mtd,
@@ -739,7 +1108,8 @@ static int sunxi_nfc_hw_syndrome_ecc_rea
if (oob_required) {
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, offset, -1);
@ -593,7 +591,7 @@ index c3e0473..2f6ab39 100644
oob += ecc->bytes + ecc->prepad;
}
@@ -750,10 +1120,13 @@ static int sunxi_nfc_hw_syndrome_ecc_read_page(struct mtd_info *mtd,
@@ -750,10 +1120,13 @@ static int sunxi_nfc_hw_syndrome_ecc_rea
cnt = mtd->oobsize - (oob - chip->oob_poi);
if (cnt > 0) {
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, offset, -1);
@ -608,7 +606,7 @@ index c3e0473..2f6ab39 100644
writel(readl(nfc->regs + NFC_REG_ECC_CTL) & ~NFC_ECC_EN,
nfc->regs + NFC_REG_ECC_CTL);
@@ -768,6 +1141,7 @@ static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,
@@ -768,6 +1141,7 @@ static int sunxi_nfc_hw_syndrome_ecc_wri
struct sunxi_nfc *nfc = to_sunxi_nfc(chip->controller);
struct nand_ecc_ctrl *ecc = chip->cur_ecc;
struct sunxi_nand_hw_ecc *data = ecc->priv;
@ -616,7 +614,7 @@ index c3e0473..2f6ab39 100644
uint8_t *oob = chip->oob_poi;
int offset = 0;
int ret;
@@ -783,7 +1157,8 @@ static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,
@@ -783,7 +1157,8 @@ static int sunxi_nfc_hw_syndrome_ecc_wri
writel(tmp, nfc->regs + NFC_REG_ECC_CTL);
for (i = 0; i < ecc->steps; i++) {
@ -626,7 +624,7 @@ index c3e0473..2f6ab39 100644
offset += ecc->size;
/* Fill OOB data in */
@@ -796,6 +1171,16 @@ static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,
@@ -796,6 +1171,16 @@ static int sunxi_nfc_hw_syndrome_ecc_wri
4);
}
@ -643,7 +641,7 @@ index c3e0473..2f6ab39 100644
tmp = NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD | NFC_ACCESS_DIR |
(1 << 30);
writel(tmp, nfc->regs + NFC_REG_CMD);
@@ -804,6 +1189,9 @@ static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,
@@ -804,6 +1189,9 @@ static int sunxi_nfc_hw_syndrome_ecc_wri
if (ret)
return ret;
@ -653,7 +651,7 @@ index c3e0473..2f6ab39 100644
offset += ecc->bytes + ecc->prepad;
oob += ecc->bytes + ecc->prepad;
}
@@ -812,9 +1200,11 @@ static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,
@@ -812,9 +1200,11 @@ static int sunxi_nfc_hw_syndrome_ecc_wri
cnt = mtd->oobsize - (oob - chip->oob_poi);
if (cnt > 0) {
chip->cmdfunc(mtd, NAND_CMD_RNDIN, offset, -1);
@ -666,7 +664,7 @@ index c3e0473..2f6ab39 100644
tmp = readl(nfc->regs + NFC_REG_ECC_CTL);
tmp &= ~NFC_ECC_EN;
@@ -824,6 +1214,128 @@ static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,
@@ -824,6 +1214,128 @@ static int sunxi_nfc_hw_syndrome_ecc_wri
return 0;
}
@ -795,7 +793,7 @@ index c3e0473..2f6ab39 100644
static int sunxi_nand_chip_set_timings(struct sunxi_nand_chip *chip,
const struct nand_sdr_timings *timings)
{
@@ -1084,6 +1596,40 @@ static int sunxi_nand_hw_syndrome_ecc_ctrl_init(struct mtd_info *mtd,
@@ -1084,6 +1596,40 @@ static int sunxi_nand_hw_syndrome_ecc_ct
return 0;
}
@ -836,7 +834,7 @@ index c3e0473..2f6ab39 100644
static void sunxi_nand_ecc_cleanup(struct nand_ecc_ctrl *ecc)
{
switch (ecc->mode) {
@@ -1175,7 +1721,14 @@ struct nand_part *sunxi_ofnandpart_parse(void *priv, struct mtd_info *master,
@@ -1175,7 +1721,14 @@ struct nand_part *sunxi_ofnandpart_parse
if (ret)
goto err;
@ -851,7 +849,7 @@ index c3e0473..2f6ab39 100644
return &part->part;
@@ -1300,18 +1853,30 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
@@ -1300,18 +1853,30 @@ static int sunxi_nand_chip_init(struct d
if (ret)
return ret;
@ -882,7 +880,7 @@ index c3e0473..2f6ab39 100644
ret = nand_scan_tail(mtd);
if (ret) {
dev_err(dev, "nand_scan_tail failed: %d\n", ret);
@@ -1367,6 +1932,8 @@ static void sunxi_nand_chips_cleanup(struct sunxi_nfc *nfc)
@@ -1367,6 +1932,8 @@ static void sunxi_nand_chips_cleanup(str
node);
nand_release(&chip->mtd);
sunxi_nand_ecc_cleanup(&chip->nand.ecc);

@ -13,11 +13,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/mtd/nand/sunxi_nand.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index 2f6ab39..74f2caf 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -1711,28 +1711,37 @@ static void sunxi_nand_part_release(struct nand_part *part)
@@ -1711,28 +1711,37 @@ static void sunxi_nand_part_release(stru
struct nand_part *sunxi_ofnandpart_parse(void *priv, struct mtd_info *master,
struct device_node *pp)
{
@ -31,15 +29,16 @@ index 2f6ab39..74f2caf 100644
- ret = sunxi_nand_ecc_init(master, &part->ecc, pp);
- if (ret)
- goto err;
+ if (of_find_property(pp, "nand-ecc-mode", NULL)) {
+ ret = sunxi_nand_ecc_init(master, &part->ecc, pp);
+ if (ret)
+ goto err;
-
- ret = sunxi_nand_rnd_init(master, &part->rnd, &part->ecc, pp);
- if (ret) {
- sunxi_nand_ecc_cleanup(&part->ecc);
- goto err;
+ if (of_find_property(pp, "nand-ecc-mode", NULL)) {
+ ret = sunxi_nand_ecc_init(master, &part->ecc, pp);
+ if (ret)
+ goto err;
+
+ part->part.ecc = &part->ecc;
}

@ -14,11 +14,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/mtd/nand/sunxi_nand.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index 74f2caf..72ab770 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -1853,6 +1853,15 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
@@ -1853,6 +1853,15 @@ static int sunxi_nand_chip_init(struct d
if (of_get_nand_on_flash_bbt(np))
nand->bbt_options |= NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB;

@ -11,11 +11,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun4i-a10.dtsi | 80 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index abea24e..e0a737f 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -924,6 +924,86 @@
@@ -774,6 +774,86 @@
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};

@ -11,13 +11,11 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun5i.dtsi | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+)
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
index f11efb7..1962ec9 100644
--- a/arch/arm/boot/dts/sun5i-a10s.dtsi
+++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
@@ -201,6 +201,20 @@
allwinner,drive = <SUN4I_PINCTRL_30_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
@@ -656,4 +656,18 @@
clocks = <&ahb_gates 28>;
};
};
+
+ nand_cs2_pins_a: nand_cs@2 {
@ -34,15 +32,11 @@ index f11efb7..1962ec9 100644
+ allwinner,pull = <0>;
+ };
};
&sram_a {
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index 772f8d8..0dc7c96 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -544,6 +544,44 @@
@@ -528,6 +528,44 @@
allwinner,drive = <SUN4I_PINCTRL_30_MA>;
allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
+
+ nand_pins_a: nand_base0@0 {

@ -11,11 +11,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun7i-a20.dtsi | 80 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 0d7e600..6ec86c9 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -1164,6 +1164,86 @@
@@ -978,6 +978,86 @@
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};

@ -11,11 +11,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun7i-a20.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 6ec86c9..092adc6 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -641,6 +641,17 @@
@@ -543,6 +543,17 @@
#dma-cells = <2>;
};

@ -11,11 +11,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun4i-a10.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index e0a737f..7cd636d 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -514,6 +514,17 @@
@@ -428,6 +428,17 @@
#dma-cells = <2>;
};

@ -10,11 +10,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun5i.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index 0dc7c96..801ab01 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -353,6 +353,17 @@
@@ -365,6 +365,17 @@
#dma-cells = <2>;
};

@ -10,13 +10,11 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 59 +++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
index b3c234c..fd1e921 100644
--- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
+++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
@@ -155,3 +155,62 @@
status = "okay";
};
@@ -201,3 +201,62 @@
status = "okay";
};
};
+&nfc {
+ pinctrl-names = "default";

@ -1,10 +1,8 @@
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
index 39a51d5..f35957d 100644
--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
@@ -142,3 +142,60 @@
status = "okay";
};
@@ -245,3 +245,60 @@
status = "okay";
};
};
+&nfc {
+ pinctrl-names = "default";

@ -11,13 +11,11 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun4i-a10-cubieboard.dts | 57 ++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
index 046a84d..a6faca3 100644
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
@@ -147,3 +147,60 @@
regulator-max-microvolt = <3000000>;
regulator-name = "avcc";
@@ -215,3 +215,60 @@
regulator-max-microvolt = <3000000>;
regulator-name = "avcc";
};
+&nfc {
+ pinctrl-names = "default";

@ -1,10 +1,8 @@
diff --git a/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts b/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
index b3c234c..fd1e921 100644
--- a/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
+++ b/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
@@ -155,3 +155,62 @@
status = "okay";
};
@@ -189,3 +189,62 @@
status = "okay";
};
};
+&nfc {
+ pinctrl-names = "default";

@ -1,10 +1,8 @@
diff --git a/arch/arm/boot/dts/sun4i-a10-pcduino.dts b/arch/arm/boot/dts/sun4i-a10-pcduino.dts
index b3c234c..fd1e921 100644
--- a/arch/arm/boot/dts/sun4i-a10-pcduino.dts
+++ b/arch/arm/boot/dts/sun4i-a10-pcduino.dts
@@ -155,3 +155,62 @@
status = "okay";
};
@@ -194,3 +194,62 @@
status = "okay";
};
};
+&nfc {
+ pinctrl-names = "default";

@ -1,10 +1,8 @@
diff --git a/arch/arm/boot/dts/sun7i-a20-pcduino3.dts b/arch/arm/boot/dts/sun7i-a20-pcduino3.dts
index b3c234c..fd1e921 100644
--- a/arch/arm/boot/dts/sun7i-a20-pcduino3.dts
+++ b/arch/arm/boot/dts/sun7i-a20-pcduino3.dts
@@ -155,3 +155,62 @@
status = "okay";
};
@@ -210,3 +210,62 @@
status = "okay";
};
};
+&nfc {
+ pinctrl-names = "default";

@ -1,17 +1,15 @@
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index c2e1232..f561c68 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3611,6 +3611,8 @@ static inline bool is_full_id_nand(struct nand_flash_dev *type)
@@ -4249,6 +4249,8 @@ static inline bool is_full_id_nand(struc
static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
struct nand_flash_dev *type, u8 *id_data, int *busw)
struct nand_flash_dev *type, const u8 *id_data, int *busw)
{
+ int mode;
+
if (!strncmp(type->id, id_data, type->id_len)) {
mtd->writesize = type->pagesize;
mtd->erasesize = type->erasesize;
@@ -3621,8 +3623,9 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
@@ -4259,8 +4261,9 @@ static bool find_full_id_nand(struct mtd
chip->options |= type->options;
chip->ecc_strength_ds = NAND_ECC_STRENGTH(type);
chip->ecc_step_ds = NAND_ECC_STEP(type);
@ -23,11 +21,9 @@ index c2e1232..f561c68 100644
*busw = type->options & NAND_BUSWIDTH_16;
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index 5095a32..72e4135 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -1083,7 +1083,7 @@ static int sunxi_nand_chip_init_timings(struct sunxi_nand_chip *chip,
@@ -1427,7 +1427,7 @@ static int sunxi_nand_chip_init_timings(
mode = onfi_get_async_timing_mode(&chip->nand);
if (mode == ONFI_TIMING_MODE_UNKNOWN) {
@ -36,7 +32,7 @@ index 5095a32..72e4135 100644
} else {
uint8_t feature[ONFI_SUBFEATURE_PARAM_LEN] = {};
@@ -1097,9 +1097,10 @@ static int sunxi_nand_chip_init_timings(struct sunxi_nand_chip *chip,
@@ -1441,9 +1441,10 @@ static int sunxi_nand_chip_init_timings(
feature);
if (ret)
return ret;
@ -48,11 +44,9 @@ index 5095a32..72e4135 100644
if (IS_ERR(timings))
return PTR_ERR(timings);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 3d4ea7e..2eb92a3 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -536,6 +536,55 @@ struct nand_buffers {
@@ -612,6 +612,55 @@ struct nand_buffers {
uint8_t *databuf;
};
@ -108,7 +102,7 @@ index 3d4ea7e..2eb92a3 100644
/**
* struct nand_chip - NAND Private Flash Chip Data
* @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the
@@ -600,11 +649,7 @@ struct nand_buffers {
@@ -676,11 +725,7 @@ struct nand_buffers {
* @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds,
* also from the datasheet. It is the recommended ECC step
* size, if known; if unknown, set to zero.
@ -121,7 +115,7 @@ index 3d4ea7e..2eb92a3 100644
* @numchips: [INTERN] number of physical chips
* @chipsize: [INTERN] the size of one chip for multichip arrays
* @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
@@ -689,7 +734,7 @@ struct nand_chip {
@@ -769,7 +814,7 @@ struct nand_chip {
uint8_t bits_per_cell;
uint16_t ecc_strength_ds;
uint16_t ecc_step_ds;
@ -130,9 +124,9 @@ index 3d4ea7e..2eb92a3 100644
int badblockpos;
int badblockbits;
@@ -975,55 +1020,6 @@ static inline int jedec_feature(struct nand_chip *chip)
: 0;
}
@@ -1156,55 +1201,6 @@ struct ofnandpart_data {
int ofnandpart_parse(struct mtd_info *master,
const struct ofnandpart_data *data);
-/*
- * struct nand_sdr_timings - SDR NAND chip timings

@ -1,8 +1,6 @@
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index f561c68..8e636df 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3624,8 +3624,13 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
@@ -4262,8 +4262,13 @@ static bool find_full_id_nand(struct mtd
chip->ecc_strength_ds = NAND_ECC_STRENGTH(type);
chip->ecc_step_ds = NAND_ECC_STEP(type);
@ -18,11 +16,9 @@ index f561c68..8e636df 100644
*busw = type->options & NAND_BUSWIDTH_16;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 2eb92a3..7d9e599 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -863,6 +863,7 @@ struct nand_flash_dev {
@@ -988,6 +988,7 @@ struct nand_flash_dev {
uint16_t step_ds;
} ecc;
int onfi_timing_mode_default;

@ -1,5 +1,3 @@
diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c
index dd620c1..15b4a03 100644
--- a/drivers/mtd/nand/nand_ids.c
+++ b/drivers/mtd/nand/nand_ids.c
@@ -19,6 +19,49 @@
@ -52,7 +50,7 @@ index dd620c1..15b4a03 100644
* The chip ID list:
* name, device ID, page size, chip size in MiB, eraseblock size, options
*
@@ -50,6 +93,10 @@ struct nand_flash_dev nand_flash_ids[] = {
@@ -50,6 +93,10 @@ struct nand_flash_dev nand_flash_ids[] =
{ .id = {0xad, 0xde, 0x94, 0xda, 0x74, 0xc4} },
SZ_8K, SZ_8K, SZ_2M, 0, 6, 640, NAND_ECC_INFO(40, SZ_1K),
4 },

@ -13,11 +13,9 @@ Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/sunxi_nand.c | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index 72ab770..3668197 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -904,7 +904,7 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
@@ -904,7 +904,7 @@ static int sunxi_nfc_hw_ecc_write_page(s
for (i = 0; i < ecc->steps; i++) {
bool rndactiv = false;
@ -26,7 +24,7 @@ index 72ab770..3668197 100644
if (i)
chip->cmdfunc(mtd, NAND_CMD_RNDIN, i * ecc->size, -1);
@@ -915,15 +915,13 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
@@ -915,15 +915,13 @@ static int sunxi_nfc_hw_ecc_write_page(s
offset = layout->eccpos[i * ecc->bytes] - 4 + mtd->writesize;
/* Fill OOB data in */
@ -49,7 +47,7 @@ index 72ab770..3668197 100644
if (i) {
cnt = ecc->bytes + 4;
@@ -942,12 +940,16 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
@@ -942,12 +940,16 @@ static int sunxi_nfc_hw_ecc_write_page(s
if (rndactiv) {
/* pre randomize to generate FF patterns on the NAND */
if (!i) {
@ -69,7 +67,7 @@ index 72ab770..3668197 100644
}
tmp = readl(nfc->regs + NFC_REG_ECC_CTL);
tmp &= ~(NFC_RANDOM_DIRECTION | NFC_ECC_EXCEPTION);
@@ -955,6 +957,8 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
@@ -955,6 +957,8 @@ static int sunxi_nfc_hw_ecc_write_page(s
writel(tmp, nfc->regs + NFC_REG_ECC_CTL);
}
@ -78,7 +76,7 @@ index 72ab770..3668197 100644
chip->cmdfunc(mtd, NAND_CMD_RNDIN, offset, -1);
ret = sunxi_nfc_wait_cmd_fifo_empty(nfc);
@@ -1164,13 +1168,13 @@ static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,
@@ -1164,13 +1168,13 @@ static int sunxi_nfc_hw_syndrome_ecc_wri
/* Fill OOB data in */
if (oob_required) {
tmp = 0xffffffff;

@ -22,11 +22,9 @@ Changes in v2:
drivers/mmc/host/sunxi-mmc.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index 4d3e1ff..daa90b7 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -289,6 +289,24 @@ static int sunxi_mmc_init_host(struct mmc_host *mmc)
@@ -289,6 +289,24 @@ static int sunxi_mmc_init_host(struct mm
return 0;
}
@ -51,7 +49,7 @@ index 4d3e1ff..daa90b7 100644
static void sunxi_mmc_init_idma_des(struct sunxi_mmc_host *host,
struct mmc_data *data)
{
@@ -383,6 +401,8 @@ static void sunxi_mmc_send_manual_stop(struct sunxi_mmc_host *host,
@@ -383,6 +401,8 @@ static void sunxi_mmc_send_manual_stop(s
u32 arg, cmd_val, ri;
unsigned long expire = jiffies + msecs_to_jiffies(1000);
@ -60,7 +58,7 @@ index 4d3e1ff..daa90b7 100644
cmd_val = SDXC_START | SDXC_RESP_EXPIRE |
SDXC_STOP_ABORT_CMD | SDXC_CHECK_RESPONSE_CRC;
@@ -597,6 +617,11 @@ static int sunxi_mmc_oclk_onoff(struct sunxi_mmc_host *host, u32 oclk_en)
@@ -597,6 +617,11 @@ static int sunxi_mmc_oclk_onoff(struct s
{
unsigned long expire = jiffies + msecs_to_jiffies(250);
u32 rval;
@ -72,17 +70,17 @@ index 4d3e1ff..daa90b7 100644
rval = mmc_readl(host, REG_CLKCR);
rval &= ~(SDXC_CARD_CLOCK_ON | SDXC_LOW_POWER_ON);
@@ -785,6 +810,13 @@ static void sunxi_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
@@ -784,6 +809,13 @@ static void sunxi_mmc_request(struct mmc
mmc_request_done(mmc, mrq);
return;
}
+
+ ret = sunxi_mmc_wait_card_ready(host);
+ if (ret) {
+ mrq->cmd->error = ret;
+ mmc_request_done(mmc, mrq);
+ return;
+ }
+
if (data) {
ret = sunxi_mmc_map_dma(host, data);
if (ret < 0) {

@ -1,8 +1,6 @@
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 6a63f30..f5f384c 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -107,7 +107,7 @@
@@ -111,7 +111,7 @@
720000 1200000
528000 1100000
312000 1000000

@ -9,18 +9,14 @@ to other sun8i family SoCs like the A23.
Signed-off-by: Jens Kuske <jenskuske@gmail.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
diff --git a/Documentation/devicetree/bindings/arm/sunxi.txt b/Documentation/devicetree/bindings/arm/sunxi.txt
index 42941fd..3cb4b94 100644
--- a/Documentation/devicetree/bindings/arm/sunxi.txt
+++ b/Documentation/devicetree/bindings/arm/sunxi.txt
@@ -9,4 +9,5 @@ using one of the following compatible strings:
@@ -9,4 +9,5 @@ using one of the following compatible st
allwinner,sun6i-a31
allwinner,sun7i-a20
allwinner,sun8i-a23
+ allwinner,sun8i-h3
allwinner,sun9i-a80
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 81502b9..4efe2d4 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -35,7 +35,7 @@ config MACH_SUN7I
@ -32,8 +28,6 @@ index 81502b9..4efe2d4 100644
default ARCH_SUNXI
select ARM_GIC
select MFD_SUN6I_PRCM
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 1bc811a..8270902 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -67,10 +67,12 @@ MACHINE_END
@ -50,6 +44,3 @@ index 1bc811a..8270902 100644
.dt_compat = sun8i_board_dt_compat,
.init_late = sunxi_dt_cpufreq_init,
MACHINE_END
--
cgit v0.10.2

@ -1,8 +1,6 @@
diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
index 9cdcba24d..d13c136 100644
--- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
+++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
@@ -4,7 +4,10 @@ This driver follows the generic DMA bindings defined in dma.txt.
@@ -4,7 +4,10 @@ This driver follows the generic DMA bind
Required properties:
@ -14,11 +12,9 @@ index 9cdcba24d..d13c136 100644
- reg: Should contain the registers base address and length
- interrupts: Should contain a reference to the interrupt used by this device
- clocks: Should contain a reference to the parent AHB clock
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index 11e5365..842ff97 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -891,9 +891,21 @@ static struct sun6i_dma_config sun8i_a23_dma_cfg = {
@@ -891,9 +891,21 @@ static struct sun6i_dma_config sun8i_a23
.nr_max_vchans = 37,
};

@ -55,9 +55,6 @@ Changes from v1:
create mode 100644 Documentation/devicetree/bindings/dma/sun4i-dma.txt
create mode 100644 drivers/dma/sun4i-dma.c
diff --git a/Documentation/devicetree/bindings/dma/sun4i-dma.txt b/Documentation/devicetree/bindings/dma/sun4i-dma.txt
new file mode 100644
index 0000000..f1634a2
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/sun4i-dma.txt
@@ -0,0 +1,46 @@
@ -107,11 +104,9 @@ index 0000000..f1634a2
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index fd7ac13..12372c2 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -443,6 +443,17 @@ config XGENE_DMA
@@ -444,6 +444,17 @@ config XGENE_DMA
help
Enable support for the APM X-Gene SoC DMA engine.
@ -129,8 +124,6 @@ index fd7ac13..12372c2 100644
config DMA_ENGINE
bool
diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index 69f77d5..3eba5e9 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -54,3 +54,4 @@ obj-$(CONFIG_NBPFAXI_DMA) += nbpfaxi.o
@ -138,9 +131,6 @@ index 69f77d5..3eba5e9 100644
obj-$(CONFIG_IMG_MDC_DMA) += img-mdc-dma.o
obj-$(CONFIG_XGENE_DMA) += xgene-dma.o
+obj-$(CONFIG_SUN4I_DMA) += sun4i-dma.o
diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c
new file mode 100644
index 0000000..a8d55518
--- /dev/null
+++ b/drivers/dma/sun4i-dma.c
@@ -0,0 +1,1235 @@

@ -18,8 +18,6 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2 files changed, 250 insertions(+)
create mode 100644 drivers/clk/sunxi/clk-a10-pll2.c
diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile
index 058f273..eb36c38 100644
--- a/drivers/clk/sunxi/Makefile
+++ b/drivers/clk/sunxi/Makefile
@@ -4,6 +4,7 @@
@ -30,9 +28,6 @@ index 058f273..eb36c38 100644
obj-y += clk-a20-gmac.o
obj-y += clk-mod0.o
obj-y += clk-sun8i-mbus.o
diff --git a/drivers/clk/sunxi/clk-a10-pll2.c b/drivers/clk/sunxi/clk-a10-pll2.c
new file mode 100644
index 0000000..bdbf1e9
--- /dev/null
+++ b/drivers/clk/sunxi/clk-a10-pll2.c
@@ -0,0 +1,249 @@

@ -17,8 +17,6 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2 files changed, 42 insertions(+)
create mode 100644 drivers/clk/sunxi/clk-a10-codec.c
diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile
index eb36c38..6fa845e 100644
--- a/drivers/clk/sunxi/Makefile
+++ b/drivers/clk/sunxi/Makefile
@@ -3,6 +3,7 @@
@ -29,9 +27,6 @@ index eb36c38..6fa845e 100644
obj-y += clk-a10-hosc.o
obj-y += clk-a10-pll2.o
obj-y += clk-a20-gmac.o
diff --git a/drivers/clk/sunxi/clk-a10-codec.c b/drivers/clk/sunxi/clk-a10-codec.c
new file mode 100644
index 0000000..c70acbf
--- /dev/null
+++ b/drivers/clk/sunxi/clk-a10-codec.c
@@ -0,0 +1,41 @@

@ -18,8 +18,6 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2 files changed, 70 insertions(+)
create mode 100644 drivers/clk/sunxi/clk-a10-mod1.c
diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile
index 6fa845e..960eeab 100644
--- a/drivers/clk/sunxi/Makefile
+++ b/drivers/clk/sunxi/Makefile
@@ -5,6 +5,7 @@
@ -30,9 +28,6 @@ index 6fa845e..960eeab 100644
obj-y += clk-a10-pll2.o
obj-y += clk-a20-gmac.o
obj-y += clk-mod0.o
diff --git a/drivers/clk/sunxi/clk-a10-mod1.c b/drivers/clk/sunxi/clk-a10-mod1.c
new file mode 100644
index 0000000..1357641
--- /dev/null
+++ b/drivers/clk/sunxi/clk-a10-mod1.c
@@ -0,0 +1,69 @@

@ -17,11 +17,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun7i-a20.dtsi | 8 ++++++++
3 files changed, 24 insertions(+)
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 30f663a..fab13af 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -195,6 +195,14 @@
@@ -162,6 +162,14 @@
clock-output-names = "pll1";
};
@ -36,11 +34,9 @@ index 30f663a..fab13af 100644
pll4: clk@01c20018 {
#clock-cells = <0>;
compatible = "allwinner,sun4i-a10-pll1-clk";
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index 53d3ead..a4b6a66 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -102,6 +102,14 @@
@@ -136,6 +136,14 @@
clock-output-names = "pll1";
};
@ -55,11 +51,9 @@ index 53d3ead..a4b6a66 100644
pll4: clk@01c20018 {
#clock-cells = <0>;
compatible = "allwinner,sun4i-a10-pll1-clk";
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 7549f1b..12d9ffd 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -199,6 +199,14 @@
@@ -203,6 +203,14 @@
clock-output-names = "pll1";
};

@ -17,11 +17,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun7i-a20.dtsi | 8 ++++++++
3 files changed, 24 insertions(+)
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index fab13af..abea24e 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -454,6 +454,14 @@
@@ -420,6 +420,14 @@
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
clock-output-names = "spi3";
};
@ -36,11 +34,9 @@ index fab13af..abea24e 100644
};
soc@01c00000 {
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index a4b6a66..5c0edd6 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -292,6 +292,14 @@
@@ -350,6 +350,14 @@
clock-output-names = "usb_ohci0", "usb_phy";
};
@ -55,11 +51,9 @@ index a4b6a66..5c0edd6 100644
mbus_clk: clk@01c2015c {
#clock-cells = <0>;
compatible = "allwinner,sun5i-a13-mbus-clk";
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 12d9ffd..400e696 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -468,6 +468,14 @@
@@ -464,6 +464,14 @@
clock-output-names = "spi3";
};

@ -15,11 +15,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun7i-a20.dtsi | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 400e696..a0d18b2 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -450,6 +450,29 @@
@@ -447,6 +447,29 @@
clock-output-names = "ir1";
};
@ -48,8 +46,8 @@ index 400e696..a0d18b2 100644
+ };
usb_clk: clk@01c200cc {
#clock-cells = <1>;
#reset-cells = <1>;
@@ -468,6 +491,22 @@
#reset-cells = <1>;
@@ -464,6 +487,22 @@
clock-output-names = "spi3";
};

@ -8,11 +8,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun7i-a20.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index a0d18b2..1cced70 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -470,7 +470,7 @@
@@ -467,7 +467,7 @@
#clock-cells = <0>;
compatible = "allwinner,sun4i-a10-mod1-clk";
reg = <0x01c200c0 0x4>;

@ -20,8 +20,6 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
create mode 100644 sound/soc/sunxi/Makefile
create mode 100644 sound/soc/sunxi/sunxi-codec.c
diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig
index 3ba52da..87dbf48 100644
--- a/sound/soc/Kconfig
+++ b/sound/soc/Kconfig
@@ -53,6 +53,7 @@ source "sound/soc/samsung/Kconfig"
@ -32,8 +30,6 @@ index 3ba52da..87dbf48 100644
source "sound/soc/tegra/Kconfig"
source "sound/soc/txx9/Kconfig"
source "sound/soc/ux500/Kconfig"
diff --git a/sound/soc/Makefile b/sound/soc/Makefile
index 974ba70..39011b8 100644
--- a/sound/soc/Makefile
+++ b/sound/soc/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_SND_SOC) += samsung/
@ -44,9 +40,6 @@ index 974ba70..39011b8 100644
obj-$(CONFIG_SND_SOC) += tegra/
obj-$(CONFIG_SND_SOC) += txx9/
obj-$(CONFIG_SND_SOC) += ux500/
diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig
new file mode 100644
index 0000000..79511ae
--- /dev/null
+++ b/sound/soc/sunxi/Kconfig
@@ -0,0 +1,10 @@
@ -60,17 +53,11 @@ index 0000000..79511ae
+ default y
+
+endmenu
diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile
new file mode 100644
index 0000000..b8950d3
--- /dev/null
+++ b/sound/soc/sunxi/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_SND_SUNXI_SOC_CODEC) += sunxi-codec.o
+
diff --git a/sound/soc/sunxi/sunxi-codec.c b/sound/soc/sunxi/sunxi-codec.c
new file mode 100644
index 0000000..67f978e
--- /dev/null
+++ b/sound/soc/sunxi/sunxi-codec.c
@@ -0,0 +1,802 @@

@ -11,11 +11,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sound/soc/sunxi/sunxi-codec.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/soc/sunxi/sunxi-codec.c b/sound/soc/sunxi/sunxi-codec.c
index 67f978e..77a191b 100644
--- a/sound/soc/sunxi/sunxi-codec.c
+++ b/sound/soc/sunxi/sunxi-codec.c
@@ -215,9 +215,6 @@ static int sunxi_codec_prepare(struct snd_pcm_substream *substream,
@@ -215,9 +215,6 @@ static int sunxi_codec_prepare(struct sn
regmap_update_bits(priv->regmap, SUNXI_DAC_FIFOC, 0x1 << SUNXI_DAC_FIFOC_FIR_VERSION, 0x1 << SUNXI_DAC_FIFOC_FIR_VERSION);
}
@ -25,7 +23,7 @@ index 67f978e..77a191b 100644
/* send last sample when DAC FIFO under run */
regmap_update_bits(priv->regmap, SUNXI_DAC_FIFOC, 0x1 << SUNXI_DAC_FIFOC_SEND_LASAT, 0x0 << SUNXI_DAC_FIFOC_SEND_LASAT);
} else {
@@ -329,6 +326,7 @@ static int sunxi_codec_hw_params(struct snd_pcm_substream *substream,
@@ -329,6 +326,7 @@ static int sunxi_codec_hw_params(struct
regmap_update_bits(priv->regmap, SUNXI_DAC_FIFOC, 7 << SUNXI_DAC_FIFOC_DAC_FS, hwrate << SUNXI_DAC_FIFOC_DAC_FS);
regmap_update_bits(priv->regmap, SUNXI_DAC_FIFOC, 1 << SUNXI_DAC_FIFOC_MONO_EN, is_mono << SUNXI_DAC_FIFOC_MONO_EN);
regmap_update_bits(priv->regmap, SUNXI_DAC_FIFOC, 1 << SUNXI_DAC_FIFOC_TX_SAMPLE_BITS, is_24bit << SUNXI_DAC_FIFOC_TX_SAMPLE_BITS);

@ -11,11 +11,9 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun7i-a20.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 1cced70..a99bbae 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -1214,6 +1214,18 @@
@@ -1182,6 +1182,18 @@
status = "disabled";
};

@ -1,7 +1,6 @@
diff -ruN old/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts new/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
--- old/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts 2015-07-10 18:50:06.000000000 +0200
+++ new/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts 2015-08-02 11:45:06.000000000 +0200
@@ -245,3 +245,10 @@
--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
@@ -302,3 +302,10 @@
};
};

@ -8,13 +8,11 @@ Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
index 39a51d5..5f9f0b9 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
@@ -84,6 +84,13 @@
status = "okay";
};
@@ -180,6 +180,13 @@
#include "axp209.dtsi"
+&codec {
+ routing =

@ -11,13 +11,11 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun7i-a20-cubietruck.dts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
index 4611e2f..d05e06d 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -105,6 +105,13 @@
status = "okay";
};
@@ -257,6 +257,13 @@
#include "axp209.dtsi"
+&codec {
+ routing =

@ -26,9 +26,6 @@ Signed-off-by: Felipe Balbi <balbi@ti.com>
create mode 100644 Documentation/devicetree/bindings/usb/allwinner,sun4i-a10-musb.txt
create mode 100644 drivers/usb/musb/sunxi.c
diff --git a/Documentation/devicetree/bindings/usb/allwinner,sun4i-a10-musb.txt b/Documentation/devicetree/bindings/usb/allwinner,sun4i-a10-musb.txt
new file mode 100644
index 0000000..9254a6c
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/allwinner,sun4i-a10-musb.txt
@@ -0,0 +1,27 @@
@ -59,8 +56,6 @@ index 0000000..9254a6c
+ extcon = <&usbphy 0>;
+ status = "disabled";
+ };
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 39db8b6..37081ed 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -5,7 +5,7 @@
@ -97,11 +92,9 @@ index 39db8b6..37081ed 100644
config USB_MUSB_DAVINCI
tristate "DaVinci"
depends on ARCH_DAVINCI_DMx
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index ba49501..f95befe 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o
@@ -20,6 +20,7 @@ obj-$(CONFIG_USB_MUSB_DA8XX) += da8xx.
obj-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o
obj-$(CONFIG_USB_MUSB_UX500) += ux500.o
obj-$(CONFIG_USB_MUSB_JZ4740) += jz4740.o
@ -109,9 +102,6 @@ index ba49501..f95befe 100644
obj-$(CONFIG_USB_MUSB_AM335X_CHILD) += musb_am335x.o
diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
new file mode 100644
index 0000000..00d7248
--- /dev/null
+++ b/drivers/usb/musb/sunxi.c
@@ -0,0 +1,703 @@

@ -15,11 +15,9 @@ Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/musb/sunxi.c | 50 +++++++++++++++++++---
2 files changed, 46 insertions(+), 7 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/allwinner,sun4i-a10-musb.txt b/Documentation/devicetree/bindings/usb/allwinner,sun4i-a10-musb.txt
index 9254a6c..fde180b 100644
--- a/Documentation/devicetree/bindings/usb/allwinner,sun4i-a10-musb.txt
+++ b/Documentation/devicetree/bindings/usb/allwinner,sun4i-a10-musb.txt
@@ -2,9 +2,10 @@ Allwinner sun4i A10 musb DRC/OTG controller
@@ -2,9 +2,10 @@ Allwinner sun4i A10 musb DRC/OTG control
-------------------------------------------
Required properties:
@ -31,8 +29,6 @@ index 9254a6c..fde180b 100644
- interrupts : interrupt to which the musb controller is connected
- interrupt-names : must be "mc"
- phys : phy specifier for the otg phy
diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
index 00d7248..df2f75e 100644
--- a/drivers/usb/musb/sunxi.c
+++ b/drivers/usb/musb/sunxi.c
@@ -26,6 +26,7 @@
@ -60,7 +56,7 @@ index 00d7248..df2f75e 100644
struct phy *phy;
struct platform_device *usb_phy;
struct usb_phy *xceiv;
@@ -229,14 +233,22 @@ static int sunxi_musb_init(struct musb *musb)
@@ -229,14 +233,22 @@ static int sunxi_musb_init(struct musb *
musb->phy = glue->phy;
musb->xceiv = glue->xceiv;
@ -86,7 +82,7 @@ index 00d7248..df2f75e 100644
writeb(SUNXI_MUSB_VEND0_PIO_MODE, musb->mregs + SUNXI_MUSB_VEND0);
/* Register notifier before calling phy_init() */
@@ -244,7 +256,7 @@ static int sunxi_musb_init(struct musb *musb)
@@ -244,7 +256,7 @@ static int sunxi_musb_init(struct musb *
ret = extcon_register_notifier(glue->extcon, EXTCON_USB_HOST,
&glue->host_nb);
if (ret)
@ -95,7 +91,7 @@ index 00d7248..df2f75e 100644
}
ret = phy_init(glue->phy);
@@ -273,10 +285,14 @@ static int sunxi_musb_init(struct musb *musb)
@@ -273,10 +285,14 @@ error_unregister_notifier:
if (musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE)
extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST,
&glue->host_nb);
@ -111,7 +107,7 @@ index 00d7248..df2f75e 100644
return ret;
}
@@ -296,8 +312,12 @@ static int sunxi_musb_exit(struct musb *musb)
@@ -296,8 +312,12 @@ static int sunxi_musb_exit(struct musb *
extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST,
&glue->host_nb);
@ -125,7 +121,7 @@ index 00d7248..df2f75e 100644
return 0;
}
@@ -617,6 +637,12 @@ static int sunxi_musb_probe(struct platform_device *pdev)
@@ -617,6 +637,12 @@ static int sunxi_musb_probe(struct platf
INIT_WORK(&glue->work, sunxi_musb_work);
glue->host_nb.notifier_call = sunxi_musb_host_notifier;
@ -138,7 +134,7 @@ index 00d7248..df2f75e 100644
glue->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(glue->clk)) {
dev_err(&pdev->dev, "Error getting clock: %ld\n",
@@ -624,6 +650,17 @@ static int sunxi_musb_probe(struct platform_device *pdev)
@@ -624,6 +650,17 @@ static int sunxi_musb_probe(struct platf
return PTR_ERR(glue->clk);
}
@ -156,7 +152,7 @@ index 00d7248..df2f75e 100644
glue->phy = devm_phy_get(&pdev->dev, "usb");
if (IS_ERR(glue->phy)) {
if (PTR_ERR(glue->phy) == -EPROBE_DEFER)
@@ -685,6 +722,7 @@ static int sunxi_musb_remove(struct platform_device *pdev)
@@ -685,6 +722,7 @@ static int sunxi_musb_remove(struct plat
static const struct of_device_id sunxi_musb_match[] = {
{ .compatible = "allwinner,sun4i-a10-musb", },

@ -1,8 +1,6 @@
Index: linux-4.1.3/arch/arm/boot/dts/sun7i-a20.dtsi
===================================================================
--- linux-4.1.3.orig/arch/arm/boot/dts/sun7i-a20.dtsi
+++ linux-4.1.3/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -679,6 +679,14 @@
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -745,6 +745,14 @@
status = "disabled";
};

@ -15,11 +15,9 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/arm/boot/dts/sun4i-a10.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 61c03d1..551e3d1 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -643,6 +643,14 @@
@@ -591,6 +591,14 @@
status = "disabled";
};

@ -27,11 +27,9 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
create mode 100644 drivers/crypto/sunxi-ss/sun4i-ss-hash.c
create mode 100644 drivers/crypto/sunxi-ss/sun4i-ss.h
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 4044125..07bc7aa 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -480,4 +480,21 @@ config CRYPTO_DEV_IMGTEC_HASH
@@ -460,4 +460,21 @@ config CRYPTO_DEV_IMGTEC_HASH
hardware hash accelerator. Supporting MD5/SHA1/SHA224/SHA256
hashing algorithms.
@ -53,26 +51,18 @@ index 4044125..07bc7aa 100644
+ will be called sun4i-ss.
+
endif # CRYPTO_HW
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index e35c07a..c3ced6f 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -28,3 +28,4 @@ obj-$(CONFIG_CRYPTO_DEV_UX500) += ux500/
@@ -27,3 +27,4 @@ obj-$(CONFIG_CRYPTO_DEV_UX500) += ux500/
obj-$(CONFIG_CRYPTO_DEV_QAT) += qat/
obj-$(CONFIG_CRYPTO_DEV_QCE) += qce/
obj-$(CONFIG_CRYPTO_DEV_VMX) += vmx/
+obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sunxi-ss/
diff --git a/drivers/crypto/sunxi-ss/Makefile b/drivers/crypto/sunxi-ss/Makefile
new file mode 100644
index 0000000..8f4c7a2
--- /dev/null
+++ b/drivers/crypto/sunxi-ss/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sun4i-ss.o
+sun4i-ss-y += sun4i-ss-core.o sun4i-ss-hash.o sun4i-ss-cipher.o
diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
new file mode 100644
index 0000000..e070c31
--- /dev/null
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
@@ -0,0 +1,542 @@
@ -618,9 +608,6 @@ index 0000000..e070c31
+ memcpy(op->key, key, keylen);
+ return 0;
+}
diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-core.c b/drivers/crypto/sunxi-ss/sun4i-ss-core.c
new file mode 100644
index 0000000..0b79b58
--- /dev/null
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-core.c
@@ -0,0 +1,403 @@
@ -1027,9 +1014,6 @@ index 0000000..0b79b58
+MODULE_DESCRIPTION("Allwinner Security System cryptographic accelerator");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Corentin LABBE <clabbe.montjoie@gmail.com>");
diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
new file mode 100644
index 0000000..ff80314
--- /dev/null
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
@@ -0,0 +1,492 @@
@ -1525,9 +1509,6 @@ index 0000000..ff80314
+
+ return sun4i_hash_final(areq);
+}
diff --git a/drivers/crypto/sunxi-ss/sun4i-ss.h b/drivers/crypto/sunxi-ss/sun4i-ss.h
new file mode 100644
index 0000000..db18b255
--- /dev/null
+++ b/drivers/crypto/sunxi-ss/sun4i-ss.h
@@ -0,0 +1,199 @@

@ -10,10 +10,8 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts | 11 +++++++++++
2 files changed, 22 insertions(+)
Index: linux-4.1.3/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
===================================================================
--- linux-4.1.3.orig/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ linux-4.1.3/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -71,12 +71,23 @@
};
@ -38,10 +36,8 @@ Index: linux-4.1.3/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
};
usbphy: phy@01c13400 {
Index: linux-4.1.3/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts
===================================================================
--- linux-4.1.3.orig/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts
+++ linux-4.1.3/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts
--- a/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts
+++ b/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts
@@ -69,12 +69,23 @@
};

@ -14,10 +14,8 @@ GPIO, but this is not supported in this patch.
arch/arm/boot/dts/sun7i-a20-cubietruck.dts | 36 ++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
Index: linux-4.1.3/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
===================================================================
--- linux-4.1.3.orig/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ linux-4.1.3/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -88,6 +88,20 @@
interrupts = <10 8>; /* PH10 / EINT10 */
interrupt-names = "host-wake";

@ -1,7 +1,5 @@
Index: linux-4.1.3/arch/arm/boot/dts/Makefile
===================================================================
--- linux-4.1.3.orig/arch/arm/boot/dts/Makefile
+++ linux-4.1.3/arch/arm/boot/dts/Makefile
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -554,6 +554,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-cubietruck.dtb \
sun7i-a20-hummingbird.dtb \
@ -10,10 +8,8 @@ Index: linux-4.1.3/arch/arm/boot/dts/Makefile
sun7i-a20-m3.dtb \
sun7i-a20-olinuxino-lime.dtb \
sun7i-a20-olinuxino-lime2.dtb \
Index: linux-4.1.3/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
===================================================================
--- /dev/null
+++ linux-4.1.3/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
+++ b/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
@@ -0,0 +1,235 @@
+/*
+ * Copyright 2015 Daniel Golle <daniel@makrotopia.org>

Loading…
Cancel
Save