Commit 79f49120ba481ed736face73ecf11a6c1070a861
Committed by
Andy Fleming
1 parent
5a52977f28
Exists in
master
and in
54 other branches
powerpc/8xxx:Add MPH controller support in USB device-tree fixup
Add support for fixing usb mode and phy type for MPH(Multi Port Host) USB controllers in device-tree nodes. Required for socs like P3060, P5020, etc having MPH USB controller Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Showing 2 changed files with 21 additions and 12 deletions Side-by-side Diff
arch/powerpc/cpu/mpc8xxx/fdt.c
... | ... | @@ -86,30 +86,39 @@ |
86 | 86 | } |
87 | 87 | #endif /* defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) */ |
88 | 88 | |
89 | -#ifdef CONFIG_HAS_FSL_DR_USB | |
89 | +#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) | |
90 | 90 | static int fdt_fixup_usb_mode_phy_type(void *blob, const char *mode, |
91 | 91 | const char *phy_type, int start_offset) |
92 | 92 | { |
93 | - const char *compat = "fsl-usb2-dr"; | |
93 | + const char *compat_dr = "fsl-usb2-dr"; | |
94 | + const char *compat_mph = "fsl-usb2-mph"; | |
94 | 95 | const char *prop_mode = "dr_mode"; |
95 | 96 | const char *prop_type = "phy_type"; |
97 | + const char *node_type = NULL; | |
96 | 98 | int node_offset; |
97 | 99 | int err; |
98 | 100 | |
99 | 101 | node_offset = fdt_node_offset_by_compatible(blob, |
100 | - start_offset, compat); | |
102 | + start_offset, compat_mph); | |
101 | 103 | if (node_offset < 0) { |
102 | - printf("WARNING: could not find compatible node %s: %s.\n", | |
103 | - compat, fdt_strerror(node_offset)); | |
104 | - return -1; | |
105 | - } | |
104 | + node_offset = fdt_node_offset_by_compatible(blob, | |
105 | + start_offset, compat_dr); | |
106 | + if (node_offset < 0) { | |
107 | + printf("WARNING: could not find compatible" | |
108 | + " node %s or %s: %s.\n", compat_mph, | |
109 | + compat_dr, fdt_strerror(node_offset)); | |
110 | + return -1; | |
111 | + } else | |
112 | + node_type = compat_dr; | |
113 | + } else | |
114 | + node_type = compat_mph; | |
106 | 115 | |
107 | 116 | if (mode) { |
108 | 117 | err = fdt_setprop(blob, node_offset, prop_mode, mode, |
109 | 118 | strlen(mode) + 1); |
110 | 119 | if (err < 0) |
111 | 120 | printf("WARNING: could not set %s for %s: %s.\n", |
112 | - prop_mode, compat, fdt_strerror(err)); | |
121 | + prop_mode, node_type, fdt_strerror(err)); | |
113 | 122 | } |
114 | 123 | |
115 | 124 | if (phy_type) { |
... | ... | @@ -117,7 +126,7 @@ |
117 | 126 | strlen(phy_type) + 1); |
118 | 127 | if (err < 0) |
119 | 128 | printf("WARNING: could not set %s for %s: %s.\n", |
120 | - prop_type, compat, fdt_strerror(err)); | |
129 | + prop_type, node_type, fdt_strerror(err)); | |
121 | 130 | } |
122 | 131 | |
123 | 132 | return node_offset; |
... | ... | @@ -180,7 +189,7 @@ |
180 | 189 | fdt_fixup_usb_mode_phy_type(blob, mode, phy_type, usb_off); |
181 | 190 | } |
182 | 191 | } |
183 | -#endif /* CONFIG_HAS_FSL_DR_USB */ | |
192 | +#endif /* defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) */ | |
184 | 193 | |
185 | 194 | /* |
186 | 195 | * update crypto node properties to a specified revision of the SEC |
include/fdt_support.h
... | ... | @@ -61,11 +61,11 @@ |
61 | 61 | const void *val, int len, int create); |
62 | 62 | void fdt_fixup_qe_firmware(void *fdt); |
63 | 63 | |
64 | -#ifdef CONFIG_HAS_FSL_DR_USB | |
64 | +#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) | |
65 | 65 | void fdt_fixup_dr_usb(void *blob, bd_t *bd); |
66 | 66 | #else |
67 | 67 | static inline void fdt_fixup_dr_usb(void *blob, bd_t *bd) {} |
68 | -#endif /* CONFIG_HAS_FSL_DR_USB */ | |
68 | +#endif /* defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) */ | |
69 | 69 | |
70 | 70 | #if defined(CONFIG_SYS_FSL_SEC_COMPAT) |
71 | 71 | void fdt_fixup_crypto_node(void *blob, int sec_rev); |