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
Reform
reform-boundary-uboot
Commits
e98f39be
Commit
e98f39be
authored
6 years ago
by
Troy Kisky
Browse files
Options
Downloads
Patches
Plain Diff
xhci-imx8m: add CONFIG_DM_USB support
Signed-off-by:
Troy Kisky
<
troy.kisky@boundarydevices.com
>
parent
01e1bed7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drivers/usb/host/xhci-imx8m.c
+108
-0
108 additions, 0 deletions
drivers/usb/host/xhci-imx8m.c
with
108 additions
and
0 deletions
drivers/usb/host/xhci-imx8m.c
+
108
−
0
View file @
e98f39be
...
...
@@ -9,12 +9,15 @@
*/
#include
<common.h>
#include
<asm-generic/gpio.h>
#include
<clk.h>
#include
<usb.h>
#include
<linux/errno.h>
#include
<linux/compat.h>
#include
<linux/usb/dwc3.h>
#include
<asm/arch/sys_proto.h>
#include
"xhci.h"
#include
<dm.h>
/* Declare global data pointer */
DECLARE_GLOBAL_DATA_PTR
;
...
...
@@ -47,10 +50,22 @@ struct imx8m_usbctrl_data {
u32
usb_id
;
unsigned
long
ctr_addr
;
};
#ifdef CONFIG_DM_USB
struct
xhci_imx8m_priv
{
struct
xhci_ctrl
xhci
;
struct
clk_bulk
clks
;
#ifdef CONFIG_DM_GPIO
struct
gpio_desc
reset_gpio
;
#endif
};
#else
static
struct
imx8m_usbctrl_data
ctr_data
[]
=
{
{
0
,
USB1_BASE_ADDR
},
{
1
,
USB2_BASE_ADDR
},
};
#endif
static
void
imx8m_usb_phy_init
(
struct
imx8m_usbmix
*
usbmix_reg
)
{
...
...
@@ -135,6 +150,98 @@ int imx8m_usb_common_init(void *base, struct xhci_hccr **hccr, struct xhci_hcor
return
ret
;
}
#ifdef CONFIG_DM_USB
static
int
imx8_of_clk_init
(
struct
udevice
*
dev
,
struct
xhci_imx8m_priv
*
priv
)
{
int
ret
;
ret
=
clk_get_bulk
(
dev
,
&
priv
->
clks
);
if
(
ret
==
-
ENOSYS
)
return
0
;
if
(
ret
)
return
ret
;
#if CONFIG_IS_ENABLED(CLK)
ret
=
clk_enable_bulk
(
&
priv
->
clks
);
if
(
ret
)
{
clk_release_bulk
(
&
priv
->
clks
);
return
ret
;
}
#endif
return
0
;
}
#ifdef CONFIG_DM_GPIO
static
void
imx8_of_reset_gpio_init
(
struct
udevice
*
dev
,
struct
xhci_imx8m_priv
*
priv
)
{
gpio_request_by_name
(
dev
,
"reset-gpios"
,
0
,
&
priv
->
reset_gpio
,
GPIOD_IS_OUT
|
GPIOD_IS_OUT_ACTIVE
);
if
(
dm_gpio_is_valid
(
&
priv
->
reset_gpio
))
{
udelay
(
500
);
/* release reset */
dm_gpio_set_value
(
&
priv
->
reset_gpio
,
0
);
}
}
#else
static
void
imx8_of_reset_gpio_init
(
struct
udevice
*
dev
,
struct
xhci_imx8m_priv
*
priv
)
{
}
#endif
static
int
imx8m_xhci_probe
(
struct
udevice
*
dev
)
{
struct
xhci_imx8m_priv
*
priv
=
dev_get_priv
(
dev
);
struct
xhci_hccr
*
hccr
;
struct
xhci_hcor
*
hcor
;
fdt_addr_t
hcd_base
;
int
ret
=
0
;
/*
* Get the base address for XHCI controller from the device node
*/
hcd_base
=
devfdt_get_addr
(
dev
);
if
(
hcd_base
==
FDT_ADDR_T_NONE
)
{
printf
(
"Can't get the XHCI register base address
\n
"
);
return
-
ENXIO
;
}
imx8m_usb_power
(
hcd_base
==
USB1_BASE_ADDR
?
0
:
1
,
true
);
imx8_of_clk_init
(
dev
,
priv
);
imx8_of_reset_gpio_init
(
dev
,
priv
);
ret
=
imx8m_usb_common_init
((
void
*
)
hcd_base
,
&
hccr
,
&
hcor
);
if
(
ret
<
0
)
return
ret
;
return
xhci_register
(
dev
,
hccr
,
hcor
);
}
static
int
imx8m_xhci_remove
(
struct
udevice
*
dev
)
{
return
xhci_deregister
(
dev
);
}
static
const
struct
udevice_id
xhci_usb_ids
[]
=
{
{
.
compatible
=
"fsl,imx8mq-dwc3"
,
},
{
}
};
U_BOOT_DRIVER
(
imx8m_xhci
)
=
{
.
name
=
"imx8m_xhci"
,
.
id
=
UCLASS_USB
,
.
of_match
=
xhci_usb_ids
,
.
probe
=
imx8m_xhci_probe
,
.
remove
=
imx8m_xhci_remove
,
.
ops
=
&
xhci_usb_ops
,
.
platdata_auto_alloc_size
=
sizeof
(
struct
usb_platdata
),
.
priv_auto_alloc_size
=
sizeof
(
struct
xhci_imx8m_priv
),
.
flags
=
DM_FLAG_ALLOC_PRIV_DMA
,
};
#else
int
xhci_hcd_init
(
int
index
,
struct
xhci_hccr
**
hccr
,
struct
xhci_hcor
**
hcor
)
{
int
ret
=
0
;
...
...
@@ -152,3 +259,4 @@ void xhci_hcd_stop(int index)
{
board_usb_cleanup
(
ctr_data
[
index
].
usb_id
,
USB_INIT_HOST
);
}
#endif
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