From patchwork Sun Feb 9 11:05:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 1235418 X-Patchwork-Delegate: narmstrong@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Vq++snJy; dkim-atps=neutral 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48FmSg4t8Gz9sP7 for ; Sun, 9 Feb 2020 22:06:43 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E8CDD816BA; Sun, 9 Feb 2020 12:06:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Vq++snJy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A13348163C; Sun, 9 Feb 2020 12:06:19 +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=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) (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 708958067D for ; Sun, 9 Feb 2020 12:06:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=linux.amoon@gmail.com Received: by mail-pj1-x1042.google.com with SMTP id dw13so2906492pjb.4 for ; Sun, 09 Feb 2020 03:06:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=sslSgqoOrArq9v6myL25h/2/2jKeu71YeRQLrX2CkNE=; b=Vq++snJypyvBOnYRABifvkf0M5/NQ7x0duPjfilf50FlriQimG88Bri98qqQ6QLzCX YeJ7QNocTvgxiNyTkElW/j81hohzvTbpWTQKT792V7DHjE4LHAt7fZOA401O84FhkH/F Mfnh+EhaxNvAO4/vBoHnBjOdBqsdjbbHqq5SPXzgzb9vtJT7TC/WPASBkwLFn/uqUTT9 SiczIP9rr8I4cn12GE5M9sknTdaD20cOgoLF7Q2ktaqjICyuvfP71UAKZxvEKWPD+s2c oxBxUSJbheUb0FMIdNSQe0Ty3HqV960jHWE/jN4lNew09uy4oV3iQIbRIjc9IPKxN3dU 80uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sslSgqoOrArq9v6myL25h/2/2jKeu71YeRQLrX2CkNE=; b=cePfylCE1by5bgpdeuZQHCk8HWgcC0VVnNCA+44qyD6mXzs1FwkNS3dg33wUlfugyu 7EVQt/1XLQThlDQG7bYW1rFkyqo4pUZaLv3JxY6zgyMMWZo8kaJFgdSh1XmBe53J8uh6 et6bjsWQd6oT3JPnqF9E91IdI4QfbCEbF+lTSUZzjdr3+jaOwJ2VAoHl8KD1F8HXqE/S +Pb27JYX9yPFxeSgFnQDSYC7BwC7nPr+fpfAIj893L8E20PcTM3rY/Jxt4AWEpnodJFr DuGYwSJXXknMe+Zkxbw/natZGj+RsG5yJ1hsY7HhjmSuWhaD8o9CIGQxpFIL1+T0mxod Rb8Q== X-Gm-Message-State: APjAAAVbLqT8GfaYFA/nOFRbapPc3sVC1lGAi/u1EbJRn3NmsEjT/TIh swOMKuP8kU6fLV3IUUIRD4I= X-Google-Smtp-Source: APXvYqzBZbqiaRVVXn6HE2jyBoX2rFivUSko+ZmdJRxsVm3ktWoT1pq7wlIksrB8Uila/L3oHwVNEQ== X-Received: by 2002:a17:902:a710:: with SMTP id w16mr7806102plq.43.1581246373586; Sun, 09 Feb 2020 03:06:13 -0800 (PST) Received: from localhost.localdomain ([45.114.62.33]) by smtp.gmail.com with ESMTPSA id fz21sm8238648pjb.15.2020.02.09.03.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Feb 2020 03:06:13 -0800 (PST) From: Anand Moon To: Neil Armstrong , Jerome Brunet , Peng Fan , Jaehoon Chung , u-boot-amlogic@groups.io, u-boot@lists.denx.de Subject: [PATCHv6 2/5] mmc: meson-gx: Use proper compatible string as per the dts Date: Sun, 9 Feb 2020 11:05:54 +0000 Message-Id: <20200209110557.1996-3-linux.amoon@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200209110557.1996-1-linux.amoon@gmail.com> References: <20200209110557.1996-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 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.101.4 at phobos.denx.de X-Virus-Status: Clean Use proper compatible string as per the dts so that mmc driver could be tuned properly. SoC family S905, S905X have common clk tuning parameters setting, while AGX and G12 have common clk tuning parameters setting for mmc driver. Suggested-by: Neil Armstrong Signed-off-by: Anand Moon Reviewed-by: Neil Armstrong --- No changes. --- arch/arm/include/asm/arch-meson/sd_emmc.h | 7 ++++ drivers/mmc/meson_gx_mmc.c | 46 +++++++++++++++++------ 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/arch/arm/include/asm/arch-meson/sd_emmc.h b/arch/arm/include/asm/arch-meson/sd_emmc.h index f4299485dc..83142d5d3f 100644 --- a/arch/arm/include/asm/arch-meson/sd_emmc.h +++ b/arch/arm/include/asm/arch-meson/sd_emmc.h @@ -13,6 +13,12 @@ #define SDIO_PORT_B 1 #define SDIO_PORT_C 2 +enum mmc_compatible { + MMC_COMPATIBLE_GXBB, + MMC_COMPATIBLE_GX, + MMC_COMPATIBLE_AXG, +}; + #define SD_EMMC_CLKSRC_24M 24000000 /* 24 MHz */ #define SD_EMMC_CLKSRC_DIV2 1000000000 /* 1 GHz */ @@ -87,6 +93,7 @@ struct meson_mmc_platdata { struct mmc_config cfg; struct mmc mmc; + int compat; void *regbase; void *w_buf; }; diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c index b013c7c5fb..1aefe360c4 100644 --- a/drivers/mmc/meson_gx_mmc.c +++ b/drivers/mmc/meson_gx_mmc.c @@ -37,7 +37,8 @@ static inline void meson_write(struct mmc *mmc, uint32_t val, int offset) writel(val, get_regbase(mmc) + offset); } -static void meson_mmc_config_clock(struct mmc *mmc) +static void meson_mmc_config_clock(struct mmc *mmc, + struct meson_mmc_platdata *pdata) { uint32_t meson_mmc_clk = 0; unsigned int clk, clk_src, clk_div; @@ -66,14 +67,20 @@ static void meson_mmc_config_clock(struct mmc *mmc) /* RX clock phase 0:180 */ meson_mmc_clk |= FIELD_PREP(CLK_RX_PHASE_MASK, CLK_PHASE_0); -#ifdef CONFIG_MESON_GX - /* clk always on */ - meson_mmc_clk |= CLK_V2_ALWAYS_ON; -#endif -#if (defined(CONFIG_MESON_AXG) || defined(CONFIG_MESON_G12A)) - /* clk always on */ - meson_mmc_clk |= CLK_V3_ALWAYS_ON; -#endif + switch (pdata->compat) { + case MMC_COMPATIBLE_GXBB: + case MMC_COMPATIBLE_GX: + /* clk always on */ + meson_mmc_clk |= CLK_V2_ALWAYS_ON; + break; + case MMC_COMPATIBLE_AXG: + /* clk always on */ + meson_mmc_clk |= CLK_V3_ALWAYS_ON; + break; + default: + debug("no compatible supported"); + break; + } /* clock settings */ meson_mmc_clk |= clk_src; @@ -85,9 +92,11 @@ static void meson_mmc_config_clock(struct mmc *mmc) static int meson_dm_mmc_set_ios(struct udevice *dev) { struct mmc *mmc = mmc_get_mmc_dev(dev); + struct meson_mmc_platdata *pdata = + (struct meson_mmc_platdata *)dev_get_driver_data(dev); uint32_t meson_mmc_cfg; - meson_mmc_config_clock(mmc); + meson_mmc_config_clock(mmc, pdata); meson_mmc_cfg = meson_read(mmc, MESON_SD_EMMC_CFG); @@ -324,9 +333,22 @@ int meson_mmc_bind(struct udevice *dev) return mmc_bind(dev, &pdata->mmc, &pdata->cfg); } +static const struct meson_mmc_platdata gxbb_data = { + .compat = MMC_COMPATIBLE_GXBB, +}; + +static const struct meson_mmc_platdata gx_data = { + .compat = MMC_COMPATIBLE_GX, +}; + +static const struct meson_mmc_platdata axg_data = { + .compat = MMC_COMPATIBLE_AXG, +}; + static const struct udevice_id meson_mmc_match[] = { - { .compatible = "amlogic,meson-gx-mmc" }, - { .compatible = "amlogic,meson-axg-mmc" }, + { .compatible = "amlogic,meson-gxbb-mmc", .data = (ulong)&gxbb_data }, + { .compatible = "amlogic,meson-gx-mmc", .data = (ulong)&gx_data }, + { .compatible = "amlogic,meson-axg-mmc", .data = (ulong)&axg_data }, { /* sentinel */ } };