Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp103120ybv; Wed, 12 Feb 2020 20:11:18 -0800 (PST) X-Google-Smtp-Source: APXvYqyTcM06p6Lp4iRN1D6UaSh4ruqrKCAST/99jmnHmy3HRIHqUVPp6R2cKf3p3rIDTBfITTsU X-Received: by 2002:a05:6830:9a:: with SMTP id a26mr12234501oto.273.1581567078159; Wed, 12 Feb 2020 20:11:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1581567078; cv=pass; d=google.com; s=arc-20160816; b=UNWUpn/8uEdJ6/QQbaHqRzDAcRs4bipBB9/TX2HCWCMuVjvCDdLJD6NpL0A+Q5tmnx ycDZibjdV788abzI2o8f2NwTNEUQjPbV/I+kTed2sgsWDGhHFIIuJXwi8BEvTKJHgQWi eSQg0NU+x3UaVF7nOFuxsaN8mqb4gU9kRe9giw+yjAcdEYTcDh8S86tTy/e0vH4hIJHm bQydgBsKisGg0wlvvgfpqYOoSiIZik38mnd7O9Le0O/Id3yhBM1q5YrlkX0mPs9s5eU2 gUb9SNcTf676uFSnhfuGnd5X9xQZYjH9/W2pRWSOnAWFw37U8BHRZCdsic+fvyIjgNcn vK5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=q6fZFNV5LPZPD1GnnXvOvEftm5p9jFYYgEFw+TTkWKg=; b=hSoUHQ3Gk9PBO4metk58zN2/kLVjS//nefOO7kkbV06Ev7vUH6zSsBg4cTjwUqPl36 WMObZwfamqvJvI+4t62ov27Gp+QopeoT3UClb56gL/RpJlCgon92Z0rMq8lrrCaOTMrP Cpm3NJI9d+PiXFhxSzFyji3xG7awW6OFDJf3E2YTuxl5KOFhZJm2fSQSbZAptMGLzq4o qCcWMJx1Gt9C2Ax6ShI+X5ZDcalGlBQSFImNLyvkBd1iNvy2jxA6fnhTT6WXIdj+//Oc gXrKknb3ixSWU1cECwohI8vIaTbChKiw4Z6NBO1YdWsGTedp9oySuEGMqaj/HxYsh/wK uWrQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=G2BcHIWA; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m24si541214otk.239.2020.02.12.20.11.05; Wed, 12 Feb 2020 20:11:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=G2BcHIWA; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729793AbgBMEKo (ORCPT + 99 others); Wed, 12 Feb 2020 23:10:44 -0500 Received: from mail-eopbgr150052.outbound.protection.outlook.com ([40.107.15.52]:3891 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729440AbgBMEKn (ORCPT ); Wed, 12 Feb 2020 23:10:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LGJBcHn8a/UNjClXgU63s12NsmBAyVQcsEdx+uwM9caDuzi7TRI7AYglw5o9oPw0H98KnLtwawYIYKr1PtxiB2tiIl68gKB8U1oYwtQLRlYyk4mB1n+FTQuWGbSqgzSCwZJFWjmrNLCtgtx+9kP00o67uAjW6SMplMTzYGm9Ycx/z6fV6Nx8W0OycMZeGy/bMT6EP8z8adJR+KlrtbpGoqHTi6r7zlNqSjUCW6sYfi+UlsqYPcSbpq6HtA53Eyad9+EudYKFNisVFZqEAkrOFekHdkP8quKSMVUn4DfnSiqIl3LdNDbeAO04DVvBE1Ek/KYr1fz0MsUU2UM+hu5h2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q6fZFNV5LPZPD1GnnXvOvEftm5p9jFYYgEFw+TTkWKg=; b=n38UdBaPZwfs1Bkh93r+2/Dl6/YaefMQdlFBS5HVyg0ZRz2pvXHhrKrwlq3SKmA0NpJz1oCbXo1U3rNDxh78lj9pkCJtzKOyrbFTLGSW0PzlYHIMkg/7KarUV5pz+YF05AoU2knoP4wGMzHdYlUfLQg2Hw8qYDrSc//z64750XHX4OH8pXLzaBi5ZT/ntAxrx/uZgDcr5BzE8WI9wMUQ3nqfJcpjuWhWUD1+CJ+zNB+pRhvLeXvh3UtwTZLsV49XZMs8t7zOLBdf/dTE61yVYU/bAljkc/HWd+oNh5z780PHwVvnoZQTbDajjmzopkIg3OKXCcSAegvD7XNSjoMzQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q6fZFNV5LPZPD1GnnXvOvEftm5p9jFYYgEFw+TTkWKg=; b=G2BcHIWAYeYVZ8eg8mROf0WEoplz4lGgWJjJDek4cnljbNH3O6ZOY3wz4JJBinJx3JEKBcFwNSoAzsUJie5lQ0TKQR4ONb9mNJtKg55oUBuq3lthyvOPJsadkHQvDekQMZqBK2rS4xRHSljIcvxKWsOCBicXKz1FwCpnUvObsyA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=zhiqiang.hou@nxp.com; Received: from DB8PR04MB6747.eurprd04.prod.outlook.com (20.179.250.159) by DB8PR04MB7084.eurprd04.prod.outlook.com (52.135.63.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2729.23; Thu, 13 Feb 2020 04:10:37 +0000 Received: from DB8PR04MB6747.eurprd04.prod.outlook.com ([fe80::104b:e88b:b0d3:cdaa]) by DB8PR04MB6747.eurprd04.prod.outlook.com ([fe80::104b:e88b:b0d3:cdaa%4]) with mapi id 15.20.2707.030; Thu, 13 Feb 2020 04:10:37 +0000 From: Zhiqiang Hou To: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bhelgaas@google.com, robh+dt@kernel.org, andrew.murray@arm.com, arnd@arndb.de, mark.rutland@arm.com, l.subrahmanya@mobiveil.co.in, shawnguo@kernel.org, m.karthikeyan@mobiveil.co.in, leoyang.li@nxp.com, lorenzo.pieralisi@arm.com, catalin.marinas@arm.com, will.deacon@arm.com Cc: Mingkai.Hu@nxp.com, Minghuan.Lian@nxp.com, Xiaowei.Bao@nxp.com, Hou Zhiqiang Subject: [PATCHv10 09/13] PCI: mobiveil: Add Header Type field check Date: Thu, 13 Feb 2020 12:06:40 +0800 Message-Id: <20200213040644.45858-10-Zhiqiang.Hou@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200213040644.45858-1-Zhiqiang.Hou@nxp.com> References: <20200213040644.45858-1-Zhiqiang.Hou@nxp.com> Content-Type: text/plain X-ClientProxiedBy: HK2PR04CA0069.apcprd04.prod.outlook.com (2603:1096:202:15::13) To DB8PR04MB6747.eurprd04.prod.outlook.com (2603:10a6:10:10b::31) MIME-Version: 1.0 Received: from localhost.localdomain (119.31.174.73) by HK2PR04CA0069.apcprd04.prod.outlook.com (2603:1096:202:15::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2729.24 via Frontend Transport; Thu, 13 Feb 2020 04:10:31 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.73] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2edaf9d7-1977-4c6a-5860-08d7b03aae31 X-MS-TrafficTypeDiagnostic: DB8PR04MB7084:|DB8PR04MB7084: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-Forefront-PRVS: 031257FE13 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(366004)(136003)(396003)(39860400002)(346002)(189003)(199004)(36756003)(6506007)(5660300002)(26005)(66476007)(7416002)(66556008)(66946007)(6512007)(4326008)(52116002)(6666004)(16526019)(86362001)(478600001)(1076003)(2616005)(956004)(6486002)(69590400006)(81156014)(8676002)(81166006)(8936002)(186003)(2906002)(316002)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB8PR04MB7084;H:DB8PR04MB6747.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6eveqEXt9qYu0QQVxphrflg58f/GfCVDGYQjPuuV2tD5Ew3pQ/Ot7Mj876cT1pzlNpBlZHPDl3xZdVQq9Ght6N+NB4sLWLkmsKkihdApw1cVztd/qUPTvcaNj/WDt2gm06ZWhwRkAOjns9zZnLtexJp5dktr3SlGs0WixlL2xfsQp+03o6g6g1V3CnlRE7B2Lrh1NwZaXBkScgp0ACRMU9wQSNVd56EcKITpH2mfmExUMECDEK/GA4XQTBmE5+KF3QnkdBHdsUUGm0wKOMpLOx2MYHGmxB3KPW1zZYPEhzBqPFiN65b6Jv2EXey7zzF2BaQFyWIWuvXDAc21u7/5FgSZsFoDCvYI/eX/YRwxoFqUs++JmG/LxAtENAQvjboLYiTd8TX16uTsPEZu1iBUl/qFqLNInfc49u9fVuioBu7o7xEOG2LKL55dPsTKrPr4ti8EupRvFwDNPjkQbzP1M51VtUOGJYbaLprRkJY7OJuVaymQtlL9rYCkKtKIYz/IB5+6w2XcPS7yZUpU3swy0o5n6JoyIIsb5B41GTpp9WZVDuCmWm5wyTCYlViL85kXVK6NJMow/wKGJjLrnoo6kQ== X-MS-Exchange-AntiSpam-MessageData: lIhaoNWi5vLA4E6ds4wdo1MQPfcghhrI3PYcRJ7ifIDoWkIZKsznca4Wn5qYPTuGCHrwW1JE2Oikq3YegfK4i7YlBpmV3oR1sR+SvaehJJ91nqxVgDHxwIU/ZFKsa5JBi335CQKvG1WR9MxaP61VOA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2edaf9d7-1977-4c6a-5860-08d7b03aae31 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2020 04:10:37.6434 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7IFCvyoj6LZwuqOgolRlQzMDU7VgQ+okzNZfxVo1oApUNMr/8dO+59QW3gbaRmYI6yM94X3RIK3RMggXLSztAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7084 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hou Zhiqiang Check the Header Type and exit from the host driver initialization if it is not in host mode. Signed-off-by: Hou Zhiqiang --- V10: - New patch separated from #10 of v9. .../pci/controller/mobiveil/pcie-mobiveil-host.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c index 44dd641fede3..db7028788d91 100644 --- a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c +++ b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c @@ -554,6 +554,16 @@ static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *pcie) return mobiveil_pcie_integrated_interrupt_init(pcie); } +static bool mobiveil_pcie_is_bridge(struct mobiveil_pcie *pcie) +{ + u32 header_type; + + header_type = mobiveil_csr_readb(pcie, PCI_HEADER_TYPE); + header_type &= 0x7f; + + return header_type == PCI_HEADER_TYPE_BRIDGE; +} + int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie) { struct mobiveil_root_port *rp = &pcie->rp; @@ -569,6 +579,9 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie) return ret; } + if (!mobiveil_pcie_is_bridge(pcie)) + return -ENODEV; + /* parse the host bridge base addresses from the device tree file */ ret = pci_parse_request_of_pci_ranges(dev, &bridge->windows, &bridge->dma_ranges, NULL); -- 2.17.1