[PATCH v1 03/12] gna: read hardware info in the driver

From: Maciej Kwapulinski
Date: Tue Feb 16 2021 - 11:11:51 EST


From: Tomasz Jankowski <tomasz1.jankowski@xxxxxxxxx>

Get the hardware information from register MMIO_IBUFFS

Signed-off-by: Tomasz Jankowski <tomasz1.jankowski@xxxxxxxxx>
Tested-by: Savo Novakovic <savox.novakovic@xxxxxxxxx>
Co-developed-by: Jianxun Zhang <jianxun.zhang@xxxxxxxxxxxxxxx>
Signed-off-by: Jianxun Zhang <jianxun.zhang@xxxxxxxxxxxxxxx>
Signed-off-by: Maciej Kwapulinski <maciej.kwapulinski@xxxxxxxxxxxxxxx>
---
drivers/misc/gna/gna_device.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/misc/gna/gna_device.c b/drivers/misc/gna/gna_device.c
index a6ef7e790e9e..869507594f9e 100644
--- a/drivers/misc/gna/gna_device.c
+++ b/drivers/misc/gna/gna_device.c
@@ -6,10 +6,13 @@

#include "gna_device.h"
#include "gna_driver.h"
+#include "gna_hw.h"

static int gna_dev_init(struct gna_private *gna_priv, struct pci_dev *pcidev,
const struct pci_device_id *pci_id)
{
+ u32 bld_reg;
+
pci_set_drvdata(pcidev, gna_priv);

gna_priv->parent = &pcidev->dev;
@@ -17,6 +20,9 @@ static int gna_dev_init(struct gna_private *gna_priv, struct pci_dev *pcidev,
gna_priv->info = *(struct gna_drv_info *)pci_id->driver_data;
gna_priv->drv_priv = &gna_drv_priv;

+ bld_reg = gna_reg_read(gna_priv->bar0.mem_addr, GNA_MMIO_IBUFFS);
+ gna_priv->hw_info.in_buf_s = bld_reg & GENMASK(7, 0);
+
return 0;
}

--
2.28.0