musb power issue on beagleboard-xM

2011-08-29 Thread Bob Liu
Hi, folks

I tried to enable musb on beagleboard-xM. But it always failed with
"insufficient available bus power".

I am using linux-3.0 from linus git tree.
Do i need to use a hub?  But i heard that musb doesn't support hub.

Thanks.


# dmesg | grep 'musb'
musb-hdrc: version 6.0, pio, host
omap_device: musb-omap2430.-1: new worst case activate latency 0: 30517
musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk
split, HB-ISO Rx, HB-ISO Tx, SoftConn)
musb-hdrc: MHDRC RTL version 1.800
musb-hdrc: setup fifo_mode 4
musb-hdrc: 28/31 max ep, 16384/16384 memory
musb-hdrc musb-hdrc: MUSB HDRC host driver
musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 1
usb usb1: Manufacturer:  musb-hcd
usb usb1: SerialNumber: musb-hdrc
musb-hdrc musb-hdrc: USB OTG mode controller at fa0ab000 using PIO, IRQ 92
#
#
# usb 1-1: new high speed USB device number 2 using musb-hdrc
usb 1-1: New USB device found, idVendor=0781, idProduct=5406
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: U3 Cruzer Micro
usb 1-1: Manufacturer: SanDisk Corporation
usb 1-1: SerialNumber: 188A1671738F
usb 1-1: rejected 1 configuration due to insufficient available bus power
usb 1-1: no configuration chosen from 1 choice
#

-- 
Regards,
--Bob
--
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 5/5 v4] mfd: omap: usb: Runtime PM support

2011-08-29 Thread Munegowda, Keshava
On Tue, Aug 30, 2011 at 2:17 AM, Kevin Hilman  wrote:
> Kevin Hilman  writes:
>
>> Keshava Munegowda  writes:
>>
>>> From: Keshava Munegowda 
>>>
>>> The usbhs core driver does not enable/disable the intefrace and
>>> fucntional clocks; These clocks are handled by hwmod and runtime pm,
>>> hence insted of the clock enable/disable, the runtime pm APIS are
>>> used. however,the port clocks are handled by the usbhs core.
>>>
>>> Signed-off-by: Keshava Munegowda 
>>
>> General comment: all usage of pm_runtime_put_sync() can likely be
>> replaced by the asynchronous versions.  I don't currently see why the
>> synchronous verions are needed here.
>>
>> Other than that, the runtime PM parts of this look OK to me.  After
>> changing to asynchonous puts, feel free to add:
>>
>> Reviewed-by: Kevin Hilman 
>
> oops, this should've been in response to your v8 version.
>
> Kevin
>
>>
>> Also, after a quick glance, it looks like this version of the series
>> addresses the problems seen by Jassi Brar with the TLL reset[1].  Please
>> confirm.
>>
>> Speaking of which, it's helpful to Cc folks who have had comments on
>> previous versions of your series so they are sure they're previous
>> issues are addressed.   I've Cc'd Jassi Brar.
>>
>> Thanks,
>>
>> Kevin
>>
>> [1] http://marc.info/?l=linux-omap&m=130921260703865&w=2
>

Thanks for review;  yes, its reworks of complete runtime pm of usbhs as
suggested by Jassi Brar.

balbi, sameo
 this patch series available at

the branch kmg-usbhs-pm

of code repository : git://gitorious.org/~kmg/mirrors/kmg-usbhs-pm.git

Regards
Keshava
--
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] mfd: Add PWM1 and PWM2 support to twl6030-pwm

2011-08-29 Thread Hemanth V
From: Hemanth V 
Date: Fri, 26 Aug 2011 10:49:29 +0530
Subject: [PATCH] Add PWM1 and PWM2 support to twl6030-pwm driver

This patch adds support for PWM1/PWM2. TWL6030 PWM driver also
supports Indicator LED PWM. Function pointers are defined for
for init, enable, disable and configuration for both Indicator LED
PWM (led_pwm) and PWM1/PWM2 (std_pwm)

Tested-by: Tomi Valkeinen 
Signed-off-by: Hemanth V 
---
 drivers/mfd/twl6030-pwm.c |  324 ++--
 1 files changed, 309 insertions(+), 15 deletions(-)

diff --git a/drivers/mfd/twl6030-pwm.c b/drivers/mfd/twl6030-pwm.c
index e8fee14..8d9c3f5 100644
--- a/drivers/mfd/twl6030-pwm.c
+++ b/drivers/mfd/twl6030-pwm.c
@@ -5,6 +5,9 @@
  * Copyright (C) 2010 Texas Instruments
  * Author: Hemanth V 
  *
+ * Added support for PWM1, PWM2
+ * Hemanth V 
+ *
  * This program 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.
@@ -36,7 +39,9 @@
 #define PWM_CTRL2_CURR_02  (2 << 4)

 /* LED supply source */
+#define PWM_CTRL2_SRC_VBUS (0 << 2)
 #define PWM_CTRL2_SRC_VAC  (1 << 2)
+#define PWM_CTRL2_SRC_EXT  (2 << 2)

 /* LED modes */
 #define PWM_CTRL2_MODE_HW  (0 << 0)
@@ -45,12 +50,53 @@

 #define PWM_CTRL2_MODE_MASK0x3

+/* PWMs supported by driver */
+#define PWM_ID_LED 1
+#define PWM_ID_PWM12
+#define PWM_ID_PWM23
+
+#define LED_PWM1ON 0x00
+#define LED_PWM1OFF0x01
+#define LED_PWM2ON 0x03
+#define LED_PWM2OFF0x04
+#define TWL6030_TOGGLE30x92
+#define PWMSTATUS2 0x94
+
+/* Defines for TOGGLE3 register */
+#define PWM2EN (1 << 5)
+#define PWM2S  (1 << 4)
+#define PWM2R  (1 << 3)
+#define PWM1EN (1 << 2)
+#define PWM1S  (1 << 1)
+#define PWM1R  (1 << 0)
+
+/* Defines for PWMSTATUS2 register */
+#define PWM1_CLK_EN(1 << 1)
+#define PWM2_CLK_EN(1 << 3)
+#defineTRUE1
+#defineFALSE   0
+
+static DEFINE_MUTEX(pwm_lock);
+static LIST_HEAD(pwm_list);
+
+struct pwm_device;
+
+struct pwm_ops {
+   int (*config)(struct pwm_device *, int, int);
+   int (*enable)(struct pwm_device *);
+   void(*disable)(struct pwm_device *);
+   int (*init)(struct pwm_device *);
+};
+
 struct pwm_device {
-   const char *label;
-   unsigned int pwm_id;
+   struct list_headnode;
+   const char  *label;
+   unsigned intpwm_id;
+   unsigned intuse_count;
+   struct pwm_ops  *ops;
 };

-int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
+int led_pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
 {
u8 duty_cycle;
int ret;
@@ -69,9 +115,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int 
period_ns)
}
return 0;
 }
-EXPORT_SYMBOL(pwm_config);

-int pwm_enable(struct pwm_device *pwm)
+int led_pwm_enable(struct pwm_device *pwm)
 {
u8 val;
int ret;
@@ -95,9 +140,8 @@ int pwm_enable(struct pwm_device *pwm)
twl_i2c_read_u8(TWL6030_MODULE_ID1, &val, LED_PWM_CTRL2);
return 0;
 }
-EXPORT_SYMBOL(pwm_enable);

-void pwm_disable(struct pwm_device *pwm)
+void led_pwm_disable(struct pwm_device *pwm)
 {
u8 val;
int ret;
@@ -120,37 +164,284 @@ void pwm_disable(struct pwm_device *pwm)
}
return;
 }
-EXPORT_SYMBOL(pwm_disable);

-struct pwm_device *pwm_request(int pwm_id, const char *label)
+int led_pwm_init(struct pwm_device *pwm)
 {
u8 val;
int ret;
+
+   val = PWM_CTRL2_DIS_PD | PWM_CTRL2_CURR_02 | PWM_CTRL2_SRC_VBUS |
+   PWM_CTRL2_MODE_HW;
+
+   ret = twl_i2c_write_u8(TWL6030_MODULE_ID1, val, LED_PWM_CTRL2);
+
+   return ret;
+}
+
+static struct pwm_ops pwm_led = {
+   .config = led_pwm_config,
+   .enable = led_pwm_enable,
+   .disable = led_pwm_disable,
+   .init = led_pwm_init,
+};
+
+int std_pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
+{
+   int ret = 0, level, pwm_id, reg;
+
+   level = (duty_ns * PWM_CTRL1_MAX) / period_ns;
+   pwm_id = pwm->pwm_id;
+
+   if (pwm_id == PWM_ID_PWM1)
+   reg = LED_PWM1ON;
+   else
+   reg = LED_PWM2ON;
+
+   if (level > 1) {
+   if (level == 255)
+   level = 0x7F;
+   else
+   level = (~(level/2)) & 0x7F;
+
+   ret = twl_i2c_write_u8(TWL_MODULE_PWM, level, reg);
+   }
+
+   return ret;
+}
+
+void std_pwm_disable(struct pwm_device *pwm)
+{
+
+   int ret, pwm_id;
+   bool pwm1_enabled = FALSE;
+   bool pwm2_enabled = FALSE;
+   u8 reg_val, reset_val, dis_val = 0;
+
+  

<    1   2