From patchwork Fri Aug 14 14:04:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Wallner X-Patchwork-Id: 1345046 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=br-automation.com Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BSlYn61Hvz9sTH for ; Sat, 15 Aug 2020 00:04:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0A1EF82189; Fri, 14 Aug 2020 16:04:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=br-automation.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 08F6382193; Fri, 14 Aug 2020 16:04:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail2.br-automation.com (mail2.br-automation.com [213.33.116.61]) (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 674E781C1D for ; Fri, 14 Aug 2020 16:04:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=br-automation.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=wolfgang.wallner@br-automation.com X-AuditID: c0a80110-239ff70000001e86-68-5f3699f193a7 Received: from brsmtp01.br-automation.co.at (Unknown_Domain [192.168.1.60]) by mail2.br-automation.com () with SMTP id 38.5B.07814.1F9963F5; Fri, 14 Aug 2020 16:04:33 +0200 (CEST) In-Reply-To: Subject: x86: apl: Acessing SPI flash when booting with Coreboot/U-Boot From: "Wolfgang Wallner" To: "Simon Glass" Cc: "Bin Meng" , "U-Boot Mailing List" Date: Fri, 14 Aug 2020 16:04:33 +0200 Message-ID: MIME-Version: 1.0 Sensitivity: Importance: Normal X-Priority: 3 (Normal) References: X-Mailer: Lotus Domino Web Server Release 10.0.1FP3 August 09, 2019 X-MIMETrack: Serialize by HTTP Server on ATEGGE09/Eggelsberg/AT/B&R(Release 10.0.1FP3|August 09, 2019) at 08/14/2020 04:04:33 PM,Serialize complete at 08/14/2020 04:04:33 PM X-Disclaimed: 52499 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrELMWRmVeSWpSXmKPExsVyYAWjje7HmWbxBge3m1tM7Ym3+LZlG6PF 272d7A7MHrMbLrJ47Jx1l93j7J0djAHMUVw2Kak5mWWpRfp2CVwZl859YCo4xVdxd4J7A+Mj 7i5GTg4JAROJhddns3UxcnEICWxllLi3fjtLFyMHB6cAr8SEf9YgNcIC7hJTpq5lBLHZBGwl Go9sZQOxRQRUJJZ3PGAHsZkFAiQuT5/LCmKzCKhKrDuwGqyGVyBSYvrCVcwQNdoSyxa+ZgYZ zyygLrF+nhBEiaDEyZlPWCBW8UpsejsbbBWngJBEx9VOVogzxSQmrPsFNkZIgEfi1Yb9jBBx Z4ldj++xgJwvIbCRUaL52maohLBE77yFLBMYhWchWT0LYfUsJKsXMDKvYhTPTczMMdJLKtJN LC3Jz00syczP00vOz93ECAl3gR2Mu99oH2Jk4mA8xCjBwawkwst82TheiDclsbIqtSg/vqg0 J7X4EKM0B4uSOO88BcN4IYH0xJLU7NTUgtQimCwTB6dUA6Ow+d2zxnN+Zaz+5CG0aZ/1Mfej +2/tefx00QZe6b23LVn//s3KWHllS0je5xaNY8F5j2as5Rd69Kr3wdnDO7uUFewuWHSW3XPw /Z29WSD7VZB+S5+O4cFvHKoLwvg9m2RO3Yy5JPXmjnX5a51V+tPT6oqfL85KltbYEN/UHnpK aN77fxWRypOUWIozEg21mIuKEwEIvc2AZQIAAA== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Hi Simon, Since commit 609b90a6a9c0 ("x86: spi: Rewrite logic for obtaining the SPI memory map") I have trouble accessing the SPI flash on my Apollo Lake board when booting with Coreboot and having U-Boot as the payload. Accessing the SPI flash returns -91 (EPROTOTYPE). My understanding of what happens is the following: - ich_spi_ofdata_to_platdata() calls ich_spi_get_basics(), the parameter 'can_probe' is hardcoded to true - There is no PCH device in my devicetree (there is also no PCH driver contained in my build) - As can_probe is true, ich_spi_get_basics() tries to find a PCH device and returns -EPROTOTYPE as it finds none As far as I see the PCH is not used in the code paths relevant to Apollo Lake. I think this behavior can not be triggered in a standalone U-Boot on Apollo Lake, as in this case arch_cpu_init_tpl() requires an LPC, which is below the PCH, and so a PCH has to be part of the devicetree anyway. In this case a PCH would be found in ich_spi_get_basics(), but it would not get used. As a quick workaround [1], I have set can_probe hardcoded to false, and with this change I can access the SPI flash again. Do you have any advice on how to fix this? How about making the value for can_probe depend on a check for ich_version == ICHV_APL? regards, Wolfgang [1] Workaround patch: --- a/drivers/spi/ich.c +++ b/drivers/spi/ich.c @@ -1016,7 +1016,7 @@ static int ich_spi_ofdata_to_platdata(struct udevice *dev) #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct ich_spi_priv *priv = dev_get_priv(dev); - ret = ich_spi_get_basics(dev, true, &priv->pch, &plat->ich_version, + ret = ich_spi_get_basics(dev, false, &priv->pch, &plat->ich_version,