All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] w1: Remove excess dependencies on W1 for masters and slaves
@ 2014-02-22  7:29 Alexander Shiyan
  2014-02-22  7:29 ` [PATCH 2/4] w1: mxc_w1: Fix mxc_w1_ds2_reset_bus() return value Alexander Shiyan
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Alexander Shiyan @ 2014-02-22  7:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Evgeniy Polyakov, Greg Kroah-Hartman, Shawn Guo, Sascha Hauer,
	Alexander Shiyan

Configuration for masters and slaves is included only if W1 symbol
enabled, so no reason to check it once more.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/w1/masters/Kconfig | 3 +--
 drivers/w1/slaves/Kconfig  | 5 -----
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig
index efc7f07..6ffe120 100644
--- a/drivers/w1/masters/Kconfig
+++ b/drivers/w1/masters/Kconfig
@@ -36,13 +36,12 @@ config W1_MASTER_DS2482
 
 config W1_MASTER_MXC
 	tristate "Freescale MXC 1-wire busmaster"
-	depends on W1 && ARCH_MXC
+	depends on ARCH_MXC
 	help
 	  Say Y here to enable MXC 1-wire host
 
 config W1_MASTER_DS1WM
 	tristate "Maxim DS1WM 1-wire busmaster"
-	depends on W1
 	help
 	  Say Y here to enable the DS1WM 1-wire driver, such as that
 	  in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like
diff --git a/drivers/w1/slaves/Kconfig b/drivers/w1/slaves/Kconfig
index 5e6a3c9..1cdce80 100644
--- a/drivers/w1/slaves/Kconfig
+++ b/drivers/w1/slaves/Kconfig
@@ -72,7 +72,6 @@ config W1_SLAVE_DS2433_CRC
 
 config W1_SLAVE_DS2760
 	tristate "Dallas 2760 battery monitor chip (HP iPAQ & others)"
-	depends on W1
 	help
 	  If you enable this you will have the DS2760 battery monitor
 	  chip support.
@@ -85,7 +84,6 @@ config W1_SLAVE_DS2760
 
 config W1_SLAVE_DS2780
 	tristate "Dallas 2780 battery monitor chip"
-	depends on W1
 	help
 	  If you enable this you will have the DS2780 battery monitor
 	  chip support.
@@ -98,7 +96,6 @@ config W1_SLAVE_DS2780
 
 config W1_SLAVE_DS2781
 	tristate "Dallas 2781 battery monitor chip"
-	depends on W1
 	help
 	  If you enable this you will have the DS2781 battery monitor
 	  chip support.
@@ -111,7 +108,6 @@ config W1_SLAVE_DS2781
 
 config W1_SLAVE_DS28E04
 	tristate "4096-Bit Addressable 1-Wire EEPROM with PIO (DS28E04-100)"
-	depends on W1
 	select CRC16
 	help
 	  If you enable this you will have the DS28E04-100
@@ -124,7 +120,6 @@ config W1_SLAVE_DS28E04
 
 config W1_SLAVE_BQ27000
 	tristate "BQ27000 slave support"
-	depends on W1
 	help
 	  Say Y here if you want to use a hdq
 	  bq27000 slave support.
-- 
1.8.3.2


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

* [PATCH 2/4] w1: mxc_w1: Fix mxc_w1_ds2_reset_bus() return value
  2014-02-22  7:29 [PATCH 1/4] w1: Remove excess dependencies on W1 for masters and slaves Alexander Shiyan
@ 2014-02-22  7:29 ` Alexander Shiyan
  2014-02-22  7:29 ` [PATCH 3/4] w1: mxc_w1: Driver cleanup Alexander Shiyan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2014-02-22  7:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Evgeniy Polyakov, Greg Kroah-Hartman, Shawn Guo, Sascha Hauer,
	Alexander Shiyan

This patch fix mxc_w1_ds2_reset_bus() return value.
According to i.MX reference manual, "presence status" reflected
in the bit 6 of control register.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/w1/masters/mxc_w1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
index 1e5d94c..6525b2c 100644
--- a/drivers/w1/masters/mxc_w1.c
+++ b/drivers/w1/masters/mxc_w1.c
@@ -74,7 +74,7 @@ static u8 mxc_w1_ds2_reset_bus(void *data)
 
 		udelay(100);
 	}
-	return (reg_val >> 7) & 0x1;
+	return (reg_val >> 6) & 0x1;
 }
 
 /*
-- 
1.8.3.2


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

* [PATCH 3/4] w1: mxc_w1: Driver cleanup
  2014-02-22  7:29 [PATCH 1/4] w1: Remove excess dependencies on W1 for masters and slaves Alexander Shiyan
  2014-02-22  7:29 ` [PATCH 2/4] w1: mxc_w1: Fix mxc_w1_ds2_reset_bus() return value Alexander Shiyan
@ 2014-02-22  7:29 ` Alexander Shiyan
  2014-02-22  7:29 ` [PATCH 4/4] w1: mxc_w1: Enable driver compilation with COMPILE_TEST Alexander Shiyan
  2014-03-04 19:57 ` [PATCH 1/4] w1: Remove excess dependencies on W1 for masters and slaves Evgeniy Polyakov
  3 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2014-02-22  7:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Evgeniy Polyakov, Greg Kroah-Hartman, Shawn Guo, Sascha Hauer,
	Alexander Shiyan

- Remove old and currently wrong address of the FSF from license
  parts of the code.
- Remove unused #include and sort remaining headers alphabetically.
- Remove unised definitions.
- Add definitions for bit-fields.
- Add missing module owner field.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/w1/masters/mxc_w1.c | 39 ++++++++++++++++-----------------------
 1 file changed, 16 insertions(+), 23 deletions(-)

diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
index 6525b2c..8e3de6a 100644
--- a/drivers/w1/masters/mxc_w1.c
+++ b/drivers/w1/masters/mxc_w1.c
@@ -10,24 +10,16 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
  */
 
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
 #include <linux/clk.h>
-#include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
 
 #include "../w1.h"
 #include "../w1_int.h"
-#include "../w1_log.h"
 
 /* According to the mx27 Datasheet the reset procedure should take up to about
  * 1350us. We set the timeout to 500*100us = 50ms for sure */
@@ -36,13 +28,13 @@
 /*
  * MXC W1 Register offsets
  */
-#define MXC_W1_CONTROL          0x00
-#define MXC_W1_TIME_DIVIDER     0x02
-#define MXC_W1_RESET            0x04
-#define MXC_W1_COMMAND          0x06
-#define MXC_W1_TXRX             0x08
-#define MXC_W1_INTERRUPT        0x0A
-#define MXC_W1_INTERRUPT_EN     0x0C
+#define MXC_W1_CONTROL		0x00
+# define MXC_W1_CONTROL_RDST	BIT(3)
+# define MXC_W1_CONTROL_WR(x)	BIT(5 - (x))
+# define MXC_W1_CONTROL_PST	BIT(6)
+# define MXC_W1_CONTROL_RPP	BIT(7)
+#define MXC_W1_TIME_DIVIDER	0x02
+#define MXC_W1_RESET		0x04
 
 struct mxc_w1_device {
 	void __iomem *regs;
@@ -61,12 +53,12 @@ static u8 mxc_w1_ds2_reset_bus(void *data)
 	unsigned int timeout_cnt = 0;
 	struct mxc_w1_device *dev = data;
 
-	__raw_writeb(0x80, (dev->regs + MXC_W1_CONTROL));
+	__raw_writeb(MXC_W1_CONTROL_RPP, (dev->regs + MXC_W1_CONTROL));
 
 	while (1) {
 		reg_val = __raw_readb(dev->regs + MXC_W1_CONTROL);
 
-		if (((reg_val >> 7) & 0x1) == 0 ||
+		if (!(reg_val & MXC_W1_CONTROL_RPP) ||
 		    timeout_cnt > MXC_W1_RESET_TIMEOUT)
 			break;
 		else
@@ -74,7 +66,7 @@ static u8 mxc_w1_ds2_reset_bus(void *data)
 
 		udelay(100);
 	}
-	return (reg_val >> 6) & 0x1;
+	return !!(reg_val & MXC_W1_CONTROL_PST);
 }
 
 /*
@@ -90,16 +82,16 @@ static u8 mxc_w1_ds2_touch_bit(void *data, u8 bit)
 					 * datasheet.
 					 */
 
-	__raw_writeb((1 << (5 - bit)), ctrl_addr);
+	__raw_writeb(MXC_W1_CONTROL_WR(bit), ctrl_addr);
 
 	while (timeout_cnt--) {
-		if (!((__raw_readb(ctrl_addr) >> (5 - bit)) & 0x1))
+		if (!(__raw_readb(ctrl_addr) & MXC_W1_CONTROL_WR(bit)))
 			break;
 
 		udelay(1);
 	}
 
-	return ((__raw_readb(ctrl_addr)) >> 3) & 0x1;
+	return !!(__raw_readb(ctrl_addr) & MXC_W1_CONTROL_RDST);
 }
 
 static int mxc_w1_probe(struct platform_device *pdev)
@@ -177,6 +169,7 @@ MODULE_DEVICE_TABLE(of, mxc_w1_dt_ids);
 static struct platform_driver mxc_w1_driver = {
 	.driver = {
 		.name = "mxc_w1",
+		.owner = THIS_MODULE,
 		.of_match_table = mxc_w1_dt_ids,
 	},
 	.probe = mxc_w1_probe,
-- 
1.8.3.2


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

* [PATCH 4/4] w1: mxc_w1: Enable driver compilation with COMPILE_TEST
  2014-02-22  7:29 [PATCH 1/4] w1: Remove excess dependencies on W1 for masters and slaves Alexander Shiyan
  2014-02-22  7:29 ` [PATCH 2/4] w1: mxc_w1: Fix mxc_w1_ds2_reset_bus() return value Alexander Shiyan
  2014-02-22  7:29 ` [PATCH 3/4] w1: mxc_w1: Driver cleanup Alexander Shiyan
@ 2014-02-22  7:29 ` Alexander Shiyan
  2014-03-04 19:57 ` [PATCH 1/4] w1: Remove excess dependencies on W1 for masters and slaves Evgeniy Polyakov
  3 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2014-02-22  7:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Evgeniy Polyakov, Greg Kroah-Hartman, Shawn Guo, Sascha Hauer,
	Alexander Shiyan

This helps increasing build testing coverage.
To do this, __raw_{read,write}b() functions was be replaced with
simple {read,write}b() variants.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/w1/masters/Kconfig  |  2 +-
 drivers/w1/masters/mxc_w1.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig
index 6ffe120..1708b23 100644
--- a/drivers/w1/masters/Kconfig
+++ b/drivers/w1/masters/Kconfig
@@ -36,7 +36,7 @@ config W1_MASTER_DS2482
 
 config W1_MASTER_MXC
 	tristate "Freescale MXC 1-wire busmaster"
-	depends on ARCH_MXC
+	depends on ARCH_MXC || COMPILE_TEST
 	help
 	  Say Y here to enable MXC 1-wire host
 
diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
index 8e3de6a..67b067a 100644
--- a/drivers/w1/masters/mxc_w1.c
+++ b/drivers/w1/masters/mxc_w1.c
@@ -53,10 +53,10 @@ static u8 mxc_w1_ds2_reset_bus(void *data)
 	unsigned int timeout_cnt = 0;
 	struct mxc_w1_device *dev = data;
 
-	__raw_writeb(MXC_W1_CONTROL_RPP, (dev->regs + MXC_W1_CONTROL));
+	writeb(MXC_W1_CONTROL_RPP, (dev->regs + MXC_W1_CONTROL));
 
 	while (1) {
-		reg_val = __raw_readb(dev->regs + MXC_W1_CONTROL);
+		reg_val = readb(dev->regs + MXC_W1_CONTROL);
 
 		if (!(reg_val & MXC_W1_CONTROL_RPP) ||
 		    timeout_cnt > MXC_W1_RESET_TIMEOUT)
@@ -82,16 +82,16 @@ static u8 mxc_w1_ds2_touch_bit(void *data, u8 bit)
 					 * datasheet.
 					 */
 
-	__raw_writeb(MXC_W1_CONTROL_WR(bit), ctrl_addr);
+	writeb(MXC_W1_CONTROL_WR(bit), ctrl_addr);
 
 	while (timeout_cnt--) {
-		if (!(__raw_readb(ctrl_addr) & MXC_W1_CONTROL_WR(bit)))
+		if (!(readb(ctrl_addr) & MXC_W1_CONTROL_WR(bit)))
 			break;
 
 		udelay(1);
 	}
 
-	return !!(__raw_readb(ctrl_addr) & MXC_W1_CONTROL_RDST);
+	return !!(readb(ctrl_addr) & MXC_W1_CONTROL_RDST);
 }
 
 static int mxc_w1_probe(struct platform_device *pdev)
@@ -131,7 +131,7 @@ static int mxc_w1_probe(struct platform_device *pdev)
 	if (err)
 		return err;
 
-	__raw_writeb(clkdiv - 1, mdev->regs + MXC_W1_TIME_DIVIDER);
+	writeb(clkdiv - 1, mdev->regs + MXC_W1_TIME_DIVIDER);
 
 	mdev->bus_master.data = mdev;
 	mdev->bus_master.reset_bus = mxc_w1_ds2_reset_bus;
-- 
1.8.3.2


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

* Re: [PATCH 1/4] w1: Remove excess dependencies on W1 for masters and slaves
  2014-02-22  7:29 [PATCH 1/4] w1: Remove excess dependencies on W1 for masters and slaves Alexander Shiyan
                   ` (2 preceding siblings ...)
  2014-02-22  7:29 ` [PATCH 4/4] w1: mxc_w1: Enable driver compilation with COMPILE_TEST Alexander Shiyan
@ 2014-03-04 19:57 ` Evgeniy Polyakov
  2014-03-05  1:39   ` Shawn Guo
  3 siblings, 1 reply; 6+ messages in thread
From: Evgeniy Polyakov @ 2014-03-04 19:57 UTC (permalink / raw)
  To: Alexander Shiyan, linux-kernel
  Cc: Greg Kroah-Hartman, Shawn Guo, Sascha Hauer

Hi everyone

22.02.2014, 11:30, "Alexander Shiyan" <shc_work@mail.ru>:
> Configuration for masters and slaves is included only if W1 symbol
> enabled, so no reason to check it once more.
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/w1/masters/Kconfig | 3 +--
>  drivers/w1/slaves/Kconfig  | 5 -----
>  2 files changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig
> index efc7f07..6ffe120 100644
> --- a/drivers/w1/masters/Kconfig
> +++ b/drivers/w1/masters/Kconfig
> @@ -36,13 +36,12 @@ config W1_MASTER_DS2482
>
>  config W1_MASTER_MXC
>          tristate "Freescale MXC 1-wire busmaster"
> - depends on W1 && ARCH_MXC
> + depends on ARCH_MXC

I know nothing about this arch, so while this first patch looks good, I can not say anything about the others :)

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

* Re: [PATCH 1/4] w1: Remove excess dependencies on W1 for masters and slaves
  2014-03-04 19:57 ` [PATCH 1/4] w1: Remove excess dependencies on W1 for masters and slaves Evgeniy Polyakov
