Skip to contentSkip to conversation

dm: qspi fix claim bus and release bus

PATCH New Peng Fan 2 participants 4 messages Apr 14, 2015 – Apr 26, 2015 SPI

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 dm: qspi fix claim bus and release bus

For fsl_qspi_claim_bus and fsl_qspi_release_bus, the input parameter "struct udevice *dev" represents device: "qspi[x]: qspi@[address] {...}". Since "dev" already represents the qspi controller, use its parent to get platdata and get 'priv' is wrong.

After applying this patch, qspi flashes can be correctly probed.

CC Simon Glass <[email protected]>
CC Jagannadha Sutradharudu Teki <[email protected]>
CC Haikun Wang <[email protected]>

---

Hi,

This patch is based on dm/next branch.

Regards,
Peng.

 drivers/spi/fsl_qspi.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/spi/fsl_qspi.c +3 -7
index 868df5f..04f1801 100644
@@ -1044,11 +1044,9 @@ static int fsl_qspi_xfer(struct udevice *dev, unsigned int bitlen,
 static int fsl_qspi_claim_bus(struct udevice *dev)
 {
 	struct fsl_qspi_priv *priv;
-	struct udevice *bus;
-	struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+	struct dm_spi_slave_platdata *slave_plat = dev_get_platdata(dev);
 
-	bus = dev->parent;
-	priv = dev_get_priv(bus);
+	priv = dev_get_priv(dev);
 
 	priv->cur_amba_base =
 		priv->amba_base[0] + FSL_QSPI_FLASH_SIZE * slave_plat->cs;
@@ -1061,10 +1059,8 @@ static int fsl_qspi_claim_bus(struct udevice *dev)
 static int fsl_qspi_release_bus(struct udevice *dev)
 {
 	struct fsl_qspi_priv *priv;
-	struct udevice *bus;
 
-	bus = dev->parent;
-	priv = dev_get_priv(bus);
+	priv = dev_get_priv(dev);
 
 	qspi_module_disable(priv, 1);
 
Signature · 1 line
1.8.4
author
#1 lore raw

PATCH 1/1 dm: qspi fix claim bus and release bus

Add missed people.

Quoted 53 lines · Peng Fan

For fsl_qspi_claim_bus and fsl_qspi_release_bus, the input parameter "struct udevice *dev" represents device: "qspi[x]: qspi@[address] {...}". Since "dev" already represents the qspi controller, use its parent to get platdata and get 'priv' is wrong.

After applying this patch, qspi flashes can be correctly probed.

CC Simon Glass <[email protected]>
CC Jagannadha Sutradharudu Teki <[email protected]>
CC Haikun Wang <[email protected]>

---

Hi,

This patch is based on dm/next branch.

Regards,
Peng.

  drivers/spi/fsl_qspi.c | 10 +++-------
  1 file changed, 3 insertions(+), 7 deletions(-)
drivers/spi/fsl_qspi.c +3 -7
index 868df5f..04f1801 100644
@@ -1044,11 +1044,9 @@ static int fsl_qspi_xfer(struct udevice *dev, unsigned int bitlen,
  static int fsl_qspi_claim_bus(struct udevice *dev)
  {
  	struct fsl_qspi_priv *priv;
-	struct udevice *bus;
-	struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+	struct dm_spi_slave_platdata *slave_plat = dev_get_platdata(dev);
 
-	bus = dev->parent;
-	priv = dev_get_priv(bus);
+	priv = dev_get_priv(dev);
 
  	priv->cur_amba_base =
  		priv->amba_base[0] + FSL_QSPI_FLASH_SIZE * slave_plat->cs;
@@ -1061,10 +1059,8 @@ static int fsl_qspi_claim_bus(struct udevice *dev)
  static int fsl_qspi_release_bus(struct udevice *dev)
  {
  	struct fsl_qspi_priv *priv;
-	struct udevice *bus;
 
-	bus = dev->parent;
-	priv = dev_get_priv(bus);
+	priv = dev_get_priv(dev);
 
  	qspi_module_disable(priv, 1);
 
#2 lore raw

PATCH 1/1 dm: qspi fix claim bus and release bus

Hi Peng,

Quoted 11 lines · Peng Fan

Add missed people.

Quoted 7 lines · Peng Fan

For fsl_qspi_claim_bus and fsl_qspi_release_bus, the input parameter "struct udevice *dev" represents device: "qspi[x]: qspi@[address] {...}". Since "dev" already represents the qspi controller, use its parent to get platdata and get 'priv' is wrong.

After applying this patch, qspi flashes can be correctly probed.

Is this patch still needed after this patch?

http://patchwork.ozlabs.org/patch/462595/

Quoted 37 lines
Quoted 37 lines
CC Simon Glass <[email protected]>
CC Jagannadha Sutradharudu Teki <[email protected]>
CC Haikun Wang <[email protected]>

---

Hi,

This patch is based on dm/next branch.

Regards,
Peng.

  drivers/spi/fsl_qspi.c | 10 +++-------
  1 file changed, 3 insertions(+), 7 deletions(-)
drivers/spi/fsl_qspi.c +2 -3
index 868df5f..04f1801 100644
@@ -1044,11 +1044,9 @@ static int fsl_qspi_xfer(struct udevice *dev,
 unsigned int bitlen,
  static int fsl_qspi_claim_bus(struct udevice *dev)
  {
        struct fsl_qspi_priv *priv;
-       struct udevice *bus;
-       struct dm_spi_slave_platdata *slave_plat =
 dev_get_parent_platdata(dev);
+       struct dm_spi_slave_platdata *slave_plat = dev_get_platdata(dev);
  -     bus = dev->parent;
-       priv = dev_get_priv(bus);
+       priv = dev_get_priv(dev);
        priv->cur_amba_base =
                priv->amba_base[0] + FSL_QSPI_FLASH_SIZE * slave_plat->cs;
@@ -1061,10 +1059,8 @@ static int fsl_qspi_claim_bus(struct udevice *dev)
  static int fsl_qspi_release_bus(struct udevice *dev)
Quoted 10 lines

drivers/spi/fsl_qspi.c static int fsl_qspi_claim_bus(struct udevice *dev) · line 1066

Quoted 8 lines
drivers/spi/fsl_qspi.c +1 -2
  {
        struct fsl_qspi_priv *priv;
-       struct udevice *bus;
  -     bus = dev->parent;
-       priv = dev_get_priv(bus);
+       priv = dev_get_priv(dev);
        qspi_module_disable(priv, 1);
 

Regards,
Simon

author
#3 lore raw

PATCH 1/1 dm: qspi fix claim bus and release bus

Hi Simon,

Quoted 12 lines · Simon Glass

Hi Peng,

Quoted 9 lines · Peng Fan

Add missed people.

Quoted 5 lines · Peng Fan

For fsl_qspi_claim_bus and fsl_qspi_release_bus, the input parameter "struct udevice *dev" represents device: "qspi[x]: qspi@[address] {...}". Since "dev" already represents the qspi controller, use its parent to get platdata and get 'priv' is wrong.

Quoted 4 lines
Quoted 1 line
Quoted 1 line

After applying this patch, qspi flashes can be correctly probed.

Is this patch still needed after this patch?

http://patchwork.ozlabs.org/patch/462595/

After applying your patch, this patch is not needed.

Quoted 46 lines
Quoted 37 lines
Quoted 37 lines
CC Simon Glass <[email protected]>
CC Jagannadha Sutradharudu Teki <[email protected]>
CC Haikun Wang <[email protected]>

---

Hi,

This patch is based on dm/next branch.

Regards,
Peng.

   drivers/spi/fsl_qspi.c | 10 +++-------
   1 file changed, 3 insertions(+), 7 deletions(-)
drivers/spi/fsl_qspi.c +2 -3
index 868df5f..04f1801 100644
@@ -1044,11 +1044,9 @@ static int fsl_qspi_xfer(struct udevice *dev,
 unsigned int bitlen,
   static int fsl_qspi_claim_bus(struct udevice *dev)
   {
         struct fsl_qspi_priv *priv;
-       struct udevice *bus;
-       struct dm_spi_slave_platdata *slave_plat =
 dev_get_parent_platdata(dev);
+       struct dm_spi_slave_platdata *slave_plat = dev_get_platdata(dev);
   -     bus = dev->parent;
-       priv = dev_get_priv(bus);
+       priv = dev_get_priv(dev);
         priv->cur_amba_base =
                 priv->amba_base[0] + FSL_QSPI_FLASH_SIZE * slave_plat->cs;
@@ -1061,10 +1059,8 @@ static int fsl_qspi_claim_bus(struct udevice *dev)
   static int fsl_qspi_release_bus(struct udevice *dev)
Quoted 9 lines

drivers/spi/fsl_qspi.c static int fsl_qspi_claim_bus(struct udevice *dev) · line 1066

Quoted 8 lines
drivers/spi/fsl_qspi.c +1 -2
   {
         struct fsl_qspi_priv *priv;
-       struct udevice *bus;
   -     bus = dev->parent;
-       priv = dev_get_priv(bus);
+       priv = dev_get_priv(dev);
         qspi_module_disable(priv, 1);
 
Quoted 4 lines

Regards,
Simon
.

Regards,
Peng.