Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp419170rwd; Tue, 30 May 2023 23:32:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7mtYJEQ/Go5vYmIakNEtAYxTy0TRYZL7oz50zcRwD0En5yyfNKjB5geiZUWlmsqdgcpTph X-Received: by 2002:a37:ad06:0:b0:75b:23a0:e7d1 with SMTP id f6-20020a37ad06000000b0075b23a0e7d1mr4084616qkm.50.1685514750220; Tue, 30 May 2023 23:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685514750; cv=none; d=google.com; s=arc-20160816; b=MMKCwx0+LWwzJkS0h1UVzMFoSTuqZNsqI+6oww3WFBJcL5Gt/8RGDlOe4Db5q88zSD js2akfCrjlNaR7YitEWcpv3fcG/ZxFR9jI1iExRxuIZ7wTg1tHmrAbjwTZ1NBXmWnu4X k3xAwXesQwVPdRm1Bv6ULijM2huTehD+vJUiesBVmEtIbyS/QhlQ6ZuiHb9Ec2ZbsNwW S01L6wsft+3gP7d2FpDHVJK6CGpQPUQbh+wSwcjpMjtjluCmFTyYhlqdGcRS/Z2loYTj 2/Y34MM1nC8t5YZYN5hW8oRuyPtKZFy4OWChU3vyuVllUV8GC50olvJbuJ0RLY/HCopq eqdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=Yf3EUpJoxdwoZUiXd5buPmMuQ6nx0e7iCaR+6uMzES4=; b=kOHxyLE+xeZMc0RwEv1A2wdHCeq1mF3kMeHA1s/O6myikVRjoJMZkW3iO7Z9merx7T 2MwOCH8N1zm8VfvPpDh3y8bYcLPTAwjTKPsuzdHAjs42PmxWHm9L+yv1nIiApJ4P6EQR 5Jmuc0xo//CVu46Lut4M3VwNGeljrRcVGYF5tc6sowk+P4KTXnG2aZqYimF9KbZnlriB NXbA5twVxm3HCvj5MaLWEuFMUZJOkMX4xJ1TEe7fz0Kyt9tz2ZHEX9bvxmsEjdmaEjT8 ONrTV2jGMer60UD4UWLt+qdk4RDxqPycUa0DcJslzujwcDppPqozm63mm+bm/SXgZtDq w6dw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a63b512000000b0053b86623b3asi445919pge.577.2023.05.30.23.32.15; Tue, 30 May 2023 23:32:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234341AbjEaGTZ (ORCPT + 99 others); Wed, 31 May 2023 02:19:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbjEaGTY (ORCPT ); Wed, 31 May 2023 02:19:24 -0400 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBB4A9F; Tue, 30 May 2023 23:19:20 -0700 (PDT) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id DEEC224DDBE; Wed, 31 May 2023 14:19:17 +0800 (CST) Received: from EXMBX168.cuchost.com (172.16.6.78) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 31 May 2023 14:19:17 +0800 Received: from [192.168.120.57] (171.223.208.138) by EXMBX168.cuchost.com (172.16.6.78) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 31 May 2023 14:19:16 +0800 Message-ID: <93ba0b97-45aa-e59d-1454-80c4f245acc0@starfivetech.com> Date: Wed, 31 May 2023 14:19:16 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v1 2/3] spi: cadence-quadspi: Add clock configuration for StarFive JH7110 QSPI Content-Language: en-US To: Mark Brown CC: , , , , "Rob Herring" , Krzysztof Kozlowski , Conor Dooley , "Emil Renner Berthing" , Ziv Xu References: <20230526062529.46747-1-william.qiu@starfivetech.com> <20230526062529.46747-3-william.qiu@starfivetech.com> <042c560d-1f36-8e97-3796-7423245592f4@starfivetech.com> <86555925-b8dd-29a8-60cd-5c2ff2c1432a@starfivetech.com> From: William Qiu In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX168.cuchost.com (172.16.6.78) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/5/30 18:33, Mark Brown wrote: > On Tue, May 30, 2023 at 10:05:38AM +0800, William Qiu wrote: >> On 2023/5/29 14:44, William Qiu wrote: >> > On 2023/5/26 23:36, Mark Brown wrote: > >> >> Nothing ever disables or unprepares this clock as far as I can tell? >> >> Perhaps also consider using the clk_bulk_ APIs. > >> > I will add in next version. > >> Now I want to replace the original devm_clk_get API in the >> driver with devm_clk_bulk_get_all API, which can achieve compatibility, >> but it seems that it is not good for other ip with only one clock, so I >> want to ask about that can I replace it? Or define that inside jh7110? > > You could always specify a different array of clocks depending on which > compatible the driver sees, just like you'd conditionally request clocks > individually. Hi Mark, If specify a different array of clocks depending on which compatible the driver sees, since there will also be clock operations in the suspend and resume interfaces, this can make the code look complicated. My thoughts are as follows: Modify the following code 1658 /* Obtain QSPI clock. */ 1659 cqspi->clk = devm_clk_get(dev, NULL); 1660 if (IS_ERR(cqspi->clk)) { 1661 dev_err(dev, "Cannot claim QSPI clock.\n"); 1662 ret = PTR_ERR(cqspi->clk); 1663 return ret; 1664 } as following: /* Obtain QSPI clock. */ cqspi->num_clks = devm_clk_bulk_get_all(dev, &cqspi->clks); if (cqspi->num_clks < 0) { dev_err(dev, "Cannot claim QSPI clock: %u\n", cqspi->num_clks); return -EINVAL; } This way, the code will look simpler and clearer. How do you think about it. Best Regards, William