Re: [PATCH 0/2] mmc: omap_hsmmc: support SDIO cards (#2)

2010-10-06 Thread Madhusudhan Chikkature

snip

 You are correct!  The version of the patch in the repo indeed has
 'out' in the wrong place and generates a compile error.

 Could you post the patch you are using and I will try to reproduce
 what you are seeing on my hardware?  Best we all work from exactly the
 same patch!

 Steve


Yes. I think that check breaking the compilation is not needed. How about the
below version? It just removes that check.

This version should apply fine on the latest kernel. I did a sanity test of
MMC/SD cards on OMAP4 SDP.

Steve or Mike can check if SDIO interrupts are working.

Regards,
Madhu

From 08b77fd388f19f5df3758a2c59dcdec280f373c8 Mon Sep 17 00:00:00 2001
From: David Vrabel david.vra...@csr.com
Date: Wed, 6 Oct 2010 12:39:18 -0500
Subject: [PATCH 1/2] mmc: omap_hsmmc: enable SDIO card interrupts

Enable the use of SDIO card interrupts.

FCLK must be enabled while SDIO interrupts are enabled or the MMC
module won't wake-up (even though ENAWAKEUP in SYSCONFIG and IWE in
HTCL have been set).  Enabling the MMC module to wake-up would require
configuring the MMC module (and the mmci_dat[1] GPIO when the CORE
power domain is OFF) as wake-up sources in the PRCM.

The writes to STAT and ISE when starting a command are unnecessary and
have been removed.

Signed-off-by: David Vrabel david.vra...@csr.com
---
 drivers/mmc/host/omap_hsmmc.c |   72 +
 1 files changed, 65 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4693e62..948dd9a 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -66,6 +66,7 @@
 #define SDVS_MASK  0x0E00
 #define SDVSCLR0xF1FF
 #define SDVSDET0x0400
+#define ENAWAKEUP  (1  2)
 #define AUTOIDLE   0x1
 #define SDBP   (1  8)
 #define DTO0xe
@@ -76,9 +77,12 @@
 #define CLKD_SHIFT 6
 #define DTO_MASK   0x000F
 #define DTO_SHIFT  16
+#define CIRQ_ENABLE(1  8)
 #define INT_EN_MASK0x307F0033
 #define BWR_ENABLE (1  4)
 #define BRR_ENABLE (1  5)
+#define CTPL   (1  11)
+#define CLKEXTFREE (1  16)
 #define DTO_ENABLE (1  20)
 #define INIT_STREAM(1  1)
 #define DP_SELECT  (1  21)
@@ -87,10 +91,12 @@
 #define MSBS   (1  5)
 #define BCE(1  1)
 #define FOUR_BIT   (1  1)
+#define IWE(1  24)
 #define DW8(1  5)
 #define CC 0x1
 #define TC 0x02
 #define OD 0x1
+#define CIRQ   (1  8)
 #define ERR(1  15)
 #define CMD_TIMEOUT(1  16)
 #define DATA_TIMEOUT   (1  20)
@@ -184,6 +190,7 @@ struct omap_hsmmc_host {
int reqs_blocked;
int use_reg;
int req_in_progress;
+   int sdio_int;

struct  omap_mmc_platform_data  *pdata;
 };
@@ -551,6 +558,9 @@ static void omap_hsmmc_enable_irq(struct omap_hsmmc_host
*host,
if (cmd-opcode == MMC_ERASE)
irq_mask = ~DTO_ENABLE;

+   if (host-sdio_int)
+   irq_mask |= CIRQ;
+
OMAP_HSMMC_WRITE(host-base, STAT, STAT_CLEAR);
OMAP_HSMMC_WRITE(host-base, ISE, irq_mask);
OMAP_HSMMC_WRITE(host-base, IE, irq_mask);
@@ -603,7 +613,7 @@ static int omap_hsmmc_context_restore(struct
omap_hsmmc_host *host)
;

OMAP_HSMMC_WRITE(host-base, SYSCONFIG,
-   OMAP_HSMMC_READ(host-base, SYSCONFIG) | AUTOIDLE);
+   OMAP_HSMMC_READ(host-base, SYSCONFIG) | AUTOIDLE | ENAWAKEUP);

if (host-id == OMAP_MMC1_DEVID) {
if (host-power_mode != MMC_POWER_OFF 
@@ -618,7 +628,7 @@ static int omap_hsmmc_context_restore(struct
omap_hsmmc_host *host)
}

OMAP_HSMMC_WRITE(host-base, HCTL,
-   OMAP_HSMMC_READ(host-base, HCTL) | hctl);
+   OMAP_HSMMC_READ(host-base, HCTL) | hctl | IWE);

OMAP_HSMMC_WRITE(host-base, CAPA,
OMAP_HSMMC_READ(host-base, CAPA) | capa);
@@ -1019,6 +1029,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host
*host, int status)
 {
struct mmc_data *data;
int end_cmd = 0, end_trans = 0;
+   bool card_irq = false;

if (!host-req_in_progress) {
do {
@@ -1032,6 +1043,9 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host
*host, int status)
data = host-data;
dev_dbg(mmc_dev(host-mmc), IRQ Status is %x\n, status);

+   if (status  CIRQ)
+   card_irq = true;
+
if (status  ERR) {
 #ifdef CONFIG_MMC_DEBUG
omap_hsmmc_report_irq(host, status);
@@ -1087,6 +1101,9 @@ 

[PATCH V2] OMAP4 ES2: HSMMC soft reset change

2010-09-28 Thread Madhusudhan Chikkature
The omap4 es2 hsmmc has a updated soft reset logic.After the
reset is issued monitor a 0-1 transition first. The reset of
CMD or DATA lines is complete only after a 0-1-0 transition
of SRC or SRD bits.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
Tested-by: Anand Gadiyar gadi...@ti.com
---
 arch/arm/mach-omap2/hsmmc.c   |3 +++
 arch/arm/plat-omap/include/plat/mmc.h |1 +
 drivers/mmc/host/omap_hsmmc.c |   11 +++
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 87ce6ff..37f9f56 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -298,6 +298,9 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info
*controllers)
else
mmc-slots[0].features |= HSMMC_HAS_PBIAS;

+   if (cpu_is_omap44xx()  (omap_rev()  OMAP4430_REV_ES1_0))
+   mmc-slots[0].features |= HSMMC_HAS_UPDATED_RESET;
+
switch (c-mmc) {
case 1:
if (mmc-slots[0].features  HSMMC_HAS_PBIAS) {
diff --git a/arch/arm/plat-omap/include/plat/mmc.h
b/arch/arm/plat-omap/include/plat/mmc.h
index 4f819fc..2c4629a 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -103,6 +103,7 @@ struct omap_mmc_platform_data {

/* we can put the features above into this variable */
 #define HSMMC_HAS_PBIAS(1  0)
+#define HSMMC_HAS_UPDATED_RESET(1  1)
unsigned features;

int switch_pin; /* gpio (card detect) */
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 53f8fa5..69858e7 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -982,6 +982,17 @@ static inline void omap_hsmmc_reset_controller_fsm(struct
omap_hsmmc_host *host,
OMAP_HSMMC_WRITE(host-base, SYSCTL,
 OMAP_HSMMC_READ(host-base, SYSCTL) | bit);

+   /*
+* OMAP4 ES2 and greater has an updated reset logic.
+* Monitor a 0-1 transition first
+*/
+   if (mmc_slot(host).features  HSMMC_HAS_UPDATED_RESET) {
+   while ((!(OMAP_HSMMC_READ(host, SYSCTL)  bit))
+(i++  limit))
+   cpu_relax();
+   }
+   i = 0;
+
while ((OMAP_HSMMC_READ(host-base, SYSCTL)  bit) 
(i++  limit))
cpu_relax();
-- 
1.7.0.4



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] OMAP4: HSMMC cmd line reset change

2010-09-15 Thread Madhusudhan Chikkature
OMAP4: HSMMC cmd line reset change

The cmd line reset logic is changed in OMAP4 ES2. The new procedure
is to monitor a 0-1 transition and then 1-0 transition.The earlier
logic would fail on ES2 chips because the loop could exit even before
the reset is actually complete.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4526d27..750ba7d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -976,12 +976,19 @@ static inline void omap_hsmmc_reset_controller_fsm(struct
omap_hsmmc_host *host,
   unsigned long bit)
 {
unsigned long i = 0;
+   unsigned long j = 0;
unsigned long limit = (loops_per_jiffy *
msecs_to_jiffies(MMC_TIMEOUT_MS));

OMAP_HSMMC_WRITE(host-base, SYSCTL,
 OMAP_HSMMC_READ(host-base, SYSCTL) | bit);

+   if (cpu_is_omap44xx()  bit == SRC) {
+   while ((!(OMAP_HSMMC_READ(host-base, SYSCTL)  bit))
+(j++  limit))
+   cpu_relax();
+   }
+
while ((OMAP_HSMMC_READ(host-base, SYSCTL)  bit) 
(i++  limit))
cpu_relax();
-- 
1.7.0.4



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Disable the non working eMMC on Zoom2/3

2010-03-31 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature madhu...@ti.com
Date: Wed, 31 Mar 2010 12:29:19 -0400
Subject: [PATCH] Zoom2/3: Disable MMC2

The eMMC on Zoom2/3 seems to have a lower EXT_CSD Rev.This causes the
writes to fail since the card size is not detected correctly by the MMC
core. Disable the MMC2 support for Zoom2/3.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 arch/arm/mach-omap2/board-zoom-peripherals.c |   30 --
 1 files changed, 0 insertions(+), 30 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c
b/arch/arm/mach-omap2/board-zoom-peripherals.c
index 6b39849..ac791d2 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -102,10 +102,6 @@ static struct regulator_consumer_supply zoom_vsim_supply = 
{
.supply = vmmc_aux,
 };

-static struct regulator_consumer_supply zoom_vmmc2_supply = {
-   .supply = vmmc,
-};
-
 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
 static struct regulator_init_data zoom_vmmc1 = {
.constraints = {
@@ -121,21 +117,6 @@ static struct regulator_init_data zoom_vmmc1 = {
.consumer_supplies  = zoom_vmmc1_supply,
 };

-/* VMMC2 for MMC2 card */
-static struct regulator_init_data zoom_vmmc2 = {
-   .constraints = {
-   .min_uV = 185,
-   .max_uV = 185,
-   .apply_uV   = true,
-   .valid_modes_mask   = REGULATOR_MODE_NORMAL
-   | REGULATOR_MODE_STANDBY,
-   .valid_ops_mask = REGULATOR_CHANGE_MODE
-   | REGULATOR_CHANGE_STATUS,
-   },
-   .num_consumer_supplies  = 1,
-   .consumer_supplies  = zoom_vmmc2_supply,
-};
-
 /* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
 static struct regulator_init_data zoom_vsim = {
.constraints = {
@@ -159,15 +140,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
.gpio_wp= -EINVAL,
.power_saving   = true,
},
-   {
-   .name   = internal,
-   .mmc= 2,
-   .wires  = 8,
-   .gpio_cd= -EINVAL,
-   .gpio_wp= -EINVAL,
-   .nonremovable   = true,
-   .power_saving   = true,
-   },
{}  /* Terminator */
 };

@@ -183,7 +155,6 @@ static int zoom_twl_gpio_setup(struct device *dev,
*/
zoom_vmmc1_supply.dev = mmc[0].dev;
zoom_vsim_supply.dev = mmc[0].dev;
-   zoom_vmmc2_supply.dev = mmc[1].dev;

return 0;
 }
@@ -241,7 +212,6 @@ static struct twl4030_platform_data zoom_twldata = {
.keypad = zoom_kp_twl4030_data,
.codec  = zoom_codec_data,
.vmmc1  = zoom_vmmc1,
-   .vmmc2  = zoom_vmmc2,
.vsim   = zoom_vsim,

 };
-- 
1.6.3.3



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH]OMAP HSMMC: Fix a bug in card remove scenario

2010-03-31 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature madhu...@ti.com
Date: Wed, 31 Mar 2010 19:31:24 -0400
Subject: [PATCH] OMAP HSMMC:Fix a bug in card removal scenario

The reset of data lines when the card is removed from the cage results
in a failure.The failure is seen if the card is removed from the cage
when TC is pending after a CMD with data received CC.The reset logic leaves
the controller in a state where niether a TC is received nor DTO.

The rest code can be safely removed here since it is taken care in the IRQ
handler.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |9 ++---
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 83f0aff..e9caf69 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1179,15 +1179,10 @@ static void omap_hsmmc_detect(struct work_struct *work)
carddetect = -ENOSYS;
}

-   if (carddetect) {
+   if (carddetect)
mmc_detect_change(host-mmc, (HZ * 200) / 1000);
-   } else {
-   mmc_host_enable(host-mmc);
-   omap_hsmmc_reset_controller_fsm(host, SRD);
-   mmc_host_lazy_disable(host-mmc);
-
+   else
mmc_detect_change(host-mmc, (HZ * 50) / 1000);
-   }
 }

 /*
-- 
1.6.3.3



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Zoom2/3:Update hsmmc board config params

2009-11-24 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature madhu...@ti.com
Subject: [PATCH] Zoom2/3:Update hsmmc board config params.

Update the hsmmc zoom peripheral configuration to support:
Power saving mode
mmc2 8-bit support
Configure mmc2 as non removable

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 arch/arm/mach-omap2/board-zoom-peripherals.c |   13 -
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c
b/arch/arm/mach-omap2/board-zoom-peripherals.c
index 221a8e3..258794d 100755
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -152,14 +152,20 @@ static struct regulator_init_data zoom_vsim = {

 static struct twl4030_hsmmc_info mmc[] __initdata = {
{
+   .name   = external,
.mmc= 1,
.wires  = 4,
.gpio_wp= -EINVAL,
+   .power_saving   = true,
},
{
+   .name   = internal,
.mmc= 2,
-   .wires  = 4,
+   .wires  = 8,
+   .gpio_cd= -EINVAL,
.gpio_wp= -EINVAL,
+   .nonremovable   = true,
+   .power_saving   = true,
},
{}  /* Terminator */
 };
@@ -167,11 +173,8 @@ static struct twl4030_hsmmc_info mmc[] __initdata = {
 static int zoom_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
 {
-   /* gpio + 0 is mmc0_cd (input/IRQ),
-* gpio + 1 is mmc1_cd (input/IRQ)
-*/
+   /* gpio + 0 is mmc0_cd (input/IRQ) */
mmc[0].gpio_cd = gpio + 0;
-   mmc[1].gpio_cd = gpio + 1;
twl4030_mmc_init(mmc);

/* link regulators to MMC adapters ... we know the
-- 
1.6.0.4



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH]Set omap3630 MMC1 I/O speed to 52Mhz

2009-10-27 Thread Madhusudhan Chikkature
From 43454c1812043ca6b21d2594e63c93b6250a9882 Mon Sep 17 00:00:00 2001
From: Madhu madhu...@ti.com
Date: Tue, 27 Oct 2009 17:44:09 -0400
Subject: [PATCH]Set omap3630 MMC1 I/O speed to 52Mhz

The speed ctrl bit for MMC I/O is part of CONTROL_PROG_IO1 register
in omap3630.This patch sets it up accordingly.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 arch/arm/mach-omap2/mmc-twl4030.c |   11 +--
 arch/arm/plat-omap/include/plat/control.h |4 
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/mmc-twl4030.c 
b/arch/arm/mach-omap2/mmc-twl4030.c
index 7bef170..1940591 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.c
+++ b/arch/arm/mach-omap2/mmc-twl4030.c
@@ -213,7 +213,7 @@ static int twl4030_mmc_get_context_loss(struct device *dev)
 static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,
int vdd)
 {
-   u32 reg;
+   u32 reg, prog_io;
int ret = 0;
struct twl_mmc_controller *c = hsmmc[0];
struct omap_mmc_platform_data *mmc = dev-platform_data;
@@ -245,7 +245,14 @@ static int twl_mmc1_set_power(struct device *dev, int
slot, int power_on,
}

reg = omap_ctrl_readl(control_pbias_offset);
-   reg |= OMAP2_PBIASSPEEDCTRL0;
+   if (cpu_is_omap3630()) {
+   /* Set MMC I/O to 52Mhz */
+   prog_io = omap_ctrl_readl(OMAP34XX_CONTROL_PROG_IO1);
+   prog_io |= OMAP3630_PRG_SDMMC1_SPEEDCTRL;
+   omap_ctrl_writel(prog_io, OMAP34XX_CONTROL_PROG_IO1);
+   } else {
+   reg |= OMAP2_PBIASSPEEDCTRL0;
+   }
reg = ~OMAP2_PBIASLITEPWRDNZ0;
omap_ctrl_writel(reg, control_pbias_offset);

diff --git a/arch/arm/plat-omap/include/plat/control.h
b/arch/arm/plat-omap/include/plat/control.h
index fdb6300..47368bc 100644
--- a/arch/arm/plat-omap/include/plat/control.h
+++ b/arch/arm/plat-omap/include/plat/control.h
@@ -146,6 +146,7 @@
 #define OMAP343X_CONTROL_IVA2_BOOTMOD  (OMAP2_CONTROL_GENERAL + 0x0194)
 #define OMAP343X_CONTROL_PBIAS_LITE(OMAP2_CONTROL_GENERAL + 0x02b0)
 #define OMAP343X_CONTROL_TEMP_SENSOR   (OMAP2_CONTROL_GENERAL + 0x02b4)
+#define OMAP34XX_CONTROL_PROG_IO1  (OMAP2_CONTROL_GENERAL + 0x01D8)

 /* 34xx D2D idle-related pins, handled by PM core */
 #define OMAP3_PADCONF_SAD2D_MSTANDBY   0x250
@@ -196,6 +197,9 @@
 #define OMAP2_PBIASLITEPWRDNZ0 (1  1)
 #define OMAP2_PBIASLITEVMODE0  (1  0)

+/* CONTROL_PROG_IO1 bits */
+#define OMAP3630_PRG_SDMMC1_SPEEDCTRL  (1  20)
+
 /* CONTROL_IVA2_BOOTMOD bits */
 #define OMAP3_IVA2_BOOTMOD_SHIFT   0
 #define OMAP3_IVA2_BOOTMOD_MASK(0xf  0)
-- 
1.6.0.4



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH]Omap3630: Add hsmmc related checks

2009-10-22 Thread Madhusudhan Chikkature
From 661b13474a7af62c54f7df7a33a818c5e782cc59 Mon Sep 17 00:00:00 2001
From: Madhu madhu...@ti.com
Date: Wed, 21 Oct 2009 16:16:31 -0400
Subject: [PATCH] Omap3630: Add HSMMC related checks.

Add omap3630 conditional checks to devices.c to allow HSMMC3 addition and
mux configuration for HSMMC1/2.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 arch/arm/mach-omap2/devices.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 7d4513b..1fdfc7f 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -575,7 +575,7 @@ static inline void omap2_mmc_mux(struct
omap_mmc_platform_data *mmc_controller,
}
}

-   if (cpu_is_omap3430()) {
+   if (cpu_is_omap3430() || cpu_is_omap3630()) {
if (controller_nr == 0) {
omap_cfg_reg(N28_3430_MMC1_CLK);
omap_cfg_reg(M27_3430_MMC1_CMD);
@@ -642,7 +642,8 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data
**mmc_data,
irq = INT_24XX_MMC2_IRQ;
break;
case 2:
-   if (!cpu_is_omap44xx()  !cpu_is_omap34xx())
+   if (!cpu_is_omap44xx()  !cpu_is_omap34xx()
+!cpu_is_omap3630())
return;
base = OMAP3_MMC3_BASE;
irq = INT_34XX_MMC3_IRQ;
-- 
1.6.0.4



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH]Omap3630:Configure HSMMC1 to 4-bit

2009-10-22 Thread Madhusudhan Chikkature
From 69189aa64954eded29921f3c248a9c1c0f5214e5 Mon Sep 17 00:00:00 2001
From: Madhu madhu...@ti.com
Date: Wed, 21 Oct 2009 16:32:49 -0400
Subject: [PATCH] Omap3630: Configure HSMMC1 to 4-bit.

The HSMMC1 controller on omap3630 supprts only 4-bit mode. If cpu
is 3630 configure HSMMC1 wires to 4-bit.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 arch/arm/mach-omap2/mmc-twl4030.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/mmc-twl4030.c 
b/arch/arm/mach-omap2/mmc-twl4030.c
index 3403914..7bef170 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.c
+++ b/arch/arm/mach-omap2/mmc-twl4030.c
@@ -489,6 +489,12 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info
*controllers)
/* on-chip level shifting via PBIAS0/PBIAS1 */
mmc-slots[0].set_power = twl_mmc1_set_power;
mmc-slots[0].set_sleep = twl_mmc1_set_sleep;
+
+   /* Omap3630 HSMMC1 supports only 4-bit */
+   if (cpu_is_omap3630()  c-wires  4) {
+   c-wires = 4;
+   mmc-slots[0].wires = c-wires;
+   }
break;
case 2:
if (c-ext_clock)
-- 
1.6.0.4



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH]Omap HSMMC2 8-bit mux configuration

2009-10-22 Thread Madhusudhan Chikkature
From c6eb46e918044739ba21ec31a9bd09ebcfa9fb53 Mon Sep 17 00:00:00 2001
From: Madhu madhu...@ti.com
Date: Wed, 21 Oct 2009 16:49:24 -0400
Subject: [PATCH] Omap HSMMC2 8-bit mux configuration.

Add support for omap hsmmc2 8-bit mux configuration.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 arch/arm/mach-omap2/devices.c |6 ++
 arch/arm/mach-omap2/mux.c |8 
 arch/arm/plat-omap/include/plat/mux.h |4 
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 1fdfc7f..2ca415a 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -609,6 +609,12 @@ static inline void omap2_mmc_mux(struct
omap_mmc_platform_data *mmc_controller,
omap_cfg_reg(AG4_3430_MMC2_DAT2);
omap_cfg_reg(AF4_3430_MMC2_DAT3);
}
+   if (mmc_controller-slots[0].wires == 8) {
+   omap_cfg_reg(AE4_3430_MMC2_DAT4);
+   omap_cfg_reg(AH3_3430_MMC2_DAT5);
+   omap_cfg_reg(AF3_3430_MMC2_DAT6);
+   omap_cfg_reg(AE3_3430_MMC2_DAT7);
+   }
}

/*
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 32c953e..83256d3 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -532,6 +532,14 @@ MUX_CFG_34XX(AG4_3430_MMC2_DAT2, 0x160,
OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
 MUX_CFG_34XX(AF4_3430_MMC2_DAT3, 0x162,
OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX(AE4_3430_MMC2_DAT4, 0x164,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX(AH3_3430_MMC2_DAT5, 0x166,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX(AF3_3430_MMC2_DAT6, 0x168,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX(AE3_3430_MMC2_DAT7, 0x16A,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)

 /* MMC3 */
 MUX_CFG_34XX(AF10_3430_MMC3_CLK, 0x5d8,
diff --git a/arch/arm/plat-omap/include/plat/mux.h
b/arch/arm/plat-omap/include/plat/mux.h
index f3c1d8a..df38e16 100644
--- a/arch/arm/plat-omap/include/plat/mux.h
+++ b/arch/arm/plat-omap/include/plat/mux.h
@@ -829,6 +829,10 @@ enum omap34xx_index {
AH4_3430_MMC2_DAT1,
AG4_3430_MMC2_DAT2,
AF4_3430_MMC2_DAT3,
+   AE4_3430_MMC2_DAT4,
+   AH3_3430_MMC2_DAT5,
+   AF3_3430_MMC2_DAT6,
+   AE3_3430_MMC2_DAT7,

/* MMC3 */
AF10_3430_MMC3_CLK,
-- 
1.6.0.4



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH]Zoom2: Setup HSMMC2 8-bit capability

2009-10-22 Thread Madhusudhan Chikkature
From 2369a08e238186bf66b677ead62b23786e5b9ac7 Mon Sep 17 00:00:00 2001
From: Madhu madhu...@ti.com
Date: Wed, 21 Oct 2009 16:55:27 -0400
Subject: [PATCH] Zoom2: Setup HSMMC2 8-bit capability.

Zoom2 can support 8-bit operations on HSMMC2.Setup the board file
capability accordingly.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 arch/arm/mach-omap2/board-zoom2.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom2.c 
b/arch/arm/mach-omap2/board-zoom2.c
index 56f9d84..ad022ac 100644
--- a/arch/arm/mach-omap2/board-zoom2.c
+++ b/arch/arm/mach-omap2/board-zoom2.c
@@ -163,7 +163,7 @@ static struct twl4030_hsmmc_info mmc[] __initdata = {
},
{
.mmc= 2,
-   .wires  = 4,
+   .wires  = 8,
.gpio_wp= -EINVAL,
},
{}  /* Terminator */
-- 
1.6.0.4



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2]Omap3630: Add hsmmc related checks

2009-10-22 Thread Madhusudhan Chikkature
From 102c97677b6a30b7741e1612c8fc03d60921f4e8 Mon Sep 17 00:00:00 2001
From: Madhu madhu...@ti.com
Date: Wed, 21 Oct 2009 16:16:31 -0400
Subject: [PATCH] Omap3630: Add HSMMC related checks.

Change the cpu_is_omap3430() check to cpu_is_omap34xx() to allow HSMMC1/2
mux configuration for omap3630.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 arch/arm/mach-omap2/devices.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 7d4513b..8d23e1f 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -575,7 +575,7 @@ static inline void omap2_mmc_mux(struct
omap_mmc_platform_data *mmc_controller,
}
}

