Source-Changes-HG archive

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

[src/netbsd-10]: src/sys/dtb/arm Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/17861ca69fbb
branches:  netbsd-10
changeset: 376048:17861ca69fbb
user:      martin <martin%NetBSD.org@localhost>
date:      Sun May 28 10:14:35 2023 +0000

description:
Pull up following revision(s) (requested by bouyer in ticket #182):

        sys/arch/arm/nxp/imx6_platform.c: revision 1.8 (via patch)
        sys/arch/arm/nxp/imx6_platform.c: revision 1.9 (via patch)
        sys/arch/arm/nxp/imx6_ccmvar.h: revision 1.2
        sys/arch/arm/nxp/imx6_ccmvar.h: revision 1.3
        distrib/sets/lists/dtb/ad.earmv7hf: revision 1.10
        sys/arch/arm/nxp/imx6sx_clk.c: revision 1.1
        sys/arch/arm/nxp/imx6_ccm.c: revision 1.3
        sys/arch/arm/nxp/imx6sx_clk.c: revision 1.2
        sys/arch/arm/nxp/imx6_ccm.c: revision 1.4
        sys/arch/arm/nxp/imx6sx_clk.c: revision 1.3
        sys/arch/arm/nxp/imx6_spi.c: revision 1.8
        sys/arch/arm/nxp/imx_sdhc.c: revision 1.8
        sys/arch/arm/imx/imxusb.c: revision 1.19
        sys/arch/arm/nxp/imx6_usb.c: revision 1.7
        sys/arch/arm/nxp/imx6_usb.c: revision 1.8
        sys/arch/arm/nxp/files.imx: revision 1.3
        sys/arch/arm/nxp/imx6_clk.c: revision 1.5
        sys/arch/arm/nxp/imx6_clk.c: revision 1.6
        sys/arch/arm/nxp/imx6_reg.h: revision 1.2
        sys/arch/arm/nxp/imx6_gpc.c: revision 1.4
        sys/arch/arm/imx/imx23_usb.c: revision 1.6
        sys/dtb/arm/Makefile: revision 1.6
        sys/arch/arm/imx/imxusbvar.h: revision 1.7
        sys/arch/evbarm/conf/GENERIC: revision 1.119
        sys/arch/arm/nxp/imx6_ccmreg.h: revision 1.2
        sys/arch/arm/nxp/imx6_iomux.c: revision 1.3
        sys/arch/arm/nxp/imx6_usbphy.c: revision 1.3
        sys/arch/arm/nxp/imx6_pcie.c: revision 1.7

In preparation of imx6sx support, move imx6q-specific definitions from
imx6_ccm.c to imx6_clk.c, and prefix with IMX6Q/imx6q:
- Clock IDs and related struct imx_clock_id
- Clock Parents and Divider Tables
- struct imx6_clk
and related static functions

Add a pointer to struct imx6_clk, and it's size to imx6ccm_softc

Pass a pointer to imx6ccm_softc to all functions from imx6_ccm.c
NFCI

i.mx6sx CPU support in the CCM module: the clock tree si different from
the i.mx6q
- move i.mx6q-specific functions and data to imx6_clk.c
- add i.mx6sx specific imx6sx_clk.c
- add a imx6sxccm device
i.mx6sx platform support:
- the i.mx6sx has a third AIPS, so KERNEL_IO_IOREG map has to be larger
- the uart clock is at 24Mhz instead of 80.

Add i.mx6sx compatible entries to drivers that should work as is.

Fix typo, preventing i2c4 from attaching
remove commented out entries, leftover from the imx6q ccm code.
introduce imx6sx_platform_bootstrap(), which calls imx_platform_bootstrap()
and then checks for an "arm,cortex-a9-twd-timer" compatible entry in the
fdt. If not present, create one so that a9ptmr will attach.
We need this entry as this is the only timer we support for this platform,
but the upstream imx6sx.dtsi is missing the entry for it (and all A9 CPUs
have it anyway).

Thanks to Jared McNeill for advices and review.

Also build dtb files for CONFIG_SOC_IMX6SX


experimental IMX6SX support:
- add options SOC_IMX6SX
- add imx6sxccm device
tested on a UDOO Neo Full board.

known to work:
- uart (console)
- sdmmc0
- ethernet (enet0)
known to not work:
- USB (device not detected).

needs a modified device tree at this time (add arm,cortex-a9-twd-timer entry
copied from the imx6qdl dtsi); for unkown reason the imx6sx.dtsi file lacks
an entry for the a9ptmr although it is present in the soc (and, from what I
understood, in all cortex A9 SoCs).

Add imx6sx dtb files

The i.mx6sx has 2 OTG and one host-only USB controller, while the 6q has
only one OTG.

Add a "uintptr_t data" argument to all sc_*_md_hook callbacks, which
gets the sc_md_hook_data value when called.

In imx6_usb.c use this to pass the number of OTG controllers to the callbacks.
imx6_usb_init() can then properly call init_otg() or init_h1() for unit 1.

In imx6_usb_attach(), test if there is a vbus-supply property in the fdt,
and enable the regulator if present.

Now the USB port of the UDOO Neo works.

diffstat:

 distrib/sets/lists/dtb/ad.earmv7hf |    12 +-
 sys/arch/arm/imx/imx23_usb.c       |     4 +-
 sys/arch/arm/imx/imxusb.c          |    11 +-
 sys/arch/arm/imx/imxusbvar.h       |    10 +-
 sys/arch/arm/nxp/files.imx         |    10 +-
 sys/arch/arm/nxp/imx6_ccm.c        |   937 +-----------------------
 sys/arch/arm/nxp/imx6_ccmreg.h     |    48 +-
 sys/arch/arm/nxp/imx6_ccmvar.h     |   282 +------
 sys/arch/arm/nxp/imx6_clk.c        |  1198 +++++++++++++++++++++++++++++-
 sys/arch/arm/nxp/imx6_gpc.c        |     5 +-
 sys/arch/arm/nxp/imx6_iomux.c      |     5 +-
 sys/arch/arm/nxp/imx6_pcie.c       |     5 +-
 sys/arch/arm/nxp/imx6_platform.c   |   106 ++-
 sys/arch/arm/nxp/imx6_reg.h        |     6 +-
 sys/arch/arm/nxp/imx6_spi.c        |     5 +-
 sys/arch/arm/nxp/imx6_usb.c        |    41 +-
 sys/arch/arm/nxp/imx6_usbphy.c     |     5 +-
 sys/arch/arm/nxp/imx6sx_clk.c      |  1413 ++++++++++++++++++++++++++++++++++++
 sys/arch/arm/nxp/imx_sdhc.c        |     5 +-
 sys/arch/evbarm/conf/GENERIC       |     6 +-
 sys/dtb/arm/Makefile               |     3 +-
 21 files changed, 2880 insertions(+), 1237 deletions(-)

diffs (truncated from 4947 to 300 lines):

diff -r 6cfb478657b4 -r 17861ca69fbb distrib/sets/lists/dtb/ad.earmv7hf
--- a/distrib/sets/lists/dtb/ad.earmv7hf        Sun May 28 10:07:11 2023 +0000
+++ b/distrib/sets/lists/dtb/ad.earmv7hf        Sun May 28 10:14:35 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ad.earmv7hf,v 1.9 2022/09/10 15:54:11 rillig Exp $
+# $NetBSD: ad.earmv7hf,v 1.9.2.1 2023/05/28 10:14:36 martin Exp $
 #
 # DO NOT EDIT THIS FILE MANUALLY
 # Generated by "make update-sets" in sys/dtb
@@ -273,6 +273,16 @@
 ./boot/dtb/imx6qp-wandboard-revd1.dtb                dtb-base-boot  dtb
 ./boot/dtb/imx6qp-zii-rdu2.dtb                       dtb-base-boot  dtb
 ./boot/dtb/imx6s-dhcom-drc02.dtb                     dtb-base-boot  dtb
+./boot/dtb/imx6sx-nitrogen6sx.dtb                    dtb-base-boot  dtb
+./boot/dtb/imx6sx-sabreauto.dtb                      dtb-base-boot  dtb
+./boot/dtb/imx6sx-sdb-mqs.dtb                        dtb-base-boot  dtb
+./boot/dtb/imx6sx-sdb-reva.dtb                       dtb-base-boot  dtb
+./boot/dtb/imx6sx-sdb-sai.dtb                        dtb-base-boot  dtb
+./boot/dtb/imx6sx-sdb.dtb                            dtb-base-boot  dtb
+./boot/dtb/imx6sx-softing-vining-2000.dtb            dtb-base-boot  dtb
+./boot/dtb/imx6sx-udoo-neo-basic.dtb                 dtb-base-boot  dtb
+./boot/dtb/imx6sx-udoo-neo-extended.dtb              dtb-base-boot  dtb
+./boot/dtb/imx6sx-udoo-neo-full.dtb                  dtb-base-boot  dtb
 ./boot/dtb/imx7d-cl-som-imx7.dtb                     dtb-base-boot  dtb
 ./boot/dtb/imx7d-colibri-aster.dtb                   dtb-base-boot  dtb
 ./boot/dtb/imx7d-colibri-emmc-aster.dtb              dtb-base-boot  dtb
diff -r 6cfb478657b4 -r 17861ca69fbb sys/arch/arm/imx/imx23_usb.c
--- a/sys/arch/arm/imx/imx23_usb.c      Sun May 28 10:07:11 2023 +0000
+++ b/sys/arch/arm/imx/imx23_usb.c      Sun May 28 10:14:35 2023 +0000
@@ -1,4 +1,4 @@
-/* $Id: imx23_usb.c,v 1.5 2021/08/07 16:18:44 thorpej Exp $ */
+/* $Id: imx23_usb.c,v 1.5.6.1 2023/05/28 10:14:36 martin Exp $ */
 
 /*
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -152,7 +152,7 @@ imxusbc_search(device_t parent, cfdata_t
 }
 
 static
-void imx23_usb_init(struct imxehci_softc *sc)
+void imx23_usb_init(struct imxehci_softc *sc, uintptr_t data)
 {
 
        sc->sc_iftype = IMXUSBC_IF_UTMI;
diff -r 6cfb478657b4 -r 17861ca69fbb sys/arch/arm/imx/imxusb.c
--- a/sys/arch/arm/imx/imxusb.c Sun May 28 10:07:11 2023 +0000
+++ b/sys/arch/arm/imx/imxusb.c Sun May 28 10:14:35 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: imxusb.c,v 1.18 2021/08/07 16:18:44 thorpej Exp $      */
+/*     $NetBSD: imxusb.c,v 1.18.6.1 2023/05/28 10:14:36 martin Exp $   */
 /*
  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi and Hiroyuki Bessho for Genetec Corporation.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imxusb.c,v 1.18 2021/08/07 16:18:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxusb.c,v 1.18.6.1 2023/05/28 10:14:36 martin Exp $");
 
 #include "locators.h"
 #include "opt_imx.h"
@@ -158,7 +158,7 @@ imxehci_attach(device_t parent, device_t
 
        /* Platform dependent setup */
        if (usbc->sc_init_md_hook)
-               usbc->sc_init_md_hook(sc);
+               usbc->sc_init_md_hook(sc, usbc->sc_md_hook_data);
 
        imxehci_reset(sc);
        imxehci_select_interface(sc, sc->sc_iftype);
@@ -178,7 +178,7 @@ imxehci_attach(device_t parent, device_t
        }
 
        if (usbc->sc_setup_md_hook)
-               usbc->sc_setup_md_hook(sc, IMXUSB_HOST);
+               usbc->sc_setup_md_hook(sc, IMXUSB_HOST, usbc->sc_md_hook_data);
 
        if (sc->sc_iftype == IMXUSBC_IF_ULPI) {
 #if 0
@@ -202,7 +202,8 @@ imxehci_attach(device_t parent, device_t
        EOWRITE4(hsc, EHCI_USBINTR, 0);
 
        if (usbc->sc_intr_establish_md_hook)
-               sc->sc_ih = usbc->sc_intr_establish_md_hook(sc);
+               sc->sc_ih = usbc->sc_intr_establish_md_hook(sc,
+                   usbc->sc_md_hook_data);
        else if (aa->aa_irq > 0)
                sc->sc_ih = intr_establish(aa->aa_irq, IPL_USB, IST_LEVEL, ehci_intr, hsc);
        KASSERT(sc->sc_ih != NULL);
diff -r 6cfb478657b4 -r 17861ca69fbb sys/arch/arm/imx/imxusbvar.h
--- a/sys/arch/arm/imx/imxusbvar.h      Sun May 28 10:07:11 2023 +0000
+++ b/sys/arch/arm/imx/imxusbvar.h      Sun May 28 10:14:35 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: imxusbvar.h,v 1.6 2019/07/24 11:20:55 hkenken Exp $    */
+/*     $NetBSD: imxusbvar.h,v 1.6.28.1 2023/05/28 10:14:36 martin Exp $        */
 /*
  * Copyright (c) 2019  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -48,9 +48,11 @@ struct imxusbc_softc {
        bus_addr_t sc_ehci_offset;
        bus_size_t sc_ehci_size;
 
-       void (* sc_init_md_hook)(struct imxehci_softc *);
-       void *(* sc_intr_establish_md_hook)(struct imxehci_softc *);
-       void (* sc_setup_md_hook)(struct imxehci_softc *, enum imx_usb_role);
+       void (* sc_init_md_hook)(struct imxehci_softc *, uintptr_t);
+       void *(* sc_intr_establish_md_hook)(struct imxehci_softc *, uintptr_t);
+       void (* sc_setup_md_hook)(struct imxehci_softc *, enum imx_usb_role,
+                                 uintptr_t);
+       uintptr_t sc_md_hook_data;
 };
 
 struct imxusbc_attach_args {
diff -r 6cfb478657b4 -r 17861ca69fbb sys/arch/arm/nxp/files.imx
--- a/sys/arch/arm/nxp/files.imx        Sun May 28 10:07:11 2023 +0000
+++ b/sys/arch/arm/nxp/files.imx        Sun May 28 10:14:35 2023 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.imx,v 1.2 2022/07/20 10:01:10 riastradh Exp $
+#      $NetBSD: files.imx,v 1.2.4.1 2023/05/28 10:14:35 martin Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -10,6 +10,7 @@ defflag       opt_soc.h                               SOC_IMX
 defflag        opt_soc.h                               SOC_IMX6DL: SOC_IMX
 defflag        opt_soc.h                               SOC_IMX6Q: SOC_IMX
 defflag        opt_soc.h                               SOC_IMX6QDL: SOC_IMX
+defflag        opt_soc.h                               SOC_IMX6SX: SOC_IMX
 defflag        opt_soc.h                               SOC_IMX7D: SOC_IMX
 
 defflag opt_imx.h                              IMX6
@@ -17,9 +18,14 @@ defflag opt_imx.h                            IMX6
 # Clock
 device imx6ccm : clk
 attach imx6ccm at fdt
-file   arch/arm/nxp/imx6_ccm.c                 imx6ccm
 file   arch/arm/nxp/imx6_clk.c                 imx6ccm
 
+device imx6sxccm : clk
+attach imx6sxccm at fdt
+file   arch/arm/nxp/imx6sx_clk.c               imx6sxccm
+
+file   arch/arm/nxp/imx6_ccm.c                 imx6ccm | imx6sxccm
+
 # Common FDT clock framework
 define imx_ccm: clk
 file   arch/arm/nxp/imx_ccm.c                  imx_ccm
diff -r 6cfb478657b4 -r 17861ca69fbb sys/arch/arm/nxp/imx6_ccm.c
--- a/sys/arch/arm/nxp/imx6_ccm.c       Sun May 28 10:07:11 2023 +0000
+++ b/sys/arch/arm/nxp/imx6_ccm.c       Sun May 28 10:14:35 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: imx6_ccm.c,v 1.2 2022/09/27 06:36:42 skrll Exp $       */
+/*     $NetBSD: imx6_ccm.c,v 1.2.4.1 2023/05/28 10:14:35 martin Exp $  */
 
 /*
  * Copyright (c) 2010-2012, 2014  Genetec Corporation.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.2 2022/09/27 06:36:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.2.4.1 2023/05/28 10:14:35 martin Exp $");
 
 #include "opt_imx.h"
 #include "opt_cputypes.h"
@@ -52,845 +52,8 @@
 
 #include <dev/clk/clk_backend.h>
 
-/* Clock Parents Tables */
-static const char *step_p[] = {
-       "osc",
-       "pll2_pfd2_396m"
-};
-
-static const char *pll1_sw_p[] = {
-       "pll1_sys",
-       "step"
-};
-
-static const char *periph_pre_p[] = {
-       "pll2_bus",
-       "pll2_pfd2_396m",
-       "pll2_pfd0_352m",
-       "pll2_198m"
-};
-
-static const char *periph_clk2_p[] = {
-       "pll3_usb_otg",
-       "osc",
-       "osc",
-       "dummy"
-};
-
-static const char *periph2_clk2_p[] = {
-       "pll3_usb_otg",
-       "pll2_bus"
-};
-
-static const char *axi_p[] = {
-       "periph",
-       "pll2_pfd2_396m",
-       "periph",
-       "pll3_pfd1_540m"
-};
-
-static const char *audio_p[] = {
-       "pll4_audio_div",
-       "pll3_pfd2_508m",
-       "pll3_pfd3_454m",
-       "pll3_usb_otg"
-};
-
-static const char *gpu2d_core_p[] = {
-       "axi",
-       "pll3_usb_otg",
-       "pll2_pfd0_352m",
-       "pll2_pfd2_396m"
-};
-
-static const char *gpu3d_core_p[] = {
-       "mmdc_ch0_axi",
-       "pll3_usb_otg",
-       "pll2_pfd1_594m",
-       "pll2_pfd2_396m"
-};
-
-static const char *gpu3d_shader_p[] = {
-       "mmdc_ch0_axi",
-       "pll3_usb_otg",
-       "pll2_pfd1_594m",
-       "pll3_pfd0_720m"
-};
-
-static const char *ipu_p[] = {
-       "mmdc_ch0_axi",
-       "pll2_pfd2_396m",
-       "pll3_120m",
-       "pll3_pfd1_540m"
-};
-
-static const char *pll_bypass_src_p[] = {
-       "osc",
-       "lvds1_in",
-       "lvds2_in",
-       "dummy"
-};
-
-static const char *pll1_bypass_p[] = {
-       "pll1",
-       "pll1_bypass_src"
-};
-
-static const char *pll2_bypass_p[] = {
-       "pll2",
-       "pll2_bypass_src"
-};
-
-static const char *pll3_bypass_p[] = {
-       "pll3",
-       "pll3_bypass_src"
-};
-
-static const char *pll4_bypass_p[] = {
-       "pll4",
-       "pll4_bypass_src"
-};
-
-static const char *pll5_bypass_p[] = {
-       "pll5",
-       "pll5_bypass_src"
-};
-
-static const char *pll6_bypass_p[] = {
-       "pll6",
-       "pll6_bypass_src"
-};
-
-static const char *pll7_bypass_p[] = {
-       "pll7",
-       "pll7_bypass_src"
-};
-
-static const char *ipu_di_pre_p[] = {
-       "mmdc_ch0_axi",
-       "pll3_usb_otg",
-       "pll5_video_div",
-       "pll2_pfd0_352m",
-       "pll2_pfd2_396m",
-       "pll3_pfd1_540m"
-};
-
-static const char *ipu1_di0_p[] = {
-       "ipu1_di0_pre",
-       "dummy",
-       "dummy",
-       "ldb_di0",
-       "ldb_di1"
-};
-



Home | Main Index | Thread Index | Old Index