Date: Wed, 25 Nov 2020 19:10:20 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368029 - in head/sys: arm/freescale/imx modules/imx/imx6_snvs Message-ID: <202011251910.0APJAKTO074080@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Wed Nov 25 19:10:20 2020 New Revision: 368029 URL: https://svnweb.freebsd.org/changeset/base/368029 Log: Convert the imx6_snvs RTC driver to access registers via the syscon device. This is required for it to work correctly in the GENERIC kernel. Modified: head/sys/arm/freescale/imx/imx6_snvs.c head/sys/modules/imx/imx6_snvs/Makefile Modified: head/sys/arm/freescale/imx/imx6_snvs.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_snvs.c Wed Nov 25 19:08:22 2020 (r368028) +++ head/sys/arm/freescale/imx/imx6_snvs.c Wed Nov 25 19:10:20 2020 (r368029) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include <dev/ofw/ofw_bus_subr.h> #include "clock_if.h" +#include "syscon_if.h" #define SNVS_LPCR 0x38 /* Control register */ #define LPCR_LPCALB_VAL_SHIFT 10 /* Calibration shift */ @@ -68,13 +69,12 @@ __FBSDID("$FreeBSD$"); struct snvs_softc { device_t dev; - struct resource * memres; + struct syscon *syscon; uint32_t lpcr; }; static struct ofw_compat_data compat_data[] = { {"fsl,sec-v4.0-mon-rtc-lp", true}, - {"fsl,sec-v4.0-mon", true}, {NULL, false} }; @@ -82,14 +82,14 @@ static inline uint32_t RD4(struct snvs_softc *sc, bus_size_t offset) { - return (bus_read_4(sc->memres, offset)); + return (SYSCON_READ_4(sc->syscon, offset)); } static inline void WR4(struct snvs_softc *sc, bus_size_t offset, uint32_t value) { - bus_write_4(sc->memres, offset, value); + SYSCON_WRITE_4(sc->syscon, offset, value); } static void @@ -187,16 +187,12 @@ static int snvs_attach(device_t dev) { struct snvs_softc *sc; - int rid; sc = device_get_softc(dev); sc->dev = dev; - rid = 0; - sc->memres = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (sc->memres == NULL) { - device_printf(sc->dev, "could not allocate registers\n"); + if (syscon_get_handle_default(sc->dev, &sc->syscon) != 0) { + device_printf(sc->dev, "Cannot get syscon handle\n"); return (ENXIO); } @@ -212,7 +208,6 @@ snvs_detach(device_t dev) sc = device_get_softc(dev); clock_unregister(sc->dev); - bus_release_resource(sc->dev, SYS_RES_MEMORY, 0, sc->memres); return (0); } Modified: head/sys/modules/imx/imx6_snvs/Makefile ============================================================================== --- head/sys/modules/imx/imx6_snvs/Makefile Wed Nov 25 19:08:22 2020 (r368028) +++ head/sys/modules/imx/imx6_snvs/Makefile Wed Nov 25 19:10:20 2020 (r368029) @@ -11,5 +11,6 @@ SRCS+= \ clock_if.h \ device_if.h \ ofw_bus_if.h \ + syscon_if.h \ .include <bsd.kmod.mk>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011251910.0APJAKTO074080>