linux: arch: define aspeed SOC IO mapping

Message ID 20181112142541.166609-1-bluecmd@google.com
State New
Headers show
Series
  • linux: arch: define aspeed SOC IO mapping
Related show

Commit Message

Christian Svensson Nov. 12, 2018, 2:25 p.m.
Without this IO mapping early printk will simply not work after the
paging and MMU has been setup.

This patch maps all the whole 0x1e600000 IO space to 0xfe600000.

Signed-off-by: Christian Svensson <bluecmd@google.com>
---
 arch/arm/Makefile                 |  1 +
 arch/arm/mach-aspeed/Makefile     |  1 +
 arch/arm/mach-aspeed/aspeed_soc.c | 47 +++++++++++++++++++++++++++++++
 arch/arm/mach-aspeed/iomap.h      | 17 +++++++++++
 4 files changed, 66 insertions(+)
 create mode 100644 arch/arm/mach-aspeed/Makefile
 create mode 100644 arch/arm/mach-aspeed/aspeed_soc.c
 create mode 100644 arch/arm/mach-aspeed/iomap.h

Comments

Christian Svensson Jan. 11, 2019, 12:30 p.m. | #1
Ping.


On Mon, Nov 12, 2018 at 3:26 PM Christian Svensson <bluecmd@google.com>
wrote:

> Without this IO mapping early printk will simply not work after the
> paging and MMU has been setup.
>
> This patch maps all the whole 0x1e600000 IO space to 0xfe600000.
>
> Signed-off-by: Christian Svensson <bluecmd@google.com>
> ---
>  arch/arm/Makefile                 |  1 +
>  arch/arm/mach-aspeed/Makefile     |  1 +
>  arch/arm/mach-aspeed/aspeed_soc.c | 47 +++++++++++++++++++++++++++++++
>  arch/arm/mach-aspeed/iomap.h      | 17 +++++++++++
>  4 files changed, 66 insertions(+)
>  create mode 100644 arch/arm/mach-aspeed/Makefile
>  create mode 100644 arch/arm/mach-aspeed/aspeed_soc.c
>  create mode 100644 arch/arm/mach-aspeed/iomap.h
>
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index fc26c3d7b9b6..f0e3ca392f8c 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -159,6 +159,7 @@ textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000
>  machine-$(CONFIG_ARCH_ACTIONS)         += actions
>  machine-$(CONFIG_ARCH_ALPINE)          += alpine
>  machine-$(CONFIG_ARCH_ARTPEC)          += artpec
> +machine-$(CONFIG_ARCH_ASPEED)          += aspeed
>  machine-$(CONFIG_ARCH_AT91)            += at91
>  machine-$(CONFIG_ARCH_AXXIA)           += axxia
>  machine-$(CONFIG_ARCH_BCM)             += bcm
> diff --git a/arch/arm/mach-aspeed/Makefile b/arch/arm/mach-aspeed/Makefile
> new file mode 100644
> index 000000000000..426952d47cc3
> --- /dev/null
> +++ b/arch/arm/mach-aspeed/Makefile
> @@ -0,0 +1 @@
> +obj-y := aspeed_soc.o
> diff --git a/arch/arm/mach-aspeed/aspeed_soc.c
> b/arch/arm/mach-aspeed/aspeed_soc.c
> new file mode 100644
> index 000000000000..187276c2813d
> --- /dev/null
> +++ b/arch/arm/mach-aspeed/aspeed_soc.c
> @@ -0,0 +1,47 @@
> +/*
> + * Copyright (C) 2018 Google, 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.
> + *
> + * 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/init.h>
> +#include <linux/of_platform.h>
> +
> +#include <asm/mach/arch.h>
> +#include <asm/mach/map.h>
> +
> +#include "iomap.h"
> +
> +// This is needed for e.g. earlyprintk
> +static struct map_desc io_desc[] __initdata = {
> +       {
> +               .virtual = AST_IO_VIRT,
> +               .pfn = __phys_to_pfn(AST_IO_PHYS),
> +               .length = AST_IO_SIZE,
> +               .type = MT_DEVICE
> +       }
> +};
> +
> +static void __init aspeed_map_io(void)
> +{
> +       iotable_init(io_desc, ARRAY_SIZE(io_desc));
> +}
> +
> +static const char * const aspeed_compat[] = {
> +       "aspeed,ast2400",
> +       "aspeed,ast2500",
> +       NULL
> +};
> +
> +DT_MACHINE_START(ASPEED_DT, "Aspeed SoC")
> +       .map_io = aspeed_map_io,
> +       .dt_compat = aspeed_compat,
> +MACHINE_END
> diff --git a/arch/arm/mach-aspeed/iomap.h b/arch/arm/mach-aspeed/iomap.h
> new file mode 100644
> index 000000000000..7ea5276f3892
> --- /dev/null
> +++ b/arch/arm/mach-aspeed/iomap.h
> @@ -0,0 +1,17 @@
> +/*
> + * Copyright (C) 2018 Google, 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.
> + *
> + * 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.
> + */
> +
> +#define AST_IO_PHYS 0x1e600000
> +#define AST_IO_VIRT 0xfe600000
> +#define AST_IO_SIZE 0x00200000
> --
> 2.19.1.930.g4563a0d9d0-goog
>
>
<div dir="ltr">Ping.<div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Nov 12, 2018 at 3:26 PM Christian Svensson &lt;<a href="mailto:bluecmd@google.com">bluecmd@google.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Without this IO mapping early printk will simply not work after the<br>
paging and MMU has been setup.<br>
<br>
This patch maps all the whole 0x1e600000 IO space to 0xfe600000.<br>
<br>
Signed-off-by: Christian Svensson &lt;<a href="mailto:bluecmd@google.com" target="_blank">bluecmd@google.com</a>&gt;<br>
---<br>
 arch/arm/Makefile                 |  1 +<br>
 arch/arm/mach-aspeed/Makefile     |  1 +<br>
 arch/arm/mach-aspeed/aspeed_soc.c | 47 +++++++++++++++++++++++++++++++<br>
 arch/arm/mach-aspeed/iomap.h      | 17 +++++++++++<br>
 4 files changed, 66 insertions(+)<br>
 create mode 100644 arch/arm/mach-aspeed/Makefile<br>
 create mode 100644 arch/arm/mach-aspeed/aspeed_soc.c<br>
 create mode 100644 arch/arm/mach-aspeed/iomap.h<br>
