Date: Mon, 11 Sep 2017 01:01:01 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323410 - in stable/11/sys: arm/freescale/imx dev/ffec Message-ID: <201709110101.v8B111bg033184@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Mon Sep 11 01:01:00 2017 New Revision: 323410 URL: https://svnweb.freebsd.org/changeset/base/323410 Log: MFC r316664, r316670, r316972, r316996, r317033: Add imx6ul support (applies to all files). Add code/constants for detecting imx6ul (ultralite) chips, a species of imx6 based on a single cortex-a7 core. Other changes to imx6 drivers and support code are needed to fully support the imx6ul. if_ffec: Add imx6ul SoC support, and get the PHY number from the FDT data. If there is no phy-handle property, fall back to using MII_PHY_ANY. This still doesn't support an mdio bus with multiple PHYs on it, or the possibility that the PHY being used by this instance of ffec is on the mdio bus of some other instance (which is now a possibility with imx6ul). Adding that support will require changes in fdt_get_phyaddr(), which is currently making some assumptions that don't work with modern fdt data. Modified: stable/11/sys/arm/freescale/imx/imx6_machdep.c stable/11/sys/arm/freescale/imx/imx6_usbphy.c stable/11/sys/arm/freescale/imx/imx_gpt.c stable/11/sys/arm/freescale/imx/imx_iomux.c stable/11/sys/arm/freescale/imx/imx_machdep.h stable/11/sys/dev/ffec/if_ffec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_machdep.c Mon Sep 11 00:55:18 2017 (r323409) +++ stable/11/sys/arm/freescale/imx/imx6_machdep.c Mon Sep 11 01:01:00 2017 (r323410) @@ -99,8 +99,8 @@ fix_fdt_interrupt_data(void) gicnode = OF_finddevice("/soc/interrupt-controller@00a01000"); if (gicnode == -1) { gicnode = OF_finddevice("/interrupt-controller@00a01000"); - if (gicnode == -1) - return; + if (gicnode == -1) + return; } gicxref = OF_xref_from_node(gicnode); @@ -233,6 +233,7 @@ u_int imx_soc_type() #define HWSOC_MX6DL 0x61 #define HWSOC_MX6SOLO 0x62 #define HWSOC_MX6Q 0x63 +#define HWSOC_MX6UL 0x64 if (soctype != 0) return (soctype); @@ -271,6 +272,9 @@ u_int imx_soc_type() case HWSOC_MX6Q : soctype = IMXSOC_6Q; break; + case HWSOC_MX6UL: + soctype = IMXSOC_6UL; + break; default: printf("imx_soc_type: Don't understand hwsoc 0x%02x, " "digprog 0x%08x; assuming IMXSOC_6Q\n", hwsoc, digprog); @@ -317,3 +321,4 @@ static platform_method_t imx6_methods[] = { FDT_PLATFORM_DEF2(imx6, imx6s, "i.MX6 Solo", 0, "fsl,imx6s", 0); FDT_PLATFORM_DEF2(imx6, imx6d, "i.MX6 Dual", 0, "fsl,imx6dl", 0); FDT_PLATFORM_DEF2(imx6, imx6q, "i.MX6 Quad", 0, "fsl,imx6q", 0); +FDT_PLATFORM_DEF2(imx6, imx6ul, "i.MX6 UltraLite", 0, "fsl,imx6ul", 0); Modified: stable/11/sys/arm/freescale/imx/imx6_usbphy.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_usbphy.c Mon Sep 11 00:55:18 2017 (r323409) +++ stable/11/sys/arm/freescale/imx/imx6_usbphy.c Mon Sep 11 01:01:00 2017 (r323410) @@ -68,6 +68,12 @@ struct usbphy_softc { u_int phy_num; }; +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6q-usbphy", true}, + {"fsl,imx6ul-usbphy", true}, + {NULL, false} +}; + static int usbphy_detach(device_t dev) { @@ -167,7 +173,7 @@ usbphy_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (ofw_bus_is_compatible(dev, "fsl,imx6q-usbphy") == 0) + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) return (ENXIO); device_set_desc(dev, "Freescale i.MX6 USB PHY"); Modified: stable/11/sys/arm/freescale/imx/imx_gpt.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_gpt.c Mon Sep 11 00:55:18 2017 (r323409) +++ stable/11/sys/arm/freescale/imx/imx_gpt.c Mon Sep 11 01:01:00 2017 (r323410) @@ -112,6 +112,7 @@ static struct resource_spec imx_gpt_spec[] = { static struct ofw_compat_data compat_data[] = { {"fsl,imx6dl-gpt", 1}, {"fsl,imx6q-gpt", 1}, + {"fsl,imx6ul-gpt", 1}, {"fsl,imx53-gpt", 1}, {"fsl,imx51-gpt", 1}, {"fsl,imx31-gpt", 1}, @@ -125,6 +126,15 @@ imx_gpt_probe(device_t dev) { if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + /* + * We only support a single unit, because the only thing this driver + * does with the complex timer hardware is supply the system + * timecounter and eventtimer. There is nothing useful we can do with + * the additional device instances that exist in some chips. + */ + if (device_get_unit(dev) > 0) return (ENXIO); if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { Modified: stable/11/sys/arm/freescale/imx/imx_iomux.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_iomux.c Mon Sep 11 00:55:18 2017 (r323409) +++ stable/11/sys/arm/freescale/imx/imx_iomux.c Mon Sep 11 01:01:00 2017 (r323410) @@ -80,6 +80,7 @@ static struct ofw_compat_data compat_data[] = { {"fsl,imx6dl-iomuxc", true}, {"fsl,imx6q-iomuxc", true}, {"fsl,imx6sl-iomuxc", true}, + {"fsl,imx6ul-iomuxc", true}, {"fsl,imx6sx-iomuxc", true}, {"fsl,imx53-iomuxc", true}, {"fsl,imx51-iomuxc", true}, @@ -223,6 +224,9 @@ iomux_attach(device_t dev) case IMXSOC_6SL: case IMXSOC_6Q: sc->last_gpreg = 13; + break; + case IMXSOC_6UL: + sc->last_gpreg = 14; break; default: device_printf(dev, "Unknown SoC type\n"); Modified: stable/11/sys/arm/freescale/imx/imx_machdep.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_machdep.h Mon Sep 11 00:55:18 2017 (r323409) +++ stable/11/sys/arm/freescale/imx/imx_machdep.h Mon Sep 11 01:01:00 2017 (r323410) @@ -55,6 +55,7 @@ void imx_wdog_init_last_reset(vm_offset_t _wdsr_phys); #define IMXSOC_6DL 0x61000000 #define IMXSOC_6S 0x62000000 #define IMXSOC_6Q 0x63000000 +#define IMXSOC_6UL 0x64000000 #define IMXSOC_FAMSHIFT 28 u_int imx_soc_type(void); Modified: stable/11/sys/dev/ffec/if_ffec.c ============================================================================== --- stable/11/sys/dev/ffec/if_ffec.c Mon Sep 11 00:55:18 2017 (r323409) +++ stable/11/sys/dev/ffec/if_ffec.c Mon Sep 11 01:01:00 2017 (r323410) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include <net/if_var.h> #include <net/if_vlan_var.h> +#include <dev/fdt/fdt_common.h> #include <dev/ffec/if_ffecreg.h> #include <dev/ofw/ofw_bus.h> #include <dev/ofw/ofw_bus_subr.h> @@ -113,6 +114,7 @@ static struct ofw_compat_data compat_data[] = { {"fsl,imx51-fec", FECTYPE_GENERIC}, {"fsl,imx53-fec", FECTYPE_IMX53}, {"fsl,imx6q-fec", FECTYPE_IMX6 | FECFLAG_GBE}, + {"fsl,imx6ul-fec", FECTYPE_IMX6}, {"fsl,mvf600-fec", FECTYPE_MVF}, {"fsl,mvf-fec", FECTYPE_MVF}, {NULL, FECTYPE_NONE}, @@ -1424,8 +1426,9 @@ ffec_attach(device_t dev) struct ffec_softc *sc; struct ifnet *ifp = NULL; struct mbuf *m; + void *dummy; phandle_t ofw_node; - int error, rid; + int error, phynum, rid; uint8_t eaddr[ETHER_ADDR_LEN]; char phy_conn_name[32]; uint32_t idx, mscr; @@ -1695,8 +1698,11 @@ ffec_attach(device_t dev) ffec_miigasket_setup(sc); /* Attach the mii driver. */ + if (fdt_get_phyaddr(ofw_node, dev, &phynum, &dummy) != 0) { + phynum = MII_PHY_ANY; + } error = mii_attach(dev, &sc->miibus, ifp, ffec_media_change, - ffec_media_status, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + ffec_media_status, BMSR_DEFCAPMASK, phynum, MII_OFFSET_ANY, (sc->fectype & FECTYPE_MVF) ? MIIF_FORCEANEG : 0); if (error != 0) { device_printf(dev, "PHY attach failed\n");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709110101.v8B111bg033184>