armv8: fsl-layerscape: rework the dwc3 snooping enable code
Instead of looking at all USB (host) devices, just search all DWC3 device tree nodes. This will (1) fix a panic if of_match is zero and (2) also apply the fixup if the controller is in peripheral mode. Both happen when the DWC3 USB controller driver is used. Signed-off-by: Michael Walle <michael@walle.cc> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
This commit is contained in:
		
							parent
							
								
									bce039acf2
								
							
						
					
					
						commit
						f53e102e12
					
				|  | @ -929,25 +929,23 @@ __weak int fsl_board_late_init(void) | ||||||
| #define DWC3_GSBUSCFG0_CACHETYPE(n)        (((n) & 0xffff)            \ | #define DWC3_GSBUSCFG0_CACHETYPE(n)        (((n) & 0xffff)            \ | ||||||
| 	<< DWC3_GSBUSCFG0_CACHETYPE_SHIFT) | 	<< DWC3_GSBUSCFG0_CACHETYPE_SHIFT) | ||||||
| 
 | 
 | ||||||
| void enable_dwc3_snooping(void) | static void enable_dwc3_snooping(void) | ||||||
| { | { | ||||||
| 	int ret; | 	static const char * const compatibles[] = { | ||||||
| 	u32 val; | 	    "fsl,layerscape-dwc3", | ||||||
| 	struct udevice *bus; | 	    "fsl,ls1028a-dwc3", | ||||||
| 	struct uclass *uc; | 	}; | ||||||
| 	fdt_addr_t dwc3_base; | 	fdt_addr_t dwc3_base; | ||||||
|  | 	ofnode node; | ||||||
|  | 	u32 val; | ||||||
|  | 	int i; | ||||||
| 
 | 
 | ||||||
| 	ret = uclass_get(UCLASS_USB, &uc); | 	for (i = 0; i < ARRAY_SIZE(compatibles); i++) { | ||||||
| 	if (ret) | 		ofnode_for_each_compatible_node(node, compatibles[i]) { | ||||||
| 		return; | 			dwc3_base = ofnode_get_addr(node); | ||||||
| 
 | 			if (dwc3_base == FDT_ADDR_T_NONE) | ||||||
| 	uclass_foreach_dev(bus, uc) { |  | ||||||
| 		if (!strcmp(bus->driver->of_match->compatible, "fsl,layerscape-dwc3")) { |  | ||||||
| 			dwc3_base = devfdt_get_addr(bus); |  | ||||||
| 			if (dwc3_base == FDT_ADDR_T_NONE) { |  | ||||||
| 				dev_err(bus, "dwc3 regs missing\n"); |  | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 
 | ||||||
| 			val = in_le32(dwc3_base + DWC3_GSBUSCFG0); | 			val = in_le32(dwc3_base + DWC3_GSBUSCFG0); | ||||||
| 			val &= ~DWC3_GSBUSCFG0_CACHETYPE(~0); | 			val &= ~DWC3_GSBUSCFG0_CACHETYPE(~0); | ||||||
| 			val |= DWC3_GSBUSCFG0_CACHETYPE(0x2222); | 			val |= DWC3_GSBUSCFG0_CACHETYPE(0x2222); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue