* [PATCH 0/6] Versatile flash protection in DT
@ 2016-01-26 11:11 Linus Walleij
2016-01-26 11:12 ` [PATCH 1/6] mtd: augment the "arm,versatile-flash" bindings Linus Walleij
` (5 more replies)
0 siblings, 6 replies; 14+ messages in thread
From: Linus Walleij @ 2016-01-26 11:11 UTC (permalink / raw)
To: linux-arm-kernel
This patch set augments the physmap driver to react to the
"arm,versatile-flash" compatible string by installing special
VPP/writeprotect handling so that the corresponding boardfile
code can be removed from the ARM boardfiles.
The patches pretty much speak for themselves, I would eventually
like to have the two mtd patches merged into the MTD tree
by themselves, and the rest of the patches merged into the
ARM SoC tree, as there is no compile-time dependency between
them and we can do a smooth transition along with other
cleanup patches in the ARM SoC tree.
Linus Walleij (6):
mtd: augment the "arm,versatile-flash" bindings
mtd: physmap_of: add a hook for Versatile write protection
ARM: versatile: move flash registration to the device tree
ARM: integrator: move flash registration to device tree
ARM: realview: add flash devices to the PB1176 DTS
ARM: realview: fix up PB11MP flash compat strings
.../devicetree/bindings/mtd/arm-versatile.txt | 20 +-
arch/arm/boot/dts/arm-realview-pb1176.dts | 32 +++
arch/arm/boot/dts/arm-realview-pb11mp.dts | 4 +-
arch/arm/boot/dts/integrator.dtsi | 3 +-
arch/arm/boot/dts/versatile-ab.dts | 5 +-
arch/arm/mach-integrator/integrator_ap.c | 62 -----
arch/arm/mach-integrator/integrator_cp.c | 51 -----
arch/arm/mach-versatile/versatile_dt.c | 47 ----
drivers/mtd/maps/Kconfig | 10 +
drivers/mtd/maps/Makefile | 1 +
drivers/mtd/maps/physmap_of.c | 6 +
drivers/mtd/maps/physmap_of_versatile.c | 253 +++++++++++++++++++++
drivers/mtd/maps/physmap_of_versatile.h | 16 ++
13 files changed, 344 insertions(+), 166 deletions(-)
create mode 100644 drivers/mtd/maps/physmap_of_versatile.c
create mode 100644 drivers/mtd/maps/physmap_of_versatile.h
--
2.4.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/6] mtd: augment the "arm,versatile-flash" bindings
2016-01-26 11:11 [PATCH 0/6] Versatile flash protection in DT Linus Walleij
@ 2016-01-26 11:12 ` Linus Walleij
2016-01-26 22:02 ` Rob Herring
2016-01-26 11:12 ` [PATCH 2/6] mtd: physmap_of: add a hook for Versatile write protection Linus Walleij
` (4 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Linus Walleij @ 2016-01-26 11:12 UTC (permalink / raw)
To: linux-arm-kernel
The bindings for the "arm,versatile-flash" device was merged in
commit 3ba7222ac992d24d09ccd0b55940b54849eef752
"arm/versatile: Add device tree support" but was never used
for anything.
Versatile flash chips are actually just standard CFI chips,
but they have one or two bits in a system controller to control
VPP and write protection. Let's use this compatible string in
conjunction with "cfi-flash" to indicate that we have a
normal CFI flash with some extra Versatile-specific protection.
Cc: devicetree at vger.kernel.org
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
.../devicetree/bindings/mtd/arm-versatile.txt | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/mtd/arm-versatile.txt b/Documentation/devicetree/bindings/mtd/arm-versatile.txt
index beace4b89daa..4ec28796a3c0 100644
--- a/Documentation/devicetree/bindings/mtd/arm-versatile.txt
+++ b/Documentation/devicetree/bindings/mtd/arm-versatile.txt
@@ -1,8 +1,26 @@
Flash device on ARM Versatile board
+These flash chips are found in the ARM reference designs like Integrator,
+Versatile, RealView, Versatile Express etc.
+
+They are regular CFI compatible (Intel or AMD extended) flash chips with
+some special write protect/VPP bits that can be controlled by the machine's
+system controller.
+
Required properties:
-- compatible : must be "arm,versatile-flash";
+- compatible : must be "arm,versatile-flash", "cfi-flash";
+- reg : memory address for the flash chip
- bank-width : width in bytes of flash interface.
+For the rest of the properties, see mtd-physmap.txt.
+
The device tree may optionally contain sub-nodes describing partitions of the
address space. See partition.txt for more detail.
+
+Example:
+
+flash at 34000000 {
+ compatible = "arm,versatile-flash", "cfi-flash";
+ reg = <0x34000000 0x4000000>;
+ bank-width = <4>;
+};
--
2.4.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/6] mtd: physmap_of: add a hook for Versatile write protection
2016-01-26 11:11 [PATCH 0/6] Versatile flash protection in DT Linus Walleij
2016-01-26 11:12 ` [PATCH 1/6] mtd: augment the "arm,versatile-flash" bindings Linus Walleij
@ 2016-01-26 11:12 ` Linus Walleij
2016-01-26 11:37 ` Russell King - ARM Linux
2016-02-13 13:19 ` Linus Walleij
2016-01-26 11:12 ` [PATCH 3/6] ARM: versatile: move flash registration to the device tree Linus Walleij
` (3 subsequent siblings)
5 siblings, 2 replies; 14+ messages in thread
From: Linus Walleij @ 2016-01-26 11:12 UTC (permalink / raw)
To: linux-arm-kernel
In order to support device tree probing of Versatile NOR flash
chips, there must be a way to add the VPP (write protection)
enable/disable callback. The register in question is in the
system controllers of these machines. Apart from this quirk,
the ARM flash chips are standard CFI flash chips from various
vendors.
Additionally, the Integrator/AP require you to set up the external
bus interface (EBI) to allow writes to the chip select where the
flash memory is connected.
Solve this by looking for the arm,versatile-flash compatible
string in the flash device tree node. In the driver,
add a special hook to check for the various Versatile syscons and
register a callback for .set_vpp() if this compatible is present.
Provide a special Kconfig entry for the addon hook so it will
not be compiled in if the Versatile boards are not supported.
Stubs in the header file make sure the impact will be zero on
other platforms. (Compilers optimze this out.)
With this patch, a large slew of ARM board file code can be
removed.
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/mtd/maps/Kconfig | 10 ++
drivers/mtd/maps/Makefile | 1 +
drivers/mtd/maps/physmap_of.c | 6 +
drivers/mtd/maps/physmap_of_versatile.c | 253 ++++++++++++++++++++++++++++++++
drivers/mtd/maps/physmap_of_versatile.h | 16 ++
5 files changed, 286 insertions(+)
create mode 100644 drivers/mtd/maps/physmap_of_versatile.c
create mode 100644 drivers/mtd/maps/physmap_of_versatile.h
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 7c95a656f9e4..392f9eff5fb7 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -74,6 +74,16 @@ config MTD_PHYSMAP_OF
physically into the CPU's memory. The mapping description here is
taken from OF device tree.
+config MTD_PHYSMAP_OF_VERSATILE
+ bool "Support ARM Versatile physmap OF"
+ depends on MTD_PHYSMAP_OF
+ depends on MFD_SYSCON
+ default y if (ARCH_INTEGRATOR || ARCH_VERSATILE || REALVIEW_DT)
+ help
+ This provides some extra DT physmap parsing for the ARM Versatile
+ platforms, basically to add a VPP (write protection) callback so
+ the flash can be taken out of write protection.
+
config MTD_PMC_MSP_EVM
tristate "CFI Flash device mapped on PMC-Sierra MSP"
depends on PMC_MSP && MTD_CFI
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile
index 141c91a5b24c..188873a72f1d 100644
--- a/drivers/mtd/maps/Makefile
+++ b/drivers/mtd/maps/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o
obj-$(CONFIG_MTD_PXA2XX) += pxa2xx-flash.o
obj-$(CONFIG_MTD_PHYSMAP) += physmap.o
obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o
+obj-$(CONFIG_MTD_PHYSMAP_OF_VERSATILE) += physmap_of_versatile.o
obj-$(CONFIG_MTD_PISMO) += pismo.o
obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcmsp-flash.o
obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 70c453144f00..22f3858c0364 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -24,6 +24,7 @@
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/slab.h>
+#include "physmap_of_versatile.h"
struct of_flash_list {
struct mtd_info *mtd;
@@ -240,6 +241,11 @@ static int of_flash_probe(struct platform_device *dev)
info->list[i].map.size = res_size;
info->list[i].map.bankwidth = be32_to_cpup(width);
info->list[i].map.device_node = dp;
+ err = of_flash_probe_versatile(dev, dp, &info->list[i].map);
+ if (err) {
+ dev_err(&dev->dev, "Can't probe Versatile VPP\n");
+ return err;
+ }
err = -ENOMEM;
info->list[i].map.virt = ioremap(info->list[i].map.phys,
diff --git a/drivers/mtd/maps/physmap_of_versatile.c b/drivers/mtd/maps/physmap_of_versatile.c
new file mode 100644
index 000000000000..fa40539e0d7f
--- /dev/null
+++ b/drivers/mtd/maps/physmap_of_versatile.c
@@ -0,0 +1,253 @@
+/*
+ * Versatile OF physmap driver add-on
+ *
+ * Copyright (c) 2016, Linaro Limited
+ * Author: Linus Walleij <linus.walleij@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/mtd/map.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
+#include <linux/bitops.h>
+#include "physmap_of_versatile.h"
+
+static struct regmap *syscon_regmap;
+
+enum versatile_flashprot {
+ INTEGRATOR_AP_FLASHPROT,
+ INTEGRATOR_CP_FLASHPROT,
+ VERSATILE_FLASHPROT,
+ REALVIEW_FLASHPROT,
+};
+
+static const struct of_device_id syscon_match[] = {
+ {
+ .compatible = "arm,integrator-ap-syscon",
+ .data = (void *)INTEGRATOR_AP_FLASHPROT,
+ },
+ {
+ .compatible = "arm,integrator-cp-syscon",
+ .data = (void *)INTEGRATOR_CP_FLASHPROT,
+ },
+ {
+ .compatible = "arm,core-module-versatile",
+ .data = (void *)VERSATILE_FLASHPROT,
+ },
+ {
+ .compatible = "arm,realview-eb-syscon",
+ .data = (void *)REALVIEW_FLASHPROT,
+ },
+ {
+ .compatible = "arm,realview-pb1176-syscon",
+ .data = (void *)REALVIEW_FLASHPROT,
+ },
+ {
+ .compatible = "arm,realview-pb11mp-syscon",
+ .data = (void *)REALVIEW_FLASHPROT,
+ },
+ {
+ .compatible = "arm,realview-pba8-syscon",
+ .data = (void *)REALVIEW_FLASHPROT,
+ },
+ {
+ .compatible = "arm,realview-pbx-syscon",
+ .data = (void *)REALVIEW_FLASHPROT,
+ },
+ {},
+};
+
+/*
+ * Flash protection handling for the Integrator/AP
+ */
+#define INTEGRATOR_SC_CTRLS_OFFSET 0x08
+#define INTEGRATOR_SC_CTRLC_OFFSET 0x0C
+#define INTEGRATOR_SC_CTRL_FLVPPEN BIT(1)
+#define INTEGRATOR_SC_CTRL_FLWP BIT(2)
+
+#define INTEGRATOR_EBI_CSR1_OFFSET 0x04
+/* The manual says bit 2, the code says bit 3, trust the code */
+#define INTEGRATOR_EBI_WRITE_ENABLE BIT(3)
+#define INTEGRATOR_EBI_LOCK_OFFSET 0x20
+#define INTEGRATOR_EBI_LOCK_VAL 0xA05F
+
+static const struct of_device_id ebi_match[] = {
+ { .compatible = "arm,external-bus-interface"},
+ { },
+};
+
+static int ap_flash_init(struct platform_device *pdev)
+{
+ struct device_node *ebi;
+ static void __iomem *ebi_base;
+ u32 val;
+ int ret;
+
+ /* Look up the EBI */
+ ebi = of_find_matching_node(NULL, ebi_match);
+ if (!ebi) {
+ return -ENODEV;
+ }
+ ebi_base = of_iomap(ebi, 0);
+ if (!ebi_base)
+ return -ENODEV;
+
+ /* Clear VPP and write protection bits */
+ ret = regmap_write(syscon_regmap,
+ INTEGRATOR_SC_CTRLC_OFFSET,
+ INTEGRATOR_SC_CTRL_FLVPPEN | INTEGRATOR_SC_CTRL_FLWP);
+ if (ret)
+ dev_err(&pdev->dev, "error clearing Integrator VPP/WP\n");
+
+ /* Unlock the EBI */
+ writel(INTEGRATOR_EBI_LOCK_VAL, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
+
+ /* Enable write cycles on the EBI, CSR1 (flash) */
+ val = readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
+ val |= INTEGRATOR_EBI_WRITE_ENABLE;
+ writel(val, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
+
+ /* Lock the EBI again */
+ writel(0, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
+ iounmap(ebi_base);
+
+ return 0;
+}
+
+static void ap_flash_set_vpp(struct map_info *map, int on)
+{
+ int ret;
+
+ if (on) {
+ ret = regmap_write(syscon_regmap,
+ INTEGRATOR_SC_CTRLS_OFFSET,
+ INTEGRATOR_SC_CTRL_FLVPPEN | INTEGRATOR_SC_CTRL_FLWP);
+ if (ret)
+ pr_err("error enabling AP VPP\n");
+ } else {
+ ret = regmap_write(syscon_regmap,
+ INTEGRATOR_SC_CTRLC_OFFSET,
+ INTEGRATOR_SC_CTRL_FLVPPEN | INTEGRATOR_SC_CTRL_FLWP);
+ if (ret)
+ pr_err("error disabling AP VPP\n");
+ }
+}
+
+/*
+ * Flash protection handling for the Integrator/CP
+ */
+
+#define INTCP_FLASHPROG_OFFSET 0x04
+#define CINTEGRATOR_FLVPPEN BIT(0)
+#define CINTEGRATOR_FLWREN BIT(1)
+#define CINTEGRATOR_FLMASK BIT(0)|BIT(1)
+
+static void cp_flash_set_vpp(struct map_info *map, int on)
+{
+ int ret;
+
+ if (on) {
+ ret = regmap_update_bits(syscon_regmap,
+ INTCP_FLASHPROG_OFFSET,
+ CINTEGRATOR_FLMASK,
+ CINTEGRATOR_FLVPPEN | CINTEGRATOR_FLWREN);
+ if (ret)
+ pr_err("error setting CP VPP\n");
+ } else {
+ ret = regmap_update_bits(syscon_regmap,
+ INTCP_FLASHPROG_OFFSET,
+ CINTEGRATOR_FLMASK,
+ 0);
+ if (ret)
+ pr_err("error setting CP VPP\n");
+ }
+}
+
+/*
+ * Flash protection handling for the Versatiles and RealViews
+ */
+
+#define VERSATILE_SYS_FLASH_OFFSET 0x4C
+
+static void versatile_flash_set_vpp(struct map_info *map, int on)
+{
+ int ret;
+
+ ret = regmap_update_bits(syscon_regmap, VERSATILE_SYS_FLASH_OFFSET,
+ 0x01, !!on);
+ if (ret)
+ pr_err("error setting Versatile VPP\n");
+}
+
+int of_flash_probe_versatile(struct platform_device *pdev,
+ struct device_node *np,
+ struct map_info *map)
+{
+ struct device_node *sysnp;
+ const struct of_device_id *devid;
+ struct regmap *rmap;
+ static enum versatile_flashprot versatile_flashprot;
+ int ret;
+
+ /* Not all flash chips use this protection line */
+ if (!of_device_is_compatible(np, "arm,versatile-flash"))
+ return 0;
+
+ /* For first chip probed, look up the syscon regmap */
+ if (!syscon_regmap) {
+ sysnp = of_find_matching_node_and_match(NULL,
+ syscon_match,
+ &devid);
+ if (!sysnp)
+ return -ENODEV;
+
+ versatile_flashprot = (enum versatile_flashprot)devid->data;
+ rmap = syscon_node_to_regmap(sysnp);
+ if (IS_ERR(rmap))
+ return PTR_ERR(rmap);
+
+ syscon_regmap = rmap;
+ }
+
+ switch (versatile_flashprot) {
+ case INTEGRATOR_AP_FLASHPROT:
+ ret = ap_flash_init(pdev);
+ if (ret)
+ return ret;
+ map->set_vpp = ap_flash_set_vpp;
+ dev_info(&pdev->dev, "Integrator/AP flash protection\n");
+ break;
+ case INTEGRATOR_CP_FLASHPROT:
+ map->set_vpp = cp_flash_set_vpp;
+ dev_info(&pdev->dev, "Integrator/CP flash protection\n");
+ break;
+ case VERSATILE_FLASHPROT:
+ case REALVIEW_FLASHPROT:
+ map->set_vpp = versatile_flash_set_vpp;
+ dev_info(&pdev->dev, "versatile/realview flash protection\n");
+ break;
+ default:
+ dev_info(&pdev->dev, "device marked as Versatile flash "
+ "but no system controller was found\n");
+ break;
+ }
+
+ return 0;
+}
diff --git a/drivers/mtd/maps/physmap_of_versatile.h b/drivers/mtd/maps/physmap_of_versatile.h
new file mode 100644
index 000000000000..5b86f6dc6b3d
--- /dev/null
+++ b/drivers/mtd/maps/physmap_of_versatile.h
@@ -0,0 +1,16 @@
+#include <linux/of.h>
+#include <linux/mtd/map.h>
+
+#ifdef CONFIG_MTD_PHYSMAP_OF_VERSATILE
+int of_flash_probe_versatile(struct platform_device *pdev,
+ struct device_node *np,
+ struct map_info *map);
+#else
+static inline
+int of_flash_probe_versatile(struct platform_device *pdev,
+ struct device_node *np,
+ struct map_info *map)
+{
+ return 0;
+}
+#endif
--
2.4.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/6] ARM: versatile: move flash registration to the device tree
2016-01-26 11:11 [PATCH 0/6] Versatile flash protection in DT Linus Walleij
2016-01-26 11:12 ` [PATCH 1/6] mtd: augment the "arm,versatile-flash" bindings Linus Walleij
2016-01-26 11:12 ` [PATCH 2/6] mtd: physmap_of: add a hook for Versatile write protection Linus Walleij
@ 2016-01-26 11:12 ` Linus Walleij
2016-01-26 11:12 ` [PATCH 4/6] ARM: integrator: move flash registration to " Linus Walleij
` (2 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2016-01-26 11:12 UTC (permalink / raw)
To: linux-arm-kernel
This moves the boardfile definition of the flash memory in the
Versatile board into the device tree. The flash was already
defined with the property "arm,versatile-flash" which was
not handled by the kernel: instead define it as compatible
also with "cfi-flash" so it detects properly, and delete the
corresponding boardfile code so we get a smooth transition.
The old compatible string "arm,versatile-flash" is reused to
indicate to the MTD physmap subsystem that this flash requires
special VPP handling. (See separate patch.)
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/boot/dts/versatile-ab.dts | 5 ++--
arch/arm/mach-versatile/versatile_dt.c | 47 ----------------------------------
2 files changed, 3 insertions(+), 49 deletions(-)
diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts
index 6fd7efbead34..28253ee84404 100644
--- a/arch/arm/boot/dts/versatile-ab.dts
+++ b/arch/arm/boot/dts/versatile-ab.dts
@@ -119,8 +119,9 @@
};
flash at 34000000 {
- compatible = "arm,versatile-flash";
- reg = <0x34000000 0x4000000>;
+ /* 64 MiB NOR flash in non-interleaved chips */
+ compatible = "arm,versatile-flash", "cfi-flash";
+ reg = <0x34000000 0x04000000>;
bank-width = <4>;
};
diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c
index dff1c0595b67..d643b9210dbd 100644
--- a/arch/arm/mach-versatile/versatile_dt.c
+++ b/arch/arm/mach-versatile/versatile_dt.c
@@ -32,7 +32,6 @@
#include <linux/amba/clcd.h>
#include <linux/platform_data/video-clcd-versatile.h>
#include <linux/amba/mmci.h>
-#include <linux/mtd/physmap.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -42,27 +41,15 @@
#define __io_address(n) ((void __iomem __force *)IO_ADDRESS(n))
/*
- * Memory definitions
- */
-#define VERSATILE_FLASH_BASE 0x34000000
-#define VERSATILE_FLASH_SIZE SZ_64M
-
-/*
* ------------------------------------------------------------------------
* Versatile Registers
* ------------------------------------------------------------------------
*/
#define VERSATILE_SYS_PCICTL_OFFSET 0x44
#define VERSATILE_SYS_MCI_OFFSET 0x48
-#define VERSATILE_SYS_FLASH_OFFSET 0x4C
#define VERSATILE_SYS_CLCD_OFFSET 0x50
/*
- * VERSATILE_SYS_FLASH
- */
-#define VERSATILE_FLASHPROG_FLVPPEN (1 << 0) /* Enable writing to flash */
-
-/*
* VERSATILE peripheral addresses
*/
#define VERSATILE_MMCI0_BASE 0x10005000 /* MMC interface */
@@ -86,39 +73,6 @@
static void __iomem *versatile_sys_base;
static void __iomem *versatile_ib2_ctrl;
-static void versatile_flash_set_vpp(struct platform_device *pdev, int on)
-{
- u32 val;
-
- val = readl(versatile_sys_base + VERSATILE_SYS_FLASH_OFFSET);
- if (on)
- val |= VERSATILE_FLASHPROG_FLVPPEN;
- else
- val &= ~VERSATILE_FLASHPROG_FLVPPEN;
- writel(val, versatile_sys_base + VERSATILE_SYS_FLASH_OFFSET);
-}
-
-static struct physmap_flash_data versatile_flash_data = {
- .width = 4,
- .set_vpp = versatile_flash_set_vpp,
-};
-
-static struct resource versatile_flash_resource = {
- .start = VERSATILE_FLASH_BASE,
- .end = VERSATILE_FLASH_BASE + VERSATILE_FLASH_SIZE - 1,
- .flags = IORESOURCE_MEM,
-};
-
-struct platform_device versatile_flash_device = {
- .name = "physmap-flash",
- .id = 0,
- .dev = {
- .platform_data = &versatile_flash_data,
- },
- .num_resources = 1,
- .resource = &versatile_flash_resource,
-};
-
unsigned int mmc_status(struct device *dev)
{
struct amba_device *adev = container_of(dev, struct amba_device, dev);
@@ -390,7 +344,6 @@ static void __init versatile_dt_init(void)
versatile_dt_pci_init();
- platform_device_register(&versatile_flash_device);
of_platform_populate(NULL, of_default_bus_match_table,
versatile_auxdata_lookup, NULL);
}
--
2.4.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/6] ARM: integrator: move flash registration to device tree
2016-01-26 11:11 [PATCH 0/6] Versatile flash protection in DT Linus Walleij
` (2 preceding siblings ...)
2016-01-26 11:12 ` [PATCH 3/6] ARM: versatile: move flash registration to the device tree Linus Walleij
@ 2016-01-26 11:12 ` Linus Walleij
2016-01-26 11:12 ` [PATCH 5/6] ARM: realview: add flash devices to the PB1176 DTS Linus Walleij
2016-01-26 11:12 ` [PATCH 6/6] ARM: realview: fix up PB11MP flash compat strings Linus Walleij
5 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2016-01-26 11:12 UTC (permalink / raw)
To: linux-arm-kernel
The flash on the Integrator was already defined by the device
tree, but VPP control and flash protection was in the
boardfiles. Simply add the compatible string
"arm,versatile-flash" and the special add-on code for flash
programming voltage and protection kicks in in the MTD
layer.
Remove the board file code and augment the device tree in
one go for seamless transition.
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/boot/dts/integrator.dtsi | 3 +-
arch/arm/mach-integrator/integrator_ap.c | 62 --------------------------------
arch/arm/mach-integrator/integrator_cp.c | 51 --------------------------
3 files changed, 2 insertions(+), 114 deletions(-)
diff --git a/arch/arm/boot/dts/integrator.dtsi b/arch/arm/boot/dts/integrator.dtsi
index 3807d4f46ef7..adc4befea46d 100644
--- a/arch/arm/boot/dts/integrator.dtsi
+++ b/arch/arm/boot/dts/integrator.dtsi
@@ -52,8 +52,9 @@
};
flash at 24000000 {
- compatible = "cfi-flash";
+ compatible = "arm,versatile-flash", "cfi-flash";
reg = <0x24000000 0x02000000>;
+ bank-width = <4>;
};
fpga {
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 5b0e363fe5ba..2b118f20c62c 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -29,7 +29,6 @@
#include <linux/amba/kmi.h>
#include <linux/io.h>
#include <linux/irqchip.h>
-#include <linux/mtd/physmap.h>
#include <linux/platform_data/clk-integrator.h>
#include <linux/of_irq.h>
#include <linux/of_address.h>
@@ -147,65 +146,6 @@ static int __init irq_syscore_init(void)
device_initcall(irq_syscore_init);
/*
- * Flash handling.
- */
-static int ap_flash_init(struct platform_device *dev)
-{
- u32 tmp;
-
- writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP,
- ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);
-
- tmp = readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET) |
- INTEGRATOR_EBI_WRITE_ENABLE;
- writel(tmp, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
-
- if (!(readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET)
- & INTEGRATOR_EBI_WRITE_ENABLE)) {
- writel(0xa05f, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
- writel(tmp, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
- writel(0, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
- }
- return 0;
-}
-
-static void ap_flash_exit(struct platform_device *dev)
-{
- u32 tmp;
-
- writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP,
- ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);
-
- tmp = readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET) &
- ~INTEGRATOR_EBI_WRITE_ENABLE;
- writel(tmp, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
-
- if (readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET) &
- INTEGRATOR_EBI_WRITE_ENABLE) {
- writel(0xa05f, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
- writel(tmp, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
- writel(0, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
- }
-}
-
-static void ap_flash_set_vpp(struct platform_device *pdev, int on)
-{
- if (on)
- writel(INTEGRATOR_SC_CTRL_nFLVPPEN,
- ap_syscon_base + INTEGRATOR_SC_CTRLS_OFFSET);
- else
- writel(INTEGRATOR_SC_CTRL_nFLVPPEN,
- ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);
-}
-
-static struct physmap_flash_data ap_flash_data = {
- .width = 4,
- .init = ap_flash_init,
- .exit = ap_flash_exit,
- .set_vpp = ap_flash_set_vpp,
-};
-
-/*
* For the PL010 found in the Integrator/AP some of the UART control is
* implemented in the system controller and accessed using a callback
* from the driver.
@@ -266,8 +206,6 @@ static struct of_dev_auxdata ap_auxdata_lookup[] __initdata = {
"kmi0", NULL),
OF_DEV_AUXDATA("arm,primecell", KMI1_BASE,
"kmi1", NULL),
- OF_DEV_AUXDATA("cfi-flash", INTEGRATOR_FLASH_BASE,
- "physmap-flash", &ap_flash_data),
{ /* sentinel */ },
};
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index b5fb71a36ee6..6f6b051e81e0 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -23,7 +23,6 @@
#include <linux/io.h>
#include <linux/irqchip.h>
#include <linux/gfp.h>
-#include <linux/mtd/physmap.h>
#include <linux/of_irq.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
@@ -43,14 +42,8 @@
/* Base address to the CP controller */
static void __iomem *intcp_con_base;
-#define INTCP_PA_FLASH_BASE 0x24000000
-
#define INTCP_PA_CLCD_BASE 0xc0000000
-#define INTCP_FLASHPROG 0x04
-#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0)
-#define CINTEGRATOR_FLASHPROG_FLWREN (1 << 1)
-
/*
* Logical Physical
* f1000000 10000000 Core module registers
@@ -108,48 +101,6 @@ static void __init intcp_map_io(void)
}
/*
- * Flash handling.
- */
-static int intcp_flash_init(struct platform_device *dev)
-{
- u32 val;
-
- val = readl(intcp_con_base + INTCP_FLASHPROG);
- val |= CINTEGRATOR_FLASHPROG_FLWREN;
- writel(val, intcp_con_base + INTCP_FLASHPROG);
-
- return 0;
-}
-
-static void intcp_flash_exit(struct platform_device *dev)
-{
- u32 val;
-
- val = readl(intcp_con_base + INTCP_FLASHPROG);
- val &= ~(CINTEGRATOR_FLASHPROG_FLVPPEN|CINTEGRATOR_FLASHPROG_FLWREN);
- writel(val, intcp_con_base + INTCP_FLASHPROG);
-}
-
-static void intcp_flash_set_vpp(struct platform_device *pdev, int on)
-{
- u32 val;
-
- val = readl(intcp_con_base + INTCP_FLASHPROG);
- if (on)
- val |= CINTEGRATOR_FLASHPROG_FLVPPEN;
- else
- val &= ~CINTEGRATOR_FLASHPROG_FLVPPEN;
- writel(val, intcp_con_base + INTCP_FLASHPROG);
-}
-
-static struct physmap_flash_data intcp_flash_data = {
- .width = 4,
- .init = intcp_flash_init,
- .exit = intcp_flash_exit,
- .set_vpp = intcp_flash_set_vpp,
-};
-
-/*
* It seems that the card insertion interrupt remains active after
* we've acknowledged it. We therefore ignore the interrupt, and
* rely on reading it from the SIC. This also means that we must
@@ -260,8 +211,6 @@ static struct of_dev_auxdata intcp_auxdata_lookup[] __initdata = {
"aaci", &mmc_data),
OF_DEV_AUXDATA("arm,primecell", INTCP_PA_CLCD_BASE,
"clcd", &clcd_data),
- OF_DEV_AUXDATA("cfi-flash", INTCP_PA_FLASH_BASE,
- "physmap-flash", &intcp_flash_data),
{ /* sentinel */ },
};
--
2.4.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/6] ARM: realview: add flash devices to the PB1176 DTS
2016-01-26 11:11 [PATCH 0/6] Versatile flash protection in DT Linus Walleij
` (3 preceding siblings ...)
2016-01-26 11:12 ` [PATCH 4/6] ARM: integrator: move flash registration to " Linus Walleij
@ 2016-01-26 11:12 ` Linus Walleij
2016-01-26 11:12 ` [PATCH 6/6] ARM: realview: fix up PB11MP flash compat strings Linus Walleij
5 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2016-01-26 11:12 UTC (permalink / raw)
To: linux-arm-kernel
This adds the flash memories and ROM to the PB1175 DTS file.
The secure flash is marked as "disabled" by default so as to
protect the user from overwriting the boot monitor.
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/boot/dts/arm-realview-pb1176.dts | 32 +++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/arch/arm/boot/dts/arm-realview-pb1176.dts b/arch/arm/boot/dts/arm-realview-pb1176.dts
index 1bc64cda819e..b7d727ef1868 100644
--- a/arch/arm/boot/dts/arm-realview-pb1176.dts
+++ b/arch/arm/boot/dts/arm-realview-pb1176.dts
@@ -106,6 +106,31 @@
clock-frequency = <0>;
};
+ flash at 30000000 {
+ compatible = "arm,versatile-flash", "cfi-flash";
+ reg = <0x30000000 0x4000000>;
+ bank-width = <4>;
+ };
+
+ fpga_flash at 38000000 {
+ compatible = "arm,versatile-flash", "cfi-flash";
+ reg = <0x38000000 0x800000>;
+ bank-width = <4>;
+ };
+
+ /*
+ * The "secure flash" contains things like the boot
+ * monitor so we don't want people to accidentally
+ * screw this up. Mark the device tree node disabled
+ * by default.
+ */
+ secflash at 3c000000 {
+ compatible = "arm,versatile-flash", "cfi-flash";
+ reg = <0x3c000000 0x4000000>;
+ bank-width = <4>;
+ status = "disabled";
+ };
+
soc {
#address-cells = <1>;
#size-cells = <1>;
@@ -297,6 +322,13 @@
clocks = <&uartclk>, <&pclk>;
clock-names = "uartclk", "apb_pclk";
};
+
+ /* Direct-mapped development chip ROM */
+ pb1176_rom at 10200000 {
+ compatible = "direct-mapped";
+ reg = <0x10200000 0x4000>;
+ bank-width = <1>;
+ };
};
/* These peripherals are inside the FPGA rather than the DevChip */
--
2.4.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 6/6] ARM: realview: fix up PB11MP flash compat strings
2016-01-26 11:11 [PATCH 0/6] Versatile flash protection in DT Linus Walleij
` (4 preceding siblings ...)
2016-01-26 11:12 ` [PATCH 5/6] ARM: realview: add flash devices to the PB1176 DTS Linus Walleij
@ 2016-01-26 11:12 ` Linus Walleij
5 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2016-01-26 11:12 UTC (permalink / raw)
To: linux-arm-kernel
The two flash memories in the PB11MPCore have their VPP/WP
lines controlled from the system controller add-on in the MTD
subsystem. "arm,versatile-flash" is the first compatible string
to use to get the right support.
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/boot/dts/arm-realview-pb11mp.dts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/arm-realview-pb11mp.dts b/arch/arm/boot/dts/arm-realview-pb11mp.dts
index da755c9851a7..63d6a051839f 100644
--- a/arch/arm/boot/dts/arm-realview-pb11mp.dts
+++ b/arch/arm/boot/dts/arm-realview-pb11mp.dts
@@ -230,14 +230,14 @@
flash0 at 40000000 {
/* 2 * 32MiB NOR Flash memory */
- compatible = "arm,vexpress-flash", "cfi-flash";
+ compatible = "arm,versatile-flash", "cfi-flash";
reg = <0x40000000 0x04000000>;
bank-width = <4>;
};
flash1 at 44000000 {
// 2 * 32MiB NOR Flash memory
- compatible = "arm,vexpress-flash", "cfi-flash";
+ compatible = "arm,versatile-flash", "cfi-flash";
reg = <0x44000000 0x04000000>;
bank-width = <4>;
};
--
2.4.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/6] mtd: physmap_of: add a hook for Versatile write protection
2016-01-26 11:12 ` [PATCH 2/6] mtd: physmap_of: add a hook for Versatile write protection Linus Walleij
@ 2016-01-26 11:37 ` Russell King - ARM Linux
2016-01-27 9:25 ` Linus Walleij
2016-02-13 13:19 ` Linus Walleij
1 sibling, 1 reply; 14+ messages in thread
From: Russell King - ARM Linux @ 2016-01-26 11:37 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jan 26, 2016 at 12:12:01PM +0100, Linus Walleij wrote:
> Solve this by looking for the arm,versatile-flash compatible
> string in the flash device tree node. In the driver,
> add a special hook to check for the various Versatile syscons and
> register a callback for .set_vpp() if this compatible is present.
You are aware that the "write enable" applies to all flash devices
on the board, and not just NOR flash. What that means is if you
have drivers for the other flash devices, you need to have a way
to enable writes when _any_ driver wants write access.
So, it shouldn't be part of the flash driver at all.
--
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/6] mtd: augment the "arm,versatile-flash" bindings
2016-01-26 11:12 ` [PATCH 1/6] mtd: augment the "arm,versatile-flash" bindings Linus Walleij
@ 2016-01-26 22:02 ` Rob Herring
0 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2016-01-26 22:02 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jan 26, 2016 at 12:12:00PM +0100, Linus Walleij wrote:
> The bindings for the "arm,versatile-flash" device was merged in
> commit 3ba7222ac992d24d09ccd0b55940b54849eef752
> "arm/versatile: Add device tree support" but was never used
> for anything.
>
> Versatile flash chips are actually just standard CFI chips,
> but they have one or two bits in a system controller to control
> VPP and write protection. Let's use this compatible string in
> conjunction with "cfi-flash" to indicate that we have a
> normal CFI flash with some extra Versatile-specific protection.
>
> Cc: devicetree at vger.kernel.org
> Cc: Grant Likely <grant.likely@linaro.org>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> .../devicetree/bindings/mtd/arm-versatile.txt | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/6] mtd: physmap_of: add a hook for Versatile write protection
2016-01-26 11:37 ` Russell King - ARM Linux
@ 2016-01-27 9:25 ` Linus Walleij
0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2016-01-27 9:25 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jan 26, 2016 at 12:37 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Tue, Jan 26, 2016 at 12:12:01PM +0100, Linus Walleij wrote:
>> Solve this by looking for the arm,versatile-flash compatible
>> string in the flash device tree node. In the driver,
>> add a special hook to check for the various Versatile syscons and
>> register a callback for .set_vpp() if this compatible is present.
>
> You are aware that the "write enable" applies to all flash devices
> on the board, and not just NOR flash. What that means is if you
> have drivers for the other flash devices, you need to have a way
> to enable writes when _any_ driver wants write access.
>
> So, it shouldn't be part of the flash driver at all.
Yes this is correct ... I put in the current code to be able to
test writes on the hardware. As to actually write to flash on
the Integrator both flags must be set to 1.
I don't see why it would just be a problem just for write
enable though, as I guess the VPP bit is *also* shared by all
devices?
After
commit 876fe76d793d03077
"mtd: maps: physmap: Add reference counter to set_vpp()"
As long as the flash devices are all physmap this reference
counter should hold VPP+WP enabled with this code as
long as any flash device has called .set_vpp().
It is a bit unintuitive that .set_vpp() is named like that though.
.enable_write() or something would be better I guess.
(The reference count also makes it start to reimplement
the regulator infrastructure.)
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/6] mtd: physmap_of: add a hook for Versatile write protection
2016-01-26 11:12 ` [PATCH 2/6] mtd: physmap_of: add a hook for Versatile write protection Linus Walleij
2016-01-26 11:37 ` Russell King - ARM Linux
@ 2016-02-13 13:19 ` Linus Walleij
2016-02-22 13:09 ` Linus Walleij
1 sibling, 1 reply; 14+ messages in thread
From: Linus Walleij @ 2016-02-13 13:19 UTC (permalink / raw)
To: linux-arm-kernel
Hey MTD folks,
On Tue, Jan 26, 2016 at 12:12 PM, Linus Walleij
<linus.walleij@linaro.org> wrote:
> In order to support device tree probing of Versatile NOR flash
> chips, there must be a way to add the VPP (write protection)
> enable/disable callback. The register in question is in the
> system controllers of these machines. Apart from this quirk,
> the ARM flash chips are standard CFI flash chips from various
> vendors.
>
> Additionally, the Integrator/AP require you to set up the external
> bus interface (EBI) to allow writes to the chip select where the
> flash memory is connected.
>
> Solve this by looking for the arm,versatile-flash compatible
> string in the flash device tree node. In the driver,
> add a special hook to check for the various Versatile syscons and
> register a callback for .set_vpp() if this compatible is present.
>
> Provide a special Kconfig entry for the addon hook so it will
> not be compiled in if the Versatile boards are not supported.
> Stubs in the header file make sure the impact will be zero on
> other platforms. (Compilers optimze this out.)
>
> With this patch, a large slew of ARM board file code can be
> removed.
>
> Cc: Grant Likely <grant.likely@linaro.org>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Do you think my reply to this about reference counting and
subsequent (accepted) patch to update the documentation
to reflect 876fe76d793d03077
"mtd: maps: physmap: Add reference counter to set_vpp()"
is enough to warrant merging of this?
If you want the code developed in any special direction
just tell me.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/6] mtd: physmap_of: add a hook for Versatile write protection
2016-02-13 13:19 ` Linus Walleij
@ 2016-02-22 13:09 ` Linus Walleij
2016-03-05 17:09 ` Linus Walleij
0 siblings, 1 reply; 14+ messages in thread
From: Linus Walleij @ 2016-02-22 13:09 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Feb 13, 2016 at 2:19 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Tue, Jan 26, 2016 at 12:12 PM, Linus Walleij
> <linus.walleij@linaro.org> wrote:
>
>> In order to support device tree probing of Versatile NOR flash
>> chips, there must be a way to add the VPP (write protection)
>> enable/disable callback. The register in question is in the
>> system controllers of these machines. Apart from this quirk,
>> the ARM flash chips are standard CFI flash chips from various
>> vendors.
>>
>> Additionally, the Integrator/AP require you to set up the external
>> bus interface (EBI) to allow writes to the chip select where the
>> flash memory is connected.
>>
>> Solve this by looking for the arm,versatile-flash compatible
>> string in the flash device tree node. In the driver,
>> add a special hook to check for the various Versatile syscons and
>> register a callback for .set_vpp() if this compatible is present.
>>
>> Provide a special Kconfig entry for the addon hook so it will
>> not be compiled in if the Versatile boards are not supported.
>> Stubs in the header file make sure the impact will be zero on
>> other platforms. (Compilers optimze this out.)
>>
>> With this patch, a large slew of ARM board file code can be
>> removed.
>>
>> Cc: Grant Likely <grant.likely@linaro.org>
>> Cc: Rob Herring <robh@kernel.org>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>
> Do you think my reply to this about reference counting and
> subsequent (accepted) patch to update the documentation
> to reflect 876fe76d793d03077
> "mtd: maps: physmap: Add reference counter to set_vpp()"
> is enough to warrant merging of this?
>
> If you want the code developed in any special direction
> just tell me.
Ping.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/6] mtd: physmap_of: add a hook for Versatile write protection
2016-02-22 13:09 ` Linus Walleij
@ 2016-03-05 17:09 ` Linus Walleij
2016-03-31 8:17 ` Linus Walleij
0 siblings, 1 reply; 14+ messages in thread
From: Linus Walleij @ 2016-03-05 17:09 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Feb 22, 2016 at 8:09 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Sat, Feb 13, 2016 at 2:19 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
>> On Tue, Jan 26, 2016 at 12:12 PM, Linus Walleij
>> <linus.walleij@linaro.org> wrote:
>>
>>> In order to support device tree probing of Versatile NOR flash
>>> chips, there must be a way to add the VPP (write protection)
>>> enable/disable callback. The register in question is in the
>>> system controllers of these machines. Apart from this quirk,
>>> the ARM flash chips are standard CFI flash chips from various
>>> vendors.
>>>
>>> Additionally, the Integrator/AP require you to set up the external
>>> bus interface (EBI) to allow writes to the chip select where the
>>> flash memory is connected.
>>>
>>> Solve this by looking for the arm,versatile-flash compatible
>>> string in the flash device tree node. In the driver,
>>> add a special hook to check for the various Versatile syscons and
>>> register a callback for .set_vpp() if this compatible is present.
>>>
>>> Provide a special Kconfig entry for the addon hook so it will
>>> not be compiled in if the Versatile boards are not supported.
>>> Stubs in the header file make sure the impact will be zero on
>>> other platforms. (Compilers optimze this out.)
>>>
>>> With this patch, a large slew of ARM board file code can be
>>> removed.
>>>
>>> Cc: Grant Likely <grant.likely@linaro.org>
>>> Cc: Rob Herring <robh@kernel.org>
>>> Cc: Arnd Bergmann <arnd@arndb.de>
>>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>>
>> Do you think my reply to this about reference counting and
>> subsequent (accepted) patch to update the documentation
>> to reflect 876fe76d793d03077
>> "mtd: maps: physmap: Add reference counter to set_vpp()"
>> is enough to warrant merging of this?
>>
>> If you want the code developed in any special direction
>> just tell me.
>
> Ping.
Ping.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/6] mtd: physmap_of: add a hook for Versatile write protection
2016-03-05 17:09 ` Linus Walleij
@ 2016-03-31 8:17 ` Linus Walleij
0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2016-03-31 8:17 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Mar 5, 2016 at 6:09 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Mon, Feb 22, 2016 at 8:09 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
>> On Sat, Feb 13, 2016 at 2:19 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
>>> On Tue, Jan 26, 2016 at 12:12 PM, Linus Walleij
>>> <linus.walleij@linaro.org> wrote:
>>>
>>>> In order to support device tree probing of Versatile NOR flash
>>>> chips, there must be a way to add the VPP (write protection)
>>>> enable/disable callback. The register in question is in the
>>>> system controllers of these machines. Apart from this quirk,
>>>> the ARM flash chips are standard CFI flash chips from various
>>>> vendors.
>>>>
>>>> Additionally, the Integrator/AP require you to set up the external
>>>> bus interface (EBI) to allow writes to the chip select where the
>>>> flash memory is connected.
>>>>
>>>> Solve this by looking for the arm,versatile-flash compatible
>>>> string in the flash device tree node. In the driver,
>>>> add a special hook to check for the various Versatile syscons and
>>>> register a callback for .set_vpp() if this compatible is present.
>>>>
>>>> Provide a special Kconfig entry for the addon hook so it will
>>>> not be compiled in if the Versatile boards are not supported.
>>>> Stubs in the header file make sure the impact will be zero on
>>>> other platforms. (Compilers optimze this out.)
>>>>
>>>> With this patch, a large slew of ARM board file code can be
>>>> removed.
>>>>
>>>> Cc: Grant Likely <grant.likely@linaro.org>
>>>> Cc: Rob Herring <robh@kernel.org>
>>>> Cc: Arnd Bergmann <arnd@arndb.de>
>>>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>>>
>>> Do you think my reply to this about reference counting and
>>> subsequent (accepted) patch to update the documentation
>>> to reflect 876fe76d793d03077
>>> "mtd: maps: physmap: Add reference counter to set_vpp()"
>>> is enough to warrant merging of this?
>>>
>>> If you want the code developed in any special direction
>>> just tell me.
>>
>> Ping.
>
> Ping.
Ping.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-03-31 8:17 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-26 11:11 [PATCH 0/6] Versatile flash protection in DT Linus Walleij
2016-01-26 11:12 ` [PATCH 1/6] mtd: augment the "arm,versatile-flash" bindings Linus Walleij
2016-01-26 22:02 ` Rob Herring
2016-01-26 11:12 ` [PATCH 2/6] mtd: physmap_of: add a hook for Versatile write protection Linus Walleij
2016-01-26 11:37 ` Russell King - ARM Linux
2016-01-27 9:25 ` Linus Walleij
2016-02-13 13:19 ` Linus Walleij
2016-02-22 13:09 ` Linus Walleij
2016-03-05 17:09 ` Linus Walleij
2016-03-31 8:17 ` Linus Walleij
2016-01-26 11:12 ` [PATCH 3/6] ARM: versatile: move flash registration to the device tree Linus Walleij
2016-01-26 11:12 ` [PATCH 4/6] ARM: integrator: move flash registration to " Linus Walleij
2016-01-26 11:12 ` [PATCH 5/6] ARM: realview: add flash devices to the PB1176 DTS Linus Walleij
2016-01-26 11:12 ` [PATCH 6/6] ARM: realview: fix up PB11MP flash compat strings Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).