Skip to content

Commit 4aada75

Browse files
TimJTixiaoxiang781216
authored andcommitted
Changes to allow board-specific DRP/OTG support
Update sam_udphs.c
1 parent 1fb6dce commit 4aada75

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

arch/arm/src/sama5/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3827,7 +3827,7 @@ if SAMA5_OHCI || SAMA5_EHCI
38273827
config SAMA5_UHPHS_RHPORT1
38283828
bool "Use Port A"
38293829
default y
3830-
depends on !SAMA5_UDPHS
3830+
depends on !SAMA5_UDPHS || SAMA5_USB_DRP
38313831

38323832
config SAMA5_UHPHS_RHPORT2
38333833
bool "Use Port B"

arch/arm/src/sama5/sam_ehci.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,16 @@
110110
#undef CONFIG_USBHOST_ISOC_DISABLE
111111
#define CONFIG_USBHOST_ISOC_DISABLE 1
112112

113-
/* If UDPHS is enabled, then don't use port A */
113+
/* Suppress use of PORTA unless board-specific dual-role-port support
114+
* has been included. Generally port A is used as a device-only port,
115+
* typically for SAM-BA and the possibility of enabling host VBUS power
116+
* for this port would be a BAD idea
117+
*/
114118

115-
#ifdef CONFIG_SAMA5_UDPHS
119+
#if defined(CONFIG_SAMA5_UDPHS) && !defined(CONFIG_SAMA5_USBA_DRP)
116120
# undef CONFIG_SAMA5_UHPHS_RHPORT1
117121
#endif
118122

119-
/* For now, suppress use of PORTA in any event. I use that for SAM-BA and
120-
* would prefer that the board not try to drive VBUS on that port!
121-
*/
122-
123-
#undef CONFIG_SAMA5_UHPHS_RHPORT1
124-
125123
/* Driver-private Definitions ***********************************************/
126124

127125
/* This is the set of interrupts handled by this driver */

arch/arm/src/sama5/sam_ohci.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,16 @@
124124

125125
#define SAM_BUFALLOC (CONFIG_SAMA5_OHCI_TDBUFFERS * CONFIG_SAMA5_OHCI_TDBUFSIZE)
126126

127-
/* If UDPHS is enabled, then don't use port A */
127+
/* Suppress use of PORTA unless board-specific dual-role-port support
128+
* has been included. Generally port A is used as a device-only port,
129+
* typically for SAM-BA and the possibility of enabling host VBUS power
130+
* for this port would be a BAD idea
131+
*/
128132

129-
#ifdef CONFIG_SAMA5_UDPHS
133+
#if defined(CONFIG_SAMA5_UDPHS) && !defined(CONFIG_SAMA5_USBA_DRP)
130134
# undef CONFIG_SAMA5_UHPHS_RHPORT1
131135
#endif
132136

133-
/* For now, suppress use of PORTA in any event. I use that for SAM-BA and
134-
* would prefer that the board not try to drive VBUS on that port!
135-
*/
136-
137-
#undef CONFIG_SAMA5_UHPHS_RHPORT1
138-
139137
/* Debug */
140138

141139
#ifndef CONFIG_DEBUG_USB_INFO

arch/arm/src/sama5/sam_udphs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4055,6 +4055,7 @@ static int sam_selfpowered(struct usbdev_s *dev, bool selfpowered)
40554055

40564056
static int sam_pullup(struct usbdev_s *dev, bool enable)
40574057
{
4058+
#ifndef CONFIG_SAMA5_USB_DRP
40584059
struct sam_usbdev_s *priv = (struct sam_usbdev_s *)dev;
40594060
uint32_t regval;
40604061

@@ -4102,7 +4103,7 @@ static int sam_pullup(struct usbdev_s *dev, bool enable)
41024103
priv->devstate = UDPHS_DEVSTATE_POWERED;
41034104
}
41044105
}
4105-
4106+
#endif /* CONFIG_SAMA5_USB_DRP */
41064107
return OK;
41074108
}
41084109

0 commit comments

Comments
 (0)