From owner-svn-src-all@freebsd.org Wed Apr 29 13:43:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D361A2B4D9A; Wed, 29 Apr 2020 13:43:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C08M5H1Rz4DbS; Wed, 29 Apr 2020 13:43:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B060C65C2; Wed, 29 Apr 2020 13:43:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TDhFka019157; Wed, 29 Apr 2020 13:43:15 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TDhFfN019156; Wed, 29 Apr 2020 13:43:15 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202004291343.03TDhFfN019156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 29 Apr 2020 13:43:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360461 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 360461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 13:43:15 -0000 Author: mmel Date: Wed Apr 29 13:43:15 2020 New Revision: 360461 URL: https://svnweb.freebsd.org/changeset/base/360461 Log: Multiple fixes for rockchip iodomain driver: - always initialize selector of voltage signaling standard. Various versions of U-boot leaves voltage signaling standard settings for PMUIO2 domain in different state. Always initialize it into expected state. - start the driver as early as possible, the IO domains should be initialized before other drivers are attached. - rename RK3399 register to its name founds in TRM. This is the second part of fixes for serial port corruption observed after DT 5.6 import. Reviewed by: manu MFC after: 1 week Modified: head/sys/arm64/rockchip/rk_iodomain.c Modified: head/sys/arm64/rockchip/rk_iodomain.c ============================================================================== --- head/sys/arm64/rockchip/rk_iodomain.c Wed Apr 29 13:41:32 2020 (r360460) +++ head/sys/arm64/rockchip/rk_iodomain.c Wed Apr 29 13:43:15 2020 (r360461) @@ -45,17 +45,20 @@ __FBSDID("$FreeBSD$"); #define RK3288_GRF_IO_VSEL 0x380 #define RK3399_GRF_IO_VSEL 0xe640 -#define RK3399_PMUGRF_IO_VSEL 0x180 +#define RK3399_PMUGRF_SOC_CON0 0x180 struct rk_iodomain_supply { char *name; uint32_t bit; }; +struct rk_iodomain_softc; + struct rk_iodomain_conf { struct rk_iodomain_supply *supply; int nsupply; uint32_t grf_reg; + void (*init)(struct rk_iodomain_softc *sc); }; struct rk_iodomain_softc { @@ -101,10 +104,12 @@ static struct rk_iodomain_supply rk3399_pmu_supply[] = {"pmu1830-supply", 9}, }; +static void rk3399_pmu_init(struct rk_iodomain_softc *sc); static struct rk_iodomain_conf rk3399_pmu_conf = { .supply = rk3399_pmu_supply, .nsupply = nitems(rk3399_pmu_supply), - .grf_reg = RK3399_PMUGRF_IO_VSEL, + .grf_reg = RK3399_PMUGRF_SOC_CON0, + .init = rk3399_pmu_init, }; static struct ofw_compat_data compat_data[] = { @@ -115,6 +120,14 @@ static struct ofw_compat_data compat_data[] = { }; static void +rk3399_pmu_init(struct rk_iodomain_softc *sc) +{ + + SYSCON_WRITE_4(sc->grf, RK3399_PMUGRF_SOC_CON0, + (1 << 8) | (1 << (8 + 16))); /* set pmu1830_volsel */ +} + +static void rk_iodomain_set(struct rk_iodomain_softc *sc) { regulator_t supply; @@ -141,6 +154,8 @@ rk_iodomain_set(struct rk_iodomain_softc *sc) } SYSCON_WRITE_4(sc->grf, sc->conf->grf_reg, reg | mask); + if (sc->conf->init != NULL) + sc->conf->init(sc); } static int @@ -204,4 +219,4 @@ static driver_t rk_iodomain_driver = { static devclass_t rk_iodomain_devclass; EARLY_DRIVER_MODULE(rk_iodomain, simplebus, rk_iodomain_driver, - rk_iodomain_devclass, 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); + rk_iodomain_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE);