From patchwork Mon Apr 20 12:52:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1089 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4F29E3F1FE for ; Mon, 20 Apr 2020 14:52:52 +0200 (CEST) Received: by mail-pl1-f197.google.com with SMTP id d4sf8477384plr.18 for ; Mon, 20 Apr 2020 05:52:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1587387170; cv=pass; d=google.com; s=arc-20160816; b=aiqBqN7W2Sbh/dU4pXhTfUlaH1yyYxJfkRv57b62okFomBxy/wRyP43VIiyFLnK0TR WlQ9l5ofY/5UXNsPsRqcQdVyTi0xXEd8jCRZLoMSEv5n0a1Rb3wueolEp6PJQAfhknI1 3pReLV6XnkLMmG0/RngtbyBb3XYOWEoI1V3aapA7A+O0DQOktn8HzotMb/KuxKJChh3P I7bFFR9kPYjWmpxLKHpod6WsGsayjgJ22CzTxBxW9OvtBXMgWtkVuLo0lFM5/JuQldDT Qw1Lp8NsAjqIBh5JRM21FV3l1zH2tzXLwXT3AK3eJBRCFupDmbuHaJj3YI9sDiIADN5P 7jKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=G3YogDmmfzG0VTXsvdkKzS5/wvbH4F7YZ+dRiyS3iSg=; b=E3D3a4l7cuny3F5639cNn/sjoin1cSr3VWY5kKHflv9TOxNLXvUEzVianOu8mlWFQS fyHMHs4sVvB3oyOMXDWF+i6ynjdBtoJpSaSh+Y11kdJ+G5h7JHQI+G/1e5B11M748kGI FBnsCpTDh8QGXK94ODFNnT5wsUoMSIxJFDctWK/6eB5BhN+dygUWdBgTGakjEzXSkV2p 6p84+2gHYc60tMH7oNA532p/C9HnVNcJZkXr6vZg+im9dpSL0T+BP3xRDS6aydW3dUju A0OcRqM/iB3pQvhgSF/7zQqHDxR0oVU3Dph0GPu3DEowe4a5RhhQQdqRPCskptCZKHzS 9GSg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BRcHk1W3; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=G3YogDmmfzG0VTXsvdkKzS5/wvbH4F7YZ+dRiyS3iSg=; b=APRG2TwldvMvg7+a4ZZVlHEgtW6VERc2c/+/uukuX1qyAN0dzQogDy9FxVmh7I0mjN mkpiYsMWWRhhFGza9uvvU665QF8oVGa1+Tzwqyf1vWiYJvkq+z/mva0B2IGc+TCjAd1T TyLEle/yidZCeWF++5m6040laxbaHtsB6cXkM= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=G3YogDmmfzG0VTXsvdkKzS5/wvbH4F7YZ+dRiyS3iSg=; b=Y/FWyomtOTnloh90xLFAZAL0ir6eAd5oJhgAeTJpDzG4KeRBYVsib5jMo0Qk2cq3vz N9M+r7fdP2G9a6cnS0riSBxaPr2NtSuELdd0sI0IxulZ6gsVUoSbM6CwcxEuhYTkrB09 8z3Hk2SHJnWwp9FxhsgSKVFcTpPnbiveNm3Y+g1S6AS9Y6qOrKAcIANuRB+eZJA3qgkz WwIYxppuJuyJ+TP63x+CMAd2HcQhzzMKhDEdeLIv6kcCNrZFvHI2E/akx8KjozbjwXjG NdCMQ0iCQeCv0wgftvERc9KNQ5uhhEwHWrJDDFmKG6xjWJi+yzQKJbhEfiSchoOaHPG8 veOw== X-Gm-Message-State: AGi0PuYpKSqn7lM//d2h4SmnTO9QKamwQLPPPgc5LcU5e9hJ7Bfne93n BlRreCirBtzLH4PbFTRZjqHMLAk+ X-Google-Smtp-Source: APiQypL0IxciquZObfc3HL7y10Tjqwp1YuuwQYK7u/ZRCAYTVeNQF3wZdSQsusaIV0oAl1NNW9H9sQ== X-Received: by 2002:a17:90a:fb89:: with SMTP id cp9mr20828354pjb.40.1587387170664; Mon, 20 Apr 2020 05:52:50 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:68c1:: with SMTP id d184ls9452170pgc.9.gmail; Mon, 20 Apr 2020 05:52:50 -0700 (PDT) X-Received: by 2002:aa7:990f:: with SMTP id z15mr17375549pff.132.1587387170110; Mon, 20 Apr 2020 05:52:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587387170; cv=none; d=google.com; s=arc-20160816; b=Y3RJwHpCwIM53OswAiws4RCwbxKYRgl0YST9wnlOf9r4yK3PkUiRXT9ICN92oPaMW5 FT0ZE6mvDgr0SwATv5QxNoZO2T5WnrzLn5tj86CyxGKlFuErPgRAcLmMMcILsTzqt8+s jUMe1Ol0WoV+JT760X18KEWhU20wPyAP7qT+9dFCeRLPyv+swGBDLu/RUk2CBw5x72Qo 6wBIQ2oCR+DBugV1MAQ9HKKrwbTJpNpdtW4d3ZWkT/fLgYTikeCNoZU9f2ziF3/1NGmR tUgmu/hbkP9Gw0lIb8Pifq3poIlIcG8b3el8PmpptshQlcnRA6IDV6PlA0grK6uSWLRZ TSQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=i23D2qIVooNAK47rSTC2z+zU5i8s7zN5uHrQ/axcnjw=; b=MBGjf8pV7eMXbeLmOAvIx2eZGiJK0hArafLv50N4mwUeEbrf3CzGKuQ80PnZ4AhEuK 0h4hxAuVUTIUhH2dn0jgoXNKCWoO09bNO+WVmNCB9arlSdcged2Tc2DYRS0QGnijwr3A VPK8K7qWYZqLqru7RLYVWZNfQ9vkLoXKAYJmxATeNPjtZTBj1xXF5fArmFsM54I2xX5M vFvIFdppOtsiCMGe1FCNZzCIM/z2oqfLVoGdoP8NAM7RsyjOsCreMm4kAiM2wWEMuG2g mQxhCIWUzhLgj9DWjUQl/ZtYOkBfmqe5q5cpz+SBWk+bIm7gEWvtqESB907t4KUbSMfQ fUnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BRcHk1W3; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id p6sor1027229pfq.95.2020.04.20.05.52.50 for (Google Transport Security); Mon, 20 Apr 2020 05:52:50 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a62:18c8:: with SMTP id 191mr17013998pfy.255.1587387169773; Mon, 20 Apr 2020 05:52:49 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:7ddc:e17b:a9b3:404]) by smtp.gmail.com with ESMTPSA id i25sm1036932pfd.140.2020.04.20.05.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 05:52:49 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Cc: Rick Chen , Bin Meng , Bhargav Shah , Sagar Shrikant Kadam , linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v3 1/3] spi: sifive: Fix QPP transfer Date: Mon, 20 Apr 2020 18:22:36 +0530 Message-Id: <20200420125238.9610-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420125238.9610-1-jagan@amarulasolutions.com> References: <20200420125238.9610-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BRcHk1W3; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , For historical reasons the existing logic of filling tx fifo with data, rx fifo with NULL for tx transfer and filling rx fifo with data, tx fifo with NULL for rx transfer is not clear enough to support the Quad Page Program.     SiFive SPI controllers have specific sets of watermark registers and SPI I/O directions bits in order to program SPI controllers clear enough to support all sets of operating modes.     Here is the exact programing sequence that would follow on this patch and tested via SPI-NOR and MMC_SPI.     - set the frame format proto, endian - set the frame format dir, set it for tx and clear it for rx - TX transfer:   fill tx fifo with data.   wait for TX watermark bit to clear. - TX transfer:   fill tx fifo with 0xff.   write nbytes to rx watermark register   wait for rx watermark bit to clear.   read the rx fifo data. So, this patch adopts this program sequence and fixes the existing I/O direction bit. Signed-off-by: Jagan Teki --- Changes for v3: - new patch drivers/spi/spi-sifive.c | 57 ++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c index 336b683476..2a0b28dc08 100644 --- a/drivers/spi/spi-sifive.c +++ b/drivers/spi/spi-sifive.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -127,8 +128,8 @@ static void sifive_spi_clear_cs(struct sifive_spi *spi) } static void sifive_spi_prep_transfer(struct sifive_spi *spi, - bool is_rx_xfer, - struct dm_spi_slave_platdata *slave_plat) + struct dm_spi_slave_platdata *slave_plat, + u8 *rx_ptr) { u32 cr; @@ -160,7 +161,7 @@ static void sifive_spi_prep_transfer(struct sifive_spi *spi, /* SPI direction in/out ? */ cr &= ~SIFIVE_SPI_FMT_DIR; - if (!is_rx_xfer) + if (!rx_ptr) cr |= SIFIVE_SPI_FMT_DIR; writel(cr, spi->regs + SIFIVE_SPI_REG_FMT); @@ -191,13 +192,19 @@ static void sifive_spi_tx(struct sifive_spi *spi, const u8 *tx_ptr) writel(tx_data, spi->regs + SIFIVE_SPI_REG_TXDATA); } +static int sifive_spi_wait(struct sifive_spi *spi, u32 bit) +{ + return wait_for_bit_le32(spi->regs + SIFIVE_SPI_REG_IP, + bit, true, 100, false); +} + static int sifive_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct udevice *bus = dev->parent; struct sifive_spi *spi = dev_get_priv(bus); struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); - const unsigned char *tx_ptr = dout; + const u8 *tx_ptr = dout; u8 *rx_ptr = din; u32 remaining_len; int ret; @@ -210,31 +217,37 @@ static int sifive_spi_xfer(struct udevice *dev, unsigned int bitlen, return ret; } - sifive_spi_prep_transfer(spi, true, slave_plat); + sifive_spi_prep_transfer(spi, slave_plat, rx_ptr); remaining_len = bitlen / 8; while (remaining_len) { - int n_words, tx_words, rx_words; - - n_words = min(remaining_len, spi->fifo_depth); + unsigned int n_words = min(remaining_len, spi->fifo_depth); + unsigned int tx_words, rx_words; /* Enqueue n_words for transmission */ - if (tx_ptr) { - for (tx_words = 0; tx_words < n_words; ++tx_words) { - sifive_spi_tx(spi, tx_ptr); - sifive_spi_rx(spi, NULL); - tx_ptr++; - } + for (tx_words = 0; tx_words < n_words; tx_words++) { + if (!tx_ptr) + sifive_spi_tx(spi, NULL); + else + sifive_spi_tx(spi, tx_ptr++); } - /* Read out all the data from the RX FIFO */ if (rx_ptr) { - for (rx_words = 0; rx_words < n_words; ++rx_words) { - sifive_spi_tx(spi, NULL); - sifive_spi_rx(spi, rx_ptr); - rx_ptr++; - } + /* Wait for transmission + reception to complete */ + writel(n_words - 1, spi->regs + SIFIVE_SPI_REG_RXMARK); + ret = sifive_spi_wait(spi, SIFIVE_SPI_IP_RXWM); + if (ret) + return ret; + + /* Read out all the data from the RX FIFO */ + for (rx_words = 0; rx_words < n_words; rx_words++) + sifive_spi_rx(spi, rx_ptr++); + } else { + /* Wait for transmission to complete */ + ret = sifive_spi_wait(spi, SIFIVE_SPI_IP_TXWM); + if (ret) + return ret; } remaining_len -= n_words; @@ -314,6 +327,10 @@ static void sifive_spi_init_hw(struct sifive_spi *spi) /* Watermark interrupts are disabled by default */ writel(0, spi->regs + SIFIVE_SPI_REG_IE); + /* Default watermark FIFO threshold values */ + writel(1, spi->regs + SIFIVE_SPI_REG_TXMARK); + writel(0, spi->regs + SIFIVE_SPI_REG_RXMARK); + /* Set CS/SCK Delays and Inactive Time to defaults */ writel(SIFIVE_SPI_DELAY0_CSSCK(1) | SIFIVE_SPI_DELAY0_SCKCS(1), spi->regs + SIFIVE_SPI_REG_DELAY0); From patchwork Mon Apr 20 12:52:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1090 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C018E3F1FE for ; Mon, 20 Apr 2020 14:52:54 +0200 (CEST) Received: by mail-pf1-f198.google.com with SMTP id y84sf9634359pfb.7 for ; Mon, 20 Apr 2020 05:52:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1587387173; cv=pass; d=google.com; s=arc-20160816; b=W2yc4EC7qpOPet53HtLYXwyseScblOL13f/iCYsOmVDvmZUtoy+it+qOBgNaDrXVP0 Vm2aT5QKQNyt/TeY2zIax8qo8hmw7MeD1VJkDdAxQT+JYR9OVsyHgFz/oiNMHrsOsTo6 rSdGumH2AuyUBy9k2cnzz3ouXZaBI1MobCUEydco/TW4yTCqmWS6N+lWFjf2mdYPoEA/ /W9MQdyxa8TxpLwfWKbmbt7Pze3cG/zfNFNZ+FsXrR/AJaXruuhqAdjKj1qpSWWyhGEI 2pzH8he/++birE/2us/JICSQrn1Rf6ke+U4FxNqgow9qIzEcJ/KqQp9DoDvFcCw+ixA9 0L5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:dkim-signature; bh=Nv7M4pRxb8Du3xNFPtR++KsMwrtwKrObDwkPWi/vXJA=; b=Uo+AlDbvCCTLkAUDCwxlloSIBAMByvu9tiRsJqGXM11L9qEI0Hq75tqeydeA9jfQfz vYfA8YRS3Z4DiyMEkgUin3y8tkDi3NhOiIZuNoXwlP9AAqTPZKOOU/SSmACHzEFzp63z xOgPBzbW18RJzWOIWyAAhHJaSpGgdhSTifPby5corj6pcKPl8xd7Lc10Houa+yW4fdKH NfjUE+ZFsPFhU//dLXFI99S+hGIsHqNEgVsBirxNs+ify/buLZjyU3FG8D1zdMbF7/Cd rSoJzd6azUCYJjT6s+To+HWuibZJ33BSI4UzkoU1dBcOsg/M3gtS4rhcL8DvxAbZMCIs KYIw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AaRK2Bdv; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=Nv7M4pRxb8Du3xNFPtR++KsMwrtwKrObDwkPWi/vXJA=; b=Ak7u65iyG1eT8NLvn/vwWIya+lEtkd68G9B7UofyvfOwd8eT74KMFVb4XqJZ1qdz4U 3gLihnLoeIq8tgiU4DB4JSFCRZoCi8Wrf6LkzfE04NrHgwuHjhAtSufH6A/qp59uCsSr l9QoHrxd2Jwjjg5n6MNR2FG4dIAwwRnAjo9mk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id :in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=Nv7M4pRxb8Du3xNFPtR++KsMwrtwKrObDwkPWi/vXJA=; b=tKY8zfKS7a7Ds3kUpXo/QzjDzwj8L2hq/xgCQsr9I5DmKAdeq+kVd6/rgF2pu3WEBC ZXPkP1XzJXGxAun0GDspdKpY4x0w6zJv6uNd0MFJc0pgRj8JgYlzOvWD/X+0ufIpwYh7 JBxwoMDlflkDhTz5FlB+C4wjP1vAnlVkLA+1mb3gdwS3IKZx2/LhGXHKl3uSMHC+DWmK SmomsXADnNuZlhvyZ5plNZvuiSg/AGlu0khKa6RMJt6M+xeBmNbIUCUBd26tUQT1ARr1 Quh2evs0qDSoSVeK31uBfkEFcMVJ4cRS/iZSwjYM1UFXH1pD2CdwT3J7drfZhZuH+9Yw cTSA== X-Gm-Message-State: AGi0PuZ1lMFfCd8bMBlx8xjYxalkffrBYq1McJ5PBOoqgKqfbr/WEVZm pjOWOV8HUSZIjPfkd3kexvclkiAb X-Google-Smtp-Source: APiQypJ1cUM+b6sF65I8AMK+BqpkQAPE2xTPS73eXaPh524EqNS5MZq4rRnWfB77cfSvR9xqphBRbQ== X-Received: by 2002:a17:90a:d98e:: with SMTP id d14mr20891183pjv.178.1587387173557; Mon, 20 Apr 2020 05:52:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:9a03:: with SMTP id v3ls9833287plp.11.gmail; Mon, 20 Apr 2020 05:52:53 -0700 (PDT) X-Received: by 2002:a17:90b:3014:: with SMTP id hg20mr21808746pjb.56.1587387173068; Mon, 20 Apr 2020 05:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587387173; cv=none; d=google.com; s=arc-20160816; b=yeqV59lt9HnBBtO63QjkKa4rKzWxY2cXDdB9ObDJcYDNBYbeFY6eURXShKVCGpiO0s KnV8HnzcjS21TM5rR31P82h/WgNTU/Ij+C4cy8azlnIozmr7bgmqCpy3N8tCER51lqOI 4XcWZS4W5V8aUsJOPHbpo/frpHORw/R2g28/NyLZUiZKP/v1PeJFxgWdVZmfJU5meWul /zPRs72BQX6yeuJtwtYTUndpofrFIgsJu1/bR6g+kPMMoFHmLI5Dmov36YwtkioBMr95 /iI/Ic7dHGTzx9r3wOj2uPKeRXxEb29d+ajN1H/fTbNav1qas+27fCD/2m69Ya2kmfd8 49xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nNw2DTOV869iJghajxYLUnoDUFoyyUDgkaJK4NFdjAA=; b=e5nrn8R24GPg8uYlVzWc1ODvYqIiMJ8AoTQjEFlLtLNtSbi0c6yusY+1KlIbo7BMwn rV1fZUb5j2/INS3jNE74cfXFUFJF0JyEdte6kl2dbAZyZUp52a+uGEyaCtf/uRZC9cU9 XpRwTuW94Z2zBXw8aK+YFiDKsT2uDW0kgl8NdLsNtkftMaO+IesIFzXyidZYR6Yrb2d0 THr8XBgutsx5S3b9MDEZoZZ5x7F51yuyzBHX3WR/8zoHvFC7WUI6/SaT2axgaZvbf9Nc Og873roEgeBmb1wlZmIeDvP1MKOs3X/9m2FEwDmtmdZOTpBlHGohmGx2oQCPGZ9CIX7B Kjqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AaRK2Bdv; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id q201sor1241160pgq.32.2020.04.20.05.52.53 for (Google Transport Security); Mon, 20 Apr 2020 05:52:53 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a63:4650:: with SMTP id v16mr14294414pgk.99.1587387172720; Mon, 20 Apr 2020 05:52:52 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:7ddc:e17b:a9b3:404]) by smtp.gmail.com with ESMTPSA id i25sm1036932pfd.140.2020.04.20.05.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 05:52:52 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Cc: Rick Chen , Bin Meng , Bhargav Shah , Sagar Shrikant Kadam , linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v3 2/3] riscv: dts: hifive-unleashed-a00: Add -u-boot.dtsi Date: Mon, 20 Apr 2020 18:22:37 +0530 Message-Id: <20200420125238.9610-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420125238.9610-1-jagan@amarulasolutions.com> References: <20200420125238.9610-1-jagan@amarulasolutions.com> X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AaRK2Bdv; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add U-Boot specific dts file for hifive-unleashed-a00, this would help to add u-boot specific properties and other node changes without touching the base dts(i) files which are easy to sync from Linux. Added spi2 alias for qspi2 as an initial u-boot specific property change. spi probing in current dm model is very much rely on aliases numbering. Even though the qspi2 can't come under any associated spi nor flash it would require to specify the same to make proper binding happen for other spi slaves. Signed-off-by: Jagan Teki Reviewed-by: Bin Meng --- Changes for v3: - none arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi new file mode 100644 index 0000000000..25ec8265a5 --- /dev/null +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019 Jagan Teki + */ + +/ { + aliases { + spi2 = &qspi2; + }; +}; From patchwork Mon Apr 20 12:52:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1091 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id A6A103F1FE for ; Mon, 20 Apr 2020 14:52:57 +0200 (CEST) Received: by mail-pl1-f197.google.com with SMTP id t9sf8482783plq.10 for ; Mon, 20 Apr 2020 05:52:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1587387176; cv=pass; d=google.com; s=arc-20160816; b=jzUoJirYBzOs/9VvJup1cMAbRiZmLzhw/1O7OeBXCBX8xJ99cZd7Q83Sbd+IyDPYVm JPmlUkeNcKMD4UrwHHr/gE7rByMG6OnXQ18iFN0VzKdeeRRxDvjRn8NGDqy5DBOL6qCp /c/fIcleSfeznvn3EryAR0m9CiFmI7Zdwrea+PEw4BEsp66ebi29206RSOW3yMw41gMt o8BtiE/V4DNybrEq0XDnW9BTbR6vmT36+e0XwPhPzw77pyqKZ/LfVf3OKNdeqM1L7qCH G+WEUoCyQZB07wEn3P+YRqrj0QhXfz2fmMYr9iGLZRSzTimAJJBjsiabuLt5wz57xz5R PjIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:dkim-signature; bh=wzuTYObyx3wSXKuC0uWvwS6BkRfJOo7sdzvSZfPgW2c=; b=ZKn2+w69WOzyNvzOcdbDW6arGsyQDWSLNSea0r4co29OvvYdPIcqUw0R0bRxKLlB3y wkFipy8Ai0uDN7zFEdj3f/9XG/EE785tzaLOWa489/rhEvyj6pARYyKXSk7s+l4juuaz MiMUQO8IcyLFWHOLw1AEY1Av8aC9Gutqyf8l+EFsI5vF2lcLL6LyldgbGqMRD9T1Cxr0 iSXZ+GdQqmbdRGkzMb1QcIa1jmABsak4RteDJMldcO/q/zv2BvF/ocUbzO6JEv5NybZF Jed7jOKY96YyQ5koDX7NDe1HWf1SirEcELVoOcjxy5qySauU5e5hLF70sgj0wxuf7uYM avTA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=J8hFxeau; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=wzuTYObyx3wSXKuC0uWvwS6BkRfJOo7sdzvSZfPgW2c=; b=R80fZJWY/F3zNAQ+J751g8hglek9va3iEvANvJ/i+yeE7ob9FHNy5dQG4zVtrlL20v N8mzQsKVxJkgrvgUN/oLumY9axlXvgxWDH5NX/30tr8K/qA3wALpInOR36A4HSr8xfwm KwwgDHtmCQY5R7IottQKrAdaiAY8jOLoN7oDg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id :in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=wzuTYObyx3wSXKuC0uWvwS6BkRfJOo7sdzvSZfPgW2c=; b=nOfCvHyHSjwxAOcDKRPlPJEhW3fvyDOeA3kulak6ToAlPJN8Ae8Wedbtx9lMRDZUax iPCumM0BGWmayy1ZFkSQh+wUXGl9nCr+HTKUl2Qz9A1ZPCBYqZYfU79ie3jw42n07PbE uVT7g38P2iJQ++prz2McE1RGR3LXJhHTEC74FO3gunjygwV+cpsfWN5cJWwIsinIU9sl KnHdLwX/LcKJ43aJ1lUCSsmGTgZKv8Tr76DyfQGbPIX8XfSBgdoEvVHdGwW3AZoosWWX NtffYYXdAH5JVQBfTPmfkXK2xBxP6NRTS2887X5k09Ip7aKaVcr6o2oqhwThRJXfOoT7 xlmA== X-Gm-Message-State: AGi0PuZuINNovzw9cIcKgBO4sdWNyu2CMw8D+9zW+YIstx6kaVsay/DC zuN/GfsAP6a6HFG3qO8AiJ+O6PkX X-Google-Smtp-Source: APiQypIf3UBUnGD9TEEMWFP1ChxLkREAFnR0wUOG+ZF9M8yV7UCXdnz+Rb1U1w5XEkchqHKqEsRXXg== X-Received: by 2002:a63:358f:: with SMTP id c137mr16305237pga.178.1587387176489; Mon, 20 Apr 2020 05:52:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:ed0f:: with SMTP id d15ls2799953pgi.11.gmail; Mon, 20 Apr 2020 05:52:56 -0700 (PDT) X-Received: by 2002:a63:5fd0:: with SMTP id t199mr16675038pgb.207.1587387175958; Mon, 20 Apr 2020 05:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587387175; cv=none; d=google.com; s=arc-20160816; b=FcEplh8QxQxNuQAHkJWWHzOLiBhWSUTQPP3KY17sPN3bZ8lVoDPtNFQKnSF7Z919ro s6wTUdcAAxNhHX+lVGPuyvrHkrRj1jFTrg4nCc5vgPOiuAHALnArX9VVCnnVqocMNVKM K5CAgQ/tiZxMlE59sD1ncwNw1FRy49TX0ihx22VNj+xkgNeqpxI1UOsFw1TqNmHFheah E3n9cOeTZVf6KXhvKdNlxLim4NlxqYlPSlAGUvf+oVQq3zJB/uvxau/ku/C0d61X2Gw7 3F/+QomtKbjl96p9lCgFrA8ikxhtpJpAgrVrUoUwkJu9GQBK44bIsnBu0jl4IIMbz/EM cVzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VCMkQhRht3TDfsJHW0HlLX+fWnwrzuKVWaLj9CID1Ks=; b=JSh4TsV1NZF8aJXwd27y8ZE2pCxx/MZByX9Kv+pgmSRX7m9RGxo3F+pqwx3lTR/y+o BDFh/ZBNfiHixw5Nf2B6eOFSCUY32eHmwZrs/zAohdBI+fl7D5G5n+Vsx7fzAcK3zZsO kFbOFPqtLl0bbkLz6rmC0lyd4hAURcME0MpH1crdIhb9wOVWnd2SZYewbVVHbeaKcDjq KIQTLMPlvSrHYFbOpnu++k9hTCXtzF31Y+pIN6qAcAI0Q+j51jgz91jQPaa8LEK226lk t8uwNXwxFceGcCWy7kIUEzgMUWfMXq3rs076B1T9q/MMEK1/v/uFxNdjgr/9NtjscS82 rxzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=J8hFxeau; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id u9sor1220563pgg.44.2020.04.20.05.52.55 for (Google Transport Security); Mon, 20 Apr 2020 05:52:55 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a63:230f:: with SMTP id j15mr16411433pgj.393.1587387175637; Mon, 20 Apr 2020 05:52:55 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:7ddc:e17b:a9b3:404]) by smtp.gmail.com with ESMTPSA id i25sm1036932pfd.140.2020.04.20.05.52.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 05:52:55 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Cc: Rick Chen , Bin Meng , Bhargav Shah , Sagar Shrikant Kadam , linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v3 3/3] sifive: fu540: Enable spi-nor flash support Date: Mon, 20 Apr 2020 18:22:38 +0530 Message-Id: <20200420125238.9610-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420125238.9610-1-jagan@amarulasolutions.com> References: <20200420125238.9610-1-jagan@amarulasolutions.com> X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=J8hFxeau; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , HiFive Unleashed A00 support is25wp256 spi-nor flash, So enable the same and add test result log for future reference. Tested on SiFive FU540 board. Signed-off-by: Jagan Teki Reviewed-by: Bin Meng --- Changes for v3: - drop sf commands log arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi | 1 + board/sifive/fu540/Kconfig | 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi index 25ec8265a5..d7a64134db 100644 --- a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi @@ -5,6 +5,7 @@ / { aliases { + spi0 = &qspi0; spi2 = &qspi2; }; }; diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig index 5ca21474de..75661f35f8 100644 --- a/board/sifive/fu540/Kconfig +++ b/board/sifive/fu540/Kconfig @@ -26,6 +26,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply CMD_FS_GENERIC imply CMD_NET imply CMD_PING + imply CMD_SF imply CLK_SIFIVE imply CLK_SIFIVE_FU540_PRCI imply DOS_PARTITION @@ -40,6 +41,8 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply SIFIVE_SERIAL imply SPI imply SPI_SIFIVE + imply SPI_FLASH + imply SPI_FLASH_ISSI imply MMC imply MMC_SPI imply MMC_BROKEN_CD