diff mbox

[4/7] ARM: meson: add basic support for MesonX SoCs

Message ID 1408272594-10814-5-git-send-email-carlo@caione.org (mailing list archive)
State New, archived
Headers show

Commit Message

Carlo Caione Aug. 17, 2014, 10:49 a.m. UTC
Signed-off-by: Carlo Caione <carlo@caione.org>
---
 arch/arm/Kconfig             |  2 ++
 arch/arm/Makefile            |  1 +
 arch/arm/mach-meson/Kconfig  | 13 +++++++++++++
 arch/arm/mach-meson/Makefile |  1 +
 arch/arm/mach-meson/meson.c  | 36 ++++++++++++++++++++++++++++++++++++
 5 files changed, 53 insertions(+)
 create mode 100644 arch/arm/mach-meson/Kconfig
 create mode 100644 arch/arm/mach-meson/Makefile
 create mode 100644 arch/arm/mach-meson/meson.c

Comments

Maxime Ripard Aug. 17, 2014, 2:21 p.m. UTC | #1
Hi Carlo,

On Sun, Aug 17, 2014 at 12:49:51PM +0200, Carlo Caione wrote:
> Signed-off-by: Carlo Caione <carlo@caione.org>

A commit log would be nice

> ---
>  arch/arm/Kconfig             |  2 ++
>  arch/arm/Makefile            |  1 +
>  arch/arm/mach-meson/Kconfig  | 13 +++++++++++++
>  arch/arm/mach-meson/Makefile |  1 +
>  arch/arm/mach-meson/meson.c  | 36 ++++++++++++++++++++++++++++++++++++
>  5 files changed, 53 insertions(+)
>  create mode 100644 arch/arm/mach-meson/Kconfig
>  create mode 100644 arch/arm/mach-meson/Makefile
>  create mode 100644 arch/arm/mach-meson/meson.c
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index c49a775..cc52a8f 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -888,6 +888,8 @@ source "arch/arm/mach-keystone/Kconfig"
>  
>  source "arch/arm/mach-ks8695/Kconfig"
>  
> +source "arch/arm/mach-meson/Kconfig"
> +
>  source "arch/arm/mach-msm/Kconfig"
>  
>  source "arch/arm/mach-moxart/Kconfig"
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 0ce9d0f..320aa57 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -168,6 +168,7 @@ machine-$(CONFIG_ARCH_IXP4XX)		+= ixp4xx
>  machine-$(CONFIG_ARCH_KEYSTONE)		+= keystone
>  machine-$(CONFIG_ARCH_KS8695)		+= ks8695
>  machine-$(CONFIG_ARCH_LPC32XX)		+= lpc32xx
> +machine-$(CONFIG_ARCH_MESON)		+= meson
>  machine-$(CONFIG_ARCH_MMP)		+= mmp
>  machine-$(CONFIG_ARCH_MOXART)		+= moxart
>  machine-$(CONFIG_ARCH_MSM)		+= msm
> diff --git a/arch/arm/mach-meson/Kconfig b/arch/arm/mach-meson/Kconfig
> new file mode 100644
> index 0000000..2c1154e
> --- /dev/null
> +++ b/arch/arm/mach-meson/Kconfig
> @@ -0,0 +1,13 @@
> +menuconfig ARCH_MESON
> +	bool "Amlogic Meson SoCs" if ARCH_MULTI_V7
> +	select GENERIC_IRQ_CHIP
> +	select ARM_GIC
> +
> +if ARCH_MESON
> +
> +config MACH_MESON6
> +	bool "Amlogic Meson6 (8726MX) SoCs support"
> +	default ARCH_MESON
> +	select MESON6_TIMER
> +
> +endif
> diff --git a/arch/arm/mach-meson/Makefile b/arch/arm/mach-meson/Makefile
> new file mode 100644
> index 0000000..9d7380e
> --- /dev/null
> +++ b/arch/arm/mach-meson/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_ARCH_MESON) += meson.o
> diff --git a/arch/arm/mach-meson/meson.c b/arch/arm/mach-meson/meson.c
> new file mode 100644
> index 0000000..4528312
> --- /dev/null
> +++ b/arch/arm/mach-meson/meson.c
> @@ -0,0 +1,36 @@
> +/*
> + * Copyright (C) 2014 Carlo Caione <carlo@caione.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + *
> + */
> +
> +#include <linux/of_platform.h>
> +#include <asm/mach/arch.h>
> +
> +static __init void meson_init_machine_devicetree(void)
> +{
> +	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> +}

