From: Priit Laes Subject: Re: [PATCH v4 4/7] ARM: sunxi: Add driver for SD/MMC hosts found on Allwinner sunxi SoCs Date: Sun, 9 Feb 2014 06:37:59 -0800 (PST) Message-ID: References: <20140207212709.24624.58619.stgit@dizzy-6.o2s.ch> <20140207213316.24624.28705.stgit@dizzy-6.o2s.ch> Reply-To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_168_16967048.1391956679334" Return-path: In-Reply-To: <20140207213316.24624.28705.stgit-GPtPHOohwllnsqa/0SyWJQ@public.gmane.org> List-Post: , List-Help: , List-Archive: Sender: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-Subscribe: , List-Unsubscribe: , To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Ulf Hansson , Laurent Pinchart , Mike Turquette , Simon Baatz , Hans de Goede , =?UTF-8?Q?Emilio_L=C3=B3pez?= , linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Chris Ball , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, H Hartley Sweeten , Tejun Heo , Maxime Ripard , Guennadi Liakhovetski , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, david.lanzendoerfer-Z7Kmv9EsliU@public.gmane.org List-Id: devicetree@vger.kernel.org ------=_Part_168_16967048.1391956679334 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =C3=9Chel kenal p=C3=A4eval, R, 07.02.2014 kell 22:33, kirjutas David Lanze= nd=C3=B6rfer: > This is based on the driver Allwinner ships in their Android kernel=20 sources. >=20 > Initial porting to upstream kernels done by David Lanzend=C3=B6rfer, addi= tional > fixes and cleanups by Hans de Goede. >=20 > It uses dma in bus-master mode using a built-in designware idmac=20 controller, > which is identical to the one found in the mmc-dw hosts. > The rest of the host is not identical to mmc-dw. >=20 > Signed-off-by: David Lanzend=C3=B6rfer=20 > Signed-off-by: Hans de Goede=20 > --- > drivers/mmc/host/Kconfig | 7=20 > drivers/mmc/host/Makefile | 2=20 > drivers/mmc/host/sunxi-mci.c | 871=20 ++++++++++++++++++++++++++++++++++++++++++ > drivers/mmc/host/sunxi-mci.h | 239 ++++++++++++ > 4 files changed, 1119 insertions(+) > create mode 100644 drivers/mmc/host/sunxi-mci.c > create mode 100644 drivers/mmc/host/sunxi-mci.h >=20 > diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig > index 1384f67..7caf266 100644 > --- a/drivers/mmc/host/Kconfig > +++ b/drivers/mmc/host/Kconfig > @@ -689,3 +689,10 @@ config MMC_REALTEK_PCI > help > Say Y here to include driver code to support SD/MMC card interface > of Realtek PCI-E card reader > + > +config MMC_SUNXI > + tristate "Allwinner sunxi SD/MMC Host Controller support" > + depends on ARCH_SUNXI > + help > + This selects support for the SD/MMC Host Controller on > + Allwinner sunxi SoCs. > diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile > index 3483b6b..6c9cbd3 100644 > --- a/drivers/mmc/host/Makefile > +++ b/drivers/mmc/host/Makefile > @@ -54,6 +54,8 @@ obj-$(CONFIG_MMC_WMT) +=3D wmt-sdmmc.o > =20 > obj-$(CONFIG_MMC_REALTEK_PCI) +=3D rtsx_pci_sdmmc.o > =20 > +obj-$(CONFIG_MMC_SUNXI) +=3D sunxi-mci.o > + > obj-$(CONFIG_MMC_SDHCI_PLTFM) +=3D sdhci-pltfm.o > obj-$(CONFIG_MMC_SDHCI_CNS3XXX) +=3D sdhci-cns3xxx.o > obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) +=3D sdhci-esdhc-imx.o > diff --git a/drivers/mmc/host/sunxi-mci.c b/drivers/mmc/host/sunxi-mci.c > new file mode 100644 > index 0000000..8b47c99 > --- /dev/null > +++ b/drivers/mmc/host/sunxi-mci.c > @@ -0,0 +1,871 @@ > +/* [...] > + > +static void sunxi_mmc_dump_errinfo(struct sunxi_mmc_host *smc_host) > +{ > + struct mmc_command *cmd =3D smc_host->mrq->cmd; > + struct mmc_data *data =3D smc_host->mrq->data; > + > + /* For some cmds timeout is normal with sd/mmc cards */ > + if ((smc_host->int_sum & SDXC_IntErrBit) =3D=3D SDXC_RespTimeout && > + (cmd->opcode =3D=3D 5 || cmd->opcode =3D=3D 52)) Aren't these the ones defined in linux/mmc/sdio.h: 5 - SD_IO_SEND_OP_COND 52 - SD_IO_RW_DIRECT > + return; > + > + dev_err(mmc_dev(smc_host->mmc), > + "smc %d err, cmd %d,%s%s%s%s%s%s%s%s%s%s !!\n", > + smc_host->mmc->index, cmd->opcode, > + data ? (data->flags & MMC_DATA_WRITE ? " WR" : " RD") : "", > + smc_host->int_sum & SDXC_RespErr ? " RE" : "", > + smc_host->int_sum & SDXC_RespCRCErr ? " RCE" : "", > + smc_host->int_sum & SDXC_DataCRCErr ? " DCE" : "", > + smc_host->int_sum & SDXC_RespTimeout ? " RTO" : "", > + smc_host->int_sum & SDXC_DataTimeout ? " DTO" : "", > + smc_host->int_sum & SDXC_FIFORunErr ? " FE" : "", > + smc_host->int_sum & SDXC_HardWLocked ? " HL" : "", > + smc_host->int_sum & SDXC_StartBitErr ? " SBE" : "", > + smc_host->int_sum & SDXC_EndBitErr ? " EBE" : "" > + ); > +} [...] > +static void sunxi_mmc_set_clk_dly(struct sunxi_mmc_host *smc_host, > + u32 oclk_dly, u32 sclk_dly) > +{ > + unsigned long iflags; > + struct clk_hw *hw =3D __clk_get_hw(smc_host->clk_mod); > + > + spin_lock_irqsave(&smc_host->lock, iflags); > + clk_sunxi_mmc_phase_control(hw, sclk_dly, oclk_dly); > + spin_unlock_irqrestore(&smc_host->lock, iflags); > +} > + > +struct sunxi_mmc_clk_dly mmc_clk_dly[MMC_CLK_MOD_NUM] =3D { > + { MMC_CLK_400K, 0, 7 }, > + { MMC_CLK_25M, 0, 5 }, > + { MMC_CLK_50M, 3, 5 }, > + { MMC_CLK_50MDDR, 2, 4 }, > + { MMC_CLK_50MDDR_8BIT, 2, 4 }, > + { MMC_CLK_100M, 1, 4 }, > + { MMC_CLK_200M, 1, 4 }, >From the looks of it, it should be static const, but apparently this was raising a warning when David did it.. Hints anyone? > +}; > + > +static void sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *smc_host, > + unsigned int rate) > +{ > + u32 newrate; > + u32 src_clk; > + u32 oclk_dly; > + u32 sclk_dly; > + u32 temp; > + struct sunxi_mmc_clk_dly *dly =3D NULL; > + > + newrate =3D clk_round_rate(smc_host->clk_mod, rate); > + if (smc_host->clk_mod_rate =3D=3D newrate) { > + dev_dbg(mmc_dev(smc_host->mmc), "clk already %d, rounded %d\n", > + rate, newrate); > + return; > + } > + > + dev_dbg(mmc_dev(smc_host->mmc), "setting clk to %d, rounded %d\n", > + rate, newrate); > + > + /* setting clock rate */ > + clk_disable(smc_host->clk_mod); > + clk_set_rate(smc_host->clk_mod, newrate); > + clk_enable(smc_host->clk_mod); > + smc_host->clk_mod_rate =3D newrate =3D clk_get_rate(smc_host->clk_mo= d); > + dev_dbg(mmc_dev(smc_host->mmc), "clk is now %d\n", newrate); > + > + sunxi_mmc_oclk_onoff(smc_host, 0); > + /* clear internal divider */ > + temp =3D mci_readl(smc_host, REG_CLKCR); > + temp &=3D ~0xff; > + mci_writel(smc_host, REG_CLKCR, temp); > + > + /* determine delays */ > + if (rate <=3D 400000) { > + dly =3D &mmc_clk_dly[MMC_CLK_400K]; > + } else if (rate <=3D 25000000) { > + dly =3D &mmc_clk_dly[MMC_CLK_25M]; > + } else if (rate <=3D 50000000) { > + if (smc_host->ddr) { > + if (smc_host->bus_width =3D=3D 8) > + dly =3D &mmc_clk_dly[MMC_CLK_50MDDR_8BIT]; > + else > + dly =3D &mmc_clk_dly[MMC_CLK_50MDDR]; > + } else { > + dly =3D &mmc_clk_dly[MMC_CLK_50M]; > + } > + } else if (rate <=3D 104000000) { > + dly =3D &mmc_clk_dly[MMC_CLK_100M]; > + } else if (rate <=3D 208000000) { > + dly =3D &mmc_clk_dly[MMC_CLK_200M]; > + } else { > + dly =3D &mmc_clk_dly[MMC_CLK_50M]; > + } > + > + oclk_dly =3D dly->oclk_dly; > + sclk_dly =3D dly->sclk_dly; > + > + src_clk =3D clk_get_rate(clk_get_parent(smc_host->clk_mod)); > + > + if (src_clk >=3D 300000000 && src_clk <=3D 400000000) { > + if (oclk_dly) > + oclk_dly--; > + if (sclk_dly) > + sclk_dly--; > + } > + > + sunxi_mmc_set_clk_dly(smc_host, oclk_dly, sclk_dly); > + sunxi_mmc_oclk_onoff(smc_host, 1); > + > + /* oclk_onoff sets various irq status bits, clear these */ > + mci_writel(smc_host, REG_RINTR, > + mci_readl(smc_host, REG_RINTR) & ~SDXC_SDIOInt); > +} > + [...] > diff --git a/drivers/mmc/host/sunxi-mci.h b/drivers/mmc/host/sunxi-mci.h > new file mode 100644 > index 0000000..4f3c2d9 > --- /dev/null > +++ b/drivers/mmc/host/sunxi-mci.h > @@ -0,0 +1,239 @@ > +/* > + * Driver for sunxi SD/MMC host controllers > + * (C) Copyright 2014-2015 Reuuimlla Technology Co., Ltd. > + * (C) Copyright 2014-2015 Aaron Maoye=20 > + * (C) Copyright 2014-2015 O2S GmbH > + * (C) Copyright 2014-2015 David Lanzend=C3=B6rfer=20 > + * (C) Copyright 2014-2015 Hans de Goede=20 Had to take a look at the calendar... > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License as > + * published by the Free Software Foundation; either version 2 of > + * the License, or (at your option) any later version. > + */ > + > +#ifndef __SUNXI_MCI_H__ > +#define __SUNXI_MCI_H__ > + [...] > + > +struct sunxi_idma_des { > + u32 config; > +#define SDXC_IDMAC_DES0_DIC BIT(1) /* disable interrupt on=20 completion */ > +#define SDXC_IDMAC_DES0_LD BIT(2) /* last descriptor */ > +#define SDXC_IDMAC_DES0_FD BIT(3) /* first descriptor */ > +#define SDXC_IDMAC_DES0_CH BIT(4) /* chain mode */ > +#define SDXC_IDMAC_DES0_ER BIT(5) /* end of ring */ > +#define SDXC_IDMAC_DES0_CES BIT(30) /* card error summary */ > +#define SDXC_IDMAC_DES0_OWN BIT(31) /* 1-idma owns it, 0-host owns it= =20 */ This #define placement inside the struct looks really weird. > + > + /* > + * If the idma-des-size-bits of property is ie 13, bufsize bits are: > + * Bits 0-12: buf1 size > + * Bits 13-25: buf2 size > + * Bits 26-31: not used > + * Since we only ever set buf1 size, we can simply store it directly= . > + */ > + u32 buf_size; > + u32 buf_addr_ptr1; > + u32 buf_addr_ptr2; > +}; > + [...] > + > +#define MMC_CLK_400K 0 > +#define MMC_CLK_25M 1 > +#define MMC_CLK_50M 2 > +#define MMC_CLK_50MDDR 3 > +#define MMC_CLK_50MDDR_8BIT 4 > +#define MMC_CLK_100M 5 > +#define MMC_CLK_200M 6 > +#define MMC_CLK_MOD_NUM 7 > + > +struct sunxi_mmc_clk_dly { > + u32 mode; > + u32 oclk_dly; > + u32 sclk_dly; Do these members have to be u32? They all seem to be smaller than 10. --=20 You received this message because you are subscribed to the Google Groups "= linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out. ------=_Part_168_16967048.1391956679334 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
=C3=9Chel kenal p=C3=A4eval, R, 07.02.2014 kell 22:33, kir= jutas David Lanzend=C3=B6rfer:
> This is based on the driver Allwinne= r ships in their Android kernel sources.
>
> Initial porting t= o upstream kernels done by David Lanzend=C3=B6rfer, additional
> fixe= s and cleanups by Hans de Goede.
>
> It uses dma in bus-master= mode using a built-in designware idmac controller,
> which is identi= cal to the one found in the mmc-dw hosts.
> The rest of the host is n= ot identical to mmc-dw.
>
> Signed-off-by: David Lanzend=C3=B6= rfer <david.lanzendoerfer-Z7Kmv9EsliU-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org>
> Signe= d-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA-XMD5yJDbdMTcBkidbGgD4Q@public.gmane.org= g>
> ---
>  drivers/mmc/host/Kconfig   &= nbsp; |    7
>  drivers/mmc/host/Makefile &= nbsp;  |    2
>  drivers/mmc/host/sunxi-mci= .c |  871 ++++++++++++++++++++++++++++++++++++++++++
>  dri= vers/mmc/host/sunxi-mci.h |  239 ++++++++++++
>  4 files ch= anged, 1119 insertions(+)
>  create mode 100644 drivers/mmc/host= /sunxi-mci.c
>  create mode 100644 drivers/mmc/host/sunxi-mci.h<= br>>
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/K= config
> index 1384f67..7caf266 100644
> --- a/drivers/mmc/host= /Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -689,3 +689,10 @= @ config MMC_REALTEK_PCI
>      help
> = ;       Say Y here to include driver code to support SD= /MMC card interface
>        of Realtek PCI-= E card reader
> +
> +config MMC_SUNXI
> +  &nbs= p; tristate "Allwinner sunxi SD/MMC Host Controller support"
> + = ;   depends on ARCH_SUNXI
> +    help
>= ; +      This selects support for the SD/MMC Host Contr= oller on
> +      Allwinner sunxi SoCs.
> d= iff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> i= ndex 3483b6b..6c9cbd3 100644
> --- a/drivers/mmc/host/Makefile
>= ; +++ b/drivers/mmc/host/Makefile
> @@ -54,6 +54,8 @@ obj-$(CONFIG_MM= C_WMT)        +=3D wmt-sdmmc.o
>  =
>  obj-$(CONFIG_MMC_REALTEK_PCI)    +=3D rtsx_pc= i_sdmmc.o
> 
> +obj-$(CONFIG_MMC_SUNXI)   =     +=3D sunxi-mci.o
> +
>  obj-$(CONFIG_M= MC_SDHCI_PLTFM)        +=3D sdhci-pltfm.o
= >  obj-$(CONFIG_MMC_SDHCI_CNS3XXX)      &n= bsp; +=3D sdhci-cns3xxx.o
>  obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX)&n= bsp;   +=3D sdhci-esdhc-imx.o
> diff --git a/drivers/mmc/ho= st/sunxi-mci.c b/drivers/mmc/host/sunxi-mci.c
> new file mode 100644<= br>> index 0000000..8b47c99
> --- /dev/null
> +++ b/drivers/= mmc/host/sunxi-mci.c
> @@ -0,0 +1,871 @@
> +/*

[...]
=
> +
> +static void sunxi_mmc_dump_errinfo(struct sunxi_mmc_hos= t *smc_host)
> +{
> +    struct mmc_command *cmd= =3D smc_host->mrq->cmd;
> +    struct mmc_data = *data =3D smc_host->mrq->data;
> +
> +    = /* For some cmds timeout is normal with sd/mmc cards */
> + &nbs= p;  if ((smc_host->int_sum & SDXC_IntErrBit) =3D=3D SDXC_RespTi= meout &&
> +          = ;  (cmd->opcode =3D=3D 5 || cmd->opcode =3D=3D 52))
Aren't th= ese the ones defined in linux/mmc/sdio.h:
5  - SD_IO_SEND_OP_COND52 - SD_IO_RW_DIRECT