@ 2014-03-05  1:39   ` Shawn Guo
  0 siblings, 0 replies; 6+ messages in thread
From: Shawn Guo @ 2014-03-05  1:39 UTC (permalink / raw)
  To: Evgeniy Polyakov
  Cc: Alexander Shiyan, linux-kernel, Greg Kroah-Hartman, Sascha Hauer

On Tue, Mar 04, 2014 at 11:57:17PM +0400, Evgeniy Polyakov wrote:
> Hi everyone
> 
> 22.02.2014, 11:30, "Alexander Shiyan" <shc_work@mail.ru>:
> > Configuration for masters and slaves is included only if W1 symbol
> > enabled, so no reason to check it once more.
> >
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > ---
> >  drivers/w1/masters/Kconfig | 3 +--
> >  drivers/w1/slaves/Kconfig  | 5 -----
> >  2 files changed, 1 insertion(+), 7 deletions(-)
> >
> > diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig
> > index efc7f07..6ffe120 100644
> > --- a/drivers/w1/masters/Kconfig
> > +++ b/drivers/w1/masters/Kconfig
> > @@ -36,13 +36,12 @@ config W1_MASTER_DS2482
> >
> >  config W1_MASTER_MXC
> >          tristate "Freescale MXC 1-wire busmaster"
> > - depends on W1 && ARCH_MXC
> > + depends on ARCH_MXC
> 
> I know nothing about this arch, so while this first patch looks good, I can not say anything about the others :)

Others look good to me.  So,

Acked-by: Shawn Guo <shawn.guo@linaro.org>


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

end of thread, other threads:[~2014-03-05  1:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-22  7:29 [PATCH 1/4] w1: Remove excess dependencies on W1 for masters and slaves Alexander Shiyan
2014-02-22  7:29 ` [PATCH 2/4] w1: mxc_w1: Fix mxc_w1_ds2_reset_bus() return value Alexander Shiyan
2014-02-22  7:29 ` [PATCH 3/4] w1: mxc_w1: Driver cleanup Alexander Shiyan
2014-02-22  7:29 ` [PATCH 4/4] w1: mxc_w1: Enable driver compilation with COMPILE_TEST Alexander Shiyan
2014-03-04 19:57 ` [PATCH 1/4] w1: Remove excess dependencies on W1 for masters and slaves Evgeniy Polyakov
2014-03-05  1:39   ` Shawn Guo

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.