Skip to content

Commit e593ba3

Browse files
ldubeacassis
authored andcommitted
arch/mips: Add basic support for MIPS Creator CI20 board
This commit introduces a rudimentary architecture and board port for the MIPS Creator CI20, featuring the dual core Ingenic JZ4780 SoC (MIPS32). Included in this initial implementation: - Basic architectural initialization and startup code for the JZ4780 Core 0. - Minimal configuration required to execute from RAM. - Early UART/serial console support for basic debugging and NSH output. - Minimal board-specific configuration for the CI20 target. - Console output is routed via UART0 on the expansion header. This establishes basic support for running NuttX on the MIPS CI20. Further peripherals, optimization, and extended documentation are left for future iterations or community contributions. Build and Runtime Deployment Info: ---------------------------------- The baseline can be configured, compiled using the MIPS MTI toolchain, and loaded via U-Boot using the following commands (replace <tftp_dir> with your local TFTP root directory). ./tools/configure.sh -l ci20/nsh make CROSSDEV=mips-mti-elf- mkimage -A mips -O linux -T kernel -C none -a 0x80000180 -e 0x800004ac \ -n "nx" -d nuttx.bin <tftp_dir>/nuttx.umg Note: U-Boot must be properly configured for networking (e.g., valid ipaddr, serverip, and ethaddr environment variables) to fetch the image over TFTP. Run this from U-Boot prompt: tftp nuttx.umg && bootm $fileaddr Signed-off-by: Lwazi Dube <lwazeh@gmail.com>
1 parent 081e4c4 commit e593ba3

38 files changed

