devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: Ashish Mhetre <amhetre@nvidia.com>,
	Dmitry Osipenko <digetx@gmail.com>,
	krzysztof.kozlowski@linaro.org, thierry.reding@gmail.com,
	jonathanh@nvidia.com, robh+dt@kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-tegra@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org
Cc: vdumpa@nvidia.com, Snikam@nvidia.com
Subject: Re: [Patch v6 1/4] memory: tegra: Add memory controller channels support
Date: Mon, 11 Apr 2022 14:13:43 +0300	[thread overview]
Message-ID: <c3e6a50f-c098-5165-a596-ee386ac533e8@collabora.com> (raw)
In-Reply-To: <3414a89d-bb80-ec89-3605-e435c7656321@nvidia.com>


On 4/11/22 12:18, Ashish Mhetre wrote:
> 
> 
> On 4/11/2022 1:05 PM, Dmitry Osipenko wrote:
>> External email: Use caution opening links or attachments
>>
>>
>> On 4/11/22 10:28, Ashish Mhetre wrote:
>>>
>>>
>>> On 4/11/2022 12:03 PM, Dmitry Osipenko wrote:
>>>> External email: Use caution opening links or attachments
>>>>
>>>>
>>>> On 4/11/22 09:05, Ashish Mhetre wrote:
>>>>>
>>>>>
>>>>> On 4/10/2022 7:48 PM, Dmitry Osipenko wrote:
>>>>>> External email: Use caution opening links or attachments
>>>>>>
>>>>>>
>>>>>> 06.04.2022 08:24, Ashish Mhetre пишет:
>>>>>>> +     num_dt_channels =
>>>>>>> of_property_count_elems_of_size(pdev->dev.of_node, "reg",
>>>>>>> +                                                       reg_cells *
>>>>>>> sizeof(u32));
>>>>>>> +     /*
>>>>>>> +      * On tegra186 onwards, memory controller support multiple
>>>>>>> channels.
>>>>>>> +      * Apart from regular memory controller channels, there is one
>>>>>>> broadcast
>>>>>>> +      * channel and one for stream-id registers.
>>>>>>> +      */
>>>>>>> +     if (num_dt_channels < mc->soc->num_channels + 2) {
>>>>>>> +             dev_warn(&pdev->dev, "MC channels are missing, please
>>>>>>> update memory controller DT node with MC channels\n");
>>>>>>> +             return 0;
>>>>>>> +     }
>>>>>>> +
>>>>>>> +     mc->bcast_ch_regs =
>>>>>>> devm_platform_ioremap_resource_byname(pdev,
>>>>>>> "mc-broadcast");
>>>>>>> +     if (IS_ERR(mc->bcast_ch_regs))
>>>>>>> +             return PTR_ERR(mc->bcast_ch_regs);
>>>>>>
>>>>>> Looks to me that you don't need to use
>>>>>> of_property_count_elems_of_size()
>>>>>> and could only check the "mc-broadcast" presence to decide whether
>>>>>> this
>>>>>> is an older DT.
>>>>>>
>>>>> Now that we are using reg-names in new DT, yes it'd be fine to just
>>>>> check mc-broadcast to decide it's a new or old DT.
>>>>>
>>>>>> mc->bcast_ch_regs = devm_platform_ioremap_resource_byname(pdev,
>>>>>> "broadcast");
>>>>>> if (IS_ERR(mc->bcast_ch_regs)) {
>>>>>>            dev_warn(&pdev->dev, "Broadcast channel is missing, please
>>>>>> update your
>>>>>> device-tree\n");
>>>>>>            return PTR_ERR(mc->bcast_ch_regs);
>>>>>> }
>>>>>
>>>>> return 0;
>>>>>
>>>>> to avoid DT ABI break, right?
>>>>
>>>> Yes, it should be "return 0".
>>>
>>> But if we "return 0" from here, then what about the case when ioremap()
>>> actually fails with new DT i.e. when broadcast reg is present in DT?
>>> In that case error should be returned and probe should be failed, right?
>>
>> You should check for the -ENOENT.
> 
> I checked __devm_ioremap_resource(), it returns -EINVAL if given
> resource is not present. So should we check for -EINVAL instead?

Yes

  reply	other threads:[~2022-04-11 11:13 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06  5:24 [Patch v6 0/4] memory: tegra: Add MC channels and error logging Ashish Mhetre
2022-04-06  5:24 ` [Patch v6 1/4] memory: tegra: Add memory controller channels support Ashish Mhetre
2022-04-10 14:18   ` Dmitry Osipenko
2022-04-11  6:05     ` Ashish Mhetre
2022-04-11  6:33       ` Dmitry Osipenko
2022-04-11  7:28         ` Ashish Mhetre
2022-04-11  7:35           ` Dmitry Osipenko
2022-04-11  9:18             ` Ashish Mhetre
2022-04-11 11:13               ` Dmitry Osipenko [this message]
2022-04-10 15:01   ` Dmitry Osipenko
2022-04-11  6:18     ` Ashish Mhetre
2022-04-10 15:04   ` Dmitry Osipenko
2022-04-11  6:20     ` Ashish Mhetre
2022-04-06  5:24 ` [Patch v6 2/4] memory: tegra: Add MC error logging on tegra186 onward Ashish Mhetre
2022-04-10 14:55   ` Dmitry Osipenko
2022-04-11  6:17     ` Ashish Mhetre
2022-04-06  5:24 ` [Patch v6 3/4] dt-bindings: memory: Update reg maxitems for tegra186 Ashish Mhetre
2022-04-10 14:21   ` Dmitry Osipenko
2022-04-11  6:09     ` Ashish Mhetre
2022-04-11 15:02     ` Ashish Mhetre
2022-04-11 15:29       ` Dmitry Osipenko
2022-04-11 15:41         ` Ashish Mhetre
2022-04-11 22:28           ` Dmitry Osipenko
2022-04-12  4:11             ` Ashish Mhetre
2022-04-06  5:24 ` [Patch v6 4/4] arm64: tegra: Add memory controller channels Ashish Mhetre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c3e6a50f-c098-5165-a596-ee386ac533e8@collabora.com \
    --to=dmitry.osipenko@collabora.com \
    --cc=Snikam@nvidia.com \
    --cc=amhetre@nvidia.com \
    --cc=devicetree@vger.kernel.org \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=vdumpa@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).