* [PATCH 1/3] ARM: at91: use chipid device for soc detection
@ 2016-03-18 7:21 Ludovic Desroches
[not found] ` <1458285681-25684-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2016-03-29 13:55 ` Arnd Bergmann
0 siblings, 2 replies; 14+ messages in thread
From: Ludovic Desroches @ 2016-03-18 7:21 UTC (permalink / raw)
To: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
Cc: plagnioj-sclMFOaUSTBWk0Htik3J/w,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ludovic Desroches
So far, the CIDR and EXID registers were in the DBGU interface. This device
has disappeared with the SAMA5D2 family. These registers are exposed
through a new device called chipid.
Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
[nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org: remove useless warnings]
---
.../devicetree/bindings/arm/atmel-at91.txt | 4 ++
arch/arm/mach-at91/soc.c | 81 +++++++++++++++++-----
2 files changed, 67 insertions(+), 18 deletions(-)
diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
index 7fd64ec..0b1fcbf 100644
--- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
@@ -41,6 +41,10 @@ compatible: must be one of:
- "atmel,sama5d43"
- "atmel,sama5d44"
+Chipid required properties:
+- compatible: Should be "atmel,sama5d2-chipid"
+- reg : Should contain registers location and length
+
PIT Timer required properties:
- compatible: Should be "atmel,at91sam9260-pit"
- reg: Should contain registers location and length
diff --git a/arch/arm/mach-at91/soc.c b/arch/arm/mach-at91/soc.c
index 54343ff..034d563 100644
--- a/arch/arm/mach-at91/soc.c
+++ b/arch/arm/mach-at91/soc.c
@@ -22,48 +22,93 @@
#include "soc.h"
#define AT91_DBGU_CIDR 0x40
-#define AT91_DBGU_CIDR_VERSION(x) ((x) & 0x1f)
-#define AT91_DBGU_CIDR_EXT BIT(31)
-#define AT91_DBGU_CIDR_MATCH_MASK 0x7fffffe0
#define AT91_DBGU_EXID 0x44
+#define AT91_CHIPID_CIDR 0x00
+#define AT91_CHIPID_EXID 0x04
+#define AT91_CIDR_VERSION(x) ((x) & 0x1f)
+#define AT91_CIDR_EXT BIT(31)
+#define AT91_CIDR_MATCH_MASK 0x7fffffe0
-struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
+int __init at91_get_cidr_exid_from_dbgu(u32 *cidr, u32 *exid)
{
- struct soc_device_attribute *soc_dev_attr;
- const struct at91_soc *soc;
- struct soc_device *soc_dev;
struct device_node *np;
void __iomem *regs;
- u32 cidr, exid;
np = of_find_compatible_node(NULL, NULL, "atmel,at91rm9200-dbgu");
if (!np)
np = of_find_compatible_node(NULL, NULL,
"atmel,at91sam9260-dbgu");
+ if (!np)
+ return -ENODEV;
- if (!np) {
- pr_warn("Could not find DBGU node");
- return NULL;
+ regs = of_iomap(np, 0);
+ of_node_put(np);
+
+ if (!regs) {
+ pr_warn("Could not map DBGU iomem range");
+ return -ENXIO;
}
+ *cidr = readl(regs + AT91_DBGU_CIDR);
+ *exid = readl(regs + AT91_DBGU_EXID);
+
+ iounmap(regs);
+
+ return 0;
+}
+
+int __init at91_get_cidr_exid_from_chipid(u32 *cidr, u32 *exid)
+{
+ struct device_node *np;
+ void __iomem *regs;
+
+ np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-chipid");
+ if (!np)
+ return -ENODEV;
+
regs = of_iomap(np, 0);
of_node_put(np);
if (!regs) {
pr_warn("Could not map DBGU iomem range");
- return NULL;
+ return -ENXIO;
}
- cidr = readl(regs + AT91_DBGU_CIDR);
- exid = readl(regs + AT91_DBGU_EXID);
+ *cidr = readl(regs + AT91_CHIPID_CIDR);
+ *exid = readl(regs + AT91_CHIPID_EXID);
iounmap(regs);
+ return 0;
+}
+
+struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
+{
+ struct soc_device_attribute *soc_dev_attr;
+ const struct at91_soc *soc;
+ struct soc_device *soc_dev;
+ u32 cidr, exid;
+ int ret;
+
+ /*
+ * With SAMA5D2 and later SoCs, CIDR and EXID registers are no more
+ * in the dbgu device but in the chipid device whose purpose is only
+ * to expose these two registers.
+ */
+ ret = at91_get_cidr_exid_from_dbgu(&cidr, &exid);
+ if (ret)
+ ret = at91_get_cidr_exid_from_chipid(&cidr, &exid);
+ if (ret) {
+ if (ret == -ENODEV)
+ pr_warn("Could not find identification node");
+ return NULL;
+ }
+
for (soc = socs; soc->name; soc++) {
- if (soc->cidr_match != (cidr & AT91_DBGU_CIDR_MATCH_MASK))
+ if (soc->cidr_match != (cidr & AT91_CIDR_MATCH_MASK))
continue;
- if (!(cidr & AT91_DBGU_CIDR_EXT) || soc->exid_match == exid)
+ if (!(cidr & AT91_CIDR_EXT) || soc->exid_match == exid)
break;
}
@@ -79,7 +124,7 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
soc_dev_attr->family = soc->family;
soc_dev_attr->soc_id = soc->name;
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%X",
- AT91_DBGU_CIDR_VERSION(cidr));
+ AT91_CIDR_VERSION(cidr));
soc_dev = soc_device_register(soc_dev_attr);
if (IS_ERR(soc_dev)) {
kfree(soc_dev_attr->revision);
@@ -91,7 +136,7 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
if (soc->family)
pr_info("Detected SoC family: %s\n", soc->family);
pr_info("Detected SoC: %s, revision %X\n", soc->name,
- AT91_DBGU_CIDR_VERSION(cidr));
+ AT91_CIDR_VERSION(cidr));
return soc_dev;
}
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/3] ARM: at91/soc: reference the whole sama5d2 family
[not found] ` <1458285681-25684-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
@ 2016-03-18 7:21 ` Ludovic Desroches
[not found] ` <1458285681-25684-2-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2016-03-18 7:21 ` [PATCH 3/3] ARM: at91/dt: sama5d2: add chipid node Ludovic Desroches
` (2 subsequent siblings)
3 siblings, 1 reply; 14+ messages in thread
From: Ludovic Desroches @ 2016-03-18 7:21 UTC (permalink / raw)
To: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
Cc: plagnioj-sclMFOaUSTBWk0Htik3J/w,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ludovic Desroches
Add EXID of all SoCs of the SAMA5D2 family.
Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
arch/arm/mach-at91/sama5.c | 20 +++++++++++++++++++-
arch/arm/mach-at91/soc.h | 12 +++++++++++-
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c
index df8fdf1..922b85f 100644
--- a/arch/arm/mach-at91/sama5.c
+++ b/arch/arm/mach-at91/sama5.c
@@ -18,8 +18,26 @@
#include "soc.h"
static const struct at91_soc sama5_socs[] = {
- AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27_EXID_MATCH,
+ AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D21CU_EXID_MATCH,
+ "sama5d21", "sama5d2"),
+ AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D22CU_EXID_MATCH,
+ "sama5d22", "sama5d2"),
+ AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D23CU_EXID_MATCH,
+ "sama5d23", "sama5d2"),
+ AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D24CX_EXID_MATCH,
+ "sama5d24", "sama5d2"),
+ AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D24CU_EXID_MATCH,
+ "sama5d24", "sama5d2"),
+ AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D26CU_EXID_MATCH,
+ "sama5d26", "sama5d2"),
+ AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27CU_EXID_MATCH,
"sama5d27", "sama5d2"),
+ AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27CN_EXID_MATCH,
+ "sama5d27", "sama5d2"),
+ AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D28CU_EXID_MATCH,
+ "sama5d28", "sama5d2"),
+ AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D28CN_EXID_MATCH,
+ "sama5d28", "sama5d2"),
AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D31_EXID_MATCH,
"sama5d31", "sama5d3"),
AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D33_EXID_MATCH,
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
index 8ede0ef..228efde 100644
--- a/arch/arm/mach-at91/soc.h
+++ b/arch/arm/mach-at91/soc.h
@@ -63,7 +63,17 @@ at91_soc_init(const struct at91_soc *socs);
#define AT91SAM9XE512_CIDR_MATCH 0x329aa3a0
#define SAMA5D2_CIDR_MATCH 0x0a5c08c0
-#define SAMA5D27_EXID_MATCH 0x00000021
+#define SAMA5D21CU_EXID_MATCH 0x0000005a
+#define SAMA5D22CU_EXID_MATCH 0x00000059
+#define SAMA5D22CN_EXID_MATCH 0x00000069
+#define SAMA5D23CU_EXID_MATCH 0x00000058
+#define SAMA5D24CX_EXID_MATCH 0x00000004
+#define SAMA5D24CU_EXID_MATCH 0x00000014
+#define SAMA5D26CU_EXID_MATCH 0x00000012
+#define SAMA5D27CU_EXID_MATCH 0x00000011
+#define SAMA5D27CN_EXID_MATCH 0x00000021
+#define SAMA5D28CU_EXID_MATCH 0x00000010
+#define SAMA5D28CN_EXID_MATCH 0x00000020
#define SAMA5D3_CIDR_MATCH 0x0a5c07c0
#define SAMA5D31_EXID_MATCH 0x00444300
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/3] ARM: at91/dt: sama5d2: add chipid node
[not found] ` <1458285681-25684-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2016-03-18 7:21 ` [PATCH 2/3] ARM: at91/soc: reference the whole sama5d2 family Ludovic Desroches
@ 2016-03-18 7:21 ` Ludovic Desroches
[not found] ` <1458285681-25684-3-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2016-03-18 10:34 ` [PATCH 1/3] ARM: at91: use chipid device for soc detection Alexandre Belloni
2016-03-20 0:45 ` Rob Herring
3 siblings, 1 reply; 14+ messages in thread
From: Ludovic Desroches @ 2016-03-18 7:21 UTC (permalink / raw)
To: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
Cc: plagnioj-sclMFOaUSTBWk0Htik3J/w,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ludovic Desroches
Add node for chipid device in order to have access to the CIDR and EXID
values.
Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
arch/arm/boot/dts/sama5d2.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
index 78996bd..173e3d7 100644
--- a/arch/arm/boot/dts/sama5d2.dtsi
+++ b/arch/arm/boot/dts/sama5d2.dtsi
@@ -1193,6 +1193,11 @@
clock-names = "tdes_clk";
status = "okay";
};
+
+ chipid@fc069000 {
+ compatible = "atmel,sama5d2-chipid";
+ reg = <0xfc069000 0x8>;
+ };
};
};
};
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] ARM: at91: use chipid device for soc detection
[not found] ` <1458285681-25684-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2016-03-18 7:21 ` [PATCH 2/3] ARM: at91/soc: reference the whole sama5d2 family Ludovic Desroches
2016-03-18 7:21 ` [PATCH 3/3] ARM: at91/dt: sama5d2: add chipid node Ludovic Desroches
@ 2016-03-18 10:34 ` Alexandre Belloni
2016-03-23 11:22 ` Nicolas Ferre
2016-03-20 0:45 ` Rob Herring
3 siblings, 1 reply; 14+ messages in thread
From: Alexandre Belloni @ 2016-03-18 10:34 UTC (permalink / raw)
To: Ludovic Desroches
Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
plagnioj-sclMFOaUSTBWk0Htik3J/w,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On 18/03/2016 at 08:21:19 +0100, Ludovic Desroches wrote :
> So far, the CIDR and EXID registers were in the DBGU interface. This device
> has disappeared with the SAMA5D2 family. These registers are exposed
> through a new device called chipid.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> [nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org: remove useless warnings]
Acked-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
> .../devicetree/bindings/arm/atmel-at91.txt | 4 ++
> arch/arm/mach-at91/soc.c | 81 +++++++++++++++++-----
> 2 files changed, 67 insertions(+), 18 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
> index 7fd64ec..0b1fcbf 100644
> --- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
> +++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
> @@ -41,6 +41,10 @@ compatible: must be one of:
> - "atmel,sama5d43"
> - "atmel,sama5d44"
>
> +Chipid required properties:
> +- compatible: Should be "atmel,sama5d2-chipid"
> +- reg : Should contain registers location and length
> +
> PIT Timer required properties:
> - compatible: Should be "atmel,at91sam9260-pit"
> - reg: Should contain registers location and length
> diff --git a/arch/arm/mach-at91/soc.c b/arch/arm/mach-at91/soc.c
> index 54343ff..034d563 100644
> --- a/arch/arm/mach-at91/soc.c
> +++ b/arch/arm/mach-at91/soc.c
> @@ -22,48 +22,93 @@
> #include "soc.h"
>
> #define AT91_DBGU_CIDR 0x40
> -#define AT91_DBGU_CIDR_VERSION(x) ((x) & 0x1f)
> -#define AT91_DBGU_CIDR_EXT BIT(31)
> -#define AT91_DBGU_CIDR_MATCH_MASK 0x7fffffe0
> #define AT91_DBGU_EXID 0x44
> +#define AT91_CHIPID_CIDR 0x00
> +#define AT91_CHIPID_EXID 0x04
> +#define AT91_CIDR_VERSION(x) ((x) & 0x1f)
> +#define AT91_CIDR_EXT BIT(31)
> +#define AT91_CIDR_MATCH_MASK 0x7fffffe0
>
> -struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
> +int __init at91_get_cidr_exid_from_dbgu(u32 *cidr, u32 *exid)
> {
> - struct soc_device_attribute *soc_dev_attr;
> - const struct at91_soc *soc;
> - struct soc_device *soc_dev;
> struct device_node *np;
> void __iomem *regs;
> - u32 cidr, exid;
>
> np = of_find_compatible_node(NULL, NULL, "atmel,at91rm9200-dbgu");
> if (!np)
> np = of_find_compatible_node(NULL, NULL,
> "atmel,at91sam9260-dbgu");
> + if (!np)
> + return -ENODEV;
>
> - if (!np) {
> - pr_warn("Could not find DBGU node");
> - return NULL;
> + regs = of_iomap(np, 0);
> + of_node_put(np);
> +
> + if (!regs) {
> + pr_warn("Could not map DBGU iomem range");
> + return -ENXIO;
> }
>
> + *cidr = readl(regs + AT91_DBGU_CIDR);
> + *exid = readl(regs + AT91_DBGU_EXID);
> +
> + iounmap(regs);
> +
> + return 0;
> +}
> +
> +int __init at91_get_cidr_exid_from_chipid(u32 *cidr, u32 *exid)
> +{
> + struct device_node *np;
> + void __iomem *regs;
> +
> + np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-chipid");
> + if (!np)
> + return -ENODEV;
> +
> regs = of_iomap(np, 0);
> of_node_put(np);
>
> if (!regs) {
> pr_warn("Could not map DBGU iomem range");
> - return NULL;
> + return -ENXIO;
> }
>
> - cidr = readl(regs + AT91_DBGU_CIDR);
> - exid = readl(regs + AT91_DBGU_EXID);
> + *cidr = readl(regs + AT91_CHIPID_CIDR);
> + *exid = readl(regs + AT91_CHIPID_EXID);
>
> iounmap(regs);
>
> + return 0;
> +}
> +
> +struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
> +{
> + struct soc_device_attribute *soc_dev_attr;
> + const struct at91_soc *soc;
> + struct soc_device *soc_dev;
> + u32 cidr, exid;
> + int ret;
> +
> + /*
> + * With SAMA5D2 and later SoCs, CIDR and EXID registers are no more
> + * in the dbgu device but in the chipid device whose purpose is only
> + * to expose these two registers.
> + */
> + ret = at91_get_cidr_exid_from_dbgu(&cidr, &exid);
> + if (ret)
> + ret = at91_get_cidr_exid_from_chipid(&cidr, &exid);
> + if (ret) {
> + if (ret == -ENODEV)
> + pr_warn("Could not find identification node");
> + return NULL;
> + }
> +
> for (soc = socs; soc->name; soc++) {
> - if (soc->cidr_match != (cidr & AT91_DBGU_CIDR_MATCH_MASK))
> + if (soc->cidr_match != (cidr & AT91_CIDR_MATCH_MASK))
> continue;
>
> - if (!(cidr & AT91_DBGU_CIDR_EXT) || soc->exid_match == exid)
> + if (!(cidr & AT91_CIDR_EXT) || soc->exid_match == exid)
> break;
> }
>
> @@ -79,7 +124,7 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
> soc_dev_attr->family = soc->family;
> soc_dev_attr->soc_id = soc->name;
> soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%X",
> - AT91_DBGU_CIDR_VERSION(cidr));
> + AT91_CIDR_VERSION(cidr));
> soc_dev = soc_device_register(soc_dev_attr);
> if (IS_ERR(soc_dev)) {
> kfree(soc_dev_attr->revision);
> @@ -91,7 +136,7 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
> if (soc->family)
> pr_info("Detected SoC family: %s\n", soc->family);
> pr_info("Detected SoC: %s, revision %X\n", soc->name,
> - AT91_DBGU_CIDR_VERSION(cidr));
> + AT91_CIDR_VERSION(cidr));
>
> return soc_dev;
> }
> --
> 2.5.0
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] ARM: at91/soc: reference the whole sama5d2 family
[not found] ` <1458285681-25684-2-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
@ 2016-03-18 10:34 ` Alexandre Belloni
0 siblings, 0 replies; 14+ messages in thread
From: Alexandre Belloni @ 2016-03-18 10:34 UTC (permalink / raw)
To: Ludovic Desroches
Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
plagnioj-sclMFOaUSTBWk0Htik3J/w,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On 18/03/2016 at 08:21:20 +0100, Ludovic Desroches wrote :
> Add EXID of all SoCs of the SAMA5D2 family.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Acked-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
> arch/arm/mach-at91/sama5.c | 20 +++++++++++++++++++-
> arch/arm/mach-at91/soc.h | 12 +++++++++++-
> 2 files changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c
> index df8fdf1..922b85f 100644
> --- a/arch/arm/mach-at91/sama5.c
> +++ b/arch/arm/mach-at91/sama5.c
> @@ -18,8 +18,26 @@
> #include "soc.h"
>
> static const struct at91_soc sama5_socs[] = {
> - AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27_EXID_MATCH,
> + AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D21CU_EXID_MATCH,
> + "sama5d21", "sama5d2"),
> + AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D22CU_EXID_MATCH,
> + "sama5d22", "sama5d2"),
> + AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D23CU_EXID_MATCH,
> + "sama5d23", "sama5d2"),
> + AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D24CX_EXID_MATCH,
> + "sama5d24", "sama5d2"),
> + AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D24CU_EXID_MATCH,
> + "sama5d24", "sama5d2"),
> + AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D26CU_EXID_MATCH,
> + "sama5d26", "sama5d2"),
> + AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27CU_EXID_MATCH,
> "sama5d27", "sama5d2"),
> + AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27CN_EXID_MATCH,
> + "sama5d27", "sama5d2"),
> + AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D28CU_EXID_MATCH,
> + "sama5d28", "sama5d2"),
> + AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D28CN_EXID_MATCH,
> + "sama5d28", "sama5d2"),
> AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D31_EXID_MATCH,
> "sama5d31", "sama5d3"),
> AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D33_EXID_MATCH,
> diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
> index 8ede0ef..228efde 100644
> --- a/arch/arm/mach-at91/soc.h
> +++ b/arch/arm/mach-at91/soc.h
> @@ -63,7 +63,17 @@ at91_soc_init(const struct at91_soc *socs);
> #define AT91SAM9XE512_CIDR_MATCH 0x329aa3a0
>
> #define SAMA5D2_CIDR_MATCH 0x0a5c08c0
> -#define SAMA5D27_EXID_MATCH 0x00000021
> +#define SAMA5D21CU_EXID_MATCH 0x0000005a
> +#define SAMA5D22CU_EXID_MATCH 0x00000059
> +#define SAMA5D22CN_EXID_MATCH 0x00000069
> +#define SAMA5D23CU_EXID_MATCH 0x00000058
> +#define SAMA5D24CX_EXID_MATCH 0x00000004
> +#define SAMA5D24CU_EXID_MATCH 0x00000014
> +#define SAMA5D26CU_EXID_MATCH 0x00000012
> +#define SAMA5D27CU_EXID_MATCH 0x00000011
> +#define SAMA5D27CN_EXID_MATCH 0x00000021
> +#define SAMA5D28CU_EXID_MATCH 0x00000010
> +#define SAMA5D28CN_EXID_MATCH 0x00000020
>
> #define SAMA5D3_CIDR_MATCH 0x0a5c07c0
> #define SAMA5D31_EXID_MATCH 0x00444300
> --
> 2.5.0
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] ARM: at91/dt: sama5d2: add chipid node
[not found] ` <1458285681-25684-3-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
@ 2016-03-18 10:34 ` Alexandre Belloni
0 siblings, 0 replies; 14+ messages in thread
From: Alexandre Belloni @ 2016-03-18 10:34 UTC (permalink / raw)
To: Ludovic Desroches
Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
plagnioj-sclMFOaUSTBWk0Htik3J/w,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On 18/03/2016 at 08:21:21 +0100, Ludovic Desroches wrote :
> Add node for chipid device in order to have access to the CIDR and EXID
> values.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Acked-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
> arch/arm/boot/dts/sama5d2.dtsi | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> index 78996bd..173e3d7 100644
> --- a/arch/arm/boot/dts/sama5d2.dtsi
> +++ b/arch/arm/boot/dts/sama5d2.dtsi
> @@ -1193,6 +1193,11 @@
> clock-names = "tdes_clk";
> status = "okay";
> };
> +
> + chipid@fc069000 {
> + compatible = "atmel,sama5d2-chipid";
> + reg = <0xfc069000 0x8>;
> + };
> };
> };
> };
> --
> 2.5.0
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] ARM: at91: use chipid device for soc detection
[not found] ` <1458285681-25684-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
` (2 preceding siblings ...)
2016-03-18 10:34 ` [PATCH 1/3] ARM: at91: use chipid device for soc detection Alexandre Belloni
@ 2016-03-20 0:45 ` Rob Herring
3 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2016-03-20 0:45 UTC (permalink / raw)
To: Ludovic Desroches
Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w,
alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
plagnioj-sclMFOaUSTBWk0Htik3J/w,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On Fri, Mar 18, 2016 at 08:21:19AM +0100, Ludovic Desroches wrote:
> So far, the CIDR and EXID registers were in the DBGU interface. This device
> has disappeared with the SAMA5D2 family. These registers are exposed
> through a new device called chipid.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> [nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org: remove useless warnings]
> ---
> .../devicetree/bindings/arm/atmel-at91.txt | 4 ++
> arch/arm/mach-at91/soc.c | 81 +++++++++++++++++-----
> 2 files changed, 67 insertions(+), 18 deletions(-)
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] ARM: at91: use chipid device for soc detection
2016-03-18 10:34 ` [PATCH 1/3] ARM: at91: use chipid device for soc detection Alexandre Belloni
@ 2016-03-23 11:22 ` Nicolas Ferre
[not found] ` <56F27C89.9070004-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 14+ messages in thread
From: Nicolas Ferre @ 2016-03-23 11:22 UTC (permalink / raw)
To: Alexandre Belloni, Ludovic Desroches
Cc: plagnioj, boris.brezillon, devicetree, linux-arm-kernel, linux-kernel
Le 18/03/2016 11:34, Alexandre Belloni a écrit :
> On 18/03/2016 at 08:21:19 +0100, Ludovic Desroches wrote :
>> So far, the CIDR and EXID registers were in the DBGU interface. This device
>> has disappeared with the SAMA5D2 family. These registers are exposed
>> through a new device called chipid.
>>
>> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
>> [nicolas.ferre@atmel.com: remove useless warnings]
> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>
>> ---
>> .../devicetree/bindings/arm/atmel-at91.txt | 4 ++
>> arch/arm/mach-at91/soc.c | 81 +++++++++++++++++-----
We may need to split this patch in 2 for going through separate arm-soc
branches: what do you think Alexandre?
Anyway, I can do it myself: no need to re-send a version:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
We'll queue it in our upcoming at91-4.7-dt and at91-4.7-soc branches.
Bye,
>> 2 files changed, 67 insertions(+), 18 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
>> index 7fd64ec..0b1fcbf 100644
>> --- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
>> +++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
>> @@ -41,6 +41,10 @@ compatible: must be one of:
>> - "atmel,sama5d43"
>> - "atmel,sama5d44"
>>
>> +Chipid required properties:
>> +- compatible: Should be "atmel,sama5d2-chipid"
>> +- reg : Should contain registers location and length
>> +
>> PIT Timer required properties:
>> - compatible: Should be "atmel,at91sam9260-pit"
>> - reg: Should contain registers location and length
>> diff --git a/arch/arm/mach-at91/soc.c b/arch/arm/mach-at91/soc.c
>> index 54343ff..034d563 100644
>> --- a/arch/arm/mach-at91/soc.c
>> +++ b/arch/arm/mach-at91/soc.c
>> @@ -22,48 +22,93 @@
>> #include "soc.h"
>>
>> #define AT91_DBGU_CIDR 0x40
>> -#define AT91_DBGU_CIDR_VERSION(x) ((x) & 0x1f)
>> -#define AT91_DBGU_CIDR_EXT BIT(31)
>> -#define AT91_DBGU_CIDR_MATCH_MASK 0x7fffffe0
>> #define AT91_DBGU_EXID 0x44
>> +#define AT91_CHIPID_CIDR 0x00
>> +#define AT91_CHIPID_EXID 0x04
>> +#define AT91_CIDR_VERSION(x) ((x) & 0x1f)
>> +#define AT91_CIDR_EXT BIT(31)
>> +#define AT91_CIDR_MATCH_MASK 0x7fffffe0
>>
>> -struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
>> +int __init at91_get_cidr_exid_from_dbgu(u32 *cidr, u32 *exid)
>> {
>> - struct soc_device_attribute *soc_dev_attr;
>> - const struct at91_soc *soc;
>> - struct soc_device *soc_dev;
>> struct device_node *np;
>> void __iomem *regs;
>> - u32 cidr, exid;
>>
>> np = of_find_compatible_node(NULL, NULL, "atmel,at91rm9200-dbgu");
>> if (!np)
>> np = of_find_compatible_node(NULL, NULL,
>> "atmel,at91sam9260-dbgu");
>> + if (!np)
>> + return -ENODEV;
>>
>> - if (!np) {
>> - pr_warn("Could not find DBGU node");
>> - return NULL;
>> + regs = of_iomap(np, 0);
>> + of_node_put(np);
>> +
>> + if (!regs) {
>> + pr_warn("Could not map DBGU iomem range");
>> + return -ENXIO;
>> }
>>
>> + *cidr = readl(regs + AT91_DBGU_CIDR);
>> + *exid = readl(regs + AT91_DBGU_EXID);
>> +
>> + iounmap(regs);
>> +
>> + return 0;
>> +}
>> +
>> +int __init at91_get_cidr_exid_from_chipid(u32 *cidr, u32 *exid)
>> +{
>> + struct device_node *np;
>> + void __iomem *regs;
>> +
>> + np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-chipid");
>> + if (!np)
>> + return -ENODEV;
>> +
>> regs = of_iomap(np, 0);
>> of_node_put(np);
>>
>> if (!regs) {
>> pr_warn("Could not map DBGU iomem range");
>> - return NULL;
>> + return -ENXIO;
>> }
>>
>> - cidr = readl(regs + AT91_DBGU_CIDR);
>> - exid = readl(regs + AT91_DBGU_EXID);
>> + *cidr = readl(regs + AT91_CHIPID_CIDR);
>> + *exid = readl(regs + AT91_CHIPID_EXID);
>>
>> iounmap(regs);
>>
>> + return 0;
>> +}
>> +
>> +struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
>> +{
>> + struct soc_device_attribute *soc_dev_attr;
>> + const struct at91_soc *soc;
>> + struct soc_device *soc_dev;
>> + u32 cidr, exid;
>> + int ret;
>> +
>> + /*
>> + * With SAMA5D2 and later SoCs, CIDR and EXID registers are no more
>> + * in the dbgu device but in the chipid device whose purpose is only
>> + * to expose these two registers.
>> + */
>> + ret = at91_get_cidr_exid_from_dbgu(&cidr, &exid);
>> + if (ret)
>> + ret = at91_get_cidr_exid_from_chipid(&cidr, &exid);
>> + if (ret) {
>> + if (ret == -ENODEV)
>> + pr_warn("Could not find identification node");
>> + return NULL;
>> + }
>> +
>> for (soc = socs; soc->name; soc++) {
>> - if (soc->cidr_match != (cidr & AT91_DBGU_CIDR_MATCH_MASK))
>> + if (soc->cidr_match != (cidr & AT91_CIDR_MATCH_MASK))
>> continue;
>>
>> - if (!(cidr & AT91_DBGU_CIDR_EXT) || soc->exid_match == exid)
>> + if (!(cidr & AT91_CIDR_EXT) || soc->exid_match == exid)
>> break;
>> }
>>
>> @@ -79,7 +124,7 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
>> soc_dev_attr->family = soc->family;
>> soc_dev_attr->soc_id = soc->name;
>> soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%X",
>> - AT91_DBGU_CIDR_VERSION(cidr));
>> + AT91_CIDR_VERSION(cidr));
>> soc_dev = soc_device_register(soc_dev_attr);
>> if (IS_ERR(soc_dev)) {
>> kfree(soc_dev_attr->revision);
>> @@ -91,7 +136,7 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
>> if (soc->family)
>> pr_info("Detected SoC family: %s\n", soc->family);
>> pr_info("Detected SoC: %s, revision %X\n", soc->name,
>> - AT91_DBGU_CIDR_VERSION(cidr));
>> + AT91_CIDR_VERSION(cidr));
>>
>> return soc_dev;
>> }
>> --
>> 2.5.0
>>
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] ARM: at91: use chipid device for soc detection
[not found] ` <56F27C89.9070004-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
@ 2016-03-23 13:47 ` Alexandre Belloni
[not found] ` <20160323134750.GC2570-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
0 siblings, 1 reply; 14+ messages in thread
From: Alexandre Belloni @ 2016-03-23 13:47 UTC (permalink / raw)
To: Nicolas Ferre
Cc: Ludovic Desroches, plagnioj-sclMFOaUSTBWk0Htik3J/w,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On 23/03/2016 at 12:22:49 +0100, Nicolas Ferre wrote :
> Le 18/03/2016 11:34, Alexandre Belloni a écrit :
> > On 18/03/2016 at 08:21:19 +0100, Ludovic Desroches wrote :
> >> So far, the CIDR and EXID registers were in the DBGU interface. This device
> >> has disappeared with the SAMA5D2 family. These registers are exposed
> >> through a new device called chipid.
> >>
> >> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> >> [nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org: remove useless warnings]
> > Acked-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> >
> >> ---
> >> .../devicetree/bindings/arm/atmel-at91.txt | 4 ++
> >> arch/arm/mach-at91/soc.c | 81 +++++++++++++++++-----
>
> We may need to split this patch in 2 for going through separate arm-soc
> branches: what do you think Alexandre?
>
I think the patch can go in as it is now, the documentation being in
line with the code.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] ARM: at91: use chipid device for soc detection
[not found] ` <20160323134750.GC2570-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
@ 2016-03-29 13:53 ` Nicolas Ferre
0 siblings, 0 replies; 14+ messages in thread
From: Nicolas Ferre @ 2016-03-29 13:53 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Ludovic Desroches, plagnioj-sclMFOaUSTBWk0Htik3J/w,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Le 23/03/2016 14:47, Alexandre Belloni a écrit :
> On 23/03/2016 at 12:22:49 +0100, Nicolas Ferre wrote :
>> Le 18/03/2016 11:34, Alexandre Belloni a écrit :
>>> On 18/03/2016 at 08:21:19 +0100, Ludovic Desroches wrote :
>>>> So far, the CIDR and EXID registers were in the DBGU interface. This device
>>>> has disappeared with the SAMA5D2 family. These registers are exposed
>>>> through a new device called chipid.
>>>>
>>>> Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
>>>> [nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org: remove useless warnings]
>>> Acked-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
>>>
>>>> ---
>>>> .../devicetree/bindings/arm/atmel-at91.txt | 4 ++
>>>> arch/arm/mach-at91/soc.c | 81 +++++++++++++++++-----
>>
>> We may need to split this patch in 2 for going through separate arm-soc
>> branches: what do you think Alexandre?
>>
>
> I think the patch can go in as it is now, the documentation being in
> line with the code.
Okay: patches 1 & 2 in the "soc" branch.
patch 3 in the "dt" branch.
Bye,
--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] ARM: at91: use chipid device for soc detection
2016-03-18 7:21 [PATCH 1/3] ARM: at91: use chipid device for soc detection Ludovic Desroches
[not found] ` <1458285681-25684-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
@ 2016-03-29 13:55 ` Arnd Bergmann
2016-03-29 14:04 ` Nicolas Ferre
2016-03-29 14:10 ` [PATCH v2 " Nicolas Ferre
1 sibling, 2 replies; 14+ messages in thread
From: Arnd Bergmann @ 2016-03-29 13:55 UTC (permalink / raw)
To: Ludovic Desroches
Cc: nicolas.ferre, alexandre.belloni, plagnioj, boris.brezillon,
devicetree, linux-arm-kernel, linux-kernel
On Friday 18 March 2016 08:21:19 Ludovic Desroches wrote:
> -struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
> +int __init at91_get_cidr_exid_from_dbgu(u32 *cidr, u32 *exid)
> {
> +
> +int __init at91_get_cidr_exid_from_chipid(u32 *cidr, u32 *exid)
> +{
>
These should both be 'static', right?
Arnd
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] ARM: at91: use chipid device for soc detection
2016-03-29 13:55 ` Arnd Bergmann
@ 2016-03-29 14:04 ` Nicolas Ferre
2016-03-29 14:10 ` [PATCH v2 " Nicolas Ferre
1 sibling, 0 replies; 14+ messages in thread
From: Nicolas Ferre @ 2016-03-29 14:04 UTC (permalink / raw)
To: Arnd Bergmann, Ludovic Desroches
Cc: alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
plagnioj-sclMFOaUSTBWk0Htik3J/w,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Le 29/03/2016 15:55, Arnd Bergmann a écrit :
> On Friday 18 March 2016 08:21:19 Ludovic Desroches wrote:
>> -struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
>> +int __init at91_get_cidr_exid_from_dbgu(u32 *cidr, u32 *exid)
>> {
>
>
>> +
>> +int __init at91_get_cidr_exid_from_chipid(u32 *cidr, u32 *exid)
>> +{
>>
>
> These should both be 'static', right?
Absolutely. I modify this right now and repost a patch.
Bye,
--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 1/3] ARM: at91: use chipid device for soc detection
2016-03-29 13:55 ` Arnd Bergmann
2016-03-29 14:04 ` Nicolas Ferre
@ 2016-03-29 14:10 ` Nicolas Ferre
2016-03-29 14:30 ` Arnd Bergmann
1 sibling, 1 reply; 14+ messages in thread
From: Nicolas Ferre @ 2016-03-29 14:10 UTC (permalink / raw)
To: linux-arm-kernel, Ludovic Desroches, Alexandre Belloni, arnd
Cc: Jean-Christophe PLAGNIOL-VILLARD, Boris BREZILLON, devicetree,
linux-kernel, Nicolas Ferre
From: Ludovic Desroches <ludovic.desroches@atmel.com>
So far, the CIDR and EXID registers were in the DBGU interface. This device
has disappeared with the SAMA5D2 family. These registers are exposed
through a new device called chipid.
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
[nicolas.ferre@atmel.com: remove useless warnings]
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
[arnd@arndb.de: suggest to use static functions to reduce scope]
---
.../devicetree/bindings/arm/atmel-at91.txt | 4 ++
arch/arm/mach-at91/soc.c | 81 +++++++++++++++++-----
2 files changed, 67 insertions(+), 18 deletions(-)
diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
index 7fd64ec9ee1d..0b1fcbfe2299 100644
--- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
@@ -41,6 +41,10 @@ compatible: must be one of:
- "atmel,sama5d43"
- "atmel,sama5d44"
+Chipid required properties:
+- compatible: Should be "atmel,sama5d2-chipid"
+- reg : Should contain registers location and length
+
PIT Timer required properties:
- compatible: Should be "atmel,at91sam9260-pit"
- reg: Should contain registers location and length
diff --git a/arch/arm/mach-at91/soc.c b/arch/arm/mach-at91/soc.c
index 54343ffa3e53..c6fda75ddb89 100644
--- a/arch/arm/mach-at91/soc.c
+++ b/arch/arm/mach-at91/soc.c
@@ -22,48 +22,93 @@
#include "soc.h"
#define AT91_DBGU_CIDR 0x40
-#define AT91_DBGU_CIDR_VERSION(x) ((x) & 0x1f)
-#define AT91_DBGU_CIDR_EXT BIT(31)
-#define AT91_DBGU_CIDR_MATCH_MASK 0x7fffffe0
#define AT91_DBGU_EXID 0x44
+#define AT91_CHIPID_CIDR 0x00
+#define AT91_CHIPID_EXID 0x04
+#define AT91_CIDR_VERSION(x) ((x) & 0x1f)
+#define AT91_CIDR_EXT BIT(31)
+#define AT91_CIDR_MATCH_MASK 0x7fffffe0
-struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
+static int __init at91_get_cidr_exid_from_dbgu(u32 *cidr, u32 *exid)
{
- struct soc_device_attribute *soc_dev_attr;
- const struct at91_soc *soc;
- struct soc_device *soc_dev;
struct device_node *np;
void __iomem *regs;
- u32 cidr, exid;
np = of_find_compatible_node(NULL, NULL, "atmel,at91rm9200-dbgu");
if (!np)
np = of_find_compatible_node(NULL, NULL,
"atmel,at91sam9260-dbgu");
+ if (!np)
+ return -ENODEV;
- if (!np) {
- pr_warn("Could not find DBGU node");
- return NULL;
+ regs = of_iomap(np, 0);
+ of_node_put(np);
+
+ if (!regs) {
+ pr_warn("Could not map DBGU iomem range");
+ return -ENXIO;
}
+ *cidr = readl(regs + AT91_DBGU_CIDR);
+ *exid = readl(regs + AT91_DBGU_EXID);
+
+ iounmap(regs);
+
+ return 0;
+}
+
+static int __init at91_get_cidr_exid_from_chipid(u32 *cidr, u32 *exid)
+{
+ struct device_node *np;
+ void __iomem *regs;
+
+ np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-chipid");
+ if (!np)
+ return -ENODEV;
+
regs = of_iomap(np, 0);
of_node_put(np);
if (!regs) {
pr_warn("Could not map DBGU iomem range");
- return NULL;
+ return -ENXIO;
}
- cidr = readl(regs + AT91_DBGU_CIDR);
- exid = readl(regs + AT91_DBGU_EXID);
+ *cidr = readl(regs + AT91_CHIPID_CIDR);
+ *exid = readl(regs + AT91_CHIPID_EXID);
iounmap(regs);
+ return 0;
+}
+
+struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
+{
+ struct soc_device_attribute *soc_dev_attr;
+ const struct at91_soc *soc;
+ struct soc_device *soc_dev;
+ u32 cidr, exid;
+ int ret;
+
+ /*
+ * With SAMA5D2 and later SoCs, CIDR and EXID registers are no more
+ * in the dbgu device but in the chipid device whose purpose is only
+ * to expose these two registers.
+ */
+ ret = at91_get_cidr_exid_from_dbgu(&cidr, &exid);
+ if (ret)
+ ret = at91_get_cidr_exid_from_chipid(&cidr, &exid);
+ if (ret) {
+ if (ret == -ENODEV)
+ pr_warn("Could not find identification node");
+ return NULL;
+ }
+
for (soc = socs; soc->name; soc++) {
- if (soc->cidr_match != (cidr & AT91_DBGU_CIDR_MATCH_MASK))
+ if (soc->cidr_match != (cidr & AT91_CIDR_MATCH_MASK))
continue;
- if (!(cidr & AT91_DBGU_CIDR_EXT) || soc->exid_match == exid)
+ if (!(cidr & AT91_CIDR_EXT) || soc->exid_match == exid)
break;
}
@@ -79,7 +124,7 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
soc_dev_attr->family = soc->family;
soc_dev_attr->soc_id = soc->name;
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%X",
- AT91_DBGU_CIDR_VERSION(cidr));
+ AT91_CIDR_VERSION(cidr));
soc_dev = soc_device_register(soc_dev_attr);
if (IS_ERR(soc_dev)) {
kfree(soc_dev_attr->revision);
@@ -91,7 +136,7 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
if (soc->family)
pr_info("Detected SoC family: %s\n", soc->family);
pr_info("Detected SoC: %s, revision %X\n", soc->name,
- AT91_DBGU_CIDR_VERSION(cidr));
+ AT91_CIDR_VERSION(cidr));
return soc_dev;
}
--
2.1.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/3] ARM: at91: use chipid device for soc detection
2016-03-29 14:10 ` [PATCH v2 " Nicolas Ferre
@ 2016-03-29 14:30 ` Arnd Bergmann
0 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2016-03-29 14:30 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Nicolas Ferre, Ludovic Desroches, Alexandre Belloni,
Boris BREZILLON, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel,
devicetree
On Tuesday 29 March 2016 16:10:38 Nicolas Ferre wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>
> So far, the CIDR and EXID registers were in the DBGU interface. This device
> has disappeared with the SAMA5D2 family. These registers are exposed
> through a new device called chipid.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> [nicolas.ferre@atmel.com: remove useless warnings]
> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Acked-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> [arnd@arndb.de: suggest to use static functions to reduce scope]
>
(whole series)
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-03-29 14:30 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-18 7:21 [PATCH 1/3] ARM: at91: use chipid device for soc detection Ludovic Desroches
[not found] ` <1458285681-25684-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2016-03-18 7:21 ` [PATCH 2/3] ARM: at91/soc: reference the whole sama5d2 family Ludovic Desroches
[not found] ` <1458285681-25684-2-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2016-03-18 10:34 ` Alexandre Belloni
2016-03-18 7:21 ` [PATCH 3/3] ARM: at91/dt: sama5d2: add chipid node Ludovic Desroches
[not found] ` <1458285681-25684-3-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2016-03-18 10:34 ` Alexandre Belloni
2016-03-18 10:34 ` [PATCH 1/3] ARM: at91: use chipid device for soc detection Alexandre Belloni
2016-03-23 11:22 ` Nicolas Ferre
[not found] ` <56F27C89.9070004-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2016-03-23 13:47 ` Alexandre Belloni
[not found] ` <20160323134750.GC2570-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
2016-03-29 13:53 ` Nicolas Ferre
2016-03-20 0:45 ` Rob Herring
2016-03-29 13:55 ` Arnd Bergmann
2016-03-29 14:04 ` Nicolas Ferre
2016-03-29 14:10 ` [PATCH v2 " Nicolas Ferre
2016-03-29 14:30 ` Arnd Bergmann
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).