[U-Boot] [PATCH] spi: xilinx_spi: Add support for Quad mode

From: Siva Durga Prasad Paladugu siva.durga.paladugu@xilinx.com
Add Quad mode support for xilinx spi driver Inform the spi framework about quad mode capability by reading it from devicetree.
Signed-off-by: Siva Durga Prasad Paladugu sivadur@xilinx.com Signed-off-by: Michal Simek michal.simek@xilinx.com --- drivers/spi/xilinx_spi.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index a951a77..3e01c66 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -21,6 +21,8 @@ #include <spi.h> #include <asm/io.h>
+DECLARE_GLOBAL_DATA_PTR; + /* * [0]: http://www.xilinx.com/support/documentation * @@ -82,6 +84,8 @@ #define CONFIG_SYS_XILINX_SPI_LIST { CONFIG_SYS_SPI_BASE } #endif
+#define XILINX_SPI_QUAD_MODE 2 + /* xilinx spi register set */ struct xilinx_spi_regs { u32 __space0__[7]; @@ -109,6 +113,22 @@ struct xilinx_spi_priv { };
static unsigned long xilinx_spi_base_list[] = CONFIG_SYS_XILINX_SPI_LIST; + +static int xilinx_spi_child_pre_probe(struct udevice *bus) +{ + struct spi_slave *slave = dev_get_parent_priv(bus); + struct udevice *dev = dev_get_parent(bus); + int spimode; + + spimode = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "xlnx,spi-mode", + -1); + + if (spimode == XILINX_SPI_QUAD_MODE) + slave->op_mode_rx = SPI_OPM_RX_QOF; + + return 0; +} + static int xilinx_spi_probe(struct udevice *bus) { struct xilinx_spi_priv *priv = dev_get_priv(bus); @@ -299,4 +319,5 @@ U_BOOT_DRIVER(xilinx_spi) = { .ops = &xilinx_spi_ops, .priv_auto_alloc_size = sizeof(struct xilinx_spi_priv), .probe = xilinx_spi_probe, + .child_pre_probe = xilinx_spi_child_pre_probe, };

On 26 July 2016 at 10:44, Siva Durga Prasad Paladugu siva.durga.paladugu@xilinx.com wrote:
From: Siva Durga Prasad Paladugu siva.durga.paladugu@xilinx.com
Add Quad mode support for xilinx spi driver Inform the spi framework about quad mode capability by reading it from devicetree.
Signed-off-by: Siva Durga Prasad Paladugu sivadur@xilinx.com Signed-off-by: Michal Simek michal.simek@xilinx.com
drivers/spi/xilinx_spi.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index a951a77..3e01c66 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -21,6 +21,8 @@ #include <spi.h> #include <asm/io.h>
+DECLARE_GLOBAL_DATA_PTR;
/*
@@ -82,6 +84,8 @@ #define CONFIG_SYS_XILINX_SPI_LIST { CONFIG_SYS_SPI_BASE } #endif
+#define XILINX_SPI_QUAD_MODE 2
/* xilinx spi register set */ struct xilinx_spi_regs { u32 __space0__[7]; @@ -109,6 +113,22 @@ struct xilinx_spi_priv { };
static unsigned long xilinx_spi_base_list[] = CONFIG_SYS_XILINX_SPI_LIST;
+static int xilinx_spi_child_pre_probe(struct udevice *bus) +{
struct spi_slave *slave = dev_get_parent_priv(bus);
struct udevice *dev = dev_get_parent(bus);
int spimode;
spimode = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "xlnx,spi-mode",
-1);
if (spimode == XILINX_SPI_QUAD_MODE)
slave->op_mode_rx = SPI_OPM_RX_QOF;
This is wrong, use platdata in spi-uclass that in-turn detect the mode from dt and SPI_OPM_RX_QOF is never exit.
thanks!

Hi Jagan,
-----Original Message----- From: Jagan Teki [mailto:jagannadh.teki@gmail.com] Sent: Tuesday, July 26, 2016 11:16 AM To: Siva Durga Prasad Paladugu sivadur@xilinx.com Cc: u-boot@lists.denx.de; Michal Simek michals@xilinx.com; Siva Durga Prasad Paladugu sivadur@xilinx.com; Michal Simek michals@xilinx.com Subject: Re: [PATCH] spi: xilinx_spi: Add support for Quad mode
On 26 July 2016 at 10:44, Siva Durga Prasad Paladugu siva.durga.paladugu@xilinx.com wrote:
From: Siva Durga Prasad Paladugu siva.durga.paladugu@xilinx.com
Add Quad mode support for xilinx spi driver Inform the spi framework about quad mode capability by reading it from devicetree.
Signed-off-by: Siva Durga Prasad Paladugu sivadur@xilinx.com Signed-off-by: Michal Simek michal.simek@xilinx.com
drivers/spi/xilinx_spi.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index a951a77..3e01c66 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -21,6 +21,8 @@ #include <spi.h> #include <asm/io.h>
+DECLARE_GLOBAL_DATA_PTR;
/*
@@ -82,6 +84,8 @@ #define CONFIG_SYS_XILINX_SPI_LIST { CONFIG_SYS_SPI_BASE } #endif
+#define XILINX_SPI_QUAD_MODE 2
/* xilinx spi register set */ struct xilinx_spi_regs { u32 __space0__[7]; @@ -109,6 +113,22 @@ struct xilinx_spi_priv { };
static unsigned long xilinx_spi_base_list[] = CONFIG_SYS_XILINX_SPI_LIST;
+static int xilinx_spi_child_pre_probe(struct udevice *bus) {
struct spi_slave *slave = dev_get_parent_priv(bus);
struct udevice *dev = dev_get_parent(bus);
int spimode;
spimode = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "xlnx,spi-mode",
-1);
if (spimode == XILINX_SPI_QUAD_MODE)
slave->op_mode_rx = SPI_OPM_RX_QOF;
This is wrong, use platdata in spi-uclass that in-turn detect the mode from dt and SPI_OPM_RX_QOF is never exit.
Do you mean to fill mode_rx of dm_spi_slave_platdata from device tree in xilinx_spi_ofdata_to_platdata(this will be defined in xilinx_spi.c). The ofdata_to_platdata is anyway required in xilinx_spi.c to get the regs address frequency.(this is with reference to your comment on other two recent patches). Please let me know if anything else is required.
Regards, Siva
thanks!
Jagan.

On 27 July 2016 at 12:54, Siva Durga Prasad Paladugu siva.durga.paladugu@xilinx.com wrote:
Hi Jagan,
-----Original Message----- From: Jagan Teki [mailto:jagannadh.teki@gmail.com] Sent: Tuesday, July 26, 2016 11:16 AM To: Siva Durga Prasad Paladugu sivadur@xilinx.com Cc: u-boot@lists.denx.de; Michal Simek michals@xilinx.com; Siva Durga Prasad Paladugu sivadur@xilinx.com; Michal Simek michals@xilinx.com Subject: Re: [PATCH] spi: xilinx_spi: Add support for Quad mode
On 26 July 2016 at 10:44, Siva Durga Prasad Paladugu siva.durga.paladugu@xilinx.com wrote:
From: Siva Durga Prasad Paladugu siva.durga.paladugu@xilinx.com
Add Quad mode support for xilinx spi driver Inform the spi framework about quad mode capability by reading it from devicetree.
Signed-off-by: Siva Durga Prasad Paladugu sivadur@xilinx.com Signed-off-by: Michal Simek michal.simek@xilinx.com
drivers/spi/xilinx_spi.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index a951a77..3e01c66 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -21,6 +21,8 @@ #include <spi.h> #include <asm/io.h>
+DECLARE_GLOBAL_DATA_PTR;
/*
@@ -82,6 +84,8 @@ #define CONFIG_SYS_XILINX_SPI_LIST { CONFIG_SYS_SPI_BASE } #endif
+#define XILINX_SPI_QUAD_MODE 2
/* xilinx spi register set */ struct xilinx_spi_regs { u32 __space0__[7]; @@ -109,6 +113,22 @@ struct xilinx_spi_priv { };
static unsigned long xilinx_spi_base_list[] = CONFIG_SYS_XILINX_SPI_LIST;
+static int xilinx_spi_child_pre_probe(struct udevice *bus) {
struct spi_slave *slave = dev_get_parent_priv(bus);
struct udevice *dev = dev_get_parent(bus);
int spimode;
spimode = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "xlnx,spi-mode",
-1);
if (spimode == XILINX_SPI_QUAD_MODE)
slave->op_mode_rx = SPI_OPM_RX_QOF;
This is wrong, use platdata in spi-uclass that in-turn detect the mode from dt and SPI_OPM_RX_QOF is never exit.
Do you mean to fill mode_rx of dm_spi_slave_platdata from device tree in xilinx_spi_ofdata_to_platdata(this will be defined in xilinx_spi.c). The ofdata_to_platdata is anyway required in xilinx_spi.c to get the regs address frequency.(this is with reference to your comment on other two recent patches). Please let me know if anything else is required.
If you add spi-rx-bus-width = <4>; on dt the core will detect quad read, no need to add RX_QUAD assignment on driver.
participants (2)
-
Jagan Teki
-
Siva Durga Prasad Paladugu