Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Add support for Amlogic Meson GXL family SoCs.



details:   https://anonhg.NetBSD.org/src/rev/71bd8786396e
branches:  trunk
changeset: 450598:71bd8786396e
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Apr 19 19:07:55 2019 +0000

description:
Add support for Amlogic Meson GXL family SoCs.

diffstat:

 sys/arch/arm/amlogic/files.meson        |   17 +-
 sys/arch/arm/amlogic/meson_clk.c        |   10 +-
 sys/arch/arm/amlogic/meson_dwmac.c      |   21 +-
 sys/arch/arm/amlogic/meson_pinctrl.c    |    8 +-
 sys/arch/arm/amlogic/meson_pinctrl.h    |    7 +-
 sys/arch/arm/amlogic/meson_platform.c   |   17 +-
 sys/arch/arm/amlogic/mesongxbb_aoclkc.c |    7 +-
 sys/arch/arm/amlogic/mesongxbb_clkc.c   |   31 +-
 sys/arch/arm/amlogic/mesongxl_pinctrl.c |  483 ++++++++++++++++++++++++++++++++
 sys/arch/arm/amlogic/mesongxl_usb2phy.c |  191 ++++++++++++
 sys/arch/arm/amlogic/mesongxl_usb3phy.c |  223 ++++++++++++++
 sys/arch/evbarm/conf/GENERIC64          |   18 +-
 12 files changed, 1003 insertions(+), 30 deletions(-)

diffs (truncated from 1305 to 300 lines):

diff -r b7b23693f197 -r 71bd8786396e sys/arch/arm/amlogic/files.meson
--- a/sys/arch/arm/amlogic/files.meson  Fri Apr 19 19:05:56 2019 +0000
+++ b/sys/arch/arm/amlogic/files.meson  Fri Apr 19 19:07:55 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.meson,v 1.6 2019/04/05 12:11:26 jmcneill Exp $
+#      $NetBSD: files.meson,v 1.7 2019/04/19 19:07:56 jmcneill Exp $
 #
 # Configuration info for Amlogic Meson family SoCs
 #
@@ -53,6 +53,7 @@
 file   arch/arm/amlogic/meson_pinctrl.c        meson_pinctrl
 file   arch/arm/amlogic/meson8b_pinctrl.c      meson_pinctrl & soc_meson8b
 file   arch/arm/amlogic/mesongxbb_pinctrl.c    meson_pinctrl & soc_mesongxbb
+file   arch/arm/amlogic/mesongxl_pinctrl.c     meson_pinctrl & soc_mesongxl
 
 # Meson8b SDHC
 device mesonsdhc: sdmmcbus
@@ -74,6 +75,16 @@
 attach mesonusbphy at fdt with meson_usbphy
 file   arch/arm/amlogic/meson_usbphy.c         meson_usbphy
 
+# Meson GXL USB2 PHY
+device mesongxlu2phy
+attach mesongxlu2phy at fdt with mesongxl_usb2phy
+file   arch/arm/amlogic/mesongxl_usb2phy.c     mesongxl_usb2phy
+
+# Meson GXL USB3 PHY
+device mesongxlu3phy
+attach mesongxlu3phy at fdt with mesongxl_usb3phy
+file   arch/arm/amlogic/mesongxl_usb3phy.c     mesongxl_usb3phy
+
 # RTC
 device mesonrtc
 attach mesonrtc at fdt with meson_rtc
@@ -96,4 +107,6 @@
 # SOC parameters
 defflag        opt_soc.h                       SOC_MESON
 defflag        opt_soc.h                       SOC_MESON8B: SOC_MESON
-defflag        opt_soc.h                       SOC_MESONGXBB: SOC_MESON
+defflag        opt_soc.h                       SOC_MESONGX: SOC_MESON
+defflag        opt_soc.h                       SOC_MESONGXBB: SOC_MESONGX
+defflag        opt_soc.h                       SOC_MESONGXL: SOC_MESONGX
diff -r b7b23693f197 -r 71bd8786396e sys/arch/arm/amlogic/meson_clk.c
--- a/sys/arch/arm/amlogic/meson_clk.c  Fri Apr 19 19:05:56 2019 +0000
+++ b/sys/arch/arm/amlogic/meson_clk.c  Fri Apr 19 19:07:55 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_clk.c,v 1.2 2019/02/25 19:30:17 jmcneill Exp $ */
+/* $NetBSD: meson_clk.c,v 1.3 2019/04/19 19:07:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017-2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_clk.c,v 1.2 2019/02/25 19:30:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_clk.c,v 1.3 2019/04/19 19:07:56 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -157,7 +157,7 @@
 
        clkp_parent = clk_get_parent(clkp);
        if (clkp_parent == NULL) {
-               aprint_error("%s: no parent for %s\n", __func__, clk->base.name);
+               aprint_debug("%s: no parent for %s\n", __func__, clk->base.name);
                return 0;
        }
 
@@ -174,7 +174,7 @@
        if (clkp->flags & CLK_SET_RATE_PARENT) {
                clkp_parent = clk_get_parent(clkp);
                if (clkp_parent == NULL) {
-                       aprint_error("%s: no parent for %s\n", __func__, clk->base.name);
+                       aprint_debug("%s: no parent for %s\n", __func__, clk->base.name);
                        return ENXIO;
                }
                return clk_set_rate(clkp_parent, rate);
@@ -196,7 +196,7 @@
        if (clkp->flags & CLK_SET_RATE_PARENT) {
                clkp_parent = clk_get_parent(clkp);
                if (clkp_parent == NULL) {
-                       aprint_error("%s: no parent for %s\n", __func__, clk->base.name);
+                       aprint_debug("%s: no parent for %s\n", __func__, clk->base.name);
                        return 0;
                }
                return clk_round_rate(clkp_parent, rate);
diff -r b7b23693f197 -r 71bd8786396e sys/arch/arm/amlogic/meson_dwmac.c
--- a/sys/arch/arm/amlogic/meson_dwmac.c        Fri Apr 19 19:05:56 2019 +0000
+++ b/sys/arch/arm/amlogic/meson_dwmac.c        Fri Apr 19 19:07:55 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_dwmac.c,v 1.4 2019/03/02 12:24:44 jmcneill Exp $ */
+/* $NetBSD: meson_dwmac.c,v 1.5 2019/04/19 19:07:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.4 2019/03/02 12:24:44 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.5 2019/04/19 19:07:56 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -50,6 +50,7 @@
 
 #define        PRG_ETHERNET_ADDR0              0x00
 #define         CLKGEN_ENABLE                  __BIT(12)
+#define         RMII_CLK_I_INVERTED            __BIT(11)
 #define         PHY_CLK_ENABLE                 __BIT(10)
 #define         MP2_CLK_OUT_DIV                __BITS(9,7)
 #define         TX_CLK_DELAY                   __BITS(6,5)
@@ -114,6 +115,20 @@
        bus_space_write_4(bst, bsh, PRG_ETHERNET_ADDR0, val);
 }
 
+static void
+meson_dwmac_set_mode_rmii(int phandle, bus_space_tag_t bst,
+    bus_space_handle_t bsh)
+{
+       uint32_t val;
+
+       val = bus_space_read_4(bst, bsh, PRG_ETHERNET_ADDR0);
+       val &= ~PHY_INTERFACE_SEL;
+       val |= RMII_CLK_I_INVERTED;
+       val &= ~TX_CLK_DELAY;
+       val |= CLKGEN_ENABLE;
+       bus_space_write_4(bst, bsh, PRG_ETHERNET_ADDR0, val);
+}
+
 static int
 meson_dwmac_intr(void *arg)
 {
@@ -182,6 +197,8 @@
 
        if (strcmp(phy_mode, "rgmii") == 0) {
                meson_dwmac_set_mode_rgmii(phandle, sc->sc_bst, prgeth_bsh, clk_in[0]);
+       } else if (strcmp(phy_mode, "rmii") == 0) {
+               meson_dwmac_set_mode_rmii(phandle, sc->sc_bst, prgeth_bsh);
        } else {
                aprint_error(": unsupported phy-mode '%s'\n", phy_mode);
                return;
diff -r b7b23693f197 -r 71bd8786396e sys/arch/arm/amlogic/meson_pinctrl.c
--- a/sys/arch/arm/amlogic/meson_pinctrl.c      Fri Apr 19 19:05:56 2019 +0000
+++ b/sys/arch/arm/amlogic/meson_pinctrl.c      Fri Apr 19 19:07:55 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_pinctrl.c,v 1.4 2019/03/02 11:15:55 jmcneill Exp $ */
+/* $NetBSD: meson_pinctrl.c,v 1.5 2019/04/19 19:07:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_pinctrl.c,v 1.4 2019/03/02 11:15:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_pinctrl.c,v 1.5 2019/04/19 19:07:56 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -80,6 +80,10 @@
        { "amlogic,meson-gxbb-aobus-pinctrl",   (uintptr_t)&mesongxbb_aobus_pinctrl_config },
        { "amlogic,meson-gxbb-periphs-pinctrl", (uintptr_t)&mesongxbb_periphs_pinctrl_config },
 #endif
+#ifdef SOC_MESONGXL
+       { "amlogic,meson-gxl-aobus-pinctrl",    (uintptr_t)&mesongxl_aobus_pinctrl_config },
+       { "amlogic,meson-gxl-periphs-pinctrl",  (uintptr_t)&mesongxl_periphs_pinctrl_config },
+#endif
        { NULL, 0 }
 };
 
diff -r b7b23693f197 -r 71bd8786396e sys/arch/arm/amlogic/meson_pinctrl.h
--- a/sys/arch/arm/amlogic/meson_pinctrl.h      Fri Apr 19 19:05:56 2019 +0000
+++ b/sys/arch/arm/amlogic/meson_pinctrl.h      Fri Apr 19 19:07:55 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_pinctrl.h,v 1.2 2019/02/25 19:30:17 jmcneill Exp $ */
+/* $NetBSD: meson_pinctrl.h,v 1.3 2019/04/19 19:07:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -83,4 +83,9 @@
 extern const struct meson_pinctrl_config mesongxbb_periphs_pinctrl_config;
 #endif
 
+#ifdef SOC_MESONGXL
+extern const struct meson_pinctrl_config mesongxl_aobus_pinctrl_config;
+extern const struct meson_pinctrl_config mesongxl_periphs_pinctrl_config;
+#endif
+
 #endif /* !_MESON_PINCTRL_H */
