musb: save dynfifo in musb struct
PATCH 1/3 musb: save dynfifo in musb struct
Save dynamic FIFO read only information for later uses such as, during musb_save/restore_context functions.
--- drivers/usb/musb/musb_core.c | 4 +++- drivers/usb/musb/musb_core.h | 1 + 2 files changed, 4 insertions(+), 1 deletions(-)
drivers/usb/musb/musb_core.c +3 -1
@@ -1328,8 +1328,10 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) reg =musb_read_configdata (mbase);strcpy (aInfo, (reg &MUSB_CONFIGDATA_UTMIDW ) ?"UTMI-16" :"UTMI-8" ); -if (reg &MUSB_CONFIGDATA_DYNFIFO ) +if (reg &MUSB_CONFIGDATA_DYNFIFO ) {strcat (aInfo,", dyn FIFOs" ); + musb->dyn_fifo = true; + }if (reg &MUSB_CONFIGDATA_MPRXE ) {strcat (aInfo,", bulk combine" );#ifdef C_MP_RX
drivers/usb/musb/musb_core.h +1 -0
@@ -411,6 +411,7 @@ struct musb { unsigned hb_iso_rx:1; /* high bandwidth iso rx? */ unsigned hb_iso_tx:1; /* high bandwidth iso tx? */ + unsigned dyn_fifo:1; /* dynamic FIFO supported? */#ifdef C_MP_TX unsigned bulk_split:1;
Signature · 6 lines
1.6.2.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1260797982-28880-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org
PATCH v3 2/3 musb: Add context save and restore support
Adding support for MUSB register save and restore during system suspend and resume.
Changes:
- Added musb_save/restore_context() functions
- Added platform specific musb_platform_save/restore_context() to handle platform specific jobs.
- Maintaining BlackFin compatibility by adding read/write functions for registers which are not available in BlackFin
Tested system suspend and resume on OMAP3EVM board.
---
Changes from v2:
- Saving/Restoring host only registers within is_host_enabled() check.
- Saving/Restoring Tx/Rx FIFOSZ/FIFOADDR within musb->dynfifo check.
drivers/usb/musb/musb_core.c | 157 +++++++++++++++++++++++++++++++++++++++++- drivers/usb/musb/musb_core.h | 39 ++++++++++ drivers/usb/musb/musb_regs.h | 90 ++++++++++++++++++++++++ drivers/usb/musb/omap2430.c | 16 ++++ 4 files changed, 300 insertions(+), 2 deletions(-)
drivers/usb/musb/musb_core.c +155 -2
@@ -2167,11 +2167,154 @@ static int __devexit musb_remove(struct platform_device *pdev)#ifdef CONFIG_PM +static struct musb_context_registers musb_context; + +void musb_save_context (struct musb *musb) +{ +int i; +void __iomem *musb_base = musb->mregs; + +if (is_host_enabled (musb)) { + musb_context.frame =musb_readw (musb_base,MUSB_FRAME ); + musb_context.testmode =musb_readb (musb_base,MUSB_TESTMODE ); + } + musb_context.power =musb_readb (musb_base,MUSB_POWER ); + musb_context.intrtxe =musb_readw (musb_base,MUSB_INTRTXE ); + musb_context.intrrxe =musb_readw (musb_base,MUSB_INTRRXE ); + musb_context.intrusbe =musb_readb (musb_base,MUSB_INTRUSBE ); + musb_context.index =musb_readb (musb_base,MUSB_INDEX ); + musb_context.devctl =musb_readb (musb_base,MUSB_DEVCTL ); + +for (i =0 ; i <MUSB_C_NUM_EPS ; ++i) { +musb_writeb (musb_base,MUSB_INDEX , i); + musb_context.index_regs[i].txmaxp = +musb_readw (musb_base,0x10 +MUSB_TXMAXP ); + musb_context.index_regs[i].txcsr = +musb_readw (musb_base,0x10 +MUSB_TXCSR ); + musb_context.index_regs[i].rxmaxp = +musb_readw (musb_base,0x10 +MUSB_RXMAXP ); + musb_context.index_regs[i].rxcsr = +musb_readw (musb_base,0x10 +MUSB_RXCSR ); + +if (musb->dyn_fifo) { + musb_context.index_regs[i].txfifoadd = +musb_read_txfifoadd (musb_base); + musb_context.index_regs[i].rxfifoadd = +musb_read_rxfifoadd (musb_base); + musb_context.index_regs[i].txfifosz = +musb_read_txfifosz (musb_base); + musb_context.index_regs[i].rxfifosz = +musb_read_rxfifosz (musb_base); + } +if (is_host_enabled (musb)) { + musb_context.index_regs[i].txtype = +musb_readb (musb_base,0x10 +MUSB_TXTYPE ); + musb_context.index_regs[i].txinterval = +musb_readb (musb_base,0x10 +MUSB_TXINTERVAL ); + musb_context.index_regs[i].rxtype = +musb_readb (musb_base,0x10 +MUSB_RXTYPE ); + musb_context.index_regs[i].rxinterval = +musb_readb (musb_base,0x10 +MUSB_RXINTERVAL ); + + musb_context.index_regs[i].txfunaddr = +musb_read_txfunaddr (musb_base, i); + musb_context.index_regs[i].txhubaddr = +musb_read_txhubaddr (musb_base, i); + musb_context.index_regs[i].txhubport = +musb_read_txhubport (musb_base, i); + + musb_context.index_regs[i].rxfunaddr = +musb_read_rxfunaddr (musb_base, i); + musb_context.index_regs[i].rxhubaddr = +musb_read_rxhubaddr (musb_base, i); + musb_context.index_regs[i].rxhubport = +musb_read_rxhubport (musb_base, i); + } + } + +musb_writeb (musb_base,MUSB_INDEX , musb_context.index); + +musb_platform_save_context (&musb_context); +} + +void musb_restore_context (struct musb *musb) +{ +int i; +void __iomem *musb_base = musb->mregs; +void __iomem *ep_target_regs; + +musb_platform_restore_context (&musb_context); + +if (is_host_enabled (musb)) { +musb_writew (musb_base,MUSB_FRAME , musb_context.frame); +musb_writeb (musb_base,MUSB_TESTMODE , musb_context.testmode); + } +musb_writeb (musb_base,MUSB_POWER , musb_context.power); +musb_writew (musb_base,MUSB_INTRTXE , musb_context.intrtxe); +musb_writew (musb_base,MUSB_INTRRXE , musb_context.intrrxe); +musb_writeb (musb_base,MUSB_INTRUSBE , musb_context.intrusbe); +musb_writeb (musb_base,MUSB_DEVCTL , musb_context.devctl); + +for (i =0 ; i <MUSB_C_NUM_EPS ; ++i) { +musb_writeb (musb_base,MUSB_INDEX , i); +musb_writew (musb_base,0x10 +MUSB_TXMAXP , + musb_context.index_regs[i].txmaxp); +musb_writew (musb_base,0x10 +MUSB_TXCSR , + musb_context.index_regs[i].txcsr); +musb_writew (musb_base,0x10 +MUSB_RXMAXP , + musb_context.index_regs[i].rxmaxp); +musb_writew (musb_base,0x10 +MUSB_RXCSR , + musb_context.index_regs[i].rxcsr); + +if (musb->dyn_fifo) { +musb_write_txfifosz (musb_base, + musb_context.index_regs[i].txfifosz); +musb_write_rxfifosz (musb_base, + musb_context.index_regs[i].rxfifosz); +musb_write_txfifoadd (musb_base, + musb_context.index_regs[i].txfifoadd); +musb_write_rxfifoadd (musb_base, + musb_context.index_regs[i].rxfifoadd); + } + +if (is_host_enabled (musb)) { +musb_writeb (musb_base,0x10 +MUSB_TXTYPE , + musb_context.index_regs[i].txtype); +musb_writeb (musb_base,0x10 +MUSB_TXINTERVAL , + musb_context.index_regs[i].txinterval); +musb_writeb (musb_base,0x10 +MUSB_RXTYPE , + musb_context.index_regs[i].rxtype); +musb_writeb (musb_base,0x10 +MUSB_RXINTERVAL , + + musb_context.index_regs[i].rxinterval); +musb_write_txfunaddr (musb_base, i, + musb_context.index_regs[i].txfunaddr); +musb_write_txhubaddr (musb_base, i, + musb_context.index_regs[i].txhubaddr); +musb_write_txhubport (musb_base, i, + musb_context.index_regs[i].txhubport); + + ep_target_regs = +musb_read_target_reg_base (i, musb_base); + +musb_write_rxfunaddr (ep_target_regs, + musb_context.index_regs[i].rxfunaddr); +musb_write_rxhubaddr (ep_target_regs, + musb_context.index_regs[i].rxhubaddr); +musb_write_rxhubport (ep_target_regs, + musb_context.index_regs[i].rxhubport); + } + } + +musb_writeb (musb_base,MUSB_INDEX , musb_context.index); +} +static int musb_suspend (struct device *dev) {struct platform_device *pdev =to_platform_device (dev);unsigned long flags;struct musb *musb =dev_to_musb (&pdev->dev); +u8 reg;if (!musb->clock)return 0 ;
@@ -2179,15 +2322,23 @@ static int musb_suspend(struct device *dev)spin_lock_irqsave (&musb->lock, flags);if (is_peripheral_active (musb)) { -/* FIXME force disconnect unless we know USB will wake -* the system up quickly enough to respond ... +/* System is entering into suspend where gadget would not be +* able to respond to host and thus it will be in an unknown +* state for host. Re-enumeration of gadget is required after +* a resume. So we force a disconnect. */ + reg =musb_readb (musb->mregs,MUSB_POWER ); + reg &= ~MUSB_POWER_SOFTCONN ; +musb_writeb (musb->mregs,MUSB_POWER , reg); + }else if (is_host_active (musb)) {/* we know all the children are suspended; sometimes * they will even be wakeup-enabled. */ } +musb_save_context (musb); +if (musb->set_clock) musb->set_clock (musb->clock,0 );else
@@ -2209,6 +2360,8 @@ static int musb_resume_noirq(struct device *dev)else clk_enable (musb->clock); +musb_restore_context (musb); +/* for static cmos like DaVinci, register values were preserved * unless for some reason the whole soc powered down or the USB * module got reset through the PSC (vs just being disabled).
drivers/usb/musb/musb_core.h +39 -0
@@ -462,6 +462,45 @@ struct musb {#endif }; +#ifdef CONFIG_PM +struct musb_csr_regs { +/* FIFO registers */ +u16 txmaxp, txcsr, rxmaxp, rxcsr; +u16 rxfifoadd, txfifoadd; +u8 txtype, txinterval, rxtype, rxinterval; +u8 rxfifosz, txfifosz; +u8 txfunaddr, txhubaddr, txhubport; +u8 rxfunaddr, rxhubaddr, rxhubport; +}; + +struct musb_context_registers { + +#if defined(CONFIG_ARCH_OMAP34XX ) +u32 otg_sysconfig, otg_forcestandby; +#endif +u8 power; +u16 intrtxe, intrrxe; +u8 intrusbe; +u16 frame; +u8 index, testmode; + +u8 devctl, misc; + +struct musb_csr_regs index_regs[MUSB_C_NUM_EPS ]; +}; + +#if defined(CONFIG_ARCH_OMAP34XX ) || defined(CONFIG_ARCH_OMAP2430 ) +extern void musb_platform_save_context (struct musb_context_registers + *musb_context); +extern void musb_platform_restore_context (struct musb_context_registers + *musb_context); +#else +#define musb_platform_save_context (x) do {} while (0) +#define musb_platform_restore_context (x) do {} while (0) +#endif + +#endif +static inline void musb_set_vbus (struct musb *musb,int is_on) { musb->board_set_vbus (musb, is_on);
drivers/usb/musb/musb_regs.h +90 -0
114 lines not on this page · raw message
drivers/usb/musb/omap2430.c +16 -0
@@ -255,6 +255,22 @@ int __init musb_platform_init(struct musb *musb)return 0 ; } +#ifdef CONFIG_PM +void musb_platform_save_context (struct musb_context_registers + *musb_context) +{ + musb_context->otg_sysconfig =omap_readl (OTG_SYSCONFIG ); + musb_context->otg_forcestandby =omap_readl (OTG_FORCESTDBY ); +} + +void musb_platform_restore_context (struct musb_context_registers + *musb_context) +{ +omap_writel (musb_context->otg_sysconfig,OTG_SYSCONFIG ); +omap_writel (musb_context->otg_forcestandby,OTG_FORCESTDBY ); +} +#endif +int musb_platform_suspend (struct musb *musb) {u32 l;
Signature · 6 lines
1.6.2.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/3 musb: Add 'extvbus' in musb_hdrc_platform_data
Some of the board might use external Vbus power supply on musb interface which would require to program ULPI_BUSCONTROL register.
Adding 'extvbus' flag which can be set from such boards which will be checked at musb driver files before programming ULPI_BUSCONTROL.
--- drivers/usb/musb/musb_core.c | 8 ++++++++ drivers/usb/musb/musb_regs.h | 5 +++++ include/linux/usb/musb.h | 3 +++ 3 files changed, 16 insertions(+), 0 deletions(-)
drivers/usb/musb/musb_core.c +8 -0
@@ -2027,6 +2027,7 @@ bad_config:/* host side needs more setup */ if (is_host_enabled (musb)) {struct usb_hcd *hcd =musb_to_hcd (musb); +u8 busctl;otg_set_host (musb->xceiv, &hcd->self);
@@ -2034,6 +2035,13 @@ bad_config: hcd->self.otg_port =1 ; musb->xceiv->host = &hcd->self; hcd->power_budget =2 * (plat->power ? :250 ); + +/* program PHY to use external vBus if required */ +if (plat->extvbus) { + busctl =musb_readb (musb->mregs,MUSB_ULPI_BUSCONTROL ); + busctl |=ULPI_USE_EXTVBUS ; +musb_writeb (musb->mregs,MUSB_ULPI_BUSCONTROL , busctl); + } }/* For the host-only role, we can activate right away.
drivers/usb/musb/musb_regs.h +5 -0
@@ -72,6 +72,10 @@#define MUSB_DEVCTL_HR 0x02#define MUSB_DEVCTL_SESSION 0x01 +/* ULPI VBUSCONTROL */ +#define ULPI_USE_EXTVBUS 0x01 +#define ULPI_USE_EXTVBUSIND 0x02 +/* TESTMODE */ #define MUSB_TEST_FORCE_HOST 0x80#define MUSB_TEST_FIFO_ACCESS 0x40
@@ -246,6 +250,7 @@/* REVISIT: vctrl/vstatus: optional vendor utmi+phy register at 0x68 */ #define MUSB_HWVERS 0x6C/* 8 bit */ +#define MUSB_ULPI_BUSCONTROL 0x70/* 8 bit */ #define MUSB_EPINFO 0x78/* 8 bit */ #define MUSB_RAMINFO 0x79/* 8 bit */
include/linux/usb/musb.h +3 -0
@@ -76,6 +76,9 @@ struct musb_hdrc_platform_data {/* (HOST or OTG) msec/2 after VBUS on till power good */ u8 potpgt; +/* (HOST or OTG) program PHY for external Vbus */ + unsigned extvbus:1; +/* Power the device on or off */ int (*set_power)(int state);
Signature · 1 line
1.6.2.4
Re: [PATCH 3/3] musb: Add 'extvbus' in musb_hdrc_platform_data
Hi,
drivers/usb/musb/musb_regs.h line 77
Quoted 11 lines · ext Ajay Kumar Gupta
drivers/usb/musb/musb_regs.h +3
-0@@ -72,6 +72,10 @@#define MUSB_DEVCTL_HR 0x02#define MUSB_DEVCTL_SESSION 0x01 +/* ULPI VBUSCONTROL */ +#define ULPI_USE_EXTVBUS 0x01 +#define ULPI_USE_EXTVBUSIND 0x02
shouldn't these go to drivers/usb/otg/ulpi.c or include/usb/ulpi.h ?
or is this musb specific ?? If it's musb specific, please prepend with MUSB_
Signature · 1 line
balbi
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH 3/3] musb: Add 'extvbus' in musb_hdrc_platform_data
Quoted 19 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Monday, December 14, 2009 10:08 PM
To: Gupta, Ajay Kumar
Cc: [email protected]; [email protected]; Balbi Felipe (Nokia-D/Helsinki); david-b-yBeKhBN/[email protected]
Subject: Re: [PATCH 3/3] musb: Add 'extvbus' inmusb_hdrc_platform_dataHi,
Quoted 8 lines · ext Ajay Kumar Gupta
drivers/usb/musb/musb_regs.h +0
-0@@ -72,6 +72,10 @@#define MUSB_DEVCTL_HR 0x02#define MUSB_DEVCTL_SESSION 0x01
Quoted 8 lines
drivers/usb/musb/musb_regs.h line 77
Quoted 3 lines
drivers/usb/musb/musb_regs.h +3
-0+/* ULPI VBUSCONTROL */ +#define ULPI_USE_EXTVBUS 0x01 +#define ULPI_USE_EXTVBUSIND 0x02shouldn't these go to
drivers/usb/otg/ulpi.corinclude/usb/ulpi.h?or is this musb specific ?? If it's musb specific, please prepend with
MUSB_
Yes, they are MUSB specific. I will append 'MUSB_' in next version.
-Ajay
Quoted 3 lines
--
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1260797982-28880-2-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org
Re: [PATCH 2/3 v3] musb: Add context save and restore support
Hi,
Quoted 20 lines · ext Ajay Kumar Gupta
drivers/usb/musb/musb_core.c +20
-0+void musb_restore_context (struct musb *musb) +{ +int i; +void __iomem *musb_base = musb->mregs; +void __iomem *ep_target_regs; + +musb_platform_restore_context (&musb_context); + +if (is_host_enabled (musb)) { +musb_writew (musb_base,MUSB_FRAME , musb_context.frame); +musb_writeb (musb_base,MUSB_TESTMODE , musb_context.testmode); + } +musb_writeb (musb_base,MUSB_POWER , musb_context.power); +musb_writew (musb_base,MUSB_INTRTXE , musb_context.intrtxe); +musb_writew (musb_base,MUSB_INTRRXE , musb_context.intrrxe); +musb_writeb (musb_base,MUSB_INTRUSBE , musb_context.intrusbe); +musb_writeb (musb_base,MUSB_DEVCTL , musb_context.devctl); + +for (i =0 ; i <MUSB_C_NUM_EPS ; ++i) { +musb_writeb (musb_base,MUSB_INDEX , i);
drivers/usb/musb/musb_core.c static int __devexit musb_remove(struct platform_device *pdev) · line 2269
Quoted 10 lines
drivers/usb/musb/musb_core.c +10
-0+musb_writew (musb_base,0x10 +MUSB_TXMAXP , + musb_context.index_regs[i].txmaxp); +musb_writew (musb_base,0x10 +MUSB_TXCSR , + musb_context.index_regs[i].txcsr); +musb_writew (musb_base,0x10 +MUSB_RXMAXP , + musb_context.index_regs[i].rxmaxp); +musb_writew (musb_base,0x10 +MUSB_RXCSR , + musb_context.index_regs[i].rxcsr); + +if (musb->dyn_fifo) {
if (musb->config->dyn_fifo)
Quoted 5 lines
drivers/usb/musb/musb_core.c +0
-1@@ -2179,15 +2322,23 @@ static int musb_suspend(struct device *dev)spin_lock_irqsave (&musb->lock, flags);if (is_peripheral_active (musb)) { -/* FIXME force disconnect unless we know USB will wake
drivers/usb/musb/musb_core.c static int musb_suspend(struct device *dev) · line 2333
Quoted 10 lines
drivers/usb/musb/musb_core.c +8
-1-* the system up quickly enough to respond ... +/* System is entering into suspend where gadget would not be +* able to respond to host and thus it will be in an unknown +* state for host. Re-enumeration of gadget is required after +* a resume. So we force a disconnect. */ + reg =musb_readb (musb->mregs,MUSB_POWER ); + reg &= ~MUSB_POWER_SOFTCONN ; +musb_writeb (musb->mregs,MUSB_POWER , reg); +
I think we should only allow suspend if cable isn't connected. What would happend if you have mounted fs (using mass storage), user is transferring files and you force a disconnect ?
Quoted 8 lines
drivers/usb/musb/omap2430.c +0
-0@@ -255,6 +255,22 @@ int __init musb_platform_init(struct musb *musb)return 0 ; }
drivers/usb/musb/omap2430.c int __init musb_platform_init(struct musb *musb) · line 267
Quoted 10 lines
drivers/usb/musb/omap2430.c +10
-0+#ifdef CONFIG_PM +void musb_platform_save_context (struct musb_context_registers + *musb_context) +{ + musb_context->otg_sysconfig =omap_readl (OTG_SYSCONFIG ); + musb_context->otg_forcestandby =omap_readl (OTG_FORCESTDBY ); +} + +void musb_platform_restore_context (struct musb_context_registers + *musb_context)
waaay too many exported functions already. Let's add some structure to pass functions pointers. I'll cook a patch adding suspend(), resume(), init() and friends and send tomorrow.
Then your patch would add save_context() and restore_context().
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3 v3] musb: Add context save and restore support
Hi,
Quoted 5 lines · Balbi Felipe (Nokia-D/Helsinki)
waaay too many exported functions already. Let's add some structure to pass functions pointers. I'll cook a patch adding
suspend(),resume(),init()and friends and send tomorrow.Then your patch would add
save_context()andrestore_context().
unless you beat me on that :-)
Signature · 1 line
balbi
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH 2/3 v3] musb: Add context save and restore support
<snip..>
Quoted 19 lines
drivers/usb/musb/musb_core.c static int musb_suspend(struct device *dev) · line 2325
Quoted 7 lines
drivers/usb/musb/musb_core.c +1
-2@@ -2179,15 +2322,23 @@ static int musb_suspend(struct device *dev)spin_lock_irqsave (&musb->lock, flags);if (is_peripheral_active (musb)) { -/* FIXME force disconnect unless we know USB will wake -* the system up quickly enough to respond ... +/* System is entering into suspend where gadget would not be
Review static int musb_suspend(struct device *dev) · line 2326
Quoted 1 line
(quoted diff) +1
-0+ * able to respond to host and thus it will be in anunknown
Review static int musb_suspend(struct device *dev) · line 2327
Quoted 1 line
(quoted diff) +1
-0+ * state for host. Re-enumeration of gadget is requiredafter
drivers/usb/musb/musb_core.c static int musb_suspend(struct device *dev) · line 2333
Quoted 6 lines
drivers/usb/musb/musb_core.c +5
-0+* a resume. So we force a disconnect. */ + reg =musb_readb (musb->mregs,MUSB_POWER ); + reg &= ~MUSB_POWER_SOFTCONN ; +musb_writeb (musb->mregs,MUSB_POWER , reg); +
Quoted 3 lines
I think we should only allow suspend if cable isn't connected. What would happend if you have mounted fs (using mass storage), user is transferring files and you force a disconnect ?
We force a disconnect during suspend which is actually triggered by user Only. So do we need to consider this scenario?
Moreover, in case of OMAP3, as Smart-Idle/Stdby is enabled so system shouldn't enter into suspend state if cable is connected and data transfer is going on.
-Ajay
Quoted 5 lines
drivers/usb/musb/omap2430.c
Quoted 5 lines
drivers/usb/musb/omap2430.c +0
-0
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 19F8576C6E063C45BE387C64729E739404372AAF0F-/tLxBxkBPtCIQmiDNMet8wC/[email protected]
RE: [PATCH 2/3 v3] musb: Add context save and restore support
Quoted 7 lines
Quoted 3 lines
I think we should only allow suspend if cable isn't connected. What would happend if you have mounted fs (using mass storage), user is transferring files and you force a disconnect ?
We force a disconnect during suspend which is actually triggered by user Only. So do we need to consider this scenario?
Like Ajay says, the kernel would need to take a call either way:
- Disallowing a system wide suspend, just because a USB cable is connected
- Allow a system-wide suspend, but disconnect the gadget device.
I would vote to allow a system-wide suspend. A user that tries to put a phone to standby in the middle of a data transfer shouldn't be too surprised that the data transfer was aborted.
- Anand
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 5A47E75E594F054BAF48C5E4FC4B92AB030ADD53A6-/tLxBxkBPtCIQmiDNMet8wC/[email protected]
Re: [PATCH 2/3 v3] musb: Add context save and restore support
Hi,
Quoted 10 lines · Anand
Quoted 7 lines
Quoted 3 lines
I think we should only allow suspend if cable isn't connected. What would happend if you have mounted fs (using mass storage), user is transferring files and you force a disconnect ?
We force a disconnect during suspend which is actually triggered by user Only. So do we need to consider this scenario?
Like Ajay says, the kernel would need to take a call either way:
Quoted 7 lines
- Disallowing a system wide suspend, just because a USB cable is connected
- Allow a system-wide suspend, but disconnect the gadget device.I would vote to allow a system-wide suspend. A user that tries to put a phone to standby in the middle of a data transfer shouldn't be too surprised that the data transfer was aborted.
yes, but the problem would be the data corrupted. I'm pretty sure user will be a bit surprised that he now can't use his 27GB and lost all contacts, movies, smses, etc.
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH 2/3 v3] musb: Add context save and restore support
Quoted 27 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Tuesday, December 15, 2009 5:41 PM
To: Gadiyar, Anand
Cc: Gupta, Ajay Kumar; Balbi Felipe (Nokia-D/Helsinki); linux-
[email protected]; [email protected]; david-b-yBeKhBN/[email protected]
Subject: Re: [PATCH 2/3 v3] musb: Add context save and restore supportHi,
Quoted 5 lines · Anand
Quoted 5 lines
Quoted 3 lines
I think we should only allow suspend if cable isn't connected. What would happend if you have mounted fs (using mass storage), user is transferring files and you force a disconnect ?
We force a disconnect during suspend which is actually triggered by
user
Quoted 6 lines
Quoted 2 lines
Only. So do we need to consider this scenario?
Like Ajay says, the kernel would need to take a call either way:
- Disallowing a system wide suspend, just because a USB cable is
connected
Quoted 3 lines
- Allow a system-wide suspend, but disconnect the gadget device.
Quoted 7 lines
Quoted 3 lines
I would vote to allow a system-wide suspend. A user that tries to put a phone to standby in the middle of a data transfer shouldn't be too surprised that the data transfer was aborted.
yes, but the problem would be the data corrupted. I'm pretty sure user will be a bit surprised that he now can't use his 27GB and lost all contacts, movies, smses, etc.
It should be system's responsibility for not entering into suspend mode when there is an ongoing active transfer. If this is reliable then there is no need for any force disconnect.
On OMAP3EVM, I can see that system doesn't enter into suspend mode when cable is connected so should be fine for OMAP.
Felipe/Ajay,
What do you suggest, shall we remove this force disconnect code?
-Ajay
Quoted 3 lines
--
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 19F8576C6E063C45BE387C64729E739404372AAF44-/tLxBxkBPtCIQmiDNMet8wC/[email protected]
RE: [PATCH 2/3 v3] musb: Add context save and restore support
Quoted 9 lines
It should be system's responsibility for not entering into suspend mode when
there is an ongoing active transfer. If this is reliable then there is no need for any force disconnect.On OMAP3EVM, I can see that system doesn't enter into suspend mode when cable is connected so should be fine for OMAP.
Felipe/Ajay,
oops! It's 'Felipe/Anand'.
-Ajay
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3 v3] musb: Add context save and restore support
In reply to a message not in the archiveHi,
Quoted 39 lines · Ajay Kumar
Quoted 27 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Tuesday, December 15, 2009 5:41 PM
To: Gadiyar, Anand
Cc: Gupta, Ajay Kumar; Balbi Felipe (Nokia-D/Helsinki); linux-
[email protected]; [email protected]; david-b-yBeKhBN/[email protected]
Subject: Re: [PATCH 2/3 v3] musb: Add context save and restore supportHi,
Quoted 5 lines · Anand
Quoted 5 lines
Quoted 3 lines
I think we should only allow suspend if cable isn't connected. What would happend if you have mounted fs (using mass storage), user is transferring files and you force a disconnect ?
We force a disconnect during suspend which is actually triggered by
user
Quoted 6 lines
Quoted 2 lines
Only. So do we need to consider this scenario?
Like Ajay says, the kernel would need to take a call either way:
- Disallowing a system wide suspend, just because a USB cable is
connected
Quoted 3 lines
- Allow a system-wide suspend, but disconnect the gadget device.
Quoted 7 lines
Quoted 3 lines
I would vote to allow a system-wide suspend. A user that tries to put a phone to standby in the middle of a data transfer shouldn't be too surprised that the data transfer was aborted.
yes, but the problem would be the data corrupted. I'm pretty sure user will be a bit surprised that he now can't use his 27GB and lost all contacts, movies, smses, etc.
It should be system's responsibility for not entering into suspend mode when there is an ongoing active transfer. If this is reliable then there is no need for any force disconnect.
Quoted 5 lines
On OMAP3EVM, I can see that system doesn't enter into suspend mode when cable is connected so should be fine for OMAP.
Felipe/Ajay,
What do you suggest, shall we remove this force disconnect code?
I would suggest that. we drop the force disconnect code.
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3 v3] musb: Add context save and restore support
In reply to a message not in the archiveQuoted 30 lines · ext Ajay Kumar Gupta
Adding support for MUSB register save and restore during system suspend and resume.
Changes:
- Added musb_save/restore_context() functions
- Added platform specific musb_platform_save/restore_context() to handle platform specific jobs.
- Maintaining BlackFin compatibility by adding read/write functions for registers which are not available in BlackFinTested system suspend and resume on OMAP3EVM board.
Signed-off-by Anand Gadiyar <[email protected]>Signed-off-by Ajay Kumar Gupta <[email protected]>---
Changes from v2:
- Saving/Restoring host only registers withinis_host_enabled()check.
- Saving/Restoring Tx/Rx FIFOSZ/FIFOADDR withinmusb->dynfifocheck.drivers/usb/musb/musb_core.c | 157 +++++++++++++++++++++++++++++++++++++++++- drivers/usb/musb/musb_core.h | 39 ++++++++++ drivers/usb/musb/musb_regs.h | 90 ++++++++++++++++++++++++ drivers/usb/musb/omap2430.c | 16 ++++ 4 files changed, 300 insertions(+), 2 deletions(-)drivers/usb/musb/musb_core.c +0
-0
drivers/usb/musb/musb_core.c static int __devexit musb_remove(struct platform_device *pdev) · line 2174
Quoted 8 lines
drivers/usb/musb/musb_core.c +4
-0@@ -2167,11 +2167,154 @@ static int __devexit musb_remove(struct platform_device *pdev)#ifdef CONFIG_PM +static struct musb_context_registers musb_context; + +void musb_save_context (struct musb *musb) +{
Could you add one more parameter to this function call, which would select either if we want to save the musb_platform context or not? I m working at the moment on turning off the musb when cable unplugged and turning it on with restoring context after cable re-connect. In this case I don't need to restore the the musb_platform_context since I just set them before calling this one.
Same apply for restore.
what do you think?
I could also modify slightly this implementation after it is ready and submit it.
Quoted 384 lines
drivers/usb/musb/musb_core.c +139
-0+int i; +void __iomem *musb_base = musb->mregs; + +if (is_host_enabled (musb)) { + musb_context.frame =musb_readw (musb_base,MUSB_FRAME ); + musb_context.testmode =musb_readb (musb_base,MUSB_TESTMODE ); + } + musb_context.power =musb_readb (musb_base,MUSB_POWER ); + musb_context.intrtxe =musb_readw (musb_base,MUSB_INTRTXE ); + musb_context.intrrxe =musb_readw (musb_base,MUSB_INTRRXE ); + musb_context.intrusbe =musb_readb (musb_base,MUSB_INTRUSBE ); + musb_context.index =musb_readb (musb_base,MUSB_INDEX ); + musb_context.devctl =musb_readb (musb_base,MUSB_DEVCTL ); + +for (i =0 ; i <MUSB_C_NUM_EPS ; ++i) { +musb_writeb (musb_base,MUSB_INDEX , i); + musb_context.index_regs[i].txmaxp = +musb_readw (musb_base,0x10 +MUSB_TXMAXP ); + musb_context.index_regs[i].txcsr = +musb_readw (musb_base,0x10 +MUSB_TXCSR ); + musb_context.index_regs[i].rxmaxp = +musb_readw (musb_base,0x10 +MUSB_RXMAXP ); + musb_context.index_regs[i].rxcsr = +musb_readw (musb_base,0x10 +MUSB_RXCSR ); + +if (musb->dyn_fifo) { + musb_context.index_regs[i].txfifoadd = +musb_read_txfifoadd (musb_base); + musb_context.index_regs[i].rxfifoadd = +musb_read_rxfifoadd (musb_base); + musb_context.index_regs[i].txfifosz = +musb_read_txfifosz (musb_base); + musb_context.index_regs[i].rxfifosz = +musb_read_rxfifosz (musb_base); + } +if (is_host_enabled (musb)) { + musb_context.index_regs[i].txtype = +musb_readb (musb_base,0x10 +MUSB_TXTYPE ); + musb_context.index_regs[i].txinterval = +musb_readb (musb_base,0x10 +MUSB_TXINTERVAL ); + musb_context.index_regs[i].rxtype = +musb_readb (musb_base,0x10 +MUSB_RXTYPE ); + musb_context.index_regs[i].rxinterval = +musb_readb (musb_base,0x10 +MUSB_RXINTERVAL ); + + musb_context.index_regs[i].txfunaddr = +musb_read_txfunaddr (musb_base, i); + musb_context.index_regs[i].txhubaddr = +musb_read_txhubaddr (musb_base, i); + musb_context.index_regs[i].txhubport = +musb_read_txhubport (musb_base, i); + + musb_context.index_regs[i].rxfunaddr = +musb_read_rxfunaddr (musb_base, i); + musb_context.index_regs[i].rxhubaddr = +musb_read_rxhubaddr (musb_base, i); + musb_context.index_regs[i].rxhubport = +musb_read_rxhubport (musb_base, i); + } + } + +musb_writeb (musb_base,MUSB_INDEX , musb_context.index); + +musb_platform_save_context (&musb_context); +} + +void musb_restore_context (struct musb *musb) +{ +int i; +void __iomem *musb_base = musb->mregs; +void __iomem *ep_target_regs; + +musb_platform_restore_context (&musb_context); + +if (is_host_enabled (musb)) { +musb_writew (musb_base,MUSB_FRAME , musb_context.frame); +musb_writeb (musb_base,MUSB_TESTMODE , musb_context.testmode); + } +musb_writeb (musb_base,MUSB_POWER , musb_context.power); +musb_writew (musb_base,MUSB_INTRTXE , musb_context.intrtxe); +musb_writew (musb_base,MUSB_INTRRXE , musb_context.intrrxe); +musb_writeb (musb_base,MUSB_INTRUSBE , musb_context.intrusbe); +musb_writeb (musb_base,MUSB_DEVCTL , musb_context.devctl); + +for (i =0 ; i <MUSB_C_NUM_EPS ; ++i) { +musb_writeb (musb_base,MUSB_INDEX , i); +musb_writew (musb_base,0x10 +MUSB_TXMAXP , + musb_context.index_regs[i].txmaxp); +musb_writew (musb_base,0x10 +MUSB_TXCSR , + musb_context.index_regs[i].txcsr); +musb_writew (musb_base,0x10 +MUSB_RXMAXP , + musb_context.index_regs[i].rxmaxp); +musb_writew (musb_base,0x10 +MUSB_RXCSR , + musb_context.index_regs[i].rxcsr); + +if (musb->dyn_fifo) { +musb_write_txfifosz (musb_base, + musb_context.index_regs[i].txfifosz); +musb_write_rxfifosz (musb_base, + musb_context.index_regs[i].rxfifosz); +musb_write_txfifoadd (musb_base, + musb_context.index_regs[i].txfifoadd); +musb_write_rxfifoadd (musb_base, + musb_context.index_regs[i].rxfifoadd); + } + +if (is_host_enabled (musb)) { +musb_writeb (musb_base,0x10 +MUSB_TXTYPE , + musb_context.index_regs[i].txtype); +musb_writeb (musb_base,0x10 +MUSB_TXINTERVAL , + musb_context.index_regs[i].txinterval); +musb_writeb (musb_base,0x10 +MUSB_RXTYPE , + musb_context.index_regs[i].rxtype); +musb_writeb (musb_base,0x10 +MUSB_RXINTERVAL , + + musb_context.index_regs[i].rxinterval); +musb_write_txfunaddr (musb_base, i, + musb_context.index_regs[i].txfunaddr); +musb_write_txhubaddr (musb_base, i, + musb_context.index_regs[i].txhubaddr); +musb_write_txhubport (musb_base, i, + musb_context.index_regs[i].txhubport); + + ep_target_regs = +musb_read_target_reg_base (i, musb_base); + +musb_write_rxfunaddr (ep_target_regs, + musb_context.index_regs[i].rxfunaddr); +musb_write_rxhubaddr (ep_target_regs, + musb_context.index_regs[i].rxhubaddr); +musb_write_rxhubport (ep_target_regs, + musb_context.index_regs[i].rxhubport); + } + } + +musb_writeb (musb_base,MUSB_INDEX , musb_context.index); +} +static int musb_suspend (struct device *dev) {struct platform_device *pdev =to_platform_device (dev);unsigned long flags;struct musb *musb =dev_to_musb (&pdev->dev); +u8 reg;if (!musb->clock)return 0;drivers/usb/musb/musb_core.c +12
-2@@ -2179,15 +2322,23 @@ static int musb_suspend(struct device *dev)spin_lock_irqsave (&musb->lock, flags);if (is_peripheral_active (musb)) { -/* FIXME force disconnect unless we know USB will wake -* the system up quickly enough to respond ... +/* System is entering into suspend where gadget would not be +* able to respond to host and thus it will be in an unknown +* state for host. Re-enumeration of gadget is required after +* a resume. So we force a disconnect. */ + reg =musb_readb (musb->mregs,MUSB_POWER ); + reg &= ~MUSB_POWER_SOFTCONN ; +musb_writeb (musb->mregs,MUSB_POWER , reg); + }else if (is_host_active (musb)) {/* we know all the children are suspended; sometimes * they will even be wakeup-enabled. */ } +musb_save_context (musb); +if (musb->set_clock) musb->set_clock (musb->clock,0 );else @@ -2209,6 +2360,8 @@ static int musb_resume_noirq(struct device *dev)else clk_enable (musb->clock); +musb_restore_context (musb); +/* for static cmos like DaVinci, register values were preserved * unless for some reason the whole soc powered down or the USB * module got reset through the PSC (vs just being disabled). drivers/usb/musb/musb_core.h +39
-0@@ -462,6 +462,45 @@ struct musb {#endif }; +#ifdef CONFIG_PM +struct musb_csr_regs { +/* FIFO registers */ +u16 txmaxp, txcsr, rxmaxp, rxcsr; +u16 rxfifoadd, txfifoadd; +u8 txtype, txinterval, rxtype, rxinterval; +u8 rxfifosz, txfifosz; +u8 txfunaddr, txhubaddr, txhubport; +u8 rxfunaddr, rxhubaddr, rxhubport; +}; + +struct musb_context_registers { + +#if defined(CONFIG_ARCH_OMAP34XX ) +u32 otg_sysconfig, otg_forcestandby; +#endif +u8 power; +u16 intrtxe, intrrxe; +u8 intrusbe; +u16 frame; +u8 index, testmode; + +u8 devctl, misc; + +struct musb_csr_regs index_regs[MUSB_C_NUM_EPS ]; +}; + +#if defined(CONFIG_ARCH_OMAP34XX ) || defined(CONFIG_ARCH_OMAP2430 ) +extern void musb_platform_save_context (struct musb_context_registers + *musb_context); +extern void musb_platform_restore_context (struct musb_context_registers + *musb_context); +#else +#define musb_platform_save_context (x) do {} while (0) +#define musb_platform_restore_context (x) do {} while (0) +#endif + +#endif +static inline void musb_set_vbus (struct musb *musb,int is_on) { musb->board_set_vbus (musb, is_on);drivers/usb/musb/musb_regs.h +90
-0@@ -321,6 +321,26 @@ static inline void musb_write_rxfifoadd(void __iomem *mbase, u16 c_off)musb_writew (mbase,MUSB_RXFIFOADD , c_off); } +static inline u8 musb_read_txfifosz (void __iomem *mbase) +{ +return musb_readb (mbase,MUSB_TXFIFOSZ ); +} + +static inline u16 musb_read_txfifoadd (void __iomem *mbase) +{ +return musb_readw (mbase,MUSB_TXFIFOADD ); +} + +static inline u8 musb_read_rxfifosz (void __iomem *mbase) +{ +return musb_readb (mbase,MUSB_RXFIFOSZ ); +} + +static inline u16 musb_read_rxfifoadd (void __iomem *mbase) +{ +return musb_readw (mbase,MUSB_RXFIFOADD ); +} +static inline u8 musb_read_configdata (void __iomem *mbase) {musb_writeb (mbase,MUSB_INDEX ,0 );@@ -376,6 +396,36 @@ static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum, qh_h_port_reg); } +static inline u8 musb_read_rxfunaddr (void __iomem *mbase,u8 epnum) +{ +return musb_readb (mbase,MUSB_BUSCTL_OFFSET (epnum,MUSB_RXFUNCADDR )); +} + +static inline u8 musb_read_rxhubaddr (void __iomem *mbase,u8 epnum) +{ +return musb_readb (mbase,MUSB_BUSCTL_OFFSET (epnum,MUSB_RXHUBADDR )); +} + +static inline u8 musb_read_rxhubport (void __iomem *mbase,u8 epnum) +{ +return musb_readb (mbase,MUSB_BUSCTL_OFFSET (epnum,MUSB_RXHUBPORT )); +} + +static inline u8 musb_read_txfunaddr (void __iomem *mbase,u8 epnum) +{ +return musb_readb (mbase,MUSB_BUSCTL_OFFSET (epnum,MUSB_TXFUNCADDR )); +} + +static inline u8 musb_read_txhubaddr (void __iomem *mbase,u8 epnum) +{ +return musb_readb (mbase,MUSB_BUSCTL_OFFSET (epnum,MUSB_TXHUBADDR )); +} + +static inline u8 musb_read_txhubport (void __iomem *mbase,u8 epnum) +{ +return musb_readb (mbase,MUSB_BUSCTL_OFFSET (epnum,MUSB_TXHUBPORT )); +} +#else /* CONFIG_BLACKFIN */ #define USB_BASE USB_FADDR@@ -455,6 +505,22 @@ static inline void musb_write_rxfifoadd(void __iomem *mbase, u16 c_off) { } +static inline u8 musb_read_txfifosz (void __iomem *mbase) +{ +} + +static inline u16 musb_read_txfifoadd (void __iomem *mbase) +{ +} + +static inline u8 musb_read_rxfifosz (void __iomem *mbase) +{ +} + +static inline u16 musb_read_rxfifoadd (void __iomem *mbase) +{ +} +static inline u8 musb_read_configdata (void __iomem *mbase) {return 0 ;@@ -500,6 +566,30 @@ static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum, { } +static inline u8 musb_read_rxfunaddr (void __iomem *mbase,u8 epnum) +{ +} + +static inline u8 musb_read_rxhubaddr (void __iomem *mbase,u8 epnum) +{ +} + +static inline u8 musb_read_rxhubport (void __iomem *mbase,u8 epnum) +{ +} + +static inline u8 musb_read_txfunaddr (void __iomem *mbase,u8 epnum) +{ +} + +static inline u8 musb_read_txhubaddr (void __iomem *mbase,u8 epnum) +{ +} + +static inline void musb_read_txhubport (void __iomem *mbase,u8 epnum) +{ +} +#endif /* CONFIG_BLACKFIN */ #endif /* __MUSB_REGS_H__ */ drivers/usb/musb/omap2430.c +16
-1@@ -255,6 +255,22 @@ int __init musb_platform_init(struct musb *musb)return 0 ; } +#ifdef CONFIG_PM +void musb_platform_save_context (struct musb_context_registers + *musb_context) +{ + musb_context->otg_sysconfig =omap_readl (OTG_SYSCONFIG ); + musb_context->otg_forcestandby =omap_readl (OTG_FORCESTDBY ); +} + +void musb_platform_restore_context (struct musb_context_registers + *musb_context) +{ +omap_writel (musb_context->otg_sysconfig,OTG_SYSCONFIG ); +omap_writel (musb_context->otg_forcestandby,OTG_FORCESTDBY ); +} +#endif +int musb_platform_suspend (struct musb *musb) {u32 l; --1.6.2.4
Quoted 5 lines
--
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-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 2/3 v3] musb: Add context save and restore support
<snip>
Quoted 16 lines
drivers/usb/musb/musb_core.c static int __devexit musb_remove(struct platform_device *pdev) · line 2173
Quoted 8 lines
#ifdef
CONFIG_PMdrivers/usb/musb/musb_core.c +4
-0+static struct musb_context_registers musb_context; + +void musb_save_context (struct musb *musb) +{Could you add one more parameter to this function call, which would select either if we want to save the
musb_platformcontext or not? I m working at the moment on turning off the musb when cable unplugged and turning it on with restoring context after cable re-connect. In this case I don't need to restore the themusb_platform_contextsince I just set them before calling this one.
Quoted 5 lines
Same apply for restore.
what do you think?
I could also modify slightly this implementation after it is ready and submit it.
I think you want to add the parameter in musb_platform_save_context() and not in musb_save_context.
If so then where do you restore them? {As you said before calling this}
I think if the requirement is generic and suits for all other platforms Using musb then we can add it.
-Ajay
Quoted 409 lines
drivers/usb/musb/musb_core.c static int __devexit musb_remove(struct platform_device *pdev)
Quoted 7 lines
drivers/usb/musb/musb_core.c +6
-0+int i; +void __iomem *musb_base = musb->mregs; + +if (is_host_enabled (musb)) { + musb_context.frame =musb_readw (musb_base,MUSB_FRAME ); + musb_context.testmode = musb_readb(musb_base,
MUSB_TESTMODE);Quoted 22 lines
drivers/usb/musb/musb_core.c +22
-0+ } + musb_context.power =musb_readb (musb_base,MUSB_POWER ); + musb_context.intrtxe =musb_readw (musb_base,MUSB_INTRTXE ); + musb_context.intrrxe =musb_readw (musb_base,MUSB_INTRRXE ); + musb_context.intrusbe =musb_readb (musb_base,MUSB_INTRUSBE ); + musb_context.index =musb_readb (musb_base,MUSB_INDEX ); + musb_context.devctl =musb_readb (musb_base,MUSB_DEVCTL ); + +for (i =0 ; i <MUSB_C_NUM_EPS ; ++i) { +musb_writeb (musb_base,MUSB_INDEX , i); + musb_context.index_regs[i].txmaxp = +musb_readw (musb_base,0x10 +MUSB_TXMAXP ); + musb_context.index_regs[i].txcsr = +musb_readw (musb_base,0x10 +MUSB_TXCSR ); + musb_context.index_regs[i].rxmaxp = +musb_readw (musb_base,0x10 +MUSB_RXMAXP ); + musb_context.index_regs[i].rxcsr = +musb_readw (musb_base,0x10 +MUSB_RXCSR ); + +if (musb->dyn_fifo) { + musb_context.index_regs[i].txfifoadd = +musb_read_txfifoadd (musb_base);drivers/usb/musb/musb_core.c static int __devexit musb_remove(struct platform_device *pdev)
Quoted 10 lines
drivers/usb/musb/musb_core.c +10
-0+ musb_context.index_regs[i].rxfifoadd = +musb_read_rxfifoadd (musb_base); + musb_context.index_regs[i].txfifosz = +musb_read_txfifosz (musb_base); + musb_context.index_regs[i].rxfifosz = +musb_read_rxfifosz (musb_base); + } +if (is_host_enabled (musb)) { + musb_context.index_regs[i].txtype = + musb_readb(musb_base, 0x10 +
MUSB_TXTYPE);Review
Quoted 2 lines
(quoted diff) +2
-0+ musb_context.index_regs[i].txinterval = + musb_readb(musb_base, 0x10 +
MUSB_TXINTERVAL);Review
Quoted 2 lines
(quoted diff) +2
-0+ musb_context.index_regs[i].rxtype = + musb_readb(musb_base, 0x10 +
MUSB_RXTYPE);Review
Quoted 2 lines
(quoted diff) +2
-0+ musb_context.index_regs[i].rxinterval = + musb_readb(musb_base, 0x10 +
MUSB_RXINTERVAL);Quoted 23 lines
drivers/usb/musb/musb_core.c +23
-0+ + musb_context.index_regs[i].txfunaddr = +musb_read_txfunaddr (musb_base, i); + musb_context.index_regs[i].txhubaddr = +musb_read_txhubaddr (musb_base, i); + musb_context.index_regs[i].txhubport = +musb_read_txhubport (musb_base, i); + + musb_context.index_regs[i].rxfunaddr = +musb_read_rxfunaddr (musb_base, i); + musb_context.index_regs[i].rxhubaddr = +musb_read_rxhubaddr (musb_base, i); + musb_context.index_regs[i].rxhubport = +musb_read_rxhubport (musb_base, i); + } + } + +musb_writeb (musb_base,MUSB_INDEX , musb_context.index); + +musb_platform_save_context (&musb_context); +} + +void musb_restore_context (struct musb *musb)drivers/usb/musb/musb_core.c static int __devexit musb_remove(struct platform_device *pdev)
Quoted 10 lines
drivers/usb/musb/musb_core.c +10
-0+{ +int i; +void __iomem *musb_base = musb->mregs; +void __iomem *ep_target_regs; + +musb_platform_restore_context (&musb_context); + +if (is_host_enabled (musb)) { +musb_writew (musb_base,MUSB_FRAME , musb_context.frame); + musb_writeb(musb_base, MUSB_TESTMODE,musb_context.testmode);
Quoted 71 lines
drivers/usb/musb/musb_core.c +62
-0+ } +musb_writeb (musb_base,MUSB_POWER , musb_context.power); +musb_writew (musb_base,MUSB_INTRTXE , musb_context.intrtxe); +musb_writew (musb_base,MUSB_INTRRXE , musb_context.intrrxe); +musb_writeb (musb_base,MUSB_INTRUSBE , musb_context.intrusbe); +musb_writeb (musb_base,MUSB_DEVCTL , musb_context.devctl); + +for (i =0 ; i <MUSB_C_NUM_EPS ; ++i) { +musb_writeb (musb_base,MUSB_INDEX , i); +musb_writew (musb_base,0x10 +MUSB_TXMAXP , + musb_context.index_regs[i].txmaxp); +musb_writew (musb_base,0x10 +MUSB_TXCSR , + musb_context.index_regs[i].txcsr); +musb_writew (musb_base,0x10 +MUSB_RXMAXP , + musb_context.index_regs[i].rxmaxp); +musb_writew (musb_base,0x10 +MUSB_RXCSR , + musb_context.index_regs[i].rxcsr); + +if (musb->dyn_fifo) { +musb_write_txfifosz (musb_base, + musb_context.index_regs[i].txfifosz); +musb_write_rxfifosz (musb_base, + musb_context.index_regs[i].rxfifosz); +musb_write_txfifoadd (musb_base, + musb_context.index_regs[i].txfifoadd); +musb_write_rxfifoadd (musb_base, + musb_context.index_regs[i].rxfifoadd); + } + +if (is_host_enabled (musb)) { +musb_writeb (musb_base,0x10 +MUSB_TXTYPE , + musb_context.index_regs[i].txtype); +musb_writeb (musb_base,0x10 +MUSB_TXINTERVAL , + musb_context.index_regs[i].txinterval); +musb_writeb (musb_base,0x10 +MUSB_RXTYPE , + musb_context.index_regs[i].rxtype); +musb_writeb (musb_base,0x10 +MUSB_RXINTERVAL , + + musb_context.index_regs[i].rxinterval); +musb_write_txfunaddr (musb_base, i, + musb_context.index_regs[i].txfunaddr); +musb_write_txhubaddr (musb_base, i, + musb_context.index_regs[i].txhubaddr); +musb_write_txhubport (musb_base, i, + musb_context.index_regs[i].txhubport); + + ep_target_regs = +musb_read_target_reg_base (i, musb_base); + +musb_write_rxfunaddr (ep_target_regs, + musb_context.index_regs[i].rxfunaddr); +musb_write_rxhubaddr (ep_target_regs, + musb_context.index_regs[i].rxhubaddr); +musb_write_rxhubport (ep_target_regs, + musb_context.index_regs[i].rxhubport); + } + } + +musb_writeb (musb_base,MUSB_INDEX , musb_context.index); +} +static int musb_suspend (struct device *dev) {struct platform_device *pdev =to_platform_device (dev);unsigned long flags;struct musb *musb =dev_to_musb (&pdev->dev); +u8 reg;if (!musb->clock)return 0 ;drivers/usb/musb/musb_core.c static int musb_suspend(struct device *dev) · line 2325
Quoted 6 lines
drivers/usb/musb/musb_core.c +1
-2@@ -2179,15 +2322,23 @@ static int musb_suspend(struct device *dev)spin_lock_irqsave (&musb->lock, flags);if (is_peripheral_active (musb)) { -/* FIXME force disconnect unless we know USB will wake -* the system up quickly enough to respond ... +/* System is entering into suspend where gadget would not be
Review static int musb_suspend(struct device *dev) · line 2326
Quoted 1 line
(quoted diff) +1
-0+ * able to respond to host and thus it will be in anunknown
Review static int musb_suspend(struct device *dev) · line 2327
Quoted 1 line
(quoted diff) +1
-0+ * state for host. Re-enumeration of gadget is requiredafter
drivers/usb/musb/musb_regs.h static inline void musb_write_rxfifoadd(void
Quoted 81 lines
drivers/usb/musb/musb_core.c +9
-0+* a resume. So we force a disconnect. */ + reg =musb_readb (musb->mregs,MUSB_POWER ); + reg &= ~MUSB_POWER_SOFTCONN ; +musb_writeb (musb->mregs,MUSB_POWER , reg); + }else if (is_host_active (musb)) {/* we know all the children are suspended; sometimes * they will even be wakeup-enabled. */ } +musb_save_context (musb); +if (musb->set_clock) musb->set_clock (musb->clock,0 );else @@ -2209,6 +2360,8 @@ static int musb_resume_noirq(struct device *dev)else clk_enable (musb->clock); +musb_restore_context (musb); +/* for static cmos like DaVinci, register values were preserved * unless for some reason the whole soc powered down or the USB * module got reset through the PSC (vs just being disabled). drivers/usb/musb/musb_core.h +39
-0@@ -462,6 +462,45 @@ struct musb {#endif }; +#ifdef CONFIG_PM +struct musb_csr_regs { +/* FIFO registers */ +u16 txmaxp, txcsr, rxmaxp, rxcsr; +u16 rxfifoadd, txfifoadd; +u8 txtype, txinterval, rxtype, rxinterval; +u8 rxfifosz, txfifosz; +u8 txfunaddr, txhubaddr, txhubport; +u8 rxfunaddr, rxhubaddr, rxhubport; +}; + +struct musb_context_registers { + +#if defined(CONFIG_ARCH_OMAP34XX ) +u32 otg_sysconfig, otg_forcestandby; +#endif +u8 power; +u16 intrtxe, intrrxe; +u8 intrusbe; +u16 frame; +u8 index, testmode; + +u8 devctl, misc; + +struct musb_csr_regs index_regs[MUSB_C_NUM_EPS ]; +}; + +#if defined(CONFIG_ARCH_OMAP34XX ) || defined(CONFIG_ARCH_OMAP2430 ) +extern void musb_platform_save_context (struct musb_context_registers + *musb_context); +extern void musb_platform_restore_context (struct musb_context_registers + *musb_context); +#else +#define musb_platform_save_context (x) do {} while (0) +#define musb_platform_restore_context (x) do {} while (0) +#endif + +#endif +static inline void musb_set_vbus (struct musb *musb,int is_on) { musb->board_set_vbus (musb, is_on);drivers/usb/musb/musb_regs.h +0
-0@@ -321,6 +321,26 @@ static inline void musb_write_rxfifoadd(void
__iomem*mbase, u16c_off)drivers/usb/musb/musb_regs.h static inline void musb_write_txhubport(void
Quoted 27 lines
drivers/usb/musb/musb_regs.h +20
-0musb_writew (mbase,MUSB_RXFIFOADD , c_off); } +static inline u8 musb_read_txfifosz (void __iomem *mbase) +{ +return musb_readb (mbase,MUSB_TXFIFOSZ ); +} + +static inline u16 musb_read_txfifoadd (void __iomem *mbase) +{ +return musb_readw (mbase,MUSB_TXFIFOADD ); +} + +static inline u8 musb_read_rxfifosz (void __iomem *mbase) +{ +return musb_readb (mbase,MUSB_RXFIFOSZ ); +} + +static inline u16 musb_read_rxfifoadd (void __iomem *mbase) +{ +return musb_readw (mbase,MUSB_RXFIFOADD ); +} +static inline u8 musb_read_configdata (void __iomem *mbase) {musb_writeb (mbase,MUSB_INDEX ,0 );@@ -376,6 +396,36 @@ static inline void musb_write_txhubport(void
__iomem*mbase, u8 epnum,drivers/usb/musb/musb_regs.h static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum,
Quoted 6 lines
drivers/usb/musb/musb_regs.h +3
-0qh_h_port_reg); } +static inline u8 musb_read_rxfunaddr (void __iomem *mbase,u8 epnum) +{ + return musb_readb(mbase, MUSB_BUSCTL_OFFSET(epnum,
MUSB_RXFUNCADDR));drivers/usb/musb/musb_regs.h static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum,
Quoted 5 lines
drivers/usb/musb/musb_regs.h +5
-0+} + +static inline u8 musb_read_rxhubaddr (void __iomem *mbase,u8 epnum) +{ + return musb_readb(mbase, MUSB_BUSCTL_OFFSET(epnum,
MUSB_RXHUBADDR));drivers/usb/musb/musb_regs.h static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum,
Quoted 5 lines
drivers/usb/musb/musb_regs.h +5
-0+} + +static inline u8 musb_read_rxhubport (void __iomem *mbase,u8 epnum) +{ + return musb_readb(mbase, MUSB_BUSCTL_OFFSET(epnum,
MUSB_RXHUBPORT));drivers/usb/musb/musb_regs.h static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum,
Quoted 5 lines
drivers/usb/musb/musb_regs.h +5
-0+} + +static inline u8 musb_read_txfunaddr (void __iomem *mbase,u8 epnum) +{ + return musb_readb(mbase, MUSB_BUSCTL_OFFSET(epnum,
MUSB_TXFUNCADDR));drivers/usb/musb/musb_regs.h static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum,
Quoted 5 lines
drivers/usb/musb/musb_regs.h +5
-0+} + +static inline u8 musb_read_txhubaddr (void __iomem *mbase,u8 epnum) +{ + return musb_readb(mbase, MUSB_BUSCTL_OFFSET(epnum,
MUSB_TXHUBADDR));drivers/usb/musb/musb_regs.h static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum,
Quoted 5 lines
drivers/usb/musb/musb_regs.h +5
-0+} + +static inline u8 musb_read_txhubport (void __iomem *mbase,u8 epnum) +{ + return musb_readb(mbase, MUSB_BUSCTL_OFFSET(epnum,
MUSB_TXHUBPORT));drivers/usb/musb/musb_regs.h static inline void musb_write_rxfifoadd(void
Quoted 6 lines
drivers/usb/musb/musb_regs.h +2
-0+} +#else /* CONFIG_BLACKFIN */ #define USB_BASE USB_FADDR@@ -455,6 +505,22 @@ static inline void musb_write_rxfifoadd(void
__iomem*mbase, u16c_off)drivers/usb/musb/musb_regs.h static inline void musb_write_txhubport(void
Quoted 23 lines
drivers/usb/musb/musb_regs.h +16
-0{ } +static inline u8 musb_read_txfifosz (void __iomem *mbase) +{ +} + +static inline u16 musb_read_txfifoadd (void __iomem *mbase) +{ +} + +static inline u8 musb_read_rxfifosz (void __iomem *mbase) +{ +} + +static inline u16 musb_read_rxfifoadd (void __iomem *mbase) +{ +} +static inline u8 musb_read_configdata (void __iomem *mbase) {return 0 ;@@ -500,6 +566,30 @@ static inline void musb_write_txhubport(void
__iomem*mbase, u8 epnum,Quoted 65 lines
drivers/usb/musb/musb_regs.h +24
-0{ } +static inline u8 musb_read_rxfunaddr (void __iomem *mbase,u8 epnum) +{ +} + +static inline u8 musb_read_rxhubaddr (void __iomem *mbase,u8 epnum) +{ +} + +static inline u8 musb_read_rxhubport (void __iomem *mbase,u8 epnum) +{ +} + +static inline u8 musb_read_txfunaddr (void __iomem *mbase,u8 epnum) +{ +} + +static inline u8 musb_read_txhubaddr (void __iomem *mbase,u8 epnum) +{ +} + +static inline void musb_read_txhubport (void __iomem *mbase,u8 epnum) +{ +} +#endif /* CONFIG_BLACKFIN */ #endif /* __MUSB_REGS_H__ */ drivers/usb/musb/omap2430.c +16
-1@@ -255,6 +255,22 @@ int __init musb_platform_init(struct musb *musb)return 0 ; } +#ifdef CONFIG_PM +void musb_platform_save_context (struct musb_context_registers + *musb_context) +{ + musb_context->otg_sysconfig =omap_readl (OTG_SYSCONFIG ); + musb_context->otg_forcestandby =omap_readl (OTG_FORCESTDBY ); +} + +void musb_platform_restore_context (struct musb_context_registers + *musb_context) +{ +omap_writel (musb_context->otg_sysconfig,OTG_SYSCONFIG ); +omap_writel (musb_context->otg_forcestandby,OTG_FORCESTDBY ); +} +#endif +int musb_platform_suspend (struct musb *musb) {u32 l; --1.6.2.4
--
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
A message that is not in the archive (sent off-list or not yet received): 19F8576C6E063C45BE387C64729E73940449F439C7-/tLxBxkBPtCIQmiDNMet8wC/[email protected]
Re: [PATCH 2/3 v3] musb: Add context save and restore support
Quoted 19 lines · Ajay Kumar
<snip>
Quoted 17 lines
drivers/usb/musb/musb_core.c static int __devexit musb_remove(struct platform_device *pdev) · line 2173
Quoted 8 lines
#ifdef
CONFIG_PMdrivers/usb/musb/musb_core.c +4
-0+static struct musb_context_registers musb_context; + +void musb_save_context (struct musb *musb) +{Could you add one more parameter to this function call, which would select either if we want to save the
musb_platformcontext or not? I m working at the moment on turning off the musb when cable unplugged and turning it on with restoring context after cable re-connect. In this case I don't need to restore the themusb_platform_contextsince I just set them before calling this one.Same apply for restore.
Quoted 9 lines
Quoted 4 lines
what do you think?
I could also modify slightly this implementation after it is ready and submit it.I think you want to add the parameter in
musb_platform_save_context()and not inmusb_save_context.
If so then where do you restore them? {As you said before calling this}
In order to support off-mode, we need the transceiver driver to wake-up the controller.
I m working on a hook which would allow that.
I want to take advantage of your implementation for saving/restoring musb context, but saving the platform data is not necessary in my case. Maybe it musb_platform_save/restore_context(), shouldn't be called from musb_save/restore_context();
Quoted 3 lines
I think if the requirement is generic and suits for all other platforms Using musb then we can add it.
Yes it should.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH 2/3 v3] musb: Add context save and restore support
Quoted 40 lines
-----Original Message-----
From: Arnaud Mandy [mailto:[email protected]]
Sent: Thursday, December 17, 2009 7:41 PM
To: Gupta, Ajay Kumar
Cc: [email protected]; [email protected]; Balbi Felipe (Nokia-D/Helsinki); david-b-yBeKhBN/[email protected]; Gadiyar, Anand
Subject: Re: [PATCH 2/3 v3] musb: Add context save and restore supportQuoted 4 lines · Ajay Kumar
<snip>
Quoted 2 lines
Quoted 2 lines
#ifdef
CONFIG_PMQuoted 11 lines
Quoted 11 lines
Review
Quoted 6 lines
(quoted diff) +4
-0+static struct musb_context_registers musb_context; + +void musb_save_context(struct musb *musb) +{Could you add one more parameter to this function call, which would select either if we want to save the
musb_platformcontext or not? I m working at the moment on turning off the musb when cable unplugged and turning it on with restoring context after cable re-connect. In this case I don't need to restore the themusb_platform_contextsince
Quoted 10 lines
Quoted 8 lines
I just set them before calling this one.
Same apply for restore.
what do you think?
I could also modify slightly this implementation after it is ready and submit it.I think you want to add the parameter in
musb_platform_save_context()and
Quoted 3 lines
not in
musb_save_context.
If so then where do you restore them? {As you said before calling this}
Quoted 5 lines
In order to support off-mode, we need the transceiver driver to wake-up the controller.
I m working on a hook which would allow that.
I want to take advantage of your implementation for saving/restoring musb context, but saving the platform data is not necessary in my case.
Then how about having a platform specific flag within musb_platform_save/restorae_context() implementation which wouldn't save/restore when you don't need them.
Quoted 8 lines
Maybe it musb_platform_save/restore_context(), shouldn't be called from musb_save/restore_context();
Quoted 3 lines
I think if the requirement is generic and suits for all other platforms Using musb then we can add it.
Yes it should.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 19F8576C6E063C45BE387C64729E73940449F439D9-/tLxBxkBPtCIQmiDNMet8wC/[email protected]
Re: [PATCH 2/3 v3] musb: Add context save and restore support
Quoted 54 lines · Ajay Kumar
Quoted 47 lines
-----Original Message-----
From: Arnaud Mandy [mailto:[email protected]]
Sent: Thursday, December 17, 2009 7:41 PM
To: Gupta, Ajay Kumar
Cc: [email protected]; [email protected]; Balbi Felipe (Nokia-D/Helsinki); david-b-yBeKhBN/[email protected]; Gadiyar, Anand
Subject: Re: [PATCH 2/3 v3] musb: Add context save and restore supportQuoted 5 lines · Ajay Kumar
<snip>
Quoted 2 lines
Quoted 2 lines
#ifdef
CONFIG_PMQuoted 13 lines
Quoted 4 lines
Quoted 4 lines
(quoted diff) +4
-0+static struct musb_context_registers musb_context; + +void musb_save_context(struct musb *musb) +{Quoted 9 lines
Quoted 3 lines
Could you add one more parameter to this function call, which would select either if we want to save the
musb_platformcontext or not? I m working at the moment on turning off the musb when cable unplugged and turning it on with restoring context after cable re-connect. In this case I don't need to restore the themusb_platform_contextsince
Quoted 11 lines
Quoted 9 lines
I just set them before calling this one.
Same apply for restore.
what do you think?
I could also modify slightly this implementation after it is ready and submit it.I think you want to add the parameter in
musb_platform_save_context()and
Quoted 4 lines
not in
musb_save_context.
If so then where do you restore them? {As you said before calling this}Quoted 6 lines
In order to support off-mode, we need the transceiver driver to wake-up the controller.
I m working on a hook which would allow that.
I want to take advantage of your implementation for saving/restoring musb context, but saving the platform data is not necessary in my case.
Quoted 5 lines
Then how about having a platform specific flag within musb_platform_save/restorae_context() implementation which wouldn't save/restore when you don't need them.
I got your point, but how would this flag being passed into musb_save_context()? As a new musb struct member?
Quoted 11 lines
Quoted 11 lines
Maybe it musb_platform_save/restore_context(), shouldn't be called from musb_save/restore_context();
Quoted 4 lines
I think if the requirement is generic and suits for all other platforms Using musb then we can add it.
Yes it should.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH 2/3 v3] musb: Add context save and restore support
Quoted 13 lines
Quoted 7 lines
Quoted 6 lines
In order to support off-mode, we need the transceiver driver to wake-up the controller.
I m working on a hook which would allow that.
I want to take advantage of your implementation for saving/restoring musb context, but saving the platform data is not necessary in my case.Quoted 5 lines
Then how about having a platform specific flag within musb_platform_save/restorae_context() implementation which wouldn't save/restore when you don't need them.
Quoted 3 lines
I got your point, but how would this flag being passed into
musb_save_context()?
As a new musb struct member?
yes, from musb only and in that case we need to add another parameter to musb_platform_save/restore_context as you suggested.
Once your testing is completed then you can submit a separate patch on this? Or if already done then we can update the current one before it is sent to Greg.
-Ajay
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
Maybe it musb_platform_save/restore_context(), shouldn't be called from musb_save/restore_context();
Quoted 1 line
I think if the requirement is generic and suits for all other
platforms
Quoted 1 line
Quoted 1 line
Quoted 1 line
Using musb then we can add it.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Felipe Balbi
NAKHi,
Quoted 4 lines · ext Ajay Kumar Gupta
Save dynamic FIFO read only information for later uses such as, during musb_save/restore_context functions.
Signed-off-by Ajay Kumar Gupta <[email protected]>
NAK
Quoted 10 lines
---
drivers/usb/musb/musb_core.c | 4 +++- drivers/usb/musb/musb_core.h | 1 + 2 files changed, 4 insertions(+), 1 deletions(-)drivers/usb/musb/musb_core.c +0
-0
drivers/usb/musb/musb_core.c static int __init musb_core_init(u16 musb_type, struct musb *musb) · line 1333
Quoted 7 lines
drivers/usb/musb/musb_core.c +2
-1@@ -1328,8 +1328,10 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) reg =musb_read_configdata (mbase);strcpy (aInfo, (reg &MUSB_CONFIGDATA_UTMIDW ) ?"UTMI-16" :"UTMI-8" ); -if (reg &MUSB_CONFIGDATA_DYNFIFO ) +if (reg &MUSB_CONFIGDATA_DYNFIFO ) {strcat (aInfo,", dyn FIFOs" ); + musb->dyn_fifo = true;
we have this inside struct musb_hdrc_config.
This is duplicating that.
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 32 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Monday, December 14, 2009 9:55 PM
To: Gupta, Ajay Kumar
Cc: [email protected]; [email protected]; Balbi Felipe (Nokia-D/Helsinki); [email protected]
Subject: Re: [PATCH 1/3] musb: save dynfifo in musb structHi,
Quoted 4 lines · ext Ajay Kumar Gupta
Save dynamic FIFO read only information for later uses such as, during musb_save/restore_context functions.
Signed-off-by Ajay Kumar Gupta <[email protected]>NAK
drivers/usb/musb/musb_core.c static int __init musb_core_init(u16 musb_type,
Quoted 10 lines
---
drivers/usb/musb/musb_core.c | 4 +++- drivers/usb/musb/musb_core.h | 1 + 2 files changed, 4 insertions(+), 1 deletions(-)drivers/usb/musb/musb_core.c +0
-0@@ -1328,8 +1328,10 @@ static int __init musb_core_init(u16 musb_type,struct musb *musb)
drivers/usb/musb/musb_core.c static int __init musb_core_init(u16 musb_type, struct musb *musb)
Quoted 3 lines
drivers/usb/musb/musb_core.c +0
-0reg =musb_read_configdata (mbase); strcpy(aInfo, (reg & MUSB_CONFIGDATA_UTMIDW) ? "UTMI-16" : "UTMI-
Quoted 8 lines
8");
drivers/usb/musb/musb_core.c static int __init musb_core_init(u16 musb_type, struct musb *musb) · line 1333
Quoted 4 lines
drivers/usb/musb/musb_core.c +2
-1-if (reg &MUSB_CONFIGDATA_DYNFIFO ) +if (reg &MUSB_CONFIGDATA_DYNFIFO ) {strcat (aInfo,", dyn FIFOs" ); + musb->dyn_fifo = true;we have this inside struct
musb_hdrc_config. This is duplicating that.
musb->config->dyn_fifo is coming from platform files and is user defined but we need to check if the mentor core itself supports dynamic fifo.
See the dynamic fifo code snippet:
--------------------------------------------------------
if (reg & MUSB_CONFIGDATA_DYNFIFO) {
if (musb->config->dyn_fifo)
status = ep_config_from_table(musb);
else {
ERR("reconfigure software for Dynamic FIFOs\n");
status = -ENODEV;
}
} else {--------------------------------------------------------
If CONFIGDATA register bit indicates that dynamic FIFO is supported then musb->config->dyn_fifo has to be set to '1' for suceessful initialization.
Thus CONFIGDATA register bit alone is sufficient condition to save/restore Tx/Rx FIFOSZ/FIFOADDR registers.
-Ajay
Quoted 3 lines
--
balbi
A message that is not in the archive (sent off-list or not yet received): 19F8576C6E063C45BE387C64729E739404372AAD03-/tLxBxkBPtCIQmiDNMet8wC/[email protected]
Hi,
Quoted 14 lines · Ajay Kumar
musb->config->dyn_fifois coming from platform files and is user defined but we need to check if the mentor core itself supports dynamic fifo.See the dynamic fifo code snippet:
--------------------------------------------------------
if (reg & MUSB_CONFIGDATA_DYNFIFO) { if (musb->config->dyn_fifo) status = ep_config_from_table(musb); else { ERR("reconfigure software for Dynamic FIFOs\n"); status = -ENODEV; } } else {
Quoted 7 lines
--------------------------------------------------------
If CONFIGDATA register bit indicates that dynamic FIFO is supported then
musb->config->dyn_fifohas to be set to '1' for suceessful initialization.Thus CONFIGDATA register bit alone is sufficient condition to save/restore Tx/Rx FIFOSZ/FIFOADDR registers.
yes, but if the user has to reconfigure the sw for dyn_fifo anyways, so we can be sure musb->config->dyn_fifo is correct when you need.
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 29 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Tuesday, December 15, 2009 12:57 PM
To: Gupta, Ajay Kumar
Cc: Balbi Felipe (Nokia-D/Helsinki); [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH 1/3] musb: save dynfifo in musb structHi,
Quoted 14 lines · Ajay Kumar
musb->config->dyn_fifois coming from platform files and is user defined but we need to check if the mentor core itself supports dynamic fifo.See the dynamic fifo code snippet:
--------------------------------------------------------
if (reg & MUSB_CONFIGDATA_DYNFIFO) { if (musb->config->dyn_fifo) status = ep_config_from_table(musb); else { ERR("reconfigure software for Dynamic FIFOs\n"); status = -ENODEV; } } else {Quoted 4 lines
--------------------------------------------------------
If CONFIGDATA register bit indicates that dynamic FIFO is supported then
musb->config->dyn_fifohas to be set to '1' for suceessful
Quoted 8 lines
initialization.
Quoted 2 lines
Thus CONFIGDATA register bit alone is sufficient condition to
save/restore
Quoted 1 line
Tx/Rx FIFOSZ/FIFOADDR registers.
yes, but if the user has to reconfigure the sw for
dyn_fifoanyways, so we can be suremusb->config->dyn_fifois correct when you need.
As per current logic, user has to set dyn_fifo if mentor core supports it and it has to be set to '0' if core doesn't support it. So what's the need for musb->config->dyn_fifo at all. We can very well decide based on only CONFIGDATA register bits alone.
I think we should just get rid of this unwanted user defined flag. I will post a patch on this along with next revision.
-Ajay
Quoted 3 lines
--
balbi
A message that is not in the archive (sent off-list or not yet received): 19F8576C6E063C45BE387C64729E739404372AAE01-/tLxBxkBPtCIQmiDNMet8wC/[email protected]
Hi,
Quoted 7 lines · Ajay Kumar
As per current logic, user has to set
dyn_fifoif mentor core supports it and it has to be set to '0' if core doesn't support it. So what's the need formusb->config->dyn_fifoat all. We can very well decide based on only CONFIGDATA register bits alone.I think we should just get rid of this unwanted user defined flag. I will post a patch on this along with next revision.
aaa ok, now I get what you're saying.
You're suggesting to drop musb->config->dyn_fifo and decide ep_config_from_table() or ep_config_from_hw() based on CONFIGDATA.
Ok, makes sense. But first remove that before saving dyn_fifo on musb structure.
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 20 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Tuesday, December 15, 2009 1:10 PM
To: Gupta, Ajay Kumar
Cc: Balbi Felipe (Nokia-D/Helsinki); [email protected]; linux- [email protected]; david-b-yBeKhBN/[email protected]
Subject: Re: [PATCH 1/3] musb: save dynfifo in musb structHi,
Quoted 2 lines · Ajay Kumar
As per current logic, user has to set
dyn_fifoif mentor core supports it and it has to be set to '0' if core doesn't support it. So what's theneed
Quoted 5 lines
for
musb->config->dyn_fifoat all. We can very well decide based on only CONFIGDATA register bits alone.I think we should just get rid of this unwanted user defined flag. I will post a patch on this along with next revision.
Quoted 7 lines
aaa ok, now I get what you're saying.
You're suggesting to drop
musb->config->dyn_fifoand decideep_config_from_table()orep_config_from_hw()based on CONFIGDATA.Ok, makes sense. But first remove that before saving
dyn_fifoon musb structure.
Another point, BlackFin doesn't have CONFIGDATA register and it always Returns '0' from it's custom function musb_read_configdata().
As it returns '0' and also BlackFin doesn't support Dynamic FIFO so Should be fine.
Any comment ?
-Ajay
Quoted 3 lines
--
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
Quoted 7 lines · Ajay Kumar
Another point, BlackFin doesn't have CONFIGDATA register and it always Returns '0' from it's custom function
musb_read_configdata().As it returns '0' and also BlackFin doesn't support Dynamic FIFO so Should be fine.
Any comment ?
yeah, should be fine.
Signature · 1 line
balbi