From patchwork Thu Dec 6 07:35:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10715383 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C251413AF for ; Thu, 6 Dec 2018 07:36:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A356F2E51D for ; Thu, 6 Dec 2018 07:36:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 919B42E057; Thu, 6 Dec 2018 07:36:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DA6422E057 for ; Thu, 6 Dec 2018 07:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ICK7ze1rKidGFNbyVcb2e+XrdrKfg7q4rlyMiMyOZpQ=; b=r0p9DW9ESbzNU2 z54kMr3nD1n94mpKH6X2EKCWDK6T/08cdRE/cRvBQxooEN4KayPI4FFYJmhQLxYCboBX5FyKdag8x Ua2pPRfQ2mel5x/4E9enAkHi+WFJOVUuruBGZhFFifNO5Y35WqI9oj65AkupMr2Ivo9TqOp872Key Gnp3NaR+LB8x/cc3NPT0e1eO3DTML5k/0Wcd4U1N3ooDSrv+yuURhU4wvsv+bBsk1K4bgsAD7teFI QXpKGqK8ZVqUKG53Wj2YBHiy9C9g0g16iWsdB7RK1zPEo19Pc1SCY4L44gHM7aFEBa9Fcktk7TGaT FZO6k0VmM2BirxtzZlEQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUoCr-0000k9-Py; Thu, 06 Dec 2018 07:36:21 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUoCd-0000Ws-2x for linux-arm-kernel@lists.infradead.org; Thu, 06 Dec 2018 07:36:11 +0000 Received: by mail-pl1-x641.google.com with SMTP id k8so11371042pls.11 for ; Wed, 05 Dec 2018 23:35:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xhmO+XhPFCrEZH1UNrvz+XUznHtfpXBiia+w2KZHgv4=; b=UjnFXN8nfAq1misbRlHq/onwF2OICWLCOF51zSdfis73UyQ+GToJqPdY0fv+WbHQxa 2p3+AHCDec0Scn9g4V/i3DevTv4+hCIIUlbIUbjjs5xgIyY3x3iUT2RMyV2TKlzDYMGJ b9rBEpgcLq5bkCks3rkLJFdC2H96alSVB5SxIm75f49vcIrZf653iC72QLLtyu01h45k mwW8lZihqWaIHi/HvmOcbKhQFmXFu6oAQYQck/DtSraaN0eK6LAY894B0Oujd5XC9DKw P5KAu/+nm30iwGDZcsnNO6fjAJtBCkbTT3pQbjo+XYAjfEdYeqcE1mtJ7omsIOElJHtt fy4Q== 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:mime-version:content-transfer-encoding; bh=xhmO+XhPFCrEZH1UNrvz+XUznHtfpXBiia+w2KZHgv4=; b=LhLU/ZLFqEzHZO9cRYsOhrhd4ZN/CtJqWlMh8laDtbzK0NLG55d4DjOKxJ+ofazA7T XmYL5fMPRpFjCSbV+N/4ODLVcUJ9ojYgND5StweuLg9vrz4MYhN3cYyTfiiZ3x8K0Jxu azceQzKTGAakZig6jMZj+B8qSp/CMW7CoI+ZNHfbRVb6sL9pGvk8C8LCuNSgO6mHbtxx LV35xM8nOuknyrf1NYE5ME8ZjqcnxgNavCPmZJ1X7dyYUUoV9NNAYjJoy9AQ1m2hrTic lo7EvCLZf60+LiiOFGS//QO1VQKLkv4gSFOr4Cvba10/vJZDW5s2wKNpdIiaTONGkokZ BDdw== X-Gm-Message-State: AA+aEWY0WHNPwdS1xwBFawolGjnMLbQRF2E6JQ1O5tjpZ+G827qcMCtO 9yGrB4G8tZvwp1x8C7vZloiyia2m X-Google-Smtp-Source: AFSGD/XwXi34Srl8/oY5Xn5iOrn3FO3++GlIOQegmwiONK7Hhbc3+2QRpbcHgmEGMCBHOCBtDO2+jQ== X-Received: by 2002:a17:902:a710:: with SMTP id w16mr26670156plq.95.1544081755408; Wed, 05 Dec 2018 23:35:55 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id v15sm33035894pfn.94.2018.12.05.23.35.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Dec 2018 23:35:54 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 1/3] PCI: imx: No-op imx6_setup_phy_mpll() on i.MX7D Date: Wed, 5 Dec 2018 23:35:43 -0800 Message-Id: <20181206073545.10967-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181206073545.10967-1-andrew.smirnov@gmail.com> References: <20181206073545.10967-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181205_233607_122468_7E67CDA8 X-CRM114-Status: GOOD ( 12.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Richard Zhu , linux-arm-kernel@lists.infradead.org, Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com, bhelgaas@google.com, Leonard Crestez , cphealy@gmail.com, l.stach@pengutronix.de Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP PCIE PHY IP block on i.MX7D differs from the one used on i.MX6 family, so none of the code in current implementation of imx6_setup_phy_mpll() is applicable. Cc: bhelgaas@google.com Cc: Fabio Estevam Cc: cphealy@gmail.com Cc: l.stach@pengutronix.de Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Tested-by: Trent Piepho Signed-off-by: Andrey Smirnov Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 2cbef2d7c207..c140f7987598 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -525,6 +525,9 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) int mult, div; u32 val; + if (imx6_pcie->variant == IMX7D) + return 0; + switch (phy_rate) { case 125000000: /* From patchwork Thu Dec 6 07:35:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10715385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F9AB13AF for ; Thu, 6 Dec 2018 07:36:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BACC2E057 for ; Thu, 6 Dec 2018 07:36:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F1D52E631; Thu, 6 Dec 2018 07:36:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D76A92E057 for ; Thu, 6 Dec 2018 07:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bp461rKOvLrwFLzDscklOYCeQHrbUGWJH/q8ZUjVBK8=; b=bbQKFIbvg6DjwZ H7Zr3ya2LuFx1pHedArYATGMRfZ866djfuHcynHN6fOb9Js0ADMFApP7x0QGiSUXoFCfmMgHaLu12 q9Nc3Zix0+WxkQqRN3bcyimUobdk/PzLmY5dnTMXUpcjCEPTMaJQ3GdjrVKkRPguN0/NsIkrjfbcP esaPFJViwMkgtd1Xhbbu6UKaWW2EhFZ0MNoVYt/ftN4T5AmztbZB5yx2lL9IUdsT1qpMLUN+fSuSg EKVgcwh8SrRt+72P+YYXym+gNwIIiYvN3gywOSD2vS7fCC8Pb3jtpSAfxoYZGtYg/piEqaKr1nw3P oCgiT+fyB25QsAaWitOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUoD4-0000yI-Ud; Thu, 06 Dec 2018 07:36:35 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUoCe-0000X7-6e for linux-arm-kernel@lists.infradead.org; Thu, 06 Dec 2018 07:36:12 +0000 Received: by mail-pg1-x544.google.com with SMTP id t13so10235177pgr.11 for ; Wed, 05 Dec 2018 23:35:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rr95nKWuiBKL9zj7ZRZZsfvYCE/2bA6VDwAU3HZE0ss=; b=q6NliBIOs7fYEWBDM0uB2PcJ8j5oxCac/VLQ/MYHoSPFT/e7kWzbM/2tPjh53qLUH4 uu6j6p2IH71/FLH8irPa1ml0WUWJBr7P9GjeUH3n7GRSi2eT1Y34Au9/4NwBPk6n61V1 yE6PuXCQxBmj6VUP4qNZkBMEToayNfNadl4Tn7+gPSYMTMZbsngK3lLQH4avJ8fdnna0 xneZ+xxnvzNCzwSX7ZPZ4jJKag82dA5F/DZIhSI9wxV/RGsG1yKLa2cB9/FZMBt0v5VF TYuKh+oMk2KTKYmQLwWZdEHISNiolEeIa5Xs/duzzd7SB8h7m9JaRuJUzWHKvVMUgGUy Lagw== 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:mime-version:content-transfer-encoding; bh=Rr95nKWuiBKL9zj7ZRZZsfvYCE/2bA6VDwAU3HZE0ss=; b=qqH/ML0Dua4IajH5DKlNKd3Xy5/nBwcDZ4vQ+8aJmTSEZ7mckMDezd5Z8xFVqSuedJ q5PeoWewaLQAWp4PkUTp4IUr2wgjp7W2Qbyl8zewTrOPs18ulmrmm+fP8h6o+OkCtaeU sWcxAeXMca5KWRpWpa+Gv8qQ4EnaYsxa0yarpicKk4o2TFprNETIF5ejiIPdareKfSV0 1p2IOUIDnLbmLSCQUxuIkv/wQCwk3l+2C6FX4wbYf6tmeaYQua+L598APHf0vKdnPw9N CYBUIc0D2+KQs5fisalsXVh4eblFvWOwIOEgAMZthldnnhoQXJ8ocQD7iLGIEIibDsuw okIw== X-Gm-Message-State: AA+aEWbDdWoR171by1tqXF4OQkFHpCSl6w3cV8MTCYTnfiEZEV6y1ft7 ZMty932n46ZFDdM7cacX4Yg= X-Google-Smtp-Source: AFSGD/Uj+Z4hxzshIa52t3yofWiY0beMqFci5+lTEddAfHdRvJb/ul6Jt1iEqifzbsgwGNZeHoAwQg== X-Received: by 2002:a63:588:: with SMTP id 130mr22895466pgf.273.1544081757518; Wed, 05 Dec 2018 23:35:57 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id v15sm33035894pfn.94.2018.12.05.23.35.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Dec 2018 23:35:56 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 2/3] PCI: imx: No-op imx6_pcie_reset_phy() on i.MX7D Date: Wed, 5 Dec 2018 23:35:44 -0800 Message-Id: <20181206073545.10967-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181206073545.10967-1-andrew.smirnov@gmail.com> References: <20181206073545.10967-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181205_233608_239321_B509B848 X-CRM114-Status: GOOD ( 12.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Richard Zhu , linux-arm-kernel@lists.infradead.org, Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com, bhelgaas@google.com, Leonard Crestez , cphealy@gmail.com, l.stach@pengutronix.de Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP PCIE PHY IP block on i.MX7D differs from the one used on i.MX6 family, so none of the code in current implementation of imx6_pcie_reset_phy() is applicable. Cc: bhelgaas@google.com Cc: Fabio Estevam Cc: cphealy@gmail.com Cc: l.stach@pengutronix.de Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Tested-by: Trent Piepho Signed-off-by: Andrey Smirnov Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index c140f7987598..3c3002861d25 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -245,6 +245,9 @@ static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) { u32 tmp; + if (imx6_pcie->variant == IMX7D) + return; + pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); tmp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN | PHY_RX_OVRD_IN_LO_RX_PLL_EN); From patchwork Thu Dec 6 07:35:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10715387 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8FA5417D5 for ; Thu, 6 Dec 2018 07:41:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C99B2E80F for ; Thu, 6 Dec 2018 07:41:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FDF72E7FC; Thu, 6 Dec 2018 07:41:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 463F42E7FC for ; Thu, 6 Dec 2018 07:40:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FOEpPD667C9ozh18eCDgwGAlk7g4dtkz041z7bVWc5Y=; b=DTxuJDDLUt89Av LkTmeCgOf4r3ViFwmxBwUNt0Xy0w2Rdq9lOYJ6ZZfE4BfVAlyOOgXcodZMyoPvJ+vxQYiWIfDZ8zt tkc/hOMzPfV/0xF65LLVS84x0XgtYvHnQbVhwkv19QpEoqXLjsRIMRBoEIpES4DruRKGLONNhq230 NmTaaPErZxmpgqmScVoCbW9qvf187GY5/aAj/C4d8K31lQ9dk5aS+QbfCA25qs+83R5X0GMRmUU5g hModYneE86FHdydbnzduaSLtiF6SZ3eDDRpgVjdxltsluW0CNFoPIkLcUQ/9n7GiQF1i0sH/jxxWM kB0AP0ZGirwx4fZxnqyQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUoHC-0003K6-Tp; Thu, 06 Dec 2018 07:40:50 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUoCg-0000X9-AR for linux-arm-kernel@lists.infradead.org; Thu, 06 Dec 2018 07:36:18 +0000 Received: by mail-pl1-x644.google.com with SMTP id e5so11383451plb.5 for ; Wed, 05 Dec 2018 23:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JsopjK7zH4q0Nw3Raq1i3v5Oy+hMRXGd6aNhJXLKDOo=; b=Zx0QwkvGqWvYleO5YxHykENoT/IEMpl+za83/8wJymnkSutF939Yo4l7ViwUNF0kwS IEJ0i7P860TG6PDGERo4b9fIUAKbDlE8CJ3DGRL9oKhmibtsqKxtrATGoJpXOvi+FJ4X vQQxOMkOsL8lJV8mFw/8AqmCYcH/Yn6tJgLTFFUG2n5CvfL846rczzdrzVOVjJK1vRgp P5F9ZR4V7lrd1meBqHXwS2vtVP5qdfrHaXWyKwGYVQUaneFze0nlY9DkAghiX3d8jPyG mMS0y61HGb3joqMEcgWjrcJjce7bhf/TIMh8g+fOOzvUmhCiOB4+CzHhWeNVQ7fNCGXS rn6Q== 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:mime-version:content-transfer-encoding; bh=JsopjK7zH4q0Nw3Raq1i3v5Oy+hMRXGd6aNhJXLKDOo=; b=YNeK8TEyB/nTi1qUc2plc2BI5I09pMgyf63CQv8oMTshU07hnAoelemoeZdhtxoPZc d/U6CPZupmZ5tRxbv5FipJHOBH+oMiuYEpZiQEIpWiaVXYnd2WrZ3fk9iXYEiqi0fblk phFwutF8Hg1dp5jjRWYIaBNFO/Q/q4gxow1+XaMHYh09/RrSbxWUlbSKDcp2zE5UBfXz hIKw70rPWEoQ6B39LnvsndRr5Gmom4Zuphbpvn0Kb71YysWjClmQb4ajmaPv1qNufh4F DIbwHe5XF3F5neTbglsuyoKCbTrsjNExpInd9A5/2U37fBoz2MOcl5JGw+jXTsv+wPLy w8tQ== X-Gm-Message-State: AA+aEWZyPutlghNJMALB90fD22mrxXWiZWBqtqEPaM8QL1ke0kqOdirq 1hUVKmt4Q+yU1JR9A1bg56E= X-Google-Smtp-Source: AFSGD/W6GT9BTMXIBVJ1TrwhN0cnpSbhXZYZErwUM56TeiXs4JlLvPEtWZ1mBFL1f6Ml31IHTJQ8LQ== X-Received: by 2002:a17:902:8541:: with SMTP id d1mr27811877plo.205.1544081759584; Wed, 05 Dec 2018 23:35:59 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id v15sm33035894pfn.94.2018.12.05.23.35.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Dec 2018 23:35:58 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 3/3] PCI: imx: Add support for i.MX8MQ Date: Wed, 5 Dec 2018 23:35:45 -0800 Message-Id: <20181206073545.10967-4-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181206073545.10967-1-andrew.smirnov@gmail.com> References: <20181206073545.10967-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181205_233610_640959_534796DC X-CRM114-Status: GOOD ( 21.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Mark Rutland , Richard Zhu , linux-arm-kernel@lists.infradead.org, Rob Herring , Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , devicetree@vger.kernel.org, linux-imx@nxp.com, bhelgaas@google.com, Leonard Crestez , cphealy@gmail.com, l.stach@pengutronix.de Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add code needed to support i.MX8MQ variant. Cc: bhelgaas@google.com Cc: Fabio Estevam Cc: cphealy@gmail.com Cc: l.stach@pengutronix.de Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Cc: Mark Rutland Cc: Rob Herring Cc: devicetree@vger.kernel.org Signed-off-by: Andrey Smirnov Reviewed-by: Lucas Stach --- .../bindings/pci/fsl,imx6q-pcie.txt | 6 +- drivers/pci/controller/dwc/Kconfig | 2 +- drivers/pci/controller/dwc/pci-imx6.c | 85 +++++++++++++++++-- 3 files changed, 86 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt index f37494d5a7be..40b46d11e7e7 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt @@ -9,6 +9,7 @@ Required properties: - "fsl,imx6sx-pcie", - "fsl,imx6qp-pcie" - "fsl,imx7d-pcie" + - "fsl,imx8mq-pcie" - reg: base address and length of the PCIe controller - interrupts: A list of interrupt outputs of the controller. Must contain an entry for each entry in the interrupt-names property. @@ -43,7 +44,7 @@ Additional required properties for imx6sx-pcie: - "pcie_inbound_axi" - power-domains: Must be set to a phandle pointing to the PCIE_PHY power domain -Additional required properties for imx7d-pcie: +Additional required properties for imx7d-pcie and imx8mq-pcie: - power-domains: Must be set to a phandle pointing to PCIE_PHY power domain - resets: Must contain phandles to PCIe-related reset lines exposed by SRC IP block @@ -52,6 +53,9 @@ Additional required properties for imx7d-pcie: - "apps" - "turnoff" +Additional required properties for imx8mq-pcie: +- fsl,controller-id: Logical ID of a given PCIE controller. PCIE1 is 0, PCIE2 is 1; + Example: pcie@01000000 { diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dwc/Kconfig index 91b0194240a5..2b139acccf32 100644 --- a/drivers/pci/controller/dwc/Kconfig +++ b/drivers/pci/controller/dwc/Kconfig @@ -90,7 +90,7 @@ config PCI_EXYNOS config PCI_IMX6 bool "Freescale i.MX6 PCIe controller" - depends on SOC_IMX6Q || (ARM && COMPILE_TEST) + depends on SOC_IMX8MQ || SOC_IMX6Q || (ARM && COMPILE_TEST) depends on PCI_MSI_IRQ_DOMAIN select PCIE_DW_HOST diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 3c3002861d25..326f71698ac2 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -8,6 +8,7 @@ * Author: Sean Cross */ +#include #include #include #include @@ -30,6 +31,11 @@ #include "pcie-designware.h" +#define IMX8MQ_GPR_PCIE_REF_USE_PAD BIT(9) +#define IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN BIT(10) +#define IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE BIT(11) +#define IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE GENMASK(11, 8) + #define to_imx6_pcie(x) dev_get_drvdata((x)->dev) enum imx6_pcie_variants { @@ -37,6 +43,7 @@ enum imx6_pcie_variants { IMX6SX, IMX6QP, IMX7D, + IMX8MQ, }; struct imx6_pcie { @@ -48,6 +55,7 @@ struct imx6_pcie { struct clk *pcie_inbound_axi; struct clk *pcie; struct regmap *iomuxc_gpr; + u32 controller_id; struct reset_control *pciephy_reset; struct reset_control *apps_reset; struct reset_control *turnoff_reset; @@ -245,7 +253,8 @@ static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) { u32 tmp; - if (imx6_pcie->variant == IMX7D) + if (imx6_pcie->variant == IMX7D || + imx6_pcie->variant == IMX8MQ) return; pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); @@ -261,6 +270,7 @@ static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) pcie_phy_write(imx6_pcie, PHY_RX_OVRD_IN_LO, tmp); } +#ifdef CONFIG_ARM /* Added for PCI abort handling */ static int imx6q_pcie_abort_handler(unsigned long addr, unsigned int fsr, struct pt_regs *regs) @@ -294,6 +304,7 @@ static int imx6q_pcie_abort_handler(unsigned long addr, return 1; } +#endif static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) { @@ -301,6 +312,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) switch (imx6_pcie->variant) { case IMX7D: + case IMX8MQ: /* FALLTHROUGH */ reset_control_assert(imx6_pcie->pciephy_reset); reset_control_assert(imx6_pcie->apps_reset); break; @@ -339,6 +351,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) { struct dw_pcie *pci = imx6_pcie->pci; struct device *dev = pci->dev; + unsigned int offset; int ret = 0; switch (imx6_pcie->variant) { @@ -369,6 +382,29 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) break; case IMX7D: break; + case IMX8MQ: + switch (imx6_pcie->controller_id) { + case 0: + offset = IOMUXC_GPR14; + break; + case 1: + offset = IOMUXC_GPR16; + break; + default: + return -EINVAL; + } + + /* + * Set the over ride low and enabled + * make sure that REF_CLK is turned on. + */ + regmap_update_bits(imx6_pcie->iomuxc_gpr, offset, + IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE, + 0); + regmap_update_bits(imx6_pcie->iomuxc_gpr, offset, + IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN, + IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN); + break; } return ret; @@ -445,6 +481,9 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) } switch (imx6_pcie->variant) { + case IMX8MQ: + reset_control_deassert(imx6_pcie->pciephy_reset); + break; case IMX7D: reset_control_deassert(imx6_pcie->pciephy_reset); imx7d_pcie_wait_for_phy_pll_lock(imx6_pcie); @@ -482,7 +521,34 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie) { + unsigned int mask, val, offset; + + mask = IMX6Q_GPR12_DEVICE_TYPE; + val = FIELD_PREP(IMX6Q_GPR12_DEVICE_TYPE, PCI_EXP_TYPE_ROOT_PORT); + switch (imx6_pcie->variant) { + case IMX8MQ: + switch (imx6_pcie->controller_id) { + case 0: + offset = IOMUXC_GPR14; + break; + case 1: + offset = IOMUXC_GPR16; + mask = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE; + val = FIELD_PREP(IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, + PCI_EXP_TYPE_ROOT_PORT); + break; + default: + return; + } + /* + * TODO: Currently this code assumes external + * oscillator is being used + */ + regmap_update_bits(imx6_pcie->iomuxc_gpr, offset, + IMX8MQ_GPR_PCIE_REF_USE_PAD, + IMX8MQ_GPR_PCIE_REF_USE_PAD); + break; case IMX7D: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0); @@ -518,8 +584,7 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie) break; } - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6Q_GPR12_DEVICE_TYPE, PCI_EXP_TYPE_ROOT_PORT << 12); + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, mask, val); } static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) @@ -528,7 +593,8 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) int mult, div; u32 val; - if (imx6_pcie->variant == IMX7D) + if (imx6_pcie->variant == IMX7D || + imx6_pcie->variant == IMX8MQ) return 0; switch (phy_rate) { @@ -616,6 +682,7 @@ static void imx6_pcie_ltssm_enable(struct device *dev) IMX6Q_GPR12_PCIE_CTL_2); break; case IMX7D: + case IMX8MQ: /* FALLTHROUGH */ reset_control_deassert(imx6_pcie->apps_reset); break; } @@ -870,6 +937,10 @@ static int imx6_pcie_probe(struct platform_device *pdev) imx6_pcie->variant = (enum imx6_pcie_variants)of_device_get_match_data(dev); + if (of_property_read_u32(node, "fsl,controller-id", + &imx6_pcie->controller_id)) + imx6_pcie->controller_id = 0; + dbi_base = platform_get_resource(pdev, IORESOURCE_MEM, 0); pci->dbi_base = devm_ioremap_resource(dev, dbi_base); if (IS_ERR(pci->dbi_base)) @@ -921,7 +992,8 @@ static int imx6_pcie_probe(struct platform_device *pdev) return PTR_ERR(imx6_pcie->pcie_inbound_axi); } break; - case IMX7D: + case IMX8MQ: + case IMX7D: /* FALLTHROUGH */ imx6_pcie->pciephy_reset = devm_reset_control_get_exclusive(dev, "pciephy"); if (IS_ERR(imx6_pcie->pciephy_reset)) { @@ -1011,6 +1083,7 @@ static const struct of_device_id imx6_pcie_of_match[] = { { .compatible = "fsl,imx6sx-pcie", .data = (void *)IMX6SX, }, { .compatible = "fsl,imx6qp-pcie", .data = (void *)IMX6QP, }, { .compatible = "fsl,imx7d-pcie", .data = (void *)IMX7D, }, + { .compatible = "fsl,imx8mq-pcie", .data = (void *)IMX8MQ, } , {}, }; @@ -1027,6 +1100,7 @@ static struct platform_driver imx6_pcie_driver = { static int __init imx6_pcie_init(void) { +#ifdef CONFIG_ARM /* * Since probe() can be deferred we need to make sure that * hook_fault_code is not called after __init memory is freed @@ -1036,6 +1110,7 @@ static int __init imx6_pcie_init(void) */ hook_fault_code(8, imx6q_pcie_abort_handler, SIGBUS, 0, "external abort on non-linefetch"); +#endif return platform_driver_register(&imx6_pcie_driver); }