From patchwork Mon Oct 21 03:38:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1180247 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="TLzq/voh"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46xNVK4rtzz9s4Y for ; Mon, 21 Oct 2019 15:11:05 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 06551C21DE8; Mon, 21 Oct 2019 03:56:23 +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 78DF5C21DD9; Mon, 21 Oct 2019 03:56:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7E660C21D65; Mon, 21 Oct 2019 03:40:42 +0000 (UTC) Received: from mail-il1-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) by lists.denx.de (Postfix) with ESMTPS id 3FCFAC21DF3 for ; Mon, 21 Oct 2019 03:40:42 +0000 (UTC) Received: by mail-il1-f195.google.com with SMTP id y5so10684586ilb.5 for ; Sun, 20 Oct 2019 20:40:42 -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=sSYNfVQ9TrzuwjCuqCClfC4okJ28I6MoFJ+H6tg/IG8=; b=TLzq/voh4EnBqdNk+b/wINgEBK4qR2Itt2eX956HAhIp2umpEB6ghZ2+YlAfwe0OGN HV/tcktNvOmaWPJsGQyadbnA5h39oh6afI91V+QR2/k+X8ZYQP5gSg18a8G1Czgu01fY RnHuX3hMb/STix2CcmBhYy2/x356p3wmSYtiI= 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=sSYNfVQ9TrzuwjCuqCClfC4okJ28I6MoFJ+H6tg/IG8=; b=OdivSVTQe/0TV73BRVG5X0HzyCVHZUMSy6JAMMtCsx1sLuzNWm+dcMsh74gen6knoT lJ/z9afaJDJvPyHUSC7JR64QClD3mYHFl2M9VsejnyIyCVhDVG+ooy6GCR1/07x+h8j9 ot8ZoENYbIILSeMoybWGYCBkB4SphRgSG4VLEsrtK6sDp5GGyswIa60uZ4vvgA5Oqubx 1tiL9KE+gfNwHJa1IryMCridKyYrNJncv3NvP3akpXC/I/3smAGIdrNai2fHvQMcaMOq Fn9rEzgzuqOnPTW/V+AijsKgx70yc9PA2LpTBMU+ketBK80ZLUlxvpSGNNC5DLeIQqtx HXPw== X-Gm-Message-State: APjAAAU5ScQ20gZCbW5jBXj+o9Qxfa0bH+DCj5MENql9wGH7KSdYbc2a rHdVLw5CB9vpVVNgPjie6BKNtxigL9CrNw== X-Google-Smtp-Source: APXvYqyvyEaut1kAfUmOKfWjZgK5VSHEk1tIhSoNCH7VW3hVkjyNfrL0hhKIuYAw3BBPAI5IO9IZFw== X-Received: by 2002:a92:c991:: with SMTP id y17mr6023323iln.306.1571629240990; Sun, 20 Oct 2019 20:40:40 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2019 20:40:40 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 20 Oct 2019 21:38:45 -0600 Message-Id: <20191021033913.220758-75-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 080/108] spi: ich: Various small tidy-ups 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" Use debug() instead of printf() to reduce code size and change a bool return value to the use the 'bool' type. Also drop the global data declaration since it not actually used. Finally, set the log category. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v3: None Changes in v2: None drivers/spi/ich.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c index 516b859a674..e2bc77bbd58 100644 --- a/drivers/spi/ich.c +++ b/drivers/spi/ich.c @@ -5,6 +5,8 @@ * This file is derived from the flashrom project. */ +#define LOG_CATEGORY UCLASS_SPI + #include #include #include @@ -19,8 +21,6 @@ #include "ich.h" -DECLARE_GLOBAL_DATA_PTR; - #ifdef DEBUG_TRACE #define debug_trace(fmt, args...) debug(fmt, ##args) #else @@ -96,7 +96,7 @@ static void ich_set_bbar(struct ich_spi_priv *ctlr, uint32_t minaddr) } /* @return 1 if the SPI flash supports the 33MHz speed */ -static int ich9_can_do_33mhz(struct udevice *dev) +static bool ich9_can_do_33mhz(struct udevice *dev) { u32 fdod, speed; @@ -172,8 +172,7 @@ static int spi_setup_opcode(struct ich_spi_priv *ctlr, struct spi_trans *trans, } if (opcode_index == ctlr->menubytes) { - printf("ICH SPI: Opcode %x not found\n", - trans->opcode); + debug("ICH SPI: Opcode %x not found\n", trans->opcode); return -EINVAL; } @@ -181,8 +180,8 @@ static int spi_setup_opcode(struct ich_spi_priv *ctlr, struct spi_trans *trans, optype = (optypes >> (opcode_index * 2)) & 0x3; if (optype != trans->type) { - printf("ICH SPI: Transaction doesn't fit type %d\n", - optype); + debug("ICH SPI: Transaction doesn't fit type %d\n", + optype); return -ENOSPC; } return opcode_index; @@ -213,9 +212,9 @@ static int ich_status_poll(struct ich_spi_priv *ctlr, u16 bitmask, } udelay(10); } + debug("ICH SPI: SCIP timeout, read %x, expected %x, wts %x %x\n", + status, bitmask, wait_til_set, status & bitmask); - printf("ICH SPI: SCIP timeout, read %x, expected %x\n", - status, bitmask); return -ETIMEDOUT; }