All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@st.com>
To: u-boot@lists.denx.de
Subject: [PATCH 25/33] spi: stm32_qspi: migrate trace to dev and log macro
Date: Wed, 21 Oct 2020 12:34:18 +0000	[thread overview]
Message-ID: <1713ba72-283a-b6ae-4e93-c078090aa565@st.com> (raw)
In-Reply-To: <20201014091646.4233-26-patrick.delaunay@st.com>

Hi Patrick

On 10/14/20 11:16 AM, Patrick Delaunay wrote:
> Change debug/pr_* to log_* or dev_* macro and define LOG_CATEGORY.
>
> Remove the "%s:" __func__  header as it is managed by dev macro
> (dev->name is displayed) or log macro (CONFIG_LOGF_FUNC).
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  drivers/spi/stm32_qspi.c | 46 ++++++++++++++++++++++------------------
>  1 file changed, 25 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c
> index a53b941410..d46adcb19a 100644
> --- a/drivers/spi/stm32_qspi.c
> +++ b/drivers/spi/stm32_qspi.c
> @@ -7,6 +7,8 @@
>   * STM32 QSPI driver
>   */
>  
> +#define LOG_CATEGORY UCLASS_SPI
> +
>  #include <common.h>
>  #include <clk.h>
>  #include <dm.h>
> @@ -136,7 +138,7 @@ static int _stm32_qspi_wait_for_not_busy(struct stm32_qspi_priv *priv)
>  				 !(sr & STM32_QSPI_SR_BUSY),
>  				 STM32_BUSY_TIMEOUT_US);
>  	if (ret)
> -		pr_err("busy timeout (stat:%#x)\n", sr);
> +		log_err("busy timeout (stat:%#x)\n", sr);
>  
>  	return ret;
>  }
> @@ -154,9 +156,9 @@ static int _stm32_qspi_wait_cmd(struct stm32_qspi_priv *priv,
>  				 sr & STM32_QSPI_SR_TCF,
>  				 STM32_QSPI_CMD_TIMEOUT_US);
>  	if (ret) {
> -		pr_err("cmd timeout (stat:%#x)\n", sr);
> +		log_err("cmd timeout (stat:%#x)\n", sr);
>  	} else if (readl(&priv->regs->sr) & STM32_QSPI_SR_TEF) {
> -		pr_err("transfer error (stat:%#x)\n", sr);
> +		log_err("transfer error (stat:%#x)\n", sr);
>  		ret = -EIO;
>  	}
>  
> @@ -198,7 +200,7 @@ static int _stm32_qspi_poll(struct stm32_qspi_priv *priv,
>  					 sr & STM32_QSPI_SR_FTF,
>  					 STM32_QSPI_FIFO_TIMEOUT_US);
>  		if (ret) {
> -			pr_err("fifo timeout (len:%d stat:%#x)\n", len, sr);
> +			log_err("fifo timeout (len:%d stat:%#x)\n", len, sr);
>  			return ret;
>  		}
>  
> @@ -246,10 +248,10 @@ static int stm32_qspi_exec_op(struct spi_slave *slave,
>  	u8 mode = STM32_QSPI_CCR_IND_WRITE;
>  	int timeout, ret;
>  
> -	debug("%s: cmd:%#x mode:%d.%d.%d.%d addr:%#llx len:%#x\n",
> -	      __func__, op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
> -	      op->dummy.buswidth, op->data.buswidth,
> -	      op->addr.val, op->data.nbytes);
> +	dev_dbg(slave->dev, "cmd:%#x mode:%d.%d.%d.%d addr:%#llx len:%#x\n",
> +		op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
> +		op->dummy.buswidth, op->data.buswidth,
> +		op->addr.val, op->data.nbytes);
>  
>  	ret = _stm32_qspi_wait_for_not_busy(priv);
>  	if (ret)
> @@ -320,7 +322,7 @@ abort:
>  	writel(STM32_QSPI_FCR_CTCF, &priv->regs->fcr);
>  
>  	if (ret || timeout)
> -		pr_err("%s ret:%d abort timeout:%d\n", __func__, ret, timeout);
> +		dev_err(slave->dev, "ret:%d abort timeout:%d\n", ret, timeout);
>  
>  	return ret;
>  }
> @@ -353,8 +355,8 @@ static int stm32_qspi_probe(struct udevice *bus)
>  	if (priv->mm_size > STM32_QSPI_MAX_MMAP_SZ)
>  		return -EINVAL;
>  
> -	debug("%s: regs=<0x%p> mapped=<0x%p> mapped_size=<0x%lx>\n",
> -	      __func__, priv->regs, priv->mm_base, priv->mm_size);
> +	dev_dbg(bus, "regs=<0x%p> mapped=<0x%p> mapped_size=<0x%lx>\n",
> +		priv->regs, priv->mm_base, priv->mm_size);
>  
>  	ret = clk_get_by_index(bus, 0, &clk);
>  	if (ret < 0)
> @@ -475,8 +477,8 @@ static int stm32_qspi_set_speed(struct udevice *bus, uint speed)
>  			STM32_QSPI_DCR_CSHT_MASK << STM32_QSPI_DCR_CSHT_SHIFT,
>  			csht << STM32_QSPI_DCR_CSHT_SHIFT);
>  
> -	debug("%s: regs=%p, speed=%d\n", __func__, priv->regs,
> -	      (qspi_clk / (prescaler + 1)));
> +	dev_dbg(bus, "regs=%p, speed=%d\n", priv->regs,
> +		(qspi_clk / (prescaler + 1)));
>  
>  	return 0;
>  }
> @@ -485,6 +487,7 @@ static int stm32_qspi_set_mode(struct udevice *bus, uint mode)
>  {
>  	struct stm32_qspi_priv *priv = dev_get_priv(bus);
>  	int ret;
> +	const char *str_rx, *str_tx;
>  
>  	ret = _stm32_qspi_wait_for_not_busy(priv);
>  	if (ret)
> @@ -500,21 +503,22 @@ static int stm32_qspi_set_mode(struct udevice *bus, uint mode)
>  	if (mode & SPI_CS_HIGH)
>  		return -ENODEV;
>  
> -	debug("%s: regs=%p, mode=%d rx: ", __func__, priv->regs, mode);
> -
>  	if (mode & SPI_RX_QUAD)
> -		debug("quad, tx: ");
> +		str_rx = "quad";
>  	else if (mode & SPI_RX_DUAL)
> -		debug("dual, tx: ");
> +		str_rx = "dual";
>  	else
> -		debug("single, tx: ");
> +		str_rx = "single";
>  
>  	if (mode & SPI_TX_QUAD)
> -		debug("quad\n");
> +		str_tx = "quad";
>  	else if (mode & SPI_TX_DUAL)
> -		debug("dual\n");
> +		str_tx = "dual";
>  	else
> -		debug("single\n");
> +		str_tx = "single";
> +
> +	dev_dbg(bus, "regs=%p, mode=%d rx: %s, tx: %s\n",
> +		priv->regs, mode, str_rx, str_tx);
>  
>  	return 0;
>  }

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>

