spear300.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * (C) Copyright 2009
  3. * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <miiphy.h>
  9. #include <netdev.h>
  10. #include <nand.h>
  11. #include <asm/io.h>
  12. #include <linux/mtd/fsmc_nand.h>
  13. #include <asm/arch/hardware.h>
  14. #include <asm/arch/spr_defs.h>
  15. #include <asm/arch/spr_misc.h>
  16. static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE];
  17. int board_init(void)
  18. {
  19. return spear_board_init(MACH_TYPE_SPEAR300);
  20. }
  21. /*
  22. * board_nand_init - Board specific NAND initialization
  23. * @nand: mtd private chip structure
  24. *
  25. * Called by nand_init_chip to initialize the board specific functions
  26. */
  27. void board_nand_init()
  28. {
  29. struct misc_regs *const misc_regs_p =
  30. (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
  31. struct nand_chip *nand = &nand_chip[0];
  32. #if defined(CONFIG_NAND_FSMC)
  33. if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
  34. MISC_SOCCFG30) ||
  35. ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
  36. MISC_SOCCFG31)) {
  37. fsmc_nand_init(nand);
  38. }
  39. #endif
  40. return;
  41. }
  42. int board_eth_init(bd_t *bis)
  43. {
  44. int ret = 0;
  45. #if defined(CONFIG_ETH_DESIGNWARE)
  46. u32 interface = PHY_INTERFACE_MODE_MII;
  47. if (designware_initialize(CONFIG_SPEAR_ETHBASE, interface) >= 0)
  48. ret++;
  49. #endif
  50. return ret;
  51. }