mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
rk29: enable apanic
This commit is contained in:
@@ -567,7 +567,8 @@ CONFIG_ANDROID_PMEM=y
|
||||
# CONFIG_KERNEL_DEBUGGER_CORE is not set
|
||||
# CONFIG_ISL29003 is not set
|
||||
# CONFIG_UID_STAT is not set
|
||||
# CONFIG_APANIC is not set
|
||||
CONFIG_APANIC=y
|
||||
CONFIG_APANIC_PLABEL="kpanic"
|
||||
# CONFIG_STE is not set
|
||||
# CONFIG_C2PORT is not set
|
||||
|
||||
|
||||
@@ -592,7 +592,8 @@ CONFIG_ANDROID_PMEM=y
|
||||
# CONFIG_ISL29003 is not set
|
||||
# CONFIG_UID_STAT is not set
|
||||
# CONFIG_WL127X_RFKILL is not set
|
||||
# CONFIG_APANIC is not set
|
||||
CONFIG_APANIC=y
|
||||
CONFIG_APANIC_PLABEL="kpanic"
|
||||
# CONFIG_STE is not set
|
||||
# CONFIG_C2PORT is not set
|
||||
|
||||
|
||||
@@ -593,7 +593,8 @@ CONFIG_ANDROID_PMEM=y
|
||||
# CONFIG_ISL29003 is not set
|
||||
# CONFIG_UID_STAT is not set
|
||||
# CONFIG_WL127X_RFKILL is not set
|
||||
# CONFIG_APANIC is not set
|
||||
CONFIG_APANIC=y
|
||||
CONFIG_APANIC_PLABEL="kpanic"
|
||||
# CONFIG_STE is not set
|
||||
# CONFIG_C2PORT is not set
|
||||
|
||||
|
||||
@@ -592,7 +592,8 @@ CONFIG_ANDROID_PMEM=y
|
||||
# CONFIG_ISL29003 is not set
|
||||
# CONFIG_UID_STAT is not set
|
||||
# CONFIG_WL127X_RFKILL is not set
|
||||
# CONFIG_APANIC is not set
|
||||
CONFIG_APANIC=y
|
||||
CONFIG_APANIC_PLABEL="kpanic"
|
||||
# CONFIG_STE is not set
|
||||
# CONFIG_C2PORT is not set
|
||||
|
||||
|
||||
@@ -193,8 +193,13 @@ static int apanic_proc_read(char *buffer, char **start, off_t offset,
|
||||
ctx->mtd->writesize,
|
||||
&len, ctx->bounce);
|
||||
|
||||
#ifdef CONFIG_MTD_RKNAND
|
||||
if (count > (ctx->mtd->writesize - page_offset))
|
||||
count = ctx->mtd->writesize - page_offset;
|
||||
#else
|
||||
if (page_offset)
|
||||
count -= page_offset;
|
||||
#endif
|
||||
memcpy(buffer, ctx->bounce + page_offset, count);
|
||||
|
||||
*start = count;
|
||||
@@ -209,6 +214,11 @@ static int apanic_proc_read(char *buffer, char **start, off_t offset,
|
||||
static void mtd_panic_erase(void)
|
||||
{
|
||||
struct apanic_data *ctx = &drv_ctx;
|
||||
#ifdef CONFIG_MTD_RKNAND
|
||||
size_t wlen;
|
||||
memset(ctx->bounce, 0, sizeof(struct panic_header));
|
||||
ctx->mtd->write(ctx->mtd, 0, sizeof(struct panic_header), &wlen, ctx->bounce);
|
||||
#else
|
||||
struct erase_info erase;
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
wait_queue_head_t wait_q;
|
||||
@@ -260,6 +270,7 @@ static void mtd_panic_erase(void)
|
||||
schedule();
|
||||
remove_wait_queue(&wait_q, &wait);
|
||||
}
|
||||
#endif
|
||||
printk(KERN_DEBUG "apanic: %s partition erased\n",
|
||||
CONFIG_APANIC_PLABEL);
|
||||
out:
|
||||
@@ -331,14 +342,18 @@ static void mtd_panic_notify_add(struct mtd_info *mtd)
|
||||
|
||||
if (hdr->magic != PANIC_MAGIC) {
|
||||
printk(KERN_INFO "apanic: No panic data available\n");
|
||||
#ifndef CONFIG_MTD_RKNAND
|
||||
mtd_panic_erase();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if (hdr->version != PHDR_VERSION) {
|
||||
printk(KERN_INFO "apanic: Version mismatch (%d != %d)\n",
|
||||
hdr->version, PHDR_VERSION);
|
||||
#ifndef CONFIG_MTD_RKNAND
|
||||
mtd_panic_erase();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -378,8 +393,10 @@ static void mtd_panic_notify_add(struct mtd_info *mtd)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CONFIG_MTD_RKNAND
|
||||
if (!proc_entry_created)
|
||||
mtd_panic_erase();
|
||||
#endif
|
||||
|
||||
return;
|
||||
out_err:
|
||||
|
||||
@@ -362,6 +362,31 @@ static void rk28xxnand_sync(struct mtd_info *mtd)
|
||||
#endif
|
||||
}
|
||||
|
||||
extern void FtlWriteCacheEn(int);
|
||||
static int rk28xxnand_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf)
|
||||
{
|
||||
int sector = len >> 9;
|
||||
int LBA = (int)(to >> 9);
|
||||
|
||||
if (sector) {
|
||||
FtlWriteCacheEn(0);
|
||||
NandWrite(LBA, sector, (void *)buf);
|
||||
FtlWriteCacheEn(1);
|
||||
}
|
||||
*retlen = len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rk28xxnand_block_isbad(struct mtd_info *mtd, loff_t ofs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rk28xxnand_block_markbad(struct mtd_info *mtd, loff_t ofs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rk28xxnand_init(struct rknand_info *nand_info)
|
||||
{
|
||||
struct mtd_info *mtd = &nand_info->mtd;
|
||||
@@ -401,15 +426,15 @@ static int rk28xxnand_init(struct rknand_info *nand_info)
|
||||
mtd->write = rk28xxnand_write;
|
||||
mtd->read_oob = NULL;
|
||||
mtd->write_oob = NULL;
|
||||
mtd->panic_write = NULL;
|
||||
mtd->panic_write = rk28xxnand_panic_write;
|
||||
|
||||
mtd->sync = rk28xxnand_sync;
|
||||
mtd->lock = NULL;
|
||||
mtd->unlock = NULL;
|
||||
mtd->suspend = NULL;
|
||||
mtd->resume = NULL;
|
||||
mtd->block_isbad = NULL;
|
||||
mtd->block_markbad = NULL;
|
||||
mtd->block_isbad = rk28xxnand_block_isbad;
|
||||
mtd->block_markbad = rk28xxnand_block_markbad;
|
||||
mtd->owner = THIS_MODULE;
|
||||
|
||||
#ifdef PAGE_REMAP
|
||||
|
||||
Reference in New Issue
Block a user