Thanks

  reply	other threads:[~2020-10-21 12:34 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14  9:16 [PATCH 00/33] stm32: enable logging features Patrick Delaunay
2020-10-14  9:16 ` [PATCH 01/33] arm: stm32mp: migrate trace to log macro Patrick Delaunay
2020-10-21 12:01   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 02/33] arm: stm32mp: migrate cmd_stm32prog " Patrick Delaunay
2020-10-21 12:01   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 03/33] arm: stm32mp: bsec: migrate trace " Patrick Delaunay
2020-10-21 12:01   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 04/33] pinctrl: stm32: " Patrick Delaunay
2020-10-21 12:38   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 05/33] gpio: stm32-gpio: migrate trace to dev and " Patrick Delaunay
2020-10-21 12:24   ` Patrice CHOTARD
2020-10-21 12:29   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 06/33] remoproc: stm32: migrate trace to " Patrick Delaunay
2020-10-21 12:25   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 07/33] ram: " Patrick Delaunay
2020-10-21 12:25   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 08/33] ram: stm32mp1: migrate trace to dev or " Patrick Delaunay
2020-10-21 12:25   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 09/33] mmc: stm32_sdmmc2: migrate trace to dev and " Patrick Delaunay
2020-10-15 10:25   ` Peng Fan
2020-10-21 12:26   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 10/33] timer: stm32: migrate trace to " Patrick Delaunay
2020-10-21 12:26   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 11/33] hwspinlock: " Patrick Delaunay
2020-10-21 12:26   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 12/33] rtc: " Patrick Delaunay
2020-10-21 12:26   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 13/33] watchdog: stm32mp: migrate trace to dev macro Patrick Delaunay
2020-10-21 12:27   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 14/33] power: regulator: stm32-verfbuf: define LOG_CATEGORY Patrick Delaunay
2020-10-21 12:27   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 15/33] misc: rcc: migrate trace to dev macro Patrick Delaunay
2020-10-21 12:27   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 16/33] misc: rcc: keep the rcc device name for subnode Patrick Delaunay
2020-10-21 12:28   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 17/33] clk: stm32mp1: migrate trace to dev and log macro Patrick Delaunay
2020-10-21 12:28   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 18/33] clk: clk_stm32f: " Patrick Delaunay
2020-10-21 12:32   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 19/33] clk: clk_stm32h7: " Patrick Delaunay
2020-10-21 12:32   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 20/33] reset: stm32-reset: " Patrick Delaunay
2020-10-21 12:32   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 21/33] mailbox: stm32-ipcc: " Patrick Delaunay
2020-10-21 12:33   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 22/33] i2c: stm32f7_i2c: " Patrick Delaunay
2020-10-21 12:33   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 23/33] phy: stm32-usbphyc: " Patrick Delaunay
2020-10-21 12:33   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 24/33] spi: stm32_spi: " Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 25/33] spi: stm32_qspi: " Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD [this message]
2020-10-14  9:16 ` [PATCH 26/33] mtd: stm32_fmc2: " Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 27/33] memory: stm32-fmc2: " Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 28/33] serial: stm32: define LOG_CATEGORY Patrick Delaunay
2020-10-21 12:34   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 29/33] video: stm32_ltdc: migrate trace to dev and log macro Patrick Delaunay
2020-10-21 12:35   ` Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 30/33] video: stm32_dsi: " Patrick Delaunay
2020-10-15  8:50   ` Philippe CORNU
2020-10-14  9:16 ` [PATCH 31/33] board: st: stm32mp1: " Patrick Delaunay
2020-10-21 12:35   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 32/33] board: st: common: " Patrick Delaunay
2020-10-21 12:36   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-14  9:16 ` [PATCH 33/33] configs: stm32mp15: enable LOG features Patrick Delaunay
2020-10-21 12:37   ` [Uboot-stm32] " Patrice CHOTARD
2020-10-15 15:05 ` [PATCH 00/33] stm32: enable logging features Simon Glass
2020-10-15 15:59   ` Patrick DELAUNAY
2020-10-26 19:22     ` Simon Glass
2020-10-28 11:52       ` Patrick DELAUNAY
2020-10-30 18:15         ` Simon Glass
2020-11-06 17:45           ` Patrick DELAUNAY
2020-11-06 18:50             ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1713ba72-283a-b6ae-4e93-c078090aa565@st.com \
    --to=patrice.chotard@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.