All pastes #1009494 Raw Edit

Stuff

public diff v1 · immutable
#1009494 ·published 2008-05-06 17:00 UTC
rendered paste body
Index: target/linux/generic-2.6/patches-2.6.24/080-mtd_plat_nand_chip_fixup.patch===================================================================--- target/linux/generic-2.6/patches-2.6.24/080-mtd_plat_nand_chip_fixup.patch	(revision 0)+++ target/linux/generic-2.6/patches-2.6.24/080-mtd_plat_nand_chip_fixup.patch	(revision 0)@@ -0,0 +1,36 @@+Index: linux-2.6.24.5/include/linux/mtd/nand.h+===================================================================+--- linux-2.6.24.5.orig/include/linux/mtd/nand.h++++ linux-2.6.24.5/include/linux/mtd/nand.h+@@ -573,6 +573,7 @@ struct platform_nand_chip {+ 	int			chip_delay;+ 	unsigned int		options;+ 	const char		**part_probe_types;++	int			(*chip_fixup)(struct mtd_info *mtd);+ 	void			*priv;+ };+ +Index: linux-2.6.24.5/drivers/mtd/nand/plat_nand.c+===================================================================+--- linux-2.6.24.5.orig/drivers/mtd/nand/plat_nand.c++++ linux-2.6.24.5/drivers/mtd/nand/plat_nand.c+@@ -70,7 +70,18 @@ static int __init plat_nand_probe(struct+ 	platform_set_drvdata(pdev, data);+ + 	/* Scan to find existance of the device */+-	if (nand_scan(&data->mtd, 1)) {++	if (nand_scan_ident(&data->mtd, 1)) {++		res = -ENXIO;++		goto out;++	}++++	if (pdata->chip.chip_fixup) {++		res = pdata->chip.chip_fixup(&data->mtd);++		if (res)++			goto out;++	}++++	if (nand_scan_tail(&data->mtd)) {+ 		res = -ENXIO;+ 		goto out;+ 	}Index: target/linux/rb532/files/arch/mips/rb500/devices.c===================================================================--- target/linux/rb532/files/arch/mips/rb500/devices.c	(revision 11054)+++ target/linux/rb532/files/arch/mips/rb500/devices.c	(working copy)@@ -130,6 +130,19 @@ };  /* Resources and device for NAND.  There is no data needed and no irqs, so just define the memory used. */++/*+ * We need to use the OLD Yaffs-1 OOB layout, otherwise the RB bootloader+ * will not be able to find the kernel that we load.  So set the oobinfo+ * when creating the partitions+ */+static struct nand_ecclayout rb500_nand_ecclayout = {+	.eccbytes	= 6,+	.eccpos		= { 8, 9, 10, 13, 14, 15 },+	.oobavail	= 9,+	.oobfree	= { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } }+};+ int rb500_dev_ready(struct mtd_info *mtd) {         return MEM32(IDT434_REG_BASE + GPIOD) & GPIO_RDY;@@ -260,6 +273,16 @@ /* NAND definitions */ #define NAND_CHIP_DELAY	25 +static int rb500_nand_fixup(struct mtd_info *mtd)+{+	struct nand_chip *chip = mtd->priv;++	if (mtd->writesize == 512)+		chip->ecc.layout = &rb500_nand_ecclayout;++	return 0;+}+ static void __init rb500_nand_setup(void) { 	switch (mips_machtype) {@@ -277,6 +300,8 @@ 	rb500_nand_data.chip.partitions = rb500_partition_info; 	rb500_nand_data.chip.chip_delay = NAND_CHIP_DELAY; 	rb500_nand_data.chip.options = NAND_NO_AUTOINCR;++	rb500_nand_data.chip.chip_fixup = &rb500_nand_fixup; }  Index: target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c===================================================================--- target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c	(revision 11054)+++ target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c	(working copy)@@ -213,6 +213,16 @@ 	} } +static int rb1xx_nand_fixup(struct mtd_info *mtd)+{+	struct nand_chip *chip = mtd->priv;++	if (mtd->writesize == 512)+		chip->ecc.layout = &rb1xx_nand_ecclayout;++	return 0;+}+ static void __init rb1xx_flash_setup(void) { 	/* setup data for flash0 device */@@ -223,9 +233,10 @@ 	adm5120_nand_data.chip.nr_chips = 1; 	adm5120_nand_data.chip.nr_partitions = ARRAY_SIZE(rb1xx_nand_parts); 	adm5120_nand_data.chip.partitions = rb1xx_nand_parts;-	adm5120_nand_data.chip.ecclayout = &rb1xx_nand_ecclayout; 	adm5120_nand_data.chip.chip_delay = RB1XX_NAND_CHIP_DELAY; 	adm5120_nand_data.chip.options = NAND_NO_AUTOINCR;++	adm5120_nand_data.chip.chip_fixup = &rb1xx_nand_fixup; }  static void __init rb1xx_setup(void)