Hi Norman
Thanks for your suggestions. I have reviewed the interrupt
controller on Fiasco.OC and have tried to compare it with the
interrupt controller on base-hw. After that and a little search on
Google about the RaspberryPI's interrupts
(http://xinu.mscs.mu.edu/BCM2835_Interrupt_Controller), I have
understood the problem, and fixed it.
On 03/23/2015 08:08 AM, Norman Feske
wrote:
Hello Reinier,
After that, I have tried to log the USB driver IRQ, setting
#define DEBUG_IRQ 1
in the file
repos/dde_linux/src/lib/usb/include/lx_emul.h
Setting this value, the USB driver will log every IRQ handled by the
function *_handle()* and *_handle_one()***in the USB driver. In the
Genode bare metal hardware it works fine, but when tried it with
Fiasco.OC, the IRQ handler *_handle()* and *_handle_one()* are never logged.
apparently, the USB driver initializes the USB controller (so the SoF
interrupts start appearing at the kernel) but it never receives any
interrupt. The issue could be the way of how IRQs are named by Fiasco.OC
and base-hw. Because of the hierarchic way of how the BCM's IRQ
controller works, the OS kernel developer has to come up with an
enumeration scheme. The scheme I introduced for the base-hw kernel is
defined at repos/base/include/platform/rpi/drivers/board_base.h:
https://github.com/genodelabs/genode/blob/master/repos/base/include/platform/rpi/drivers/board_base.h
/*
* 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.
*/
Fiasco.OC use an scheme very similar to base-hw but change the
numeration of the interrupts. In Fiasco.OC the USB interrupt
correspond to number 9, not 17.
The DWC-OTG controller uses IRQ 17. So it is not a basic IRQ. Hence, its
number is subjected to the enumeration scheme above. I do not know how
Fiasco.OC's naming scheme for IRQs on the Raspberry Pi looks like but it
may be different. To investigate, I'd recommend you to instrument both
kernels to log the accesses to the interrupt-controller registers. Look
if each of them touch the same bits once the USB driver is started.
Cheers
Norman
There is a patch with small changes on Genode to allow compile the
USB Driver for base-hw y foc-rpi:
-------------
repos/base/include/platform/rpi/drivers/board_base.h -------------
index 2cca3f6..139337f 100644
@@ -23,7 +23,7 @@ namespace Genode
{
enum {
RAM_0_BASE = 0x00000000,
- RAM_0_SIZE = 0x10000000, /* XXX ? */
+ RAM_0_SIZE = 0x20000000, /* XXX ? */
MMIO_0_BASE = 0x20000000,
MMIO_0_SIZE = 0x02000000,
---------------- repos/dde_linux/include/usb/foc_rpi/usb_irq.h
----------------
new file mode 100644
index 0000000..a99b10a
@@ -0,0 +1,14 @@
+/*
+ * \brief USB: DWC-OTG RaspberryPI Interrupt (base-foc)
+ * \author Reinier Millo Sánchez
+ * \date 2015-03-23
+ */
+
+#ifndef _INCLUDE_USB_IRQ_H_
+#define _INCLUDE_USB_IRQ_H_
+
+enum{
+ DWC_IRQ = 9,
+};
+
+#endif /* _INCLUDE_USB_IRQ_H_ */
----------------- repos/dde_linux/include/usb/hw_rpi/usb_irq.h
-----------------
new file mode 100644
index 0000000..bcf7913
@@ -0,0 +1,14 @@
+/*
+ * \brief USB: DWC-OTG RaspberryPI Interrupt (base-hw)
+ * \author Reinier Millo Sánchez
+ * \date 2015-03-23
+ */
+
+#ifndef _INCLUDE_USB_IRQ_H_
+#define _INCLUDE_USB_IRQ_H_
+
+enum{
+ DWC_IRQ = 17,
+};
+
+#endif /* _INCLUDE_USB_IRQ_H_ */
-------------------- repos/dde_linux/lib/mk/foc_rpi/usb.mk
--------------------
new file mode 100644
index 0000000..df03613
@@ -0,0 +1,3 @@
+include $(REP_DIR)/lib/mk/usb_rpi.inc
+
+INC_DIR += $(REP_DIR)/include/usb/foc_rpi
\ No newline at end of file
------------------ repos/dde_linux/lib/mk/platform_rpi/usb.mk
------------------
index 4021104..5a7f1ea 100644
@@ -1,48 +1,3 @@
-SRC_C += \
- usb/host/dwc_otg/dwc_otg/dwc_otg_adp.c \
- usb/host/dwc_otg/dwc_otg/dwc_otg_attr.c \
- usb/host/dwc_otg/dwc_otg/dwc_otg_cfi.c \
- usb/host/dwc_otg/dwc_otg/dwc_otg_cil.c \
- usb/host/dwc_otg/dwc_otg/dwc_otg_cil_intr.c \
- usb/host/dwc_otg/dwc_otg/dwc_otg_driver.c \
- usb/host/dwc_otg/dwc_otg/dwc_otg_hcd.c \
- usb/host/dwc_otg/dwc_otg/dwc_otg_hcd_ddma.c \
- usb/host/dwc_otg/dwc_otg/dwc_otg_hcd_intr.c \
- usb/host/dwc_otg/dwc_otg/dwc_otg_hcd_linux.c \
- usb/host/dwc_otg/dwc_otg/dwc_otg_hcd_queue.c
+include $(REP_DIR)/lib/mk/usb_rpi.inc
-SRC_C += \
- usb/host/dwc_otg/dwc_common_port/dwc_cc.c \
- usb/host/dwc_otg/dwc_common_port/dwc_common_linux.c \
- usb/host/dwc_otg/dwc_common_port/dwc_crypto.c \
- usb/host/dwc_otg/dwc_common_port/dwc_dh.c \
- usb/host/dwc_otg/dwc_common_port/dwc_mem.c \
- usb/host/dwc_otg/dwc_common_port/dwc_modpow.c \
- usb/host/dwc_otg/dwc_common_port/dwc_notifier.c
-
-SRC_C += net/usb/usbnet.c net/usb/smsc95xx.c
-
-include $(REP_DIR)/lib/mk/usb.inc
-include $(REP_DIR)/lib/mk/armv6/usb.inc
-
-CC_OPT += -DDWC_LINUX -DPLATFORM_INTERFACE
-
-# needed for 'ehci-hcd.c', which we don't use on the rpi, but it
is still
-# part of the generic usb USB driver
-CC_OPT += -DCONFIG_USB_EHCI_PCI=1
-
-# for 'dwc_otg_hcd_linux.c' for enabling the FIQ, which we don't
use anyway
-CC_OPT += -DINTERRUPT_VC_USB=9
-
-# for 'dwc_otg_driver.c' for preventing calls to set_irq_type
-CC_OPT += -DIRQF_TRIGGER_LOW=1
-
-INC_DIR +=
$(LX_CONTRIB_DIR)/drivers/usb/host/dwc_otg/dwc_common_port \
- $(LX_CONTRIB_DIR)/drivers/usb/host/dwc_otg/dwc_otg
-SRC_CC += platform.cc
-
-vpath platform.cc $(LIB_DIR)/arm/platform_rpi
-vpath %.c $(LX_CONTRIB_DIR)/drivers/net/usb
-
-# enable C++11 support
-CC_CXX_OPT += -std=gnu++11
+INC_DIR += $(REP_DIR)/include/usb/hw_rpi
\ No newline at end of file
---------------------- repos/dde_linux/lib/mk/usb_rpi.inc
----------------------
similarity index 100%
copy from repos/dde_linux/lib/mk/platform_rpi/usb.mk
copy to repos/dde_linux/lib/mk/usb_rpi.inc
----------------------- repos/dde_linux/run/usb_hid.run
-----------------------
index 714d55d..a3ced48 100644
@@ -13,6 +13,7 @@ lappend_if [have_spec acpi]
build_components drivers/acpi
lappend_if [have_spec pci] build_components
drivers/pci
lappend_if [have_spec pci] build_components
drivers/pci/device_pd
lappend_if [have_spec platform_arndale] build_components
drivers/platform
+lappend_if [have_spec platform_rpi] build_components
drivers/platform
lappend_if [have_spec gpio] build_components
drivers/gpio
build $build_components
@@ -48,6 +49,13 @@ append_if [have_spec platform_arndale] config {
<provides><service
name="Regulator"/></provides>
</start>}
+append_if [have_spec platform_rpi] config {
+ <start name="platform_drv">
+ <resource name="RAM" quantum="1M"/>
+ <provides><service
name="Platform"/></provides>
+ <config/>
+ </start>}
+
append_if [have_spec gpio] config {
<start name="gpio_drv">
<resource name="RAM" quantum="4M"/>
@@ -107,6 +115,7 @@ lappend_if [have_spec acpi]
boot_modules acpi_drv
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec nova] boot_modules
pci_device_pd
lappend_if [have_spec platform_arndale] boot_modules platform_drv
+lappend_if [have_spec platform_rpi] boot_modules platform_drv
lappend_if [have_spec gpio] boot_modules gpio_drv
build_boot_image $boot_modules
-----------
repos/dde_linux/src/lib/usb/arm/platform_rpi/platform.cc
-----------
index ae7654f..4c0a05d 100644
@@ -29,6 +29,9 @@
#include <dwc_otg_dbg.h>
#undef new
+#include <usb_irq.h>
+
+
using namespace Genode;
@@ -39,8 +42,6 @@ using namespace Genode;
enum {
DWC_BASE = 0x20980000,
DWC_SIZE = 0x20000,
-
- DWC_IRQ = 17,
};
Now I'll try more complex examples on Fiasco.OC+Genode.
Best regards
--
Lic. Reinier Millo Sánchez
Centro de Estudios de Informática
Universidad Central "Marta Abreu" de Las Villas
"antes de discutir ... respira;
antes de hablar ... escucha;
antes de escribir ... piensa;
antes de herir ... siente;
antes de rendirte ... intenta;
antes de morir ... vive"