Skip to content

Commit 0990c40

Browse files
authored
Merge pull request #1426 from Mellanox/cherry-pick-commits-master
Cherry pick commits master [mstflint-4.34.0-2]
2 parents e1a89d1 + ee69d38 commit 0990c40

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

dev_mgt/tools_dev_types.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
#include "tools_dev_types.h"
5050
#include "mflash/mflash_types.h"
5151
#include "mtcr_ul/mtcr_ul_com.h"
52+
#ifdef CABLES_SUPPORT
53+
#include "mtcr_ul/mtcr_cables.h"
54+
#endif
55+
56+
/* Forward declaration to ensure read_device_id is visible */
57+
int read_device_id(mfile* mf, u_int32_t* device_id);
5258

5359
struct device_info {
5460
dm_dev_id_t dm_id;

mflash/mflash.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ int flash_init_fw_access(mflash* mfl, flash_params_t* flash_params);
144144
int mf_get_secure_host(mflash* mfl, int* mode);
145145
int mf_secure_host_op(mflash* mfl, u_int64_t key, int op);
146146
int cntx_sst_get_log2size(u_int8_t density, int* log2spi_size);
147+
int cntx_mx25k16xxx_get_log2size(u_int8_t density, int* log2spi_size);
147148
/* NOTE: This macro returns ... not nice. */
148149
#define CHECK_RC(rc) \
149150
do \
@@ -510,11 +511,32 @@ int cntx_sst_get_log2size(u_int8_t density, int* log2spi_size)
510511
return 0;
511512
}
512513

514+
int cntx_mx25k16xxx_get_log2size(u_int8_t density, int* log2spi_size)
515+
{
516+
switch (density)
517+
{
518+
case 0x3a:
519+
case 0x20:
520+
*log2spi_size = 0x1a;
521+
break;
522+
523+
default:
524+
*log2spi_size = density;
525+
break;
526+
}
527+
return MFE_OK;
528+
}
529+
530+
513531
int get_log2size_by_vendor_type_density(u_int8_t vendor, u_int8_t type, u_int8_t density, int* log2size)
514532
{
515533
if ((type == FMT_SST_25) && (vendor == FV_SST)) {
516534
return cntx_sst_get_log2size(density, log2size);
517535
}
536+
if (type == FMT_SST_25 && vendor == FV_MX25K16XXX)
537+
{
538+
return cntx_mx25k16xxx_get_log2size(density, log2size);
539+
}
518540
// In some flashes, the value is 20, but the correct value should be 0x1A. It cannot be 0x20 because 2^20 would overflow an integer.
519541
if(density == 0x20) {
520542
*log2size = 0x1a;

0 commit comments

Comments
 (0)