Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752666AbbGARu7 (ORCPT ); Wed, 1 Jul 2015 13:50:59 -0400 Received: from mail-yk0-f178.google.com ([209.85.160.178]:36678 "EHLO mail-yk0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750846AbbGARuw (ORCPT ); Wed, 1 Jul 2015 13:50:52 -0400 MIME-Version: 1.0 In-Reply-To: <1435735399-15333-1-git-send-email-chunyan.zhang@spreadtrum.com> References: <1435735399-15333-1-git-send-email-chunyan.zhang@spreadtrum.com> From: Rob Herring Date: Wed, 1 Jul 2015 12:50:32 -0500 Message-ID: Subject: Re: [RFC PATCH] mmc: sprd: add MMC host driver for Spreadtrum SoC To: Chunyan Zhang Cc: "chris@printf.net" , Ulf Hansson , Lee Jones , Shawn Guo , Grant Likely , Rob Herring , Arnd Bergmann , billows.wu@spreadtrum.com, =?UTF-8?B?V2VpIFFpYW8gKOS5lOS8nyk=?= , baolin.wang@spreadtrum.com, ning.yang@spreadtrum.com, orson.zhai@spreadtrum.com, jason.wu@spreadtrum.com, "linux-mmc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4738 Lines: 129 On Wed, Jul 1, 2015 at 2:23 AM, Chunyan Zhang wrote: > From: Billows Wu > > The Spreadtrum MMC host driver is used to support EMMC, SD, and > SDIO types of memory cards. > > Signed-off-by: Billows Wu > Reviewed-by: Orson Zhai > Signed-off-by: Chunyan Zhang > --- > drivers/mmc/host/sprd_sdhost.c | 1270 ++++++++++++++++++++++++++++++++ > drivers/mmc/host/sprd_sdhost.h | 507 +++++++++++++ > drivers/mmc/host/sprd_sdhost_debugfs.c | 213 ++++++ > drivers/mmc/host/sprd_sdhost_debugfs.h | 27 + > 6 files changed, 2027 insertions(+) > create mode 100644 drivers/mmc/host/sprd_sdhost.c > create mode 100644 drivers/mmc/host/sprd_sdhost.h > create mode 100644 drivers/mmc/host/sprd_sdhost_debugfs.c > create mode 100644 drivers/mmc/host/sprd_sdhost_debugfs.h > > diff --git a/drivers/mmc/host/sprd_sdhost.c b/drivers/mmc/host/sprd_sdhost.c > new file mode 100644 > index 0000000..e7a66e8 > --- /dev/null > +++ b/drivers/mmc/host/sprd_sdhost.c > @@ -0,0 +1,1270 @@ > +/* > + * linux/drivers/mmc/host/sprd_sdhost.c - Secure Digital Host Controller > + * Interface driver > + * > + * Copyright (C) 2015 Spreadtrum corporation. > + * > + * 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. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "sprd_sdhost.h" > +#include "sprd_sdhost_debugfs.h" > + > +#define DRIVER_NAME "sdhost" > +#define SDHOST_CAPS \ > + (MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED | \ > + MMC_CAP_ERASE | MMC_CAP_UHS_SDR50 | \ > + MMC_CAP_CMD23 | MMC_CAP_HW_RESET) > + > +struct sdhost_caps_data { > + char *name; > + uint32_t ocr_avail; > + uint32_t caps; > + uint32_t caps2; > + uint32_t pm_caps; > + /* TODO: we will obtain these values from regulator and clock > + * phandles after LDO and clock function is OK > + */ You can do fixed clocks and regulators in DT until you have a driver in place. > + uint32_t base_clk; > + uint32_t signal_default_voltage; > +}; > + > +struct sdhost_caps_data sd_caps_info = { > + .name = "sd", > + .ocr_avail = MMC_VDD_29_30 | MMC_VDD_30_31, > + .caps = SDHOST_CAPS, > + .caps2 = MMC_CAP2_HC_ERASE_SZ, > + .pm_caps = MMC_PM_WAKE_SDIO_IRQ, > + .base_clk = 192000000, > + .signal_default_voltage = 3000000, > +}; > + > +struct sdhost_caps_data wifi_caps_info = { > + .name = "wifi", > + .ocr_avail = MMC_VDD_165_195 | MMC_VDD_29_30 | > + MMC_VDD_30_31 | MMC_VDD_32_33 | MMC_VDD_33_34, > + .caps = SDHOST_CAPS | MMC_CAP_POWER_OFF_CARD | MMC_CAP_UHS_SDR12, Is powering off a card a capability of the SD host controller or just the regulator control you have? > + .pm_caps = MMC_PM_KEEP_POWER | MMC_PM_IGNORE_PM_NOTIFY, > + .base_clk = 76000000, > +}; > + > +struct sdhost_caps_data emmc_caps_info = { > + .name = "emmc", > + .ocr_avail = MMC_VDD_29_30 | MMC_VDD_30_31, > + .caps = SDHOST_CAPS | > + MMC_CAP_8_BIT_DATA | MMC_CAP_UHS_SDR12 | > + MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_DDR50 | MMC_CAP_MMC_HIGHSPEED, > + .caps2 = MMC_CAP2_FULL_PWR_CYCLE | MMC_CAP2_HC_ERASE_SZ, > + .pm_caps = MMC_PM_WAKE_SDIO_IRQ, > + .base_clk = 192000000, > + .signal_default_voltage = 1800000, > +}; > + > +const struct of_device_id sdhost_of_match[] = { > + {.compatible = "sprd,sd-sdhost-3.0", .data = &sd_caps_info,}, > + {.compatible = "sprd,wifi-sdhost-3.0", .data = &wifi_caps_info,}, > + {.compatible = "sprd,emmc-sdhost-3.0", .data = &emmc_caps_info,}, What these are connected to is irrelevant to the driver and compatible string. All these differences belong in the DT unless the IP blocks are really different. Rob -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/