Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E784C46467 for ; Wed, 4 Jan 2023 14:08:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 840E485574; Wed, 4 Jan 2023 15:08:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="Wh1T4/cG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 295FB80A55; Wed, 4 Jan 2023 15:08:26 +0100 (CET) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8AE7F85575 for ; Wed, 4 Jan 2023 15:08:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Sergiu.Moga@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1672841302; x=1704377302; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bI++5uHILEtjb2OMjy94bD4DseGVIFpWTgGYBbSHjAs=; b=Wh1T4/cGylbRPff17KxO0TpoGnKs5rMT7WQ0SBQAKSSuH069tzP42OIj ZioH9jRfMkLsnx1KrS7ZyTr1mu75b81AYbSnqOyk5T6beeZ5CtE5QPtIz ixoevl4TWPHVTRozU/CI7mttMDHednWM1EvPDFE2hhX5FaOBYCm9YngCu 8WYee1x91GSgOH2l2R2kW+onkZB8jF/p4vVhkKCw+Oda2w973VJskchth X1cF+Bzjjv6uvZ9CieDWFrfqtUnSBOhdgugbEvwPAX+IfxdJaGzx4PlZ9 sbPU/PX2u2WGQC9B4J5LRio9wl351345OVbNltahNDPijN82NlZXn7i3b w==; X-IronPort-AV: E=Sophos;i="5.96,300,1665471600"; d="scan'208";a="195388854" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Jan 2023 07:08:21 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 4 Jan 2023 07:08:19 -0700 Received: from ROB-ULT-M68701.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Wed, 4 Jan 2023 07:08:17 -0700 From: Sergiu Moga To: , , , , , , , , , CC: , Mihai Sain Subject: [PATCH v3 3/3] usb: ohci-at91: Add USB PHY functionality Date: Wed, 4 Jan 2023 16:08:07 +0200 Message-ID: <20230104140806.150097-4-sergiu.moga@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104140806.150097-1-sergiu.moga@microchip.com> References: <20230104140806.150097-1-sergiu.moga@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Add the ability to enable/disable whatever USB PHY's are passed to the AT91 OHCI driver through DT. Signed-off-by: Sergiu Moga Tested-by: Mihai Sain --- v1 -> v2: - use *_bulk API's v2 -> v3: - use if (CONFIG_IS_ENABLED(...)) drivers/usb/host/ohci-at91.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 92d0ab7184..171245ef6e 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -73,6 +73,7 @@ int usb_cpu_init_fail(void) #include #include #include "ohci.h" +#include #define AT91_MAX_USBH_PORTS 3 @@ -90,15 +91,32 @@ struct at91_usbh_data { struct ohci_at91_priv { ohci_t ohci; struct clk_bulk clks; + struct phy_bulk phys; }; static int at91_start_clock(struct ohci_at91_priv *ohci_at91) { + if (CONFIG_IS_ENABLED(PHY_MICROCHIP_SAMA7_USB)) { + int ret; + + ret = generic_phy_power_on_bulk(&ohci_at91->phys); + if (ret) + return ret; + } + return clk_enable_bulk(&ohci_at91->clks); } static int at91_stop_clock(struct ohci_at91_priv *ohci_at91) { + if (CONFIG_IS_ENABLED(PHY_MICROCHIP_SAMA7_USB)) { + int ret; + + ret = generic_phy_power_off_bulk(&ohci_at91->phys); + if (ret) + return ret; + } + return clk_disable_bulk(&ohci_at91->clks); } @@ -185,6 +203,16 @@ static int ohci_atmel_probe(struct udevice *dev) if (ret) goto fail; + if (CONFIG_IS_ENABLED(PHY_MICROCHIP_SAMA7_USB)) { + ret = generic_phy_get_bulk(dev, &ohci_at91->phys); + if (ret) + goto fail; + + ret = generic_phy_init_bulk(&ohci_at91->phys); + if (ret) + goto fail; + } + ret = at91_start_hc(dev); if (ret) goto fail; -- 2.34.1