@@ -519,38 +519,39 @@ DT_INST_FOREACH_STATUS_OKAY(PL011_INIT)
519
519
#define DT_DRV_COMPAT SBSA_COMPAT
520
520
521
521
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
522
- static void pl011_irq_config_func_sbsa (const struct device * dev );
522
+ #define PL011_SBSA_CONFIG_PORT (n ) \
523
+ static void pl011_irq_config_func_sbsa_##n(const struct device *dev) \
524
+ { \
525
+ DT_INST_FOREACH_PROP_ELEM(n, interrupt_names, \
526
+ PL011_IRQ_CONFIG_FUNC_BODY) \
527
+ }; \
528
+ \
529
+ static struct pl011_config pl011_cfg_sbsa_##n = { \
530
+ DEVICE_MMIO_ROM_INIT(DT_DRV_INST(n)), \
531
+ .irq_config_func = pl011_irq_config_func_sbsa_##n, \
532
+ };
533
+ #else
534
+ #define PL011_SBSA_CONFIG_PORT (n ) \
535
+ static struct pl011_config pl011_cfg_sbsa_##n = { \
536
+ DEVICE_MMIO_ROM_INIT(DT_DRV_INST(n)), \
537
+ };
523
538
#endif
524
539
525
- static struct pl011_config pl011_cfg_sbsa = {
526
- DEVICE_MMIO_ROM_INIT (DT_DRV_INST (0 )),
527
- #ifdef CONFIG_UART_INTERRUPT_DRIVEN
528
- .irq_config_func = pl011_irq_config_func_sbsa ,
529
- #endif
530
- };
531
-
532
- static struct pl011_data pl011_data_sbsa = {
533
- .sbsa = true,
534
- };
535
-
536
- DEVICE_DT_INST_DEFINE (0 ,
537
- & pl011_init ,
538
- NULL ,
539
- & pl011_data_sbsa ,
540
- & pl011_cfg_sbsa , PRE_KERNEL_1 ,
541
- CONFIG_SERIAL_INIT_PRIORITY ,
542
- & pl011_driver_api );
540
+ #define PL011_SBSA_INIT (n ) \
541
+ PL011_SBSA_CONFIG_PORT(n) \
542
+ \
543
+ static struct pl011_data pl011_data_sbsa_##n = { \
544
+ .sbsa = true, \
545
+ }; \
546
+ \
547
+ DEVICE_DT_INST_DEFINE(n, &pl011_init, \
548
+ NULL, \
549
+ &pl011_data_sbsa_##n, \
550
+ &pl011_cfg_sbsa_##n, \
551
+ PRE_KERNEL_1, \
552
+ CONFIG_SERIAL_INIT_PRIORITY, \
553
+ &pl011_driver_api);
543
554
544
- #ifdef CONFIG_UART_INTERRUPT_DRIVEN
545
- static void pl011_irq_config_func_sbsa (const struct device * dev )
546
- {
547
- IRQ_CONNECT (DT_INST_IRQN (0 ),
548
- DT_INST_IRQ (0 , priority ),
549
- pl011_isr ,
550
- DEVICE_GET (pl011_sbsa ),
551
- 0 );
552
- irq_enable (DT_INST_IRQN (0 ));
553
- }
554
- #endif
555
+ DT_INST_FOREACH_STATUS_OKAY (PL011_SBSA_INIT )
555
556
556
557
#endif /* CONFIG_UART_PL011_SBSA */
0 commit comments