Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: gadget: aspeed-vhub: Add ast2700 support

Add support for the AST2700 SOC in the vhub gadget driver. AST2700
uses a 64-bit DMA addressing capability, so select 64-bit DMA mask
for compatible. AST2700 vhub also requires an reset line, so hook
up the optional reset control and assert/deassert it during probe
and remove.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
Link: https://patch.msgid.link/20251128-upstream_vhub-v2-2-1fa66a5833c2@aspeedtech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ryan Chen and committed by
Greg Kroah-Hartman
36723c6c d0f607e4

+31
+30
drivers/usb/gadget/udc/aspeed-vhub/core.c
··· 23 23 #include <linux/of.h> 24 24 #include <linux/regmap.h> 25 25 #include <linux/dma-mapping.h> 26 + #include <linux/reset.h> 26 27 27 28 #include "vhub.h" 28 29 ··· 281 280 if (vhub->clk) 282 281 clk_disable_unprepare(vhub->clk); 283 282 283 + reset_control_assert(vhub->rst); 284 + 284 285 spin_unlock_irqrestore(&vhub->lock, flags); 285 286 286 287 if (vhub->ep0_bufs) ··· 297 294 static int ast_vhub_probe(struct platform_device *pdev) 298 295 { 299 296 enum usb_device_speed max_speed; 297 + const u64 *dma_mask_ptr; 300 298 struct ast_vhub *vhub; 301 299 struct resource *res; 302 300 int i, rc = 0; ··· 352 348 goto err; 353 349 } 354 350 351 + vhub->rst = devm_reset_control_get_optional_shared(&pdev->dev, NULL); 352 + if (IS_ERR(vhub->rst)) { 353 + rc = PTR_ERR(vhub->rst); 354 + goto err; 355 + } 356 + 357 + rc = reset_control_deassert(vhub->rst); 358 + if (rc) 359 + goto err; 360 + 355 361 /* Check if we need to limit the HW to USB1 */ 356 362 max_speed = usb_get_maximum_speed(&pdev->dev); 357 363 if (max_speed != USB_SPEED_UNKNOWN && max_speed < USB_SPEED_HIGH) ··· 384 370 goto err; 385 371 } 386 372 373 + dma_mask_ptr = (u64 *)of_device_get_match_data(&pdev->dev); 374 + if (dma_mask_ptr) { 375 + rc = dma_coerce_mask_and_coherent(&pdev->dev, *dma_mask_ptr); 376 + if (rc) 377 + goto err; 378 + } 387 379 /* 388 380 * Allocate DMA buffers for all EP0s in one chunk, 389 381 * one per port and one for the vHub itself ··· 432 412 return rc; 433 413 } 434 414 415 + static const u64 dma_mask_32 = DMA_BIT_MASK(32); 416 + static const u64 dma_mask_64 = DMA_BIT_MASK(64); 417 + 435 418 static const struct of_device_id ast_vhub_dt_ids[] = { 436 419 { 437 420 .compatible = "aspeed,ast2400-usb-vhub", 421 + .data = &dma_mask_32, 438 422 }, 439 423 { 440 424 .compatible = "aspeed,ast2500-usb-vhub", 425 + .data = &dma_mask_32, 441 426 }, 442 427 { 443 428 .compatible = "aspeed,ast2600-usb-vhub", 429 + .data = &dma_mask_32, 430 + }, 431 + { 432 + .compatible = "aspeed,ast2700-usb-vhub", 433 + .data = &dma_mask_64, 444 434 }, 445 435 { } 446 436 };
+1
drivers/usb/gadget/udc/aspeed-vhub/vhub.h
··· 388 388 spinlock_t lock; 389 389 struct work_struct wake_work; 390 390 struct clk *clk; 391 + struct reset_control *rst; 391 392 392 393 /* EP0 DMA buffers allocated in one chunk */ 393 394 void *ep0_bufs;