diff --git a/repos/base-hw/src/core/spec/arm/bcm2835_pic.cc b/repos/base-hw/src/core/spec/arm/bcm2835_pic.cc index c014a77126..5105a65eec 100644 --- a/repos/base-hw/src/core/spec/arm/bcm2835_pic.cc +++ b/repos/base-hw/src/core/spec/arm/bcm2835_pic.cc @@ -76,25 +76,16 @@ Board::Pic::Pic() bool Board::Pic::take_request(unsigned &irq) { - /* read basic IRQ status mask */ - uint32_t const p = read(); - - /* read GPU IRQ status mask */ uint32_t const p1 = read(), p2 = read(); - if (Irq_pending_basic::Timer::get(p)) { - irq = Irq_pending_basic::Timer::SHIFT; - return true; - } - /* search for lowest set bit in pending masks */ for (unsigned i = 0; i < NR_OF_IRQ; i++) { if (!_is_pending(i, p1, p2)) continue; - irq = Board::GPU_IRQ_BASE + i; + irq = i; /* handle SOF interrupts locally, filter from the user land */ if (irq == Board::DWC_IRQ) @@ -118,23 +109,15 @@ void Board::Pic::mask() void Board::Pic::unmask(unsigned const i, unsigned) { - if (i < 8) - write(1 << i); - else if (i < 32 + 8) - write(1 << (i - 8)); - else - write(1 << (i - 8 - 32)); + if (i < 32) { write(1 << i); } + else { write(1 << (i - 32)); } } void Board::Pic::mask(unsigned const i) { - if (i < 8) - write(1 << i); - else if (i < 32 + 8) - write(1 << (i - 8)); - else - write(1 << (i - 8 - 32)); + if (i < 32) { write(1 << i); } + else { write(1 << (i - 32)); } } diff --git a/repos/base/include/drivers/defs/rpi.h b/repos/base/include/drivers/defs/rpi.h index 5bce75a480..ae5c41de65 100644 --- a/repos/base/include/drivers/defs/rpi.h +++ b/repos/base/include/drivers/defs/rpi.h @@ -25,14 +25,7 @@ namespace Rpi { MMIO_0_BASE = 0x20000000, MMIO_0_SIZE = 0x02000000, - /* - * IRQ numbers 0..7 refer to the basic IRQs. - * IRQ numbers 8..39 refer to GPU IRQs 0..31. - * IRQ numbers 40..71 refer to GPU IRQs 32..63. - */ - GPU_IRQ_BASE = 8, - - SYSTEM_TIMER_IRQ = GPU_IRQ_BASE + 1, + SYSTEM_TIMER_IRQ = 1, SYSTEM_TIMER_MMIO_BASE = 0x20003000, SYSTEM_TIMER_MMIO_SIZE = 0x1000, SYSTEM_TIMER_CLOCK = 1000000, @@ -56,11 +49,8 @@ namespace Rpi { USB_DWC_OTG_BASE = 0x20980000, USB_DWC_OTG_SIZE = 0x20000, - /* timer */ - TIMER_IRQ = 0, - /* USB host controller */ - DWC_IRQ = 17, + DWC_IRQ = 9, /* SD card */ SDHCI_BASE = MMIO_0_BASE + 0x300000, diff --git a/repos/dde_linux/lib/mk/rpi_usb.mk b/repos/dde_linux/lib/mk/rpi_usb.mk deleted file mode 100644 index e63575d7eb..0000000000 --- a/repos/dde_linux/lib/mk/rpi_usb.mk +++ /dev/null @@ -1,5 +0,0 @@ -SRC_CC += dwc_irq.cc - -vpath % $(REP_DIR)/src/lib/rpi_usb - -CC_CXX_WARN_STRICT = diff --git a/repos/dde_linux/recipes/src/usb_drv/content.mk b/repos/dde_linux/recipes/src/usb_drv/content.mk index 9be6e28b49..450e82a171 100644 --- a/repos/dde_linux/recipes/src/usb_drv/content.mk +++ b/repos/dde_linux/recipes/src/usb_drv/content.mk @@ -1,4 +1,4 @@ -LIB_MK := lib/import/import-usb_include.mk lib/mk/usb_include.mk lib/mk/rpi_usb.mk \ +LIB_MK := lib/import/import-usb_include.mk lib/mk/usb_include.mk \ lib/import/import-usb_arch_include.mk \ $(foreach SPEC,x86_32 x86_64 arm,lib/mk/spec/$(SPEC)/lx_kit_setjmp.mk) @@ -6,8 +6,7 @@ PORT_DIR := $(call port_dir,$(REP_DIR)/ports/dde_linux) MIRROR_FROM_REP_DIR := $(LIB_MK) \ src/drivers/usb \ - src/include src/lx_kit \ - $(shell cd $(REP_DIR); find src/lib/rpi_usb -type f) + src/include src/lx_kit MIRROR_FROM_PORT_DIR := $(shell cd $(PORT_DIR); find src/lib/usb -type f | grep -v ".git") MIRROR_FROM_PORT_DIR := $(filter-out $(MIRROR_FROM_REP_DIR),$(MIRROR_FROM_PORT_DIR)) diff --git a/repos/dde_linux/src/drivers/usb/spec/rpi/platform.cc b/repos/dde_linux/src/drivers/usb/spec/rpi/platform.cc index df9c708748..91b9fff4ed 100644 --- a/repos/dde_linux/src/drivers/usb/spec/rpi/platform.cc +++ b/repos/dde_linux/src/drivers/usb/spec/rpi/platform.cc @@ -28,8 +28,6 @@ using namespace Genode; -unsigned dwc_irq(Genode::Env&); - /************************************************ ** Resource info passed to the dwc_otg driver ** @@ -38,6 +36,7 @@ unsigned dwc_irq(Genode::Env&); enum { DWC_BASE = 0x20980000, DWC_SIZE = 0x20000, + DWC_IRQ = 9, }; @@ -155,11 +154,10 @@ extern "C" int module_smsc95xx_driver_init(); void platform_hcd_init(Env &env, Services *services) { - unsigned irq = dwc_irq(env); static resource _dwc_otg_resource[] = { { DWC_BASE, DWC_BASE + DWC_SIZE - 1, "dwc_otg", IORESOURCE_MEM }, - { irq, irq, "dwc_otg-irq" /* name unused */, IORESOURCE_IRQ } + { DWC_IRQ, DWC_IRQ, "dwc_otg-irq" /* name unused */, IORESOURCE_IRQ } }; /* enable USB power */ diff --git a/repos/dde_linux/src/drivers/usb/spec/rpi/target.mk b/repos/dde_linux/src/drivers/usb/spec/rpi/target.mk index 8cc5078c7d..a6076cf237 100644 --- a/repos/dde_linux/src/drivers/usb/spec/rpi/target.mk +++ b/repos/dde_linux/src/drivers/usb/spec/rpi/target.mk @@ -47,5 +47,3 @@ vpath %.c $(LX_CONTRIB_DIR)/drivers/net/usb # enable C++11 support CC_CXX_OPT += -std=gnu++11 - -LIBS += rpi_usb diff --git a/repos/dde_linux/src/drivers/usb_host/spec/rpi/platform.cc b/repos/dde_linux/src/drivers/usb_host/spec/rpi/platform.cc index d089ff74d1..8382551443 100644 --- a/repos/dde_linux/src/drivers/usb_host/spec/rpi/platform.cc +++ b/repos/dde_linux/src/drivers/usb_host/spec/rpi/platform.cc @@ -28,8 +28,6 @@ using namespace Genode; -unsigned dwc_irq(Genode::Env&); - /************************************************ ** Resource info passed to the dwc_otg driver ** @@ -38,6 +36,7 @@ unsigned dwc_irq(Genode::Env&); enum { DWC_BASE = 0x20980000, DWC_SIZE = 0x20000, + DWC_IRQ = 9, }; @@ -50,11 +49,10 @@ extern bool fiq_enable, fiq_fsm_enable; void platform_hcd_init(Genode::Env &env, Services *services) { - unsigned irq = dwc_irq(env); static resource _dwc_otg_resource[] = { { DWC_BASE, DWC_BASE + DWC_SIZE - 1, "dwc_otg", IORESOURCE_MEM }, - { irq, irq, "dwc_otg-irq" /* name unused */, IORESOURCE_IRQ } + { DWC_IRQ, DWC_IRQ, "dwc_otg-irq" /* name unused */, IORESOURCE_IRQ } }; /* enable USB power */ diff --git a/repos/dde_linux/src/drivers/usb_host/spec/rpi/target.mk b/repos/dde_linux/src/drivers/usb_host/spec/rpi/target.mk index 67c9667cfa..97653d8dda 100644 --- a/repos/dde_linux/src/drivers/usb_host/spec/rpi/target.mk +++ b/repos/dde_linux/src/drivers/usb_host/spec/rpi/target.mk @@ -46,5 +46,3 @@ INC_DIR += $(LX_CONTRIB_DIR)/drivers/usb/host/dwc_common_port \ $(REP_DIR)/src/lib/usb_host/spec/arm vpath %.c $(LX_CONTRIB_DIR)/drivers/usb/host - -LIBS += rpi_usb diff --git a/repos/dde_linux/src/lib/rpi_usb/dwc_irq.cc b/repos/dde_linux/src/lib/rpi_usb/dwc_irq.cc deleted file mode 100644 index a6b9db85bf..0000000000 --- a/repos/dde_linux/src/lib/rpi_usb/dwc_irq.cc +++ /dev/null @@ -1,24 +0,0 @@ -/* - * \brief USB: DWC-OTG RaspberryPI Interrupt - * \author Stefan Kalkowski - * \date 2019-04-16 - */ - -#include -#include -#include - -unsigned dwc_irq(Genode::Env &env) -{ - using namespace Genode; - - static Attached_rom_dataspace rom(env, "platform_info"); - static unsigned offset = 0; - try { - String<32> kernel_name = - rom.xml().sub_node("kernel").attribute_value("name", String<32>()); - if (kernel_name == "hw") offset += Rpi::GPU_IRQ_BASE; - } catch (...) { } - - return offset + 9; -} diff --git a/repos/os/src/drivers/gpio/rpi/driver.h b/repos/os/src/drivers/gpio/rpi/driver.h index d3e2a06a78..5fb0a3ce4a 100644 --- a/repos/os/src/drivers/gpio/rpi/driver.h +++ b/repos/os/src/drivers/gpio/rpi/driver.h @@ -54,10 +54,15 @@ class Gpio::Rpi_driver : public Driver }); } - Rpi_driver(Genode::Env &env, unsigned irq_offset) + void _invalid_gpio(unsigned gpio) { + Genode::error("invalid GPIO pin number ", gpio); } + + public: + + Rpi_driver(Genode::Env &env) : _reg(env, Rpi::GPIO_CONTROLLER_BASE, 0, Rpi::GPIO_CONTROLLER_SIZE), - _irq(env, IRQ + irq_offset), + _irq(env, IRQ), _dispatcher(env.ep(), *this, &Rpi_driver::_handle), _async(false) { @@ -65,11 +70,6 @@ class Gpio::Rpi_driver : public Driver _irq.ack_irq(); } - void _invalid_gpio(unsigned gpio) { - Genode::error("invalid GPIO pin number ", gpio); } - - public: - void set_async_events(bool async) { _async = async; } void set_func(unsigned gpio, Reg::Function function) @@ -80,8 +80,6 @@ class Gpio::Rpi_driver : public Driver _reg.set_gpio_function(gpio, function); } - static Rpi_driver& factory(Genode::Env &env); - /****************************** ** Driver interface ** diff --git a/repos/os/src/drivers/gpio/rpi/main.cc b/repos/os/src/drivers/gpio/rpi/main.cc index b09a2ded5a..be744827e9 100644 --- a/repos/os/src/drivers/gpio/rpi/main.cc +++ b/repos/os/src/drivers/gpio/rpi/main.cc @@ -26,25 +26,11 @@ #include "driver.h" -Gpio::Rpi_driver& Gpio::Rpi_driver::factory(Genode::Env &env) -{ - unsigned irq_offset = 0; - static Genode::Attached_rom_dataspace rom { env, "platform_info" }; - try { - String<32> kernel_name = - rom.xml().sub_node("kernel").attribute_value("name", String<32>()); - if (kernel_name == "hw") irq_offset += Rpi::GPU_IRQ_BASE; - } catch (...) { } - static Rpi_driver driver(env, irq_offset); - return driver; -} - - struct Main { Genode::Env &env; Genode::Sliced_heap sliced_heap; - Gpio::Rpi_driver &driver; + Gpio::Rpi_driver driver; Gpio::Root root; Genode::Attached_rom_dataspace config_rom { env, "config" }; @@ -53,7 +39,7 @@ struct Main : env(env), sliced_heap(env.ram(), env.rm()), - driver(Gpio::Rpi_driver::factory(env)), + driver(env), root(&env.ep().rpc_ep(), &sliced_heap, driver) { using namespace Genode;