From nobody Mon Mar 07 16:00:12 2022 X-Original-To: dev-commits-src-all@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 5559819F764D; Mon, 7 Mar 2022 16:00:13 +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 4KC37w6thRz4SCd; Mon, 7 Mar 2022 16:00:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646668813; 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=crVeNeVlj9JyS0lXHDC1kAcIB6N7xxDhfkFr3fp1q/I=; b=MVJ8w7iDh9SZi1k1ev/uqYecYZCctVd3xmrnH/T7BGkXnIIuvCJhnDFomxlA7kn3+uEmud cdSIGwDnUCai2dj4YiHJW37OUGAxtP9eeKdS/47TrFDnUxYxk3/fN/VQ/62ROE+lz7qV6c tAuQzizWK3kZ24I6fYG3xI2O7UPe2i3EjzuKQjGU/bkbUGzLbkLOAdc+g7mNU7D5Lvz/gI 96Vi7eZgEcAIOW5bpGfBa/nPn08t91pctiGiq4GYa0or/RO4vWI2GlKLjSBxgLffX8dfRr z76ho5uttl6UeyBF8+f/wLdiKLMZ9O6qa7ulCHvjX07h6v2LPLFlvTCeGujoog== 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 53CEB3394; Mon, 7 Mar 2022 16:00:12 +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 227G0COS067725; Mon, 7 Mar 2022 16:00:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 227G0Cql067718; Mon, 7 Mar 2022 16:00:12 GMT (envelope-from git) Date: Mon, 7 Mar 2022 16:00:12 GMT Message-Id: <202203071600.227G0Cql067718@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Marcin Wojtas Subject: git: 1b19617e9662 - stable/13 - sdhci_xenon: remove redundant code in property parsing List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 1b19617e9662fec655ff23bcc7a65c26f5fdaa46 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646668813; 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=crVeNeVlj9JyS0lXHDC1kAcIB6N7xxDhfkFr3fp1q/I=; b=x6zVG8PAdq85IvzC/XGYrC/CGi0zU12Pdo+1r0iVYWHcaSN+4HnCekVmqBRAdisq5LYCRm sjVioPEEWXOZF3IjQd9lil/RVZfw/nRlx3rlJCSnSBhCTNf0qFfmTsyL9G/nQ7hw5gPrks d9qUbLX/JvxrhUfLSI/MbkBqabMa6fgYjUseLzo+ZCY8JU/hDe1QfU9Bf8IG6RWRVQV5ZI lA2d3N2706RfjqGnG1nqOkz2I6tq7yR/u0mlq5UlBTHPEepbZLC7I31IFEXriGTeXUi1HF 42sVWYQs6m9U04bY7a+NfldCYrPBZKj8i9Z02c8Gv8fsj5G1ms2JR/dBrgdB3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646668813; a=rsa-sha256; cv=none; b=YJJOXhj0o7vXh7qm3E67QhZbK9ZABP0PsSFtVybNhEj3/+xLe9mp+Dwn+q8zUy5bhcTst9 TVKvUzeWFaMoAMTja4sCFA5Imcsc4arpJ07RPOZneYzHxCW/knrm71iD1g83ynmadtMHod mHYnHRLk+emH7eVry1qQf5uGBDbeGlb1hQIKrQYaQM0rymTi2+3AHsr2s07eJpb7JT+GgU ukTPeZKJ1fxNlkLugIs70GElGkP6udfrHhz0Ayzbwl8y69T8hgyXRa/lLsGOrn4UH362aV GjaL0zwWWjjjNvVtpe2ae40n60bO/4EGmSoYf2YPvakt5dJMJpp7njPusMbuhQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=1b19617e9662fec655ff23bcc7a65c26f5fdaa46 commit 1b19617e9662fec655ff23bcc7a65c26f5fdaa46 Author: Bartlomiej Grzesik AuthorDate: 2021-07-15 15:20:46 +0000 Commit: Marcin Wojtas CommitDate: 2022-03-07 15:59:51 +0000 sdhci_xenon: remove redundant code in property parsing Remove redundant ofw property parsing in driver code, is already taken care of in mmc_fdt_helpers. Move ofw parsing to attach method. Reviewed by: manu Sponsored by: Semihalf Differential Revision: https://reviews.freebsd.org/D31409 (cherry picked from commit 6ad816a999171874c36c73d5794d0d25ff8fd311) --- sys/dev/sdhci/sdhci_xenon.c | 69 +++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/sys/dev/sdhci/sdhci_xenon.c b/sys/dev/sdhci/sdhci_xenon.c index 10cbc5991119..b6f7513245eb 100644 --- a/sys/dev/sdhci/sdhci_xenon.c +++ b/sys/dev/sdhci/sdhci_xenon.c @@ -83,9 +83,6 @@ struct sdhci_xenon_softc { device_t dev; /* Controller device */ int slot_id; /* Controller ID */ phandle_t node; /* FDT node */ - uint32_t quirks; /* Chip specific quirks */ - uint32_t caps; /* If we override SDHCI_CAPABILITIES */ - uint32_t max_clk; /* Max possible freq */ struct resource *irq_res; /* IRQ resource */ void *intrhand; /* Interrupt handle */ struct sdhci_fdt_gpio *gpio; /* GPIO pins for CD detection. */ @@ -95,7 +92,6 @@ struct sdhci_xenon_softc { uint8_t znr; /* PHY ZNR */ uint8_t zpr; /* PHY ZPR */ - bool no_18v; /* No 1.8V support */ bool slow_mode; /* PHY slow mode */ struct mmc_fdt_helper mmc_helper; /* MMC helper for parsing FDT */ @@ -509,32 +505,17 @@ sdhci_xenon_switch_vccq(device_t brdev, device_t reqdev) } } -static int -sdhci_xenon_probe(device_t dev) +static void +sdhci_xenon_fdt_parse(device_t dev, struct sdhci_slot *slot) { struct sdhci_xenon_softc *sc = device_get_softc(dev); pcell_t cid; - sc->quirks = 0; - sc->slot_id = 0; - sc->max_clk = XENON_MMC_MAX_CLK; - - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) - return (ENXIO); - - sc->node = ofw_bus_get_node(dev); - device_set_desc(dev, "Armada Xenon SDHCI controller"); + mmc_fdt_parse(dev, 0, &sc->mmc_helper, &slot->host); /* Allow dts to patch quirks, slots, and max-frequency. */ if ((OF_getencprop(sc->node, "quirks", &cid, sizeof(cid))) > 0) - sc->quirks = cid; - if ((OF_getencprop(sc->node, "max-frequency", &cid, sizeof(cid))) > 0) - sc->max_clk = cid; - if (OF_hasprop(sc->node, "no-1-8-v")) - sc->no_18v = true; + slot->quirks = cid; if (OF_hasprop(sc->node, "marvell,xenon-phy-slow-mode")) sc->slow_mode = true; sc->znr = XENON_ZNR_DEF_VALUE; @@ -545,6 +526,18 @@ sdhci_xenon_probe(device_t dev) if ((OF_getencprop(sc->node, "marvell,xenon-phy-zpr", &cid, sizeof(cid))) > 0) sc->zpr = cid & XENON_ZPR_MASK; +} + +static int +sdhci_xenon_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Armada Xenon SDHCI controller"); return (0); } @@ -558,6 +551,8 @@ sdhci_xenon_attach(device_t dev) uint32_t reg; sc->dev = dev; + sc->slot_id = 0; + sc->node = ofw_bus_get_node(dev); /* Allocate IRQ. */ rid = 0; @@ -581,34 +576,34 @@ sdhci_xenon_attach(device_t dev) slot = malloc(sizeof(*slot), M_DEVBUF, M_ZERO | M_WAITOK); + /* + * Set up any gpio pin handling described in the FDT data. This cannot + * fail; see comments in sdhci_fdt_gpio.h for details. + */ + sc->gpio = sdhci_fdt_gpio_setup(dev, slot); + + sdhci_xenon_fdt_parse(dev, slot); + + slot->max_clk = XENON_MMC_MAX_CLK; + if (slot->host.f_max > 0) + slot->max_clk = slot->host.f_max; /* Check if the device is flagged as non-removable. */ - if (OF_hasprop(sc->node, "non-removable")) { + if (sc->mmc_helper.props & MMC_PROP_NON_REMOVABLE) { slot->opt |= SDHCI_NON_REMOVABLE; if (bootverbose) device_printf(dev, "Non-removable media\n"); } - slot->quirks = sc->quirks; - slot->caps = sc->caps; - slot->max_clk = sc->max_clk; sc->slot = slot; - /* - * Set up any gpio pin handling described in the FDT data. This cannot - * fail; see comments in sdhci_fdt_gpio.h for details. - */ - sc->gpio = sdhci_fdt_gpio_setup(dev, slot); - - mmc_fdt_parse(dev, 0, &sc->mmc_helper, &sc->slot->host); - if (sdhci_init_slot(dev, sc->slot, 0)) goto fail; /* 1.2V signaling is not supported. */ sc->slot->host.caps &= ~MMC_CAP_SIGNALING_120; - /* Disable UHS in case of lack of 1.8V VCCQ or the PHY slow mode. */ - if (sc->no_18v || sc->slow_mode) + /* Disable UHS in case of the PHY slow mode. */ + if (sc->slow_mode) sc->slot->host.caps &= ~MMC_CAP_SIGNALING_180; /* Activate the interrupt */