> +        r= eturn;
> +
> +    dev_err(mmc_dev(smc_host->m= mc),
> +        "smc %d err, cmd %d,%s%= s%s%s%s%s%s%s%s%s !!\n",
> +        smc= _host->mmc->index, cmd->opcode,
> +     =    data ? (data->flags & MMC_DATA_WRITE ? " WR" : " RD") := "",
> +        smc_host->int_sum &a= mp; SDXC_RespErr     ? " RE"     : = "",
> +        smc_host->int_sum &am= p; SDXC_RespCRCErr  ? " RCE"    : "",
> + &n= bsp;      smc_host->int_sum & SDXC_DataCRCErr&nb= sp; ? " DCE"    : "",
> +     &nbs= p;  smc_host->int_sum & SDXC_RespTimeout ? " RTO"  &n= bsp; : "",
> +        smc_host->int_= sum & SDXC_DataTimeout ? " DTO"    : "",
> + =        smc_host->int_sum & SDXC_FIFORunErr&= nbsp; ? " FE"     : "",
> +    &nb= sp;   smc_host->int_sum & SDXC_HardWLocked ? " HL" &n= bsp;   : "",
> +        smc_h= ost->int_sum & SDXC_StartBitErr ? " SBE"    : "",
= > +        smc_host->int_sum & SDXC= _EndBitErr   ? " EBE"    : ""
> +  = ;      );
> +}
[...]
> +static void sunx= i_mmc_set_clk_dly(struct sunxi_mmc_host *smc_host,
> +  &nb= sp;               u32 ocl= k_dly, u32 sclk_dly)
> +{
> +    unsigned long i= flags;
> +    struct clk_hw *hw =3D __clk_get_hw(smc_h= ost->clk_mod);
> +
> +    spin_lock_irqsave(&= amp;smc_host->lock, iflags);
> +    clk_sunxi_mmc_p= hase_control(hw, sclk_dly, oclk_dly);
> +    spin_unlo= ck_irqrestore(&smc_host->lock, iflags);
> +}
> +
>= +struct sunxi_mmc_clk_dly mmc_clk_dly[MMC_CLK_MOD_NUM] =3D {
> +&nbs= p;   { MMC_CLK_400K, 0, 7 },
> +    { MMC_CL= K_25M, 0, 5 },
> +    { MMC_CLK_50M, 3, 5 },
> +=     { MMC_CLK_50MDDR, 2, 4 },
> +    { = MMC_CLK_50MDDR_8BIT, 2, 4 },
> +    { MMC_CLK_100M, 1,= 4 },
> +    { MMC_CLK_200M, 1, 4 },

From the l= ooks of it, it should be static const, but apparently this was
raising a= warning when David did it.. Hints anyone?

> +};
> +
>= ; +static void sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *smc_host,
&= gt; +              &= nbsp;    unsigned int rate)
> +{
> +   = ; u32 newrate;
> +    u32 src_clk;
> + &nbs= p;  u32 oclk_dly;
> +    u32 sclk_dly;
> +&= nbsp;   u32 temp;
> +    struct sunxi_mmc_cl= k_dly *dly =3D NULL;
> +
> +    newrate =3D clk_= round_rate(smc_host->clk_mod, rate);
> +    if (smc= _host->clk_mod_rate =3D=3D newrate) {
> +     =    dev_dbg(mmc_dev(smc_host->mmc), "clk already %d, rounded %d= \n",
> +            rate= , newrate);
> +        return;
> = +    }
> +
> +    dev_dbg(mmc_dev= (smc_host->mmc), "setting clk to %d, rounded %d\n",
> +  = ;      rate, newrate);
> +
> +  &= nbsp; /* setting clock rate */
> +    clk_disable(smc_= host->clk_mod);
> +    clk_set_rate(smc_host->cl= k_mod, newrate);
> +    clk_enable(smc_host->clk_mo= d);
> +    smc_host->clk_mod_rate =3D newrate =3D c= lk_get_rate(smc_host->clk_mod);
> +    dev_dbg(mmc_= dev(smc_host->mmc), "clk is now %d\n", newrate);
> +
> +&nbs= p;   sunxi_mmc_oclk_onoff(smc_host, 0);
> +  &nbs= p; /* clear internal divider */
> +    temp =3D mci_re= adl(smc_host, REG_CLKCR);
> +    temp &=3D ~0xff;<= br>> +    mci_writel(smc_host, REG_CLKCR, temp);
> = +
> +    /* determine delays */
> +  &= nbsp; if (rate <=3D 400000) {
> +      &n= bsp; dly =3D &mmc_clk_dly[MMC_CLK_400K];
> +    } = else if (rate <=3D 25000000) {
> +      &= nbsp; dly =3D &mmc_clk_dly[MMC_CLK_25M];
> +    } = else if (rate <=3D 50000000) {
> +      &= nbsp; if (smc_host->ddr) {
> +       = ;     if (smc_host->bus_width =3D=3D 8)
> + &n= bsp;              dly =3D= &mmc_clk_dly[MMC_CLK_50MDDR_8BIT];
> +     &= nbsp;      else
> +      = ;          dly =3D &mmc_clk_dly[MMC_= CLK_50MDDR];
> +        } else {
>= ; +            dly =3D &mm= c_clk_dly[MMC_CLK_50M];
> +        }> +    } else if (rate <=3D 104000000) {
> +&nb= sp;       dly =3D &mmc_clk_dly[MMC_CLK_100M];<= br>> +    } else if (rate <=3D 208000000) {
> +&= nbsp;       dly =3D &mmc_clk_dly[MMC_CLK_200M]= ;
> +    } else {
> +     &n= bsp;  dly =3D &mmc_clk_dly[MMC_CLK_50M];
> +  &nbs= p; }
> +
> +    oclk_dly =3D dly->oclk_dly;> +    sclk_dly =3D dly->sclk_dly;
> +
>= +    src_clk =3D clk_get_rate(clk_get_parent(smc_host->c= lk_mod));
> +
> +    if (src_clk >=3D 3000000= 00 && src_clk <=3D 400000000) {
> +    &nbs= p;   if (oclk_dly)
> +       =     oclk_dly--;
> +      &nb= sp; if (sclk_dly)
> +         &nbs= p;  sclk_dly--;
> +    }
> +
> + = ;   sunxi_mmc_set_clk_dly(smc_host, oclk_dly, sclk_dly);
> = +    sunxi_mmc_oclk_onoff(smc_host, 1);
> +
> +&= nbsp;   /* oclk_onoff sets various irq status bits, clear these *= /
> +    mci_writel(smc_host, REG_RINTR,
> +&nbs= p;          mci_readl(smc_host, REG_RINT= R) & ~SDXC_SDIOInt);
> +}
> +

[...]

> diff= --git a/drivers/mmc/host/sunxi-mci.h b/drivers/mmc/host/sunxi-mci.h
>= ; new file mode 100644
> index 0000000..4f3c2d9
> --- /dev/null=
> +++ b/drivers/mmc/host/sunxi-mci.h
> @@ -0,0 +1,239 @@
&g= t; +/*
> + * Driver for sunxi SD/MMC host controllers
> + * (C)= Copyright 2014-2015 Reuuimlla Technology Co., Ltd.
> + * (C) Copyrig= ht 2014-2015 Aaron Maoye <leafy.myeh-jFKXxz0WcGyYHARAtoI1EgC/G2K4zDHf@pu= blic.gmane.org>
> + * (C) Copyright 2014-2015 O2S GmbH <www.o2s= .ch>
> + * (C) Copyright 2014-2015 David Lanzend=C3=B6rfer <dav= id.lanzendoerfer-Z7Kmv9EsliU@public.gmane.org>
> + * (C) Copyright 2014-2015 Hans de Goe= de <hdegoede-H+wXaHxf7aLQT0dZR+AlfA-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org>

Had to t= ake a look at the calendar...

> + *
> + * This program is f= ree software; you can redistribute it and/or
> + * modify it under th= e terms of the GNU General Public License as
> + * published by the F= ree Software Foundation; either version 2 of
> + * the License, or (a= t your option) any later version.
> + */
> +
> +#ifndef _= _SUNXI_MCI_H__
> +#define __SUNXI_MCI_H__
> +

[...]
<= br>> +
> +struct sunxi_idma_des {
> +    u32&= nbsp;   config;
> +#define SDXC_IDMAC_DES0_DIC  &= nbsp; BIT(1)  /* disable interrupt on completion */
> +#define S= DXC_IDMAC_DES0_LD    BIT(2)  /* last descriptor */
&= gt; +#define SDXC_IDMAC_DES0_FD    BIT(3)  /* first des= criptor */
> +#define SDXC_IDMAC_DES0_CH    BIT(4)&nbs= p; /* chain mode */
> +#define SDXC_IDMAC_DES0_ER    B= IT(5)  /* end of ring */
> +#define SDXC_IDMAC_DES0_CES &nb= sp;  BIT(30) /* card error summary */
> +#define SDXC_IDMAC_DES0= _OWN    BIT(31) /* 1-idma owns it, 0-host owns it */

= This #define placement inside the struct looks really weird.

> +<= br>> +    /*
> +     * If the i= dma-des-size-bits of property is ie 13, bufsize bits are:
> + &n= bsp;   *  Bits  0-12: buf1 size
> +  &n= bsp;  *  Bits 13-25: buf2 size
> +     = *  Bits 26-31: not used
> +     * Since we o= nly ever set buf1 size, we can simply store it directly.
> + &nb= sp;   */
> +    u32    buf_si= ze;
> +    u32    buf_addr_ptr1;
>= ; +    u32    buf_addr_ptr2;
> +};
&= gt; +
[...]
> +
> +#define MMC_CLK_400K   &nb= sp;        0
> +#define MMC_CLK_25= M             1=
> +#define MMC_CLK_50M       &nbs= p;     2
> +#define MMC_CLK_50MDDR  &nb= sp;       3
> +#define MMC_CLK_50MDDR_8= BIT     4
> +#define MMC_CLK_100M  &nbs= p;         5
> +#define MMC_C= LK_200M            6=
> +#define MMC_CLK_MOD_NUM       =   7
> +
> +struct sunxi_mmc_clk_dly {
> +  = ;  u32 mode;
> +    u32 oclk_dly;
> + =    u32 sclk_dly;

Do these members have to be u32? They all= seem to be smaller than 10.


--
You received this message because you are subscribed to the Google Groups &= quot;linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
------=_Part_168_16967048.1391956679334--