From patchwork Thu Apr 26 10:20:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 904964 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="jkAmzfN1"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40WtQd4zRwz9ry1 for ; Thu, 26 Apr 2018 20:21:45 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 42DFFC22036; Thu, 26 Apr 2018 10:21:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 6214DC2205F; Thu, 26 Apr 2018 10:20:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4D974C22040; Thu, 26 Apr 2018 10:20:40 +0000 (UTC) Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by lists.denx.de (Postfix) with ESMTPS id 48677C21F9A for ; Thu, 26 Apr 2018 10:20:37 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id p6so17944334pfn.4 for ; Thu, 26 Apr 2018 03:20:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Tk/S7PftCFFkiTXDQhxIaxjs3Fk4lKzG54YwbTIjebQ=; b=jkAmzfN1OjNY2SGs5bhwCoZ/m/mfiu5dfQ5iHY4f+uWMxBdq+LxYQQUIbwWZecMF1Z xcxOz3HI02RzHZEloPhpNrI30sAs+9ozoDk/lH2W0GjaoL5ewaVtdsRjwjZJV9EC5QFF J3XIeupcZbzAMxpJlUXE664PanD7fumD+kMH8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Tk/S7PftCFFkiTXDQhxIaxjs3Fk4lKzG54YwbTIjebQ=; b=bTulLvJ6xKyyqlt4NCNCuOcJ/v+Nyqt9RLRhFVTb7Xk00Zt7fysM3XsP/86yfKj8I/ pnK1pXOxWfoy0Zy0C8RdHuJFpjHg3a9GfJWoAFLtfjN2ZK3xHYZYk0sglw6PwvvruEYw 6bW0tI+ZXheXDEiRqlfv3jjMAfqSBR65Ar4GZzkVjem8dC3+hRnDufLAxScanuETO9s7 ccUlCPD+43n/2sPYE1aPtkEcgsl+wZr3qQvyEZlY/JrYZTkC+wCYugwBfB/yD8ay349u Tr2mdZmwiqhHqx9Uha/aQpaBtfZXiqV9V2qfVENgPPbRIcQVYkkXPiaW4hSjfCT0UL4S Ef8A== X-Gm-Message-State: ALQs6tDXmxlXbLzfqLubHh45G97TXRcOlhyHF3hd0qQ3PGHpPlq6fxOB mAE7YvjjZWlanMJIie1VHX6/cm/+0I8= X-Google-Smtp-Source: AIpwx49bbWCCv/dEO0L/lU2u/nVvH4W1LIw/IH7EDX0QvaX2kAEIdv1s9ZE5VD/P7Pp5yGkjLx+S/Q== X-Received: by 10.98.209.92 with SMTP id t28mr19492368pfl.148.1524738035596; Thu, 26 Apr 2018 03:20:35 -0700 (PDT) Received: from localhost.localdomain ([183.82.229.182]) by smtp.gmail.com with ESMTPSA id e87sm36338336pfl.65.2018.04.26.03.20.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Apr 2018 03:20:35 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Date: Thu, 26 Apr 2018 15:50:17 +0530 Message-Id: <20180426102020.31058-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180426102020.31058-1-jagan@amarulasolutions.com> References: <20180426102020.31058-1-jagan@amarulasolutions.com> Cc: Maxime Ripard Subject: [U-Boot] [PATCH v6 06/34] musb: sunxi: Add OTG device clkgate and reset for H3/H5 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add OTG device clkgate and reset for H3/H5 through driver_data. Signed-off-by: Jagan Teki --- Changes for v6: - split previous version patch and add only relevant changes. drivers/usb/musb-new/sunxi.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c index af0dbc5a20..e79d7a2774 100644 --- a/drivers/usb/musb-new/sunxi.c +++ b/drivers/usb/musb-new/sunxi.c @@ -78,6 +78,8 @@ struct sunxi_musb_config { struct musb_hdrc_config *config; + u8 rst_bit; + u8 clkgate_bit; }; struct sunxi_glue { @@ -275,9 +277,16 @@ static int sunxi_musb_init(struct musb *musb) musb->isr = sunxi_musb_interrupt; setbits_le32(&glue->ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_USB0); + if (glue->cfg->clkgate_bit) + setbits_le32(&glue->ccm->ahb_gate0, + 1 << glue->cfg->clkgate_bit); #ifdef CONFIG_SUNXI_GEN_SUN6I setbits_le32(&glue->ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_USB0); + if (glue->cfg->rst_bit) + setbits_le32(&glue->ccm->ahb_reset0_cfg, + 1 << glue->cfg->rst_bit); #endif + sunxi_usb_phy_init(0); USBC_ConfigFIFO_Base(); @@ -408,8 +417,14 @@ static int musb_usb_remove(struct udevice *dev) sunxi_usb_phy_exit(0); #ifdef CONFIG_SUNXI_GEN_SUN6I clrbits_le32(&glue->ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_USB0); + if (glue->cfg->rst_bit) + clrbits_le32(&glue->ccm->ahb_reset0_cfg, + 1 << glue->cfg->rst_bit); #endif clrbits_le32(&glue->ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_USB0); + if (glue->cfg->clkgate_bit) + clrbits_le32(&glue->ccm->ahb_gate0, + 1 << glue->cfg->clkgate_bit); free(host->host); host->host = NULL; @@ -423,6 +438,8 @@ static const struct sunxi_musb_config sun4i_a10_cfg = { static const struct sunxi_musb_config sun8i_h3_cfg = { .config = &musb_config_h3, + .rst_bit = 23, + .clkgate_bit = 23, }; static const struct udevice_id sunxi_musb_ids[] = {