Commit 2cf0b6fe authored by Ioana Ciornei's avatar Ioana Ciornei Committed by David S. Miller

soc: fsl: dpio: extract the QBMAN clock frequency from the attributes

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: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f3fafbcb
...@@ -46,6 +46,9 @@ struct dpio_rsp_get_attr { ...@@ -46,6 +46,9 @@ struct dpio_rsp_get_attr {
__le64 qbman_portal_ci_addr; __le64 qbman_portal_ci_addr;
/* cmd word 3 */ /* cmd word 3 */
__le32 qbman_version; __le32 qbman_version;
__le32 pad1;
/* cmd word 4 */
__le32 clk;
}; };
struct dpio_stashing_dest { struct dpio_stashing_dest {
......
...@@ -162,6 +162,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) ...@@ -162,6 +162,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
goto err_get_attr; goto err_get_attr;
} }
desc.qman_version = dpio_attrs.qbman_version; 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); err = dpio_enable(dpio_dev->mc_io, 0, dpio_dev->mc_handle);
if (err) { if (err) {
......
...@@ -127,6 +127,7 @@ struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc, ...@@ -127,6 +127,7 @@ struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,
obj->dpio_desc = *desc; obj->dpio_desc = *desc;
obj->swp_desc.cena_bar = obj->dpio_desc.regs_cena; obj->swp_desc.cena_bar = obj->dpio_desc.regs_cena;
obj->swp_desc.cinh_bar = obj->dpio_desc.regs_cinh; 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_desc.qman_version = obj->dpio_desc.qman_version;
obj->swp = qbman_swp_init(&obj->swp_desc); obj->swp = qbman_swp_init(&obj->swp_desc);
......
...@@ -162,6 +162,7 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io, ...@@ -162,6 +162,7 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io,
attr->qbman_portal_ci_offset = attr->qbman_portal_ci_offset =
le64_to_cpu(dpio_rsp->qbman_portal_ci_addr); le64_to_cpu(dpio_rsp->qbman_portal_ci_addr);
attr->qbman_version = le32_to_cpu(dpio_rsp->qbman_version); attr->qbman_version = le32_to_cpu(dpio_rsp->qbman_version);
attr->clk = le32_to_cpu(dpio_rsp->clk);
return 0; return 0;
} }
......
...@@ -59,6 +59,7 @@ int dpio_disable(struct fsl_mc_io *mc_io, ...@@ -59,6 +59,7 @@ int dpio_disable(struct fsl_mc_io *mc_io,
* @num_priorities: Number of priorities for the notification channel (1-8); * @num_priorities: Number of priorities for the notification channel (1-8);
* relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL' * relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
* @qbman_version: QBMAN version * @qbman_version: QBMAN version
* @clk: QBMAN clock frequency value in Hz
*/ */
struct dpio_attr { struct dpio_attr {
int id; int id;
...@@ -68,6 +69,7 @@ struct dpio_attr { ...@@ -68,6 +69,7 @@ struct dpio_attr {
enum dpio_channel_mode channel_mode; enum dpio_channel_mode channel_mode;
u8 num_priorities; u8 num_priorities;
u32 qbman_version; u32 qbman_version;
u32 clk;
}; };
int dpio_get_attributes(struct fsl_mc_io *mc_io, int dpio_get_attributes(struct fsl_mc_io *mc_io,
......
...@@ -24,6 +24,7 @@ struct qbman_swp_desc { ...@@ -24,6 +24,7 @@ struct qbman_swp_desc {
void *cena_bar; /* Cache-enabled portal base address */ void *cena_bar; /* Cache-enabled portal base address */
void __iomem *cinh_bar; /* Cache-inhibited portal base address */ void __iomem *cinh_bar; /* Cache-inhibited portal base address */
u32 qman_version; u32 qman_version;
u32 qman_clk;
}; };
#define QBMAN_SWP_INTERRUPT_EQRI 0x01 #define QBMAN_SWP_INTERRUPT_EQRI 0x01
......
...@@ -44,6 +44,7 @@ struct device; ...@@ -44,6 +44,7 @@ struct device;
* @regs_cinh: The cache inhibited regs * @regs_cinh: The cache inhibited regs
* @dpio_id: The dpio index * @dpio_id: The dpio index
* @qman_version: The qman version * @qman_version: The qman version
* @qman_clk: The qman clock frequency in Hz
* *
* Describes the attributes and features of the DPIO object. * Describes the attributes and features of the DPIO object.
*/ */
...@@ -55,6 +56,7 @@ struct dpaa2_io_desc { ...@@ -55,6 +56,7 @@ struct dpaa2_io_desc {
void __iomem *regs_cinh; void __iomem *regs_cinh;
int dpio_id; int dpio_id;
u32 qman_version; u32 qman_version;
u32 qman_clk;
}; };
struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc, struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment