1 /*****************************************************************************
2 ** FILE NAME : ifxusb_ctl.c
3 ** PROJECT : IFX USB sub-system V3
4 ** MODULES : IFX USB sub-system Host and Device driver
8 ** DESCRIPTION : Implementing the procfs and sysfs for IFX USB driver
11 ** REFERENCE : Synopsys DWC-OTG Driver 2.7
12 ** COPYRIGHT : Copyright (c) 2010
13 ** LANTIQ DEUTSCHLAND GMBH,
14 ** Am Campeon 3, 85579 Neubiberg, Germany
16 ** This program is free software; you can redistribute it and/or modify
17 ** it under the terms of the GNU General Public License as published by
18 ** the Free Software Foundation; either version 2 of the License, or
19 ** (at your option) any later version.
21 ** Version Control Section **
25 ** $Log$ Revision history
26 *****************************************************************************/
29 * This file contains code fragments from Synopsys HS OTG Linux Software Driver.
30 * For this code the following notice is applicable:
32 * ==========================================================================
34 * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
35 * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless
36 * otherwise expressly agreed to in writing between Synopsys and you.
38 * The Software IS NOT an item of Licensed Software or Licensed Product under
39 * any End User Software License Agreement or Agreement for Licensed Product
40 * with Synopsys or any supplement thereto. You are permitted to use and
41 * redistribute this Software in source and binary forms, with or without
42 * modification, provided that redistributions of source code must retain this
43 * notice. You may not view, use, disclose, copy or distribute this file or
44 * any information contained herein except pursuant to this license grant from
45 * Synopsys. If you do not agree with this notice, including the disclaimer
46 * below, then you are not authorized to use the Software.
48 * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS
49 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT,
52 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
53 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
54 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
59 * ========================================================================== */
61 /*! \file ifxusb_ctl.c
62 \ingroup IFXUSB_DRIVER_V3
63 \brief Implementing the procfs and sysfs for IFX USB driver
66 #include <linux/version.h>
67 #include "ifxusb_version.h"
70 #include <linux/proc_fs.h>
71 #include <asm/byteorder.h>
72 #include <asm/unaligned.h>
73 #include <asm/uaccess.h>
75 #include "ifxusb_plat.h"
76 #include "ifxusb_regs.h"
77 #include "ifxusb_cif.h"
82 #include <asm/ifx/ifx_types.h>
83 #include <asm/ifx/ifx_pmcu.h>
84 IFX_PMCU_REGISTER_t pmcuRegisterUSBGadget
;
91 #include <asm/ifx/ifx_types.h>
92 #include <asm/ifx/ifx_pmcu.h>
94 IFX_PMCU_REGISTER_t pmcuRegisterUSBHost_1
;
95 IFX_PMCU_REGISTER_t pmcuRegisterUSBHost_2
;
97 IFX_PMCU_REGISTER_t pmcuRegisterUSBHost
;
102 #include <linux/device.h>
103 #include <linux/platform_device.h>
104 #include <linux/gfp.h>
107 extern char ifxusb_hcd_driver_name
[];
110 extern ifxhcd_hcd_t ifxusb_hcd_1
;
111 extern ifxhcd_hcd_t ifxusb_hcd_2
;
112 extern char ifxusb_hcd_name_1
[];
113 extern char ifxusb_hcd_name_2
[];
115 extern ifxhcd_hcd_t ifxusb_hcd
;
116 extern char ifxusb_hcd_name
[];
122 extern char ifxusb_pcd_driver_name
[];
124 extern ifxpcd_pcd_t ifxusb_pcd
;
125 extern char ifxusb_pcd_name
[];
129 //Attributes for sysfs (for 2.6 only)
132 extern struct device_attribute dev_attr_version_h
;
134 extern struct device_attribute dev_attr_version_d
;
137 extern struct device_attribute dev_attr_dbglevel_h
;
139 extern struct device_attribute dev_attr_dbglevel_d
;
143 extern struct device_attribute dev_attr_suspend_host_1
;
144 extern struct device_attribute dev_attr_suspend_host_2
;
145 extern struct device_attribute dev_attr_probe_host_1
;
146 extern struct device_attribute dev_attr_probe_host_2
;
147 extern struct device_attribute dev_attr_probe_timer1_val_h
;
148 extern struct device_attribute dev_attr_probe_timer2_val_h
;
149 extern struct device_attribute dev_attr_autoprobe_timer1_val_h
;
150 extern struct device_attribute dev_attr_autoprobe_timer2_val_h
;
152 extern struct device_attribute dev_attr_suspend_host
;
153 extern struct device_attribute dev_attr_probe_host
;
154 extern struct device_attribute dev_attr_probe_timer_val_h
;
155 extern struct device_attribute dev_attr_autoprobe_timer_val_h
;
160 extern struct device_attribute dev_attr_suspend_device
;
161 extern struct device_attribute dev_attr_probe_device
;
162 extern struct device_attribute dev_attr_probe_timer_val_d
;
163 extern struct device_attribute dev_attr_autoprobe_timer_val_d
;
168 extern struct device_attribute dev_attr_dump_params_h_1
;
169 extern struct device_attribute dev_attr_dump_params_h_2
;
170 extern struct device_attribute dev_attr_mode_h_1
;
171 extern struct device_attribute dev_attr_mode_h_2
;
173 extern struct device_attribute dev_attr_dump_params_h
;
174 extern struct device_attribute dev_attr_mode_h
;
177 extern struct device_attribute dev_attr_dump_params_d
;
178 extern struct device_attribute dev_attr_mode_d
;
183 extern struct device_attribute dev_attr_pkt_count_limit_bi_1
;
184 extern struct device_attribute dev_attr_pkt_count_limit_bo_1
;
185 extern struct device_attribute dev_attr_pkt_count_limit_bi_2
;
186 extern struct device_attribute dev_attr_pkt_count_limit_bo_2
;
187 extern struct device_attribute dev_attr_bandwidth_fs_1
;
188 extern struct device_attribute dev_attr_bandwidth_ls_1
;
189 extern struct device_attribute dev_attr_bandwidth_hs_2
;
190 extern struct device_attribute dev_attr_bandwidth_fs_2
;
191 extern struct device_attribute dev_attr_bandwidth_ls_2
;
192 extern struct device_attribute dev_attr_buspower_1
;
193 extern struct device_attribute dev_attr_buspower_2
;
194 extern struct device_attribute dev_attr_bussuspend_1
;
195 extern struct device_attribute dev_attr_bussuspend_2
;
196 extern struct device_attribute dev_attr_busconnected_1
;
197 extern struct device_attribute dev_attr_busconnected_2
;
198 extern struct device_attribute dev_attr_connectspeed_1
;
199 extern struct device_attribute dev_attr_connectspeed_1
;
201 extern struct device_attribute dev_attr_pkt_count_limit_bi
;
202 extern struct device_attribute dev_attr_pkt_count_limit_bo
;
203 extern struct device_attribute dev_attr_bandwidth_hs
;
204 extern struct device_attribute dev_attr_bandwidth_fs
;
205 extern struct device_attribute dev_attr_bandwidth_ls
;
206 extern struct device_attribute dev_attr_buspower
;
207 extern struct device_attribute dev_attr_bussuspend
;
208 extern struct device_attribute dev_attr_busconnected
;
209 extern struct device_attribute dev_attr_connectspeed
;
214 extern struct device_attribute dev_attr_devspeed
;
215 extern struct device_attribute dev_attr_enumspeed
;
216 #endif //__IS_DEVICE__
218 #ifdef __ENABLE_DUMP__
221 extern struct device_attribute dev_attr_dump_reg_h_1
;
222 extern struct device_attribute dev_attr_dump_reg_h_2
;
223 extern struct device_attribute dev_attr_dump_spram_h_1
;
224 extern struct device_attribute dev_attr_dump_spram_h_2
;
225 extern struct device_attribute dev_attr_dump_host_state_1
;
226 extern struct device_attribute dev_attr_dump_host_state_2
;
228 extern struct device_attribute dev_attr_dump_reg_h
;
229 extern struct device_attribute dev_attr_dump_spram_h
;
230 extern struct device_attribute dev_attr_dump_host_state
;
233 extern struct device_attribute dev_attr_dump_reg_d
;
234 extern struct device_attribute dev_attr_dump_spram_d
;
236 #endif //__ENABLE_DUMP__
239 /////////////////////////////////////////////////////////////////////////////////////////////////////
240 /////////////////////////////////////////////////////////////////////////////////////////////////////
241 /////////////////////////////////////////////////////////////////////////////////////////////////////
243 static ssize_t
procfs_version_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
245 return sprintf( buf
, "%s\n",IFXUSB_VERSION
);
248 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
249 static ssize_t
sysfs_version_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
251 static ssize_t
sysfs_version_show( struct device
*_dev
, char *buf
)
254 return sprintf( buf
, "%s\n",IFXUSB_VERSION
);
258 DEVICE_ATTR(version_h
, S_IRUGO
|S_IWUSR
, sysfs_version_show
, NULL
);
260 DEVICE_ATTR(version_d
, S_IRUGO
|S_IWUSR
, sysfs_version_show
, NULL
);
264 /////////////////////////////////////////////////////////////////////////////////////////////////////
265 /////////////////////////////////////////////////////////////////////////////////////////////////////
266 /////////////////////////////////////////////////////////////////////////////////////////////////////
267 /////////////////////////////////////////////////////////////////////////////////////////////////////
268 /////////////////////////////////////////////////////////////////////////////////////////////////////
269 /////////////////////////////////////////////////////////////////////////////////////////////////////
271 static ssize_t
procfs_dbglevel_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
274 return sprintf( buf
, "%08X\n",h_dbg_lvl
);
276 return sprintf( buf
, "%08X\n",d_dbg_lvl
);
280 static ssize_t
procfs_dbglevel_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
285 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
287 value
= simple_strtoul(buf
, NULL
, 16);
293 //turn on and off power
297 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
298 static ssize_t
sysfs_dbglevel_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
300 static ssize_t
sysfs_dbglevel_show( struct device
*_dev
, char *buf
)
304 return sprintf( buf
, "%08X\n",h_dbg_lvl
);
306 return sprintf( buf
, "%08X\n",d_dbg_lvl
);
310 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
311 static ssize_t
sysfs_dbglevel_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
313 static ssize_t
sysfs_dbglevel_store( struct device
*_dev
, const char *buffer
, size_t count
)
319 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
321 value
= simple_strtoul(buf
, NULL
, 16);
327 //turn on and off power
332 DEVICE_ATTR(dbglevel_h
, S_IRUGO
|S_IWUSR
, sysfs_dbglevel_show
, sysfs_dbglevel_store
);
334 DEVICE_ATTR(dbglevel_d
, S_IRUGO
|S_IWUSR
, sysfs_dbglevel_show
, sysfs_dbglevel_store
);
338 /////////////////////////////////////////////////////////////////////////////////////////////////////
339 /////////////////////////////////////////////////////////////////////////////////////////////////////
340 /////////////////////////////////////////////////////////////////////////////////////////////////////
342 static void ifxusb_dump_params(ifxusb_core_if_t
*_core_if
);
345 static void dump_params_1(void)
347 ifxusb_dump_params(&ifxusb_hcd_1
.core_if
);
349 static void dump_params_2(void)
351 ifxusb_dump_params(&ifxusb_hcd_2
.core_if
);
354 static ssize_t
procfs_dump_params_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
359 static ssize_t
procfs_dump_params_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
365 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
366 static ssize_t
sysfs_dump_params_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
368 static ssize_t
sysfs_dump_params_show_1( struct device
*_dev
,char *buf
)
374 DEVICE_ATTR(dump_params_h_1
, S_IRUGO
|S_IWUSR
, sysfs_dump_params_show_1
, NULL
);
376 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
377 static ssize_t
sysfs_dump_params_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
379 static ssize_t
sysfs_dump_params_show_2( struct device
*_dev
,char *buf
)
386 DEVICE_ATTR(dump_params_h_2
, S_IRUGO
|S_IWUSR
, sysfs_dump_params_show_2
, NULL
);
388 static void dump_params(void)
391 ifxusb_dump_params(&ifxusb_hcd
.core_if
);
393 ifxusb_dump_params(&ifxusb_pcd
.core_if
);
397 static ssize_t
procfs_dump_params_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
403 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
404 static ssize_t
sysfs_dump_params_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
406 static ssize_t
sysfs_dump_params_show( struct device
*_dev
,char *buf
)
414 DEVICE_ATTR(dump_params_h
, S_IRUGO
|S_IWUSR
, sysfs_dump_params_show
, NULL
);
416 DEVICE_ATTR(dump_params_d
, S_IRUGO
|S_IWUSR
, sysfs_dump_params_show
, NULL
);
420 /////////////////////////////////////////////////////////////////////////////////////////////////////
421 /////////////////////////////////////////////////////////////////////////////////////////////////////
422 /////////////////////////////////////////////////////////////////////////////////////////////////////
425 static ssize_t
mode_show_1(char *buf
)
427 if((ifxusb_rreg(&ifxusb_hcd_1
.core_if
.core_global_regs
->gintsts
) & 0x1) == 1)
428 return sprintf( buf
, "HOST\n" );
430 return sprintf( buf
, "DEVICE(INCORRECT!)\n" );
433 static ssize_t
mode_show_2(char *buf
)
435 if((ifxusb_rreg(&ifxusb_hcd_2
.core_if
.core_global_regs
->gintsts
) & 0x1) == 1)
436 return sprintf( buf
, "HOST\n" );
438 return sprintf( buf
, "DEVICE(INCORRECT!)\n" );
441 static ssize_t
procfs_mode_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
443 return mode_show_1(buf
);
445 static ssize_t
procfs_mode_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
447 return mode_show_2(buf
);
450 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
451 static ssize_t
sysfs_mode_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
453 static ssize_t
sysfs_mode_show_1( struct device
*_dev
,char *buf
)
456 return mode_show_1(buf
);
459 DEVICE_ATTR(mode_h_1
, S_IRUGO
|S_IWUSR
, sysfs_mode_show_1
, 0);
461 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
462 static ssize_t
sysfs_mode_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
464 static ssize_t
sysfs_mode_show_2( struct device
*_dev
,char *buf
)
467 return mode_show_2(buf
);
469 DEVICE_ATTR(mode_h_2
, S_IRUGO
|S_IWUSR
, sysfs_mode_show_2
, NULL
);
471 static ssize_t
mode_show(char *buf
)
474 if((ifxusb_rreg(&ifxusb_hcd
.core_if
.core_global_regs
->gintsts
) & 0x1) == 1)
475 return sprintf( buf
, "HOST\n" );
477 return sprintf( buf
, "DEVICE(INCORRECT!)\n" );
479 if((ifxusb_rreg(&ifxusb_pcd
.core_if
.core_global_regs
->gintsts
) & 0x1) != 1)
480 return sprintf( buf
, "DEVICE\n" );
482 return sprintf( buf
, "HOST(INCORRECT!)\n" );
485 static ssize_t
procfs_mode_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
487 return mode_show(buf
);
489 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
490 static ssize_t
sysfs_mode_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
492 static ssize_t
sysfs_mode_show( struct device
*_dev
, char *buf
)
495 return mode_show(buf
);
498 DEVICE_ATTR(mode_h
, S_IRUGO
|S_IWUSR
, sysfs_mode_show
, NULL
);
500 DEVICE_ATTR(mode_d
, S_IRUGO
|S_IWUSR
, sysfs_mode_show
, NULL
);
504 /////////////////////////////////////////////////////////////////////////////////////////////////////
505 /////////////////////////////////////////////////////////////////////////////////////////////////////
506 /////////////////////////////////////////////////////////////////////////////////////////////////////
509 /////////////////////////////////////////////////////////////////////////////////////////////////////
510 /////////////////////////////////////////////////////////////////////////////////////////////////////
511 /////////////////////////////////////////////////////////////////////////////////////////////////////
513 static ssize_t
bandwidth_hs_show_1(char *buf
)
515 return sprintf( buf
, "%d\n",ifxusb_hcd_1
.pkt_remaining_reload_hs
);
517 static ssize_t
bandwidth_fs_show_1(char *buf
)
519 return sprintf( buf
, "%d\n",ifxusb_hcd_1
.pkt_remaining_reload_fs
);
521 static ssize_t
bandwidth_ls_show_1(char *buf
)
523 return sprintf( buf
, "%d\n",ifxusb_hcd_1
.pkt_remaining_reload_ls
);
525 static void bandwidth_hs_store_1(uint32_t value
)
527 if(value
>16 && value
<120)
530 ifxusb_hcd_1
.pkt_remaining_reload_hs
= value
;
531 hprt0
.d32
= ifxusb_rreg(ifxusb_hcd_1
.core_if
.hprt0
);
532 if(hprt0
.b
.prtspd
== IFXUSB_HPRT0_PRTSPD_HIGH_SPEED
)
533 ifxusb_hcd_1
.pkt_remaining_reload
=value
;
536 static void bandwidth_fs_store_1(uint32_t value
)
538 if (value
>2 && value
<30)
541 ifxusb_hcd_1
.pkt_remaining_reload_fs
= value
;
542 hprt0
.d32
= ifxusb_rreg(ifxusb_hcd_1
.core_if
.hprt0
);
543 if(hprt0
.b
.prtspd
!= IFXUSB_HPRT0_PRTSPD_LOW_SPEED
&& hprt0
.b
.prtspd
!= IFXUSB_HPRT0_PRTSPD_HIGH_SPEED
)
544 ifxusb_hcd_1
.pkt_remaining_reload
=value
;
547 static void bandwidth_ls_store_1(uint32_t value
)
549 if (value
>2 && value
<30)
552 ifxusb_hcd_1
.pkt_remaining_reload_ls
= value
;
553 hprt0
.d32
= ifxusb_rreg(ifxusb_hcd_1
.core_if
.hprt0
);
554 if(hprt0
.b
.prtspd
== IFXUSB_HPRT0_PRTSPD_LOW_SPEED
)
555 ifxusb_hcd_1
.pkt_remaining_reload
=value
;
558 static ssize_t
bandwidth_hs_show_2(char *buf
)
560 return sprintf( buf
, "%d\n",ifxusb_hcd_2
.pkt_remaining_reload_hs
);
562 static ssize_t
bandwidth_fs_show_2(char *buf
)
564 return sprintf( buf
, "%d\n",ifxusb_hcd_2
.pkt_remaining_reload_fs
);
566 static ssize_t
bandwidth_ls_show_2(char *buf
)
568 return sprintf( buf
, "%d\n",ifxusb_hcd_2
.pkt_remaining_reload_ls
);
570 static void bandwidth_hs_store_2(uint32_t value
)
572 if(value
>16 && value
<120)
575 ifxusb_hcd_2
.pkt_remaining_reload_hs
= value
;
576 hprt0
.d32
= ifxusb_rreg(ifxusb_hcd_2
.core_if
.hprt0
);
577 if(hprt0
.b
.prtspd
== IFXUSB_HPRT0_PRTSPD_HIGH_SPEED
)
578 ifxusb_hcd_2
.pkt_remaining_reload
=value
;
581 static void bandwidth_fs_store_2(uint32_t value
)
583 if (value
>2 && value
<30)
586 ifxusb_hcd_2
.pkt_remaining_reload_fs
= value
;
587 hprt0
.d32
= ifxusb_rreg(ifxusb_hcd_2
.core_if
.hprt0
);
588 if(hprt0
.b
.prtspd
!= IFXUSB_HPRT0_PRTSPD_LOW_SPEED
&& hprt0
.b
.prtspd
!= IFXUSB_HPRT0_PRTSPD_HIGH_SPEED
)
589 ifxusb_hcd_2
.pkt_remaining_reload
=value
;
592 static void bandwidth_ls_store_2(uint32_t value
)
594 if (value
>2 && value
<30)
597 ifxusb_hcd_2
.pkt_remaining_reload_ls
= value
;
598 hprt0
.d32
= ifxusb_rreg(ifxusb_hcd_2
.core_if
.hprt0
);
599 if(hprt0
.b
.prtspd
== IFXUSB_HPRT0_PRTSPD_LOW_SPEED
)
600 ifxusb_hcd_2
.pkt_remaining_reload
=value
;
603 static ssize_t
procfs_bandwidth_hs_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
605 return bandwidth_hs_show_1(buf
);
607 static ssize_t
procfs_bandwidth_fs_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
609 return bandwidth_fs_show_1(buf
);
611 static ssize_t
procfs_bandwidth_ls_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
613 return bandwidth_ls_show_1(buf
);
615 static ssize_t
procfs_bandwidth_hs_store_1(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
620 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
622 value
= simple_strtoul(buf
, NULL
, 10);
623 bandwidth_hs_store_1(value
);
626 static ssize_t
procfs_bandwidth_fs_store_1(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
631 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
633 value
= simple_strtoul(buf
, NULL
, 10);
634 bandwidth_fs_store_1(value
);
637 static ssize_t
procfs_bandwidth_ls_store_1(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
642 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
644 value
= simple_strtoul(buf
, NULL
, 10);
645 bandwidth_ls_store_1(value
);
648 static ssize_t
procfs_bandwidth_hs_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
650 return bandwidth_hs_show_2(buf
);
652 static ssize_t
procfs_bandwidth_fs_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
654 return bandwidth_fs_show_2(buf
);
656 static ssize_t
procfs_bandwidth_ls_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
658 return bandwidth_ls_show_2(buf
);
660 static ssize_t
procfs_bandwidth_hs_store_2(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
665 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
667 value
= simple_strtoul(buf
, NULL
, 10);
668 bandwidth_hs_store_2(value
);
671 static ssize_t
procfs_bandwidth_fs_store_2(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
676 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
678 value
= simple_strtoul(buf
, NULL
, 10);
679 bandwidth_fs_store_2(value
);
682 static ssize_t
procfs_bandwidth_ls_store_2(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
687 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
689 value
= simple_strtoul(buf
, NULL
, 10);
690 bandwidth_ls_store_2(value
);
694 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
695 static ssize_t
sysfs_bandwidth_hs_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
697 static ssize_t
sysfs_bandwidth_hs_show_1( struct device
*_dev
,char *buf
)
700 return bandwidth_hs_show_1(buf
);
702 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
703 static ssize_t
sysfs_bandwidth_hs_store_1( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
705 static ssize_t
sysfs_bandwidth_hs_store_1( struct device
*_dev
, const char *buffer
, size_t count
)
711 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
713 value
= simple_strtoul(buf
, NULL
, 10);
714 bandwidth_hs_store_1(value
);
717 DEVICE_ATTR(bandwidth_hs_1
, S_IRUGO
|S_IWUSR
, sysfs_bandwidth_hs_show_1
, sysfs_bandwidth_hs_store_1
);
719 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
720 static ssize_t
sysfs_bandwidth_fs_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
722 static ssize_t
sysfs_bandwidth_fs_show_1( struct device
*_dev
,char *buf
)
725 return bandwidth_fs_show_1(buf
);
727 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
728 static ssize_t
sysfs_bandwidth_fs_store_1( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
730 static ssize_t
sysfs_bandwidth_fs_store_1( struct device
*_dev
, const char *buffer
, size_t count
)
736 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
738 value
= simple_strtoul(buf
, NULL
, 10);
739 bandwidth_fs_store_1(value
);
742 DEVICE_ATTR(bandwidth_fs_1
, S_IRUGO
|S_IWUSR
, sysfs_bandwidth_fs_show_1
, sysfs_bandwidth_fs_store_1
);
744 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
745 static ssize_t
sysfs_bandwidth_ls_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
747 static ssize_t
sysfs_bandwidth_ls_show_1( struct device
*_dev
,char *buf
)
750 return bandwidth_ls_show_1(buf
);
752 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
753 static ssize_t
sysfs_bandwidth_ls_store_1( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
755 static ssize_t
sysfs_bandwidth_ls_store_1( struct device
*_dev
, const char *buffer
, size_t count
)
761 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
763 value
= simple_strtoul(buf
, NULL
, 10);
764 bandwidth_ls_store_1(value
);
767 DEVICE_ATTR(bandwidth_ls_1
, S_IRUGO
|S_IWUSR
, sysfs_bandwidth_ls_show_1
, sysfs_bandwidth_ls_store_1
);
769 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
770 static ssize_t
sysfs_bandwidth_hs_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
772 static ssize_t
sysfs_bandwidth_hs_show_2( struct device
*_dev
,char *buf
)
775 return bandwidth_hs_show_2(buf
);
777 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
778 static ssize_t
sysfs_bandwidth_hs_store_2( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
780 static ssize_t
sysfs_bandwidth_hs_store_2( struct device
*_dev
, const char *buffer
, size_t count
)
786 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
788 value
= simple_strtoul(buf
, NULL
, 10);
789 bandwidth_hs_store_2(value
);
792 DEVICE_ATTR(bandwidth_hs_2
, S_IRUGO
|S_IWUSR
, sysfs_bandwidth_hs_show_2
, sysfs_bandwidth_hs_store_2
);
794 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
795 static ssize_t
sysfs_bandwidth_fs_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
797 static ssize_t
sysfs_bandwidth_fs_show_2( struct device
*_dev
,char *buf
)
800 return bandwidth_fs_show_2(buf
);
802 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
803 static ssize_t
sysfs_bandwidth_fs_store_2( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
805 static ssize_t
sysfs_bandwidth_fs_store_2( struct device
*_dev
, const char *buffer
, size_t count
)
811 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
813 value
= simple_strtoul(buf
, NULL
, 10);
814 bandwidth_fs_store_2(value
);
817 DEVICE_ATTR(bandwidth_fs_2
, S_IRUGO
|S_IWUSR
, sysfs_bandwidth_fs_show_2
, sysfs_bandwidth_fs_store_2
);
819 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
820 static ssize_t
sysfs_bandwidth_ls_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
822 static ssize_t
sysfs_bandwidth_ls_show_2( struct device
*_dev
,char *buf
)
825 return bandwidth_ls_show_2(buf
);
827 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
828 static ssize_t
sysfs_bandwidth_ls_store_2( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
830 static ssize_t
sysfs_bandwidth_ls_store_2( struct device
*_dev
, const char *buffer
, size_t count
)
836 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
838 value
= simple_strtoul(buf
, NULL
, 10);
839 bandwidth_ls_store_2(value
);
842 DEVICE_ATTR(bandwidth_ls_2
, S_IRUGO
|S_IWUSR
, sysfs_bandwidth_ls_show_2
, sysfs_bandwidth_ls_store_2
);
844 static ssize_t
bandwidth_hs_show(char *buf
)
846 return sprintf( buf
, "%d\n",ifxusb_hcd
.pkt_remaining_reload_hs
);
848 static ssize_t
bandwidth_fs_show(char *buf
)
850 return sprintf( buf
, "%d\n",ifxusb_hcd
.pkt_remaining_reload_fs
);
852 static ssize_t
bandwidth_ls_show(char *buf
)
854 return sprintf( buf
, "%d\n",ifxusb_hcd
.pkt_remaining_reload_ls
);
856 static void bandwidth_hs_store(uint32_t value
)
858 if (value
>16 && value
<120)
861 ifxusb_hcd
.pkt_remaining_reload_hs
= value
;
862 hprt0
.d32
= ifxusb_rreg(ifxusb_hcd
.core_if
.hprt0
);
863 if(hprt0
.b
.prtspd
== IFXUSB_HPRT0_PRTSPD_HIGH_SPEED
)
864 ifxusb_hcd
.pkt_remaining_reload
=value
;
867 static void bandwidth_fs_store(uint32_t value
)
869 if (value
>2 && value
<30)
872 ifxusb_hcd
.pkt_remaining_reload_fs
= value
;
873 hprt0
.d32
= ifxusb_rreg(ifxusb_hcd
.core_if
.hprt0
);
874 if(hprt0
.b
.prtspd
!= IFXUSB_HPRT0_PRTSPD_LOW_SPEED
&& hprt0
.b
.prtspd
!= IFXUSB_HPRT0_PRTSPD_HIGH_SPEED
)
875 ifxusb_hcd
.pkt_remaining_reload
=value
;
878 static void bandwidth_ls_store(uint32_t value
)
880 if (value
>2 && value
<30)
883 ifxusb_hcd
.pkt_remaining_reload_hs
= value
;
884 hprt0
.d32
= ifxusb_rreg(ifxusb_hcd
.core_if
.hprt0
);
885 if(hprt0
.b
.prtspd
== IFXUSB_HPRT0_PRTSPD_LOW_SPEED
)
886 ifxusb_hcd
.pkt_remaining_reload
=value
;
889 static ssize_t
procfs_bandwidth_hs_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
891 return bandwidth_hs_show(buf
);
893 static ssize_t
procfs_bandwidth_fs_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
895 return bandwidth_fs_show(buf
);
897 static ssize_t
procfs_bandwidth_ls_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
899 return bandwidth_ls_show(buf
);
901 static ssize_t
procfs_bandwidth_hs_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
906 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
908 value
= simple_strtoul(buf
, NULL
, 10);
909 bandwidth_hs_store(value
);
912 static ssize_t
procfs_bandwidth_fs_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
917 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
919 value
= simple_strtoul(buf
, NULL
, 10);
920 bandwidth_fs_store(value
);
923 static ssize_t
procfs_bandwidth_ls_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
928 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
930 value
= simple_strtoul(buf
, NULL
, 10);
931 bandwidth_ls_store(value
);
935 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
936 static ssize_t
sysfs_bandwidth_hs_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
938 static ssize_t
sysfs_bandwidth_hs_show( struct device
*_dev
,char *buf
)
941 return bandwidth_hs_show(buf
);
943 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
944 static ssize_t
sysfs_bandwidth_hs_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
946 static ssize_t
sysfs_bandwidth_hs_store( struct device
*_dev
, const char *buffer
, size_t count
)
952 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
954 value
= simple_strtoul(buf
, NULL
, 10);
955 bandwidth_hs_store(value
);
958 DEVICE_ATTR(bandwidth_hs
, S_IRUGO
|S_IWUSR
, sysfs_bandwidth_hs_show
, sysfs_bandwidth_hs_store
);
960 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
961 static ssize_t
sysfs_bandwidth_fs_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
963 static ssize_t
sysfs_bandwidth_fs_show( struct device
*_dev
,char *buf
)
966 return bandwidth_fs_show(buf
);
968 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
969 static ssize_t
sysfs_bandwidth_fs_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
971 static ssize_t
sysfs_bandwidth_fs_store( struct device
*_dev
, const char *buffer
, size_t count
)
977 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
979 value
= simple_strtoul(buf
, NULL
, 10);
980 bandwidth_fs_store(value
);
983 DEVICE_ATTR(bandwidth_fs
, S_IRUGO
|S_IWUSR
, sysfs_bandwidth_fs_show
, sysfs_bandwidth_fs_store
);
985 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
986 static ssize_t
sysfs_bandwidth_ls_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
988 static ssize_t
sysfs_bandwidth_ls_show( struct device
*_dev
,char *buf
)
991 return bandwidth_ls_show(buf
);
993 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
994 static ssize_t
sysfs_bandwidth_ls_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
996 static ssize_t
sysfs_bandwidth_ls_store( struct device
*_dev
, const char *buffer
, size_t count
)
1002 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1004 value
= simple_strtoul(buf
, NULL
, 10);
1005 bandwidth_ls_store(value
);
1008 DEVICE_ATTR(bandwidth_ls
, S_IRUGO
|S_IWUSR
, sysfs_bandwidth_ls_show
, sysfs_bandwidth_ls_store
);
1011 /////////////////////////////////////////////////////////////////////////////////////////////////////
1012 /////////////////////////////////////////////////////////////////////////////////////////////////////
1014 static ssize_t
pkt_count_limit_bi_show_1(char *buf
)
1016 return sprintf( buf
, "%d\n",ifxusb_hcd_1
.pkt_count_limit_bi
);
1018 static ssize_t
pkt_count_limit_bo_show_1(char *buf
)
1020 return sprintf( buf
, "%d\n",ifxusb_hcd_1
.pkt_count_limit_bo
);
1022 static void pkt_count_limit_bi_store_1(uint32_t value
)
1025 ifxusb_hcd_1
.pkt_count_limit_bi
= value
;
1027 static void pkt_count_limit_bo_store_1(uint32_t value
)
1030 ifxusb_hcd_1
.pkt_count_limit_bo
= value
;
1032 static ssize_t
pkt_count_limit_bi_show_2(char *buf
)
1034 return sprintf( buf
, "%d\n",ifxusb_hcd_2
.pkt_count_limit_bi
);
1036 static ssize_t
pkt_count_limit_bo_show_2(char *buf
)
1038 return sprintf( buf
, "%d\n",ifxusb_hcd_2
.pkt_count_limit_bo
);
1040 static void pkt_count_limit_bi_store_2(uint32_t value
)
1043 ifxusb_hcd_2
.pkt_count_limit_bi
= value
;
1045 static void pkt_count_limit_bo_store_2(uint32_t value
)
1048 ifxusb_hcd_2
.pkt_count_limit_bo
= value
;
1050 static ssize_t
procfs_pkt_count_limit_bi_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1052 return pkt_count_limit_bi_show_1(buf
);
1054 static ssize_t
procfs_pkt_count_limit_bo_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1056 return pkt_count_limit_bo_show_1(buf
);
1058 static ssize_t
procfs_pkt_count_limit_bi_store_1(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
1063 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1065 value
= simple_strtoul(buf
, NULL
, 10);
1066 pkt_count_limit_bi_store_1(value
);
1069 static ssize_t
procfs_pkt_count_limit_bo_store_1(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
1074 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1076 value
= simple_strtoul(buf
, NULL
, 10);
1077 pkt_count_limit_bo_store_1(value
);
1080 static ssize_t
procfs_pkt_count_limit_bi_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1082 return pkt_count_limit_bi_show_2(buf
);
1084 static ssize_t
procfs_pkt_count_limit_bo_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1086 return pkt_count_limit_bo_show_2(buf
);
1088 static ssize_t
procfs_pkt_count_limit_bi_store_2(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
1093 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1095 value
= simple_strtoul(buf
, NULL
, 10);
1096 pkt_count_limit_bi_store_2(value
);
1099 static ssize_t
procfs_pkt_count_limit_bo_store_2(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
1104 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1106 value
= simple_strtoul(buf
, NULL
, 10);
1107 pkt_count_limit_bo_store_2(value
);
1111 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1112 static ssize_t
sysfs_pkt_count_limit_bi_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1114 static ssize_t
sysfs_pkt_count_limit_bi_show_1( struct device
*_dev
,char *buf
)
1117 return pkt_count_limit_bi_show_1(buf
);
1119 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1120 static ssize_t
sysfs_pkt_count_limit_bi_store_1( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
1122 static ssize_t
sysfs_pkt_count_limit_bi_store_1( struct device
*_dev
, const char *buffer
, size_t count
)
1128 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1130 value
= simple_strtoul(buf
, NULL
, 10);
1131 pkt_count_limit_bi_store_1(value
);
1134 DEVICE_ATTR(pkt_count_limit_bi_1
, S_IRUGO
|S_IWUSR
, sysfs_pkt_count_limit_bi_show_1
, sysfs_pkt_count_limit_bi_store_1
);
1136 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1137 static ssize_t
sysfs_pkt_count_limit_bo_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1139 static ssize_t
sysfs_pkt_count_limit_bo_show_1( struct device
*_dev
,char *buf
)
1142 return pkt_count_limit_bo_show_1(buf
);
1144 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1145 static ssize_t
sysfs_pkt_count_limit_bo_store_1( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
1147 static ssize_t
sysfs_pkt_count_limit_bo_store_1( struct device
*_dev
, const char *buffer
, size_t count
)
1153 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1155 value
= simple_strtoul(buf
, NULL
, 10);
1156 pkt_count_limit_bo_store_1(value
);
1159 DEVICE_ATTR(pkt_count_limit_bo_1
, S_IRUGO
|S_IWUSR
, sysfs_pkt_count_limit_bo_show_1
, sysfs_pkt_count_limit_bo_store_1
);
1161 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1162 static ssize_t
sysfs_pkt_count_limit_bi_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1164 static ssize_t
sysfs_pkt_count_limit_bi_show_2( struct device
*_dev
,char *buf
)
1167 return pkt_count_limit_bi_show_2(buf
);
1169 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1170 static ssize_t
sysfs_pkt_count_limit_bi_store_2( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
1172 static ssize_t
sysfs_pkt_count_limit_bi_2( struct device
*_dev
, const char *buffer
, size_t count
)
1178 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1180 value
= simple_strtoul(buf
, NULL
, 10);
1181 pkt_count_limit_bi_store_2(value
);
1184 DEVICE_ATTR(pkt_count_limit_bi_2
, S_IRUGO
|S_IWUSR
, sysfs_pkt_count_limit_bi_show_2
, sysfs_pkt_count_limit_bi_store_2
);
1186 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1187 static ssize_t
sysfs_pkt_count_limit_bo_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1189 static ssize_t
sysfs_pkt_count_limit_bo_show_2( struct device
*_dev
,char *buf
)
1192 return pkt_count_limit_bo_show_2(buf
);
1194 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1195 static ssize_t
sysfs_pkt_count_limit_bo_store_2( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
1197 static ssize_t
sysfs_pkt_count_limit_bo_store_2( struct device
*_dev
, const char *buffer
, size_t count
)
1203 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1205 value
= simple_strtoul(buf
, NULL
, 10);
1206 pkt_count_limit_bo_store_2(value
);
1209 DEVICE_ATTR(pkt_count_limit_bo_2
, S_IRUGO
|S_IWUSR
, sysfs_pkt_count_limit_bo_show_2
, sysfs_pkt_count_limit_bo_store_2
);
1211 static ssize_t
pkt_count_limit_bi_show(char *buf
)
1213 return sprintf( buf
, "%d\n",ifxusb_hcd
.pkt_count_limit_bi
);
1215 static ssize_t
pkt_count_limit_bo_show(char *buf
)
1217 return sprintf( buf
, "%d\n",ifxusb_hcd
.pkt_count_limit_bo
);
1219 static void pkt_count_limit_bi_store(uint32_t value
)
1222 ifxusb_hcd
.pkt_count_limit_bi
= value
;
1224 static void pkt_count_limit_bo_store(uint32_t value
)
1227 ifxusb_hcd
.pkt_count_limit_bo
= value
;
1229 static ssize_t
procfs_pkt_count_limit_bi_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1231 return pkt_count_limit_bi_show(buf
);
1233 static ssize_t
procfs_pkt_count_limit_bo_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1235 return pkt_count_limit_bo_show(buf
);
1237 static ssize_t
procfs_pkt_count_limit_bi_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
1242 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1244 value
= simple_strtoul(buf
, NULL
, 10);
1245 pkt_count_limit_bi_store(value
);
1248 static ssize_t
procfs_pkt_count_limit_bo_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
1253 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1255 value
= simple_strtoul(buf
, NULL
, 10);
1256 pkt_count_limit_bo_store(value
);
1260 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1261 static ssize_t
sysfs_pkt_count_limit_bi_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1263 static ssize_t
sysfs_pkt_count_limit_bi_show( struct device
*_dev
,char *buf
)
1266 return pkt_count_limit_bi_show(buf
);
1268 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1269 static ssize_t
sysfs_pkt_count_limit_bi_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
1271 static ssize_t
sysfs_pkt_count_limit_bi_store( struct device
*_dev
, const char *buffer
, size_t count
)
1277 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1279 value
= simple_strtoul(buf
, NULL
, 10);
1280 pkt_count_limit_bi_store(value
);
1283 DEVICE_ATTR(pkt_count_limit_bi
, S_IRUGO
|S_IWUSR
, sysfs_pkt_count_limit_bi_show
, sysfs_pkt_count_limit_bi_store
);
1285 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1286 static ssize_t
sysfs_pkt_count_limit_bo_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1288 static ssize_t
sysfs_pkt_count_limit_bo_show( struct device
*_dev
,char *buf
)
1291 return pkt_count_limit_bo_show(buf
);
1293 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1294 static ssize_t
sysfs_pkt_count_limit_bo_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
1296 static ssize_t
sysfs_pkt_count_limit_bo_store( struct device
*_dev
, const char *buffer
, size_t count
)
1302 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1304 value
= simple_strtoul(buf
, NULL
, 10);
1305 pkt_count_limit_bo_store(value
);
1308 DEVICE_ATTR(pkt_count_limit_bo
, S_IRUGO
|S_IWUSR
, sysfs_pkt_count_limit_bo_show
, sysfs_pkt_count_limit_bo_store
);
1311 /////////////////////////////////////////////////////////////////////////////////////////////////////
1312 /////////////////////////////////////////////////////////////////////////////////////////////////////
1313 /////////////////////////////////////////////////////////////////////////////////////////////////////
1316 static ssize_t
buspower_show_1(char *buf
)
1318 if(ifxusb_vbus (&ifxusb_hcd_1
.core_if
)==1) return sprintf( buf
, "1\n" );
1319 if(ifxusb_vbus (&ifxusb_hcd_1
.core_if
)==0) return sprintf( buf
, "0\n" );
1320 return sprintf( buf
, "UNKNOWN\n" );
1322 static void buspower_store_1(uint32_t value
)
1324 if (value
==1) ifxusb_vbus_on (&ifxusb_hcd_1
.core_if
);
1325 else if(value
==0) ifxusb_vbus_off(&ifxusb_hcd_1
.core_if
);
1327 static ssize_t
buspower_show_2(char *buf
)
1329 if(ifxusb_vbus (&ifxusb_hcd_2
.core_if
)==1) return sprintf( buf
, "1\n" );
1330 if(ifxusb_vbus (&ifxusb_hcd_2
.core_if
)==0) return sprintf( buf
, "0\n" );
1331 return sprintf( buf
, "UNKNOWN\n" );
1333 static void buspower_store_2(uint32_t value
)
1335 if (value
==1) ifxusb_vbus_on (&ifxusb_hcd_2
.core_if
);
1336 else if(value
==0) ifxusb_vbus_off(&ifxusb_hcd_2
.core_if
);
1338 static ssize_t
procfs_buspower_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1340 return buspower_show_1(buf
);
1342 static ssize_t
procfs_buspower_store_1(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
1347 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1349 value
= simple_strtoul(buf
, NULL
, 10);
1350 buspower_store_1(value
);
1353 static ssize_t
procfs_buspower_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1355 return buspower_show_2(buf
);
1357 static ssize_t
procfs_buspower_store_2(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
1362 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1364 value
= simple_strtoul(buf
, NULL
, 10);
1365 buspower_store_2(value
);
1369 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1370 static ssize_t
sysfs_buspower_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1372 static ssize_t
sysfs_buspower_show_1( struct device
*_dev
,char *buf
)
1375 return buspower_show_1(buf
);
1377 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1378 static ssize_t
sysfs_buspower_store_1( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
1380 static ssize_t
sysfs_buspower_store_1( struct device
*_dev
, const char *buffer
, size_t count
)
1386 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1388 value
= simple_strtoul(buf
, NULL
, 10);
1389 buspower_store_1(value
);
1392 DEVICE_ATTR(buspower_1
, S_IRUGO
|S_IWUSR
, sysfs_buspower_show_1
, sysfs_buspower_store_1
);
1394 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1395 static ssize_t
sysfs_buspower_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1397 static ssize_t
sysfs_buspower_show_2( struct device
*_dev
,char *buf
)
1400 return buspower_show_2(buf
);
1402 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1403 static ssize_t
sysfs_buspower_store_2( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
1405 static ssize_t
sysfs_buspower_store_2( struct device
*_dev
, const char *buffer
, size_t count
)
1411 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1413 value
= simple_strtoul(buf
, NULL
, 10);
1414 buspower_store_2(value
);
1417 DEVICE_ATTR(buspower_2
, S_IRUGO
|S_IWUSR
, sysfs_buspower_show_2
, sysfs_buspower_store_2
);
1419 static ssize_t
buspower_show(char *buf
)
1421 if(ifxusb_vbus (&ifxusb_hcd
.core_if
)==1) return sprintf( buf
, "1\n" );
1422 if(ifxusb_vbus (&ifxusb_hcd
.core_if
)==0) return sprintf( buf
, "0\n" );
1423 return sprintf( buf
, "UNKNOWN\n" );
1425 static void buspower_store(uint32_t value
)
1427 if (value
==1) ifxusb_vbus_on (&ifxusb_hcd
.core_if
);
1428 else if(value
==0) ifxusb_vbus_off(&ifxusb_hcd
.core_if
);
1430 static ssize_t
procfs_buspower_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1432 return buspower_show(buf
);
1434 static ssize_t
procfs_buspower_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
1439 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1441 value
= simple_strtoul(buf
, NULL
, 10);
1442 buspower_store(value
);
1445 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1446 static ssize_t
sysfs_buspower_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1448 static ssize_t
sysfs_buspower_show( struct device
*_dev
, char *buf
)
1451 return buspower_show(buf
);
1453 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1454 static ssize_t
sysfs_buspower_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
1456 static ssize_t
sysfs_buspower_store( struct device
*_dev
, const char *buffer
, size_t count
)
1462 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
1464 value
= simple_strtoul(buf
, NULL
, 10);
1465 buspower_store(value
);
1468 DEVICE_ATTR(buspower
, S_IRUGO
|S_IWUSR
, sysfs_buspower_show
, sysfs_buspower_store
);
1471 /////////////////////////////////////////////////////////////////////////////////////////////////////
1472 /////////////////////////////////////////////////////////////////////////////////////////////////////
1473 /////////////////////////////////////////////////////////////////////////////////////////////////////
1477 static ssize_t
bussuspend_show_1(char *buf
)
1480 val
.d32
= ifxusb_rreg(ifxusb_hcd_1
.core_if
.hprt0
);
1481 return sprintf (buf
, "Bus Suspend = 0x%x\n", val
.b
.prtsusp
);
1483 static ssize_t
bussuspend_show_2(char *buf
)
1486 val
.d32
= ifxusb_rreg(ifxusb_hcd_2
.core_if
.hprt0
);
1487 return sprintf (buf
, "Bus Suspend = 0x%x\n", val
.b
.prtsusp
);
1490 static ssize_t
procfs_bussuspend_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1492 return bussuspend_show_1(buf
);
1494 static ssize_t
procfs_bussuspend_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1496 return bussuspend_show_2(buf
);
1498 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1499 static ssize_t
sysfs_bussuspend_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1501 static ssize_t
sysfs_bussuspend_show_1( struct device
*_dev
,char *buf
)
1504 return bussuspend_show_1(buf
);
1506 DEVICE_ATTR(bussuspend_1
, S_IRUGO
|S_IWUSR
, sysfs_bussuspend_show_1
, 0);
1507 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1508 static ssize_t
sysfs_bussuspend_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1510 static ssize_t
sysfs_bussuspend_show_2( struct device
*_dev
,char *buf
)
1513 return bussuspend_show_2(buf
);
1515 DEVICE_ATTR(bussuspend_2
, S_IRUGO
|S_IWUSR
, sysfs_bussuspend_show_2
, 0);
1517 static ssize_t
bussuspend_show(char *buf
)
1520 val
.d32
= ifxusb_rreg(ifxusb_hcd
.core_if
.hprt0
);
1521 return sprintf (buf
, "Bus Suspend = 0x%x\n", val
.b
.prtsusp
);
1523 static ssize_t
procfs_bussuspend_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1525 return bussuspend_show(buf
);
1528 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1529 static ssize_t
sysfs_bussuspend_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1531 static ssize_t
sysfs_bussuspend_show( struct device
*_dev
, char *buf
)
1534 return bussuspend_show(buf
);
1536 DEVICE_ATTR(bussuspend
, S_IRUGO
|S_IWUSR
, sysfs_bussuspend_show
, 0);
1539 /////////////////////////////////////////////////////////////////////////////////////////////////////
1540 /////////////////////////////////////////////////////////////////////////////////////////////////////
1541 /////////////////////////////////////////////////////////////////////////////////////////////////////
1544 static ssize_t
busconnected_show_1(char *buf
)
1547 val
.d32
= ifxusb_rreg(ifxusb_hcd_1
.core_if
.hprt0
);
1548 return sprintf (buf
, "Bus Connected = 0x%x\n", val
.b
.prtconnsts
);
1550 static ssize_t
busconnected_show_2(char *buf
)
1553 val
.d32
= ifxusb_rreg(ifxusb_hcd_2
.core_if
.hprt0
);
1554 return sprintf (buf
, "Bus Connected = 0x%x\n", val
.b
.prtconnsts
);
1557 static ssize_t
procfs_busconnected_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1559 return busconnected_show_1(buf
);
1561 static ssize_t
procfs_busconnected_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1563 return busconnected_show_2(buf
);
1565 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1566 static ssize_t
sysfs_busconnected_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1568 static ssize_t
sysfs_busconnected_show_1( struct device
*_dev
,char *buf
)
1571 return busconnected_show_1(buf
);
1573 DEVICE_ATTR(busconnected_1
, S_IRUGO
|S_IWUSR
, sysfs_busconnected_show_1
, 0);
1574 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1575 static ssize_t
sysfs_busconnected_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1577 static ssize_t
sysfs_busconnected_show_2( struct device
*_dev
,char *buf
)
1580 return busconnected_show_2(buf
);
1582 DEVICE_ATTR(busconnected_2
, S_IRUGO
|S_IWUSR
, sysfs_busconnected_show_2
, 0);
1584 static ssize_t
busconnected_show(char *buf
)
1587 val
.d32
= ifxusb_rreg(ifxusb_hcd
.core_if
.hprt0
);
1588 return sprintf (buf
, "Bus Connected = 0x%x\n", val
.b
.prtconnsts
);
1590 static ssize_t
procfs_busconnected_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1592 return busconnected_show(buf
);
1595 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1596 static ssize_t
sysfs_busconnected_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1598 static ssize_t
sysfs_busconnected_show( struct device
*_dev
, char *buf
)
1601 return busconnected_show(buf
);
1603 DEVICE_ATTR(busconnected
, S_IRUGO
|S_IWUSR
, sysfs_busconnected_show
, 0);
1606 /////////////////////////////////////////////////////////////////////////////////////////////////////
1607 /////////////////////////////////////////////////////////////////////////////////////////////////////
1608 /////////////////////////////////////////////////////////////////////////////////////////////////////
1611 static ssize_t
connectspeed_show_1(char *buf
)
1614 val
.d32
= ifxusb_rreg(ifxusb_hcd_1
.core_if
.hprt0
);
1615 if( val
.b
.prtspd
==0) return sprintf (buf
, "Bus Speed = High (%d)\n", val
.b
.prtspd
);
1616 if( val
.b
.prtspd
==1) return sprintf (buf
, "Bus Speed = Full (%d)\n", val
.b
.prtspd
);
1617 if( val
.b
.prtspd
==2) return sprintf (buf
, "Bus Speed = Low (%d)\n", val
.b
.prtspd
);
1618 return sprintf (buf
, "Bus Speed = Unknown (%d)\n", val
.b
.prtspd
);
1620 static ssize_t
connectspeed_show_2(char *buf
)
1623 val
.d32
= ifxusb_rreg(ifxusb_hcd_2
.core_if
.hprt0
);
1624 if( val
.b
.prtspd
==0) return sprintf (buf
, "Bus Speed = High (%d)\n", val
.b
.prtspd
);
1625 if( val
.b
.prtspd
==1) return sprintf (buf
, "Bus Speed = Full (%d)\n", val
.b
.prtspd
);
1626 if( val
.b
.prtspd
==2) return sprintf (buf
, "Bus Speed = Low (%d)\n", val
.b
.prtspd
);
1627 return sprintf (buf
, "Bus Speed = Unknown (%d)\n", val
.b
.prtspd
);
1630 static ssize_t
procfs_connectspeed_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1632 return connectspeed_show_1(buf
);
1634 static ssize_t
procfs_connectspeed_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1636 return connectspeed_show_2(buf
);
1638 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1639 static ssize_t
sysfs_connectspeed_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1641 static ssize_t
sysfs_connectspeed_show_1( struct device
*_dev
,char *buf
)
1644 return connectspeed_show_1(buf
);
1646 DEVICE_ATTR(connectspeed_1
, S_IRUGO
|S_IWUSR
, sysfs_connectspeed_show_1
, 0);
1647 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1648 static ssize_t
sysfs_connectspeed_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1650 static ssize_t
sysfs_connectspeed_show_2( struct device
*_dev
,char *buf
)
1653 return connectspeed_show_2(buf
);
1655 DEVICE_ATTR(connectspeed_2
, S_IRUGO
|S_IWUSR
, sysfs_connectspeed_show_2
, 0);
1657 static ssize_t
connectspeed_show(char *buf
)
1660 val
.d32
= ifxusb_rreg(ifxusb_hcd
.core_if
.hprt0
);
1661 if( val
.b
.prtspd
==0) return sprintf (buf
, "Bus Speed = High (%d)\n", val
.b
.prtspd
);
1662 if( val
.b
.prtspd
==1) return sprintf (buf
, "Bus Speed = Full (%d)\n", val
.b
.prtspd
);
1663 if( val
.b
.prtspd
==2) return sprintf (buf
, "Bus Speed = Low (%d)\n", val
.b
.prtspd
);
1664 return sprintf (buf
, "Bus Speed = Unknown (%d)\n", val
.b
.prtspd
);
1667 static ssize_t
procfs_connectspeed_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1669 return connectspeed_show(buf
);
1672 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1673 static ssize_t
sysfs_connectspeed_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1675 static ssize_t
sysfs_connectspeed_show( struct device
*_dev
, char *buf
)
1678 return connectspeed_show(buf
);
1680 DEVICE_ATTR(connectspeed
, S_IRUGO
|S_IWUSR
, sysfs_connectspeed_show
, 0);
1682 /////////////////////////////////////////////////////////////////////////////////////////////////////
1683 /////////////////////////////////////////////////////////////////////////////////////////////////////
1684 /////////////////////////////////////////////////////////////////////////////////////////////////////
1688 #ifdef __IS_DEVICE__
1689 /////////////////////////////////////////////////////////////////////////////////////////////////////
1690 /////////////////////////////////////////////////////////////////////////////////////////////////////
1691 /////////////////////////////////////////////////////////////////////////////////////////////////////
1692 static ssize_t
devspeed_show(char *buf
)
1695 val
.d32
= ifxusb_rreg(&ifxusb_pcd
.core_if
.dev_global_regs
->dcfg
);
1696 if( val
.b
.devspd
==0) return sprintf (buf
, "Dev Speed = High (%d)\n", val
.b
.devspd
);
1697 if( val
.b
.devspd
==1) return sprintf (buf
, "Dev Speed = Full (%d)\n", val
.b
.devspd
);
1698 if( val
.b
.devspd
==3) return sprintf (buf
, "Dev Speed = Full (%d)\n", val
.b
.devspd
);
1699 return sprintf (buf
, "Dev Speed = Unknown (%d)\n", val
.b
.devspd
);
1702 static ssize_t
procfs_devspeed_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1704 return devspeed_show(buf
);
1707 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1708 static ssize_t
sysfs_devspeed_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1710 static ssize_t
sysfs_devspeed_show( struct device
*_dev
, char *buf
)
1713 return devspeed_show(buf
);
1715 DEVICE_ATTR(devspeed
, S_IRUGO
|S_IWUSR
, sysfs_devspeed_show
, 0);
1717 static ssize_t
enumspeed_show(char *buf
)
1720 val
.d32
= ifxusb_rreg(&ifxusb_pcd
.core_if
.dev_global_regs
->dsts
);
1721 if( val
.b
.enumspd
==0) return sprintf (buf
, "Enum Speed = High (%d)\n", val
.b
.enumspd
);
1722 if( val
.b
.enumspd
==1) return sprintf (buf
, "Enum Speed = Full (%d)\n", val
.b
.enumspd
);
1723 if( val
.b
.enumspd
==2) return sprintf (buf
, "Enum Speed = Low (%d)\n", val
.b
.enumspd
);
1724 return sprintf (buf
, "Enum Speed = invalid(%d)\n", val
.b
.enumspd
);
1727 static ssize_t
procfs_enumspeed_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1729 return enumspeed_show(buf
);
1732 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1733 static ssize_t
sysfs_enumspeed_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1735 static ssize_t
sysfs_enumspeed_show( struct device
*_dev
, char *buf
)
1738 return enumspeed_show(buf
);
1740 DEVICE_ATTR(enumspeed
, S_IRUGO
|S_IWUSR
, sysfs_enumspeed_show
, 0);
1741 /////////////////////////////////////////////////////////////////////////////////////////////////////
1742 /////////////////////////////////////////////////////////////////////////////////////////////////////
1743 /////////////////////////////////////////////////////////////////////////////////////////////////////
1747 //////////////////////////////////////////////////////////////////////////////////
1748 #ifdef __ENABLE_DUMP__
1751 static void dump_reg_1(void)
1753 ifxusb_dump_registers_h(&ifxusb_hcd_1
.core_if
);
1755 static void dump_reg_2(void)
1757 ifxusb_dump_registers_h(&ifxusb_hcd_2
.core_if
);
1760 static ssize_t
procfs_dump_reg_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1765 static ssize_t
procfs_dump_reg_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1770 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1771 static ssize_t
sysfs_dump_reg_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1773 static ssize_t
sysfs_dump_reg_show_1( struct device
*_dev
,char *buf
)
1779 DEVICE_ATTR(dump_reg_h_1
, S_IRUGO
|S_IWUSR
, sysfs_dump_reg_show_1
, 0);
1780 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1781 static ssize_t
sysfs_dump_reg_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1783 static ssize_t
sysfs_dump_reg_show_2( struct device
*_dev
,char *buf
)
1789 DEVICE_ATTR(dump_reg_h_2
, S_IRUGO
|S_IWUSR
, sysfs_dump_reg_show_2
, 0);
1791 static void dump_reg(void)
1794 ifxusb_dump_registers_h(&ifxusb_hcd
.core_if
);
1796 #ifdef __IS_DEVICE__
1797 ifxusb_dump_registers_d(&ifxusb_pcd
.core_if
);
1800 static ssize_t
procfs_dump_reg_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1805 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1806 static ssize_t
sysfs_dump_reg_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1808 static ssize_t
sysfs_dump_reg_show( struct device
*_dev
,char *buf
)
1815 DEVICE_ATTR(dump_reg_h
, S_IRUGO
|S_IWUSR
, sysfs_dump_reg_show
, 0);
1817 DEVICE_ATTR(dump_reg_d
, S_IRUGO
|S_IWUSR
, sysfs_dump_reg_show
, 0);
1822 /////////////////////////////////////////////////////////////////////////////////////////////////////
1823 /////////////////////////////////////////////////////////////////////////////////////////////////////
1824 /////////////////////////////////////////////////////////////////////////////////////////////////////
1827 static void dump_spram_1(void)
1829 ifxusb_dump_spram_h(&ifxusb_hcd_1
.core_if
);
1831 static void dump_spram_2(void)
1833 ifxusb_dump_spram_h(&ifxusb_hcd_2
.core_if
);
1836 static ssize_t
procfs_dump_spram_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1841 static ssize_t
procfs_dump_spram_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1846 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1847 static ssize_t
sysfs_dump_spram_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1849 static ssize_t
sysfs_dump_spram_show_1( struct device
*_dev
,char *buf
)
1855 DEVICE_ATTR(dump_spram_h_1
, S_IRUGO
|S_IWUSR
, sysfs_dump_spram_show_1
, 0);
1857 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1858 static ssize_t
sysfs_dump_spram_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1860 static ssize_t
sysfs_dump_spram_show_2( struct device
*_dev
,char *buf
)
1866 DEVICE_ATTR(dump_spram_h_2
, S_IRUGO
|S_IWUSR
, sysfs_dump_spram_show_2
, 0);
1868 static void dump_spram(void)
1871 ifxusb_dump_spram_h(&ifxusb_hcd
.core_if
);
1873 #ifdef __IS_DEVICE__
1874 ifxusb_dump_spram_d(&ifxusb_pcd
.core_if
);
1877 static ssize_t
procfs_dump_spram_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1882 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1883 static ssize_t
sysfs_dump_spram_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1885 static ssize_t
sysfs_dump_spram_show( struct device
*_dev
,char *buf
)
1892 DEVICE_ATTR(dump_spram_h
, S_IRUGO
|S_IWUSR
, sysfs_dump_spram_show
, 0);
1894 DEVICE_ATTR(dump_spram_d
, S_IRUGO
|S_IWUSR
, sysfs_dump_spram_show
, 0);
1898 /////////////////////////////////////////////////////////////////////////////////////////////////////
1899 /////////////////////////////////////////////////////////////////////////////////////////////////////
1900 /////////////////////////////////////////////////////////////////////////////////////////////////////
1904 static ssize_t
procfs_dump_host_state_show_1(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1906 ifxhcd_dump_state(&ifxusb_hcd_1
);
1909 static ssize_t
procfs_dump_host_state_show_2(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1911 ifxhcd_dump_state(&ifxusb_hcd_2
);
1914 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1915 static ssize_t
sysfs_dump_host_state_show_1( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1917 static ssize_t
sysfs_dump_host_state_show_1( struct device
*_dev
,char *buf
)
1920 ifxhcd_dump_state(&ifxusb_hcd_1
);
1923 DEVICE_ATTR(dump_host_state_1
, S_IRUGO
|S_IWUSR
, sysfs_dump_host_state_show_1
, 0);
1924 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1925 static ssize_t
sysfs_dump_host_state_show_2( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1927 static ssize_t
sysfs_dump_host_state_show_2( struct device
*_dev
,char *buf
)
1930 ifxhcd_dump_state(&ifxusb_hcd_2
);
1933 DEVICE_ATTR(dump_host_state_2
, S_IRUGO
|S_IWUSR
, sysfs_dump_host_state_show_2
, 0);
1935 static ssize_t
procfs_dump_host_state_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
1937 ifxhcd_dump_state(&ifxusb_hcd
);
1940 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1941 static ssize_t
sysfs_dump_host_state_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
1943 static ssize_t
sysfs_dump_host_state_show( struct device
*_dev
,char *buf
)
1946 ifxhcd_dump_state(&ifxusb_hcd
);
1949 DEVICE_ATTR(dump_host_state
, S_IRUGO
|S_IWUSR
, sysfs_dump_host_state_show
, 0);
1952 /////////////////////////////////////////////////////////////////////////////////////////////////////
1953 /////////////////////////////////////////////////////////////////////////////////////////////////////
1954 /////////////////////////////////////////////////////////////////////////////////////////////////////
1958 #endif //__ENABLE_DUMP__
1959 /////////////////////////////////////////////////////////////////////////////////////////////////////
1960 /////////////////////////////////////////////////////////////////////////////////////////////////////
1962 static void host_probe(unsigned long _ptr
)
1964 ifxhcd_hcd_t
*ifxhcd
= (ifxhcd_hcd_t
*)_ptr
;
1966 if(ifxhcd
->flags
.b
.port_connect_status
)
1968 del_timer(&ifxhcd
->host_probe_timer
);
1969 del_timer(&ifxhcd
->autoprobe_timer
);
1970 ifxhcd
->power_status
= 0;
1974 del_timer(&ifxhcd
->autoprobe_timer
);
1975 ifxhcd
->autoprobe_timer
.expires
= jiffies
+ (HZ
*ifxhcd
->autoprobe_sec
);
1976 add_timer(&ifxhcd
->autoprobe_timer
);
1977 ifxhcd
->power_status
= 2;
1978 del_timer(&ifxhcd
->host_probe_timer
);
1979 do_suspend_h(&ifxhcd
->core_if
);
1983 static void host_autoprobe(unsigned long _ptr
)
1985 ifxhcd_hcd_t
*ifxhcd
= (ifxhcd_hcd_t
*)_ptr
;
1986 del_timer(&ifxhcd
->host_probe_timer
);
1987 ifxhcd
->host_probe_timer
.function
= host_probe
;
1988 ifxhcd
->host_probe_timer
.expires
= jiffies
+ (HZ
*ifxhcd
->probe_sec
);
1989 ifxhcd
->host_probe_timer
.data
= (unsigned long)ifxhcd
;
1990 add_timer(&ifxhcd
->host_probe_timer
);
1991 do_resume_h(&ifxhcd
->core_if
);
1994 static void suspend_host_store(ifxhcd_hcd_t
*ifxhcd
, uint32_t value
)
1998 del_timer(&ifxhcd
->autoprobe_timer
);
1999 ifxhcd
->autoprobe_timer
.function
= host_autoprobe
;
2000 ifxhcd
->autoprobe_timer
.expires
= jiffies
+ (HZ
*ifxhcd
->autoprobe_sec
);
2001 ifxhcd
->autoprobe_timer
.data
= (unsigned long)ifxhcd
;
2002 add_timer(&ifxhcd
->autoprobe_timer
);
2003 ifxhcd
->power_status
= 2;
2007 do_suspend_h(&ifxhcd
->core_if
);
2008 ifxhcd
->power_status
= 1;
2009 del_timer(&ifxhcd
->host_probe_timer
);
2010 del_timer(&ifxhcd
->autoprobe_timer
);
2014 do_resume_h(&ifxhcd
->core_if
);
2015 ifxhcd
->power_status
= 0;
2016 del_timer(&ifxhcd
->host_probe_timer
);
2017 del_timer(&ifxhcd
->autoprobe_timer
);
2021 static ssize_t
procfs_suspend_host_2_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
2026 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2028 value
= simple_strtoul(buf
, NULL
, 10);
2029 suspend_host_store(&ifxusb_hcd_2
,value
);
2033 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2034 static ssize_t
sysfs_suspend_host_2_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
2036 static ssize_t
sysfs_suspend_host_2_store( struct device
*_dev
, const char *buffer
, size_t count
)
2042 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2044 value
= simple_strtoul(buf
, NULL
, 10);
2045 suspend_host_store(&ifxusb_hcd_2
,value
);
2049 static ssize_t
procfs_suspend_host_1_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
2054 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2056 value
= simple_strtoul(buf
, NULL
, 10);
2057 suspend_host_store(&ifxusb_hcd_1
,value
);
2061 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2062 static ssize_t
sysfs_suspend_host_1_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
2064 static ssize_t
sysfs_suspend_host_1_store( struct device
*_dev
, const char *buffer
, size_t count
)
2070 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2072 value
= simple_strtoul(buf
, NULL
, 10);
2073 suspend_host_store(&ifxusb_hcd_1
,value
);
2076 DEVICE_ATTR(suspend_host_2
, S_IWUSR
,NULL
, sysfs_suspend_host_2_store
);
2077 DEVICE_ATTR(suspend_host_1
, S_IWUSR
,NULL
, sysfs_suspend_host_1_store
);
2078 /////////////////////////////////////////////////////////////////////////////////////////////////////
2080 static ssize_t
procfs_suspend_host_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
2085 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2087 value
= simple_strtoul(buf
, NULL
, 10);
2088 suspend_host_store(&ifxusb_hcd
,value
);
2092 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2093 static ssize_t
sysfs_suspend_host_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
2095 static ssize_t
sysfs_suspend_host_store( struct device
*_dev
, const char *buffer
, size_t count
)
2101 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2103 value
= simple_strtoul(buf
, NULL
, 10);
2104 suspend_host_store(&ifxusb_hcd
,value
);
2107 DEVICE_ATTR(suspend_host
, S_IWUSR
,NULL
, sysfs_suspend_host_store
);
2111 /////////////////////////////////////////////////////////////////////////////////////////////////////
2112 /////////////////////////////////////////////////////////////////////////////////////////////////////
2114 static void probe_host_store(ifxhcd_hcd_t
*ifxhcd
, uint32_t value
)
2116 if(ifxhcd
->power_status
== 1)
2118 del_timer(&ifxhcd
->host_probe_timer
);
2119 ifxhcd
->host_probe_timer
.function
= host_probe
;
2120 ifxhcd
->host_probe_timer
.expires
= jiffies
+ (HZ
*ifxhcd
->probe_sec
);
2121 ifxhcd
->host_probe_timer
.data
= (unsigned long) ifxhcd
;
2122 add_timer(&ifxhcd
->host_probe_timer
);
2123 do_resume_h(&ifxhcd
->core_if
);
2127 static ssize_t
probe_host_2_show(char *buf
)
2129 if(ifxusb_hcd_2
.power_status
== 0)
2130 return sprintf (buf
,"Host 2 power status is ON\n");
2131 else if(ifxusb_hcd_2
.power_status
== 1)
2132 return sprintf (buf
,"Host 2 power status is Suspend\n");
2134 return sprintf (buf
,"Host 2 power status is Auto-probing\n");
2136 static ssize_t
probe_host_1_show(char *buf
)
2138 if(ifxusb_hcd_1
.power_status
== 0)
2139 return sprintf (buf
,"Host 1 power status is ON\n");
2140 else if(ifxusb_hcd_1
.power_status
== 1)
2141 return sprintf (buf
,"Host 1 power status is Suspend\n");
2143 return sprintf (buf
,"Host 1 power status is Auto-probing\n");
2145 static ssize_t
procfs_probe_host_2_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
2150 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2152 value
= simple_strtoul(buf
, NULL
, 10);
2153 probe_host_store(&ifxusb_hcd_2
,value
);
2156 static ssize_t
procfs_probe_host_2_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
2158 return probe_host_2_show(buf
);
2160 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2161 static ssize_t
sysfs_probe_host_2_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
2163 static ssize_t
sysfs_probe_host_2_show( struct device
*_dev
, char *buf
)
2166 return probe_host_2_show(buf
);
2168 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2169 static ssize_t
sysfs_probe_host_2_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
2171 static ssize_t
sysfs_probe_host_2_store( struct device
*_dev
, const char *buffer
, size_t count
)
2177 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2179 value
= simple_strtoul(buf
, NULL
, 10);
2180 probe_host_store(&ifxusb_hcd_2
,value
);
2184 static ssize_t
procfs_probe_host_1_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
2189 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2191 value
= simple_strtoul(buf
, NULL
, 10);
2192 probe_host_store(&ifxusb_hcd_1
,value
);
2195 static ssize_t
procfs_probe_host_1_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
2197 return probe_host_1_show(buf
);
2199 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2200 static ssize_t
sysfs_probe_host_1_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
2202 static ssize_t
sysfs_probe_host_1_show( struct device
*_dev
, char *buf
)
2205 return probe_host_1_show(buf
);
2207 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2208 static ssize_t
sysfs_probe_host_1_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
2210 static ssize_t
sysfs_probe_host_1_store( struct device
*_dev
, const char *buffer
, size_t count
)
2216 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2218 value
= simple_strtoul(buf
, NULL
, 10);
2219 probe_host_store(&ifxusb_hcd_1
,value
);
2222 DEVICE_ATTR(probe_host_2
, S_IRUGO
|S_IWUSR
, sysfs_probe_host_2_show
, sysfs_probe_host_2_store
);
2223 DEVICE_ATTR(probe_host_1
, S_IRUGO
|S_IWUSR
, sysfs_probe_host_1_show
, sysfs_probe_host_1_store
);
2224 /////////////////////////////////////////////////////////////////////////////////////////////////////
2226 static ssize_t
probe_host_show(char *buf
)
2228 if(ifxusb_hcd
.power_status
== 0)
2229 return sprintf (buf
,"Host power status is ON\n");
2230 else if(ifxusb_hcd
.power_status
== 1)
2231 return sprintf (buf
,"Host power status is Suspend\n");
2233 return sprintf (buf
,"Host power status is Auto-probing\n");
2235 static ssize_t
procfs_probe_host_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
2240 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2242 value
= simple_strtoul(buf
, NULL
, 10);
2243 probe_host_store(&ifxusb_hcd
,value
);
2246 static ssize_t
procfs_probe_host_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
2248 return probe_host_show(buf
);
2250 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2251 static ssize_t
sysfs_probe_host_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
2253 static ssize_t
sysfs_probe_host_show( struct device
*_dev
, char *buf
)
2256 return probe_host_show(buf
);
2258 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2259 static ssize_t
sysfs_probe_host_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
2261 static ssize_t
sysfs_probe_host_store( struct device
*_dev
, const char *buffer
, size_t count
)
2267 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2269 value
= simple_strtoul(buf
, NULL
, 10);
2270 probe_host_store(&ifxusb_hcd
,value
);
2273 DEVICE_ATTR(probe_host
, S_IRUGO
|S_IWUSR
, sysfs_probe_host_show
, sysfs_probe_host_store
);
2276 /////////////////////////////////////////////////////////////////////////////////////////////////////
2277 /////////////////////////////////////////////////////////////////////////////////////////////////////
2278 #ifdef __IS_DEVICE__
2279 static void device_probe(unsigned long _ptr
)
2281 if(ifxusb_pcd
.power_status
== 2)
2283 del_timer(&ifxusb_pcd
.device_autoprobe_timer
);
2284 ifxusb_pcd
.device_autoprobe_timer
.expires
= jiffies
+ (HZ
*ifxusb_pcd
.autoprobe_sec
);
2285 add_timer(&ifxusb_pcd
.device_autoprobe_timer
);
2286 ifxusb_pcd
.power_status
= 2;
2287 do_suspend_d(&ifxusb_pcd
.core_if
);
2289 else if(ifxusb_pcd
.power_status
== 1)
2291 do_suspend_d(&ifxusb_pcd
.core_if
);
2292 ifxusb_pcd
.power_status
= 1;
2295 static void device_autoprobe(unsigned long _ptr
)
2297 init_timer(&ifxusb_pcd
.device_probe_timer
);
2298 ifxusb_pcd
.device_probe_timer
.function
= device_probe
;
2299 ifxusb_pcd
.device_probe_timer
.expires
= jiffies
+ (HZ
*ifxusb_pcd
.probe_sec
);
2300 add_timer(&ifxusb_pcd
.device_probe_timer
);
2301 do_resume_d(&ifxusb_pcd
.core_if
);
2303 static void suspend_device_store(uint32_t value
)
2307 del_timer(&ifxusb_pcd
.device_autoprobe_timer
);
2308 ifxusb_pcd
.device_autoprobe_timer
.function
= device_autoprobe
;
2309 ifxusb_pcd
.device_autoprobe_timer
.expires
= jiffies
+ (HZ
*ifxusb_pcd
.autoprobe_sec
);
2310 add_timer(&ifxusb_pcd
.device_autoprobe_timer
);
2311 ifxusb_pcd
.power_status
= 2;
2315 do_suspend_d(&ifxusb_pcd
.core_if
);
2316 ifxusb_pcd
.power_status
= 1;
2317 del_timer(&ifxusb_pcd
.device_autoprobe_timer
);
2318 del_timer(&ifxusb_pcd
.device_probe_timer
);
2322 do_resume_d(&ifxusb_pcd
.core_if
);
2323 ifxusb_pcd
.power_status
= 0;
2324 del_timer(&ifxusb_pcd
.device_autoprobe_timer
);
2325 del_timer(&ifxusb_pcd
.device_probe_timer
);
2328 static ssize_t
procfs_suspend_device_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
2333 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2335 value
= simple_strtoul(buf
, NULL
, 10);
2336 suspend_device_store(value
);
2339 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2340 static ssize_t
sysfs_suspend_device_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
2342 static ssize_t
sysfs_suspend_device_store( struct device
*_dev
, const char *buffer
, size_t count
)
2348 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2350 value
= simple_strtoul(buf
, NULL
, 10);
2351 suspend_device_store(value
);
2354 DEVICE_ATTR(suspend_device
, S_IWUSR
,NULL
,sysfs_suspend_device_store
);
2356 /////////////////////////////////////////////////////////////////////////////////////////////////////
2357 #ifdef __IS_DEVICE__
2358 static ssize_t
probe_device_show(char *buf
)
2360 if(ifxusb_pcd
.power_status
== 0)
2361 return sprintf (buf
,"Device power status is ON\n");
2362 else if(ifxusb_pcd
.power_status
== 1)
2363 return sprintf (buf
,"Device power status is Suspend\n");
2365 return printk(buf
,"Device power status is Auto-probing\n");
2367 static void probe_device_store(uint32_t value
)
2370 if(ifxusb_pcd
.power_status
== 1)
2372 del_timer(&ifxusb_pcd
.device_probe_timer
);
2373 ifxusb_pcd
.device_probe_timer
.function
= device_probe
;
2374 ifxusb_pcd
.device_probe_timer
.expires
= jiffies
+ (HZ
*ifxusb_pcd
.probe_sec
);
2375 add_timer(&ifxusb_pcd
.device_probe_timer
);
2376 do_resume_d(&ifxusb_pcd
.core_if
);
2379 static ssize_t
procfs_probe_device_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
2384 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2386 value
= simple_strtoul(buf
, NULL
, 10);
2387 probe_device_store(value
);
2390 static ssize_t
procfs_probe_device_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
2392 return probe_device_show(buf
);
2394 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2395 static ssize_t
sysfs_probe_device_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
2397 static ssize_t
sysfs_probe_device_show( struct device
*_dev
, char *buf
)
2400 return probe_device_show(buf
);
2402 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2403 static ssize_t
sysfs_probe_device_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
2405 static ssize_t
sysfs_probe_device_store( struct device
*_dev
, const char *buffer
, size_t count
)
2411 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2413 value
= simple_strtoul(buf
, NULL
, 10);
2414 probe_device_store(value
);
2417 DEVICE_ATTR(probe_device
, S_IRUGO
|S_IWUSR
, sysfs_probe_device_show
, sysfs_probe_device_store
);
2419 /////////////////////////////////////////////////////////////////////////////////////////////////////
2420 /////////////////////////////////////////////////////////////////////////////////////////////////////
2423 static ssize_t
autoprobe_timer2_val_show(char *buf
)
2425 return sprintf (buf
,"Host 2 auto-probe timer is %d second\n",ifxusb_hcd_2
.autoprobe_sec
);
2427 static ssize_t
procfs_autoprobe_timer2_val_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
2432 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2434 value
= simple_strtoul(buf
, NULL
, 10);
2435 if((value
> 0)&&(value
< 300))
2436 ifxusb_hcd_2
.autoprobe_sec
= value
;
2439 static ssize_t
procfs_autoprobe_timer2_val_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
2441 return autoprobe_timer2_val_show(buf
);
2443 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2444 static ssize_t
sysfs_autoprobe_timer2_val_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
2446 static ssize_t
sysfs_autoprobe_timer2_val_show( struct device
*_dev
, char *buf
)
2449 return autoprobe_timer2_val_show(buf
);
2451 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2452 static ssize_t
sysfs_autoprobe_timer2_val_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
2454 static ssize_t
sysfs_autoprobe_timer2_val_store( struct device
*_dev
, const char *buffer
, size_t count
)
2460 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2462 value
= simple_strtoul(buf
, NULL
, 10);
2463 if((value
> 0)&&(value
< 300))
2464 ifxusb_hcd_2
.autoprobe_sec
= value
;
2468 static ssize_t
autoprobe_timer1_val_show(char *buf
)
2470 return sprintf (buf
,"Host 1 auto-probe timer is %d second\n",ifxusb_hcd_1
.autoprobe_sec
);
2472 static ssize_t
procfs_autoprobe_timer1_val_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
2477 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2479 value
= simple_strtoul(buf
, NULL
, 10);
2480 if((value
> 0)&&(value
< 300))
2481 ifxusb_hcd_1
.autoprobe_sec
= value
;
2484 static ssize_t
procfs_autoprobe_timer1_val_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
, void *data
)
2486 return autoprobe_timer1_val_show(buf
);
2488 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2489 static ssize_t
sysfs_autoprobe_timer1_val_show( struct device
*_dev
, struct device_attribute
*attr
,char *buf
)
2491 static ssize_t
sysfs_autoprobe_timer1_val_show( struct device
*_dev
, char *buf
)
2494 return autoprobe_timer1_val_show(buf
);
2496 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2497 static ssize_t
sysfs_autoprobe_timer1_val_store( struct device
*_dev
, struct device_attribute
*attr
,const char *buffer
, size_t count
)
2499 static ssize_t
sysfs_autoautoprobe_timer1_val_store( struct device
*_dev
, const char *buffer
, size_t count
)
2505 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2507 value
= simple_strtoul(buf
, NULL
, 10);
2508 if((value
> 0)&&(value
< 300))
2509 ifxusb_hcd_1
.autoprobe_sec
= value
;
2513 static ssize_t
probe_timer2_val_show(char *buf
)
2515 return sprintf (buf
,"Host 2 probe timer is %d second\n",ifxusb_hcd_2
.probe_sec
);
2517 static ssize_t
procfs_probe_timer2_val_store(struct file
*file
, const char *buffer
, unsigned long count
, void *data
)
2522 if (copy_from_user(buf
, &buffer
[i
], sizeof("0xFFFFFFFF\n")+1))
2524 value
= simple_strtoul(buf
, NULL
, 10);
2525 if((value
> 0)&&(value
< 10))
2526 ifxusb_hcd_2
.probe_sec
= value
;
2529 static ssize_t
procfs_probe_timer2_val_show(char *buf
, char **start
, off_t offset
, int count
, int *eof
,