linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v11 0/5] soc: fsl: Add initial guts driver
@ 2016-07-17  2:50 Scott Wood
  2016-07-17  2:50 ` [PATCH v11 1/5] dt: bindings: update Freescale DCFG compatible Scott Wood
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Scott Wood @ 2016-07-17  2:50 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Yangbo Lu, linux-mmc, Arnd Bergmann, linux-kernel, devicetree,
	Scott Wood

This patchset adds the beginnings of a driver to consolidate accesses to
the Freescale/NXP "global utilities" block.  Initially only access to SVR
(the system version register) is provided.  This register is needed by
various drivers, mainly for errata detection.  Access to SVR via
mfspr(SPRN_SVR) is now discouraged, especially in drivers that are
not PPC-specific.

I plan to send this via the PPC tree for this merge window, to provide a
base for using/extending the guts driver in various drivers in the next
cycle.

Scott Wood (1):
  powerpc/fsl-pci: Use fsl_guts_get_svr()

Yangbo Lu (2):
  dt: bindings: move guts devicetree doc out of powerpc directory
  soc: fsl: add GUTS driver for QorIQ platforms

yangbo lu (2):
  dt: bindings: update Freescale DCFG compatible
  powerpc/fsl: move mpc85xx.h to include/linux/fsl

 Documentation/devicetree/bindings/arm/fsl.txt      |   6 +-
 .../bindings/{powerpc => soc}/fsl/guts.txt         |   3 +
 arch/powerpc/Kconfig                               |   1 +
 arch/powerpc/kernel/cpu_setup_fsl_booke.S          |   2 +-
 arch/powerpc/platforms/85xx/common.c               |   2 -
 arch/powerpc/sysdev/fsl_pci.c                      |   8 +-
 drivers/clk/clk-qoriq.c                            |   3 +-
 drivers/i2c/busses/i2c-mpc.c                       |   2 +-
 drivers/iommu/fsl_pamu.c                           |   3 +-
 drivers/net/ethernet/freescale/gianfar.c           |   2 +-
 drivers/soc/Kconfig                                |   2 +-
 drivers/soc/fsl/Kconfig                            |   8 ++
 drivers/soc/fsl/Makefile                           |   1 +
 drivers/soc/fsl/guts.c                             | 113 ++++++++++++++++++
 include/linux/fsl/guts.h                           | 126 +++++++++++++--------
 .../asm/mpc85xx.h => include/linux/fsl/svr.h       |   4 +-
 16 files changed, 223 insertions(+), 63 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt (91%)
 create mode 100644 drivers/soc/fsl/Kconfig
 create mode 100644 drivers/soc/fsl/guts.c
 rename arch/powerpc/include/asm/mpc85xx.h => include/linux/fsl/svr.h (97%)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v11 1/5] dt: bindings: update Freescale DCFG compatible
  2016-07-17  2:50 [PATCH v11 0/5] soc: fsl: Add initial guts driver Scott Wood
@ 2016-07-17  2:50 ` Scott Wood
  2016-07-17  2:50 ` [PATCH v11 2/5] dt: bindings: move guts devicetree doc out of powerpc directory Scott Wood
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 17+ messages in thread
From: Scott Wood @ 2016-07-17  2:50 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Yangbo Lu, linux-mmc, Arnd Bergmann, linux-kernel, devicetree,
	Scott Wood

From: yangbo lu <yangbo.lu@nxp.com>

Update Freescale DCFG compatible with 'fsl,<chip>-dcfg' instead
of 'fsl,ls1021a-dcfg' to include more chips such as ls1021a,
ls1043a, and ls2080a.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Scott Wood <oss@buserror.net>
---
 Documentation/devicetree/bindings/arm/fsl.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/arm/fsl.txt b/Documentation/devicetree/bindings/arm/fsl.txt
index dbbc095..713c1ae 100644
--- a/Documentation/devicetree/bindings/arm/fsl.txt
+++ b/Documentation/devicetree/bindings/arm/fsl.txt
@@ -119,7 +119,11 @@ Freescale DCFG
 configuration and status for the device. Such as setting the secondary
 core start address and release the secondary core from holdoff and startup.
   Required properties:
-  - compatible: should be "fsl,ls1021a-dcfg"
+  - compatible: should be "fsl,<chip>-dcfg"
+    Possible compatibles:
+	"fsl,ls1021a-dcfg"
+	"fsl,ls1043a-dcfg"
+	"fsl,ls2080a-dcfg"
   - reg : should contain base address and length of DCFG memory-mapped registers
 
 Example:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v11 2/5] dt: bindings: move guts devicetree doc out of powerpc directory
  2016-07-17  2:50 [PATCH v11 0/5] soc: fsl: Add initial guts driver Scott Wood
  2016-07-17  2:50 ` [PATCH v11 1/5] dt: bindings: update Freescale DCFG compatible Scott Wood
@ 2016-07-17  2:50 ` Scott Wood
  2016-07-17  2:50 ` [PATCH v11 3/5] soc: fsl: add GUTS driver for QorIQ platforms Scott Wood
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 17+ messages in thread
From: Scott Wood @ 2016-07-17  2:50 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Yangbo Lu, linux-mmc, Arnd Bergmann, linux-kernel, devicetree,
	Scott Wood

From: Yangbo Lu <yangbo.lu@nxp.com>

Move guts devicetree doc to Documentation/devicetree/bindings/soc/fsl/
since it's used by not only PowerPC but also ARM. And add a specification
for 'little-endian' property.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Scott Wood <oss@buserror.net>
---
 Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt | 3 +++
 1 file changed, 3 insertions(+)
 rename Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt (91%)

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt b/Documentation/devicetree/bindings/soc/fsl/guts.txt
similarity index 91%
rename from Documentation/devicetree/bindings/powerpc/fsl/guts.txt
rename to Documentation/devicetree/bindings/soc/fsl/guts.txt
index b71b203..07adca9 100644
--- a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt
+++ b/Documentation/devicetree/bindings/soc/fsl/guts.txt
@@ -25,6 +25,9 @@ Recommended properties:
  - fsl,liodn-bits : Indicates the number of defined bits in the LIODN
    registers, for those SOCs that have a PAMU device.
 
+ - little-endian : Indicates that the global utilities block is little
+   endian. The default is big endian.
+
 Examples:
 	global-utilities@e0000 {	/* global utilities block */
 		compatible = "fsl,mpc8548-guts";
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v11 3/5] soc: fsl: add GUTS driver for QorIQ platforms
  2016-07-17  2:50 [PATCH v11 0/5] soc: fsl: Add initial guts driver Scott Wood
  2016-07-17  2:50 ` [PATCH v11 1/5] dt: bindings: update Freescale DCFG compatible Scott Wood
  2016-07-17  2:50 ` [PATCH v11 2/5] dt: bindings: move guts devicetree doc out of powerpc directory Scott Wood
