All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v4 1/3] spi: pl022: Simplify platdata code
@ 2018-11-24 12:17 Jagan Teki
  2018-11-24 12:17 ` [U-Boot] [PATCH v4 2/3] spi: pl022: Drop unnecessary include files Jagan Teki
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jagan Teki @ 2018-11-24 12:17 UTC (permalink / raw)
  To: u-boot

pl022 spi driver support both OF_CONTROL and PLATDATA, this
patch is trying to simplify the code that differentiating
platdata vs of_control.
- Move OF_CONTROL code at one place
- Handle clock setup code directly in pl022_spi_ofdata_to_platdata

Cc: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v4:
- preserve fdtdec.h
Changes for v3:
- none 
Changes for v2:
- Update commit message
- Use struct clk for clkdev

 drivers/spi/pl022_spi.c              | 48 ++++++++++++----------------
 include/dm/platform_data/pl022_spi.h |  7 ----
 2 files changed, 20 insertions(+), 35 deletions(-)

diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c
index 86b71d2e21..05f4f6f481 100644
--- a/drivers/spi/pl022_spi.c
+++ b/drivers/spi/pl022_spi.c
@@ -72,11 +72,7 @@
 
 struct pl022_spi_slave {
 	void *base;
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
-	struct clk clk;
-#else
 	unsigned int freq;
-#endif
 };
 
 /*
@@ -96,30 +92,13 @@ static int pl022_is_supported(struct pl022_spi_slave *ps)
 	return 0;
 }
 
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
-static int pl022_spi_ofdata_to_platdata(struct udevice *bus)
-{
-	struct pl022_spi_pdata *plat = bus->platdata;
-	const void *fdt = gd->fdt_blob;
-	int node = dev_of_offset(bus);
-
-	plat->addr = fdtdec_get_addr_size(fdt, node, "reg", &plat->size);
-
-	return clk_get_by_index(bus, 0, &plat->clk);
-}
-#endif
-
 static int pl022_spi_probe(struct udevice *bus)
 {
 	struct pl022_spi_pdata *plat = dev_get_platdata(bus);
 	struct pl022_spi_slave *ps = dev_get_priv(bus);
 
 	ps->base = ioremap(plat->addr, plat->size);
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
-	ps->clk = plat->clk;
-#else
 	ps->freq = plat->freq;
-#endif
 
 	/* Check the PL022 version */
 	if (!pl022_is_supported(ps))
@@ -240,11 +219,7 @@ static int pl022_spi_set_speed(struct udevice *bus, uint speed)
 	u16 scr = SSP_SCR_MIN, cr0 = 0, cpsr = SSP_CPSR_MIN, best_scr = scr,
 	    best_cpsr = cpsr;
 	u32 min, max, best_freq = 0, tmp;
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
-	u32 rate = clk_get_rate(&ps->clk);
-#else
 	u32 rate = ps->freq;
-#endif
 	bool found = false;
 
 	max = spi_rate(rate, SSP_CPSR_MIN, SSP_SCR_MIN);
@@ -316,6 +291,25 @@ static const struct dm_spi_ops pl022_spi_ops = {
 };
 
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
+static int pl022_spi_ofdata_to_platdata(struct udevice *bus)
+{
+	struct pl022_spi_pdata *plat = bus->platdata;
+	const void *fdt = gd->fdt_blob;
+	int node = dev_of_offset(bus);
+	struct clk clkdev;
+	int ret;
+
+	plat->addr = fdtdec_get_addr_size(fdt, node, "reg", &plat->size);
+
+	ret = clk_get_by_index(bus, 0, &clkdev);
+	if (ret)
+		return ret;
+
+	plat->freq = clk_get_rate(&clkdev);
+
+	return 0;
+}
+
 static const struct udevice_id pl022_spi_ids[] = {
 	{ .compatible = "arm,pl022-spi" },
 	{ }
@@ -327,11 +321,9 @@ U_BOOT_DRIVER(pl022_spi) = {
 	.id     = UCLASS_SPI,
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	.of_match = pl022_spi_ids,
-#endif
-	.ops    = &pl022_spi_ops,
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	.ofdata_to_platdata = pl022_spi_ofdata_to_platdata,
 #endif
+	.ops    = &pl022_spi_ops,
 	.platdata_auto_alloc_size = sizeof(struct pl022_spi_pdata),
 	.priv_auto_alloc_size = sizeof(struct pl022_spi_slave),
 	.probe  = pl022_spi_probe,
diff --git a/include/dm/platform_data/pl022_spi.h b/include/dm/platform_data/pl022_spi.h
index 77fe6da3cb..df8870169d 100644
--- a/include/dm/platform_data/pl022_spi.h
+++ b/include/dm/platform_data/pl022_spi.h
@@ -10,19 +10,12 @@
 #ifndef __PL022_SPI_H__
 #define __PL022_SPI_H__
 
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
-#include <clk.h>
-#endif
 #include <fdtdec.h>
 
 struct pl022_spi_pdata {
 	fdt_addr_t addr;
 	fdt_size_t size;
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
-	struct clk clk;
-#else
 	unsigned int freq;
-#endif
 };
 
 #endif
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v4 2/3] spi: pl022: Drop unnecessary include files
  2018-11-24 12:17 [U-Boot] [PATCH v4 1/3] spi: pl022: Simplify platdata code Jagan Teki
@ 2018-11-24 12:17 ` Jagan Teki
  2018-11-27  8:00   ` Quentin Schulz
  2018-11-24 12:17 ` [U-Boot] [PATCH v4 3/3] dm: platform_data: spi: s/pl022_spi.h/spi_pl022.h Jagan Teki
  2018-11-27  7:59 ` [U-Boot] [PATCH v4 1/3] spi: pl022: Simplify platdata code Quentin Schulz
  2 siblings, 1 reply; 9+ messages in thread
From: Jagan Teki @ 2018-11-24 12:17 UTC (permalink / raw)
  To: u-boot

This patch can drop unnecessary include files in
pl022_spi driver.

Cc: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v4:
- none
Changes for v3:
- split patch from previous

 drivers/spi/pl022_spi.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c
index 05f4f6f481..f2e5367225 100644
--- a/drivers/spi/pl022_spi.c
+++ b/drivers/spi/pl022_spi.c
@@ -9,16 +9,11 @@
  * Driver for ARM PL022 SPI Controller.
  */
 
-#include <asm/io.h>
 #include <clk.h>
 #include <common.h>
 #include <dm.h>
 #include <dm/platform_data/pl022_spi.h>
-#include <fdtdec.h>
-#include <linux/bitops.h>
-#include <linux/bug.h>
 #include <linux/io.h>
-#include <linux/kernel.h>
 #include <spi.h>
 
 #define SSP_CR0		0x000
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v4 3/3] dm: platform_data: spi: s/pl022_spi.h/spi_pl022.h
  2018-11-24 12:17 [U-Boot] [PATCH v4 1/3] spi: pl022: Simplify platdata code Jagan Teki
  2018-11-24 12:17 ` [U-Boot] [PATCH v4 2/3] spi: pl022: Drop unnecessary include files Jagan Teki
