diff mbox

[U-Boot,1/6] cros_ec: Fix two bugs in the SPI implementation

Message ID 1404749802-22450-1-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Simon Glass July 7, 2014, 4:16 p.m. UTC
An incorrect message version is passed to the EC in some cases and the
parameters of one function are switched.

Fix these problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/misc/cros_ec_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ajay kumar July 8, 2014, 6:10 a.m. UTC | #1
On Mon, Jul 7, 2014 at 9:46 PM, Simon Glass <sjg@chromium.org> wrote:
> An incorrect message version is passed to the EC in some cases and the
> parameters of one function are switched.
>
> Fix these problems.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/misc/cros_ec_spi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/cros_ec_spi.c b/drivers/misc/cros_ec_spi.c
> index 7df709c..015333f 100644
> --- a/drivers/misc/cros_ec_spi.c
> +++ b/drivers/misc/cros_ec_spi.c
> @@ -98,7 +98,7 @@ int cros_ec_spi_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
>         }
>
>         out = dev->dout;
> -       out[0] = cmd_version;
> +       out[0] = EC_CMD_VERSION0 + cmd_version;
>         out[1] = cmd;
>         out[2] = (uint8_t)dout_len;
>         memcpy(out + 3, dout, dout_len);
> @@ -165,7 +165,7 @@ int cros_ec_spi_decode_fdt(struct cros_ec_dev *dev, const void *blob)
>   */
>  int cros_ec_spi_init(struct cros_ec_dev *dev, const void *blob)
>  {
> -       dev->spi = spi_setup_slave_fdt(blob, dev->parent_node, dev->node);
> +       dev->spi = spi_setup_slave_fdt(blob, dev->node, dev->parent_node);
>         if (!dev->spi) {
>                 debug("%s: Could not setup SPI slave\n", __func__);
>                 return -1;
> --
> 2.0.0.526.g5318336
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Able to test display on peach_pit(which needs tps65090) with these patches.
Also, crosec commands from u-boot prompt works as expected on peach_pit.

Tested-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Jagan Teki July 13, 2014, 2:40 p.m. UTC | #2
On Tue, Jul 8, 2014 at 11:40 AM, Ajay kumar <ajaynumb@gmail.com> wrote:
> On Mon, Jul 7, 2014 at 9:46 PM, Simon Glass <sjg@chromium.org> wrote:
>> An incorrect message version is passed to the EC in some cases and the
>> parameters of one function are switched.
>>
>> Fix these problems.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>>  drivers/misc/cros_ec_spi.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/misc/cros_ec_spi.c b/drivers/misc/cros_ec_spi.c
>> index 7df709c..015333f 100644
>> --- a/drivers/misc/cros_ec_spi.c
>> +++ b/drivers/misc/cros_ec_spi.c
>> @@ -98,7 +98,7 @@ int cros_ec_spi_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
>>         }
>>
>>         out = dev->dout;
>> -       out[0] = cmd_version;
>> +       out[0] = EC_CMD_VERSION0 + cmd_version;
>>         out[1] = cmd;
>>         out[2] = (uint8_t)dout_len;
>>         memcpy(out + 3, dout, dout_len);
>> @@ -165,7 +165,7 @@ int cros_ec_spi_decode_fdt(struct cros_ec_dev *dev, const void *blob)
>>   */
>>  int cros_ec_spi_init(struct cros_ec_dev *dev, const void *blob)
>>  {
>> -       dev->spi = spi_setup_slave_fdt(blob, dev->parent_node, dev->node);
>> +       dev->spi = spi_setup_slave_fdt(blob, dev->node, dev->parent_node);
>>         if (!dev->spi) {
>>                 debug("%s: Could not setup SPI slave\n", __func__);
>>                 return -1;
>> --
>> 2.0.0.526.g5318336
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
> Able to test display on peach_pit(which needs tps65090) with these patches.
> Also, crosec commands from u-boot prompt works as expected on peach_pit.
>
> Tested-by: Ajay Kumar <ajaykumar.rs@samsung.com>

Applied to u-boot-spi/master

thanks!
diff mbox

Patch

diff --git a/drivers/misc/cros_ec_spi.c b/drivers/misc/cros_ec_spi.c
index 7df709c..015333f 100644
--- a/drivers/misc/cros_ec_spi.c
+++ b/drivers/misc/cros_ec_spi.c
@@ -98,7 +98,7 @@  int cros_ec_spi_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
 	}
 
 	out = dev->dout;
-	out[0] = cmd_version;
+	out[0] = EC_CMD_VERSION0 + cmd_version;
 	out[1] = cmd;
 	out[2] = (uint8_t)dout_len;
 	memcpy(out + 3, dout, dout_len);
@@ -165,7 +165,7 @@  int cros_ec_spi_decode_fdt(struct cros_ec_dev *dev, const void *blob)
  */
 int cros_ec_spi_init(struct cros_ec_dev *dev, const void *blob)
 {
-	dev->spi = spi_setup_slave_fdt(blob, dev->parent_node, dev->node);
+	dev->spi = spi_setup_slave_fdt(blob, dev->node, dev->parent_node);
 	if (!dev->spi) {
 		debug("%s: Could not setup SPI slave\n", __func__);
 		return -1;