-   if (cpu_is_omap3430()) {
+   if (cpu_is_omap34xx()) {
if (controller_nr == 0) {
omap_cfg_reg(N28_3430_MMC1_CLK);
omap_cfg_reg(M27_3430_MMC1_CMD);
-- 
1.6.0.4



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: MMC_CAP_SDIO_IRQ for omap 3430

2009-10-16 Thread Madhusudhan Chikkature
Hi Dirk,

I am inlining the patch so that it helps review.



Subject: [PATCH][RFC] OMAP HSMMC: Add SDIO interrupt support
Form: Dirk Behme dirk.be...@googlemail.com

At the moment, OMAP HSMMC driver supports only SDIO polling, resulting in poor
performance. Add support for SDIO interrupt handling.

Signed-off-by: Dirk Behme dirk.be...@googlemail.com
---

Patch against recent omap-linux head Linux omap got rebuilt from scratch
274c94b29ee7c53609a756acca974e4742c59559

Compile tested only. Please comment and help testing.

 drivers/mmc/host/omap_hsmmc.c |   48 +-
 1 file changed, 43 insertions(+), 5 deletions(-)

Index: linux-beagle/drivers/mmc/host/omap_hsmmc.c
===
--- linux-beagle.orig/drivers/mmc/host/omap_hsmmc.c
+++ linux-beagle/drivers/mmc/host/omap_hsmmc.c
@@ -27,6 +27,7 @@
 #include linux/timer.h
 #include linux/clk.h
 #include linux/mmc/host.h
+#include linux/mmc/card.h
 #include linux/mmc/core.h
 #include linux/io.h
 #include linux/semaphore.h
@@ -65,6 +66,7 @@
 #define SDVSDET0x0400
 #define AUTOIDLE   0x1
 #define SDBP   (1  8)
+#define IBG(1  19)
 #define DTO0xe
 #define ICE0x1
 #define ICS0x2
@@ -76,6 +78,7 @@
 #define INT_EN_MASK0x307F0033
 #define BWR_ENABLE (1  4)
 #define BRR_ENABLE (1  5)
+#define CIRQ_ENABLE(1  8)
 #define INIT_STREAM(1  1)
 #define DP_SELECT  (1  21)
 #define DDIR   (1  4)
@@ -87,6 +90,7 @@
 #define CC 0x1
 #define TC 0x02
 #define OD 0x1
+#define CIRQ   (1   8)
 #define ERR(1  15)
 #define CMD_TIMEOUT(1  16)
 #define DATA_TIMEOUT   (1  20)
@@ -653,6 +657,15 @@ static irqreturn_t omap_hsmmc_irq(int ir
status = OMAP_HSMMC_READ(host-base, STAT);
dev_dbg(mmc_dev(host-mmc), IRQ Status is %x\n, status);

+   if (status  CIRQ) {
+   dev_dbg(mmc_dev(host-mmc), SDIO interrupt);
+   OMAP_HSMMC_WRITE(host-base, IE, OMAP_HSMMC_READ(host-base, IE)
+ ~(CIRQ_ENABLE));
+   mmc_signal_sdio_irq(host-mmc);
+   spin_unlock(host-irq_lock);
+   return IRQ_HANDLED;
+   }
+
if (status  ERR) {
 #ifdef CONFIG_MMC_DEBUG
omap_hsmmc_report_irq(host, status);
@@ -1165,8 +1178,15 @@ static void omap_hsmmc_set_ios(struct mm
break;
case MMC_BUS_WIDTH_4:
OMAP_HSMMC_WRITE(host-base, CON, con  ~DW8);
-   OMAP_HSMMC_WRITE(host-base, HCTL,
-   OMAP_HSMMC_READ(host-base, HCTL) | FOUR_BIT);
+   if (mmc_card_sdio(host-mmc-card)) {

I wish it could be moved to enable_sdio_irq so that we can avoid inclusion of
card.h and checking the type of card in the host controller driver. But the
dependancy on 4-bit seems to be a problem here.

On the problems being discussed on testing is the interrupt source geting
cleared at the SDIO card level upon genaration of the CIRQ? If not it remains
asserted.

+   OMAP_HSMMC_WRITE(host-base, HCTL,
+OMAP_HSMMC_READ(host-base, HCTL)
+| IBG | FOUR_BIT);
+   } else {
+   OMAP_HSMMC_WRITE(host-base, HCTL,
+OMAP_HSMMC_READ(host-base, HCTL)
+| FOUR_BIT);
+   }
break;
case MMC_BUS_WIDTH_1:
OMAP_HSMMC_WRITE(host-base, CON, con  ~DW8);
@@ -1512,6 +1532,24 @@ static int omap_hsmmc_disable_fclk(struc
return 0;
 }

+static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
+{
+   struct omap_hsmmc_host *host = mmc_priv(mmc);
+   u32 ie, ise;
+
+   ise = OMAP_HSMMC_READ(host-base, ISE);
+   ie  = OMAP_HSMMC_READ(host-base, IE);
+
+   if (enable) {
+   OMAP_HSMMC_WRITE(host-base, ISE, ise | CIRQ_ENABLE);
+   OMAP_HSMMC_WRITE(host-base, IE,  ie  | CIRQ_ENABLE);
+   } else {
+   OMAP_HSMMC_WRITE(host-base, ISE, ise  ~CIRQ_ENABLE);
+   OMAP_HSMMC_WRITE(host-base, IE,  ie   ~CIRQ_ENABLE);
+   }
+
+}
+
 static const struct mmc_host_ops omap_hsmmc_ops = {
.enable = omap_hsmmc_enable_fclk,
.disable = omap_hsmmc_disable_fclk,
@@ -1519,7 +1557,7 @@ static const struct mmc_host_ops omap_hs
.set_ios = omap_hsmmc_set_ios,
.get_cd = omap_hsmmc_get_cd,
.get_ro = omap_hsmmc_get_ro,
-   /* NYET -- enable_sdio_irq */
+   .enable_sdio_irq = omap_hsmmc_enable_sdio_irq,
 };

 static const struct mmc_host_ops omap_hsmmc_ps_ops = {
@@ -1529,7 +1567,7 @@ 

[PATCH]Optimize the delay in MMC power sequence

2009-09-06 Thread Madhusudhan Chikkature
commit 004a049bbab47d382a741d8e8fc6a1b9b44b36ac
Author: Madhu madhu...@ti.com
Date:   Sun Sep 6 13:18:21 2009 -0400

Replace the 100mS delay in the MMC power sequence with an appropriate delay
based on the measurements taken for VDDS stability on SDP with T2 power IC.
The delay in the power down sequence is not needed since it is taken care in
the power up sequence.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com

diff --git a/arch/arm/mach-omap2/mmc-twl4030.c 
b/arch/arm/mach-omap2/mmc-twl4030.c
index 3c04c2f..6a9be61 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.c
+++ b/arch/arm/mach-omap2/mmc-twl4030.c
@@ -237,30 +237,27 @@ static int twl_mmc1_set_power(struct device *dev, int
slot, int power_on,
reg = ~OMAP2_PBIASLITEPWRDNZ0;
omap_ctrl_writel(reg, control_pbias_offset);

-   ret = mmc_regulator_set_ocr(c-vcc, vdd);
-
-   /* 100ms delay required for PBIAS configuration */
-   msleep(100);
reg = omap_ctrl_readl(control_pbias_offset);
-   reg |= (OMAP2_PBIASLITEPWRDNZ0 | OMAP2_PBIASSPEEDCTRL0);
if ((1  vdd) = MMC_VDD_165_195)
reg = ~OMAP2_PBIASLITEVMODE0;
else
reg |= OMAP2_PBIASLITEVMODE0;
omap_ctrl_writel(reg, control_pbias_offset);
+
+   ret = mmc_regulator_set_ocr(c-vcc, vdd);
+
+   /* 400uS required for VDDS to stable */
+   udelay(400);
+
+   reg = omap_ctrl_readl(control_pbias_offset);
+   reg |= OMAP2_PBIASLITEPWRDNZ0;
+   omap_ctrl_writel(reg, control_pbias_offset);
} else {
reg = omap_ctrl_readl(control_pbias_offset);
reg = ~OMAP2_PBIASLITEPWRDNZ0;
omap_ctrl_writel(reg, control_pbias_offset);

ret = mmc_regulator_set_ocr(c-vcc, 0);
-
-   /* 100ms delay required for PBIAS configuration */
-   msleep(100);
-   reg = omap_ctrl_readl(control_pbias_offset);
-   reg |= (OMAP2_PBIASSPEEDCTRL0 | OMAP2_PBIASLITEPWRDNZ0 |
-   OMAP2_PBIASLITEVMODE0);
-   omap_ctrl_writel(reg, control_pbias_offset);
}

return ret;


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] omap_hsmmc: Fix for the db clock failure message

2009-08-19 Thread Madhusudhan Chikkature
Hi,

The patch applies on top of the series [PATCH V2 0/32] mmc and omap_hsmmc
patches posted by Adrian Hunter.

Regards,
Madhu



This patch removes the error message Failed to get debounce clock.. printed
out by the MMC driver on OMAP3430. The debounce clock needs to be handled only
for OMAP2430.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   46 ++
 1 file changed, 25 insertions(+), 21 deletions(-)

Index: linux-2.6/drivers/mmc/host/omap_hsmmc.c
===
--- linux-2.6.orig/drivers/mmc/host/omap_hsmmc.c
+++ linux-2.6/drivers/mmc/host/omap_hsmmc.c
@@ -160,7 +160,7 @@ struct omap_hsmmc_host {
int use_dma, dma_ch;
int dma_line_tx, dma_line_rx;
int slot_id;
-   int dbclk_enabled;
+   int got_dbclk;
int response_busy;
int context_loss;
int dpm_state;
@@ -735,7 +735,7 @@ static int omap_hsmmc_switch_opcond(stru
/* Disable the clocks */
clk_disable(host-fclk);
clk_disable(host-iclk);
-   if (host-dbclk_enabled)
+   if (host-got_dbclk)
clk_disable(host-dbclk);

/* Turn the power off */
@@ -746,9 +746,9 @@ static int omap_hsmmc_switch_opcond(stru
ret = mmc_slot(host).set_power(host-dev, host-slot_id, 1,
   vdd);
clk_enable(host-iclk);
-   if (host-dbclk_enabled)
-   clk_enable(host-dbclk);
clk_enable(host-fclk);
+   if (host-got_dbclk)
+   clk_enable(host-dbclk);

if (ret != 0)
goto err;
@@ -1697,18 +1697,22 @@ static int __init omap_hsmmc_probe(struc
goto err1;
}

-   host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
-   /*
-* MMC can still work without debounce clock.
-*/
-   if (IS_ERR(host-dbclk))
-   dev_warn(mmc_dev(host-mmc), Failed to get debounce clock\n);
-   else
-   if (clk_enable(host-dbclk) != 0)
-   dev_dbg(mmc_dev(host-mmc), Enabling debounce
-clk failed\n);
+   if (cpu_is_omap2430()) {
+   host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
+   /*
+* MMC can still work without debounce clock.
+*/
+   if (IS_ERR(host-dbclk))
+   dev_warn(mmc_dev(host-mmc),
+   Failed to get debounce clock\n);
else
-   host-dbclk_enabled = 1;
+   host-got_dbclk = 1;
+
+   if (host-got_dbclk)
+   if (clk_enable(host-dbclk) != 0)
+   dev_dbg(mmc_dev(host-mmc), Enabling debounce
+clk failed\n);
+   }

/* Since we do only SG emulation, we can have as many segs
 * as we want. */
@@ -1825,7 +1829,7 @@ err_irq:
clk_disable(host-iclk);
clk_put(host-fclk);
clk_put(host-iclk);
-   if (host-dbclk_enabled) {
+   if (host-got_dbclk) {
clk_disable(host-dbclk);
clk_put(host-dbclk);
}
@@ -1859,7 +1863,7 @@ static int omap_hsmmc_remove(struct plat
clk_disable(host-iclk);
clk_put(host-fclk);
clk_put(host-iclk);
-   if (host-dbclk_enabled) {
+   if (host-got_dbclk) {
clk_disable(host-dbclk);
clk_put(host-dbclk);
}
@@ -1910,7 +1914,7 @@ static int omap_hsmmc_suspend(struct pla
OMAP_HSMMC_READ(host-base, HCTL)  ~SDBP);
mmc_host_disable(host-mmc);
clk_disable(host-iclk);
-   if (host-dbclk_enabled)
+   if (host-got_dbclk)
clk_disable(host-dbclk);
} else {
host-suspended = 0;
@@ -1942,14 +1946,14 @@ static int omap_hsmmc_resume(struct plat
if (ret)
goto clk_en_err;

-   if (host-dbclk_enabled)
-   clk_enable(host-dbclk);
-
if (mmc_host_enable(host-mmc) != 0) {
clk_disable(host-iclk);
goto clk_en_err;
}

+   if (host-got_dbclk)
+   clk_enable(host-dbclk);
+
omap_hsmmc_conf_bus_power(host);

if (host-pdata-resume) {


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More

[PATCH] Maintainers update for TI OMAP hsmmc driver

2009-08-19 Thread Madhusudhan Chikkature
Hi,

I have posted this patch to linux-...@vger.kernel.org list earlier. I am
reposting it to Andrew as I am not clear on the upstream path from
linux-...@vger.kernel.org list currently.

Regards,
Madhu
---

Update maintainers entry for TI OMAP HS MMC support.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
Acked-by: Kevin Hilman khil...@deeprootsystems.com
---
 MAINTAINERS |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: linux-2.6/MAINTAINERS
===
--- linux-2.6.orig/MAINTAINERS
+++ linux-2.6/MAINTAINERS
@@ -3712,7 +3712,13 @@ OMAP MMC SUPPORT
 M: Jarkko Lavinen jarkko.lavi...@nokia.com
 L: linux-omap@vger.kernel.org
 S: Maintained
-F: drivers/mmc/host/*omap*
+F: drivers/mmc/host/omap.c
+
+OMAP HS MMC SUPPORT
+M: Madhusudhan Chikkature madhu...@ti.com
+L: linux-omap@vger.kernel.org
+S: Maintained
+F: drivers/mmc/host/omap_hsmmc.c

 OMAP RANDOM NUMBER GENERATOR SUPPORT
 M: Deepak Saxena dsax...@plexity.net


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Maintainers update for TI OMAP hsmmc driver

2009-08-18 Thread Madhusudhan Chikkature
Update maintainers entry for TI OMAP HS MMC support.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
Acked-by: Kevin Hilman khil...@deeprootsystems.com
---
 MAINTAINERS |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: linux-omap-2.6/MAINTAINERS
===
--- linux-omap-2.6.orig/MAINTAINERS
+++ linux-omap-2.6/MAINTAINERS
@@ -3698,7 +3698,13 @@ OMAP MMC SUPPORT
 M: Jarkko Lavinen jarkko.lavi...@nokia.com
 L: linux-omap@vger.kernel.org
 S: Maintained
-F: drivers/mmc/host/*omap*
+F: drivers/mmc/host/omap.c
+
+OMAP HS MMC SUPPORT
+M: Madhusudhan Chikkature madhu...@ti.com
+L: linux-omap@vger.kernel.org
+S: Maintained
+F: drivers/mmc/host/omap_hsmmc.c

 OMAP RANDOM NUMBER GENERATOR SUPPORT
 M: Deepak Saxena dsax...@plexity.net


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] omap_hsmmc: Fix for the db clock failure message

2009-08-17 Thread Madhusudhan Chikkature
Hi,

This patch applies on top of the series [PATCH V2 0/32] mmc and omap_hsmmc
patches posted by Adrian Hunter.

Regards,
Madhu
-



This patch removes the error message Failed to get debounce clock.. printed
out by the HSMMC driver on OMAP3430. The debounce clock needs to be handled only
for OMAP2430.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |   63 +++---
 1 file changed, 41 insertions(+), 22 deletions(-)

Index: linux-2.6/drivers/mmc/host/omap_hsmmc.c
===
--- linux-2.6.orig/drivers/mmc/host/omap_hsmmc.c
+++ linux-2.6/drivers/mmc/host/omap_hsmmc.c
@@ -735,8 +735,10 @@ static int omap_hsmmc_switch_opcond(stru
/* Disable the clocks */
clk_disable(host-fclk);
clk_disable(host-iclk);
-   if (host-dbclk_enabled)
+   if (cpu_is_omap2430()  host-dbclk_enabled) {
clk_disable(host-dbclk);
+   host-dbclk_enabled = 0;
+   }

/* Turn the power off */
ret = mmc_slot(host).set_power(host-dev, host-slot_id, 0, 0);
@@ -746,9 +748,14 @@ static int omap_hsmmc_switch_opcond(stru
ret = mmc_slot(host).set_power(host-dev, host-slot_id, 1,
   vdd);
clk_enable(host-iclk);
-   if (host-dbclk_enabled)
-   clk_enable(host-dbclk);
clk_enable(host-fclk);
+   if (cpu_is_omap2430()  !host-dbclk_enabled) {
+   if (clk_enable(host-dbclk) != 0)
+   dev_dbg(mmc_dev(host-mmc), Enabling debounce
+clk failed\n);
+   else
+   host-dbclk_enabled = 1;
+   }

if (ret != 0)
goto err;
@@ -1697,18 +1704,21 @@ static int __init omap_hsmmc_probe(struc
goto err1;
}

-   host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
-   /*
-* MMC can still work without debounce clock.
-*/
-   if (IS_ERR(host-dbclk))
-   dev_warn(mmc_dev(host-mmc), Failed to get debounce clock\n);
-   else
-   if (clk_enable(host-dbclk) != 0)
-   dev_dbg(mmc_dev(host-mmc), Enabling debounce
-clk failed\n);
+   if (cpu_is_omap2430()) {
+   host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
+   /*
+* MMC can still work without debounce clock.
+*/
+   if (IS_ERR(host-dbclk))
+   dev_warn(mmc_dev(host-mmc),
+   Failed to get debounce clock\n);
else
-   host-dbclk_enabled = 1;
+   if (clk_enable(host-dbclk) != 0)
+   dev_dbg(mmc_dev(host-mmc), Enabling debounce
+clk failed\n);
+   else
+   host-dbclk_enabled = 1;
+   }

/* Since we do only SG emulation, we can have as many segs
 * as we want. */
@@ -1825,8 +1835,9 @@ err_irq:
clk_disable(host-iclk);
clk_put(host-fclk);
clk_put(host-iclk);
-   if (host-dbclk_enabled) {
-   clk_disable(host-dbclk);
+   if (cpu_is_omap2430()) {
+   if (host-dbclk_enabled)
+   clk_disable(host-dbclk);
clk_put(host-dbclk);
}

@@ -1859,8 +1870,9 @@ static int omap_hsmmc_remove(struct plat
clk_disable(host-iclk);
clk_put(host-fclk);
clk_put(host-iclk);
-   if (host-dbclk_enabled) {
-   clk_disable(host-dbclk);
+   if (cpu_is_omap2430()) {
+   if (host-dbclk_enabled)
+   clk_disable(host-dbclk);
clk_put(host-dbclk);
}

@@ -1910,8 +1922,10 @@ static int omap_hsmmc_suspend(struct pla
OMAP_HSMMC_READ(host-base, HCTL)  ~SDBP);
mmc_host_disable(host-mmc);
clk_disable(host-iclk);
-   if (host-dbclk_enabled)
+   if (cpu_is_omap2430()  host-dbclk_enabled) {
clk_disable(host-dbclk);
+   host-dbclk_enabled = 0;
+   }
} else {
host-suspended = 0;
if (host-pdata-resume) {
@@ -1942,14 +1956,19 @@ static int omap_hsmmc_resume(struct plat
if (ret)
goto clk_en_err;

-   if (host-dbclk_enabled)
-   clk_enable(host-dbclk);
-
if (mmc_host_enable(host-mmc) != 0

[Resend][PATCH] Maintainers update for hsmmc driver

2009-08-07 Thread Madhusudhan Chikkature
Hi,

Resending the patch after changing omap_hs* to omap_hsmmc.c.

Regards,
Madhu



Update maintainers entry for TI OMAP HS MMC support.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 MAINTAINERS |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: linux-omap-2.6/MAINTAINERS
===
--- linux-omap-2.6.orig/MAINTAINERS
+++ linux-omap-2.6/MAINTAINERS
@@ -3698,7 +3698,13 @@ OMAP MMC SUPPORT
 M: Jarkko Lavinen jarkko.lavi...@nokia.com
 L: linux-omap@vger.kernel.org
 S: Maintained
-F: drivers/mmc/host/*omap*
+F: drivers/mmc/host/omap.c
+
+OMAP HS MMC SUPPORT
+M: Madhusudhan Chikkature madhu...@ti.com
+L: linux-omap@vger.kernel.org
+S: Maintained
+F: drivers/mmc/host/omap_hsmmc.c

 OMAP RANDOM NUMBER GENERATOR SUPPORT
 M: Deepak Saxena dsax...@plexity.net


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Resend][PATCH] Maintainers update for hsmmc driver

2009-08-06 Thread Madhusudhan Chikkature
Hi,

Resending the patch after fixing the conflict pointed out by Nishant.

Regards,
Madhu
---

Update maintainers entry for TI OMAP HS MMC support.

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 MAINTAINERS |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: linux-omap-2.6/MAINTAINERS
===
--- linux-omap-2.6.orig/MAINTAINERS
+++ linux-omap-2.6/MAINTAINERS
@@ -3698,7 +3698,13 @@ OMAP MMC SUPPORT
 M: Jarkko Lavinen jarkko.lavi...@nokia.com
 L: linux-omap@vger.kernel.org
 S: Maintained
-F: drivers/mmc/host/*omap*
+F: drivers/mmc/host/omap.c
+
+OMAP HS MMC SUPPORT
+M: Madhusudhan Chikkature madhu...@ti.com
+L: linux-omap@vger.kernel.org
+S: Maintained
+F: drivers/mmc/host/omap_hs*

 OMAP RANDOM NUMBER GENERATOR SUPPORT
 M: Deepak Saxena dsax...@plexity.net


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC][PATCH] Maintainers update for hsmmc driver

2009-08-05 Thread Madhusudhan Chikkature
Hi,

I intend to post this patch upstream for TI OMAP 2430/3430 HSMMC controller
driver maintainance. Any thoughts or comments welcome.

Regards,
Madhu

Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
---
 MAINTAINERS |6 ++
 1 file changed, 6 insertions(+)

Index: linux-omap-2.6/MAINTAINERS
===
--- linux-omap-2.6.orig/MAINTAINERS
+++ linux-omap-2.6/MAINTAINERS
@@ -3700,6 +3700,12 @@ L:   linux-omap@vger.kernel.org
 S: Maintained
 F: drivers/mmc/host/*omap*

+OMAP HS MMC SUPPORT
+M: Madhusudhan Chikkature madhu...@ti.com
+L: linux-omap@vger.kernel.org
+S: Maintained
+F: drivers/mmc/host/*omap_hsmmc*
+
 OMAP RANDOM NUMBER GENERATOR SUPPORT
 M: Deepak Saxena dsax...@plexity.net
 S: Maintained



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH] Maintainers update for hsmmc driver

2009-08-05 Thread Madhusudhan Chikkature
 Madhusudhan said the following on 08/05/2009 07:00 PM:
 Signed-off-by: Madhusudhan Chikkature madhu...@ti.com
 ---
  MAINTAINERS |6 ++
  1 file changed, 6 insertions(+)

 Index: linux-omap-2.6/MAINTAINERS
 ===
 --- linux-omap-2.6.orig/MAINTAINERS
 +++ linux-omap-2.6/MAINTAINERS
 @@ -3700,6 +3700,12 @@ L:  linux-omap@vger.kernel.org
  S:Maintained
  F:drivers/mmc/host/*omap*

 this regex *omap* and your regex *omap_hsmmc* are conflicting IMHO.


 Why do you think so? The omap driver which could support OMAP1 + 2420 vs
 omap_hsmmc driver which support 2430/3430 controller are two separate
 drivers.


 Simple:
 $ ls drivers/mmc/host/*omap*
 drivers/mmc/host/omap.c  drivers/mmc/host/omap_hsmmc.c
 $ ls drivers/mmc/host/*omap_hsmmc*
 drivers/mmc/host/omap_hsmmc.c


I got your point now. I will resubmit the patch by explicitly changing *omap*
to omap.c and *omap_hsmmc* to omap_hsmmc.c.

Regards,
Madhu

 Regards,
 Nishanth Menon




--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] HDQ Driver for OMAP2430/3430

2008-10-14 Thread Madhusudhan Chikkature

- Original Message - 
From: Andrew Morton [EMAIL PROTECTED]
To: Madhusudhan Chikkature [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
linux-omap@vger.kernel.org
Sent: Monday, October 13, 2008 9:23 PM
Subject: Re: [PATCH 1/5] HDQ Driver for OMAP2430/3430


 On Mon, 13 Oct 2008 18:55:43 +0530 Madhusudhan Chikkature [EMAIL 
 PROTECTED] wrote:
 
 - Original Message - 
 From: Andrew Morton [EMAIL PROTECTED]
 To: Gadiyar, Anand [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; linux-omap@vger.kernel.org; 
 [EMAIL PROTECTED]
 Sent: Saturday, October 11, 2008 2:08 AM
 Subject: Re: [PATCH 1/5] HDQ Driver for OMAP2430/3430
 
 
  +   /* set the GO bit */
  +   hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 
  OMAP_HDQ_CTRL_STATUS_GO,
  +   OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO);
  +   /* wait for the TXCOMPLETE bit */
  +   ret = wait_event_interruptible_timeout(hdq_wait_queue,
  +   hdq_data-hdq_irqstatus, OMAP_HDQ_TIMEOUT);
  +   if (ret  0) {
  +   dev_dbg(hdq_data-dev, wait interrupted);
  +   return -EINTR;
  +   }
  
  Is this desirable?  The user hits ^C and the driver bails out?
  
  I assume so, but was this tested?
 
 Andrew, What is the test scenario you mean here? A user hitting ^C when the 
 driver is waiting for the TXCOMPLETE bit?
 
 Yes.
 

Yes. It is desired to return an error if the condition in the wait is not met. 
I need to change the check for return value to check for zero and neg value.

I spent some time to test this perticular scenario.I could not really see any 
impact of hitting ^C when an application is 
transfering data in the background. When the h/w is programmed to transfer data 
and the driver issues a wait, I see that 
TXCOMPLETE interrupt comes immediately and wakes up as expected. 

So guess I am unable to hit ^C exactly when the driver is waiting in 
wait_event_interruptible_timeout(before the condition 
is met) for it to catch the signal. Is it generally suggested to use 
wait_event_timeout so that ^C signal is not caught?

Regards,
Madhu
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] HDQ Driver for OMAP2430/3430

2008-10-13 Thread Madhusudhan Chikkature

- Original Message - 
From: Andrew Morton [EMAIL PROTECTED]
To: Gadiyar, Anand [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; linux-omap@vger.kernel.org; 
[EMAIL PROTECTED]
Sent: Saturday, October 11, 2008 2:08 AM
Subject: Re: [PATCH 1/5] HDQ Driver for OMAP2430/3430


 On Wed, 8 Oct 2008 12:46:25 +0530
 Gadiyar, Anand [EMAIL PROTECTED] wrote:
 
 From: Madhusudhan Chikkature [EMAIL PROTECTED]
 
 The HDQ/1-Wire module of TI OMAP2430/3430 platforms implement the hardware
 protocol of the master functions of the Benchmark HDQ and the Dallas
 Semiconductor 1-Wire protocols. These protocols use a single wire for
 communication between the master (HDQ/1-Wire controller) and the slave
 (HDQ/1-Wire external compliant device).
 
 This patch provides the HDQ driver to suppport TI OMAP2430/3430 platforms.
 
 Every tab character in all five patches was converted to eight-spaces by
 your email client.  Please fix the mailer and resend everything.
 
 +++ linux-2.6/drivers/w1/masters/omap_hdq.c 2008-09-26 
 14:28:36.0 +0530
 @@ -0,0 +1,730 @@
 +/*
 + * drivers/w1/masters/omap_hdq.c
 + *
 + * Copyright (C) 2007 Texas Instruments, Inc.
 + *
 + * This file is licensed under the terms of the GNU General Public License
 + * version 2. This program is licensed as is without any warranty of any
 + * kind, whether express or implied.
 + *
 + */
 +#include linux/kernel.h
 +#include linux/module.h
 +#include linux/platform_device.h
 +#include linux/interrupt.h
 +#include linux/err.h
 +#include linux/clk.h
 +#include linux/io.h
 +#include asm/irq.h
 +#include mach/hardware.h
 
 We conventionally put a blank line between the linux/ includes and the
 asm/ includes.
 
 +static int omap_hdq_get(struct hdq_data *hdq_data);
 +static int omap_hdq_put(struct hdq_data *hdq_data);
 +static int omap_hdq_break(struct hdq_data *hdq_data);
 
 These three aren't strictly needed, because these functions are defined
 before first use.  I think it's best to not declare them.
 
 +static int hdq_wait_for_flag(struct hdq_data *hdq_data, u32 offset,
 +   u8 flag, u8 flag_set, u8 *status)
 +{
 +   int ret = 0;
 +   unsigned long timeout = jiffies + OMAP_HDQ_TIMEOUT;
 +
 +   if (flag_set == OMAP_HDQ_FLAG_CLEAR) {
 +   /* wait for the flag clear */
 +   while (((*status = hdq_reg_in(hdq_data, offset))  flag)
 +time_before(jiffies, timeout)) {
 +   set_current_state(TASK_UNINTERRUPTIBLE);
 +   schedule_timeout(1);
 
 Use schedule_timeout_uninterruptible(1)
 
 +   }
 +   if (*status  flag)
 +   ret = -ETIMEDOUT;
 +   } else if (flag_set == OMAP_HDQ_FLAG_SET) {
 +   /* wait for the flag set */
 +   while (!((*status = hdq_reg_in(hdq_data, offset))  flag)
 +time_before(jiffies, timeout)) {
 +   set_current_state(TASK_UNINTERRUPTIBLE);
 +   schedule_timeout(1);
 
 elsewhere..
 
 +   }
 +   if (!(*status  flag))
 +   ret = -ETIMEDOUT;
 +   } else
 +   return -EINVAL;
 +
 +   return ret;
 +}
 +
 +/* write out a byte and fill *status with HDQ_INT_STATUS */
 +static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
 +{
 +   int ret;
 +   u8 tmp_status;
 +   unsigned long irqflags;
 +
 +   *status = 0;
 +
 +   spin_lock_irqsave(hdq_data-hdq_spinlock, irqflags);
 +   /* clear interrupt flags via a dummy read */
 +   hdq_reg_in(hdq_data, OMAP_HDQ_INT_STATUS);
 +   /* ISR loads it with new INT_STATUS */
 +   hdq_data-hdq_irqstatus = 0;
 +   spin_unlock_irqrestore(hdq_data-hdq_spinlock, irqflags);
 +
 +   hdq_reg_out(hdq_data, OMAP_HDQ_TX_DATA, val);
 +
 +   /* set the GO bit */
 +   hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 
 OMAP_HDQ_CTRL_STATUS_GO,
 +   OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO);
 +   /* wait for the TXCOMPLETE bit */
 +   ret = wait_event_interruptible_timeout(hdq_wait_queue,
 +   hdq_data-hdq_irqstatus, OMAP_HDQ_TIMEOUT);
 +   if (ret  0) {
 +   dev_dbg(hdq_data-dev, wait interrupted);
 +   return -EINTR;
 +   }
 
 Is this desirable?  The user hits ^C and the driver bails out?
 
 I assume so, but was this tested?

Andrew, What is the test scenario you mean here? A user hitting ^C when the 
driver is waiting for the TXCOMPLETE bit?
 
 
 +   spin_lock_irqsave(hdq_data-hdq_spinlock, irqflags);
 +   *status = hdq_data-hdq_irqstatus;
 +   spin_unlock_irqrestore(hdq_data-hdq_spinlock, irqflags);
 
 It's unusual to put a lock around a single atomic move instruction.
 
 +   /* check irqstatus */
 +   if (!(*status  OMAP_HDQ_INT_STATUS_TXCOMPLETE)) {
 +   dev_dbg(hdq_data-dev, timeout waiting for
 +   TXCOMPLETE/RXCOMPLETE

Re: [PATCH 1/10] HDQ driver: Remove global pointer

2008-10-06 Thread Madhusudhan Chikkature

- Original Message - 
From: Tony Lindgren [EMAIL PROTECTED]
To: Evgeniy Polyakov [EMAIL PROTECTED]
Cc: Gadiyar, Anand [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
linux-omap@vger.kernel.org; Chikkature Rajashekar, Madhusudhan [EMAIL 
PROTECTED]
Sent: Monday, October 06, 2008 2:47 PM
Subject: Re: [PATCH 1/10] HDQ driver: Remove global pointer


* Evgeniy Polyakov [EMAIL PROTECTED] [080925 14:41]:
 Hi.
 
 On Thu, Sep 25, 2008 at 12:19:44PM +0530, Gadiyar, Anand ([EMAIL PROTECTED]) 
 wrote:
  From: Madhusudhan Chikkature [EMAIL PROTECTED]
  
  This patch provides the necessary modifications to the driver to
  remove the global ptr hdq_data.
  
  Signed-off-by: Madhusudhan Chikkature [EMAIL PROTECTED]
 
 Looks ok, IA ck the whole serie.
 
 Great, pushing to linux-omap tree.
 
 Evgeniy, are these already in your queue for upstream?

Tony,
These patches are against the L-o tree. We need to send the complete driver 
patches against the LKML kernel tree to Evgeniy.

Regards,
Madhu
 
 Tony
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/10] HDQ driver: Remove global pointer

2008-10-06 Thread Madhusudhan Chikkature

- Original Message - 
From: Tony Lindgren [EMAIL PROTECTED]
To: Evgeniy Polyakov [EMAIL PROTECTED]
Cc: Gadiyar, Anand [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
linux-omap@vger.kernel.org; Chikkature Rajashekar, Madhusudhan [EMAIL 
PROTECTED]
Sent: Monday, October 06, 2008 4:01 PM
Subject: Re: [PATCH 1/10] HDQ driver: Remove global pointer


* Evgeniy Polyakov [EMAIL PROTECTED] [081006 12:36]:
 Hi.
 
 On Mon, Oct 06, 2008 at 12:17:06PM +0300, Tony Lindgren ([EMAIL PROTECTED]) 
 wrote:
  Great, pushing to linux-omap tree.
  
  Evgeniy, are these already in your queue for upstream?
 
 Not really, since I do not follow omap tree and will not be able to
 handle dependency there. Please push w1 part when appropriate changes in
 the arch tree are ready.
 
 * Madhusudhan Chikkature [EMAIL PROTECTED] [081006 12:38]:

 These patches are against the L-o tree. We need to send the complete
 driver patches against the LKML kernel tree to Evgeniy.
 
 OK, Madhu, can you please do the patches against the mainline kernel
 for Evgeniy?

I will create the patches and send them to Evgeniy.

Regards,
Madhu
 
 Tony
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/9] HDQ driver fixes

2008-09-25 Thread Madhusudhan Chikkature
Hi Tony,

Somehow the mailer I am using seem to wrap the patch header and I dont have a 
immediate fix for the same.So Anand will repost the same patches again on 
behalf of me.I added one more patch to the series which fixed some minor 
comments that came in after I posted the patches.

Regards,
Madhu
- Original Message - 
From: Madhusudhan Chikkature [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; linux-omap@vger.kernel.org
Sent: Wednesday, September 24, 2008 4:49 PM
Subject: [PATCH 0/9] HDQ driver fixes


 Hi Tony,
 
 I am posting a series of nine patches for the HDQ driver. The patch series
 provides cleanup of the driver pointed out by Filipe's diff file, use ioremap
 for HDQ base, replace usage of semaphore with mutex, fixes some commenting
 style and indentation.
 
 Regards,
 Madhu
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/9] HDQ driver fixes

2008-09-24 Thread Madhusudhan Chikkature
Hi Tony,

I am posting a series of nine patches for the HDQ driver. The patch series
provides cleanup of the driver pointed out by Filipe's diff file, use ioremap
for HDQ base, replace usage of semaphore with mutex, fixes some commenting
style and indentation.

Regards,
Madhu

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/9]HDQ driver: Remove global pointer

2008-09-24 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

This patch provides the necessary modifications to the driver to remove the
global ptr hdq_data.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/w1/masters/omap_hdq.c |  137 ++
 1 files changed, 72 insertions(+), 65 deletions(-)

Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
===
--- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c   2008-08-18
14:48:26.0 +0530
+++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c2008-09-23 
12:39:19.0
+0530
@@ -62,11 +62,9 @@ struct hdq_data {
spinlock_t  hdq_spinlock;
 };

-static struct hdq_data *hdq_data;
-
-static int omap_hdq_get(void);
-static int omap_hdq_put(void);
-static int omap_hdq_break(void);
+static int omap_hdq_get(struct hdq_data *hdq_data);
+static int omap_hdq_put(struct hdq_data *hdq_data);
+static int omap_hdq_break(struct hdq_data *hdq_data);

 static int __init omap_hdq_probe(struct platform_device *pdev);
 static int omap_hdq_remove(struct platform_device *pdev);
@@ -81,12 +79,13 @@ static struct platform_driver omap_hdq_d
},
 };

-static u8 omap_w1_read_byte(void *data);
-static void omap_w1_write_byte(void *data, u8 byte);
-static u8 omap_w1_reset_bus(void *data);
-static void omap_w1_search_bus(void *data, u8 search_type,
+static u8 omap_w1_read_byte(void *_hdq);
+static void omap_w1_write_byte(void *_hdq, u8 byte);
+static u8 omap_w1_reset_bus(void *_hdq);
+static void omap_w1_search_bus(void *_hdq, u8 search_type,
w1_slave_found_callback slave_found);

+
 static struct w1_bus_master omap_w1_master = {
.read_byte  = omap_w1_read_byte,
.write_byte = omap_w1_write_byte,
@@ -97,25 +96,25 @@ static struct w1_bus_master omap_w1_mast
 /*
  * HDQ register I/O routines
  */
-static inline u8
-hdq_reg_in(u32 offset)
+static inline u8 hdq_reg_in(struct hdq_data *hdq_data, u32 offset)
 {
return omap_readb(hdq_data-hdq_base + offset);
 }

-static inline u8
-hdq_reg_out(u32 offset, u8 val)
+static inline u8 hdq_reg_out(struct hdq_data *hdq_data, u32 offset, u8 val)
 {
omap_writeb(val, hdq_data-hdq_base + offset);
+
return val;
 }

-static inline u8
-hdq_reg_merge(u32 offset, u8 val, u8 mask)
+static inline u8 hdq_reg_merge(struct hdq_data *hdq_data, u32 offset,
+   u8 val, u8 mask)
 {
u8 new_val = (omap_readb(hdq_data-hdq_base + offset)  ~mask)
| (val  mask);
omap_writeb(new_val, hdq_data-hdq_base + offset);
+
return new_val;
 }

@@ -125,15 +124,15 @@ hdq_reg_merge(u32 offset, u8 val, u8 mas
  * HDQ_FLAG_CLEAR: wait until all bits in the flag are cleared.
  * return 0 on success and -ETIMEDOUT in the case of timeout.
  */
-static int
-hdq_wait_for_flag(u32 offset, u8 flag, u8 flag_set, u8 *status)
+static int hdq_wait_for_flag(struct hdq_data *hdq_data, u32 offset,
+   u8 flag, u8 flag_set, u8 *status)
 {
int ret = 0;
unsigned long timeout = jiffies + OMAP_HDQ_TIMEOUT;

if (flag_set == OMAP_HDQ_FLAG_CLEAR) {
/* wait for the flag clear */
-   while (((*status = hdq_reg_in(offset))  flag)
+   while (((*status = hdq_reg_in(hdq_data, offset))  flag)
 time_before(jiffies, timeout)) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
@@ -142,7 +141,7 @@ hdq_wait_for_flag(u32 offset, u8 flag, u
ret = -ETIMEDOUT;
} else if (flag_set == OMAP_HDQ_FLAG_SET) {
/* wait for the flag set */
-   while (!((*status = hdq_reg_in(offset))  flag)
+   while (!((*status = hdq_reg_in(hdq_data, offset))  flag)
 time_before(jiffies, timeout)) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
@@ -159,7 +158,7 @@ hdq_wait_for_flag(u32 offset, u8 flag, u
  * write out a byte and fill *status with HDQ_INT_STATUS
  */
 static int
-hdq_write_byte(u8 val, u8 *status)
+hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
 {
int ret;
u8 tmp_status;
@@ -169,15 +168,15 @@ hdq_write_byte(u8 val, u8 *status)

spin_lock_irqsave(hdq_data-hdq_spinlock, irqflags);
/* clear interrupt flags via a dummy read */
-   hdq_reg_in(OMAP_HDQ_INT_STATUS);
+   hdq_reg_in(hdq_data, OMAP_HDQ_INT_STATUS);
/* ISR loads it with new INT_STATUS */
hdq_data-hdq_irqstatus = 0;
spin_unlock_irqrestore(hdq_data-hdq_spinlock, irqflags);

-   hdq_reg_out(OMAP_HDQ_TX_DATA, val);
+   hdq_reg_out(hdq_data, OMAP_HDQ_TX_DATA, val);

/* set the GO bit */
-   hdq_reg_merge(OMAP_HDQ_CTRL_STATUS, OMAP_HDQ_CTRL_STATUS_GO,
+   hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS

[PATCH 2/9]HDQ driver: replace pr_debug with dev_dbg

2008-09-24 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

Replace pr_debug with dev_dbg with device information added for debug prints.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/w1/masters/omap_hdq.c |   54 +++---
 1 files changed, 30 insertions(+), 24 deletions(-)

Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
===
--- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c   2008-09-23
12:39:19.0 +0530
+++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c2008-09-23 
17:04:50.0
+0530
@@ -53,6 +53,7 @@ DECLARE_WAIT_QUEUE_HEAD(hdq_wait_queue);
 int W1_ID;

 struct hdq_data {
+   struct device   *dev;
resource_size_t hdq_base;
struct  semaphore   hdq_semlock;
int hdq_usecount;
@@ -182,7 +183,7 @@ hdq_write_byte(struct hdq_data *hdq_data
ret = wait_event_interruptible_timeout(hdq_wait_queue,
hdq_data-hdq_irqstatus, OMAP_HDQ_TIMEOUT);
if (unlikely(ret  0)) {
-   pr_debug(wait interrupted);
+   dev_dbg(hdq_data-dev, wait interrupted);
return -EINTR;
}

@@ -191,8 +192,8 @@ hdq_write_byte(struct hdq_data *hdq_data
spin_unlock_irqrestore(hdq_data-hdq_spinlock, irqflags);
/* check irqstatus */
if (!(*status  OMAP_HDQ_INT_STATUS_TXCOMPLETE)) {
-   pr_debug(timeout waiting for TXCOMPLETE/RXCOMPLETE, %x,
-   *status);
+   dev_dbg(hdq_data-dev, timeout waiting for
+   TXCOMPLETE/RXCOMPLETE, %x, *status);
return -ETIMEDOUT;
}

@@ -201,8 +202,8 @@ hdq_write_byte(struct hdq_data *hdq_data
OMAP_HDQ_CTRL_STATUS_GO,
OMAP_HDQ_FLAG_CLEAR, tmp_status);
if (ret) {
-   pr_debug(timeout waiting GO bit return to zero, %x,
-   tmp_status);
+   dev_dbg(hdq_data-dev, timeout waiting GO bit
+   return to zero, %x, tmp_status);
return ret;
}

@@ -220,7 +221,7 @@ static irqreturn_t hdq_isr(int irq, void
spin_lock_irqsave(hdq_data-hdq_spinlock, irqflags);
hdq_data-hdq_irqstatus = hdq_reg_in(hdq_data, OMAP_HDQ_INT_STATUS);
spin_unlock_irqrestore(hdq_data-hdq_spinlock, irqflags);
-   pr_debug(hdq_isr: %x, hdq_data-hdq_irqstatus);
+   dev_dbg(hdq_data-dev, hdq_isr: %x, hdq_data-hdq_irqstatus);

if (hdq_data-hdq_irqstatus 
(OMAP_HDQ_INT_STATUS_TXCOMPLETE | OMAP_HDQ_INT_STATUS_RXCOMPLETE
@@ -284,7 +285,8 @@ static int _omap_hdq_reset(struct hdq_da
ret = hdq_wait_for_flag(hdq_data, OMAP_HDQ_SYSSTATUS,
OMAP_HDQ_SYSSTATUS_RESETDONE, OMAP_HDQ_FLAG_SET, tmp_status);
if (ret)
-   pr_debug(timeout waiting HDQ reset, %x, tmp_status);
+   dev_dbg(hdq_data-dev, timeout waiting HDQ reset, %x,
+   tmp_status);
else {
hdq_reg_out(hdq_data, OMAP_HDQ_CTRL_STATUS,
OMAP_HDQ_CTRL_STATUS_CLOCKENABLE |
@@ -332,7 +334,7 @@ omap_hdq_break(struct hdq_data *hdq_data
ret = wait_event_interruptible_timeout(hdq_wait_queue,
hdq_data-hdq_irqstatus, OMAP_HDQ_TIMEOUT);
if (unlikely(ret  0)) {
-   pr_debug(wait interrupted);
+   dev_dbg(hdq_data-dev, wait interrupted);
up(hdq_data-hdq_semlock);
return -EINTR;
}
@@ -342,7 +344,8 @@ omap_hdq_break(struct hdq_data *hdq_data
spin_unlock_irqrestore(hdq_data-hdq_spinlock, irqflags);
/* check irqstatus */
if (!(tmp_status  OMAP_HDQ_INT_STATUS_TIMEOUT)) {
-   pr_debug(timeout waiting for TIMEOUT, %x, tmp_status);
+   dev_dbg(hdq_data-dev, timeout waiting for TIMEOUT, %x,
+   tmp_status);
up(hdq_data-hdq_semlock);
return -ETIMEDOUT;
}
@@ -355,8 +358,8 @@ omap_hdq_break(struct hdq_data *hdq_data
OMAP_HDQ_CTRL_STATUS_GO, OMAP_HDQ_FLAG_CLEAR,
tmp_status);
if (ret)
-   pr_debug(timeout waiting INITGO bits return to zero, %x,
-   tmp_status);
+   dev_dbg(hdq_data-dev, timeout waiting INITGO bits
+   return to zero, %x, tmp_status);

up(hdq_data-hdq_semlock);
return ret;
@@ -402,7 +405,8 @@ static int hdq_read_byte(struct hdq_data
spin_unlock_irqrestore(hdq_data-hdq_spinlock, irqflags);
/* check irqstatus */
if (!(status  OMAP_HDQ_INT_STATUS_RXCOMPLETE)) {
-   pr_debug(timeout waiting for RXCOMPLETE, %x, status);
+   dev_dbg(hdq_data-dev, timeout waiting

[PATCH 3/9]HDQ driver: modify probe fn exit points

2008-09-24 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

This patch fix the exit paths in the probe function.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/w1/masters/omap_hdq.c |   85 ++
 1 files changed, 45 insertions(+), 40 deletions(-)

Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
===
--- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c   2008-09-23
17:04:50.0 +0530
+++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c2008-09-24 
09:33:39.0
+0530
@@ -573,17 +573,20 @@ static int __init omap_hdq_probe(struct
return -ENODEV;

hdq_data = kmalloc(sizeof(*hdq_data), GFP_KERNEL);
-   if (!hdq_data)
-   return -ENODEV;
+   if (!hdq_data) {
+   dev_dbg(pdev-dev, unable to allocate memory\n);
+   ret = -ENODEV;
+   goto err_kmalloc;
+   }

hdq_data-dev = pdev-dev;
platform_set_drvdata(pdev, hdq_data);

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (res == NULL) {
-   platform_set_drvdata(pdev, NULL);
-   kfree(hdq_data);
-   return -ENXIO;
+   if (!res) {
+   dev_dbg(pdev-dev, unable to get resource\n);
+   ret = ENXIO;
+   goto err_resource;
}

hdq_data-hdq_base = res-start;
@@ -596,15 +599,12 @@ static int __init omap_hdq_probe(struct
dev_dbg(pdev-dev, Can't get HDQ clock objects\n);
if (IS_ERR(hdq_data-hdq_ick)) {
ret = PTR_ERR(hdq_data-hdq_ick);
-   platform_set_drvdata(pdev, NULL);
-   kfree(hdq_data);
-   return ret;
+   goto err_clk;
}
if (IS_ERR(hdq_data-hdq_fck)) {
ret = PTR_ERR(hdq_data-hdq_fck);
-   platform_set_drvdata(pdev, NULL);
-   kfree(hdq_data);
-   return ret;
+   clk_put(hdq_data-hdq_ick);
+   goto err_clk;
}
}

@@ -613,21 +613,14 @@ static int __init omap_hdq_probe(struct

if (clk_enable(hdq_data-hdq_ick)) {
dev_dbg(pdev-dev, Can not enable ick\n);
-   clk_put(hdq_data-hdq_ick);
-   clk_put(hdq_data-hdq_fck);
-   platform_set_drvdata(pdev, NULL);
-   kfree(hdq_data);
-   return -ENODEV;
+   ret = -ENODEV;
+   goto err_ick;
}

if (clk_enable(hdq_data-hdq_fck)) {
dev_dbg(pdev-dev, Can not enable fck\n);
-   clk_disable(hdq_data-hdq_ick);
-   clk_put(hdq_data-hdq_ick);
-   clk_put(hdq_data-hdq_fck);
-   platform_set_drvdata(pdev, NULL);
-   kfree(hdq_data);
-   return -ENODEV;
+   ret = -ENODEV;
+   goto err_fck;
}

rev = hdq_reg_in(hdq_data, OMAP_HDQ_REVISION);
@@ -639,20 +632,14 @@ static int __init omap_hdq_probe(struct

irq = platform_get_irq(pdev, 0);
if (irq  0) {
-   platform_set_drvdata(pdev, NULL);
-   kfree(hdq_data);
-   return -ENXIO;
+   ret = -ENXIO;
+   goto err_irq;
}

-   if (request_irq(irq, hdq_isr, IRQF_DISABLED, OMAP HDQ,
-   hdq_data)) {
-   dev_dbg(pdev-dev, request_irq failed\n);
-   clk_disable(hdq_data-hdq_ick);
-   clk_put(hdq_data-hdq_ick);
-   clk_put(hdq_data-hdq_fck);
-   platform_set_drvdata(pdev, NULL);
-   kfree(hdq_data);
-   return -ENODEV;
+   ret = request_irq(irq, hdq_isr, IRQF_DISABLED, omap_hdq, hdq_data);
+   if (ret  0) {
+   dev_dbg(pdev-dev, could not request irq\n);
+   goto err_irq;
}

/* don't clock the HDQ until it is needed */
@@ -664,14 +651,32 @@ static int __init omap_hdq_probe(struct
ret = w1_add_master_device(omap_w1_master);
if (ret) {
dev_dbg(pdev-dev, Failure in registering w1 master\n);
-   clk_put(hdq_data-hdq_ick);
-   clk_put(hdq_data-hdq_fck);
-   platform_set_drvdata(pdev, NULL);
-   kfree(hdq_data);
-   return ret;
+   goto err_w1;
}

return 0;
+
+err_w1:
+err_irq:
+   clk_disable(hdq_data-hdq_fck);
+
+err_fck:
+   clk_disable(hdq_data-hdq_ick);
+
+err_ick:
+   clk_put(hdq_data-hdq_ick);
+   clk_put(hdq_data-hdq_fck);
+
+err_clk:
+   hdq_data-hdq_base = NULL;
+
+err_resource:
+   platform_set_drvdata(pdev, NULL);
+   kfree(hdq_data);
+
+err_kmalloc:
+   return ret;
+
 }

 static int omap_hdq_remove(struct platform_device *pdev

[PATCH 5/9]HDQ driver: Convert few declarations to static

2008-09-24 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

Convert declaration to static.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/w1/masters/omap_hdq.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
===
--- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c   2008-09-24
10:10:07.0 +0530
+++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c2008-09-24 
10:19:28.0
+0530
@@ -49,8 +49,8 @@

 #define OMAP_HDQ_MAX_USER  4

-DECLARE_WAIT_QUEUE_HEAD(hdq_wait_queue);
-int W1_ID;
+static DECLARE_WAIT_QUEUE_HEAD(hdq_wait_queue);
+static int w1_id;

 struct hdq_data {
struct device   *dev;
@@ -249,8 +249,8 @@ static void omap_w1_search_bus(void *_hd
 {
u64 module_id, rn_le, cs, id;

-   if (W1_ID)
-   module_id = W1_ID;
+   if (w1_id)
+   module_id = w1_id;
else
module_id = 0x1;

@@ -715,7 +715,7 @@ omap_hdq_exit(void)
 module_init(omap_hdq_init);
 module_exit(omap_hdq_exit);

-module_param(W1_ID, int, S_IRUSR);
+module_param(w1_id, int, S_IRUSR);

 MODULE_AUTHOR(Texas Instruments);
 MODULE_DESCRIPTION(HDQ driver Library);


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/9]HDQ driver: use ioremap for HDQ base

2008-09-24 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

This patch provides the ioremap related changes to the driver.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/w1/masters/omap_hdq.c |   21 ++---
 1 files changed, 14 insertions(+), 7 deletions(-)

Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
===
--- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c   2008-09-24
10:46:53.0 +0530
+++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c2008-09-24 
11:13:12.0
+0530
@@ -54,7 +54,7 @@ static int w1_id;

 struct hdq_data {
struct device   *dev;
-   resource_size_t hdq_base;
+   void __iomem*hdq_base;
struct  semaphore   hdq_semlock;
int hdq_usecount;
struct  clk *hdq_ick;
@@ -99,12 +99,12 @@ static struct w1_bus_master omap_w1_mast
  */
 static inline u8 hdq_reg_in(struct hdq_data *hdq_data, u32 offset)
 {
-   return omap_readb(hdq_data-hdq_base + offset);
+   return __raw_readb(hdq_data-hdq_base + offset);
 }

 static inline u8 hdq_reg_out(struct hdq_data *hdq_data, u32 offset, u8 val)
 {
-   omap_writeb(val, hdq_data-hdq_base + offset);
+   __raw_writeb(val, hdq_data-hdq_base + offset);

return val;
 }
@@ -112,9 +112,9 @@ static inline u8 hdq_reg_out(struct hdq_
 static inline u8 hdq_reg_merge(struct hdq_data *hdq_data, u32 offset,
u8 val, u8 mask)
 {
-   u8 new_val = (omap_readb(hdq_data-hdq_base + offset)  ~mask)
+   u8 new_val = (__raw_readb(hdq_data-hdq_base + offset)  ~mask)
| (val  mask);
-   omap_writeb(new_val, hdq_data-hdq_base + offset);
+   __raw_writeb(new_val, hdq_data-hdq_base + offset);

return new_val;
 }
@@ -589,7 +589,12 @@ static int __init omap_hdq_probe(struct
goto err_resource;
}

-   hdq_data-hdq_base = res-start;
+   hdq_data-hdq_base = ioremap(res-start, SZ_4K);
+   if (!hdq_data-hdq_base) {
+   dev_dbg(pdev-dev, ioremap failed\n);
+   ret = -EINVAL;
+   goto err_ioremap;
+   }

/* get interface  functional clock objects */
hdq_data-hdq_ick = clk_get(pdev-dev, hdq_ick);
@@ -668,8 +673,9 @@ err_ick:
clk_put(hdq_data-hdq_fck);

 err_clk:
-   hdq_data-hdq_base = NULL;
+   iounmap(hdq_data-hdq_base);

+err_ioremap:
 err_resource:
platform_set_drvdata(pdev, NULL);
kfree(hdq_data);
@@ -695,6 +701,7 @@ static int omap_hdq_remove(struct platfo
clk_put(hdq_data-hdq_fck);
free_irq(INT_24XX_HDQ_IRQ, hdq_data);
platform_set_drvdata(pdev, NULL);
+   iounmap(hdq_data-hdq_base);
kfree(hdq_data);

return 0;


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/9]HDQ driver:replace semaphore with mutex

2008-09-24 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

This patch replaces the usage of semaphore by mutex.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/w1/masters/omap_hdq.c |   42 ++
 1 files changed, 22 insertions(+), 20 deletions(-)

Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
===
--- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c   2008-09-24
11:13:12.0 +0530
+++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c2008-09-24 
11:49:45.0
+0530
@@ -55,7 +55,7 @@ static int w1_id;
 struct hdq_data {
struct device   *dev;
void __iomem*hdq_base;
-   struct  semaphore   hdq_semlock;
+   struct  mutex   hdq_mutex;
int hdq_usecount;
struct  clk *hdq_ick;
struct  clk *hdq_fck;
@@ -308,12 +308,12 @@ omap_hdq_break(struct hdq_data *hdq_data
u8 tmp_status;
unsigned long irqflags;

-   ret = down_interruptible(hdq_data-hdq_semlock);
+   ret = mutex_lock_interruptible(hdq_data-hdq_mutex);
if (ret  0)
return -EINTR;

if (!hdq_data-hdq_usecount) {
-   up(hdq_data-hdq_semlock);
+   mutex_unlock(hdq_data-hdq_mutex);
return -EINVAL;
}

@@ -335,7 +335,7 @@ omap_hdq_break(struct hdq_data *hdq_data
hdq_data-hdq_irqstatus, OMAP_HDQ_TIMEOUT);
if (ret  0) {
dev_dbg(hdq_data-dev, wait interrupted);
-   up(hdq_data-hdq_semlock);
+   mutex_unlock(hdq_data-hdq_mutex);
return -EINTR;
}

@@ -346,7 +346,7 @@ omap_hdq_break(struct hdq_data *hdq_data
if (!(tmp_status  OMAP_HDQ_INT_STATUS_TIMEOUT)) {
dev_dbg(hdq_data-dev, timeout waiting for TIMEOUT, %x,
tmp_status);
-   up(hdq_data-hdq_semlock);
+   mutex_unlock(hdq_data-hdq_mutex);
return -ETIMEDOUT;
}
/*
@@ -361,7 +361,7 @@ omap_hdq_break(struct hdq_data *hdq_data
dev_dbg(hdq_data-dev, timeout waiting INITGO bits
return to zero, %x, tmp_status);

-   up(hdq_data-hdq_semlock);
+   mutex_unlock(hdq_data-hdq_mutex);
return ret;
 }

@@ -371,12 +371,12 @@ static int hdq_read_byte(struct hdq_data
u8 status;
unsigned long irqflags;

-   ret = down_interruptible(hdq_data-hdq_semlock);
+   ret = mutex_lock_interruptible(hdq_data-hdq_mutex);
if (ret  0)
return -EINTR;

if (!hdq_data-hdq_usecount) {
-   up(hdq_data-hdq_semlock);
+   mutex_unlock(hdq_data-hdq_mutex);
return -EINVAL;
}

@@ -407,13 +407,13 @@ static int hdq_read_byte(struct hdq_data
if (!(status  OMAP_HDQ_INT_STATUS_RXCOMPLETE)) {
dev_dbg(hdq_data-dev, timeout waiting for
RXCOMPLETE, %x, status);
-   up(hdq_data-hdq_semlock);
+   mutex_unlock(hdq_data-hdq_mutex);
return -ETIMEDOUT;
}
}
/* the data is ready. Read it in! */
*val = hdq_reg_in(hdq_data, OMAP_HDQ_RX_DATA);
-   up(hdq_data-hdq_semlock);
+   mutex_unlock(hdq_data-hdq_mutex);

return 0;

@@ -427,13 +427,13 @@ omap_hdq_get(struct hdq_data *hdq_data)
 {
int ret = 0;

-   ret = down_interruptible(hdq_data-hdq_semlock);
+   ret = mutex_lock_interruptible(hdq_data-hdq_mutex);
if (ret  0)
return -EINTR;

if (OMAP_HDQ_MAX_USER == hdq_data-hdq_usecount) {
dev_dbg(hdq_data-dev, attempt to exceed the max use count);
-   up(hdq_data-hdq_semlock);
+   mutex_unlock(hdq_data-hdq_mutex);
ret = -EINVAL;
} else {
hdq_data-hdq_usecount++;
@@ -443,14 +443,14 @@ omap_hdq_get(struct hdq_data *hdq_data)
dev_dbg(hdq_data-dev, Can not enable ick\n);
clk_put(hdq_data-hdq_ick);
clk_put(hdq_data-hdq_fck);
-   up(hdq_data-hdq_semlock);
+   mutex_unlock(hdq_data-hdq_mutex);
return -ENODEV;
}
if (clk_enable(hdq_data-hdq_fck)) {
dev_dbg(hdq_data-dev, Can not enable fck\n);
clk_put(hdq_data-hdq_ick);
clk_put(hdq_data-hdq_fck);
-   up(hdq_data-hdq_semlock);
+   mutex_unlock(hdq_data-hdq_mutex);
return -ENODEV;
}

@@ -472,7 +472,7

[PATCH 8/9]HDQ driver:protect the shared flag

2008-09-24 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

This patch moves the shared variable into the local structure and protects its
updation.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/w1/masters/omap_hdq.c |   52 ++
 1 files changed, 38 insertions(+), 14 deletions(-)

Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
===
--- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c   2008-09-24
11:49:45.0 +0530
+++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c2008-09-24 
14:41:43.0
+0530
@@ -61,6 +61,12 @@ struct hdq_data {
struct  clk *hdq_fck;
u8  hdq_irqstatus;
spinlock_t  hdq_spinlock;
+   /*
+* Used to control the call to omap_hdq_get and omap_hdq_put.
+* HDQ Protocol: Write the CMD|REG_address first, followed by
+* the data wrire or read.
+*/
+   int init_trans;
 };

 static int omap_hdq_get(struct hdq_data *hdq_data);
@@ -505,13 +511,6 @@ omap_hdq_put(struct hdq_data *hdq_data)
 }

 /*
- * Used to control the call to omap_hdq_get and omap_hdq_put.
- * HDQ Protocol: Write the CMD|REG_address first, followed by
- * the data wrire or read.
- */
-static int init_trans;
-
-/*
  * Read a byte of data from the device.
  */
 static u8 omap_w1_read_byte(void *_hdq)
@@ -522,14 +521,26 @@ static u8 omap_w1_read_byte(void *_hdq)

ret = hdq_read_byte(hdq_data, val);
if (ret) {
-   init_trans = 0;
+   ret = mutex_lock_interruptible(hdq_data-hdq_mutex);
+   if (ret  0) {
+   dev_dbg(hdq_data-dev, Could not acquire mutex\n);
+   return -EINTR;
+   }
+   hdq_data-init_trans = 0;
+   mutex_unlock(hdq_data-hdq_mutex);
omap_hdq_put(hdq_data);
return -1;
}

/* Write followed by a read, release the module */
-   if (init_trans) {
-   init_trans = 0;
+   if (hdq_data-init_trans) {
+   ret = mutex_lock_interruptible(hdq_data-hdq_mutex);
+   if (ret  0) {
+   dev_dbg(hdq_data-dev, Could not acquire mutex\n);
+   return -EINTR;
+   }
+   hdq_data-init_trans = 0;
+   mutex_unlock(hdq_data-hdq_mutex);
omap_hdq_put(hdq_data);
}

@@ -542,21 +553,34 @@ static u8 omap_w1_read_byte(void *_hdq)
 static void omap_w1_write_byte(void *_hdq, u8 byte)
 {
struct hdq_data *hdq_data = _hdq;
+   int ret;
u8 status;

/* First write to initialize the transfer */
-   if (init_trans == 0)
+   if (hdq_data-init_trans == 0)
omap_hdq_get(hdq_data);

-   init_trans++;
+   ret = mutex_lock_interruptible(hdq_data-hdq_mutex);
+   if (ret  0) {
+   dev_dbg(hdq_data-dev, Could not acquire mutex\n);
+   return;
+   }
+   hdq_data-init_trans++;
+   mutex_unlock(hdq_data-hdq_mutex);

hdq_write_byte(hdq_data, byte, status);
dev_dbg(hdq_data-dev, Ctrl status %x\n, status);

/* Second write, data transfered. Release the module */
-   if (init_trans  1) {
+   if (hdq_data-init_trans  1) {
omap_hdq_put(hdq_data);
-   init_trans = 0;
+   ret = mutex_lock_interruptible(hdq_data-hdq_mutex);
+   if (ret  0) {
+   dev_dbg(hdq_data-dev, Could not acquire mutex\n);
+   return;
+   }
+   hdq_data-init_trans = 0;
+   mutex_unlock(hdq_data-hdq_mutex);
}

return;


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 9/9]HDQ driver: Fix indentation and commenting style

2008-09-24 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

This patch fixes the indentation, commenting style of a single line comment.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/w1/masters/omap_hdq.c |   81 +++---
 1 files changed, 29 insertions(+), 52 deletions(-)

Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
===
--- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c   2008-09-24
14:41:43.0 +0530
+++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c2008-09-24 
15:37:18.0
+0530
@@ -77,12 +77,12 @@ static int __init omap_hdq_probe(struct
 static int omap_hdq_remove(struct platform_device *pdev);

 static struct platform_driver omap_hdq_driver = {
-   .probe = omap_hdq_probe,
-   .remove = omap_hdq_remove,
-   .suspend = NULL,
-   .resume = NULL,
-   .driver = {
-   .name = omap_hdq,
+   .probe =omap_hdq_probe,
+   .remove =   omap_hdq_remove,
+   .suspend =  NULL,
+   .resume =   NULL,
+   .driver =   {
+   .name = omap_hdq,
},
 };

@@ -100,9 +100,7 @@ static struct w1_bus_master omap_w1_mast
.search = omap_w1_search_bus,
 };

-/*
- * HDQ register I/O routines
- */
+/* HDQ register I/O routines */
 static inline u8 hdq_reg_in(struct hdq_data *hdq_data, u32 offset)
 {
return __raw_readb(hdq_data-hdq_base + offset);
@@ -161,11 +159,8 @@ static int hdq_wait_for_flag(struct hdq_
return ret;
 }

-/*
- * write out a byte and fill *status with HDQ_INT_STATUS
- */
-static int
-hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
+/* write out a byte and fill *status with HDQ_INT_STATUS */
+static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
 {
int ret;
u8 tmp_status;
@@ -216,9 +211,7 @@ hdq_write_byte(struct hdq_data *hdq_data
return ret;
 }

-/*
- * HDQ Interrupt service routine.
- */
+/* HDQ Interrupt service routine */
 static irqreturn_t hdq_isr(int irq, void *_hdq)
 {
struct hdq_data *hdq_data = _hdq;
@@ -239,17 +232,13 @@ static irqreturn_t hdq_isr(int irq, void
return IRQ_HANDLED;
 }

-/*
- * HDQ Mode: always return success.
- */
+/* HDQ Mode: always return success */
 static u8 omap_w1_reset_bus(void *_hdq)
 {
return 0;
 }

-/*
- * W1 search callback function.
- */
+/* W1 search callback function */
 static void omap_w1_search_bus(void *_hdq, u8 search_type,
w1_slave_found_callback slave_found)
 {
@@ -304,11 +293,8 @@ static int _omap_hdq_reset(struct hdq_da
return ret;
 }

-/*
- * Issue break pulse to the device.
- */
-static int
-omap_hdq_break(struct hdq_data *hdq_data)
+/* Issue break pulse to the device */
+static int omap_hdq_break(struct hdq_data *hdq_data)
 {
int ret;
u8 tmp_status;
@@ -368,6 +354,7 @@ omap_hdq_break(struct hdq_data *hdq_data
return to zero, %x, tmp_status);

mutex_unlock(hdq_data-hdq_mutex);
+
return ret;
 }

@@ -376,6 +363,7 @@ static int hdq_read_byte(struct hdq_data
int ret;
u8 status;
unsigned long irqflags;
+   unsigned long timeout = jiffies + OMAP_HDQ_TIMEOUT;

ret = mutex_lock_interruptible(hdq_data-hdq_mutex);
if (ret  0)
@@ -395,14 +383,11 @@ static int hdq_read_byte(struct hdq_data
 * triggers another interrupt before we
 * sleep. So we have to wait for RXCOMPLETE bit.
 */
-   {
-   unsigned long timeout = jiffies + OMAP_HDQ_TIMEOUT;
-   while (!(hdq_data-hdq_irqstatus
-OMAP_HDQ_INT_STATUS_RXCOMPLETE)
-time_before(jiffies, timeout)) {
-   set_current_state(TASK_UNINTERRUPTIBLE);
-   schedule_timeout(1);
-   }
+   while (!(hdq_data-hdq_irqstatus
+OMAP_HDQ_INT_STATUS_RXCOMPLETE)
+time_before(jiffies, timeout)) {
+   set_current_state(TASK_UNINTERRUPTIBLE);
+   schedule_timeout(1);
}
hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 0,
OMAP_HDQ_CTRL_STATUS_DIR);
@@ -425,11 +410,8 @@ static int hdq_read_byte(struct hdq_data

 }

-/*
- * Enable clocks and set the controller to HDQ mode.
- */
-static int
-omap_hdq_get(struct hdq_data *hdq_data)
+/* Enable clocks and set the controller to HDQ mode */
+static int omap_hdq_get(struct hdq_data *hdq_data)
 {
int ret = 0;

@@ -479,14 +461,12 @@ omap_hdq_get(struct hdq_data *hdq_data)
}
}
mutex_unlock(hdq_data-hdq_mutex);
+
return ret;
 }

-/*
- * Disable clocks to the module.
- */
-static int
-omap_hdq_put(struct hdq_data *hdq_data)
+/* Disable

Re: [PATCH 7/9]HDQ driver:replace semaphore with mutex

2008-09-24 Thread Madhusudhan Chikkature

- Original Message - 
From: Felipe Balbi [EMAIL PROTECTED]
To: ext Madhusudhan Chikkature [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
linux-omap@vger.kernel.org
Sent: Wednesday, September 24, 2008 5:20 PM
Subject: Re: [PATCH 7/9]HDQ driver:replace semaphore with mutex


 On Wed, Sep 24, 2008 at 05:01:27PM +0530, ext Madhusudhan Chikkature wrote:
 From: Madhusudhan Chikkature[EMAIL PROTECTED]
 
 This patch replaces the usage of semaphore by mutex.
 
 Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
 ---
  drivers/w1/masters/omap_hdq.c |   42 
 ++
  1 files changed, 22 insertions(+), 20 deletions(-)
 
 Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
 ===
 --- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c 2008-09-24
 11:13:12.0 +0530
 +++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c 2008-09-24 
 11:49:45.0
 +0530
 @@ -55,7 +55,7 @@ static int w1_id;
  struct hdq_data {
  struct device *dev;
  void __iomem *hdq_base;
 - struct semaphore hdq_semlock;
 + struct  mutex hdq_mutex;
  int hdq_usecount;
  struct clk *hdq_ick;
  struct clk *hdq_fck;
 
 Please, fix these two:
 
 CHECK: struct  mutex definition without comment
 #58: FILE: w1/masters/omap_hdq.c:58:
 + struct  mutex hdq_mutex;
 
 CHECK: spinlock_t definition without comment
 #63: FILE: w1/masters/omap_hdq.c:63:
 + spinlock_t hdq_spinlock;
 
 total: 0 errors, 0 warnings, 2 checks, 732 lines checked

I dont see any such checks reported by checkpatch.pl?

Regards,
Madhu
 
 -- 
 balbi
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 7/9]HDQ driver:replace semaphore with mutex

2008-09-24 Thread Madhusudhan Chikkature

- Original Message - 
From: Gadiyar, Anand [EMAIL PROTECTED]
To: Chikkature Rajashekar, Madhusudhan [EMAIL PROTECTED]; [EMAIL 
PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
linux-omap@vger.kernel.org
Sent: Wednesday, September 24, 2008 6:35 PM
Subject: RE: [PATCH 7/9]HDQ driver:replace semaphore with mutex


 -Original Message-
 From: [EMAIL PROTECTED] On Behalf Of Chikkature Rajashekar, Madhusudhan
 - Original Message - From: Felipe Balbi [EMAIL PROTECTED]
 
  On Wed, Sep 24, 2008 at 05:01:27PM +0530, ext Madhusudhan Chikkature wrote:
  From: Madhusudhan Chikkature[EMAIL PROTECTED]
  
  This patch replaces the usage of semaphore by mutex.
  
  Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
  ---
   drivers/w1/masters/omap_hdq.c |   42 
  ++
   1 files changed, 22 insertions(+), 20 deletions(-)
  
  Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
  ===
  --- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c 2008-09-24 
  11:13:12.0 +0530
  +++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c 2008-09-24 
  11:49:45.0 +0530
  @@ -55,7 +55,7 @@ static int w1_id;
   struct hdq_data {
   struct device *dev;
   void __iomem *hdq_base;
  - struct semaphore hdq_semlock;
  + struct  mutex hdq_mutex;
   int hdq_usecount;
   struct clk *hdq_ick;
   struct clk *hdq_fck;
  
  Please, fix these two:
  
  CHECK: struct  mutex definition without comment
  #58: FILE: w1/masters/omap_hdq.c:58:
  + struct  mutex hdq_mutex;
  
  CHECK: spinlock_t definition without comment
  #63: FILE: w1/masters/omap_hdq.c:63:
  + spinlock_t hdq_spinlock;
  
  total: 0 errors, 0 warnings, 2 checks, 732 lines checked
 
 I dont see any such checks reported by checkpatch.pl?
 

Oh, I guess Felipe uses `checkpatch.pl --strict`, right Felipe?

Hi,
Yes. That seems to be the case. I will add a couple of simple comments. I will 
send a final patch (patch #10)which will fix these minor things which Filipe 
reported.I do not want to rebase any of my patches again :)

Regards,
Madhu

- Anand

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH]OMAP HDQ driver ioremap changes

2008-09-22 Thread Madhusudhan Chikkature
Hi Tony,

This patch provides the HDQ driver modifications to use ioremap for the base
address.

Regards,
Madhu
--
From: Madhusudhan Chikkature[EMAIL PROTECTED]

Modifications to the driver to use ioremap for the base address.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/w1/masters/omap_hdq.c |   20 ++--
 1 files changed, 14 insertions(+), 6 deletions(-)

Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
===
--- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c   2008-08-18
14:48:26.0 +0530
+++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c2008-09-22 
14:56:28.0
+0530
@@ -53,7 +53,7 @@ DECLARE_WAIT_QUEUE_HEAD(hdq_wait_queue);
 int W1_ID;

 struct hdq_data {
-   resource_size_t hdq_base;
+   void __iomem*hdq_base;
struct  semaphore   hdq_semlock;
int hdq_usecount;
struct  clk *hdq_ick;
@@ -100,22 +100,22 @@ static struct w1_bus_master omap_w1_mast
 static inline u8
 hdq_reg_in(u32 offset)
 {
-   return omap_readb(hdq_data-hdq_base + offset);
+   return __raw_readb(hdq_data-hdq_base + offset);
 }

 static inline u8
 hdq_reg_out(u32 offset, u8 val)
 {
-   omap_writeb(val, hdq_data-hdq_base + offset);
+   __raw_writeb(val, hdq_data-hdq_base + offset);
return val;
 }

 static inline u8
 hdq_reg_merge(u32 offset, u8 val, u8 mask)
 {
-   u8 new_val = (omap_readb(hdq_data-hdq_base + offset)  ~mask)
+   u8 new_val = (__raw_readb(hdq_data-hdq_base + offset)  ~mask)
| (val  mask);
-   omap_writeb(new_val, hdq_data-hdq_base + offset);
+   __raw_writeb(new_val, hdq_data-hdq_base + offset);
return new_val;
 }

@@ -577,7 +577,7 @@ static int __init omap_hdq_probe(struct
return -ENXIO;
}

-   hdq_data-hdq_base = res-start;
+   hdq_data-hdq_base = ioremap(res-start, SZ_4K);

/* get interface  functional clock objects */
hdq_data-hdq_ick = clk_get(pdev-dev, hdq_ick);
@@ -588,12 +588,14 @@ static int __init omap_hdq_probe(struct
if (IS_ERR(hdq_data-hdq_ick)) {
ret = PTR_ERR(hdq_data-hdq_ick);
platform_set_drvdata(pdev, NULL);
+   iounmap(hdq_data-hdq_base);
kfree(hdq_data);
return ret;
}
if (IS_ERR(hdq_data-hdq_fck)) {
ret = PTR_ERR(hdq_data-hdq_fck);
platform_set_drvdata(pdev, NULL);
+   iounmap(hdq_data-hdq_base);
kfree(hdq_data);
return ret;
}
@@ -607,6 +609,7 @@ static int __init omap_hdq_probe(struct
clk_put(hdq_data-hdq_ick);
clk_put(hdq_data-hdq_fck);
platform_set_drvdata(pdev, NULL);
+   iounmap(hdq_data-hdq_base);
kfree(hdq_data);
return -ENODEV;
}
@@ -617,6 +620,7 @@ static int __init omap_hdq_probe(struct
clk_put(hdq_data-hdq_ick);
clk_put(hdq_data-hdq_fck);
platform_set_drvdata(pdev, NULL);
+   iounmap(hdq_data-hdq_base);
kfree(hdq_data);
return -ENODEV;
}
@@ -631,6 +635,7 @@ static int __init omap_hdq_probe(struct
irq = platform_get_irq(pdev, 0);
if (irq  0) {
platform_set_drvdata(pdev, NULL);
+   iounmap(hdq_data-hdq_base);
kfree(hdq_data);
return -ENXIO;
}
@@ -642,6 +647,7 @@ static int __init omap_hdq_probe(struct
clk_put(hdq_data-hdq_ick);
clk_put(hdq_data-hdq_fck);
platform_set_drvdata(pdev, NULL);
+   iounmap(hdq_data-hdq_base);
kfree(hdq_data);
return -ENODEV;
}
@@ -656,6 +662,7 @@ static int __init omap_hdq_probe(struct
clk_put(hdq_data-hdq_ick);
clk_put(hdq_data-hdq_fck);
platform_set_drvdata(pdev, NULL);
+   iounmap(hdq_data-hdq_base);
kfree(hdq_data);
return ret;
}
@@ -677,6 +684,7 @@ static int omap_hdq_remove(struct platfo
clk_put(hdq_data-hdq_fck);
free_irq(INT_24XX_HDQ_IRQ, hdq_data-hdq_semlock);
platform_set_drvdata(pdev, NULL);
+   iounmap(hdq_data-hdq_base);
kfree(hdq_data);

return 0;


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH]OMAP HDQ driver ioremap changes

2008-09-22 Thread Madhusudhan Chikkature
Hi Evgeniy Polyakov,

Thanks for the comments. I will incorporate them and send the patch again. My 
comments inlined.

Regards,
Madhu


- Original Message - 
From: Evgeniy Polyakov [EMAIL PROTECTED]
To: Madhusudhan Chikkature [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; linux-omap@vger.kernel.org
Sent: Monday, September 22, 2008 6:36 PM
Subject: Re: [PATCH]OMAP HDQ driver ioremap changes


 Hi.
 
 On Mon, Sep 22, 2008 at 03:45:57PM +0530, Madhusudhan Chikkature ([EMAIL 
 PROTECTED]) wrote:
 This patch provides the HDQ driver modifications to use ioremap for the base
 address.
 
 Looks good.
 Couple of small comments inline.
 
 --- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c 2008-08-18
 14:48:26.0 +0530
 +++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c 2008-09-22 
 14:56:28.0
 +0530
 @@ -53,7 +53,7 @@ DECLARE_WAIT_QUEUE_HEAD(hdq_wait_queue);
  int W1_ID;
 
  struct hdq_data {
 - resource_size_t hdq_base;
 + void __iomem *hdq_base;
  struct semaphore hdq_semlock;
 
 Shouldn't it use mutex or it does counting?

Yes. RMK had given the same comment. I am working on it now. I will submit that 
as a second patch to use mutex
instead of semaphores.

 
 @@ -577,7 +577,7 @@ static int __init omap_hdq_probe(struct
  return -ENXIO;
  }
 
 - hdq_data-hdq_base = res-start;
 + hdq_data-hdq_base = ioremap(res-start, SZ_4K);
 
 Suppose it does not fail on this arch?

I will add a check for that.

 
  /* get interface  functional clock objects */
  hdq_data-hdq_ick = clk_get(pdev-dev, hdq_ick);
 @@ -588,12 +588,14 @@ static int __init omap_hdq_probe(struct
  if (IS_ERR(hdq_data-hdq_ick)) {
  ret = PTR_ERR(hdq_data-hdq_ick);
  platform_set_drvdata(pdev, NULL);
 + iounmap(hdq_data-hdq_base);
  kfree(hdq_data);
  return ret;
  }
  if (IS_ERR(hdq_data-hdq_fck)) {
  ret = PTR_ERR(hdq_data-hdq_fck);
  platform_set_drvdata(pdev, NULL);
 + iounmap(hdq_data-hdq_base);
  kfree(hdq_data);
  return ret;
  }
 
 Don't you want to use goto and single exit path here and in other places?

Yes. I will make those changes as well.

 
 -- 
 Evgeniy Polyakov
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH]OMAP HDQ driver ioremap changes

2008-09-22 Thread Madhusudhan Chikkature

- Original Message - 
From: Felipe Balbi [EMAIL PROTECTED]
To: ext Madhusudhan Chikkature [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; Evgeniy Polyakov [EMAIL PROTECTED]; [EMAIL 
PROTECTED]; linux-omap@vger.kernel.org
Sent: Monday, September 22, 2008 8:07 PM
Subject: Re: [PATCH]OMAP HDQ driver ioremap changes


 On Mon, Sep 22, 2008 at 07:01:57PM +0530, ext Madhusudhan Chikkature wrote:
 
 - Original Message - 
 From: Felipe Balbi [EMAIL PROTECTED]
 To: ext Madhusudhan Chikkature [EMAIL PROTECTED]
 Cc: Evgeniy Polyakov [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
 linux-omap@vger.kernel.org
 Sent: Monday, September 22, 2008 6:57 PM
 Subject: Re: [PATCH]OMAP HDQ driver ioremap changes
 
 
  On Mon, Sep 22, 2008 at 06:43:10PM +0530, ext Madhusudhan Chikkature wrote:
  Hi Evgeniy Polyakov,
  
  Thanks for the comments. I will incorporate them and send the patch 
  again. My comments inlined.
  
  How about fixing it and later sending to mainline for integration ?
 
 Yes. I will do that.
 
 Really, that driver is a mess. Get the attached patch, break it into
 proper smaller patches, see if it's really working since I just compile
 tested, change the semaphore to mutex (in a separate patch), fix
 comments to kernel-doc style, then you send a nice series fixing the
 driver before sending the final driver to mainline.
 
 It's time to start doing things properly. It's really annoying have to
 keep cleaning stuff after it's in-tree.

Balbi,
Please note that the driver patches were submitted to L-o as RFC initially and 
all the comments provided by the community are fixed before it is pushed by 
Tony. 

There would be a time gap between the day the patches are submitted and before 
Tony pushes the patches to the tree. Any valid comments provided then would get 
promptly fixed. This would definetely avoid cleaning stuff which is already in 
tree to whatever extent it is possible.

Regards,
Madhu
 
 -- 
 balbi

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH]OMAP HDQ driver ioremap changes

2008-09-22 Thread Madhusudhan Chikkature

- Original Message - 
From: Felipe Balbi [EMAIL PROTECTED]
To: Evgeniy Polyakov [EMAIL PROTECTED]
Cc: Felipe Balbi [EMAIL PROTECTED]; ext Madhusudhan Chikkature [EMAIL 
PROTECTED]; [EMAIL PROTECTED]; linux-omap@vger.kernel.org
Sent: Tuesday, September 23, 2008 7:54 AM
Subject: Re: [PATCH]OMAP HDQ driver ioremap changes


 On Tue, Sep 23, 2008 at 12:14:00AM +0400, Evgeniy Polyakov wrote:
 On Mon, Sep 22, 2008 at 05:37:41PM +0300, Felipe Balbi ([EMAIL PROTECTED]) 
 wrote:
  +/*
  + * Used to control the call to omap_hdq_get and omap_hdq_put.
  + * HDQ Protocol: Write the CMD|REG_address first, followed by
  + * the data wrire or read.
  + */
  +static int init_trans;
 
 This variable is not protected against simultaneous master's access
 afaics, isn't it possible to have multiple w1 masters on given board?
 
 Don't know much about 1-wire. Someone else should answer that. But I
 suppose we should protect it, yeah.

We can not test that scenario on our board. But I guess we should protect it as 
1-Wire protocol supports multiple access.

Regards,
Madhu
 
 -- 
 balbi
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH]TWL4030 battery driver madc str fix

2008-09-18 Thread Madhusudhan Chikkature
Hi Tony,

I am resending the patch after fixing the comment provided by Jagadeesh.

Regards,
Madhu
-
From: Madhusudhan Chikkature[EMAIL PROTECTED]

This patch set up the unused madc request structure members to NULL.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/power/twl4030_bci_battery.c |2 ++
 1 files changed, 2 insertions(+)

Index: linux-omap-2.6/drivers/power/twl4030_bci_battery.c
===
--- linux-omap-2.6.orig/drivers/power/twl4030_bci_battery.c 2008-09-10
10:16:20.0 +0530
+++ linux-omap-2.6/drivers/power/twl4030_bci_battery.c  2008-09-18
17:12:22.0 +0530
@@ -604,7 +604,9 @@
struct twl4030_madc_request req;

req.channels = (1  9);
+   req.do_avg = 0;
req.method = TWL4030_MADC_SW1;
+   req.active = 0;
req.func_cb = NULL;
twl4030_madc_conversion(req);
temp = (u16)req.rbuf[9];


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH PM-0 v2] ARM: OMAP3: HSMMC: Ensure HSMMC is fully reset on boot

2008-09-18 Thread Madhusudhan Chikkature

- Original Message - 
From: Kevin Hilman [EMAIL PROTECTED]
To: linux-omap@vger.kernel.org
Cc: Kevin Hilman [EMAIL PROTECTED]
Sent: Thursday, September 18, 2008 9:24 PM
Subject: [PATCH PM-0 v2] ARM: OMAP3: HSMMC: Ensure HSMMC is fully reset on boot


 This ensures that each HSMMC block is reset so it will not interfere
 with retention or OFF-mode.
 
 Signed-off-by: Kevin Hilman [EMAIL PROTECTED]
 ---
 arch/arm/mach-omap2/hsmmc.c |   73 ++-
 1 files changed, 72 insertions(+), 1 deletions(-)
 
 diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
 index 7334d86..00fe354 100644
 --- a/arch/arm/mach-omap2/hsmmc.c
 +++ b/arch/arm/mach-omap2/hsmmc.c
 @@ -15,7 +15,9 @@
 #include linux/platform_device.h
 #include linux/interrupt.h
 #include linux/delay.h
 +#include linux/clk.h
 #include linux/i2c/twl4030.h
 +
 #include mach/hardware.h
 #include mach/mmc.h
 #include mach/board.h
 @@ -46,6 +48,74 @@
 #define OMAP2_CONTROL_PBIAS_PWRDNZ (1  1)
 #define OMAP2_CONTROL_PBIAS_SCTRL (1  2)
 
 +#define MMCHS1 (L4_34XX_BASE + 0x9C000)
 +#define MMCHS2 (L4_34XX_BASE + 0xB4000)
 +#define MMCHS3 (L4_34XX_BASE + 0xAD000)
 +#define MAX_MMC 3
 +#define MMCHS_SYSCONFIG 0x0010
 +#define MMCHS_SYSCONFIG_SWRESET (1  1)
 +#define MMCHS_SYSSTATUS 0x0014
 +#define MMCHS_SYSSTATUS_RESETDONE (1  0)
 +
 +static struct platform_device dummy_pdev = {
 + .dev = {
 + .bus = platform_bus_type,
 + },
 +};
 +
 +/**
 + * hsmmc_reset() - Full reset of each HS-MMC controller
 + *
 + * Ensure that each MMC controller is fully reset.  Controllers
 + * left in an unknown state (by bootloaer) may prevent retention
 + * or OFF-mode.
 + *
 + * In order for reset to work, interface, functional and debounce
 + * clocks must be enabled.  The debounce clock comes from func_32k_clk
 + * and is not under SW controle, so we only enable i- and f-clocks.
 + **/
 +static void __init hsmmc_reset(void)
 +{
 + u32 i, base[MAX_MMC] = {MMCHS1, MMCHS2, MMCHS3};
 +
 + for (i = 0; i  MAX_MMC; i++) {
 + u32 v;
 + struct clk *iclk, *fclk;
 + struct device *dev = dummy_pdev.dev;
 +
 + dummy_pdev.id = i + 1;
 + iclk = clk_get(dev, mmchs_ick);
 + if (iclk  clk_enable(iclk))
 + iclk = NULL;
 + 
 + fclk = clk_get(dev, mmchs_fck);
 + if (fclk  clk_enable(fclk))
 + fclk = NULL;
 +
 + if (!iclk || !fclk) {
 + printk(KERN_WARNING 
 +%s: Unable to enable clocks for MMC%d, 
 +cannot reset.\n,  __func__, i);
 + break;
 + }
 +
 + omap_writel(MMCHS_SYSCONFIG_SWRESET, base[i] + MMCHS_SYSCONFIG);
 + v = omap_readl(base[i] + MMCHS_SYSSTATUS);
 + while (!(omap_readl(base[i] + MMCHS_SYSSTATUS) 
 + MMCHS_SYSSTATUS_RESETDONE))
 + cpu_relax();
 +
 + if (fclk) {
 + clk_disable(fclk);
 + clk_put(fclk);
 + }
 + if (iclk) {
 + clk_disable(iclk);
 + clk_put(iclk);
 + }
 + }
 +}
 +
 static int hsmmc_card_detect(int irq)
 {
  return twl4030_get_gpio_datain(irq - TWL4030_GPIO_IRQ_BASE);
 @@ -282,6 +352,7 @@ static struct omap_mmc_platform_data hsmmc_data = {
 
 void __init hsmmc_init(void)
 {
 + hsmmc_reset();
This might not be the right place to reset the controllers. You can avoid all 
the clk stuff if you do the reset in the driver probe function after the clocks 
are enabled.

BTW,
What is the issue you are facing if you dont reset the controllers? I have seen 
that on L-o that suspend/resume works with this driver enabled.

Regards,
Madhu

  omap2_init_mmc(hsmmc_data);
 }
 
 @@ -289,7 +360,7 @@ void __init hsmmc_init(void)
 
 void __init hsmmc_init(void)
 {
 -
 + hsmmc_reset();
 }
 
 #endif
 -- 
 1.6.0
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH]Enable 4-bit in HSMMC1 and HSMMC2 platform data

2008-09-12 Thread Madhusudhan Chikkature
Hi Jarko,

My comments inlined.

Regards,
Madhu
- Original Message - 
From: Jarkko Lavinen [EMAIL PROTECTED]
To: Russell King - ARM Linux [EMAIL PROTECTED]
Cc: Tony Lindgren [EMAIL PROTECTED]; Madhusudhan Chikkature [EMAIL 
PROTECTED]; linux-omap@vger.kernel.org
Sent: Thursday, September 11, 2008 4:53 PM
Subject: Re: [PATCH]Enable 4-bit in HSMMC1 and HSMMC2 platform data


 On Thu, Sep 11, 2008 at 09:48:28AM +0100, ext Russell King - ARM Linux wrote:
 So, given my update for this, shouldn't this be something sent almost
 immediately to me so stuff for mainline isn't falling behind.
 
 Hi Russell and all
 
 Here is a hopefully self-explaining patch, which enables 8-bit
 support similar to the 4-bit support in Omap HSMMC when then mmc
 confifuration from platform data tells it is available.
 
 I have tested it on a testboard with 2.6.26 beased kernel and
 write speed increased some 30..40%.
 
 Cheers,
 Jarkko
 
 ---
 
 From f739457703988da18a5509bd297c4f6ebed83291 Mon Sep 17 00:00:00 2001
 From: Jarkko Lavinen [EMAIL PROTECTED]
 Date: Thu, 11 Sep 2008 14:15:31 +0300
 Subject: [PATCH] HSMMC: Enable 8-bit transfer when available.
 
 Signed-off-by: Jarkko Lavinen [EMAIL PROTECTED]
 ---
 arch/arm/plat-omap/devices.c|8 ++--
 arch/arm/plat-omap/include/mach/board.h |4 +++-
 drivers/mmc/core/mmc.c  |   17 +
 drivers/mmc/host/omap_hsmmc.c   |   10 ++
 include/linux/mmc/host.h|   12 +++-
 5 files changed, 39 insertions(+), 12 deletions(-)
 
 diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
 index 3bd1da2..aa1299f 100644
 --- a/arch/arm/plat-omap/devices.c
 +++ b/arch/arm/plat-omap/devices.c
 @@ -289,13 +289,17 @@ static void __init omap_init_mmc(void)
  mmc = mmc_conf-mmc[0];
 
  if (cpu_is_omap2430() || cpu_is_omap34xx()) {
 - if (mmc-enabled)
 + if (mmc-enabled) {
 + mmc1_data.conf = *mmc;
  (void) platform_device_register(mmc_omap_device1);
 + }
 
 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX)
  mmc = mmc_conf-mmc[1];
 - if (mmc-enabled)
 + if (mmc-enabled) {
 + mmc2_data.conf = *mmc;
  (void) platform_device_register(mmc_omap_device2);
 + }
 #endif
 
The above changes are already pushed by Tony.

  return;
 diff --git a/arch/arm/plat-omap/include/mach/board.h 
 b/arch/arm/plat-omap/include/mach/board.h
 index a1a66ac..cd287dd 100644
 --- a/arch/arm/plat-omap/include/mach/board.h
 +++ b/arch/arm/plat-omap/include/mach/board.h
 @@ -46,8 +46,10 @@ struct omap_mmc_conf {
  unsigned nomux:1;
  /* switch pin can be for card detect (default) or card cover */
  unsigned cover:1;
 - /* 4 wire signaling is optional, and is only used for SD/SDIO */
 + /* 4 and 8 wire signaling are optional */
  unsigned wire4:1;
 + unsigned wire8:1;
 +
  /* use the internal clock */
  unsigned internal_clock:1;
  s16 power_pin;
 diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
 index fdd7c76..8c55df3 100644
 --- a/drivers/mmc/core/mmc.c
 +++ b/drivers/mmc/core/mmc.c
 @@ -434,13 +434,23 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
  * Activate wide bus (if supported).
  */
  if ((card-csd.mmca_vsn = CSD_SPEC_VER_4) 
 - (host-caps  MMC_CAP_4_BIT_DATA)) {
 + (host-caps  (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {
 + unsigned ext_csd_bit, driver_width;
 +
 + if (host-caps  MMC_CAP_8_BIT_DATA) {
 + ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
 + driver_width = MMC_BUS_WIDTH_8;
 + } else {
 + ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
 + driver_width = MMC_BUS_WIDTH_4;
 + }
 +
  err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
 - EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_4);
 + EXT_CSD_BUS_WIDTH, ext_csd_bit);
  if (err)
  goto free_card;
 
 - mmc_set_bus_width(card-host, MMC_BUS_WIDTH_4);
 + mmc_set_bus_width(card-host, driver_width);
  }
 
  if (!oldcard)
 @@ -624,4 +634,3 @@ err:
 
  return err;
 }
 -
 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index af34871..92ad67e 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -72,6 +72,7 @@
 #define MSBS 15
 #define BCE 11
 #define FOUR_BIT 1  1
 +#define DW8 (1  5)
 #define CC 0x1
 #define TC 0x02
 #define OD 0x1
 @@ -631,6 +632,7 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct 
 mmc_ios *ios)
  u16 dsor = 0;
  unsigned long regval;
  unsigned long timeout;
 + u32 con;
 
  switch (ios-power_mode) {
  case MMC_POWER_OFF:
 @@ -641,12 +643,18 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, 
 struct mmc_ios *ios)
  break;
  }
 
 + con =  OMAP_HSMMC_READ(host-base, CON);
  switch (mmc-ios.bus_width) {
 + case MMC_BUS_WIDTH_8:
 + OMAP_HSMMC_WRITE(host-base, CON, con | DW8);
 + break;
  case MMC_BUS_WIDTH_4:
 + OMAP_HSMMC_WRITE(host-base, CON, con  ~DW8);
  OMAP_HSMMC_WRITE(host-base, HCTL,
  OMAP_HSMMC_READ(host-base, HCTL) | FOUR_BIT);
  break;
  case MMC_BUS_WIDTH_1:
 + OMAP_HSMMC_WRITE(host-base, CON, con  ~DW8);
  OMAP_HSMMC_WRITE(host-base, HCTL

Re: Bug in twl4030backupbatt_voltage()

2008-09-10 Thread Madhusudhan Chikkature

- Original Message - 
From: Adrian Hunter [EMAIL PROTECTED]
To: Tony Lindgren [EMAIL PROTECTED]
Cc: linux-omap@vger.kernel.org; [EMAIL PROTECTED]
Sent: Wednesday, September 10, 2008 12:58 PM
Subject: Re: Bug in twl4030backupbatt_voltage()


 Tony Lindgren wrote:
 * Adrian Hunter [EMAIL PROTECTED] [080903 08:08]:
 In the omap tree, commit f91fd98be045bec9c18e13110f22dafd44cb84b5
 fixed a bug with the use of function twl4030_madc_conversion()
 relating to the local variable 'struct twl4030_madc_request req'
 not being fully initialised.

 The same problem appears to be in the function
 twl4030backupbatt_voltage() which is in drivers/power/twl4030_bci_battery.c
 
 Thanks, I'll initialize it to NULL. Wouldn't it have been easier just
 to write a patch instead of the description above? :)
 
 Apparently.
 
 There is also req.do_avg which should be zero, if you assume the programmer's
 intent was to have uninitialised members set to zero.
I guess, I did not look at all the other members of the twl4030_madc_request 
structure. I might have missed it.
The do_avg and func_cb fields can both be set to NULL.

Regards,
Madhu
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Bug in twl4030backupbatt_voltage()

2008-09-10 Thread Madhusudhan Chikkature

- Original Message - 
From: Tony Lindgren [EMAIL PROTECTED]
To: Madhusudhan Chikkature [EMAIL PROTECTED]
Cc: Adrian Hunter [EMAIL PROTECTED]; linux-omap@vger.kernel.org
Sent: Wednesday, September 10, 2008 9:09 PM
Subject: Re: Bug in twl4030backupbatt_voltage()


* Madhusudhan Chikkature [EMAIL PROTECTED] [080910 06:12]:
 
 - Original Message - 
 From: Adrian Hunter [EMAIL PROTECTED]
 To: Tony Lindgren [EMAIL PROTECTED]
 Cc: linux-omap@vger.kernel.org; [EMAIL PROTECTED]
 Sent: Wednesday, September 10, 2008 12:58 PM
 Subject: Re: Bug in twl4030backupbatt_voltage()
 
 
  Tony Lindgren wrote:
  * Adrian Hunter [EMAIL PROTECTED] [080903 08:08]:
  In the omap tree, commit f91fd98be045bec9c18e13110f22dafd44cb84b5
  fixed a bug with the use of function twl4030_madc_conversion()
  relating to the local variable 'struct twl4030_madc_request req'
  not being fully initialised.
 
  The same problem appears to be in the function
  twl4030backupbatt_voltage() which is in 
  drivers/power/twl4030_bci_battery.c
  
  Thanks, I'll initialize it to NULL. Wouldn't it have been easier just
  to write a patch instead of the description above? :)
  
  Apparently.
  
  There is also req.do_avg which should be zero, if you assume the 
  programmer's
  intent was to have uninitialised members set to zero.
 I guess, I did not look at all the other members of the 
 twl4030_madc_request structure. I might have missed it.
 The do_avg and func_cb fields can both be set to NULL.
 
 Can you please check the code and send a patch?
Yes. I will do that.

Regards,
Madhu
 
 Thanks,
 
 Tony
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: HSMMC pending fixes

2008-09-10 Thread Madhusudhan Chikkature

- Original Message - 
From: Tony Lindgren [EMAIL PROTECTED]
To: Woodruff, Richard [EMAIL PROTECTED]
Cc: Jarkko Lavinen [EMAIL PROTECTED]; linux-omap@vger.kernel.org
Sent: Thursday, September 11, 2008 5:35 AM
Subject: Re: HSMMC pending fixes


* Woodruff, Richard [EMAIL PROTECTED] [080818 14:09]:
 Hi,
 
  [EMAIL PROTECTED] On Behalf Of Jarkko Lavinen
 
 
  2: Disable smartidle mode while suspending (workaround)
 
 This was the work around we had in internal trees for a long time.
 
 However Madhu C. recently updated this based on an internal investigation.  
 It is required to reset the command pin to clear the system for sleep.  This 
 allows retention to work.
 
 The non-idle work around when profiled showed it was taking a huge amount of 
 time for the clock re-enable to work.  This actually would noticeably reduce 
 MMC throughput when doing aggressive clock cutting in the driver and 
 increase power usage.
 
 +   } else {
 +   OMAP_HSMMC_WRITE(host-base, SYSCTL,
 +   OMAP_HSMMC_READ(host-base, SYSCTL) | SRD);
 +   while (OMAP_HSMMC_READ(host-base, SYSCTL)  SRD) ;
 
 If you use a really long time out then perhaps it doesn't matter.  But if 
 you try and be aggressive it will hurt you.
 
 Pushing all except the workaround. Madhu, can you please send a patch
 for what Richard is describing?
Tony, I have already posted the above fix to L-o. I see that it is merged as 
well. With this fix, I guess there is no need to disable smart idle mode while 
suspending. Am I missing any other thing here?

Regards,
Madhu

 
 Thanks,
 
 Tony
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 32/33] add omap 1-wire interface driver

2008-09-09 Thread Madhusudhan Chikkature

- Original Message - 
From: Tony Lindgren [EMAIL PROTECTED]
To: Madhusudhan Chikkature [EMAIL PROTECTED]
Cc: Felipe Balbi [EMAIL PROTECTED]; linux-omap@vger.kernel.org; Felipe 
Balbi [EMAIL PROTECTED]
Sent: Monday, September 08, 2008 11:35 PM
Subject: Re: [PATCH 32/33] add omap 1-wire interface driver


* Madhusudhan Chikkature [EMAIL PROTECTED] [080908 05:15]:
 
 - Original Message - 
 From: Tony Lindgren [EMAIL PROTECTED]
 To: Madhusudhan Chikkature [EMAIL PROTECTED]
 Cc: Felipe Balbi [EMAIL PROTECTED]; linux-omap@vger.kernel.org; 
 Felipe Balbi [EMAIL PROTECTED]
 Sent: Friday, September 05, 2008 11:29 PM
 Subject: Re: [PATCH 32/33] add omap 1-wire interface driver
 
 
 * Madhusudhan Chikkature [EMAIL PROTECTED] [080901 06:16]:
  Hi,
  
  The HDQ patchset that I posted to Tony were given ACK by Evgeniy Polyakov 
  on the omap list. I hope that helps.
  
  Madhu, can you post your 1-wire driver to LKML and Cc Evgeniy Polyakov
  so we can get that integrated? Also Cc l-o list.
 I have a question regarding this. In fact it can be a generic question which 
 might apply for other drivers as well. How do we post the OMAP3 related 
 driver patches to LKML or any other driver specific lists if OMAP3 base 
 support is not already  present there?
 
 Well the drivers should not have dependencies to omap3 headers.
 And hopefully we'll have the minimal omap3 support integrated when
 2.6.28 opens.
 
 Also, you're already getting IORESOURCE_MEM as rerource. And isn't
 this driver also on 24XX chips too?
Yes.  This driver should work on 2430 as well.
 
 BTW, how about change it to use __raw_read/write instead of
 omap_read/write? Just ioremap the IORESOURCE_MEM, see
 the recent ioremap changes.
Okay. I will look at those changes.

Regards,
Madhu
 
 Regards,
 
 Tony
 
 
 Regards,
 Madhu 
  
  Thanks,
  
  Tony
  
  
  Regards,
  Madhu
  
  - Original Message - 
  From: Felipe Balbi [EMAIL PROTECTED]
  To: linux-omap@vger.kernel.org
  Cc: Felipe Balbi [EMAIL PROTECTED]
  Sent: Saturday, August 30, 2008 10:46 PM
  Subject: [PATCH 32/33] add omap 1-wire interface driver
  
  
   From: Felipe Balbi [EMAIL PROTECTED]
   
   Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
   ---
   arch/arm/plat-omap/include/mach/irqs.h |2 +
   drivers/w1/masters/Kconfig |7 +
   drivers/w1/masters/Makefile|1 +
   drivers/w1/masters/omap_hdq.c  |  704 
   
   4 files changed, 714 insertions(+), 0 deletions(-)
   create mode 100644 drivers/w1/masters/omap_hdq.c
   
   diff --git a/arch/arm/plat-omap/include/mach/irqs.h 
   b/arch/arm/plat-omap/include/mach/irqs.h
   index 17248bb..c9e95a6 100644
   --- a/arch/arm/plat-omap/include/mach/irqs.h
   +++ b/arch/arm/plat-omap/include/mach/irqs.h
   @@ -54,6 +54,8 @@
   #define INT_TIMER2 30
   #define INT_LCD_CTRL 31
   
   +#define INT_24XX_HDQ_IRQ 58 /* Temporarily here for driver to build */
   +
   /*
* OMAP-1510 specific IRQ numbers for interrupt handler 1
*/
   diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig
   index c449309..636d4f7 100644
   --- a/drivers/w1/masters/Kconfig
   +++ b/drivers/w1/masters/Kconfig
   @@ -42,6 +42,13 @@ config W1_MASTER_DS1WM
  in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like
  hx4700.
   
   +config HDQ_MASTER_OMAP
   + tristate OMAP HDQ driver
   + depends on ARCH_OMAP2430 || ARCH_OMAP34XX
   + help
   +   Say Y here if you want support for the 1-wire or HDQ Interface
   +   on an OMAP processor.
   +
   config W1_MASTER_GPIO
tristate GPIO 1-wire busmaster
depends on GENERIC_GPIO
   diff --git a/drivers/w1/masters/Makefile b/drivers/w1/masters/Makefile
   index 1420b5b..1daeb6e 100644
   --- a/drivers/w1/masters/Makefile
   +++ b/drivers/w1/masters/Makefile
   @@ -6,4 +6,5 @@ obj-$(CONFIG_W1_MASTER_MATROX) += matrox_w1.o
   obj-$(CONFIG_W1_MASTER_DS2490) += ds2490.o
   obj-$(CONFIG_W1_MASTER_DS2482) += ds2482.o
   obj-$(CONFIG_W1_MASTER_DS1WM) += ds1wm.o
   +obj-$(CONFIG_HDQ_MASTER_OMAP) += omap_hdq.o
   obj-$(CONFIG_W1_MASTER_GPIO) += w1-gpio.o
   diff --git a/drivers/w1/masters/omap_hdq.c 
   b/drivers/w1/masters/omap_hdq.c
   new file mode 100644
   index 000..880e282
   --- /dev/null
   +++ b/drivers/w1/masters/omap_hdq.c
   @@ -0,0 +1,704 @@
   +/*
   + * drivers/w1/masters/omap_hdq.c
   + *
   + * Copyright (C) 2007 Texas Instruments, Inc.
   + *
   + * This file is licensed under the terms of the GNU General Public 
   License
   + * version 2. This program is licensed as is without any warranty of 
   any
   + * kind, whether express or implied.
   + *
   + */
   +#include linux/kernel.h
   +#include linux/module.h
   +#include linux/platform_device.h
   +#include linux/interrupt.h
   +#include linux/err.h
   +#include linux/clk.h
   +#include linux/io.h
   +#include asm/irq.h
   +#include mach/hardware.h
   +
   +#include ../w1.h
   +#include ../w1_int.h
   +
   +#define MOD_NAME OMAP_HDQ

Re: [PATCH 32/33] add omap 1-wire interface driver

2008-09-08 Thread Madhusudhan Chikkature

- Original Message - 
From: Tony Lindgren [EMAIL PROTECTED]
To: Madhusudhan Chikkature [EMAIL PROTECTED]
Cc: Felipe Balbi [EMAIL PROTECTED]; linux-omap@vger.kernel.org; Felipe 
Balbi [EMAIL PROTECTED]
Sent: Friday, September 05, 2008 11:29 PM
Subject: Re: [PATCH 32/33] add omap 1-wire interface driver


* Madhusudhan Chikkature [EMAIL PROTECTED] [080901 06:16]:
 Hi,
 
 The HDQ patchset that I posted to Tony were given ACK by Evgeniy Polyakov on 
 the omap list. I hope that helps.
 
 Madhu, can you post your 1-wire driver to LKML and Cc Evgeniy Polyakov
 so we can get that integrated? Also Cc l-o list.
I have a question regarding this. In fact it can be a generic question which 
might apply for other drivers as well. How do we post the OMAP3 related driver 
patches to LKML or any other driver specific lists if OMAP3 base support is not 
already  present there?

Regards,
Madhu 
 
 Thanks,
 
 Tony
 
 
 Regards,
 Madhu
 
 - Original Message - 
 From: Felipe Balbi [EMAIL PROTECTED]
 To: linux-omap@vger.kernel.org
 Cc: Felipe Balbi [EMAIL PROTECTED]
 Sent: Saturday, August 30, 2008 10:46 PM
 Subject: [PATCH 32/33] add omap 1-wire interface driver
 
 
  From: Felipe Balbi [EMAIL PROTECTED]
  
  Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
  ---
  arch/arm/plat-omap/include/mach/irqs.h |2 +
  drivers/w1/masters/Kconfig |7 +
  drivers/w1/masters/Makefile|1 +
  drivers/w1/masters/omap_hdq.c  |  704 
  
  4 files changed, 714 insertions(+), 0 deletions(-)
  create mode 100644 drivers/w1/masters/omap_hdq.c
  
  diff --git a/arch/arm/plat-omap/include/mach/irqs.h 
  b/arch/arm/plat-omap/include/mach/irqs.h
  index 17248bb..c9e95a6 100644
  --- a/arch/arm/plat-omap/include/mach/irqs.h
  +++ b/arch/arm/plat-omap/include/mach/irqs.h
  @@ -54,6 +54,8 @@
  #define INT_TIMER2 30
  #define INT_LCD_CTRL 31
  
  +#define INT_24XX_HDQ_IRQ 58 /* Temporarily here for driver to build */
  +
  /*
   * OMAP-1510 specific IRQ numbers for interrupt handler 1
   */
  diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig
  index c449309..636d4f7 100644
  --- a/drivers/w1/masters/Kconfig
  +++ b/drivers/w1/masters/Kconfig
  @@ -42,6 +42,13 @@ config W1_MASTER_DS1WM
 in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like
 hx4700.
  
  +config HDQ_MASTER_OMAP
  + tristate OMAP HDQ driver
  + depends on ARCH_OMAP2430 || ARCH_OMAP34XX
  + help
  +   Say Y here if you want support for the 1-wire or HDQ Interface
  +   on an OMAP processor.
  +
  config W1_MASTER_GPIO
   tristate GPIO 1-wire busmaster
   depends on GENERIC_GPIO
  diff --git a/drivers/w1/masters/Makefile b/drivers/w1/masters/Makefile
  index 1420b5b..1daeb6e 100644
  --- a/drivers/w1/masters/Makefile
  +++ b/drivers/w1/masters/Makefile
  @@ -6,4 +6,5 @@ obj-$(CONFIG_W1_MASTER_MATROX) += matrox_w1.o
  obj-$(CONFIG_W1_MASTER_DS2490) += ds2490.o
  obj-$(CONFIG_W1_MASTER_DS2482) += ds2482.o
  obj-$(CONFIG_W1_MASTER_DS1WM) += ds1wm.o
  +obj-$(CONFIG_HDQ_MASTER_OMAP) += omap_hdq.o
  obj-$(CONFIG_W1_MASTER_GPIO) += w1-gpio.o
  diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
  new file mode 100644
  index 000..880e282
  --- /dev/null
  +++ b/drivers/w1/masters/omap_hdq.c
  @@ -0,0 +1,704 @@
  +/*
  + * drivers/w1/masters/omap_hdq.c
  + *
  + * Copyright (C) 2007 Texas Instruments, Inc.
  + *
  + * This file is licensed under the terms of the GNU General Public License
  + * version 2. This program is licensed as is without any warranty of any
  + * kind, whether express or implied.
  + *
  + */
  +#include linux/kernel.h
  +#include linux/module.h
  +#include linux/platform_device.h
  +#include linux/interrupt.h
  +#include linux/err.h
  +#include linux/clk.h
  +#include linux/io.h
  +#include asm/irq.h
  +#include mach/hardware.h
  +
  +#include ../w1.h
  +#include ../w1_int.h
  +
  +#define MOD_NAME OMAP_HDQ:
  +
  +#define OMAP_HDQ_REVISION 0x00
  +#define OMAP_HDQ_TX_DATA 0x04
  +#define OMAP_HDQ_RX_DATA 0x08
  +#define OMAP_HDQ_CTRL_STATUS 0x0c
  +#define OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK (16)
  +#define OMAP_HDQ_CTRL_STATUS_CLOCKENABLE (15)
  +#define OMAP_HDQ_CTRL_STATUS_GO (14)
  +#define OMAP_HDQ_CTRL_STATUS_INITIALIZATION (12)
  +#define OMAP_HDQ_CTRL_STATUS_DIR (11)
  +#define OMAP_HDQ_CTRL_STATUS_MODE (10)
  +#define OMAP_HDQ_INT_STATUS 0x10
  +#define OMAP_HDQ_INT_STATUS_TXCOMPLETE (12)
  +#define OMAP_HDQ_INT_STATUS_RXCOMPLETE (11)
  +#define OMAP_HDQ_INT_STATUS_TIMEOUT (10)
  +#define OMAP_HDQ_SYSCONFIG 0x14
  +#define OMAP_HDQ_SYSCONFIG_SOFTRESET (11)
  +#define OMAP_HDQ_SYSCONFIG_AUTOIDLE (10)
  +#define OMAP_HDQ_SYSSTATUS 0x18
  +#define OMAP_HDQ_SYSSTATUS_RESETDONE (10)
  +
  +#define OMAP_HDQ_FLAG_CLEAR 0
  +#define OMAP_HDQ_FLAG_SET 1
  +#define OMAP_HDQ_TIMEOUT (HZ/5)
  +
  +#define OMAP_HDQ_MAX_USER 4
  +
  +DECLARE_WAIT_QUEUE_HEAD(hdq_wait_queue);
  +int W1_ID;
  +
  +struct hdq_data {
  + resource_size_t

Re: [PATCH 21/33] add OMAP HighSpeed mmc controller driver

2008-09-04 Thread Madhusudhan Chikkature
Hi Dave,

OK, this one may need cleanup ... but I don't disagree that it
should go upstream.
I had fixed several comments provided by Pierre and Russell before Tony merged 
this patch. But then we have further added several fixes on top of the driver. 
Do you have any specific comments when you mean cleanup?

Regards,
Madhu
- Original Message - 
From: David Brownell [EMAIL PROTECTED]
To: Felipe Balbi [EMAIL PROTECTED]
Cc: linux-omap@vger.kernel.org; Felipe Balbi [EMAIL PROTECTED]
Sent: Monday, September 01, 2008 2:36 AM
Subject: Re: [PATCH 21/33] add OMAP HighSpeed mmc controller driver


On Saturday 30 August 2008, Felipe Balbi wrote:
 From: Felipe Balbi [EMAIL PROTECTED]
 
 Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
 ---
 drivers/mmc/host/Kconfig | 13 +-
 drivers/mmc/host/Makefile | 1 +
 drivers/mmc/host/omap_hsmmc.c | 1069 +
 3 files changed, 1082 insertions(+), 1 deletions(-)
 create mode 100644 drivers/mmc/host/omap_hsmmc.c

OK, this one may need cleanup ... but I don't disagree that it
should go upstream.

Now the process for getting it there involves posting to LKML
and probably CCing the MMC maintainer...

One reason I'd like to see this particular driver upstream is
so that folk using www.beagleboard.org hardware can stand a
real chance of using mainline kernels for development.  That's
a small set of drivers, so that's a very achievable goal.



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] MMC: OMAP: Re-organizing some goto at hsmmc probe

2008-08-21 Thread Madhusudhan Chikkature
Hi Jarkko,

I am not clear what this patch is doing? Is it fixing any perticular issue?

Regards,
Madhu
- Original Message - 
From: Jarkko Lavinen [EMAIL PROTECTED]
To: linux-omap@vger.kernel.org
Cc: Jarkko Lavinen [EMAIL PROTECTED]
Sent: Monday, August 18, 2008 8:43 PM
Subject: [PATCH] MMC: OMAP: Re-organizing some goto at hsmmc probe


 Re-organizing some goto at hsmmc probe.
 
 Signed-off-by: Francisco Alecrim [EMAIL PROTECTED]
 Signed-off-by: Jarkko Lavinen [EMAIL PROTECTED]
 ---
 drivers/mmc/host/omap_hsmmc.c |   20 +++-
 1 files changed, 11 insertions(+), 9 deletions(-)
 
 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index f5acf91..824e7e9 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -878,7 +878,7 @@ static int __init omap_mmc_probe(struct platform_device 
 *pdev)
  host);
  if (ret) {
  dev_dbg(mmc_dev(host-mmc), Unable to grab HSMMC IRQ\n);
 - goto irq_err;
 + goto err_irq;
  }
 
  /* Request IRQ for card detect */
 @@ -888,18 +888,17 @@ static int __init omap_mmc_probe(struct platform_device 
 *pdev)
host);
  if (ret) {
  dev_dbg(mmc_dev(host-mmc),
 - Unable to grab MMC CD IRQ);
 - free_irq(host-irq, host);
 - goto irq_err;
 + Unable to grab MMC CD IRQ\n);
 + goto err_irq_cd;
  }
  }
 
  INIT_WORK(host-mmc_carddetect_work, mmc_omap_detect);
  if (pdata-init != NULL) {
  if (pdata-init(pdev-dev) != 0) {
 - free_irq(mmc_slot(host).card_detect_irq, host);
 - free_irq(host-irq, host);
 - goto irq_err;
 + dev_dbg(mmc_dev(host-mmc),
 + Unable to configure MMC IRQs\n);
 + goto err_irq_cd_init;
  }
  }
 
 @@ -911,8 +910,11 @@ static int __init omap_mmc_probe(struct platform_device 
 *pdev)
 
  return 0;
 
 -irq_err:
 - dev_dbg(mmc_dev(host-mmc), Unable to configure MMC IRQs\n);
 +err_irq_cd_init:
 + free_irq(mmc_slot(host).card_detect_irq, host);
 +err_irq_cd:
 + free_irq(host-irq, host);
 +err_irq:
  clk_disable(host-fclk);
  clk_disable(host-iclk);
  clk_put(host-fclk);
 -- 
 1.5.6.3
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH]Enable 4-bit in HSMMC1 and HSMMC2 platform data

2008-08-13 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

ARM: OMAP3: Enable 4-bit support for HSMMC.

This patch provides the fix to enable 4-bit support for HSMMC.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
Signed-off-by: purushotam[EMAIL PROTECTED]
---
 arch/arm/plat-omap/devices.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Index: linux-omap-2.6/arch/arm/plat-omap/devices.c
===
--- linux-omap-2.6.orig/arch/arm/plat-omap/devices.c2008-08-07
15:56:52.0 +0530
+++ linux-omap-2.6/arch/arm/plat-omap/devices.c 2008-08-11 10:57:37.0
+0530
@@ -289,13 +289,17 @@ static void __init omap_init_mmc(void)
mmc = mmc_conf-mmc[0];

if (cpu_is_omap2430() || cpu_is_omap34xx()) {
-   if (mmc-enabled)
+   if (mmc-enabled) {
+   mmc1_data.conf = *mmc;
(void) platform_device_register(mmc_omap_device1);
+   }

 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX)
mmc = mmc_conf-mmc[1];
-   if (mmc-enabled)
+   if (mmc-enabled) {
+   mmc2_data.conf = *mmc;
(void) platform_device_register(mmc_omap_device2);
+   }
 #endif

return;


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH]Add 3430 SDP board level support for HSMMC2

2008-08-13 Thread Madhusudhan Chikkature

- Original Message - 
From: David Brownell [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: linux-omap@vger.kernel.org
Sent: Wednesday, August 13, 2008 2:24 PM
Subject: Re: [PATCH]Add 3430 SDP board level support for HSMMC2


  arch/arm/mach-omap2/board-3430sdp.c |4
  arch/arm/mach-omap2/hsmmc.c |  185 
 
 hsmmc.c is used by Beagle too, yet ...
 
 
  void __init hsmmc_init(void)
  {
  omap_set_mmc_info(1, hsmmc_data);
 + omap_set_mmc_info(2, hsmmc2_data);
  }
 
 ... MMC2 is rarely enabled on Beagle, so this is incorrect.
There is an another level of abstraction at the board level files like 
board-3430sdp.c,board-omap3beagle.c, board-omap3evm.c..
I see that the beagle board file does not enable hsmmc2. So the platform device 
for the second controller is not registered anyway.

 
 
 A better way to do this would be to let the boards say exactly
 what the hardware configuration is, rather than requiring all
 OMAP3 boards to be set up exactly like the SDP...
I think the initial version was written specific to SDP. Later on it was 
changed to hsmmc.c and the platforms 
which required simillar setup as SDP started using it. Now, if support for a 
new board is required which is unlike SDP a
new file can still be added for that perticular board, right?

Regards,
Madhu
 
 - Dave
 
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] OMAP3:devices.c: Enabling 4-bit for SD card

2008-08-10 Thread Madhusudhan Chikkature

- Original Message - 
From: David Brownell [EMAIL PROTECTED]
To: Kumar, Purushotam [EMAIL PROTECTED]
Cc: Tony Lindgren [EMAIL PROTECTED]; Purushotam Kumar [EMAIL 
PROTECTED]; linux-omap@vger.kernel.org; Gole, Anant [EMAIL PROTECTED]
Sent: Tuesday, August 05, 2008 12:40 PM
Subject: Re: [PATCH] OMAP3:devices.c: Enabling 4-bit for SD card


 On Monday 14 July 2008, Kumar, Purushotam wrote:
if (cpu_is_omap2430() || cpu_is_omap34xx()) {
- if (mmc-enabled)
+ if (mmc-enabled) {
+ mmc1_data.conf = *mmc;
(void) platform_device_register(mmc_omap_device1);
+ }
 
 I don't get it.  OMAP3 uses the hsmmc code, which uses
 a struct omap_mmc_platform_data to configure itself.
 
 But this patch updates a struct omap_mmc_conf as used
 by the non-hsmmc code.
 
 So ... it's a NOP, at least for OMAP3.  Right?

Hi Dave,
I think there is no difference between hsmmc code vs non-hsmmc code with 
respect to platform specific structure initializations.
Both of them use omap_mmc_platform_data as well as omap_mmc_config 
structures. I had a quick look at board-h4-mmc.c
and board-h4.c to verify this.

What this patch does is to add the missing initializtion line mmc1_data.conf = 
*mmc; for 2430 or 3430 which was present for platforms other 
than these. Without this line the below condition in the hsmmc driver will not 
evaluate to true.

if (pdata-conf.wire4)
mmc-caps |= MMC_CAP_4_BIT_DATA;

The header include/asm-arm/arch-omap/mmc.h is used by both hsmmc and 
non-hsmmc code.

Regards,
Madhu
 
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] Fixes required for HSMMC driver to work as module

2008-08-07 Thread Madhusudhan Chikkature
 * Madhusudhan Chikkature [EMAIL PROTECTED] [080725 13:34]:
 From: Madhusudhan Chikkature[EMAIL PROTECTED]

 ARM: OMAP3: Fixes required to make HSMMC driver as module.

 This patch provides the necessary fixes to make the HSMMC driver work as
 loadble module.

 This one does not apply, can you take a look?

 Thanks,

 Tony

Hi Tony,

I see that you have pushed this patch which did not apply correctly. So the
patch seems to have applied in part. Also the title for the commit seems to
have been wronly put as removing some usb defines.

I will post a patch which will complete the patch that I had send for HSMMC
driver to work as a module.

Regards,
Madhu



 Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
 Signed-off-by: Romit Dasgupta [EMAIL PROTECTED]
 ---
  drivers/mmc/host/omap_hsmmc.c |   43
 +++---
  1 files changed, 32 insertions(+), 11 deletions(-)

 Index: linux-omap-ti.git-07142008/drivers/mmc/host/omap_hsmmc.c
 ===
 --- linux-omap-ti.git-07142008.orig/drivers/mmc/host/omap_hsmmc.c
 2008-07-23
 16:31:56.0 +0530
 +++ linux-omap-ti.git-07142008/drivers/mmc/host/omap_hsmmc.c 2008-07-24
 12:07:40.0 +0530
 @@ -764,23 +764,27 @@ static int __init omap_mmc_probe(struct
  if (IS_ERR(host-iclk)) {
  ret = PTR_ERR(host-iclk);
  host-iclk = NULL;
 -goto err;
 +goto err1;
  }
  host-fclk = clk_get(pdev-dev, mmchs_fck);
  if (IS_ERR(host-fclk)) {
  ret = PTR_ERR(host-fclk);
  host-fclk = NULL;
  clk_put(host-iclk);
 -goto err;
 +goto err1;
  }

 -if (clk_enable(host-fclk) != 0)
 -goto err;
 +if (clk_enable(host-fclk) != 0) {
 +clk_put(host-iclk);
 +clk_put(host-fclk);
 +goto err1;
 +}

  if (clk_enable(host-iclk) != 0) {
  clk_disable(host-fclk);
 +clk_put(host-iclk);
  clk_put(host-fclk);
 -goto err;
 +goto err1;
  }

  host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
 @@ -873,12 +877,6 @@ static int __init omap_mmc_probe(struct

  return 0;

 -err:
 -dev_dbg(mmc_dev(host-mmc), Probe Failed\n);
 -if (host)
 -mmc_free_host(mmc);
 -return ret;
 -
  irq_err:
  dev_dbg(mmc_dev(host-mmc), Unable to configure MMC IRQs\n);
  clk_disable(host-fclk);
 @@ -890,6 +888,11 @@ irq_err:
  clk_put(host-dbclk);
  }

 +err1:
 +iounmap(host-base);
 +err:
 +dev_dbg(mmc_dev(host-mmc), Probe Failed\n);
 +release_mem_region(res-start, res-end - res-start + 1);
  if (host)
  mmc_free_host(mmc);
  return ret;
 @@ -898,9 +901,26 @@ irq_err:
  static int omap_mmc_remove(struct platform_device *pdev)
  {
  struct mmc_omap_host *host = platform_get_drvdata(pdev);
 +struct resource *res;
 +u16 vdd = 0;
 +
 +if (!(OMAP_HSMMC_READ(host-base, HCTL)  SDVSDET)) {
 +/*
 + * Set the vdd back to 3V,
 + * applicable for dual volt support.
 + */
 +vdd = fls(host-mmc-ocr_avail) - 1;
 +if (omap_mmc_switch_opcond(host, vdd) != 0)
 +host-mmc-ios.vdd = vdd;
 +}
 +
 +res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 +if (res)
 +release_mem_region(res-start, res-end - res-start + 1);

  platform_set_drvdata(pdev, NULL);
  if (host) {
 +mmc_remove_host(host-mmc);
  host-pdata-cleanup(pdev-dev);
  free_irq(host-irq, host);
  if (mmc_slot(host).card_detect_irq)
 @@ -917,6 +937,7 @@ static int omap_mmc_remove(struct platfo
  }

  mmc_free_host(host-mmc);
 +iounmap(host-base);
  }

  return 0;





--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Resending PATCH 3/3] Fixes required for HSMMC driver to work as module

2008-08-07 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

ARM: OMAP3: Fixes required to make HSMMC driver work as module.Complete the
previously applied patch.

This patch provides the necessary fixes to make the HSMMC driver work as
loadble module.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
Signed-off-by: Romit Dasgupta [EMAIL PROTECTED]
---
 drivers/mmc/host/omap_hsmmc.c |   17 +
 1 files changed, 17 insertions(+)

Index: linux-omap-2.6/drivers/mmc/host/omap_hsmmc.c
===
--- linux-omap-2.6.orig/drivers/mmc/host/omap_hsmmc.c   2008-08-07
15:56:52.0 +0530
+++ linux-omap-2.6/drivers/mmc/host/omap_hsmmc.c2008-08-07 
16:09:22.0
+0530
@@ -901,9 +901,26 @@ err:
 static int omap_mmc_remove(struct platform_device *pdev)
 {
struct mmc_omap_host *host = platform_get_drvdata(pdev);
+   struct resource *res;
+   u16 vdd = 0;
+
+   if (!(OMAP_HSMMC_READ(host-base, HCTL)  SDVSDET)) {
+   /*
+* Set the vdd back to 3V,
+* applicable for dual volt support.
+*/
+   vdd = fls(host-mmc-ocr_avail) - 1;
+   if (omap_mmc_switch_opcond(host, vdd) != 0)
+   host-mmc-ios.vdd = vdd;
+   }
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (res)
+   release_mem_region(res-start, res-end - res-start + 1);

platform_set_drvdata(pdev, NULL);
if (host) {
+   mmc_remove_host(host-mmc);
if (host-pdata-cleanup)
host-pdata-cleanup(pdev-dev);
free_irq(host-irq, host);


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] Fixes required for HSMMC driver to work as module

2008-08-05 Thread Madhusudhan Chikkature
Hi Tony,

Sure. I will take a look. 

Regards,
Madhu
- Original Message - 
From: Tony Lindgren [EMAIL PROTECTED]
To: Madhusudhan Chikkature [EMAIL PROTECTED]
Cc: linux-omap@vger.kernel.org
Sent: Tuesday, August 05, 2008 7:34 PM
Subject: Re: [PATCH 3/3] Fixes required for HSMMC driver to work as module


* Madhusudhan Chikkature [EMAIL PROTECTED] [080725 13:34]:
 From: Madhusudhan Chikkature[EMAIL PROTECTED]
 
 ARM: OMAP3: Fixes required to make HSMMC driver as module.
 
 This patch provides the necessary fixes to make the HSMMC driver work as
 loadble module.
 
 This one does not apply, can you take a look?
 
 Thanks,
 
 Tony
 
 
 Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
 Signed-off-by: Romit Dasgupta [EMAIL PROTECTED]
 ---
  drivers/mmc/host/omap_hsmmc.c |   43 
 +++---
  1 files changed, 32 insertions(+), 11 deletions(-)
 
 Index: linux-omap-ti.git-07142008/drivers/mmc/host/omap_hsmmc.c
 ===
 --- linux-omap-ti.git-07142008.orig/drivers/mmc/host/omap_hsmmc.c 2008-07-23
 16:31:56.0 +0530
 +++ linux-omap-ti.git-07142008/drivers/mmc/host/omap_hsmmc.c 2008-07-24
 12:07:40.0 +0530
 @@ -764,23 +764,27 @@ static int __init omap_mmc_probe(struct
  if (IS_ERR(host-iclk)) {
  ret = PTR_ERR(host-iclk);
  host-iclk = NULL;
 - goto err;
 + goto err1;
  }
  host-fclk = clk_get(pdev-dev, mmchs_fck);
  if (IS_ERR(host-fclk)) {
  ret = PTR_ERR(host-fclk);
  host-fclk = NULL;
  clk_put(host-iclk);
 - goto err;
 + goto err1;
  }
 
 - if (clk_enable(host-fclk) != 0)
 - goto err;
 + if (clk_enable(host-fclk) != 0) {
 + clk_put(host-iclk);
 + clk_put(host-fclk);
 + goto err1;
 + }
 
  if (clk_enable(host-iclk) != 0) {
  clk_disable(host-fclk);
 + clk_put(host-iclk);
  clk_put(host-fclk);
 - goto err;
 + goto err1;
  }
 
  host-dbclk = clk_get(pdev-dev, mmchsdb_fck);
 @@ -873,12 +877,6 @@ static int __init omap_mmc_probe(struct
 
  return 0;
 
 -err:
 - dev_dbg(mmc_dev(host-mmc), Probe Failed\n);
 - if (host)
 - mmc_free_host(mmc);
 - return ret;
 -
  irq_err:
  dev_dbg(mmc_dev(host-mmc), Unable to configure MMC IRQs\n);
  clk_disable(host-fclk);
 @@ -890,6 +888,11 @@ irq_err:
  clk_put(host-dbclk);
  }
 
 +err1:
 + iounmap(host-base);
 +err:
 + dev_dbg(mmc_dev(host-mmc), Probe Failed\n);
 + release_mem_region(res-start, res-end - res-start + 1);
  if (host)
  mmc_free_host(mmc);
  return ret;
 @@ -898,9 +901,26 @@ irq_err:
  static int omap_mmc_remove(struct platform_device *pdev)
  {
  struct mmc_omap_host *host = platform_get_drvdata(pdev);
 + struct resource *res;
 + u16 vdd = 0;
 +
 + if (!(OMAP_HSMMC_READ(host-base, HCTL)  SDVSDET)) {
 + /*
 + * Set the vdd back to 3V,
 + * applicable for dual volt support.
 + */
 + vdd = fls(host-mmc-ocr_avail) - 1;
 + if (omap_mmc_switch_opcond(host, vdd) != 0)
 + host-mmc-ios.vdd = vdd;
 + }
 +
 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 + if (res)
 + release_mem_region(res-start, res-end - res-start + 1);
 
  platform_set_drvdata(pdev, NULL);
  if (host) {
 + mmc_remove_host(host-mmc);
  host-pdata-cleanup(pdev-dev);
  free_irq(host-irq, host);
  if (mmc_slot(host).card_detect_irq)
 @@ -917,6 +937,7 @@ static int omap_mmc_remove(struct platfo
  }
 
  mmc_free_host(host-mmc);
 + iounmap(host-base);
  }
 
  return 0;
 
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] Fix hsmmc driver issues

2008-07-25 Thread Madhusudhan Chikkature
Hi Tony,

I am posting a series of three patches to fix few issues noted in the hsmmc
driver.

Regards,
Madhu

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3]TWL4030 BCI patches

2008-07-22 Thread Madhusudhan Chikkature
Hi Tony,

I am resending the BCI 3 patch series after fixing the comments provided by 
Mikko.

Regards,
Madhu

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Resending - PATCH 1/3] Triton BCI driver board/device setup for OMAP3430

2008-07-22 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

Device setup/board level initialization for the Triton battery charger
interface driver for the OMAP3430 SDP.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 arch/arm/mach-omap2/Makefile  |3 +
 arch/arm/mach-omap2/bci.c |   57 ++
 arch/arm/mach-omap2/board-3430sdp.c   |1
 include/asm-arm/arch-omap/bci.h   |   17 
 include/asm-arm/arch-omap/board-3430sdp.h |1
 5 files changed, 78 insertions(+), 1 deletion(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/Makefile
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/Makefile2008-07-22
11:58:54.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/Makefile 2008-07-22 12:01:10.0
+0530
@@ -47,7 +47,8 @@ obj-$(CONFIG_MACH_OMAP_3430SDP)   += boar
   hsmmc.o \
   usb-musb.o \
   usb-ehci.o \
-  board-3430sdp-flash.o
+  board-3430sdp-flash.o \
+  bci.o
 obj-$(CONFIG_MACH_OMAP3EVM)+= board-omap3evm.o \
   hsmmc.o \
   usb-musb.o usb-ehci.o \
Index: linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/board-3430sdp.c 2008-07-22
11:58:54.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c  2008-07-22
12:01:10.0 +0530
@@ -299,6 +299,7 @@ static void __init omap_3430sdp_init(voi
ARRAY_SIZE(sdp3430_spi_board_info));
ads7846_dev_init();
sdp3430_flash_init();
+   twl4030_bci_battery_init();
omap_serial_init();
usb_musb_init();
usb_ehci_init();
Index: linux-omap-2.6/include/asm-arm/arch-omap/board-3430sdp.h
===
--- linux-omap-2.6.orig/include/asm-arm/arch-omap/board-3430sdp.h   
2008-07-22
11:58:54.0 +0530
+++ linux-omap-2.6/include/asm-arm/arch-omap/board-3430sdp.h2008-07-22
12:01:10.0 +0530
@@ -31,6 +31,7 @@

 extern void sdp3430_usb_init(void);
 extern void sdp3430_flash_init(void);
+extern void twl4030_bci_battery_init(void);

 #define DEBUG_BASE 0x0800  /* debug board */

Index: linux-omap-2.6/arch/arm/mach-omap2/bci.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-omap-2.6/arch/arm/mach-omap2/bci.c2008-07-22 12:02:39.0 
+0530
@@ -0,0 +1,57 @@
+/*
+ * linux/arch/arm/mach-omap2/bci.c
+ *
+ * TWL4030 BCI platform device setup/initialization
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include linux/module.h
+#include linux/kernel.h
+#include linux/init.h
+#include linux/platform_device.h
+#include asm/arch/bci.h
+
+#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
+   defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
+/*
+ * Thermistor Calibration for Current Source and MADC
+ * Tolerance (for THS05-3H103F)
+ */
+static int sdp3430_batt_table[] = {
+/* 0 C*/
+30800, 29500, 28300, 27100,
+26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
+17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
+11600, 11200, 10800, 10400, 1, 9630,   9280,   8950,   8620,   8310,
+8020,   7730,   7460,   7200,   6950,   6710,   6470,   6250,   6040,   5830,
+5640,   5450,   5260,   5090,   4920,   4760,   4600,   4450,   4310,   4170,
+4040,   3910,   3790,   3670,   3550
+};
+
+static struct twl4030_bci_platform_data sdp3430_bci_data = {
+  .battery_tmp_tbl = sdp3430_batt_table,
+  .tblsize = ARRAY_SIZE(sdp3430_batt_table),
+};
+
+static struct platform_device twl4030_bci_battery_device = {
+   .name   = twl4030-bci-battery,
+   .id = -1,
+   .dev= {
+   .platform_data  = sdp3430_bci_data,
+   },
+   .num_resources  = 0,
+};
+
+void __init twl4030_bci_battery_init(void)
+{
+   (void) platform_device_register(twl4030_bci_battery_device);
+}
+#else
+void __init twl4030_bci_battery_init(void)
+{
+}
+#endif
Index: linux-omap-2.6/include/asm-arm/arch-omap/bci.h
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-omap-2.6/include/asm-arm/arch-omap/bci.h  2008-07-22
12:01:10.0 +0530
@@ -0,0 +1,17 @@
+/*
+ *  linux

[Resending - PATCH 3/3] Triton BCI driver for OMAP3430 - USB changes

2008-07-22 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

This patch calls the functionality supported by the TWL4030 battery charger
interface driver
to enable/disable battery charging upon cable attach/detach.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/i2c/chips/twl4030-usb.c |7 +--
 include/linux/i2c/twl4030.h |7 +++
 2 files changed, 12 insertions(+), 2 deletions(-)

Index: linux-omap-2.6/drivers/i2c/chips/twl4030-usb.c
===
--- linux-omap-2.6.orig/drivers/i2c/chips/twl4030-usb.c 2008-07-03
16:09:05.0 +0530
+++ linux-omap-2.6/drivers/i2c/chips/twl4030-usb.c  2008-07-03
17:03:30.0 +0530
@@ -601,10 +601,13 @@ static irqreturn_t twl4030_usb_irq(int i
goto done;
}

-   if (val  USB_PRES_RISING)
+   if (val  USB_PRES_RISING) {
twl4030_phy_resume();
-   else
+   twl4030charger_usb_en(1);
+   } else {
+   twl4030charger_usb_en(0);
twl4030_phy_suspend(0);
+   }

ret = IRQ_HANDLED;

Index: linux-omap-2.6/include/linux/i2c/twl4030.h
===
--- linux-omap-2.6.orig/include/linux/i2c/twl4030.h 2008-07-03
16:09:05.0 +0530
+++ linux-omap-2.6/include/linux/i2c/twl4030.h  2008-07-03 17:03:30.0 
+0530
@@ -127,4 +127,11 @@ int twl4030_set_gpio_edge_ctrl(int gpio,
 int twl4030_set_gpio_debounce(int gpio, int enable);
 int twl4030_free_gpio(int gpio);

+#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
+   defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
+   extern int twl4030charger_usb_en(int enable);
+#else
+   static inline int twl4030charger_usb_en(int enable) { return 0; }
+#endif
+
 #endif /* End of __TWL4030_H */


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Resending - PATCH 2/3] Triton BCI driver for OMAP3430

2008-07-22 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

ARM: OMAP: Triton Battery Charger Interface

This patch provides a OMAP Triton battery charger interface driver to moniter
the battery
through power class subsystem.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/power/Kconfig   |8
 drivers/power/Makefile  |1
 drivers/power/twl4030_bci_battery.c | 1080 
 3 files changed, 1089 insertions(+)

Index: linux-omap-2.6/drivers/power/Kconfig
===
--- linux-omap-2.6.orig/drivers/power/Kconfig   2008-07-21 14:33:02.0 
+0530
+++ linux-omap-2.6/drivers/power/Kconfig2008-07-22 10:47:07.0 
+0530
@@ -70,4 +70,12 @@ config BATTERY_BQ27200
help
  Say Y here to enable support for batteries with BQ27200(I2C) chip.

+config TWL4030_BCI_BATTERY
+   tristate OMAP TWL4030 BCI Battery driver
+   depends on (MACH_OMAP_2430SDP || MACH_OMAP_3430SDP)  TWL4030_MADC
+   default y
+   help
+ Support for OMAP TWL4030 BCI Battery driver.
+ This driver can give support for TWL4030 Battery Charge Interface.
+
 endif # POWER_SUPPLY
Index: linux-omap-2.6/drivers/power/Makefile
===
--- linux-omap-2.6.orig/drivers/power/Makefile  2008-07-21 14:33:02.0 
+0530
+++ linux-omap-2.6/drivers/power/Makefile   2008-07-21 14:33:35.0 
+0530
@@ -21,3 +21,4 @@ obj-$(CONFIG_BATTERY_DS2760)  += ds2760_b
 obj-$(CONFIG_BATTERY_PMU)  += pmu_battery.o
 obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
 obj-$(CONFIG_BATTERY_BQ27x00)   += bq27x00_battery.o
+obj-$(CONFIG_TWL4030_BCI_BATTERY)  += twl4030_bci_battery.o
Index: linux-omap-2.6/drivers/power/twl4030_bci_battery.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-omap-2.6/drivers/power/twl4030_bci_battery.c  2008-07-22
13:58:40.0 +0530
@@ -0,0 +1,1080 @@
+/*
+ * linux/drivers/power/twl4030_bci_battery.c
+ *
+ * OMAP2430/3430 BCI battery driver for Linux
+ *
+ * Copyright (C) 2008 Texas Instruments, Inc.
+ * Author: Texas Instruments, Inc.
+ *
+ * This package is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#include linux/init.h
+#include linux/module.h
+#include linux/device.h
+#include linux/interrupt.h
+#include linux/delay.h
+#include linux/platform_device.h
+#include linux/i2c/twl4030.h
+#include linux/power_supply.h
+#include asm/arch/bci.h
+#include linux/i2c/twl4030-madc.h
+
+#define T2_BATTERY_VOLT0x04
+#define T2_BATTERY_TEMP0x06
+#define T2_BATTERY_CUR 0x08
+
+/* charger constants */
+#define NO_PW_CONN 0
+#define AC_PW_CONN 0x01
+#define USB_PW_CONN0x02
+
+/* TWL4030_MODULE_USB */
+#define REG_POWER_CTRL 0x0AC
+#define OTG_EN 0x020
+#define REG_PHY_CLK_CTRL   0x0FE
+#define REG_PHY_CLK_CTRL_STS   0x0FF
+#define PHY_DPLL_CLK   0x01
+
+#define REG_BCICTL10x023
+#define REG_BCICTL20x024
+#define CGAIN  0x020
+#define ITHEN  0x010
+#define ITHSENS0x007
+
+/* Boot BCI flag bits */
+#define BCIAUTOWEN 0x020
+#define CONFIG_DONE0x010
+#define BCIAUTOUSB 0x002
+#define BCIAUTOAC  0x001
+#define BCIMSTAT_MASK  0x03F
+
+/* Boot BCI register */
+#define REG_BOOT_BCI   0x007
+#define REG_CTRL1  0x00
+#define REG_SW1SELECT_MSB  0x07
+#define SW1_CH9_SEL0x02
+#define REG_CTRL_SW1   0x012
+#define SW1_TRIGGER0x020
+#define EOC_SW10x002
+#define REG_GPCH9  0x049
+#define REG_STS_HW_CONDITIONS  0x0F
+#define STS_VBUS   0x080
+#define STS_CHG0x02
+#define REG_BCIMSTATEC 0x02
+#define REG_BCIMFSTS4  0x010
+#define REG_BCIMFSTS2  0x00E
+#define REG_BCIMFSTS3  0x00F
+#define REG_BCIMFSTS1  0x001
+#define USBFASTMCHG0x004
+#define BATSTSPCHG 0x004
+#define BATSTSMCHG 0x040
+#define VBATOV40x020
+#define VBATOV30x010
+#define VBATOV20x008
+#define VBATOV10x004
+#define REG_BB_CFG 0x012
+#define BBCHEN 0x010
+
+/* Power supply charge interrupt */
+#define REG_PWR_ISR1   0x00
+#define REG_PWR_IMR1   0x01

[PATCH] Free HDQ clocks in error path

2008-07-22 Thread Madhusudhan Chikkature
Hi,

This patch provides the fix to free the HDQ clocks in the error path.

Regards,
Madhu
-

From: Madhusudhan Chikkature[EMAIL PROTECTED]

ARM: OMAP3: Free HDQ clocks when a read is tried with no battery connected

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/w1/masters/omap_hdq.c |5 -
 1 files changed, 4 insertions(+), 1 deletion(-)

Index: linux-omap-ti.git-07102008/drivers/w1/masters/omap_hdq.c
===
--- linux-omap-ti.git-07102008.orig/drivers/w1/masters/omap_hdq.c   
2008-07-02
20:10:38.0 +0530
+++ linux-omap-ti.git-07102008/drivers/w1/masters/omap_hdq.c2008-07-16
12:17:42.0 +0530
@@ -515,8 +515,11 @@ static u8 omap_w1_read_byte(void *data)
int ret;

ret = hdq_read_byte(val);
-   if (ret)
+   if (ret) {
+   init_trans = 0;
+   omap_hdq_put();
return -1;
+   }

/* Write followed by a read, release the module */
if (init_trans) {


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Resending - PATCH 1/3] Triton BCI driver board/device setup for OMAP3430

2008-07-22 Thread Madhusudhan Chikkature
Hi Felipe,

 Tony, weird that we still have these prototypes in these headers.
 Could be some merging conflict ?
Yes. I see that these prototypes are still present in the board3430 and 
board2430 header files in the omap tree.

 Anyways, please apply the attached patch. We're using
 usb_musb_init() and usb_ehci_init() now.
You mean I should apply the attached patch you sent for local use, right? And I 
guess I dont need to resend this perticular BCI patch, am I correct?

Regards,
Madhu

- Original Message - 
From: Felipe Balbi [EMAIL PROTECTED]
To: Tony Lindgren [EMAIL PROTECTED]
Cc: Madhusudhan Chikkature [EMAIL PROTECTED]; linux-omap@vger.kernel.org; 
[EMAIL PROTECTED]
Sent: Tuesday, July 22, 2008 6:03 PM
Subject: Re: [Resending - PATCH 1/3] Triton BCI driver board/device setup for 
OMAP3430


 Hi,
 
 
 On Tue, 22 Jul 2008 17:25:33 +0530 (IST), Madhusudhan Chikkature
 [EMAIL PROTECTED] wrote:
  extern void sdp3430_usb_init(void);
 
 Tony, weird that we still have these prototypes in these headers.
 Could be some merging conflict ?
 
 Anyways, please apply the attached patch. We're using
 usb_musb_init() and usb_ehci_init() now.
 
 
 
 -- 
 Best Regards,
 
 Felipe Balbi
 http://blog.felipebalbi.com
 [EMAIL PROTECTED]
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Resending - PATCH 2/3] Triton BCI driver for OMAP3430

2008-07-09 Thread Madhusudhan Chikkature
Hi Mikko,

Thanks for the comments.

I have inlined my answers.

Regards,
Madhu
- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: linux-omap@vger.kernel.org; [EMAIL PROTECTED]
Sent: Monday, July 07, 2008 6:34 PM
Subject: RE: [Resending - PATCH 2/3] Triton BCI driver for OMAP3430


Hi, 

Some comments inlined below.

-Original Message-
From: Madhusudhan Chikkature[EMAIL PROTECTED]

ARM: OMAP: Triton Battery Charger Interface

This patch provides a OMAP Triton battery charger interface 
driver to moniter
the battery
through power class subsystem.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/power/Kconfig   |8
 drivers/power/Makefile  |1
 drivers/power/twl4030_bci_battery.c | 1139 

 3 files changed, 1148 insertions(+)

Index: linux-omap-2.6/drivers/power/Kconfig
===
--- linux-omap-2.6.orig/drivers/power/Kconfig 2008-06-16 
16:46:52.0 +0530
+++ linux-omap-2.6/drivers/power/Kconfig 2008-06-27 
16:01:08.0 +0530
@@ -70,4 +70,12 @@ config BATTERY_BQ27200
 help
   Say Y here to enable support for batteries with 
BQ27200(I2C) chip.

+config TWL4030_BCI_BATTERY
+ tristate OMAP TWL4030 BCI Battery driver
+ depends on (MACH_OMAP_2430SDP || MACH_OMAP_3430SDP)  
TWL4030_CORE
+ default y
+ help
+   Support for OMAP TWL4030 BCI Battery driver.
+   This driver can give support for TWL4030 Battery 
Charge Interface.
+
 endif # POWER_SUPPLY
Index: linux-omap-2.6/drivers/power/Makefile
===
--- linux-omap-2.6.orig/drivers/power/Makefile 2008-06-16 
16:46:52.0 +0530
+++ linux-omap-2.6/drivers/power/Makefile 2008-06-27 
15:53:29.0 +0530
@@ -21,3 +21,4 @@ obj-$(CONFIG_BATTERY_DS2760) += ds2760_b
 obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
 obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
 obj-$(CONFIG_BATTERY_BQ27x00)   += bq27x00_battery.o
+obj-$(CONFIG_TWL4030_BCI_BATTERY) += twl4030_bci_battery.o
Index: linux-omap-2.6/drivers/power/twl4030_bci_battery.c
===
--- /dev/null 1970-01-01 00:00:00.0 +
+++ linux-omap-2.6/drivers/power/twl4030_bci_battery.c 2008-07-03
16:10:11.0 +0530
@@ -0,0 +1,1139 @@
+/*
+ * linux/drivers/power/twl4030_bci_battery.c
+ *
+ * OMAP2430/3430 BCI battery driver for Linux
+ *
+ * Copyright (C) 2008 Texas Instruments, Inc.
+ * Author: Texas Instruments, Inc.
+ *
+ * This package is free software; you can redistribute it 
and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#include linux/init.h
+#include linux/module.h
+#include linux/device.h
+#include linux/interrupt.h
+#include linux/delay.h
+#include linux/platform_device.h
+#include linux/i2c/twl4030.h
+#include linux/power_supply.h
+
+#define T2_BATTERY_VOLT 0x04
+#define T2_BATTERY_TEMP 0x06
+#define T2_BATTERY_CUR 0x08
+
+/* charger constants */
+#define NO_PW_CONN 0
+#define AC_PW_CONN 0x01
+#define USB_PW_CONN 0x02
+
+/* TWL4030_MODULE_USB */
+#define REG_POWER_CTRL 0x0AC
+#define OTG_EN 0x020
+#define REG_PHY_CLK_CTRL 0x0FE
+#define REG_PHY_CLK_CTRL_STS 0x0FF
+#define PHY_DPLL_CLK 0x01
+
+#define REG_BCICTL1 0x023
+#define REG_BCICTL2 0x024
+#define CGAIN 0x020
+#define ITHEN 0x010
+#define ITHSENS 0x007
+
+/* Boot BCI flag bits */
+#define BCIAUTOWEN 0x020
+#define CONFIG_DONE 0x010
+#define BCIAUTOUSB 0x002
+#define BCIAUTOAC 0x001
+#define BCIMSTAT_MASK 0x03F
+
+/* Boot BCI register */
+#define REG_BOOT_BCI 0x007
+#define REG_CTRL1 0x00
+#define MADC_ON 0x01
+#define REG_SW1SELECT_MSB 0x07
+#define SW1_CH9_SEL 0x02
+#define REG_CTRL_SW1 0x012
+#define SW1_TRIGGER 0x020
+#define EOC_SW1 0x002
+#define REG_GPCH9 0x049
+#define REG_STS_HW_CONDITIONS 0x0F
+#define STS_VBUS 0x080
+#define STS_CHG 0x02
+#define REG_BCIMSTATEC 0x02
+#define REG_BCIMFSTS4 0x010
+#define REG_BCIMFSTS2 0x00E
+#define REG_BCIMFSTS3 0x00F
+#define REG_BCIMFSTS1 0x001
+#define USBFASTMCHG 0x004
+#define BATSTSPCHG 0x004
+#define BATSTSMCHG 0x040
+#define VBATOV4 0x020
+#define VBATOV3 0x010
+#define VBATOV2 0x008
+#define VBATOV1 0x004
+#define MADC_LSB_MASK 0xC0
+#define REG_BB_CFG 0x012
+#define BBCHEN 0x010
+
+/* Power supply charge interrupt */
+#define REG_PWR_ISR1 0x00
+#define REG_PWR_IMR1 0x01
+#define REG_PWR_EDR1 0x05
+#define REG_PWR_SIH_CTRL 0x007
+
+#define USB_PRES 0x004
+#define CHG_PRES 0x002
+
+#define USB_PRES_RISING 0x020
+#define USB_PRES_FALLING 0x010
+#define CHG_PRES_RISING 0x008
+#define CHG_PRES_FALLING 0x004
+#define AC_STATEC 0x20
+#define COR 0x004
+
+/* interrupt status

[Resending - PATCH 1/3] Triton BCI driver device setup for OMAP3430

2008-07-03 Thread Madhusudhan Chikkature
Hi Tony,

I am resending the BCI patch series after fixing the comments provided by 
Filipe.

Regards,
Madhu
-

From: Madhusudhan Chikkature[EMAIL PROTECTED]

Device setup/initialization for the Triton battery charger interface driver for
the OMAP3430 SDP.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 arch/arm/mach-omap2/Makefile  |3 +-
 arch/arm/mach-omap2/bci.c |   34 ++
 arch/arm/mach-omap2/board-3430sdp.c   |1
 include/asm-arm/arch-omap/board-3430sdp.h |1
 4 files changed, 38 insertions(+), 1 deletion(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/Makefile
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/Makefile2008-07-03
16:58:02.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/Makefile 2008-07-03 16:58:30.0
+0530
@@ -47,7 +47,8 @@ obj-$(CONFIG_MACH_OMAP_3430SDP)   += boar
   hsmmc.o \
   usb-musb.o \
   usb-ehci.o \
-  board-3430sdp-flash.o
+  board-3430sdp-flash.o \
+  bci.o
 obj-$(CONFIG_MACH_OMAP3EVM)+= board-omap3evm.o \
   hsmmc.o \
   usb-musb.o usb-ehci.o \
Index: linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/board-3430sdp.c 2008-07-03
16:58:02.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c  2008-07-03
16:58:30.0 +0530
@@ -299,6 +299,7 @@ static void __init omap_3430sdp_init(voi
ARRAY_SIZE(sdp3430_spi_board_info));
ads7846_dev_init();
sdp3430_flash_init();
+   twl4030_bci_battery_init();
omap_serial_init();
usb_musb_init();
usb_ehci_init();
Index: linux-omap-2.6/include/asm-arm/arch-omap/board-3430sdp.h
===
--- linux-omap-2.6.orig/include/asm-arm/arch-omap/board-3430sdp.h   
2008-07-03
16:58:02.0 +0530
+++ linux-omap-2.6/include/asm-arm/arch-omap/board-3430sdp.h2008-07-03
16:58:30.0 +0530
@@ -31,6 +31,7 @@

 extern void sdp3430_usb_init(void);
 extern void sdp3430_flash_init(void);
+extern void twl4030_bci_battery_init(void);

 #define DEBUG_BASE 0x0800  /* debug board */

Index: linux-omap-2.6/arch/arm/mach-omap2/bci.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-omap-2.6/arch/arm/mach-omap2/bci.c2008-07-03 16:59:40.0 
+0530
@@ -0,0 +1,34 @@
+/*
+ * linux/arch/arm/mach-omap2/board-3430sdp-bci.c
+ *
+ * TWL4030 BCI platform device setup/initialization
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include linux/module.h
+#include linux/kernel.h
+#include linux/init.h
+#include linux/platform_device.h
+
+#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
+   defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
+
+static struct platform_device twl4030_bci_battery_device = {
+   .name   = twl4030-bci-battery,
+   .id = 1,
+   .num_resources  = 0,
+};
+
+void __init twl4030_bci_battery_init(void)
+{
+   (void) platform_device_register(twl4030_bci_battery_device);
+}
+#else
+void __init twl4030_bci_battery_init(void)
+{
+}
+#endif


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Resending - PATCH 3/3] Triton BCI driver for OMAP3430 - USB changes

2008-07-03 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

This patch calls the functionality supported by the TWL4030 battery charger
interface driver
to enable/disable battery charging upon cable attach/detach.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/i2c/chips/twl4030-usb.c |7 +--
 include/linux/i2c/twl4030.h |7 +++
 2 files changed, 12 insertions(+), 2 deletions(-)

Index: linux-omap-2.6/drivers/i2c/chips/twl4030-usb.c
===
--- linux-omap-2.6.orig/drivers/i2c/chips/twl4030-usb.c 2008-07-03
16:09:05.0 +0530
+++ linux-omap-2.6/drivers/i2c/chips/twl4030-usb.c  2008-07-03
17:03:30.0 +0530
@@ -601,10 +601,13 @@ static irqreturn_t twl4030_usb_irq(int i
goto done;
}

-   if (val  USB_PRES_RISING)
+   if (val  USB_PRES_RISING) {
twl4030_phy_resume();
-   else
+   twl4030charger_usb_en(1);
+   } else {
+   twl4030charger_usb_en(0);
twl4030_phy_suspend(0);
+   }

ret = IRQ_HANDLED;

Index: linux-omap-2.6/include/linux/i2c/twl4030.h
===
--- linux-omap-2.6.orig/include/linux/i2c/twl4030.h 2008-07-03
16:09:05.0 +0530
+++ linux-omap-2.6/include/linux/i2c/twl4030.h  2008-07-03 17:03:30.0 
+0530
@@ -127,4 +127,11 @@ int twl4030_set_gpio_edge_ctrl(int gpio,
 int twl4030_set_gpio_debounce(int gpio, int enable);
 int twl4030_free_gpio(int gpio);

+#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
+   defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
+   extern int twl4030charger_usb_en(int enable);
+#else
+   static inline int twl4030charger_usb_en(int enable) { return 0; }
+#endif
+
 #endif /* End of __TWL4030_H */


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Resending - PATCH 1/3] Triton BCI driver device setup for OMAP3430

2008-07-03 Thread Madhusudhan Chikkature
Hi Tony,

I fixed couple of minor comments from Filipe.

Regards,
Madhu



From: Madhusudhan Chikkature[EMAIL PROTECTED]

Device setup/initialization for the Triton battery charger interface driver for
the OMAP3430 SDP.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 arch/arm/mach-omap2/Makefile  |3 +-
 arch/arm/mach-omap2/bci.c |   34 ++
 arch/arm/mach-omap2/board-3430sdp.c   |1
 include/asm-arm/arch-omap/board-3430sdp.h |1
 4 files changed, 38 insertions(+), 1 deletion(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/Makefile
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/Makefile2008-07-03
16:58:02.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/Makefile 2008-07-03 16:58:30.0
+0530
@@ -47,7 +47,8 @@ obj-$(CONFIG_MACH_OMAP_3430SDP)   += boar
   hsmmc.o \
   usb-musb.o \
   usb-ehci.o \
-  board-3430sdp-flash.o
+  board-3430sdp-flash.o \
+  bci.o
 obj-$(CONFIG_MACH_OMAP3EVM)+= board-omap3evm.o \
   hsmmc.o \
   usb-musb.o usb-ehci.o \
Index: linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c
===
--- linux-omap-2.6.orig/arch/arm/mach-omap2/board-3430sdp.c 2008-07-03
16:58:02.0 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c  2008-07-03
16:58:30.0 +0530
@@ -299,6 +299,7 @@ static void __init omap_3430sdp_init(voi
ARRAY_SIZE(sdp3430_spi_board_info));
ads7846_dev_init();
sdp3430_flash_init();
+   twl4030_bci_battery_init();
omap_serial_init();
usb_musb_init();
usb_ehci_init();
Index: linux-omap-2.6/include/asm-arm/arch-omap/board-3430sdp.h
===
--- linux-omap-2.6.orig/include/asm-arm/arch-omap/board-3430sdp.h   
2008-07-03
16:58:02.0 +0530
+++ linux-omap-2.6/include/asm-arm/arch-omap/board-3430sdp.h2008-07-03
16:58:30.0 +0530
@@ -31,6 +31,7 @@

 extern void sdp3430_usb_init(void);
 extern void sdp3430_flash_init(void);
+extern void twl4030_bci_battery_init(void);

 #define DEBUG_BASE 0x0800  /* debug board */

Index: linux-omap-2.6/arch/arm/mach-omap2/bci.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-omap-2.6/arch/arm/mach-omap2/bci.c2008-07-03 19:40:37.0 
+0530
@@ -0,0 +1,34 @@
+/*
+ * linux/arch/arm/mach-omap2/bci.c
+ *
+ * TWL4030 BCI platform device setup/initialization
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include linux/module.h
+#include linux/kernel.h
+#include linux/init.h
+#include linux/platform_device.h
+
+#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
+   defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
+
+static struct platform_device twl4030_bci_battery_device = {
+   .name   = twl4030-bci-battery,
+   .id = -1,
+   .num_resources  = 0,
+};
+
+void __init twl4030_bci_battery_init(void)
+{
+   (void) platform_device_register(twl4030_bci_battery_device);
+}
+#else
+void __init twl4030_bci_battery_init(void)
+{
+}
+#endif


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/PATCH 1/2] Triton Battery charger interface driver forOMAP3430

2008-06-24 Thread Madhusudhan Chikkature

- Original Message - 
From: Tony Lindgren [EMAIL PROTECTED]
To: Felipe Balbi [EMAIL PROTECTED]
Cc: Madhusudhan Chikkature [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
linux-omap@vger.kernel.org
Sent: Tuesday, June 24, 2008 1:20 PM
Subject: Re: [RFC/PATCH 1/2] Triton Battery charger interface driver forOMAP3430


* Felipe Balbi [EMAIL PROTECTED] [080623 17:53]:
 Hi,
 
 On Mon, 23 Jun 2008 19:04:51 +0530, Madhusudhan Chikkature
 [EMAIL PROTECTED] wrote:
 
  On Fri, 20 Jun 2008 17:33:41 +0530 (IST), [EMAIL PROTECTED]
  wrote:
 
  Index: linux-omap-2.6/arch/arm/mach-omap2/devices.c
  ===
  --- linux-omap-2.6.orig/arch/arm/mach-omap2/devices.c 2008-06-20
  15:39:56.0 +0530
  +++ linux-omap-2.6/arch/arm/mach-omap2/devices.c 2008-06-20
  15:42:05.0
  +0530
  @@ -358,6 +358,22 @@
   static inline void omap_hdq_init(void) {}
   #endif
 
  +#ifdef CONFIG_TWL4030_BCI_BATTERY
  +static struct platform_device omap_bci_battery_device = {
  + .name   = twl4030-bci-battery,
  + .id = 1,
  + .num_resources  = 0,
  + .resource   = NULL,
 
  if you pass the struct resources you can use __raw_{read,write} which
  would simplify a lot for you, but if you really don't want it, you
  don't have to initialize it to NULL. Just because it's static, it's
  enough for it to get NULLed.
  The battery driver uses twl4030_i2c_read_u8 and twl4030_i2c_write_u8 as
  low level interface(I2C) with
  standard twl4030.h defines. So no point of  _raw(read,write) and BASE
  address getting initialized through resource structure. Right?.
  I agree with your second point of no need to explicitely setting it to
  NULL though.
 
 The idea was to actually get rid of the i2c transfers and use
 __raw_read/write
 instead, but I suppose it's ok to use i2c transfers
 
 Hmm, I guess the only way to access twl4030 is via i2c :) So
 __raw_read/write would not work for the twl4030 registers.
 
 
  +};
  +
  +static inline void omap_bci_battery_init(void)
  +{
  + (void) platform_device_register(omap_bci_battery_device);
  +}
  +#else
  +static inline void omap_bci_battery_init(void) {}
  +#endif
  +
 
 don't remember if I said on last mail, but this ifdef should be in
 a header file. Maybe include/linux/i2c/twl4030.h
 
  How about creating a special battery.c for this just like usb-musb.c,
  usb-ehci.c
  and hsmmc.c, so it's easier to reuse it and add such support only for
  boards that
  has twl4030.
 
  It would be useful for omap multiboot, I suppose.
  I had put these under devices.c as there is not much board level
  configurations for BCI unlike hsmmc.
  I guess I can add a simple board file for battery that way it can used
  based on TWL4030 if it is a good idea.
 
 I would like to hear from Tony and the others what do they think?
 would it be worthy adding an extra file for bci ??
 
 Tony, comments?
 
 Well I guess some people are not using the bci, so it could be a
 separate module.
Okay. I will add a seperate file for BCI.

Regards,
Madhu
 
 
 INIT_DELAYED_WORK_DEFERRABLE()???
  Do you mean INIT_DELAYED_WORK_DEFERRABLE() is a better choice here??
 
 Yes, as it could be deferred on suspend/resume. I think INIT_DELAYED_WORK
 also blocks dynamic pm ?!?
 
 Maybe Jouni could clarify this one better. Jouni, any comments?
 
 
 -- 
 Best Regards,
 
 Felipe Balbi
 http://felipebalbi.com
 [EMAIL PROTECTED]
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/PATCH 1/2] Triton Battery charger interface driver for OMAP3430

2008-06-23 Thread Madhusudhan Chikkature
Hi Felipe,

Thanks for the comments. I will fix them and resend the patch.I have some 
clarification inlined for some of the comments.

Best regards,
Madhu
- Original Message - 
From: Felipe Balbi [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: linux-omap@vger.kernel.org
Sent: Monday, June 23, 2008 2:19 PM
Subject: Re: [RFC/PATCH 1/2] Triton Battery charger interface driver for 
OMAP3430


 
 
 On Fri, 20 Jun 2008 17:33:41 +0530 (IST), [EMAIL PROTECTED]
 wrote:
 
 Index: linux-omap-2.6/arch/arm/mach-omap2/devices.c
 ===
 --- linux-omap-2.6.orig/arch/arm/mach-omap2/devices.c 2008-06-20
 15:39:56.0 +0530
 +++ linux-omap-2.6/arch/arm/mach-omap2/devices.c 2008-06-20
 15:42:05.0
 +0530
 @@ -358,6 +358,22 @@
  static inline void omap_hdq_init(void) {}
  #endif
 
 +#ifdef CONFIG_TWL4030_BCI_BATTERY
 +static struct platform_device omap_bci_battery_device = {
 + .name   = twl4030-bci-battery,
 + .id = 1,
 + .num_resources  = 0,
 + .resource   = NULL,
 
 if you pass the struct resources you can use __raw_{read,write} which
 would simplify a lot for you, but if you really don't want it, you
 don't have to initialize it to NULL. Just because it's static, it's
 enough for it to get NULLed.
The battery driver uses twl4030_i2c_read_u8 and twl4030_i2c_write_u8 as low 
level interface(I2C) with
standard twl4030.h defines. So no point of  _raw(read,write) and BASE address 
getting initialized through resource structure. Right?.
I agree with your second point of no need to explicitely setting it to NULL 
though.

 
 +};
 +
 +static inline void omap_bci_battery_init(void)
 +{
 + (void) platform_device_register(omap_bci_battery_device);
 +}
 +#else
 +static inline void omap_bci_battery_init(void) {}
 +#endif
 +
 
 How about creating a special battery.c for this just like usb-musb.c,
 usb-ehci.c
 and hsmmc.c, so it's easier to reuse it and add such support only for
 boards that
 has twl4030.
 
 It would be useful for omap multiboot, I suppose.
I had put these under devices.c as there is not much board level configurations 
for BCI unlike hsmmc.
I guess I can add a simple board file for battery that way it can used based on 
TWL4030 if it is a good idea.

 
 

 /*-*/
 
  static int __init omap2_init_devices(void)
 @@ -369,6 +385,7 @@
  omap_init_mbox();
  omap_init_mcspi();
  omap_hdq_init();
 + omap_bci_battery_init();
 
 And this would be added to board-files.
Agreed considering the above point.
 
  omap_init_sti();
  omap_init_sha1_md5();
 
 Index: linux-omap-2.6/drivers/power/Kconfig
 ===
 --- linux-omap-2.6.orig/drivers/power/Kconfig 2008-06-20
 15:39:56.0 +0530
 +++ linux-omap-2.6/drivers/power/Kconfig 2008-06-20 15:42:05.0
 +0530
 @@ -70,4 +70,12 @@
  help
Say Y here to enable support for batteries with BQ27200(I2C) chip.
 
 +config TWL4030_BCI_BATTERY
 + bool OMAP TWL4030 BCI Battery driver
 
 I'm pretty sure this can be tristate. Did you try that ?
I agree. I can make it tristate.

 
 
 +struct twl4030_bci_device_info {
 + struct device *dev;
 +
 + unsigned long update_time;
 + int voltage_uV;
 + int bk_voltage_uV;
 + int current_uA;
 + int temp_C;
 + int charge_rsoc;
 + int charge_status;
 +
 + struct power_supply bat;
 + struct power_supply bk_bat;
 + struct delayed_work twl4030_bci_monitor_work;
 + struct delayed_work twl4030_bk_bci_monitor_work;
 +};
 +
 +static struct platform_driver twl4030_bci_battery_driver = {
 + .probe = twl4030_bci_battery_probe,
 + .remove = twl4030_bci_battery_remove,
 +#ifdef CONFIG_PM
 + .suspend = twl4030_bci_battery_suspend,
 + .resume = twl4030_bci_battery_resume,
 +#endif
 + .driver = {
 + .name = twl4030-bci-battery,
 + },
 
 how about tabifying these for better alignment ?
Okay.
 
 +
 +static int twl4030madc_sw1_trigger(void);
 +static int read_bci_val(u8 reg_1);
 +static inline int clear_n_set(u8 mod_no, u8 clear, u8 set, u8 reg);
 +static int twl4030charger_presence(void);
 +
 +/*
 + * Twl4030 battery temperature lookup table.
 + */
 +const int twl4030battery_temp_tbl [] =
 +{
 +/* 0 C*/
 +27100,
 +26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
 +17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
 +11600, 11200, 10800, 10400, 1, 9630,   9280,   8950,   8620,   8310,
 +8020,   7730,   7460,   7200,   6950,   6710,   6470,   6250,   6040,  
 5830,
 +5640,   5450,   5260,   5090,   4920,   4760,   4600,   4450,   4310,  
 4170,
 +4040,   3910,   3790,   3670,   3550
 +};
 +
 +/*
 + * Report and clear the charger presence event.
 + */
 +static inline int twl4030charger_presence_evt(void)
 +{
 + int ret;
 + u8 chg_sts, set = 0, clear = 0;
 +
 + /* read charger power supply status */
 + ret = twl4030_i2c_read_u8(TWL4030_MODULE_PM_MASTER, chg_sts,
 + REG_STS_HW_CONDITIONS);
 + if 

Re: [RFC/PATCH 2/2] Triton Battery charger interface driver for OMAP3430

2008-06-23 Thread Madhusudhan Chikkature
Hi Felipe,

Thanks for the comments. I will fix it and resend the patch.

Best regards,
Madhu
- Original Message - 
From: Felipe Balbi [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: linux-omap@vger.kernel.org
Sent: Monday, June 23, 2008 2:21 PM
Subject: Re: [RFC/PATCH 2/2] Triton Battery charger interface driver for 
OMAP3430


 
 
 On Fri, 20 Jun 2008 17:36:00 +0530 (IST), [EMAIL PROTECTED]
 wrote:
 
 +#ifdef CONFIG_TWL4030_BCI_BATTERY
 +extern int twl4030charger_usb_en(int enable);
 +#else
 +static inline int twl4030charger_usb_en(int enable) { return 0; }
 +#endif
 
 this should be in include/linux/i2c/twl4030.h
 you should also change it for when bci is built as a
 dynamically linked module.
Okay. Good point.
 
 -- 
 Best Regards,
 
 Felipe Balbi
 http://felipebalbi.com
 [EMAIL PROTECTED]
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 7/8] 34XX: PM: Workaround to disable mmc

2008-06-17 Thread Madhusudhan Chikkature


- Original Message - 
From: Högander Jouni [EMAIL PROTECTED]

To: ext Felipe Balbi [EMAIL PROTECTED]
Cc: linux-omap@vger.kernel.org
Sent: Tuesday, June 17, 2008 5:39 PM
Subject: Re: [PATCH 7/8] 34XX: PM: Workaround to disable mmc



ext Felipe Balbi [EMAIL PROTECTED] writes:


On Tue, 17 Jun 2008 10:31:11 +0300, Jouni Hogander
[EMAIL PROTECTED] wrote:

Current hsmmc is not pm friendly. Disable it because it prevents omap3
retention


Disabling will just hide the bug. Better making it modular
and let mmc guys dig on it.


Ok, I can change it, if this set needs to be sent again. I think
disabling mmc increases visibility of its PM problems. I mean missing
mmc driver is more visible than missing PM in this case.



What do you need to make it more pm friendly?


Not to prevent omap retention.
When are you expecting the omap to go into retention? Is it in the suspend 
path?


Regards,
Madhu




--
Best Regards,

Felipe Balbi
http://felipebalbi.com
[EMAIL PROTECTED]





--
Jouni Högander

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: MMC/SD cards hotplug scenario

2008-05-21 Thread Madhusudhan Chikkature Rajashekar
 

 -Original Message-
 From: Russell King - ARM Linux [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, May 21, 2008 1:00 PM
 To: Madhusudhan Chikkature Rajashekar
 Cc: 'Pierre Ossman'; linux-omap@vger.kernel.org; 
 [EMAIL PROTECTED]
 Subject: Re: MMC/SD cards hotplug scenario
 
 On Wed, May 21, 2008 at 11:42:04AM +0530, Madhusudhan 
 Chikkature Rajashekar wrote:
  After the end of the I/O errors I can umount the partition that was
  mounted and I reinsert the card.
 
 That's rather expected - outstanding IO has to be errored when the
 medium is removed.
Yes. I got your point. But can this be made to through few I/O errors and stop 
instead of resulting in I/O errors for the rest of
the data?
In the case where data copied is huge, for eg 500MB, the I/O errors are quite 
lot.

 
  It seem not to work very well consistently.
 
 Vague handwaving comment with no useful information.  What 
 precisely is
 the problem that you're seeing?
 
What I meant here is that reinsertion of the card does not seem to result in 
reinitialization of the card consistently.

Details of few things I noticed is listed below stepwise and to start with card 
is detected and mounted on mount point /mnt/mmc dir.

1. Start copy of data.
2. Removed the card in the middle of transfer. At the controller driver level 
this generated card removed interrupt. The
mmc_detect_change fn called.
3. I/O Errors generated.
4. Reinsert the card. This generated card inserted interrupt. The mmc_detect_fn 
called. But the card does not seem to be
reinitialized correctly.
   cat /proc/partitions does not list mmc partitions.

The attached log shows that out of 3 trails, it seem to work fine correctly 2 
times and failed the third time.

So my question is for the above scenario does the MMC/SD core need to take care 
of anything explicitely or should this be fixed at
the controller
driver level?

Regards,
Madhu
p -a      cp -a /etc/ /mnt/mmc/

 + MMC CARD REMOVED + 
mmc0: card 981b removed
mmcblk0: error -110 sending read/write command
end_request: I/O error, dev mmcblk0, sector 3928
mmcblk0: error -110 sending read/write command
end_request: I/O error, dev mmcblk0, sector 48
Buffer I/O error on device mmcblk0p1, logical block 4
lost page write due to I/O error on mmcblk0p1
mmcblk0: error -110 sending read/write command
end_request: I/O error, dev mmcblk0, sector 16
Buffer I/O error on device mmcblk0p1, logical block 0
lost page write due to I/O error on mmcblk0p1
end_request: I/O error, dev mmcblk0, sector 24
Buffer I/O error on device mmcblk0p1, logical block 1
lost page write due to I/O error on mmcblk0p1
mmcblk0: error -110 sending read/write command
WARNING: at fs/buffer.c:1169 mark_buffer_dirty()
[c0033400] (dump_stack+0x0/0x14) from [c00d21ac] 
(mark_buffer_dirty+0x44/0xb8)
[c00d2168] (mark_buffer_dirty+0x0/0xb8) from [c0108ae4] 
(group_adjust_blocks+0x38/0x3c)
 r5:0008 r4:
[c0108aac] (group_adjust_blocks+0x0/0x3c) from [c0109778] 
(ext2_new_blocks+0x3fc/0x5cc)
[c010937c] (ext2_new_blocks+0x0/0x5cc) from [c010d100] 
(ext2_get_block+0x2bc/0x69c)
[c010ce44] (ext2_get_block+0x0/0x69c) from [c00d2f70] 
(__block_prepare_write+0x18c/0x414)
[c00d2de4] (__block_prepare_write+0x0/0x414) from [c00d32e4] 
(block_write_begin+0x90/0x108)
[c00d3254] (block_write_begin+0x0/0x108) from [c010cdf4] 
(__ext2_write_begin+0x3c/0x48)
[c010cdb8] (__ext2_write_begin+0x0/0x48) from [c010ce3c] 
(ext2_write_begin+0x3c/0x44)
[c010ce00] (ext2_write_begin+0x0/0x44) from [c009185c] 
(generic_file_buffered_write+0x10c/0x5f0)
[c0091750] (generic_file_buffered_write+0x0/0x5f0) from [c0092168] 
(__generic_file_aio_write_nolock+0x428/0x478)
[c0091d40] (__generic_file_aio_write_nolock+0x0/0x478) from [c009222c] 
(generic_file_aio_write+0x74/0xe8)
[c00921b8] (generic_file_aio_write+0x0/0xe8) from [c00b08d0] 
(do_sync_write+0xbc/0x10c)
[c00b0814] (do_sync_write+0x0/0x10c) from [c00b11b8] (vfs_write+0xb8/0x148)
[c00b1100] (vfs_write+0x0/0x148) from [c00b1784] (sys_write+0x44/0x70)
 r7:1000 r6:c7c1ff20 r5: r4:
[c00b1740] (sys_write+0x0/0x70) from [c002ee60] (ret_fast_syscall+0x0/0x2c)
 r8:c002f66c r7:0004 r6:0004 r5:be8aa148 r4:1000
end_request: I/O error, dev mmcblk0, sector 1048592
Buffer I/O error on device mmcblk0p1, logical block 131072
lost page write due to I/O error on mmcblk0p1
end_request: I/O error, dev mmcblk0, sector 1048600
Buffer I/O error on device mmcblk0p1, logical block 131073
lost page write due to I/O error on mmcblk0p1
end_request: I/O error, dev mmcblk0, sector 1048608
Buffer I/O error on device mmcblk0p1, logical block 131074
lost page write due to I/O error on mmcblk0p1
end_request: I/O error, dev mmcblk0, sector 1048616
Buffer I/O error on device mmcblk0p1, logical block 131075
lost page write due to I/O error on mmcblk0p1
end_request: I/O error, dev mmcblk0, sector 1048624
Buffer I/O error on device mmcblk0p1, logical block 131076
lost page write due

RE: sdio cmd53 doesn't work on omap 2430sdp

2008-05-21 Thread Madhusudhan Chikkature Rajashekar
Hi,

Please use the vger list.

It seems like you are getting DTO on CMD53.

One thing you might want to check is did the card configuration path went fine 
before you issue CMD53.
Before your card driver issues CMD53, I guess the SDIO core issues a series of 
CMD52 to read the card capabilities and
Setup the bus width etc... Does these go through fine for the card you are 
using? Does the core detect the new SDIO card?

Regards,
Madhu




 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On 
 Behalf Of Dmitriy Chumak
 Sent: Wednesday, May 21, 2008 5:51 PM
 To: [EMAIL PROTECTED]
 Subject: sdio cmd53 doesn't work on omap 2430sdp
 
 Hi *,
 
 I write an SDIO driver on OMAP 2430SDP platform.
 
 I have two question related to MMC subsystem:
 
 1. When I issue sdio_readw (or other function that ends up
using CMD53 sdio command) - it hangs. This happens because func
mmc_wait_for_req waits for request completion that 
 should be signaled
by calling mmc_wait_done. mmc_wait_done is indirectly 
 called from
mmc_omap_cmd_done if condition host-data == NULL || 
 cmd-error
(file: drivers/mmc/host/omap_hsmmc.c, line: 273) is 
 true. In my case
the above condition is not true because host-data is 
 not NULL and
cmd-error is NULL. Why this could be happen. Which 
 code is responsible
for setting host-data to NULL in case of successful 
 sdio command
completion?
 
 2. Also when I issue sdio_readw - I get an error status 108001 in
mmc_omap_irq. If I've decoded it correctly it means CC, ERR and
DATA_TIMEOUT. What does it means and when this could 
 be happened?

 
 Best regards,
 
 Dmitriy
 ___
 Linux-omap-open-source mailing list
 [EMAIL PROTECTED]
 http://linux.omap.com/mailman/listinfo/linux-omap-open-source
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC/PATCH] BQ27000/BQ27200 battery monitoring driver for OMAP34xx

2008-04-29 Thread Madhusudhan Chikkature Rajashekar
 

 -Original Message-
 From: Felipe Balbi [mailto:[EMAIL PROTECTED] 
 Sent: Monday, April 28, 2008 5:17 PM
 To: Madhusudhan Chikkature Rajashekar
 Cc: Tony Lindgren; linux-omap@vger.kernel.org
 Subject: RE: [RFC/PATCH] BQ27000/BQ27200 battery monitoring 
 driver for OMAP34xx
 
 
 
 On Mon, 28 Apr 2008 17:11:51 +0530, Madhusudhan Chikkature 
 Rajashekar
 [EMAIL PROTECTED] wrote:
  Hi Felipe,
  
  Thanks for the comments. I will fix them and resend the patch.
  
  Please note my view on the below point.
  
   -pdev = platform_device_alloc(omap-bq2700-battery, id);
   +pdev = platform_device_alloc(bq27000-bat, id);
 
  do you really need to change the name here?
  It seems that this change doesn't belong to this patch.
  
  I will make this as a separate patch.As BQ27000 chip is not omap
 specific,
  I guess the above name is not correct. Hence I intend to make that
 change.
 
 Ok, works for me :-)
 
 I guess bq2700-battery is ok, just remove omap- from the 
 previous name??
Yes. I will correct the name and resend the patch. I will send this one as a 
separate patch and followed by it will
be the battery driver patch.

 
 
 -- 
 Best Regards,
 
 Felipe Balbi
 http://felipebalbi.com
 [EMAIL PROTECTED]
 
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Resending: [PATCH] BQ27000/BQ27200 battery monitoring driver for OMAP34xx

2008-04-29 Thread Madhusudhan Chikkature Rajashekar
Hi,

I am resending the patch after fixing the comments provided by Felipe.

Regards,
Madhu

This patch provides the battery driver to support BQ27000 and BQ27200 chips.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]

---
 drivers/power/Kconfig   |   21 +
 drivers/power/Makefile  |1 
 drivers/power/bq27x00_battery.c |  564 
 3 files changed, 586 insertions(+)

Index: linux-omap-2.6/drivers/power/bq27x00_battery.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-omap-2.6/drivers/power/bq27x00_battery.c  2008-04-29 
11:27:42.962321458 +0530
@@ -0,0 +1,564 @@
+/*
+ * linux/drivers/power/bq27x00_battery.c
+ *
+ * BQ27000/BQ27200 battery driver
+ *
+ * Copyright (C) 2008 Texas Instruments, Inc.
+ *
+ * Author: Texas Instruments
+ *
+ * This package is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+#include linux/module.h
+#include linux/param.h
+#include linux/jiffies.h
+#include linux/workqueue.h
+#include linux/delay.h
+#include linux/platform_device.h
+#include linux/power_supply.h
+
+#ifdef CONFIG_BATTERY_BQ27000
+#include ../w1/w1.h
+#endif
+#ifdef CONFIG_BATTERY_BQ27200
+#include linux/i2c.h
+#endif
+
+#define BQ27x00_REG_TEMP   0x06
+#define BQ27x00_REG_VOLT   0x08
+#define BQ27x00_REG_RSOC   0x0B /* Relative State-of-Charge */
+#define BQ27x00_REG_AI 0x14
+#define BQ27x00_REG_FLAGS  0x0A
+#define HIGH_BYTE(A)   ((A)  8)
+
+#ifdef CONFIG_BATTERY_BQ27000
+extern int w1_bq27000_read(struct device *dev, u8 reg);
+#endif
+
+struct bq27x00_device_info;
+struct bq27x00_access_methods {
+   int (*read)(u8 reg, int *rt_value, int b_single,
+   struct bq27x00_device_info *di);
+};
+
+struct bq27x00_device_info {
+   struct device   *dev;
+#ifdef CONFIG_BATTERY_BQ27000
+   struct device   *w1_dev;
+#endif
+#ifdef CONFIG_BATTERY_BQ27200
+   struct i2c_client *client;
+#endif
+   unsigned long   update_time;
+   int voltage_uV;
+   int current_uA;
+   int temp_C;
+   int charge_rsoc;
+   struct bq27x00_access_methods   *bus;
+   struct power_supply bat;
+   struct delayed_work monitor_work;
+};
+
+static unsigned int cache_time = 6;
+module_param(cache_time, uint, 0644);
+MODULE_PARM_DESC(cache_time, cache time in milliseconds);
+
+static enum power_supply_property bq27x00_battery_props[] = {
+   POWER_SUPPLY_PROP_PRESENT,
+   POWER_SUPPLY_PROP_VOLTAGE_NOW,
+   POWER_SUPPLY_PROP_CURRENT_NOW,
+   POWER_SUPPLY_PROP_CHARGE_NOW,
+   POWER_SUPPLY_PROP_CAPACITY,
+   POWER_SUPPLY_PROP_TEMP,
+};
+
+static int bq27x00_read(u8 reg, int *rt_value, int b_single,
+   struct bq27x00_device_info *di);
+
+#ifdef CONFIG_BATTERY_BQ27000
+static int bq27000_battery_probe(struct platform_device *dev);
+static int bq27000_battery_remove(struct platform_device *dev);
+#ifdef CONFIG_PM
+static int bq27000_battery_suspend(struct platform_device *dev,
+   pm_message_t state);
+static int bq27000_battery_resume(struct platform_device *dev);
+#endif /* CONFIG_PM */
+
+static struct platform_driver bq27000_battery_driver = {
+   .probe = bq27000_battery_probe,
+   .remove = bq27000_battery_remove,
+#ifdef CONFIG_PM
+   .suspend = bq27000_battery_suspend,
+   .resume = bq27000_battery_resume,
+#endif /* CONFIG_PM */
+   .driver = {
+   .name = bq27000-battery,
+   },
+};
+#endif /* CONFIG_BATTERY_BQ27000 */
+
+#ifdef CONFIG_BATTERY_BQ27200
+static int bq27200_battery_probe(struct i2c_client *client);
+static int bq27200_battery_remove(struct i2c_client *client);
+#ifdef CONFIG_PM
+static int bq27200_battery_suspend(struct i2c_client *client,
+   pm_message_t mesg);
+static int bq27200_battery_resume(struct i2c_client *client);
+#endif /* CONFIG_PM */
+static struct i2c_driver bq27200_battery_driver = {
+   .driver = {
+   .name   = bq27200-bat,
+   },
+   .probe  = bq27200_battery_probe,
+   .remove = bq27200_battery_remove,
+#ifdef CONFIG_PM
+   .suspend = bq27200_battery_suspend,
+   .resume = bq27200_battery_resume,
+#endif /* CONFIG_PM */
+};
+#endif /* CONFIG_BATTERY_BQ27200 */
+
+/*
+ * Return the battery temperature in Celcius degrees
+ * Or  0 if something fails.
+ */
+static int bq27x00_battery_temperature(struct

[RFC/PATCH] BQ27000/BQ27200 battery monitoring driver for OMAP34xx

2008-04-25 Thread Madhusudhan Chikkature Rajashekar
This patch provides the battery monitoring driver to monitor batteries with 
BQ27000(HDQ) or BQ27200(i2C) chips.
On omap 3430 sdp BQ27000 battery is tested through the HDQ interface which uses 
the earlier posted HDQ and BQ slave drivers. 
The BQ27200 support is an extension to the BQ27000 driver as the register set 
between BQ27000 and BQ27200 is the same.

Thanks to Klaus.K Pedersen and Mikko Ylinen for the suggestions to add support 
for BQ27200 chip as part of
this driver.


Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]

---
 drivers/power/Kconfig   |   21 +
 drivers/power/Makefile  |1 
 drivers/power/bq27x00_battery.c |  556 
 drivers/w1/slaves/w1_bq27000.c  |2 
 4 files changed, 579 insertions(+), 1 deletion(-)

Index: linux-omap-2.6/drivers/power/bq27x00_battery.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-omap-2.6/drivers/power/bq27x00_battery.c  2008-04-24 
10:50:53.631358952 +0530
@@ -0,0 +1,556 @@
+/*
+ * linux/drivers/power/bq27x00_battery.c
+ *
+ * BQ27000/BQ27200 battery driver
+ *
+ * Copyright (C) 2008 Texas Instruments, Inc.
+ *
+ * Author: Texas Instruments
+ *
+ * This package is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+#include linux/module.h
+#include linux/param.h
+#include linux/jiffies.h
+#include linux/workqueue.h
+#include linux/delay.h
+#include linux/platform_device.h
+#include linux/power_supply.h
+
+#if defined(CONFIG_BATTERY_BQ27000)
+#define BATTERY_BQ27000
+#include ../w1/w1.h
+#endif
+#if defined(CONFIG_BATTERY_BQ27200)
+#define BATTERY_BQ27200
+#include linux/i2c.h
+#endif
+
+#define BQ27x00_REG_TEMP   0x06
+#define BQ27x00_REG_VOLT   0x08
+#define BQ27x00_REG_RSOC   0x0B /* Relative State-of-Charge */
+#define BQ27x00_REG_AI 0x14
+#define BQ27x00_REG_FLAGS  0x0A
+#define HIGH_BYTE(A)   ((A)  8)
+
+#if defined(BATTERY_BQ27000)
+extern int w1_bq27000_read(struct device *dev, u8 reg);
+#endif
+
+struct bq27x00_device_info;
+struct bq27x00_access_methods {
+   int (*read)(u8 reg, int *rt_value, int b_single,
+   struct bq27x00_device_info *di);
+};
+
+struct bq27x00_device_info {
+   struct device   *dev;
+#if defined(BATTERY_BQ27000)
+   struct device   *w1_dev;
+#endif
+#if defined(BATTERY_BQ27200)
+   struct i2c_client *client;
+#endif
+   unsigned long   update_time;
+   int voltage_uV;
+   int current_uA;
+   int temp_C;
+   int charge_rsoc;
+   struct bq27x00_access_methods   *bus;
+   struct power_supply bat;
+   struct delayed_work monitor_work;
+};
+
+static unsigned int cache_time = 6;
+module_param(cache_time, uint, 0644);
+MODULE_PARM_DESC(cache_time, cache time in milliseconds);
+
+static enum power_supply_property bq27x00_battery_props[] = {
+   POWER_SUPPLY_PROP_PRESENT,
+   POWER_SUPPLY_PROP_VOLTAGE_NOW,
+   POWER_SUPPLY_PROP_CURRENT_NOW,
+   POWER_SUPPLY_PROP_CHARGE_NOW,
+   POWER_SUPPLY_PROP_CAPACITY,
+   POWER_SUPPLY_PROP_TEMP,
+};
+
+static int bq27x00_read(u8 reg, int *rt_value, int b_single,
+   struct bq27x00_device_info *di);
+
+#if defined(BATTERY_BQ27000)
+static int bq27000_battery_probe(struct platform_device *dev);
+static int bq27000_battery_remove(struct platform_device *dev);
+#ifdef CONFIG_PM
+static int bq27000_battery_suspend(struct platform_device *dev,
+   pm_message_t state);
+static int bq27000_battery_resume(struct platform_device *dev);
+#endif
+
+static struct platform_driver bq27000_battery_driver = {
+   .probe = bq27000_battery_probe,
+   .remove = bq27000_battery_remove,
+#ifdef CONFIG_PM
+   .suspend = bq27000_battery_suspend,
+   .resume = bq27000_battery_resume,
+#endif
+   .driver = {
+   .name = bq27000-bat,
+   },
+};
+#endif
+
+#if defined(BATTERY_BQ27200)
+static int bq27200_battery_probe(struct i2c_client *client);
+static int bq27200_battery_remove(struct i2c_client *client);
+static int bq27200_battery_suspend(struct i2c_client *client,
+   pm_message_t mesg);
+static int bq27200_battery_resume(struct i2c_client *client);
+static struct i2c_driver bq27200_battery_driver = {
+   .driver = {
+   .name   = bq27200-bat,
+   },
+   .probe  = bq27200_battery_probe,
+   .remove = bq27200_battery_remove,
+#ifdef CONFIG_PM
+   .suspend = bq27200_battery_suspend

RE: [RFC/PATH] OMAP: HSMMC: Fixes for 1.8V MMC2 interface

2008-04-01 Thread Madhusudhan Chikkature Rajashekar
Hi,

I did not see any board level code to power up the second slot along with this 
patch.
Where is the code that enables 1.8V to the second slot?

Regards,
Madhu 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Seth Forshee
 Sent: Tuesday, April 01, 2008 6:22 AM
 To: Francisco Alecrim
 Cc: linux-omap@vger.kernel.org
 Subject: Re: [RFC/PATH] OMAP: HSMMC: Fixes for 1.8V MMC2 interface
 
 On Mon, Mar 31, 2008 at 11:45:21PM +0300, Francisco Alecrim wrote:
  Hello Seth,
 It's fine and work for 3430! Maybe you should resend 
 changing the 
  commit message. It's too big.
  
  Remove RFC from subject.
  
  What do you think?
  
  if(changes)
 Acked-by: Francisco Alecrim [EMAIL PROTECTED]
 
 Thank you for reviewing/testing.  I wanted to get 
 verification for OMAP3430
 before I officially submitted the patch, and since you have 
 done that I will
 submit it now.
 --
 To unsubscribe from this list: send the line unsubscribe 
 linux-omap in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC/PATH] OMAP: HSMMC: Fixes for 1.8V MMC2 interface

2008-04-01 Thread Madhusudhan Chikkature Rajashekar
 

 -Original Message-
 From: Francisco Alecrim [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, April 02, 2008 6:17 AM
 To: Madhusudhan Chikkature Rajashekar; linux-omap@vger.kernel.org
 Subject: Re: [RFC/PATH] OMAP: HSMMC: Fixes for 1.8V MMC2 interface
 
 ext Seth Forshee wrote:
  On Tue, Apr 01, 2008 at 08:44:47PM +0530, Madhusudhan 
 Chikkature Rajashekar wrote:

  Hi,
 
  I did not see any board level code to power up the second 
 slot along with this patch.
  Where is the code that enables 1.8V to the second slot?
  
 
  I am working with a custom board that isn't supported in 
 the git repo, and I
  don't have access to any other board that I could test such 
 changes with.
  These are just the chages I found were necessary to support 
 the 1.8V-only
  host, regardless of whatever board support is needed.
 
 That's the same problem here!! I have a custom board too!! However, 
 pushing patches [1] and [2] we will be able to enable the second 
 controller with some modifications in board-sdp-mmc.c.

Yes. That’s what I meant. Some changes in the sdp board file would be required 
to
Enable power to slot2 through triton LDOs. Currently I am tied up with some 
work,
I will patch that when I get some time unless someone else sends a patch by 
then.

 
 [1] - OMAP: HSMMC: Fixes for 1.8V MMC2 interface
 [2] - [PATCH 1/1] PLAT: OMAP: Add device configuration to 
 support second 
 HSMMC slot on OMAP 2430 and 3430 boards.
 
 -- 
 Francisco Keppler Silva Alecrim - INdT
 Phone: +55 92 2126-1017
 Mobile: +55 92 9152-7000
 
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 1/1] MMC: OMAP: Fix HSMMC driver name at host driver.

2008-03-23 Thread Madhusudhan Chikkature Rajashekar
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Felipe Balbi
 Sent: Friday, March 21, 2008 4:25 AM
 To: Carlos Aguiar
 Cc: Tony Lindgren; linux-omap@vger.kernel.org
 Subject: Re: [PATCH 1/1] MMC: OMAP: Fix HSMMC driver name at 
 host driver.
 
 On Thu, Mar 20, 2008 at 04:24:30PM -0400, Carlos Aguiar wrote:
  From: Carlos Eduardo Aguiar [EMAIL PROTECTED]
  
  This patch fixes the HSMMC driver name at host driver.
  
  Signed-off-by: Carlos Eduardo Aguiar [EMAIL PROTECTED]
  ---
   drivers/mmc/host/omap_hsmmc.c |2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)
  
  diff --git a/drivers/mmc/host/omap_hsmmc.c 
 b/drivers/mmc/host/omap_hsmmc.c
  index 047c64d..0e7ee20 100644
  --- a/drivers/mmc/host/omap_hsmmc.c
  +++ b/drivers/mmc/host/omap_hsmmc.c
  @@ -92,7 +92,7 @@
   #define OMAP_MMC_DATADIR_WRITE 2
   #define MMC_TIMEOUT_MS 20
   #define OMAP_MMC_MASTER_CLOCK  9600
  -#define DRIVER_NAMEmmci-omap
  +#define DRIVER_NAMEhsmmc-omap
 
 stupid question :-p
 what does the 'i' means?
I think it is a simple mistake. The change you have done makes sense for the 
HSMMC driver.

 
 -- 
 Best Regards,
 
 Felipe Balbi
 [EMAIL PROTECTED]
 http://blog.felipebalbi.com
 --
 To unsubscribe from this list: send the line unsubscribe 
 linux-omap in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html