diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-28 09:44:56 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-28 09:44:56 -0700 |
commit | e4c5bf8e3dca827a1b3a6fac494eae8c74b7e1e7 (patch) | |
tree | ea51b391f7d74ca695dcb9f5e46eb02688a92ed9 /drivers/staging/westbridge/astoria/gadget/cyasgadget.h | |
parent | 81280572ca6f54009edfa4deee563e8678784218 (diff) | |
parent | a4ac0d847af9dd34d5953a5e264400326144b6b2 (diff) | |
download | op-kernel-dev-e4c5bf8e3dca827a1b3a6fac494eae8c74b7e1e7.zip op-kernel-dev-e4c5bf8e3dca827a1b3a6fac494eae8c74b7e1e7.tar.gz |
Merge 'staging-next' to Linus's tree
This merges the staging-next tree to Linus's tree and resolves
some conflicts that were present due to changes in other trees that were
affected by files here.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/westbridge/astoria/gadget/cyasgadget.h')
-rw-r--r-- | drivers/staging/westbridge/astoria/gadget/cyasgadget.h | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/drivers/staging/westbridge/astoria/gadget/cyasgadget.h b/drivers/staging/westbridge/astoria/gadget/cyasgadget.h new file mode 100644 index 0000000..e01cea7 --- /dev/null +++ b/drivers/staging/westbridge/astoria/gadget/cyasgadget.h @@ -0,0 +1,193 @@ +/* cyangadget.h - Linux USB Gadget driver file for the Cypress West Bridge +## =========================== +## Copyright (C) 2010 Cypress Semiconductor +## +## 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. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor +## Boston, MA 02110-1301, USA. +## =========================== +*/ + +/* + * Cypress West Bridge high/full speed USB device controller code + * Based on the Netchip 2280 device controller by David Brownell + * in the linux 2.6.10 kernel + * + * linux/drivers/usb/gadget/net2280.h + */ + +/* + * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com) + * Copyright (C) 2003 David Brownell + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _INCLUDED_CYANGADGET_H_ +#define _INCLUDED_CYANGADGET_H_ + +#include <linux/device.h> +#include <linux/moduleparam.h> +#include <linux/usb/ch9.h> +#include <linux/usb/gadget.h> +#include <linux/sched.h> + +#include "../include/linux/westbridge/cyastoria.h" +#include "../include/linux/westbridge/cyashal.h" +#include "../include/linux/westbridge/cyasdevice.h" +#include "cyasgadget_ioctl.h" + +#include <linux/module.h> +#include <linux/init.h> + +/*char driver defines, revisit*/ +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/init.h> +#include <linux/fs.h> /* everything... */ +#include <linux/errno.h> /* error codes */ +#include <linux/types.h> /* size_t */ +#include <linux/proc_fs.h> +#include <linux/fcntl.h> /* O_ACCMODE */ +#include <linux/seq_file.h> +#include <linux/cdev.h> +#include <linux/scatterlist.h> +#include <linux/pagemap.h> +#include <linux/vmalloc.h> /* vmalloc(), vfree */ +#include <linux/msdos_fs.h> /*fat_alloc_cluster*/ +#include <linux/buffer_head.h> +#include <asm/system.h> /* cli(), *_flags */ +#include <linux/uaccess.h> /* copy_*_user */ + +extern int mpage_cleardirty(struct address_space *mapping, int num_pages); +extern int fat_get_block(struct inode *, sector_t , struct buffer_head *, int); +extern cy_as_device_handle *cyasdevice_getdevhandle(void); + +/* Driver data structures and utilities */ +typedef struct cyasgadget_ep { + struct usb_ep usb_ep_inst; + struct cyasgadget *dev; + + /* analogous to a host-side qh */ + struct list_head queue; + const struct usb_endpoint_descriptor *desc; + unsigned num:8, + fifo_size:12, + in_fifo_validate:1, + out_overflow:1, + stopped:1, + is_in:1, + is_iso:1; + cy_as_usb_end_point_config cyepconfig; +} cyasgadget_ep; + +typedef struct cyasgadget_req { + struct usb_request req; + struct list_head queue; + int ep_num; + unsigned mapped:1, + valid:1, + complete:1, + ep_stopped:1; +} cyasgadget_req; + +typedef struct cyasgadget { + /* each device provides one gadget, several endpoints */ + struct usb_gadget gadget; + spinlock_t lock; + struct cyasgadget_ep an_gadget_ep[16]; + struct usb_gadget_driver *driver; + /* Handle to the West Bridge device */ + cy_as_device_handle dev_handle; + unsigned enabled:1, + protocol_stall:1, + softconnect:1, + outsetupreq:1; + struct completion thread_complete; + wait_queue_head_t thread_wq; + struct semaphore thread_sem; + struct list_head thread_queue; + + cy_bool tmtp_send_complete; + cy_bool tmtp_get_complete; + cy_bool tmtp_need_new_blk_tbl; + /* Data member used to store the SendObjectComplete event data */ + cy_as_mtp_send_object_complete_data tmtp_send_complete_data; + /* Data member used to store the GetObjectComplete event data */ + cy_as_mtp_get_object_complete_data tmtp_get_complete_data; + +} cyasgadget; + +static inline void set_halt(cyasgadget_ep *ep) +{ + return; +} + +static inline void clear_halt(cyasgadget_ep *ep) +{ + return; +} + +#define xprintk(dev, level, fmt, args...) \ + printk(level "%s %s: " fmt, driver_name, \ + pci_name(dev->pdev), ## args) + +#ifdef DEBUG +#undef DEBUG +#define DEBUG(dev, fmt, args...) \ + xprintk(dev, KERN_DEBUG, fmt, ## args) +#else +#define DEBUG(dev, fmt, args...) \ + do { } while (0) +#endif /* DEBUG */ + +#ifdef VERBOSE +#define VDEBUG DEBUG +#else +#define VDEBUG(dev, fmt, args...) \ + do { } while (0) +#endif /* VERBOSE */ + +#define ERROR(dev, fmt, args...) \ + xprintk(dev, KERN_ERR, fmt, ## args) +#define GADG_WARN(dev, fmt, args...) \ + xprintk(dev, KERN_WARNING, fmt, ## args) +#define INFO(dev, fmt, args...) \ + xprintk(dev, KERN_INFO, fmt, ## args) + +/*-------------------------------------------------------------------------*/ + +static inline void start_out_naking(struct cyasgadget_ep *ep) +{ + return; +} + +static inline void stop_out_naking(struct cyasgadget_ep *ep) +{ + return; +} + +#endif /* _INCLUDED_CYANGADGET_H_ */ |