Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp397653ima; Thu, 31 Jan 2019 19:14:13 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia0rkjUXNiZSGSsdKWDADB1QVCBDVFO7FJRQXG0dnGF431oAEnr6Lq4EkVrE6eXTRzF7y4U X-Received: by 2002:a63:4c5:: with SMTP id 188mr524287pge.391.1548990852933; Thu, 31 Jan 2019 19:14:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548990852; cv=none; d=google.com; s=arc-20160816; b=bd71B3jaHbWxgYpClCOKcZg11gV/AXBileNQ/npC28v4ygJZew4YdWumOnMV1HCwj3 kt2gBxfOgpYkjcjTuH1vgJegSY0UPe9F7hqcM5a2UoYj3pEtKoRKEnS+lzg71cJPU/bM pwU6JAgVRY7QaPyrCHltXgiO89XUGUGHIyDGflMBOgoA7h6OPsLCRRuH5WKIkLKz6n5x SMbQYak82fSMPudAMmXSsg79WvnB5EvipzSNxDdxR0PGeHmGMwxZNMfrG+4apoE887oG Z+nnWV0Gk+4I51XyrEsyCapo3YPtOQvPM8poylz0Tsxuvb2ekFJGTnIfJUiwxgz7MyON oT1w== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=dgvUBNTkyRSqrdasuaegPUuqQtrEClxiOthHnusAcZQ=; b=YKCNTDryAXhQacsp6hae41QNKirzK9e2xOFzwsRjvp7pdGuBeB2gR8ISZoWaoJPfLp 0rs3YD34FNUozcVihDDRDEtroqAcQeCaEEWG7nHE9/ywMnvKd+vd79rZRBj1XXfvcy82 ozcuGzBOXtcETgIwfXUUNWEcGuRBCNNRBL8vToFLdE/C7T0tzLBZ7sViTpGYMehZG2aN dGQhfNKkuZJ+83E55cdwJ1AFp5JX+QBq/Jp21tohopgqejgcQv3sFz9gDCLH/6Xhpy0U nXIP2RAA0BcrWytL2S6zankV9/15/3QwyCjkJytGi5ExBLB6zB3N6gcjKLgMqxclcN3l Ns+A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si6036218pgc.587.2019.01.31.19.13.56; Thu, 31 Jan 2019 19:14:12 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726763AbfBABb0 (ORCPT + 99 others); Thu, 31 Jan 2019 20:31:26 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:37007 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725870AbfBABb0 (ORCPT ); Thu, 31 Jan 2019 20:31:26 -0500 X-UUID: 0c19a04efc4e49469a3c3261057127c0-20190201 X-UUID: 0c19a04efc4e49469a3c3261057127c0-20190201 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1676911109; Fri, 01 Feb 2019 09:31:12 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 1 Feb 2019 09:31:10 +0800 Received: from [172.21.77.4] (172.21.77.4) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 1 Feb 2019 09:31:10 +0800 Message-ID: <1548984670.7501.2.camel@mtksdaap41> Subject: Re: [PATCH 06/10] soc: mediatek: add register device function From: CK Hu To: Bibby Hsieh CC: Jassi Brar , Matthias Brugger , Rob Herring , Daniel Kurtz , Sascha Hauer , , , , , , Sascha Hauer , "Philipp Zabel" , Nicolas Boichat , "YT Shen" , Daoyuan Huang , Jiaguang Zhang , Dennis-YC Hsieh , Houlong Wei , , , Frederic Chen Date: Fri, 1 Feb 2019 09:31:10 +0800 In-Reply-To: <1548747128-60136-7-git-send-email-bibby.hsieh@mediatek.com> References: <1548747128-60136-1-git-send-email-bibby.hsieh@mediatek.com> <1548747128-60136-7-git-send-email-bibby.hsieh@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-SNTS-SMTP: 5F9CD66F38D58B2368783410EA4ADCE24611ACB8CD381CCC5FEA9C52371936CB2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Bibby: On Tue, 2019-01-29 at 15:32 +0800, Bibby Hsieh wrote: > GCE cannot know the register base address, we store the subsys-base address > relationship in the device node, and store the relationship by > cmdq_register_device function. > > Signed-off-by: Bibby Hsieh > --- > drivers/soc/mediatek/mtk-cmdq-helper.c | 24 ++++++++++++++++++++++++ > include/linux/soc/mediatek/mtk-cmdq.h | 1 + > 2 files changed, 25 insertions(+) > > diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c > index 6e4b85e..6ad997f 100644 > --- a/drivers/soc/mediatek/mtk-cmdq-helper.c > +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c > @@ -32,6 +32,30 @@ u8 cmdq_subsys_base_to_id(struct cmdq_base *clt_base, u32 base) > } > EXPORT_SYMBOL(cmdq_subsys_base_to_id); > > +struct cmdq_base *cmdq_register_device(struct device *dev) > +{ > + struct cmdq_base *clt_base; > + struct of_phandle_args spec; > + u32 idx; > + > + clt_base = devm_kzalloc(dev, sizeof(*clt_base), GFP_KERNEL); > + if (!clt_base) > + return NULL; > + > + /* parse subsys */ > + for (idx = 0; idx < ARRAY_SIZE(clt_base->subsys); idx++) { > + if (of_parse_phandle_with_args(dev->of_node, "gce-subsys", > + "#gce-subsys-cells", idx, &spec)) > + break; > + clt_base->subsys[idx].base = spec.args[0]; > + clt_base->subsys[idx].id = spec.args[1]; This does not match the binding [1]. [1] https://www.kernel.org/doc/Documentation/devicetree/bindings/mailbox/mtk-gce.txt Regards, CK > + } > + clt_base->count = idx; > + > + return clt_base; > +} > +EXPORT_SYMBOL(cmdq_register_device); > + > static void cmdq_client_timeout(struct timer_list *t) > { > struct cmdq_client *client = from_timer(client, t, timer); > diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h > index 0c7a6ee..a1f5eb6 100644 > --- a/include/linux/soc/mediatek/mtk-cmdq.h > +++ b/include/linux/soc/mediatek/mtk-cmdq.h > @@ -138,5 +138,6 @@ int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb cb, > int cmdq_pkt_flush(struct cmdq_pkt *pkt); > > u8 cmdq_subsys_base_to_id(struct cmdq_base *clt_base, u32 base); > +struct cmdq_base *cmdq_register_device(struct device *dev); > > #endif /* __MTK_CMDQ_H__ */