]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
soc: fsl: dpio: extract the QBMAN clock frequency from the attributes
authorIoana Ciornei <ioana.ciornei@nxp.com>
Fri, 15 Oct 2021 09:01:23 +0000 (12:01 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Oct 2021 13:32:40 +0000 (14:32 +0100)
Through the dpio_get_attributes() firmware call the dpio driver has
access to the QBMAN clock frequency. Extend the structure which holds
the firmware's response so that we can have access to this information.

This will be needed in the next patches which also add support for
interrupt coalescing which needs to be configured based on the
frequency.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/soc/fsl/dpio/dpio-cmd.h
drivers/soc/fsl/dpio/dpio-driver.c
drivers/soc/fsl/dpio/dpio-service.c
drivers/soc/fsl/dpio/dpio.c
drivers/soc/fsl/dpio/dpio.h
drivers/soc/fsl/dpio/qbman-portal.h
include/soc/fsl/dpaa2-io.h

index e13fd3ac193940bd00ab85ee62247942388fd2b0..2fbcb78cdaaf13d5aeae12532c42400876eb4f7e 100644 (file)
@@ -46,6 +46,9 @@ struct dpio_rsp_get_attr {
        __le64 qbman_portal_ci_addr;
        /* cmd word 3 */
        __le32 qbman_version;
+       __le32 pad1;
+       /* cmd word 4 */
+       __le32 clk;
 };
 
 struct dpio_stashing_dest {
index 7f397b4ad878daf381775d093457af6d12402e2d..dd948889eeab8b93ceca8aeacebfd72f5123456e 100644 (file)
@@ -162,6 +162,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
                goto err_get_attr;
        }
        desc.qman_version = dpio_attrs.qbman_version;
+       desc.qman_clk = dpio_attrs.clk;
 
        err = dpio_enable(dpio_dev->mc_io, 0, dpio_dev->mc_handle);
        if (err) {
index 7351f303055063c7a93cd1e1f1e3fb85297c5818..2acbb96c5e45ffa08682bd2761e3e0d1bf93db67 100644 (file)
@@ -127,6 +127,7 @@ struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,
        obj->dpio_desc = *desc;
        obj->swp_desc.cena_bar = obj->dpio_desc.regs_cena;
        obj->swp_desc.cinh_bar = obj->dpio_desc.regs_cinh;
+       obj->swp_desc.qman_clk = obj->dpio_desc.qman_clk;
        obj->swp_desc.qman_version = obj->dpio_desc.qman_version;
        obj->swp = qbman_swp_init(&obj->swp_desc);
 
index af74c597a675620c56e4031f4b61466dc884c608..8ed606ffaac5e2473216bbfbea1024308342e492 100644 (file)
@@ -162,6 +162,7 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io,
        attr->qbman_portal_ci_offset =
                le64_to_cpu(dpio_rsp->qbman_portal_ci_addr);
        attr->qbman_version = le32_to_cpu(dpio_rsp->qbman_version);
+       attr->clk = le32_to_cpu(dpio_rsp->clk);
 
        return 0;
 }
index da06f72580980544309c2090993d938900fecb94..7fda44f0d7f4da74fd0543f8ba1d80a8002b2083 100644 (file)
@@ -59,6 +59,7 @@ int dpio_disable(struct fsl_mc_io     *mc_io,
  * @num_priorities: Number of priorities for the notification channel (1-8);
  *                     relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
  * @qbman_version: QBMAN version
+ * @clk: QBMAN clock frequency value in Hz
  */
 struct dpio_attr {
        int                     id;
@@ -68,6 +69,7 @@ struct dpio_attr {
        enum dpio_channel_mode  channel_mode;
        u8                      num_priorities;
        u32             qbman_version;
+       u32             clk;
 };
 
 int dpio_get_attributes(struct fsl_mc_io       *mc_io,
index c7c2225b7d914de953a2c9956ce7e68988a534a0..f058289416af4c118e7e46ee970c9b237b58b95f 100644 (file)
@@ -24,6 +24,7 @@ struct qbman_swp_desc {
        void *cena_bar; /* Cache-enabled portal base address */
        void __iomem *cinh_bar; /* Cache-inhibited portal base address */
        u32 qman_version;
+       u32 qman_clk;
 };
 
 #define QBMAN_SWP_INTERRUPT_EQRI 0x01
index c9d849924f890a664a376543871de66381f495ed..041ebf7d804c511fb3aba3e3e744be7f312724fc 100644 (file)
@@ -44,6 +44,7 @@ struct device;
  * @regs_cinh:      The cache inhibited regs
  * @dpio_id:        The dpio index
  * @qman_version:   The qman version
+ * @qman_clk:       The qman clock frequency in Hz
  *
  * Describes the attributes and features of the DPIO object.
  */
@@ -55,6 +56,7 @@ struct dpaa2_io_desc {
        void __iomem *regs_cinh;
        int dpio_id;
        u32 qman_version;
+       u32 qman_clk;
 };
 
 struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,