/*
* driver/usb/gadget/imx_udc.c
*
* Copyright (C) 2005 Mike Lee <eemike@gmail.com>
* Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/slab.h>
#include <linux/prefetch.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <mach/usb.h>
#include <mach/hardware.h>
#include "imx_udc.h"
static const char driver_name[] = "imx_udc";
static const char ep0name[] = "ep0";
void ep0_chg_stat(const char *label, struct imx_udc_struct *imx_usb,
enum ep0_state stat);
/*******************************************************************************
* IMX UDC hardware related functions
*******************************************************************************
*/
void imx_udc_enable(struct imx_udc_struct *imx_usb)
{
int temp = __raw_readl(imx_usb->base + USB_CTRL);
__raw_writel(temp | CTRL_FE_ENA | CTRL_AFE_ENA,
imx_usb->base + USB_CTRL);
imx_usb->gadget.speed = USB_SPEED_FULL;
}
void imx_udc_disable(struct imx_udc_struct *imx_usb)
{
int temp = __raw_readl(imx_usb->base + USB_CTRL);
__raw_writel(temp & ~(CTRL_FE_ENA | CTRL_AFE_ENA),
imx_usb->base + USB_CTRL);
ep0_chg_stat(__func__, imx_usb, EP0_IDLE);
imx_usb->gadget.speed = USB_SPEED_UNKNOWN;
}
void imx_udc_reset(struct imx_udc_struct *imx_usb)
{
|