Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp885376ybn; Wed, 25 Sep 2019 09:07:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxr0pm6dOt6qw7ouP8sqpawk/y5ZNcqQ3oeSuVs5gtVML5PRdtXbx6k8WplsQtuKWCffsWK X-Received: by 2002:a17:906:e0c2:: with SMTP id gl2mr4792989ejb.157.1569427638639; Wed, 25 Sep 2019 09:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569427638; cv=none; d=google.com; s=arc-20160816; b=dicbMWmSdx/Y7bdGHeSrl4zJpJ4wpkfMkHap2FCLoPA92gNyVC/2TYQUZBWIcIcgj0 TiIwVVmbxcOqREIVU1uq8OufqAUI6xYRPBm9MokV1eL0vX9RbvEhq+4HemvIu7yPiQEl Fejqj7d711EEK4M4xKeB1ft+EFPIZ4Yg+pkcXC7t12K6ATscZYQiZrToD5YZehoW9Kz0 Op8Eeo+Qbg/iyC+nkbDPgOvVCa7SsHa4gDOlumRLOreow3N9EFseJLUHnU1bHfi95sic Z8xBN63+QX+xfKj0Js9mrDdHTeF3LIqJf14a6CUEOsGEXzzjjhTE3bQfq0LOfCrUhLSk xWlg== 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:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=kzmk5oXzqDZ+eAfZk6u16J40xX3fX7uris0kIfdxInw=; b=zx1pMfWn77UheFePP2PJK4rj1jj3FHCgYVMEu7OJFYRaz2Y2qYGVzentVlV+DtuBOS bxTv17+ZcTxoy06JGDNsH8U0hnXj5gd7karuXNWQI24eR064eL29i+lu5/uMdVHriseG GWwJlU5XlQOr8dxgGXg1shmpEKGSaDegWCrZxai08vMbHds7sPSgHn4MXFvRdw0xpKPi 7XH6Jpw2K34W4W3nf5++W3/A0Xn24k+VsWrC2BJKN/jDMMdbqO3uWPFbgTIbp/X6RWvp p7pnY2c+c2KDfSzUKJJXMfRqPoCG2u+FMlJ7YW7/gNYQ2SqGVcwYe9YklmxlvGdLI5Xx 5r3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fffi+cvf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t7si3021368ejo.302.2019.09.25.09.06.53; Wed, 25 Sep 2019 09:07:18 -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; dkim=pass header.i=@linaro.org header.s=google header.b=fffi+cvf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388380AbfIWQLg (ORCPT + 99 others); Mon, 23 Sep 2019 12:11:36 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44879 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387848AbfIWQLf (ORCPT ); Mon, 23 Sep 2019 12:11:35 -0400 Received: by mail-pf1-f196.google.com with SMTP id q21so9380206pfn.11 for ; Mon, 23 Sep 2019 09:11:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kzmk5oXzqDZ+eAfZk6u16J40xX3fX7uris0kIfdxInw=; b=fffi+cvfsjwYCv4QYdDnkvsY+TJKFEEpszFsHlCLEO+CEYgxiwuCzHIamqdPBoRfa2 bZLHt74bTA0AGxOpx4NQXXyKqS+CD11W5glUd1qpDLKV+WlrgXDr5o8I7f+6+GKldDmq 2x0XJdoUg9WqePPy+syGAofvFBBAiJGHwNtt/zMddFquelri0V27mZYRN5RKwxBjh67+ qTAcjWXp0GhxJu4tvDoNXr9y9bpYxvLe7NNLpH0f4Jfl9svekAZKvmGPwQnF+Z8maNVC S9z4DofIS/Pe+oKOBhkJ16i43EVrlto9glpM7nqEGYIbrlC+ROtgaqyphhu0PPQaWaG+ 8f/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=kzmk5oXzqDZ+eAfZk6u16J40xX3fX7uris0kIfdxInw=; b=BG85jAsK+FzAVQCxyyKbbUT2vLYdqaEUD3TJzo/W73J4Z8DJfDEt6rY89sREF9Z8up OXiTHgx1W8AUcfvtXV4iPN2LJafRXD0rwSUqiZboKiDeTrjHcSaHIRTUcnYME+JIzxzN 2UXZvaueHBj7/QdwAe5MsnVODDBYn+ZXM2yRXyv/9uzH4gsVbKk6IhMVwEtddenNcw+C +n/ODmBYqjDxS0N7l596PtkD0A/12MGwug5i3jsU1r61/3T3f/UfEjgqYN6u0AIhmsZJ ORmqub5vcPzVwW9e2NEf53hTujfuUKQ/yDC5mz+hkxtVtFl0cPieGmSyU7SVqw0tue7V 3YXQ== X-Gm-Message-State: APjAAAW57PMkSQhPwzC01CYwm/DpR5USA7SaVqJTwianYSEhvtDQmbqK /GoZatGXzukX70y8YsVuWXonYBj+IqRBug== X-Received: by 2002:a63:61c2:: with SMTP id v185mr694837pgb.96.1569255093168; Mon, 23 Sep 2019 09:11:33 -0700 (PDT) Received: from [172.20.32.102] ([12.157.10.114]) by smtp.googlemail.com with ESMTPSA id 197sm10443591pge.39.2019.09.23.09.11.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Sep 2019 09:11:32 -0700 (PDT) Subject: Re: [PATCH] thermal: qoriq: add thermal monitor unit version 2 support To: Andy Tang , "edubezval@gmail.com" , "rui.zhang@intel.com" Cc: Leo Li , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20190604025114.46085-1-andy.tang@nxp.com> From: Daniel Lezcano Openpgp: preference=signencrypt Autocrypt: addr=daniel.lezcano@linaro.org; prefer-encrypt=mutual; keydata= mQINBFv/yykBEADDdW8RZu7iZILSf3zxq5y8YdaeyZjI/MaqgnvG/c3WjFaunoTMspeusiFE sXvtg3ehTOoyD0oFjKkHaia1Zpa1m/gnNdT/WvTveLfGA1gH+yGes2Sr53Ht8hWYZFYMZc8V 2pbSKh8wepq4g8r5YI1XUy9YbcTdj5mVrTklyGWA49NOeJz2QbfytMT3DJmk40LqwK6CCSU0 9Ed8n0a+vevmQoRZJEd3Y1qXn2XHys0F6OHCC+VLENqNNZXdZE9E+b3FFW0lk49oLTzLRNIq 0wHeR1H54RffhLQAor2+4kSSu8mW5qB0n5Eb/zXJZZ/bRiXmT8kNg85UdYhvf03ZAsp3qxcr xMfMsC7m3+ADOtW90rNNLZnRvjhsYNrGIKH8Ub0UKXFXibHbafSuq7RqyRQzt01Ud8CAtq+w P9EftUysLtovGpLSpGDO5zQ++4ZGVygdYFr318aGDqCljKAKZ9hYgRimPBToDedho1S1uE6F 6YiBFnI3ry9+/KUnEP6L8Sfezwy7fp2JUNkUr41QF76nz43tl7oersrLxHzj2dYfWUAZWXva wW4IKF5sOPFMMgxoOJovSWqwh1b7hqI+nDlD3mmVMd20VyE9W7AgTIsvDxWUnMPvww5iExlY eIC0Wj9K4UqSYBOHcUPrVOKTcsBVPQA6SAMJlt82/v5l4J0pSQARAQABtCpEYW5pZWwgTGV6 Y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h4ikHoS7/tLjK iqWjuat8/HWc01yEd8rtkGuUcMqbCi1XhcAmkaOnX8FYscMRoyyMrWClRZEQRokqZIj79+PR adkDXtr4MeL8BaB7Ij2oyRVjXUwhFQNKi5Z5Rve0a3zvGkkqw8Mz20BOksjSWjAF6g9byukl CUVjC03PdMSufNLK06x5hPc/c4tFR4J9cLrV+XxdCX7r0zGos9SzTPGNuIk1LK++S3EJhLFj 4eoWtNhMWc1uiTf9ENza0ntqH9XBWEQ6IA1gubCniGG+Xg== Message-ID: <1f0f5931-ae9a-5495-aa56-3d66d114a488@linaro.org> Date: Mon, 23 Sep 2019 18:11:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=gbk Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/09/2019 11:24, Andy Tang wrote: > Hi Rui, Edubezval, > > Would you please review this patch? Eduardo, can you give an update about the thermal maintenance discussion we had at LPC2019? Thanks -- Daniel >> -----Original Message----- >> From: Andy Tang >> Sent: 2019??8??29?? 16:38 >> To: 'edubezval@gmail.com' ; 'rui.zhang@intel.com' >> >> Cc: 'daniel.lezcano@linaro.org' ; Leo Li >> ; 'linux-pm@vger.kernel.org' >> ; 'linux-kernel@vger.kernel.org' >> >> Subject: RE: [PATCH] thermal: qoriq: add thermal monitor unit version 2 >> support >> >> Hi Rui, Edubezval, >> >> Almost three monthes passed, I have not got your comments from you. >> Could you please take a look at this patch? >> >> BR, >> Andy >> >>> -----Original Message----- >>> From: Andy Tang >>> Sent: 2019??8??6?? 10:57 >>> To: edubezval@gmail.com; rui.zhang@intel.com >>> Cc: daniel.lezcano@linaro.org; Leo Li ; >>> linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org >>> Subject: RE: [PATCH] thermal: qoriq: add thermal monitor unit version >>> 2 support >>> >>> Any comments? >>> >>> BR, >>> Andy >>> >>>> -----Original Message----- >>>> From: Yuantian Tang >>>> Sent: 2019??6??4?? 10:51 >>>> To: edubezval@gmail.com; rui.zhang@intel.com >>>> Cc: daniel.lezcano@linaro.org; Leo Li ; >>>> linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; Andy Tang >>>> >>>> Subject: [PATCH] thermal: qoriq: add thermal monitor unit version 2 >>>> support >>>> >>>> Thermal Monitor Unit v2 is introduced on new Layscape SoC. >>>> Compared to v1, TMUv2 has a little different register layout and >>>> digital output is fairly linear. >>>> >>>> Signed-off-by: Yuantian Tang >>>> --- >>>> drivers/thermal/qoriq_thermal.c | 122 >>>> +++++++++++++++++++++++++------- >>>> 1 file changed, 98 insertions(+), 24 deletions(-) >>>> >>>> diff --git a/drivers/thermal/qoriq_thermal.c >>>> b/drivers/thermal/qoriq_thermal.c index 3b5f5b3fb1bc..0df6dfddf804 >>>> 100644 >>>> --- a/drivers/thermal/qoriq_thermal.c >>>> +++ b/drivers/thermal/qoriq_thermal.c >>>> @@ -13,6 +13,15 @@ >>>> #include "thermal_core.h" >>>> >>>> #define SITES_MAX 16 >>>> +#define TMR_DISABLE 0x0 >>>> +#define TMR_ME 0x80000000 >>>> +#define TMR_ALPF 0x0c000000 >>>> +#define TMR_ALPF_V2 0x03000000 >>>> +#define TMTMIR_DEFAULT 0x0000000f >>>> +#define TIER_DISABLE 0x0 >>>> +#define TEUMR0_V2 0x51009C00 >>>> +#define TMU_VER1 0x1 >>>> +#define TMU_VER2 0x2 >>>> >>>> /* >>>> * QorIQ TMU Registers >>>> @@ -23,17 +32,55 @@ struct qoriq_tmu_site_regs { >>>> u8 res0[0x8]; >>>> }; >>>> >>>> -struct qoriq_tmu_regs { >>>> +struct qoriq_tmu_regs_v2 { >>>> + u32 tmr; /* Mode Register */ >>>> + u32 tsr; /* Status Register */ >>>> + u32 tmsr; /* monitor site register */ >>>> + u32 tmtmir; /* Temperature measurement interval Register >> */ >>>> + u8 res0[0x10]; >>>> + u32 tier; /* Interrupt Enable Register */ >>>> + u32 tidr; /* Interrupt Detect Register */ >>>> + u8 res1[0x8]; >>>> + u32 tiiscr; /* interrupt immediate site capture register */ >>>> + u32 tiascr; /* interrupt average site capture register */ >>>> + u32 ticscr; /* Interrupt Critical Site Capture Register */ >>>> + u32 res2; >>>> + u32 tmhtcr; /* monitor high temperature capture register */ >>>> + u32 tmltcr; /* monitor low temperature capture register */ >>>> + u32 tmrtrcr; /* monitor rising temperature rate capture register >> */ >>>> + u32 tmftrcr; /* monitor falling temperature rate capture register >> */ >>>> + u32 tmhtitr; /* High Temperature Immediate Threshold */ >>>> + u32 tmhtatr; /* High Temperature Average Threshold */ >>>> + u32 tmhtactr; /* High Temperature Average Crit Threshold */ >>>> + u32 res3; >>>> + u32 tmltitr; /* monitor low temperature immediate threshold */ >>>> + u32 tmltatr; /* monitor low temperature average threshold >> register */ >>>> + u32 tmltactr; /* monitor low temperature average critical >> threshold */ >>>> + u32 res4; >>>> + u32 tmrtrctr; /* monitor rising temperature rate critical threshold >> */ >>>> + u32 tmftrctr; /* monitor falling temperature rate critical >> threshold*/ >>>> + u8 res5[0x8]; >>>> + u32 ttcfgr; /* Temperature Configuration Register */ >>>> + u32 tscfgr; /* Sensor Configuration Register */ >>>> + u8 res6[0x78]; >>>> + struct qoriq_tmu_site_regs site[SITES_MAX]; >>>> + u8 res7[0x9f8]; >>>> + u32 ipbrr0; /* IP Block Revision Register 0 */ >>>> + u32 ipbrr1; /* IP Block Revision Register 1 */ >>>> + u8 res8[0x300]; >>>> + u32 teumr0; >>>> + u32 teumr1; >>>> + u32 teumr2; >>>> + u32 res9; >>>> + u32 ttrcr[4]; /* Temperature Range Control Register */ >>>> +}; >>>> + >>>> +struct qoriq_tmu_regs_v1 { >>>> u32 tmr; /* Mode Register */ >>>> -#define TMR_DISABLE 0x0 >>>> -#define TMR_ME 0x80000000 >>>> -#define TMR_ALPF 0x0c000000 >>>> u32 tsr; /* Status Register */ >>>> u32 tmtmir; /* Temperature measurement interval Register >> */ >>>> -#define TMTMIR_DEFAULT 0x0000000f >>>> u8 res0[0x14]; >>>> u32 tier; /* Interrupt Enable Register */ >>>> -#define TIER_DISABLE 0x0 >>>> u32 tidr; /* Interrupt Detect Register */ >>>> u32 tiscr; /* Interrupt Site Capture Register */ >>>> u32 ticscr; /* Interrupt Critical Site Capture Register */ >>>> @@ -53,10 +100,7 @@ struct qoriq_tmu_regs { >>>> u32 ipbrr0; /* IP Block Revision Register 0 */ >>>> u32 ipbrr1; /* IP Block Revision Register 1 */ >>>> u8 res6[0x310]; >>>> - u32 ttr0cr; /* Temperature Range 0 Control Register */ >>>> - u32 ttr1cr; /* Temperature Range 1 Control Register */ >>>> - u32 ttr2cr; /* Temperature Range 2 Control Register */ >>>> - u32 ttr3cr; /* Temperature Range 3 Control Register */ >>>> + u32 ttrcr[4]; /* Temperature Range Control Register */ >>>> }; >>>> >>>> struct qoriq_tmu_data; >>>> @@ -71,7 +115,9 @@ struct qoriq_sensor { }; >>>> >>>> struct qoriq_tmu_data { >>>> - struct qoriq_tmu_regs __iomem *regs; >>>> + int ver; >>>> + struct qoriq_tmu_regs_v1 __iomem *regs; >>>> + struct qoriq_tmu_regs_v2 __iomem *regv2; >>>> bool little_endian; >>>> struct qoriq_sensor *sensor[SITES_MAX]; >>>> }; >>>> @@ -111,7 +157,7 @@ static const struct thermal_zone_of_device_ops >>>> tmu_tz_ops = { static int qoriq_tmu_register_tmu_zone(struct >>>> platform_device *pdev) { >>>> struct qoriq_tmu_data *qdata = platform_get_drvdata(pdev); >>>> - int id, sites = 0; >>>> + int id, sites = 0, sv2 = 0; >>>> >>>> for (id = 0; id < SITES_MAX; id++) { >>>> qdata->sensor[id] = devm_kzalloc(&pdev->dev, @@ -130,12 >>>> +176,24 @@ static int qoriq_tmu_register_tmu_zone(struct >>>> +platform_device >>>> *pdev) >>>> return PTR_ERR(qdata->sensor[id]->tzd); >>>> } >>>> >>>> - sites |= 0x1 << (15 - id); >>>> + if (qdata->ver == TMU_VER1) >>>> + sites |= 0x1 << (15 - id); >>>> + else >>>> + sv2 |= 0x1 << id; >>>> } >>>> >>>> /* Enable monitoring */ >>>> - if (sites != 0) >>>> - tmu_write(qdata, sites | TMR_ME | TMR_ALPF, >>>> &qdata->regs->tmr); >>>> + if (qdata->ver == TMU_VER1) { >>>> + if (sites != 0) >>>> + tmu_write(qdata, sites | TMR_ME | TMR_ALPF, >>>> + &qdata->regs->tmr); >>>> + } else { >>>> + if (sv2 != 0) { >>>> + tmu_write(qdata, sv2, &qdata->regv2->tmsr); >>>> + tmu_write(qdata, TMR_ME | TMR_ALPF_V2, >>>> + &qdata->regv2->tmr); >>>> + } >>>> + } >>>> >>>> return 0; >>>> } >>>> @@ -148,16 +206,20 @@ static int qoriq_tmu_calibration(struct >>>> platform_device *pdev) >>>> struct device_node *np = pdev->dev.of_node; >>>> struct qoriq_tmu_data *data = platform_get_drvdata(pdev); >>>> >>>> - if (of_property_read_u32_array(np, "fsl,tmu-range", range, 4)) { >>>> - dev_err(&pdev->dev, "missing calibration range.\n"); >>>> - return -ENODEV; >>>> + len = of_property_count_u32_elems(np, "fsl,tmu-range"); >>>> + if (len == -ENODATA || len == -EINVAL || len > 4) { >>>> + dev_err(&pdev->dev, "invalid range data.\n"); >>>> + return len; >>>> } >>>> >>>> - /* Init temperature range registers */ >>>> - tmu_write(data, range[0], &data->regs->ttr0cr); >>>> - tmu_write(data, range[1], &data->regs->ttr1cr); >>>> - tmu_write(data, range[2], &data->regs->ttr2cr); >>>> - tmu_write(data, range[3], &data->regs->ttr3cr); >>>> + val = of_property_read_u32_array(np, "fsl,tmu-range", range, len); >>>> + if (val != 0) { >>>> + dev_err(&pdev->dev, "invalid range data.\n"); >>>> + return val; >>>> + } >>>> + >>>> + for (i = 0; i < len; i++) >>>> + tmu_write(data, range[i], &data->regs->ttrcr[i]); >>>> >>>> calibration = of_get_property(np, "fsl,tmu-calibration", &len); >>>> if (calibration == NULL || len % 8) { @@ -181,7 +243,12 @@ static >>>> void qoriq_tmu_init_device(struct qoriq_tmu_data *data) >>>> tmu_write(data, TIER_DISABLE, &data->regs->tier); >>>> >>>> /* Set update_interval */ >>>> - tmu_write(data, TMTMIR_DEFAULT, &data->regs->tmtmir); >>>> + if (data->ver == TMU_VER1) { >>>> + tmu_write(data, TMTMIR_DEFAULT, &data->regs->tmtmir); >>>> + } else { >>>> + tmu_write(data, TMTMIR_DEFAULT, &data->regv2->tmtmir); >>>> + tmu_write(data, TEUMR0_V2, &data->regv2->teumr0); >>>> + } >>>> >>>> /* Disable monitoring */ >>>> tmu_write(data, TMR_DISABLE, &data->regs->tmr); @@ -190,6 >> +257,7 >>> @@ >>>> static void qoriq_tmu_init_device(struct qoriq_tmu_data *data) >>>> static int qoriq_tmu_probe(struct platform_device *pdev) { >>>> int ret; >>>> + u32 ver; >>>> struct qoriq_tmu_data *data; >>>> struct device_node *np = pdev->dev.of_node; >>>> >>>> @@ -214,6 +282,12 @@ static int qoriq_tmu_probe(struct >>> platform_device >>>> *pdev) >>>> goto err_iomap; >>>> } >>>> >>>> + /* version register offset at: 0xbf8 on both v1 and v2 */ >>>> + ver = tmu_read(data, &data->regs->ipbrr0); >>>> + data->ver = (ver >> 8) & 0xff; >>>> + if (data->ver == TMU_VER2) >>>> + data->regv2 = (void __iomem *)data->regs; >>>> + >>>> qoriq_tmu_init_device(data); /* TMU initialization */ >>>> >>>> ret = qoriq_tmu_calibration(pdev); /* TMU calibration */ >>>> -- >>>> 2.17.1 > -- Linaro.org ?? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog