Merge branch 'next' of git://git.denx.de/u-boot-video
[oweals/u-boot.git] / arch / arm / mach-at91 / matrix.c
1 /*
2  * Copyright (C) 2015 Atmel Corporation
3  *                    Wenyou Yang <wenyou.yang@atmel.com>
4  *
5  * SPDX-License-Identifier:     GPL-2.0+
6  */
7
8 #include <common.h>
9 #include <asm/hardware.h>
10 #include <asm/io.h>
11 #include <asm/arch/sama5_matrix.h>
12
13 void matrix_init(void)
14 {
15         struct atmel_matrix *h64mx = (struct atmel_matrix *)ATMEL_BASE_MATRIX0;
16         struct atmel_matrix *h32mx = (struct atmel_matrix *)ATMEL_BASE_MATRIX1;
17         int i;
18
19         /* DDR port 1 ~ port 7 */
20         for (i = H64MX_SLAVE_DDRC_PORT1; i <= H64MX_SLAVE_DDRC_PORT7; i++) {
21                 writel(0x000f0f0f, &h64mx->ssr[i]);
22                 writel(0x0000ffff, &h64mx->sassr[i]);
23                 writel(0x0000000f, &h64mx->srtsr[i]);
24         }
25
26         /* EBI CS3 (NANDFlash 128M) and NFC Command Registers(128M) */
27         writel(0x00c0c0c0, &h32mx->ssr[H32MX_SLAVE_EBI]);
28         writel(0xff000000, &h32mx->sassr[H32MX_SLAVE_EBI]);
29         writel(0xff000000, &h32mx->srtsr[H32MX_SLAVE_EBI]);
30
31         /* NFC SRAM */
32         writel(0x00010101, &h32mx->ssr[H32MX_SLAVE_NFC_SRAM]);
33         writel(0x00000001, &h32mx->sassr[H32MX_SLAVE_NFC_SRAM]);
34         writel(0x00000001, &h32mx->srtsr[H32MX_SLAVE_NFC_SRAM]);
35 }