Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp439254pxb; Tue, 12 Apr 2022 05:32:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCFio1wYCoZCtDP4rAOdFK8n2hyOuV0xGKux1EOEuEIVnEOy9shkQfgvoDLpGLh/c10Bhr X-Received: by 2002:a17:906:c0c9:b0:6db:207:c41f with SMTP id bn9-20020a170906c0c900b006db0207c41fmr34992973ejb.292.1649766763189; Tue, 12 Apr 2022 05:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649766763; cv=none; d=google.com; s=arc-20160816; b=KTn/oLvdzMPaVRmBYBq+1DGFHMr2ZkK3bCyd2K+C3kCzvngM87Yw/or6XVSDo2vdUg yn+ijBpBj486VfKOZpWbCYjA3lhTT5GM50vU4uac7Nz1l/jukUnhuWVBlQxQEpjY5m6V 3mIUf7gnxpl6p0LfFrb7IFygA4hoQd3GPyLzkhGZLM/Ym+Nbab/jWiYHGZOh3XFsrvVN jqBVPaD0Q09xde3ix9RD9ZeWCAXaGH3q0DI7n0zr3SAH/MlsVUmZNUlOdsgvIbpYkhpU XPKaPpjDAsjnKB0Sl95JPzq26HDqtmfZB75nLidduBCdHdbCtq0ZBd9okHTy2wmxZgb6 kiWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Z3bfi4jEhccqAf4VpSwIvrwgBKpCwXS2hyKcY3NbE+0=; b=y6YLrzwNS/ND6CuSY8nd0Dl+pXROe3Xq/Zs1BAv8Up8zyQDDX3uXfdO6njZ1b8iP20 PgJE2WeeB3zUUyTPPZmraS1Vt8OrQn1oK9AbKXpA0HxAKEv8BfS4lnihHHyc/anKmufa 5tfRGCUWv46dlKcIVrSuxuwnFHpemCtwC3D/iZFDeSwAY9gFREZqgYP+jzY+/L3U/LaM 0zqkKrhs1EcEgqsdApxlDH+vg9Ik50th47+nt5AslaQBT4Kko+NPM/Ka7wvPea1jOP8Z PwBw8U5deZTqW+pifKBuTuVgleJsZLFpWvVqkzALOSFTdp7eVuyxyPJyCIiVHTxRtImR oAeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=IVYZr2Lw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t17-20020a50c251000000b00418c2b5be33si8431794edf.277.2022.04.12.05.32.17; Tue, 12 Apr 2022 05:32:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=IVYZr2Lw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241109AbiDKLQD (ORCPT + 99 others); Mon, 11 Apr 2022 07:16:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbiDKLQB (ORCPT ); Mon, 11 Apr 2022 07:16:01 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FAE513D; Mon, 11 Apr 2022 04:13:48 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dmitry.osipenko) with ESMTPSA id D0AEF1F4023C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1649675626; bh=qXNSUAatAu+49KD5X1wMrep6ovWzzUkN4hPQhFlLpHo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=IVYZr2Lw1IHAxdafW4UAznDuUStmuDMak/mGVhX2OPQBC97OvReLzXM7w6GjTI4od ujm+N0VxeBYFIU37jqFRai/sKBgAnp3ecq7ztk65C5WTeXu1vhMhXVibxY1ge2fTQC mLFHwgqKOotEr+6M4xTsLIlBfRfVQhyjXOm7VGHeKrWnfY+tWwJWirBytngkrbBn0g pBeOSKsVKdbuQSxyA1p8ayMTouZpGU1nODpAow528sWt/4izxgd+6O3DkIvzS9Hb/0 hyeyiMdRtIXFek7ZljMoOK5eQ3wl4ymhy/sxJfgGCF7HgtH/u3/te7qSBOKFU1ILKD Sp1HIRmWKllCw== Message-ID: Date: Mon, 11 Apr 2022 14:13:43 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [Patch v6 1/4] memory: tegra: Add memory controller channels support Content-Language: en-US To: Ashish Mhetre , Dmitry Osipenko , 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 References: <20220406052459.10438-1-amhetre@nvidia.com> <20220406052459.10438-2-amhetre@nvidia.com> <3bbbffff-6aa3-7068-6f0c-4372d53daf94@gmail.com> <0ce65e42-6567-9fd5-d959-3bc5aa0457eb@collabora.com> <16d5c86b-cb04-5f57-7923-724850ce2633@nvidia.com> <185f72b6-e6a1-3062-5f36-864973d12ec5@collabora.com> <3414a89d-bb80-ec89-3605-e435c7656321@nvidia.com> From: Dmitry Osipenko In-Reply-To: <3414a89d-bb80-ec89-3605-e435c7656321@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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