common.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // SPDX-License-Identifier: GPL-2.0+
  2. #include <common.h>
  3. #include <twl4030.h>
  4. #include <asm/io.h>
  5. #include <asm/omap_mmc.h>
  6. #include <asm/arch/mux.h>
  7. #include <asm/arch/sys_proto.h>
  8. #include <jffs2/load_kernel.h>
  9. #include <linux/mtd/rawnand.h>
  10. #include "igep00x0.h"
  11. DECLARE_GLOBAL_DATA_PTR;
  12. /*
  13. * Routine: set_muxconf_regs
  14. * Description: Setting up the configuration Mux registers specific to the
  15. * hardware. Many pins need to be moved from protect to primary
  16. * mode.
  17. */
  18. void set_muxconf_regs(void)
  19. {
  20. MUX_DEFAULT();
  21. }
  22. /*
  23. * Routine: board_init
  24. * Description: Early hardware init.
  25. */
  26. int board_init(void)
  27. {
  28. int loops = 100;
  29. /* find out flash memory type, assume NAND first */
  30. gpmc_cs0_flash = MTD_DEV_TYPE_NAND;
  31. gpmc_init();
  32. /* Issue a RESET and then READID */
  33. writeb(NAND_CMD_RESET, &gpmc_cfg->cs[0].nand_cmd);
  34. writeb(NAND_CMD_STATUS, &gpmc_cfg->cs[0].nand_cmd);
  35. while ((readl(&gpmc_cfg->cs[0].nand_dat) & NAND_STATUS_READY)
  36. != NAND_STATUS_READY) {
  37. udelay(1);
  38. if (--loops == 0) {
  39. gpmc_cs0_flash = MTD_DEV_TYPE_ONENAND;
  40. gpmc_init(); /* reinitialize for OneNAND */
  41. break;
  42. }
  43. }
  44. /* boot param addr */
  45. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  46. return 0;
  47. }
  48. #if defined(CONFIG_MMC)
  49. int board_mmc_init(bd_t *bis)
  50. {
  51. return omap_mmc_init(0, 0, 0, -1, -1);
  52. }
  53. void board_mmc_power_init(void)
  54. {
  55. twl4030_power_mmc_init(0);
  56. }
  57. #endif