Created
September 13, 2014 16:02
-
-
Save psyke83/c0782d51789b4847ad4f to your computer and use it in GitHub Desktop.
gt-s5360 onenand_base.c Samsung diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c | |
| index 26caf25..0bc4922 100644 | |
| --- a/drivers/mtd/onenand/onenand_base.c | |
| +++ b/drivers/mtd/onenand/onenand_base.c | |
| @@ -1350,7 +1350,7 @@ static int onenand_read_oob_nolock(struct mtd_info *mtd, loff_t from, | |
| stats = mtd->ecc_stats; | |
| - readcmd = ONENAND_IS_MLC(this) ? ONENAND_CMD_READ : ONENAND_CMD_READOOB; | |
| + readcmd = (ONENAND_IS_MLC(this) || ONENAND_IS_4KB_PAGE(this)) ? ONENAND_CMD_READ : ONENAND_CMD_READOOB; | |
| while (read < len) { | |
| cond_resched(); | |
| @@ -1555,7 +1555,7 @@ int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from, | |
| column = from & (mtd->oobsize - 1); | |
| - readcmd = ONENAND_IS_MLC(this) ? ONENAND_CMD_READ : ONENAND_CMD_READOOB; | |
| + readcmd = (ONENAND_IS_MLC(this) || ONENAND_IS_4KB_PAGE(this))? ONENAND_CMD_READ : ONENAND_CMD_READOOB; | |
| while (read < len) { | |
| cond_resched(); | |
| @@ -1609,7 +1609,7 @@ static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to | |
| u_char *oob_buf = this->oob_buf; | |
| int status, i, readcmd; | |
| - readcmd = ONENAND_IS_MLC(this) ? ONENAND_CMD_READ : ONENAND_CMD_READOOB; | |
| + readcmd = (ONENAND_IS_MLC(this) || ONENAND_IS_4KB_PAGE(this))? ONENAND_CMD_READ : ONENAND_CMD_READOOB; | |
| this->command(mtd, readcmd, to, mtd->oobsize); | |
| onenand_update_bufferram(mtd, to, 0); | |
| @@ -2064,7 +2064,7 @@ static int onenand_write_oob_nolock(struct mtd_info *mtd, loff_t to, | |
| oobbuf = this->oob_buf; | |
| - oobcmd = ONENAND_IS_MLC(this) ? ONENAND_CMD_PROG : ONENAND_CMD_PROGOOB; | |
| + oobcmd = ONENAND_IS_MLC(this) || ONENAND_IS_4KB_PAGE(this) ? ONENAND_CMD_PROG : ONENAND_CMD_PROGOOB; | |
| /* Loop until all data write */ | |
| while (written < len) { | |
| @@ -3019,9 +3019,9 @@ static int do_otp_read(struct mtd_info *mtd, loff_t from, size_t len, | |
| .ooblen = 0, | |
| .datbuf = buf, | |
| .oobbuf = NULL, | |
| + .retlen = 0, | |
| }; | |
| int ret; | |
| - | |
| /* Enter OTP access mode */ | |
| this->command(mtd, ONENAND_CMD_OTP_ACCESS, 0, 0); | |
| this->wait(mtd, FL_OTPING); | |
| @@ -3029,11 +3029,11 @@ static int do_otp_read(struct mtd_info *mtd, loff_t from, size_t len, | |
| ret = ONENAND_IS_MLC(this) || ONENAND_IS_4KB_PAGE(this) ? | |
| onenand_mlc_read_ops_nolock(mtd, from, &ops) : | |
| onenand_read_ops_nolock(mtd, from, &ops); | |
| + *retlen = ops.retlen; | |
| /* Exit OTP access mode */ | |
| this->command(mtd, ONENAND_CMD_RESET, 0, 0); | |
| this->wait(mtd, FL_RESETING); | |
| - | |
| return ret; | |
| } | |
| @@ -3054,7 +3054,6 @@ static int do_otp_write(struct mtd_info *mtd, loff_t to, size_t len, | |
| unsigned char *pbuf = buf; | |
| int ret; | |
| struct mtd_oob_ops ops; | |
| - | |
| /* Force buffer page aligned */ | |
| if (len < mtd->writesize) { | |
| memcpy(this->page_buf, buf, len); | |
| @@ -3077,7 +3076,6 @@ static int do_otp_write(struct mtd_info *mtd, loff_t to, size_t len, | |
| /* Exit OTP access mode */ | |
| this->command(mtd, ONENAND_CMD_RESET, 0, 0); | |
| this->wait(mtd, FL_RESETING); | |
| - | |
| return ret; | |
| } | |
| @@ -3176,7 +3174,6 @@ static int onenand_otp_walk(struct mtd_info *mtd, loff_t from, size_t len, | |
| while (len > 0 && otp_pages > 0) { | |
| if (!action) { /* OTP Info functions */ | |
| struct otp_info *otpinfo; | |
| - | |
| len -= sizeof(struct otp_info); | |
| if (len <= 0) { | |
| ret = -ENOSPC; | |
| @@ -3362,18 +3359,19 @@ static int onenand_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, | |
| static void onenand_check_features(struct mtd_info *mtd) | |
| { | |
| struct onenand_chip *this = mtd->priv; | |
| - unsigned int density, process; | |
| + unsigned int density, process, numbufs; | |
| /* Lock scheme depends on density and process */ | |
| density = onenand_get_density(this->device_id); | |
| process = this->version_id >> ONENAND_VERSION_PROCESS_SHIFT; | |
| + numbufs = this->read_word(this->base + ONENAND_REG_NUM_BUFFERS) >> 8; | |
| /* Lock scheme */ | |
| switch (density) { | |
| case ONENAND_DEVICE_DENSITY_4Gb: | |
| if (ONENAND_IS_DDP(this)) | |
| this->options |= ONENAND_HAS_2PLANE; | |
| - else | |
| + else if (numbufs == 1) | |
| this->options |= ONENAND_HAS_4KB_PAGE; | |
| case ONENAND_DEVICE_DENSITY_2Gb: | |
| @@ -3745,6 +3743,7 @@ static int onenand_probe(struct mtd_info *mtd) | |
| /* Save system configuration 1 */ | |
| syscfg = this->read_word(this->base + ONENAND_REG_SYS_CFG1); | |
| +#if 0 | |
| /* Clear Sync. Burst Read mode to read BootRAM */ | |
| this->write_word((syscfg & ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE), this->base + ONENAND_REG_SYS_CFG1); | |
| @@ -3762,6 +3761,7 @@ static int onenand_probe(struct mtd_info *mtd) | |
| /* Restore system configuration 1 */ | |
| this->write_word(syscfg, this->base + ONENAND_REG_SYS_CFG1); | |
| +#endif | |
| /* Workaround */ | |
| if (syscfg & ONENAND_SYS_CFG1_SYNC_WRITE) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment