public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Weijie Gao <weijie.gao@mediatek.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 20/26] mmc: mtk-sd: add support for MediaTek MT7620/MT7628 SoCs
Date: Thu, 29 Aug 2019 12:28:02 +0800	[thread overview]
Message-ID: <1567052882.2874.144.camel@mcddlt001> (raw)
In-Reply-To: <94e5b85e-dc80-8c7f-3a50-dd668b363c35@denx.de>

On Wed, 2019-08-28 at 15:50 +0200, Stefan Roese wrote:
> On 28.08.19 08:38, Weijie Gao wrote:
> > This patch adds mmc support for MediaTek MT7620/MT7628 SoCs.
> > 
> > Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
> > ---
> >   drivers/mmc/Kconfig  |  2 +-
> >   drivers/mmc/mtk-sd.c | 23 ++++++++++++++++++++---
> >   2 files changed, 21 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> > index 0ccb1ea701..564310b293 100644
> > --- a/drivers/mmc/Kconfig
> > +++ b/drivers/mmc/Kconfig
> > @@ -671,7 +671,7 @@ config FTSDC010_SDIO
> >   
> >   config MMC_MTK
> >   	bool "MediaTek SD/MMC Card Interface support"
> > -	depends on ARCH_MEDIATEK
> > +	depends on (ARCH_MEDIATEK || ARCH_MTMIPS)
> 
> AFAIK, the braces are not necessary.
> 
> Thanks,
> Stefan
> 
> >   	depends on BLK && DM_MMC
> >   	depends on OF_CONTROL
> >   	help
> > diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c
> > index f555357af2..7069fe8948 100644
> > --- a/drivers/mmc/mtk-sd.c
> > +++ b/drivers/mmc/mtk-sd.c
> > @@ -217,6 +217,7 @@ struct mtk_sd_regs {
> >   
> >   struct msdc_compatible {
> >   	u8 clk_div_bits;
> > +	u8 sclk_cycle_shift;
> >   	bool pad_tune0;
> >   	bool async_fifo;
> >   	bool data_tune;
> > @@ -664,7 +665,7 @@ static int msdc_ops_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
> >   
> >   static void msdc_set_timeout(struct msdc_host *host, u32 ns, u32 clks)
> >   {
> > -	u32 timeout, clk_ns;
> > +	u32 timeout, clk_ns, shift;
> >   	u32 mode = 0;
> >   
> >   	host->timeout_ns = ns;
> > @@ -673,10 +674,11 @@ static void msdc_set_timeout(struct msdc_host *host, u32 ns, u32 clks)
> >   	if (host->sclk == 0) {
> >   		timeout = 0;
> >   	} else {
> > +		shift = host->dev_comp->sclk_cycle_shift;
> >   		clk_ns = 1000000000UL / host->sclk;
> >   		timeout = (ns + clk_ns - 1) / clk_ns + clks;
> >   		/* unit is 1048576 sclk cycles */
> > -		timeout = (timeout + (0x1 << 20) - 1) >> 20;
> > +		timeout = (timeout + (0x1 << shift) - 1) >> shift;
> >   		if (host->dev_comp->clk_div_bits == 8)
> >   			mode = (readl(&host->base->msdc_cfg) &
> >   				MSDC_CFG_CKMOD_M) >> MSDC_CFG_CKMOD_S;
> > @@ -1301,7 +1303,7 @@ static int msdc_drv_probe(struct udevice *dev)
> >   
> >   	host->mmc = &plat->mmc;
> >   	host->timeout_ns = 100000000;
> > -	host->timeout_clks = 3 * 1048576;
> > +	host->timeout_clks = 3 * (1 << host->dev_comp->sclk_cycle_shift);
> >   
> >   #ifdef CONFIG_PINCTRL
> >   	pinctrl_select_state(dev, "default");
> > @@ -1374,8 +1376,20 @@ static const struct dm_mmc_ops msdc_ops = {
> >   #endif
> >   };
> >   
> > +static const struct msdc_compatible mt7620_compat = {
> > +	.clk_div_bits = 8,
> > +	.sclk_cycle_shift = 16,
> > +	.pad_tune0 = false,
> > +	.async_fifo = false,
> > +	.data_tune = false,
> > +	.busy_check = false,
> > +	.stop_clk_fix = false,
> > +	.enhance_rx = false
> > +};
> > +
> >   static const struct msdc_compatible mt7623_compat = {
> >   	.clk_div_bits = 12,
> > +	.sclk_cycle_shift = 20,
> >   	.pad_tune0 = true,
> >   	.async_fifo = true,
> >   	.data_tune = true,
> > @@ -1386,6 +1400,7 @@ static const struct msdc_compatible mt7623_compat = {
> >   
> >   static const struct msdc_compatible mt8516_compat = {
> >   	.clk_div_bits = 12,
> > +	.sclk_cycle_shift = 20,
> >   	.pad_tune0 = true,
> >   	.async_fifo = true,
> >   	.data_tune = true,
> > @@ -1395,6 +1410,7 @@ static const struct msdc_compatible mt8516_compat = {
> >   
> >   static const struct msdc_compatible mt8183_compat = {
> >   	.clk_div_bits = 12,
> > +	.sclk_cycle_shift = 20,
> >   	.pad_tune0 = true,
> >   	.async_fifo = true,
> >   	.data_tune = true,
> > @@ -1403,6 +1419,7 @@ static const struct msdc_compatible mt8183_compat = {
> >   };
> >   
> >   static const struct udevice_id msdc_ids[] = {
> > +	{ .compatible = "mediatek,mt7620-mmc", .data = (ulong)&mt7620_compat },
> >   	{ .compatible = "mediatek,mt7623-mmc", .data = (ulong)&mt7623_compat },
> >   	{ .compatible = "mediatek,mt8516-mmc", .data = (ulong)&mt8516_compat },
> >   	{ .compatible = "mediatek,mt8183-mmc", .data = (ulong)&mt8183_compat },
> > 
> 
> Viele Grüße,
> Stefan
> 

I'll remove these braces.

  reply	other threads:[~2019-08-29  4:28 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28  6:37 [U-Boot] [PATCH 00/26] Add and update drivers for MediaTek MT76x8 SoCs Weijie Gao
2019-08-28  6:37 ` [U-Boot] [PATCH 01/26] serial: serial_mtk: enable FIFO and disable flow control Weijie Gao
2019-08-28  6:37 ` [U-Boot] [PATCH 02/26] serial: serial_mtk: add non-DM version for SPL Weijie Gao
2019-08-28  6:37 ` [U-Boot] [PATCH 03/26] dts: mtmips: move uart property clock-frequency into mt7628an.dtsi Weijie Gao
2019-08-28  7:13   ` Stefan Roese
2019-08-28  6:37 ` [U-Boot] [PATCH 04/26] dts: mtmips: enable high-speed UART support for mt7628 Weijie Gao
2019-08-28  7:14   ` Stefan Roese
2019-08-28  6:37 ` [U-Boot] [PATCH 05/26] spi: mt7621-spi: remove data cache and rewrite its xfer function Weijie Gao
2019-08-28  7:55   ` Stefan Roese
2019-08-28  6:37 ` [U-Boot] [PATCH 06/26] spi: mt7621-spi: restore default register value after each xfer Weijie Gao
2019-08-28  8:01   ` Stefan Roese
2019-08-28  6:37 ` [U-Boot] [PATCH 07/26] pinctrl: add support for MediaTek MT7628 Weijie Gao
2019-08-28 12:26   ` Stefan Roese
2019-08-28 12:37     ` Stefan Roese
2019-08-29  3:04       ` Weijie Gao
2019-08-28  6:37 ` [U-Boot] [PATCH 08/26] dts: mtmips: add pinctrl node for mt7628 Weijie Gao
2019-08-28  6:37 ` [U-Boot] [PATCH 09/26] dts: mtmips: add default pinctrl for uart nodes Weijie Gao
2019-08-28  6:37 ` [U-Boot] [PATCH 10/26] reset: add reset controller driver for MediaTek MIPS platform Weijie Gao
2019-08-28  6:37 ` [U-Boot] [PATCH 11/26] dts: mtmips: update reset controller node for mt7628 Weijie Gao
2019-08-28 13:18   ` Stefan Roese
2019-08-29  3:18     ` Weijie Gao
2019-12-30  9:19   ` Mauro Condarelli
2019-12-30 10:22     ` Daniel Schwierzeck
2019-12-30 11:09       ` Mauro Condarelli
2019-12-30 12:14       ` Mauro Condarelli
2020-01-02 12:30         ` Stefan Roese
2020-01-02 13:36           ` Mauro Condarelli
2019-08-28  6:37 ` [U-Boot] [PATCH 12/26] clk: add clock gating driver for MediaTek MIPS platform Weijie Gao
2019-08-28 13:24   ` Daniel Schwierzeck
2019-08-29  3:25     ` Weijie Gao
2019-08-28  6:37 ` [U-Boot] [PATCH 13/26] dts: mtmips: add gate clock node for mt7628 Weijie Gao
2019-08-28  6:37 ` [U-Boot] [PATCH 14/26] phy: mt76x8-usb-phy: add slew rate calibration and remove non-mt7628 part Weijie Gao
2019-08-28  6:38 ` [U-Boot] [PATCH 15/26] net: mt7628-eth: remove hardcoded gpio settings and regmap-based phy reset Weijie Gao
2019-08-28 13:32   ` Stefan Roese
2019-08-28  6:38 ` [U-Boot] [PATCH 16/26] net: mt7628-eth: remove phy link up detection Weijie Gao
2019-08-28 13:37   ` Stefan Roese
2019-08-29  3:32     ` Weijie Gao
2019-08-28  6:38 ` [U-Boot] [PATCH 17/26] net: mt7628-eth: free rx descriptor on receiving failure Weijie Gao
2019-08-28 13:42   ` Stefan Roese
2019-08-28  6:38 ` [U-Boot] [PATCH 18/26] net: mt7628-eth: add support to isolate LAN/WAN ports Weijie Gao
2019-08-28 13:46   ` Stefan Roese
2019-08-29  4:27     ` Weijie Gao
2019-08-28  6:38 ` [U-Boot] [PATCH 19/26] dts: mtmips: enable eth port0 led function for all boards Weijie Gao
2019-08-28 13:47   ` Stefan Roese
2019-08-28  6:38 ` [U-Boot] [PATCH 20/26] mmc: mtk-sd: add support for MediaTek MT7620/MT7628 SoCs Weijie Gao
2019-08-28 13:50   ` Stefan Roese
2019-08-29  4:28     ` Weijie Gao [this message]
2019-08-28  6:38 ` [U-Boot] [PATCH 21/26] mmc: mtk-sd: add a dts property cd-active-high for builtin-cd mode Weijie Gao
2019-08-28  6:38 ` [U-Boot] [PATCH 22/26] dts: mtmips: add mmc related nodes for mt7628an.dtsi Weijie Gao
2019-08-28  6:38 ` [U-Boot] [PATCH 23/26] dts: mtmips: add default pinctrl for gardena-smart-gateway-mt7688 Weijie Gao
2019-08-28 13:52   ` Stefan Roese
2019-08-28  6:38 ` [U-Boot] [PATCH 24/26] dts: mtmips: add default pinctrl to eth nodes for all boards Weijie Gao
2019-08-28 13:55   ` Stefan Roese
2019-08-28  6:38 ` [U-Boot] [PATCH 25/26] configs: mtmips: change all boards to use mtk high-speed uart driver Weijie Gao
2019-08-28 13:57   ` Stefan Roese
2019-08-29  4:30     ` Weijie Gao
2019-08-28  6:38 ` [U-Boot] [PATCH 26/26] configs: mtmips: add necessary drivers for mtmips boards Weijie Gao
2019-08-28 13:35   ` Daniel Schwierzeck
2019-08-28 13:40     ` Stefan Roese
2019-08-29  3:34       ` Weijie Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1567052882.2874.144.camel@mcddlt001 \
    --to=weijie.gao@mediatek.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox