• Masahiro Yamada's avatar
    usb: dwc3: support clocks and resets for DWC3 core · fe8abf33
    Masahiro Yamada authored
    Historically, the clocks and resets are handled on the glue layer
    side instead of the DWC3 core.  For simple cases, dwc3-of-simple.c
    takes care of arbitrary number of clocks and resets.  The DT node
    structure typically looks like as follows:
    
      dwc3-glue {
              compatible = "foo,dwc3";
              clocks = ...;
              resets = ...;
              ...
    
              dwc3 {
                      compatible = "snps,dwc3";
                      ...
              };
      }
    
    By supporting the clocks and the reset in the dwc3/core.c, it will
    be turned into a single node:
    
      dwc3 {
              compatible = "foo,dwc3", "snps,dwc3";
              clocks = ...;
              resets = ...;
              ...
      }
    
    This commit adds the binding of clocks and resets specific to this IP.
    The number of clocks should generally be the same across SoCs, it is
    just some SoCs either tie clocks together or do not provide software
    control of some of the clocks.
    
    I took the clock names from the Synopsys datasheet: "ref" (ref_clk),
    "bus_early" (bus_clk_early), and "suspend" (suspend_clk).
    
    I found only one reset line in the datasheet, hence the reset-names
    property is omitted.
    
    Those clocks are required for new platforms.  Enforcing the new
    binding breaks existing platforms since they specify clocks (and
    resets) in their glue layer node, but nothing in the core node.
    I listed such exceptional cases in the DT binding.  The driver
    code has been relaxed to accept no clock.  This change is based
    on the discussion [1].
    
    I inserted reset_control_deassert() and clk_bulk_enable() before the
    first register access, i.e. dwc3_cache_hwparams().
    
    [1] https://patchwork.kernel.org/patch/10284265/Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
    Reviewed-by: default avatarRob Herring <robh@kernel.org>
    Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
    fe8abf33
core.h 44.5 KB