Skip to content

Commit 95dec99

Browse files
committed
arch/risc-v/rp23xx-riscv: Initial rp23xx RISC-V support
UPDATE from PULL Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
1 parent b0342c8 commit 95dec99

File tree

149 files changed

+40831
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+40831
-0
lines changed

.codespellrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@ ignore-words-list =
6262
tolen,
6363
UE,
6464
WRON,
65+
SIE,

arch/risc-v/Kconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,22 @@ config ARCH_CHIP_EIC7700X
368368
---help---
369369
ESWIN EIC7700X SoC.
370370

371+
config ARCH_CHIP_RP23XX_RV
372+
bool "Raspberry Pi RP23XX RISC-V"
373+
select ARCH_RV32
374+
select ARCH_RV_ISA_M
375+
select ARCH_RV_ISA_A
376+
select ARCH_RV_ISA_C
377+
select ARCH_HAVE_PWM_MULTICHAN
378+
select ARCH_HAVE_RESET
379+
select ARCH_HAVE_TICKLESS
380+
select ONESHOT
381+
select ALARM_ARCH
382+
select ARCH_HAVE_I2CRESET
383+
select ARCH_BOARD_COMMON
384+
---help---
385+
Raspberry Pi RP23XX architectures (RISC-V dual Hazard3).
386+
371387
config ARCH_CHIP_RISCV_CUSTOM
372388
bool "Custom RISC-V chip"
373389
select ARCH_CHIP_CUSTOM
@@ -553,6 +569,7 @@ config ARCH_CHIP
553569
default "k230" if ARCH_CHIP_K230
554570
default "sg2000" if ARCH_CHIP_SG2000
555571
default "eic7700x" if ARCH_CHIP_EIC7700X
572+
default "rp23xx-rv" if ARCH_CHIP_RP23XX_RV
556573

557574
config ARCH_RISCV_INTXCPT_EXTENSIONS
558575
bool "RISC-V Integer Context Extensions"
@@ -796,4 +813,8 @@ endif
796813
if ARCH_CHIP_EIC7700X
797814
source "arch/risc-v/src/eic7700x/Kconfig"
798815
endif
816+
if ARCH_CHIP_RP23XX_RV
817+
source "arch/risc-v/src/rp23xx-rv/Kconfig"
818+
endif
819+
799820
endif # ARCH_RISCV

arch/risc-v/include/rp23xx-rv/chip.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/****************************************************************************
2+
* arch/risc-v/include/rp23xx-rv/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_RISCV_INCLUDE_RP23XX_RV_CHIP_H
24+
#define __ARCH_RISCV_INCLUDE_RP23XX_RV_CHIP_H
25+
26+
#endif /* __ARCH_RISCV_INCLUDE_RP23XX_RV_CHIP_H */
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/****************************************************************************
2+
* arch/risc-v/include/rp23xx-rv/i2c_slave.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_RISCV_INCLUDE_RP23XX_RV_I2C_SLAVE_H
24+
#define __ARCH_RISCV_INCLUDE_RP23XX_RV_I2C_SLAVE_H
25+
26+
/****************************************************************************
27+
* Included Files
28+
****************************************************************************/
29+
30+
#include <nuttx/config.h>
31+
#include <nuttx/i2c/i2c_slave.h>
32+
33+
#ifndef __ASSEMBLY__
34+
#if defined(__cplusplus)
35+
#define EXTERN extern "C"
36+
extern "C"
37+
{
38+
#else
39+
#define EXTERN extern
40+
#endif
41+
42+
/* There is no driver for I2C slave operations. To create an I2C slave,
43+
* include this file (as: <arch/chip/i2c_slave.h>) and use either
44+
* rp23xx_i2c0_slave_initialize or rp23xx_i2c1_slave_initialize to
45+
* initialize the I2C for slave operations.
46+
*/
47+
48+
/****************************************************************************
49+
* Public Function Prototypes
50+
****************************************************************************/
51+
52+
/****************************************************************************
53+
* Name: rp23xx_i2c0_slave_initialize
54+
*
55+
* Description:
56+
* Initialize I2C controller zero for slave operation, and return a pointer
57+
* to the instance of struct i2c_slave_s. This function should only be
58+
* called once of a give controller.
59+
*
60+
* Note: the same port cannot be initialized as both master and slave.
61+
*
62+
* Input Parameters:
63+
* rx_buffer - Buffer for data transmitted to us by an I2C master.
64+
* rx_buffer_len - Length of rx_buffer.
65+
* callback - Callback function called when messages are received.
66+
*
67+
* Returned Value:
68+
* Valid I2C device structure reference on success; a NULL on failure
69+
*
70+
****************************************************************************/
71+
72+
#ifdef CONFIG_RP23XX_RV_I2C0_SLAVE
73+
74+
struct i2c_slave_s *rp23xx_i2c0_slave_initialize
75+
(uint8_t *rx_buffer,
76+
size_t rx_buffer_len,
77+
i2c_slave_callback_t *callback);
78+
79+
#endif
80+
81+
/****************************************************************************
82+
* Name: rp23xx_i2c1_slave_initialize
83+
*
84+
* Description:
85+
* Initialize I2C controller zero for slave operation, and return a pointer
86+
* to the instance of struct i2c_slave_s. This function should only be
87+
* called once of a give controller.
88+
*
89+
* Note: the same port cannot be initialized as both master and slave.
90+
*
91+
* Input Parameters:
92+
* rx_buffer - Buffer for data transmitted to us by an I2C master.
93+
* rx_buffer_len - Length of rx_buffer.
94+
* callback - Callback function called when messages are received.
95+
*
96+
* Returned Value:
97+
* Valid I2C device structure reference on success; a NULL on failure
98+
*
99+
****************************************************************************/
100+
101+
#ifdef CONFIG_RP23XX_RV_I2C1_SLAVE
102+
103+
struct i2c_slave_s *rp23xx_i2c1_slave_initialize
104+
(uint8_t *rx_buffer,
105+
size_t rx_buffer_len,
106+
i2c_slave_callback_t *callback);
107+
108+
#endif
109+
110+
#undef EXTERN
111+
#if defined(__cplusplus)
112+
}
113+
#endif
114+
115+
#endif /* __ASSEMBLY__ */
116+
#endif /* __ARCH_RISCV_INCLUDE_RP23XX_RV_I2C_SLAVE_H */

