Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp749390ybh; Sun, 12 Jul 2020 23:20:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVj3iFc5vytyJ+p7/KYbGT8IIbGxTFN0N0SPgW48xeZ1GvbrnTLwqhKX6IiAmAJgCXeIf2 X-Received: by 2002:a50:af45:: with SMTP id g63mr5326188edd.52.1594621238717; Sun, 12 Jul 2020 23:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594621238; cv=none; d=google.com; s=arc-20160816; b=ZcZA6AySnaHG5UpzjSO0Ucd+K3jMOf20aA9R1HRXLbP2BL6DOeWVfO86XVQTvnuYf3 RDV/kXAOJvO4RrMZ9vGUu2gNRjXcpnKGcxTQFdk7fVApo3+VbyfVecNDg9/ZqMbvNQZh glOqt9D3TvpCL6D2ssuaGbyuU7S41e+WDGUX5Ts+lQAdWEfcDD/veZblzz5oeuTyg1Rw 75NH32D2SwaLsNP9VN3VE4ML1qmjPvMrGEcMMYZUBGM6rmp2xXsSMZO3Sg6bIsRgs5pm FZDo+eUxFYJzORvQlMgnGacyDZ74OLyBmSIoGkE663ujX5jBErgroBXKhm3uJv0MqZsd HD1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Q1nNG59uOezPd15ZiA9JgTx0CIDiLghdRBTHYaX5Y0k=; b=OKCXrvmF8Afdmwjkv6hpCFul5o3pMGAIJhppwuK1q5ULLRaKvK1HJF0zTxvysPyiA6 u+yQvgfncg47cOhcwhD4pTkrTlJsQkpZ0cTAqzP2DHeQ1v48oP6rwdL/7XhWlQdzFa77 LWSVo8HiEfj0qKMrMufFr0zaAjB9kxBHkjCB3S9s8Su/ERUEYLGcBSZHZYpLx0+VG+5E XgglnbekrlQXOLtfluiMXrbgZFEKV7GU54a2D4ktHlMOOXo3yFk240LGk2ZHZGXexFRL Ls/x59F9IERwxuGiK/+cDLH8l3yQUKhAV6DiLnJu0Dzf9VRu+o1wbQuIg0/w/qS/2xzD 6xig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aNl3g7zA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y16si4880991edv.476.2020.07.12.23.20.15; Sun, 12 Jul 2020 23:20:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aNl3g7zA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729021AbgGMGRn (ORCPT + 99 others); Mon, 13 Jul 2020 02:17:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:47338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726571AbgGMGRm (ORCPT ); Mon, 13 Jul 2020 02:17:42 -0400 Received: from localhost (unknown [122.182.251.219]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 16AD92065F; Mon, 13 Jul 2020 06:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594621062; bh=XlMSuqTpDlP5SWU0u/vnLYHw1UcIUbZbzLp5CEBxgos=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aNl3g7zAwv+h/dlFGVcJySB7qXgYhqSUXJL0PPfLcAGCk3tLLFl2RrRafkjXCinex QWnlowxFpGmoM2BSqp7SB5VYvrvyQSy5jbs96BqZRi0TjzeaYVt/IO+21BwLCy8xUg mzPQZ8Cj5k1e2eVM/4sghR236HDiiMZa9F51B2i0= Date: Mon, 13 Jul 2020 11:47:37 +0530 From: Vinod Koul To: Alim Akhtar Cc: robh+dt@kernel.org, krzk@kernel.org, kwmad.kim@samsung.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, kishon@ti.com Subject: Re: [PATCH v12 2/2] phy: samsung-ufs: add UFS PHY driver for samsung SoC Message-ID: <20200713061737.GD34333@vkoul-mobl> References: <20200703171135.77389-1-alim.akhtar@samsung.com> <20200703171135.77389-2-alim.akhtar@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200703171135.77389-2-alim.akhtar@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03-07-20, 22:41, Alim Akhtar wrote: > +static const struct samsung_ufs_phy_cfg exynos7_post_init_cfg[] = { > + END_UFS_PHY_CFG > +}; This is dummy, why not add a check to make config optional? > +static int samsung_ufs_phy_symbol_clk_init(struct samsung_ufs_phy *phy) > +{ > + int ret = 0; superfluous init, am sure I flagged it before as well > + > + phy->tx0_symbol_clk = devm_clk_get(phy->dev, "tx0_symbol_clk"); > + if (IS_ERR(phy->tx0_symbol_clk)) { > + dev_err(phy->dev, "failed to get tx0_symbol_clk clock\n"); > + goto out; > + } > + > + phy->rx0_symbol_clk = devm_clk_get(phy->dev, "rx0_symbol_clk"); > + if (IS_ERR(phy->rx0_symbol_clk)) { > + dev_err(phy->dev, "failed to get rx0_symbol_clk clock\n"); > + goto out; > + } > + > + phy->rx1_symbol_clk = devm_clk_get(phy->dev, "rx1_symbol_clk"); > + if (IS_ERR(phy->rx0_symbol_clk)) { > + dev_err(phy->dev, "failed to get rx1_symbol_clk clock\n"); > + goto out; > + } > + > + ret = clk_prepare_enable(phy->tx0_symbol_clk); > + if (ret) { > + dev_err(phy->dev, "%s: tx0_symbol_clk enable failed %d\n", __func__, ret); > + goto out; > + } > + > + ret = clk_prepare_enable(phy->rx0_symbol_clk); > + if (ret) { > + dev_err(phy->dev, "%s: rx0_symbol_clk enable failed %d\n", __func__, ret); > + clk_disable_unprepare(phy->tx0_symbol_clk); > + goto out; > + } > + > + ret = clk_prepare_enable(phy->rx1_symbol_clk); > + if (ret) { > + dev_err(phy->dev, "%s: rx1_symbol_clk enable failed %d\n", __func__, ret); > + clk_disable_unprepare(phy->tx0_symbol_clk); > + clk_disable_unprepare(phy->rx0_symbol_clk); maybe it will look better if we add common rollback and jump to proper labels > +static int samsung_ufs_phy_clks_init(struct samsung_ufs_phy *phy) > +{ > + int ret; > + > + phy->ref_clk = devm_clk_get(phy->dev, "ref_clk"); > + if (IS_ERR(phy->ref_clk)) > + dev_err(phy->dev, "failed to get ref_clk clock\n"); > + > + ret = clk_prepare_enable(phy->ref_clk); > + if (ret) { > + dev_err(phy->dev, "%s: ref_clk enable failed %d\n", __func__, ret); > + return ret; > + } > + > + dev_info(phy->dev, "UFS MPHY ref_clk_rate = %ld\n", clk_get_rate(phy->ref_clk)); debug pls > +static int samsung_ufs_phy_init(struct phy *phy) > +{ > + struct samsung_ufs_phy *_phy = get_samsung_ufs_phy(phy); ss_phy perhaps? > + int ret; > + > + _phy->lane_cnt = phy->attrs.bus_width; > + _phy->ufs_phy_state = CFG_PRE_INIT; > + > + if (_phy->drvdata->has_symbol_clk) { > + ret = samsung_ufs_phy_symbol_clk_init(_phy); > + if (ret) > + dev_err(_phy->dev, "failed to set ufs phy symbol clocks\n"); > + } > + > + ret = samsung_ufs_phy_clks_init(_phy); > + if (ret) > + dev_err(_phy->dev, "failed to set ufs phy clocks\n"); > + > + samsung_ufs_phy_calibrate(phy); > + > + return 0; not return samsung_ufs_phy_calibrate() ? -- ~Vinod