07 Jun, 2015

1 commit

  • DTO/DCRC errors were not being informed to the mmc core since
    commit ae4bf788ee ("mmc: omap_hsmmc: consolidate error report handling of
    iHSMMC IRQ"). This commit made sure 'end_trans' is never set on DTO/DCRC
    errors. This is because after this commit 'host->data' is checked after
    it has been cleared to NULL by omap_hsmmc_dma_cleanup().

    Because 'end_trans' is never set, omap_hsmmc_xfer_done() is never invoked
    making core layer not to be aware of DTO/DCRC errors. Because of this
    any command invoked after DTO/DCRC error leads to a hang.

    Fix this by checking for 'host->data' before it is actually cleared.

    Fixes: ae4bf788ee ("mmc: omap_hsmmc: consolidate error report handling of
    iHSMMC IRQ")

    Reported-by: Yan Liu
    Tested-by: Yan Liu
    Signed-off-by: Kishon Vijay Abraham I
    Signed-off-by: Sekhar Nori

    Kishon Vijay Abraham I
     

29 May, 2015

2 commits

  • We can't rely just on dr_mode to decide if we're in host or gadget
    mode when we're configured as otg/dual-role. So while dr_mode is
    OTG, we find out from the otg state machine if we're in host
    or gadget mode and take the necessary actions during suspend/resume.

    Also make sure that we disable OTG irq and events during system suspend
    so that we don't lockup the system during system suspend/resume.

    Known Issue:
    when otg-host, usb device disconnects and reconnects after system suspend/resume.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • There is a race happening during dwc3_drd_init() that causes
    otg events to get disabled. This is what happens.

    dwc3_otg_irq() happens immediately when PRTCAP is set to OTG,
    even though OEVTEN is 0. This is because BIT 31 IRQ of
    OEVT can't be disabled by OEVTEN.
    We configure OEVTEN in dwc3_otg_init() but dwc3_otg_irq() has
    already saved OEVTEN as 0 into dwc->oevten. So finally when
    dwc3_irq_thread_irq() is called we save 0 into OEVTEN
    thus disabling OTG irqs forever.

    We fix this by disabling IRQs when configuring OEVTEN in
    dwc3_otg_init().

    eviewed-by: Felipe Balbi
    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     

26 May, 2015

2 commits

  • commit 5fa63bd959 (usb: xhci: Fix suspend/resume when used
    with OTG core) removes assigning xhci->main_hcd from xhci_gen_setup
    and adds it in the probe of xhci-plat and xhci-pci.

    In the case of xhci-pci, xhci_mem_init is invoked before main_hcd is
    initialized in the probe causing a null pointer deferencing error.

    Fix it by initializing xhci->main_hcd in xhci_gen_setup and removing
    it from xhci_pci_probe().

    Fixes: 5fa63bd959cc ("usb: xhci: Fix suspend/resume when used with OTG core")
    Acked-by: Roger Quadros
    Signed-off-by: Kishon Vijay Abraham I
    Signed-off-by: Sekhar Nori

    Kishon Vijay Abraham I
     
  • CONFIG_USB_OTG_WHITELIST is to be enabled for compliance to OTG
    specification. However, on TI SoCs, we only support/test USB
    dual-role device, not the full OTG specification.

    Moreover, with CONFIG_USB_OTG_WHITELIST enabled, on AM335x
    beaglebone black, on connecting a USB webcam we get:

    [ 74.960459] musb-hdrc musb-hdrc.1.auto: otg: usb_otg_kick_fsm: invalid host/gadget device
    [ 75.080228] usb 1-1: new high-speed USB device number 4 using musb-hdrc
    [ 75.270151] usb 1-1: device v03f0 pa707 is not supported
    [ 75.275670] hub 1-0:1.0: unable to enumerate USB device on port 1

    This is because kernel refuses to enumerate peripherals which
    are not listed in kernel's OTG whitelist. This is needed for
    full compliance with OTG specification.

    Disable CONFIG_USB_OTG_WHITELIST since we support only dual-role
    device and do not need to reject non-whitelisted devices during
    enumeration.

    Suggested-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Sekhar Nori
     

18 May, 2015

3 commits


14 May, 2015

2 commits

  • Multiple failures are seemed to be caused by 8250 DMA:
    * board crash due to dma errors if it is suspended while crypto
    operations are in progress
    * edma unmanaged events errors caused nand write failures during
    suspend
    * board aborts suspend sequence due to late interrupt generated by
    presumably uart dma

    So disable it to have a more stable system.

    Signed-off-by: Carlos Hernandez

    Carlos Hernandez
     
  • The extcon us gpio driver requests id and vbus gpios during
    probe. This could fail with -EPROBE_DEFER in case the gpiochip
    that has the specific gpio pin is not initialised. For eg: the
    gpiochip could be an i2c client and is not probed at the time that
    the extcon driver gets probed.

    Propagating the EPROBE_DEFER error lets the extcon driver probe
    function to be called again until it succeeds or error out with
    something other than EPROBE_DEFER.

    Acked-by: Roger Quadros
    Signed-off-by: Subramaniam Chanderashekarapuram
    [nsekhar@ti.com: move EPROBE_DEFER check inside IS_ERR() check]
    Signed-off-by: Sekhar Nori

    Subramaniam Chanderashekarapuram
     

13 May, 2015

5 commits

  • When hardware and software timer are used simultaneously there
    are instances where both will trigger timeout interrupt to MMC
    core and also instances where any of them provide any timeout
    to MMC core which results in MMC core kernel task to hung
    infinitely.

    Instead of using software timeout only for larger delays requested
    when using HS200/SDR104 cards which results in hardware and
    software timer race conditions, so move all the timeout request
    to use software timer when HS200/SDR104 card is connected and
    use hardware timer when other type cards are connected.

    Also start the software timer after queueing to DMA to ensure
    we are more likely to expire within correct limits. To be ever
    more sure that we won't expire this soft timer too early, we're
    adding a 1000000ns slack to the data timeout requested by the
    upper layer.

    Fixes: d029ff6f ("mmc: host: omap_hsmmc: add software timer when timeout greater than hardware capablility")
    Suggested-by: Felipe Balbi
    Signed-off-by: Mugunthan V N
    Signed-off-by: Sekhar Nori

    Mugunthan V N
     
  • When SATA is used by u-boot and not powered down correctly *and*
    if AHCI_PLATFORM is m, clock auto-disable will kick in
    and disable sata_refclk thus causing Errata i783 and breaking SATA.

    Since we can't guarantee what's done in u-boot, we take a safe approach by
    keeping the sata_refclk ON in pipe3 probe so that it doesn't get auto-disabled
    by the kernel. We keep track of this with the sata_refclk_enabled flag
    and do an additional disable in ti_pipe3_disable_refclk() when needed.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • The pcf compatible field for i2c client 1 at slave address 21 should
    be nxp,pcf8575 and not ti,pcf8575. Fix the same.

    Signed-off-by: Subramaniam Chanderashekarapuram
    Signed-off-by: Sekhar Nori

    Subramaniam Chanderashekarapuram
     
  • We don't want leave any pending timers if we're
    going into suspend or removing the MMC driver.

    Signed-off-by: Felipe Balbi
    Signed-off-by: Mugunthan V N
    Signed-off-by: Sekhar Nori

    Felipe Balbi
     
  • that's a nicer way of using the timer API.

    Signed-off-by: Felipe Balbi
    Signed-off-by: Mugunthan V N
    Signed-off-by: Sekhar Nori

    Felipe Balbi
     

12 May, 2015

3 commits


08 May, 2015

2 commits

  • SATA_PLL_SOFT_RESET bit of CTRL_CORE_SMA_SW_0 must be toggled
    between a SATA DPLL unlock and re-lock to prevent SATA lockup.

    Introduce a new DT parameter 'syscon-pllreset' to provide the syscon
    regmap access to this register which sits in the control module.

    If the register is not provided we fallback to the old behaviour
    i.e. SATA DPLL refclk will not be disabled and we prevent SoC low
    power states.

    NOTE: If SATA is enabled in u-boot will break if AHCI_PLATFORM is m
    as kernel clock autodisable kicks in and u-boot hadn't disabled
    SATA correctly. We can't do anything about this in the kernel
    and u-boot must be fixed.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • This register is required to be passed to the SATA PHY
    driver to workaround errata i783 - SATA Lockup After SATA DPLL Unlock/Relock.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     

05 May, 2015

20 commits

  • [ Upstream commit 90bdf403db4ca75ee60ca5a760dc342cef96b5e1 ]

    The driver was recently adapted to a core API change, but the
    change was incomplete, missing out the suspend helper and
    leaving an extraneous local variable around:

    usb/phy/phy-mv-usb.c: In function 'mv_otg_update_state':
    usb/phy/phy-mv-usb.c:341:18: warning: unused variable 'phy' [-Wunused-variable]

    usb/phy/phy-mv-usb.c: In function 'mv_otg_suspend':
    usb/phy/phy-mv-usb.c:861:16: error: 'struct usb_phy' has no member named 'state'

    Signed-off-by: Arnd Bergmann
    Fixes: e47d92545c297 ("usb: move the OTG state from the USB PHY to the OTG structure")
    Signed-off-by: Felipe Balbi
    Signed-off-by: Sekhar Nori

    Arnd Bergmann
     
  • The rx_running flag should show if DMA is currently active. However
    there is a window between when the flag is set/cleared and when
    the DMA is started/stopped. Because the flag is queried from both
    hard and soft irq contexts, the driver can make incorrect
    decisions and do things like start a DMA transfer using a buffer
    that is already setup to be used for a DMA transfer.

    This patch adds a spinlock to synchronize the rx_running flag and
    close the above mentioned window.

    Signed-off-by: John Ogness
    Signed-off-by: Sekhar Nori

    John Ogness
     
  • [ Upstream commit d560fed6abe0f9975b509e4fb824e08ac19adc93 ]

    Required for moving drivers to the nanosecond based interfaces.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: John Stultz
    Signed-off-by: Felipe Balbi
    Signed-off-by: Sekhar Nori

    Thomas Gleixner
     
  • We support dual-role via CONFIG_USB_OTG so enable it.
    Switch from EXTCON_GPIO to EXTCON_USB_GPIO as we've moved
    to using the new driver for USB.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • commit 33b23a79d28c (arm: boot: dts: am437x-sk: add missing USB pins)
    mistakenly added a wrong pinctrl address for usb2_phy2_pins.
    This looks like a copy paste error as it is the address of usb2_phy1_pins.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • USB1 port is micro-AB type and can function as peripheral
    as well as host. Enable dual-role mode for USB1.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • Gdget controller might not be always active during suspend/
    resume when we are operating in dual-role/otg mode.
    Check if we're active and only if we are then perform
    necessary actions during suspend/resume.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • Without this we loose OTG controller register context and malfunction
    after a system suspend-resume.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • If the ID pin event is not available over extcon
    then we rely on the OTG controller to provide us ID and VBUS
    information.

    We still don't support any OTG features but just
    dual-role operation.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • Add OTG and GHWPARAMS6 register definitions

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • Now that we have dual-role support working at USB core,
    enable dual-role support for usb1 controller.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • Register with the USB OTG core. Since we don't support
    OTG yet we just work as a dual-role device even
    if device tree says "otg".

    Use extcon framework to get VBUS/ID cable events and
    kick the OTG state machine.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • This is the a_set_b_hnp_enable flag in the OTG state machine
    diagram and must be set when the A-Host has successfully set
    the b_hnp_enable feature of the OTG-B-Peripheral attached to it.

    When this bit changes we kick our OTG FSM to make note of the
    change and act accordingly.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • DRD mode is a reduced functionality OTG mode. In this mode
    we don't support SRP, HNP and dynamic role-swap.

    In DRD operation, the controller mode (Host or Peripheral)
    is decided based on the ID pin status. Once a cable plug (Type-A
    or Type-B) is attached the controller selects the state
    and doesn't change till the cable in unplugged and a different
    cable type is inserted.

    As we don't need most of the complex OTG states and OTG timers
    we implement a lean DRD state machine in usb-otg.c.
    The DRD state machine is only interested in 2 hardware inputs
    'id' and 'vbus; that are still passed via the origintal struct otg_fsm.

    Most of the usb-otg.c functionality remains the same except
    adding a new parameter to usb_otg_register() to indicate that
    the OTG controller needs to operate in DRD mode.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • we need to unlock the usb_lock mutex before calling
    usb_otg_register_gadget() else it will cause a
    circular locking dependency.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • The OTG state machine needs a mechanism to start and
    stop the gadget controller. Add usb_gadget_start()
    and usb_gadget_stop().

    Register with OTG core when gadget function driver
    is available and unregister when function driver is unbound.

    Ignore softconnect sysfs control when we're in OTG
    mode as OTG FSM takes care of gadget softconnect using
    the b_bus_req mechanism.

    Signed-off-by: Roger Quadros
    [nsekhar@ti.com: sparse warning fix]
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • The existing usb_add/remove_hcd() functionality
    remains unchanged for non-OTG devices. For OTG
    devices they only register the HCD with the OTG core.

    Introduce usb_otg_add/remove_hcd() for use by OTG core.
    These functions actually add/remove the HCD.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • The OTG core instantiates the OTG Finite State Machine
    per OTG controller and manages starting/stopping the
    host and gadget controllers based on the bus state.

    It provides APIs for the following tasks

    - Registering an OTG capable controller
    - Registering Host and Gadget controllers to OTG core
    - Providing inputs to and kicking the OTG state machine

    TODO:
    - sysfs interface to allow application inputs to OTG state machine
    - otg class?

    Signed-off-by: Roger Quadros
    [nsekhar@ti.com: remove unused if() block in usb_otg_work() and sparse fixes]
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • The OTG core will use struct otg_gadget_ops to
    start/stop the gadget controller.

    The main purpose of this interface is to avoid directly
    calling usb_gadget_start/stop() from the OTG core as they
    wouldn't be defined in the built-in symbol table if
    CONFIG_USB_GADGET is m.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros
     
  • The OTG core will use struct otg_hcd_ops to
    add/remove the HCD controller.

    The main purpose of this interface is to avoid directly
    calling usb_add/remove_hcd() from the OTG core as they
    wouldn't be defined in the built-in symbol table if
    CONFIG_USB is m.

    Signed-off-by: Roger Quadros
    Signed-off-by: Sekhar Nori

    Roger Quadros