mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
drivers: virt_mtd: incorporate review comments
Incorporate review comments received on adding sysfs nodes for exposing requested variables. JIRA SSV-12115 Bug 4791020 Signed-off-by: Vishwaroop A <va@nvidia.com> Change-Id: I840338c4d051b42175757272a504ecdd05db6e2f Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3190000 (cherry picked from commit dbbfdb0c48ee7609802e316402fd4b1776c36c2b) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3265306 GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com>
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#if (IS_ENABLED(CONFIG_TEGRA_HSIERRRPTINJ))
|
#if (IS_ENABLED(CONFIG_TEGRA_HSIERRRPTINJ))
|
||||||
#include <linux/tegra-hsierrrptinj.h>
|
#include <linux/tegra-hsierrrptinj.h>
|
||||||
#endif
|
#endif
|
||||||
|
#define ECC_REQUEST_FAILED 0xFFFFFFFF
|
||||||
|
|
||||||
#if (IS_ENABLED(CONFIG_TEGRA_HSIERRRPTINJ))
|
#if (IS_ENABLED(CONFIG_TEGRA_HSIERRRPTINJ))
|
||||||
#define HSI_QSPI_REPORT_ID(inst) (0x805B + (inst))
|
#define HSI_QSPI_REPORT_ID(inst) (0x805B + (inst))
|
||||||
@@ -58,6 +59,7 @@ struct vmtd_dev {
|
|||||||
uint32_t epl_reporter_id;
|
uint32_t epl_reporter_id;
|
||||||
uint32_t instance_id;
|
uint32_t instance_id;
|
||||||
#endif
|
#endif
|
||||||
|
uint32_t ecc_failed_chunk_address;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define IVC_RESET_RETRIES 30
|
#define IVC_RESET_RETRIES 30
|
||||||
@@ -493,7 +495,7 @@ static ssize_t qspi_device_size_bytes_show(struct device *dev,
|
|||||||
{
|
{
|
||||||
struct vmtd_dev *vmtddev = dev_get_drvdata(dev);
|
struct vmtd_dev *vmtddev = dev_get_drvdata(dev);
|
||||||
|
|
||||||
return sprintf(buf, "%u\n", (unsigned int)vmtddev->config.mtd_config.qspi_device_size_bytes);
|
return sprintf(buf, "%u\n", (unsigned int) vmtddev->config.mtd_config.qspi_device_size_bytes);
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(qspi_device_size_bytes);
|
static DEVICE_ATTR_RO(qspi_device_size_bytes);
|
||||||
|
|
||||||
@@ -511,17 +513,17 @@ static ssize_t ecc_status_show(struct device *dev,
|
|||||||
vs_req->mtddev_req.mtd_req.offset = 0;
|
vs_req->mtddev_req.mtd_req.offset = 0;
|
||||||
vs_req->mtddev_req.mtd_req.size = 0;
|
vs_req->mtddev_req.mtd_req.size = 0;
|
||||||
vs_req->mtddev_req.mtd_req.data_offset = 0;
|
vs_req->mtddev_req.mtd_req.data_offset = 0;
|
||||||
|
/* FIXME: Need to choose request id based on some logic instead of 0 */
|
||||||
vs_req->req_id = 0;
|
vs_req->req_id = 0;
|
||||||
|
|
||||||
ret = vmtd_process_request(vmtddev, vs_req);
|
ret = vmtd_process_request(vmtddev, vs_req);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
dev_err(vmtddev->device, "Read ECC Failed\n");
|
dev_err(vmtddev->device, "Read ECC Failed\n");
|
||||||
return snprintf(buf, PAGE_SIZE, "Error reading ECC status\n");
|
return sprintf(buf, "0x%x\n", ECC_REQUEST_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
ecc_response = vs_req->mtddev_resp.ecc_resp;
|
ecc_response = vs_req->mtddev_resp.ecc_resp;
|
||||||
vs_req->mtddev_req.stored_ecc_status = ecc_response.status;
|
vmtddev->ecc_failed_chunk_address = ecc_response.failed_chunk_addr;
|
||||||
vs_req->mtddev_req.stored_failed_chunk_addr = ecc_response.failed_chunk_addr;
|
|
||||||
|
|
||||||
switch (ecc_response.status) {
|
switch (ecc_response.status) {
|
||||||
case ECC_NO_ERROR:
|
case ECC_NO_ERROR:
|
||||||
@@ -533,7 +535,7 @@ static ssize_t ecc_status_show(struct device *dev,
|
|||||||
case ECC_DISABLED:
|
case ECC_DISABLED:
|
||||||
return sprintf(buf, "0x%x\n", ECC_DISABLED);
|
return sprintf(buf, "0x%x\n", ECC_DISABLED);
|
||||||
default:
|
default:
|
||||||
return snprintf(buf, PAGE_SIZE, "ECC Status: Unknown error\n");
|
return sprintf(buf, "0x%x\n", ECC_REQUEST_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(ecc_status);
|
static DEVICE_ATTR_RO(ecc_status);
|
||||||
@@ -542,12 +544,12 @@ static ssize_t failure_chunk_addr_show(struct device *dev,
|
|||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct vmtd_dev *vmtddev = dev_get_drvdata(dev);
|
struct vmtd_dev *vmtddev = dev_get_drvdata(dev);
|
||||||
struct vs_request *vs_req = (struct vs_request *)vmtddev->cmd_frame;
|
ssize_t ret;
|
||||||
|
|
||||||
if (vs_req->mtddev_req.stored_ecc_status == ECC_NO_ERROR)
|
ret = snprintf(buf, PAGE_SIZE, "0x%x\n", vmtddev->ecc_failed_chunk_address);
|
||||||
return sprintf(buf, "0x0\n");
|
vmtddev->ecc_failed_chunk_address = 0;
|
||||||
else
|
|
||||||
return snprintf(buf, PAGE_SIZE, "0x%x\n", vs_req->mtddev_req.stored_failed_chunk_addr);
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(failure_chunk_addr);
|
static DEVICE_ATTR_RO(failure_chunk_addr);
|
||||||
|
|||||||
@@ -160,9 +160,6 @@ struct vs_mtddev_request {
|
|||||||
struct vs_mtd_request mtd_req;
|
struct vs_mtd_request mtd_req;
|
||||||
struct vs_ioctl_request ioctl_req;
|
struct vs_ioctl_request ioctl_req;
|
||||||
};
|
};
|
||||||
uint32_t stored_ecc_status; /* Field to store ECC status */
|
|
||||||
|
|
||||||
uint32_t stored_failed_chunk_addr; /* field to store failed chunk address */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vs_blk_response {
|
struct vs_blk_response {
|
||||||
|
|||||||
Reference in New Issue
Block a user