Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67739C433EF for ; Wed, 6 Apr 2022 15:29:44 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9C97D83DC7; Wed, 6 Apr 2022 17:29:41 +0200 (CEST) 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="W/jkVgYJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DE6C583DCB; Wed, 6 Apr 2022 17:29:39 +0200 (CEST) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) (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 9F53D83C76 for ; Wed, 6 Apr 2022 17:29:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jbx6244@gmail.com Received: by mail-ed1-x535.google.com with SMTP id r10so3098826eda.1 for ; Wed, 06 Apr 2022 08:29:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=ghqUmyl6+4ykUZ++n997uzjhsnWqJfk1GHFWcOGN/Hs=; b=W/jkVgYJS9pvAM0M/TAxNNhZiu8CWT40ZcrEg176tnuRAstpcZ8qzsHp87S40lpkQi eLMk+5riTYnbgclSCozCOKN4Hw6MXNRRhcbmTvqDis6ySXCaX+/B6u56cVF3B+yX4rF+ b9T24U4z49UM77sHeu3+ilYTqJAVB/+CsERpkVo9vgSqPUVyqluOM9LOMy1ZNLDP1ni+ odjdXITuYSUYToXJDSKHsm1m/sxwk1cyu/kcF3G6iys6zo0/isHQLhmGAEbcXqKnpv9f hH169JzpbduR/ju1vYyjyf9Fqof93JLffsHAcfUXUS6k31L1JoT1BA1L3w1yy/Mb3hMf ieyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=ghqUmyl6+4ykUZ++n997uzjhsnWqJfk1GHFWcOGN/Hs=; b=U//5BR3GU1QZwq6oDSVBFxhBLh1iEmJp6UhxCpgAEJpVTVtuDy62dlIFr/4dQ64IXB gMRgjbbw8pRjr1+dPB7rnnU6yCOS+z+E0ex7WjE6F9UwpgEWAmP7p9tfbbpUcgFtbdmt nE1lHFgFTr4DbyV8C59MjCba+UVRTyjJusyVB2usXYZiPoKFwhCl5LPlT1PjxTSyDdUn eRpBM8grS6lReMOZOHw3KOchVvAhv9dtTMK7SezerpR1rnssTkvQjZGhHqYsS3AqHigD dky4bPz2/O/QUjHXYid4X3xyO6LOggLvWE9PL8DmaYcwsVBMXISBUzNFBUI5gI76hboB qvWg== X-Gm-Message-State: AOAM531gB0ANfCwyTw0jIeE/aUiQnEtvnNvlrDYaY67Zn5AU3md511wZ fPxeUqvLaZiik0aD66AJZpQ= X-Google-Smtp-Source: ABdhPJzPaU/Gexp3TDPKtNwlgHxYC++C2gRmspUikW1pEvjclLibQK+3fnkOgnagKJ5nMKHMVUB7iA== X-Received: by 2002:a05:6402:34c4:b0:419:e00e:64c1 with SMTP id w4-20020a05640234c400b00419e00e64c1mr9396008edc.88.1649258976078; Wed, 06 Apr 2022 08:29:36 -0700 (PDT) Received: from [192.168.2.1] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id hp11-20020a1709073e0b00b006dfd53a0e39sm6685774ejc.135.2022.04.06.08.29.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Apr 2022 08:29:35 -0700 (PDT) Message-ID: <4884951c-b93c-2fff-42e9-8c25fbacd932@gmail.com> Date: Wed, 6 Apr 2022 17:29:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v4 09/12] rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support Content-Language: en-US To: Kever Yang Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, heiko@sntech.de, peng.fan@nxp.com, jh80.chung@samsung.com, u-boot@lists.denx.de References: <20220403230659.12039-1-jbx6244@gmail.com> <20220403230659.12039-10-jbx6244@gmail.com> From: Johan Jonker In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 at phobos.denx.de X-Virus-Status: Clean Hi, On 4/6/22 16:50, Kever Yang wrote: > Hi Johan, > > On 2022/4/4 07:06, Johan Jonker wrote: >> The Rockchip SoCs rk3066/rk3188 have mmc DT nodes >> with as compatible string "rockchip,rk2928-dw-mshc". >> Add support to the existing driver with help of >> a DM_DRIVER_ALIAS. >> >> This type needs a permanent enabled fifo. >> The other Rockchip SoCs not always have the property >> "fifo-mode" in the TPL/SPL DT nodes, so dtplat structures >> can't be used to switch it on. > > There is an option "u-boot,spl-fifo-mode", which already used for many > SoCs, > > could you try with it? Rk3066 SPL makes use of dt-plat.c to describe the DT, because of memory size and it's BOOTROM doesn't have build-in SD card support like the later models. u-boot-tpl.bin : 25,112 bytes u-boot-spl.bin : 39,280 bytes u-boot-dtb.img : 328,678 bytes Example rockchip_dwmmc_probe function: old: priv->fifo_mode = 0; vs. new: priv->fifo_mode = dtplat->u_boot_spl_fifo_mode The use of u_boot_spl_fifo_mode in C code would make it a requirement for other SoC types to include it in "static struct dtd_rockchip_rk3288_dw_mshc" as well: .u_boot_spl_fifo_mode = false, Please advise how to get progress here as. Kind regards, Johan === static struct dtd_rockchip_rk3288_dw_mshc dtv_mmc_at_10214000 = { .bus_width = 0x4, .cap_mmc_highspeed = true, .cap_sd_highspeed = true, .clock_frequency = 0x2faf080, .clocks = { {0, {448}}, {0, {72}},}, .dma_names = "rx-tx", .dmas = {0xa, 0x1}, .fifo_depth = 0x100, .fifo_mode = true, .max_frequency = 0x3d0900, .reg = {0x10214000, 0x1000}, .reset_names = "reset", .resets = {0x2, 0x51}, .u_boot_spl_fifo_mode = true, .vmmc_supply = 0xf, }; U_BOOT_DRVINFO(mmc_at_10214000) = { .name = "rockchip_rk3288_dw_mshc", .plat = &dtv_mmc_at_10214000, .plat_size = sizeof(dtv_mmc_at_10214000), .parent_idx = -1, }; > > > Thanks, > > - Kever > >> Add a data structure linked to the compatible string >> to enable. >> >> Signed-off-by: Johan Jonker >> --- >> >> Changed V4: >>    use boolean >> --- >>   drivers/mmc/rockchip_dw_mmc.c | 16 +++++++++++++--- >>   1 file changed, 13 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/mmc/rockchip_dw_mmc.c >> b/drivers/mmc/rockchip_dw_mmc.c >> index be065ec0c3..45488dd7bd 100644 >> --- a/drivers/mmc/rockchip_dw_mmc.c >> +++ b/drivers/mmc/rockchip_dw_mmc.c >> @@ -19,6 +19,11 @@ >>   #include >>   #include >>   +enum rockchip_dwmmc_type { >> +    RK2928_MSHC, >> +    RK3288_MSHC, >> +}; >> + >>   struct rockchip_mmc_plat { >>   #if CONFIG_IS_ENABLED(OF_PLATDATA) >>       struct dtd_rockchip_rk3288_dw_mshc dtplat; >> @@ -111,6 +116,7 @@ static int rockchip_dwmmc_probe(struct udevice *dev) >>     #if CONFIG_IS_ENABLED(OF_PLATDATA) >>       struct dtd_rockchip_rk3288_dw_mshc *dtplat = &plat->dtplat; >> +    enum rockchip_dwmmc_type type = dev_get_driver_data(dev); >>         host->name = dev->name; >>       host->ioaddr = map_sysmem(dtplat->reg[0], dtplat->reg[1]); >> @@ -119,7 +125,10 @@ static int rockchip_dwmmc_probe(struct udevice *dev) >>       host->priv = dev; >>       host->dev_index = 0; >>       priv->fifo_depth = dtplat->fifo_depth; >> -    priv->fifo_mode = 0; >> +    if (type == RK2928_MSHC) >> +        priv->fifo_mode = true; >> +    else >> +        priv->fifo_mode = false; >>       priv->minmax[0] = 400000;  /*  400 kHz */ >>       priv->minmax[1] = dtplat->max_frequency; >>   @@ -163,8 +172,8 @@ static int rockchip_dwmmc_bind(struct udevice *dev) >>   } >>     static const struct udevice_id rockchip_dwmmc_ids[] = { >> -    { .compatible = "rockchip,rk2928-dw-mshc" }, >> -    { .compatible = "rockchip,rk3288-dw-mshc" }, >> +    { .compatible = "rockchip,rk2928-dw-mshc", .data = RK2928_MSHC }, >> +    { .compatible = "rockchip,rk3288-dw-mshc", .data = RK3288_MSHC }, >>       { } >>   }; >>   @@ -180,5 +189,6 @@ U_BOOT_DRIVER(rockchip_rk3288_dw_mshc) = { >>       .plat_auto    = sizeof(struct rockchip_mmc_plat), >>   }; >>   +DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk2928_dw_mshc) >>   DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3328_dw_mshc) >>   DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3368_dw_mshc)