Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1728631imm; Thu, 27 Sep 2018 01:20:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV629QQ28390+AbWwly+80pSNRvCrk/j8AA1+3F0ZKKLg8mVfaqWAY6BMtUPZY5Tgtm0DsyAj X-Received: by 2002:a62:3306:: with SMTP id z6-v6mr10034522pfz.85.1538036429593; Thu, 27 Sep 2018 01:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538036429; cv=none; d=google.com; s=arc-20160816; b=pNwqF0xxr/GBgF0d0DEVqaoGkZr4VggQgo7eUW7uVETzZL9aq0LeqkfPXfzmohtoI9 +2Xph8N/yKHSmt4qFWe2Bd7Yy//d++cH6fKFAQACtgoi4QtiuR83WTlTTnWJ10hRQtc/ kzp5DYWC0Bp+nJaci6npcLUpoev99M6EBHa6PADOKoCQkLlvu2CCjtZcU317MrU4uFwU nrt/tbgJ5rJCbEE3Vy1fFBSvn3rXRF3wErituLkrCFbr04uLTAlM+cNThszJX3vtXWk3 PnGstHpy/KumYCDHcVOrkC6hGcdc96YeKlj31baq7XIJ+13gQbVdPH6M51GwuPEcFmPt ySSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=nvFFpHxuaBrCrXO9TscTrY6OTVJjHVtSU3C8VlJeWy0=; b=GAAduqzezsAFMokPvR3oFcUmfNONs04pgXIgGIPZ7y6WdFBBsI+y9Srd25halXoPxY o/ut1t3Lj7ngqgrb1wPR3aBcB0bOgeYKZLY/FE5BpgWFy3AXvrZVR119CKI/2I/rdgKR 1Fy8v2DMeqxs4c8Ecs79pCUFaSIDH8wxeL/NrbYABP2YhaW8NSZwDcggkPlkOJnmqfz0 6rTBwipE5UMiTnNgRAfqPyqFDUipBA86kg+ZkJqeBgLoJ4tZrKt+6xdR7TrWuSs1Ci/1 KXDXveI3MS8jzW0SLmDhM5SeljIvTFCsvCotqQBZ5RGjsVu5IwtwCvzUW2ISzHDPRg6Z j3Yg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 30-v6si1445825pla.282.2018.09.27.01.20.13; Thu, 27 Sep 2018 01:20:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726959AbeI0OgV (ORCPT + 99 others); Thu, 27 Sep 2018 10:36:21 -0400 Received: from mail-sz2.amlogic.com ([211.162.65.114]:40763 "EHLO mail-sz2.amlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726698AbeI0OgV (ORCPT ); Thu, 27 Sep 2018 10:36:21 -0400 Received: from [10.28.18.92] (10.28.18.92) by mail-sz2.amlogic.com (10.28.11.6) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 27 Sep 2018 16:19:38 +0800 Subject: Re: [PATCH v4 2/2] mtd: rawnand: meson: add support for Amlogic NAND flash controller To: Martin Blumenstingl , CC: , , , , , , , , Neil Armstrong , , , , , , , , , References: <1537433449-65213-1-git-send-email-jianxin.pan@amlogic.com> <1537433449-65213-3-git-send-email-jianxin.pan@amlogic.com> From: Liang Yang Message-ID: Date: Thu, 27 Sep 2018 16:16:31 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.28.18.92] X-ClientProxiedBy: mail-sz2.amlogic.com (10.28.11.6) To mail-sz2.amlogic.com (10.28.11.6) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Martin, On 9/22/2018 11:32 PM, Martin Blumenstingl wrote: > Hello, > > On Thu, Sep 20, 2018 at 10:51 AM Jianxin Pan wrote: > [snip] >> +static int meson_nfc_clk_init(struct meson_nfc *nfc) >> +{ >> + int ret; >> + >> + /* request core clock */ >> + nfc->core_clk = devm_clk_get(nfc->dev, "core"); >> + if (IS_ERR(nfc->core_clk)) { >> + dev_err(nfc->dev, "failed to get core clk\n"); >> + return PTR_ERR(nfc->core_clk); >> + } >> + >> + nfc->device_clk = devm_clk_get(nfc->dev, "device"); >> + if (IS_ERR(nfc->device_clk)) { >> + dev_err(nfc->dev, "failed to get device clk\n"); >> + return PTR_ERR(nfc->device_clk); >> + } >> + >> + nfc->phase_tx = devm_clk_get(nfc->dev, "tx"); >> + if (IS_ERR(nfc->phase_tx)) { >> + dev_err(nfc->dev, "failed to get tx clk\n"); >> + return PTR_ERR(nfc->phase_tx); >> + } >> + >> + nfc->phase_rx = devm_clk_get(nfc->dev, "rx"); >> + if (IS_ERR(nfc->phase_rx)) { >> + dev_err(nfc->dev, "failed to get rx clk\n"); >> + return PTR_ERR(nfc->phase_rx); >> + } > neither the "rx" nor the "tx" clock are documented in the dt-bindings patch > ok, i will add them later. >> + /* init SD_EMMC_CLOCK to sane defaults w/min clock rate */ >> + regmap_update_bits(nfc->reg_clk, 0, >> + CLK_SELECT_NAND | CLK_ALWAYS_ON | CLK_DIV_MASK, >> + CLK_SELECT_NAND | CLK_ALWAYS_ON | CLK_DIV_MASK); > clk_set_rate also works for clocks that are not enabled yet (except if > they have the flag CLK_SET_RATE_UNGATE) > this should help you to remove CLK_DIV_MASK here > if not set clk_div_mask here, the value 0x00 of divider means nand clock off, even read/write nand register is forbidden. > is CLK_SELECT_NAND a bit that switches the clock output from the sdmmc > controller to the NAND controller? > if so: can this be modeled as a mux clock? > it seems to like a gate. 1: nand is selected; 0: emmc is selected. Is it suitable for making it as a mux clock? > the public S905 datasheet doesn't mention CLK_ALWAYS_ON at bit 28 but > uses bit 24 instead. the description from the datasheet: > Cfg_always_on: > 1: Keep clock always on > 0: Clock on/off controlled by activities. > Any APB3 access or descriptor execution will turn clock on. > Recommended value: 0 > > can you please explain what CLK_ALWAYS_ON does and why it has to be 1? > em , it is the same as bit 24 in S905 datasheet, only moves to bit 28. it means keeping internal clock on whether nand wroks or not. it doesn't have to be 1; i have tried 0 successfully on AXG platform. > > Regards > Martin > > . >