@ 2016-07-17  2:50 ` Scott Wood
  2016-07-17  2:50 ` [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl Scott Wood
  2016-07-17  2:50 ` [PATCH v11 5/5] powerpc/fsl-pci: Use fsl_guts_get_svr() Scott Wood
  4 siblings, 0 replies; 17+ messages in thread
From: Scott Wood @ 2016-07-17  2:50 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Yangbo Lu, linux-mmc, Arnd Bergmann, linux-kernel, devicetree,
	Scott Wood

From: Yangbo Lu <yangbo.lu@nxp.com>

The global utilities block controls power management, I/O device
enabling, power-onreset(POR) configuration monitoring, alternate
function selection for multiplexed signals,and clock control.

This patch adds a driver to manage and access global utilities block.
Initially only reading SVR is supported.  Other guts accesses, such as
reading RCW, should eventually be moved into this driver as well.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
[scottwood: minor cleanup]
Signed-off-by: Scott Wood <oss@buserror.net>
---
 arch/powerpc/platforms/85xx/common.c |   2 -
 drivers/soc/Kconfig                  |   2 +-
 drivers/soc/fsl/Kconfig              |   8 +++
 drivers/soc/fsl/Makefile             |   1 +
 drivers/soc/fsl/guts.c               | 113 +++++++++++++++++++++++++++++++
 include/linux/fsl/guts.h             | 126 ++++++++++++++++++++++-------------
 6 files changed, 201 insertions(+), 51 deletions(-)
 create mode 100644 drivers/soc/fsl/Kconfig
 create mode 100644 drivers/soc/fsl/guts.c

diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index 28720a4..badd193 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -29,8 +29,6 @@ static const struct of_device_id mpc85xx_common_ids[] __initconst = {
 	{ .compatible = "fsl,srio", },
 	/* So that the DMA channel nodes can be probed individually: */
 	{ .compatible = "fsl,eloplus-dma", },
-	/* For the PMC driver */
-	{ .compatible = "fsl,mpc8548-guts", },
 	/* Probably unnecessary? */
 	{ .compatible = "gpio-leds", },
 	/* For all PCI controllers */
diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index cb58ef0..7106463 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -2,7 +2,7 @@ menu "SOC (System On Chip) specific Drivers"
 
 source "drivers/soc/bcm/Kconfig"
 source "drivers/soc/brcmstb/Kconfig"
-source "drivers/soc/fsl/qe/Kconfig"
+source "drivers/soc/fsl/Kconfig"
 source "drivers/soc/mediatek/Kconfig"
 source "drivers/soc/qcom/Kconfig"
 source "drivers/soc/rockchip/Kconfig"
diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig
new file mode 100644
index 0000000..b313759
--- /dev/null
+++ b/drivers/soc/fsl/Kconfig
@@ -0,0 +1,8 @@
+#
+# Freescale SOC drivers
+#
+
+source "drivers/soc/fsl/qe/Kconfig"
+
+config FSL_GUTS
+	bool
diff --git a/drivers/soc/fsl/Makefile b/drivers/soc/fsl/Makefile
index 203307f..02afb7f 100644
--- a/drivers/soc/fsl/Makefile
+++ b/drivers/soc/fsl/Makefile
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_QUICC_ENGINE)		+= qe/
 obj-$(CONFIG_CPM)			+= qe/
+obj-$(CONFIG_FSL_GUTS)			+= guts.o
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
new file mode 100644
index 0000000..b534654
--- /dev/null
+++ b/drivers/soc/fsl/guts.c
@@ -0,0 +1,113 @@
+/*
+ * Freescale QorIQ Platforms GUTS Driver
+ *
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ *
+ * 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.
+ */
+
+#include <linux/io.h>
+#include <linux/slab.h>
+#include <linux/mutex.h>
+#include <linux/of_address.h>
+#include <linux/of_platform.h>
+#include <linux/fsl/guts.h>
+
+struct guts {
+	struct ccsr_guts __iomem *regs;
+	bool little_endian;
+};
+
+static struct guts *guts;
+static DEFINE_MUTEX(guts_lock);
+
+u32 fsl_guts_get_svr(void)
+{
+	u32 svr = 0;
+
+	if (!guts || !guts->regs) {
+#ifdef CONFIG_PPC
+		svr =  mfspr(SPRN_SVR);
+#endif
+		return svr;
+	}
+
+	if (guts->little_endian)
+		svr = ioread32(&guts->regs->svr);
+	else
+		svr = ioread32be(&guts->regs->svr);
+
+	return svr;
+}
+EXPORT_SYMBOL(fsl_guts_get_svr);
+
+/*
+ * Table for matching compatible strings, for device tree
+ * guts node, for Freescale QorIQ SOCs.
+ */
+static const struct of_device_id guts_of_match[] = {
+	{ .compatible = "fsl,qoriq-device-config-1.0", },
+	{ .compatible = "fsl,qoriq-device-config-2.0", },
+	{ .compatible = "fsl,p1010-guts", },
+	{ .compatible = "fsl,p1020-guts", },
+	{ .compatible = "fsl,p1021-guts", },
+	{ .compatible = "fsl,p1022-guts", },
+	{ .compatible = "fsl,p1023-guts", },
+	{ .compatible = "fsl,p2020-guts", },
+	{ .compatible = "fsl,bsc9131-guts", },
+	{ .compatible = "fsl,bsc9132-guts", },
+	{ .compatible = "fsl,mpc8536-guts", },
+	{ .compatible = "fsl,mpc8544-guts", },
+	{ .compatible = "fsl,mpc8548-guts", },
+	{ .compatible = "fsl,mpc8568-guts", },
+	{ .compatible = "fsl,mpc8569-guts", },
+	{ .compatible = "fsl,mpc8572-guts", },
+	{ .compatible = "fsl,ls1021a-dcfg", },
+	{ .compatible = "fsl,ls1043a-dcfg", },
+	{ .compatible = "fsl,ls2080a-dcfg", },
+	{}
+};
+
+int fsl_guts_init(void)
+{
+	struct device_node *np;
+	int ret;
+
+	mutex_lock(&guts_lock);
+	/* Initialize guts only once */
+	if (guts) {
+		ret = guts->regs ? 0 : -ENOMEM;
+		goto out;
+	}
+
+	np = of_find_matching_node(NULL, guts_of_match);
+	if (!np) {
+		ret = -ENODEV;
+		goto out;
+	}
+
+	guts = kzalloc(sizeof(*guts), GFP_KERNEL);
+	if (!guts) {
+		ret = -ENOMEM;
+		goto out_np;
+	}
+
+	guts->little_endian = of_property_read_bool(np, "little-endian");
+
+	guts->regs = of_iomap(np, 0);
+	if (!guts->regs) {
+		ret = -ENOMEM;
+		goto out_np;
+	}
+
+	ret = 0;
+out_np:
+	of_node_put(np);
+out:
+	mutex_unlock(&guts_lock);
+	return ret;
+}
+EXPORT_SYMBOL(fsl_guts_init);
diff --git a/include/linux/fsl/guts.h b/include/linux/fsl/guts.h
index 649e917..7e1e22b 100644
--- a/include/linux/fsl/guts.h
+++ b/include/linux/fsl/guts.h
@@ -29,83 +29,113 @@
  * #ifdefs.
  */
 struct ccsr_guts {
-	__be32	porpllsr;	/* 0x.0000 - POR PLL Ratio Status Register */
-	__be32	porbmsr;	/* 0x.0004 - POR Boot Mode Status Register */
-	__be32	porimpscr;	/* 0x.0008 - POR I/O Impedance Status and Control Register */
-	__be32	pordevsr;	/* 0x.000c - POR I/O Device Status Register */
-	__be32	pordbgmsr;	/* 0x.0010 - POR Debug Mode Status Register */
-	__be32	pordevsr2;	/* 0x.0014 - POR device status register 2 */
+	u32	porpllsr;	/* 0x.0000 - POR PLL Ratio Status Register */
+	u32	porbmsr;	/* 0x.0004 - POR Boot Mode Status Register */
+	u32	porimpscr;	/* 0x.0008 - POR I/O Impedance Status and
+				 *           Control Register
+				 */
+	u32	pordevsr;	/* 0x.000c - POR I/O Device Status Register */
+	u32	pordbgmsr;	/* 0x.0010 - POR Debug Mode Status Register */
+	u32	pordevsr2;	/* 0x.0014 - POR device status register 2 */
 	u8	res018[0x20 - 0x18];
-	__be32	porcir;		/* 0x.0020 - POR Configuration Information Register */
+	u32	porcir;		/* 0x.0020 - POR Configuration Information
+				 *           Register
+				 */
 	u8	res024[0x30 - 0x24];
-	__be32	gpiocr;		/* 0x.0030 - GPIO Control Register */
+	u32	gpiocr;		/* 0x.0030 - GPIO Control Register */
 	u8	res034[0x40 - 0x34];
-	__be32	gpoutdr;	/* 0x.0040 - General-Purpose Output Data Register */
+	u32	gpoutdr;	/* 0x.0040 - General-Purpose Output Data
+				 *           Register
+				 */
 	u8	res044[0x50 - 0x44];
-	__be32	gpindr;		/* 0x.0050 - General-Purpose Input Data Register */
+	u32	gpindr;		/* 0x.0050 - General-Purpose Input Data
+				 *           Register
+				 */
 	u8	res054[0x60 - 0x54];
-	__be32	pmuxcr;		/* 0x.0060 - Alternate Function Signal Multiplex Control */
-        __be32  pmuxcr2;	/* 0x.0064 - Alternate function signal multiplex control 2 */
-        __be32  dmuxcr;		/* 0x.0068 - DMA Mux Control Register */
+	u32	pmuxcr;		/* 0x.0060 - Alternate Function Signal
+				 *           Multiplex Control
+				 */
+	u32	pmuxcr2;	/* 0x.0064 - Alternate function signal
+				 *           multiplex control 2
+				 */
+	u32	dmuxcr;		/* 0x.0068 - DMA Mux Control Register */
         u8	res06c[0x70 - 0x6c];
-	__be32	devdisr;	/* 0x.0070 - Device Disable Control */
+	u32	devdisr;	/* 0x.0070 - Device Disable Control */
 #define CCSR_GUTS_DEVDISR_TB1	0x00001000
 #define CCSR_GUTS_DEVDISR_TB0	0x00004000
-	__be32	devdisr2;	/* 0x.0074 - Device Disable Control 2 */
+	u32	devdisr2;	/* 0x.0074 - Device Disable Control 2 */
 	u8	res078[0x7c - 0x78];
-	__be32  pmjcr;		/* 0x.007c - 4 Power Management Jog Control Register */
-	__be32	powmgtcsr;	/* 0x.0080 - Power Management Status and Control Register */
-	__be32  pmrccr;		/* 0x.0084 - Power Management Reset Counter Configuration Register */
-	__be32  pmpdccr;	/* 0x.0088 - Power Management Power Down Counter Configuration Register */
-	__be32  pmcdr;		/* 0x.008c - 4Power management clock disable register */
-	__be32	mcpsumr;	/* 0x.0090 - Machine Check Summary Register */
-	__be32	rstrscr;	/* 0x.0094 - Reset Request Status and Control Register */
-	__be32  ectrstcr;	/* 0x.0098 - Exception reset control register */
-	__be32  autorstsr;	/* 0x.009c - Automatic reset status register */
-	__be32	pvr;		/* 0x.00a0 - Processor Version Register */
-	__be32	svr;		/* 0x.00a4 - System Version Register */
+	u32	pmjcr;		/* 0x.007c - 4 Power Management Jog Control
+				 *           Register
+				 */
+	u32	powmgtcsr;	/* 0x.0080 - Power Management Status and
+				 *           Control Register
+				 */
+	u32	pmrccr;		/* 0x.0084 - Power Management Reset Counter
+				 *           Configuration Register
+				 */
+	u32	pmpdccr;	/* 0x.0088 - Power Management Power Down Counter
+				 *           Configuration Register
+				 */
+	u32	pmcdr;		/* 0x.008c - 4Power management clock disable
+				 *           register
+				 */
+	u32	mcpsumr;	/* 0x.0090 - Machine Check Summary Register */
+	u32	rstrscr;	/* 0x.0094 - Reset Request Status and
+				 *           Control Register
+				 */
+	u32	ectrstcr;	/* 0x.0098 - Exception reset control register */
+	u32	autorstsr;	/* 0x.009c - Automatic reset status register */
+	u32	pvr;		/* 0x.00a0 - Processor Version Register */
+	u32	svr;		/* 0x.00a4 - System Version Register */
 	u8	res0a8[0xb0 - 0xa8];
-	__be32	rstcr;		/* 0x.00b0 - Reset Control Register */
+	u32	rstcr;		/* 0x.00b0 - Reset Control Register */
 	u8	res0b4[0xc0 - 0xb4];
-	__be32  iovselsr;	/* 0x.00c0 - I/O voltage select status register
+	u32	iovselsr;	/* 0x.00c0 - I/O voltage select status register
 					     Called 'elbcvselcr' on 86xx SOCs */
 	u8	res0c4[0x100 - 0xc4];
-	__be32	rcwsr[16];	/* 0x.0100 - Reset Control Word Status registers
+	u32	rcwsr[16];	/* 0x.0100 - Reset Control Word Status registers
 					     There are 16 registers */
 	u8	res140[0x224 - 0x140];
-	__be32  iodelay1;	/* 0x.0224 - IO delay control register 1 */
-	__be32  iodelay2;	/* 0x.0228 - IO delay control register 2 */
+	u32	iodelay1;	/* 0x.0224 - IO delay control register 1 */
+	u32	iodelay2;	/* 0x.0228 - IO delay control register 2 */
 	u8	res22c[0x604 - 0x22c];
-	__be32	pamubypenr; 	/* 0x.604 - PAMU bypass enable register */
+	u32	pamubypenr;	/* 0x.604 - PAMU bypass enable register */
 	u8	res608[0x800 - 0x608];
-	__be32	clkdvdr;	/* 0x.0800 - Clock Divide Register */
+	u32	clkdvdr;	/* 0x.0800 - Clock Divide Register */
 	u8	res804[0x900 - 0x804];
-	__be32	ircr;		/* 0x.0900 - Infrared Control Register */
+	u32	ircr;		/* 0x.0900 - Infrared Control Register */
 	u8	res904[0x908 - 0x904];
-	__be32	dmacr;		/* 0x.0908 - DMA Control Register */
+	u32	dmacr;		/* 0x.0908 - DMA Control Register */
 	u8	res90c[0x914 - 0x90c];
-	__be32	elbccr;		/* 0x.0914 - eLBC Control Register */
+	u32	elbccr;		/* 0x.0914 - eLBC Control Register */
 	u8	res918[0xb20 - 0x918];
-	__be32	ddr1clkdr;	/* 0x.0b20 - DDR1 Clock Disable Register */
-	__be32	ddr2clkdr;	/* 0x.0b24 - DDR2 Clock Disable Register */
-	__be32	ddrclkdr;	/* 0x.0b28 - DDR Clock Disable Register */
+	u32	ddr1clkdr;	/* 0x.0b20 - DDR1 Clock Disable Register */
+	u32	ddr2clkdr;	/* 0x.0b24 - DDR2 Clock Disable Register */
+	u32	ddrclkdr;	/* 0x.0b28 - DDR Clock Disable Register */
 	u8	resb2c[0xe00 - 0xb2c];
-	__be32	clkocr;		/* 0x.0e00 - Clock Out Select Register */
+	u32	clkocr;		/* 0x.0e00 - Clock Out Select Register */
 	u8	rese04[0xe10 - 0xe04];
-	__be32	ddrdllcr;	/* 0x.0e10 - DDR DLL Control Register */
+	u32	ddrdllcr;	/* 0x.0e10 - DDR DLL Control Register */
 	u8	rese14[0xe20 - 0xe14];
-	__be32	lbcdllcr;	/* 0x.0e20 - LBC DLL Control Register */
-	__be32  cpfor;		/* 0x.0e24 - L2 charge pump fuse override register */
+	u32	lbcdllcr;	/* 0x.0e20 - LBC DLL Control Register */
+	u32	cpfor;		/* 0x.0e24 - L2 charge pump fuse override
+				 *           register
+				 */
 	u8	rese28[0xf04 - 0xe28];
-	__be32	srds1cr0;	/* 0x.0f04 - SerDes1 Control Register 0 */
-	__be32	srds1cr1;	/* 0x.0f08 - SerDes1 Control Register 0 */
+	u32	srds1cr0;	/* 0x.0f04 - SerDes1 Control Register 0 */
+	u32	srds1cr1;	/* 0x.0f08 - SerDes1 Control Register 0 */
 	u8	resf0c[0xf2c - 0xf0c];
-	__be32  itcr;		/* 0x.0f2c - Internal transaction control register */
+	u32	itcr;		/* 0x.0f2c - Internal transaction control
+				 *           register
+				 */
 	u8	resf30[0xf40 - 0xf30];
-	__be32	srds2cr0;	/* 0x.0f40 - SerDes2 Control Register 0 */
-	__be32	srds2cr1;	/* 0x.0f44 - SerDes2 Control Register 0 */
+	u32	srds2cr0;	/* 0x.0f40 - SerDes2 Control Register 0 */
+	u32	srds2cr1;	/* 0x.0f44 - SerDes2 Control Register 0 */
 } __attribute__ ((packed));
 
+u32 fsl_guts_get_svr(void);
+int fsl_guts_init(void);
 
 /* Alternate function signal multiplex control */
 #define MPC85xx_PMUXCR_QE(x) (0x8000 >> (x))
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
  2016-07-17  2:50 [PATCH v11 0/5] soc: fsl: Add initial guts driver Scott Wood
                   ` (2 preceding siblings ...)
  2016-07-17  2:50 ` [PATCH v11 3/5] soc: fsl: add GUTS driver for QorIQ platforms Scott Wood
@ 2016-07-17  2:50 ` Scott Wood
  2016-07-20 11:24   ` Arnd Bergmann
  2016-07-17  2:50 ` [PATCH v11 5/5] powerpc/fsl-pci: Use fsl_guts_get_svr() Scott Wood
  4 siblings, 1 reply; 17+ messages in thread
From: Scott Wood @ 2016-07-17  2:50 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Yangbo Lu, linux-mmc, Arnd Bergmann, linux-kernel, devicetree,
	Scott Wood

From: yangbo lu <yangbo.lu@nxp.com>

Move mpc85xx.h to include/linux/fsl and rename it to svr.h as a common
header file.  This SVR numberspace is used on some ARM chips as well as
PPC, and even to check for a PPC SVR multi-arch drivers would otherwise
need to ifdef the header inclusion and all references to the SVR symbols.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Joerg Roedel <jroedel@suse.de>
[scottwood: update description]
Signed-off-by: Scott Wood <oss@buserror.net>
---
 arch/powerpc/kernel/cpu_setup_fsl_booke.S                     | 2 +-
 arch/powerpc/sysdev/fsl_pci.c                                 | 2 +-
 drivers/clk/clk-qoriq.c                                       | 3 +--
 drivers/i2c/busses/i2c-mpc.c                                  | 2 +-
 drivers/iommu/fsl_pamu.c                                      | 3 +--
 drivers/net/ethernet/freescale/gianfar.c                      | 2 +-
 arch/powerpc/include/asm/mpc85xx.h => include/linux/fsl/svr.h | 4 ++--
 7 files changed, 8 insertions(+), 10 deletions(-)
 rename arch/powerpc/include/asm/mpc85xx.h => include/linux/fsl/svr.h (97%)

diff --git a/arch/powerpc/kernel/cpu_setup_fsl_booke.S b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
index 462aed9..2b0284e 100644
--- a/arch/powerpc/kernel/cpu_setup_fsl_booke.S
+++ b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
@@ -13,13 +13,13 @@
  *
  */
 
+#include <linux/fsl/svr.h>
 #include <asm/page.h>
 #include <asm/processor.h>
 #include <asm/cputable.h>
 #include <asm/ppc_asm.h>
 #include <asm/mmu-book3e.h>
 #include <asm/asm-offsets.h>
-#include <asm/mpc85xx.h>
 
 _GLOBAL(__e500_icache_setup)
 	mfspr	r0, SPRN_L1CSR1
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 0ef9df4..0fd1895 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -22,6 +22,7 @@
 #include <linux/delay.h>
 #include <linux/string.h>
 #include <linux/fsl/edac.h>
+#include <linux/fsl/svr.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/memblock.h>
@@ -37,7 +38,6 @@
 #include <asm/pci-bridge.h>
 #include <asm/ppc-pci.h>
 #include <asm/machdep.h>
-#include <asm/mpc85xx.h>
 #include <asm/disassemble.h>
 #include <asm/ppc-opcode.h>
 #include <sysdev/fsl_soc.h>
diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
index 58566a17..4b6c438 100644
--- a/drivers/clk/clk-qoriq.c
+++ b/drivers/clk/clk-qoriq.c
@@ -13,6 +13,7 @@
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/fsl/guts.h>
+#include <linux/fsl/svr.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -1149,8 +1150,6 @@ bad_args:
 }
 
 #ifdef CONFIG_PPC
-#include <asm/mpc85xx.h>
-
 static const u32 a4510_svrs[] __initconst = {
 	(SVR_P2040 << 8) | 0x10,	/* P2040 1.0 */
 	(SVR_P2040 << 8) | 0x11,	/* P2040 1.1 */
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 48ecffe..600704c 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -27,9 +27,9 @@
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
+#include <linux/fsl/svr.h>
 
 #include <asm/mpc52xx.h>
-#include <asm/mpc85xx.h>
 #include <sysdev/fsl_soc.h>
 
 #define DRV_NAME "mpc-i2c"
diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c
index a34355f..af8fb27 100644
--- a/drivers/iommu/fsl_pamu.c
+++ b/drivers/iommu/fsl_pamu.c
@@ -21,11 +21,10 @@
 #include "fsl_pamu.h"
 
 #include <linux/fsl/guts.h>
+#include <linux/fsl/svr.h>
 #include <linux/interrupt.h>
 #include <linux/genalloc.h>
 
-#include <asm/mpc85xx.h>
-
 /* define indexes for each operation mapping scenario */
 #define OMI_QMAN        0x00
 #define OMI_FMAN        0x01
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 2e6785b..450d31f 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -86,11 +86,11 @@
 #include <linux/udp.h>
 #include <linux/in.h>
 #include <linux/net_tstamp.h>
+#include <linux/fsl/svr.h>
 
 #include <asm/io.h>
 #ifdef CONFIG_PPC
 #include <asm/reg.h>
-#include <asm/mpc85xx.h>
 #endif
 #include <asm/irq.h>
 #include <asm/uaccess.h>
diff --git a/arch/powerpc/include/asm/mpc85xx.h b/include/linux/fsl/svr.h
similarity index 97%
rename from arch/powerpc/include/asm/mpc85xx.h
rename to include/linux/fsl/svr.h
index 213f3a8..8d13836 100644
--- a/arch/powerpc/include/asm/mpc85xx.h
+++ b/include/linux/fsl/svr.h
@@ -9,8 +9,8 @@
  * (at your option) any later version.
  */
 
-#ifndef __ASM_PPC_MPC85XX_H
-#define __ASM_PPC_MPC85XX_H
+#ifndef FSL_SVR_H
+#define FSL_SVR_H
 
 #define SVR_REV(svr)	((svr) & 0xFF)		/* SOC design resision */
 #define SVR_MAJ(svr)	(((svr) >>  4) & 0xF)	/* Major revision field*/
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v11 5/5] powerpc/fsl-pci: Use fsl_guts_get_svr()
  2016-07-17  2:50 [PATCH v11 0/5] soc: fsl: Add initial guts driver Scott Wood
                   ` (3 preceding siblings ...)
  2016-07-17  2:50 ` [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl Scott Wood
@ 2016-07-17  2:50 ` Scott Wood
  4 siblings, 0 replies; 17+ messages in thread
From: Scott Wood @ 2016-07-17  2:50 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Yangbo Lu, linux-mmc, Arnd Bergmann, linux-kernel, devicetree,
	Scott Wood

Establish an initial user of fsl_guts_get_svr(), so that the code gets
some test coverage until users outside arch/powerpc can get converted.

Signed-off-by: Scott Wood <oss@buserror.net>
---
 arch/powerpc/Kconfig          | 1 +
 arch/powerpc/sysdev/fsl_pci.c | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index fcfe533..765df81 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -777,6 +777,7 @@ config FSL_PCI
  	bool
 	select PPC_INDIRECT_PCI
 	select PCI_QUIRKS
+	select FSL_GUTS
 
 config FSL_PMC
 	bool
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 0fd1895..9ba570cf 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -22,6 +22,7 @@
 #include <linux/delay.h>
 #include <linux/string.h>
 #include <linux/fsl/edac.h>
+#include <linux/fsl/guts.h>
 #include <linux/fsl/svr.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -529,7 +530,10 @@ int fsl_add_bridge(struct platform_device *pdev, int is_primary)
 	struct device_node *dev;
 	struct ccsr_pci __iomem *pci;
 	u16 temp;
-	u32 svr = mfspr(SPRN_SVR);
+	u32 svr;
+
+	fsl_guts_init();
+	svr = fsl_guts_get_svr();
 
 	dev = pdev->dev.of_node;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
  2016-07-17  2:50 ` [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl Scott Wood
@ 2016-07-20 11:24   ` Arnd Bergmann
  2016-07-20 18:31     ` Scott Wood
  0 siblings, 1 reply; 17+ messages in thread
From: Arnd Bergmann @ 2016-07-20 11:24 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, Yangbo Lu, linux-mmc, linux-kernel, devicetree

On Saturday, July 16, 2016 9:50:21 PM CEST Scott Wood wrote:
> From: yangbo lu <yangbo.lu@nxp.com>
> 
> Move mpc85xx.h to include/linux/fsl and rename it to svr.h as a common
> header file.  This SVR numberspace is used on some ARM chips as well as
> PPC, and even to check for a PPC SVR multi-arch drivers would otherwise
> need to ifdef the header inclusion and all references to the SVR symbols.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> Acked-by: Wolfram Sang <wsa@the-dreams.de>
> Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> Acked-by: Joerg Roedel <jroedel@suse.de>
> [scottwood: update description]
> Signed-off-by: Scott Wood <oss@buserror.net>
> 

As discussed before, please don't introduce yet another vendor specific
way to match a SoC ID from a device driver.

I've posted a patch for an extension to the soc_device infrastructure
to allow comparing the running SoC to a table of devices, use that
instead.

	Arnd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
  2016-07-20 11:24   ` Arnd Bergmann
@ 2016-07-20 18:31     ` Scott Wood
  2016-07-20 20:35       ` Arnd Bergmann
  2016-07-21 10:26       ` Michael Ellerman
  0 siblings, 2 replies; 17+ messages in thread
From: Scott Wood @ 2016-07-20 18:31 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linuxppc-dev, Yangbo Lu, linux-mmc, linux-kernel, devicetree

On Wed, 2016-07-20 at 13:24 +0200, Arnd Bergmann wrote:
> On Saturday, July 16, 2016 9:50:21 PM CEST Scott Wood wrote:
> > 
> > From: yangbo lu <yangbo.lu@nxp.com>
> > 
> > Move mpc85xx.h to include/linux/fsl and rename it to svr.h as a common
> > header file.  This SVR numberspace is used on some ARM chips as well as
> > PPC, and even to check for a PPC SVR multi-arch drivers would otherwise
> > need to ifdef the header inclusion and all references to the SVR symbols.
> > 
> > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > Acked-by: Wolfram Sang <wsa@the-dreams.de>
> > Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> > Acked-by: Joerg Roedel <jroedel@suse.de>
> > [scottwood: update description]
> > Signed-off-by: Scott Wood <oss@buserror.net>
> > 
> As discussed before, please don't introduce yet another vendor specific
> way to match a SoC ID from a device driver.
> 
> I've posted a patch for an extension to the soc_device infrastructure
> to allow comparing the running SoC to a table of devices, use that
> instead.

As I asked before, in which relevant maintainership capacity are you NACKing
this?

-Scott

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
  2016-07-20 18:31     ` Scott Wood
@ 2016-07-20 20:35       ` Arnd Bergmann
  2016-07-21 10:26       ` Michael Ellerman
  1 sibling, 0 replies; 17+ messages in thread
From: Arnd Bergmann @ 2016-07-20 20:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood, linux-mmc, devicetree, linux-kernel, Yangbo Lu

On Wednesday, July 20, 2016 1:31:48 PM CEST Scott Wood wrote:
> On Wed, 2016-07-20 at 13:24 +0200, Arnd Bergmann wrote:
> > On Saturday, July 16, 2016 9:50:21 PM CEST Scott Wood wrote:
> > > 
> > > From: yangbo lu <yangbo.lu@nxp.com>
> > > 
> > > Move mpc85xx.h to include/linux/fsl and rename it to svr.h as a common
> > > header file.  This SVR numberspace is used on some ARM chips as well as
> > > PPC, and even to check for a PPC SVR multi-arch drivers would otherwise
> > > need to ifdef the header inclusion and all references to the SVR symbols.
> > > 
> > > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > > Acked-by: Wolfram Sang <wsa@the-dreams.de>
> > > Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> > > Acked-by: Joerg Roedel <jroedel@suse.de>
> > > [scottwood: update description]
> > > Signed-off-by: Scott Wood <oss@buserror.net>
> > > 
> > As discussed before, please don't introduce yet another vendor specific
> > way to match a SoC ID from a device driver.
> > 
> > I've posted a patch for an extension to the soc_device infrastructure
> > to allow comparing the running SoC to a table of devices, use that
> > instead.
> 
> As I asked before, in which relevant maintainership capacity are you NACKing
> this?

I don't know why that's important, but I suggested the creation of
drivers/soc/ as a place to have a more general place for platform
specific drivers as part of being maintainer for arm-soc, and
almost all changes to drivers/soc go through our tree.

Olof does about half the merges, but I do the majority of the reviews
for drivers/soc patches. See also

git log --graph --format="%an %s" --merges drivers/soc/ 

	Arnd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
  2016-07-20 18:31     ` Scott Wood
  2016-07-20 20:35       ` Arnd Bergmann
@ 2016-07-21 10:26       ` Michael Ellerman
  2016-07-21 16:45         ` Scott Wood
  1 sibling, 1 reply; 17+ messages in thread
From: Michael Ellerman @ 2016-07-21 10:26 UTC (permalink / raw)
  To: Scott Wood, Arnd Bergmann
  Cc: linux-mmc, devicetree, linuxppc-dev, linux-kernel, Yangbo Lu

Quoting Scott Wood (2016-07-21 04:31:48)
> On Wed, 2016-07-20 at 13:24 +0200, Arnd Bergmann wrote:
> > On Saturday, July 16, 2016 9:50:21 PM CEST Scott Wood wrote:
> > > 
> > > From: yangbo lu <yangbo.lu@nxp.com>
> > > 
> > > Move mpc85xx.h to include/linux/fsl and rename it to svr.h as a common
> > > header file.  This SVR numberspace is used on some ARM chips as well as
> > > PPC, and even to check for a PPC SVR multi-arch drivers would otherwise
> > > need to ifdef the header inclusion and all references to the SVR symbols.
> > > 
> > > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > > Acked-by: Wolfram Sang <wsa@the-dreams.de>
> > > Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> > > Acked-by: Joerg Roedel <jroedel@suse.de>
> > > [scottwood: update description]
> > > Signed-off-by: Scott Wood <oss@buserror.net>
> > > 
> > As discussed before, please don't introduce yet another vendor specific
> > way to match a SoC ID from a device driver.
> > 
> > I've posted a patch for an extension to the soc_device infrastructure
> > to allow comparing the running SoC to a table of devices, use that
> > instead.
> 
> As I asked before, in which relevant maintainership capacity are you NACKing
> this?

I'll nack the powerpc part until you guys can agree.

cheers

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
  2016-07-21 10:26       ` Michael Ellerman
@ 2016-07-21 16:45         ` Scott Wood
  2016-07-21 18:34           ` Arnd Bergmann
  2016-07-25  6:12           ` Yangbo Lu
  0 siblings, 2 replies; 17+ messages in thread
From: Scott Wood @ 2016-07-21 16:45 UTC (permalink / raw)
  To: Michael Ellerman, Arnd Bergmann
  Cc: linux-mmc, devicetree, linuxppc-dev, linux-kernel, Yangbo Lu

On Thu, 2016-07-21 at 20:26 +1000, Michael Ellerman wrote:
> Quoting Scott Wood (2016-07-21 04:31:48)
> > 
> > On Wed, 2016-07-20 at 13:24 +0200, Arnd Bergmann wrote:
> > > 
> > > On Saturday, July 16, 2016 9:50:21 PM CEST Scott Wood wrote:
> > > > 
> > > > 
> > > > From: yangbo lu <yangbo.lu@nxp.com>
> > > > 
> > > > Move mpc85xx.h to include/linux/fsl and rename it to svr.h as a common
> > > > header file.  This SVR numberspace is used on some ARM chips as well
> > > > as
> > > > PPC, and even to check for a PPC SVR multi-arch drivers would
> > > > otherwise
> > > > need to ifdef the header inclusion and all references to the SVR
> > > > symbols.
> > > > 
> > > > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > > > Acked-by: Wolfram Sang <wsa@the-dreams.de>
> > > > Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> > > > Acked-by: Joerg Roedel <jroedel@suse.de>
> > > > [scottwood: update description]
> > > > Signed-off-by: Scott Wood <oss@buserror.net>
> > > > 
> > > As discussed before, please don't introduce yet another vendor specific
> > > way to match a SoC ID from a device driver.
> > > 
> > > I've posted a patch for an extension to the soc_device infrastructure
> > > to allow comparing the running SoC to a table of devices, use that
> > > instead.
> > As I asked before, in which relevant maintainership capacity are you
> > NACKing
> > this?
> I'll nack the powerpc part until you guys can agree.

OK, I've pulled these patches out.

For the MMC issue I suggest using ifdef CONFIG_PPC and mfspr(SPRN_SVR) like
the clock driver does[1] and we can revisit the issue if/when we need to do
something similar on an ARM chip.

-Scott

[1] One of the issues with Arnd's approach is that it wouldn't have worked for
early things like the clock driver, and he didn't seem to mind using ifdef and
mfspr() there.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
  2016-07-21 16:45         ` Scott Wood
@ 2016-07-21 18:34           ` Arnd Bergmann
  2016-07-25  6:12           ` Yangbo Lu
  1 sibling, 0 replies; 17+ messages in thread
From: Arnd Bergmann @ 2016-07-21 18:34 UTC (permalink / raw)
  To: Scott Wood
  Cc: Michael Ellerman, linux-mmc, devicetree, linuxppc-dev,
	linux-kernel, Yangbo Lu

On Thursday, July 21, 2016 11:45:26 AM CEST Scott Wood wrote:
> 
> For the MMC issue I suggest using ifdef CONFIG_PPC and mfspr(SPRN_SVR) like
> the clock driver does[1] and we can revisit the issue if/when we need to do
> something similar on an ARM chip.

That sounds ok to me. having an mfspr check isn't nice but does the
job to work around existing bindings. For future chips, we can hopefully
find a way to identify most quirks early enough that the DT binding
can describe them using distinct compatible strings or other properties,
if necessary with the help of the boot loader.

Some other folks on MIPS were interested in having the soc_device
matching infrastructure and contacted me off-list, but they can of
course take the patch I sent and work from that.

	Arnd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
  2016-07-21 16:45         ` Scott Wood
  2016-07-21 18:34           ` Arnd Bergmann
@ 2016-07-25  6:12           ` Yangbo Lu
  2016-07-27  0:38             ` Scott Wood
  1 sibling, 1 reply; 17+ messages in thread
From: Yangbo Lu @ 2016-07-25  6:12 UTC (permalink / raw)
  To: Scott Wood, Michael Ellerman, Arnd Bergmann, Ulf Hansson
  Cc: linux-mmc, devicetree, linuxppc-dev, linux-kernel

Hi Scott,


> -----Original Message-----
> From: Scott Wood [mailto:oss@buserror.net]
> Sent: Friday, July 22, 2016 12:45 AM
> To: Michael Ellerman; Arnd Bergmann
> Cc: linux-mmc@vger.kernel.org; devicetree@vger.kernel.org; linuxppc-
> dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; Yangbo Lu
> Subject: Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to
> include/linux/fsl
> 
> On Thu, 2016-07-21 at 20:26 +1000, Michael Ellerman wrote:
> > Quoting Scott Wood (2016-07-21 04:31:48)
> > >
> > > On Wed, 2016-07-20 at 13:24 +0200, Arnd Bergmann wrote:
> > > >
> > > > On Saturday, July 16, 2016 9:50:21 PM CEST Scott Wood wrote:
> > > > >
> > > > >
> > > > > From: yangbo lu <yangbo.lu@nxp.com>
> > > > >
> > > > > Move mpc85xx.h to include/linux/fsl and rename it to svr.h as a
> > > > > common header file.  This SVR numberspace is used on some ARM
> > > > > chips as well as PPC, and even to check for a PPC SVR multi-arch
> > > > > drivers would otherwise need to ifdef the header inclusion and
> > > > > all references to the SVR symbols.
> > > > >
> > > > > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > > > > Acked-by: Wolfram Sang <wsa@the-dreams.de>
> > > > > Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> > > > > Acked-by: Joerg Roedel <jroedel@suse.de>
> > > > > [scottwood: update description]
> > > > > Signed-off-by: Scott Wood <oss@buserror.net>
> > > > >
> > > > As discussed before, please don't introduce yet another vendor
> > > > specific way to match a SoC ID from a device driver.
> > > >
> > > > I've posted a patch for an extension to the soc_device
> > > > infrastructure to allow comparing the running SoC to a table of
> > > > devices, use that instead.
> > > As I asked before, in which relevant maintainership capacity are you
> > > NACKing this?
> > I'll nack the powerpc part until you guys can agree.
> 
> OK, I've pulled these patches out.
> 
> For the MMC issue I suggest using ifdef CONFIG_PPC and mfspr(SPRN_SVR)
> like the clock driver does[1] and we can revisit the issue if/when we
> need to do something similar on an ARM chip.

[Lu Yangbo-B47093] I remembered that Uffe had opposed us to introduce non-generic header files(like '#include <asm/mpc85xx.h>')
in mmc driver initially. So I think it will not be accepted to use ifdef CONFIG_PPC and mfspr(SPRN_SVR)...
And this method still couldn’t get SVR of ARM chip now.

Any other suggestion here?
Thank you very much.

- Yangbo Lu

> 
> -Scott
> 
> [1] One of the issues with Arnd's approach is that it wouldn't have
> worked for early things like the clock driver, and he didn't seem to mind
> using ifdef and
> mfspr() there.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
  2016-07-25  6:12           ` Yangbo Lu
@ 2016-07-27  0:38             ` Scott Wood
  2016-08-02  5:57               ` Yangbo Lu
  0 siblings, 1 reply; 17+ messages in thread
From: Scott Wood @ 2016-07-27  0:38 UTC (permalink / raw)
  To: Yangbo Lu, Michael Ellerman, Arnd Bergmann, Ulf Hansson
  Cc: linux-mmc, devicetree, linuxppc-dev, linux-kernel

On Mon, 2016-07-25 at 06:12 +0000, Yangbo Lu wrote:
> Hi Scott,
> 
> 
> > 
> > -----Original Message-----
> > From: Scott Wood [mailto:oss@buserror.net]
> > Sent: Friday, July 22, 2016 12:45 AM
> > To: Michael Ellerman; Arnd Bergmann
> > Cc: linux-mmc@vger.kernel.org; devicetree@vger.kernel.org; linuxppc-
> > dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; Yangbo Lu
> > Subject: Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to
> > include/linux/fsl
> > 
> > On Thu, 2016-07-21 at 20:26 +1000, Michael Ellerman wrote:
> > > 
> > > Quoting Scott Wood (2016-07-21 04:31:48)
> > > > 
> > > > 
> > > > On Wed, 2016-07-20 at 13:24 +0200, Arnd Bergmann wrote:
> > > > > 
> > > > > 
> > > > > On Saturday, July 16, 2016 9:50:21 PM CEST Scott Wood wrote:
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > From: yangbo lu <yangbo.lu@nxp.com>
> > > > > > 
> > > > > > Move mpc85xx.h to include/linux/fsl and rename it to svr.h as a
> > > > > > common header file.  This SVR numberspace is used on some ARM
> > > > > > chips as well as PPC, and even to check for a PPC SVR multi-arch
> > > > > > drivers would otherwise need to ifdef the header inclusion and
> > > > > > all references to the SVR symbols.
> > > > > > 
> > > > > > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > > > > > Acked-by: Wolfram Sang <wsa@the-dreams.de>
> > > > > > Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> > > > > > Acked-by: Joerg Roedel <jroedel@suse.de>
> > > > > > [scottwood: update description]
> > > > > > Signed-off-by: Scott Wood <oss@buserror.net>
> > > > > > 
> > > > > As discussed before, please don't introduce yet another vendor
> > > > > specific way to match a SoC ID from a device driver.
> > > > > 
> > > > > I've posted a patch for an extension to the soc_device
> > > > > infrastructure to allow comparing the running SoC to a table of
> > > > > devices, use that instead.
> > > > As I asked before, in which relevant maintainership capacity are you
> > > > NACKing this?
> > > I'll nack the powerpc part until you guys can agree.
> > OK, I've pulled these patches out.
> > 
> > For the MMC issue I suggest using ifdef CONFIG_PPC and mfspr(SPRN_SVR)
> > like the clock driver does[1] and we can revisit the issue if/when we
> > need to do something similar on an ARM chip.
> [Lu Yangbo-B47093] I remembered that Uffe had opposed us to introduce non-
> generic header files(like '#include <asm/mpc85xx.h>')
> in mmc driver initially. So I think it will not be accepted to use ifdef
> CONFIG_PPC and mfspr(SPRN_SVR)...
> And this method still couldn’t get SVR of ARM chip now.

Right, as I said we'll have to revisit the issue if/when we have the same
problem on an ARM chip.  That also applies if the PPC ifdef is still getting
NACKed from the MMC side.

> Any other suggestion here?

The other option is to try to come up with something that fits into Arnd's
framework while addressing the concerns I raised.  The soc_id string should be
well-structured to avoid mismatches and compatibility problems (especially
since it would get exposed to userspace).  Maybe something like:

svr:<SVR minus E bit>,svre:<full SVR including E bit>,name:<soc name>,die:<soc
die name>,rev:X.Y,<tag1>,<tag2>,<...>,

with the final comma used so that globs can put a colon on either end to be
sure they're matching a full field.  The SoC die name would be the primary
chip for a given die (e.g. p4040 would have a die name of p4080).  The "name"
and "die" fields would never include the trailing "e" indicated by the E bit.

Extra tags could be used for common groupings, such as all chips from a
particular die before a certain revision.  Once a tag is added it can't be
removed or reordered, to maintain userspace compatibility, but new tags could
be appended.

Some examples:

svr:0x82000020,svre:0x82000020,name:p4080,die:p4080,rev:2.0,
svr:0x82000020,svr
e:0x82080020,name:p4080,die:p4080,rev:2.0,
svr:0x82000030,svre:0x82000030,name:
p4080,die:p4080,rev:3.0,
svr:0x82000030,svre:0x82080030,name:p4080,die:p4080,re
v:3.0,
svr:0x82010020,svre:0x82010020,name:p4040,die:p4080,rev:2.0,
svr:0x820100
20,svre:0x82090020,name:p4040,die:p4080,rev:2.0,

svr:0x82010030,svre:0x82010030
,name:p4040,die:p4080,rev:3.0,
svr:0x82010030,svre:0x82090030,name:p4040,die:p4
080,rev:3.0,

Then if you want to apply a workaround on:
- all chips using the p4080 die, match with "*,die:p4080,*"
- all chips using the rev 2.0 p4080 die, match with "*,die:p4080,rev:2.0,*"
- Only p4040, but of any rev, match with "*,name:p4040,*"

Matching via open-coded hex number should be considered a last resort (it's
more error-prone, either for getting the number wrong or for forgetting
variants -- the latter is already a common problem), but preferable to adding
too many tags.

Using wildcards within a tag field would be discouraged.  

-Scott

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
  2016-07-27  0:38             ` Scott Wood
@ 2016-08-02  5:57               ` Yangbo Lu
  2016-08-02 21:40                 ` Scott Wood
  0 siblings, 1 reply; 17+ messages in thread
From: Yangbo Lu @ 2016-08-02  5:57 UTC (permalink / raw)
  To: Scott Wood, Michael Ellerman, Arnd Bergmann, Ulf Hansson
  Cc: linux-mmc, devicetree, linuxppc-dev, linux-kernel, Xiaobo Xie

Hi Scott,

> -----Original Message-----
> From: Scott Wood [mailto:oss@buserror.net]
> Sent: Wednesday, July 27, 2016 8:38 AM
> To: Yangbo Lu; Michael Ellerman; Arnd Bergmann; Ulf Hansson
> Cc: linux-mmc@vger.kernel.org; devicetree@vger.kernel.org; linuxppc-
> dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to
> include/linux/fsl
> 
> On Mon, 2016-07-25 at 06:12 +0000, Yangbo Lu wrote:
> > Hi Scott,
> >
> >
> > >
> > > -----Original Message-----
> > > From: Scott Wood [mailto:oss@buserror.net]
> > > Sent: Friday, July 22, 2016 12:45 AM
> > > To: Michael Ellerman; Arnd Bergmann
> > > Cc: linux-mmc@vger.kernel.org; devicetree@vger.kernel.org; linuxppc-
> > > dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; Yangbo Lu
> > > Subject: Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to
> > > include/linux/fsl
> > >
> > > On Thu, 2016-07-21 at 20:26 +1000, Michael Ellerman wrote:
> > > >
> > > > Quoting Scott Wood (2016-07-21 04:31:48)
> > > > >
> > > > >
> > > > > On Wed, 2016-07-20 at 13:24 +0200, Arnd Bergmann wrote:
> > > > > >
> > > > > >
> > > > > > On Saturday, July 16, 2016 9:50:21 PM CEST Scott Wood wrote:
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > From: yangbo lu <yangbo.lu@nxp.com>
> > > > > > >
> > > > > > > Move mpc85xx.h to include/linux/fsl and rename it to svr.h
> > > > > > > as a common header file.  This SVR numberspace is used on
> > > > > > > some ARM chips as well as PPC, and even to check for a PPC
> > > > > > > SVR multi-arch drivers would otherwise need to ifdef the
> > > > > > > header inclusion and all references to the SVR symbols.
> > > > > > >
> > > > > > > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > > > > > > Acked-by: Wolfram Sang <wsa@the-dreams.de>
> > > > > > > Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> > > > > > > Acked-by: Joerg Roedel <jroedel@suse.de>
> > > > > > > [scottwood: update description]
> > > > > > > Signed-off-by: Scott Wood <oss@buserror.net>
> > > > > > >
> > > > > > As discussed before, please don't introduce yet another vendor
> > > > > > specific way to match a SoC ID from a device driver.
> > > > > >
> > > > > > I've posted a patch for an extension to the soc_device
> > > > > > infrastructure to allow comparing the running SoC to a table
> > > > > > of devices, use that instead.
> > > > > As I asked before, in which relevant maintainership capacity are
> > > > > you NACKing this?
> > > > I'll nack the powerpc part until you guys can agree.
> > > OK, I've pulled these patches out.
> > >
> > > For the MMC issue I suggest using ifdef CONFIG_PPC and
> > > mfspr(SPRN_SVR) like the clock driver does[1] and we can revisit the
> > > issue if/when we need to do something similar on an ARM chip.
> > [Lu Yangbo-B47093] I remembered that Uffe had opposed us to introduce
> > non- generic header files(like '#include <asm/mpc85xx.h>') in mmc
> > driver initially. So I think it will not be accepted to use ifdef
> > CONFIG_PPC and mfspr(SPRN_SVR)...
> > And this method still couldn’t get SVR of ARM chip now.
> 
> Right, as I said we'll have to revisit the issue if/when we have the same
> problem on an ARM chip.  That also applies if the PPC ifdef is still
> getting NACKed from the MMC side.

[Lu Yangbo-B47093] It's not clear for me about your idea :( 
Do you mean we can still use this method, or not ?
I think Uffe had opposed to use ifdef CONFIG_PPC and mfspr(SPRN_SVR).
Is there any solution to resolve ?
:)

> 
> > Any other suggestion here?
> 
> The other option is to try to come up with something that fits into
> Arnd's framework while addressing the concerns I raised.  The soc_id
> string should be well-structured to avoid mismatches and compatibility
> problems (especially since it would get exposed to userspace).  Maybe
> something like:
> 
> svr:<SVR minus E bit>,svre:<full SVR including E bit>,name:<soc
> name>,die:<soc die name>,rev:X.Y,<tag1>,<tag2>,<...>,

[Lu Yangbo-B47093] The soc_device_attribut struct is defined as below.
struct soc_device_attribute {
        const char *machine;
        const char *family;
        const char *revision;
        const char *soc_id;
};

We can put the 'model' in root node of dts as machine, put 'Freescale QorIQ' as family,
and put x.x as revision. Is it ok?
As you suggested, you like to use below string as soc_id. It's easy to get svr, but how does the software know the name and die,
and put them into this string ? It's a large code to define them. 
> svr:<SVR minus E bit>,svre:<full SVR including E bit>,name:<soc
> name>,die:<soc die name>,rev:X.Y,<tag1>,<tag2>,<...>,
Should we remove rev here since there is also a revision member?

Regarding the guts_init, we still call guts_init and then match the soc, or we change to use platform driver?
Or do you know any better place to call guts_init to initialize only once?

Thank you so much :)

> 
> with the final comma used so that globs can put a colon on either end to
> be sure they're matching a full field.  The SoC die name would be the
> primary chip for a given die (e.g. p4040 would have a die name of
> p4080).  The "name"
> and "die" fields would never include the trailing "e" indicated by the E
> bit.
> 
> Extra tags could be used for common groupings, such as all chips from a
> particular die before a certain revision.  Once a tag is added it can't
> be removed or reordered, to maintain userspace compatibility, but new
> tags could be appended.
> 
> Some examples:
> 
> svr:0x82000020,svre:0x82000020,name:p4080,die:p4080,rev:2.0,
> svr:0x82000020,svr
> e:0x82080020,name:p4080,die:p4080,rev:2.0,
> svr:0x82000030,svre:0x82000030,name:
> p4080,die:p4080,rev:3.0,
> svr:0x82000030,svre:0x82080030,name:p4080,die:p4080,re
> v:3.0,
> svr:0x82010020,svre:0x82010020,name:p4040,die:p4080,rev:2.0,
> svr:0x820100
> 20,svre:0x82090020,name:p4040,die:p4080,rev:2.0,
> 
> svr:0x82010030,svre:0x82010030
> ,name:p4040,die:p4080,rev:3.0,
> svr:0x82010030,svre:0x82090030,name:p4040,die:p4
> 080,rev:3.0,
> 
> Then if you want to apply a workaround on:
> - all chips using the p4080 die, match with "*,die:p4080,*"
> - all chips using the rev 2.0 p4080 die, match with
> "*,die:p4080,rev:2.0,*"
> - Only p4040, but of any rev, match with "*,name:p4040,*"
> 
> Matching via open-coded hex number should be considered a last resort
> (it's more error-prone, either for getting the number wrong or for
> forgetting variants -- the latter is already a common problem), but
> preferable to adding too many tags.
> 
> Using wildcards within a tag field would be discouraged.
> 
> -Scott

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
  2016-08-02  5:57               ` Yangbo Lu
@ 2016-08-02 21:40                 ` Scott Wood
  2016-08-03  3:33                   ` Yangbo Lu
  0 siblings, 1 reply; 17+ messages in thread
From: Scott Wood @ 2016-08-02 21:40 UTC (permalink / raw)
  To: Yangbo Lu, Michael Ellerman, Arnd Bergmann, Ulf Hansson
  Cc: linux-mmc, devicetree, linuxppc-dev, linux-kernel, Xiaobo Xie

On Tue, 2016-08-02 at 05:57 +0000, Yangbo Lu wrote:
> Hi Scott,
> 
> > 
> > -----Original Message-----
> > From: Scott Wood [mailto:oss@buserror.net]
> > Sent: Wednesday, July 27, 2016 8:38 AM
> > To: Yangbo Lu; Michael Ellerman; Arnd Bergmann; Ulf Hansson
> > Cc: linux-mmc@vger.kernel.org; devicetree@vger.kernel.org; linuxppc-
> > dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to
> > include/linux/fsl
> > 
> > On Mon, 2016-07-25 at 06:12 +0000, Yangbo Lu wrote:
> > > 
> > > Hi Scott,
> > > 
> > > 
> > > > 
> > > > 
> > > > -----Original Message-----
> > > > From: Scott Wood [mailto:oss@buserror.net]
> > > > Sent: Friday, July 22, 2016 12:45 AM
> > > > To: Michael Ellerman; Arnd Bergmann
> > > > Cc: linux-mmc@vger.kernel.org; devicetree@vger.kernel.org; linuxppc-
> > > > dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; Yangbo Lu
> > > > Subject: Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to
> > > > include/linux/fsl
> > > > 
> > > > On Thu, 2016-07-21 at 20:26 +1000, Michael Ellerman wrote:
> > > > > 
> > > > > 
> > > > > Quoting Scott Wood (2016-07-21 04:31:48)
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > On Wed, 2016-07-20 at 13:24 +0200, Arnd Bergmann wrote:
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > On Saturday, July 16, 2016 9:50:21 PM CEST Scott Wood wrote:
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > From: yangbo lu <yangbo.lu@nxp.com>
> > > > > > > > 
> > > > > > > > Move mpc85xx.h to include/linux/fsl and rename it to svr.h
> > > > > > > > as a common header file.  This SVR numberspace is used on
> > > > > > > > some ARM chips as well as PPC, and even to check for a PPC
> > > > > > > > SVR multi-arch drivers would otherwise need to ifdef the
> > > > > > > > header inclusion and all references to the SVR symbols.
> > > > > > > > 
> > > > > > > > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > > > > > > > Acked-by: Wolfram Sang <wsa@the-dreams.de>
> > > > > > > > Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> > > > > > > > Acked-by: Joerg Roedel <jroedel@suse.de>
> > > > > > > > [scottwood: update description]
> > > > > > > > Signed-off-by: Scott Wood <oss@buserror.net>
> > > > > > > > 
> > > > > > > As discussed before, please don't introduce yet another vendor
> > > > > > > specific way to match a SoC ID from a device driver.
> > > > > > > 
> > > > > > > I've posted a patch for an extension to the soc_device
> > > > > > > infrastructure to allow comparing the running SoC to a table
> > > > > > > of devices, use that instead.
> > > > > > As I asked before, in which relevant maintainership capacity are
> > > > > > you NACKing this?
> > > > > I'll nack the powerpc part until you guys can agree.
> > > > OK, I've pulled these patches out.
> > > > 
> > > > For the MMC issue I suggest using ifdef CONFIG_PPC and
> > > > mfspr(SPRN_SVR) like the clock driver does[1] and we can revisit the
> > > > issue if/when we need to do something similar on an ARM chip.
> > > [Lu Yangbo-B47093] I remembered that Uffe had opposed us to introduce
> > > non- generic header files(like '#include <asm/mpc85xx.h>') in mmc
> > > driver initially. So I think it will not be accepted to use ifdef
> > > CONFIG_PPC and mfspr(SPRN_SVR)...
> > > And this method still couldn’t get SVR of ARM chip now.
> > Right, as I said we'll have to revisit the issue if/when we have the same
> > problem on an ARM chip.  That also applies if the PPC ifdef is still
> > getting NACKed from the MMC side.
> [Lu Yangbo-B47093] It's not clear for me about your idea :( 
> Do you mean we can still use this method, or not ?
> I think Uffe had opposed to use ifdef CONFIG_PPC and mfspr(SPRN_SVR).
> Is there any solution to resolve ?
> :)

As I said, I'm OK with using the SPR.  It's up to you to find out whether it's
still unacceptable with the MMC maintainers given all the discussion (it would
be the quickest way to get the workaround enabled), or just go with the method
below.

> > > Any other suggestion here?
> > The other option is to try to come up with something that fits into
> > Arnd's framework while addressing the concerns I raised.  The soc_id
> > string should be well-structured to avoid mismatches and compatibility
> > problems (especially since it would get exposed to userspace).  Maybe
> > something like:
> > 
> > svr:<SVR minus E bit>,svre:<full SVR including E bit>,name:<soc
> > name>,die:<soc die name>,rev:X.Y,<tag1>,<tag2>,<...>,
> [Lu Yangbo-B47093] The soc_device_attribut struct is defined as below.
> struct soc_device_attribute {
>         const char *machine;
>         const char *family;
>         const char *revision;
>         const char *soc_id;
> };
> 
> We can put the 'model' in root node of dts as machine, put 'Freescale QorIQ'
> as family,

I'd just put "QorIQ" to avoid the question of whether to use "Freescale" or
"NXP".

> and put x.x as revision. Is it ok?
> As you suggested, you like to use below string as soc_id. It's easy to get
> svr, but how does the software know the name and die,
> and put them into this string ? It's a large code to define them. 

Yes, there would need to be a table in the guts driver for each SVR.  If the
SVR isn't found in the table then the soc_id would only contain the svr: and
svre: fields.

> > 
> > svr:<SVR minus E bit>,svre:<full SVR including E bit>,name:<soc
> > name>,die:<soc die name>,rev:X.Y,<tag1>,<tag2>,<...>,
> Should we remove rev here since there is also a revision member?

Yes, I forgot there was a revision field -- it should go there obviously.

> Regarding the guts_init, we still call guts_init and then match the soc, or
> we change to use platform driver?
> Or do you know any better place to call guts_init to initialize only once?

Use a platform driver for now.  If we ever need to check an ARM SVR in the
clock driver or similar place, then Arnd can explain what he wants us to do
then :-)

-Scott

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
  2016-08-02 21:40                 ` Scott Wood
@ 2016-08-03  3:33                   ` Yangbo Lu
  0 siblings, 0 replies; 17+ messages in thread
From: Yangbo Lu @ 2016-08-03  3:33 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, devicetree, linuxppc-dev, linux-kernel, Xiaobo Xie,
	Scott Wood, Michael Ellerman, Arnd Bergmann

Hi Uffe,


> -----Original Message-----
> From: Scott Wood [mailto:oss@buserror.net]
> Sent: Wednesday, August 03, 2016 5:41 AM
> To: Yangbo Lu; Michael Ellerman; Arnd Bergmann; Ulf Hansson
> Cc: linux-mmc@vger.kernel.org; devicetree@vger.kernel.org; linuxppc-
> dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; Xiaobo Xie
> Subject: Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to
> include/linux/fsl
> 
> On Tue, 2016-08-02 at 05:57 +0000, Yangbo Lu wrote:
> > Hi Scott,
> >
> > >
> > > -----Original Message-----
> > > From: Scott Wood [mailto:oss@buserror.net]
> > > Sent: Wednesday, July 27, 2016 8:38 AM
> > > To: Yangbo Lu; Michael Ellerman; Arnd Bergmann; Ulf Hansson
> > > Cc: linux-mmc@vger.kernel.org; devicetree@vger.kernel.org; linuxppc-
> > > dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
> > > Subject: Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to
> > > include/linux/fsl
> > >
> > > On Mon, 2016-07-25 at 06:12 +0000, Yangbo Lu wrote:
> > > >
> > > > Hi Scott,
> > > >
> > > >
> > > > >
> > > > >
> > > > > -----Original Message-----
> > > > > From: Scott Wood [mailto:oss@buserror.net]
> > > > > Sent: Friday, July 22, 2016 12:45 AM
> > > > > To: Michael Ellerman; Arnd Bergmann
> > > > > Cc: linux-mmc@vger.kernel.org; devicetree@vger.kernel.org;
> > > > > linuxppc- dev@lists.ozlabs.org; linux-kernel@vger.kernel.org;
> > > > > Yangbo Lu
> > > > > Subject: Re: [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to
> > > > > include/linux/fsl
> > > > >
> > > > > On Thu, 2016-07-21 at 20:26 +1000, Michael Ellerman wrote:
> > > > > >
> > > > > >
> > > > > > Quoting Scott Wood (2016-07-21 04:31:48)
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Wed, 2016-07-20 at 13:24 +0200, Arnd Bergmann wrote:
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On Saturday, July 16, 2016 9:50:21 PM CEST Scott Wood wrote:
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > From: yangbo lu <yangbo.lu@nxp.com>
> > > > > > > > >
> > > > > > > > > Move mpc85xx.h to include/linux/fsl and rename it to
> > > > > > > > > svr.h as a common header file.  This SVR numberspace is
> > > > > > > > > used on some ARM chips as well as PPC, and even to check
> > > > > > > > > for a PPC SVR multi-arch drivers would otherwise need to
> > > > > > > > > ifdef the header inclusion and all references to the SVR
> symbols.
> > > > > > > > >
> > > > > > > > > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > > > > > > > > Acked-by: Wolfram Sang <wsa@the-dreams.de>
> > > > > > > > > Acked-by: Stephen Boyd <sboyd@codeaurora.org>
> > > > > > > > > Acked-by: Joerg Roedel <jroedel@suse.de>
> > > > > > > > > [scottwood: update description]
> > > > > > > > > Signed-off-by: Scott Wood <oss@buserror.net>
> > > > > > > > >
> > > > > > > > As discussed before, please don't introduce yet another
> > > > > > > > vendor specific way to match a SoC ID from a device driver.
> > > > > > > >
> > > > > > > > I've posted a patch for an extension to the soc_device
> > > > > > > > infrastructure to allow comparing the running SoC to a
> > > > > > > > table of devices, use that instead.
> > > > > > > As I asked before, in which relevant maintainership capacity
> > > > > > > are you NACKing this?
> > > > > > I'll nack the powerpc part until you guys can agree.
> > > > > OK, I've pulled these patches out.
> > > > >
> > > > > For the MMC issue I suggest using ifdef CONFIG_PPC and
> > > > > mfspr(SPRN_SVR) like the clock driver does[1] and we can revisit
> > > > > the issue if/when we need to do something similar on an ARM chip.
> > > > [Lu Yangbo-B47093] I remembered that Uffe had opposed us to
> > > > introduce
> > > > non- generic header files(like '#include <asm/mpc85xx.h>') in mmc
> > > > driver initially. So I think it will not be accepted to use ifdef
> > > > CONFIG_PPC and mfspr(SPRN_SVR)...
> > > > And this method still couldn’t get SVR of ARM chip now.
> > > Right, as I said we'll have to revisit the issue if/when we have the
> > > same problem on an ARM chip.  That also applies if the PPC ifdef is
> > > still getting NACKed from the MMC side.
> > [Lu Yangbo-B47093] It's not clear for me about your idea :( Do you
> > mean we can still use this method, or not ?
> > I think Uffe had opposed to use ifdef CONFIG_PPC and mfspr(SPRN_SVR).
> > Is there any solution to resolve ?
> > :)
> 
> As I said, I'm OK with using the SPR.  It's up to you to find out whether
> it's still unacceptable with the MMC maintainers given all the discussion
> (it would be the quickest way to get the workaround enabled), or just go
> with the method below.

[Lu Yangbo-B47093] As you know, this patchset(as below) has been discussed for more than one year.
What I want is just to add a fix for an specific soc revision.

Yangbo Lu (7):
  Documentation: DT: update Freescale DCFG compatible
  ARM64: dts: ls2080a: add device configuration node
  soc: fsl: add GUTS driver for QorIQ platforms
  dt: move guts devicetree doc out of powerpc directory
  powerpc/fsl: move mpc85xx.h to include/linux/fsl
  MAINTAINERS: add entry for Freescale SoC drivers
  mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0

But we have to abandon it since Arnd strongly disagree our guts driver method to get soc revision.
Now I have to ask you to reconsider the original method to get soc revison since we really have no better idea.
As Scott suggested above, use ifdef CONFIG_PPC and mfspr(SPRN_SVR) like the clock driver does to get SVR.
It's quickest way to resolve our esdhc issue. Could you reconsider to use this?

Although Arnd provided another new method by sending a proof-of-concept patch as below, there were still many controversial points.
I'm worried that would be discussed for a quite long time like the guts driver.
[PATCH 1/4]  base: soc: introduce soc_device_match() interface
[PATCH 2/4] soc: fsl: add GUTS driver for QorIQ platforms
[PATCH 3/4] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
[PATCH 4/4] Revert "powerpc/fsl: Move fsl_guts.h out of arch/powerpc"

Anyway, what I want is just to fix the esdhc issue ASAP. 
Uffe, Could you reconsider whether you could accept the way using ifdef CONFIG_PPC and mfspr(SPRN_SVR)?
Or do you have any suggestion.

I will appreciate your suggestion.
Thanks a lot.

- Yangbo
> 
> > > > Any other suggestion here?
> > > The other option is to try to come up with something that fits into
> > > Arnd's framework while addressing the concerns I raised.  The soc_id
> > > string should be well-structured to avoid mismatches and
> > > compatibility problems (especially since it would get exposed to
> > > userspace).  Maybe something like:
> > >
> > > svr:<SVR minus E bit>,svre:<full SVR including E bit>,name:<soc
> > > name>,die:<soc die name>,rev:X.Y,<tag1>,<tag2>,<...>,
> > [Lu Yangbo-B47093] The soc_device_attribut struct is defined as below.
> > struct soc_device_attribute {
> >         const char *machine;
> >         const char *family;
> >         const char *revision;
> >         const char *soc_id;
> > };
> >
> > We can put the 'model' in root node of dts as machine, put 'Freescale
> QorIQ'
> > as family,
> 
> I'd just put "QorIQ" to avoid the question of whether to use "Freescale"
> or "NXP".
> 
> > and put x.x as revision. Is it ok?
> > As you suggested, you like to use below string as soc_id. It's easy to
> > get svr, but how does the software know the name and die, and put them
> > into this string ? It's a large code to define them.
> 
> Yes, there would need to be a table in the guts driver for each SVR.  If
> the SVR isn't found in the table then the soc_id would only contain the
> svr: and
> svre: fields.
> 
> > >
> > > svr:<SVR minus E bit>,svre:<full SVR including E bit>,name:<soc
> > > name>,die:<soc die name>,rev:X.Y,<tag1>,<tag2>,<...>,
> > Should we remove rev here since there is also a revision member?
> 
> Yes, I forgot there was a revision field -- it should go there obviously.
> 
> > Regarding the guts_init, we still call guts_init and then match the
> > soc, or we change to use platform driver?
> > Or do you know any better place to call guts_init to initialize only
> once?
> 
> Use a platform driver for now.  If we ever need to check an ARM SVR in
> the clock driver or similar place, then Arnd can explain what he wants us
> to do then :-)
> 
> -Scott

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-08-03  3:34 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-17  2:50 [PATCH v11 0/5] soc: fsl: Add initial guts driver Scott Wood
2016-07-17  2:50 ` [PATCH v11 1/5] dt: bindings: update Freescale DCFG compatible Scott Wood
2016-07-17  2:50 ` [PATCH v11 2/5] dt: bindings: move guts devicetree doc out of powerpc directory Scott Wood
2016-07-17  2:50 ` [PATCH v11 3/5] soc: fsl: add GUTS driver for QorIQ platforms Scott Wood
2016-07-17  2:50 ` [PATCH v11 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl Scott Wood
2016-07-20 11:24   ` Arnd Bergmann
2016-07-20 18:31     ` Scott Wood
2016-07-20 20:35       ` Arnd Bergmann
2016-07-21 10:26       ` Michael Ellerman
2016-07-21 16:45         ` Scott Wood
2016-07-21 18:34           ` Arnd Bergmann
2016-07-25  6:12           ` Yangbo Lu
2016-07-27  0:38             ` Scott Wood
2016-08-02  5:57               ` Yangbo Lu
2016-08-02 21:40                 ` Scott Wood
2016-08-03  3:33                   ` Yangbo Lu
2016-07-17  2:50 ` [PATCH v11 5/5] powerpc/fsl-pci: Use fsl_guts_get_svr() Scott Wood

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).