Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1164545pxx; Fri, 30 Oct 2020 03:53:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSYOXbmoTeZpXSSiCfsuvYWvCqR8g3Sz1HZxP7MwBxLzsRUiiHwyxyzRuM5XafYK8RIyWi X-Received: by 2002:a17:906:fa99:: with SMTP id lt25mr1683874ejb.511.1604055193675; Fri, 30 Oct 2020 03:53:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604055193; cv=none; d=google.com; s=arc-20160816; b=feg/O0pzNTxZ49KFmjbgUI0NfPPQFVnoShWsCIQXUxRhD1sXBAGc/wpd3HisbbqpwX dEOeKAyjxM/9ReWUmZzX6ee0RVR38URf2wE7IAFHdTN8MOLUDhJapOetUHWvO4Dvnr5b 7hkWvmKBdO3afY993s/BFtzLSUPZtwtGa4MczGId5oEv48J7iYDPZ50o4MbQAU2DjX3H zfLyRsCD1VLOTuMSbnwjK5YipkwMtwf9OM75OaBW/bJJuT54NGxFhVlqUHeyor9hnoGJ kUBttdjjzbJe+jY++8VTwb0kWkixQIPqYv5BUGCqUtIo2q383v30dXT9HtzNNJNguTcs Kh0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=o/a1Fg1l8jTDVjB4D1N/25wYLdlaFeX7TtKVbE5a6QU=; b=JWtgaWsr9NAkY+Mab24+BMq5j+qVOC/kfGsIVT/fq5XZCRbYSjRna1EoaF0/xgDdfO 2KPnB4LK+/L65Z7ApZZP/rTZ2g5cIa4NjfICbSr3m/VOyzjZmOjKk+3HmXl7aJaBHzJB Z9YwVwNkHMs/8foVnleEs/VHk6L+DoM++Ux+QpQ9VQH+Sw84mEgHZQqlrTC+QqdesD2z IIYU0J1oM8eDpFc+mvK9d22PsntP/WRT2sp5m/VZPZ7+gACPolptjDG4mfxnhGXYCtZZ DO+a2iJHGdkUGQSFW1MHqfgy0ZwUtqPlSLPJD8tw2gdR+7F5vGTo/cSgM8nXHLbMQwML 48Ew== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q27si3828087eji.605.2020.10.30.03.52.51; Fri, 30 Oct 2020 03:53:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726495AbgJ3Kse (ORCPT + 99 others); Fri, 30 Oct 2020 06:48:34 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:46664 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726482AbgJ3Ksc (ORCPT ); Fri, 30 Oct 2020 06:48:32 -0400 Received: by mail-oi1-f193.google.com with SMTP id x1so6169289oic.13; Fri, 30 Oct 2020 03:48:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=o/a1Fg1l8jTDVjB4D1N/25wYLdlaFeX7TtKVbE5a6QU=; b=MNbNqKWaeycBfMaxfs6jaw6By+KU4zltvwRJkSq0T1j0gdpXHOYSNhkpx2UXtopcBr 2Zu0dWaYcW4m/feTRAbvoxDHKGk44zdu/eW9schEKFU1hHEs8VrPDlLa1wLtz5UROleP ytedGPZbXZUEpaNQHxmkmqzlXB6+25GZbIgD9+JxPofVcK7zAZbrnW9WXnQ7V20jbCHa 8uGphlESQC4eZUfyoApvINUZF/IjoDzxntLonSn37Sm3gQgIZjVh6KMj/lJ2q/drwbGz T4Rs/v9mwPEvPyQZef7BnZb6hJxV/ZivDbUp0fexufOWW0gHj4hT0Ap1zV0xG0Q/U6Rz 7cag== X-Gm-Message-State: AOAM5331PGhsco4iAhx/h6G9z3qMFxJjJAbqpO3fMLtGF42zlNy/9WdH dVny4LIJKJ19icKlxu5SnZzSP9XaekaWmtvtqdM= X-Received: by 2002:aca:c490:: with SMTP id u138mr1180705oif.54.1604054911030; Fri, 30 Oct 2020 03:48:31 -0700 (PDT) MIME-Version: 1.0 References: <20201029105515.16309-1-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: From: Geert Uytterhoeven Date: Fri, 30 Oct 2020 11:48:19 +0100 Message-ID: Subject: Re: [PATCH v2] clk: renesas: r8a774c0: Add RPC clocks To: "Lad, Prabhakar" Cc: Lad Prabhakar , Michael Turquette , Stephen Boyd , Linux-Renesas , linux-clk , Linux Kernel Mailing List , Biju Das Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Prabhakar, On Fri, Oct 30, 2020 at 11:13 AM Lad, Prabhakar wrote: > On Thu, Oct 29, 2020 at 2:29 PM Geert Uytterhoeven wrote: > > On Thu, Oct 29, 2020 at 11:55 AM Lad Prabhakar > > wrote: > > > Describe the RPCSRC internal clock and the RPC[D2] clocks derived from it, > > > as well as the RPC-IF module clock, in the RZ/G2E (R8A774C0) CPG/MSSR > > > driver. > > > > Thanks for your patch! > > > > > Add new clk type CLK_TYPE_GEN3E3_RPCSRC to handle registering rpcsrc > > > clock as the source for RPCSRC can be either PLL0/PLL1 and this depends > > > on MD[1:4] pins where as compared to other R-Car Gen3 SoC's the RPCSRC > > > clock source is always PLL1. > > > > > > MD[4] MD[3] MD[2] MD[1] > > > 0 0 0 1 -> RPCSRC CLK source is PLL1 > > > 0 0 1 1 -> RPCSRC CLK source is PLL1 > > > 0 1 0 0 -> RPCSRC CLK source is PLL1 > > > 1 0 1 1 -> RPCSRC CLK source is PLL1 > > > x x x x -> For any other values RPCSRC CLK source is PLL0 > > > > AFAIU, the _initial values_ of the RPCCKCR bits depend on the MD pins. > > They can still be changed at run-time, and might have been changed by > > the bootloader before transferring control to Linux. > > > > > R-Car Gen3 manual Rev.2.20 has in-correct information related to > > > determining the clock source for RPCSRC. > > > > Which part of the information is not correct? > > Where can I find corrected information? > > Is my understanding above incorrect, too? > > > R-Car Gen3 HW manual mentions the below statement (page 529, Rev.2.20 manual): > [R-Car E3] > When (MD4, MD3, MD2, MD1) = (0, 0, 0, 1) or (0, 1, 0, 0): DIV[2:0] = > 011, DIV[4:3] = 00 (300 MHz PLL0) That indeed doesn't match the values in the DIV[4:0] bits description. > Confirming with internal team this should be below: > > When (MD4, MD3, MD2, MD1) = (0, 0, 0, 1) or (0, 1, 0, 0): DIV[2:0] = > 011, DIV[4:3] = 00 (80 MHz PLL1) > > This should be fixed in the next version of the document, and when > available I'll ask Chris P to send it across. OK, that does match the bits. > > > @@ -696,6 +717,22 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev, > > > cpg_rpcsrc_div_table, > > > &cpg_lock); > > > > > > + case CLK_TYPE_GEN3E3_RPCSRC: > > > + e3_rpcsrc_parent = cpg_rpcsrc_e3_get_parent(cpg_mode); > > > > This is not correct if the boot loader has changed the parent clock. > > > You mean by manually togelling the MD pins before we get into Linux ? No, by writing to the RPCCKCR register. Remember, the _initial_ values are determined by the MD pins. They can still be changed. E.g. on R-Car D3, I verified that changing PLL0CR.CKSEL at runtime does work. In the end, we decided to just look at MD12 instead (IIRC because the CKSEL bit was removed from later documentation, but Rev 2.20 documents it again ;-) Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds