Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
reform-boundary-uboot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jack Humbert
reform-boundary-uboot
Commits
ae3b770e
Commit
ae3b770e
authored
18 years ago
by
Markus Klotzbuecher
Committed by
Markus Klotzbuecher
18 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix some endianness issues related to the generic ohci driver
parent
7b59b3c7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
drivers/usb_ohci.c
+49
-11
49 additions, 11 deletions
drivers/usb_ohci.c
include/configs/IceCube.h
+8
-1
8 additions, 1 deletion
include/configs/IceCube.h
include/usb.h
+9
-6
9 additions, 6 deletions
include/usb.h
with
66 additions
and
18 deletions
drivers/usb_ohci.c
+
49
−
11
View file @
ae3b770e
...
...
@@ -62,15 +62,20 @@
#include
<usb.h>
#include
"usb_ohci.h"
#
un
def S3C24X0_merge
#def
ine
S3C24X0_merge
#if defined(CONFIG_ARM920T) || \
defined(CONFIG_S3C2400) || \
defined(CONFIG_S3C2410)
defined(CONFIG_S3C2410) || \
defined(CONFIG_440EP) || \
defined(CONFIG_MPC5200)
# define OHCI_USE_NPS
/* force NoPowerSwitching mode */
#endif
#undef OHCI_VERBOSE_DEBUG
/* not always helpful */
#undef DEBUG
#undef SHOW_INFO
#undef OHCI_FILL_TRACE
/* For initializing controller (mask in an HCFS mode too) */
#define OHCI_CONTROL_INIT \
...
...
@@ -95,8 +100,13 @@
#define info(format, arg...) do {} while(0)
#endif
#define m16_swap(x) swap_16(x)
#define m32_swap(x) swap_32(x)
#if defined(CONFIG_440EP) || defined(CONFIG_MPC5200)
# define m16_swap(x) (x)
# define m32_swap(x) (x)
#else
# define m16_swap(x) swap_16(x)
# define m32_swap(x) swap_32(x)
#endif
/* global ohci_t */
static
ohci_t
gohci
;
...
...
@@ -523,7 +533,7 @@ static int ep_link (ohci_t *ohci, ed_t *edi)
if
(
ohci
->
ed_controltail
==
NULL
)
{
writel
(
ed
,
&
ohci
->
regs
->
ed_controlhead
);
}
else
{
ohci
->
ed_controltail
->
hwNextED
=
m32_swap
(
ed
);
ohci
->
ed_controltail
->
hwNextED
=
m32_swap
(
(
unsigned
long
)
ed
);
}
ed
->
ed_prev
=
ohci
->
ed_controltail
;
if
(
!
ohci
->
ed_controltail
&&
!
ohci
->
ed_rm_list
[
0
]
&&
...
...
@@ -539,7 +549,7 @@ static int ep_link (ohci_t *ohci, ed_t *edi)
if
(
ohci
->
ed_bulktail
==
NULL
)
{
writel
(
ed
,
&
ohci
->
regs
->
ed_bulkhead
);
}
else
{
ohci
->
ed_bulktail
->
hwNextED
=
m32_swap
(
ed
);
ohci
->
ed_bulktail
->
hwNextED
=
m32_swap
(
(
unsigned
long
)
ed
);
}
ed
->
ed_prev
=
ohci
->
ed_bulktail
;
if
(
!
ohci
->
ed_bulktail
&&
!
ohci
->
ed_rm_list
[
0
]
&&
...
...
@@ -635,7 +645,7 @@ static ed_t * ep_add_ed (struct usb_device *usb_dev, unsigned long pipe)
ed
->
hwINFO
=
m32_swap
(
OHCI_ED_SKIP
);
/* skip ed */
/* dummy td; end of td list for ed */
td
=
td_alloc
(
usb_dev
);
ed
->
hwTailP
=
m32_swap
(
td
);
ed
->
hwTailP
=
m32_swap
(
(
unsigned
long
)
td
);
ed
->
hwHeadP
=
ed
->
hwTailP
;
ed
->
state
=
ED_UNLINK
;
ed
->
type
=
usb_pipetype
(
pipe
);
...
...
@@ -693,12 +703,12 @@ static void td_fill (ohci_t *ohci, unsigned int info,
data
=
0
;
td
->
hwINFO
=
m32_swap
(
info
);
td
->
hwCBP
=
m32_swap
(
data
);
td
->
hwCBP
=
m32_swap
(
(
unsigned
long
)
data
);
if
(
data
)
td
->
hwBE
=
m32_swap
(
data
+
len
-
1
);
td
->
hwBE
=
m32_swap
((
unsigned
long
)
(
data
+
len
-
1
)
)
;
else
td
->
hwBE
=
0
;
td
->
hwNextTD
=
m32_swap
(
td_pt
);
td
->
hwNextTD
=
m32_swap
(
(
unsigned
long
)
td_pt
);
#ifndef S3C24X0_merge
td
->
hwPSW
[
0
]
=
m16_swap
(((
__u32
)
data
&
0x0FFF
)
|
0xE000
);
#endif
...
...
@@ -875,7 +885,12 @@ static int dl_done_list (ohci_t *ohci, td_t *td_list)
/* see if this done list makes for all TD's of current URB,
* and mark the URB finished if so */
if
(
++
(
lurb_priv
->
td_cnt
)
==
lurb_priv
->
length
)
{
#if 1
if
((
ed
->
state
&
(
ED_OPER
|
ED_UNLINK
))
&&
(
lurb_priv
->
state
!=
URB_DEL
))
#else
if
((
ed
->
state
&
(
ED_OPER
|
ED_UNLINK
)))
#endif
urb_finished
=
1
;
else
dbg
(
"dl_done_list: strange.., ED state %x, ed->state
\n
"
);
...
...
@@ -1068,9 +1083,15 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
}
bmRType_bReq
=
cmd
->
requesttype
|
(
cmd
->
request
<<
8
);
#if defined(CONFIG_440EP) || defined(CONFIG_MPC5200)
wValue
=
__swap_16
(
cmd
->
value
);
wIndex
=
__swap_16
(
cmd
->
index
);
wLength
=
__swap_16
(
cmd
->
length
);
#else
wValue
=
m16_swap
(
cmd
->
value
);
wIndex
=
m16_swap
(
cmd
->
index
);
wLength
=
m16_swap
(
cmd
->
length
);
#endif
/* CONFIG_440EP || CONFIG_MPC5200 */
info
(
"Root-Hub: adr: %2x cmd(%1x): %08x %04x %04x %04x"
,
dev
->
devnum
,
8
,
bmRType_bReq
,
wValue
,
wIndex
,
wLength
);
...
...
@@ -1084,6 +1105,20 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
RH_OTHER | RH_CLASS almost ever means HUB_PORT here
*/
#if defined(CONFIG_440EP) || defined(CONFIG_MPC5200)
case
RH_GET_STATUS
:
*
(
__u16
*
)
data_buf
=
__swap_16
(
1
);
OK
(
2
);
case
RH_GET_STATUS
|
RH_INTERFACE
:
*
(
__u16
*
)
data_buf
=
__swap_16
(
0
);
OK
(
2
);
case
RH_GET_STATUS
|
RH_ENDPOINT
:
*
(
__u16
*
)
data_buf
=
__swap_16
(
0
);
OK
(
2
);
case
RH_GET_STATUS
|
RH_CLASS
:
*
(
__u32
*
)
data_buf
=
__swap_32
(
RD_RH_STAT
&
~
(
RH_HS_CRWE
|
RH_HS_DRWE
));
OK
(
4
);
case
RH_GET_STATUS
|
RH_OTHER
|
RH_CLASS
:
*
(
__u32
*
)
data_buf
=
__swap_32
(
RD_RH_PORTSTAT
);
OK
(
4
);
#else
case
RH_GET_STATUS
:
*
(
__u16
*
)
data_buf
=
m16_swap
(
1
);
OK
(
2
);
case
RH_GET_STATUS
|
RH_INTERFACE
:
...
...
@@ -1096,6 +1131,7 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
OK
(
4
);
case
RH_GET_STATUS
|
RH_OTHER
|
RH_CLASS
:
*
(
__u32
*
)
data_buf
=
m32_swap
(
RD_RH_PORTSTAT
);
OK
(
4
);
#endif
/* CONFIG_440EP || CONFIG_MPC5200 */
case
RH_CLEAR_FEATURE
|
RH_ENDPOINT
:
switch
(
wValue
)
{
...
...
@@ -1294,8 +1330,10 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
return
-
1
;
}
#if 0
wait_ms(10);
/* ohci_dump_status(&gohci); */
#endif
/* allow more time for a BULK device to react - some are slow */
#define BULK_TO 5000
/* timeout in milliseconds */
...
...
@@ -1337,6 +1375,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
err
(
"CTL:TIMEOUT "
);
#ifdef S3C24X0_merge
dbg
(
"submit_common_msg: TO status %x
\n
"
,
stat
);
stat
=
USB_ST_CRC_ERR
;
urb_finished
=
1
;
#endif
stat
=
USB_ST_CRC_ERR
;
...
...
@@ -1755,5 +1794,4 @@ int usb_lowlevel_stop(void)
return
0
;
}
#endif
/* CONFIG_USB_OHCI_NEW */
This diff is collapsed.
Click to expand it.
include/configs/IceCube.h
+
8
−
1
View file @
ae3b770e
...
...
@@ -94,9 +94,16 @@
/* USB */
#if 1
#define CONFIG_USB_OHCI
#define CONFIG_USB_OHCI
_NEW
#define ADD_USB_CMD CFG_CMD_USB | CFG_CMD_FAT
#define CONFIG_USB_STORAGE
#undef CFG_USB_OHCI_BOARD_INIT
#define CFG_USB_OHCI_CPU_INIT
#define CFG_USB_OHCI_REGS_BASE MPC5XXX_USB
#define CFG_USB_OHCI_SLOT_NAME "mpc5200"
#define CFG_USB_OHCI_MAX_ROOT_PORTS 15
#else
#define ADD_USB_CMD 0
#endif
...
...
This diff is collapsed.
Click to expand it.
include/usb.h
+
9
−
6
View file @
ae3b770e
...
...
@@ -230,16 +230,12 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);
/* big endian -> little endian conversion */
/* some CPUs are already little endian e.g. the ARM920T */
#ifdef LITTLEENDIAN
#define swap_16(x) ((unsigned short)(x))
#define swap_32(x) ((unsigned long)(x))
#else
#define swap_16(x) \
#define __swap_16(x) \
({ unsigned short x_ = (unsigned short)x; \
(unsigned short)( \
((x_ & 0x00FFU) << 8) | ((x_ & 0xFF00U) >> 8) ); \
})
#define swap_32(x) \
#define
__
swap_32(x) \
({ unsigned long x_ = (unsigned long)x; \
(unsigned long)( \
((x_ & 0x000000FFUL) << 24) | \
...
...
@@ -247,6 +243,13 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);
((x_ & 0x00FF0000UL) >> 8) | \
((x_ & 0xFF000000UL) >> 24) ); \
})
#ifdef LITTLEENDIAN
# define swap_16(x) (x)
# define swap_32(x) (x)
#else
# define swap_16(x) __swap_16(x)
# define swap_32(x) __swap_32(x)
#endif
/* LITTLEENDIAN */
/*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment