* [PATCH 0/7] TWL4030 Changes
@ 2008-03-19 13:42 Felipe Balbi
0 siblings, 0 replies; 13+ messages in thread
From: Felipe Balbi @ 2008-03-19 13:42 UTC (permalink / raw)
To: linux-omap
Hi all,
The following patches implements some clean ups in twl4030 driver
also let twl4030-usb.c initialize struct otg_transceiver and
deliver it to omap2430.c.
musb clock is now comming from musb_platform_data as it should
and we avoid clk_get():ing twice (on omap2430.c and musb_core.c)
TODO:
. twl4030-gpio.c: moves to gpiolib
. twl4030-usb.c: irq is not waking up the phy and
transceiver doesn't notify musb_core.c id pin
state.
For now that's all,
Thanks everybody.
As usual, comments are welcome
diffstat:
arch/arm/mach-omap2/board-2430sdp-usb.c | 27 +
arch/arm/mach-omap2/board-3430sdp-usb.c | 29 +-
arch/arm/mach-omap2/board-3430sdp.c | 2 +-
arch/arm/mach-omap2/board-sdp-hsmmc.c | 2 +-
drivers/i2c/chips/Makefile | 8 +-
drivers/i2c/chips/twl4030-core.c | 904 +++++++++++++++++++++++++++
drivers/i2c/chips/twl4030-gpio.c | 836 +++++++++++++++++++++++++
drivers/i2c/chips/twl4030-poweroff.c | 75 +++
drivers/i2c/chips/twl4030-usb.c | 784 +++++++++++++++++++++++
drivers/i2c/chips/twl4030_core.c | 900 --------------------------
drivers/i2c/chips/twl4030_gpio.c | 836 -------------------------
drivers/i2c/chips/twl4030_poweroff.c | 75 ---
drivers/i2c/chips/twl4030_usb.c | 693 --------------------
drivers/input/keyboard/omap-twl4030keypad.c | 2 +-
drivers/rtc/rtc-twl4030.c | 4 +-
drivers/usb/musb/musb_core.h | 4 +-
drivers/usb/musb/omap2430.c | 34 +-
drivers/usb/musb/omap2430.h | 8 -
include/asm-arm/arch-omap/twl4030-rtc.h | 230 -------
include/asm-arm/arch-omap/twl4030.h | 118 ----
include/linux/i2c/twl4030-rtc.h | 230 +++++++
include/linux/i2c/twl4030.h | 118 ++++
22 files changed, 3028 insertions(+), 2891 deletions(-)
br,
- Balbi
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 0/7] twl4030 changes
@ 2008-03-27 17:16 Felipe Balbi
2008-03-27 17:16 ` [PATCH 1/7] I2C: TWL4030: Move twl4030's headers under include/linux/i2c/ Felipe Balbi
2008-03-28 7:49 ` [PATCH 0/7] twl4030 changes Tony Lindgren
0 siblings, 2 replies; 13+ messages in thread
From: Felipe Balbi @ 2008-03-27 17:16 UTC (permalink / raw)
To: linux-omap; +Cc: Felipe Balbi
Hi Tony,
I'm resending this series cuz I changed a bit patch #5 to set
session bit on musb_platform_set_mode so musb core will really
go to a_host mode when we echo sysfs.
Without this small change the sysfs interface will work only with
a few devices, most likely usb sticks.
Below is a shortlog and diffstat of the changes.
Best regards,
- Balbi
Felipe Balbi (7):
I2C: TWL4030: Move twl4030's headers under include/linux/i2c/
I2C: TWL4030: Move all *_*.c to *-*.c
I2C: TWL4030: General cleanup in twl4030-core.c
I2C: TWL4030: Cleanup twl4030-usb.c
I2C: TWL4030: Make twl4030-usb.c initialize otg_transceiver
I2C: TWL4030: Reorganize code in twl4030-usb.c
USB: MUSB: Let board specific code handle clock initialization
arch/arm/mach-omap2/board-2430sdp-usb.c | 27 ++
arch/arm/mach-omap2/board-3430sdp-usb.c | 29 ++-
arch/arm/mach-omap2/board-3430sdp.c | 2 +-
arch/arm/mach-omap2/board-sdp-hsmmc.c | 2 +-
drivers/i2c/chips/Makefile | 8 +-
.../i2c/chips/{twl4030_core.c => twl4030-core.c} | 80 ++++---
.../i2c/chips/{twl4030_gpio.c => twl4030-gpio.c} | 2 +-
.../{twl4030_poweroff.c => twl4030-poweroff.c} | 2 +-
drivers/i2c/chips/{twl4030_usb.c => twl4030-usb.c} | 255 +++++++++++++-------
drivers/input/keyboard/omap-twl4030keypad.c | 2 +-
drivers/rtc/rtc-twl4030.c | 4 +-
drivers/usb/musb/musb_core.h | 4 +-
drivers/usb/musb/omap2430.c | 39 ++--
drivers/usb/musb/omap2430.h | 8 -
.../{asm-arm/arch-omap => linux/i2c}/twl4030-rtc.h | 0
include/{asm-arm/arch-omap => linux/i2c}/twl4030.h | 0
16 files changed, 303 insertions(+), 161 deletions(-)
rename drivers/i2c/chips/{twl4030_core.c => twl4030-core.c} (93%)
rename drivers/i2c/chips/{twl4030_gpio.c => twl4030-gpio.c} (99%)
rename drivers/i2c/chips/{twl4030_poweroff.c => twl4030-poweroff.c} (98%)
rename drivers/i2c/chips/{twl4030_usb.c => twl4030-usb.c} (87%)
rename include/{asm-arm/arch-omap => linux/i2c}/twl4030-rtc.h (100%)
rename include/{asm-arm/arch-omap => linux/i2c}/twl4030.h (100%)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/7] I2C: TWL4030: Move twl4030's headers under include/linux/i2c/
2008-03-27 17:16 [PATCH 0/7] twl4030 changes Felipe Balbi
@ 2008-03-27 17:16 ` Felipe Balbi
2008-03-27 17:16 ` [PATCH 2/7] I2C: TWL4030: Move all *_*.c to *-*.c Felipe Balbi
2008-03-28 7:49 ` [PATCH 0/7] twl4030 changes Tony Lindgren
1 sibling, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2008-03-27 17:16 UTC (permalink / raw)
To: linux-omap; +Cc: Felipe Balbi
Now that we have this directory we can use it.
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
arch/arm/mach-omap2/board-3430sdp.c | 2 +-
arch/arm/mach-omap2/board-sdp-hsmmc.c | 2 +-
drivers/i2c/chips/twl4030_core.c | 2 +-
drivers/i2c/chips/twl4030_gpio.c | 2 +-
drivers/i2c/chips/twl4030_poweroff.c | 2 +-
drivers/i2c/chips/twl4030_usb.c | 2 +-
drivers/input/keyboard/omap-twl4030keypad.c | 2 +-
drivers/rtc/rtc-twl4030.c | 4 ++--
.../{asm-arm/arch-omap => linux/i2c}/twl4030-rtc.h | 0
include/{asm-arm/arch-omap => linux/i2c}/twl4030.h | 0
10 files changed, 9 insertions(+), 9 deletions(-)
rename include/{asm-arm/arch-omap => linux/i2c}/twl4030-rtc.h (100%)
rename include/{asm-arm/arch-omap => linux/i2c}/twl4030.h (100%)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index f3a316f..1eb84a6 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -20,6 +20,7 @@
#include <linux/workqueue.h>
#include <linux/err.h>
#include <linux/clk.h>
+#include <linux/i2c/twl4030.h>
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
@@ -28,7 +29,6 @@
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
-#include <asm/arch/twl4030.h>
#include <asm/arch/mcspi.h>
#include <asm/arch/gpio.h>
#include <asm/arch/mux.h>
diff --git a/arch/arm/mach-omap2/board-sdp-hsmmc.c b/arch/arm/mach-omap2/board-sdp-hsmmc.c
index 7661a79..3ae5b20 100644
--- a/arch/arm/mach-omap2/board-sdp-hsmmc.c
+++ b/arch/arm/mach-omap2/board-sdp-hsmmc.c
@@ -13,8 +13,8 @@
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
+#include <linux/i2c/twl4030.h>
#include <asm/hardware.h>
-#include <asm/arch/twl4030.h>
#include <asm/arch/mmc.h>
#include <asm/arch/board.h>
#include <asm/io.h>
diff --git a/drivers/i2c/chips/twl4030_core.c b/drivers/i2c/chips/twl4030_core.c
index e733195..4f0f465 100644
--- a/drivers/i2c/chips/twl4030_core.c
+++ b/drivers/i2c/chips/twl4030_core.c
@@ -38,6 +38,7 @@
#include <linux/kthread.h>
#include <linux/i2c.h>
+#include <linux/i2c/twl4030.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/device.h>
@@ -45,7 +46,6 @@
#include <asm/irq.h>
#include <asm/mach/irq.h>
-#include <asm/arch/twl4030.h>
#include <asm/arch/gpio.h>
#include <asm/arch/mux.h>
diff --git a/drivers/i2c/chips/twl4030_gpio.c b/drivers/i2c/chips/twl4030_gpio.c
index 9054cc9..a9f3b1d 100644
--- a/drivers/i2c/chips/twl4030_gpio.c
+++ b/drivers/i2c/chips/twl4030_gpio.c
@@ -36,9 +36,9 @@
#include <linux/kthread.h>
#include <linux/i2c.h>
+#include <linux/i2c/twl4030.h>
#include <linux/slab.h>
-#include <asm/arch/twl4030.h>
#include <asm/arch/irqs.h>
#include <asm/irq.h>
#include <asm/mach/irq.h>
diff --git a/drivers/i2c/chips/twl4030_poweroff.c b/drivers/i2c/chips/twl4030_poweroff.c
index 7a176d9..dbe413a 100644
--- a/drivers/i2c/chips/twl4030_poweroff.c
+++ b/drivers/i2c/chips/twl4030_poweroff.c
@@ -23,7 +23,7 @@
#include <linux/module.h>
#include <linux/pm.h>
-#include <asm/arch/twl4030.h>
+#include <linux/i2c/twl4030.h>
#define PWR_P1_SW_EVENTS 0x10
#define PWR_DEVOFF (1<<0)
diff --git a/drivers/i2c/chips/twl4030_usb.c b/drivers/i2c/chips/twl4030_usb.c
index b3365f6..cf86d3e 100644
--- a/drivers/i2c/chips/twl4030_usb.c
+++ b/drivers/i2c/chips/twl4030_usb.c
@@ -29,7 +29,7 @@
#include <linux/interrupt.h>
#include <linux/usb.h>
-#include <asm/arch/twl4030.h>
+#include <linux/i2c/twl4030.h>
/* Register defines */
diff --git a/drivers/input/keyboard/omap-twl4030keypad.c b/drivers/input/keyboard/omap-twl4030keypad.c
index 4750dba..3bc3045 100644
--- a/drivers/input/keyboard/omap-twl4030keypad.c
+++ b/drivers/input/keyboard/omap-twl4030keypad.c
@@ -33,9 +33,9 @@
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
+#include <linux/i2c/twl4030.h>
#include <asm/irq.h>
#include <asm/arch/keypad.h>
-#include <asm/arch/twl4030.h>
#include "twl4030-keypad.h"
#define OMAP_TWL4030KP_LOG_LEVEL 0
diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c
index b50de5f..929a788 100644
--- a/drivers/rtc/rtc-twl4030.c
+++ b/drivers/rtc/rtc-twl4030.c
@@ -34,14 +34,14 @@
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/device.h>
+#include <linux/i2c/twl4030.h>
+#include <linux/i2c/twl4030-rtc.h>
#include <asm/io.h>
#include <asm/mach/time.h>
#include <asm/system.h>
#include <asm/hardware.h>
#include <asm/irq.h>
-#include <asm/arch/twl4030.h>
-#include <asm/arch/twl4030-rtc.h>
#define ALL_TIME_REGS 6
diff --git a/include/asm-arm/arch-omap/twl4030-rtc.h b/include/linux/i2c/twl4030-rtc.h
similarity index 100%
rename from include/asm-arm/arch-omap/twl4030-rtc.h
rename to include/linux/i2c/twl4030-rtc.h
diff --git a/include/asm-arm/arch-omap/twl4030.h b/include/linux/i2c/twl4030.h
similarity index 100%
rename from include/asm-arm/arch-omap/twl4030.h
rename to include/linux/i2c/twl4030.h
--
1.5.5.rc1.12.g660b9
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/7] I2C: TWL4030: Move all *_*.c to *-*.c
2008-03-27 17:16 ` [PATCH 1/7] I2C: TWL4030: Move twl4030's headers under include/linux/i2c/ Felipe Balbi
@ 2008-03-27 17:16 ` Felipe Balbi
2008-03-27 17:16 ` [PATCH 3/7] I2C: TWL4030: General cleanup in twl4030-core.c Felipe Balbi
0 siblings, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2008-03-27 17:16 UTC (permalink / raw)
To: linux-omap; +Cc: Felipe Balbi
Rename to use the name style.
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/i2c/chips/Makefile | 8 ++++----
.../i2c/chips/{twl4030_core.c => twl4030-core.c} | 0
.../i2c/chips/{twl4030_gpio.c => twl4030-gpio.c} | 0
.../{twl4030_poweroff.c => twl4030-poweroff.c} | 0
drivers/i2c/chips/{twl4030_usb.c => twl4030-usb.c} | 0
5 files changed, 4 insertions(+), 4 deletions(-)
rename drivers/i2c/chips/{twl4030_core.c => twl4030-core.c} (100%)
rename drivers/i2c/chips/{twl4030_gpio.c => twl4030-gpio.c} (100%)
rename drivers/i2c/chips/{twl4030_poweroff.c => twl4030-poweroff.c} (100%)
rename drivers/i2c/chips/{twl4030_usb.c => twl4030-usb.c} (100%)
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
index 939ef5c..255fbb1 100644
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -22,10 +22,10 @@ obj-$(CONFIG_SENSORS_TLV320AIC23) += tlv320aic23.o
obj-$(CONFIG_GPIOEXPANDER_OMAP) += gpio_expander_omap.o
obj-$(CONFIG_MENELAUS) += menelaus.o
obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
-obj-$(CONFIG_TWL4030_CORE) += twl4030_core.o
-obj-$(CONFIG_TWL4030_GPIO) += twl4030_gpio.o
-obj-$(CONFIG_TWL4030_USB) += twl4030_usb.o
-obj-$(CONFIG_TWL4030_POWEROFF) += twl4030_poweroff.o
+obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o
+obj-$(CONFIG_TWL4030_GPIO) += twl4030-gpio.o
+obj-$(CONFIG_TWL4030_USB) += twl4030-usb.o
+obj-$(CONFIG_TWL4030_POWEROFF) += twl4030-poweroff.o
obj-$(CONFIG_RTC_X1205_I2C) += x1205.o
ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
diff --git a/drivers/i2c/chips/twl4030_core.c b/drivers/i2c/chips/twl4030-core.c
similarity index 100%
rename from drivers/i2c/chips/twl4030_core.c
rename to drivers/i2c/chips/twl4030-core.c
diff --git a/drivers/i2c/chips/twl4030_gpio.c b/drivers/i2c/chips/twl4030-gpio.c
similarity index 100%
rename from drivers/i2c/chips/twl4030_gpio.c
rename to drivers/i2c/chips/twl4030-gpio.c
diff --git a/drivers/i2c/chips/twl4030_poweroff.c b/drivers/i2c/chips/twl4030-poweroff.c
similarity index 100%
rename from drivers/i2c/chips/twl4030_poweroff.c
rename to drivers/i2c/chips/twl4030-poweroff.c
diff --git a/drivers/i2c/chips/twl4030_usb.c b/drivers/i2c/chips/twl4030-usb.c
similarity index 100%
rename from drivers/i2c/chips/twl4030_usb.c
rename to drivers/i2c/chips/twl4030-usb.c
--
1.5.5.rc1.12.g660b9
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/7] I2C: TWL4030: General cleanup in twl4030-core.c
2008-03-27 17:16 ` [PATCH 2/7] I2C: TWL4030: Move all *_*.c to *-*.c Felipe Balbi
@ 2008-03-27 17:16 ` Felipe Balbi
2008-03-27 17:16 ` [PATCH 4/7] I2C: TWL4030: Cleanup twl4030-usb.c Felipe Balbi
0 siblings, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2008-03-27 17:16 UTC (permalink / raw)
To: linux-omap; +Cc: Felipe Balbi
General cleanup in twl4030-core.c
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/i2c/chips/twl4030-core.c | 78 ++++++++++++++++++++------------------
1 files changed, 41 insertions(+), 37 deletions(-)
diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c
index 4f0f465..c979241 100644
--- a/drivers/i2c/chips/twl4030-core.c
+++ b/drivers/i2c/chips/twl4030-core.c
@@ -32,6 +32,7 @@
#include <linux/kernel_stat.h>
#include <linux/init.h>
#include <linux/time.h>
+#include <linux/mutex.h>
#include <linux/interrupt.h>
#include <linux/random.h>
#include <linux/syscalls.h>
@@ -158,7 +159,7 @@ struct twl4030_client {
struct i2c_msg xfer_msg[2];
/* To lock access to xfer_msg */
- struct semaphore xfer_lock;
+ struct mutex xfer_lock;
};
/* Module Mapping */
@@ -218,7 +219,10 @@ static struct twl4030_client twl4030_modules[TWL4030_NUM_SLAVES] = {
/* One Client Driver , 4 Clients */
static struct i2c_driver twl4030_driver = {
- .driver.name = "TWL4030 I2C",
+ .driver = {
+ .name = DRIVER_NAME,
+ .owner = THIS_MODULE,
+ },
.attach_adapter = twl4030_attach_adapter,
.detach_client = twl4030_detach_client,
};
@@ -256,7 +260,7 @@ int twl4030_i2c_write(u8 mod_no, u8 * value, u8 reg, u8 num_bytes)
{
int ret;
int sid;
- struct twl4030_client *client;
+ struct twl4030_client *twl;
struct i2c_msg *msg;
if (unlikely(mod_no > TWL4030_MODULE_LAST)) {
@@ -264,27 +268,27 @@ int twl4030_i2c_write(u8 mod_no, u8 * value, u8 reg, u8 num_bytes)
return -EPERM;
}
sid = twl4030_map[mod_no].sid;
- client = &(twl4030_modules[sid]);
+ twl = &twl4030_modules[sid];
- if (unlikely(client->inuse != TWL_CLIENT_USED)) {
+ if (unlikely(twl->inuse != TWL_CLIENT_USED)) {
pr_err("I2C Client[%d] is not initialized[%d]\n",
sid, __LINE__);
return -EPERM;
}
- down(&(client->xfer_lock));
+ mutex_lock(&twl->xfer_lock);
/*
* [MSG1]: fill the register address data
* fill the data Tx buffer
*/
- msg = &(client->xfer_msg[0]);
- msg->addr = client->address;
+ msg = &twl->xfer_msg[0];
+ msg->addr = twl->address;
msg->len = num_bytes + 1;
msg->flags = 0;
msg->buf = value;
/* over write the first byte of buffer with the register address */
*value = twl4030_map[mod_no].base + reg;
- ret = i2c_transfer(client->client.adapter, client->xfer_msg, 1);
- up(&(client->xfer_lock));
+ ret = i2c_transfer(twl->client.adapter, twl->xfer_msg, 1);
+ mutex_unlock(&twl->xfer_lock);
/* i2cTransfer returns num messages.translate it pls.. */
if (ret >= 0)
@@ -307,7 +311,7 @@ int twl4030_i2c_read(u8 mod_no, u8 * value, u8 reg, u8 num_bytes)
int ret;
u8 val;
int sid;
- struct twl4030_client *client;
+ struct twl4030_client *twl;
struct i2c_msg *msg;
if (unlikely(mod_no > TWL4030_MODULE_LAST)) {
@@ -315,29 +319,29 @@ int twl4030_i2c_read(u8 mod_no, u8 * value, u8 reg, u8 num_bytes)
return -EPERM;
}
sid = twl4030_map[mod_no].sid;
- client = &(twl4030_modules[sid]);
+ twl = &twl4030_modules[sid];
- if (unlikely(client->inuse != TWL_CLIENT_USED)) {
+ if (unlikely(twl->inuse != TWL_CLIENT_USED)) {
pr_err("I2C Client[%d] is not initialized[%d]\n", sid,
__LINE__);
return -EPERM;
}
- down(&(client->xfer_lock));
+ mutex_lock(&twl->xfer_lock);
/* [MSG1] fill the register address data */
- msg = &(client->xfer_msg[0]);
- msg->addr = client->address;
+ msg = &twl->xfer_msg[0];
+ msg->addr = twl->address;
msg->len = 1;
msg->flags = 0; /* Read the register value */
val = twl4030_map[mod_no].base + reg;
msg->buf = &val;
/* [MSG2] fill the data rx buffer */
- msg = &(client->xfer_msg[1]);
- msg->addr = client->address;
+ msg = &twl->xfer_msg[1];
+ msg->addr = twl->address;
msg->flags = I2C_M_RD; /* Read the register value */
msg->len = num_bytes; /* only n bytes */
msg->buf = value;
- ret = i2c_transfer(client->client.adapter, client->xfer_msg, 2);
- up(&(client->xfer_lock));
+ ret = i2c_transfer(twl->client.adapter, twl->xfer_msg, 2);
+ mutex_unlock(&twl->xfer_lock);
/* i2cTransfer returns num messages.translate it pls.. */
if (ret >= 0)
@@ -530,7 +534,7 @@ static void do_twl4030_irq(unsigned int irq, irq_desc_t *desc)
static int twl4030_detect_client(struct i2c_adapter *adapter, unsigned char sid)
{
int err = 0;
- struct twl4030_client *client;
+ struct twl4030_client *twl;
if (unlikely(sid >= TWL4030_NUM_SLAVES)) {
pr_err("sid[%d] > MOD_LAST[%d]\n", sid, TWL4030_NUM_SLAVES);
@@ -543,30 +547,30 @@ static int twl4030_detect_client(struct i2c_adapter *adapter, unsigned char sid)
pr_err("SlaveID=%d functionality check failed\n", sid);
return err;
}
- client = &(twl4030_modules[sid]);
- if (unlikely(client->inuse)) {
- pr_err("Client %s is already in use\n", client->client_name);
+ twl = &twl4030_modules[sid];
+ if (unlikely(twl->inuse)) {
+ pr_err("Client %s is already in use\n", twl->client_name);
return -EPERM;
}
- memset(&(client->client), 0, sizeof(struct i2c_client));
+ memset(&twl->client, 0, sizeof(struct i2c_client));
- client->client.addr = client->address;
- client->client.adapter = adapter;
- client->client.driver = &twl4030_driver;
+ twl->client.addr = twl->address;
+ twl->client.adapter = adapter;
+ twl->client.driver = &twl4030_driver;
- memcpy(&(client->client.name), client->client_name,
+ memcpy(&twl->client.name, twl->client_name,
sizeof(TWL_CLIENT_STRING) + 1);
pr_info("TWL4030: TRY attach Slave %s on Adapter %s [%x]\n",
- client->client_name, adapter->name, err);
+ twl->client_name, adapter->name, err);
- if ((err = i2c_attach_client(&(client->client)))) {
+ if ((err = i2c_attach_client(&twl->client))) {
pr_err("Couldn't attach Slave %s on Adapter"
- "%s [%x]\n", client->client_name, adapter->name, err);
+ "%s [%x]\n", twl->client_name, adapter->name, err);
} else {
- client->inuse = TWL_CLIENT_USED;
- init_MUTEX(&client->xfer_lock);
+ twl->inuse = TWL_CLIENT_USED;
+ mutex_init(&twl->xfer_lock);
}
return err;
@@ -607,17 +611,17 @@ free_client:
while (i >= 0) {
/* now remove all those from the current adapter... */
if (twl4030_modules[i].adapter_index == twl_i2c_adapter)
- (void)twl4030_detach_client(&(twl4030_modules[i].client));
+ (void)twl4030_detach_client(&twl4030_modules[i].client);
i--;
}
return ret;
}
/* adapter's callback */
-static int twl4030_detach_client(struct i2c_client *iclient)
+static int twl4030_detach_client(struct i2c_client *client)
{
int err;
- if ((err = i2c_detach_client(iclient))) {
+ if ((err = i2c_detach_client(client))) {
pr_err("Client detach failed\n");
return err;
}
--
1.5.5.rc1.12.g660b9
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/7] I2C: TWL4030: Cleanup twl4030-usb.c
2008-03-27 17:16 ` [PATCH 3/7] I2C: TWL4030: General cleanup in twl4030-core.c Felipe Balbi
@ 2008-03-27 17:16 ` Felipe Balbi
2008-03-27 17:16 ` [PATCH 5/7] I2C: TWL4030: Make twl4030-usb.c initialize otg_transceiver Felipe Balbi
0 siblings, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2008-03-27 17:16 UTC (permalink / raw)
To: linux-omap; +Cc: Felipe Balbi
General cleanup on twl4030-usb.c
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/i2c/chips/twl4030-usb.c | 27 +++++++++++++--------------
drivers/usb/musb/omap2430.c | 1 -
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/i2c/chips/twl4030-usb.c b/drivers/i2c/chips/twl4030-usb.c
index cf86d3e..eca5aef 100644
--- a/drivers/i2c/chips/twl4030-usb.c
+++ b/drivers/i2c/chips/twl4030-usb.c
@@ -28,7 +28,6 @@
#include <linux/time.h>
#include <linux/interrupt.h>
#include <linux/usb.h>
-
#include <linux/i2c/twl4030.h>
/* Register defines */
@@ -248,6 +247,18 @@
/*-------------------------------------------------------------------------*/
+struct twl4030_usb {
+ int irq;
+ u8 usb_mode; /* pin configuration */
+#define T2_USB_MODE_ULPI 1
+/* #define T2_USB_MODE_CEA2011_3PIN 2 */
+ u8 asleep;
+};
+
+static struct twl4030_usb *the_transceiver;
+
+/*-------------------------------------------------------------------------*/
+
static int twl4030_i2c_write_u8_verify(u8 module, u8 data, u8 address)
{
u8 check;
@@ -307,18 +318,6 @@ static inline int twl4030_usb_read(u8 address)
/*-------------------------------------------------------------------------*/
-struct twl4030_usb {
- int irq;
- u8 usb_mode; /* pin configuration */
-#define T2_USB_MODE_ULPI 1
-/* #define T2_USB_MODE_CEA2011_3PIN 2 */
- u8 asleep;
-};
-
-static struct twl4030_usb *the_transceiver;
-
-/*-------------------------------------------------------------------------*/
-
static inline int
twl4030_usb_set_bits(struct twl4030_usb *twl, u8 reg, u8 bits)
{
@@ -616,7 +615,7 @@ static int __init twl4030_usb_init(void)
if (the_transceiver)
return 0;
- twl = kcalloc(1, sizeof *twl, GFP_KERNEL);
+ twl = kzalloc(sizeof *twl, GFP_KERNEL);
if (!twl)
return 0;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index e19a15e..eacd6c4 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -227,7 +227,6 @@ int __init musb_platform_init(struct musb *musb)
omap_vbus_power(musb, musb->board_mode == MUSB_HOST, 1);
-
if (is_host_enabled(musb))
musb->board_set_vbus = omap_set_vbus;
if (is_peripheral_enabled(musb))
--
1.5.5.rc1.12.g660b9
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/7] I2C: TWL4030: Make twl4030-usb.c initialize otg_transceiver
2008-03-27 17:16 ` [PATCH 4/7] I2C: TWL4030: Cleanup twl4030-usb.c Felipe Balbi
@ 2008-03-27 17:16 ` Felipe Balbi
2008-03-27 17:16 ` [PATCH 6/7] I2C: TWL4030: Reorganize code in twl4030-usb.c Felipe Balbi
0 siblings, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2008-03-27 17:16 UTC (permalink / raw)
To: linux-omap; +Cc: Felipe Balbi
Code still needs some reorganization which will come in later
patches but we can already put omap3 in host mode by echo:ing
sysfs node.
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/i2c/chips/twl4030-usb.c | 111 ++++++++++++++++++++++++++++++++++++---
drivers/usb/musb/musb_core.h | 4 +-
drivers/usb/musb/omap2430.c | 30 +++++++---
drivers/usb/musb/omap2430.h | 8 ---
4 files changed, 126 insertions(+), 27 deletions(-)
diff --git a/drivers/i2c/chips/twl4030-usb.c b/drivers/i2c/chips/twl4030-usb.c
index eca5aef..136e1c6 100644
--- a/drivers/i2c/chips/twl4030-usb.c
+++ b/drivers/i2c/chips/twl4030-usb.c
@@ -28,7 +28,11 @@
#include <linux/time.h>
#include <linux/interrupt.h>
#include <linux/usb.h>
+#include <linux/usb/ch9.h>
+#include <linux/usb/gadget.h>
+#include <linux/usb/otg.h>
#include <linux/i2c/twl4030.h>
+#include <asm/arch/usb.h>
/* Register defines */
@@ -245,9 +249,28 @@
#define REG_PWR_SIH_CTRL 0x07
#define COR (1 << 2)
+/* internal define on top of container_of */
+#define xceiv_to_twl(x) container_of((x), struct twl4030_usb, otg);
+
+/* bits in OTG_CTRL_REG */
+
+#define OTG_XCEIV_OUTPUTS \
+ (OTG_ASESSVLD|OTG_BSESSEND|OTG_BSESSVLD|OTG_VBUSVLD|OTG_ID)
+#define OTG_XCEIV_INPUTS \
+ (OTG_PULLDOWN|OTG_PULLUP|OTG_DRV_VBUS|OTG_PD_VBUS|OTG_PU_VBUS|OTG_PU_ID)
+#define OTG_CTRL_BITS \
+ (OTG_A_BUSREQ|OTG_A_SETB_HNPEN|OTG_B_BUSREQ|OTG_B_HNPEN|OTG_BUSDROP)
+ /* and OTG_PULLUP is sometimes written */
+
+#define OTG_CTRL_MASK (OTG_DRIVER_SEL| \
+ OTG_XCEIV_OUTPUTS|OTG_XCEIV_INPUTS| \
+ OTG_CTRL_BITS)
+
+
/*-------------------------------------------------------------------------*/
struct twl4030_usb {
+ struct otg_transceiver otg;
int irq;
u8 usb_mode; /* pin configuration */
#define T2_USB_MODE_ULPI 1
@@ -328,6 +351,7 @@ static inline int
twl4030_usb_clear_bits(struct twl4030_usb *twl, u8 reg, u8 bits)
{
return twl4030_usb_write(reg + 2, bits);
+
}
/*-------------------------------------------------------------------------*/
@@ -472,8 +496,8 @@ static void usb_irq_disable(void)
return;
}
-void twl4030_phy_suspend(int controller_off);
-void twl4030_phy_resume(void);
+static void twl4030_phy_suspend(int controller_off);
+static void twl4030_phy_resume(void);
static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
{
@@ -565,7 +589,7 @@ static void twl4030_usb_ldo_init(struct twl4030_usb *twl)
twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, PROTECT_KEY);
}
-void twl4030_phy_suspend(int controller_off)
+static void twl4030_phy_suspend(int controller_off)
{
struct twl4030_usb *twl = the_transceiver;
@@ -583,10 +607,8 @@ void twl4030_phy_suspend(int controller_off)
twl->asleep = 1;
return;
}
-EXPORT_SYMBOL(twl4030_phy_suspend);
-
-void twl4030_phy_resume(void)
+static void twl4030_phy_resume(void)
{
struct twl4030_usb *twl = the_transceiver;
@@ -604,8 +626,76 @@ void twl4030_phy_resume(void)
twl->asleep = 0;
return;
}
-EXPORT_SYMBOL(twl4030_phy_resume);
+static int twl4030_set_suspend(struct otg_transceiver *x, int suspend)
+{
+ if (suspend)
+ twl4030_phy_suspend(1);
+ else
+ twl4030_phy_resume();
+
+ return 0;
+}
+
+static int twl4030_set_peripheral(struct otg_transceiver *xceiv, struct usb_gadget *gadget)
+{
+ struct twl4030_usb *twl = xceiv_to_twl(xceiv);
+
+ if (!xceiv)
+ return -ENODEV;
+
+ if (!gadget) {
+ OTG_IRQ_EN_REG = 0;
+ twl4030_phy_suspend(1);
+ twl->otg.gadget = NULL;
+
+ return -ENODEV;
+ }
+
+ twl->otg.gadget = gadget;
+ twl4030_phy_resume();
+
+ OTG_CTRL_REG = (OTG_CTRL_REG & OTG_CTRL_MASK
+ & ~(OTG_XCEIV_OUTPUTS|OTG_CTRL_BITS))
+ | OTG_ID;
+
+ twl->otg.state = OTG_STATE_B_IDLE;
+
+ twl4030_usb_set_bits(twl, USB_INT_EN_RISE,
+ USB_INT_SESSVALID | USB_INT_VBUSVALID);
+ twl4030_usb_set_bits(twl, USB_INT_EN_FALL,
+ USB_INT_SESSVALID | USB_INT_VBUSVALID);
+
+ return 0;
+}
+
+static int twl4030_set_host(struct otg_transceiver *xceiv, struct usb_bus *host)
+{
+ struct twl4030_usb *twl = xceiv_to_twl(xceiv);
+
+ if (!xceiv)
+ return -ENODEV;
+
+ if (!host) {
+ OTG_IRQ_EN_REG = 0;
+ twl4030_phy_suspend(1);
+ twl->otg.host = NULL;
+
+ return -ENODEV;
+ }
+
+ twl->otg.host = host;
+ twl4030_phy_resume();
+
+ twl4030_usb_set_bits(twl, OTG_CTRL,
+ OTG_CTRL_DMPULLDOWN | OTG_CTRL_DPPULLDOWN);
+ twl4030_usb_set_bits(twl, USB_INT_EN_RISE, USB_INT_IDGND);
+ twl4030_usb_set_bits(twl, USB_INT_EN_FALL, USB_INT_IDGND);
+ twl4030_usb_set_bits(twl, FUNC_CTRL, FUNC_CTRL_SUSPENDM);
+ twl4030_usb_set_bits(twl, OTG_CTRL, OTG_CTRL_DRVVBUS);
+
+ return 0;
+}
static int __init twl4030_usb_init(void)
{
@@ -621,7 +711,10 @@ static int __init twl4030_usb_init(void)
the_transceiver = twl;
- twl->irq = TWL4030_MODIRQ_PWR;
+ twl->irq = TWL4030_MODIRQ_PWR;
+ twl->otg.set_host = twl4030_set_host;
+ twl->otg.set_peripheral = twl4030_set_peripheral;
+ twl->otg.set_suspend = twl4030_set_suspend;
usb_irq_disable();
status = request_irq(twl->irq, twl4030_usb_irq,
@@ -648,6 +741,8 @@ static int __init twl4030_usb_init(void)
if (twl->usb_mode == T2_USB_MODE_ULPI)
twl4030_phy_suspend(1);
+ otg_set_transceiver(&twl->otg);
+
printk(KERN_INFO "Initialized TWL4030 USB module");
return 0;
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index a76ed82..3494b99 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -476,6 +476,8 @@ extern void musb_platform_disable(struct musb *musb);
extern void musb_hnp_stop(struct musb *musb);
+extern void musb_platform_set_mode(struct musb *musb, u8 musb_mode);
+
#if defined(CONFIG_USB_TUSB6010) || \
defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX)
extern void musb_platform_try_idle(struct musb *musb, unsigned long timeout);
@@ -485,10 +487,8 @@ extern void musb_platform_try_idle(struct musb *musb, unsigned long timeout);
#ifdef CONFIG_USB_TUSB6010
extern int musb_platform_get_vbus_status(struct musb *musb);
-extern void musb_platform_set_mode(struct musb *musb, u8 musb_mode);
#else
#define musb_platform_get_vbus_status(x) 0
-#define musb_platform_set_mode(x, y) do {} while (0)
#endif
extern int __init musb_platform_init(struct musb *musb);
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index eacd6c4..caae81b 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -192,19 +192,31 @@ static int omap_set_power(struct otg_transceiver *x, unsigned mA)
return 0;
}
-static int omap_set_suspend(struct otg_transceiver *x, int suspend)
+int musb_platform_resume(struct musb *musb);
+
+void musb_platform_set_mode(struct musb *musb, u8 musb_mode)
{
- if (suspend)
- twl4030_phy_suspend(1);
- else
- twl4030_phy_resume();
- return 0;
-}
+ u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
-int musb_platform_resume(struct musb *musb);
+ devctl |= MUSB_DEVCTL_SESSION;
+ musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+
+ switch (musb_mode) {
+ case MUSB_HOST:
+ otg_set_host(&musb->xceiv, musb->xceiv.host);
+ break;
+ case MUSB_PERIPHERAL:
+ otg_set_peripheral(&musb->xceiv, musb->xceiv.gadget);
+ break;
+ case MUSB_OTG:
+ break;
+ }
+}
int __init musb_platform_init(struct musb *musb)
{
+ struct otg_transceiver *xceiv = otg_get_transceiver();
+
#if defined(CONFIG_ARCH_OMAP2430)
omap_cfg_reg(AE5_2430_USB0HS_STP);
/* get the clock */
@@ -215,7 +227,7 @@ int __init musb_platform_init(struct musb *musb)
if(IS_ERR(musb->clock))
return PTR_ERR(musb->clock);
- musb->xceiv.set_suspend = omap_set_suspend;
+ musb->xceiv = *xceiv;
musb_platform_resume(musb);
OTG_INTERFSEL_REG |= ULPI_12PIN;
diff --git a/drivers/usb/musb/omap2430.h b/drivers/usb/musb/omap2430.h
index e89d7bd..d036382 100644
--- a/drivers/usb/musb/omap2430.h
+++ b/drivers/usb/musb/omap2430.h
@@ -14,14 +14,6 @@
#include <asm/arch/hardware.h>
#include <asm/arch/usb.h>
-#if defined(CONFIG_TWL4030_USB_HS_ULPI)
-extern void twl4030_phy_suspend(int controller_off);
-extern void twl4030_phy_resume(void);
-#else
-#define twl4030_phy_suspend(x) do {} while (0)
-#define twl4030_phy_resume() do {} while (0)
-#endif
-
/*
* OMAP2430-specific definitions
*/
--
1.5.5.rc1.12.g660b9
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/7] I2C: TWL4030: Reorganize code in twl4030-usb.c
2008-03-27 17:16 ` [PATCH 5/7] I2C: TWL4030: Make twl4030-usb.c initialize otg_transceiver Felipe Balbi
@ 2008-03-27 17:16 ` Felipe Balbi
2008-03-27 17:16 ` [PATCH 7/7] USB: MUSB: Let board specific code handle clock initialization Felipe Balbi
0 siblings, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2008-03-27 17:16 UTC (permalink / raw)
To: linux-omap; +Cc: Felipe Balbi
Code flow now makes sense.
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/i2c/chips/twl4030-usb.c | 131 +++++++++++++++++++--------------------
1 files changed, 64 insertions(+), 67 deletions(-)
diff --git a/drivers/i2c/chips/twl4030-usb.c b/drivers/i2c/chips/twl4030-usb.c
index 136e1c6..2db1c63 100644
--- a/drivers/i2c/chips/twl4030-usb.c
+++ b/drivers/i2c/chips/twl4030-usb.c
@@ -496,45 +496,6 @@ static void usb_irq_disable(void)
return;
}
-static void twl4030_phy_suspend(int controller_off);
-static void twl4030_phy_resume(void);
-
-static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
-{
- int ret = IRQ_NONE;
- u8 val;
-
- if (twl4030_i2c_read_u8(TWL4030_MODULE_INT, &val, REG_PWR_ISR1) < 0) {
- printk(KERN_ERR "twl4030_usb: i2c read failed,"
- " line %d\n", __LINE__);
- goto done;
- }
-
- /* this interrupt line may be shared */
- if (!(val & USB_PRES))
- goto done;
-
- /* clear the interrupt */
- twl4030_i2c_write_u8(TWL4030_MODULE_INT, USB_PRES, REG_PWR_ISR1);
-
- /* action based on cable attach or detach */
- if (twl4030_i2c_read_u8(TWL4030_MODULE_INT, &val, REG_PWR_EDR1) < 0) {
- printk(KERN_ERR "twl4030_usb: i2c read failed,"
- " line %d\n", __LINE__);
- goto done;
- }
-
- if (val & USB_PRES_RISING)
- twl4030_phy_resume();
- else
- twl4030_phy_suspend(0);
-
- ret = IRQ_HANDLED;
-
-done:
- return ret;
-}
-
static void twl4030_phy_power(struct twl4030_usb *twl, int on)
{
u8 pwr;
@@ -561,34 +522,6 @@ static void twl4030_phy_power(struct twl4030_usb *twl, int on)
return;
}
-static void twl4030_usb_ldo_init(struct twl4030_usb *twl)
-{
- /* Enable writing to power configuration registers */
- twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0xC0, PROTECT_KEY);
- twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0x0C, PROTECT_KEY);
-
- /* put VUSB3V1 LDO in active state */
- twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);
-
- /* input to VUSB3V1 LDO is from VBAT, not VBUS */
- twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1);
-
- /* turn on 3.1V regulator */
- twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20, VUSB3V1_DEV_GRP);
- twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_TYPE);
-
- /* turn on 1.5V regulator */
- twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20, VUSB1V5_DEV_GRP);
- twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_TYPE);
-
- /* turn on 1.8V regulator */
- twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20, VUSB1V8_DEV_GRP);
- twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE);
-
- /* disable access to power configuration registers */
- twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, PROTECT_KEY);
-}
-
static void twl4030_phy_suspend(int controller_off)
{
struct twl4030_usb *twl = the_transceiver;
@@ -627,6 +560,70 @@ static void twl4030_phy_resume(void)
return;
}
+static void twl4030_usb_ldo_init(struct twl4030_usb *twl)
+{
+ /* Enable writing to power configuration registers */
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0xC0, PROTECT_KEY);
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0x0C, PROTECT_KEY);
+
+ /* put VUSB3V1 LDO in active state */
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);
+
+ /* input to VUSB3V1 LDO is from VBAT, not VBUS */
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1);
+
+ /* turn on 3.1V regulator */
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20, VUSB3V1_DEV_GRP);
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_TYPE);
+
+ /* turn on 1.5V regulator */
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20, VUSB1V5_DEV_GRP);
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_TYPE);
+
+ /* turn on 1.8V regulator */
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20, VUSB1V8_DEV_GRP);
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE);
+
+ /* disable access to power configuration registers */
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, PROTECT_KEY);
+}
+
+static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
+{
+ int ret = IRQ_NONE;
+ u8 val;
+
+ if (twl4030_i2c_read_u8(TWL4030_MODULE_INT, &val, REG_PWR_ISR1) < 0) {
+ printk(KERN_ERR "twl4030_usb: i2c read failed,"
+ " line %d\n", __LINE__);
+ goto done;
+ }
+
+ /* this interrupt line may be shared */
+ if (!(val & USB_PRES))
+ goto done;
+
+ /* clear the interrupt */
+ twl4030_i2c_write_u8(TWL4030_MODULE_INT, USB_PRES, REG_PWR_ISR1);
+
+ /* action based on cable attach or detach */
+ if (twl4030_i2c_read_u8(TWL4030_MODULE_INT, &val, REG_PWR_EDR1) < 0) {
+ printk(KERN_ERR "twl4030_usb: i2c read failed,"
+ " line %d\n", __LINE__);
+ goto done;
+ }
+
+ if (val & USB_PRES_RISING)
+ twl4030_phy_resume();
+ else
+ twl4030_phy_suspend(0);
+
+ ret = IRQ_HANDLED;
+
+done:
+ return ret;
+}
+
static int twl4030_set_suspend(struct otg_transceiver *x, int suspend)
{
if (suspend)
--
1.5.5.rc1.12.g660b9
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 7/7] USB: MUSB: Let board specific code handle clock initialization
2008-03-27 17:16 ` [PATCH 6/7] I2C: TWL4030: Reorganize code in twl4030-usb.c Felipe Balbi
@ 2008-03-27 17:16 ` Felipe Balbi
2008-03-27 17:42 ` Felipe Balbi
0 siblings, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2008-03-27 17:16 UTC (permalink / raw)
To: linux-omap; +Cc: Felipe Balbi
Instead of clk_get() in omap2430.c driver, we can let
musb_core.c do it by setting the clock id in
musb_platform_data structure.
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
arch/arm/mach-omap2/board-2430sdp-usb.c | 27 +++++++++++++++++++++++++++
arch/arm/mach-omap2/board-3430sdp-usb.c | 29 +++++++++++++++++++++++++++--
drivers/usb/musb/omap2430.c | 8 --------
3 files changed, 54 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-omap2/board-2430sdp-usb.c b/arch/arm/mach-omap2/board-2430sdp-usb.c
index 908a0c0..7f4e017 100644
--- a/arch/arm/mach-omap2/board-2430sdp-usb.c
+++ b/arch/arm/mach-omap2/board-2430sdp-usb.c
@@ -13,9 +13,11 @@
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
+#include <linux/clk.h>
#include <linux/usb/musb.h>
#include <asm/arch/hardware.h>
+#include <asm/arch/pm.h>
#include <asm/arch/usb.h>
static struct resource musb_resources[] = {
@@ -34,6 +36,29 @@ static struct resource musb_resources[] = {
},
};
+static int usbhs_ick_on;
+
+static int musb_set_clock(struct clk *clk, int state)
+{
+ if (state) {
+ if (usbhs_ick_on > 0)
+ return -ENODEV;
+
+ omap2_block_sleep();
+ clk_enable(clk);
+ usbhs_ick_on = 1;
+ } else {
+ if (usbhs_ick_on == 0)
+ return -ENODEV;
+
+ clk_disable(clk);
+ usbhs_ick_on = 0;
+ omap2_allow_sleep();
+ }
+
+ return 0;
+}
+
static struct musb_hdrc_platform_data musb_plat = {
#ifdef CONFIG_USB_MUSB_OTG
.mode = MUSB_OTG,
@@ -43,6 +68,8 @@ static struct musb_hdrc_platform_data musb_plat = {
.mode = MUSB_PERIPHERAL,
#endif
.multipoint = 1,
+ .clock = "usbhs_ick",
+ .set_clock = musb_set_clock,
};
static u64 musb_dmamask = ~(u32)0;
diff --git a/arch/arm/mach-omap2/board-3430sdp-usb.c b/arch/arm/mach-omap2/board-3430sdp-usb.c
index 77088b4..81c9af7 100644
--- a/arch/arm/mach-omap2/board-3430sdp-usb.c
+++ b/arch/arm/mach-omap2/board-3430sdp-usb.c
@@ -16,11 +16,13 @@
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
+#include <linux/clk.h>
#include <asm/io.h>
#include <asm/arch/mux.h>
#include <linux/usb/musb.h>
#include <asm/arch/hardware.h>
+#include <asm/arch/pm.h>
#include <asm/arch/usb.h>
#ifdef CONFIG_USB_MUSB_SOC
@@ -40,6 +42,29 @@ static struct resource musb_resources[] = {
},
};
+static int hsotgusb_ick_on;
+
+static int musb_set_clock(struct clk *clk, int state)
+{
+ if (state) {
+ if (hsotgusb_ick_on > 0)
+ return -ENODEV;
+
+ omap2_block_sleep();
+ clk_enable(clk);
+ hsotgusb_ick_on = 1;
+ } else {
+ if (hsotgusb_ick_on == 0)
+ return -ENODEV;
+
+ clk_disable(clk);
+ hsotgusb_ick_on = 0;
+ omap2_allow_sleep();
+ }
+
+ return 0;
+}
+
static struct musb_hdrc_platform_data musb_plat = {
#ifdef CONFIG_USB_MUSB_OTG
.mode = MUSB_OTG,
@@ -49,8 +74,8 @@ static struct musb_hdrc_platform_data musb_plat = {
.mode = MUSB_PERIPHERAL,
#endif
.multipoint = 1,
- .clock = NULL,
- .set_clock = NULL,
+ .clock = "hsotgusb_ick",
+ .set_clock = musb_set_clock,
};
static u64 musb_dmamask = ~(u32)0;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index caae81b..364d746 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -219,13 +219,7 @@ int __init musb_platform_init(struct musb *musb)
#if defined(CONFIG_ARCH_OMAP2430)
omap_cfg_reg(AE5_2430_USB0HS_STP);
- /* get the clock */
- musb->clock = clk_get((struct device *)musb->controller, "usbhs_ick");
-#else
- musb->clock = clk_get((struct device *)musb->controller, "hsotgusb_ick");
#endif
- if(IS_ERR(musb->clock))
- return PTR_ERR(musb->clock);
musb->xceiv = *xceiv;
musb_platform_resume(musb);
@@ -261,13 +255,11 @@ int musb_platform_suspend(struct musb *musb)
OTG_SYSCONFIG_REG |= AUTOIDLE; /* enable auto idle */
musb->xceiv.set_suspend(&musb->xceiv, 1);
- clk_disable(musb->clock);
return 0;
}
int musb_platform_resume(struct musb *musb)
{
- clk_enable(musb->clock);
musb->xceiv.set_suspend(&musb->xceiv, 0);
OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */
--
1.5.5.rc1.12.g660b9
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 7/7] USB: MUSB: Let board specific code handle clock initialization
2008-03-27 17:16 ` [PATCH 7/7] USB: MUSB: Let board specific code handle clock initialization Felipe Balbi
@ 2008-03-27 17:42 ` Felipe Balbi
0 siblings, 0 replies; 13+ messages in thread
From: Felipe Balbi @ 2008-03-27 17:42 UTC (permalink / raw)
To: Felipe Balbi; +Cc: linux-omap
On Thu, Mar 27, 2008 at 07:16:07PM +0200, Felipe Balbi wrote:
> Instead of clk_get() in omap2430.c driver, we can let
> musb_core.c do it by setting the clock id in
> musb_platform_data structure.
board-rx51-usb.c was missing,
updated below:
>From 14e0ef4901509ac229aecc561c248a96d70ac46d Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.balbi@nokia.com>
Date: Tue, 25 Mar 2008 15:18:16 +0200
Subject: [PATCH 7/7] USB: MUSB: Let board specific code handle clock initialization
Instead of clk_get() in omap2430.c driver, we can let
musb_core.c do it by setting the clock id in
musb_platform_data structure.
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
arch/arm/mach-omap2/board-2430sdp-usb.c | 27 +++++++++++++++++++++++++++
arch/arm/mach-omap2/board-3430sdp-usb.c | 29 +++++++++++++++++++++++++++--
arch/arm/mach-omap2/board-rx51-usb.c | 26 +++++++++++++++++++++++++-
drivers/usb/musb/omap2430.c | 8 --------
4 files changed, 79 insertions(+), 11 deletions(-)
diff --git a/arch/arm/mach-omap2/board-2430sdp-usb.c b/arch/arm/mach-omap2/board-2430sdp-usb.c
index 908a0c0..7f4e017 100644
--- a/arch/arm/mach-omap2/board-2430sdp-usb.c
+++ b/arch/arm/mach-omap2/board-2430sdp-usb.c
@@ -13,9 +13,11 @@
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
+#include <linux/clk.h>
#include <linux/usb/musb.h>
#include <asm/arch/hardware.h>
+#include <asm/arch/pm.h>
#include <asm/arch/usb.h>
static struct resource musb_resources[] = {
@@ -34,6 +36,29 @@ static struct resource musb_resources[] = {
},
};
+static int usbhs_ick_on;
+
+static int musb_set_clock(struct clk *clk, int state)
+{
+ if (state) {
+ if (usbhs_ick_on > 0)
+ return -ENODEV;
+
+ omap2_block_sleep();
+ clk_enable(clk);
+ usbhs_ick_on = 1;
+ } else {
+ if (usbhs_ick_on == 0)
+ return -ENODEV;
+
+ clk_disable(clk);
+ usbhs_ick_on = 0;
+ omap2_allow_sleep();
+ }
+
+ return 0;
+}
+
static struct musb_hdrc_platform_data musb_plat = {
#ifdef CONFIG_USB_MUSB_OTG
.mode = MUSB_OTG,
@@ -43,6 +68,8 @@ static struct musb_hdrc_platform_data musb_plat = {
.mode = MUSB_PERIPHERAL,
#endif
.multipoint = 1,
+ .clock = "usbhs_ick",
+ .set_clock = musb_set_clock,
};
static u64 musb_dmamask = ~(u32)0;
diff --git a/arch/arm/mach-omap2/board-3430sdp-usb.c b/arch/arm/mach-omap2/board-3430sdp-usb.c
index 77088b4..81c9af7 100644
--- a/arch/arm/mach-omap2/board-3430sdp-usb.c
+++ b/arch/arm/mach-omap2/board-3430sdp-usb.c
@@ -16,11 +16,13 @@
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
+#include <linux/clk.h>
#include <asm/io.h>
#include <asm/arch/mux.h>
#include <linux/usb/musb.h>
#include <asm/arch/hardware.h>
+#include <asm/arch/pm.h>
#include <asm/arch/usb.h>
#ifdef CONFIG_USB_MUSB_SOC
@@ -40,6 +42,29 @@ static struct resource musb_resources[] = {
},
};
+static int hsotgusb_ick_on;
+
+static int musb_set_clock(struct clk *clk, int state)
+{
+ if (state) {
+ if (hsotgusb_ick_on > 0)
+ return -ENODEV;
+
+ omap2_block_sleep();
+ clk_enable(clk);
+ hsotgusb_ick_on = 1;
+ } else {
+ if (hsotgusb_ick_on == 0)
+ return -ENODEV;
+
+ clk_disable(clk);
+ hsotgusb_ick_on = 0;
+ omap2_allow_sleep();
+ }
+
+ return 0;
+}
+
static struct musb_hdrc_platform_data musb_plat = {
#ifdef CONFIG_USB_MUSB_OTG
.mode = MUSB_OTG,
@@ -49,8 +74,8 @@ static struct musb_hdrc_platform_data musb_plat = {
.mode = MUSB_PERIPHERAL,
#endif
.multipoint = 1,
- .clock = NULL,
- .set_clock = NULL,
+ .clock = "hsotgusb_ick",
+ .set_clock = musb_set_clock,
};
static u64 musb_dmamask = ~(u32)0;
diff --git a/arch/arm/mach-omap2/board-rx51-usb.c b/arch/arm/mach-omap2/board-rx51-usb.c
index 3c85dd0..f6e2a0b 100644
--- a/arch/arm/mach-omap2/board-rx51-usb.c
+++ b/arch/arm/mach-omap2/board-rx51-usb.c
@@ -62,10 +62,34 @@ static struct resource musb_resources[] = {
},
};
+static int hsotgusb_ick_on;
+
+static int musb_set_clock(struct clk *clk, int state)
+{
+ if (state) {
+ if (hsotgusb_ick_on > 0)
+ return -ENODEV;
+
+ omap2_block_sleep();
+ clk_enable(clk);
+ hsotgusb_ick_on = 1;
+ } else {
+ if (hsotgusb_ick_on == 0)
+ return -ENODEV;
+
+ clk_disable(clk);
+ hsotgusb_ick_on = 0;
+ omap2_allow_sleep();
+ }
+
+ return 0;
+}
+
static struct musb_hdrc_platform_data musb_plat = {
.mode = BOARD_MODE,
- .clock = NULL,
.multipoint = 1,
+ .clock = "hsotgusb_ick",
+ .set_clock = musb_set_clock,
#ifdef CONFIG_USB_OTG_TPL
.otg_tpl = tpl_table,
#endif
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index efdb795..29927d0 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -219,13 +219,7 @@ int __init musb_platform_init(struct musb *musb)
#if defined(CONFIG_ARCH_OMAP2430)
omap_cfg_reg(AE5_2430_USB0HS_STP);
- /* get the clock */
- musb->clock = clk_get((struct device *)musb->controller, "usbhs_ick");
-#else
- musb->clock = clk_get((struct device *)musb->controller, "hsotgusb_ick");
#endif
- if(IS_ERR(musb->clock))
- return PTR_ERR(musb->clock);
musb->xceiv = *xceiv;
musb_platform_resume(musb);
@@ -261,13 +255,11 @@ int musb_platform_suspend(struct musb *musb)
OTG_SYSCONFIG_REG |= AUTOIDLE; /* enable auto idle */
otg_set_suspend(&musb->xceiv, 1);
- clk_disable(musb->clock);
return 0;
}
int musb_platform_resume(struct musb *musb)
{
- clk_enable(musb->clock);
otg_set_suspend(&musb->xceiv, 0);
OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */
--
1.5.5.rc1.12.g660b9
--
- Balbi
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 0/7] twl4030 changes
2008-03-27 17:16 [PATCH 0/7] twl4030 changes Felipe Balbi
2008-03-27 17:16 ` [PATCH 1/7] I2C: TWL4030: Move twl4030's headers under include/linux/i2c/ Felipe Balbi
@ 2008-03-28 7:49 ` Tony Lindgren
2008-03-28 10:15 ` Felipe Balbi
1 sibling, 1 reply; 13+ messages in thread
From: Tony Lindgren @ 2008-03-28 7:49 UTC (permalink / raw)
To: Felipe Balbi; +Cc: linux-omap
* Felipe Balbi <felipe.balbi@nokia.com> [080327 19:20]:
> Hi Tony,
>
> I'm resending this series cuz I changed a bit patch #5 to set
> session bit on musb_platform_set_mode so musb core will really
> go to a_host mode when we echo sysfs.
>
> Without this small change the sysfs interface will work only with
> a few devices, most likely usb sticks.
>
> Below is a shortlog and diffstat of the changes.
Pushing this series today.
Tony
> Best regards,
>
> - Balbi
>
> Felipe Balbi (7):
> I2C: TWL4030: Move twl4030's headers under include/linux/i2c/
> I2C: TWL4030: Move all *_*.c to *-*.c
> I2C: TWL4030: General cleanup in twl4030-core.c
> I2C: TWL4030: Cleanup twl4030-usb.c
> I2C: TWL4030: Make twl4030-usb.c initialize otg_transceiver
> I2C: TWL4030: Reorganize code in twl4030-usb.c
> USB: MUSB: Let board specific code handle clock initialization
>
> arch/arm/mach-omap2/board-2430sdp-usb.c | 27 ++
> arch/arm/mach-omap2/board-3430sdp-usb.c | 29 ++-
> arch/arm/mach-omap2/board-3430sdp.c | 2 +-
> arch/arm/mach-omap2/board-sdp-hsmmc.c | 2 +-
> drivers/i2c/chips/Makefile | 8 +-
> .../i2c/chips/{twl4030_core.c => twl4030-core.c} | 80 ++++---
> .../i2c/chips/{twl4030_gpio.c => twl4030-gpio.c} | 2 +-
> .../{twl4030_poweroff.c => twl4030-poweroff.c} | 2 +-
> drivers/i2c/chips/{twl4030_usb.c => twl4030-usb.c} | 255 +++++++++++++-------
> drivers/input/keyboard/omap-twl4030keypad.c | 2 +-
> drivers/rtc/rtc-twl4030.c | 4 +-
> drivers/usb/musb/musb_core.h | 4 +-
> drivers/usb/musb/omap2430.c | 39 ++--
> drivers/usb/musb/omap2430.h | 8 -
> .../{asm-arm/arch-omap => linux/i2c}/twl4030-rtc.h | 0
> include/{asm-arm/arch-omap => linux/i2c}/twl4030.h | 0
> 16 files changed, 303 insertions(+), 161 deletions(-)
> rename drivers/i2c/chips/{twl4030_core.c => twl4030-core.c} (93%)
> rename drivers/i2c/chips/{twl4030_gpio.c => twl4030-gpio.c} (99%)
> rename drivers/i2c/chips/{twl4030_poweroff.c => twl4030-poweroff.c} (98%)
> rename drivers/i2c/chips/{twl4030_usb.c => twl4030-usb.c} (87%)
> rename include/{asm-arm/arch-omap => linux/i2c}/twl4030-rtc.h (100%)
> rename include/{asm-arm/arch-omap => linux/i2c}/twl4030.h (100%)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/7] twl4030 changes
2008-03-28 7:49 ` [PATCH 0/7] twl4030 changes Tony Lindgren
@ 2008-03-28 10:15 ` Felipe Balbi
2008-03-28 10:17 ` Tony Lindgren
0 siblings, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2008-03-28 10:15 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Felipe Balbi, linux-omap
[-- Attachment #1: Type: text/plain, Size: 693 bytes --]
On Fri, 28 Mar 2008 09:49:00 +0200, Tony Lindgren <tony@atomide.com> wrote:
> * Felipe Balbi <felipe.balbi@nokia.com> [080327 19:20]:
>> Hi Tony,
>>
>> I'm resending this series cuz I changed a bit patch #5 to set
>> session bit on musb_platform_set_mode so musb core will really
>> go to a_host mode when we echo sysfs.
>>
>> Without this small change the sysfs interface will work only with
>> a few devices, most likely usb sticks.
>>
>> Below is a shortlog and diffstat of the changes.
>
> Pushing this series today.
Hi tony,
You missed the attached patch: Let board specific codee handle clock
initialization
--
Best Regards,
Felipe Balbi
http://felipebalbi.com
me@felipebalbi.com
[-- Attachment #2: 0001-USB-MUSB-Let-board-specific-code-handle-clock-initi.diff --]
[-- Type: text/x-diff, Size: 4523 bytes --]
From ad7a01e97dadbde2ef6c43b46182272ccc201683 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.balbi@nokia.com>
Date: Tue, 18 Mar 2008 20:26:30 +0200
Subject: [PATCH 1/2] USB: MUSB: Let board specific code handle clock initialization
Instead of clk_get() in omap2430.c driver, we can let
musb_core.c do it by setting the clock id in
musb_platform_data structure.
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
arch/arm/mach-omap2/board-2430sdp-usb.c | 27 +++++++++++++++++++++++++++
arch/arm/mach-omap2/board-3430sdp-usb.c | 29 +++++++++++++++++++++++++++--
drivers/usb/musb/omap2430.c | 8 --------
3 files changed, 54 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-omap2/board-2430sdp-usb.c b/arch/arm/mach-omap2/board-2430sdp-usb.c
index 908a0c0..7f4e017 100644
--- a/arch/arm/mach-omap2/board-2430sdp-usb.c
+++ b/arch/arm/mach-omap2/board-2430sdp-usb.c
@@ -13,9 +13,11 @@
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
+#include <linux/clk.h>
#include <linux/usb/musb.h>
#include <asm/arch/hardware.h>
+#include <asm/arch/pm.h>
#include <asm/arch/usb.h>
static struct resource musb_resources[] = {
@@ -34,6 +36,29 @@ static struct resource musb_resources[] = {
},
};
+static int usbhs_ick_on;
+
+static int musb_set_clock(struct clk *clk, int state)
+{
+ if (state) {
+ if (usbhs_ick_on > 0)
+ return -ENODEV;
+
+ omap2_block_sleep();
+ clk_enable(clk);
+ usbhs_ick_on = 1;
+ } else {
+ if (usbhs_ick_on == 0)
+ return -ENODEV;
+
+ clk_disable(clk);
+ usbhs_ick_on = 0;
+ omap2_allow_sleep();
+ }
+
+ return 0;
+}
+
static struct musb_hdrc_platform_data musb_plat = {
#ifdef CONFIG_USB_MUSB_OTG
.mode = MUSB_OTG,
@@ -43,6 +68,8 @@ static struct musb_hdrc_platform_data musb_plat = {
.mode = MUSB_PERIPHERAL,
#endif
.multipoint = 1,
+ .clock = "usbhs_ick",
+ .set_clock = musb_set_clock,
};
static u64 musb_dmamask = ~(u32)0;
diff --git a/arch/arm/mach-omap2/board-3430sdp-usb.c b/arch/arm/mach-omap2/board-3430sdp-usb.c
index 77088b4..81c9af7 100644
--- a/arch/arm/mach-omap2/board-3430sdp-usb.c
+++ b/arch/arm/mach-omap2/board-3430sdp-usb.c
@@ -16,11 +16,13 @@
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
+#include <linux/clk.h>
#include <asm/io.h>
#include <asm/arch/mux.h>
#include <linux/usb/musb.h>
#include <asm/arch/hardware.h>
+#include <asm/arch/pm.h>
#include <asm/arch/usb.h>
#ifdef CONFIG_USB_MUSB_SOC
@@ -40,6 +42,29 @@ static struct resource musb_resources[] = {
},
};
+static int hsotgusb_ick_on;
+
+static int musb_set_clock(struct clk *clk, int state)
+{
+ if (state) {
+ if (hsotgusb_ick_on > 0)
+ return -ENODEV;
+
+ omap2_block_sleep();
+ clk_enable(clk);
+ hsotgusb_ick_on = 1;
+ } else {
+ if (hsotgusb_ick_on == 0)
+ return -ENODEV;
+
+ clk_disable(clk);
+ hsotgusb_ick_on = 0;
+ omap2_allow_sleep();
+ }
+
+ return 0;
+}
+
static struct musb_hdrc_platform_data musb_plat = {
#ifdef CONFIG_USB_MUSB_OTG
.mode = MUSB_OTG,
@@ -49,8 +74,8 @@ static struct musb_hdrc_platform_data musb_plat = {
.mode = MUSB_PERIPHERAL,
#endif
.multipoint = 1,
- .clock = NULL,
- .set_clock = NULL,
+ .clock = "hsotgusb_ick",
+ .set_clock = musb_set_clock,
};
static u64 musb_dmamask = ~(u32)0;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index caae81b..364d746 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -219,13 +219,7 @@ int __init musb_platform_init(struct musb *musb)
#if defined(CONFIG_ARCH_OMAP2430)
omap_cfg_reg(AE5_2430_USB0HS_STP);
- /* get the clock */
- musb->clock = clk_get((struct device *)musb->controller, "usbhs_ick");
-#else
- musb->clock = clk_get((struct device *)musb->controller, "hsotgusb_ick");
#endif
- if(IS_ERR(musb->clock))
- return PTR_ERR(musb->clock);
musb->xceiv = *xceiv;
musb_platform_resume(musb);
@@ -261,13 +255,11 @@ int musb_platform_suspend(struct musb *musb)
OTG_SYSCONFIG_REG |= AUTOIDLE; /* enable auto idle */
musb->xceiv.set_suspend(&musb->xceiv, 1);
- clk_disable(musb->clock);
return 0;
}
int musb_platform_resume(struct musb *musb)
{
- clk_enable(musb->clock);
musb->xceiv.set_suspend(&musb->xceiv, 0);
OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */
--
1.5.5.rc1.12.g660b9
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 0/7] twl4030 changes
2008-03-28 10:15 ` Felipe Balbi
@ 2008-03-28 10:17 ` Tony Lindgren
0 siblings, 0 replies; 13+ messages in thread
From: Tony Lindgren @ 2008-03-28 10:17 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Felipe Balbi, linux-omap
* Felipe Balbi <me@felipebalbi.com> [080328 12:16]:
>
>
> On Fri, 28 Mar 2008 09:49:00 +0200, Tony Lindgren <tony@atomide.com> wrote:
> > * Felipe Balbi <felipe.balbi@nokia.com> [080327 19:20]:
> >> Hi Tony,
> >>
> >> I'm resending this series cuz I changed a bit patch #5 to set
> >> session bit on musb_platform_set_mode so musb core will really
> >> go to a_host mode when we echo sysfs.
> >>
> >> Without this small change the sysfs interface will work only with
> >> a few devices, most likely usb sticks.
> >>
> >> Below is a shortlog and diffstat of the changes.
> >
> > Pushing this series today.
>
> Hi tony,
>
> You missed the attached patch: Let board specific codee handle clock
> initialization
Oops, sorry pushing.
Tony
>
> --
> Best Regards,
>
> Felipe Balbi
> http://felipebalbi.com
> me@felipebalbi.com
> From ad7a01e97dadbde2ef6c43b46182272ccc201683 Mon Sep 17 00:00:00 2001
> From: Felipe Balbi <felipe.balbi@nokia.com>
> Date: Tue, 18 Mar 2008 20:26:30 +0200
> Subject: [PATCH 1/2] USB: MUSB: Let board specific code handle clock initialization
>
> Instead of clk_get() in omap2430.c driver, we can let
> musb_core.c do it by setting the clock id in
> musb_platform_data structure.
>
> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
> ---
> arch/arm/mach-omap2/board-2430sdp-usb.c | 27 +++++++++++++++++++++++++++
> arch/arm/mach-omap2/board-3430sdp-usb.c | 29 +++++++++++++++++++++++++++--
> drivers/usb/musb/omap2430.c | 8 --------
> 3 files changed, 54 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-2430sdp-usb.c b/arch/arm/mach-omap2/board-2430sdp-usb.c
> index 908a0c0..7f4e017 100644
> --- a/arch/arm/mach-omap2/board-2430sdp-usb.c
> +++ b/arch/arm/mach-omap2/board-2430sdp-usb.c
> @@ -13,9 +13,11 @@
> #include <linux/errno.h>
> #include <linux/delay.h>
> #include <linux/platform_device.h>
> +#include <linux/clk.h>
> #include <linux/usb/musb.h>
>
> #include <asm/arch/hardware.h>
> +#include <asm/arch/pm.h>
> #include <asm/arch/usb.h>
>
> static struct resource musb_resources[] = {
> @@ -34,6 +36,29 @@ static struct resource musb_resources[] = {
> },
> };
>
> +static int usbhs_ick_on;
> +
> +static int musb_set_clock(struct clk *clk, int state)
> +{
> + if (state) {
> + if (usbhs_ick_on > 0)
> + return -ENODEV;
> +
> + omap2_block_sleep();
> + clk_enable(clk);
> + usbhs_ick_on = 1;
> + } else {
> + if (usbhs_ick_on == 0)
> + return -ENODEV;
> +
> + clk_disable(clk);
> + usbhs_ick_on = 0;
> + omap2_allow_sleep();
> + }
> +
> + return 0;
> +}
> +
> static struct musb_hdrc_platform_data musb_plat = {
> #ifdef CONFIG_USB_MUSB_OTG
> .mode = MUSB_OTG,
> @@ -43,6 +68,8 @@ static struct musb_hdrc_platform_data musb_plat = {
> .mode = MUSB_PERIPHERAL,
> #endif
> .multipoint = 1,
> + .clock = "usbhs_ick",
> + .set_clock = musb_set_clock,
> };
>
> static u64 musb_dmamask = ~(u32)0;
> diff --git a/arch/arm/mach-omap2/board-3430sdp-usb.c b/arch/arm/mach-omap2/board-3430sdp-usb.c
> index 77088b4..81c9af7 100644
> --- a/arch/arm/mach-omap2/board-3430sdp-usb.c
> +++ b/arch/arm/mach-omap2/board-3430sdp-usb.c
> @@ -16,11 +16,13 @@
> #include <linux/errno.h>
> #include <linux/delay.h>
> #include <linux/platform_device.h>
> +#include <linux/clk.h>
> #include <asm/io.h>
> #include <asm/arch/mux.h>
> #include <linux/usb/musb.h>
>
> #include <asm/arch/hardware.h>
> +#include <asm/arch/pm.h>
> #include <asm/arch/usb.h>
>
> #ifdef CONFIG_USB_MUSB_SOC
> @@ -40,6 +42,29 @@ static struct resource musb_resources[] = {
> },
> };
>
> +static int hsotgusb_ick_on;
> +
> +static int musb_set_clock(struct clk *clk, int state)
> +{
> + if (state) {
> + if (hsotgusb_ick_on > 0)
> + return -ENODEV;
> +
> + omap2_block_sleep();
> + clk_enable(clk);
> + hsotgusb_ick_on = 1;
> + } else {
> + if (hsotgusb_ick_on == 0)
> + return -ENODEV;
> +
> + clk_disable(clk);
> + hsotgusb_ick_on = 0;
> + omap2_allow_sleep();
> + }
> +
> + return 0;
> +}
> +
> static struct musb_hdrc_platform_data musb_plat = {
> #ifdef CONFIG_USB_MUSB_OTG
> .mode = MUSB_OTG,
> @@ -49,8 +74,8 @@ static struct musb_hdrc_platform_data musb_plat = {
> .mode = MUSB_PERIPHERAL,
> #endif
> .multipoint = 1,
> - .clock = NULL,
> - .set_clock = NULL,
> + .clock = "hsotgusb_ick",
> + .set_clock = musb_set_clock,
> };
>
> static u64 musb_dmamask = ~(u32)0;
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> index caae81b..364d746 100644
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -219,13 +219,7 @@ int __init musb_platform_init(struct musb *musb)
>
> #if defined(CONFIG_ARCH_OMAP2430)
> omap_cfg_reg(AE5_2430_USB0HS_STP);
> - /* get the clock */
> - musb->clock = clk_get((struct device *)musb->controller, "usbhs_ick");
> -#else
> - musb->clock = clk_get((struct device *)musb->controller, "hsotgusb_ick");
> #endif
> - if(IS_ERR(musb->clock))
> - return PTR_ERR(musb->clock);
>
> musb->xceiv = *xceiv;
> musb_platform_resume(musb);
> @@ -261,13 +255,11 @@ int musb_platform_suspend(struct musb *musb)
> OTG_SYSCONFIG_REG |= AUTOIDLE; /* enable auto idle */
>
> musb->xceiv.set_suspend(&musb->xceiv, 1);
> - clk_disable(musb->clock);
> return 0;
> }
>
> int musb_platform_resume(struct musb *musb)
> {
> - clk_enable(musb->clock);
> musb->xceiv.set_suspend(&musb->xceiv, 0);
>
> OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */
> --
> 1.5.5.rc1.12.g660b9
>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2008-03-28 10:17 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-27 17:16 [PATCH 0/7] twl4030 changes Felipe Balbi
2008-03-27 17:16 ` [PATCH 1/7] I2C: TWL4030: Move twl4030's headers under include/linux/i2c/ Felipe Balbi
2008-03-27 17:16 ` [PATCH 2/7] I2C: TWL4030: Move all *_*.c to *-*.c Felipe Balbi
2008-03-27 17:16 ` [PATCH 3/7] I2C: TWL4030: General cleanup in twl4030-core.c Felipe Balbi
2008-03-27 17:16 ` [PATCH 4/7] I2C: TWL4030: Cleanup twl4030-usb.c Felipe Balbi
2008-03-27 17:16 ` [PATCH 5/7] I2C: TWL4030: Make twl4030-usb.c initialize otg_transceiver Felipe Balbi
2008-03-27 17:16 ` [PATCH 6/7] I2C: TWL4030: Reorganize code in twl4030-usb.c Felipe Balbi
2008-03-27 17:16 ` [PATCH 7/7] USB: MUSB: Let board specific code handle clock initialization Felipe Balbi
2008-03-27 17:42 ` Felipe Balbi
2008-03-28 7:49 ` [PATCH 0/7] twl4030 changes Tony Lindgren
2008-03-28 10:15 ` Felipe Balbi
2008-03-28 10:17 ` Tony Lindgren
-- strict thread matches above, loose matches on Subject: below --
2008-03-19 13:42 [PATCH 0/7] TWL4030 Changes Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox