source "drivers/usb/gadget/Kconfig"
+source "drivers/usb/dwc_otg_310/Kconfig"
+
config USB_LED_TRIG
bool "USB LED Triggers"
depends on LEDS_CLASS && USB_COMMON && LEDS_TRIGGERS
obj-$(CONFIG_USB_ATM) += atm/
obj-$(CONFIG_USB_SPEEDTOUCH) += atm/
+obj-$(CONFIG_DWC_OTG_310) += dwc_otg_310/
+
obj-$(CONFIG_USB_MUSB_HDRC) += musb/
obj-$(CONFIG_USB_CHIPIDEA) += chipidea/
obj-$(CONFIG_USB_RENESAS_USBHS) += renesas_usbhs/
void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr)
{
#if 1 /* def xxCOSIM Only works for 32-bit cosim */
- void *buf = dma_alloc_coherent(dma_ctx, (size_t)size, dma_addr, GFP_KERNEL);
+ void *buf = dma_alloc_coherent((struct device *)dma_ctx, (size_t)size,
+ dma_addr, GFP_KERNEL);
#else
void *buf = dma_alloc_coherent(dma_ctx, (size_t)size, dma_addr, GFP_KERNEL | GFP_DMA32);
#endif
void *__DWC_DMA_ALLOC_ATOMIC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr)
{
- void *buf = dma_alloc_coherent(NULL, (size_t)size, dma_addr, GFP_ATOMIC);
+ void *buf = dma_alloc_coherent((struct device *)dma_ctx, (size_t)size,
+ dma_addr, GFP_ATOMIC);
if (!buf) {
return NULL;
}
void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr)
{
- dma_free_coherent(dma_ctx, size, virt_addr, dma_addr);
+ dma_free_coherent((struct device *)dma_ctx, size, virt_addr, dma_addr);
}
void *__DWC_ALLOC(void *mem_ctx, uint32_t size)
}
t->scheduled = 0;
- t->t->base = &boot_tvec_bases;
t->t->expires = jiffies;
setup_timer(t->t, timer_callback, (unsigned long)t);
#define DWC_FREE(_addr_) __DWC_FREE(NULL, _addr_)
# ifdef DWC_LINUX
+extern void *dwc_otg_dev;
#define DWC_DMA_ALLOC(_size_, _dma_) __DWC_DMA_ALLOC(NULL, _size_, _dma_)
#define DWC_DMA_ALLOC_ATOMIC(_size_, _dma_) __DWC_DMA_ALLOC_ATOMIC(NULL, _size_, _dma_)
#define DWC_DMA_FREE(_size_, _virt_, _dma_) __DWC_DMA_FREE(NULL, _size_, _virt_, _dma_)
+#define DWC_DEV_DMA_ALLOC(_size_, _dma_) \
+ __DWC_DMA_ALLOC(dwc_otg_dev, _size_, _dma_)
+#define DWC_DEV_DMA_ALLOC_ATOMIC(_size_, _dma_) \
+ __DWC_DMA_ALLOC_ATOMIC(dwc_otg_dev, _size_, _dma_)
+#define DWC_DEV_DMA_FREE(_size_, _virt_, _dma_) \
+ __DWC_DMA_FREE(dwc_otg_dev, _size_, _virt_, _dma_)
# endif
# if defined(DWC_FREEBSD) || defined(DWC_NETBSD)
CFI_INFO("%s\n", __func__);
if (cfiobj->buf_in.buf) {
- DWC_DMA_FREE(CFI_IN_BUF_LEN, cfiobj->buf_in.buf,
- cfiobj->buf_in.addr);
+ DWC_DEV_DMA_FREE(CFI_IN_BUF_LEN, cfiobj->buf_in.buf,
+ cfiobj->buf_in.addr);
cfiobj->buf_in.buf = NULL;
}
if (cfiobj->buf_out.buf) {
- DWC_DMA_FREE(CFI_OUT_BUF_LEN, cfiobj->buf_out.buf,
- cfiobj->buf_out.addr);
+ DWC_DEV_DMA_FREE(CFI_OUT_BUF_LEN, cfiobj->buf_out.buf,
+ cfiobj->buf_out.addr);
cfiobj->buf_out.buf = NULL;
}
static const char dwc_otg20_driver_name[] = "usb20_otg";
dwc_otg_device_t *g_otgdev;
+void *dwc_otg_dev;
extern int pcd_init(struct platform_device *_dev);
extern int otg20_hcd_init(struct platform_device *_dev);
#endif
#ifdef CONFIG_ARM64
{
- .compatible = "rockchip,rk3368_usb20_otg",
+ .compatible = "rockchip,rk3368-usb",
.data = &usb20otg_pdata_rk3368,
},
#endif
*/
g_otgdev = dwc_otg_device;
+ dwc_otg_dev = (struct device *)&_dev->dev;
pldata->privdata = dwc_otg_device;
dwc_otg_device->pldata = pldata;
{
struct dwc_otg_platform_data *pldata_otg;
struct dwc_otg_platform_data *pldata_host;
+#ifdef CONFIG_USB_EHCI_RK
struct rkehci_platform_data *pldata_ehci;
+#endif
if (cpu_is_rk3288()) {
#ifdef CONFIG_RK_USB_UART
{
struct dwc_otg_platform_data *pldata_otg;
struct dwc_otg_platform_data *pldata_host;
+#ifdef CONFIG_USB_EHCI_RK
struct rkehci_platform_data *pldata_ehci;
+#endif
if (cpu_is_rk3288()) {
#ifdef CONFIG_RK_USB_UART
if (dwc_otg_hcd->core_if->dma_enable) {
if (dwc_otg_hcd->status_buf_dma) {
- DWC_DMA_FREE(DWC_OTG_HCD_STATUS_BUF_SIZE,
- dwc_otg_hcd->status_buf,
- dwc_otg_hcd->status_buf_dma);
+ DWC_DEV_DMA_FREE(DWC_OTG_HCD_STATUS_BUF_SIZE,
+ dwc_otg_hcd->status_buf,
+ dwc_otg_hcd->status_buf_dma);
}
} else if (dwc_otg_hcd->status_buf != NULL) {
DWC_FREE(dwc_otg_hcd->status_buf);
*/
if (hcd->core_if->dma_enable) {
hcd->status_buf =
- DWC_DMA_ALLOC_ATOMIC(DWC_OTG_HCD_STATUS_BUF_SIZE,
- &hcd->status_buf_dma);
+ DWC_DEV_DMA_ALLOC_ATOMIC(DWC_OTG_HCD_STATUS_BUF_SIZE,
+ &hcd->status_buf_dma);
} else {
hcd->status_buf = DWC_ALLOC(DWC_OTG_HCD_STATUS_BUF_SIZE);
}
buf_size = 4096;
}
if (!qh->dw_align_buf) {
- qh->dw_align_buf = DWC_DMA_ALLOC_ATOMIC(buf_size,
- &qh->
- dw_align_buf_dma);
+ qh->dw_align_buf =
+ DWC_DEV_DMA_ALLOC_ATOMIC(buf_size,
+ &qh->
+ dw_align_buf_dma);
if (!qh->dw_align_buf) {
DWC_ERROR
("%s: Failed to allocate memory to handle "
int retval = 0;
qh->desc_list = (dwc_otg_host_dma_desc_t *)
- DWC_DMA_ALLOC_ATOMIC(sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh),
- &qh->desc_list_dma);
+ DWC_DEV_DMA_ALLOC_ATOMIC(sizeof(dwc_otg_host_dma_desc_t) *
+ max_desc_num(qh),
+ &qh->desc_list_dma);
if (!qh->desc_list) {
retval = -DWC_E_NO_MEMORY;
static void desc_list_free(dwc_otg_qh_t *qh)
{
if (qh->desc_list) {
- DWC_DMA_FREE(max_desc_num(qh), qh->desc_list,
- qh->desc_list_dma);
+ DWC_DEV_DMA_FREE(max_desc_num(qh), qh->desc_list,
+ qh->desc_list_dma);
qh->desc_list = NULL;
}
if (hcd->frame_list)
return 0;
- hcd->frame_list = DWC_DMA_ALLOC_ATOMIC(4 * MAX_FRLIST_EN_NUM,
- &hcd->frame_list_dma);
+ hcd->frame_list = DWC_DEV_DMA_ALLOC_ATOMIC(4 * MAX_FRLIST_EN_NUM,
+ &hcd->frame_list_dma);
if (!hcd->frame_list) {
retval = -DWC_E_NO_MEMORY;
DWC_ERROR("%s: Frame List allocation failed\n", __func__);
if (!hcd->frame_list)
return;
- DWC_DMA_FREE(4 * MAX_FRLIST_EN_NUM, hcd->frame_list,
- hcd->frame_list_dma);
+ DWC_DEV_DMA_FREE(4 * MAX_FRLIST_EN_NUM, hcd->frame_list,
+ hcd->frame_list_dma);
hcd->frame_list = NULL;
}
* IRQ line, and calls hcd_start method.
*/
irq = platform_get_irq(_dev, 0);
- retval = usb_add_hcd(hcd, irq, IRQF_SHARED | IRQF_DISABLED);
+ retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (retval < 0) {
goto error2;
}
* IRQ line, and calls hcd_start method.
*/
irq = platform_get_irq(_dev, 0);
- retval = usb_add_hcd(hcd, irq, IRQF_SHARED | IRQF_DISABLED);
+ retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (retval < 0) {
goto error2;
}
} else {
buf_size = hcd->core_if->core_params->max_transfer_size;
}
- DWC_DMA_FREE(buf_size, qh->dw_align_buf, qh->dw_align_buf_dma);
+ DWC_DEV_DMA_FREE(buf_size, qh->dw_align_buf,
+ qh->dw_align_buf_dma);
}
DWC_FREE(qh);
dwc_otg_dev_dma_desc_t *dwc_otg_ep_alloc_desc_chain(dwc_dma_t *dma_desc_addr,
uint32_t count)
{
- return DWC_DMA_ALLOC_ATOMIC(count * sizeof(dwc_otg_dev_dma_desc_t),
- dma_desc_addr);
+ return DWC_DEV_DMA_ALLOC_ATOMIC(count * sizeof(dwc_otg_dev_dma_desc_t),
+ dma_desc_addr);
}
/**
void dwc_otg_ep_free_desc_chain(dwc_otg_dev_dma_desc_t *desc_addr,
uint32_t dma_desc_addr, uint32_t count)
{
- DWC_DMA_FREE(count * sizeof(dwc_otg_dev_dma_desc_t), desc_addr,
- dma_desc_addr);
+ DWC_DEV_DMA_FREE(count * sizeof(dwc_otg_dev_dma_desc_t), desc_addr,
+ dma_desc_addr);
}
#ifdef DWC_EN_ISOC
*/
if (GET_CORE_IF(pcd)->dma_enable) {
pcd->setup_pkt =
- DWC_DMA_ALLOC_ATOMIC(sizeof(*pcd->setup_pkt) * 5,
- &pcd->setup_pkt_dma_handle);
+ DWC_DEV_DMA_ALLOC_ATOMIC(sizeof(*pcd->setup_pkt) * 5,
+ &pcd->setup_pkt_dma_handle);
if (pcd->setup_pkt == NULL) {
DWC_FREE(pcd);
return NULL;
}
pcd->status_buf =
- DWC_DMA_ALLOC_ATOMIC(sizeof(uint16_t),
- &pcd->status_buf_dma_handle);
+ DWC_DEV_DMA_ALLOC_ATOMIC(sizeof(uint16_t),
+ &pcd->status_buf_dma_handle);
if (pcd->status_buf == NULL) {
- DWC_DMA_FREE(sizeof(*pcd->setup_pkt) * 5,
- pcd->setup_pkt, pcd->setup_pkt_dma_handle);
+ DWC_DEV_DMA_FREE(sizeof(*pcd->setup_pkt) * 5,
+ pcd->setup_pkt,
+ pcd->setup_pkt_dma_handle);
DWC_FREE(pcd);
return NULL;
}
(dev_if->setup_desc_addr[0],
dev_if->dma_setup_desc_addr[0], 1);
- DWC_DMA_FREE(sizeof(*pcd->setup_pkt) * 5,
- pcd->setup_pkt,
- pcd->setup_pkt_dma_handle);
- DWC_DMA_FREE(sizeof(*pcd->status_buf),
- pcd->status_buf,
- pcd->status_buf_dma_handle);
+ DWC_DEV_DMA_FREE(sizeof(*pcd->setup_pkt) * 5,
+ pcd->setup_pkt,
+ pcd->setup_pkt_dma_handle);
+ DWC_DEV_DMA_FREE(sizeof(*pcd->status_buf),
+ pcd->status_buf,
+ pcd->status_buf_dma_handle);
DWC_FREE(pcd);
}
if (GET_CORE_IF(pcd)->dma_enable) {
- DWC_DMA_FREE(sizeof(*pcd->setup_pkt) * 5, pcd->setup_pkt,
- pcd->setup_pkt_dma_handle);
- DWC_DMA_FREE(sizeof(uint16_t), pcd->status_buf,
- pcd->status_buf_dma_handle);
+ DWC_DEV_DMA_FREE(sizeof(*pcd->setup_pkt) * 5, pcd->setup_pkt,
+ pcd->setup_pkt_dma_handle);
+ DWC_DEV_DMA_FREE(sizeof(uint16_t), pcd->status_buf,
+ pcd->status_buf_dma_handle);
if (GET_CORE_IF(pcd)->dma_desc_enable) {
dwc_otg_ep_free_desc_chain(dev_if->setup_desc_addr[0],
dev_if->dma_setup_desc_addr
req->dw_align_buf = NULL;
if ((dma_buf & 0x3) && GET_CORE_IF(pcd)->dma_enable
&& !GET_CORE_IF(pcd)->dma_desc_enable)
- req->dw_align_buf = DWC_DMA_ALLOC_ATOMIC(buflen,
- &req->dw_align_buf_dma);
+ req->dw_align_buf = DWC_DEV_DMA_ALLOC_ATOMIC(buflen,
+ &req->
+ dw_align_buf_dma);
DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags);
/*
dwc_memcpy(req->buf, req->dw_align_buf,
req->length);
}
- DWC_DMA_FREE(req->length, req->dw_align_buf,
- req->dw_align_buf_dma);
+ DWC_DEV_DMA_FREE(req->length, req->dw_align_buf,
+ req->dw_align_buf_dma);
}
dwc_otg_request_done(ep, req, 0);
return 0;
}
-static int dwc_otg_gadget_stop(struct usb_gadget *g,
- struct usb_gadget_driver *driver)
+static int dwc_otg_gadget_stop(struct usb_gadget *g)
{
return 0;
}
struct dwc_otg_platform_data *usbpdata = pdata;
struct clk *ahbclk, *phyclk;
- ahbclk = devm_clk_get(usbpdata->dev, "hclk_otg");
+ ahbclk = devm_clk_get(usbpdata->dev, "otg");
if (IS_ERR(ahbclk)) {
- dev_err(usbpdata->dev, "Failed to get hclk_usb0\n");
+ dev_err(usbpdata->dev, "Failed to get otg clk\n");
return;
}
- phyclk = devm_clk_get(usbpdata->dev, "clk_usbphy0");
+ phyclk = devm_clk_get(usbpdata->dev, "sclk_otgphy0");
if (IS_ERR(phyclk)) {
- dev_err(usbpdata->dev, "Failed to get clk_usbphy0\n");
+ dev_err(usbpdata->dev, "Failed to get sclk_otgphy0\n");
return;
}