From patchwork Thu Nov 18 12:03:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1556595 X-Patchwork-Delegate: trini@ti.com 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=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=HeXyRsdU; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hvz3m2981z9s5P for ; Thu, 18 Nov 2021 23:04:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CB11982F85; Thu, 18 Nov 2021 13:03:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.b="HeXyRsdU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A22B482F8D; Thu, 18 Nov 2021 13:03:48 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3701582F50 for ; Thu, 18 Nov 2021 13:03:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-wr1-x42a.google.com with SMTP id r8so11054247wra.7 for ; Thu, 18 Nov 2021 04:03:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SLnfgTGOtkqtDiKGMAiB1i9Ys64A1EsQCveM7NZWM4Q=; b=HeXyRsdUCLtV+Fka9AB8tlu3e4qdfvn7pWcjAhB8w5rGfKwQOYv43ZjtI65FufYac6 8TUSTSi/8jYiTg7Lj0A1f811sjZ/hqY4khj1UNPdeJJJKCvUTmZTLiwgLpHSyRrULnvE ZlAISPbGWP56Iyvis1c4+f7DJuixczFc8dvrfao9UEMCxGSDnoEoHaF5NZGcDlWvxqBp yxDQr28p8j4TJkjiWEiCKLY/wTlOfWSoVXt+dLaMC2V7p7VquDSxw7PH7ngh7rU0WoM/ aVk8c8/htjAGASH3ZpCm3ywF28xMz6klGURM6z3RjzVGS5zTN+lJL+c62QEplP9hmYVh +myA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=SLnfgTGOtkqtDiKGMAiB1i9Ys64A1EsQCveM7NZWM4Q=; b=fMySHmvm/zvf8hmSBAZuvQupt+upX7Adx7rQvJApwoXllxeNQ52PgNz97OS/DaUrLM S+BAxuFZM4XP7h4VBzKbReO52aRNnAQeLPC6UPXjXv4llyQqbexIix338Hb3piJkxk+/ aH7BTeLDLZuDdM7gGlvP8eEsPXkh5p6LvtXkQPVPl6UL1S8WJH0tHJTRjx5//4k2eVJN Tf7oIryN/bHjNGUXJ5vGK9NLPQVH2izJc8LLDEpCpvhERIrqqwGiSWTBkVhbDajqYoQl TlYZ2go/t5wV4IdkxiTywmJPCyM1lEfw4Wq4G8l5Q9UZKmaCXtcMtFRvegy+A2CA2kSt QzJg== X-Gm-Message-State: AOAM531C0skEyGx/Gk+ecnpyAQuhnQGpzdiRAT9cKgELGEny5pL123PD vOspQUKpOI8OuxraKItxWu0YkcXgk/cPXg== X-Google-Smtp-Source: ABdhPJy69zQhK1j41WneZaoQlV/b//eLAr6wHPMsqtZV0Sm1Ekts5UNgbDFV6l0Lqlpf6HZepOxVuw== X-Received: by 2002:a05:6000:10c7:: with SMTP id b7mr31566346wrx.160.1637237024556; Thu, 18 Nov 2021 04:03:44 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6::45a]) by smtp.gmail.com with ESMTPSA id bg14sm1560551wmb.5.2021.11.18.04.03.43 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Nov 2021 04:03:44 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: Jaehoon Chung , Peng Fan Subject: [PATCH] sdhci: zynqmp: Setting up clock frequency based on DT Date: Thu, 18 Nov 2021 13:03:43 +0100 Message-Id: <3242152203c411968965488f622d0c0d2f036b57.1637237021.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.35 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Using clock-frequency property to define desired clock speed for controllers. Signed-off-by: Michal Simek --- drivers/mmc/zynq_sdhci.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index 5cea4c695e8d..ee87907939fe 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -58,6 +58,7 @@ struct arasan_sdhci_plat { struct arasan_sdhci_priv { struct sdhci_host *host; struct arasan_sdhci_clk_data clk_data; + u32 frequency; u8 deviceid; u8 bank; u8 no_1p8; @@ -721,6 +722,14 @@ static int arasan_sdhci_probe(struct udevice *dev) return ret; } + if (priv->frequency) { + ret = clk_set_rate(&clk, priv->frequency); + if (IS_ERR_VALUE(ret)) { + dev_err(dev, "failed to set clock rate\n"); + return ret; + } + } + clock = clk_get_rate(&clk); if (IS_ERR_VALUE(clock)) { dev_err(dev, "failed to get rate\n"); @@ -804,6 +813,7 @@ static int arasan_sdhci_of_to_plat(struct udevice *dev) if (IS_ERR(priv->host->ioaddr)) return PTR_ERR(priv->host->ioaddr); + priv->frequency = dev_read_u32_default(dev, "clock-frequency", 0); priv->deviceid = dev_read_u32_default(dev, "xlnx,device_id", -1); priv->bank = dev_read_u32_default(dev, "xlnx,mio-bank", 0); priv->no_1p8 = dev_read_bool(dev, "no-1-8-v");