diff -r b7b23693f197 -r 71bd8786396e sys/arch/arm/amlogic/meson_platform.c
--- a/sys/arch/arm/amlogic/meson_platform.c     Fri Apr 19 19:05:56 2019 +0000
+++ b/sys/arch/arm/amlogic/meson_platform.c     Fri Apr 19 19:07:55 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_platform.c,v 1.7 2019/04/05 12:07:02 jmcneill Exp $ */
+/* $NetBSD: meson_platform.c,v 1.8 2019/04/19 19:07:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
 #include "arml2cc.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.7 2019/04/05 12:07:02 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.8 2019/04/19 19:07:56 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -446,8 +446,8 @@
 ARM_PLATFORM(meson8b, "amlogic,meson8b", &meson8b_platform);
 #endif /* SOC_MESON8B */
 
-#if defined(SOC_MESONGXBB)
-static const struct arm_platform mesongxbb_platform = {
+#if defined(SOC_MESONGX)
+static const struct arm_platform mesongx_platform = {
        .ap_devmap = meson_platform_devmap,
        .ap_bootstrap = meson_platform_bootstrap,
        .ap_init_attach_args = meson_platform_init_attach_args,
@@ -458,5 +458,10 @@
        .ap_mpstart = arm_fdt_cpu_mpstart,
 };
 
-ARM_PLATFORM(mesongxbb, "amlogic,meson-gxbb", &mesongxbb_platform);
-#endif
+#if defined(SOC_MESONGXBB)
+ARM_PLATFORM(mesongxbb, "amlogic,meson-gxbb", &mesongx_platform);
+#endif /* SOC_MESONGXBB */
+#if defined(SOC_MESONGXL)
+ARM_PLATFORM(mesongxl, "amlogic,meson-gxl", &mesongx_platform);
+#endif /* SOC_MESONGXL */
+#endif /* SOC_MESONGX */
diff -r b7b23693f197 -r 71bd8786396e sys/arch/arm/amlogic/mesongxbb_aoclkc.c
--- a/sys/arch/arm/amlogic/mesongxbb_aoclkc.c   Fri Apr 19 19:05:56 2019 +0000
+++ b/sys/arch/arm/amlogic/mesongxbb_aoclkc.c   Fri Apr 19 19:07:55 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mesongxbb_aoclkc.c,v 1.1 2019/02/25 19:30:17 jmcneill Exp $ */
+/* $NetBSD: mesongxbb_aoclkc.c,v 1.2 2019/04/19 19:07:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: mesongxbb_aoclkc.c,v 1.1 2019/02/25 19:30:17 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: mesongxbb_aoclkc.c,v 1.2 2019/04/19 19:07:56 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -49,6 +49,7 @@
 
 static const char * const compatible[] = {
        "amlogic,meson-gxbb-aoclkc",
+       "amlogic,meson-gxl-aoclkc",
        NULL
 };
 
@@ -104,7 +105,7 @@
        meson_clk_attach(sc);
 
        aprint_naive("\n");
-       aprint_normal(": Meson GXBB AO clock controller\n");
+       aprint_normal(": Meson GX AO clock controller\n");
 
        meson_clk_print(sc);
 }
diff -r b7b23693f197 -r 71bd8786396e sys/arch/arm/amlogic/mesongxbb_clkc.c
--- a/sys/arch/arm/amlogic/mesongxbb_clkc.c     Fri Apr 19 19:05:56 2019 +0000
+++ b/sys/arch/arm/amlogic/mesongxbb_clkc.c     Fri Apr 19 19:07:55 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mesongxbb_clkc.c,v 1.1 2019/02/25 19:30:17 jmcneill Exp $ */
+/* $NetBSD: mesongxbb_clkc.c,v 1.2 2019/04/19 19:07:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: mesongxbb_clkc.c,v 1.1 2019/02/25 19:30:17 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: mesongxbb_clkc.c,v 1.2 2019/04/19 19:07:56 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -66,9 +66,22 @@
 static int mesongxbb_clkc_match(device_t, cfdata_t, void *);
 static void mesongxbb_clkc_attach(device_t, device_t, void *);
 
-static const char * const compatible[] = {
-       "amlogic,gxbb-clkc",
-       NULL
+struct mesongxbb_clkc_config {
+       const char *name;
+};
+
+static const struct mesongxbb_clkc_config gxbb_config = {
+       .name = "Meson GXBB",
+};



Home | Main Index | Thread Index | Old Index