* [PATCH 0/3] Some rockchip_spi fixes and debug support
@ 2016-02-15 8:27 Shawn Lin
2016-02-15 8:27 ` [PATCH 1/3] spi: rockchip: disable runtime pm when in err case Shawn Lin
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Shawn Lin @ 2016-02-15 8:27 UTC (permalink / raw)
To: Mark Brown
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Shawn Lin
This patchset fix some missing err handles of rockchip_spi.
And it also add debugfs support for rockchip_spi in order to trace
the driver's and controller's state.
Shawn Lin (3):
spi: rockchip: disable runtime pm when in err case
spi: rockchip: add missing spi_master_put
spi: rockchip: add debug interface support
drivers/spi/spi-rockchip.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
--
2.3.7
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] spi: rockchip: disable runtime pm when in err case
2016-02-15 8:27 [PATCH 0/3] Some rockchip_spi fixes and debug support Shawn Lin
@ 2016-02-15 8:27 ` Shawn Lin
[not found] ` <1455524878-2696-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-02-15 8:28 ` [PATCH 2/3] spi: rockchip: add missing spi_master_put Shawn Lin
[not found] ` <1455524848-2646-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2 siblings, 1 reply; 8+ messages in thread
From: Shawn Lin @ 2016-02-15 8:27 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-spi, linux-kernel, Shawn Lin
Before registering master, driver enables runtime pm.
This patch pm_runtime_disable in err case while probing
driver to balance pm reference count.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/spi/spi-rockchip.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 79a8bc4..c0f9bae 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -749,6 +749,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
return 0;
err_register_master:
+ pm_runtime_disable(&pdev->dev);
if (rs->dma_tx.ch)
dma_release_channel(rs->dma_tx.ch);
if (rs->dma_rx.ch)
--
2.3.7
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] spi: rockchip: add missing spi_master_put
2016-02-15 8:27 [PATCH 0/3] Some rockchip_spi fixes and debug support Shawn Lin
2016-02-15 8:27 ` [PATCH 1/3] spi: rockchip: disable runtime pm when in err case Shawn Lin
@ 2016-02-15 8:28 ` Shawn Lin
[not found] ` <1455524892-2739-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
[not found] ` <1455524848-2646-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2 siblings, 1 reply; 8+ messages in thread
From: Shawn Lin @ 2016-02-15 8:28 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-spi, linux-kernel, Shawn Lin
Add missing spi_master_put for rockchip_spi_remove since
it calls spi_master_get already.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/spi/spi-rockchip.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index c0f9bae..7cb1b2d 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -779,6 +779,8 @@ static int rockchip_spi_remove(struct platform_device *pdev)
if (rs->dma_rx.ch)
dma_release_channel(rs->dma_rx.ch);
+ spi_master_put(master);
+
return 0;
}
--
2.3.7
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] spi: rockchip: add debug interface support
[not found] ` <1455524848-2646-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2016-02-15 8:28 ` Shawn Lin
2016-02-15 17:26 ` Mark Brown
0 siblings, 1 reply; 8+ messages in thread
From: Shawn Lin @ 2016-02-15 8:28 UTC (permalink / raw)
To: Mark Brown
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Shawn Lin
Add debugfs support for user to debug rockchip spi
problems.
Signed-off-by: Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
drivers/spi/spi-rockchip.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 7cb1b2d..e858393 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -28,6 +28,10 @@
#include <linux/io.h>
#include <linux/dmaengine.h>
+#ifdef CONFIG_DEBUG_FS
+#include <linux/debugfs.h>
+#endif
+
#define DRIVER_NAME "rockchip-spi"
/* SPI register offsets */
@@ -199,8 +203,81 @@ struct rockchip_spi {
struct sg_table rx_sg;
struct rockchip_spi_dma_data dma_rx;
struct rockchip_spi_dma_data dma_tx;
+
+ #ifdef CONFIG_DEBUG_FS
+ struct dentry *debugfs;
+ #endif
+};
+
+#ifdef CONFIG_DEBUG_FS
+static int rockchip_spi_dbg_show(struct seq_file *s, void *v)
+{
+ struct rockchip_spi *rs = s->private;
+
+ seq_printf(s, "CTRLR0:\t0x%08x\n",
+ readl_relaxed(rs->regs + ROCKCHIP_SPI_CTRLR0));
+ seq_printf(s, "CTRLR1:\t0x%08x\n",
+ readl_relaxed(rs->regs + ROCKCHIP_SPI_CTRLR1));
+ seq_printf(s, "BAUDR:\t0x%08x\n",
+ readl_relaxed(rs->regs + ROCKCHIP_SPI_BAUDR));
+ seq_printf(s, "TXFTLR:\t0x%08x\n",
+ readl_relaxed(rs->regs + ROCKCHIP_SPI_TXFTLR));
+ seq_printf(s, "RXFTLR:\t0x%08x\n",
+ readl_relaxed(rs->regs + ROCKCHIP_SPI_RXFTLR));
+ seq_printf(s, "SR:\t0x%08x\n",
+ readl_relaxed(rs->regs + ROCKCHIP_SPI_SR));
+ seq_printf(s, "ISR:\t0x%08x\n",
+ readl_relaxed(rs->regs + ROCKCHIP_SPI_ISR));
+ seq_printf(s, "DMACR:\t0x%08x\n",
+ readl_relaxed(rs->regs + ROCKCHIP_SPI_DMACR));
+ seq_printf(s, "rs->state:\t0x%08x\n", rs->state);
+ seq_printf(s, "rs->speed:\t0x%08x\n", rs->speed);
+ seq_printf(s, "rs->tmode:\t0x%08x\n", rs->tmode);
+ seq_printf(s, "rs->mode:\t0x%08x\n", rs->mode);
+
+ return 0;
+}
+
+static int rockchip_spi_dbg_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, rockchip_spi_dbg_show, inode->i_private);
+}
+
+static const struct file_operations rockchip_spi_dbg_ops = {
+ .owner = THIS_MODULE,
+ .open = rockchip_spi_dbg_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+static int rockchip_spi_debugfs_init(struct rockchip_spi *rs)
+{
+ rs->debugfs = debugfs_create_dir("rockchip_spi", NULL);
+ if (!rs->debugfs)
+ return -ENOMEM;
+
+ debugfs_create_file("regs", S_IFREG | S_IRUGO,
+ rs->debugfs, (void *)rs, &rockchip_spi_dbg_ops);
+ return 0;
+}
+
+static void rockchip_spi_debugfs_remove(struct rockchip_spi *rs)
+{
+ debugfs_remove_recursive(rs->debugfs);
+}
+#else
+static inline int rockchip_spi_debugfs_init(struct rockchip_spi *rs)
+{
+ return 0;
+}
+
+static inline void rockchip_spi_debugfs_remove(struct rockchip_spi *rs)
+{
+}
+#endif /* CONFIG_DEBUG_FS */
+
+
static inline void spi_enable_chip(struct rockchip_spi *rs, int enable)
{
writel_relaxed((enable ? 1 : 0), rs->regs + ROCKCHIP_SPI_SSIENR);
@@ -746,6 +823,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
goto err_register_master;
}
+ rockchip_spi_debugfs_init(rs);
return 0;
err_register_master:
@@ -770,6 +848,7 @@ static int rockchip_spi_remove(struct platform_device *pdev)
struct rockchip_spi *rs = spi_master_get_devdata(master);
pm_runtime_disable(&pdev->dev);
+ rockchip_spi_debugfs_remove(rs);
clk_disable_unprepare(rs->spiclk);
clk_disable_unprepare(rs->apb_pclk);
--
2.3.7
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Applied "spi: rockchip: add missing spi_master_put" to the spi tree
[not found] ` <1455524892-2739-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2016-02-15 12:28 ` Mark Brown
0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2016-02-15 12:28 UTC (permalink / raw)
To: Shawn Lin, Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA
The patch
spi: rockchip: add missing spi_master_put
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 844c9f476a43db0bdf61df409026a026ce98ec1b Mon Sep 17 00:00:00 2001
From: Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Date: Mon, 15 Feb 2016 16:28:12 +0800
Subject: [PATCH] spi: rockchip: add missing spi_master_put
Add missing spi_master_put for rockchip_spi_remove since
it calls spi_master_get already.
Signed-off-by: Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/spi/spi-rockchip.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index c0f9baee1e91..7cb1b2d710c1 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -779,6 +779,8 @@ static int rockchip_spi_remove(struct platform_device *pdev)
if (rs->dma_rx.ch)
dma_release_channel(rs->dma_rx.ch);
+ spi_master_put(master);
+
return 0;
}
--
2.7.0
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Applied "spi: rockchip: disable runtime pm when in err case" to the spi tree
[not found] ` <1455524878-2696-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2016-02-15 12:28 ` Mark Brown
0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2016-02-15 12:28 UTC (permalink / raw)
To: Shawn Lin, Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA
The patch
spi: rockchip: disable runtime pm when in err case
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From b8659adda9e295eca0b10a67f3b15a8644c8ed6f Mon Sep 17 00:00:00 2001
From: Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Date: Mon, 15 Feb 2016 16:27:58 +0800
Subject: [PATCH] spi: rockchip: disable runtime pm when in err case
Before registering master, driver enables runtime pm.
This patch pm_runtime_disable in err case while probing
driver to balance pm reference count.
Signed-off-by: Shawn Lin <shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/spi/spi-rockchip.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 79a8bc4f6cec..c0f9baee1e91 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -749,6 +749,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
return 0;
err_register_master:
+ pm_runtime_disable(&pdev->dev);
if (rs->dma_tx.ch)
dma_release_channel(rs->dma_tx.ch);
if (rs->dma_rx.ch)
--
2.7.0
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] spi: rockchip: add debug interface support
2016-02-15 8:28 ` [PATCH 3/3] spi: rockchip: add debug interface support Shawn Lin
@ 2016-02-15 17:26 ` Mark Brown
[not found] ` <20160215172632.GQ18988-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2016-02-15 17:26 UTC (permalink / raw)
To: Shawn Lin; +Cc: linux-spi, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 827 bytes --]
On Mon, Feb 15, 2016 at 04:28:22PM +0800, Shawn Lin wrote:
> +#ifdef CONFIG_DEBUG_FS
> +#include <linux/debugfs.h>
> +#endif
Just include the header. Only add ifdefs if they do something.
> +static int rockchip_spi_debugfs_init(struct rockchip_spi *rs)
> +{
> + rs->debugfs = debugfs_create_dir("rockchip_spi", NULL);
> + if (!rs->debugfs)
> + return -ENOMEM;
> +
> + debugfs_create_file("regs", S_IFREG | S_IRUGO,
> + rs->debugfs, (void *)rs, &rockchip_spi_dbg_ops);
> + return 0;
> +}
This is completely separate to the core debugfs support for SPI, if
we're adding new debugfs stuff that's per device we should be extending
the core debugfs stuff so everything is in one place.
Your register dump stuff looks like you might want to consider using
regmap, it's got this and other register access diagnostics already.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] spi: rockchip: add debug interface support
[not found] ` <20160215172632.GQ18988-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2016-02-16 1:32 ` Shawn Lin
0 siblings, 0 replies; 8+ messages in thread
From: Shawn Lin @ 2016-02-16 1:32 UTC (permalink / raw)
To: Mark Brown
Cc: shawn.lin-TNX95d0MmH7DzftRWevZcw,
shawn.lin-NgiFYW8Wbx6Ta72+1OMJgUB+6BGkLq7r,
linux-spi-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi Mark,
On 2016/2/16 1:26, Mark Brown wrote:
> On Mon, Feb 15, 2016 at 04:28:22PM +0800, Shawn Lin wrote:
>
>> +#ifdef CONFIG_DEBUG_FS
>> +#include <linux/debugfs.h>
>> +#endif
>
> Just include the header. Only add ifdefs if they do something.
>
>> +static int rockchip_spi_debugfs_init(struct rockchip_spi *rs)
>> +{
>> + rs->debugfs = debugfs_create_dir("rockchip_spi", NULL);
>> + if (!rs->debugfs)
>> + return -ENOMEM;
>> +
>> + debugfs_create_file("regs", S_IFREG | S_IRUGO,
>> + rs->debugfs, (void *)rs, &rockchip_spi_dbg_ops);
>> + return 0;
>> +}
>
> This is completely separate to the core debugfs support for SPI, if
> we're adding new debugfs stuff that's per device we should be extending
> the core debugfs stuff so everything is in one place.
yes, I will check the spi core debugfs to see how we can extend it
for per device to dump specific msg.
Thanks.
>
> Your register dump stuff looks like you might want to consider using
> regmap, it's got this and other register access diagnostics already.
>
--
Best Regards
Shawn Lin
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-02-16 1:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-15 8:27 [PATCH 0/3] Some rockchip_spi fixes and debug support Shawn Lin
2016-02-15 8:27 ` [PATCH 1/3] spi: rockchip: disable runtime pm when in err case Shawn Lin
[not found] ` <1455524878-2696-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-02-15 12:28 ` Applied "spi: rockchip: disable runtime pm when in err case" to the spi tree Mark Brown
2016-02-15 8:28 ` [PATCH 2/3] spi: rockchip: add missing spi_master_put Shawn Lin
[not found] ` <1455524892-2739-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-02-15 12:28 ` Applied "spi: rockchip: add missing spi_master_put" to the spi tree Mark Brown
[not found] ` <1455524848-2646-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-02-15 8:28 ` [PATCH 3/3] spi: rockchip: add debug interface support Shawn Lin
2016-02-15 17:26 ` Mark Brown
[not found] ` <20160215172632.GQ18988-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-02-16 1:32 ` Shawn Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).