common.c 1.4 KB

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