summaryrefslogtreecommitdiff
path: root/bsp/ls1cdev/drivers/board.h
blob: 089384e34856f9c7dc412e4fc2b7dfd178fb4ca2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * Copyright (c) 2006-2018, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date                Author         Notes
 * 2010-06-25     Bernard        first version
 * 2011-08-08     lgnq             modified for Loongson LS1B
 * 2015-07-06     chinesebear   modified for Loongson LS1C
 * 2019-12-04     Jiaxun Yang   Add board config defines
 */

#ifndef __BOARD_H__
#define __BOARD_H__
#include <rtconfig.h>

#ifndef __ASSEMBLY__
void rt_hw_board_init(void);
#endif

/*
* SDRAM config
*
* Take IS42S16400 SDRAM chip as a example
* The specfication is
* Size 8MB
* WIDTH: 16 bits
* COL WIDTH: 8 bits, so we should take the 8 power of 2, it's 256
* ROW WIDTH: 12 bits, so we take the 12 power of 2, it's 4K
*
* Please reference macro SD_PARA0 and SDRAM registers intruduction
* in user's manual to edit the SDRAM config.
*/

#if defined(RT_LS1C_BAICAIBOARD)
/* 8MByte IS42S16400 appeared in bacai_board V1.x V2.x */
#define MEM_SIZE        (0x800000)
#define SDRAM_WIDTH     (WIDTH_16)
#define SDRAM_COL       (COL_256)
#define SDRAM_ROW       (ROW_4K)
#elif defined(RT_LS1C_OPENLOONGSON)
/* 32MByte appeared in SmartLoong board */
#define MEM_SIZE        (0x2000000)
#define SDRAM_WIDTH     (WIDTH_16)
#define SDRAM_COL       (COL_512)
#define SDRAM_ROW       (ROW_8K)
#else
#error Unknown Board
#endif

/* Early Debug config */
#define EARLY_DEBUG /* UART2 serial print debug in early stage */
#define EARLY_DEBUG_BAUD  (115200)

/* Clock config */
#define CPU_HZ            (252 * 1000000)
#define PLL_MULT          (0x54)  /* When external clock is 24Mhz PLL=504Mhz */
#define SDRAM_DIV         (0)     /* SDRAM is CPU divided by 2*/
#define CPU_DIV           (2)     /* CPU clock is PLL divided by 2 */

#endif