This is the default, you can just remove it

> +
> +static const char * const m6_common_board_compat[] = {
> +	"amlogic,8726_mx",
> +	"amlogic,8726_mxs",
> +	"amlogic,8726_mxl",
> +	"amlogic,meson6",

Why are all those compatibles needed? Usually, you add a single one
per SoC (which would be the last in your case I guess.

> +	NULL,
> +};
> +
> +DT_MACHINE_START(AML8726_MX, "Amlogic Meson6 platform")
> +	.init_machine	= meson_init_machine_devicetree,

And since you don't need the init machine, you can just use the
generic machine support. I'm not sure what's been decided on this,
should we remove such empty machines?

Maxime
Carlo Caione Aug. 18, 2014, 1:27 p.m. UTC | #2
On Sun, Aug 17, 2014 at 04:21:15PM +0200, Maxime Ripard wrote:
> Hi Carlo,

Hi Maxime,
thank you for reviewing also these patches, I'll keep you in CC for the
next revisions if you are interested.

> > +static __init void meson_init_machine_devicetree(void)
> > +{
> > +	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> > +}
> 
> This is the default, you can just remove it

Agree

> > +static const char * const m6_common_board_compat[] = {
> > +	"amlogic,8726_mx",
> > +	"amlogic,8726_mxs",
> > +	"amlogic,8726_mxl",
> > +	"amlogic,meson6",
> 
> Why are all those compatibles needed? Usually, you add a single one
> per SoC (which would be the last in your case I guess.

They are taken from the weird DTS in the original Amlogic sources but I
guess you are right. I am actually more inclined to just leave "8726_mx"
and "meson6" since online you can find equally both the versions for
exactly the same SoCs.

> > +	NULL,
> > +};
> > +
> > +DT_MACHINE_START(AML8726_MX, "Amlogic Meson6 platform")
> > +	.init_machine	= meson_init_machine_devicetree,
> 
> And since you don't need the init machine, you can just use the
> generic machine support. I'm not sure what's been decided on this,
> should we remove such empty machines?

I can get rid of the .init_machine but what about the .dt_compat field?

Thanks,
Matthias Brugger Aug. 18, 2014, 3:10 p.m. UTC | #3
2014-08-18 15:27 GMT+02:00 Carlo Caione <carlo@caione.org>:
> On Sun, Aug 17, 2014 at 04:21:15PM +0200, Maxime Ripard wrote:
>> Hi Carlo,
>
> Hi Maxime,
> thank you for reviewing also these patches, I'll keep you in CC for the
> next revisions if you are interested.
>
>> > +static __init void meson_init_machine_devicetree(void)
>> > +{
>> > +   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
>> > +}
>>
>> This is the default, you can just remove it
>
> Agree
>
>> > +static const char * const m6_common_board_compat[] = {
>> > +   "amlogic,8726_mx",
>> > +   "amlogic,8726_mxs",
>> > +   "amlogic,8726_mxl",
>> > +   "amlogic,meson6",
>>
>> Why are all those compatibles needed? Usually, you add a single one
>> per SoC (which would be the last in your case I guess.
>
> They are taken from the weird DTS in the original Amlogic sources but I
> guess you are right. I am actually more inclined to just leave "8726_mx"
> and "meson6" since online you can find equally both the versions for
> exactly the same SoCs.
>
>> > +   NULL,
>> > +};
>> > +
>> > +DT_MACHINE_START(AML8726_MX, "Amlogic Meson6 platform")
>> > +   .init_machine   = meson_init_machine_devicetree,
>>
>> And since you don't need the init machine, you can just use the
>> generic machine support. I'm not sure what's been decided on this,
>> should we remove such empty machines?
>
> I can get rid of the .init_machine but what about the .dt_compat field?

AFIAK there is no consensus about that.
For now I would leave the .dt_compat field. There are proposals which
try to get rid of the name_str
in the DT_MACHINE_START [0], but from what I know they are not yet merged.

Cheers,
Matthias

[0] http://lists.infradead.org/pipermail/linux-arm-kernel/2013-November/208878.html

>
> Thanks,
>
> --
> Carlo Caione
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Maxime Ripard Aug. 18, 2014, 7:11 p.m. UTC | #4
Hi,

On Mon, Aug 18, 2014 at 03:27:13PM +0200, Carlo Caione wrote:
> On Sun, Aug 17, 2014 at 04:21:15PM +0200, Maxime Ripard wrote:
> > Hi Carlo,
> 
> Hi Maxime,
> thank you for reviewing also these patches, I'll keep you in CC for the
> next revisions if you are interested.

Yep, sure.

> > > +static const char * const m6_common_board_compat[] = {
> > > +	"amlogic,8726_mx",
> > > +	"amlogic,8726_mxs",
> > > +	"amlogic,8726_mxl",
> > > +	"amlogic,meson6",
> > 
> > Why are all those compatibles needed? Usually, you add a single one
> > per SoC (which would be the last in your case I guess.
> 
> They are taken from the weird DTS in the original Amlogic sources but I
> guess you are right. I am actually more inclined to just leave "8726_mx"
> and "meson6" since online you can find equally both the versions for
> exactly the same SoCs.

I don't really know what's the best option here, but you should really
choose one name and stick to it. Since the mach directory is called
meson, I guess meson6 would make more sense, but it's your call.

> > > +	NULL,
> > > +};
> > > +
> > > +DT_MACHINE_START(AML8726_MX, "Amlogic Meson6 platform")
> > > +	.init_machine	= meson_init_machine_devicetree,
> > 
> > And since you don't need the init machine, you can just use the
> > generic machine support. I'm not sure what's been decided on this,
> > should we remove such empty machines?
> 
> I can get rid of the .init_machine but what about the .dt_compat field?

Technically, it would work. The only drawbacks are that you don't get
the machine name in /proc/cpuinfo, and that you'll probably have to
add this file at some point in the future anyway.

Maxime
diff mbox

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c49a775..cc52a8f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -888,6 +888,8 @@  source "arch/arm/mach-keystone/Kconfig"
 
 source "arch/arm/mach-ks8695/Kconfig"
 
+source "arch/arm/mach-meson/Kconfig"
+
 source "arch/arm/mach-msm/Kconfig"
 
 source "arch/arm/mach-moxart/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 0ce9d0f..320aa57 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -168,6 +168,7 @@  machine-$(CONFIG_ARCH_IXP4XX)		+= ixp4xx
 machine-$(CONFIG_ARCH_KEYSTONE)		+= keystone
 machine-$(CONFIG_ARCH_KS8695)		+= ks8695
 machine-$(CONFIG_ARCH_LPC32XX)		+= lpc32xx
+machine-$(CONFIG_ARCH_MESON)		+= meson
 machine-$(CONFIG_ARCH_MMP)		+= mmp
 machine-$(CONFIG_ARCH_MOXART)		+= moxart
 machine-$(CONFIG_ARCH_MSM)		+= msm
diff --git a/arch/arm/mach-meson/Kconfig b/arch/arm/mach-meson/Kconfig
new file mode 100644
index 0000000..2c1154e
--- /dev/null
+++ b/arch/arm/mach-meson/Kconfig
@@ -0,0 +1,13 @@ 
+menuconfig ARCH_MESON
+	bool "Amlogic Meson SoCs" if ARCH_MULTI_V7
+	select GENERIC_IRQ_CHIP
+	select ARM_GIC
+
+if ARCH_MESON
+
+config MACH_MESON6
+	bool "Amlogic Meson6 (8726MX) SoCs support"
+	default ARCH_MESON
+	select MESON6_TIMER
+
+endif
diff --git a/arch/arm/mach-meson/Makefile b/arch/arm/mach-meson/Makefile
new file mode 100644
index 0000000..9d7380e
--- /dev/null
+++ b/arch/arm/mach-meson/Makefile
@@ -0,0 +1 @@ 
+obj-$(CONFIG_ARCH_MESON) += meson.o
diff --git a/arch/arm/mach-meson/meson.c b/arch/arm/mach-meson/meson.c
new file mode 100644
index 0000000..4528312
--- /dev/null
+++ b/arch/arm/mach-meson/meson.c
@@ -0,0 +1,36 @@ 
+/*
+ * Copyright (C) 2014 Carlo Caione <carlo@caione.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ */
+
+#include <linux/of_platform.h>
+#include <asm/mach/arch.h>
+
+static __init void meson_init_machine_devicetree(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char * const m6_common_board_compat[] = {
+	"amlogic,8726_mx",
+	"amlogic,8726_mxs",
+	"amlogic,8726_mxl",
+	"amlogic,meson6",
+	NULL,
+};
+
+DT_MACHINE_START(AML8726_MX, "Amlogic Meson6 platform")
+	.init_machine	= meson_init_machine_devicetree,
+	.dt_compat	= m6_common_board_compat,
+MACHINE_END
+