Release 4.7 drivers/usb/musb/blackfin.c
/*
* MUSB OTG controller driver for Blackfin Processors
*
* Copyright 2006-2008 Analog Devices Inc.
*
* Enter bugs at http://blackfin.uclinux.org/
*
* Licensed under the GPL-2 or later.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/list.h>
#include <linux/gpio.h>
#include <linux/io.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/prefetch.h>
#include <linux/usb/usb_phy_generic.h>
#include <asm/cacheflush.h>
#include "musb_core.h"
#include "musbhsdma.h"
#include "blackfin.h"
struct bfin_glue {
struct device *dev;
struct platform_device *musb;
struct platform_device *phy;
};
#define glue_to_musb(g) platform_get_drvdata(g->musb)
static u32 bfin_fifo_offset(u8 epnum)
{
return USB_OFFSET(USB_EP0_FIFO) + (epnum * 8);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
tony lindgren | tony lindgren | 21 | 100.00% | 1 | 100.00% |
| Total | 21 | 100.00% | 1 | 100.00% |
static u8 bfin_readb(const void __iomem *addr, unsigned offset)
{
return (u8)(bfin_read16(addr + offset));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
tony lindgren | tony lindgren | 28 | 100.00% | 1 | 100.00% |
| Total | 28 | 100.00% | 1 | 100.00% |
static u16 bfin_readw(const void __iomem *addr, unsigned offset)
{
return bfin_read16(addr + offset);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
tony lindgren | tony lindgren | 23 | 100.00% | 1 | 100.00% |
| Total | 23 | 100.00% | 1 | 100.00% |
static u32 bfin_readl(const void __iomem *addr, unsigned offset)
{
return (u32)(bfin_read16(addr + offset));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
tony lindgren | tony lindgren | 28 | 100.00% | 1 | 100.00% |
| Total | 28 | 100.00% | 1 | 100.00% |
static void bfin_writeb(void __iomem *addr, unsigned offset, u8 data)
{
bfin_write16(addr + offset, (u16)data);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
tony lindgren | tony lindgren | 29 | 100.00% | 1 | 100.00% |
| Total | 29 | 100.00% | 1 | 100.00% |
static void bfin_writew(void __iomem *addr, unsigned offset, u16 data)
{
bfin_write16(addr + offset, data);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
tony lindgren | tony lindgren | 26 | 100.00% | 1 | 100.00% |
| Total | 26 | 100.00% | 1 | 100.00% |
static void bfin_writel(void __iomem *addr, unsigned offset, u32 data)
{
bfin_write16(addr + offset, (u16)data);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
tony lindgren | tony lindgren | 28 | 96.55% | 1 | 50.00% |
felipe balbi | felipe balbi | 1 | 3.45% | 1 | 50.00% |
| Total | 29 | 100.00% | 2 | 100.00% |
/*
* Load an endpoint's FIFO
*/
static void bfin_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
{
struct musb *musb = hw_ep->musb;
void __iomem *fifo = hw_ep->fifo;
void __iomem *epio = hw_ep->regs;
u8 epnum = hw_ep->epnum;
prefetch((u8 *)src);
musb_writew(epio, MUSB_TXCOUNT, len);
dev_dbg(musb->controller, "TX ep%d fifo %p count %d buf %p, epio %p\n",
hw_ep->epnum, fifo, len, src, epio);
dump_fifo_data(src, len);
if (!ANOMALY_05000380 && epnum != 0) {
u16 dma_reg;
flush_dcache_range((unsigned long)src,
(unsigned long)(src + len));
/* Setup DMA address register */
dma_reg = (u32)src;
bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg);
SSYNC();
dma_reg = (u32)src >> 16;
bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg);
SSYNC();
/* Setup DMA count register */
bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_LOW), len);
bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_HIGH), 0);
SSYNC();
/* Enable the DMA */
dma_reg = (epnum << 4) | DMA_ENA | INT_ENA | DIRECTION;
bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), dma_reg);
SSYNC();
/* Wait for complete */
while (!(bfin_read_USB_DMA_INTERRUPT() & (1 << epnum)))
cpu_relax();
/* acknowledge dma interrupt */
bfin_write_USB_DMA_INTERRUPT(1 << epnum);
SSYNC();
/* Reset DMA */
bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0);
SSYNC();
} else {
SSYNC();
if (unlikely((unsigned long)src & 0x01))
outsw_8((unsigned long)fifo, src, (len + 1) >> 1);
else
outsw((unsigned long)fifo, src, (len + 1) >> 1);
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 324 | 95.29% | 4 | 50.00% |
felipe balbi | felipe balbi | 13 | 3.82% | 2 | 25.00% |
tony lindgren | tony lindgren | 2 | 0.59% | 1 | 12.50% |
rahul bedarkar | rahul bedarkar | 1 | 0.29% | 1 | 12.50% |
| Total | 340 | 100.00% | 8 | 100.00% |
/*
* Unload an endpoint's FIFO
*/
static void bfin_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
{
struct musb *musb = hw_ep->musb;
void __iomem *fifo = hw_ep->fifo;
u8 epnum = hw_ep->epnum;
if (ANOMALY_05000467 && epnum != 0) {
u16 dma_reg;
invalidate_dcache_range((unsigned long)dst,
(unsigned long)(dst + len));
/* Setup DMA address register */
dma_reg = (u32)dst;
bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg);
SSYNC();
dma_reg = (u32)dst >> 16;
bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg);
SSYNC();
/* Setup DMA count register */
bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_LOW), len);
bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_HIGH), 0);
SSYNC();
/* Enable the DMA */
dma_reg = (epnum << 4) | DMA_ENA | INT_ENA;
bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), dma_reg);
SSYNC();
/* Wait for complete */
while (!(bfin_read_USB_DMA_INTERRUPT() & (1 << epnum)))
cpu_relax();
/* acknowledge dma interrupt */
bfin_write_USB_DMA_INTERRUPT(1 << epnum);
SSYNC();
/* Reset DMA */
bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0);
SSYNC();
} else {
SSYNC();
/* Read the last byte of packet with odd size from address fifo + 4
* to trigger 1 byte access to EP0 FIFO.
*/
if (len == 1)
*dst = (u8)inw((unsigned long)fifo + 4);
else {
if (unlikely((unsigned long)dst & 0x01))
insw_8((unsigned long)fifo, dst, len >> 1);
else
insw((unsigned long)fifo, dst, len >> 1);
if (len & 0x01)
*(dst + len - 1) = (u8)inw((unsigned long)fifo + 4);
}
}
dev_dbg(musb->controller, "%cX ep%d fifo %p count %d buf %p\n",
'R', hw_ep->epnum, fifo, len, dst);
dump_fifo_data(dst, len);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 324 | 90.76% | 4 | 44.44% |
mike frysinger | mike frysinger | 17 | 4.76% | 1 | 11.11% |
felipe balbi | felipe balbi | 13 | 3.64% | 2 | 22.22% |
tony lindgren | tony lindgren | 2 | 0.56% | 1 | 11.11% |
rahul bedarkar | rahul bedarkar | 1 | 0.28% | 1 | 11.11% |
| Total | 357 | 100.00% | 9 | 100.00% |
static irqreturn_t blackfin_interrupt(int irq, void *__hci)
{
unsigned long flags;
irqreturn_t retval = IRQ_NONE;
struct musb *musb = __hci;
spin_lock_irqsave(&musb->lock, flags);
musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
if (musb->int_usb || musb->int_tx || musb->int_rx) {
musb_writeb(musb->mregs, MUSB_INTRUSB, musb->int_usb);
musb_writew(musb->mregs, MUSB_INTRTX, musb->int_tx);
musb_writew(musb->mregs, MUSB_INTRRX, musb->int_rx);
retval = musb_interrupt(musb);
}
/* Start sampling ID pin, when plug is removed from MUSB */
if ((musb->xceiv->otg->state == OTG_STATE_B_IDLE
|| musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON) ||
(musb->int_usb & MUSB_INTR_DISCONNECT && is_host_active(musb))) {
mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
musb->a_wait_bcon = TIMER_DELAY;
}
spin_unlock_irqrestore(&musb->lock, flags);
return retval;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 152 | 72.73% | 1 | 20.00% |
cliff cai | cliff cai | 38 | 18.18% | 1 | 20.00% |
bob liu | bob liu | 14 | 6.70% | 1 | 20.00% |
antoine tenart | antoine tenart | 4 | 1.91% | 1 | 20.00% |
sergei shtylyov | sergei shtylyov | 1 | 0.48% | 1 | 20.00% |
| Total | 209 | 100.00% | 5 | 100.00% |
static void musb_conn_timer_handler(unsigned long _musb)
{
struct musb *musb = (void *)_musb;
unsigned long flags;
u16 val;
static u8 toggle;
spin_lock_irqsave(&musb->lock, flags);
switch (musb->xceiv->otg->state) {
case OTG_STATE_A_IDLE:
case OTG_STATE_A_WAIT_BCON:
/* Start a new session */
val = musb_readw(musb->mregs, MUSB_DEVCTL);
val &= ~MUSB_DEVCTL_SESSION;
musb_writew(musb->mregs, MUSB_DEVCTL, val);
val |= MUSB_DEVCTL_SESSION;
musb_writew(musb->mregs, MUSB_DEVCTL, val);
/* Check if musb is host or peripheral. */
val = musb_readw(musb->mregs, MUSB_DEVCTL);
if (!(val & MUSB_DEVCTL_BDEVICE)) {
gpio_set_value(musb->config->gpio_vrsel, 1);
musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
} else {
gpio_set_value(musb->config->gpio_vrsel, 0);
/* Ignore VBUSERROR and SUSPEND IRQ */
val = musb_readb(musb->mregs, MUSB_INTRUSBE);
val &= ~MUSB_INTR_VBUSERROR;
musb_writeb(musb->mregs, MUSB_INTRUSBE, val);
val = MUSB_INTR_SUSPEND | MUSB_INTR_VBUSERROR;
musb_writeb(musb->mregs, MUSB_INTRUSB, val);
musb->xceiv->otg->state = OTG_STATE_B_IDLE;
}
mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
break;
case OTG_STATE_B_IDLE:
/*
* Start a new session. It seems that MUSB needs taking
* some time to recognize the type of the plug inserted?
*/
val = musb_readw(musb->mregs, MUSB_DEVCTL);
val |= MUSB_DEVCTL_SESSION;
musb_writew(musb->mregs, MUSB_DEVCTL, val);
val = musb_readw(musb->mregs, MUSB_DEVCTL);
if (!(val & MUSB_DEVCTL_BDEVICE)) {
gpio_set_value(musb->config->gpio_vrsel, 1);
musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
} else {
gpio_set_value(musb->config->gpio_vrsel, 0);
/* Ignore VBUSERROR and SUSPEND IRQ */
val = musb_readb(musb->mregs, MUSB_INTRUSBE);
val &= ~MUSB_INTR_VBUSERROR;
musb_writeb(musb->mregs, MUSB_INTRUSBE, val);
val = MUSB_INTR_SUSPEND | MUSB_INTR_VBUSERROR;
musb_writeb(musb->mregs, MUSB_INTRUSB, val);
/* Toggle the Soft Conn bit, so that we can response to
* the inserting of either A-plug or B-plug.
*/
if (toggle) {
val = musb_readb(musb->mregs, MUSB_POWER);
val &= ~MUSB_POWER_SOFTCONN;
musb_writeb(musb->mregs, MUSB_POWER, val);
toggle = 0;
} else {
val = musb_readb(musb->mregs, MUSB_POWER);
val |= MUSB_POWER_SOFTCONN;
musb_writeb(musb->mregs, MUSB_POWER, val);
toggle = 1;
}
/* The delay time is set to 1/4 second by default,
* shortening it, if accelerating A-plug detection
* is needed in OTG mode.
*/
mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY / 4);
}
break;
default:
dev_dbg(musb->controller, "%s state not handled\n",
usb_otg_state_string(musb->xceiv->otg->state));
break;
}
spin_unlock_irqrestore(&musb->lock, flags);
dev_dbg(musb->controller, "state is %s\n",
usb_otg_state_string(musb->xceiv->otg->state));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 233 | 46.98% | 1 | 12.50% |
cliff cai | cliff cai | 230 | 46.37% | 1 | 12.50% |
antoine tenart | antoine tenart | 12 | 2.42% | 1 | 12.50% |
felipe balbi | felipe balbi | 11 | 2.22% | 3 | 37.50% |
anatolij gustschin | anatolij gustschin | 8 | 1.61% | 1 | 12.50% |
david brownell | david brownell | 2 | 0.40% | 1 | 12.50% |
| Total | 496 | 100.00% | 8 | 100.00% |
static void bfin_musb_enable(struct musb *musb)
{
/* REVISIT is this really correct ? */
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 9 | 75.00% | 1 | 33.33% |
felipe balbi | felipe balbi | 3 | 25.00% | 2 | 66.67% |
| Total | 12 | 100.00% | 3 | 100.00% |
static void bfin_musb_disable(struct musb *musb)
{
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 8 | 80.00% | 1 | 50.00% |
felipe balbi | felipe balbi | 2 | 20.00% | 1 | 50.00% |
| Total | 10 | 100.00% | 2 | 100.00% |
static void bfin_musb_set_vbus(struct musb *musb, int is_on)
{
int value = musb->config->gpio_vrsel_active;
if (!is_on)
value = !value;
gpio_set_value(musb->config->gpio_vrsel, value);
dev_dbg(musb->controller, "VBUS %s, devctl %02x "
/* otg %3x conf %08x prcm %08x */ "\n",
usb_otg_state_string(musb->xceiv->otg->state),
musb_readb(musb->mregs, MUSB_DEVCTL));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 48 | 64.00% | 1 | 14.29% |
cliff cai | cliff cai | 15 | 20.00% | 1 | 14.29% |
felipe balbi | felipe balbi | 6 | 8.00% | 3 | 42.86% |
anatolij gustschin | anatolij gustschin | 4 | 5.33% | 1 | 14.29% |
antoine tenart | antoine tenart | 2 | 2.67% | 1 | 14.29% |
| Total | 75 | 100.00% | 7 | 100.00% |
static int bfin_musb_set_power(struct usb_phy *x, unsigned mA)
{
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 15 | 88.24% | 1 | 33.33% |
heikki krogerus | heikki krogerus | 1 | 5.88% | 1 | 33.33% |
felipe balbi | felipe balbi | 1 | 5.88% | 1 | 33.33% |
| Total | 17 | 100.00% | 3 | 100.00% |
static int bfin_musb_vbus_status(struct musb *musb)
{
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 12 | 85.71% | 1 | 33.33% |
felipe balbi | felipe balbi | 1 | 7.14% | 1 | 33.33% |
mike frysinger | mike frysinger | 1 | 7.14% | 1 | 33.33% |
| Total | 14 | 100.00% | 3 | 100.00% |
static int bfin_musb_set_mode(struct musb *musb, u8 musb_mode)
{
return -EIO;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 16 | 88.89% | 2 | 66.67% |
felipe balbi | felipe balbi | 2 | 11.11% | 1 | 33.33% |
| Total | 18 | 100.00% | 3 | 100.00% |
static int bfin_musb_adjust_channel_params(struct dma_channel *channel,
u16 packet_sz, u8 *mode,
dma_addr_t *dma_addr, u32 *len)
{
struct musb_dma_channel *musb_channel = channel->private_data;
/*
* Anomaly 05000450 might cause data corruption when using DMA
* MODE 1 transmits with short packet. So to work around this,
* we truncate all MODE 1 transfers down to a multiple of the
* max packet size, and then do the last short packet transfer
* (if there is any) using MODE 0.
*/
if (ANOMALY_05000450) {
if (musb_channel->transmit && *mode == 1)
*len = *len - (*len % packet_sz);
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mike frysinger | mike frysinger | 69 | 100.00% | 1 | 100.00% |
| Total | 69 | 100.00% | 1 | 100.00% |
static void bfin_musb_reg_init(struct musb *musb)
{
if (ANOMALY_05000346) {
bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value);
SSYNC();
}
if (ANOMALY_05000347) {
bfin_write_USB_APHY_CNTRL(0x0);
SSYNC();
}
/* Configure PLL oscillator register */
bfin_write_USB_PLLOSC_CTRL(0x3080 |
((480/musb->config->clkin) << 1));
SSYNC();
bfin_write_USB_SRP_CLKDIV((get_sclk()/1000) / 32 - 1);
SSYNC();
bfin_write_USB_EP_NI0_RXMAXP(64);
SSYNC();
bfin_write_USB_EP_NI0_TXMAXP(64);
SSYNC();
/* Route INTRUSB/INTR_RX/INTR_TX to USB_INT0*/
bfin_write_USB_GLOBINTR(0x7);
SSYNC();
bfin_write_USB_GLOBAL_CTL(GLOBAL_ENA | EP1_TX_ENA | EP2_TX_ENA |
EP3_TX_ENA | EP4_TX_ENA | EP5_TX_ENA |
EP6_TX_ENA | EP7_TX_ENA | EP1_RX_ENA |
EP2_RX_ENA | EP3_RX_ENA | EP4_RX_ENA |
EP5_RX_ENA | EP6_RX_ENA | EP7_RX_ENA);
SSYNC();
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 108 | 77.14% | 1 | 25.00% |
bob liu | bob liu | 15 | 10.71% | 1 | 25.00% |
robin getz | robin getz | 13 | 9.29% | 1 | 25.00% |
felipe balbi | felipe balbi | 4 | 2.86% | 1 | 25.00% |
| Total | 140 | 100.00% | 4 | 100.00% |
static int bfin_musb_init(struct musb *musb)
{
/*
* Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE
* and OTG HOST modes, while rev 1.1 and greater require PE7 to
* be low for DEVICE mode and high for HOST mode. We set it high
* here because we are in host mode
*/
if (gpio_request(musb->config->gpio_vrsel, "USB_VRSEL")) {
printk(KERN_ERR "Failed ro request USB_VRSEL GPIO_%d\n",
musb->config->gpio_vrsel);
return -ENODEV;
}
gpio_direction_output(musb->config->gpio_vrsel, 0);
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb->xceiv)) {
gpio_free(musb->config->gpio_vrsel);
return -EPROBE_DEFER;
}
bfin_musb_reg_init(musb);
setup_timer(&musb_conn_timer, musb_conn_timer_handler,
(unsigned long) musb);
musb->xceiv->set_power = bfin_musb_set_power;
musb->isr = blackfin_interrupt;
musb->double_buffer_not_ok = true;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
felipe balbi | felipe balbi | 79 | 61.24% | 2 | 25.00% |
bryan wu | bryan wu | 41 | 31.78% | 1 | 12.50% |
kishon vijay abraham i | kishon vijay abraham i | 7 | 5.43% | 3 | 37.50% |
david brownell | david brownell | 1 | 0.78% | 1 | 12.50% |
ming lei | ming lei | 1 | 0.78% | 1 | 12.50% |
| Total | 129 | 100.00% | 8 | 100.00% |
static int bfin_musb_exit(struct musb *musb)
{
gpio_free(musb->config->gpio_vrsel);
usb_put_phy(musb->xceiv);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 21 | 70.00% | 1 | 25.00% |
sergei shtylyov | sergei shtylyov | 6 | 20.00% | 1 | 25.00% |
felipe balbi | felipe balbi | 2 | 6.67% | 1 | 25.00% |
kishon vijay abraham i | kishon vijay abraham i | 1 | 3.33% | 1 | 25.00% |
| Total | 30 | 100.00% | 4 | 100.00% |
static const struct musb_platform_ops bfin_ops = {
.quirks = MUSB_DMA_INVENTRA,
.init = bfin_musb_init,
.exit = bfin_musb_exit,
.readb = bfin_readb,
.writeb = bfin_writeb,
.readw = bfin_readw,
.writew = bfin_writew,
.readl = bfin_readl,
.writel = bfin_writel,
.fifo_mode = 2,
.read_fifo = bfin_read_fifo,
.write_fifo = bfin_write_fifo,
#ifdef CONFIG_USB_INVENTRA_DMA
.dma_init = musbhs_dma_controller_create,
.dma_exit = musbhs_dma_controller_destroy,
#endif
.enable = bfin_musb_enable,
.disable = bfin_musb_disable,
.set_mode = bfin_musb_set_mode,
.vbus_status = bfin_musb_vbus_status,
.set_vbus = bfin_musb_set_vbus,
.adjust_channel_params = bfin_musb_adjust_channel_params,
};
static u64 bfin_dmamask = DMA_BIT_MASK(32);
static int bfin_probe(struct platform_device *pdev)
{
struct resource musb_resources[2];
struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct platform_device *musb;
struct bfin_glue *glue;
int ret = -ENOMEM;
glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
if (!glue)
goto err0;
musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
if (!musb)
goto err0;
musb->dev.parent = &pdev->dev;
musb->dev.dma_mask = &bfin_dmamask;
musb->dev.coherent_dma_mask = bfin_dmamask;
glue->dev = &pdev->dev;
glue->musb = musb;
pdata->platform_ops = &bfin_ops;
glue->phy = usb_phy_generic_register();
if (IS_ERR(glue->phy))
goto err1;
platform_set_drvdata(pdev, glue);
memset(musb_resources, 0x00, sizeof(*musb_resources) *
ARRAY_SIZE(musb_resources));
musb_resources[0].name = pdev->resource[0].name;
musb_resources[0].start = pdev->resource[0].start;
musb_resources[0].end = pdev->resource[0].end;
musb_resources[0].flags = pdev->resource[0].flags;
musb_resources[1].name = pdev->resource[1].name;
musb_resources[1].start = pdev->resource[1].start;
musb_resources[1].end = pdev->resource[1].end;
musb_resources[1].flags = pdev->resource[1].flags;
ret = platform_device_add_resources(musb, musb_resources,
ARRAY_SIZE(musb_resources));
if (ret) {
dev_err(&pdev->dev, "failed to add resources\n");
goto err2;
}
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(&pdev->dev, "failed to add platform_data\n");
goto err2;
}
ret = platform_device_add(musb);
if (ret) {
dev_err(&pdev->dev, "failed to register musb device\n");
goto err2;
}
return 0;
err2:
usb_phy_generic_unregister(glue->phy);
err1:
platform_device_put(musb);
err0:
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
felipe balbi | felipe balbi | 411 | 95.80% | 6 | 66.67% |
himangi saraogi | himangi saraogi | 13 | 3.03% | 1 | 11.11% |
jingoo han | jingoo han | 4 | 0.93% | 1 | 11.11% |
sebastian andrzej siewior | sebastian andrzej siewior | 1 | 0.23% | 1 | 11.11% |
| Total | 429 | 100.00% | 9 | 100.00% |
static int bfin_remove(struct platform_device *pdev)
{
struct bfin_glue *glue = platform_get_drvdata(pdev);
platform_device_unregister(glue->musb);
usb_phy_generic_unregister(glue->phy);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
felipe balbi | felipe balbi | 37 | 97.37% | 4 | 80.00% |
wei yongjun | wei yongjun | 1 | 2.63% | 1 | 20.00% |
| Total | 38 | 100.00% | 5 | 100.00% |
#ifdef CONFIG_PM
static int bfin_suspend(struct device *dev)
{
struct bfin_glue *glue = dev_get_drvdata(dev);
struct musb *musb = glue_to_musb(glue);
if (is_host_active(musb))
/*
* During hibernate gpio_vrsel will change from high to low
* low which will generate wakeup event resume the system
* immediately. Set it to 0 before hibernate to avoid this
* wakeup event.
*/
gpio_set_value(musb->config->gpio_vrsel, 0);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
felipe balbi | felipe balbi | 53 | 100.00% | 1 | 100.00% |
| Total | 53 | 100.00% | 1 | 100.00% |
static int bfin_resume(struct device *dev)
{
struct bfin_glue *glue = dev_get_drvdata(dev);
struct musb *musb = glue_to_musb(glue);
bfin_musb_reg_init(musb);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
felipe balbi | felipe balbi | 39 | 100.00% | 1 | 100.00% |
| Total | 39 | 100.00% | 1 | 100.00% |
#endif
static SIMPLE_DEV_PM_OPS(bfin_pm_ops, bfin_suspend, bfin_resume);
static struct platform_driver bfin_driver = {
.probe = bfin_probe,
.remove = bfin_remove,
.driver = {
.name = "musb-blackfin",
.pm = &bfin_pm_ops,
},
};
MODULE_DESCRIPTION("Blackfin MUSB Glue Layer");
MODULE_AUTHOR("Bryan Wy <cooloney@kernel.org>");
MODULE_LICENSE("GPL v2");
module_platform_driver(bfin_driver);
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bryan wu | bryan wu | 1341 | 45.86% | 5 | 9.26% |
felipe balbi | felipe balbi | 820 | 28.04% | 17 | 31.48% |
cliff cai | cliff cai | 283 | 9.68% | 2 | 3.70% |
tony lindgren | tony lindgren | 252 | 8.62% | 5 | 9.26% |
mike frysinger | mike frysinger | 96 | 3.28% | 4 | 7.41% |
bob liu | bob liu | 32 | 1.09% | 3 | 5.56% |
antoine tenart | antoine tenart | 18 | 0.62% | 1 | 1.85% |
robin getz | robin getz | 13 | 0.44% | 1 | 1.85% |
himangi saraogi | himangi saraogi | 13 | 0.44% | 1 | 1.85% |
daniel mack | daniel mack | 12 | 0.41% | 1 | 1.85% |
anatolij gustschin | anatolij gustschin | 12 | 0.41% | 1 | 1.85% |
kishon vijay abraham i | kishon vijay abraham i | 11 | 0.38% | 3 | 5.56% |
sergei shtylyov | sergei shtylyov | 7 | 0.24% | 2 | 3.70% |
jingoo han | jingoo han | 4 | 0.14% | 1 | 1.85% |
david brownell | david brownell | 3 | 0.10% | 1 | 1.85% |
rahul bedarkar | rahul bedarkar | 2 | 0.07% | 1 | 1.85% |
ming lei | ming lei | 1 | 0.03% | 1 | 1.85% |
sebastian andrzej siewior | sebastian andrzej siewior | 1 | 0.03% | 1 | 1.85% |
heikki krogerus | heikki krogerus | 1 | 0.03% | 1 | 1.85% |
wei yongjun | wei yongjun | 1 | 0.03% | 1 | 1.85% |
srinivas kandagatla | srinivas kandagatla | 1 | 0.03% | 1 | 1.85% |
| Total | 2924 | 100.00% | 54 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.