Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d35ca5c authored by Ram Prakash Gupta's avatar Ram Prakash Gupta
Browse files

mmc: core: fix reading the bkops status from card



The bkops status is indicated by the bit 0 and 1 of the
246th byte of the ext_csd register.
The current code doesn't ignore the rest of the byte.

Fix this by extracting the bit 0 and 1 only
for the current bkops urgency.

The exception level is defined by the least significant
nibble of 54th byte in the ext_csd register. The current
code doesn't ignore the rest of the byte.

Fix this by extracting the nibble(LSB) for exception status.

Change-Id: I3c8fb2beeda2ab41a4157201c1cb186acef720b5
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
Signed-off-by: default avatarRam Prakash Gupta <rampraka@codeaurora.org>
parent 0ec4b188
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -937,8 +937,14 @@ static int mmc_read_bkops_status(struct mmc_card *card)
	if (err)
		return err;

	card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS];
	card->ext_csd.raw_exception_status = ext_csd[EXT_CSD_EXP_EVENTS_STATUS];
	card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS] &
						MMC_BKOPS_URGENCY_MASK;
	card->ext_csd.raw_exception_status =
					ext_csd[EXT_CSD_EXP_EVENTS_STATUS] &
					(EXT_CSD_URGENT_BKOPS |
					 EXT_CSD_DYNCAP_NEEDED |
					 EXT_CSD_SYSPOOL_EXHAUSTED
					 | EXT_CSD_PACKED_FAILURE);
	kfree(ext_csd);
	return 0;
}