1. 04 Jul, 2020 1 commit
    • Robert Sprowson's avatar
      Change to unsigned physical addresses · 9f272d38
      Robert Sprowson authored
      The prototype for vtophys returns an unsigned value, update this driver to match the port header file from USBDriver-1_31.
      
      Version 0.37. Tagged as 'DWCDriver-0_37'
      9f272d38
  2. 22 Apr, 2020 1 commit
    • Jeffrey Lee's avatar
      Remove some redundant #includes · e706bc6b
      Jeffrey Lee authored
      TCPIPLibs-5_69's version of sys/time.h now includes the TCPIPLibs
      version of sys/types.h, which contains duplicate/conflicting definitions
      of CLib's clock_t & time_t from time.h.
      
      DWCDriver's port.c was including both sys/time.h and time.h, which means
      that for the past few weeks Norcroft has been throwing errors about the
      duplicate definitions (but still producing a valid object).
      
      However both of those includes appear to be redundant, so just remove
      them. Resulting binary is unchanged.
      
      
      Version 0.36. Not tagged
      e706bc6b
  3. 29 Feb, 2020 1 commit
    • Robert Sprowson's avatar
      Make a substitute for MPHI · d6652a69
      Robert Sprowson authored
      The MPHI is (ab)used by DWCDriver as a means to do a FIQ downgrade to IRQ, but Pi 4 has no MPHI, so instead we substitute the GIC. This is essentially a GIC based equivalent to the changes in https://github.com/raspberrypi/linux/commit/0a1cf0d.
      Apply these diffs then, in dwc_otg_riscos.c:
      * deduce use_swirq by noticing the MPHI base happens to have all 13 LSB clear whereas the GIC doesn't, in just as horrendously Pi specific manner as Linux looking at the size of the memory region to deduce same
      * setup the pointers to swirq_set and swirq_clr at GICD_ISPENDRn GICD_ICPENDRn
      
      Version 0.36. Tagged as 'DWCDriver-0_36'
      d6652a69
  4. 02 Jun, 2018 1 commit
  5. 27 Jan, 2018 1 commit
    • ROOL's avatar
      Improve response USBDriver finalisation · 972e2607
      ROOL authored
      Detail:
        Listen for Service_USB_USBDriverDead then shut down the driver, rather than Service_ModulePostFinal.
        Ensure the returned status is defined if USBDriver_InsertTransfer fails (because USBDriver has gone).
      Admin:
        Submission from Colin Granville.
      
      Version 0.34. Tagged as 'DWCDriver-0_34'
      972e2607
  6. 25 Nov, 2017 1 commit
    • ROOL's avatar
      Fix to device descriptor interval handling · 3da3b7b4
      ROOL authored
      Detail:
        For high speed interrupt endpoints, and full/high speed isochronous, the bInterval value is held in log2 form. Take this into account.
        Correct the built in root hub device descriptor similarly - 255 is not valid for a HSHUBSTT (USB 2.0 errata 07-Dec-2000 corrected the mistake on page 412 of the USB 2.0 spec).
      Admin:
        Based on a submission from Colin Granville, with edits.
      
      Version 0.33. Tagged as 'DWCDriver-0_33'
      3da3b7b4
  7. 19 Sep, 2017 1 commit
    • ROOL's avatar
      Remove some part finished HAL support · 8ee45d86
      ROOL authored
      Detail:
        A few sections of code guarded by USBHAL defines carried over from MUSBDriver, but were never finished due to the complexity of DWCDriver.
        These are no longer needed now the kernel scans for keys, so remove them.
      Admin:
        Couple of warnings in cmodule.c also attended to.
        Submission for USB bounty.
      
      Version 0.32. Tagged as 'DWCDriver-0_32'
      8ee45d86
  8. 19 Aug, 2017 2 commits
    • ROOL's avatar
      Remove unused header · 8e8a2962
      ROOL authored
      Admin:
        Missed in earlier commit. Retagged.
      8e8a2962
    • ROOL's avatar
      Changes to header imports · 300aee8a
      ROOL authored
      Detail:
        Use those in C:USB rather than reaching inside the adjacent USBDriver.
      Admin:
        Requires USBDriver-1_21.
      
      Version 0.31. Tagged as 'DWCDriver-0_31'
      300aee8a
  9. 15 Jul, 2017 1 commit
    • ROOL's avatar
      Repoint include path · 4ea0e965
      ROOL authored
      Admin:
        Reach into USBDriver rather than NetBSD.
      
      Version 0.30. Tagged as 'DWCDriver-0_30'
      4ea0e965
  10. 17 Dec, 2016 1 commit
    • ROOL's avatar
      Internationalised · 21123a25
      ROOL authored
      Detail:
        Add support for standalone messages registration, and actually use the messages rather than just exporting them in ROM builds.
        Changed to use allocated error bases rather than 0.
        Sync controller hunting loop with other HC for ease of comparison.
      Admin:
        Submission for USB bounty.
        Tested on a Pi 2.
      
      Version 0.29. Tagged as 'DWCDriver-0_29'
      21123a25
  11. 10 Dec, 2016 1 commit
    • ROOL's avatar
      Build fix · ff0f490e
      ROOL authored
      Admin:
        Requires NetBSD-1_17
      ff0f490e
  12. 15 Jun, 2016 1 commit
    • Jeffrey Lee's avatar
      Issue CLREX on return from the FIQ handler · 66844ced
      Jeffrey Lee authored
      Detail:
        s/regaccess - Issue CLREX on return from the FIQ handler, just in case we start using exclusive access instructions from within the handler. Update PSR manipulation code to use CPS in preference to MSR.
      Admin:
        Tested on Raspberry Pi
      
      
      Version 0.28. Tagged as 'DWCDriver-0_28'
      66844ced
  13. 02 May, 2016 1 commit
  14. 27 Mar, 2016 2 commits
  15. 04 Mar, 2016 2 commits
    • ROOL's avatar
      Revert accidental commits · 49ab6570
      ROOL authored
      Admin:
        These changes are currently subject to rework via the normal submissions channel.
      49ab6570
    • John Ballance's avatar
      Fixes to get isochronous transfer in DWCDriver (Raspberry Pi)` · 8722f4da
      John Ballance authored
      Detail:
      
      Changes to the RISC OS part of the DWCDriver (Raspberry Pi) necessary to get isochronous transfers working on a pi.
      
      DWCDriver.c.cmodule
      DWCDriver.c.dwc_otg_riscos
      DWCDriver.c.softc_device
      DWCDriver.h.dwc_otg_riscos
      
      Admin:
      submitted by Colin Granville
      tested on pi
      
      Version 0.25. Tagged as 'DWCDriver-0_25'
      8722f4da
  16. 11 Dec, 2015 1 commit
  17. 18 Nov, 2015 1 commit
  18. 15 Nov, 2015 1 commit
  19. 07 Oct, 2015 1 commit
    • Jeffrey Lee's avatar
      Update to 'FIQ FSM' USB driver · 10052c0c
      Jeffrey Lee authored
      Detail:
        Makefile, dwc/* - Updated to latest-ish code from Raspberry Pi github (rev c8baa9702c). Includes the 'FIQ FSM' USB driver, which replaces the older 'FIQ fix'. Note that many files appear to have no functional changes - just trailing whitespace removal to keep things in sync with github.
        Makefile - add DEBUGLIBS back into the debug libs listing to fix debug builds
        c/cmodule - Update to work with new FIQ FSM flags
        c/dwc_otg_riscos - Update to work with new FIQ FSM flags. Update initialisation procedure. Change IRQ handling to try both the HCD & CIL interrupt handlers (HCD can claim interrupt is handled when there's still a CIL interrupt pending). Disable support for falling back to IRQ if the FIQ vector is claimed by someone else - will need new implementation to cope with starting & stopping the FIQ FSM.
        s/regaccess - Update FIQ veneer & install routine to allow operation with either the dwc_otg_fiq_fsm or dwc_otg_fiq_nop functions.
      Admin:
        Tested on Raspberry Pi 1 & 2
      
      
      Version 0.21. Tagged as 'DWCDriver-0_21'
      10052c0c
  20. 21 Aug, 2015 1 commit
    • Robert Sprowson's avatar
      Don't reach into USBDriver's back pocket · 88a7fa72
      Robert Sprowson authored
      cmodule.c:
        Use USBDriver.h from interface exports
      Makefile:
        Remove duplicated libs from debug build
        Remove relative reference to NetBSD component from VPATH
      !MkDebug:
        Select debug target so the right compiler switches are used
      Built, but not tested.
      
      Version 0.20. Tagged as 'DWCDriver-0_20'
      88a7fa72
  21. 28 Mar, 2015 1 commit
    • Jeffrey Lee's avatar
      Fix error handling when transfers fail to start · 39e2d3a4
      Jeffrey Lee authored
      Detail:
        c/softc_device - Fix softc_device_start() to call usb_transfer_complete() with the appropriate status code if a transfer fails to start - returning the status to the caller isn't enough. Also tweak debug output and add extra safety checks to timeout cancellation.
      Admin:
        Tested on Raspberry Pi
      
      
      Version 0.19. Tagged as 'DWCDriver-0_19'
      39e2d3a4
  22. 31 Oct, 2014 1 commit
    • Robert Sprowson's avatar
      Build fix · 1d60fab9
      Robert Sprowson authored
      Having updated the central 'usb.h' to include some of the more recent definitions this has created a clash here.
      UHF_PORT_L1 isn't 5 according to the USB 2.0 spec, but since the only use of it in DWCDriver is wrapped in CONFIG_USB_DWC_OTG_LPM which isn't enabled in this port, just delete it.
      UHF_C_PORT_L1 is now defined in 'usb.h', delete local copy.
      UHF_PORT_HIGH_SPEED remains. In fact, it looks like the ported driver got confused when responding to GET_PORT_STATUS as it builds the status word out of bitmasks defined for hub feature manipulation (UHF) not port status (UPS) which are different number spaces. Oops.
      
      Version 0.18. Tagged as 'DWCDriver-0_18'
      1d60fab9
  23. 18 Oct, 2014 1 commit
  24. 08 Jul, 2014 1 commit
    • Jeffrey Lee's avatar
      Enable part two of the FIQ fix · 1bec5bff
      Jeffrey Lee authored
      Detail:
        This enables support for the code which handles split transactions in the FIQ handler. This requires some extra logic to allow the FIQ handler to gracefully terminate its state machine when we need to release our hold on the FIQ vector.
        c/dwc_otg_riscos - Update FIQ claim/release functions to initialise and terminate fiq_split_enable. Make FIQ usage bools static const as nothing needs to change them at runtime.
        h/dwc_otg_riscos - Remove unused use_fiq_fix extern
        dwc/driver/c/dwc_otg_hcd_intr - Modify fiq_hcintr_handle() to allow for graceful termination - when terminating, suppress adding new xfers to the schedule and instead force the IRQ handler to deal with them
      Admin:
        Tested on Raspberry Pi
        Thrashing Service_ClaimFIQ/Service_ReleaseFIQ didn't result in any obvious problems while split xfers were occuring
      
      
      Version 0.16. Tagged as 'DWCDriver-0_16'
      1bec5bff
  25. 19 Jun, 2014 1 commit
    • Jeffrey Lee's avatar
      Enable part one of the FIQ fix · db8357fa
      Jeffrey Lee authored
      Detail:
        This change enables the basic 'FIQ fix', where SOF interrupts are handled by a FIQ handler and all other interrupts are delegated to IRQ.
        During testing it was observed that when the FIQ fix was enabled, what appears to be the host-side VCHIQ process would randomly die. It could take anywhere from several seconds (including during ROM init) or several hours for this to happen.
        After much investigation it looks like the cause was the use of the MPHI peripheral as a mechanism to trigger an IRQ from the FIQ handler. Changing the code in dwc_otg_hcd_handle_intr() so that it 'flushes' MPHI more often (after every interrupt instead of after every 60) seemed to reduce the problem, while changing the IRQ generation mechanism to use a different IRQ source (e.g. timer) made the crash go away entirely
        In the end I've settled on the compromise of using the MPHI peripheral, but in a way in which we only need to poke it once on startup, instead of once for every desired IRQ. Once we have it generating an IRQ we then rely on masking/unmasking the IRQ in the interrupt controller to get the desired effect of downgrading FIQs to IRQs. See the RISCOS_FIQ_DOWNGRADE #define.
        Changed files:
        - c/cmodule - Use symbolic constant for the USB controller ID instead of a magic number. Get the MPHI details from HAL_USBControllerInfo. Pay attention to Service_ClaimFIQ/Service_ReleaseFIQ and enable/disable the FIQ fix as appropriate.
        - c/dwc_common_riscos - Disable some debug functions which were accidentally left in non-debug builds. Change work queue/tasklet thread initialisation to fix a deadlock issue seen on reboot.
        - c/dwc_otg_riscos - Set up the MPHI and enable/disable the FIQ handler as required
        - cmhg/modhead - Pay attention to Service_ClaimFIQ/Service_ReleaseFIQ
        - dwc/driver/c/dwc_otg_hcd_intr, dwc/driver/h/dwc_otg_mphi_fix - RISCOS_FIQ_DOWNGRADE code
        - dwc/dwc_common_port/h/dwc_os - Make sure __DWC_WARN, __DWC_ERROR, DWC_EXCEPTION are compiled out in non-debug builds
        - h/dwc_otg_riscos - declare extra functions/variables related to FIQ fix
        - s/regaccess - Routine to install the FIQ handler on the FIQ vector, and simple HAL call wrapper
      Admin:
        Tested on Raspberry Pi
        Requires Kernel-5_35-4_79_2_227, BCM2835-0_34
      
      
      Version 0.15. Tagged as 'DWCDriver-0_15'
      db8357fa
  26. 01 Jun, 2014 1 commit
    • Jeffrey Lee's avatar
      Fix to allow building against NetBSD-0_85 · 689a0ad0
      Jeffrey Lee authored
      Detail:
        c/cmodule - Don't use NetBSD/build/service.h, it no longer exists. Use the exported USB/USBDevFS.h instead. Fix service call reason codes to use USBDevFS names.
      Admin:
        Tested in BCM2835 ROM build
        Build output is binary-identical to previous version
        Requires NetBSD-0_85
      
      
      Version 0.14. Tagged as 'DWCDriver-0_14'
      689a0ad0
  27. 06 May, 2014 1 commit
  28. 29 Apr, 2014 1 commit
  29. 26 Apr, 2014 1 commit
    • Jeffrey Lee's avatar
      Update to latest code from Raspberry Pi github · a17ef0c8
      Jeffrey Lee authored
      Detail:
        Makefile, dwc/* - Updated to latest code from Raspberry Pi github (rev e0001dd59d). Includes the fabled 'FIQ fix' code, although the code isn't yet enabled in the RISC OS version of the driver.
        c/cmodule - Add extra flags for controlling driver behaviour, as required by the new core code
        c/dwc_otg_riscos - Add some missing driver parameters (although we leave them at default). Handle DWC_E_SHUTDOWN xfer errors, which will now be produced when the driver is shutting down
        c/softc_device - Disable interrupts around dwc_otg_hcd_urb_enqueue, to mirror behaviour of Linux code (previously, it was the responsibility of the DWC code to disable interrupts for the appropriate part of the operation)
        s/regaccess - Add some extra IRQ/memory barrier functions required by the new code (mainly the FIQ fix). Make DWC_MODIFY_REG32 operate atomicly (mirrors change in Linux version)
      Admin:
        Tested on Raspberry Pi
      
      
      Version 0.11. Tagged as 'DWCDriver-0_11'
      a17ef0c8
  30. 30 Mar, 2013 1 commit
    • Jeffrey Lee's avatar
      Fix hang on boot · 07e72b27
      Jeffrey Lee authored
      Detail:
        c/cmodule - Add a re-entrancy check to USB driver initialisation; due to recent kernel changes we're now getting the "USBDriver has started" service call during the middle of our call to USBDriver_Register (called from our own initialisation callback). Without the re-entrancy check the system was getting confused and sending a duff transfer request to DWCDriver, resulting in a hang somewhere in the driver logic.
      Admin:
        Tested on Raspberry Pi
        Machine no longer stops after "mod init done" is displayed
      
      
      Version 0.10. Tagged as 'DWCDriver-0_10'
      07e72b27
  31. 17 Sep, 2012 1 commit
    • Jeffrey Lee's avatar
      Update to version 3.00 of DWC_otg · d854b974
      Jeffrey Lee authored
      Detail:
        This big batch of changes brings us in line with rev 70428950df of the Raspberry Pi Linux github.
        Briefly:
        * Deleted HTML docs as they're a waste of space
        * Dropped the SOF fix (which we never used anyway)
        * Dropped our implementation of the microframe scheduling patch, in favour of their implementation
        * Updated to version 3.00 of the DWC sources. Hard to tell what useful changes this brings, due to API tweaks resulting in pretty much every file being littered with changes.
      Admin:
        Tested on Raspberry Pi with high processor vectors
        This new version seems like it might be a bit more sensitive to insufficient power supplies. Beware!
      
      
      Version 0.09. Tagged as 'DWCDriver-0_09'
      d854b974
  32. 04 Aug, 2012 1 commit
    • Jeffrey Lee's avatar
      Fix aborts on reset/*rmkill USBDriver · 75f42235
      Jeffrey Lee authored
      Detail:
        c/cmodule, cmhg/modhead - Don't shutdown DWC layer during Service_USBDriver_Dying. Instead, only do it during Service_ModulePostFinal/Service_PreReset(/module finialisation). Also during Service_PreReset, deregister with USBDriver. This ensures we're deregistered with USBDriver before we shut down the DWC layer, and so don't have to worry about receiving events from USBDriver after the DWC layer is shut down.
        c/dwc_common_riscos, c/dwc_otg_riscos, h/dwc_common_riscos - Improve handling of DWC endpoint disable callbacks. The memory block for the endpoint now has a flag set in its header when a callback is pending, allowing us to avoid double-free situations if both ourselves and the DWC layer decide to free the endpoint.
        c/softc_root - Correct some debug messages
        dwc/driver/c/dwc_otg_hcd - Fix qh_list_free to use DWC_LIST_FOREACH_SAFE (as dwc_otg_hcd_qh_remove_and_free will remove entries from the list) - fixes potential double-free if a non-empty list is being freed
        dwc/driver/c/dwc_otg_hcd_intr - Fix building of debug builds
      Admin:
        Tested in Pi ROM with high processor vectors
        Resets and killing/reiniting USBDriver now works properly
      
      
      Version 0.08. Tagged as 'DWCDriver-0_08'
      75f42235
  33. 02 Aug, 2012 1 commit
    • Jeffrey Lee's avatar
      Fix mutex implementation · 2c8ed4d4
      Jeffrey Lee authored
      Detail:
        c/dwc_common_riscos - Mutex lock/trylock functions had defective logic that would have resulted in them ignoring the lock state of the mutex and claiming it while it was still in use by another thread.
      Admin:
        Tested on Raspberry Pi with high processor vectors
      
      
      Version 0.07. Tagged as 'DWCDriver-0_07'
      2c8ed4d4
  34. 22 Jul, 2012 1 commit
    • Jeffrey Lee's avatar
      Incorporate patch to add support for scheduling of transfers on a per-microframe basis · 153b386d
      Jeffrey Lee authored
      Detail:
        Makefile, dwc/driver/c/dwc_otg_hcd, dwc/driver/c/dwc_otg_hcd_intr, dwc/driver/c/dwc_otg_hcd_queue, dwc/driver/h/dwc_otg_hcd - Adapted the microframe scheduling patch at http://git.denx.de/?p=linux-denx.git;a=commit;h=9796e39e7a513d8a4acde759ec5d0023645143d8 to work with our newer version of the DWC driver. Enabled by SCHEDULE_PATCH #define.
        dwc/driver/c/dwc_otg_hcd_ddma - Fix up descriptor DMA support to compile (but not run properly) when the scheduling patch is active
        dwc/dwc_common_port/h/dwc_os - Provide local_irq_save() and local_irq_restore() implementations, as used by the scheduling patch
      Admin:
        Tested on Raspberry Pi with high processor vectors
        Appears to fix problems with devices becoming unresponsive once too many periodic transfers are active (e.g. too many interrupt pipes open)
      
      
      Version 0.06. Tagged as 'DWCDriver-0_06'
      153b386d
  35. 21 Jul, 2012 1 commit
    • Jeffrey Lee's avatar
      Track latest developments on Raspberry Pi github · c0223aea
      Jeffrey Lee authored
      Detail:
        Makefile, c/cmodule, h/module, dwc/driver/c/dwc_otg_driver, dwc/driver/c/dwc_otg_hcd, dwc/driver/c/dwc_otg_hcd_ddma, dwc/driver/c/dwc_otg_hcd_intr, dwc/driver/c/dwc_otg_hcd_linex, dwc/driver/h/dwc_otg_hcd, dwc/dwc_common_port/c/dwc_common_linux - Track latest developments on Raspberry Pi github. Includes fixes for buffer overruns when unexpectedly receiving too much data, and changes to allow SOF interrupt spam to be reduced.
        c/dwc_common_riscos - Make sure we always round up delay values when converting from msec to csec. Avoids issues with high frequency timers (e.g. SOF re-enable timer) hogging all the CPU time. May be the cause of some other bad behaviour that I've experienced in the past?
      Admin:
        Tested on Raspberry Pi with high processor vectors
        Note - SOF fix is currently disabled, as it was causing too many interrupt packets (e.g. mouse clicks) to be lost. Probable cause is that we're running the SOF re-enable timer at 100Hz instead of 1kHz. May be worth investigating moving all timer/thread scheduling over to a HAL timer which can provide us a 1kHz ticker interrupt.
      
      
      Version 0.05. Tagged as 'DWCDriver-0_05'
      c0223aea
  36. 24 Jun, 2012 1 commit
    • Jeffrey Lee's avatar
      Update to latest code from Raspberry Pi github. Improve debugging. Fix race... · eb6b48ef
      Jeffrey Lee authored
      Update to latest code from Raspberry Pi github. Improve debugging. Fix race condition that could lead to timeout callbacks inappropriately firing.
      
      Detail:
        Makefile, dwc/* - Updated to latest code from Raspberry Pi github. Tweaks specific to Broadcom hardware have been placed in BCM2835 #ifdef's to allow them to easily be identified/controlled if we need the driver to support different SoCs in future
        c/cmodule, c/dwc_common_riscos, c/port, c/softc_device, h/cmodule - Improved debugging code
        c/softc_device - Schedule timeout before starting transfer instead of after. Fixes issue where a transfer that completes inbetween dwc_otg_hcd_urb_enqueue() and callout_reset() would result in the timeout being enabled even though the transfer is already complete
        s/triggercbs - Synced with latest USBDriver version for consistency
      Admin:
        Tested on Raspberry Pi with high processor vectors
        Fixes some, if not all, stability issues
      
      
      Version 0.04. Tagged as 'DWCDriver-0_04'
      eb6b48ef
  37. 15 Jun, 2012 1 commit
    • Jeffrey Lee's avatar
      Add memory barriers to register reads/writes. Reduce frequency of memory allocations. · 5ae117ef
      Jeffrey Lee authored
      Detail:
        s/regaccess - New file containing assembler register access routines, with memory barriers to protect against the BCM2835 AXI bus returning device loads out-of-order
        Makefile, dwc/dwc_common_port/h/dwc_os - Updated to use register access functions instead of inline code
        c/dwc_common_riscos - Added a simple bucket-and-chain data structure to dwc_alloc/dwc_free, to collect free memory blocks and allow them to be reused later, to reduce the load on the heap manager.
      Admin:
        Tested in BCM2835 ROM
      
      
      Version 0.03. Tagged as 'DWCDriver-0_03'
      5ae117ef