From patchwork Thu May 12 22:43:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9086581 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 9E3A89F1D3 for ; Thu, 12 May 2016 22:45:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D19CE2024C for ; Thu, 12 May 2016 22:45:55 +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 EAA2620225 for ; Thu, 12 May 2016 22:45:54 +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 1b0zL5-0002It-L8; Thu, 12 May 2016 22:44:15 +0000 Received: from mail-pa0-x233.google.com ([2607:f8b0:400e:c03::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0zL2-0002FO-AC for linux-arm-kernel@lists.infradead.org; Thu, 12 May 2016 22:44:12 +0000 Received: by mail-pa0-x233.google.com with SMTP id iv1so33657948pac.2 for ; Thu, 12 May 2016 15:43:52 -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=kWGPqzWH+ssMAISmsW65jXTTD2D24TXiyhXsxyN3l4A=; b=K9tNhr1pVF6IQ3o/++y2m/fxJHzXMlSbaRqWqRkYgDcgYhDp7cd0ZTE87PEwf+zuNI lHZEJDszPlYcrFxTH9jfsRZvISgmH1J0zIv3Lj7jJFWeYye7GNmSIW6gi6+EEimF4aRp BSm5pPSQwjepcpX71Nb247iSs9CILvNb2csGA= 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=kWGPqzWH+ssMAISmsW65jXTTD2D24TXiyhXsxyN3l4A=; b=abpgWlk+7RMUXMWm1C3NwA8ulrMsdxWIYAtH5Jnrchw7ncx3wBwOE7aZFMpHeeKl5f DP5fDiVxPgB8ugZ3cKnuJsfrBgiakbJZ2m4yZTR8G32RbITq5uyq/q8nda5n2MEk2nQo AN/BuTi91upcJ9kDKO35GO/K/XwX/rPxzsDL+BtoeyNgNPX4h18XtoIVBxT0+YP2tKhy Fpl/tglXVcbgCh3t7srpl+3ayeR3NX6r7ul1qt7hx3UuDWtOfKfdW6qI0rYbEpNMWS6A mLGXg9zlZn8Eoa6spcxB9xUFN6FkW+NK5VNXDey+g5/zk81MNh5j2y10vXibSp34wFOE hHgA== X-Gm-Message-State: AOPr4FUJ15+5uDq4cb2JlsYJU5/iZ6ZxkC2f6umaXZ7OAe30z7YGsiWJ3Hsibzn8xx78CjcC X-Received: by 10.66.151.104 with SMTP id up8mr16038136pab.134.1463093031859; Thu, 12 May 2016 15:43:51 -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:51 -0700 (PDT) From: Brian Norris To: Kishon Vijay Abraham I Subject: [PATCH 2/4] phy: rockchip-emmc: configure frequency range and drive impedance Date: Thu, 12 May 2016 15:43:04 -0700 Message-Id: <1463092986-61777-2-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_154412_419866_64776474 X-CRM114-Status: GOOD ( 12.73 ) 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 From: Shawn Lin Signal integrity analysis has suggested we set these values. Do this in power_on(), so that they get reconfigured after suspend/resume. Signed-off-by: Shawn Lin Signed-off-by: Brian Norris Acked-by: Kishon Vijay Abraham I --- drivers/phy/phy-rockchip-emmc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c index 48cbe691a889..5641dede32f6 100644 --- a/drivers/phy/phy-rockchip-emmc.c +++ b/drivers/phy/phy-rockchip-emmc.c @@ -56,6 +56,19 @@ #define PHYCTRL_DLLRDY_SHIFT 0x5 #define PHYCTRL_DLLRDY_DONE 0x1 #define PHYCTRL_DLLRDY_GOING 0x0 +#define PHYCTRL_FREQSEL_200M 0x0 +#define PHYCTRL_FREQSEL_50M 0x1 +#define PHYCTRL_FREQSEL_100M 0x2 +#define PHYCTRL_FREQSEL_150M 0x3 +#define PHYCTRL_FREQSEL_MASK 0x3 +#define PHYCTRL_FREQSEL_SHIFT 0xc +#define PHYCTRL_DR_MASK 0x7 +#define PHYCTRL_DR_SHIFT 0x4 +#define PHYCTRL_DR_50OHM 0x0 +#define PHYCTRL_DR_33OHM 0x1 +#define PHYCTRL_DR_66OHM 0x2 +#define PHYCTRL_DR_100OHM 0x3 +#define PHYCTRL_DR_40OHM 0x4 struct rockchip_emmc_phy { unsigned int reg_offset; @@ -154,6 +167,20 @@ static int rockchip_emmc_phy_power_on(struct phy *phy) struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy); int ret = 0; + /* DLL operation: 170 to 200 MHz */ + regmap_write(rk_phy->reg_base, + rk_phy->reg_offset + GRF_EMMCPHY_CON0, + HIWORD_UPDATE(PHYCTRL_FREQSEL_200M, + PHYCTRL_FREQSEL_MASK, + PHYCTRL_FREQSEL_SHIFT)); + + /* Drive impedance: 50 Ohm */ + regmap_write(rk_phy->reg_base, + rk_phy->reg_offset + GRF_EMMCPHY_CON6, + HIWORD_UPDATE(PHYCTRL_DR_50OHM, + PHYCTRL_DR_MASK, + PHYCTRL_DR_SHIFT)); + /* Power up emmc phy analog blocks */ ret = rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_ON); if (ret)