Lines changed: 3984 additions & 14 deletions
57 KB
Loading
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
=================
2+
MIPS Creator CI20
3+
=================
4+
5+
.. tags:: arch:mips, chip:jz4780
6+
7+
.. figure:: ci20.jpg
8+
:figwidth: 100%
9+
:align: center
10+
:alt: The MIPS Creator CI20 V2.0
11+
12+
The MIPS Creator CI20 V2.0
13+
14+
Supported Features
15+
==================
16+
17+
* Single 1.2GHz MIPS32 processor
18+
* UART0 on Raspberry PI connector
19+
* 256MiB DRAM
20+
21+
Configurations
22+
==============
23+
24+
.. important::
25+
26+
U-Boot must be properly configured for networking (e.g., valid ``ipaddr``,
27+
``serverip``, and ``ethaddr`` environment variables) to fetch the image over TFTP.
28+
29+
NuttX is loaded via U-Boot using TFTP (replace ``<tftp_dir>`` with your local
30+
TFTP root directory).
31+
32+
You can use the following command to configure the NuttX build:
33+
34+
.. code-block:: shell
35+
36+
./tools/configure.sh -l ci20/nsh
37+
38+
make CROSSDEV=mips-mti-elf-
39+
mkimage -A mips -O linux -T kernel -C none -a 0x80000180 -e 0x800004ac \
40+
-n "nx" -d nuttx.bin <tftp_dir>/nuttx.umg
41+
42+
Run this from U-Boot prompt:
43+
44+
.. code-block:: shell
45+
46+
tftp nuttx.umg && bootm $fileaddr
47+
48+
nsh
49+
---
50+
51+
Basic serial console access to the NSH shell.
52+
53+
.. note::
54+
55+
Connect USB cable from your PC to UART0 pins on the Raspberry PI connector.
56+
57+
Then use some serial console client (minicom, picocom, teraterm, etc)
58+
configured to 115200 8n1 without software or hardware flow control.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
==============
2+
Ingenic JZ4780
3+
==============
4+
5+
MIPS32r2 architecture.
6+
7+
The basic port is functional and a NuttShell (NSH) configuration is available.
8+
9+
Supported Boards
10+
================
11+
12+
.. toctree::
13+
:glob:
14+
:maxdepth: 1
15+
16+
boards/*/*

arch/mips/Kconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ config ARCH_CHIP_PIC32MZ
3030
---help---
3131
Microchip PIC32MZ (MIPS32)
3232

33+
config ARCH_CHIP_JZ4780
34+
bool "JZ4780"
35+
select ARCH_MIPS32
36+
select ARCH_MIPS_XBURST1
37+
select ARCH_HAVE_IRQPRIO
38+
select ARCH_VECNOTIRQ
39+
select ARCH_HAVE_RESET
40+
select ARCH_HAVE_SERIAL_TERMIOS
41+
select MIPS32_HAVE_DCACHE
42+
select MIPS32_HAVE_ICACHE
43+
select MIPS32_USE_WAIT_INSTRUCTION
44+
select MIPS32_USE_SYSCALL_INSTRUCTION
45+
---help---
46+
Ingenic JZ4780 (MIPS32)
47+
3348
config ARCH_CHIP_MIPS_CUSTOM
3449
bool "Custom MIPS chip"
3550
select ARCH_CHIP_CUSTOM
@@ -57,6 +72,10 @@ config ARCH_MIPS_M5150
5772
default n
5873
select ARCH_HAVE_MICROMIPS
5974

75+
config ARCH_MIPS_XBURST1
76+
bool
77+
default n
78+
6079
config ARCH_HAVE_EIC
6180
bool
6281
default n
@@ -82,10 +101,12 @@ config ARCH_CHIP
82101
string
83102
default "pic32mx" if ARCH_CHIP_PIC32MX
84103
default "pic32mz" if ARCH_CHIP_PIC32MZ
104+
default "jz4780" if ARCH_CHIP_JZ4780
85105

86106
source "arch/mips/src/common/Kconfig"
87107
source "arch/mips/src/mips32/Kconfig"
88108
source "arch/mips/src/pic32mx/Kconfig"
89109
source "arch/mips/src/pic32mz/Kconfig"
110+
source "arch/mips/src/jz4780/Kconfig"
90111

91112
endif

arch/mips/include/jz4780/chip.h

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
/****************************************************************************
2+
* arch/mips/include/jz4780/chip.h
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed to the Apache Software Foundation (ASF) under one or more
7+
* contributor license agreements. See the NOTICE file distributed with
8+
* this work for additional information regarding copyright ownership. The
9+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
10+
* "License"); you may not use this file except in compliance with the
11+
* License. You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18+
* License for the specific language governing permissions and limitations
19+
* under the License.
20+
*
21+
****************************************************************************/
22+
23+
#ifndef __ARCH_MIPS_INCLUDE_JZ4780_CHIP_H
24+
#define __ARCH_MIPS_INCLUDE_JZ4780_CHIP_H
25+
26+
/****************************************************************************
27+
* Included Files
28+
****************************************************************************/
29+
30+
#include <nuttx/config.h>
31+
32+
/****************************************************************************
33+
* Pre-processor Definitions
34+
****************************************************************************/
35+
36+
#define CKPCR 0xB0003040
37+
#define CKPCR_CK32CTL_RTCLK (3 << 1)
38+
39+
#define JZINTC_BASE 0xB0001000
40+
41+
#define ICMSR0 (JZINTC_BASE + 0x08)
42+
#define ICMCR0 (JZINTC_BASE + 0x0C)
43+
#define ICPR0 (JZINTC_BASE + 0x10)
44+
#define ICMSR1 (JZINTC_BASE + 0x28)
45+
#define ICMCR1 (JZINTC_BASE + 0x2C)
46+
#define ICPR1 (JZINTC_BASE + 0x30)
47+
48+
#define JZTMR_BASE 0xB0002000
49+
50+
#define WD_TDR (JZTMR_BASE + 0x00) // u16: Watchdog Timer Data
51+
#define WD_TCER (JZTMR_BASE + 0x04) // u8 : Watchdog Counter Enable
52+
#define WD_TCNT (JZTMR_BASE + 0x08) // u16: Watchdog Timer Counter
53+
#define WD_TCSR (JZTMR_BASE + 0x0C) // u16: Watchdog Timer Control
54+
55+
#define TCSR_PRESCALE(x) ((x) << 3)
56+
#define TCSR_DIV_16 2
57+
58+
#define TCSR_EXT_EN (1 << 2)
59+
#define TCSR_RTC_EN (1 << 1)
60+
#define TCSR_PCK_EN (1 << 0)
61+
62+
#define TCER_TCEN (1 << 0)
63+
64+
#define OSTDR (JZTMR_BASE + 0xe0)
65+
#define OSTCNTL (JZTMR_BASE + 0xe4)
66+
#define OSTCNTH (JZTMR_BASE + 0xe8)
67+
#define OSTCSR (JZTMR_BASE + 0xec)
68+
69+
#define TESR (JZTMR_BASE + 0x14)
70+
71+
#define TESR_OSTEN (1 << 15)
72+
#define TESR_TCEN(n) (1 << (n))
73+
74+
#define TMSR (JZTMR_BASE + 0x34)
75+
#define TMCR (JZTMR_BASE + 0x38)
76+
#define TMCR_OSTMCL (1 << 15)
77+
#define TMCR_FMCL5 (1 << 5)
78+
#define TMCR_FMCL(n) (1 << (n))
79+
80+
#define TFR (JZTMR_BASE + 0x20)
81+
82+
#define TFCR (JZTMR_BASE + 0x28)
83+
#define TFCR_OSTFCL (1 << 15)
84+
#define TFCR_FFCL5 (1 << 5)
85+
#define TFCR_FFCL(n) (1 << (n))
86+
87+
#define TCNT(n) (JZTMR_BASE + 0x48 + (n)*0x10)
88+
#define TCSR(n) (JZTMR_BASE + 0x4C + (n)*0x10)
89+
#define TDFR(n) (JZTMR_BASE + 0x40 + (n)*0x10)
90+
91+
#define TICKS_PER_MS (48000/16)
92+
93+
#define CHIP_JZ4780 1
94+
#define CHIP_NPORTS 6 /* 6 ports (A-F) */
95+
96+
/****************************************************************************
97+
* Public Types
98+
****************************************************************************/
99+
100+
#ifndef __ASSEMBLY__
101+
102+
/****************************************************************************
103+
* Inline Functions
104+
****************************************************************************/
105+
106+
/****************************************************************************
107+
* Public Function Prototypes
108+
****************************************************************************/
109+
110+
#ifdef __cplusplus
111+
#define EXTERN extern "C"
112+
extern "C"
113+
{
114+
#else
115+
#define EXTERN extern
116+
#endif
117+
118+
/****************************************************************************
119+
* Name: jz_physregaddr
120+
*
121+
* Description:
122+
* Give the virtual address of a register, return the physical address of
123+
* the register
124+
*
125+
****************************************************************************/
126+
127+
uintptr_t jz_physregaddr(uintptr_t virtregaddr);
128+
129+
/****************************************************************************
130+
* Name: jz_physramaddr
131+
*
132+
* Description:
133+
* Give the virtual address of a RAM memory location, return the physical
134+
* address of that location.
135+
*
136+
****************************************************************************/
137+
138+
uintptr_t jz_physramaddr(uintptr_t vramaddr);
139+
140+
/****************************************************************************
141+
* Name: jz_virtramaddr
142+
*
143+
* Description:
144+
* Give the physical address of a RAM memory location, return the virtual
145+
* address of that location.
146+
*
147+
****************************************************************************/
148+
149+
uintptr_t jz_virtramaddr(uintptr_t physramaddr);
150+
151+
#undef EXTERN
152+
#ifdef __cplusplus
153+
}
154+
#endif
155+
156+
#endif /* __ASSEMBLY__ */
157+
#endif /* __ARCH_MIPS_INCLUDE_JZ4780_CHIP_H */

0 commit comments

Comments
 (0)