@ 2018-11-24 12:17 ` Jagan Teki
  2018-11-27  8:00   ` Quentin Schulz
  2018-11-27  7:59 ` [U-Boot] [PATCH v4 1/3] spi: pl022: Simplify platdata code Quentin Schulz
  2 siblings, 1 reply; 9+ messages in thread
From: Jagan Teki @ 2018-11-24 12:17 UTC (permalink / raw)
  To: u-boot

Rename platform_data include file as spi_pl022.h from pl022_spi.h,
this is generic notation used for spi platdata include files.

Cc: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v4:
- none
Changes for v3:
- split patch from previous

 drivers/spi/pl022_spi.c                               | 2 +-
 include/dm/platform_data/{pl022_spi.h => spi_pl022.h} | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
 rename include/dm/platform_data/{pl022_spi.h => spi_pl022.h} (82%)

diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c
index f2e5367225..32bb8c8d21 100644
--- a/drivers/spi/pl022_spi.c
+++ b/drivers/spi/pl022_spi.c
@@ -12,7 +12,7 @@
 #include <clk.h>
 #include <common.h>
 #include <dm.h>
-#include <dm/platform_data/pl022_spi.h>
+#include <dm/platform_data/spi_pl022.h>
 #include <linux/io.h>
 #include <spi.h>
 
diff --git a/include/dm/platform_data/pl022_spi.h b/include/dm/platform_data/spi_pl022.h
similarity index 82%
rename from include/dm/platform_data/pl022_spi.h
rename to include/dm/platform_data/spi_pl022.h
index df8870169d..63a58ee453 100644
--- a/include/dm/platform_data/pl022_spi.h
+++ b/include/dm/platform_data/spi_pl022.h
@@ -7,8 +7,8 @@
  * in ofdata_to_platdata.
  */
 
-#ifndef __PL022_SPI_H__
-#define __PL022_SPI_H__
+#ifndef __spi_pl022_h
+#define __spi_pl022_h
 
 #include <fdtdec.h>
 
@@ -18,4 +18,4 @@ struct pl022_spi_pdata {
 	unsigned int freq;
 };
 
-#endif
+#endif /* __spi_pl022_h */
-- 
2.18.0.321.gffc6fa0e3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v4 1/3] spi: pl022: Simplify platdata code
  2018-11-24 12:17 [U-Boot] [PATCH v4 1/3] spi: pl022: Simplify platdata code Jagan Teki
  2018-11-24 12:17 ` [U-Boot] [PATCH v4 2/3] spi: pl022: Drop unnecessary include files Jagan Teki
  2018-11-24 12:17 ` [U-Boot] [PATCH v4 3/3] dm: platform_data: spi: s/pl022_spi.h/spi_pl022.h Jagan Teki
@ 2018-11-27  7:59 ` Quentin Schulz
  2018-11-27 15:38   ` Jagan Teki
  2 siblings, 1 reply; 9+ messages in thread
From: Quentin Schulz @ 2018-11-27  7:59 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

On Sat, Nov 24, 2018 at 05:47:21PM +0530, Jagan Teki wrote:
> pl022 spi driver support both OF_CONTROL and PLATDATA, this
> patch is trying to simplify the code that differentiating
> platdata vs of_control.
> - Move OF_CONTROL code at one place
> - Handle clock setup code directly in pl022_spi_ofdata_to_platdata
> 
> Cc: Quentin Schulz <quentin.schulz@bootlin.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v4:
> - preserve fdtdec.h
> Changes for v3:
> - none 
> Changes for v2:
> - Update commit message
> - Use struct clk for clkdev
> 
>  drivers/spi/pl022_spi.c              | 48 ++++++++++++----------------
>  include/dm/platform_data/pl022_spi.h |  7 ----
>  2 files changed, 20 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c
> index 86b71d2e21..05f4f6f481 100644
> --- a/drivers/spi/pl022_spi.c
> +++ b/drivers/spi/pl022_spi.c
> @@ -72,11 +72,7 @@
>  
>  struct pl022_spi_slave {
>  	void *base;
> -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> -	struct clk clk;
> -#else
>  	unsigned int freq;
> -#endif
>  };
>  
>  /*
> @@ -96,30 +92,13 @@ static int pl022_is_supported(struct pl022_spi_slave *ps)
>  	return 0;
>  }
>  
> -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> -static int pl022_spi_ofdata_to_platdata(struct udevice *bus)
> -{
> -	struct pl022_spi_pdata *plat = bus->platdata;
> -	const void *fdt = gd->fdt_blob;
> -	int node = dev_of_offset(bus);
> -
> -	plat->addr = fdtdec_get_addr_size(fdt, node, "reg", &plat->size);
> -
> -	return clk_get_by_index(bus, 0, &plat->clk);
> -}
> -#endif
> -
>  static int pl022_spi_probe(struct udevice *bus)
>  {
>  	struct pl022_spi_pdata *plat = dev_get_platdata(bus);
>  	struct pl022_spi_slave *ps = dev_get_priv(bus);
>  
>  	ps->base = ioremap(plat->addr, plat->size);
> -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> -	ps->clk = plat->clk;
> -#else
>  	ps->freq = plat->freq;
> -#endif
>  
>  	/* Check the PL022 version */
>  	if (!pl022_is_supported(ps))
> @@ -240,11 +219,7 @@ static int pl022_spi_set_speed(struct udevice *bus, uint speed)
>  	u16 scr = SSP_SCR_MIN, cr0 = 0, cpsr = SSP_CPSR_MIN, best_scr = scr,
>  	    best_cpsr = cpsr;
>  	u32 min, max, best_freq = 0, tmp;
> -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> -	u32 rate = clk_get_rate(&ps->clk);
> -#else
>  	u32 rate = ps->freq;
> -#endif
>  	bool found = false;
>  
>  	max = spi_rate(rate, SSP_CPSR_MIN, SSP_SCR_MIN);
> @@ -316,6 +291,25 @@ static const struct dm_spi_ops pl022_spi_ops = {
>  };
>  
>  #if !CONFIG_IS_ENABLED(OF_PLATDATA)
> +static int pl022_spi_ofdata_to_platdata(struct udevice *bus)
> +{
> +	struct pl022_spi_pdata *plat = bus->platdata;
> +	const void *fdt = gd->fdt_blob;
> +	int node = dev_of_offset(bus);
> +	struct clk clkdev;
> +	int ret;
> +
> +	plat->addr = fdtdec_get_addr_size(fdt, node, "reg", &plat->size);
> +
> +	ret = clk_get_by_index(bus, 0, &clkdev);
> +	if (ret)
> +		return ret;
> +
> +	plat->freq = clk_get_rate(&clkdev);
> +
> +	return 0;
> +}
> +
>  static const struct udevice_id pl022_spi_ids[] = {
>  	{ .compatible = "arm,pl022-spi" },
>  	{ }
> @@ -327,11 +321,9 @@ U_BOOT_DRIVER(pl022_spi) = {
>  	.id     = UCLASS_SPI,
>  #if !CONFIG_IS_ENABLED(OF_PLATDATA)
>  	.of_match = pl022_spi_ids,
> -#endif
> -	.ops    = &pl022_spi_ops,
> -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
>  	.ofdata_to_platdata = pl022_spi_ofdata_to_platdata,
>  #endif
> +	.ops    = &pl022_spi_ops,
>  	.platdata_auto_alloc_size = sizeof(struct pl022_spi_pdata),
>  	.priv_auto_alloc_size = sizeof(struct pl022_spi_slave),
>  	.probe  = pl022_spi_probe,
> diff --git a/include/dm/platform_data/pl022_spi.h b/include/dm/platform_data/pl022_spi.h
> index 77fe6da3cb..df8870169d 100644
> --- a/include/dm/platform_data/pl022_spi.h
> +++ b/include/dm/platform_data/pl022_spi.h
> @@ -10,19 +10,12 @@
>  #ifndef __PL022_SPI_H__
>  #define __PL022_SPI_H__
>  
> -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> -#include <clk.h>
> -#endif
>  #include <fdtdec.h>
>  
>  struct pl022_spi_pdata {
>  	fdt_addr_t addr;
>  	fdt_size_t size;
> -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> -	struct clk clk;
> -#else
>  	unsigned int freq;
> -#endif
>  };
>  
>  #endif

Acked-by: Quentin Schulz <quentin.schulz@bootlin.com>

Thanks for the patch,
Quentin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181127/55ac2bdf/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v4 2/3] spi: pl022: Drop unnecessary include files
  2018-11-24 12:17 ` [U-Boot] [PATCH v4 2/3] spi: pl022: Drop unnecessary include files Jagan Teki
@ 2018-11-27  8:00   ` Quentin Schulz
  2018-11-27 15:37     ` Jagan Teki
  0 siblings, 1 reply; 9+ messages in thread
From: Quentin Schulz @ 2018-11-27  8:00 UTC (permalink / raw)
  To: u-boot

Hi all,

On Sat, Nov 24, 2018 at 05:47:22PM +0530, Jagan Teki wrote:
> This patch can drop unnecessary include files in
> pl022_spi driver.
> 
> Cc: Quentin Schulz <quentin.schulz@bootlin.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v4:
> - none
> Changes for v3:
> - split patch from previous
> 
>  drivers/spi/pl022_spi.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c
> index 05f4f6f481..f2e5367225 100644
> --- a/drivers/spi/pl022_spi.c
> +++ b/drivers/spi/pl022_spi.c
> @@ -9,16 +9,11 @@
>   * Driver for ARM PL022 SPI Controller.
>   */
>  
> -#include <asm/io.h>
>  #include <clk.h>
>  #include <common.h>
>  #include <dm.h>
>  #include <dm/platform_data/pl022_spi.h>
> -#include <fdtdec.h>
> -#include <linux/bitops.h>
> -#include <linux/bug.h>
>  #include <linux/io.h>
> -#include <linux/kernel.h>
>  #include <spi.h>
>  
>  #define SSP_CR0		0x000

