axs10x.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <dwmmc.h>
  8. #include <malloc.h>
  9. #include "axs10x.h"
  10. DECLARE_GLOBAL_DATA_PTR;
  11. int board_mmc_init(bd_t *bis)
  12. {
  13. struct dwmci_host *host = NULL;
  14. host = malloc(sizeof(struct dwmci_host));
  15. if (!host) {
  16. printf("dwmci_host malloc fail!\n");
  17. return 1;
  18. }
  19. memset(host, 0, sizeof(struct dwmci_host));
  20. host->name = "Synopsys Mobile storage";
  21. host->ioaddr = (void *)ARC_DWMMC_BASE;
  22. host->buswidth = 4;
  23. host->dev_index = 0;
  24. host->bus_hz = 50000000;
  25. add_dwmci(host, host->bus_hz / 2, 400000);
  26. return 0;
  27. }
  28. #define AXS_MB_CREG 0xE0011000
  29. int board_early_init_f(void)
  30. {
  31. if (readl((void __iomem *)AXS_MB_CREG + 0x234) & (1 << 28))
  32. gd->board_type = AXS_MB_V3;
  33. else
  34. gd->board_type = AXS_MB_V2;
  35. return 0;
  36. }
  37. #ifdef CONFIG_ISA_ARCV2
  38. #define RESET_VECTOR_ADDR 0x0
  39. void smp_set_core_boot_addr(unsigned long addr, int corenr)
  40. {
  41. /* All cores have reset vector pointing to 0 */
  42. writel(addr, (void __iomem *)RESET_VECTOR_ADDR);
  43. /* Make sure other cores see written value in memory */
  44. flush_dcache_all();
  45. }
  46. void smp_kick_all_cpus(void)
  47. {
  48. /* CPU start CREG */
  49. #define AXC003_CREG_CPU_START 0xF0001400
  50. /* Bits positions in CPU start CREG */
  51. #define BITS_START 0
  52. #define BITS_POLARITY 8
  53. #define BITS_CORE_SEL 9
  54. #define BITS_MULTICORE 12
  55. #define CMD (1 << BITS_MULTICORE) | (1 << BITS_CORE_SEL) | \
  56. (1 << BITS_POLARITY) | (1 << BITS_START)
  57. writel(CMD, (void __iomem *)AXC003_CREG_CPU_START);
  58. }
  59. #endif