dm365evm.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17. #include <common.h>
  18. #include <nand.h>
  19. #include <linux/io.h>
  20. #include <asm/arch/hardware.h>
  21. #include <asm/arch/emif_defs.h>
  22. #include <asm/arch/nand_defs.h>
  23. #include "../common/misc.h"
  24. DECLARE_GLOBAL_DATA_PTR;
  25. int board_init(void)
  26. {
  27. gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_DM365_EVM;
  28. gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
  29. return 0;
  30. }
  31. #ifdef CONFIG_NAND_DAVINCI
  32. static void nand_dm365evm_select_chip(struct mtd_info *mtd, int chip)
  33. {
  34. struct nand_chip *this = mtd->priv;
  35. u32 wbase = (u32) this->IO_ADDR_W;
  36. u32 rbase = (u32) this->IO_ADDR_R;
  37. if (chip == 1) {
  38. __set_bit(14, &wbase);
  39. __set_bit(14, &rbase);
  40. } else {
  41. __clear_bit(14, &wbase);
  42. __clear_bit(14, &rbase);
  43. }
  44. this->IO_ADDR_W = (void *)wbase;
  45. this->IO_ADDR_R = (void *)rbase;
  46. }
  47. int board_nand_init(struct nand_chip *nand)
  48. {
  49. davinci_nand_init(nand);
  50. nand->select_chip = nand_dm365evm_select_chip;
  51. return 0;
  52. }
  53. #endif