Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

octeon_ep: reset firmware ready status

Add support to reset firmware ready status
when the driver is removed(either in unload
or unbind)

Signed-off-by: Sathesh Edara <sedara@marvell.com>
Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
Signed-off-by: Vimlesh Kumar <vimleshk@marvell.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260115092048.870237-1-vimleshk@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Vimlesh Kumar and committed by
Jakub Kicinski
3b85d5f8 3d4375c2

+58 -1
+26
drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c
··· 637 637 638 638 octep_write_csr64(oct, CN93_SDP_WIN_WR_MASK_REG, 0xFF); 639 639 640 + /* Firmware status CSR is supposed to be cleared by 641 + * core domain reset, but due to a hw bug, it is not. 642 + * Set it to RUNNING right before reset so that it is not 643 + * left in READY (1) state after a reset. This is required 644 + * in addition to the early setting to handle the case where 645 + * the OcteonTX is unexpectedly reset, reboots, and then 646 + * the module is removed. 647 + */ 648 + OCTEP_PCI_WIN_WRITE(oct, 649 + CN9K_PEMX_PFX_CSX_PFCFGX(0, 650 + 0, CN9K_PCIEEP_VSECST_CTL), 651 + FW_STATUS_DOWNING); 652 + 640 653 /* Set core domain reset bit */ 641 654 OCTEP_PCI_WIN_WRITE(oct, CN93_RST_CORE_DOMAIN_W1S, 1); 642 655 /* Wait for 100ms as Octeon resets. */ ··· 907 894 908 895 octep_init_config_cn93_pf(oct); 909 896 octep_configure_ring_mapping_cn93_pf(oct); 897 + 898 + if (oct->chip_id == OCTEP_PCI_DEVICE_ID_CN98_PF) 899 + return; 900 + 901 + /* Firmware status CSR is supposed to be cleared by 902 + * core domain reset, but due to IPBUPEM-38842, it is not. 903 + * Set it to RUNNING early in boot, so that unexpected resets 904 + * leave it in a state that is not READY (1). 905 + */ 906 + OCTEP_PCI_WIN_WRITE(oct, 907 + CN9K_PEMX_PFX_CSX_PFCFGX(0, 908 + 0, CN9K_PCIEEP_VSECST_CTL), 909 + FW_STATUS_RUNNING); 910 910 }
+1 -1
drivers/net/ethernet/marvell/octeon_ep/octep_cnxk_pf.c
··· 660 660 * the module is removed. 661 661 */ 662 662 OCTEP_PCI_WIN_WRITE(oct, CNXK_PEMX_PFX_CSX_PFCFGX(0, 0, CNXK_PCIEEP_VSECST_CTL), 663 - FW_STATUS_RUNNING); 663 + FW_STATUS_DOWNING); 664 664 665 665 /* Set chip domain reset bit */ 666 666 OCTEP_PCI_WIN_WRITE(oct, CNXK_RST_CHIP_DOMAIN_W1S, 1);
+30
drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h
··· 5 5 * 6 6 */ 7 7 8 + #include <linux/bitfield.h> 9 + 8 10 #ifndef _OCTEP_REGS_CN9K_PF_H_ 9 11 #define _OCTEP_REGS_CN9K_PF_H_ 10 12 ··· 384 382 #define CN93_SDP_EPF_OEI_RINT_DATA_BIT_MBOX BIT_ULL(0) 385 383 /* bit 1 for firmware heartbeat interrupt */ 386 384 #define CN93_SDP_EPF_OEI_RINT_DATA_BIT_HBEAT BIT_ULL(1) 385 + 386 + #define FW_STATUS_DOWNING 0ULL 387 + #define FW_STATUS_RUNNING 2ULL 388 + 389 + #define CN9K_PEM_GENMASK BIT_ULL(36) 390 + #define CN9K_PF_GENMASK GENMASK_ULL(21, 18) 391 + #define CN9K_PFX_CSX_PFCFGX_SHADOW_BIT BIT_ULL(16) 392 + #define CN9K_PFX_CSX_PFCFGX_BASE_ADDR (0x8e0000008000ULL) 393 + #define CN9K_4BYTE_ALIGNED_ADDRESS_OFFSET(offset) ((offset) & BIT_ULL(2)) 394 + #define CN9K_PEMX_PFX_CSX_PFCFGX cn9k_pemx_pfx_csx_pfcfgx 395 + 396 + static inline u64 cn9k_pemx_pfx_csx_pfcfgx(u64 pem, u32 pf, u32 offset) 397 + { 398 + u32 shadow_addr_bit, pf_addr_bits, aligned_offset; 399 + u64 pem_addr_bits; 400 + 401 + pem_addr_bits = FIELD_PREP(CN9K_PEM_GENMASK, pem); 402 + pf_addr_bits = FIELD_PREP(CN9K_PF_GENMASK, pf); 403 + shadow_addr_bit = CN9K_PFX_CSX_PFCFGX_SHADOW_BIT & (offset); 404 + aligned_offset = rounddown((offset), 8); 405 + 406 + return (CN9K_PFX_CSX_PFCFGX_BASE_ADDR | pem_addr_bits 407 + | pf_addr_bits | shadow_addr_bit | aligned_offset) 408 + + CN9K_4BYTE_ALIGNED_ADDRESS_OFFSET(offset); 409 + } 410 + 411 + /* Register defines for use with CN9K_PEMX_PFX_CSX_PFCFGX */ 412 + #define CN9K_PCIEEP_VSECST_CTL 0x4D0 387 413 388 414 #define CN93_PEM_BAR4_INDEX 7 389 415 #define CN93_PEM_BAR4_INDEX_SIZE 0x400000ULL
+1
drivers/net/ethernet/marvell/octeon_ep/octep_regs_cnxk_pf.h
··· 396 396 #define CNXK_SDP_EPF_OEI_RINT_DATA_BIT_MBOX BIT_ULL(0) 397 397 /* bit 1 for firmware heartbeat interrupt */ 398 398 #define CNXK_SDP_EPF_OEI_RINT_DATA_BIT_HBEAT BIT_ULL(1) 399 + #define FW_STATUS_DOWNING 0ULL 399 400 #define FW_STATUS_RUNNING 2ULL 400 401 #define CNXK_PEMX_PFX_CSX_PFCFGX(pem, pf, offset) ({ typeof(offset) _off = (offset); \ 401 402 ((0x8e0000008000 | \