All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: broonie@kernel.org
Cc: Neil Armstrong <narmstrong@baylibre.com>,
	linux-spi@vger.kernel.org, linux-amlogic@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Sunny Luo <sunny.luo@amlogic.com>,
	Yixun Lan <yixun.lan@amlogic.com>
Subject: [PATCH 4/9] spi: meson-spicc: support max 80MHz clock
Date: Thu, 12 Mar 2020 14:31:26 +0100	[thread overview]
Message-ID: <20200312133131.26430-5-narmstrong@baylibre.com> (raw)
In-Reply-To: <20200312133131.26430-1-narmstrong@baylibre.com>

The SPICC controller in Meson-AXG is capable of running at 80M clock.
The ASIC IP is improved and the clock is actually running higher than
previous old SoCs.

Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/spi/spi-meson-spicc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index bd434d9055d9..710b4e780daa 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -35,7 +35,6 @@
  *   to have a CS go down over the full transfer
  */
 
-#define SPICC_MAX_FREQ	30000000
 #define SPICC_MAX_BURST	128
 
 /* Register Map */
@@ -132,6 +131,7 @@
 #define SPICC_FIFO_HALF 10
 
 struct meson_spicc_data {
+	unsigned int			max_speed_hz;
 	bool				has_oen;
 	bool				has_enhance_clk_div;
 };
@@ -693,11 +693,9 @@ static int meson_spicc_probe(struct platform_device *pdev)
 	master->transfer_one = meson_spicc_transfer_one;
 	master->use_gpio_descriptors = true;
 
-	/* Setup max rate according to the Meson GX datasheet */
-	if ((rate >> 2) > SPICC_MAX_FREQ)
-		master->max_speed_hz = SPICC_MAX_FREQ;
-	else
-		master->max_speed_hz = rate >> 2;
+	/* Setup max rate according to the Meson datasheet */
+	master->max_speed_hz = min_t(unsigned int, rate >> 1,
+				     spicc->data->max_speed_hz);
 
 	meson_spicc_oen_enable(spicc);
 
@@ -737,9 +735,11 @@ static int meson_spicc_remove(struct platform_device *pdev)
 }
 
 static const struct meson_spicc_data meson_spicc_gx_data = {
+	.max_speed_hz		= 30000000,
 };
 
 static const struct meson_spicc_data meson_spicc_axg_data = {
+	.max_speed_hz		= 80000000,
 	.has_oen		= true,
 	.has_enhance_clk_div	= true,
 };
-- 
2.22.0


WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
To: broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: Neil Armstrong
	<narmstrong-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Sunny Luo <sunny.luo-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>,
	Yixun Lan <yixun.lan-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH 4/9] spi: meson-spicc: support max 80MHz clock
Date: Thu, 12 Mar 2020 14:31:26 +0100	[thread overview]
Message-ID: <20200312133131.26430-5-narmstrong@baylibre.com> (raw)
In-Reply-To: <20200312133131.26430-1-narmstrong-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>

The SPICC controller in Meson-AXG is capable of running at 80M clock.
The ASIC IP is improved and the clock is actually running higher than
previous old SoCs.

Signed-off-by: Sunny Luo <sunny.luo-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Yixun Lan <yixun.lan-LpR1jeaWuhtBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Neil Armstrong <narmstrong-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
---
 drivers/spi/spi-meson-spicc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index bd434d9055d9..710b4e780daa 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -35,7 +35,6 @@
  *   to have a CS go down over the full transfer
  */
 
-#define SPICC_MAX_FREQ	30000000
 #define SPICC_MAX_BURST	128
 
 /* Register Map */
@@ -132,6 +131,7 @@
 #define SPICC_FIFO_HALF 10
 
 struct meson_spicc_data {
+	unsigned int			max_speed_hz;
 	bool				has_oen;
 	bool				has_enhance_clk_div;
 };
@@ -693,11 +693,9 @@ static int meson_spicc_probe(struct platform_device *pdev)
 	master->transfer_one = meson_spicc_transfer_one;
 	master->use_gpio_descriptors = true;
 
