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=-12.2 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham 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 1A528C433E6 for ; Fri, 15 Jan 2021 13:03:52 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 47A1B22473 for ; Fri, 15 Jan 2021 13:03:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 47A1B22473 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3D559178B; Fri, 15 Jan 2021 14:02:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3D559178B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610715829; bh=1sSmbT74MAWdX3F/HVg+EzumTjxaXJpTjyVPLaBS/XA=; h=Subject:From:To:References:Date:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gSyDqiDtq4zFmIjsFkOn1y3PiHMBjjTbc8oI0ofNiv65piDVA21qCBkdFvmkXw5Dg UBh6A+MOrk2c7ikPVC5m+ScaekSmjabkva7YJGZ4g0gtSXw8DAkBbipqQFEO98FuGA Hs3wDP5uHu4ytYmT8fyEa7/PqIDDNGEGHwBzg2+c= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B1B1FF8016D; Fri, 15 Jan 2021 14:02:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A6EE5F801ED; Fri, 15 Jan 2021 14:02:56 +0100 (CET) Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5F6D2F80113 for ; Fri, 15 Jan 2021 14:02:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5F6D2F80113 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hucXtmX2" Received: by mail-lj1-x231.google.com with SMTP id m13so10237346ljo.11 for ; Fri, 15 Jan 2021 05:02:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Ced3NxvYK3fUREKoo4RuGKO8nItMO6rbOL9yPMeNSOA=; b=hucXtmX2CLjSjXIeLSPOZ5kLbLG4UtSP8wR/Weha9hA+jClqCuD1CGIg1DAS4NAIVS 8b+lrciqxAGBr2MJnz5JrRaUc9cGb7AY9E+XRihDqQd/5EYG8xoJ5BJY9Dk4/u4OiEp5 Udo5JPNQiHQbdP63KJGNhSvQ2pKNCvLiWshOj2XZjFk/73ulW9g5YglPv9n3KQhSd6fR GOtp9b/ALqb5L5zm+1ZTYylQeGnuAkanfAjdke63gsHywW70CWSr3eH76r8akVfzhLbw N5GHY8YaabL2Apmh50ZOKiMWw6zlZ/oG1djh1V3GSqJl3Of8/hBsww2uW7PuN/il7FUb 80jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Ced3NxvYK3fUREKoo4RuGKO8nItMO6rbOL9yPMeNSOA=; b=Ho/L+aoHq+Cjhhz0VSUnafAN3QwYH2bf7UaONxkJQpb4EE6vzBkV5wBnIP02Qxszv/ 2TXsD4yq3u4hPm7e+9UyWVc+93wSOtF+gwyc9YCQyqfiP7VLYYwjz528Yu8Nqwv5MQou wTY9QL3a1mq2YwbVkuH6I/4JyjI7BKeXG7j4cm/LaqxW0tg3BAkLvau3ZhJI/r1cDO4J M0rzi1tK7FBXbVDxG7zBjxk88w/LP758w3K1c9ykcLxxTAVTJDC7gqvW7ds/aWLOwbh1 t+ycOh/COH48nMoftoKB5H8nAHTu3Agr3pkPIUl89mdhRKY4GKlJVTCBDijbF4jKet2w JnmA== X-Gm-Message-State: AOAM530nNd7ic9pdevM7F5lxVoFjEI0XWd4S0tGvkNYDnymUxv4GNQ5p BgGe/zGNY6zeArCU0+CQFew= X-Google-Smtp-Source: ABdhPJy1VyYGCB2G9pvcPq97w0TzAlqZ2ViCpO83g6XVhyil0OoITD43h7+sCiO7pF/mO4Td/ZQ4wQ== X-Received: by 2002:a05:651c:1282:: with SMTP id 2mr5260045ljc.383.1610715771914; Fri, 15 Jan 2021 05:02:51 -0800 (PST) Received: from [192.168.2.145] (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.googlemail.com with ESMTPSA id z9sm892667lfs.183.2021.01.15.05.02.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Jan 2021 05:02:51 -0800 (PST) Subject: Re: [PATCH v1 5/5] ASoC: tegra: ahub: Reset hardware properly From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Sameer Pujar , Peter Geis , Nicolas Chauvet , Takashi Iwai , Jaroslav Kysela References: <20210112125834.21545-1-digetx@gmail.com> <20210112125834.21545-6-digetx@gmail.com> Message-ID: <5d99eba8-a169-1dc1-c7ab-0734c67c50b7@gmail.com> Date: Fri, 15 Jan 2021 16:02:50 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.2 MIME-Version: 1.0 In-Reply-To: <20210112125834.21545-6-digetx@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 12.01.2021 15:58, Dmitry Osipenko пишет: > Assert hardware reset before clocks are enabled and then de-assert it > after clocks are enabled. This brings hardware into a predictable state > and removes relying on implicit de-assertion of resets which is done by > the clk driver. > > Tested-by: Peter Geis > Tested-by: Nicolas Chauvet > Signed-off-by: Dmitry Osipenko > --- > sound/soc/tegra/tegra30_ahub.c | 33 ++++++++++++++++----------------- > sound/soc/tegra/tegra30_ahub.h | 1 + > 2 files changed, 17 insertions(+), 17 deletions(-) > > diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c > index 4dbb58f7ea36..246cf6a373a1 100644 > --- a/sound/soc/tegra/tegra30_ahub.c > +++ b/sound/soc/tegra/tegra30_ahub.c > @@ -65,10 +65,20 @@ static int tegra30_ahub_runtime_resume(struct device *dev) > { > int ret; > > + ret = reset_control_assert(ahub->reset); > + if (ret) > + return ret; > + > ret = clk_bulk_prepare_enable(ahub->nclocks, ahub->clocks); > if (ret) > return ret; > > + ret = reset_control_reset(ahub->reset); > + if (ret) { > + clk_bulk_disable_unprepare(ahub->nclocks, ahub->clocks); > + return ret; > + } > + > regcache_cache_only(ahub->regmap_apbif, false); > regcache_cache_only(ahub->regmap_ahub, false); I just realized that this is incorrect version of the patch which misses the regcache syncing after the h/w reset. I'll make a v2. 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=-14.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 E8F19C433E6 for ; Fri, 15 Jan 2021 13:04:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE92A221FA for ; Fri, 15 Jan 2021 13:04:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731945AbhAONDi (ORCPT ); Fri, 15 Jan 2021 08:03:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733115AbhAONDe (ORCPT ); Fri, 15 Jan 2021 08:03:34 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E458C061757; Fri, 15 Jan 2021 05:02:53 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id p13so10320188ljg.2; Fri, 15 Jan 2021 05:02:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Ced3NxvYK3fUREKoo4RuGKO8nItMO6rbOL9yPMeNSOA=; b=hucXtmX2CLjSjXIeLSPOZ5kLbLG4UtSP8wR/Weha9hA+jClqCuD1CGIg1DAS4NAIVS 8b+lrciqxAGBr2MJnz5JrRaUc9cGb7AY9E+XRihDqQd/5EYG8xoJ5BJY9Dk4/u4OiEp5 Udo5JPNQiHQbdP63KJGNhSvQ2pKNCvLiWshOj2XZjFk/73ulW9g5YglPv9n3KQhSd6fR GOtp9b/ALqb5L5zm+1ZTYylQeGnuAkanfAjdke63gsHywW70CWSr3eH76r8akVfzhLbw N5GHY8YaabL2Apmh50ZOKiMWw6zlZ/oG1djh1V3GSqJl3Of8/hBsww2uW7PuN/il7FUb 80jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Ced3NxvYK3fUREKoo4RuGKO8nItMO6rbOL9yPMeNSOA=; b=HnGdCL1q6PTVJl7YTlLknq3Q4tbH+OF1+ns88xtkv+EZpiDpfdAtAY4fZ8q+3OAeDm AC105dA04O6rERCd/+nKbkJ5bn3dwxLXG2N6MZry+gW5PaKNBKuiUBjch36+E1Ae8ziW axqACP9NnDURDTQ1YC6gN3sWnFHkz0XBS8fUwax2QBqy54KPmnp/3OVJg7TXpajo4+AI hLPz6FxMCidd0dg399GgIN6cbYq70XZSXwj7NgFvdSPRh8d7j1mTsUXntzpLFyIyeV4Y 5zRMZ4YiVZUTf/YCgnialx0ZnQbG8AleT9wv5QhmS7lSb36u2LHfqiN1BD0wUfPNztnH EejA== X-Gm-Message-State: AOAM5311dnygnv6SoSJ6e8FEDqMm27aLQC1Z0bGBaEk61yqr3QLJx3pW M+By8ndST/UqLC5Clp6VBKILiC2eGng= X-Google-Smtp-Source: ABdhPJy1VyYGCB2G9pvcPq97w0TzAlqZ2ViCpO83g6XVhyil0OoITD43h7+sCiO7pF/mO4Td/ZQ4wQ== X-Received: by 2002:a05:651c:1282:: with SMTP id 2mr5260045ljc.383.1610715771914; Fri, 15 Jan 2021 05:02:51 -0800 (PST) Received: from [192.168.2.145] (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.googlemail.com with ESMTPSA id z9sm892667lfs.183.2021.01.15.05.02.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Jan 2021 05:02:51 -0800 (PST) Subject: Re: [PATCH v1 5/5] ASoC: tegra: ahub: Reset hardware properly From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Sameer Pujar , Peter Geis , Nicolas Chauvet , Takashi Iwai , Jaroslav Kysela Cc: alsa-devel@alsa-project.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210112125834.21545-1-digetx@gmail.com> <20210112125834.21545-6-digetx@gmail.com> Message-ID: <5d99eba8-a169-1dc1-c7ab-0734c67c50b7@gmail.com> Date: Fri, 15 Jan 2021 16:02:50 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.2 MIME-Version: 1.0 In-Reply-To: <20210112125834.21545-6-digetx@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org 12.01.2021 15:58, Dmitry Osipenko пишет: > Assert hardware reset before clocks are enabled and then de-assert it > after clocks are enabled. This brings hardware into a predictable state > and removes relying on implicit de-assertion of resets which is done by > the clk driver. > > Tested-by: Peter Geis > Tested-by: Nicolas Chauvet > Signed-off-by: Dmitry Osipenko > --- > sound/soc/tegra/tegra30_ahub.c | 33 ++++++++++++++++----------------- > sound/soc/tegra/tegra30_ahub.h | 1 + > 2 files changed, 17 insertions(+), 17 deletions(-) > > diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c > index 4dbb58f7ea36..246cf6a373a1 100644 > --- a/sound/soc/tegra/tegra30_ahub.c > +++ b/sound/soc/tegra/tegra30_ahub.c > @@ -65,10 +65,20 @@ static int tegra30_ahub_runtime_resume(struct device *dev) > { > int ret; > > + ret = reset_control_assert(ahub->reset); > + if (ret) > + return ret; > + > ret = clk_bulk_prepare_enable(ahub->nclocks, ahub->clocks); > if (ret) > return ret; > > + ret = reset_control_reset(ahub->reset); > + if (ret) { > + clk_bulk_disable_unprepare(ahub->nclocks, ahub->clocks); > + return ret; > + } > + > regcache_cache_only(ahub->regmap_apbif, false); > regcache_cache_only(ahub->regmap_ahub, false); I just realized that this is incorrect version of the patch which misses the regcache syncing after the h/w reset. I'll make a v2.