Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
TI ARM U-Boot Custodian Tree
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
U-Boot
Custodians
TI ARM U-Boot Custodian Tree
Commits
ad17b970
Commit
ad17b970
authored
6 years ago
by
Tom Rini
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
git://git.denx.de/u-boot-usb
parents
589cf349
5c349e17
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drivers/usb/host/ehci-generic.c
+61
-1
61 additions, 1 deletion
drivers/usb/host/ehci-generic.c
with
61 additions
and
1 deletion
drivers/usb/host/ehci-generic.c
+
61
−
1
View file @
ad17b970
...
...
@@ -11,6 +11,7 @@
#include
<asm/io.h>
#include
<dm.h>
#include
"ehci.h"
#include
<power/regulator.h>
/*
* Even though here we don't explicitly use "struct ehci_ctrl"
...
...
@@ -22,10 +23,56 @@ struct generic_ehci {
struct
clk
*
clocks
;
struct
reset_ctl
*
resets
;
struct
phy
phy
;
#ifdef CONFIG_DM_REGULATOR
struct
udevice
*
vbus_supply
;
#endif
int
clock_count
;
int
reset_count
;
};
#ifdef CONFIG_DM_REGULATOR
static
int
ehci_enable_vbus_supply
(
struct
udevice
*
dev
)
{
struct
generic_ehci
*
priv
=
dev_get_priv
(
dev
);
int
ret
;
ret
=
device_get_supply_regulator
(
dev
,
"vbus-supply"
,
&
priv
->
vbus_supply
);
if
(
ret
&&
ret
!=
-
ENOENT
)
return
ret
;
if
(
priv
->
vbus_supply
)
{
ret
=
regulator_set_enable
(
priv
->
vbus_supply
,
true
);
if
(
ret
)
{
dev_err
(
dev
,
"Error enabling VBUS supply
\n
"
);
return
ret
;
}
}
else
{
dev_dbg
(
dev
,
"No vbus supply
\n
"
);
}
return
0
;
}
static
int
ehci_disable_vbus_supply
(
struct
generic_ehci
*
priv
)
{
if
(
priv
->
vbus_supply
)
return
regulator_set_enable
(
priv
->
vbus_supply
,
false
);
else
return
0
;
}
#else
static
int
ehci_enable_vbus_supply
(
struct
udevice
*
dev
)
{
return
0
;
}
static
int
ehci_disable_vbus_supply
(
struct
generic_ehci
*
priv
)
{
return
0
;
}
#endif
static
int
ehci_usb_probe
(
struct
udevice
*
dev
)
{
struct
generic_ehci
*
priv
=
dev_get_priv
(
dev
);
...
...
@@ -95,10 +142,14 @@ static int ehci_usb_probe(struct udevice *dev)
}
}
err
=
ehci_
setup_phy
(
dev
,
&
priv
->
phy
,
0
);
err
=
ehci_
enable_vbus_supply
(
dev
);
if
(
err
)
goto
reset_err
;
err
=
ehci_setup_phy
(
dev
,
&
priv
->
phy
,
0
);
if
(
err
)
goto
regulator_err
;
hccr
=
map_physmem
(
dev_read_addr
(
dev
),
0x100
,
MAP_NOCACHE
);
hcor
=
(
struct
ehci_hcor
*
)((
uintptr_t
)
hccr
+
HC_LENGTH
(
ehci_readl
(
&
hccr
->
cr_capbase
)));
...
...
@@ -114,6 +165,11 @@ phy_err:
if
(
ret
)
dev_err
(
dev
,
"failed to shutdown usb phy
\n
"
);
regulator_err:
ret
=
ehci_disable_vbus_supply
(
priv
);
if
(
ret
)
dev_err
(
dev
,
"failed to disable VBUS supply
\n
"
);
reset_err:
ret
=
reset_release_all
(
priv
->
resets
,
priv
->
reset_count
);
if
(
ret
)
...
...
@@ -139,6 +195,10 @@ static int ehci_usb_remove(struct udevice *dev)
if
(
ret
)
return
ret
;
ret
=
ehci_disable_vbus_supply
(
priv
);
if
(
ret
)
return
ret
;
ret
=
reset_release_all
(
priv
->
resets
,
priv
->
reset_count
);
if
(
ret
)
return
ret
;
...
...
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