usb/musb Blackfin updates
Subsystems (2)
cover usb/musb Blackfin updates
Hi Felipe,
I regenerated the "[PATCH 15/17] usb: musb: add Blackfin specific configuration to MUSB" on top of your patches. It should be easy for you to merge.
And in this patchset, some other small fixings are included as well as.
Thanks
-Bryan
PATCH 1/4 usb: musb: add Blackfin specific configuration to MUSB (add missing file changes)
Add back some missing file changes in previous patch named "[PATCH 15/17] usb: musb: add Blackfin specific configuration to MUSB"
--- drivers/usb/musb/musb_core.c | 52 ++---- drivers/usb/musb/musb_host.c | 22 +-- drivers/usb/musb/musb_regs.h | 353 +++++++++++++++++++++++++++++++----------- 3 files changed, 286 insertions(+), 141 deletions(-)
drivers/usb/musb/musb_core.c +18 -34
@@ -148,7 +148,8 @@ static inline struct musb *dev_to_musb(struct device *dev)/*-------------------------------------------------------------------------*/ -#ifndef CONFIG_USB_TUSB6010 +#if !defined(CONFIG_USB_TUSB6010 ) && !defined(CONFIG_BLACKFIN ) +/* * Load an endpoint's FIFO */
@@ -1124,25 +1125,25 @@ fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep,#endif switch (cfg->style) {case FIFO_TX : -musb_writeb (mbase,MUSB_TXFIFOSZ , c_size); -musb_writew (mbase,MUSB_TXFIFOADD , c_off); +musb_write_txfifosz (mbase, c_size); +musb_write_txfifoadd (mbase, c_off); hw_ep->tx_double_buffered = !!(c_size &MUSB_FIFOSZ_DPB ); hw_ep->max_packet_sz_tx = maxpacket;break ;case FIFO_RX : -musb_writeb (mbase,MUSB_RXFIFOSZ , c_size); -musb_writew (mbase,MUSB_RXFIFOADD , c_off); +musb_write_rxfifosz (mbase, c_size); +musb_write_rxfifoadd (mbase, c_off); hw_ep->rx_double_buffered = !!(c_size &MUSB_FIFOSZ_DPB ); hw_ep->max_packet_sz_rx = maxpacket;break ;case FIFO_RXTX : -musb_writeb (mbase,MUSB_TXFIFOSZ , c_size); -musb_writew (mbase,MUSB_TXFIFOADD , c_off); +musb_write_txfifosz (mbase, c_size); +musb_write_txfifoadd (mbase, c_off); hw_ep->rx_double_buffered = !!(c_size &MUSB_FIFOSZ_DPB ); hw_ep->max_packet_sz_rx = maxpacket; -musb_writeb (mbase,MUSB_RXFIFOSZ , c_size); -musb_writew (mbase,MUSB_RXFIFOADD , c_off); +musb_write_rxfifosz (mbase, c_size); +musb_write_rxfifoadd (mbase, c_off); hw_ep->tx_double_buffered = hw_ep->rx_double_buffered; hw_ep->max_packet_sz_tx = maxpacket;
@@ -1246,9 +1247,10 @@ static int __init ep_config_from_table(struct musb *musb)*/ static int __init ep_config_from_hw (struct musb *musb) { -u8 epnum =0 , reg; +u8 epnum =0 ;struct musb_hw_ep *hw_ep;void *mbase = musb->mregs; +int ret =0 ;DBG (2 ,"<== static silicon ep config\n" );
@@ -1258,26 +1260,9 @@ static int __init ep_config_from_hw(struct musb *musb)musb_ep_select (mbase, epnum); hw_ep = musb->endpoints + epnum; -/* read from core using indexed model */ - reg =musb_readb (hw_ep->regs,0x10 +MUSB_FIFOSIZE ); -if (!reg) { -/* 0's returned when no more endpoints */ + ret =musb_read_fifosize (musb, hw_ep, epnum); +if (ret <0 )break ; - } - musb->nr_endpoints++; - musb->epmask |= (1 << epnum); - - hw_ep->max_packet_sz_tx =1 << (reg &0x0f ); - -/* shared TX/RX FIFO? */ -if ((reg &0xf0 ) ==0xf0 ) { - hw_ep->max_packet_sz_rx = hw_ep->max_packet_sz_tx; - hw_ep->is_shared_fifo = true; -continue ; - }else { - hw_ep->max_packet_sz_rx =1 << ((reg &0xf0 ) >>4 ); - hw_ep->is_shared_fifo = false; - }/* FIXME set up hw_ep->{rx,tx}_double_buffered */
@@ -1326,7 +1311,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb)/* log core options (read using indexed model) */ musb_ep_select (mbase,0 ); - reg =musb_readb (mbase,0x10 +MUSB_CONFIGDATA ); + reg =musb_read_configdata (mbase);strcpy (aInfo, (reg &MUSB_CONFIGDATA_UTMIDW ) ?"UTMI-16" :"UTMI-8" );if (reg &MUSB_CONFIGDATA_DYNFIFO )
@@ -1391,7 +1376,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) }/* log release info */ - hwvers =musb_readw (mbase,MUSB_HWVERS ); + hwvers =musb_read_hwvers (mbase); rev_major = (hwvers >>10 ) &0x1f ; rev_minor = hwvers &0x3ff ; snprintf(aRevision, 32, "%d.%d%s", rev_major,
@@ -1400,8 +1385,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) musb_driver_name, type, aRevision, aDate);/* configure ep0 */ - musb->endpoints[0 ].max_packet_sz_tx =MUSB_EP0_FIFOSIZE ; - musb->endpoints[0 ].max_packet_sz_rx =MUSB_EP0_FIFOSIZE ; +musb_configure_ep0 (musb);/* discover endpoint configuration */ musb->nr_endpoints =1 ;
@@ -1445,7 +1429,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) hw_ep->regs =MUSB_EP_OFFSET (i,0 ) + mbase;#ifdef CONFIG_USB_MUSB_HDRC_HCD - hw_ep->target_regs =MUSB_BUSCTL_OFFSET (i,0 ) + mbase; + hw_ep->target_regs =musb_read_target_reg_base (i, mbase); hw_ep->rx_reinit =1 ; hw_ep->tx_reinit =1 ;#endif
drivers/usb/musb/musb_host.c +7 -15
@@ -606,12 +606,10 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, struct musb_hw_ep *ep)/* target addr and (for multipoint) hub addr/port */ if (musb->is_multipoint) { -musb_writeb (ep->target_regs,MUSB_RXFUNCADDR , - qh->addr_reg); -musb_writeb (ep->target_regs,MUSB_RXHUBADDR , - qh->h_addr_reg); -musb_writeb (ep->target_regs,MUSB_RXHUBPORT , - qh->h_port_reg); +musb_write_rxfunaddr (ep->target_regs, qh->addr_reg); +musb_write_rxhubaddr (ep->target_regs, qh->h_addr_reg); +musb_write_rxhubport (ep->target_regs, qh->h_port_reg); + }else musb_writeb (musb->mregs,MUSB_FADDR , qh->addr_reg);
@@ -725,15 +723,9 @@ static void musb_ep_program(struct musb *musb, u8 epnum,/* target addr and (for multipoint) hub addr/port */ if (musb->is_multipoint) { -musb_writeb (mbase, -MUSB_BUSCTL_OFFSET (epnum,MUSB_TXFUNCADDR ), - qh->addr_reg); -musb_writeb (mbase, -MUSB_BUSCTL_OFFSET (epnum,MUSB_TXHUBADDR ), - qh->h_addr_reg); -musb_writeb (mbase, -MUSB_BUSCTL_OFFSET (epnum,MUSB_TXHUBPORT ), - qh->h_port_reg); +musb_write_txfunaddr (mbase, epnum, qh->addr_reg); +musb_write_txhubaddr (mbase, epnum, qh->h_addr_reg); +musb_write_txhubport (mbase, epnum, qh->h_port_reg);/* FIXME if !epnum, do the same for RX ... */ }else musb_writeb (mbase,MUSB_FADDR , qh->addr_reg);
drivers/usb/musb/musb_regs.h +261 -92
369 lines not on this page · raw message
Signature · 1 line
1.5.6.3
PATCH 2/4 usb: musb: Blackfin provides read/write I/O accessor in header files
In reply to Bryan WuDon't redefine the functions in musb driver
--- drivers/usb/musb/musb_io.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/musb/musb_io.h +1 -1
@@ -39,7 +39,7 @@#if !defined(CONFIG_ARM ) && !defined(CONFIG_SUPERH ) \ && !defined(CONFIG_AVR32 ) && !defined(CONFIG_PPC32 ) \ - && !defined(CONFIG_PPC64 ) + && !defined(CONFIG_PPC64 ) && !defined(CONFIG_BLACKFIN )static inline void readsl (const void __iomem *addr,void *buf,int len) {insl ((unsigned long )addr, buf, len); }static inline void readsw (const void __iomem *addr,void *buf,int len)
Signature · 1 line
1.5.6.3
PATCH 3/4 usb: musb: Kill some compiling warning in musb Blackfin part
In reply to Bryan Wu--- drivers/usb/musb/blackfin.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
drivers/usb/musb/blackfin.c +8 -6
@@ -41,9 +41,11 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)dump_fifo_data (src, len);if (unlikely ((unsigned long )src &0x01 )) -outsw_8 (fifo, src, len &0x01 ? (len >>1 ) +1 : len >>1 ); +outsw_8 ((unsigned long )fifo, src, + len &0x01 ? (len >>1 ) +1 : len >>1 );else -outsw (fifo, src, len &0x01 ? (len >>1 ) +1 : len >>1 ); +outsw ((unsigned long )fifo, src, + len &0x01 ? (len >>1 ) +1 : len >>1 ); }/*
@@ -54,8 +56,6 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)void __iomem *fifo = hw_ep->fifo;u8 epnum = hw_ep->epnum;u16 dma_reg =0 ; -int i; -u16 *data;DBG (4 ,"%cX ep%d fifo %p count %d buf %p\n" ,'R' , hw_ep->epnum, fifo, len, dst);
@@ -96,9 +96,11 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)SSYNC ();#else if (unlikely ((unsigned long )dst &0x01 )) -insw_8 (fifo, dst, len &0x01 ? (len >>1 ) +1 : len >>1 ); +insw_8 ((unsigned long )fifo, dst, + len &0x01 ? (len >>1 ) +1 : len >>1 );else -insw (fifo, dst, len &0x01 ? (len >>1 ) +1 : len >>1 ); +insw ((unsigned long )fifo, dst, + len &0x01 ? (len >>1 ) +1 : len >>1 );#endif dump_fifo_data (dst, len);
Signature · 1 line
1.5.6.3
PATCH 4/4 usb: musb: use static inline functions to replace the macros in Blackfin version
In reply to Bryan WuAs Mike pointed out, "these should be static inline's so that side effects in function usage dont get messed up. for example, if someone used a ++ or -- or = operator in the argument list."
So I fixed all musb stubs here, but remain clk_xxx stubs because it needs to define struck clk. IMO, we might add clk support in the future.
--- drivers/usb/musb/musb_regs.h | 76 +++++++++++++++++++++++++++++++++--------- 1 files changed, 60 insertions(+), 16 deletions(-)
drivers/usb/musb/musb_regs.h +60 -16
@@ -447,22 +447,66 @@ static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum,#define clk_enable (clock) do {} while (0)#define clk_disable (clock) do {} while (0) -#define musb_write_txfifosz (mbase, c_size) do {} while (0) -#define musb_write_txfifoadd (mbase, c_off) do {} while (0) -#define musb_write_rxfifosz (mbase, c_size) do {} while (0) -#define musb_write_rxfifoadd (mbase, c_off) do {} while (0) - -#define musb_read_configdata (mbase) 0 -#define musb_read_hwvers (mbase) 0 -#define musb_read_target_reg_base (i, mbase) 0 - -#define musb_write_rxfunaddr (ep_target_regs, qh_addr_reg) do {} while (0) -#define musb_write_rxhubaddr (ep_target_regs, qh_h_addr_reg) do {} while (0) -#define musb_write_rxhubport (ep_target_regs, qh_h_port_reg) do {} while (0) - -#define musb_write_txfunaddr (mbase, epnum, qh_addr_reg) do {} while (0) -#define musb_write_txhubaddr (mbase, epnum, qh_h_addr_reg) do {} while (0) -#define musb_write_txhubport (mbase, epnum, qh_h_port_reg) do {} while (0) +static inline void musb_write_txfifosz (void __iomem *mbase,u8 c_size) +{ +} + +static inline void musb_write_txfifoadd (void __iomem *mbase,u16 c_off) +{ +} + +static inline void musb_write_rxfifosz (void __iomem *mbase,u8 c_size) +{ +} + +static inline void musb_write_rxfifoadd (void __iomem *mbase,u16 c_off) +{ +} + +static inline u8 musb_read_configdata (void __iomem *mbase) +{ +return 0 ; +} + +static inline u16 musb_read_hwvers (void __iomem *mbase) +{ +return 0 ; +} + +static inline u16 musb_read_target_reg_base (u8 i,void __iomem *mbase) +{ +return 0 ; +} + +static inline void musb_write_rxfunaddr (void __iomem *ep_target_regs, +u8 qh_addr_req) +{ +} + +static inline void musb_write_rxhubaddr (void __iomem *ep_target_regs, +u8 qh_h_addr_reg) +{ +} + +static inline void musb_write_rxhubport (void __iomem *ep_target_regs, +u8 qh_h_port_reg) +{ +} + +static inline void musb_write_txfunaddr (void __iomem *mbase,u8 epnum, +u8 qh_addr_reg) +{ +} + +static inline void musb_write_txhubaddr (void __iomem *mbase,u8 epnum, +u8 qh_addr_reg) +{ +} + +static inline void musb_write_txhubport (void __iomem *mbase,u8 epnum, +u8 qh_h_port_reg) +{ +}#endif /* CONFIG_BLACKFIN */
Signature · 1 line
1.5.6.3
Hi Felipe,
Do you have time to review these patches and merge them to your queue?
Thanks
-Bryan
Quoted 16 lines · Bryan Wu
Hi Felipe,
I regenerated the "[PATCH 15/17] usb: musb: add Blackfin specific configuration to MUSB" on top of your patches. It should be easy for you to merge.
And in this patchset, some other small fixings are included as well as.
Thanks
-Bryan
--
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