Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2866205ybg; Sat, 6 Jun 2020 04:04:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw82ZmjAUan4f2jtLVK7nqB4LRin6w/WyAWwrQUkoZDkWqIc8XO/8ObLbgBO+dvMiaV+Mss X-Received: by 2002:a17:906:2503:: with SMTP id i3mr13192136ejb.293.1591441485681; Sat, 06 Jun 2020 04:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591441485; cv=none; d=google.com; s=arc-20160816; b=nq34whLjaS5X4h2dsILtzLF/urw0MJocYjfa/6zolAfErzPKlwAv/mFoWVYllN9A3a CAXaxXtquedwg+07YXbPvHgqueTRadpZ6CsocjMQskC8bFYl5L2R0P0pq3XwUkyTWgxj wCq2hvZB1E8M5378oxJGjLfuQSuza1CADpcy5OYnfFQ/k3tjZzeHmNKIe4OnXa3u2zdF KcxDroXXr6xlfwayfgYDV5N3CvwxVKsWNoqGfPwWjDg7y0faU9xc43HezlolO0RPFgFn VfVrT0a73pFY6XkTN3wghtBQ1IrcMyVRHaPE2d7RynnC2YiPY593BLtMbn9JuJScJOgj 3brQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from; bh=9iI/TwSNgBruKyBEbvwRJBXsfJvbYfuowl5uMgMwd+s=; b=r1RpCVDU0cLqpfKIjwhwia6LK7YEw7uqjxuSK/tFzScHiyYhKZQhDXbRcvak9fu23T 2sOuKMtNbA7zT7oLkAFfpRNtCFSTGOx+QuDUG07BmLfnBTYTsw59sLN1ST/tydKie/Yb TcSRGXCRB1CfcqEp6Vp7+0MjbnIP2h1f9u92FTPzc/KnnjGWoJnRwe6X/O3IXJxw/S96 XHF/UYJk+cTp6zc9bPAXU0nagYcTVcN6amFKL7nlXe8aADETMxbq4kHhUkecZ6yM5HZx bCltTLztZTEse+8sHc1L+F4vJSZl6C9WBQf2CjbJhTfP33OTE1ZM+uRPpyafE/oExGxR xPWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u7si5233777ejn.279.2020.06.06.04.04.23; Sat, 06 Jun 2020 04:04:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728840AbgFFK7u (ORCPT + 99 others); Sat, 6 Jun 2020 06:59:50 -0400 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:42528 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728726AbgFFK7h (ORCPT ); Sat, 6 Jun 2020 06:59:37 -0400 Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-02.qualcomm.com with ESMTP; 06 Jun 2020 03:59:37 -0700 Received: from sivaprak-linux.qualcomm.com ([10.201.3.202]) by ironmsg03-sd.qualcomm.com with ESMTP; 06 Jun 2020 03:59:34 -0700 Received: by sivaprak-linux.qualcomm.com (Postfix, from userid 459349) id 0C061217DA; Sat, 6 Jun 2020 16:29:32 +0530 (IST) From: Sivaprakash Murugesan To: agross@kernel.org, bjorn.andersson@linaro.org, robh+dt@kernel.org, jassisinghbrar@gmail.com, sivaprak@codeaurora.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 3/3] mailbox: qcom: Add ipq6018 apcs compatible Date: Sat, 6 Jun 2020 16:29:31 +0530 Message-Id: <1591441171-20341-4-git-send-email-sivaprak@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1591441171-20341-1-git-send-email-sivaprak@codeaurora.org> References: <1591441171-20341-1-git-send-email-sivaprak@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Qualcomm ipq6018 has apcs block, add compatible for the same. Also, the apcs provides a clock controller functionality similar to msm8916 but the clock driver is different. Create a child platform device based on the apcs compatible for the clock controller functionality. Signed-off-by: Sivaprakash Murugesan --- [V2] * created a new structur for driver data. * re-arranged compatible strings in sorted order drivers/mailbox/qcom-apcs-ipc-mailbox.c | 61 +++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/drivers/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c index eeebafd..cec34f0 100644 --- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c +++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c @@ -24,6 +24,35 @@ struct qcom_apcs_ipc { struct platform_device *clk; }; +struct qcom_apcs_ipc_data { + int offset; + char *clk_name; +}; + +static const struct qcom_apcs_ipc_data ipq6018_apcs_data = { + .offset = 8, .clk_name = "qcom,apss-ipq6018-clk" +}; + +static const struct qcom_apcs_ipc_data ipq8074_apcs_data = { + .offset = 8, .clk_name = NULL +}; + +static const struct qcom_apcs_ipc_data msm8916_apcs_data = { + .offset = 8, .clk_name = "qcom-apcs-msm8916-clk" +}; + +static const struct qcom_apcs_ipc_data msm8996_apcs_data = { + .offset = 16, .clk_name = NULL +}; + +static const struct qcom_apcs_ipc_data msm8998_apcs_data = { + .offset = 8, .clk_name = NULL +}; + +static const struct qcom_apcs_ipc_data apps_shared_apcs_data = { + .offset = 12, .clk_name = NULL +}; + static const struct regmap_config apcs_regmap_config = { .reg_bits = 32, .reg_stride = 4, @@ -48,17 +77,12 @@ static const struct mbox_chan_ops qcom_apcs_ipc_ops = { static int qcom_apcs_ipc_probe(struct platform_device *pdev) { struct qcom_apcs_ipc *apcs; + const struct qcom_apcs_ipc_data *apcs_data; struct regmap *regmap; struct resource *res; - unsigned long offset; void __iomem *base; unsigned long i; int ret; - const struct of_device_id apcs_clk_match_table[] = { - { .compatible = "qcom,msm8916-apcs-kpss-global", }, - { .compatible = "qcom,qcs404-apcs-apps-global", }, - {} - }; apcs = devm_kzalloc(&pdev->dev, sizeof(*apcs), GFP_KERNEL); if (!apcs) @@ -73,10 +97,10 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); - offset = (unsigned long)of_device_get_match_data(&pdev->dev); + apcs_data = of_device_get_match_data(&pdev->dev); apcs->regmap = regmap; - apcs->offset = offset; + apcs->offset = apcs_data->offset; /* Initialize channel identifiers */ for (i = 0; i < ARRAY_SIZE(apcs->mbox_chans); i++) @@ -93,9 +117,9 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev) return ret; } - if (of_match_device(apcs_clk_match_table, &pdev->dev)) { + if (apcs_data->clk_name) { apcs->clk = platform_device_register_data(&pdev->dev, - "qcom-apcs-msm8916-clk", + apcs_data->clk_name, PLATFORM_DEVID_NONE, NULL, 0); if (IS_ERR(apcs->clk)) @@ -119,14 +143,15 @@ static int qcom_apcs_ipc_remove(struct platform_device *pdev) /* .data is the offset of the ipc register within the global block */ static const struct of_device_id qcom_apcs_ipc_of_match[] = { - { .compatible = "qcom,msm8916-apcs-kpss-global", .data = (void *)8 }, - { .compatible = "qcom,msm8996-apcs-hmss-global", .data = (void *)16 }, - { .compatible = "qcom,msm8998-apcs-hmss-global", .data = (void *)8 }, - { .compatible = "qcom,qcs404-apcs-apps-global", .data = (void *)8 }, - { .compatible = "qcom,sc7180-apss-shared", .data = (void *)12 }, - { .compatible = "qcom,sdm845-apss-shared", .data = (void *)12 }, - { .compatible = "qcom,sm8150-apss-shared", .data = (void *)12 }, - { .compatible = "qcom,ipq8074-apcs-apps-global", .data = (void *)8 }, + { .compatible = "qcom,ipq6018-apcs-apps-global", .data = &ipq6018_apcs_data }, + { .compatible = "qcom,ipq8074-apcs-apps-global", .data = &ipq8074_apcs_data }, + { .compatible = "qcom,msm8916-apcs-kpss-global", .data = &msm8916_apcs_data }, + { .compatible = "qcom,msm8996-apcs-hmss-global", .data = &msm8996_apcs_data }, + { .compatible = "qcom,msm8998-apcs-hmss-global", .data = &msm8998_apcs_data }, + { .compatible = "qcom,qcs404-apcs-apps-global", .data = &msm8916_apcs_data }, + { .compatible = "qcom,sc7180-apss-shared", .data = &apps_shared_apcs_data }, + { .compatible = "qcom,sdm845-apss-shared", .data = &apps_shared_apcs_data }, + { .compatible = "qcom,sm8150-apss-shared", .data = &apps_shared_apcs_data }, {} }; MODULE_DEVICE_TABLE(of, qcom_apcs_ipc_of_match); -- 2.7.4