Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4355930imu; Mon, 28 Jan 2019 23:32:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN7FWAyjRxDyDApV9Kc7sX/PE1KKnHdRRQLAj/tfbsND6VY7bl2kGcIcLzCAXmlQFPFWcTGD X-Received: by 2002:a63:ee4c:: with SMTP id n12mr22101711pgk.21.1548747167652; Mon, 28 Jan 2019 23:32:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548747167; cv=none; d=google.com; s=arc-20160816; b=vkH+LqFEbdibfEfzSNxet0o1LsS1oYme2S0LTVnxYuu4qQcYm2y9fYI1NBiJA6u9dn TDJzLfLyBOmkrKrUqo8RG7x6tzCj9+Zg3VBpIgiUm1Vt/04ZQS2tu6+TWbZ834ELh3sj oEN3eAh8KFZqdzvHBxzwYj0LLOcamW4uEQkskI6/iz8+ZRyfEm5qokULUBnteJTxvBfX n9NuQQhxvQCGc5tatW+rYihUrmiXIcBnht22Zfthi0Clcy8ANX96H8yG4zY6gnLz2SaV 1K701LhgRpeETU/J5Z/PN+615WhDv8VQUtCj7DqRBoRel4ajZT3xoJmkVsfNZRJU16St tE1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=iRvkZgmwqYLfrjNrBZVCoKeBAWTCzHwRMEpDl4uWvhU=; b=aohS9wnkY1dLvtjLkPyrFhnr0agxdtGVMYVtN0yFXllxt/LSMPI7sV8SpbIC5TWSa9 Lr58OWk7r6S4o7e9UjElBQ3t2rUHEabsGuh8FW7cOGa8qxyCLtrAMM+blSWch9foEVg1 /pfCB3tnpgfax/EQuIvj/rTZ0cOTBiBFcuwvb8Ue2HAt4FgqAaR8Uv6Fas0IpmNuMdbA Z5zWN3hfwuK7xQQfroMALjikCBEqd4rq3hvwx/9ohcb4QMui5fOaQQ+J0voSyktdQLuH 3MOlFzNWZ8ErwDKA29FUmCUOz7lLf8kjrCjxUOgCrwms2nbhq+aFPvR0n4YjwRVVtNB8 YFeQ== 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 k72si32960681pge.310.2019.01.28.23.32.32; Mon, 28 Jan 2019 23:32:47 -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 S1727009AbfA2HcZ (ORCPT + 99 others); Tue, 29 Jan 2019 02:32:25 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:20119 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725786AbfA2HcW (ORCPT ); Tue, 29 Jan 2019 02:32:22 -0500 X-UUID: 0588ae895bbf41be959d4b0382ef8911-20190129 X-UUID: 0588ae895bbf41be959d4b0382ef8911-20190129 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 464381186; Tue, 29 Jan 2019 15:32:12 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 29 Jan 2019 15:32:12 +0800 Received: from mtkslt302.mediatek.inc (10.21.14.115) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 29 Jan 2019 15:32:11 +0800 From: Bibby Hsieh To: Jassi Brar , Matthias Brugger , Rob Herring , CK HU CC: Daniel Kurtz , Sascha Hauer , , , , , , Sascha Hauer , Philipp Zabel , Nicolas Boichat , Bibby Hsieh , YT Shen , Daoyuan Huang , Jiaguang Zhang , Dennis-YC Hsieh , Houlong Wei , , , Frederic Chen Subject: [PATCH 06/10] soc: mediatek: add register device function Date: Tue, 29 Jan 2019 15:32:03 +0800 Message-ID: <1548747128-60136-7-git-send-email-bibby.hsieh@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1548747128-60136-1-git-send-email-bibby.hsieh@mediatek.com> References: <1548747128-60136-1-git-send-email-bibby.hsieh@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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]; + } + 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__ */ -- 1.9.1