Skip to content

Commit 81a1193

Browse files
committed
MIMXRT1050_EVK: Add USB support
Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent a870fcf commit 81a1193

27 files changed

+12923
-4
lines changed

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MIMXRT1050/TARGET_EVK/mbed_overrides.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2020 ARM Limited
3+
* SPDX-License-Identifier: Apache-2.0
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
56
* you may not use this file except in compliance with the License.
@@ -20,9 +21,17 @@
2021
#include "fsl_iomuxc.h"
2122
#include "fsl_gpio.h"
2223
#include "lpm.h"
24+
#include "usb_phy.h"
25+
#include "usb_device_config.h"
2326

2427
#define LPSPI_CLOCK_SOURCE_DIVIDER (7U)
2528
#define LPI2C_CLOCK_SOURCE_DIVIDER (5U)
29+
30+
/* USB PHY condfiguration */
31+
#define BOARD_USB_PHY_D_CAL (0x0CU)
32+
#define BOARD_USB_PHY_TXCAL45DP (0x06U)
33+
#define BOARD_USB_PHY_TXCAL45DM (0x06U)
34+
2635
uint8_t mbed_otp_mac_address(char *mac);
2736
void mbed_default_mac_address(char *mac);
2837

@@ -311,3 +320,28 @@ void mbed_default_mac_address(char *mac) {
311320

312321
return;
313322
}
323+
324+
void USB_DeviceClockInit(void)
325+
{
326+
usb_phy_config_struct_t phyConfig = {
327+
BOARD_USB_PHY_D_CAL,
328+
BOARD_USB_PHY_TXCAL45DP,
329+
BOARD_USB_PHY_TXCAL45DM,
330+
};
331+
332+
CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usbphy480M, 480000000U);
333+
CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M, 480000000U);
334+
335+
USB_EhciPhyInit(CONTROLLER_ID, BOARD_XTAL0_CLK_HZ, &phyConfig);
336+
}
337+
338+
uint32_t USB_DeviceGetIrqNumber(void)
339+
{
340+
uint8_t irqNumber;
341+
342+
uint8_t usbDeviceEhciIrq[] = USBHS_IRQS;
343+
irqNumber = usbDeviceEhciIrq[CONTROLLER_ID - kUSB_ControllerEhci0];
344+
345+
return irqNumber;
346+
}
347+

0 commit comments

Comments
 (0)