arch/risc-v/include/rp23xx-rv/irq.h

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/****************************************************************************
2+
* arch/risc-v/include/rp23xx-rv/irq.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+
/* This file should never be included directly but, rather,
24+
* only indirectly through nuttx/irq.h
25+
*/
26+
27+
#ifndef __ARCH_RISCV_INCLUDE_RP23XX_IRQ_H
28+
#define __ARCH_RISCV_INCLUDE_RP23XX_IRQ_H
29+
30+
/****************************************************************************
31+
* Included Files
32+
****************************************************************************/
33+
34+
#ifndef __ASSEMBLY__
35+
# include <stdint.h>
36+
#endif
37+
38+
/****************************************************************************
39+
* Pre-processor Prototypes
40+
****************************************************************************/
41+
42+
#define RP23XX_IRQ_EXTINT (RISCV_IRQ_ASYNC + 32) /* Vector 48: Vector number of the first external interrupt */
43+
44+
/* External interrupts (vectors >= 48). These definitions are
45+
* chip-specific
46+
*/
47+
48+
#define RP23XX_TIMER0_IRQ_0 (RP23XX_IRQ_EXTINT+0)
49+
#define RP23XX_TIMER0_IRQ_1 (RP23XX_IRQ_EXTINT+1)
50+
#define RP23XX_TIMER0_IRQ_2 (RP23XX_IRQ_EXTINT+2)
51+
#define RP23XX_TIMER0_IRQ_3 (RP23XX_IRQ_EXTINT+3)
52+
#define RP23XX_TIMER1_IRQ_0 (RP23XX_IRQ_EXTINT+4)
53+
#define RP23XX_TIMER1_IRQ_1 (RP23XX_IRQ_EXTINT+5)
54+
#define RP23XX_TIMER1_IRQ_2 (RP23XX_IRQ_EXTINT+6)
55+
#define RP23XX_TIMER1_IRQ_3 (RP23XX_IRQ_EXTINT+7)
56+
#define RP23XX_RV_PWM_IRQ_WRAP_0 (RP23XX_IRQ_EXTINT+8)
57+
#define RP23XX_RV_PWM_IRQ_WRAP_1 (RP23XX_IRQ_EXTINT+9)
58+
#define RP23XX_DMA_IRQ_0 (RP23XX_IRQ_EXTINT+10)
59+
#define RP23XX_DMA_IRQ_1 (RP23XX_IRQ_EXTINT+11)
60+
#define RP23XX_DMA_IRQ_2 (RP23XX_IRQ_EXTINT+12)
61+
#define RP23XX_DMA_IRQ_3 (RP23XX_IRQ_EXTINT+13)
62+
#define RP23XX_USBCTRL_IRQ (RP23XX_IRQ_EXTINT+14)
63+
#define RP23XX_PIO0_IRQ_0 (RP23XX_IRQ_EXTINT+15)
64+
#define RP23XX_PIO0_IRQ_1 (RP23XX_IRQ_EXTINT+16)
65+
#define RP23XX_PIO1_IRQ_0 (RP23XX_IRQ_EXTINT+17)
66+
#define RP23XX_PIO1_IRQ_1 (RP23XX_IRQ_EXTINT+18)
67+
#define RP23XX_PIO2_IRQ_0 (RP23XX_IRQ_EXTINT+19)
68+
#define RP23XX_PIO2_IRQ_1 (RP23XX_IRQ_EXTINT+20)
69+
#define RP23XX_IO_IRQ_BANK0 (RP23XX_IRQ_EXTINT+21)
70+
#define RP23XX_IO_IRQ_BANK0_NS (RP23XX_IRQ_EXTINT+22)
71+
#define RP23XX_IO_IRQ_QSPI (RP23XX_IRQ_EXTINT+23)
72+
#define RP23XX_IO_IRQ_QSPI_NS (RP23XX_IRQ_EXTINT+24)
73+
#define RP23XX_SIO_IRQ_FIFO (RP23XX_IRQ_EXTINT+25)
74+
#define RP23XX_SIO_IRQ_BELL (RP23XX_IRQ_EXTINT+26)
75+
#define RP23XX_SIO_IRQ_FIFO_NS (RP23XX_IRQ_EXTINT+27)
76+
#define RP23XX_SIO_IRQ_BELL_NS (RP23XX_IRQ_EXTINT+28)
77+
#define RP23XX_SIO_IRQ_MTIMECMP (RP23XX_IRQ_EXTINT+29)
78+
#define RP23XX_CLOCKS_IRQ (RP23XX_IRQ_EXTINT+30)
79+
#define RP23XX_RV_SPI0_IRQ (RP23XX_IRQ_EXTINT+31)
80+
#define RP23XX_RV_SPI1_IRQ (RP23XX_IRQ_EXTINT+32)
81+
#define RP23XX_RV_UART0_IRQ (RP23XX_IRQ_EXTINT+33)
82+
#define RP23XX_RV_UART1_IRQ (RP23XX_IRQ_EXTINT+34)
83+
#define RP23XX_RV_ADC_IRQ_FIFO (RP23XX_IRQ_EXTINT+35)
84+
#define RP23XX_RV_I2C0_IRQ (RP23XX_IRQ_EXTINT+36)
85+
#define RP23XX_RV_I2C1_IRQ (RP23XX_IRQ_EXTINT+37)
86+
#define RP23XX_OTP_IRQ (RP23XX_IRQ_EXTINT+38)
87+
#define RP23XX_TRNG_IRQ (RP23XX_IRQ_EXTINT+39)
88+
#define RP23XX_PROC0_IRQ_CTI (RP23XX_IRQ_EXTINT+40)
89+
#define RP23XX_PROC1_IRQ_CTI (RP23XX_IRQ_EXTINT+41)
90+
#define RP23XX_PLL_SYS_IRQ (RP23XX_IRQ_EXTINT+42)
91+
#define RP23XX_PLL_USB_IRQ (RP23XX_IRQ_EXTINT+43)
92+
#define RP23XX_POWMAN_IRQ_POW (RP23XX_IRQ_EXTINT+44)
93+
#define RP23XX_POWMAN_IRQ_TIMER (RP23XX_IRQ_EXTINT+45)
94+
#define RP23XX_SPAREIRQ_IRQ_0 (RP23XX_IRQ_EXTINT+46)
95+
#define RP23XX_SPAREIRQ_IRQ_1 (RP23XX_IRQ_EXTINT+47)
96+
#define RP23XX_SPAREIRQ_IRQ_2 (RP23XX_IRQ_EXTINT+48)
97+
#define RP23XX_SPAREIRQ_IRQ_3 (RP23XX_IRQ_EXTINT+49)
98+
#define RP23XX_SPAREIRQ_IRQ_4 (RP23XX_IRQ_EXTINT+50)
99+
#define RP23XX_SPAREIRQ_IRQ_5 (RP23XX_IRQ_EXTINT+51)
100+
101+
#define RP23XX_IRQ_NEXTINT (52)
102+
#define RP23XX_IRQ_NIRQS (RP23XX_IRQ_EXTINT+RP23XX_IRQ_NEXTINT)
103+
104+
#define NR_VECTORS RP23XX_IRQ_NIRQS
105+
#define NR_IRQS RP23XX_IRQ_NIRQS
106+
107+
/****************************************************************************
108+
* Public Types
109+
****************************************************************************/
110+
111+
/****************************************************************************
112+
* Public Data
113+
****************************************************************************/
114+
115+
#ifndef __ASSEMBLY__
116+
#ifdef __cplusplus
117+
#define EXTERN extern "C"
118+
extern "C"
119+
{
120+
#else
121+
#define EXTERN extern
122+
#endif
123+
124+
/****************************************************************************
125+
* Public Function Prototypes
126+
****************************************************************************/
127+
128+
#undef EXTERN
129+
#ifdef __cplusplus
130+
}
131+
#endif
132+
#endif /* __ASSEMBLY__ */
133+
134+
#endif /* __ARCH_RISCV_INCLUDE_RP23XX_IRQ_H */

0 commit comments

Comments
 (0)