Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp228341ybl; Fri, 9 Aug 2019 05:15:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRVjDfUTDDITeyN7BNkedK8agxrxYfgF7QxktEEOwWsGVb5HTfVYV3DfAfou6cTRjPV9X9 X-Received: by 2002:a62:cdc3:: with SMTP id o186mr21305506pfg.168.1565352899995; Fri, 09 Aug 2019 05:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565352899; cv=none; d=google.com; s=arc-20160816; b=EqEnoHii/HDdhq3/PPq/xWz1eEqHiqRAE5zSqeOdZNLl/nopMr6Klr8qZZRPQM4D2G 6LWLuL8hVIENcANvDlJM1aI61ps/sqFnkQpk3GoC5J9jcJOTz3czjZWk6waiQbymSkn8 vOf5ZHavV7e4r7esdP3Q4W1BZrYfvgoSkOVUvhDz+rl8wvnDJNZzhuL5jdf/FD8c0TBF 6kZqmE/BD5UNvhDFMh1t+LFIOb6AJ3L3dF6Z7HBJrg8D1iDHzpyl/LqprMNWkrb+SbvL nVCCspmers/mkctqRi9u3WMJrPDll8fkl7b45m6HYIa+uStJl5M/su5xfYncD02Cjzu+ jc2w== 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:organization:from:references:cc:to:subject; bh=8F/Rj2ZxfZKcG7IWTXtxOri9lvvjGZB9p1n7qAUIc4w=; b=CN/p9BoZMYOR+rC/fznJvrdWKq5ut4yBlG3kOad8JkAEYq7UidesTpmO0eXNKL7JbD BmZYbpHBknlRVnQB9MECqTLwr15bHeSD2E59rAh7tKhsGVpQGckdyufqJngd46R4Bw3V y6yAhTxvJh108ANJFXxkXWMUeLF+65sQqdtCv9wm/Fqnsayn9pRaseQXWhsPXpWnLIv3 O9ZXFo3KBT8OF7Lk0O6R3WJfPiXKwcftjHP0hFvbmMx3dJYzzsnIZTT3rqaDUc47N6S0 JL+dYhVy1sptnc7gMaU0bTMsfh9cI7Y/q8NZp+hC0MIytc3POrhrKIfOTHe7Ga3wEB2S xbqQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4si53977700pgg.334.2019.08.09.05.14.44; Fri, 09 Aug 2019 05:14:59 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406699AbfHIMMy (ORCPT + 99 others); Fri, 9 Aug 2019 08:12:54 -0400 Received: from foss.arm.com ([217.140.110.172]:46532 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726152AbfHIMMx (ORCPT ); Fri, 9 Aug 2019 08:12:53 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B9D4A1596; Fri, 9 Aug 2019 05:12:52 -0700 (PDT) Received: from [10.1.197.61] (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EB6683F706; Fri, 9 Aug 2019 05:12:50 -0700 (PDT) Subject: Re: [PATCH 05/19] irqchip/mmp: do not use of_address_to_resource() to get mux regs To: Lubomir Rintel , Olof Johansson Cc: Rob Herring , Mark Rutland , Thomas Gleixner , Jason Cooper , Kishon Vijay Abraham I , Russell King , Michael Turquette , Stephen Boyd , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Pavel Machek References: <20190809093158.7969-1-lkundrak@v3.sk> <20190809093158.7969-6-lkundrak@v3.sk> From: Marc Zyngier Organization: Approximate Message-ID: <16d77ca3-7ad1-3af2-650e-722cf6a931ed@kernel.org> Date: Fri, 9 Aug 2019 13:12:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190809093158.7969-6-lkundrak@v3.sk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/08/2019 10:31, Lubomir Rintel wrote: > The "regs" property of the "mrvl,mmp2-mux-intc" devices are silly. They > are offsets from intc's base, not addresses on the parent bus. At this > point it probably can't be fixed. > > On an OLPC XO-1.75 machine, the muxes are children of the intc, not the > axi bus, and thus of_address_to_resource() won't work. We should treat > the values as mere integers as opposed to bus addresses. > > Signed-off-by: Lubomir Rintel > Acked-by: Pavel Machek > > --- > drivers/irqchip/irq-mmp.c | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c > index 14618dc0bd396..af9cba4a51c2e 100644 > --- a/drivers/irqchip/irq-mmp.c > +++ b/drivers/irqchip/irq-mmp.c > @@ -424,9 +424,9 @@ IRQCHIP_DECLARE(mmp2_intc, "mrvl,mmp2-intc", mmp2_of_init); > static int __init mmp2_mux_of_init(struct device_node *node, > struct device_node *parent) > { > - struct resource res; > int i, ret, irq, j = 0; > u32 nr_irqs, mfp_irq; > + u32 reg[4]; > > if (!parent) > return -ENODEV; > @@ -438,18 +438,20 @@ static int __init mmp2_mux_of_init(struct device_node *node, > pr_err("Not found mrvl,intc-nr-irqs property\n"); > return -EINVAL; > } > - ret = of_address_to_resource(node, 0, &res); > + > + /* > + * For historical reasonsm, the "regs" property of the > + * mrvl,mmp2-mux-intc is not a regular * "regs" property containing > + * addresses on the parent bus, but offsets from the intc's base. > + * That is why we can't use of_address_to_resource() here. > + */ > + ret = of_property_read_u32_array(node, "reg", reg, ARRAY_SIZE(reg)); This will return 0 even if you've read less than your expected 4 u32s. You may want to try of_property_read_variable_u32_array instead. > if (ret < 0) { > pr_err("Not found reg property\n"); > return -EINVAL; > } > - icu_data[i].reg_status = mmp_icu_base + res.start; > - ret = of_address_to_resource(node, 1, &res); > - if (ret < 0) { > - pr_err("Not found reg property\n"); > - return -EINVAL; > - } > - icu_data[i].reg_mask = mmp_icu_base + res.start; > + icu_data[i].reg_status = mmp_icu_base + reg[0]; > + icu_data[i].reg_mask = mmp_icu_base + reg[2]; > icu_data[i].cascade_irq = irq_of_parse_and_map(node, 0); > if (!icu_data[i].cascade_irq) > return -EINVAL; > Thanks, M. -- Jazz is not dead, it just smells funny...