Skip to content

Commit cace493

Browse files
committed
HSD #14024927011: fpga: altera-cvp: Fixed read config type for credit register
This fix is required to use the correct altera_read_config type for CVP credit register for Agilex5 and for non-Agilex5. altera_read_config_dword is used for Agilex5 credits as it is 12bits and altera_read_config_byte is used for non-Agilex5 credits as it is 8bits. Signed-off-by: Murugasen Krishnan, Kuhanh <kuhanh.murugasen.krishnan@intel.com>
1 parent f02b1d5 commit cace493

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/fpga/altera-cvp.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ struct cvp_priv {
105105
int user_time_us;
106106
};
107107

108+
static int altera_read_config_byte(struct altera_cvp_conf *conf,
109+
int where, u8 *val)
110+
{
111+
return pci_read_config_byte(conf->pci_dev, conf->vsec_offset + where,
112+
val);
113+
}
114+
108115
static int altera_read_config_dword(struct altera_cvp_conf *conf,
109116
int where, u32 *val)
110117
{
@@ -247,7 +254,13 @@ static int altera_cvp_v2_wait_for_credit(struct fpga_manager *mgr,
247254
}
248255

249256
do {
250-
ret = altera_read_config_dword(conf, vse_cvp_tx_credits_offset, &val);
257+
/* READ DWORD is required for Agilex5 but READ BYTE is required for non-Agilex5 */
258+
if (conf->device_family_type == SOCFPGA_CVP_V2_AGILEX5) {
259+
ret = altera_read_config_dword(conf, vse_cvp_tx_credits_offset, &val);
260+
} else {
261+
ret = altera_read_config_byte(conf, vse_cvp_tx_credits_offset, (u8 *) &val);
262+
}
263+
251264
if (ret) {
252265
dev_err(&conf->pci_dev->dev,
253266
"Error reading CVP Credit Register\n");

0 commit comments

Comments
 (0)