From patchwork Thu May 12 22:43:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9086611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8504D9F1D3 for ; Thu, 12 May 2016 22:46:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B7F052024C for ; Thu, 12 May 2016 22:46:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D2D8F20225 for ; Thu, 12 May 2016 22:46:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0zLL-0002Op-Hk; Thu, 12 May 2016 22:44:31 +0000 Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0zL3-0002FR-82 for linux-arm-kernel@lists.infradead.org; Thu, 12 May 2016 22:44:14 +0000 Received: by mail-pa0-x22b.google.com with SMTP id iv1so33658066pac.2 for ; Thu, 12 May 2016 15:43:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bVJqD59ZMApx1A9NhYcrAo3AT0NtNAvvnJS/UIDwVAw=; b=TXLDEHS0koGNeuIlvlTmJWa6xcaqpzi2nzr8ypBXqa/rVJdjxcmYw5JPHYN5NvCfXV XWu2RN4lf4I9bCuuHS/xZ8D1s2PzCtBhXgHZccTB3i3aExsQt7NbCaCwSzKEJYB+FRMa Z0esTSzoTHdwAnF1C6os2YjkT5Hnz2hksIT/w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bVJqD59ZMApx1A9NhYcrAo3AT0NtNAvvnJS/UIDwVAw=; b=KP01ykDWzEdliCrkysH+ihJmdKZNGoU66oox8m2SnoZtrhQ40znkW7bcn12ozR6uTO +nKCtFViDM3GBq/B9JBFzHQ/AhpX7JTGu1sAu/z8jeBBT9zqGkwG3PlLkYVGeOL2gX6A YZgNAiicysp2dySHd2MI7RUABXb1/m9KX2zgNepwQYJsSyh/TLy3YlSoBRmKwUJoGwD8 WWrfJ6ZH0pZckMB+u/7H91nTQJ09oZ37FqflZyRac3fCngkZLaalVSajX9mfOfHioQF8 om7PGCHizNg0NORV/PW0nCUY5X/OrDxfq5HPNbK4avS/cWJHcfqTsVo0dVjSWzpPB05b 9T5A== X-Gm-Message-State: AOPr4FWBY6ldmyFwV82lmQkx3C81bWkzM2stFumaqXvWvcRjzrx6W02cVUqOYkIFkM7UOyuZ X-Received: by 10.66.248.6 with SMTP id yi6mr17610870pac.86.1463093032787; Thu, 12 May 2016 15:43:52 -0700 (PDT) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id 28sm22189254pfr.89.2016.05.12.15.43.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 May 2016 15:43:52 -0700 (PDT) From: Brian Norris To: Kishon Vijay Abraham I Subject: [PATCH 3/4] phy: rockchip-emmc: configure default output tap delay Date: Thu, 12 May 2016 15:43:05 -0700 Message-Id: <1463092986-61777-3-git-send-email-briannorris@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1463092986-61777-1-git-send-email-briannorris@chromium.org> References: <1463092986-61777-1-git-send-email-briannorris@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160512_154413_328238_576BA2B1 X-CRM114-Status: GOOD ( 14.03 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , Shawn Lin , Brian Norris , Doug Anderson , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Brian Norris , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The output tap delay controls helps maintain the hold requirements for eMMC. The exact value is dependent on the SoC and other factors, though it isn't really an exact science. But the default of 0 is not very good, as it doesn't give the eMMC much hold time, so let's bump up to 4 (approx 90 degree phase?). If we need to configure this any further (e.g., based on board or speed factors), we may need to consider a device tree representation. Suggested-by: Shawn Lin Signed-off-by: Brian Norris Tested-by: Heiko Stuebner Acked-by: Kishon Vijay Abraham I --- drivers/phy/phy-rockchip-emmc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c index 5641dede32f6..f94d3a6587ed 100644 --- a/drivers/phy/phy-rockchip-emmc.c +++ b/drivers/phy/phy-rockchip-emmc.c @@ -69,6 +69,11 @@ #define PHYCTRL_DR_66OHM 0x2 #define PHYCTRL_DR_100OHM 0x3 #define PHYCTRL_DR_40OHM 0x4 +#define PHYCTRL_OTAPDLYENA 0x1 +#define PHYCTRL_OTAPDLYENA_MASK 0x1 +#define PHYCTRL_OTAPDLYENA_SHIFT 0xb +#define PHYCTRL_OTAPDLYSEL_MASK 0xf +#define PHYCTRL_OTAPDLYSEL_SHIFT 0x7 struct rockchip_emmc_phy { unsigned int reg_offset; @@ -181,6 +186,20 @@ static int rockchip_emmc_phy_power_on(struct phy *phy) PHYCTRL_DR_MASK, PHYCTRL_DR_SHIFT)); + /* Output tap delay: enable */ + regmap_write(rk_phy->reg_base, + rk_phy->reg_offset + GRF_EMMCPHY_CON0, + HIWORD_UPDATE(PHYCTRL_OTAPDLYENA, + PHYCTRL_OTAPDLYENA_MASK, + PHYCTRL_OTAPDLYENA_SHIFT)); + + /* Output tap delay */ + regmap_write(rk_phy->reg_base, + rk_phy->reg_offset + GRF_EMMCPHY_CON0, + HIWORD_UPDATE(4, + PHYCTRL_OTAPDLYSEL_MASK, + PHYCTRL_OTAPDLYSEL_SHIFT)); + /* Power up emmc phy analog blocks */ ret = rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_ON); if (ret)