#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/dma-mapping.h>
+#include <linux/reset.h>
#include "vhub.h"
if (vhub->clk)
clk_disable_unprepare(vhub->clk);
+ reset_control_assert(vhub->rst);
+
spin_unlock_irqrestore(&vhub->lock, flags);
if (vhub->ep0_bufs)
static int ast_vhub_probe(struct platform_device *pdev)
{
enum usb_device_speed max_speed;
+ const u64 *dma_mask_ptr;
struct ast_vhub *vhub;
struct resource *res;
int i, rc = 0;
goto err;
}
+ vhub->rst = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
+ if (IS_ERR(vhub->rst)) {
+ rc = PTR_ERR(vhub->rst);
+ goto err;
+ }
+
+ rc = reset_control_deassert(vhub->rst);
+ if (rc)
+ goto err;
+
/* Check if we need to limit the HW to USB1 */
max_speed = usb_get_maximum_speed(&pdev->dev);
if (max_speed != USB_SPEED_UNKNOWN && max_speed < USB_SPEED_HIGH)
goto err;
}
+ dma_mask_ptr = (u64 *)of_device_get_match_data(&pdev->dev);
+ if (dma_mask_ptr) {
+ rc = dma_coerce_mask_and_coherent(&pdev->dev, *dma_mask_ptr);
+ if (rc)
+ goto err;
+ }
/*
* Allocate DMA buffers for all EP0s in one chunk,
* one per port and one for the vHub itself
return rc;
}
+static const u64 dma_mask_32 = DMA_BIT_MASK(32);
+static const u64 dma_mask_64 = DMA_BIT_MASK(64);
+
static const struct of_device_id ast_vhub_dt_ids[] = {
{
.compatible = "aspeed,ast2400-usb-vhub",
+ .data = &dma_mask_32,
},
{
.compatible = "aspeed,ast2500-usb-vhub",
+ .data = &dma_mask_32,
},
{
.compatible = "aspeed,ast2600-usb-vhub",
+ .data = &dma_mask_32,
+ },
+ {
+ .compatible = "aspeed,ast2700-usb-vhub",
+ .data = &dma_mask_64,
},
{ }
};