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 3E828C433F5 for ; Wed, 22 Dec 2021 09:56:00 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B9F92831D7; Wed, 22 Dec 2021 10:55:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1640166950; bh=Kw95fpL9CP/OUCiRlfCVBF2iQlj50EbKzwEGbpsd0wE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=oAIPtqiHGTniRxV2buQ26NrtZrH5dAitns0GNGFZ1oAKZgOFcgOZtZZmZqKhQfh9E 8LUVNLCBvs5tLV11yZwC2+FTlLDnPqIfmo2T8IfwEkkeK4onDG/P5Sw/GzhynbinYO ECy5kMB7sAWQ4csBqgdKnzQLYHnbt3PcEcZt3WAjXAuRKFz6voXcEMgOb/UPDnwvJs eOSoZjl7GLsz8+hc2JVdKiS10oyLwP3RFbLMI7dO7doyjcCQPTKb1MTM8LKbBzH7qO UcnFf2uWZFoSbojF4KZcXh2v2QUhhx/UZQRzIekRSZGssstBXFwfWFAty2MCakLmk/ 8pxXgZuRhO4vw== Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 884F683027; Wed, 22 Dec 2021 10:55:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1640166934; bh=Kw95fpL9CP/OUCiRlfCVBF2iQlj50EbKzwEGbpsd0wE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fb2Fbc8kLwrbP9SobXj9gvgj9/bGJ/BNCWkhcajw3xFpDcH2GDcg5bd8RsbUn1r0i pRaChHDk5BcoJLoDHiNfOOkKbtl0vqbdk2FnC62QRooZhLmCa9NzvkUTeN4bInXazO dlHwCKVQqopstiH8t3ZrYMtJFfQRAsWcRtJ1fHA0kLsLb3Il5486NCFk7HnteoJreC PoLu4TmeSPQdycOc2uJTCQK/W8pPK/a/w3uxCyHsPJIdKM7TY25RflxNLJzevdmyji 5KPIv681fYGu+eFtA+YRSsW9nVCKs3BlfX7ogYlTLBlquPUzZ+COqUMAKJWEs2CAiG kjbilhZCc7lgw== From: Lukasz Majewski To: u-boot@lists.denx.de, Stefano Babic , Marek Vasut Cc: Lukasz Majewski , "WARNING:Unknown"@denx.de, setting@denx.de, ignore_warnings@denx.de Subject: [PATCH v1 2/4] usb: ehci: Refactor the ehci_mxs_toggle_clock function to be reused with DM Date: Wed, 22 Dec 2021 10:55:07 +0100 Message-Id: <20211222095509.30071-3-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211222095509.30071-1-lukma@denx.de> References: <20211222095509.30071-1-lukma@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean This function is going to be reused with the CONFIG_DM_USB enabled in the imx28 mxs USB ehci driver. No functional changes introduced. Signed-off-by: Lukasz Majewski --- drivers/usb/host/ehci-mxs.c | 42 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/usb/host/ehci-mxs.c b/drivers/usb/host/ehci-mxs.c index 824c620e638..a9d5d58970a 100644 --- a/drivers/usb/host/ehci-mxs.c +++ b/drivers/usb/host/ehci-mxs.c @@ -29,6 +29,27 @@ struct ehci_mxs_port { uint32_t gate_bits; }; +static int ehci_mxs_toggle_clock(const struct ehci_mxs_port *port, int enable) +{ + struct mxs_register_32 *digctl_ctrl = + (struct mxs_register_32 *)HW_DIGCTL_CTRL; + int pll_offset, dig_offset; + + if (enable) { + pll_offset = offsetof(struct mxs_register_32, reg_set); + dig_offset = offsetof(struct mxs_register_32, reg_clr); + writel(port->gate_bits, (u32)&digctl_ctrl->reg + dig_offset); + writel(port->pll_en_bits, (u32)port->pll + pll_offset); + } else { + pll_offset = offsetof(struct mxs_register_32, reg_clr); + dig_offset = offsetof(struct mxs_register_32, reg_set); + writel(port->pll_dis_bits, (u32)port->pll + pll_offset); + writel(port->gate_bits, (u32)&digctl_ctrl->reg + dig_offset); + } + + return 0; +} + static const struct ehci_mxs_port mxs_port[] = { #ifdef CONFIG_EHCI_MXS_PORT0 { @@ -56,27 +77,6 @@ static const struct ehci_mxs_port mxs_port[] = { #endif }; -static int ehci_mxs_toggle_clock(const struct ehci_mxs_port *port, int enable) -{ - struct mxs_register_32 *digctl_ctrl = - (struct mxs_register_32 *)HW_DIGCTL_CTRL; - int pll_offset, dig_offset; - - if (enable) { - pll_offset = offsetof(struct mxs_register_32, reg_set); - dig_offset = offsetof(struct mxs_register_32, reg_clr); - writel(port->gate_bits, (u32)&digctl_ctrl->reg + dig_offset); - writel(port->pll_en_bits, (u32)port->pll + pll_offset); - } else { - pll_offset = offsetof(struct mxs_register_32, reg_clr); - dig_offset = offsetof(struct mxs_register_32, reg_set); - writel(port->pll_dis_bits, (u32)port->pll + pll_offset); - writel(port->gate_bits, (u32)&digctl_ctrl->reg + dig_offset); - } - - return 0; -} - int __weak board_ehci_hcd_init(int port) { return 0; -- 2.20.1