From nobody Mon Aug 08 04:43:36 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M1Nr86hftz4Yv4n; Mon, 8 Aug 2022 04:43:36 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M1Nr852Xnz4G2h; Mon, 8 Aug 2022 04:43:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659933816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Df8rQwkBy6QtF+u1na7rKW8etEDkRlHxfX1ucfH/O9k=; b=OlPLGp4wYSaziPOWEGHnt8hODSGtLvwqhMU3YCjUN0Um4czkUHZewPFCf8BlHeKRiBDscb 2RU5P/2XSduVzcjpXp4UAAVp6k2MimntY8bB/u+Z8OzcauQCJF6uSo9URlHf+YAc5bUnqP mSDw+KtTOo0dSexJRizlNae2LpexdF7vpFs6iO2ZhhD1ZMuO+mY+1H4qaYHcsqmVMUvjzU BIzoo70p21DyE+SQfA+Fz1HfthJqLix/7YSLRJTg9bsd4OprAagVzfKUhUwRG7mLDEte2G ZfO2Ml6CPhsDH11ttuQxPEnjZeVWMCCh2NcN9oIcOv7I/oD9X73dJDBiVhYfGA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M1Nr846CMzfjR; Mon, 8 Aug 2022 04:43:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2784ha5f028671; Mon, 8 Aug 2022 04:43:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2784halm028670; Mon, 8 Aug 2022 04:43:36 GMT (envelope-from git) Date: Mon, 8 Aug 2022 04:43:36 GMT Message-Id: <202208080443.2784halm028670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ganbold Tsagaankhuu Subject: git: 5db5bd5f3987 - main - Add drive strength setting for RK3568 pinctrl driver. Partially from https://reviews.freebsd.org/D36027 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ganbold X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5db5bd5f39871facd0c633b7d1e98931eb57d442 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659933816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Df8rQwkBy6QtF+u1na7rKW8etEDkRlHxfX1ucfH/O9k=; b=Ht/1ziHlZM/MqomwEFFCM0Nl43swR+AuYt51Tx2ElbBrnvkHuljFbXP06M81Lz1GxJzhgv jUa5cZRi2DvNp85qFg7MSDEJZ07KJ8mpfenylo4/jnz+uF25LpSc0WxUzldtbme51GwQbp 1fgnieGD17ZUKClVWHDrjCJqVsnWiHMNDs5GZYOzxY9RzX4J0ykeTX8uXErWDkW5zN20y7 ETU4Vtq5IrMMp7EHfv4TRV/M3tne7YaYC8GcZdsVqxiS8/njYx+o/YbUrBi8jQljayIerR 8ycxu6BMFs4wGO3ASSmtNmbHLHDHeU+5qeMF9+HXaH1GyIl3pwU7e/zeL/+AEg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659933816; a=rsa-sha256; cv=none; b=uDYYRM4t/yKh7MALYyvaeix/Y4+s8Lftv24AG1Cs7YmIHdUKASC09vOZyeYwezyEjJzx9r 64JNOjxyhYAmGRZgoLaTvgGVdHkVrkutdF+WRA/yz3e6DrBIKRKLoH8Q/J/pvMyDZhoFI1 yxNDCxQAAieFLqg4lYXg3sLtY243y8nFQeyhyBOYXDbI5W/ZH8QxbUWsv3bYS7n3zGrshA Nm+AixsK27nXF04+5dazslCjxUHKrCgJvcSEmMIzzB7n+YVx417uAkhUG4AAjTM021ZoL4 QLZm0Z5vXsX4DsFjk7613GV9KDO0Dm57czz1LQod08wFi2Znz7eb5OIUF8It6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by ganbold: URL: https://cgit.FreeBSD.org/src/commit/?id=5db5bd5f39871facd0c633b7d1e98931eb57d442 commit 5db5bd5f39871facd0c633b7d1e98931eb57d442 Author: Ganbold Tsagaankhuu AuthorDate: 2022-08-08 04:42:22 +0000 Commit: Ganbold Tsagaankhuu CommitDate: 2022-08-08 04:42:22 +0000 Add drive strength setting for RK3568 pinctrl driver. Partially from https://reviews.freebsd.org/D36027 Submitted by: sos --- sys/arm64/rockchip/rk_pinctrl.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/sys/arm64/rockchip/rk_pinctrl.c b/sys/arm64/rockchip/rk_pinctrl.c index ae633f052a21..6d0d93aee439 100644 --- a/sys/arm64/rockchip/rk_pinctrl.c +++ b/sys/arm64/rockchip/rk_pinctrl.c @@ -1171,11 +1171,31 @@ rk_pinctrl_configure_pin(struct rk_pinctrl_softc *sc, uint32_t *pindata) } /* Then drive strength */ - rv = rk_pinctrl_parse_drive(sc, pin_conf, bank, subbank, &drive, ®); - if (rv == 0) { - bit = (pin % 8) * 2; - mask = (0x3 << bit); - SYSCON_MODIFY_4(syscon, reg, mask, drive << bit | (mask << 16)); + if (ofw_bus_node_is_compatible(ofw_bus_get_node(sc->dev), + "rockchip,rk3568-pinctrl")) { + uint32_t value; + if (OF_getencprop(pin_conf, "drive-strength", &value, + sizeof(value)) == 0) { + if (bank) + reg = 0x01c0 + (bank * 0x40) + (pin / 2 * 4); + else + reg = 0x0070 + (pin / 2 * 4); + + drive = ((1 << (value + 1)) - 1) << (pin % 2); + + mask = 0x3f << (pin % 2);; + + SYSCON_WRITE_4(syscon, reg, drive | (mask << 16)); + } + } else { + rv = rk_pinctrl_parse_drive(sc, pin_conf, bank, subbank, &drive, + ®); + if (rv == 0) { + bit = (pin % 8) * 2; + mask = (0x3 << bit); + SYSCON_MODIFY_4(syscon, reg, mask, + drive << bit | (mask << 16)); + } } /* Finally set the pin function */