From: Danylo Vodopianov <dvo-...@napatech.com>

Reset platform and peripherals for PRM initialization.

Signed-off-by: Danylo Vodopianov <dvo-...@napatech.com>
---
 .../net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h |  2 ++
 .../core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c    | 13 +++++++++++++
 drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c     | 12 ++++++++++++
 3 files changed, 27 insertions(+)

diff --git a/drivers/net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h 
b/drivers/net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h
index 09bfd79249..53692145b7 100644
--- a/drivers/net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h
+++ b/drivers/net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h
@@ -26,5 +26,7 @@ typedef struct nt_prm_nt400dxx nt_prm_nt400dxx;
 
 nthw_prm_nt400dxx_t *nthw_prm_nt400dxx_new(void);
 int nthw_prm_nt400dxx_init(nthw_prm_nt400dxx_t *p, nthw_fpga_t *p_fpga, int 
n_instance);
+void nthw_prm_nt400dxx_periph_rst(nthw_prm_nt400dxx_t *p, uint32_t val);
+void nthw_prm_nt400dxx_platform_rst(nthw_prm_nt400dxx_t *p, uint32_t val);
 
 #endif /* NTHW_PRM_NT400DXX_H_ */
diff --git 
a/drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c 
b/drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c
index 4d74db88de..ff29101e61 100644
--- a/drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c
+++ b/drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c
@@ -52,6 +52,19 @@ static int nthw_fpga_rst_nt400dxx_init(struct fpga_info_s 
*p_fpga_info)
        p_fpga_info->mp_nthw_agx.p_prm = nthw_prm_nt400dxx_new();
        res = nthw_prm_nt400dxx_init(p_fpga_info->mp_nthw_agx.p_prm, p_fpga, 0);
 
+       if (res != 0)
+               return res;
+
+       /* (b1) Reset platform. It is released later */
+       nthw_prm_nt400dxx_platform_rst(p_fpga_info->mp_nthw_agx.p_prm, 1);
+       nt_os_wait_usec(10000);
+
+       /* (C) Reset peripherals and release the reset */
+       nthw_prm_nt400dxx_periph_rst(p_fpga_info->mp_nthw_agx.p_prm, 1);
+       nt_os_wait_usec(10000);
+       nthw_prm_nt400dxx_periph_rst(p_fpga_info->mp_nthw_agx.p_prm, 0);
+       nt_os_wait_usec(10000);
+
        if (res != 0)
                return res;
 
diff --git a/drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c 
b/drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c
index b1910fdbd5..286bda43f8 100644
--- a/drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c
+++ b/drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c
@@ -41,3 +41,15 @@ int nthw_prm_nt400dxx_init(nthw_prm_nt400dxx_t *p, 
nthw_fpga_t *p_fpga, int n_in
        p->mp_fld_rst_platform = nthw_register_get_field(p->mp_reg_rst, 
PRM_NT400DXX_RST_PLATFORM);
        return 0;
 }
+
+void nthw_prm_nt400dxx_periph_rst(nthw_prm_nt400dxx_t *p, uint32_t val)
+{
+       nthw_field_update_register(p->mp_fld_rst_periph);
+       nthw_field_set_val_flush32(p->mp_fld_rst_periph, val);
+}
+
+void nthw_prm_nt400dxx_platform_rst(nthw_prm_nt400dxx_t *p, uint32_t val)
+{
+       nthw_field_update_register(p->mp_fld_rst_platform);
+       nthw_field_set_val_flush32(p->mp_fld_rst_platform, val);
+}
-- 
2.45.0

Reply via email to