<br>
diff --git a/arch/arm/Makefile b/arch/arm/Makefile<br>
index fc26c3d7b9b6..f0e3ca392f8c 100644<br>
--- a/arch/arm/Makefile<br>
+++ b/arch/arm/Makefile<br>
@@ -159,6 +159,7 @@ textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000<br>
 machine-$(CONFIG_ARCH_ACTIONS)         += actions<br>
 machine-$(CONFIG_ARCH_ALPINE)          += alpine<br>
 machine-$(CONFIG_ARCH_ARTPEC)          += artpec<br>
+machine-$(CONFIG_ARCH_ASPEED)          += aspeed<br>
 machine-$(CONFIG_ARCH_AT91)            += at91<br>
 machine-$(CONFIG_ARCH_AXXIA)           += axxia<br>
 machine-$(CONFIG_ARCH_BCM)             += bcm<br>
diff --git a/arch/arm/mach-aspeed/Makefile b/arch/arm/mach-aspeed/Makefile<br>
new file mode 100644<br>
index 000000000000..426952d47cc3<br>
--- /dev/null<br>
+++ b/arch/arm/mach-aspeed/Makefile<br>
@@ -0,0 +1 @@<br>
+obj-y := aspeed_soc.o<br>
diff --git a/arch/arm/mach-aspeed/aspeed_soc.c b/arch/arm/mach-aspeed/aspeed_soc.c<br>
new file mode 100644<br>
index 000000000000..187276c2813d<br>
--- /dev/null<br>
+++ b/arch/arm/mach-aspeed/aspeed_soc.c<br>
@@ -0,0 +1,47 @@<br>
+/*<br>
+ * Copyright (C) 2018 Google, Inc.<br>
+ *<br>
+ * This program is free software; you can redistribute it and/or modify<br>
+ * it under the terms of the GNU General Public License as published by<br>
+ * the Free Software Foundation; either version 2 of the License, or<br>
+ * (at your option) any later version.<br>
+ *<br>
+ * This program is distributed in the hope that it will be useful,<br>
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>
+ * GNU General Public License for more details.<br>
+ */<br>
+<br>
+#include &lt;linux/init.h&gt;<br>
+#include &lt;linux/of_platform.h&gt;<br>
+<br>
+#include &lt;asm/mach/arch.h&gt;<br>
+#include &lt;asm/mach/map.h&gt;<br>
+<br>
+#include &quot;iomap.h&quot;<br>
+<br>
+// This is needed for e.g. earlyprintk<br>
+static struct map_desc io_desc[] __initdata = {<br>
+       {<br>
+               .virtual = AST_IO_VIRT,<br>
+               .pfn = __phys_to_pfn(AST_IO_PHYS),<br>
+               .length = AST_IO_SIZE,<br>
+               .type = MT_DEVICE<br>
+       }<br>
+};<br>
+<br>
+static void __init aspeed_map_io(void)<br>
+{<br>
+       iotable_init(io_desc, ARRAY_SIZE(io_desc));<br>
+}<br>
+<br>
+static const char * const aspeed_compat[] = {<br>
+       &quot;aspeed,ast2400&quot;,<br>
+       &quot;aspeed,ast2500&quot;,<br>
+       NULL<br>
+};<br>
+<br>
+DT_MACHINE_START(ASPEED_DT, &quot;Aspeed SoC&quot;)<br>
+       .map_io = aspeed_map_io,<br>
+       .dt_compat = aspeed_compat,<br>
+MACHINE_END<br>
diff --git a/arch/arm/mach-aspeed/iomap.h b/arch/arm/mach-aspeed/iomap.h<br>
new file mode 100644<br>
index 000000000000..7ea5276f3892<br>
--- /dev/null<br>
+++ b/arch/arm/mach-aspeed/iomap.h<br>
@@ -0,0 +1,17 @@<br>
+/*<br>
+ * Copyright (C) 2018 Google, Inc.<br>
+ *<br>
+ * This program is free software; you can redistribute it and/or modify<br>
+ * it under the terms of the GNU General Public License as published by<br>
+ * the Free Software Foundation; either version 2 of the License, or<br>
+ * (at your option) any later version.<br>
+ *<br>
+ * This program is distributed in the hope that it will be useful,<br>
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>
+ * GNU General Public License for more details.<br>
+ */<br>
+<br>
+#define AST_IO_PHYS 0x1e600000<br>
+#define AST_IO_VIRT 0xfe600000<br>
+#define AST_IO_SIZE 0x00200000<br>
-- <br>
2.19.1.930.g4563a0d9d0-goog<br>
<br>
</blockquote></div>

Patch

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index fc26c3d7b9b6..f0e3ca392f8c 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -159,6 +159,7 @@  textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000
 machine-$(CONFIG_ARCH_ACTIONS)		+= actions
 machine-$(CONFIG_ARCH_ALPINE)		+= alpine
 machine-$(CONFIG_ARCH_ARTPEC)		+= artpec
+machine-$(CONFIG_ARCH_ASPEED)		+= aspeed
 machine-$(CONFIG_ARCH_AT91)		+= at91
 machine-$(CONFIG_ARCH_AXXIA)		+= axxia
 machine-$(CONFIG_ARCH_BCM)		+= bcm
diff --git a/arch/arm/mach-aspeed/Makefile b/arch/arm/mach-aspeed/Makefile
new file mode 100644
index 000000000000..426952d47cc3
--- /dev/null
+++ b/arch/arm/mach-aspeed/Makefile
@@ -0,0 +1 @@ 
+obj-y := aspeed_soc.o
diff --git a/arch/arm/mach-aspeed/aspeed_soc.c b/arch/arm/mach-aspeed/aspeed_soc.c
new file mode 100644
index 000000000000..187276c2813d
--- /dev/null
+++ b/arch/arm/mach-aspeed/aspeed_soc.c
@@ -0,0 +1,47 @@ 
+/*
+ * Copyright (C) 2018 Google, 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.
+ *
+ * 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/init.h>
+#include <linux/of_platform.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include "iomap.h"
+
+// This is needed for e.g. earlyprintk
+static struct map_desc io_desc[] __initdata = {
+	{
+		.virtual = AST_IO_VIRT,
+		.pfn = __phys_to_pfn(AST_IO_PHYS),
+		.length = AST_IO_SIZE,
+		.type = MT_DEVICE
+	}
+};
+
+static void __init aspeed_map_io(void)
+{
+	iotable_init(io_desc, ARRAY_SIZE(io_desc));
+}
+
+static const char * const aspeed_compat[] = {
+	"aspeed,ast2400",
+	"aspeed,ast2500",
+	NULL
+};
+
+DT_MACHINE_START(ASPEED_DT, "Aspeed SoC")
+	.map_io = aspeed_map_io,
+	.dt_compat = aspeed_compat,
+MACHINE_END
diff --git a/arch/arm/mach-aspeed/iomap.h b/arch/arm/mach-aspeed/iomap.h
new file mode 100644
index 000000000000..7ea5276f3892
--- /dev/null
+++ b/arch/arm/mach-aspeed/iomap.h
@@ -0,0 +1,17 @@ 
+/*
+ * Copyright (C) 2018 Google, 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.
+ *
+ * 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.
+ */
+
+#define AST_IO_PHYS 0x1e600000
+#define AST_IO_VIRT 0xfe600000
+#define AST_IO_SIZE 0x00200000