matrix.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2015 Atmel Corporation
  3. * Wenyou Yang <wenyou.yang@atmel.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <asm/io.h>
  9. #include <asm/arch/sama5_matrix.h>
  10. void matrix_init(void)
  11. {
  12. struct atmel_matrix *h64mx = (struct atmel_matrix *)ATMEL_BASE_MATRIX0;
  13. struct atmel_matrix *h32mx = (struct atmel_matrix *)ATMEL_BASE_MATRIX1;
  14. int i;
  15. /* DDR port 1 ~ poart 7, slave number is: 4 ~ 10 */
  16. for (i = 4; i <= 10; i++) {
  17. writel(0x000f0f0f, &h64mx->ssr[i]);
  18. writel(0x0000ffff, &h64mx->sassr[i]);
  19. writel(0x0000000f, &h64mx->srtsr[i]);
  20. }
  21. /* CS3 */
  22. writel(0x00c0c0c0, &h32mx->ssr[3]);
  23. writel(0xff000000, &h32mx->sassr[3]);
  24. writel(0xff000000, &h32mx->srtsr[3]);
  25. /* NFC SRAM */
  26. writel(0x00010101, &h32mx->ssr[4]);
  27. writel(0x00000001, &h32mx->sassr[4]);
  28. writel(0x00000001, &h32mx->srtsr[4]);
  29. /* Configure Programmable Security peripherals on matrix 64 */
  30. writel(readl(&h64mx->spselr[0]) | 0x00080000, &h64mx->spselr[0]);
  31. writel(readl(&h64mx->spselr[1]) | 0x00180000, &h64mx->spselr[1]);
  32. writel(readl(&h64mx->spselr[2]) | 0x00000008, &h64mx->spselr[2]);
  33. /* Configure Programmable Security peripherals on matrix 32 */
  34. writel(readl(&h32mx->spselr[0]) | 0xFFC00000, &h32mx->spselr[0]);
  35. writel(readl(&h32mx->spselr[1]) | 0x60E3FFFF, &h32mx->spselr[1]);
  36. }