From patchwork Fri Nov 12 12:04:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 1554287 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=GB21CmdR; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HrHM35TXrz9sRK for ; Fri, 12 Nov 2021 23:04:30 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mlVI1-0006mt-Gq; Fri, 12 Nov 2021 12:04:17 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mlVHy-0006lj-Kb for kernel-team@lists.ubuntu.com; Fri, 12 Nov 2021 12:04:14 +0000 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 730E13F176 for ; Fri, 12 Nov 2021 12:04:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1636718654; bh=zulaFsxGQcmSOGC2WqUrWDPoPSfIfsouRNd1LB2KSDk=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GB21CmdRha7fpI93CxtA+0tr4LD4+9wnba5s9BL8zS1tFUsBBayjU02LDamApvzLW qpEACbshOWbu6Sjd/2Cck/MT/NC6Ilc20sLq5Ya55ivbmVONt0hoQ6eJ7ifZD5yGe6 a2aQsd+syqxtlJH57jHsfyW3gKDlYTyzbBn1AgX6zgw1+NVCPu4nyjn9dSi1wXzsgH 89gNVzo+gASKTg01xIE+SxgaMatcd2/D0ysVGt5owdWqeJVPHpWY1m5fpqQeqEGIil /lBxouxa2ReOjMbwh/jFW7Es6z3h5ZYQ4X7bUA2Ifu2rmZ7v8DCskz9FV7v6jA3YrW rTiXsBGQ9MbrA== Received: by mail-ed1-f71.google.com with SMTP id i22-20020a05640242d600b003e28aecc0afso8097914edc.1 for ; Fri, 12 Nov 2021 04:04:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zulaFsxGQcmSOGC2WqUrWDPoPSfIfsouRNd1LB2KSDk=; b=cMfLJ2SvZPuQI4SYqQSIoOjHBXqg+SGGhNu6UiZpoNXwPjpul5OtJpigLDJyspdC4+ uUKrYUno4XWFxlb9SiecrMqUHfzFrYFYff6Fhm0HKmiMRAozeuAuPyk9+vM9UytWLEdS aIZRDWg6I7qH3tkUClFzq1lnhVtjFwROS8JCqVa5mSieOMLCzCGvoZSvsnjaJcC3DPqY 5f5ZGXNlJ4uIyzzCOchHcaT5NOWpzRFxWdISWI1jnHHUtQoecyEmJ8m2HSPSw+9wxB9Y uL6Fl16d8oyqGXazOzezluUFyoPNnt81PqihpPsEDkTSKdbPo5lR2lcLkRYH3x+3A7Cb oyrg== X-Gm-Message-State: AOAM532SVOkEt581sBDjPn6+fOkbWK2dpeY1XXINrqvgZN0WqTslxQiL 8lfzSicKGQ/DGuWBrRmevYHanEL2DeGGiZTSrcwt7S70TtRKQ8YVfqb969mGd4opNFby10STslz Iv5mXfqQ+Swvt2pBE/bBQfj6Qa6jnnLdhwxyg16m6WQ== X-Received: by 2002:a17:906:4dd0:: with SMTP id f16mr11899125ejw.454.1636718654209; Fri, 12 Nov 2021 04:04:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyiYjX/0j/OgXFv2sFIYAtS1xyK+VvqZ13pRr+VbjECxy8bHjhDp9yPOtm6pxOBByQByT++tw== X-Received: by 2002:a17:906:4dd0:: with SMTP id f16mr11899108ejw.454.1636718654043; Fri, 12 Nov 2021 04:04:14 -0800 (PST) Received: from gollum.fritz.box ([194.191.244.86]) by smtp.gmail.com with ESMTPSA id b2sm2961443edv.73.2021.11.12.04.04.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 04:04:13 -0800 (PST) From: Juerg Haefliger X-Google-Original-From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [SRU][H/raspi][PATCH 2/5] mmc: sdhost: Pass DT pointer to rpi_firmware_get Date: Fri, 12 Nov 2021 13:04:08 +0100 Message-Id: <20211112120411.1541681-3-juergh@canonical.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211112120411.1541681-1-juergh@canonical.com> References: <20211112120411.1541681-1-juergh@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Phil Elwell BugLink: https://bugs.launchpad.net/bugs/1950064 Using the rpi_firmware API as intended allows proper reference counting of the firmware device and means we can remove a downstream patch to the firmware driver. Signed-off-by: Phil Elwell (cherry picked from commit 491b5c65cbed7d30cc2b3e5a6e724dcff0865809 linux-rpi) Signed-off-by: Juerg Haefliger --- drivers/mmc/host/bcm2835-sdhost.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c index 7caba5e12f79..2c4124082785 100644 --- a/drivers/mmc/host/bcm2835-sdhost.c +++ b/drivers/mmc/host/bcm2835-sdhost.c @@ -147,6 +147,8 @@ struct bcm2835_host { spinlock_t lock; + struct rpi_firmware *fw; + void __iomem *ioaddr; phys_addr_t bus_addr; @@ -1558,7 +1560,7 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) if (host->firmware_sets_cdiv) { u32 msg[3] = { clock, 0, 0 }; - rpi_firmware_property(rpi_firmware_get(NULL), + rpi_firmware_property(host->fw, RPI_FIRMWARE_SET_SDHOST_CLOCK, &msg, sizeof(msg)); @@ -2100,6 +2102,13 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) goto err; } + host->fw = rpi_firmware_get( + of_parse_phandle(dev->of_node, "firmware", 0)); + if (!host->fw) { + ret = -EPROBE_DEFER; + goto err; + } + host->max_clk = clk_get_rate(clk); host->irq = platform_get_irq(pdev, 0); @@ -2124,7 +2133,7 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) msg[1] = ~0; msg[2] = ~0; - rpi_firmware_property(rpi_firmware_get(NULL), + rpi_firmware_property(host->fw, RPI_FIRMWARE_SET_SDHOST_CLOCK, &msg, sizeof(msg)); @@ -2142,6 +2151,8 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) err: pr_debug("bcm2835_sdhost_probe -> err %d\n", ret); + if (host->fw) + rpi_firmware_put(host->fw); if (host->dma_chan_rxtx) dma_release_channel(host->dma_chan_rxtx); mmc_free_host(mmc); @@ -2164,6 +2175,7 @@ static int bcm2835_sdhost_remove(struct platform_device *pdev) del_timer_sync(&host->timer); tasklet_kill(&host->finish_tasklet); + rpi_firmware_put(host->fw); if (host->dma_chan_rxtx) dma_release_channel(host->dma_chan_rxtx); mmc_free_host(host->mmc);