Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5541300pxb; Wed, 26 Jan 2022 14:34:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAgowFTDv4siz4ojZDMbQ7DbKTwCQi2hc2xrNaSh8bpy3F5SWsCM8UQjrB/cCB3wYQgGMx X-Received: by 2002:a50:ed06:: with SMTP id j6mr1139663eds.16.1643236452478; Wed, 26 Jan 2022 14:34:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643236452; cv=none; d=google.com; s=arc-20160816; b=wEny7u3vGCMT2ywBPxPNIsJrjiPMrjTi0yQHFjGPwbK1uuQRcsg/JHXxm26P/WO6QN njczyVgHpVAwkbqFT/EuLilJCPSXTs2LicQRH4EiU/GIgl/ktDpxZNIKnGxVM5sUR15I xngoU2ryKWaxzLahyptJWqn875KrrK+HvFTe2GpRg1/u5JJyDqNJyr8l8sQtbkbK1O6T Bjxib6P86JDqGpL04GPxfEjp9ZfXtyX8zq2JcnAdtSJ7EHHF7EG4+dhGfAdRIuSF+mxQ Mm0si2ysOh6YmMaVJm8aTq99HvJkL5QoCAfcYhB3ZVNCr1e0hBg0NHIejs3IY53V0hDU oXgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=UP9gZvEqecFuu7zAvR9KN6tafDNiyzHOmQm+1VEcsME=; b=FoFb7DSXBtF7SbRRJ61cQTElVPRGpl8HQv9deBfwiMxQ0937qcm/GT7g2wrOEFSElo U5dubcv4KMvp3Hb4vt738zqyfvZNu5Lx8d5SreSYY5gcoaaTpokDNTKKbb83dlAbInu/ UWUQSu2aIxfNoy1TBIoRRBCMsW2x/wJn/3ktOb+BvSQOFkFCmT3Gyy3Vut2qm3ZcwQ1q Ig8UYvIlJsTW0ZvDDluOO6Per3/vxQLJng02xbNG5mJR7ZJFOQsuZxs7nmmOJ9WoRaTF bGD3CneUss7+g6NAucI9c1M4wvlr6vazogzJpD1Y+Sab9RUix1yjvfKRtCYwF5sX7qRo kCQg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w26si262087edq.254.2022.01.26.14.33.47; Wed, 26 Jan 2022 14:34:12 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244567AbiAZTvO (ORCPT + 99 others); Wed, 26 Jan 2022 14:51:14 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:62469 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S244546AbiAZTvI (ORCPT ); Wed, 26 Jan 2022 14:51:08 -0500 X-IronPort-AV: E=Sophos;i="5.88,319,1635174000"; d="scan'208";a="108403304" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 27 Jan 2022 04:51:07 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 66EE94008541; Thu, 27 Jan 2022 04:51:04 +0900 (JST) From: Lad Prabhakar To: Kishon Vijay Abraham I , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Arnd Bergmann , Greg Kroah-Hartman , Marek Vasut , Yoshihiro Shimoda , Rob Herring , linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Lad Prabhakar Subject: [RFC PATCH 3/5] misc: pci_endpoint_test: Add driver data for Renesas RZ/G2{EHMN} Date: Wed, 26 Jan 2022 19:50:41 +0000 Message-Id: <20220126195043.28376-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220126195043.28376-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220126195043.28376-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add "dmac_data_alignment" member (indicating the alignment requirement for internal DMAC for data transfers) to struct pci_endpoint_test_data and add driver_data to Renesas RZ/G2{EHMN}. Signed-off-by: Lad Prabhakar --- drivers/misc/pci_endpoint_test.c | 40 ++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 8f786a225dcf..0a00d45830e9 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -116,6 +116,7 @@ struct pci_endpoint_test { struct miscdevice miscdev; enum pci_barno test_reg_bar; size_t alignment; + size_t dmac_data_alignment; const char *name; }; @@ -123,6 +124,7 @@ struct pci_endpoint_test_data { enum pci_barno test_reg_bar; size_t alignment; int irq_type; + size_t dmac_data_alignment; }; static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test, @@ -368,8 +370,11 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, goto err; use_dma = !!(param.flags & PCITEST_FLAGS_USE_DMA); - if (use_dma) + if (use_dma) { flags |= FLAG_USE_DMA; + if (test->dmac_data_alignment) + size = ALIGN(size, test->dmac_data_alignment); + } if (irq_type < IRQ_TYPE_LEGACY || irq_type > IRQ_TYPE_MSIX) { dev_err(dev, "Invalid IRQ type option\n"); @@ -502,8 +507,11 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, goto err; use_dma = !!(param.flags & PCITEST_FLAGS_USE_DMA); - if (use_dma) + if (use_dma) { flags |= FLAG_USE_DMA; + if (test->dmac_data_alignment) + size = ALIGN(size, test->dmac_data_alignment); + } if (irq_type < IRQ_TYPE_LEGACY || irq_type > IRQ_TYPE_MSIX) { dev_err(dev, "Invalid IRQ type option\n"); @@ -600,8 +608,11 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, goto err; use_dma = !!(param.flags & PCITEST_FLAGS_USE_DMA); - if (use_dma) + if (use_dma) { flags |= FLAG_USE_DMA; + if (test->dmac_data_alignment) + size = ALIGN(size, test->dmac_data_alignment); + } if (irq_type < IRQ_TYPE_LEGACY || irq_type > IRQ_TYPE_MSIX) { dev_err(dev, "Invalid IRQ type option\n"); @@ -787,6 +798,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, test->test_reg_bar = test_reg_bar; test->alignment = data->alignment; irq_type = data->irq_type; + test->dmac_data_alignment = data->dmac_data_alignment; } init_completion(&test->irq_raised); @@ -948,6 +960,12 @@ static const struct pci_endpoint_test_data j721e_data = { .irq_type = IRQ_TYPE_MSI, }; +static const struct pci_endpoint_test_data renesas_rzg2x_data = { + .test_reg_bar = BAR_0, + .irq_type = IRQ_TYPE_MSI, + .dmac_data_alignment = 8, +}; + static const struct pci_device_id pci_endpoint_test_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_DRA74x), .driver_data = (kernel_ulong_t)&default_data, @@ -965,10 +983,18 @@ static const struct pci_device_id pci_endpoint_test_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_AM654), .driver_data = (kernel_ulong_t)&am654_data }, - { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_R8A774A1),}, - { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_R8A774B1),}, - { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_R8A774C0),}, - { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_R8A774E1),}, + { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_R8A774A1), + .driver_data = (kernel_ulong_t)&renesas_rzg2x_data, + }, + { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_R8A774B1), + .driver_data = (kernel_ulong_t)&renesas_rzg2x_data, + }, + { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_R8A774C0), + .driver_data = (kernel_ulong_t)&renesas_rzg2x_data, + }, + { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_R8A774E1), + .driver_data = (kernel_ulong_t)&renesas_rzg2x_data, + }, { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_J721E), .driver_data = (kernel_ulong_t)&j721e_data, }, -- 2.25.1