From owner-dev-commits-src-main@freebsd.org Fri May 7 01:49:32 2021 Return-Path: Delivered-To: dev-commits-src-main@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 83BAC634414; Fri, 7 May 2021 01:49:32 +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 4Fbtfh39sPz3JFM; Fri, 7 May 2021 01:49:32 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5B35122C24; Fri, 7 May 2021 01:49:32 +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 1471nWdn032319; Fri, 7 May 2021 01:49:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1471nWpn032318; Fri, 7 May 2021 01:49:32 GMT (envelope-from git) Date: Fri, 7 May 2021 01:49:32 GMT Message-Id: <202105070149.1471nWpn032318@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: d5b20eaafc0b - main - sdhci_fsl_fdt: specify base clk divisor per SoC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d5b20eaafc0bd8668e5deb8d2b4043c25df4134b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 01:49:32 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=d5b20eaafc0bd8668e5deb8d2b4043c25df4134b commit d5b20eaafc0bd8668e5deb8d2b4043c25df4134b Author: Marcin Wojtas AuthorDate: 2021-05-07 01:45:22 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-07 01:48:54 +0000 sdhci_fsl_fdt: specify base clk divisor per SoC Only LS1046A and LS1028A require the base clk to be divided by 2. Implement that by moving the divider to a SoC specific data. This commit fixes base clk setup for the entire SoC family, including the already suported LS2160A. Submitted by: Lukasz Hajec Reviewed by: manu Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30120 --- sys/dev/sdhci/sdhci_fsl_fdt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/dev/sdhci/sdhci_fsl_fdt.c b/sys/dev/sdhci/sdhci_fsl_fdt.c index d9b7d1954a1d..167c28b60ca0 100644 --- a/sys/dev/sdhci/sdhci_fsl_fdt.c +++ b/sys/dev/sdhci/sdhci_fsl_fdt.c @@ -108,14 +108,17 @@ struct sdhci_fsl_fdt_softc { struct sdhci_fsl_fdt_soc_data { int quirks; + int baseclk_div; }; static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_ls1046a_soc_data = { - .quirks = SDHCI_QUIRK_DONT_SET_HISPD_BIT | SDHCI_QUIRK_BROKEN_AUTO_STOP + .quirks = SDHCI_QUIRK_DONT_SET_HISPD_BIT | SDHCI_QUIRK_BROKEN_AUTO_STOP, + .baseclk_div = 2, }; static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_gen_data = { .quirks = 0, + .baseclk_div = 1, }; static const struct ofw_compat_data sdhci_fsl_fdt_compat_data[] = { @@ -511,7 +514,7 @@ sdhci_fsl_fdt_attach(device_t dev) goto err_free_irq; } - sc->baseclk_hz = clk_hz / 2; + sc->baseclk_hz = clk_hz / sc->soc_data->baseclk_div; /* Figure out eSDHC block endianness before we touch any HW regs. */ if (OF_hasprop(node, "little-endian")) { @@ -537,8 +540,9 @@ sdhci_fsl_fdt_attach(device_t dev) WR4(sc, SDHCI_FSL_PROT_CTRL, val | buf_order); /* - * Gate the SD clock and set its source to peripheral clock / 2. - * The frequency in baseclk_hz is set to match this. + * Gate the SD clock and set its source to + * peripheral clock / baseclk_div. The frequency in baseclk_hz is set + * to match this. */ val = RD4(sc, SDHCI_CLOCK_CONTROL); WR4(sc, SDHCI_CLOCK_CONTROL, val & ~SDHCI_FSL_CLK_SDCLKEN);