Acked-by: Quentin Schulz <quentin.schulz@bootlin.com>

Thanks for the patch,
Quentin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181127/df5755e9/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v4 3/3] dm: platform_data: spi: s/pl022_spi.h/spi_pl022.h
  2018-11-24 12:17 ` [U-Boot] [PATCH v4 3/3] dm: platform_data: spi: s/pl022_spi.h/spi_pl022.h Jagan Teki
@ 2018-11-27  8:00   ` Quentin Schulz
  2018-11-27 15:37     ` Jagan Teki
  0 siblings, 1 reply; 9+ messages in thread
From: Quentin Schulz @ 2018-11-27  8:00 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

On Sat, Nov 24, 2018 at 05:47:23PM +0530, Jagan Teki wrote:
> Rename platform_data include file as spi_pl022.h from pl022_spi.h,
> this is generic notation used for spi platdata include files.
> 
> Cc: Quentin Schulz <quentin.schulz@bootlin.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v4:
> - none
> Changes for v3:
> - split patch from previous
> 
>  drivers/spi/pl022_spi.c                               | 2 +-
>  include/dm/platform_data/{pl022_spi.h => spi_pl022.h} | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
>  rename include/dm/platform_data/{pl022_spi.h => spi_pl022.h} (82%)
> 
> diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c
> index f2e5367225..32bb8c8d21 100644
> --- a/drivers/spi/pl022_spi.c
> +++ b/drivers/spi/pl022_spi.c
> @@ -12,7 +12,7 @@
>  #include <clk.h>
>  #include <common.h>
>  #include <dm.h>
> -#include <dm/platform_data/pl022_spi.h>
> +#include <dm/platform_data/spi_pl022.h>
>  #include <linux/io.h>
>  #include <spi.h>
>  
> diff --git a/include/dm/platform_data/pl022_spi.h b/include/dm/platform_data/spi_pl022.h
> similarity index 82%
> rename from include/dm/platform_data/pl022_spi.h
> rename to include/dm/platform_data/spi_pl022.h
> index df8870169d..63a58ee453 100644
> --- a/include/dm/platform_data/pl022_spi.h
> +++ b/include/dm/platform_data/spi_pl022.h
> @@ -7,8 +7,8 @@
>   * in ofdata_to_platdata.
>   */
>  
> -#ifndef __PL022_SPI_H__
> -#define __PL022_SPI_H__
> +#ifndef __spi_pl022_h
> +#define __spi_pl022_h
>  
>  #include <fdtdec.h>
>  
> @@ -18,4 +18,4 @@ struct pl022_spi_pdata {
>  	unsigned int freq;
>  };
>  
> -#endif
> +#endif /* __spi_pl022_h */

Acked-by: Quentin Schulz <quentin.schulz@bootlin.com>

Thanks for the patch,
Quentin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181127/8645d9fd/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v4 3/3] dm: platform_data: spi: s/pl022_spi.h/spi_pl022.h
  2018-11-27  8:00   ` Quentin Schulz
@ 2018-11-27 15:37     ` Jagan Teki
  0 siblings, 0 replies; 9+ messages in thread
From: Jagan Teki @ 2018-11-27 15:37 UTC (permalink / raw)
  To: u-boot

On Tue, Nov 27, 2018 at 1:31 PM Quentin Schulz
<quentin.schulz@bootlin.com> wrote:
>
> Hi Jagan,
>
> On Sat, Nov 24, 2018 at 05:47:23PM +0530, Jagan Teki wrote:
> > Rename platform_data include file as spi_pl022.h from pl022_spi.h,
> > this is generic notation used for spi platdata include files.
> >
> > Cc: Quentin Schulz <quentin.schulz@bootlin.com>
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > ---
> > Changes for v4:
> > - none
> > Changes for v3:
> > - split patch from previous
> >
> >  drivers/spi/pl022_spi.c                               | 2 +-
> >  include/dm/platform_data/{pl022_spi.h => spi_pl022.h} | 6 +++---
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> >  rename include/dm/platform_data/{pl022_spi.h => spi_pl022.h} (82%)
> >
> > diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c
> > index f2e5367225..32bb8c8d21 100644
> > --- a/drivers/spi/pl022_spi.c
> > +++ b/drivers/spi/pl022_spi.c
> > @@ -12,7 +12,7 @@
> >  #include <clk.h>
> >  #include <common.h>
> >  #include <dm.h>
> > -#include <dm/platform_data/pl022_spi.h>
> > +#include <dm/platform_data/spi_pl022.h>
> >  #include <linux/io.h>
> >  #include <spi.h>
> >
> > diff --git a/include/dm/platform_data/pl022_spi.h b/include/dm/platform_data/spi_pl022.h
> > similarity index 82%
> > rename from include/dm/platform_data/pl022_spi.h
> > rename to include/dm/platform_data/spi_pl022.h
> > index df8870169d..63a58ee453 100644
> > --- a/include/dm/platform_data/pl022_spi.h
> > +++ b/include/dm/platform_data/spi_pl022.h
> > @@ -7,8 +7,8 @@
> >   * in ofdata_to_platdata.
> >   */
> >
> > -#ifndef __PL022_SPI_H__
> > -#define __PL022_SPI_H__
> > +#ifndef __spi_pl022_h
> > +#define __spi_pl022_h
> >
> >  #include <fdtdec.h>
> >
> > @@ -18,4 +18,4 @@ struct pl022_spi_pdata {
> >       unsigned int freq;
> >  };
> >
> > -#endif
> > +#endif /* __spi_pl022_h */
>
> Acked-by: Quentin Schulz <quentin.schulz@bootlin.com>

Applied to u-boot-spi/master

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v4 2/3] spi: pl022: Drop unnecessary include files
  2018-11-27  8:00   ` Quentin Schulz
@ 2018-11-27 15:37     ` Jagan Teki
  0 siblings, 0 replies; 9+ messages in thread
From: Jagan Teki @ 2018-11-27 15:37 UTC (permalink / raw)
  To: u-boot

On Tue, Nov 27, 2018 at 1:30 PM Quentin Schulz
<quentin.schulz@bootlin.com> wrote:
>
> Hi all,
>
> On Sat, Nov 24, 2018 at 05:47:22PM +0530, Jagan Teki wrote:
> > This patch can drop unnecessary include files in
> > pl022_spi driver.
> >
> > Cc: Quentin Schulz <quentin.schulz@bootlin.com>
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > ---
> > Changes for v4:
> > - none
> > Changes for v3:
> > - split patch from previous
> >
> >  drivers/spi/pl022_spi.c | 5 -----
> >  1 file changed, 5 deletions(-)
> >
> > diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c
> > index 05f4f6f481..f2e5367225 100644
> > --- a/drivers/spi/pl022_spi.c
> > +++ b/drivers/spi/pl022_spi.c
> > @@ -9,16 +9,11 @@
> >   * Driver for ARM PL022 SPI Controller.
> >   */
> >
> > -#include <asm/io.h>
> >  #include <clk.h>
> >  #include <common.h>
> >  #include <dm.h>
> >  #include <dm/platform_data/pl022_spi.h>
> > -#include <fdtdec.h>
> > -#include <linux/bitops.h>
> > -#include <linux/bug.h>
> >  #include <linux/io.h>
> > -#include <linux/kernel.h>
> >  #include <spi.h>
> >
> >  #define SSP_CR0              0x000
>
> Acked-by: Quentin Schulz <quentin.schulz@bootlin.com>

Applied to u-boot-spi/master

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v4 1/3] spi: pl022: Simplify platdata code
  2018-11-27  7:59 ` [U-Boot] [PATCH v4 1/3] spi: pl022: Simplify platdata code Quentin Schulz
@ 2018-11-27 15:38   ` Jagan Teki
  0 siblings, 0 replies; 9+ messages in thread
From: Jagan Teki @ 2018-11-27 15:38 UTC (permalink / raw)
  To: u-boot

On Tue, Nov 27, 2018 at 1:29 PM Quentin Schulz
<quentin.schulz@bootlin.com> wrote:
>
> Hi Jagan,
>
> On Sat, Nov 24, 2018 at 05:47:21PM +0530, Jagan Teki wrote:
> > pl022 spi driver support both OF_CONTROL and PLATDATA, this
> > patch is trying to simplify the code that differentiating
> > platdata vs of_control.
> > - Move OF_CONTROL code at one place
> > - Handle clock setup code directly in pl022_spi_ofdata_to_platdata
> >
> > Cc: Quentin Schulz <quentin.schulz@bootlin.com>
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > ---
> > Changes for v4:
> > - preserve fdtdec.h
> > Changes for v3:
> > - none
> > Changes for v2:
> > - Update commit message
> > - Use struct clk for clkdev
> >
> >  drivers/spi/pl022_spi.c              | 48 ++++++++++++----------------
> >  include/dm/platform_data/pl022_spi.h |  7 ----
> >  2 files changed, 20 insertions(+), 35 deletions(-)
> >
> > diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c
> > index 86b71d2e21..05f4f6f481 100644
> > --- a/drivers/spi/pl022_spi.c
> > +++ b/drivers/spi/pl022_spi.c
> > @@ -72,11 +72,7 @@
> >
> >  struct pl022_spi_slave {
> >       void *base;
> > -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> > -     struct clk clk;
> > -#else
> >       unsigned int freq;
> > -#endif
> >  };
> >
> >  /*
> > @@ -96,30 +92,13 @@ static int pl022_is_supported(struct pl022_spi_slave *ps)
> >       return 0;
> >  }
> >
> > -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> > -static int pl022_spi_ofdata_to_platdata(struct udevice *bus)
> > -{
> > -     struct pl022_spi_pdata *plat = bus->platdata;
> > -     const void *fdt = gd->fdt_blob;
> > -     int node = dev_of_offset(bus);
> > -
> > -     plat->addr = fdtdec_get_addr_size(fdt, node, "reg", &plat->size);
> > -
> > -     return clk_get_by_index(bus, 0, &plat->clk);
> > -}
> > -#endif
> > -
> >  static int pl022_spi_probe(struct udevice *bus)
> >  {
> >       struct pl022_spi_pdata *plat = dev_get_platdata(bus);
> >       struct pl022_spi_slave *ps = dev_get_priv(bus);
> >
> >       ps->base = ioremap(plat->addr, plat->size);
> > -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> > -     ps->clk = plat->clk;
> > -#else
> >       ps->freq = plat->freq;
> > -#endif
> >
> >       /* Check the PL022 version */
> >       if (!pl022_is_supported(ps))
> > @@ -240,11 +219,7 @@ static int pl022_spi_set_speed(struct udevice *bus, uint speed)
> >       u16 scr = SSP_SCR_MIN, cr0 = 0, cpsr = SSP_CPSR_MIN, best_scr = scr,
> >           best_cpsr = cpsr;
> >       u32 min, max, best_freq = 0, tmp;
> > -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> > -     u32 rate = clk_get_rate(&ps->clk);
> > -#else
> >       u32 rate = ps->freq;
> > -#endif
> >       bool found = false;
> >
> >       max = spi_rate(rate, SSP_CPSR_MIN, SSP_SCR_MIN);
> > @@ -316,6 +291,25 @@ static const struct dm_spi_ops pl022_spi_ops = {
> >  };
> >
> >  #if !CONFIG_IS_ENABLED(OF_PLATDATA)
> > +static int pl022_spi_ofdata_to_platdata(struct udevice *bus)
> > +{
> > +     struct pl022_spi_pdata *plat = bus->platdata;
> > +     const void *fdt = gd->fdt_blob;
> > +     int node = dev_of_offset(bus);
> > +     struct clk clkdev;
> > +     int ret;
> > +
> > +     plat->addr = fdtdec_get_addr_size(fdt, node, "reg", &plat->size);
> > +
> > +     ret = clk_get_by_index(bus, 0, &clkdev);
> > +     if (ret)
> > +             return ret;
> > +
> > +     plat->freq = clk_get_rate(&clkdev);
> > +
> > +     return 0;
> > +}
> > +
> >  static const struct udevice_id pl022_spi_ids[] = {
> >       { .compatible = "arm,pl022-spi" },
> >       { }
> > @@ -327,11 +321,9 @@ U_BOOT_DRIVER(pl022_spi) = {
> >       .id     = UCLASS_SPI,
> >  #if !CONFIG_IS_ENABLED(OF_PLATDATA)
> >       .of_match = pl022_spi_ids,
> > -#endif
> > -     .ops    = &pl022_spi_ops,
> > -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> >       .ofdata_to_platdata = pl022_spi_ofdata_to_platdata,
> >  #endif
> > +     .ops    = &pl022_spi_ops,
> >       .platdata_auto_alloc_size = sizeof(struct pl022_spi_pdata),
> >       .priv_auto_alloc_size = sizeof(struct pl022_spi_slave),
> >       .probe  = pl022_spi_probe,
> > diff --git a/include/dm/platform_data/pl022_spi.h b/include/dm/platform_data/pl022_spi.h
> > index 77fe6da3cb..df8870169d 100644
> > --- a/include/dm/platform_data/pl022_spi.h
> > +++ b/include/dm/platform_data/pl022_spi.h
> > @@ -10,19 +10,12 @@
> >  #ifndef __PL022_SPI_H__
> >  #define __PL022_SPI_H__
> >
> > -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> > -#include <clk.h>
> > -#endif
> >  #include <fdtdec.h>
> >
> >  struct pl022_spi_pdata {
> >       fdt_addr_t addr;
> >       fdt_size_t size;
> > -#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> > -     struct clk clk;
> > -#else
> >       unsigned int freq;
> > -#endif
> >  };
> >
> >  #endif
>
> Acked-by: Quentin Schulz <quentin.schulz@bootlin.com>

Applied to u-boot-spi/master

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-11-27 15:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-24 12:17 [U-Boot] [PATCH v4 1/3] spi: pl022: Simplify platdata code Jagan Teki
2018-11-24 12:17 ` [U-Boot] [PATCH v4 2/3] spi: pl022: Drop unnecessary include files Jagan Teki
2018-11-27  8:00   ` Quentin Schulz
2018-11-27 15:37     ` Jagan Teki
2018-11-24 12:17 ` [U-Boot] [PATCH v4 3/3] dm: platform_data: spi: s/pl022_spi.h/spi_pl022.h Jagan Teki
2018-11-27  8:00   ` Quentin Schulz
2018-11-27 15:37     ` Jagan Teki
2018-11-27  7:59 ` [U-Boot] [PATCH v4 1/3] spi: pl022: Simplify platdata code Quentin Schulz
2018-11-27 15:38   ` Jagan Teki

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.