From patchwork Mon Jun 13 05:30:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 634304 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3rShG568f6z9t0P for ; Mon, 13 Jun 2016 15:31:08 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=OfP17jwg; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 40E97A75FF; Mon, 13 Jun 2016 07:31:05 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IfMKHLDsbLzg; Mon, 13 Jun 2016 07:31:05 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B1510A7558; Mon, 13 Jun 2016 07:31:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7D5D3A74D6 for ; Mon, 13 Jun 2016 07:31:01 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1c2a1mrszzkA for ; Mon, 13 Jun 2016 07:31:01 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.42]) by theia.denx.de (Postfix) with ESMTPS id 1639BA74D2 for ; Mon, 13 Jun 2016 07:30:58 +0200 (CEST) Received: by mail-it0-f42.google.com with SMTP id a5so40457047ita.1 for ; Sun, 12 Jun 2016 22:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=aTC0jCs4mNnI1IQpYOZgJALfs2JlgBBT87wEvTE3Pvc=; b=OfP17jwg49zgGAK/6Jo6Hu89MKvqxXX5CL1vGdtrPoouZ8uhnAnkYGhrDLuUABslrI pQOHCJ/Bdtpj6oQUUdldJO4VXifOZyZFbacKJUNBOpuRQ/VN9J06Uf+S+ekx2BwxTyKJ z5flh9FHGQCrkcHhC3yoM2qyqNvXyvhIq2twJG4AMskCNbcnRRou/7AHZo+6PKSxam4I UM8HQ/tZTZ8Aw64iKJ5h9BfMGZjClz0LTv7RyWk8lx25lJsCRbGRvi7FKPeh1qVUeqZO 5zcsuSiiQHTVhZ7/Xa+u6E05MMDbQKUwNzkGi0l6FtwMvDaut3lXKlG0Gl50Npz+4+yM thgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=aTC0jCs4mNnI1IQpYOZgJALfs2JlgBBT87wEvTE3Pvc=; b=Hg+dKbEfj+bIpRxJpOOmBK1ZTg8mGtpXJDwph9NoGIRgeAgXZZcLY3BJwfUtXSZW9W ucfPvsxaLjpzcbZ2JgmxFcwza0TC/XfwuO7nnfSEx3/8ODhQHvc8k7HXV2eT9Gns6nGr MY/5G+Usov3JUPsw8v905DbmGkEEfOcblkvucx97DZFgWI06hiaBh+/YaJ/xnTbC0clS kwHzxc0rIUOXEaTGaDNwqq68GDnZEfEnwD4cRevB/qcsiNd8lZ3783hgH8g1Jhj9CoWQ /JvYYkwyBRKZ9XD0vC5GOo6+2oJ/nxAYuo1CLxYA9ErCWQeJgqu+aTj5menDmoUzO4wg u4Zg== X-Gm-Message-State: ALyK8tJviZgQhn8cxH2/PwzZ2/bJIBPKYE1PTKDfN1lQp1q2whAXugTFmbypcQ6OuYYJ7kqA X-Received: by 10.36.53.204 with SMTP id k195mr14653955ita.59.1465795856826; Sun, 12 Jun 2016 22:30:56 -0700 (PDT) Received: from kaki.bld.corp.google.com ([100.100.202.57]) by smtp.gmail.com with ESMTPSA id w63sm5660351itf.6.2016.06.12.22.30.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Jun 2016 22:30:56 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 67DFE22169C; Sun, 12 Jun 2016 23:30:55 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 12 Jun 2016 23:30:13 -0600 Message-Id: <1465795839-16632-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1465795839-16632-1-git-send-email-sjg@chromium.org> References: <1465795839-16632-1-git-send-email-sjg@chromium.org> Cc: huang lin , Pantelis Antoniou , Jaehoon Chung Subject: [U-Boot] [PATCH 01/27] dm: mmc: dwmmc: Add comments to the dwmmc setup functions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" These comments were missed when the original code was written. Add them to help people port their drivers over. Signed-off-by: Simon Glass --- include/dwmmc.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/include/dwmmc.h b/include/dwmmc.h index 335af51..0199def 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -224,9 +224,73 @@ static inline u8 dwmci_readb(struct dwmci_host *host, int reg) return readb(host->ioaddr + reg); } +#ifdef CONFIG_BLK +/** + * dwmci_setup_cfg() - Set up the configuration for DWMMC + * + * This is used to set up a DWMMC device when you are using CONFIG_BLK. + * + * This should be called from your MMC driver's probe() method once you have + * the information required. + * + * Generally your driver will have a platform data structure which holds both + * the configuration (struct mmc_config) and the MMC device info (struct mmc). + * For example: + * + * struct rockchip_mmc_plat { + * struct mmc_config cfg; + * struct mmc mmc; + * }; + * + * ... + * + * Inside U_BOOT_DRIVER(): + * .platdata_auto_alloc_size = sizeof(struct rockchip_mmc_plat), + * + * To access platform data: + * struct rockchip_mmc_plat *plat = dev_get_platdata(dev); + * + * See rockchip_dw_mmc.c for an example. + * + * @cfg: Configuration structure to fill in (generally &plat->mmc) + * @name: Device name (normally dev->name) + * @buswidth: Bus width (in bits, such as 4 or 8) + * @caps: Host capabilities (MMC_MODE_...) + * @max_clk: Maximum supported clock speed in HZ (e.g. 400000) + * @min_clk: Minimum supported clock speed in HZ (e.g. 150000000) + */ void dwmci_setup_cfg(struct mmc_config *cfg, const char *name, int buswidth, uint caps, u32 max_clk, u32 min_clk); + +/** + * dwmci_bind() - Set up a new MMC block device + * + * This is used to set up a DWMMC block device when you are using CONFIG_BLK. + * It should be called from your driver's bind() method. + * + * See rockchip_dw_mmc.c for an example. + * + * @dev: Device to set up + * @mmc: Pointer to mmc structure (normally &plat->mmc) + * @cfg: Empty configuration structure (generally &plat->cfg). This is + * normally all zeroes at this point. The only purpose of passing + * this in is to set mmc->cfg to it. + * @return 0 if OK, -ve if the block device could not be created + */ int dwmci_bind(struct udevice *dev, struct mmc *mmc, struct mmc_config *cfg); +#else +/** + * add_dwmci() - Add a new DWMMC interface + * + * This is used when you are not using CONFIG_BLK. Convert your driver over! + * + * @host: DWMMC host structure + * @max_clk: Maximum supported clock speed in HZ (e.g. 400000) + * @min_clk: Minimum supported clock speed in HZ (e.g. 150000000) + * @return 0 if OK, -ve on error + */ int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk); +#endif /* !CONFIG_BLK */ + #endif /* __DWMMC_HW_H */