All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kever Yang <kever.yang@rock-chips.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/5] mmc: rockchip: add SDHCI driver support for rockchip soc
Date: Mon, 18 Jul 2016 10:58:58 +0800	[thread overview]
Message-ID: <578C45F2.6080805@rock-chips.com> (raw)
In-Reply-To: <CAPnjgZ2dMwF3RWbR0kyiHkUjmbu4PX_baAEPNzy7OUM+-9YmUA@mail.gmail.com>

Hi Simon,

On 07/15/2016 11:20 AM, Simon Glass wrote:
> Hi Kever,
>
> On 13 July 2016 at 23:08, Kever Yang <kever.yang@rock-chips.com> wrote:
>> Rockchip rk3399 using arasan sdhci-5.1 controller.
>> This patch add the controller support to enable mmc device and tested on
>> rk3399 evb board.
>>
>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>> ---
>>
>>   drivers/mmc/Kconfig          |  6 +++++
>>   drivers/mmc/Makefile         |  1 +
>>   drivers/mmc/rockchip_sdhci.c | 58 ++++++++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 65 insertions(+)
>>   create mode 100644 drivers/mmc/rockchip_sdhci.c
>>
> Can you please update this to define CONFIG_BLK and CONFIG_DM_MMC_OPS?
> This will give it full driver-model support.
>
> See msm_sdhci.c for an example.
Sorry, missing this reply when I send out patch V2/V3, will update with
full driver-model support.

Thanks,
- Kever
>
>> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
>> index c80efc3..75c2d92 100644
>> --- a/drivers/mmc/Kconfig
>> +++ b/drivers/mmc/Kconfig
>> @@ -52,6 +52,12 @@ config ZYNQ_SDHCI
>>          help
>>            Support for Arasan SDHCI host controller on Zynq/ZynqMP ARM SoCs platform
>>
>> +config ROCKCHIP_SDHCI
>> +       bool "Arasan SDHCI controller for Rockchip support"
>> +       depends on DM_MMC && OF_CONTROL
>> +       help
>> +         Support for Arasan SDHCI host controller on Rockchip ARM SoCs platform
>> +
>>   config MMC_UNIPHIER
>>          bool "UniPhier SD/MMC Host Controller support"
>>          depends on ARCH_UNIPHIER
>> diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
>> index 3da4817..7cb2ab0 100644
>> --- a/drivers/mmc/Makefile
>> +++ b/drivers/mmc/Makefile
>> @@ -53,6 +53,7 @@ obj-$(CONFIG_SPEAR_SDHCI) += spear_sdhci.o
>>   obj-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
>>   obj-$(CONFIG_MMC_UNIPHIER) += uniphier-sd.o
>>   obj-$(CONFIG_ZYNQ_SDHCI) += zynq_sdhci.o
>> +obj-$(CONFIG_ROCKCHIP_SDHCI) += rockchip_sdhci.o
>>
>>   ifdef CONFIG_SPL_BUILD
>>   obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
>> diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c
>> new file mode 100644
>> index 0000000..bee269d
>> --- /dev/null
>> +++ b/drivers/mmc/rockchip_sdhci.c
>> @@ -0,0 +1,58 @@
>> +/*
>> + * (C) Copyright 2016 Fuzhou Rockchip Electronics Co., Ltd
>> + *
>> + * Rockchip SD Host Controller Interface
>> + *
>> + * SPDX-License-Identifier:    GPL-2.0+
>> + */
>> +
>> +#include <common.h>
>> +#include <dm.h>
>> +#include <fdtdec.h>
>> +#include <libfdt.h>
>> +#include <malloc.h>
>> +#include <sdhci.h>
>> +
>> +/* 400KHz is max freq for card ID etc. Use that as min */
>> +#define EMMC_MIN_FREQ  400000
>> +
>> +static int arasan_sdhci_probe(struct udevice *dev)
>> +{
>> +       struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
>> +       struct sdhci_host *host = dev_get_priv(dev);
>> +
>> +
>> +       host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
>> +       host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD;
>> +
>> +       add_sdhci(host, CONFIG_ROCKCHIP_SDHCI_MAX_FREQ, EMMC_MIN_FREQ);
>> +
>> +       upriv->mmc = host->mmc;
>> +       host->mmc->dev = dev;
>> +
>> +       return 0;
>> +}
>> +
>> +static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
>> +{
>> +       struct sdhci_host *host = dev_get_priv(dev);
>> +
>> +       host->name = dev->name;
>> +       host->ioaddr = (void *)dev_get_addr(dev);
> You can use dev_get_addr_ptr() here.
>
>> +
>> +       return 0;
>> +}
>> +
>> +static const struct udevice_id arasan_sdhci_ids[] = {
>> +       { .compatible = "arasan,sdhci-5.1" },
>> +       { }
>> +};
>> +
>> +U_BOOT_DRIVER(arasan_sdhci_drv) = {
>> +       .name           = "arasan_sdhci",
>> +       .id             = UCLASS_MMC,
>> +       .of_match       = arasan_sdhci_ids,
>> +       .ofdata_to_platdata = arasan_sdhci_ofdata_to_platdata,
>> +       .probe          = arasan_sdhci_probe,
>> +       .priv_auto_alloc_size = sizeof(struct sdhci_host),
>> +};
>> --
>> 1.9.1
>>
>>
> Regards,
> Simon
>
>
>

  reply	other threads:[~2016-07-18  2:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-14  5:08 [U-Boot] [PATCH 0/5] Kever Yang
2016-07-14  5:08 ` [U-Boot] [PATCH 1/5] dts: add support for rkchichip rk3399 soc Kever Yang
2016-07-15  3:20   ` Simon Glass
2016-07-14  5:08 ` [U-Boot] [PATCH 2/5] ARM64: rockchip: add support for rk3399 SoC based evb-board Kever Yang
2016-07-15  3:20   ` Simon Glass
2016-07-14  5:08 ` [U-Boot] [PATCH 3/5] config: add config file for evb-rk3399 Kever Yang
2016-07-15  3:20   ` Simon Glass
2016-07-14  5:08 ` [U-Boot] [PATCH 4/5] mmc: rockchip: add SDHCI driver support for rockchip soc Kever Yang
2016-07-15  3:20   ` Simon Glass
2016-07-18  2:58     ` Kever Yang [this message]
2016-07-15  3:20 ` [U-Boot] [PATCH 0/5] Simon Glass

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=578C45F2.6080805@rock-chips.com \
    --to=kever.yang@rock-chips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.