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=-7.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 613DAC5ACAE for ; Wed, 11 Sep 2019 19:05:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 38EB920838 for ; Wed, 11 Sep 2019 19:05:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FbPiTlii"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TFQM0oja" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 38EB920838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N/FbQHeK8i9dP+LNflkSjFn9S7XIjt0j+wIvl6v55io=; b=FbPiTliisw7JsR 8U2DdtnnsXjWaYoSZR7ENcyTuNAo9Qv0T+Gz1CJuxgVn5jsz3VSJAjPiYCyybZbWSWkZW36D/bjEv KIBk4y6tXlMcSG432+/+G0w4JKp+DfWhuxEZ3o5PUTIGIpFJiGX4txycwg4IsxWKrJvz4fr0bU8Qq C+/BPfheG3DFv7nryXuRusnXQH3XNMy19kebnwRZd+yFF5HOelGzQEQFd/JctNBzeFHXAp1Vzaid8 Pu5aj8B4vXG3olEwf9vfgnRpiTcCSQThRSr5ute0pDI+g18pb2PB5wflQrmw1YmXQuQHjJJiJrBS3 eZeAruRtFhXU/nQyf1rQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i87w3-0006z9-Hc; Wed, 11 Sep 2019 19:05:47 +0000 Received: from mail-io1-xd44.google.com ([2607:f8b0:4864:20::d44]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i87w0-0006yO-IG for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2019 19:05:46 +0000 Received: by mail-io1-xd44.google.com with SMTP id d17so26512700ios.13 for ; Wed, 11 Sep 2019 12:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CRqcj7+NuoI4D3cZX40T5TKikuDO93RhQlD6Y+l1eos=; b=TFQM0ojamkh1ySloLepkw4Vnnp+z3PWbYhYVqfkdh4RxgGEuHC8TPTbpPbHy6x2JD0 JRUofNZKnBYbutyDTigYjqzOBsaCkSSp2rSl7dz9AfUYw8IZrQ5RGdVORUbixBiivPyC 4We9ZWshElKuWJ4fE3UjLaRxLawGRNLiFCDws2ba2evyAajjVJrUdSZU/0jqB3xkeLkD hw3FRKk6X/U5TAhBdki7UmmeY8N76FyqymbXsNA/JGyt+cYmtdrsN94M7mM7DTwRm4ZJ ZngIcxjzCos1Tl9aSuDs9N8sMuShcXcZ5ykpNKaAi0c9WhRK14DBUow1s2/49M/VHyx4 ZBpQ== 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=CRqcj7+NuoI4D3cZX40T5TKikuDO93RhQlD6Y+l1eos=; b=hU9EtDAeXb9RRW0ASYEwxKcMda54rqseo8Jufk2NfYO9znJIrprwKgvxrNMspsl1Nf ulHs3+xbbVGdPd92HkuUwEi/dtJ0VabeDllNDmnUCq2I3YaVrvQXl3ZDF1Fx8kS4HYf5 10C7GojwKEu5rT2/4tEjKpYBG+FUaNvsR71EwcL6SuWujwYB6K/kT+WEb/uBCucrmFV0 5OAh2dIxU/+GOs3A2j025ODHZ21KohuIcYLQfuO4GgDeUFmAQqWW4cG5eUUZ8FhpR+Md 2k+2ZWYzLbDmSlt9s3tNdQRrrOfgjgF3WlAIerPc5Q8RVz2gXPDSoiTIUoo1vB7L7QzZ NlvA== X-Gm-Message-State: APjAAAUR2FDOvyWgHa15uE7veFSJvi2z2Aj8shS9RQHPPS95Kr6wQ+oQ slMwhApplVAvq2AxNtCGvymvx0DgDKsH6f8fXM8= X-Google-Smtp-Source: APXvYqyW3zpytIyyY4lkLih9aeq6GQUikYQE55Vk06YhYYlczXfzgPpsPg7ZSwNMCyW0TtkF3zR3Lv4zwFuvzF0J46Y= X-Received: by 2002:a02:b395:: with SMTP id p21mr40570622jan.52.1568228743054; Wed, 11 Sep 2019 12:05:43 -0700 (PDT) MIME-Version: 1.0 References: <9254e741d1b43d824f0697ec54fe9c132903e244.1568224033.git.hns@goldelico.com> In-Reply-To: <9254e741d1b43d824f0697ec54fe9c132903e244.1568224033.git.hns@goldelico.com> From: Adam Ford Date: Wed, 11 Sep 2019 14:05:31 -0500 Message-ID: Subject: Re: [PATCH v3 1/8] cpufreq: ti-cpufreq: add support for omap34xx and omap36xx To: "H. Nikolaus Schaller" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190911_120544_622822_47BF6B43 X-CRM114-Status: GOOD ( 28.89 ) 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: Mark Rutland , devicetree , Discussions about the Letux Kernel , linux-pm@vger.kernel.org, Tony Lindgren , Viresh Kumar , "Rafael J. Wysocki" , Linux Kernel Mailing List , Enric Balletbo i Serra , Rob Herring , =?UTF-8?Q?Andr=C3=A9_Roth?= , =?UTF-8?Q?Beno=C3=AEt_Cousson?= , kernel@pyra-handheld.com, Teresa Remmet , Javier Martinez Canillas , Linux-OMAP , arm-soc , Roger Quadros Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Sep 11, 2019 at 12:47 PM H. Nikolaus Schaller wrote: > > This adds code and tables to read the silicon revision and > eFuse (speed binned / 720 MHz grade) bits for selecting > opp-v2 table entries. > > Since these bits are not always part of the syscon register > range (like for am33xx, am43, dra7), we add code to directly > read the register values using ioremap() if syscon access fails. > > The format of the opp-supported-hw entries is that it has > two 32 bit bitfields. E.g.: > > opp-supported-hw = <0xffffffff 3> > > The first value is matched against the bit position of the > silicon revision which is (see TRM) > > omap34xx: > BIT(0) ES1.0 > BIT(1) ES2.0 > BIT(2) ES2.1 > BIT(3) ES3.0 > BIT(4) ES3.1 > BIT(7) ES3.1.2 > > omap36xx: > BIT(0) ES1.0 > BIT(1) ES1.1 > BIT(2) ES1.2 > > The second value is matched against the speed grade eFuse: > > BIT(0) no high speed OPP > BIT(1) high speed OPP > > This means for the example above that it is always enabled > while e.g. > > opp-supported-hw = <0x1 2> > > enables the OPP only for ES1.0 BIT(0) and if the high speed > eFuse is set BIT(1). > > Signed-off-by: H. Nikolaus Schaller > Reviewed-by: Tony Lindgren For the entire series, I tested on the Logic PD devices: DM3730 Torpedo, OMAP3530 SOM-LV, DM3730 SOM-LV and AM3517-EVM Tested-by: Adam Ford > --- > drivers/cpufreq/ti-cpufreq.c | 91 +++++++++++++++++++++++++++++++++++- > 1 file changed, 89 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c > index 2ad1ae17932d..f2f58d689320 100644 > --- a/drivers/cpufreq/ti-cpufreq.c > +++ b/drivers/cpufreq/ti-cpufreq.c > @@ -31,6 +31,11 @@ > #define DRA7_EFUSE_OD_MPU_OPP BIT(1) > #define DRA7_EFUSE_HIGH_MPU_OPP BIT(2) > > +#define OMAP3_CONTROL_DEVICE_STATUS 0x4800244C > +#define OMAP3_CONTROL_IDCODE 0x4830A204 > +#define OMAP34xx_ProdID_SKUID 0x4830A20C > +#define OMAP3_SYSCON_BASE (0x48000000 + 0x2000 + 0x270) > + > #define VERSION_COUNT 2 > > struct ti_cpufreq_data; > @@ -84,6 +89,13 @@ static unsigned long dra7_efuse_xlate(struct ti_cpufreq_data *opp_data, > return calculated_efuse; > } > > +static unsigned long omap3_efuse_xlate(struct ti_cpufreq_data *opp_data, > + unsigned long efuse) > +{ > + /* OPP enable bit ("Speed Binned") */ > + return BIT(efuse); > +} > + > static struct ti_cpufreq_soc_data am3x_soc_data = { > .efuse_xlate = amx3_efuse_xlate, > .efuse_fallback = AM33XX_800M_ARM_MPU_MAX_FREQ, > @@ -111,6 +123,56 @@ static struct ti_cpufreq_soc_data dra7_soc_data = { > .multi_regulator = true, > }; > > +/* > + * OMAP35x TRM (SPRUF98K): > + * CONTROL_IDCODE (0x4830 A204) describes Silicon revisions. > + * Control OMAP Status Register 15:0 (Address 0x4800 244C) > + * to separate between omap3503, omap3515, omap3525, omap3530 > + * and feature presence. > + * There are encodings for versions limited to 400/266MHz > + * but we ignore. > + * Not clear if this also holds for omap34xx. > + * some eFuse values e.g. CONTROL_FUSE_OPP1_VDD1 > + * are stored in the SYSCON register range > + * Register 0x4830A20C [ProdID.SKUID] [0:3] > + * 0x0 for normal 600/430MHz device. > + * 0x8 for 720/520MHz device. > + * Not clear what omap34xx value is. > + */ > + > +static struct ti_cpufreq_soc_data omap34xx_soc_data = { > + .efuse_xlate = omap3_efuse_xlate, > + .efuse_offset = OMAP34xx_ProdID_SKUID - OMAP3_SYSCON_BASE, > + .efuse_shift = 3, > + .efuse_mask = BIT(3), > + .rev_offset = OMAP3_CONTROL_IDCODE - OMAP3_SYSCON_BASE, > + .multi_regulator = false, > +}; > + > +/* > + * AM/DM37x TRM (SPRUGN4M) > + * CONTROL_IDCODE (0x4830 A204) describes Silicon revisions. > + * Control Device Status Register 15:0 (Address 0x4800 244C) > + * to separate between am3703, am3715, dm3725, dm3730 > + * and feature presence. > + * Speed Binned = Bit 9 > + * 0 800/600 MHz > + * 1 1000/800 MHz > + * some eFuse values e.g. CONTROL_FUSE_OPP 1G_VDD1 > + * are stored in the SYSCON register range. > + * There is no 0x4830A20C [ProdID.SKUID] register (exists but > + * seems to always read as 0). > + */ > + > +static struct ti_cpufreq_soc_data omap36xx_soc_data = { > + .efuse_xlate = omap3_efuse_xlate, > + .efuse_offset = OMAP3_CONTROL_DEVICE_STATUS - OMAP3_SYSCON_BASE, > + .efuse_shift = 9, > + .efuse_mask = BIT(9), > + .rev_offset = OMAP3_CONTROL_IDCODE - OMAP3_SYSCON_BASE, > + .multi_regulator = false, > +}; > + > /** > * ti_cpufreq_get_efuse() - Parse and return efuse value present on SoC > * @opp_data: pointer to ti_cpufreq_data context > @@ -127,7 +189,17 @@ static int ti_cpufreq_get_efuse(struct ti_cpufreq_data *opp_data, > > ret = regmap_read(opp_data->syscon, opp_data->soc_data->efuse_offset, > &efuse); > - if (ret) { > + if (ret == -EIO) { > + /* not a syscon register! */ > + void __iomem *regs = ioremap(OMAP3_SYSCON_BASE + > + opp_data->soc_data->efuse_offset, 4); > + > + if (!regs) > + return -ENOMEM; > + efuse = readl(regs); > + iounmap(regs); > + } > + else if (ret) { > dev_err(dev, > "Failed to read the efuse value from syscon: %d\n", > ret); > @@ -158,7 +230,17 @@ static int ti_cpufreq_get_rev(struct ti_cpufreq_data *opp_data, > > ret = regmap_read(opp_data->syscon, opp_data->soc_data->rev_offset, > &revision); > - if (ret) { > + if (ret == -EIO) { > + /* not a syscon register! */ > + void __iomem *regs = ioremap(OMAP3_SYSCON_BASE + > + opp_data->soc_data->rev_offset, 4); > + > + if (!regs) > + return -ENOMEM; > + revision = readl(regs); > + iounmap(regs); > + } > + else if (ret) { > dev_err(dev, > "Failed to read the revision number from syscon: %d\n", > ret); > @@ -190,6 +272,11 @@ static const struct of_device_id ti_cpufreq_of_match[] = { > { .compatible = "ti,am33xx", .data = &am3x_soc_data, }, > { .compatible = "ti,am43", .data = &am4x_soc_data, }, > { .compatible = "ti,dra7", .data = &dra7_soc_data }, > + { .compatible = "ti,omap34xx", .data = &omap34xx_soc_data, }, > + { .compatible = "ti,omap36xx", .data = &omap36xx_soc_data, }, > + /* legacy */ > + { .compatible = "ti,omap3430", .data = &omap34xx_soc_data, }, > + { .compatible = "ti,omap3630", .data = &omap36xx_soc_data, }, > {}, > }; > > -- > 2.19.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel