From patchwork Sat Feb 17 10:01:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 773878 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83C241C69F; Sat, 17 Feb 2024 10:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708164141; cv=none; b=QJ6oIVGgA53oAcpKGS6VoqiNtC+KLwRApe4CRln6qJO0/LqhWEJvtb+eaLx+PJKQ4NdbrBIBdYUK3IiCYtsl9l07kDYI9OJ0BtvOFS7PRoGC918oceV0jT6X+y8hTy8BXw76ujEeGVfCDV1+MKywbDBjCble/G7t+ZQ164MtFwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708164141; c=relaxed/simple; bh=USFCdbHyoE8FKG3GAqIj7/95rop2cgT/ZVVdnVi+iQg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UReHqVt3LBbZWNAhlhj/wPlyD+v3m/4mtiTCvtzF+Tpp3tudXAylndgF9v3jOeE5kxytDXp9pb/pa+cBEU2eoOy0Tb+k3cDOdXE5M4y8hLqa0PUaSHvejP1JLA1kbYm6sv7XA846std0U8OSyZBQ0bhJjnH+2ZmbezC/TTOBaZ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com; spf=pass smtp.mailfrom=googlemail.com; dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=fxHMZSJZ; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=googlemail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="fxHMZSJZ" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a3de25186fbso164053166b.0; Sat, 17 Feb 2024 02:02:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20230601; t=1708164134; x=1708768934; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3ZM66OWGdF6SbtT/QLY8tKqxblTioRIXbDjnM5RGQoM=; b=fxHMZSJZugBa6NBkOjCCOBIlcIKcfLmcPPjlHm43IvKp0NHKKEahswCttp7CZOWwbQ B4SQgZhDl7lGkihp7MsAuGwUR1EreMgctd9CcRi/3PucY5X+ncCVzOhqnUKsVQ+0wlz6 EV8SLle20BvJNn640Qw7B0avj3/d/SpNM8HMCkvuUM9UBuTs67gGfFznGOCmvaS/W0DA AgbrKeatPJEmmr+/GJACkS+bx2BQj840rtxU7JDPDiu5TLI24kJ0o4SzUajZXLeqyBYz +uLWwOO1WeF9IyVrCiamup1i2YFkaGoCGy7GmkDo5EFM3qUqgvlkPpUxMoScOCNNUMZB JihA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708164134; x=1708768934; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3ZM66OWGdF6SbtT/QLY8tKqxblTioRIXbDjnM5RGQoM=; b=DMWpjMym3hkLL3gHfRNBHgtzIwZAQ84eV+H7e9WLFtPVKB6jeg9YF2WUxlWMXRUnE2 fy6dDA3ltpNkrU2kwouVHYALmbWYMvgSHI8q4aSgs9eb/iJMRlO0/ETgjit3geIYG82w nvU0fwkRX1KeERdNb5KD1Wmc0FQm5hyZPWeTHEArkTr01tmRZLoCwDhdYr6onLWatH8w RsK7lPp4VInsJ92v0fHM8lyYtkGzPeT6uDFMZrN+Qvo/7R+6IcgnkdAhWZP6cxI6CgcJ jrmffDZ2whptTGFnWQQZUpgsIp1ZL1285ot0SL9iqFxWfwojLGa9C5xGXMnZqmNmmptv 5oBQ== X-Forwarded-Encrypted: i=1; AJvYcCX3mpjX1pCs+GaQ/YyukTXcYGhXfr5yh6C1LHkz+20OlSyjMoj31JQ7qJww/BSzcTn7FIFBFXEnJhwg/NpGnbRpvqG2eNKdxcMawp3vQKJX1oYKGHUI61cJ7eT7XVMuvUsP5PCZzPVy X-Gm-Message-State: AOJu0Yxd94DLg9i1bRkImkdLfsSi+YYYH2TlpKm++jsT0HGZm4dnrV3j pwdZChmdkPd7QVMwDVsK5pM461iBX4gAlG0m163wFXmPIa3ww8oT0Em1f74b X-Google-Smtp-Source: AGHT+IH8aFNkKOjHk2QaX+mE3vWKGtqusxEFTd96jtkQJfQEqeUCvx3ptfcS86lAFFLwTWbc4nxtwA== X-Received: by 2002:a17:906:abce:b0:a3e:13f3:e1ab with SMTP id kq14-20020a170906abce00b00a3e13f3e1abmr890687ejb.3.1708164133432; Sat, 17 Feb 2024 02:02:13 -0800 (PST) Received: from localhost.localdomain (dynamic-2a01-0c23-c18b-3d00-0000-0000-0000-0e63.c23.pool.telefonica.de. [2a01:c23:c18b:3d00::e63]) by smtp.googlemail.com with ESMTPSA id vu2-20020a170907a64200b00a3d2e690abfsm832444ejc.122.2024.02.17.02.02.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 02:02:13 -0800 (PST) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-mmc@vger.kernel.org, ulf.hansson@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Blumenstingl Subject: [PATCH v1 1/2] mmc: meson-mx-sdhc: Use devm_clk_hw_get_clk() for clock retrieval Date: Sat, 17 Feb 2024 11:01:59 +0100 Message-ID: <20240217100200.1494980-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240217100200.1494980-1-martin.blumenstingl@googlemail.com> References: <20240217100200.1494980-1-martin.blumenstingl@googlemail.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Now that devm_clk_hw_get_clk() has been available for a while we can resolve an older TODO where this API did not exist yet. No functional changes intended. Signed-off-by: Martin Blumenstingl --- drivers/mmc/host/meson-mx-sdhc-clkc.c | 43 ++++++++++++++------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/drivers/mmc/host/meson-mx-sdhc-clkc.c b/drivers/mmc/host/meson-mx-sdhc-clkc.c index 19200b7079a6..cbd17a596cd2 100644 --- a/drivers/mmc/host/meson-mx-sdhc-clkc.c +++ b/drivers/mmc/host/meson-mx-sdhc-clkc.c @@ -71,12 +71,23 @@ static int meson_mx_sdhc_clk_hw_register(struct device *dev, static int meson_mx_sdhc_gate_clk_hw_register(struct device *dev, const char *name_suffix, struct clk_hw *parent, - struct clk_hw *hw) + struct clk_hw *hw, + struct clk_bulk_data *clk_bulk_data, + u8 bulk_index) { struct clk_parent_data parent_data = { .hw = parent }; + int ret; + + ret = meson_mx_sdhc_clk_hw_register(dev, name_suffix, &parent_data, 1, + &clk_gate_ops, hw); + if (ret) + return ret; + + clk_bulk_data[bulk_index].clk = devm_clk_hw_get_clk(dev, hw, name_suffix); + if (IS_ERR(clk_bulk_data[bulk_index].clk)) + return PTR_ERR(clk_bulk_data[bulk_index].clk); - return meson_mx_sdhc_clk_hw_register(dev, name_suffix, &parent_data, 1, - &clk_gate_ops, hw); + return 0; } int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base, @@ -115,7 +126,8 @@ int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base, clkc_data->mod_clk_en.bit_idx = 15; ret = meson_mx_sdhc_gate_clk_hw_register(dev, "mod_clk_on", &clkc_data->div.hw, - &clkc_data->mod_clk_en.hw); + &clkc_data->mod_clk_en.hw, + clk_bulk_data, 0); if (ret) return ret; @@ -123,7 +135,8 @@ int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base, clkc_data->tx_clk_en.bit_idx = 14; ret = meson_mx_sdhc_gate_clk_hw_register(dev, "tx_clk_on", &clkc_data->div.hw, - &clkc_data->tx_clk_en.hw); + &clkc_data->tx_clk_en.hw, + clk_bulk_data, 1); if (ret) return ret; @@ -131,7 +144,8 @@ int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base, clkc_data->rx_clk_en.bit_idx = 13; ret = meson_mx_sdhc_gate_clk_hw_register(dev, "rx_clk_on", &clkc_data->div.hw, - &clkc_data->rx_clk_en.hw); + &clkc_data->rx_clk_en.hw, + clk_bulk_data, 2); if (ret) return ret; @@ -139,18 +153,7 @@ int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base, clkc_data->sd_clk_en.bit_idx = 12; ret = meson_mx_sdhc_gate_clk_hw_register(dev, "sd_clk_on", &clkc_data->div.hw, - &clkc_data->sd_clk_en.hw); - if (ret) - return ret; - - /* - * TODO: Replace clk_hw.clk with devm_clk_hw_get_clk() once that is - * available. - */ - clk_bulk_data[0].clk = clkc_data->mod_clk_en.hw.clk; - clk_bulk_data[1].clk = clkc_data->sd_clk_en.hw.clk; - clk_bulk_data[2].clk = clkc_data->tx_clk_en.hw.clk; - clk_bulk_data[3].clk = clkc_data->rx_clk_en.hw.clk; - - return 0; + &clkc_data->sd_clk_en.hw, + clk_bulk_data, 3); + return ret; } From patchwork Sat Feb 17 10:02:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 774017 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0900A1CAA5; Sat, 17 Feb 2024 10:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708164141; cv=none; b=FiUetxSgwnh40kk5iPKrzaLHK1t0eR9m7b7eREoYqzFnqTwiE+eXsQ5f8tS+hqPr8/RCAp3OJxmSzIe18MkMFv2zoenKMuUxfXXZg2pxIXfL300B/VBcmLZW2CXgxnRQqeCD3ArnLIt2Oqc47es3+QLfiLuzFAiKKgedKm3URao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708164141; c=relaxed/simple; bh=c7c1Q3/20PbpOtZUY4apUCKgz6BG6WLPvFsA+YNlXP0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jl0Uysgbcbh6mJaLATJsqqSin5AqanPilkkA4GeEAwRIXMTTw8Ggprienc0DYSkG+QGMxRAU8o8DNPL04FYi4a6pXHTc8BfWdGAiMueavDPyMDFo1syqI0ZGjAyZ06HtgcRcO1UZe1vAQH+GoUivjfRhMguUYb3G0EydlwJ/eCw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com; spf=pass smtp.mailfrom=googlemail.com; dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=UIIUWUCS; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=googlemail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="UIIUWUCS" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a2f79e79f0cso426924766b.2; Sat, 17 Feb 2024 02:02:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20230601; t=1708164134; x=1708768934; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nqfx68Stq1v6Qf4tIPhse4R7f6lQzjIJhU0OnU94194=; b=UIIUWUCSQLDGpM2qU+d8pfLd7YjfRehKfr7N11eQc5S3EHfZNMejDfQqutXuGRr9Om WfOl/OFU6g4nS7cRT6ewI2a1qdF+FvTKuP56z8d+eyGFJ8hn99YIIkia2GL/Pgf468p3 peijXMuXCLiLJ16E9P2j2uf/UQH7FPKeVgH5eRolokWUJMumE+hmzODJNvQzbHv9ARKy eRMftZ23e+TzWk8rOtRaFYK0zk5Z/blIb6BsFx0mgZnFC5lrjkmNQOK6ALPeKANQvbZM 0oaRKkKW/hVSqfqvN4Vw3koOiOKi/VsC/O9N5XvLct6S8o/fTw+bop/lSIHDxv0b1kcz 6INA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708164134; x=1708768934; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nqfx68Stq1v6Qf4tIPhse4R7f6lQzjIJhU0OnU94194=; b=r60UKr7KBgDwbx5T/N38CeX+iI06uSJ1rd8sycb02b3JebPj46qvyWPPexSNa6EPQe HwjVXl+U/fpK+jZdF1KRCXkLj7QLpmAz1xWKR7lPHvrEpCnRE6maq/moqE7fgl8LsT3r oja205CW0jyn+b5QgzLkvI1yI1Ux8jQM7NdV+z7XYBkKHrab5btBjaZVqFzwnzXqM7HZ OW7xI6RFs5zBg81nd6G5PZ6M0W40Wi2aU5uIpua7ON0kUE6dVIvFREj8kB1cOAtO+Tpn MJYaaUDrQi1J/3W8MvvIT6+D84qe6kH7FOUt3yW2mukN7x05jEfwZBw64wvLIWcRCL2x DdkA== X-Forwarded-Encrypted: i=1; AJvYcCV/+aTxZZfvppDlPpx8lgW2CYG44n1DMeWFMtw25rFvHhqOEYqxn7RmE1uaPtiOezU1Tzph2l75fNw3nB6o9AuypvJBrdTIrZcLMZspICyjtol3mPHB+kifiaBPxKKdfvJdzUm0Vy0v X-Gm-Message-State: AOJu0YzxOjt4byl8W8Wpj/qQf4GwgEgwRfLSNf/7Extwdl0joz86oKGW u5D5/qLBbljMyrtgvSrtOLwPnbLueqAgDffN4kwLbC+gx32xVUKK X-Google-Smtp-Source: AGHT+IEb82KoWpU5FoV1SEo4/+fKxZ4+uJYz6Hsw8ouQNl0/LXhPOmil04C+qDwX+A36tj5/j83VzA== X-Received: by 2002:a17:906:694b:b0:a3d:590:195e with SMTP id c11-20020a170906694b00b00a3d0590195emr6136810ejs.4.1708164134317; Sat, 17 Feb 2024 02:02:14 -0800 (PST) Received: from localhost.localdomain (dynamic-2a01-0c23-c18b-3d00-0000-0000-0000-0e63.c23.pool.telefonica.de. [2a01:c23:c18b:3d00::e63]) by smtp.googlemail.com with ESMTPSA id vu2-20020a170907a64200b00a3d2e690abfsm832444ejc.122.2024.02.17.02.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 02:02:13 -0800 (PST) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-mmc@vger.kernel.org, ulf.hansson@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Blumenstingl Subject: [PATCH v1 2/2] mmc: meson-mx-sdhc: Remove .card_hw_reset callback Date: Sat, 17 Feb 2024 11:02:00 +0100 Message-ID: <20240217100200.1494980-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240217100200.1494980-1-martin.blumenstingl@googlemail.com> References: <20240217100200.1494980-1-martin.blumenstingl@googlemail.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit 32f18e596141 ("mmc: improve API to make clear hw_reset callback is for cards") made it clear that the hw_reset callback is intended for resetting the card. Remove the .card_hw_reset callback from the meson-mx-sdhc-mmc driver because it's purpose is to reset the SDHC controller (FIFOs, PHY, DMA interface, ...). While here also rename and change the argument of meson_mx_sdhc_hw_reset so it cannot be called by accident as a replacement for card_hw_reset in the future. Signed-off-by: Martin Blumenstingl --- drivers/mmc/host/meson-mx-sdhc-mmc.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c index 1ed9731e77ef..31f750301dc1 100644 --- a/drivers/mmc/host/meson-mx-sdhc-mmc.c +++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c @@ -65,10 +65,8 @@ static const struct regmap_config meson_mx_sdhc_regmap_config = { .max_register = MESON_SDHC_CLK2, }; -static void meson_mx_sdhc_hw_reset(struct mmc_host *mmc) +static void meson_mx_sdhc_reset(struct meson_mx_sdhc_host *host) { - struct meson_mx_sdhc_host *host = mmc_priv(mmc); - regmap_write(host->regmap, MESON_SDHC_SRST, MESON_SDHC_SRST_MAIN_CTRL | MESON_SDHC_SRST_RXFIFO | MESON_SDHC_SRST_TXFIFO | MESON_SDHC_SRST_DPHY_RX | MESON_SDHC_SRST_DPHY_TX | @@ -116,7 +114,7 @@ static void meson_mx_sdhc_wait_cmd_ready(struct mmc_host *mmc) dev_warn(mmc_dev(mmc), "Failed to poll for CMD_BUSY while processing CMD%d\n", host->cmd->opcode); - meson_mx_sdhc_hw_reset(mmc); + meson_mx_sdhc_reset(host); } ret = regmap_read_poll_timeout(host->regmap, MESON_SDHC_ESTA, esta, @@ -127,7 +125,7 @@ static void meson_mx_sdhc_wait_cmd_ready(struct mmc_host *mmc) dev_warn(mmc_dev(mmc), "Failed to poll for ESTA[13:11] while processing CMD%d\n", host->cmd->opcode); - meson_mx_sdhc_hw_reset(mmc); + meson_mx_sdhc_reset(host); } } @@ -495,7 +493,6 @@ static int meson_mx_sdhc_execute_tuning(struct mmc_host *mmc, u32 opcode) } static const struct mmc_host_ops meson_mx_sdhc_ops = { - .card_hw_reset = meson_mx_sdhc_hw_reset, .request = meson_mx_sdhc_request, .set_ios = meson_mx_sdhc_set_ios, .card_busy = meson_mx_sdhc_card_busy, @@ -618,7 +615,7 @@ static irqreturn_t meson_mx_sdhc_irq_thread(int irq, void *irq_data) } if (cmd->error == -EIO || cmd->error == -ETIMEDOUT) - meson_mx_sdhc_hw_reset(host->mmc); + meson_mx_sdhc_reset(host); else if (cmd->data) /* * Clear the FIFOs after completing data transfers to prevent @@ -728,7 +725,7 @@ static void meson_mx_sdhc_init_hw(struct mmc_host *mmc) { struct meson_mx_sdhc_host *host = mmc_priv(mmc); - meson_mx_sdhc_hw_reset(mmc); + meson_mx_sdhc_reset(host); regmap_write(host->regmap, MESON_SDHC_CTRL, FIELD_PREP(MESON_SDHC_CTRL_RX_PERIOD, 0xf) |