1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-28 18:30:37 +02:00

qi_lb60: Initalize nand paritions and ecc layout depending on the chip size.

This commit is contained in:
Lars-Peter Clausen 2009-10-12 01:31:23 +02:00 committed by Xiangfu Liu
parent cc05485408
commit 9eff41dbb1

View File

@ -31,8 +31,7 @@
/* NAND */
#ifdef QI_LB60_1GB_NAND
static struct nand_ecclayout qi_lb60_ecclayout = {
static struct nand_ecclayout qi_lb60_ecclayout_1gb = {
.eccbytes = 36,
.eccpos = {
6, 7, 8, 9, 10, 11, 12, 13,
@ -47,7 +46,7 @@ static struct nand_ecclayout qi_lb60_ecclayout = {
.length = 22}}
};
static struct mtd_partition qi_lb60_partitions[] = {
static struct mtd_partition qi_lb60_partitions_1gb[] = {
{ .name = "NAND BOOT partition",
.offset = 0 * 0x100000,
.size = 4 * 0x100000,
@ -65,8 +64,8 @@ static struct mtd_partition qi_lb60_partitions[] = {
.size = 512 * 0x100000,
},
};
#else
static struct nand_ecclayout qi_lb60_ecclayout = {
static struct nand_ecclayout qi_lb60_ecclayout_2gb = {
.eccbytes = 72,
.eccpos = {
12, 13, 14, 15, 16, 17, 18, 19,
@ -85,7 +84,7 @@ static struct nand_ecclayout qi_lb60_ecclayout = {
.length = 44}}
};
static struct mtd_partition qi_lb60_partitions[] = {
static struct mtd_partition qi_lb60_partitions_2gb[] = {
{ .name = "NAND BOOT partition",
.offset = 0 * 0x100000,
.size = 4 * 0x100000,
@ -103,7 +102,28 @@ static struct mtd_partition qi_lb60_partitions[] = {
.size = (512 + 1024) * 0x100000,
},
};
#endif /* QI_LB60_1GB_NAND */
static void qi_lb60_nand_ident(struct platform_device *pdev,
struct nand_chip *chip,
struct mtd_partition **partitions,
int *num_partitions)
{
if (chip->page_shift == 12) {
chip->ecc.layout = &qi_lb60_ecclayout_2gb;
*partitions = qi_lb60_partitions_2gb;
*num_partitions = ARRAY_SIZE(qi_lb60_partitions_2gb);
} else {
chip->ecc.layout = &qi_lb60_ecclayout_1gb;
*partitions = qi_lb60_partitions_1gb;
*num_partitions = ARRAY_SIZE(qi_lb60_partitions_1gb);
}
}
static struct jz_nand_platform_data qi_lb60_nand_pdata = {
.ident_callback = qi_lb60_nand_ident,
.busy_gpio = 94,
};
/* Keyboard*/
@ -246,13 +266,6 @@ static struct jz4740_fb_platform_data qi_lb60_fb_pdata = {
};
static struct jz_nand_platform_data qi_lb60_nand_pdata = {
.num_partitions = ARRAY_SIZE(qi_lb60_partitions),
.partitions = qi_lb60_partitions,
.ecc_layout = &qi_lb60_ecclayout,
.busy_gpio = 94,
};
struct spi_gpio_platform_data spigpio_platform_data = {
.sck = JZ_GPIO_PORTC(23),
.mosi = JZ_GPIO_PORTC(22),
@ -358,7 +371,7 @@ static int __init qi_lb60_init_platform_devices(void)
}
extern int jz_gpiolib_init(void);
static void __init qi_lb60_board_setup(void)
static int __init qi_lb60_board_setup(void)
{
printk("Qi Hardware JZ4740 QI_LB60 setup\n");
if (jz_gpiolib_init())
@ -368,6 +381,8 @@ static void __init qi_lb60_board_setup(void)
if (qi_lb60_init_platform_devices())
panic("Failed to initalize platform devices\n");
return 0;
}
arch_initcall(qi_lb60_board_setup);