mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2026-03-11 03:28:39 +01:00
ipq40xx: Enable USB device mode through dts patching
This commit enables USB device mode through dts patching. To enable 'setenv usb_mode device' to be executed in u-boot environment before booting the kernel. Change-Id: I2bcba292a514d04eed7e941a7feba00600fc1fc9 Signed-off-by: Sasirekaa Madhesu <smadhesu@codeaurora.org>
This commit is contained in:
parent
1fbb054c7e
commit
da5968ecbd
1 changed files with 53 additions and 0 deletions
|
|
@ -35,6 +35,7 @@
|
|||
#include "ipq_phy.h"
|
||||
|
||||
#define DLOAD_MAGIC_COOKIE 0x10
|
||||
#define TCSR_USB_HSPHY_DEVICE_MODE 0x00C700E70
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
qca_mmc mmc_host;
|
||||
|
|
@ -316,6 +317,58 @@ void ipq_fdt_fixup_socinfo(void *blob)
|
|||
|
||||
void ipq_fdt_fixup_usb_device_mode(void *blob)
|
||||
{
|
||||
int nodeoff, ret, i;
|
||||
int phy_mode = htonl(TCSR_USB_HSPHY_DEVICE_MODE);
|
||||
const char *mode = "peripheral";
|
||||
const char *node[] = {"/soc/ssphy", "/soc/hsphy", "/soc/usb3"};
|
||||
char *usb_cfg;
|
||||
|
||||
usb_cfg = getenv("usb_mode");
|
||||
if (!usb_cfg)
|
||||
return;
|
||||
|
||||
if (strcmp(usb_cfg, "device"))
|
||||
return;
|
||||
|
||||
nodeoff = fdt_path_offset(blob, "/soc/tcsr");
|
||||
if (nodeoff < 0) {
|
||||
printf("ipq: fdt fixup unable to find node /soc/tcsr\n");
|
||||
return;
|
||||
}
|
||||
ret = fdt_setprop(blob, nodeoff, "ipq,usb-hsphy-mode-select",
|
||||
&phy_mode, sizeof(phy_mode));
|
||||
if (ret != 0) {
|
||||
printf("ipq: unable to set prop: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
phy_mode = 0;
|
||||
for (i = 0; i < (sizeof(node) / sizeof(node[0])); i++) {
|
||||
nodeoff = fdt_path_offset(blob, node[i]);
|
||||
if (nodeoff < 0) {
|
||||
printf("ipq: fdt fixup unable to find node %s\n",
|
||||
node[i]);
|
||||
continue;
|
||||
}
|
||||
ret = fdt_setprop(blob, nodeoff, "qca,host",
|
||||
&phy_mode, sizeof(phy_mode));
|
||||
if (ret != 0) {
|
||||
printf("ipq: unable to set prop: %d\n", ret);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
nodeoff = fdt_path_offset(blob, "/soc/usb3/dwc3");
|
||||
if (nodeoff < 0) {
|
||||
printf("ipq: fdt fixup unable to find node /soc/usb3/dwc3\n");
|
||||
return;
|
||||
}
|
||||
ret = fdt_setprop(blob, nodeoff, "dr_mode",
|
||||
mode, (strlen(mode) + 1));
|
||||
if (ret != 0) {
|
||||
printf("ipq: unable to set prop: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue