[MTD] [ONENAND] Make onenand_sim compile on non-ARM platforms.
The whole point of a sim is that it should run almost anywhere. Gratuitously depending on '#define SZ_128K 131072' from an ARM-specific header isn't really a good idea. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* The OneNAND simulator
|
* The OneNAND simulator
|
||||||
*
|
*
|
||||||
* Copyright(C) 2005-2007 Samsung Electronics
|
* Copyright © 2005-2007 Samsung Electronics
|
||||||
* Kyungmin Park <kyungmin.park@samsung.com>
|
* Kyungmin Park <kyungmin.park@samsung.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -19,8 +19,7 @@
|
|||||||
#include <linux/mtd/partitions.h>
|
#include <linux/mtd/partitions.h>
|
||||||
#include <linux/mtd/onenand.h>
|
#include <linux/mtd/onenand.h>
|
||||||
|
|
||||||
#include <asm/io.h>
|
#include <linux/io.h>
|
||||||
#include <asm/sizes.h>
|
|
||||||
|
|
||||||
#ifndef CONFIG_ONENAND_SIM_MANUFACTURER
|
#ifndef CONFIG_ONENAND_SIM_MANUFACTURER
|
||||||
#define CONFIG_ONENAND_SIM_MANUFACTURER 0xec
|
#define CONFIG_ONENAND_SIM_MANUFACTURER 0xec
|
||||||
@@ -83,7 +82,8 @@ struct onenand_info *info;
|
|||||||
|
|
||||||
#define DPRINTK(format, args...) \
|
#define DPRINTK(format, args...) \
|
||||||
do { \
|
do { \
|
||||||
printk("%s[%d]: " format "\n", __func__, __LINE__, ##args); \
|
printk(KERN_DEBUG "%s[%d]: " format "\n", __func__, \
|
||||||
|
__LINE__, ##args); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -382,9 +382,9 @@ static int __init flash_init(struct onenand_flash *flash)
|
|||||||
int density, size;
|
int density, size;
|
||||||
int buffer_size;
|
int buffer_size;
|
||||||
|
|
||||||
flash->base = kzalloc(SZ_128K, GFP_KERNEL);
|
flash->base = kzalloc(131072, GFP_KERNEL);
|
||||||
if (!flash->base) {
|
if (!flash->base) {
|
||||||
printk(KERN_ERR "Unalbe to allocate base address.\n");
|
printk(KERN_ERR "Unable to allocate base address.\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ static int __init flash_init(struct onenand_flash *flash)
|
|||||||
|
|
||||||
ONENAND_CORE(flash) = vmalloc(size + (size >> 5));
|
ONENAND_CORE(flash) = vmalloc(size + (size >> 5));
|
||||||
if (!ONENAND_CORE(flash)) {
|
if (!ONENAND_CORE(flash)) {
|
||||||
printk(KERN_ERR "Unalbe to allocate nand core address.\n");
|
printk(KERN_ERR "Unable to allocate nand core address.\n");
|
||||||
kfree(flash->base);
|
kfree(flash->base);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -406,9 +406,9 @@ static int __init flash_init(struct onenand_flash *flash)
|
|||||||
writew(version_id, flash->base + ONENAND_REG_VERSION_ID);
|
writew(version_id, flash->base + ONENAND_REG_VERSION_ID);
|
||||||
|
|
||||||
if (density < 2)
|
if (density < 2)
|
||||||
buffer_size = 0x0400; /* 1KB page */
|
buffer_size = 0x0400; /* 1KiB page */
|
||||||
else
|
else
|
||||||
buffer_size = 0x0800; /* 2KB page */
|
buffer_size = 0x0800; /* 2KiB page */
|
||||||
writew(buffer_size, flash->base + ONENAND_REG_DATA_BUFFER_SIZE);
|
writew(buffer_size, flash->base + ONENAND_REG_DATA_BUFFER_SIZE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user