002-rb532_nand_fixup.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --- a/arch/mips/rb532/devices.c
  2. +++ b/arch/mips/rb532/devices.c
  3. @@ -141,6 +141,19 @@ static struct platform_device cf_slot0 =
  4. };
  5. /* Resources and device for NAND */
  6. +
  7. +/*
  8. + * We need to use the OLD Yaffs-1 OOB layout, otherwise the RB bootloader
  9. + * will not be able to find the kernel that we load. So set the oobinfo
  10. + * when creating the partitions
  11. + */
  12. +static struct nand_ecclayout rb532_nand_ecclayout = {
  13. + .eccbytes = 6,
  14. + .eccpos = { 8, 9, 10, 13, 14, 15 },
  15. + .oobavail = 9,
  16. + .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } }
  17. +};
  18. +
  19. static int rb532_dev_ready(struct mtd_info *mtd)
  20. {
  21. return gpio_get_value(GPIO_RDY);
  22. @@ -255,6 +268,16 @@ static struct platform_device *rb532_dev
  23. /* NAND definitions */
  24. #define NAND_CHIP_DELAY 25
  25. +static int rb532_nand_fixup(struct mtd_info *mtd)
  26. +{
  27. + struct nand_chip *chip = mtd->priv;
  28. +
  29. + if (mtd->writesize == 512)
  30. + chip->ecc.layout = &rb532_nand_ecclayout;
  31. +
  32. + return 0;
  33. +}
  34. +
  35. static void __init rb532_nand_setup(void)
  36. {
  37. switch (mips_machtype) {
  38. @@ -273,6 +296,7 @@ static void __init rb532_nand_setup(void
  39. rb532_nand_data.chip.nr_partitions = ARRAY_SIZE(rb532_partition_info);
  40. rb532_nand_data.chip.partitions = rb532_partition_info;
  41. rb532_nand_data.chip.chip_delay = NAND_CHIP_DELAY;
  42. + rb532_nand_data.chip.chip_fixup = &rb532_nand_fixup;
  43. }