All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] max310x: max3109_detect should use indirect addressing in SPI mode for REVID register
@ 2014-09-05 16:07 Gregory Hermant
  2014-09-05 17:30 ` Alexander Shiyan
  2014-09-29  1:32 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Gregory Hermant @ 2014-09-05 16:07 UTC (permalink / raw)
  To: linux-serial; +Cc: shc_work, Gregory Hermant

This patch allows to read the REV_ID register in SPI mode and consequently
to properly detect the max3109. Indeed in SPI mode, this register is only
accessible by using indirect addressing.

Signed-off-by: Gregory Hermant <gregory.hermant@calao-systems.com>
---
 drivers/tty/serial/max310x.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 5183643..2d911f6 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -369,10 +369,13 @@ static int max3109_detect(struct device *dev)
 	unsigned int val = 0;
 	int ret;
 
-	ret = regmap_read(s->regmap, MAX310X_REVID_REG, &val);
+	ret = regmap_write(s->regmap, MAX310X_GLOBALCMD_REG,
+			   MAX310X_EXTREG_ENBL);
 	if (ret)
 		return ret;
-
+	
+	regmap_read(s->regmap, MAX310X_REVID_EXTREG, &val);
+	regmap_write(s->regmap, MAX310X_GLOBALCMD_REG, MAX310X_EXTREG_DSBL);
 	if (((val & MAX310x_REV_MASK) != MAX3109_REV_ID)) {
 		dev_err(dev,
 			"%s ID 0x%02x does not match\n", s->devtype->name, val);
-- 
1.7.9.5


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

* Re: [PATCH] max310x: max3109_detect should use indirect addressing in SPI mode for REVID register
  2014-09-05 16:07 [PATCH] max310x: max3109_detect should use indirect addressing in SPI mode for REVID register Gregory Hermant
@ 2014-09-05 17:30 ` Alexander Shiyan
  2014-09-29  1:32 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Shiyan @ 2014-09-05 17:30 UTC (permalink / raw)
  To: Gregory Hermant; +Cc: linux-serial, Greg Kroah-Hartman

Fri,  5 Sep 2014 18:07:36 +0200 от Gregory Hermant <gregory.hermant@calao-systems.com>:
> This patch allows to read the REV_ID register in SPI mode and consequently
> to properly detect the max3109. Indeed in SPI mode, this register is only
> accessible by using indirect addressing.
> 
> Signed-off-by: Gregory Hermant <gregory.hermant@calao-systems.com>
> ---
>  drivers/tty/serial/max310x.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
> index 5183643..2d911f6 100644
> --- a/drivers/tty/serial/max310x.c
> +++ b/drivers/tty/serial/max310x.c
> @@ -369,10 +369,13 @@ static int max3109_detect(struct device *dev)
>  	unsigned int val = 0;
>  	int ret;
>  
> -	ret = regmap_read(s->regmap, MAX310X_REVID_REG, &val);
> +	ret = regmap_write(s->regmap, MAX310X_GLOBALCMD_REG,
> +			   MAX310X_EXTREG_ENBL);
>  	if (ret)
>  		return ret;
> -
> +	
> +	regmap_read(s->regmap, MAX310X_REVID_EXTREG, &val);
> +	regmap_write(s->regmap, MAX310X_GLOBALCMD_REG, MAX310X_EXTREG_DSBL);
>  	if (((val & MAX310x_REV_MASK) != MAX3109_REV_ID)) {
>  		dev_err(dev,
>  			"%s ID 0x%02x does not match\n", s->devtype->name, val);
> -- 

Reviewed-by: Alexander Shiyan <shc_work@mail.ru>

---


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

* Re: [PATCH] max310x: max3109_detect should use indirect addressing in SPI mode for REVID register
  2014-09-05 16:07 [PATCH] max310x: max3109_detect should use indirect addressing in SPI mode for REVID register Gregory Hermant
  2014-09-05 17:30 ` Alexander Shiyan
@ 2014-09-29  1:32 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2014-09-29  1:32 UTC (permalink / raw)
  To: Gregory Hermant; +Cc: linux-serial, shc_work

On Fri, Sep 05, 2014 at 06:07:36PM +0200, Gregory Hermant wrote:
> This patch allows to read the REV_ID register in SPI mode and consequently
> to properly detect the max3109. Indeed in SPI mode, this register is only
> accessible by using indirect addressing.
> 
> Signed-off-by: Gregory Hermant <gregory.hermant@calao-systems.com>
> ---
>  drivers/tty/serial/max310x.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
> index 5183643..2d911f6 100644
> --- a/drivers/tty/serial/max310x.c
> +++ b/drivers/tty/serial/max310x.c
> @@ -369,10 +369,13 @@ static int max3109_detect(struct device *dev)
>  	unsigned int val = 0;
>  	int ret;
>  
> -	ret = regmap_read(s->regmap, MAX310X_REVID_REG, &val);
> +	ret = regmap_write(s->regmap, MAX310X_GLOBALCMD_REG,
> +			   MAX310X_EXTREG_ENBL);
>  	if (ret)
>  		return ret;
> -
> +	

Always run your patches through checkpatch.pl and never add new problems
to the existing codebase :(


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

end of thread, other threads:[~2014-09-29  6:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-05 16:07 [PATCH] max310x: max3109_detect should use indirect addressing in SPI mode for REVID register Gregory Hermant
2014-09-05 17:30 ` Alexander Shiyan
2014-09-29  1:32 ` Greg KH

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.