Commit 82d939ec authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge branch 'opw-next' into staging-next

This pulls in all of the staging patches applied during the opw
application process, and some other staging patches that were submitted
during that period of time.  All of these are for 3.14-rc1.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parents 6ce4eac1 4f317748
...@@ -68,11 +68,10 @@ static struct devalarm alarms[ANDROID_ALARM_TYPE_COUNT]; ...@@ -68,11 +68,10 @@ static struct devalarm alarms[ANDROID_ALARM_TYPE_COUNT];
*/ */
static int is_wakeup(enum android_alarm_type type) static int is_wakeup(enum android_alarm_type type)
{ {
return (type == ANDROID_ALARM_RTC_WAKEUP || return type == ANDROID_ALARM_RTC_WAKEUP ||
type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP); type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP;
} }
static void devalarm_start(struct devalarm *alrm, ktime_t exp) static void devalarm_start(struct devalarm *alrm, ktime_t exp)
{ {
if (is_wakeup(alrm->type)) if (is_wakeup(alrm->type))
...@@ -111,7 +110,6 @@ static void alarm_clear(enum android_alarm_type alarm_type) ...@@ -111,7 +110,6 @@ static void alarm_clear(enum android_alarm_type alarm_type)
} }
alarm_enabled &= ~alarm_type_mask; alarm_enabled &= ~alarm_type_mask;
spin_unlock_irqrestore(&alarm_slock, flags); spin_unlock_irqrestore(&alarm_slock, flags);
} }
static void alarm_set(enum android_alarm_type alarm_type, static void alarm_set(enum android_alarm_type alarm_type,
...@@ -280,6 +278,7 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -280,6 +278,7 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return 0; return 0;
} }
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
static long alarm_compat_ioctl(struct file *file, unsigned int cmd, static long alarm_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
...@@ -371,7 +370,6 @@ static void devalarm_triggered(struct devalarm *alarm) ...@@ -371,7 +370,6 @@ static void devalarm_triggered(struct devalarm *alarm)
spin_unlock_irqrestore(&alarm_slock, flags); spin_unlock_irqrestore(&alarm_slock, flags);
} }
static enum hrtimer_restart devalarm_hrthandler(struct hrtimer *hrt) static enum hrtimer_restart devalarm_hrthandler(struct hrtimer *hrt)
{ {
struct devalarm *devalrm = container_of(hrt, struct devalarm, u.hrt); struct devalarm *devalrm = container_of(hrt, struct devalarm, u.hrt);
......
...@@ -28,7 +28,7 @@ struct sync_fence; ...@@ -28,7 +28,7 @@ struct sync_fence;
/** /**
* struct sync_timeline_ops - sync object implementation ops * struct sync_timeline_ops - sync object implementation ops
* @driver_name: name of the implentation * @driver_name: name of the implementation
* @dup: duplicate a sync_pt * @dup: duplicate a sync_pt
* @has_signaled: returns: * @has_signaled: returns:
* 1 if pt has signaled * 1 if pt has signaled
...@@ -37,12 +37,12 @@ struct sync_fence; ...@@ -37,12 +37,12 @@ struct sync_fence;
* @compare: returns: * @compare: returns:
* 1 if b will signal before a * 1 if b will signal before a
* 0 if a and b will signal at the same time * 0 if a and b will signal at the same time
* -1 if a will signabl before b * -1 if a will signal before b
* @free_pt: called before sync_pt is freed * @free_pt: called before sync_pt is freed
* @release_obj: called before sync_timeline is freed * @release_obj: called before sync_timeline is freed
* @print_obj: deprecated * @print_obj: deprecated
* @print_pt: deprecated * @print_pt: deprecated
* @fill_driver_data: write implmentation specific driver data to data. * @fill_driver_data: write implementation specific driver data to data.
* should return an error if there is not enough room * should return an error if there is not enough room
* as specified by size. This information is returned * as specified by size. This information is returned
* to userspace by SYNC_IOC_FENCE_INFO. * to userspace by SYNC_IOC_FENCE_INFO.
...@@ -88,9 +88,9 @@ struct sync_timeline_ops { ...@@ -88,9 +88,9 @@ struct sync_timeline_ops {
/** /**
* struct sync_timeline - sync object * struct sync_timeline - sync object
* @kref: reference count on fence. * @kref: reference count on fence.
* @ops: ops that define the implementaiton of the sync_timeline * @ops: ops that define the implementation of the sync_timeline
* @name: name of the sync_timeline. Useful for debugging * @name: name of the sync_timeline. Useful for debugging
* @destoryed: set when sync_timeline is destroyed * @destroyed: set when sync_timeline is destroyed
* @child_list_head: list of children sync_pts for this sync_timeline * @child_list_head: list of children sync_pts for this sync_timeline
* @child_list_lock: lock protecting @child_list_head, destroyed, and * @child_list_lock: lock protecting @child_list_head, destroyed, and
* sync_pt.status * sync_pt.status
...@@ -119,12 +119,12 @@ struct sync_timeline { ...@@ -119,12 +119,12 @@ struct sync_timeline {
* @parent: sync_timeline to which this sync_pt belongs * @parent: sync_timeline to which this sync_pt belongs
* @child_list: membership in sync_timeline.child_list_head * @child_list: membership in sync_timeline.child_list_head
* @active_list: membership in sync_timeline.active_list_head * @active_list: membership in sync_timeline.active_list_head
* @signaled_list: membership in temorary signaled_list on stack * @signaled_list: membership in temporary signaled_list on stack
* @fence: sync_fence to which the sync_pt belongs * @fence: sync_fence to which the sync_pt belongs
* @pt_list: membership in sync_fence.pt_list_head * @pt_list: membership in sync_fence.pt_list_head
* @status: 1: signaled, 0:active, <0: error * @status: 1: signaled, 0:active, <0: error
* @timestamp: time which sync_pt status transitioned from active to * @timestamp: time which sync_pt status transitioned from active to
* singaled or error. * signaled or error.
*/ */
struct sync_pt { struct sync_pt {
struct sync_timeline *parent; struct sync_timeline *parent;
...@@ -145,9 +145,9 @@ struct sync_pt { ...@@ -145,9 +145,9 @@ struct sync_pt {
/** /**
* struct sync_fence - sync fence * struct sync_fence - sync fence
* @file: file representing this fence * @file: file representing this fence
* @kref: referenace count on fence. * @kref: reference count on fence.
* @name: name of sync_fence. Useful for debugging * @name: name of sync_fence. Useful for debugging
* @pt_list_head: list of sync_pts in ths fence. immutable once fence * @pt_list_head: list of sync_pts in the fence. immutable once fence
* is created * is created
* @waiter_list_head: list of asynchronous waiters on this fence * @waiter_list_head: list of asynchronous waiters on this fence
* @waiter_list_lock: lock protecting @waiter_list_head and @status * @waiter_list_lock: lock protecting @waiter_list_head and @status
...@@ -201,23 +201,23 @@ static inline void sync_fence_waiter_init(struct sync_fence_waiter *waiter, ...@@ -201,23 +201,23 @@ static inline void sync_fence_waiter_init(struct sync_fence_waiter *waiter,
/** /**
* sync_timeline_create() - creates a sync object * sync_timeline_create() - creates a sync object
* @ops: specifies the implemention ops for the object * @ops: specifies the implementation ops for the object
* @size: size to allocate for this obj * @size: size to allocate for this obj
* @name: sync_timeline name * @name: sync_timeline name
* *
* Creates a new sync_timeline which will use the implemetation specified by * Creates a new sync_timeline which will use the implementation specified by
* @ops. @size bytes will be allocated allowing for implemntation specific * @ops. @size bytes will be allocated allowing for implementation specific
* data to be kept after the generic sync_timeline stuct. * data to be kept after the generic sync_timeline struct.
*/ */
struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops, struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops,
int size, const char *name); int size, const char *name);
/** /**
* sync_timeline_destory() - destorys a sync object * sync_timeline_destroy() - destroys a sync object
* @obj: sync_timeline to destroy * @obj: sync_timeline to destroy
* *
* A sync implemntation should call this when the @obj is going away * A sync implementation should call this when the @obj is going away
* (i.e. module unload.) @obj won't actually be freed until all its childern * (i.e. module unload.) @obj won't actually be freed until all its children
* sync_pts are freed. * sync_pts are freed.
*/ */
void sync_timeline_destroy(struct sync_timeline *obj); void sync_timeline_destroy(struct sync_timeline *obj);
...@@ -226,7 +226,7 @@ void sync_timeline_destroy(struct sync_timeline *obj); ...@@ -226,7 +226,7 @@ void sync_timeline_destroy(struct sync_timeline *obj);
* sync_timeline_signal() - signal a status change on a sync_timeline * sync_timeline_signal() - signal a status change on a sync_timeline
* @obj: sync_timeline to signal * @obj: sync_timeline to signal
* *
* A sync implemntation should call this any time one of it's sync_pts * A sync implementation should call this any time one of it's sync_pts
* has signaled or has an error condition. * has signaled or has an error condition.
*/ */
void sync_timeline_signal(struct sync_timeline *obj); void sync_timeline_signal(struct sync_timeline *obj);
...@@ -236,8 +236,8 @@ void sync_timeline_signal(struct sync_timeline *obj); ...@@ -236,8 +236,8 @@ void sync_timeline_signal(struct sync_timeline *obj);
* @parent: sync_pt's parent sync_timeline * @parent: sync_pt's parent sync_timeline
* @size: size to allocate for this pt * @size: size to allocate for this pt
* *
* Creates a new sync_pt as a chiled of @parent. @size bytes will be * Creates a new sync_pt as a child of @parent. @size bytes will be
* allocated allowing for implemntation specific data to be kept after * allocated allowing for implementation specific data to be kept after
* the generic sync_timeline struct. * the generic sync_timeline struct.
*/ */
struct sync_pt *sync_pt_create(struct sync_timeline *parent, int size); struct sync_pt *sync_pt_create(struct sync_timeline *parent, int size);
...@@ -287,7 +287,7 @@ struct sync_fence *sync_fence_merge(const char *name, ...@@ -287,7 +287,7 @@ struct sync_fence *sync_fence_merge(const char *name,
struct sync_fence *sync_fence_fdget(int fd); struct sync_fence *sync_fence_fdget(int fd);
/** /**
* sync_fence_put() - puts a refernnce of a sync fence * sync_fence_put() - puts a reference of a sync fence
* @fence: fence to put * @fence: fence to put
* *
* Puts a reference on @fence. If this is the last reference, the fence and * Puts a reference on @fence. If this is the last reference, the fence and
...@@ -297,7 +297,7 @@ void sync_fence_put(struct sync_fence *fence); ...@@ -297,7 +297,7 @@ void sync_fence_put(struct sync_fence *fence);
/** /**
* sync_fence_install() - installs a fence into a file descriptor * sync_fence_install() - installs a fence into a file descriptor
* @fence: fence to instal * @fence: fence to install
* @fd: file descriptor in which to install the fence * @fd: file descriptor in which to install the fence
* *
* Installs @fence into @fd. @fd's should be acquired through get_unused_fd(). * Installs @fence into @fd. @fd's should be acquired through get_unused_fd().
...@@ -359,10 +359,10 @@ struct sync_merge_data { ...@@ -359,10 +359,10 @@ struct sync_merge_data {
* struct sync_pt_info - detailed sync_pt information * struct sync_pt_info - detailed sync_pt information
* @len: length of sync_pt_info including any driver_data * @len: length of sync_pt_info including any driver_data
* @obj_name: name of parent sync_timeline * @obj_name: name of parent sync_timeline
* @driver_name: name of driver implmenting the parent * @driver_name: name of driver implementing the parent
* @status: status of the sync_pt 0:active 1:signaled <0:error * @status: status of the sync_pt 0:active 1:signaled <0:error
* @timestamp_ns: timestamp of status change in nanoseconds * @timestamp_ns: timestamp of status change in nanoseconds
* @driver_data: any driver dependant data * @driver_data: any driver dependent data
*/ */
struct sync_pt_info { struct sync_pt_info {
__u32 len; __u32 len;
...@@ -377,7 +377,7 @@ struct sync_pt_info { ...@@ -377,7 +377,7 @@ struct sync_pt_info {
/** /**
* struct sync_fence_info_data - data returned from fence info ioctl * struct sync_fence_info_data - data returned from fence info ioctl
* @len: ioctl caller writes the size of the buffer its passing in. * @len: ioctl caller writes the size of the buffer its passing in.
* ioctl returns length of sync_fence_data reutnred to userspace * ioctl returns length of sync_fence_data returned to userspace
* including pt_info. * including pt_info.
* @name: name of fence * @name: name of fence
* @status: status of fence. 1: signaled 0:active <0:error * @status: status of fence. 1: signaled 0:active <0:error
...@@ -418,7 +418,7 @@ struct sync_fence_info_data { ...@@ -418,7 +418,7 @@ struct sync_fence_info_data {
* pt_info. * pt_info.
* *
* pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence. * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence.
* To itterate over the sync_pt_infos, use the sync_pt_info.len field. * To iterate over the sync_pt_infos, use the sync_pt_info.len field.
*/ */
#define SYNC_IOC_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\ #define SYNC_IOC_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\
struct sync_fence_info_data) struct sync_fence_info_data)
......
This diff is collapsed.
This diff is collapsed.
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/slab.h>
#include "comedidev.h" #include "comedidev.h"
#include "comedi_internal.h" #include "comedi_internal.h"
...@@ -26,31 +27,21 @@ ...@@ -26,31 +27,21 @@
#define COMEDI_PAGE_PROTECTION PAGE_KERNEL #define COMEDI_PAGE_PROTECTION PAGE_KERNEL
#endif #endif
static void __comedi_buf_free(struct comedi_device *dev, static void comedi_buf_map_kref_release(struct kref *kref)
struct comedi_subdevice *s,
unsigned n_pages)
{ {
struct comedi_async *async = s->async; struct comedi_buf_map *bm =
container_of(kref, struct comedi_buf_map, refcount);
struct comedi_buf_page *buf; struct comedi_buf_page *buf;
unsigned i; unsigned int i;
if (async->prealloc_buf) {
vunmap(async->prealloc_buf);
async->prealloc_buf = NULL;
async->prealloc_bufsz = 0;
}
if (!async->buf_page_list)
return;
for (i = 0; i < n_pages; ++i) { if (bm->page_list) {
buf = &async->buf_page_list[i]; for (i = 0; i < bm->n_pages; i++) {
if (buf->virt_addr) { buf = &bm->page_list[i];
clear_bit(PG_reserved, clear_bit(PG_reserved,
&(virt_to_page(buf->virt_addr)->flags)); &(virt_to_page(buf->virt_addr)->flags));
if (s->async_dma_dir != DMA_NONE) { if (bm->dma_dir != DMA_NONE) {
#ifdef CONFIG_HAS_DMA #ifdef CONFIG_HAS_DMA
dma_free_coherent(dev->hw_dev, dma_free_coherent(bm->dma_hw_dev,
PAGE_SIZE, PAGE_SIZE,
buf->virt_addr, buf->virt_addr,
buf->dma_addr); buf->dma_addr);
...@@ -59,10 +50,26 @@ static void __comedi_buf_free(struct comedi_device *dev, ...@@ -59,10 +50,26 @@ static void __comedi_buf_free(struct comedi_device *dev,
free_page((unsigned long)buf->virt_addr); free_page((unsigned long)buf->virt_addr);
} }
} }
vfree(bm->page_list);
} }
vfree(async->buf_page_list); if (bm->dma_dir != DMA_NONE)
async->buf_page_list = NULL; put_device(bm->dma_hw_dev);
async->n_buf_pages = 0; kfree(bm);
}
static void __comedi_buf_free(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct comedi_async *async = s->async;
if (async->prealloc_buf) {
vunmap(async->prealloc_buf);
async->prealloc_buf = NULL;
async->prealloc_bufsz = 0;
}
comedi_buf_map_put(async->buf_map);
async->buf_map = NULL;
} }
static void __comedi_buf_alloc(struct comedi_device *dev, static void __comedi_buf_alloc(struct comedi_device *dev,
...@@ -71,6 +78,7 @@ static void __comedi_buf_alloc(struct comedi_device *dev, ...@@ -71,6 +78,7 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
{ {
struct comedi_async *async = s->async; struct comedi_async *async = s->async;
struct page **pages = NULL; struct page **pages = NULL;
struct comedi_buf_map *bm;
struct comedi_buf_page *buf; struct comedi_buf_page *buf;
unsigned i; unsigned i;
...@@ -80,18 +88,29 @@ static void __comedi_buf_alloc(struct comedi_device *dev, ...@@ -80,18 +88,29 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
return; return;
} }
async->buf_page_list = vzalloc(sizeof(*buf) * n_pages); bm = kzalloc(sizeof(*async->buf_map), GFP_KERNEL);
if (async->buf_page_list) if (!bm)
return;
async->buf_map = bm;
kref_init(&bm->refcount);
bm->dma_dir = s->async_dma_dir;
if (bm->dma_dir != DMA_NONE)
/* Need ref to hardware device to free buffer later. */
bm->dma_hw_dev = get_device(dev->hw_dev);
bm->page_list = vzalloc(sizeof(*buf) * n_pages);
if (bm->page_list)
pages = vmalloc(sizeof(struct page *) * n_pages); pages = vmalloc(sizeof(struct page *) * n_pages);
if (!pages) if (!pages)
return; return;
for (i = 0; i < n_pages; i++) { for (i = 0; i < n_pages; i++) {
buf = &async->buf_page_list[i]; buf = &bm->page_list[i];
if (s->async_dma_dir != DMA_NONE) if (bm->dma_dir != DMA_NONE)
#ifdef CONFIG_HAS_DMA #ifdef CONFIG_HAS_DMA
buf->virt_addr = dma_alloc_coherent(dev->hw_dev, buf->virt_addr = dma_alloc_coherent(bm->dma_hw_dev,
PAGE_SIZE, PAGE_SIZE,
&buf->dma_addr, &buf->dma_addr,
GFP_KERNEL | GFP_KERNEL |
...@@ -108,6 +127,7 @@ static void __comedi_buf_alloc(struct comedi_device *dev, ...@@ -108,6 +127,7 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
pages[i] = virt_to_page(buf->virt_addr); pages[i] = virt_to_page(buf->virt_addr);
} }
bm->n_pages = i;
/* vmap the prealloc_buf if all the pages were allocated */ /* vmap the prealloc_buf if all the pages were allocated */
if (i == n_pages) if (i == n_pages)
...@@ -117,6 +137,26 @@ static void __comedi_buf_alloc(struct comedi_device *dev, ...@@ -117,6 +137,26 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
vfree(pages); vfree(pages);
} }
void comedi_buf_map_get(struct comedi_buf_map *bm)
{
if (bm)
kref_get(&bm->refcount);
}
int comedi_buf_map_put(struct comedi_buf_map *bm)
{
if (bm)
return kref_put(&bm->refcount, comedi_buf_map_kref_release);
return 1;
}
bool comedi_buf_is_mmapped(struct comedi_async *async)
{
struct comedi_buf_map *bm = async->buf_map;
return bm && (atomic_read(&bm->refcount.refcount) > 1);
}
int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
unsigned long new_size) unsigned long new_size)
{ {
...@@ -130,7 +170,7 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -130,7 +170,7 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
return 0; return 0;
/* deallocate old buffer */ /* deallocate old buffer */
__comedi_buf_free(dev, s, async->n_buf_pages); __comedi_buf_free(dev, s);
/* allocate new buffer */ /* allocate new buffer */
if (new_size) { if (new_size) {
...@@ -140,10 +180,9 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -140,10 +180,9 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
if (!async->prealloc_buf) { if (!async->prealloc_buf) {
/* allocation failed */ /* allocation failed */
__comedi_buf_free(dev, s, n_pages); __comedi_buf_free(dev, s);
return -ENOMEM; return -ENOMEM;
} }
async->n_buf_pages = n_pages;
} }
async->prealloc_bufsz = new_size; async->prealloc_bufsz = new_size;
......
This diff is collapsed.
...@@ -16,7 +16,11 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s); ...@@ -16,7 +16,11 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s);
int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
unsigned long new_size); unsigned long new_size);
void comedi_buf_reset(struct comedi_async *async); void comedi_buf_reset(struct comedi_async *async);
bool comedi_buf_is_mmapped(struct comedi_async *async);
void comedi_buf_map_get(struct comedi_buf_map *bm);
int comedi_buf_map_put(struct comedi_buf_map *bm);
unsigned int comedi_buf_write_n_allocated(struct comedi_async *async); unsigned int comedi_buf_write_n_allocated(struct comedi_async *async);
void comedi_device_cancel_all(struct comedi_device *dev);
extern unsigned int comedi_default_buf_size_kb; extern unsigned int comedi_default_buf_size_kb;
extern unsigned int comedi_default_buf_maxsize_kb; extern unsigned int comedi_default_buf_maxsize_kb;
......
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
#define _COMEDIDEV_H #define _COMEDIDEV_H
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/mutex.h>
#include <linux/spinlock_types.h>
#include <linux/rwsem.h>
#include <linux/kref.h>
#include "comedi.h" #include "comedi.h"
...@@ -100,18 +104,22 @@ struct comedi_buf_page { ...@@ -100,18 +104,22 @@ struct comedi_buf_page {
dma_addr_t dma_addr; dma_addr_t dma_addr;
}; };
struct comedi_buf_map {
struct device *dma_hw_dev;
struct comedi_buf_page *page_list;
unsigned int n_pages;
enum dma_data_direction dma_dir;
struct kref refcount;
};
struct comedi_async { struct comedi_async {
struct comedi_subdevice *subdevice; struct comedi_subdevice *subdevice;
void *prealloc_buf; /* pre-allocated buffer */ void *prealloc_buf; /* pre-allocated buffer */
unsigned int prealloc_bufsz; /* buffer size, in bytes */ unsigned int prealloc_bufsz; /* buffer size, in bytes */
/* virtual and dma address of each page */ struct comedi_buf_map *buf_map; /* map of buffer pages */
struct comedi_buf_page *buf_page_list;
unsigned n_buf_pages; /* num elements in buf_page_list */
unsigned int max_bufsize; /* maximum buffer size, bytes */ unsigned int max_bufsize; /* maximum buffer size, bytes */
/* current number of mmaps of prealloc_buf */
unsigned int mmap_count;
/* byte count for writer (write completed) */ /* byte count for writer (write completed) */
unsigned int buf_write_count; unsigned int buf_write_count;
...@@ -141,10 +149,7 @@ struct comedi_async { ...@@ -141,10 +149,7 @@ struct comedi_async {
wait_queue_head_t wait_head; wait_queue_head_t wait_head;
/* callback stuff */
unsigned int cb_mask; unsigned int cb_mask;
int (*cb_func) (unsigned int flags, void *);
void *cb_arg;
int (*inttrig) (struct comedi_device *dev, struct comedi_subdevice *s, int (*inttrig) (struct comedi_device *dev, struct comedi_subdevice *s,
unsigned int x); unsigned int x);
...@@ -173,6 +178,7 @@ struct comedi_device { ...@@ -173,6 +178,7 @@ struct comedi_device {
struct device *class_dev; struct device *class_dev;
int minor; int minor;
unsigned int detach_count;
/* hw_dev is passed to dma_alloc_coherent when allocating async buffers /* hw_dev is passed to dma_alloc_coherent when allocating async buffers
* for subdevices that have async_dma_dir set to something other than * for subdevices that have async_dma_dir set to something other than
* DMA_NONE */ * DMA_NONE */
...@@ -185,6 +191,8 @@ struct comedi_device { ...@@ -185,6 +191,8 @@ struct comedi_device {
bool ioenabled:1; bool ioenabled:1;
spinlock_t spinlock; spinlock_t spinlock;
struct mutex mutex; struct mutex mutex;
struct rw_semaphore attach_lock;
struct kref refcount;
int n_subdevices; int n_subdevices;
struct comedi_subdevice *subdevices; struct comedi_subdevice *subdevices;
...@@ -231,7 +239,8 @@ enum comedi_minor_bits { ...@@ -231,7 +239,8 @@ enum comedi_minor_bits {
static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4; static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4;
static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1; static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1;
struct comedi_device *comedi_dev_from_minor(unsigned minor); struct comedi_device *comedi_dev_get_from_minor(unsigned minor);
int comedi_dev_put(struct comedi_device *dev);
void init_polling(void); void init_polling(void);
void cleanup_polling(void); void cleanup_polling(void);
...@@ -240,7 +249,6 @@ void stop_polling(struct comedi_device *); ...@@ -240,7 +249,6 @@ void stop_polling(struct comedi_device *);
/* subdevice runflags */ /* subdevice runflags */
enum subdevice_runflags { enum subdevice_runflags {
SRF_USER = 0x00000001,
SRF_RT = 0x00000002, SRF_RT = 0x00000002,
/* indicates an COMEDI_CB_ERROR event has occurred since the last /* indicates an COMEDI_CB_ERROR event has occurred since the last
* command was started */ * command was started */
......
...@@ -95,7 +95,7 @@ int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices) ...@@ -95,7 +95,7 @@ int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices)
} }
EXPORT_SYMBOL_GPL(comedi_alloc_subdevices); EXPORT_SYMBOL_GPL(comedi_alloc_subdevices);
static void cleanup_device(struct comedi_device *dev) static void comedi_device_detach_cleanup(struct comedi_device *dev)
{ {
int i; int i;
struct comedi_subdevice *s; struct comedi_subdevice *s;
...@@ -133,10 +133,14 @@ static void cleanup_device(struct comedi_device *dev) ...@@ -133,10 +133,14 @@ static void cleanup_device(struct comedi_device *dev)
void comedi_device_detach(struct comedi_device *dev) void comedi_device_detach(struct comedi_device *dev)
{ {
comedi_device_cancel_all(dev);
down_write(&dev->attach_lock);
dev->attached = false; dev->attached = false;
dev->detach_count++;
if (dev->driver) if (dev->driver)
dev->driver->detach(dev); dev->driver->detach(dev);
cleanup_device(dev); comedi_device_detach_cleanup(dev);
up_write(&dev->attach_lock);
} }
static int poll_invalid(struct comedi_device *dev, struct comedi_subdevice *s) static int poll_invalid(struct comedi_device *dev, struct comedi_subdevice *s)
...@@ -355,8 +359,9 @@ static int comedi_device_postconfig(struct comedi_device *dev) ...@@ -355,8 +359,9 @@ static int comedi_device_postconfig(struct comedi_device *dev)
ret = __comedi_device_postconfig(dev); ret = __comedi_device_postconfig(dev);
if (ret < 0) if (ret < 0)
return ret; return ret;
smp_wmb(); down_write(&dev->attach_lock);
dev->attached = true; dev->attached = true;
up_write(&dev->attach_lock);
return 0; return 0;
} }
...@@ -657,7 +662,7 @@ void comedi_driver_unregister(struct comedi_driver *driver) ...@@ -657,7 +662,7 @@ void comedi_driver_unregister(struct comedi_driver *driver)
/* check for devices using this driver */ /* check for devices using this driver */
for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) { for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
struct comedi_device *dev = comedi_dev_from_minor(i); struct comedi_device *dev = comedi_dev_get_from_minor(i);
if (!dev) if (!dev)
continue; continue;
...@@ -671,6 +676,7 @@ void comedi_driver_unregister(struct comedi_driver *driver) ...@@ -671,6 +676,7 @@ void comedi_driver_unregister(struct comedi_driver *driver)
comedi_device_detach(dev); comedi_device_detach(dev);
} }
mutex_unlock(&dev->mutex); mutex_unlock(&dev->mutex);
comedi_dev_put(dev);
} }
} }
EXPORT_SYMBOL_GPL(comedi_driver_unregister); EXPORT_SYMBOL_GPL(comedi_driver_unregister);
...@@ -513,7 +513,7 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev, ...@@ -513,7 +513,7 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev,
int event = 0; int event = 0;
spin_lock_irqsave(&subpriv->spinlock, flags); spin_lock_irqsave(&subpriv->spinlock, flags);
subpriv->active = 1; subpriv->active = true;
/* Set up end of acquisition. */ /* Set up end of acquisition. */
switch (cmd->stop_src) { switch (cmd->stop_src) {
......
...@@ -345,7 +345,7 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring, ...@@ -345,7 +345,7 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring,
for (i = 0; i < n_links; i++) { for (i = 0; i < n_links; i++) {
ring->descriptors[i].count = cpu_to_le32(PAGE_SIZE); ring->descriptors[i].count = cpu_to_le32(PAGE_SIZE);
ring->descriptors[i].addr = ring->descriptors[i].addr =
cpu_to_le32(async->buf_page_list[i].dma_addr); cpu_to_le32(async->buf_map->page_list[i].dma_addr);
ring->descriptors[i].next = ring->descriptors[i].next =
cpu_to_le32(ring->descriptors_dma_addr + (i + cpu_to_le32(ring->descriptors_dma_addr + (i +
1) * 1) *
......
...@@ -753,7 +753,7 @@ static void pcl818_ai_mode13dma_int(int mode, struct comedi_device *dev, ...@@ -753,7 +753,7 @@ static void pcl818_ai_mode13dma_int(int mode, struct comedi_device *dev,
} else { } else {
devpriv->ai_mode = INT_TYPE_AI3_DMA; devpriv->ai_mode = INT_TYPE_AI3_DMA;
outb(0x86 | (dev->irq << 4), dev->iobase + PCL818_CONTROL); /* Ext trig+IRQ+DMA */ outb(0x86 | (dev->irq << 4), dev->iobase + PCL818_CONTROL); /* Ext trig+IRQ+DMA */
}; }
} }
/* /*
......
...@@ -35,7 +35,7 @@ MODULE_LICENSE("GPL"); ...@@ -35,7 +35,7 @@ MODULE_LICENSE("GPL");
struct comedi_device *comedi_open(const char *filename) struct comedi_device *comedi_open(const char *filename)
{ {
struct comedi_device *dev; struct comedi_device *dev, *retval = NULL;
unsigned int minor; unsigned int minor;
if (strncmp(filename, "/dev/comedi", 11) != 0) if (strncmp(filename, "/dev/comedi", 11) != 0)
...@@ -46,24 +46,27 @@ struct comedi_device *comedi_open(const char *filename) ...@@ -46,24 +46,27 @@ struct comedi_device *comedi_open(const char *filename)
if (minor >= COMEDI_NUM_BOARD_MINORS) if (minor >= COMEDI_NUM_BOARD_MINORS)
return NULL; return NULL;
dev = comedi_dev_from_minor(minor); dev = comedi_dev_get_from_minor(minor);
if (!dev)
if (!dev || !dev->attached)
return NULL; return NULL;
if (!try_module_get(dev->driver->module)) down_read(&dev->attach_lock);
return NULL; if (dev->attached)
retval = dev;
else
retval = NULL;
up_read(&dev->attach_lock);
if (retval == NULL)
comedi_dev_put(dev);
return dev; return retval;
} }
EXPORT_SYMBOL_GPL(comedi_open); EXPORT_SYMBOL_GPL(comedi_open);
int comedi_close(struct comedi_device *d) int comedi_close(struct comedi_device *dev)
{ {
struct comedi_device *dev = (struct comedi_device *)d; comedi_dev_put(dev);
module_put(dev->driver->module);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(comedi_close); EXPORT_SYMBOL_GPL(comedi_close);
...@@ -73,7 +76,14 @@ static int comedi_do_insn(struct comedi_device *dev, ...@@ -73,7 +76,14 @@ static int comedi_do_insn(struct comedi_device *dev,
unsigned int *data) unsigned int *data)
{ {
struct comedi_subdevice *s; struct comedi_subdevice *s;
int ret = 0; int ret;
mutex_lock(&dev->mutex);
if (!dev->attached) {
ret = -EINVAL;
goto error;
}
/* a subdevice instruction */ /* a subdevice instruction */
if (insn->subdev >= dev->n_subdevices) { if (insn->subdev >= dev->n_subdevices) {
...@@ -120,6 +130,7 @@ static int comedi_do_insn(struct comedi_device *dev, ...@@ -120,6 +130,7 @@ static int comedi_do_insn(struct comedi_device *dev,
s->busy = NULL; s->busy = NULL;
error: error:
mutex_unlock(&dev->mutex);
return ret; return ret;
} }
...@@ -169,9 +180,6 @@ int comedi_dio_bitfield2(struct comedi_device *dev, unsigned int subdev, ...@@ -169,9 +180,6 @@ int comedi_dio_bitfield2(struct comedi_device *dev, unsigned int subdev,
unsigned int shift; unsigned int shift;
int ret; int ret;
if (subdev >= dev->n_subdevices)
return -EINVAL;
base_channel = CR_CHAN(base_channel); base_channel = CR_CHAN(base_channel);
n_chan = comedi_get_n_channels(dev, subdev); n_chan = comedi_get_n_channels(dev, subdev);
if (base_channel >= n_chan) if (base_channel >= n_chan)
...@@ -211,23 +219,33 @@ int comedi_find_subdevice_by_type(struct comedi_device *dev, int type, ...@@ -211,23 +219,33 @@ int comedi_find_subdevice_by_type(struct comedi_device *dev, int type,
unsigned int subd) unsigned int subd)
{ {
struct comedi_subdevice *s; struct comedi_subdevice *s;
int ret = -ENODEV;
if (subd > dev->n_subdevices) down_read(&dev->attach_lock);
return -ENODEV; if (dev->attached)
for (; subd < dev->n_subdevices; subd++) { for (; subd < dev->n_subdevices; subd++) {
s = &dev->subdevices[subd]; s = &dev->subdevices[subd];
if (s->type == type) if (s->type == type) {
return subd; ret = subd;
break;
}
} }
return -1; up_read(&dev->attach_lock);
return ret;
} }
EXPORT_SYMBOL_GPL(comedi_find_subdevice_by_type); EXPORT_SYMBOL_GPL(comedi_find_subdevice_by_type);
int comedi_get_n_channels(struct comedi_device *dev, unsigned int subdevice) int comedi_get_n_channels(struct comedi_device *dev, unsigned int subdevice)
{ {
struct comedi_subdevice *s = &dev->subdevices[subdevice]; int n;
down_read(&dev->attach_lock);
if (!dev->attached || subdevice >= dev->n_subdevices)
n = 0;
else
n = dev->subdevices[subdevice].n_chan;
up_read(&dev->attach_lock);
return s->n_chan; return n;
} }
EXPORT_SYMBOL_GPL(comedi_get_n_channels); EXPORT_SYMBOL_GPL(comedi_get_n_channels);
...@@ -41,16 +41,20 @@ static int comedi_read(struct seq_file *m, void *v) ...@@ -41,16 +41,20 @@ static int comedi_read(struct seq_file *m, void *v)
"driver_name, board_name, n_subdevices"); "driver_name, board_name, n_subdevices");
for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) { for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
struct comedi_device *dev = comedi_dev_from_minor(i); struct comedi_device *dev = comedi_dev_get_from_minor(i);
if (!dev) if (!dev)
continue; continue;
down_read(&dev->attach_lock);
if (dev->attached) { if (dev->attached) {
devices_q = 1; devices_q = 1;
seq_printf(m, "%2d: %-20s %-20s %4d\n", seq_printf(m, "%2d: %-20s %-20s %4d\n",
i, dev->driver->driver_name, i, dev->driver->driver_name,
dev->board_name, dev->n_subdevices); dev->board_name, dev->n_subdevices);
} }
up_read(&dev->attach_lock);
comedi_dev_put(dev);
} }
if (!devices_q) if (!devices_q)
seq_puts(m, "no devices\n"); seq_puts(m, "no devices\n");
......
...@@ -1059,7 +1059,7 @@ bool crystalhd_cmd_interrupt(struct crystalhd_cmd *ctx) ...@@ -1059,7 +1059,7 @@ bool crystalhd_cmd_interrupt(struct crystalhd_cmd *ctx)
{ {
if (!ctx) { if (!ctx) {
BCMLOG_ERR("Invalid arg..\n"); BCMLOG_ERR("Invalid arg..\n");
return 0; return false;
} }
return crystalhd_hw_interrupt(ctx->adp, &ctx->hw_ctx); return crystalhd_hw_interrupt(ctx->adp, &ctx->hw_ctx);
......
...@@ -28,9 +28,9 @@ extern int cxt1e1_log_level; ...@@ -28,9 +28,9 @@ extern int cxt1e1_log_level;
#define COMET_NUM_UNITS 5 /* Number of points per entry in table */ #define COMET_NUM_UNITS 5 /* Number of points per entry in table */
/* forward references */ /* forward references */
static void SetPwrLevel(comet_t *comet); static void SetPwrLevel(struct s_comet_reg *comet);
static void WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table); static void WrtRcvEqualizerTbl(ci_t *ci, struct s_comet_reg *comet, u_int32_t *table);
static void WrtXmtWaveformTbl(ci_t *ci, comet_t *comet, u_int8_t table[COMET_NUM_SAMPLES][COMET_NUM_UNITS]); static void WrtXmtWaveformTbl(ci_t *ci, struct s_comet_reg *comet, u_int8_t table[COMET_NUM_SAMPLES][COMET_NUM_UNITS]);
void *TWV_table[12] = { void *TWV_table[12] = {
...@@ -58,7 +58,7 @@ lbo_tbl_lkup(int t1, int lbo) { ...@@ -58,7 +58,7 @@ lbo_tbl_lkup(int t1, int lbo) {
return lbo - 1; return lbo - 1;
} }
void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster, void init_comet(void *ci, struct s_comet_reg *comet, u_int32_t port_mode, int clockmaster,
u_int8_t moreParams) u_int8_t moreParams)
{ {
u_int8_t isT1mode; u_int8_t isT1mode;
...@@ -159,8 +159,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster, ...@@ -159,8 +159,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster,
/* 60: t1 ALMI cfg */ /* 60: t1 ALMI cfg */
/* Configure Line Coding */ /* Configure Line Coding */
switch (port_mode) switch (port_mode) {
{
/* 1 - T1 B8ZS */ /* 1 - T1 B8ZS */
case CFG_FRAME_SF: case CFG_FRAME_SF:
pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0);
...@@ -286,8 +285,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster, ...@@ -286,8 +285,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster,
/* 0x30: "BRIF cfg"; 0x20 is 'CMODE', 0x03 is (bit) rate */ /* 0x30: "BRIF cfg"; 0x20 is 'CMODE', 0x03 is (bit) rate */
/* note "rate bits can only be set once after reset" */ /* note "rate bits can only be set once after reset" */
if (clockmaster) if (clockmaster) {
{
/* CMODE == clockMode, 0=clock master (so all 3 others should be slave) */ /* CMODE == clockMode, 0=clock master (so all 3 others should be slave) */
/* rate = 1.544 Mb/s */ /* rate = 1.544 Mb/s */
if (isT1mode) if (isT1mode)
...@@ -302,16 +300,17 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster, ...@@ -302,16 +300,17 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster,
/* Master Mode i.e.FPMODE=0 (@0x20) */ /* Master Mode i.e.FPMODE=0 (@0x20) */
pci_write_32((u_int32_t *) &comet->brif_fpcfg, 0x00); pci_write_32((u_int32_t *) &comet->brif_fpcfg, 0x00);
if ((moreParams & CFG_CLK_PORT_MASK) == CFG_CLK_PORT_INTERNAL) if ((moreParams & CFG_CLK_PORT_MASK) == CFG_CLK_PORT_INTERNAL) {
{
if (cxt1e1_log_level >= LOG_SBEBUG12) if (cxt1e1_log_level >= LOG_SBEBUG12)
pr_info(">> %s: clockmaster internal clock\n", __func__); pr_info(">> %s: clockmaster internal clock\n",
__func__);
/* internal oscillator */ /* internal oscillator */
pci_write_32((u_int32_t *) &comet->tx_time, 0x0d); pci_write_32((u_int32_t *) &comet->tx_time, 0x0d);
} else { } else {
/* external clock source */ /* external clock source */
if (cxt1e1_log_level >= LOG_SBEBUG12) if (cxt1e1_log_level >= LOG_SBEBUG12)
pr_info(">> %s: clockmaster external clock\n", __func__); pr_info(">> %s: clockmaster external clock\n",
__func__);
/* loop timing(external) */ /* loop timing(external) */
pci_write_32((u_int32_t *) &comet->tx_time, 0x09); pci_write_32((u_int32_t *) &comet->tx_time, 0x09);
} }
...@@ -399,7 +398,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster, ...@@ -399,7 +398,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster,
** Returns: Nothing ** Returns: Nothing
*/ */
static void static void
WrtXmtWaveform(ci_t *ci, comet_t *comet, u_int32_t sample, u_int32_t unit, u_int8_t data) WrtXmtWaveform(ci_t *ci, struct s_comet_reg *comet, u_int32_t sample, u_int32_t unit, u_int8_t data)
{ {
u_int8_t WaveformAddr; u_int8_t WaveformAddr;
...@@ -417,19 +416,20 @@ WrtXmtWaveform(ci_t *ci, comet_t *comet, u_int32_t sample, u_int32_t unit, u_int ...@@ -417,19 +416,20 @@ WrtXmtWaveform(ci_t *ci, comet_t *comet, u_int32_t sample, u_int32_t unit, u_int
** Returns: Nothing ** Returns: Nothing
*/ */
static void static void
WrtXmtWaveformTbl(ci_t *ci, comet_t *comet, WrtXmtWaveformTbl(ci_t *ci, struct s_comet_reg *comet,
u_int8_t table[COMET_NUM_SAMPLES][COMET_NUM_UNITS]) u_int8_t table[COMET_NUM_SAMPLES][COMET_NUM_UNITS])
{ {
u_int32_t sample, unit; u_int32_t sample, unit;
for (sample = 0; sample < COMET_NUM_SAMPLES; sample++) for (sample = 0; sample < COMET_NUM_SAMPLES; sample++) {
{
for (unit = 0; unit < COMET_NUM_UNITS; unit++) for (unit = 0; unit < COMET_NUM_UNITS; unit++)
WrtXmtWaveform(ci, comet, sample, unit, table[sample][unit]); WrtXmtWaveform(ci, comet, sample, unit,
table[sample][unit]);
} }
/* Enable transmitter and set output amplitude */ /* Enable transmitter and set output amplitude */
pci_write_32((u_int32_t *) &comet->xlpg_cfg, table[COMET_NUM_SAMPLES][0]); pci_write_32((u_int32_t *) &comet->xlpg_cfg,
table[COMET_NUM_SAMPLES][0]);
} }
...@@ -444,7 +444,7 @@ WrtXmtWaveformTbl(ci_t *ci, comet_t *comet, ...@@ -444,7 +444,7 @@ WrtXmtWaveformTbl(ci_t *ci, comet_t *comet,
*/ */
static void static void
WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table) WrtRcvEqualizerTbl(ci_t *ci, struct s_comet_reg *comet, u_int32_t *table)
{ {
u_int32_t ramaddr; u_int32_t ramaddr;
volatile u_int32_t value; volatile u_int32_t value;
...@@ -457,7 +457,8 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table) ...@@ -457,7 +457,8 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table)
/* for write order preservation when Optimizing driver */ /* for write order preservation when Optimizing driver */
pci_flush_write(ci); pci_flush_write(ci);
/* write the addr, initiate a read */ /* write the addr, initiate a read */
pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr, (u_int8_t) ramaddr); pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr,
(u_int8_t) ramaddr);
/* for write order preservation when Optimizing driver */ /* for write order preservation when Optimizing driver */
pci_flush_write(ci); pci_flush_write(ci);
/* /*
...@@ -470,9 +471,12 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table) ...@@ -470,9 +471,12 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table)
} }
value = *table++; value = *table++;
pci_write_32((u_int32_t *) &comet->rlps_idata3, (u_int8_t) (value >> 24)); pci_write_32((u_int32_t *) &comet->rlps_idata3,
pci_write_32((u_int32_t *) &comet->rlps_idata2, (u_int8_t) (value >> 16)); (u_int8_t) (value >> 24));
pci_write_32((u_int32_t *) &comet->rlps_idata1, (u_int8_t) (value >> 8)); pci_write_32((u_int32_t *) &comet->rlps_idata2,
(u_int8_t) (value >> 16));
pci_write_32((u_int32_t *) &comet->rlps_idata1,
(u_int8_t) (value >> 8));
pci_write_32((u_int32_t *) &comet->rlps_idata0, (u_int8_t) value); pci_write_32((u_int32_t *) &comet->rlps_idata0, (u_int8_t) value);
/* for write order preservation when Optimizing driver */ /* for write order preservation when Optimizing driver */
pci_flush_write(ci); pci_flush_write(ci);
...@@ -484,7 +488,8 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table) ...@@ -484,7 +488,8 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table)
/* for write order preservation when optimizing driver */ /* for write order preservation when optimizing driver */
pci_flush_write(ci); pci_flush_write(ci);
/* write the addr, initiate a read */ /* write the addr, initiate a read */
pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr, (u_int8_t) ramaddr); pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr,
(u_int8_t) ramaddr);
/* for write order preservation when optimizing driver */ /* for write order preservation when optimizing driver */
pci_flush_write(ci); pci_flush_write(ci);
...@@ -508,7 +513,7 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table) ...@@ -508,7 +513,7 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table)
*/ */
static void static void
SetPwrLevel(comet_t *comet) SetPwrLevel(struct s_comet_reg *comet)
{ {
volatile u_int32_t temp; volatile u_int32_t temp;
...@@ -550,12 +555,11 @@ SetPwrLevel(comet_t *comet) ...@@ -550,12 +555,11 @@ SetPwrLevel(comet_t *comet)
*/ */
#if 0 #if 0
static void static void
SetCometOps(comet_t *comet) SetCometOps(struct s_comet_reg *comet)
{ {
volatile u_int8_t rd_value; volatile u_int8_t rd_value;
if (comet == mConfig.C4Func1Base + (COMET0_OFFSET >> 2)) if (comet == mConfig.C4Func1Base + (COMET0_OFFSET >> 2)) {
{
/* read the BRIF Configuration */ /* read the BRIF Configuration */
rd_value = (u_int8_t) pci_read_32((u_int32_t *) &comet->brif_cfg); rd_value = (u_int8_t) pci_read_32((u_int32_t *) &comet->brif_cfg);
rd_value &= ~0x20; rd_value &= ~0x20;
......
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
#define VINT32 volatile u_int32_t #define VINT32 volatile u_int32_t
struct s_comet_reg struct s_comet_reg {
{
VINT32 gbl_cfg; /* 00 Global Cfg */ VINT32 gbl_cfg; /* 00 Global Cfg */
VINT32 clkmon; /* 01 Clk Monitor */ VINT32 clkmon; /* 01 Clk Monitor */
VINT32 rx_opt; /* 02 RX Options */ VINT32 rx_opt; /* 02 RX Options */
...@@ -118,7 +117,8 @@ struct s_comet_reg ...@@ -118,7 +117,8 @@ struct s_comet_reg
VINT32 ibcd_deact; /* 4F IBCD Deactivate Code */ VINT32 ibcd_deact; /* 4F IBCD Deactivate Code */
VINT32 sigx_cfg; /* 50 SIGX Cfg/Change of Signaling State */ VINT32 sigx_cfg; /* 50 SIGX Cfg/Change of Signaling State */
VINT32 sigx_acc_cos; /* 51 SIGX uP Access Sts/Change of Signaling State */ VINT32 sigx_acc_cos; /* 51 SIGX
* uP Access Sts/Change of Signaling State */
VINT32 sigx_iac_cos; /* 52 SIGX Channel Indirect VINT32 sigx_iac_cos; /* 52 SIGX Channel Indirect
* Addr/Ctl/Change of Signaling State */ * Addr/Ctl/Change of Signaling State */
VINT32 sigx_idb_cos; /* 53 SIGX Channel Indirect Data VINT32 sigx_idb_cos; /* 53 SIGX Channel Indirect Data
...@@ -131,8 +131,10 @@ struct s_comet_reg ...@@ -131,8 +131,10 @@ struct s_comet_reg
VINT32 pmon_ies; /* 58 PMON Intr Enable/Sts */ VINT32 pmon_ies; /* 58 PMON Intr Enable/Sts */
VINT32 pmon_fberr; /* 59 PMON Framing Bit Err Cnt */ VINT32 pmon_fberr; /* 59 PMON Framing Bit Err Cnt */
VINT32 pmon_feb_lsb; /* 5A PMON OFF/COFA/Far End Block Err Cnt (LSB) */ VINT32 pmon_feb_lsb; /* 5A PMON
VINT32 pmon_feb_msb; /* 5B PMON OFF/COFA/Far End Block Err Cnt (MSB) */ * OFF/COFA/Far End Block Err Cnt (LSB) */
VINT32 pmon_feb_msb; /* 5B PMON
* OFF/COFA/Far End Block Err Cnt (MSB) */
VINT32 pmon_bed_lsb; /* 5C PMON Bit/Err/CRCE Cnt (LSB) */ VINT32 pmon_bed_lsb; /* 5C PMON Bit/Err/CRCE Cnt (LSB) */
VINT32 pmon_bed_msb; /* 5D PMON Bit/Err/CRCE Cnt (MSB) */ VINT32 pmon_bed_msb; /* 5D PMON Bit/Err/CRCE Cnt (MSB) */
VINT32 pmon_lvc_lsb; /* 5E PMON LVC Cnt (LSB) */ VINT32 pmon_lvc_lsb; /* 5E PMON LVC Cnt (LSB) */
...@@ -176,8 +178,10 @@ struct s_comet_reg ...@@ -176,8 +178,10 @@ struct s_comet_reg
VINT32 t1_aprm_1sec_2; /* 7B T1 APRM One Second Content Octet 2 */ VINT32 t1_aprm_1sec_2; /* 7B T1 APRM One Second Content Octet 2 */
VINT32 t1_aprm_1sec_3; /* 7C T1 APRM One Second Content Octet 3 */ VINT32 t1_aprm_1sec_3; /* 7C T1 APRM One Second Content Octet 3 */
VINT32 t1_aprm_1sec_4; /* 7D T1 APRM One Second Content Octet 4 */ VINT32 t1_aprm_1sec_4; /* 7D T1 APRM One Second Content Octet 4 */
VINT32 t1_aprm_1sec_5; /* 7E T1 APRM One Second Content MSB (Octect 5) */ VINT32 t1_aprm_1sec_5; /* 7E T1 APRM
VINT32 t1_aprm_1sec_6; /* 7F T1 APRM One Second Content MSB (Octect 6) */ * One Second Content MSB (Octect 5) */
VINT32 t1_aprm_1sec_6; /* 7F T1 APRM
* One Second Content MSB (Octect 6) */
VINT32 e1_tran_cfg; /* 80 E1 TRAN Cfg */ VINT32 e1_tran_cfg; /* 80 E1 TRAN Cfg */
VINT32 e1_tran_txalarm; /* 81 E1 TRAN TX Alarm/Diagnostic Ctl */ VINT32 e1_tran_txalarm; /* 81 E1 TRAN TX Alarm/Diagnostic Ctl */
...@@ -201,18 +205,23 @@ struct s_comet_reg ...@@ -201,18 +205,23 @@ struct s_comet_reg
VINT32 e1_frmr_aopts; /* 90 E1 FRMR Frame Alignment Options */ VINT32 e1_frmr_aopts; /* 90 E1 FRMR Frame Alignment Options */
VINT32 e1_frmr_mopts; /* 91 E1 FRMR Maintenance Mode Options */ VINT32 e1_frmr_mopts; /* 91 E1 FRMR Maintenance Mode Options */
VINT32 e1_frmr_ien; /* 92 E1 FRMR Framing Sts Intr Enable */ VINT32 e1_frmr_ien; /* 92 E1 FRMR Framing Sts Intr Enable */
VINT32 e1_frmr_mien; /* 93 E1 FRMR Maintenance/Alarm Sts Intr Enable */ VINT32 e1_frmr_mien; /* 93 E1 FRMR
* Maintenance/Alarm Sts Intr Enable */
VINT32 e1_frmr_ists; /* 94 E1 FRMR Framing Sts Intr Indication */ VINT32 e1_frmr_ists; /* 94 E1 FRMR Framing Sts Intr Indication */
VINT32 e1_frmr_mists; /* 95 E1 FRMR Maintenance/Alarm Sts Indication Enable */ VINT32 e1_frmr_mists; /* 95 E1 FRMR
* Maintenance/Alarm Sts Indication Enable */
VINT32 e1_frmr_sts; /* 96 E1 FRMR Framing Sts */ VINT32 e1_frmr_sts; /* 96 E1 FRMR Framing Sts */
VINT32 e1_frmr_masts; /* 97 E1 FRMR Maintenance/Alarm Sts */ VINT32 e1_frmr_masts; /* 97 E1 FRMR Maintenance/Alarm Sts */
VINT32 e1_frmr_nat_bits; /* 98 E1 FRMR International/National Bits */ VINT32 e1_frmr_nat_bits; /* 98 E1 FRMR International/National Bits */
VINT32 e1_frmr_crc_lsb; /* 99 E1 FRMR CRC Err Cnt - LSB */ VINT32 e1_frmr_crc_lsb; /* 99 E1 FRMR CRC Err Cnt - LSB */
VINT32 e1_frmr_crc_msb; /* 9A E1 FRMR CRC Err Cnt - MSB */ VINT32 e1_frmr_crc_msb; /* 9A E1 FRMR CRC Err Cnt - MSB */
VINT32 e1_frmr_nat_ien; /* 9B E1 FRMR National Bit Codeword Intr Enables */ VINT32 e1_frmr_nat_ien; /* 9B E1 FRMR
VINT32 e1_frmr_nat_ists; /* 9C E1 FRMR National Bit Codeword Intr/Sts */ * National Bit Codeword Intr Enables */
VINT32 e1_frmr_nat_ists; /* 9C E1 FRMR
* National Bit Codeword Intr/Sts */
VINT32 e1_frmr_nat; /* 9D E1 FRMR National Bit Codewords */ VINT32 e1_frmr_nat; /* 9D E1 FRMR National Bit Codewords */
VINT32 e1_frmr_fp_ien; /* 9E E1 FRMR Frame Pulse/Alarm Intr Enables */ VINT32 e1_frmr_fp_ien; /* 9E E1 FRMR
* Frame Pulse/Alarm Intr Enables */
VINT32 e1_frmr_fp_ists; /* 9F E1 FRMR Frame Pulse/Alarm Intr/Sts */ VINT32 e1_frmr_fp_ists; /* 9F E1 FRMR Frame Pulse/Alarm Intr/Sts */
VINT32 __resA0; /* A0 Reserved */ VINT32 __resA0; /* A0 Reserved */
...@@ -304,7 +313,8 @@ struct s_comet_reg ...@@ -304,7 +313,8 @@ struct s_comet_reg
VINT32 xlpg_cfg; /* F0 XLPG Line Driver Cfg */ VINT32 xlpg_cfg; /* F0 XLPG Line Driver Cfg */
VINT32 xlpg_ctlsts; /* F1 XLPG Ctl/Sts */ VINT32 xlpg_ctlsts; /* F1 XLPG Ctl/Sts */
VINT32 xlpg_pwave_addr; /* F2 XLPG Pulse Waveform Storage Write Addr */ VINT32 xlpg_pwave_addr; /* F2 XLPG
* Pulse Waveform Storage Write Addr */
VINT32 xlpg_pwave_data; /* F3 XLPG Pulse Waveform Storage Data */ VINT32 xlpg_pwave_data; /* F3 XLPG Pulse Waveform Storage Data */
VINT32 xlpg_atest_pctl; /* F4 XLPG Analog Test Positive Ctl */ VINT32 xlpg_atest_pctl; /* F4 XLPG Analog Test Positive Ctl */
VINT32 xlpg_atest_nctl; /* F5 XLPG Analog Test Negative Ctl */ VINT32 xlpg_atest_nctl; /* F5 XLPG Analog Test Negative Ctl */
...@@ -312,7 +322,8 @@ struct s_comet_reg ...@@ -312,7 +322,8 @@ struct s_comet_reg
VINT32 _xlpg_resF7; /* F7 XLPG Reserved */ VINT32 _xlpg_resF7; /* F7 XLPG Reserved */
VINT32 rlps_cfgsts; /* F8 RLPS Cfg & Sts */ VINT32 rlps_cfgsts; /* F8 RLPS Cfg & Sts */
VINT32 rlps_alos_thresh; /* F9 RLPS ALOS Detection/Clearance Threshold */ VINT32 rlps_alos_thresh; /* F9 RLPS
* ALOS Detection/Clearance Threshold */
VINT32 rlps_alos_dper; /* FA RLPS ALOS Detection Period */ VINT32 rlps_alos_dper; /* FA RLPS ALOS Detection Period */
VINT32 rlps_alos_cper; /* FB RLPS ALOS Clearance Period */ VINT32 rlps_alos_cper; /* FB RLPS ALOS Clearance Period */
VINT32 rlps_eq_iaddr; /* FC RLPS Equalization Indirect Addr */ VINT32 rlps_eq_iaddr; /* FC RLPS Equalization Indirect Addr */
...@@ -321,8 +332,6 @@ struct s_comet_reg ...@@ -321,8 +332,6 @@ struct s_comet_reg
VINT32 rlps_eq_cfg; /* FF RLPS Equalizer Cfg */ VINT32 rlps_eq_cfg; /* FF RLPS Equalizer Cfg */
}; };
typedef struct s_comet_reg comet_t;
/* 00AH: MDIAG Register bit definitions */ /* 00AH: MDIAG Register bit definitions */
#define COMET_MDIAG_ID5 0x40 #define COMET_MDIAG_ID5 0x40
#define COMET_MDIAG_LBMASK 0x3F #define COMET_MDIAG_LBMASK 0x3F
...@@ -338,7 +347,7 @@ typedef struct s_comet_reg comet_t; ...@@ -338,7 +347,7 @@ typedef struct s_comet_reg comet_t;
#ifdef __KERNEL__ #ifdef __KERNEL__
extern void extern void
init_comet(void *, comet_t *, u_int32_t, int, u_int8_t); init_comet(void *, struct s_comet_reg *, u_int32_t, int, u_int8_t);
#endif #endif
#endif /* _INC_COMET_H_ */ #endif /* _INC_COMET_H_ */
...@@ -274,7 +274,7 @@ VMETRO_TRACE (void *x) ...@@ -274,7 +274,7 @@ VMETRO_TRACE (void *x)
void void
VMETRO_TRIGGER (ci_t *ci, int x) VMETRO_TRIGGER (ci_t *ci, int x)
{ {
comet_t *comet; struct s_comet_reg *comet;
volatile u_int32_t data; volatile u_int32_t data;
comet = ci->port[0].cometbase; /* default to COMET # 0 */ comet = ci->port[0].cometbase; /* default to COMET # 0 */
......
unsigned int max_intcnt = 0; static unsigned int max_intcnt = 0;
unsigned int max_bh = 0; static unsigned int max_bh = 0;
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
* musycc.c - * musycc.c -
......
...@@ -194,7 +194,7 @@ checkPorts (ci_t *ci) ...@@ -194,7 +194,7 @@ checkPorts (ci_t *ci)
* alarms conflicts with NCOMM's interrupt servicing implementation. * alarms conflicts with NCOMM's interrupt servicing implementation.
*/ */
comet_t *comet; struct s_comet_reg *comet;
volatile u_int32_t value; volatile u_int32_t value;
u_int32_t copyVal, LEDval; u_int32_t copyVal, LEDval;
...@@ -507,7 +507,7 @@ c4_cleanup (void) ...@@ -507,7 +507,7 @@ c4_cleanup (void)
int int
c4_get_portcfg (ci_t *ci) c4_get_portcfg (ci_t *ci)
{ {
comet_t *comet; struct s_comet_reg *comet;
int portnum, mask; int portnum, mask;
u_int32_t wdata, rdata; u_int32_t wdata, rdata;
...@@ -561,7 +561,7 @@ c4_init (ci_t *ci, u_char *func0, u_char *func1) ...@@ -561,7 +561,7 @@ c4_init (ci_t *ci, u_char *func0, u_char *func1)
for (portnum = 0; portnum < MUSYCC_NPORTS; portnum++) for (portnum = 0; portnum < MUSYCC_NPORTS; portnum++)
{ {
pi = &ci->port[portnum]; pi = &ci->port[portnum];
pi->cometbase = (comet_t *) ((u_int32_t *) (func1 + COMET_OFFSET (portnum))); pi->cometbase = (struct s_comet_reg *) ((u_int32_t *) (func1 + COMET_OFFSET (portnum)));
pi->reg = (struct musycc_globalr *) ((u_char *) ci->reg + (portnum * 0x800)); pi->reg = (struct musycc_globalr *) ((u_char *) ci->reg + (portnum * 0x800));
pi->portnum = portnum; pi->portnum = portnum;
pi->p.portnum = portnum; pi->p.portnum = portnum;
...@@ -693,7 +693,7 @@ c4_init2 (ci_t *ci) ...@@ -693,7 +693,7 @@ c4_init2 (ci_t *ci)
int int
c4_loop_port (ci_t *ci, int portnum, u_int8_t cmd) c4_loop_port (ci_t *ci, int portnum, u_int8_t cmd)
{ {
comet_t *comet; struct s_comet_reg *comet;
volatile u_int32_t loopValue; volatile u_int32_t loopValue;
comet = ci->port[portnum].cometbase; comet = ci->port[portnum].cometbase;
...@@ -752,7 +752,7 @@ c4_loop_port (ci_t *ci, int portnum, u_int8_t cmd) ...@@ -752,7 +752,7 @@ c4_loop_port (ci_t *ci, int portnum, u_int8_t cmd)
status_t status_t
c4_frame_rw (ci_t *ci, struct sbecom_port_param *pp) c4_frame_rw (ci_t *ci, struct sbecom_port_param *pp)
{ {
comet_t *comet; struct s_comet_reg *comet;
volatile u_int32_t data; volatile u_int32_t data;
if (pp->portnum >= ci->max_port)/* sanity check */ if (pp->portnum >= ci->max_port)/* sanity check */
......
...@@ -133,7 +133,7 @@ struct c4_port_info ...@@ -133,7 +133,7 @@ struct c4_port_info
void *regram_saved; /* Original malloc value may have non-2KB void *regram_saved; /* Original malloc value may have non-2KB
* boundary. Need to save for use when * boundary. Need to save for use when
* freeing. */ * freeing. */
comet_t *cometbase; struct s_comet_reg *cometbase;
struct sbe_card_info *up; struct sbe_card_info *up;
/* /*
......
...@@ -20,37 +20,36 @@ ...@@ -20,37 +20,36 @@
#include "sbe_bid.h" #include "sbe_bid.h"
char * char *
sbeid_get_bdname (ci_t *ci) sbeid_get_bdname(ci_t *ci)
{ {
char *np = NULL; char *np = NULL;
switch (ci->brd_id) switch (ci->brd_id) {
{ case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1):
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1):
np = "wanPTMC-256T3 <E1>"; np = "wanPTMC-256T3 <E1>";
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1):
np = "wanPTMC-256T3 <T1>"; np = "wanPTMC-256T3 <T1>";
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1):
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L):
np = "wanPMC-C4T1E1"; np = "wanPMC-C4T1E1";
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1):
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L):
np = "wanPMC-C2T1E1"; np = "wanPMC-C2T1E1";
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1):
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L):
np = "wanPMC-C1T1E1"; np = "wanPMC-C1T1E1";
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1):
np = "wanPCI-C4T1E1"; np = "wanPCI-C4T1E1";
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1):
np = "wanPCI-C2T1E1"; np = "wanPCI-C2T1E1";
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1):
np = "wanPCI-C1T1E1"; np = "wanPCI-C1T1E1";
break; break;
default: default:
...@@ -66,31 +65,29 @@ sbeid_get_bdname (ci_t *ci) ...@@ -66,31 +65,29 @@ sbeid_get_bdname (ci_t *ci)
/* given the presetting of brd_id, set the corresponding hdw_id */ /* given the presetting of brd_id, set the corresponding hdw_id */
void void
sbeid_set_hdwbid (ci_t *ci) sbeid_set_hdwbid(ci_t *ci)
{ {
/* /*
* set SBE's unique hardware identification (for legacy boards might not * set SBE's unique hardware identification (for legacy boards might not
* have this register implemented) * have this register implemented)
*/ */
switch (ci->brd_id) switch (ci->brd_id) {
{ case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1):
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1):
ci->hdw_bid = SBE_BID_256T3_E1; /* 0x46 - SBE wanPTMC-256T3 (E1 ci->hdw_bid = SBE_BID_256T3_E1; /* 0x46 - SBE wanPTMC-256T3 (E1
* Version) */ * Version) */
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1):
ci->hdw_bid = SBE_BID_256T3_T1; /* 0x42 - SBE wanPTMC-256T3 (T1 ci->hdw_bid = SBE_BID_256T3_T1; /* 0x42 - SBE wanPTMC-256T3 (T1
* Version) */ * Version) */
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1):
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L):
/* /*
* This Board ID is a generic identification. Use the found number * This Board ID is a generic identification. Use the found number
* of ports to further define this hardware. * of ports to further define this hardware.
*/ */
switch (ci->max_port) switch (ci->max_port) {
{
default: /* shouldn't need a default, but have one default: /* shouldn't need a default, but have one
* anyway */ * anyway */
case 4: case 4:
...@@ -98,20 +95,20 @@ sbeid_set_hdwbid (ci_t *ci) ...@@ -98,20 +95,20 @@ sbeid_set_hdwbid (ci_t *ci)
break; break;
case 2: case 2:
ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */ ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1);
break; break;
case 1: case 1:
ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */ ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1);
break; break;
} }
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1):
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L):
ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */ ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1):
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L):
ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */ ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */
break; break;
#ifdef SBE_PMCC4_ENABLE #ifdef SBE_PMCC4_ENABLE
...@@ -122,16 +119,15 @@ sbeid_set_hdwbid (ci_t *ci) ...@@ -122,16 +119,15 @@ sbeid_set_hdwbid (ci_t *ci)
*/ */
case 0: case 0:
/* start by assuming 4-port for ZERO casing */ /* start by assuming 4-port for ZERO casing */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
/* drop thru to set hdw_bid and alternate PCI CxT1E1 settings */ /* drop thru to set hdw_bid and alternate PCI CxT1E1 settings */
#endif #endif
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1):
/* /*
* This Board ID is a generic identification. Use the number of * This Board ID is a generic identification. Use the number of
* found ports to further define this hardware. * found ports to further define this hardware.
*/ */
switch (ci->max_port) switch (ci->max_port) {
{
default: /* shouldn't need a default, but have one default: /* shouldn't need a default, but have one
* anyway */ * anyway */
case 4: case 4:
...@@ -139,18 +135,18 @@ sbeid_set_hdwbid (ci_t *ci) ...@@ -139,18 +135,18 @@ sbeid_set_hdwbid (ci_t *ci)
break; break;
case 2: case 2:
ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */ ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1);
break; break;
case 1: case 1:
ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */ ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1);
break; break;
} }
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1):
ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */ ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */
break; break;
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1):
ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */ ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */
break; break;
default: default:
...@@ -163,45 +159,44 @@ sbeid_set_hdwbid (ci_t *ci) ...@@ -163,45 +159,44 @@ sbeid_set_hdwbid (ci_t *ci)
/* given the presetting of hdw_bid, set the corresponding brd_id */ /* given the presetting of hdw_bid, set the corresponding brd_id */
void void
sbeid_set_bdtype (ci_t *ci) sbeid_set_bdtype(ci_t *ci)
{ {
/* set SBE's unique PCI VENDOR/DEVID */ /* set SBE's unique PCI VENDOR/DEVID */
switch (ci->hdw_bid) switch (ci->hdw_bid) {
{
case SBE_BID_C1T3: /* SBE wanPMC-C1T3 */ case SBE_BID_C1T3: /* SBE wanPMC-C1T3 */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3);
break; break;
case SBE_BID_C24TE1: /* SBE wanPTMC-C24TE1 */ case SBE_BID_C24TE1: /* SBE wanPTMC-C24TE1 */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_C24TE1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_C24TE1);
break; break;
case SBE_BID_256T3_E1: /* SBE wanPTMC-256T3 E1 Version */ case SBE_BID_256T3_E1: /* SBE wanPTMC-256T3 E1 Version */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1);
break; break;
case SBE_BID_256T3_T1: /* SBE wanPTMC-256T3 T1 Version */ case SBE_BID_256T3_T1: /* SBE wanPTMC-256T3 T1 Version */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1);
break; break;
case SBE_BID_PMC_C4T1E1: /* 0xC4 - SBE wanPMC-C4T1E1 */ case SBE_BID_PMC_C4T1E1: /* 0xC4 - SBE wanPMC-C4T1E1 */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1);
break; break;
case SBE_BID_PMC_C2T1E1: /* 0xC2 - SBE wanPMC-C2T1E1 */ case SBE_BID_PMC_C2T1E1: /* 0xC2 - SBE wanPMC-C2T1E1 */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1);
break; break;
case SBE_BID_PMC_C1T1E1: /* 0xC1 - SBE wanPMC-C1T1E1 */ case SBE_BID_PMC_C1T1E1: /* 0xC1 - SBE wanPMC-C1T1E1 */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1);
break; break;
case SBE_BID_PCI_C4T1E1: /* 0x04 - SBE wanPCI-C4T1E1 */ case SBE_BID_PCI_C4T1E1: /* 0x04 - SBE wanPCI-C4T1E1 */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
break; break;
case SBE_BID_PCI_C2T1E1: /* 0x02 - SBE wanPCI-C2T1E1 */ case SBE_BID_PCI_C2T1E1: /* 0x02 - SBE wanPCI-C2T1E1 */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1);
break; break;
case SBE_BID_PCI_C1T1E1: /* 0x01 - SBE wanPCI-C1T1E1 */ case SBE_BID_PCI_C1T1E1: /* 0x01 - SBE wanPCI-C1T1E1 */
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1);
break; break;
default: default:
/*** hdw_bid = "<unknown>"; ***/ /*** hdw_bid = "<unknown>"; ***/
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
break; break;
} }
} }
......
...@@ -2232,114 +2232,20 @@ static ssize_t dgrp_net_read(struct file *file, char __user *buf, size_t count, ...@@ -2232,114 +2232,20 @@ static ssize_t dgrp_net_read(struct file *file, char __user *buf, size_t count,
return rtn; return rtn;
} }
/** /*
* dgrp_receive() -- decode data packets received from the remote PortServer. * Common Packet Handling code
* @nd: pointer to a node structure
*/ */
static void dgrp_receive(struct nd_struct *nd)
static void handle_data_in_packet(struct nd_struct *nd, struct ch_struct *ch,
long dlen, long plen, int n1, u8 *dbuf)
{ {
struct ch_struct *ch;
u8 *buf;
u8 *b;
u8 *dbuf;
char *error; char *error;
long port;
long dlen;
long plen;
long remain;
long n; long n;
long mlast; long remain;
long elast; u8 *buf;
long mstat; u8 *b;
long estat;
char ID[3];
nd->nd_tx_time = jiffies;
ID_TO_CHAR(nd->nd_ID, ID);
b = buf = nd->nd_iobuf;
remain = nd->nd_remain; remain = nd->nd_remain;
/*
* Loop to process Realport protocol packets.
*/
while (remain > 0) {
int n0 = b[0] >> 4;
int n1 = b[0] & 0x0f;
if (n0 <= 12) {
port = (nd->nd_rx_module << 4) + n1;
if (port >= nd->nd_chan_count) {
error = "Improper Port Number";
goto prot_error;
}
ch = nd->nd_chan + port;
} else {
port = -1;
ch = NULL;
}
/*
* Process by major packet type.
*/
switch (n0) {
/*
* Process 1-byte header data packet.
*/
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
dlen = n0 + 1;
plen = dlen + 1;
dbuf = b + 1;
goto data;
/*
* Process 2-byte header data packet.
*/
case 8:
if (remain < 3)
goto done;
dlen = b[1];
plen = dlen + 2;
dbuf = b + 2;
goto data;
/*
* Process 3-byte header data packet.
*/
case 9:
if (remain < 4)
goto done;
dlen = get_unaligned_be16(b + 1);
plen = dlen + 3;
dbuf = b + 3;
/*
* Common packet handling code.
*/
data:
nd->nd_tx_work = 1; nd->nd_tx_work = 1;
/* /*
...@@ -2349,7 +2255,9 @@ static void dgrp_receive(struct nd_struct *nd) ...@@ -2349,7 +2255,9 @@ static void dgrp_receive(struct nd_struct *nd)
if (ch->ch_state < CS_READY) { if (ch->ch_state < CS_READY) {
error = "Data received before RWIN established"; error = "Data received before RWIN established";
goto prot_error; nd->nd_remain = 0;
nd->nd_state = NS_SEND_ERROR;
nd->nd_error = error;
} }
/* /*
...@@ -2361,7 +2269,9 @@ static void dgrp_receive(struct nd_struct *nd) ...@@ -2361,7 +2269,9 @@ static void dgrp_receive(struct nd_struct *nd)
if (dlen > n) { if (dlen > n) {
error = "Receive data overrun"; error = "Receive data overrun";
goto prot_error; nd->nd_remain = 0;
nd->nd_state = NS_SEND_ERROR;
nd->nd_error = error;
} }
/* /*
...@@ -2468,7 +2378,6 @@ static void dgrp_receive(struct nd_struct *nd) ...@@ -2468,7 +2378,6 @@ static void dgrp_receive(struct nd_struct *nd)
if ((ch->ch_flag & CH_INPUT) != 0) { if ((ch->ch_flag & CH_INPUT) != 0) {
ch->ch_flag &= ~CH_INPUT; ch->ch_flag &= ~CH_INPUT;
wake_up_interruptible(&ch->ch_flag_wait); wake_up_interruptible(&ch->ch_flag_wait);
} }
} }
...@@ -2486,8 +2395,119 @@ static void dgrp_receive(struct nd_struct *nd) ...@@ -2486,8 +2395,119 @@ static void dgrp_receive(struct nd_struct *nd)
put_unaligned_be16(dlen, b + 1); put_unaligned_be16(dlen, b + 1);
remain = 3; remain = 3;
goto done; if (remain > 0 && b != buf)
memcpy(buf, b, remain);
nd->nd_remain = remain;
return;
}
}
/**
* dgrp_receive() -- decode data packets received from the remote PortServer.
* @nd: pointer to a node structure
*/
static void dgrp_receive(struct nd_struct *nd)
{
struct ch_struct *ch;
u8 *buf;
u8 *b;
u8 *dbuf;
char *error;
long port;
long dlen;
long plen;
long remain;
long n;
long mlast;
long elast;
long mstat;
long estat;
char ID[3];
nd->nd_tx_time = jiffies;
ID_TO_CHAR(nd->nd_ID, ID);
b = buf = nd->nd_iobuf;
remain = nd->nd_remain;
/*
* Loop to process Realport protocol packets.
*/
while (remain > 0) {
int n0 = b[0] >> 4;
int n1 = b[0] & 0x0f;
if (n0 <= 12) {
port = (nd->nd_rx_module << 4) + n1;
if (port >= nd->nd_chan_count) {
error = "Improper Port Number";
goto prot_error;
} }
ch = nd->nd_chan + port;
} else {
port = -1;
ch = NULL;
}
/*
* Process by major packet type.
*/
switch (n0) {
/*
* Process 1-byte header data packet.
*/
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
dlen = n0 + 1;
plen = dlen + 1;
dbuf = b + 1;
handle_data_in_packet(nd, ch, dlen, plen, n1, dbuf);
break;
/*
* Process 2-byte header data packet.
*/
case 8:
if (remain < 3)
goto done;
dlen = b[1];
plen = dlen + 2;
dbuf = b + 2;
handle_data_in_packet(nd, ch, dlen, plen, n1, dbuf);
break;
/*
* Process 3-byte header data packet.
*/
case 9:
if (remain < 4)
goto done;
dlen = get_unaligned_be16(b + 1);
plen = dlen + 3;
dbuf = b + 3;
break; break;
/* /*
......
...@@ -344,25 +344,17 @@ void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg) ...@@ -344,25 +344,17 @@ void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg)
static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
{ {
unsigned short utime = qh->usecs; unsigned short utime = qh->usecs;
int done = 0; int i;
int i = 0;
int ret = -1;
while (!done) { for (i = 0; i < 8; i++) {
/* At the start hsotg->frame_usecs[i] = max_uframe_usecs[i] */ /* At the start hsotg->frame_usecs[i] = max_uframe_usecs[i] */
if (utime <= hsotg->frame_usecs[i]) { if (utime <= hsotg->frame_usecs[i]) {
hsotg->frame_usecs[i] -= utime; hsotg->frame_usecs[i] -= utime;
qh->frame_usecs[i] += utime; qh->frame_usecs[i] += utime;
ret = i; return i;
done = 1;
} else {
i++;
if (i == 8)
done = 1;
} }
} }
return -1;
return ret;
} }
/* /*
...@@ -372,21 +364,14 @@ static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -372,21 +364,14 @@ static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
{ {
unsigned short utime = qh->usecs; unsigned short utime = qh->usecs;
unsigned short xtime; unsigned short xtime;
int t_left = utime; int t_left;
int done = 0; int i;
int i = 0;
int j; int j;
int ret = -1; int k;
while (!done) { for (i = 0; i < 8; i++) {
if (hsotg->frame_usecs[i] <= 0) { if (hsotg->frame_usecs[i] <= 0)
i++;
if (i == 8) {
ret = -1;
done = 1;
}
continue; continue;
}
/* /*
* we need n consecutive slots so use j as a start slot * we need n consecutive slots so use j as a start slot
...@@ -400,50 +385,35 @@ static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -400,50 +385,35 @@ static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
*/ */
if (xtime + hsotg->frame_usecs[j] < utime) { if (xtime + hsotg->frame_usecs[j] < utime) {
if (hsotg->frame_usecs[j] < if (hsotg->frame_usecs[j] <
max_uframe_usecs[j]) { max_uframe_usecs[j])
ret = -1; continue;
break;
}
} }
if (xtime >= utime) { if (xtime >= utime) {
ret = i;
break;
}
/* add the frame time to x time */
xtime += hsotg->frame_usecs[j];
/* we must have a fully available next frame or break */
if (xtime < utime &&
hsotg->frame_usecs[j] == max_uframe_usecs[j]) {
ret = -1;
break;
}
}
if (ret >= 0) {
t_left = utime; t_left = utime;
for (j = i; t_left > 0 && j < 8; j++) { for (k = i; k < 8; k++) {
t_left -= hsotg->frame_usecs[j]; t_left -= hsotg->frame_usecs[k];
if (t_left <= 0) { if (t_left <= 0) {
qh->frame_usecs[j] += qh->frame_usecs[k] +=
hsotg->frame_usecs[j] + t_left; hsotg->frame_usecs[k]
hsotg->frame_usecs[j] = -t_left; + t_left;
ret = i; hsotg->frame_usecs[k] = -t_left;
done = 1; return i;
} else { } else {
qh->frame_usecs[j] += qh->frame_usecs[k] +=
hsotg->frame_usecs[j]; hsotg->frame_usecs[k];
hsotg->frame_usecs[j] = 0; hsotg->frame_usecs[k] = 0;
} }
} }
} else {
i++;
if (i == 8) {
ret = -1;
done = 1;
} }
/* add the frame time to x time */
xtime += hsotg->frame_usecs[j];
/* we must have a fully available next frame or break */
if (xtime < utime &&
hsotg->frame_usecs[j] == max_uframe_usecs[j])
continue;
} }
} }
return -1;
return ret;
} }
static int dwc2_find_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) static int dwc2_find_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
......
...@@ -135,7 +135,7 @@ MODULE_DEVICE_TABLE(of, dwc2_of_match_table); ...@@ -135,7 +135,7 @@ MODULE_DEVICE_TABLE(of, dwc2_of_match_table);
static struct platform_driver dwc2_platform_driver = { static struct platform_driver dwc2_platform_driver = {
.driver = { .driver = {
.name = (char *)dwc2_driver_name, .name = dwc2_driver_name,
.of_match_table = dwc2_of_match_table, .of_match_table = dwc2_of_match_table,
}, },
.probe = dwc2_driver_probe, .probe = dwc2_driver_probe,
......
...@@ -27,132 +27,132 @@ ...@@ -27,132 +27,132 @@
#define _BOOTH_ #define _BOOTH_
// Official bootloader // Official bootloader
static unsigned char bootimage [] = { static unsigned char bootimage[] = {
0x00,0x00,0x01,0x5E,0x00,0x00 0x00, 0x00, 0x01, 0x5E, 0x00, 0x00,
,0x00,0x00,0x00,0x00,0x02,0xD7 0x00, 0x00, 0x00, 0x00, 0x02, 0xD7,
,0x00,0x00,0x01,0x5E,0x46,0xB3 0x00, 0x00, 0x01, 0x5E, 0x46, 0xB3,
,0xE6,0x02,0x00,0x98,0xE6,0x8C 0xE6, 0x02, 0x00, 0x98, 0xE6, 0x8C,
,0x00,0x98,0xFB,0x92,0xFF,0xFF 0x00, 0x98, 0xFB, 0x92, 0xFF, 0xFF,
,0x98,0xFB,0x94,0xFF,0xFF,0x98 0x98, 0xFB, 0x94, 0xFF, 0xFF, 0x98,
,0xFB,0x06,0x08,0x00,0x98,0xFB 0xFB, 0x06, 0x08, 0x00, 0x98, 0xFB,
,0x96,0x84,0x00,0x98,0xFB,0x08 0x96, 0x84, 0x00, 0x98, 0xFB, 0x08,
,0x1C,0x00,0x98,0xFB,0x51,0x25 0x1C, 0x00, 0x98, 0xFB, 0x51, 0x25,
,0x10,0x1C,0x00,0xE6,0x51,0x01 0x10, 0x1C, 0x00, 0xE6, 0x51, 0x01,
,0x07,0xFD,0x4C,0xFF,0x20,0xF5 0x07, 0xFD, 0x4C, 0xFF, 0x20, 0xF5,
,0x51,0x02,0x20,0x08,0x00,0x4C 0x51, 0x02, 0x20, 0x08, 0x00, 0x4C,
,0xFF,0x20,0x3C,0x00,0xC0,0x64 0xFF, 0x20, 0x3C, 0x00, 0xC0, 0x64,
,0x98,0xC0,0x66,0x98,0xC0,0x68 0x98, 0xC0, 0x66, 0x98, 0xC0, 0x68,
,0x98,0xC0,0x6A,0x98,0xC0,0x6C 0x98, 0xC0, 0x6A, 0x98, 0xC0, 0x6C,
,0x98,0x90,0x08,0x90,0x09,0x90 0x98, 0x90, 0x08, 0x90, 0x09, 0x90,
,0x0A,0x90,0x0B,0x90,0x0C,0x90 0x0A, 0x90, 0x0B, 0x90, 0x0C, 0x90,
,0x0D,0x90,0x0E,0x90,0x0F,0x90 0x0D, 0x90, 0x0E, 0x90, 0x0F, 0x90,
,0x04,0x90,0x06,0xFB,0x51,0x22 0x04, 0x90, 0x06, 0xFB, 0x51, 0x22,
,0x16,0x08,0x03,0xFB,0x51,0x52 0x16, 0x08, 0x03, 0xFB, 0x51, 0x52,
,0x16,0x08,0x04,0xFB,0x51,0x24 0x16, 0x08, 0x04, 0xFB, 0x51, 0x24,
,0x2B,0x08,0x06,0xFB,0x51,0x54 0x2B, 0x08, 0x06, 0xFB, 0x51, 0x54,
,0x2B,0x08,0x07,0xFB,0x51,0x24 0x2B, 0x08, 0x07, 0xFB, 0x51, 0x24,
,0x2B,0x08,0x09,0xFB,0x51,0x54 0x2B, 0x08, 0x09, 0xFB, 0x51, 0x54,
,0x2B,0x08,0x0A,0xFB,0x51,0x12 0x2B, 0x08, 0x0A, 0xFB, 0x51, 0x12,
,0x16,0x08,0x0C,0xFB,0x51,0x52 0x16, 0x08, 0x0C, 0xFB, 0x51, 0x52,
,0x16,0x08,0x0D,0x78,0x00,0x00 0x16, 0x08, 0x0D, 0x78, 0x00, 0x00,
,0x00,0x16,0x00,0x00,0xEC,0x31 0x00, 0x16, 0x00, 0x00, 0xEC, 0x31,
,0xAE,0x00,0x00,0x81,0x4C,0x0F 0xAE, 0x00, 0x00, 0x81, 0x4C, 0x0F,
,0xE6,0x43,0xFF,0xEC,0x31,0x4E 0xE6, 0x43, 0xFF, 0xEC, 0x31, 0x4E,
,0x00,0x00,0x91,0xEC,0x31,0xAE 0x00, 0x00, 0x91, 0xEC, 0x31, 0xAE,
,0x00,0x00,0x91,0x4C,0x0F,0xE6 0x00, 0x00, 0x91, 0x4C, 0x0F, 0xE6,
,0x43,0xFF,0xEC,0x31,0x5E,0x00 0x43, 0xFF, 0xEC, 0x31, 0x5E, 0x00,
,0x00,0xA1,0xEB,0x31,0x08,0x00 0x00, 0xA1, 0xEB, 0x31, 0x08, 0x00,
,0x00,0xA6,0xEB,0x31,0x08,0x00 0x00, 0xA6, 0xEB, 0x31, 0x08, 0x00,
,0x00,0xAC,0x3C,0x00,0xEB,0x31 0x00, 0xAC, 0x3C, 0x00, 0xEB, 0x31,
,0x08,0x00,0x00,0xA8,0x76,0xFE 0x08, 0x00, 0x00, 0xA8, 0x76, 0xFE,
,0xFE,0x08,0xEB,0x31,0x08,0x20 0xFE, 0x08, 0xEB, 0x31, 0x08, 0x20,
,0x00,0x00,0x76,0xFF,0xFF,0x18 0x00, 0x00, 0x76, 0xFF, 0xFF, 0x18,
,0xED,0x31,0x08,0x20,0x00,0x00 0xED, 0x31, 0x08, 0x20, 0x00, 0x00,
,0x26,0x10,0x04,0x10,0xF5,0x3C 0x26, 0x10, 0x04, 0x10, 0xF5, 0x3C,
,0x01,0x3C,0x00,0x08,0x01,0x12 0x01, 0x3C, 0x00, 0x08, 0x01, 0x12,
,0x3C,0x11,0x3C,0x00,0x08,0x01 0x3C, 0x11, 0x3C, 0x00, 0x08, 0x01,
,0x0B,0x08,0x00,0x6D,0xEC,0x31 0x0B, 0x08, 0x00, 0x6D, 0xEC, 0x31,
,0xAE,0x20,0x00,0x06,0xED,0x4D 0xAE, 0x20, 0x00, 0x06, 0xED, 0x4D,
,0x08,0x00,0x00,0x67,0x80,0x6F 0x08, 0x00, 0x00, 0x67, 0x80, 0x6F,
,0x00,0x01,0x0B,0x6F,0x00,0x02 0x00, 0x01, 0x0B, 0x6F, 0x00, 0x02,
,0x2E,0x76,0xEE,0x01,0x48,0x06 0x2E, 0x76, 0xEE, 0x01, 0x48, 0x06,
,0x01,0x39,0xED,0x4D,0x18,0x00 0x01, 0x39, 0xED, 0x4D, 0x18, 0x00,
,0x02,0xED,0x4D,0x08,0x00,0x04 0x02, 0xED, 0x4D, 0x08, 0x00, 0x04,
,0x14,0x06,0xA4,0xED,0x31,0x22 0x14, 0x06, 0xA4, 0xED, 0x31, 0x22,
,0x00,0x00,0xAC,0x76,0xEE,0x07 0x00, 0x00, 0xAC, 0x76, 0xEE, 0x07,
,0x48,0x6D,0x22,0x01,0x1E,0x08 0x48, 0x6D, 0x22, 0x01, 0x1E, 0x08,
,0x01,0x58,0xEB,0x31,0x08,0x00 0x01, 0x58, 0xEB, 0x31, 0x08, 0x00,
,0x00,0xAC,0x06,0xFF,0xBA,0x3C 0x00, 0xAC, 0x06, 0xFF, 0xBA, 0x3C,
,0x00,0xEB,0x31,0x08,0x20,0x00 0x00, 0xEB, 0x31, 0x08, 0x20, 0x00,
,0x04,0x3C,0x30,0xEB,0x31,0x08 0x04, 0x3C, 0x30, 0xEB, 0x31, 0x08,
,0x20,0x00,0x02,0x3C,0x10,0xEB 0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB,
,0x31,0x08,0x20,0x00,0x00,0xED 0x31, 0x08, 0x20, 0x00, 0x00, 0xED,
,0x31,0x08,0x20,0x00,0x00,0x04 0x31, 0x08, 0x20, 0x00, 0x00, 0x04,
,0x10,0xF7,0xED,0x31,0x08,0x00 0x10, 0xF7, 0xED, 0x31, 0x08, 0x00,
,0x00,0xA2,0x91,0x00,0x9C,0x3C 0x00, 0xA2, 0x91, 0x00, 0x9C, 0x3C,
,0x80,0xEB,0x31,0x08,0x20,0x00 0x80, 0xEB, 0x31, 0x08, 0x20, 0x00,
,0x04,0x3C,0x20,0xEB,0x31,0x08 0x04, 0x3C, 0x20, 0xEB, 0x31, 0x08,
,0x20,0x00,0x02,0x3C,0x10,0xEB 0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB,
,0x31,0x08,0x20,0x00,0x00,0xED 0x31, 0x08, 0x20, 0x00, 0x00, 0xED,
,0x31,0x08,0x20,0x00,0x00,0x04 0x31, 0x08, 0x20, 0x00, 0x00, 0x04,
,0x10,0xF7,0xED,0x31,0x08,0x20 0x10, 0xF7, 0xED, 0x31, 0x08, 0x20,
,0x00,0x04,0x42,0x10,0x90,0x08 0x00, 0x04, 0x42, 0x10, 0x90, 0x08,
,0xEC,0x31,0xAE,0x20,0x00,0x06 0xEC, 0x31, 0xAE, 0x20, 0x00, 0x06,
,0xA4,0x41,0x08,0x00,0xB6,0xED 0xA4, 0x41, 0x08, 0x00, 0xB6, 0xED,
,0x41,0x28,0x7D,0xFF,0xFF,0x22 0x41, 0x28, 0x7D, 0xFF, 0xFF, 0x22,
,0xB3,0x40,0x98,0x2A,0x32,0xEB 0xB3, 0x40, 0x98, 0x2A, 0x32, 0xEB,
,0x41,0x28,0xB4,0x43,0xFC,0x05 0x41, 0x28, 0xB4, 0x43, 0xFC, 0x05,
,0xFF,0xE6,0xA0,0x31,0x20,0x00 0xFF, 0xE6, 0xA0, 0x31, 0x20, 0x00,
,0x06,0xEB,0x31,0x08,0x20,0x00 0x06, 0xEB, 0x31, 0x08, 0x20, 0x00,
,0x04,0x3C,0x20,0xEB,0x31,0x08 0x04, 0x3C, 0x20, 0xEB, 0x31, 0x08,
,0x20,0x00,0x02,0x3C,0x10,0xEB 0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB,
,0x31,0x08,0x20,0x00,0x00,0xED 0x31, 0x08, 0x20, 0x00, 0x00, 0xED,
,0x31,0x08,0x20,0x00,0x00,0x04 0x31, 0x08, 0x20, 0x00, 0x00, 0x04,
,0x10,0xF7,0xED,0x31,0x08,0x20 0x10, 0xF7, 0xED, 0x31, 0x08, 0x20,
,0x00,0x04,0x42,0x10,0x90,0x08 0x00, 0x04, 0x42, 0x10, 0x90, 0x08,
,0xEC,0x31,0xAE,0x20,0x00,0x06 0xEC, 0x31, 0xAE, 0x20, 0x00, 0x06,
,0xA4,0x41,0x08,0x00,0x68,0xED 0xA4, 0x41, 0x08, 0x00, 0x68, 0xED,
,0x41,0x28,0x7D,0xFF,0xFF,0x22 0x41, 0x28, 0x7D, 0xFF, 0xFF, 0x22,
,0xB3,0x40,0x98,0x2A,0x32,0xEB 0xB3, 0x40, 0x98, 0x2A, 0x32, 0xEB,
,0x41,0x28,0xB4,0x43,0xFC,0x05 0x41, 0x28, 0xB4, 0x43, 0xFC, 0x05,
,0xFF,0xE6,0x48,0x04,0xEB,0x31 0xFF, 0xE6, 0x48, 0x04, 0xEB, 0x31,
,0x08,0x20,0x00,0x04,0xEB,0x31 0x08, 0x20, 0x00, 0x04, 0xEB, 0x31,
,0x18,0x20,0x00,0x02,0x3C,0x11 0x18, 0x20, 0x00, 0x02, 0x3C, 0x11,
,0xEB,0x31,0x18,0x20,0x00,0x00 0xEB, 0x31, 0x18, 0x20, 0x00, 0x00,
,0xED,0x31,0x08,0x20,0x00,0x00 0xED, 0x31, 0x08, 0x20, 0x00, 0x00,
,0x04,0x10,0xF7,0xED,0x31,0x08 0x04, 0x10, 0xF7, 0xED, 0x31, 0x08,
,0x20,0x00,0x02,0x66,0x00,0x6F 0x20, 0x00, 0x02, 0x66, 0x00, 0x6F,
,0x00,0x01,0x16,0x76,0xEE,0x06 0x00, 0x01, 0x16, 0x76, 0xEE, 0x06,
,0x48,0x4A,0x1E,0x48,0x04,0xED 0x48, 0x4A, 0x1E, 0x48, 0x04, 0xED,
,0x31,0x08,0x20,0x00,0x04,0xEB 0x31, 0x08, 0x20, 0x00, 0x04, 0xEB,
,0x31,0x08,0x00,0x00,0xA4,0x48 0x31, 0x08, 0x00, 0x00, 0xA4, 0x48,
,0x04,0xED,0x31,0x08,0x20,0x00 0x04, 0xED, 0x31, 0x08, 0x20, 0x00,
,0x04,0xEB,0x31,0x08,0x00,0x00 0x04, 0xEB, 0x31, 0x08, 0x00, 0x00,
,0xA2,0x48,0x04,0x20,0x20,0x4A 0xA2, 0x48, 0x04, 0x20, 0x20, 0x4A,
,0x7C,0x46,0x82,0x50,0x05,0x50 0x7C, 0x46, 0x82, 0x50, 0x05, 0x50,
,0x15,0xB5,0x1E,0x98,0xED,0x31 0x15, 0xB5, 0x1E, 0x98, 0xED, 0x31,
,0x08,0x00,0x00,0xA8,0x10,0x47 0x08, 0x00, 0x00, 0xA8, 0x10, 0x47,
,0x3B,0x2C,0x01,0xDB,0x40,0x11 0x3B, 0x2C, 0x01, 0xDB, 0x40, 0x11,
,0x98,0xC1,0x1E,0x98,0x10,0x07 0x98, 0xC1, 0x1E, 0x98, 0x10, 0x07,
,0x30,0xF9,0x40,0x07,0x18,0x98 0x30, 0xF9, 0x40, 0x07, 0x18, 0x98,
,0x2A,0x10,0xEB,0x31,0x08,0x00 0x2A, 0x10, 0xEB, 0x31, 0x08, 0x00,
,0x00,0xA8,0xA4,0x1E,0x98,0xBB 0x00, 0xA8, 0xA4, 0x1E, 0x98, 0xBB,
,0x1E,0x98,0x50,0x14,0x50,0x04 0x1E, 0x98, 0x50, 0x14, 0x50, 0x04,
,0x46,0x83,0x48,0x04,0x02,0x01 0x46, 0x83, 0x48, 0x04, 0x02, 0x01,
,0x00,0x50,0x05,0x50,0x15,0x10 0x00, 0x50, 0x05, 0x50, 0x15, 0x10,
,0x87,0x3F,0x90,0x2B,0x18,0x01 0x87, 0x3F, 0x90, 0x2B, 0x18, 0x01,
,0x00,0xC0,0x31,0x00,0x00,0xAE 0x00, 0xC0, 0x31, 0x00, 0x00, 0xAE,
,0xDF,0x41,0x00,0x08,0x00,0x1A 0xDF, 0x41, 0x00, 0x08, 0x00, 0x1A,
,0x42,0x11,0x67,0x01,0xDF,0x41 0x42, 0x11, 0x67, 0x01, 0xDF, 0x41,
,0x02,0x08,0x00,0x10,0x42,0x11 0x02, 0x08, 0x00, 0x10, 0x42, 0x11,
,0x62,0x01,0xB4,0x43,0x4A,0x68 0x62, 0x01, 0xB4, 0x43, 0x4A, 0x68,
,0x50,0x14,0x50,0x04,0x24,0x10 0x50, 0x14, 0x50, 0x04, 0x24, 0x10,
,0x48,0x04,0xF2,0x31,0x00,0x01 0x48, 0x04, 0xF2, 0x31, 0x00, 0x01,
,0x00,0x00,0xAE,0xF6,0x31,0x00 0x00, 0x00, 0xAE, 0xF6, 0x31, 0x00,
,0x01,0x00,0x00,0xAE,0x62,0xE4 0x01, 0x00, 0x00, 0xAE, 0x62, 0xE4,
,0xE5,0x61,0x04,0x48,0x04,0xE5 0xE5, 0x61, 0x04, 0x48, 0x04, 0xE5,
,0x63,0x05,0x48,0x04,0x20,0x20 0x63, 0x05, 0x48, 0x04, 0x20, 0x20,
,0x00,0x00,0x00,0x00 0x00, 0x00, 0x00, 0x00
}; };
#endif #endif
...@@ -33,13 +33,13 @@ ...@@ -33,13 +33,13 @@
#define seq_putx(m, message, size, var) \ #define seq_putx(m, message, size, var) \
seq_printf(m, message); \ seq_printf(m, message); \
for(i = 0; i < (size - 1); i++) \ for (i = 0; i < (size - 1); i++) \
seq_printf(m, "%02x:", var[i]); \ seq_printf(m, "%02x:", var[i]); \
seq_printf(m, "%02x\n", var[i]) seq_printf(m, "%02x\n", var[i])
#define seq_putd(m, message, size, var) \ #define seq_putd(m, message, size, var) \
seq_printf(m, message); \ seq_printf(m, message); \
for(i = 0; i < (size - 1); i++) \ for (i = 0; i < (size - 1); i++) \
seq_printf(m, "%d.", var[i]); \ seq_printf(m, "%d.", var[i]); \
seq_printf(m, "%d\n", var[i]) seq_printf(m, "%d\n", var[i])
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#define FTNET_PROC init_net.proc_net #define FTNET_PROC init_net.proc_net
int ft1000_read_dpram16 (struct ft1000_usb *ft1000dev, u16 indx, int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx,
u8 *buffer, u8 highlow); u8 *buffer, u8 highlow);
......
...@@ -45,13 +45,13 @@ static int ft1000_poll_thread(void *arg) ...@@ -45,13 +45,13 @@ static int ft1000_poll_thread(void *arg)
msleep(10); msleep(10);
if (!gPollingfailed) { if (!gPollingfailed) {
ret = ft1000_poll(arg); ret = ft1000_poll(arg);
if (ret != STATUS_SUCCESS) { if (ret != 0) {
DEBUG("ft1000_poll_thread: polling failed\n"); DEBUG("ft1000_poll_thread: polling failed\n");
gPollingfailed = true; gPollingfailed = true;
} }
} }
} }
return STATUS_SUCCESS; return 0;
} }
static int ft1000_probe(struct usb_interface *interface, static int ft1000_probe(struct usb_interface *interface,
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
#define PSEUDOSZ 16 #define PSEUDOSZ 16
#define SUCCESS 0x00
struct app_info_block { struct app_info_block {
u32 nTxMsg; /* DPRAM msg sent to DSP with app_id */ u32 nTxMsg; /* DPRAM msg sent to DSP with app_id */
u32 nRxMsg; /* DPRAM msg rcv from dsp with app_id */ u32 nRxMsg; /* DPRAM msg rcv from dsp with app_id */
...@@ -31,9 +29,6 @@ struct app_info_block { ...@@ -31,9 +29,6 @@ struct app_info_block {
#define FALSE 0 #define FALSE 0
#define TRUE 1 #define TRUE 1
#define STATUS_SUCCESS 0
#define STATUS_FAILURE 0x1001
#define FT1000_STATUS_CLOSING 0x01 #define FT1000_STATUS_CLOSING 0x01
#define DSPBCMSGID 0x10 #define DSPBCMSGID 0x10
......
...@@ -44,18 +44,6 @@ ...@@ -44,18 +44,6 @@
*/ */
#define DEFAULT_MTU_SIZE 1500 #define DEFAULT_MTU_SIZE 1500
#define gdm_dev_endian(n) (\
n->phy_dev->get_endian(n->phy_dev->priv_dev))
#define gdm_lte_hci_send(n, d, l) (\
n->phy_dev->send_hci_func(n->phy_dev->priv_dev, d, l, NULL, NULL))
#define gdm_lte_sdu_send(n, d, l, c, b, i, t) (\
n->phy_dev->send_sdu_func(n->phy_dev->priv_dev, d, l, n->pdn_table.dft_eps_id, 0, c, b, i, t))
#define gdm_lte_rcv_with_cb(n, c, b, e) (\
n->rcv_func(n->priv_dev, c, b, e))
#define IP_VERSION_4 4 #define IP_VERSION_4 4
#define IP_VERSION_6 6 #define IP_VERSION_6 6
...@@ -458,12 +446,10 @@ static int gdm_lte_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -458,12 +446,10 @@ static int gdm_lte_tx(struct sk_buff *skb, struct net_device *dev)
sscanf(dev->name, "lte%d", &idx); sscanf(dev->name, "lte%d", &idx);
ret = gdm_lte_sdu_send(nic, ret = nic->phy_dev->send_sdu_func(nic->phy_dev->priv_dev,
data_buf, data_buf, data_len,
data_len, nic->pdn_table.dft_eps_id, 0,
tx_complete, tx_complete, nic, idx,
nic,
idx,
nic_type); nic_type);
if (ret == TX_NO_BUFFER || ret == TX_NO_SPC) { if (ret == TX_NO_BUFFER || ret == TX_NO_SPC) {
...@@ -503,14 +489,18 @@ static int gdm_lte_event_send(struct net_device *dev, char *buf, int len) ...@@ -503,14 +489,18 @@ static int gdm_lte_event_send(struct net_device *dev, char *buf, int len)
sscanf(dev->name, "lte%d", &idx); sscanf(dev->name, "lte%d", &idx);
return netlink_send(lte_event.sock, idx, 0, buf, return netlink_send(lte_event.sock, idx, 0, buf,
gdm_dev16_to_cpu(gdm_dev_endian(nic), hci->len) + HCI_HEADER_SIZE); gdm_dev16_to_cpu(
nic->phy_dev->get_endian(
nic->phy_dev->priv_dev), hci->len)
+ HCI_HEADER_SIZE);
} }
static void gdm_lte_event_rcv(struct net_device *dev, u16 type, void *msg, int len) static void gdm_lte_event_rcv(struct net_device *dev, u16 type, void *msg, int len)
{ {
struct nic *nic = netdev_priv(dev); struct nic *nic = netdev_priv(dev);
gdm_lte_hci_send(nic, msg, len); nic->phy_dev->send_hci_func(nic->phy_dev->priv_dev, msg, len, NULL,
NULL);
} }
int gdm_lte_event_init(void) int gdm_lte_event_init(void)
...@@ -688,8 +678,14 @@ static void gdm_lte_pdn_table(struct net_device *dev, char *buf, int len) ...@@ -688,8 +678,14 @@ static void gdm_lte_pdn_table(struct net_device *dev, char *buf, int len)
if (pdn_table->activate) { if (pdn_table->activate) {
nic->pdn_table.activate = pdn_table->activate; nic->pdn_table.activate = pdn_table->activate;
nic->pdn_table.dft_eps_id = gdm_dev32_to_cpu(gdm_dev_endian(nic), pdn_table->dft_eps_id); nic->pdn_table.dft_eps_id = gdm_dev32_to_cpu(
nic->pdn_table.nic_type = gdm_dev32_to_cpu(gdm_dev_endian(nic), pdn_table->nic_type); nic->phy_dev->get_endian(
nic->phy_dev->priv_dev),
pdn_table->dft_eps_id);
nic->pdn_table.nic_type = gdm_dev32_to_cpu(
nic->phy_dev->get_endian(
nic->phy_dev->priv_dev),
pdn_table->nic_type);
netdev_info(dev, "pdn activated, nic_type=0x%x\n", netdev_info(dev, "pdn activated, nic_type=0x%x\n",
nic->pdn_table.nic_type); nic->pdn_table.nic_type);
...@@ -762,7 +758,7 @@ void start_rx_proc(struct phy_dev *phy_dev) ...@@ -762,7 +758,7 @@ void start_rx_proc(struct phy_dev *phy_dev)
int i; int i;
for (i = 0; i < MAX_RX_SUBMIT_COUNT; i++) for (i = 0; i < MAX_RX_SUBMIT_COUNT; i++)
gdm_lte_rcv_with_cb(phy_dev, rx_complete, phy_dev, USB_COMPLETE); phy_dev->rcv_func(phy_dev->priv_dev, rx_complete, phy_dev, USB_COMPLETE);
} }
static struct net_device_ops gdm_netdev_ops = { static struct net_device_ops gdm_netdev_ops = {
......
...@@ -158,7 +158,6 @@ static int up_to_host(struct mux_rx *r) ...@@ -158,7 +158,6 @@ static int up_to_host(struct mux_rx *r)
unsigned int start_flag; unsigned int start_flag;
unsigned int payload_size; unsigned int payload_size;
unsigned short packet_type; unsigned short packet_type;
int remain;
int dummy_cnt; int dummy_cnt;
u32 packet_size_sum = r->offset; u32 packet_size_sum = r->offset;
int index; int index;
...@@ -176,8 +175,7 @@ static int up_to_host(struct mux_rx *r) ...@@ -176,8 +175,7 @@ static int up_to_host(struct mux_rx *r)
break; break;
} }
remain = (MUX_HEADER_SIZE + payload_size) % 4; dummy_cnt = ALIGN(MUX_HEADER_SIZE + payload_size, 4);
dummy_cnt = remain ? (4-remain) : 0;
if (len - packet_size_sum < if (len - packet_size_sum <
MUX_HEADER_SIZE + payload_size + dummy_cnt) { MUX_HEADER_SIZE + payload_size + dummy_cnt) {
...@@ -361,7 +359,6 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index, ...@@ -361,7 +359,6 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index,
struct mux_pkt_header *mux_header; struct mux_pkt_header *mux_header;
struct mux_tx *t = NULL; struct mux_tx *t = NULL;
static u32 seq_num = 1; static u32 seq_num = 1;
int remain;
int dummy_cnt; int dummy_cnt;
int total_len; int total_len;
int ret; int ret;
...@@ -375,8 +372,7 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index, ...@@ -375,8 +372,7 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index,
spin_lock_irqsave(&mux_dev->write_lock, flags); spin_lock_irqsave(&mux_dev->write_lock, flags);
remain = (MUX_HEADER_SIZE + len) % 4; dummy_cnt = ALIGN(MUX_HEADER_SIZE + len, 4);
dummy_cnt = remain ? (4 - remain) : 0;
total_len = len + MUX_HEADER_SIZE + dummy_cnt; total_len = len + MUX_HEADER_SIZE + dummy_cnt;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -61,7 +61,6 @@ int cfs_curproc_groups_nr(void); ...@@ -61,7 +61,6 @@ int cfs_curproc_groups_nr(void);
*/ */
/* check if task is running in compat mode.*/ /* check if task is running in compat mode.*/
int current_is_32bit(void);
#define current_pid() (current->pid) #define current_pid() (current->pid)
#define current_comm() (current->comm) #define current_comm() (current->comm)
int cfs_get_environ(const char *key, char *value, int *val_len); int cfs_get_environ(const char *key, char *value, int *val_len);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment