From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id F2AFE1BF3DB for ; Sun, 4 Nov 2018 10:50:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id EF0C02305A for ; Sun, 4 Nov 2018 10:50:13 +0000 (UTC) Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Kjm63EGdhKud for ; Sun, 4 Nov 2018 10:50:13 +0000 (UTC) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by silver.osuosl.org (Postfix) with ESMTPS id F2A5523026 for ; Sun, 4 Nov 2018 10:50:12 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id r63-v6so5536604wma.4 for ; Sun, 04 Nov 2018 02:50:12 -0800 (PST) From: Sergio Paracuellos Subject: [PATCH v6 11/33] staging: mt7621-pci: factor out 'mt7621_enable_phy' function Date: Sun, 4 Nov 2018 11:49:37 +0100 Message-Id: <1541328599-18396-12-git-send-email-sergio.paracuellos@gmail.com> In-Reply-To: <1541328599-18396-1-git-send-email-sergio.paracuellos@gmail.com> References: <1541328599-18396-1-git-send-email-sergio.paracuellos@gmail.com> List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" To: gregkh@linuxfoundation.org Cc: neil@brown.name, driverdev-devel@linuxdriverproject.org Factor out a new function 'mt7621_enable_phy' for enabling the pcie phy for each port and call it from 'mt7621_pcie_enable_port'. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index 5dce7af..7e76d30 100644 --- a/drivers/staging/mt7621-pci/pci-mt7621.c +++ b/drivers/staging/mt7621-pci/pci-mt7621.c @@ -387,6 +387,14 @@ set_phy_for_ssc(struct mt7621_pcie_port *port) pcie_write(pcie, val, offset); } +static void mt7621_enable_phy(struct mt7621_pcie_port *port) +{ + /* MT7621 E2 */ + if ((*(unsigned int *)(0xbe00000c) & 0xFFFF) == 0x0101) + bypass_pipe_rst(port); + set_phy_for_ssc(port); +} + static void setup_cm_memory_region(struct resource *mem_resource) { resource_size_t mask; @@ -565,6 +573,8 @@ static int mt7621_pcie_enable_port(struct mt7621_pcie_port *port) pcie_write(pcie, val, RALINK_PCI_PCIMSK_ADDR); } + mt7621_enable_phy(port); + return 0; } @@ -652,9 +662,6 @@ static int mt7621_pci_probe(struct platform_device *pdev) dev_err(dev, "enabling port %d failed\n", slot); list_del(&port->list); } else { - if ((*(unsigned int *)(0xbe00000c) & 0xFFFF) == 0x0101) // MT7621 E2 - bypass_pipe_rst(port); - set_phy_for_ssc(port); val = read_config(pcie, slot, 0x70c); dev_info(dev, "Port %d N_FTS = %x\n", (unsigned int)val, slot); } -- 2.7.4 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel