From nobody Tue Dec 16 12:20:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 242DCC10DCE for ; Thu, 30 Nov 2023 13:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345674AbjK3Npu (ORCPT ); Thu, 30 Nov 2023 08:45:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345646AbjK3Npr (ORCPT ); Thu, 30 Nov 2023 08:45:47 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42833DD for ; Thu, 30 Nov 2023 05:45:53 -0800 (PST) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Sgy9s3m4PzWj0l; Thu, 30 Nov 2023 21:45:05 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 30 Nov 2023 21:45:50 +0800 From: Huisong Li To: CC: , , , , , , , , Subject: [PATCH v2 1/4] soc: hisilicon: kunpeng_hccs: Fix some incorrect format strings Date: Thu, 30 Nov 2023 21:45:47 +0800 Message-ID: <20231130134550.33398-2-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231130134550.33398-1-lihuisong@huawei.com> References: <20231109054526.27270-1-lihuisong@huawei.com> <20231130134550.33398-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm000004.china.huawei.com (7.193.23.18) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Fix some incorrect format strings. Signed-off-by: Huisong Li Reviewed-by: Jonathan Cameron --- drivers/soc/hisilicon/kunpeng_hccs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/k= unpeng_hccs.c index e31791659560..dad6235dbf1a 100644 --- a/drivers/soc/hisilicon/kunpeng_hccs.c +++ b/drivers/soc/hisilicon/kunpeng_hccs.c @@ -155,7 +155,7 @@ static int hccs_register_pcc_channel(struct hccs_dev *h= dev) cl_info->pcc_comm_addr =3D ioremap(pcc_chan->shmem_base_addr, pcc_chan->shmem_size); if (!cl_info->pcc_comm_addr) { - dev_err(dev, "Failed to ioremap PCC communication region for channel-%d= .\n", + dev_err(dev, "Failed to ioremap PCC communication region for channel-%u= .\n", hdev->chan_id); rc =3D -ENOMEM; goto err_mbx_channel_free; @@ -1097,7 +1097,7 @@ static int hccs_create_hccs_dir(struct hccs_dev *hdev, int ret; =20 ret =3D kobject_init_and_add(&port->kobj, &hccs_port_type, - &die->kobj, "hccs%d", port->port_id); + &die->kobj, "hccs%u", port->port_id); if (ret) { kobject_put(&port->kobj); return ret; @@ -1115,7 +1115,7 @@ static int hccs_create_die_dir(struct hccs_dev *hdev, u16 i; =20 ret =3D kobject_init_and_add(&die->kobj, &hccs_die_type, - &chip->kobj, "die%d", die->die_id); + &chip->kobj, "die%u", die->die_id); if (ret) { kobject_put(&die->kobj); return ret; @@ -1125,7 +1125,7 @@ static int hccs_create_die_dir(struct hccs_dev *hdev, port =3D &die->ports[i]; ret =3D hccs_create_hccs_dir(hdev, die, port); if (ret) { - dev_err(hdev->dev, "create hccs%d dir failed.\n", + dev_err(hdev->dev, "create hccs%u dir failed.\n", port->port_id); goto err; } @@ -1147,7 +1147,7 @@ static int hccs_create_chip_dir(struct hccs_dev *hdev, u16 id; =20 ret =3D kobject_init_and_add(&chip->kobj, &hccs_chip_type, - &hdev->dev->kobj, "chip%d", chip->chip_id); + &hdev->dev->kobj, "chip%u", chip->chip_id); if (ret) { kobject_put(&chip->kobj); return ret; @@ -1178,7 +1178,7 @@ static int hccs_create_topo_dirs(struct hccs_dev *hde= v) chip =3D &hdev->chips[id]; ret =3D hccs_create_chip_dir(hdev, chip); if (ret) { - dev_err(hdev->dev, "init chip%d dir failed!\n", id); + dev_err(hdev->dev, "init chip%u dir failed!\n", id); goto err; } } --=20 2.33.0 From nobody Tue Dec 16 12:20:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD013C07CA9 for ; Thu, 30 Nov 2023 13:46:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345698AbjK3Npw (ORCPT ); Thu, 30 Nov 2023 08:45:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345682AbjK3Npt (ORCPT ); Thu, 30 Nov 2023 08:45:49 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B92BF10F8 for ; Thu, 30 Nov 2023 05:45:55 -0800 (PST) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Sgy9t0Gw8zWj0x; Thu, 30 Nov 2023 21:45:06 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 30 Nov 2023 21:45:51 +0800 From: Huisong Li To: CC: , , , , , , , , Subject: [PATCH v2 2/4] soc: hisilicon: kunpeng_hccs: Add failure log for no _CRS method Date: Thu, 30 Nov 2023 21:45:48 +0800 Message-ID: <20231130134550.33398-3-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231130134550.33398-1-lihuisong@huawei.com> References: <20231109054526.27270-1-lihuisong@huawei.com> <20231130134550.33398-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm000004.china.huawei.com (7.193.23.18) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Driver gets the PCC channel id by using the PCC GAS in _CRS. But, currently, if the firmware has no _CRS method on platform, there is not any failure log. So this patch adds the log for this. Signed-off-by: Huisong Li Reviewed-by: Jonathan Cameron --- drivers/soc/hisilicon/kunpeng_hccs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/k= unpeng_hccs.c index dad6235dbf1a..fd3ca0eb8175 100644 --- a/drivers/soc/hisilicon/kunpeng_hccs.c +++ b/drivers/soc/hisilicon/kunpeng_hccs.c @@ -85,8 +85,10 @@ static int hccs_get_pcc_chan_id(struct hccs_dev *hdev) struct hccs_register_ctx ctx =3D {0}; acpi_status status; =20 - if (!acpi_has_method(handle, METHOD_NAME__CRS)) + if (!acpi_has_method(handle, METHOD_NAME__CRS)) { + dev_err(hdev->dev, "No _CRS method.\n"); return -ENODEV; + } =20 ctx.dev =3D hdev->dev; status =3D acpi_walk_resources(handle, METHOD_NAME__CRS, --=20 2.33.0 From nobody Tue Dec 16 12:20:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88509C4167B for ; Thu, 30 Nov 2023 13:46:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345710AbjK3Npy (ORCPT ); Thu, 30 Nov 2023 08:45:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345673AbjK3Npt (ORCPT ); Thu, 30 Nov 2023 08:45:49 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 126FE19F for ; Thu, 30 Nov 2023 05:45:56 -0800 (PST) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Sgy9w3wF1zWj16; Thu, 30 Nov 2023 21:45:08 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 30 Nov 2023 21:45:51 +0800 From: Huisong Li To: CC: , , , , , , , , Subject: [PATCH v2 3/4] soc: hisilicon: kunpeng_hccs: remove an unused blank line Date: Thu, 30 Nov 2023 21:45:49 +0800 Message-ID: <20231130134550.33398-4-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231130134550.33398-1-lihuisong@huawei.com> References: <20231109054526.27270-1-lihuisong@huawei.com> <20231130134550.33398-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm000004.china.huawei.com (7.193.23.18) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Remove an unused blank line. Signed-off-by: Huisong Li Reviewed-by: Jonathan Cameron --- drivers/soc/hisilicon/kunpeng_hccs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/k= unpeng_hccs.c index fd3ca0eb8175..15125f1e0f3e 100644 --- a/drivers/soc/hisilicon/kunpeng_hccs.c +++ b/drivers/soc/hisilicon/kunpeng_hccs.c @@ -529,7 +529,6 @@ static int hccs_get_all_port_info_on_die(struct hccs_de= v *hdev, =20 static int hccs_query_all_port_info_on_platform(struct hccs_dev *hdev) { - struct device *dev =3D hdev->dev; struct hccs_chip_info *chip; struct hccs_die_info *die; --=20 2.33.0 From nobody Tue Dec 16 12:20:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D283C4167B for ; Thu, 30 Nov 2023 13:46:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345693AbjK3Np5 (ORCPT ); Thu, 30 Nov 2023 08:45:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345695AbjK3Npv (ORCPT ); Thu, 30 Nov 2023 08:45:51 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91B0CD40 for ; Thu, 30 Nov 2023 05:45:56 -0800 (PST) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Sgy9x0LpxzWj1C; Thu, 30 Nov 2023 21:45:09 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 30 Nov 2023 21:45:54 +0800 From: Huisong Li To: CC: , , , , , , , , Subject: [PATCH v2 4/4] soc: hisilicon: kunpeng_hccs: Support the platform with PCC type3 and interrupt ack Date: Thu, 30 Nov 2023 21:45:50 +0800 Message-ID: <20231130134550.33398-5-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231130134550.33398-1-lihuisong@huawei.com> References: <20231109054526.27270-1-lihuisong@huawei.com> <20231130134550.33398-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm000004.china.huawei.com (7.193.23.18) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Support the platform with PCC type3 and interrupt ack. And a version specific structure is introduced to handle the difference between the device in the code. Signed-off-by: Huisong Li Reviewed-by: Jonathan Cameron --- drivers/soc/hisilicon/kunpeng_hccs.c | 136 ++++++++++++++++++++++----- drivers/soc/hisilicon/kunpeng_hccs.h | 15 +++ 2 files changed, 126 insertions(+), 25 deletions(-) diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/k= unpeng_hccs.c index 15125f1e0f3e..d2302ff8c0e9 100644 --- a/drivers/soc/hisilicon/kunpeng_hccs.c +++ b/drivers/soc/hisilicon/kunpeng_hccs.c @@ -110,6 +110,14 @@ static void hccs_chan_tx_done(struct mbox_client *cl, = void *msg, int ret) *(u8 *)msg, ret); } =20 +static void hccs_pcc_rx_callback(struct mbox_client *cl, void *mssg) +{ + struct hccs_mbox_client_info *cl_info =3D + container_of(cl, struct hccs_mbox_client_info, client); + + complete(&cl_info->done); +} + static void hccs_unregister_pcc_channel(struct hccs_dev *hdev) { struct hccs_mbox_client_info *cl_info =3D &hdev->cl_info; @@ -131,6 +139,9 @@ static int hccs_register_pcc_channel(struct hccs_dev *h= dev) cl->tx_block =3D false; cl->knows_txdone =3D true; cl->tx_done =3D hccs_chan_tx_done; + cl->rx_callback =3D hdev->verspec_data->rx_callback; + init_completion(&cl_info->done); + pcc_chan =3D pcc_mbox_request_channel(cl, hdev->chan_id); if (IS_ERR(pcc_chan)) { dev_err(dev, "PPC channel request failed.\n"); @@ -147,10 +158,16 @@ static int hccs_register_pcc_channel(struct hccs_dev = *hdev) */ cl_info->deadline_us =3D HCCS_PCC_CMD_WAIT_RETRIES_NUM * pcc_chan->latency; - if (cl_info->mbox_chan->mbox->txdone_irq) { + if (!hdev->verspec_data->has_txdone_irq && + cl_info->mbox_chan->mbox->txdone_irq) { dev_err(dev, "PCC IRQ in PCCT is enabled.\n"); rc =3D -EINVAL; goto err_mbx_channel_free; + } else if (hdev->verspec_data->has_txdone_irq && + !cl_info->mbox_chan->mbox->txdone_irq) { + dev_err(dev, "PCC IRQ in PCCT isn't supported.\n"); + rc =3D -EINVAL; + goto err_mbx_channel_free; } =20 if (pcc_chan->shmem_base_addr) { @@ -172,7 +189,7 @@ static int hccs_register_pcc_channel(struct hccs_dev *h= dev) return rc; } =20 -static int hccs_check_chan_cmd_complete(struct hccs_dev *hdev) +static inline int hccs_wait_cmd_complete_by_poll(struct hccs_dev *hdev) { struct hccs_mbox_client_info *cl_info =3D &hdev->cl_info; struct acpi_pcct_shared_memory __iomem *comm_base =3D @@ -194,30 +211,75 @@ static int hccs_check_chan_cmd_complete(struct hccs_d= ev *hdev) return ret; } =20 +static inline int hccs_wait_cmd_complete_by_irq(struct hccs_dev *hdev) +{ + struct hccs_mbox_client_info *cl_info =3D &hdev->cl_info; + int ret =3D 0; + + if (!wait_for_completion_timeout(&cl_info->done, + usecs_to_jiffies(cl_info->deadline_us))) { + dev_err(hdev->dev, "PCC command executed timeout!\n"); + ret =3D -ETIMEDOUT; + } + + return ret; +} + +static inline void hccs_fill_pcc_shared_mem_region(struct hccs_dev *hdev, + u8 cmd, + struct hccs_desc *desc, + void __iomem *comm_space, + u16 space_size) +{ + struct acpi_pcct_shared_memory tmp =3D { + .signature =3D PCC_SIGNATURE | hdev->chan_id, + .command =3D cmd, + .status =3D 0, + }; + + memcpy_toio(hdev->cl_info.pcc_comm_addr, (void *)&tmp, + sizeof(struct acpi_pcct_shared_memory)); + + /* Copy the message to the PCC comm space */ + memcpy_toio(comm_space, (void *)desc, space_size); +} + +static inline void hccs_fill_ext_pcc_shared_mem_region(struct hccs_dev *hd= ev, + u8 cmd, + struct hccs_desc *desc, + void __iomem *comm_space, + u16 space_size) +{ + struct acpi_pcct_ext_pcc_shared_memory tmp =3D { + .signature =3D PCC_SIGNATURE | hdev->chan_id, + .flags =3D PCC_CMD_COMPLETION_NOTIFY, + .length =3D HCCS_PCC_SHARE_MEM_BYTES, + .command =3D cmd, + }; + + memcpy_toio(hdev->cl_info.pcc_comm_addr, (void *)&tmp, + sizeof(struct acpi_pcct_ext_pcc_shared_memory)); + + /* Copy the message to the PCC comm space */ + memcpy_toio(comm_space, (void *)desc, space_size); +} + static int hccs_pcc_cmd_send(struct hccs_dev *hdev, u8 cmd, struct hccs_desc *desc) { + const struct hccs_verspecific_data *verspec_data =3D hdev->verspec_data; struct hccs_mbox_client_info *cl_info =3D &hdev->cl_info; - void __iomem *comm_space =3D cl_info->pcc_comm_addr + - sizeof(struct acpi_pcct_shared_memory); struct hccs_fw_inner_head *fw_inner_head; - struct acpi_pcct_shared_memory tmp =3D {0}; - u16 comm_space_size; + void __iomem *comm_space; + u16 space_size; int ret; =20 - /* Write signature for this subspace */ - tmp.signature =3D PCC_SIGNATURE | hdev->chan_id; - /* Write to the shared command region */ - tmp.command =3D cmd; - /* Clear cmd complete bit */ - tmp.status =3D 0; - memcpy_toio(cl_info->pcc_comm_addr, (void *)&tmp, - sizeof(struct acpi_pcct_shared_memory)); - - /* Copy the message to the PCC comm space */ - comm_space_size =3D HCCS_PCC_SHARE_MEM_BYTES - - sizeof(struct acpi_pcct_shared_memory); - memcpy_toio(comm_space, (void *)desc, comm_space_size); + comm_space =3D cl_info->pcc_comm_addr + verspec_data->shared_mem_size; + space_size =3D HCCS_PCC_SHARE_MEM_BYTES - verspec_data->shared_mem_size; + verspec_data->fill_pcc_shared_mem(hdev, cmd, desc, + comm_space, space_size); + if (verspec_data->has_txdone_irq) + reinit_completion(&cl_info->done); =20 /* Ring doorbell */ ret =3D mbox_send_message(cl_info->mbox_chan, &cmd); @@ -227,13 +289,12 @@ static int hccs_pcc_cmd_send(struct hccs_dev *hdev, u= 8 cmd, goto end; } =20 - /* Wait for completion */ - ret =3D hccs_check_chan_cmd_complete(hdev); + ret =3D verspec_data->wait_cmd_complete(hdev); if (ret) goto end; =20 /* Copy response data */ - memcpy_fromio((void *)desc, comm_space, comm_space_size); + memcpy_fromio((void *)desc, comm_space, space_size); fw_inner_head =3D &desc->rsp.fw_inner_head; if (fw_inner_head->retStatus) { dev_err(hdev->dev, "Execute PCC command failed, error code =3D %u.\n", @@ -242,7 +303,10 @@ static int hccs_pcc_cmd_send(struct hccs_dev *hdev, u8= cmd, } =20 end: - mbox_client_txdone(cl_info->mbox_chan, ret); + if (verspec_data->has_txdone_irq) + mbox_chan_txdone(cl_info->mbox_chan, ret); + else + mbox_client_txdone(cl_info->mbox_chan, ret); return ret; } =20 @@ -1213,6 +1277,11 @@ static int hccs_probe(struct platform_device *pdev) hdev->dev =3D &pdev->dev; platform_set_drvdata(pdev, hdev); =20 + /* + * Here would never be failure as the driver and device has been matched. + */ + hdev->verspec_data =3D acpi_device_get_match_data(hdev->dev); + mutex_init(&hdev->lock); rc =3D hccs_get_pcc_chan_id(hdev); if (rc) @@ -1249,9 +1318,26 @@ static void hccs_remove(struct platform_device *pdev) hccs_unregister_pcc_channel(hdev); } =20 +static const struct hccs_verspecific_data hisi04b1_verspec_data =3D { + .rx_callback =3D NULL, + .wait_cmd_complete =3D hccs_wait_cmd_complete_by_poll, + .fill_pcc_shared_mem =3D hccs_fill_pcc_shared_mem_region, + .shared_mem_size =3D sizeof(struct acpi_pcct_shared_memory), + .has_txdone_irq =3D false, +}; + +static const struct hccs_verspecific_data hisi04b2_verspec_data =3D { + .rx_callback =3D hccs_pcc_rx_callback, + .wait_cmd_complete =3D hccs_wait_cmd_complete_by_irq, + .fill_pcc_shared_mem =3D hccs_fill_ext_pcc_shared_mem_region, + .shared_mem_size =3D sizeof(struct acpi_pcct_ext_pcc_shared_memory), + .has_txdone_irq =3D true, +}; + static const struct acpi_device_id hccs_acpi_match[] =3D { - { "HISI04B1"}, - { ""}, + { "HISI04B1", (unsigned long)&hisi04b1_verspec_data}, + { "HISI04B2", (unsigned long)&hisi04b2_verspec_data}, + { } }; MODULE_DEVICE_TABLE(acpi, hccs_acpi_match); =20 diff --git a/drivers/soc/hisilicon/kunpeng_hccs.h b/drivers/soc/hisilicon/k= unpeng_hccs.h index 6012d2776028..c3adbc01b471 100644 --- a/drivers/soc/hisilicon/kunpeng_hccs.h +++ b/drivers/soc/hisilicon/kunpeng_hccs.h @@ -51,11 +51,26 @@ struct hccs_mbox_client_info { struct pcc_mbox_chan *pcc_chan; u64 deadline_us; void __iomem *pcc_comm_addr; + struct completion done; +}; + +struct hccs_desc; + +struct hccs_verspecific_data { + void (*rx_callback)(struct mbox_client *cl, void *mssg); + int (*wait_cmd_complete)(struct hccs_dev *hdev); + void (*fill_pcc_shared_mem)(struct hccs_dev *hdev, + u8 cmd, struct hccs_desc *desc, + void __iomem *comm_space, + u16 space_size); + u16 shared_mem_size; + bool has_txdone_irq; }; =20 struct hccs_dev { struct device *dev; struct acpi_device *acpi_dev; + const struct hccs_verspecific_data *verspec_data; u64 caps; u8 chip_num; struct hccs_chip_info *chips; --=20 2.33.0