Merge pull request #4286 from Michael0066/ls1b-dev

ls1b: fix the count of GPIO IRQ
This commit is contained in:
Bernard Xiong 2021-02-02 07:00:46 +08:00 committed by GitHub
commit 59f320783f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 46 additions and 14 deletions

View File

@ -19,7 +19,7 @@ source "$RTT_DIR/Kconfig"
source "$RTT_DIR/libcpu/mips/common/Kconfig" source "$RTT_DIR/libcpu/mips/common/Kconfig"
source "$PKGS_DIR/Kconfig" source "$PKGS_DIR/Kconfig"
config SOC_1C300 config SOC_LS1C300
bool bool
select RT_USING_COMPONENTS_INIT select RT_USING_COMPONENTS_INIT
select RT_USING_USER_MAIN select RT_USING_USER_MAIN

View File

@ -161,7 +161,7 @@
/* samples: kernel and components samples */ /* samples: kernel and components samples */
#define SOC_1C300 #define SOC_LS1C300
#define RT_LS1C_BAICAIBOARD #define RT_LS1C_BAICAIBOARD
#define RT_USING_SELF_BOOT #define RT_USING_SELF_BOOT
#define RT_SELF_BOOT_DEBUG #define RT_SELF_BOOT_DEBUG

View File

@ -30,3 +30,12 @@ config SOC_LS2K1000
select RT_USING_DEVICE select RT_USING_DEVICE
default y default y
if RT_USING_SERIAL
config RT_USING_UART0
bool "Using RT_USING_UART0"
default y
config RT_USING_UART4
bool "Using RT_USING_UART4"
default y
endif

View File

@ -156,26 +156,32 @@ struct rt_serial_device serial, serial4;
void rt_hw_uart_init(void) void rt_hw_uart_init(void)
{ {
struct rt_uart_ls2k *uart, *uart4;
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
uart = &uart_dev0; #ifdef RT_USING_UART0
uart4 = &uart_dev4; struct rt_uart_ls2k *uart0;
uart0 = &uart_dev0;
serial.ops = &ls2k_uart_ops; serial.ops = &ls2k_uart_ops;
serial.config = config_uart0; serial.config = config_uart0;
serial4.ops = &ls2k_uart_ops;
serial4.config = config;
rt_hw_interrupt_install(uart->IRQ, uart_irq_handler, &serial, "UART0"); rt_hw_interrupt_install(uart0->IRQ, uart_irq_handler, &serial, "UART0");
rt_hw_interrupt_install(uart4->IRQ, uart_irq_handler, &serial4, "UART4");
/* register UART device */ /* register UART device */
rt_hw_serial_register(&serial, rt_hw_serial_register(&serial,
"uart0", "uart0",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
uart); uart0);
#endif
#ifdef RT_USING_UART4
struct rt_uart_ls2k *uart4;
uart4 = &uart_dev4;
serial4.ops = &ls2k_uart_ops;
serial4.config = config;
rt_hw_interrupt_install(uart4->IRQ, uart_irq_handler, &serial4, "UART4");
rt_hw_serial_register(&serial4, rt_hw_serial_register(&serial4,
"uart4", "uart4",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
&uart_dev4); &uart_dev4);
#endif
} }
/*@}*/ /*@}*/

View File

@ -232,5 +232,7 @@
/* samples: kernel and components samples */ /* samples: kernel and components samples */
#define SOC_LS2K1000 #define SOC_LS2K1000
#define RT_USING_UART0
#define RT_USING_UART4
#endif #endif

View File

@ -17,7 +17,14 @@
#define INTC_BASE 0xBFD01040 #define INTC_BASE 0xBFD01040
#ifdef SOC_LS1B
#define GS232_INTC_CELLS 4
#endif
#ifdef SOC_LS1C300
#define GS232_INTC_CELLS 5 #define GS232_INTC_CELLS 5
#endif
#define GS232_NR_IRQS (32 * GS232_INTC_CELLS) #define GS232_NR_IRQS (32 * GS232_INTC_CELLS)
#define GMAC0_BASE 0xBFE10000 #define GMAC0_BASE 0xBFE10000

View File

@ -22,7 +22,6 @@
#define MAX_INTR (GS232_NR_IRQS) #define MAX_INTR (GS232_NR_IRQS)
static struct rt_irq_desc irq_handle_table[MAX_INTR]; static struct rt_irq_desc irq_handle_table[MAX_INTR];
void rt_interrupt_dispatch(void *ptreg);
void rt_hw_timer_handler(); void rt_hw_timer_handler();
static struct gs232_intc_regs volatile *gs232_hw0_icregs static struct gs232_intc_regs volatile *gs232_hw0_icregs

View File

@ -19,6 +19,15 @@
#define LS1B_UART1_IRQ 3 #define LS1B_UART1_IRQ 3
#define LS1B_UART2_IRQ 4 #define LS1B_UART2_IRQ 4
#define LS1B_UART3_IRQ 5 #define LS1B_UART3_IRQ 5
#define LS1B_UART4_IRQ 29
#define LS1B_UART5_IRQ 30
#define LS1B_UART6_IRQ 2 //共享LS1B_UART0_IRQ
#define LS1B_UART7_IRQ 2
#define LS1B_UART8_IRQ 2
#define LS1B_UART9_IRQ 3 //共享LS1B_UART1_IRQ
#define LS1B_UART10_IRQ 3
#define LS1B_UART11_IRQ 3
#define LS1B_CAN0_IRQ 6 #define LS1B_CAN0_IRQ 6
#define LS1B_CAN1_IRQ 7 #define LS1B_CAN1_IRQ 7
#define LS1B_SPI0_IRQ 8 #define LS1B_SPI0_IRQ 8
@ -49,7 +58,7 @@
#define LS1B_GPIO_IRQ 64 #define LS1B_GPIO_IRQ 64
#define LS1B_GPIO_FIRST_IRQ 64 #define LS1B_GPIO_FIRST_IRQ 64
#define LS1B_GPIO_IRQ_COUNT 96 #define LS1B_GPIO_IRQ_COUNT 64
#define LS1B_GPIO_LAST_IRQ (LS1B_GPIO_FIRST_IRQ + LS1B_GPIO_IRQ_COUNT-1) #define LS1B_GPIO_LAST_IRQ (LS1B_GPIO_FIRST_IRQ + LS1B_GPIO_IRQ_COUNT-1)
#define INT_PCI_INTA (1<<6) #define INT_PCI_INTA (1<<6)