-	/* Setup max rate according to the Meson GX datasheet */
-	if ((rate >> 2) > SPICC_MAX_FREQ)
-		master->max_speed_hz = SPICC_MAX_FREQ;
-	else
-		master->max_speed_hz = rate >> 2;
+	/* Setup max rate according to the Meson datasheet */
+	master->max_speed_hz = min_t(unsigned int, rate >> 1,
+				     spicc->data->max_speed_hz);
 
 	meson_spicc_oen_enable(spicc);
 
@@ -737,9 +735,11 @@ static int meson_spicc_remove(struct platform_device *pdev)
 }
 
 static const struct meson_spicc_data meson_spicc_gx_data = {
+	.max_speed_hz		= 30000000,
 };
 
 static const struct meson_spicc_data meson_spicc_axg_data = {
+	.max_speed_hz		= 80000000,
 	.has_oen		= true,
 	.has_enhance_clk_div	= true,
 };
-- 
2.22.0

WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong@baylibre.com>
To: broonie@kernel.org
Cc: Neil Armstrong <narmstrong@baylibre.com>,
	Yixun Lan <yixun.lan@amlogic.com>,
	linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
	linux-amlogic@lists.infradead.org,
	Sunny Luo <sunny.luo@amlogic.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/9] spi: meson-spicc: support max 80MHz clock
Date: Thu, 12 Mar 2020 14:31:26 +0100	[thread overview]
Message-ID: <20200312133131.26430-5-narmstrong@baylibre.com> (raw)
In-Reply-To: <20200312133131.26430-1-narmstrong@baylibre.com>

The SPICC controller in Meson-AXG is capable of running at 80M clock.
The ASIC IP is improved and the clock is actually running higher than
previous old SoCs.

Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/spi/spi-meson-spicc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index bd434d9055d9..710b4e780daa 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -35,7 +35,6 @@
  *   to have a CS go down over the full transfer
  */
 
-#define SPICC_MAX_FREQ	30000000
 #define SPICC_MAX_BURST	128
 
 /* Register Map */
@@ -132,6 +131,7 @@
 #define SPICC_FIFO_HALF 10
 
 struct meson_spicc_data {
+	unsigned int			max_speed_hz;
 	bool				has_oen;
 	bool				has_enhance_clk_div;
 };
@@ -693,11 +693,9 @@ static int meson_spicc_probe(struct platform_device *pdev)
 	master->transfer_one = meson_spicc_transfer_one;
 	master->use_gpio_descriptors = true;
 
-	/* Setup max rate according to the Meson GX datasheet */
-	if ((rate >> 2) > SPICC_MAX_FREQ)
-		master->max_speed_hz = SPICC_MAX_FREQ;
-	else
-		master->max_speed_hz = rate >> 2;
+	/* Setup max rate according to the Meson datasheet */
+	master->max_speed_hz = min_t(unsigned int, rate >> 1,
+				     spicc->data->max_speed_hz);
 
 	meson_spicc_oen_enable(spicc);
 
@@ -737,9 +735,11 @@ static int meson_spicc_remove(struct platform_device *pdev)
 }
 
 static const struct meson_spicc_data meson_spicc_gx_data = {
+	.max_speed_hz		= 30000000,
 };
 
 static const struct meson_spicc_data meson_spicc_axg_data = {
+	.max_speed_hz		= 80000000,
 	.has_oen		= true,
 	.has_enhance_clk_div	= true,
 };
-- 
2.22.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong@baylibre.com>
To: broonie@kernel.org
Cc: Neil Armstrong <narmstrong@baylibre.com>,
	Yixun Lan <yixun.lan@amlogic.com>,
	linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
	linux-amlogic@lists.infradead.org,
	Sunny Luo <sunny.luo@amlogic.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/9] spi: meson-spicc: support max 80MHz clock
Date: Thu, 12 Mar 2020 14:31:26 +0100	[thread overview]
Message-ID: <20200312133131.26430-5-narmstrong@baylibre.com> (raw)
In-Reply-To: <20200312133131.26430-1-narmstrong@baylibre.com>

The SPICC controller in Meson-AXG is capable of running at 80M clock.
The ASIC IP is improved and the clock is actually running higher than
previous old SoCs.

Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/spi/spi-meson-spicc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index bd434d9055d9..710b4e780daa 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -35,7 +35,6 @@
  *   to have a CS go down over the full transfer
  */
 
-#define SPICC_MAX_FREQ	30000000
 #define SPICC_MAX_BURST	128
 
 /* Register Map */
@@ -132,6 +131,7 @@
 #define SPICC_FIFO_HALF 10
 
 struct meson_spicc_data {
+	unsigned int			max_speed_hz;
 	bool				has_oen;
 	bool				has_enhance_clk_div;
 };
@@ -693,11 +693,9 @@ static int meson_spicc_probe(struct platform_device *pdev)
 	master->transfer_one = meson_spicc_transfer_one;
 	master->use_gpio_descriptors = true;
 
-	/* Setup max rate according to the Meson GX datasheet */
-	if ((rate >> 2) > SPICC_MAX_FREQ)
-		master->max_speed_hz = SPICC_MAX_FREQ;
-	else
-		master->max_speed_hz = rate >> 2;
+	/* Setup max rate according to the Meson datasheet */
+	master->max_speed_hz = min_t(unsigned int, rate >> 1,
+				     spicc->data->max_speed_hz);
 
 	meson_spicc_oen_enable(spicc);
 
@@ -737,9 +735,11 @@ static int meson_spicc_remove(struct platform_device *pdev)
 }
 
 static const struct meson_spicc_data meson_spicc_gx_data = {
+	.max_speed_hz		= 30000000,
 };
 
 static const struct meson_spicc_data meson_spicc_axg_data = {
+	.max_speed_hz		= 80000000,
 	.has_oen		= true,
 	.has_enhance_clk_div	= true,
 };
-- 
2.22.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  parent reply	other threads:[~2020-03-12 13:31 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 13:31 [PATCH 0/9] spi: meson-spicc: add support for AXG and G12A variants Neil Armstrong
2020-03-12 13:31 ` Neil Armstrong
2020-03-12 13:31 ` Neil Armstrong
2020-03-12 13:31 ` [PATCH 1/9] spi: meson-spicc: remove unused variables Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 17:39   ` Applied "spi: meson-spicc: remove unused variables" to the spi tree Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 13:31 ` [PATCH 2/9] spi: meson-spicc: enhance output enable feature Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 17:39   ` Applied "spi: meson-spicc: enhance output enable feature" to the spi tree Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 13:31 ` [PATCH 3/9] spi: meson-spicc: add a linear clock divider support Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 17:39   ` Applied "spi: meson-spicc: add a linear clock divider support" to the spi tree Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 13:31 ` Neil Armstrong [this message]
2020-03-12 13:31   ` [PATCH 4/9] spi: meson-spicc: support max 80MHz clock Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 17:39   ` Applied "spi: meson-spicc: support max 80MHz clock" to the spi tree Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 13:31 ` [PATCH 5/9] spi: meson-spicc: add min sclk for each compatible Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 17:39   ` Applied "spi: meson-spicc: add min sclk for each compatible" to the spi tree Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 13:31 ` [PATCH 6/9] spi: meson-spicc: setup IO line delay Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 17:39   ` Applied "spi: meson-spicc: setup IO line delay" to the spi tree Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 13:31 ` [PATCH 7/9] spi: meson-spicc: adapt burst handling for G12A support Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 17:39   ` Applied "spi: meson-spicc: adapt burst handling for G12A support" to the spi tree Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 13:31 ` [PATCH 8/9] dt-bindings: spi: amlogic,meson-gx-spicc: add Amlogic G12A compatible Neil Armstrong
2020-03-12 13:31   ` [PATCH 8/9] dt-bindings: spi: amlogic, meson-gx-spicc: " Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 17:38   ` Applied "spi: dt-bindings: amlogic, meson-gx-spicc: add Amlogic G12A compatible" to the spi tree Mark Brown
2020-03-12 17:38     ` Mark Brown
2020-03-12 17:38     ` Mark Brown
2020-03-12 17:38     ` Mark Brown
2020-03-12 13:31 ` [PATCH 9/9] spi: meson-spicc: add support for Amlogic G12A Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 13:31   ` Neil Armstrong
2020-03-12 17:39   ` Applied "spi: meson-spicc: add support for Amlogic G12A" to the spi tree Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-03-12 17:39     ` Mark Brown
2020-04-16 16:07 ` [PATCH 0/9] spi: meson-spicc: add support for AXG and G12A variants patchwork-bot+linux-amlogic

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=20200312133131.26430-5-narmstrong@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=sunny.luo@amlogic.com \
    --cc=yixun.lan@amlogic.com \
    /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.