diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2013-07-14 13:44:45 +0000 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2013-07-14 13:44:45 +0000 |
commit | a5c0ad6354b0df5216a26653b868b53329c61c69 (patch) | |
tree | da977722cdd32c9447957747cc316e2ca0b0e093 /target/linux/brcm47xx/patches-3.10/052-mtd_bcm47xxsflash_implement_erasing_support.patch | |
parent | 3bc90a4d23e05be4a54edfccae3d45eefcfa5557 (diff) | |
download | upstream-a5c0ad6354b0df5216a26653b868b53329c61c69.tar.gz upstream-a5c0ad6354b0df5216a26653b868b53329c61c69.tar.bz2 upstream-a5c0ad6354b0df5216a26653b868b53329c61c69.zip |
brcm47xx: add initial support for kernel 3.10
SVN-Revision: 37287
Diffstat (limited to 'target/linux/brcm47xx/patches-3.10/052-mtd_bcm47xxsflash_implement_erasing_support.patch')
-rw-r--r-- | target/linux/brcm47xx/patches-3.10/052-mtd_bcm47xxsflash_implement_erasing_support.patch | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/target/linux/brcm47xx/patches-3.10/052-mtd_bcm47xxsflash_implement_erasing_support.patch b/target/linux/brcm47xx/patches-3.10/052-mtd_bcm47xxsflash_implement_erasing_support.patch new file mode 100644 index 0000000000..3446a9f935 --- /dev/null +++ b/target/linux/brcm47xx/patches-3.10/052-mtd_bcm47xxsflash_implement_erasing_support.patch @@ -0,0 +1,74 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Subject: [PATCH] mtd: bcm47xxsflash: implement erasing support +Date: Tue, 21 May 2013 21:03:46 +0200 + +Signed-off-by: Rafał Miłecki <zajec5@gmail.com> +--- +This has been succesfully tested on BCM4706. +--- + drivers/mtd/devices/bcm47xxsflash.c | 43 +++++++++++++++++++++++++++++++++-- + 1 file changed, 41 insertions(+), 2 deletions(-) + +--- a/drivers/mtd/devices/bcm47xxsflash.c ++++ b/drivers/mtd/devices/bcm47xxsflash.c +@@ -64,6 +64,42 @@ static int bcm47xxsflash_poll(struct bcm + * MTD ops + **************************************************/ + ++static int bcm47xxsflash_erase(struct mtd_info *mtd, struct erase_info *erase) ++{ ++ struct bcm47xxsflash *b47s = mtd->priv; ++ int err; ++ ++ switch (b47s->type) { ++ case BCM47XXSFLASH_TYPE_ST: ++ bcm47xxsflash_cmd(b47s, OPCODE_ST_WREN); ++ b47s->cc_write(b47s, BCMA_CC_FLASHADDR, erase->addr); ++ /* Newer flashes have "sub-sectors" which can be erased ++ * independently with a new command: ST_SSE. The ST_SE command ++ * erases 64KB just as before. ++ */ ++ if (b47s->blocksize < (64 * 1024)) ++ bcm47xxsflash_cmd(b47s, OPCODE_ST_SSE); ++ else ++ bcm47xxsflash_cmd(b47s, OPCODE_ST_SE); ++ break; ++ case BCM47XXSFLASH_TYPE_ATMEL: ++ b47s->cc_write(b47s, BCMA_CC_FLASHADDR, erase->addr << 1); ++ bcm47xxsflash_cmd(b47s, OPCODE_AT_PAGE_ERASE); ++ break; ++ } ++ ++ err = bcm47xxsflash_poll(b47s, HZ); ++ if (err) ++ erase->state = MTD_ERASE_FAILED; ++ else ++ erase->state = MTD_ERASE_DONE; ++ ++ if (erase->callback) ++ erase->callback(erase); ++ ++ return err; ++} ++ + static int bcm47xxsflash_read(struct mtd_info *mtd, loff_t from, size_t len, + size_t *retlen, u_char *buf) + { +@@ -88,12 +124,15 @@ static void bcm47xxsflash_fill_mtd(struc + mtd->name = "bcm47xxsflash"; + mtd->owner = THIS_MODULE; + mtd->type = MTD_ROM; +- mtd->size = b47s->size; +- mtd->_read = bcm47xxsflash_read; + + /* TODO: implement writing support and verify/change following code */ + mtd->flags = MTD_CAP_ROM; ++ mtd->size = b47s->size; ++ mtd->erasesize = b47s->blocksize; + mtd->writebufsize = mtd->writesize = 1; ++ ++ mtd->_erase = bcm47xxsflash_erase; ++ mtd->_read = bcm47xxsflash_read; + } + + /************************************************** |