From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D601C433F4 for ; Mon, 13 Jul 2020 06:19:01 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3EC022065F for ; Mon, 13 Jul 2020 06:19:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BgAPkgjj"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="aNl3g7zA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EC022065F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kSKSOT4VXHfdZj1+5L+z9+4FtPmZhbPdGs5VD8Lw+7c=; b=BgAPkgjjOAdZuzNsGyoZC40bp H8fihkU/rZZAeGsV1L03aUCjynjzTjgxOB1ygr0WTeAl5RINt/YDp97zEUTGiZLrnHzDWv9RhYlJd wy+NZXbK2jUUZYZSBbs4Mq3Lg27+lxkUts24Bjf+PBIC/d1jCrPLWLAo+b7MgODqOkW+k7pxelDRa OJgqKQKLIiGMwR5rTG8vdZhlK1vtlZCVdlOPTiTrb6lufcVjDoa5cedM6Q+ZnKOBvp0bnvCRlqFoq kNU8KSRLhKRmul83WyQJOtENUJ+Hc7xkz1FdE/Diz24h4MBotWj732eH8xJPsxnnKpZJA78n78HiK XLB7zOT0g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jurmc-0001cS-23; Mon, 13 Jul 2020 06:17:46 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jurmZ-0001bP-As for linux-arm-kernel@lists.infradead.org; Mon, 13 Jul 2020 06:17:44 +0000 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 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-Disposition: inline In-Reply-To: <20200703171135.77389-2-alim.akhtar@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200713_021743_500999_E2A27611 X-CRM114-Status: GOOD ( 13.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, krzk@kernel.org, kwmad.kim@samsung.com, robh+dt@kernel.org, kishon@ti.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel