From patchwork Mon Oct 21 03:38:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1180212 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=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Jpe98Gu6"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46xN2C6c5pz9sPL for ; Mon, 21 Oct 2019 14:50:11 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 55B4DC21BE5; Mon, 21 Oct 2019 03:42:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 819D2C21D65; Mon, 21 Oct 2019 03:42:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 11660C21DFA; Mon, 21 Oct 2019 03:40:44 +0000 (UTC) Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by lists.denx.de (Postfix) with ESMTPS id 3359CC21DCA for ; Mon, 21 Oct 2019 03:40:44 +0000 (UTC) Received: by mail-io1-f68.google.com with SMTP id i26so4841478iog.9 for ; Sun, 20 Oct 2019 20:40:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EuF5WW3DToEn49DBl4KOe4C1UGnY08Ae2nSes3Pqqcc=; b=Jpe98Gu6QZwAQKNyFNucAsjdjNcn/OQ3SUTLbjfaIoVI2NsUU2waCWhhqd3BUwfbd9 cdIJrLcA3sNJD0bIIXM5HVhVtY1EFkkBne4dhNjOUS4Vkm8NwaOkjODNP9gQ2lBztFkX V4YbJ0Lp1yc+3C7KTpI+WzAvDXQZdwguCoB9I= 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=EuF5WW3DToEn49DBl4KOe4C1UGnY08Ae2nSes3Pqqcc=; b=jE5NGg7bRRpLcX2mrbgP0XxupTseUk9lCuJEAZmAUeJc3/vJWb9ybMlaoFgppp/Eng fKuHatzRdc+6HMrqph5HiWB0LfYWeDE7TEclr7pqxWKLQ0+gETrlvojWTMG8uv5WyzgF 2rbjsv57lAxVNaBTspx0dut3PLmwwc3LjxiRd7mcaiLDfiLzAUSM7rBwIcgod3n//53E iMcbefThiiaOUp47Z1U8QpEPfy8i8JSuCSgzuSmzb/Lks6/WsbcCxXr/UEfRGopTQXSG S6pcWL0wPOkSMUptAUETHgB0+R6fcC1sNpHYKor/Ibd032WxgpgsNov07tsEZVNLk3vQ kf5A== X-Gm-Message-State: APjAAAVY2s4wKg7kFb4e/V1U0QvJsNePBG4q/AWBd9rAFth2WL4HRv0Q BVbzU3QwYamkD83p8XHsHBCAxvwOEISQLg== X-Google-Smtp-Source: APXvYqzJHlLgrgdZoQq1Wig6TXhkUPwDM+ekgI3fi8iJyIaXxC3VLEKLa/cqESkt8oAeFcq2Ew19wg== X-Received: by 2002:a5d:87ce:: with SMTP id q14mr18819194ios.278.1571629242971; Sun, 20 Oct 2019 20:40:42 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id x14sm1947028ion.67.2019.10.20.20.40.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2019 20:40:42 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 20 Oct 2019 21:38:48 -0600 Message-Id: <20191021033913.220758-78-sjg@chromium.org> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog In-Reply-To: <20191021033913.220758-22-sjg@chromium.org> References: <20191021033913.220758-22-sjg@chromium.org> MIME-Version: 1.0 Cc: Jagannadha Sutradharudu Teki Subject: [U-Boot] [PATCH v3 083/108] spi: ich: Support of-platdata for fast-spi X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" The Intel Fast SPI interface is similar to ICH. Add of-platdata support for this using the "intel,fast-spi" compatible string. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None drivers/spi/ich.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c index b28f3423584..ae3bff36bba 100644 --- a/drivers/spi/ich.c +++ b/drivers/spi/ich.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -28,9 +29,13 @@ #endif struct ich_spi_platdata { +#if CONFIG_IS_ENABLED(OF_PLATDATA) + struct dtd_intel_fast_spi dtplat; +#endif enum ich_version ich_version; /* Controller version, 7 or 9 */ bool lockdown; /* lock down controller settings? */ ulong mmio_base; /* Base of MMIO registers */ + pci_dev_t bdf; /* PCI address used by of-platdata */ }; static u8 ich_readb(struct ich_spi_priv *priv, int reg) @@ -597,10 +602,16 @@ static int ich_spi_ofdata_to_platdata(struct udevice *dev) { struct ich_spi_platdata *plat = dev_get_platdata(dev); +#if !CONFIG_IS_ENABLED(OF_PLATDATA) plat->ich_version = dev_get_driver_data(dev); plat->lockdown = dev_read_bool(dev, "intel,spi-lock-down"); - pch_get_spi_base(dev->parent, &plat->mmio_base); +#else + plat->ich_version = ICHV_APL; + plat->mmio_base = plat->dtplat.early_regs[0]; + plat->bdf = pci_x86_ofplat_get_devfn(plat->dtplat.reg[0]); +#endif + debug("%s: mmio_base=%lx\n", __func__, plat->mmio_base); return 0; } @@ -628,8 +639,8 @@ static const struct udevice_id ich_spi_ids[] = { { } }; -U_BOOT_DRIVER(ich_spi) = { - .name = "ich_spi", +U_BOOT_DRIVER(intel_fast_spi) = { + .name = "intel_fast_spi", .id = UCLASS_SPI, .of_match = ich_spi_ids, .ops = &ich_spi_ops,