From patchwork Thu Jun 13 19:07:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 251151 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D51D52C0098 for ; Fri, 14 Jun 2013 05:07:49 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 841A04A11E; Thu, 13 Jun 2013 21:07:48 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L1zQ8UhXcJ6Z; Thu, 13 Jun 2013 21:07:48 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BB19B4A118; Thu, 13 Jun 2013 21:07:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 92E474A118 for ; Thu, 13 Jun 2013 21:07:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B8sDGsJxjEWS for ; Thu, 13 Jun 2013 21:07:33 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by theia.denx.de (Postfix) with ESMTPS id DF2BA4A10C for ; Thu, 13 Jun 2013 21:07:25 +0200 (CEST) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5DJ7OAh022099 for ; Thu, 13 Jun 2013 14:07:24 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r5DJ7NJ4029536 for ; Thu, 13 Jun 2013 14:07:23 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Thu, 13 Jun 2013 14:07:23 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r5DJ7NWY022596; Thu, 13 Jun 2013 14:07:23 -0500 Received: from localhost (h0-226.vpn.ti.com [172.24.0.226]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id r5DJ7NV03523; Thu, 13 Jun 2013 14:07:23 -0500 (CDT) From: Dan Murphy To: , , Date: Thu, 13 Jun 2013 14:07:21 -0500 Message-ID: <1371150441-3470-1-git-send-email-dmurphy@ti.com> X-Mailer: git-send-email 1.7.5.4 MIME-Version: 1.0 Subject: [U-Boot] [uBoot] [PATCH v2] musb: Move linux and usb compat files to include/linux/usb X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Move the linux and usb compat files to the include/linux/usb directory in order for the files to be reused. Added GPLv2 license to the linux and usb compat as well. Signed-off-by: Dan Murphy --- v2 - Fix checkpatch issues only for newly introduced code - http://patchwork.ozlabs.org/patch/251127/ drivers/usb/musb-new/linux-compat.h | 114 -------------------------- drivers/usb/musb-new/musb_core.c | 4 +- drivers/usb/musb-new/musb_dsps.c | 2 +- drivers/usb/musb-new/musb_gadget.c | 2 +- drivers/usb/musb-new/musb_gadget_ep0.c | 2 +- drivers/usb/musb-new/musb_host.c | 4 +- drivers/usb/musb-new/musb_host.h | 2 +- drivers/usb/musb-new/musb_uboot.c | 4 +- drivers/usb/musb-new/usb-compat.h | 88 -------------------- include/linux/usb/linux-compat.h | 136 ++++++++++++++++++++++++++++++++ include/linux/usb/usb-compat.h | 110 ++++++++++++++++++++++++++ 11 files changed, 256 insertions(+), 212 deletions(-) delete mode 100644 drivers/usb/musb-new/linux-compat.h delete mode 100644 drivers/usb/musb-new/usb-compat.h create mode 100644 include/linux/usb/linux-compat.h create mode 100644 include/linux/usb/usb-compat.h diff --git a/drivers/usb/musb-new/linux-compat.h b/drivers/usb/musb-new/linux-compat.h deleted file mode 100644 index 72c8c2b..0000000 --- a/drivers/usb/musb-new/linux-compat.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef __LINUX_COMPAT_H__ -#define __LINUX_COMPAT_H__ - -#include -#include -#include - -#define __init -#define __devinit -#define __devinitdata -#define __devinitconst -#define __iomem -#define __deprecated - -struct unused {}; -typedef struct unused unused_t; - -typedef int irqreturn_t; -typedef unused_t spinlock_t; - -struct work_struct {}; - -struct timer_list {}; -struct notifier_block {}; - -typedef unsigned long dmaaddr_t; - -#define spin_lock_init(lock) do {} while (0) -#define spin_lock(lock) do {} while (0) -#define spin_unlock(lock) do {} while (0) -#define spin_lock_irqsave(lock, flags) do {} while (0) -#define spin_unlock_irqrestore(lock, flags) do {} while (0) - -#define setup_timer(timer, func, data) do {} while (0) -#define del_timer_sync(timer) do {} while (0) -#define schedule_work(work) do {} while (0) -#define INIT_WORK(work, fun) do {} while (0) - -#define cpu_relax() do {} while (0) - -#define pr_debug(fmt, args...) debug(fmt, ##args) -#define dev_dbg(dev, fmt, args...) \ - debug(fmt, ##args) -#define dev_vdbg(dev, fmt, args...) \ - debug(fmt, ##args) -#define dev_info(dev, fmt, args...) \ - printf(fmt, ##args) -#define dev_err(dev, fmt, args...) \ - printf(fmt, ##args) -#define printk printf - -#define WARN(condition, fmt, args...) ({ \ - int ret_warn = !!condition; \ - if (ret_warn) \ - printf(fmt, ##args); \ - ret_warn; }) - -#define KERN_DEBUG -#define KERN_NOTICE -#define KERN_WARNING -#define KERN_ERR - -#define kfree(ptr) free(ptr) - -#define pm_runtime_get_sync(dev) do {} while (0) -#define pm_runtime_put(dev) do {} while (0) -#define pm_runtime_put_sync(dev) do {} while (0) -#define pm_runtime_use_autosuspend(dev) do {} while (0) -#define pm_runtime_set_autosuspend_delay(dev, delay) do {} while (0) -#define pm_runtime_enable(dev) do {} while (0) - -#define MODULE_DESCRIPTION(desc) -#define MODULE_AUTHOR(author) -#define MODULE_LICENSE(license) -#define MODULE_ALIAS(alias) -#define module_param(name, type, perm) -#define MODULE_PARM_DESC(name, desc) -#define EXPORT_SYMBOL_GPL(name) - -#define writesl(a, d, s) __raw_writesl((unsigned long)a, d, s) -#define readsl(a, d, s) __raw_readsl((unsigned long)a, d, s) -#define writesw(a, d, s) __raw_writesw((unsigned long)a, d, s) -#define readsw(a, d, s) __raw_readsw((unsigned long)a, d, s) -#define writesb(a, d, s) __raw_writesb((unsigned long)a, d, s) -#define readsb(a, d, s) __raw_readsb((unsigned long)a, d, s) - -#define IRQ_NONE 0 -#define IRQ_HANDLED 0 - -#define dev_set_drvdata(dev, data) do {} while (0) - -#define disable_irq_wake(irq) do {} while (0) -#define enable_irq_wake(irq) -EINVAL -#define free_irq(irq, data) do {} while (0) -#define request_irq(nr, f, flags, nm, data) 0 - -#define device_init_wakeup(dev, a) do {} while (0) - -#define platform_data device_data - -#ifndef wmb -#define wmb() asm volatile ("" : : : "memory") -#endif - -#define msleep(a) udelay(a * 1000) - -/* - * Map U-Boot config options to Linux ones - */ -#ifdef CONFIG_OMAP34XX -#define CONFIG_SOC_OMAP3430 -#endif - -#endif /* __LINUX_COMPAT_H__ */ diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c index da93571..2cb3181 100644 --- a/drivers/usb/musb-new/musb_core.c +++ b/drivers/usb/musb-new/musb_core.c @@ -109,8 +109,8 @@ #include #include #include -#include "linux-compat.h" -#include "usb-compat.h" +#include +#include #endif #include "musb_core.h" diff --git a/drivers/usb/musb-new/musb_dsps.c b/drivers/usb/musb-new/musb_dsps.c index 9a03917..aa5f8aa 100644 --- a/drivers/usb/musb-new/musb_dsps.c +++ b/drivers/usb/musb-new/musb_dsps.c @@ -47,7 +47,7 @@ #else #include #include -#include "linux-compat.h" +#include #endif #include "musb_core.h" diff --git a/drivers/usb/musb-new/musb_gadget.c b/drivers/usb/musb-new/musb_gadget.c index d2cb91a..0186b57 100644 --- a/drivers/usb/musb-new/musb_gadget.c +++ b/drivers/usb/musb-new/musb_gadget.c @@ -47,7 +47,7 @@ #else #include #include -#include "linux-compat.h" +#include #endif #include "musb_core.h" diff --git a/drivers/usb/musb-new/musb_gadget_ep0.c b/drivers/usb/musb-new/musb_gadget_ep0.c index 6599d38..bbc67b0 100644 --- a/drivers/usb/musb-new/musb_gadget_ep0.c +++ b/drivers/usb/musb-new/musb_gadget_ep0.c @@ -43,7 +43,7 @@ #include #else #include -#include "linux-compat.h" +#include #endif #include "musb_core.h" diff --git a/drivers/usb/musb-new/musb_host.c b/drivers/usb/musb-new/musb_host.c index 9a2cf59..7bc19bf 100644 --- a/drivers/usb/musb-new/musb_host.c +++ b/drivers/usb/musb-new/musb_host.c @@ -47,8 +47,8 @@ #else #include #include -#include "linux-compat.h" -#include "usb-compat.h" +#include +#include #endif #include "musb_core.h" diff --git a/drivers/usb/musb-new/musb_host.h b/drivers/usb/musb-new/musb_host.h index ebebe0c..1be9206 100644 --- a/drivers/usb/musb-new/musb_host.h +++ b/drivers/usb/musb-new/musb_host.h @@ -35,7 +35,7 @@ #ifndef _MUSB_HOST_H #define _MUSB_HOST_H #ifdef __UBOOT__ -#include "usb-compat.h" +#include #endif static inline struct usb_hcd *musb_to_hcd(struct musb *musb) diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c index 15d2ec0..bebf4c6 100644 --- a/drivers/usb/musb-new/musb_uboot.c +++ b/drivers/usb/musb-new/musb_uboot.c @@ -5,8 +5,8 @@ #define __UBOOT__ #include -#include "linux-compat.h" -#include "usb-compat.h" +#include +#include #include "musb_core.h" #include "musb_host.h" #include "musb_gadget.h" diff --git a/drivers/usb/musb-new/usb-compat.h b/drivers/usb/musb-new/usb-compat.h deleted file mode 100644 index 27f656f..0000000 --- a/drivers/usb/musb-new/usb-compat.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef __USB_COMPAT_H__ -#define __USB_COMPAT_H__ - -#include "usb.h" - -struct usb_hcd { - void *hcd_priv; -}; - -struct usb_host_endpoint { - struct usb_endpoint_descriptor desc; - struct list_head urb_list; - void *hcpriv; -}; - -/* - * urb->transfer_flags: - * - * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb(). - */ -#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ -#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */ - -struct urb; - -typedef void (*usb_complete_t)(struct urb *); - -struct urb { - void *hcpriv; /* private data for host controller */ - struct list_head urb_list; /* list head for use by the urb's - * current owner */ - struct usb_device *dev; /* (in) pointer to associated device */ - struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */ - unsigned int pipe; /* (in) pipe information */ - int status; /* (return) non-ISO status */ - unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ - void *transfer_buffer; /* (in) associated data buffer */ - dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ - u32 transfer_buffer_length; /* (in) data buffer length */ - u32 actual_length; /* (return) actual transfer length */ - unsigned char *setup_packet; /* (in) setup packet (control only) */ - int start_frame; /* (modify) start frame (ISO) */ - usb_complete_t complete; /* (in) completion routine */ -}; - -#define usb_hcd_link_urb_to_ep(hcd, urb) ({ \ - int ret = 0; \ - list_add_tail(&urb->urb_list, &urb->ep->urb_list); \ - ret; }) -#define usb_hcd_unlink_urb_from_ep(hcd, urb) list_del_init(&urb->urb_list) - -static inline void usb_hcd_giveback_urb(struct usb_hcd *hcd, - struct urb *urb, - int status) -{ - urb->status = status; - if (urb->complete) - urb->complete(urb); -} - -static inline int usb_hcd_unmap_urb_for_dma(struct usb_hcd *hcd, - struct urb *urb) -{ - /* TODO: add cache invalidation here */ - return 0; -} - -static inline u16 find_tt(struct usb_device *dev) -{ - u8 chid; - u8 hub; - - /* Find out the nearest parent which is high speed */ - while (dev->parent->parent != NULL) - if (dev->parent->speed != USB_SPEED_HIGH) - dev = dev->parent; - else - break; - - /* determine the port address at that hub */ - hub = dev->parent->devnum; - for (chid = 0; chid < USB_MAXCHILDREN; chid++) - if (dev->parent->children[chid] == dev) - break; - - return (hub << 8) | chid; -} -#endif /* __USB_COMPAT_H__ */ diff --git a/include/linux/usb/linux-compat.h b/include/linux/usb/linux-compat.h new file mode 100644 index 0000000..a93dec7 --- /dev/null +++ b/include/linux/usb/linux-compat.h @@ -0,0 +1,136 @@ +/* + * linux_compat.h -- linux compatibility header file + * + * Copyright (C) 2012-2013 + * Texas Instruments Incorporated. + * Cogent Embedded. + * + * 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 St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __LINUX_COMPAT_H__ +#define __LINUX_COMPAT_H__ + +#include +#include +#include + +#define __init +#define __devinit +#define __devinitdata +#define __devinitconst +#define __iomem +#define __deprecated + +struct unused {}; +typedef struct unused unused_t; + +typedef int irqreturn_t; +typedef unused_t spinlock_t; + +struct work_struct {}; + +struct timer_list {}; +struct notifier_block {}; + +typedef unsigned long dmaaddr_t; + +#define spin_lock_init(lock) do {} while (0) +#define spin_lock(lock) do {} while (0) +#define spin_unlock(lock) do {} while (0) +#define spin_lock_irqsave(lock, flags) do {} while (0) +#define spin_unlock_irqrestore(lock, flags) do {} while (0) + +#define setup_timer(timer, func, data) do {} while (0) +#define del_timer_sync(timer) do {} while (0) +#define schedule_work(work) do {} while (0) +#define INIT_WORK(work, fun) do {} while (0) + +#define cpu_relax() do {} while (0) + +#define pr_debug(fmt, args...) debug(fmt, ##args) +#define dev_dbg(dev, fmt, args...) \ + debug(fmt, ##args) +#define dev_vdbg(dev, fmt, args...) \ + debug(fmt, ##args) +#define dev_info(dev, fmt, args...) \ + printf(fmt, ##args) +#define dev_err(dev, fmt, args...) \ + printf(fmt, ##args) +#define printk printf + +#define WARN(condition, fmt, args...) ({ \ + int ret_warn = !!condition; \ + if (ret_warn) \ + printf(fmt, ##args); \ + ret_warn; }) + +#define KERN_DEBUG +#define KERN_NOTICE +#define KERN_WARNING +#define KERN_ERR + +#define kfree(ptr) free(ptr) + +#define pm_runtime_get_sync(dev) do {} while (0) +#define pm_runtime_put(dev) do {} while (0) +#define pm_runtime_put_sync(dev) do {} while (0) +#define pm_runtime_use_autosuspend(dev) do {} while (0) +#define pm_runtime_set_autosuspend_delay(dev, delay) do {} while (0) +#define pm_runtime_enable(dev) do {} while (0) + +#define MODULE_DESCRIPTION(desc) +#define MODULE_AUTHOR(author) +#define MODULE_LICENSE(license) +#define MODULE_ALIAS(alias) +#define module_param(name, type, perm) +#define MODULE_PARM_DESC(name, desc) +#define EXPORT_SYMBOL_GPL(name) + +#define writesl(a, d, s) __raw_writesl((unsigned long)a, d, s) +#define readsl(a, d, s) __raw_readsl((unsigned long)a, d, s) +#define writesw(a, d, s) __raw_writesw((unsigned long)a, d, s) +#define readsw(a, d, s) __raw_readsw((unsigned long)a, d, s) +#define writesb(a, d, s) __raw_writesb((unsigned long)a, d, s) +#define readsb(a, d, s) __raw_readsb((unsigned long)a, d, s) + +#define IRQ_NONE 0 +#define IRQ_HANDLED 0 + +#define dev_set_drvdata(dev, data) do {} while (0) + +#define disable_irq_wake(irq) do {} while (0) +#define enable_irq_wake(irq) -EINVAL +#define free_irq(irq, data) do {} while (0) +#define request_irq(nr, f, flags, nm, data) 0 + +#define device_init_wakeup(dev, a) do {} while (0) + +#define platform_data device_data + +#ifndef wmb +#define wmb() asm volatile ("" : : : "memory") +#endif + +#define msleep(a) udelay(a * 1000) + +/* + * Map U-Boot config options to Linux ones + */ +#ifdef CONFIG_OMAP34XX +#define CONFIG_SOC_OMAP3430 +#endif + +#endif /* __LINUX_COMPAT_H__ */ diff --git a/include/linux/usb/usb-compat.h b/include/linux/usb/usb-compat.h new file mode 100644 index 0000000..295f1b7 --- /dev/null +++ b/include/linux/usb/usb-compat.h @@ -0,0 +1,110 @@ +/* + * usb_compat.h -- usb compatibility header file + * + * Copyright (C) 2012-2013 + * Texas Instruments Incorporated. + * Cogent Embedded. + * + * 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 St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __USB_COMPAT_H__ +#define __USB_COMPAT_H__ + +#include "usb.h" + +struct usb_hcd { + void *hcd_priv; +}; + +struct usb_host_endpoint { + struct usb_endpoint_descriptor desc; + struct list_head urb_list; + void *hcpriv; +}; + +/* + * urb->transfer_flags: + * + * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb(). + */ +#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ +#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */ + +struct urb; + +typedef void (*usb_complete_t)(struct urb *); + +struct urb { + void *hcpriv; /* private data for host controller */ + struct list_head urb_list; /* list head for use by the urb's + * current owner */ + struct usb_device *dev; /* (in) pointer to associated device */ + struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */ + unsigned int pipe; /* (in) pipe information */ + int status; /* (return) non-ISO status */ + unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ + void *transfer_buffer; /* (in) associated data buffer */ + dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ + u32 transfer_buffer_length; /* (in) data buffer length */ + u32 actual_length; /* (return) actual transfer length */ + unsigned char *setup_packet; /* (in) setup packet (control only) */ + int start_frame; /* (modify) start frame (ISO) */ + usb_complete_t complete; /* (in) completion routine */ +}; + +#define usb_hcd_link_urb_to_ep(hcd, urb) ({ \ + int ret = 0; \ + list_add_tail(&urb->urb_list, &urb->ep->urb_list); \ + ret; }) +#define usb_hcd_unlink_urb_from_ep(hcd, urb) list_del_init(&urb->urb_list) + +static inline void usb_hcd_giveback_urb(struct usb_hcd *hcd, + struct urb *urb, + int status) +{ + urb->status = status; + if (urb->complete) + urb->complete(urb); +} + +static inline int usb_hcd_unmap_urb_for_dma(struct usb_hcd *hcd, + struct urb *urb) +{ + /* TODO: add cache invalidation here */ + return 0; +} + +static inline u16 find_tt(struct usb_device *dev) +{ + u8 chid; + u8 hub; + + /* Find out the nearest parent which is high speed */ + while (dev->parent->parent != NULL) + if (dev->parent->speed != USB_SPEED_HIGH) + dev = dev->parent; + else + break; + + /* determine the port address at that hub */ + hub = dev->parent->devnum; + for (chid = 0; chid < USB_MAXCHILDREN; chid++) + if (dev->parent->children[chid] == dev) + break; + + return (hub << 8) | chid; +} +#endif /* __USB_COMPAT_H__ */