From b4d5cf0bc8f9d39c0674c87c610d95d3445a3434 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 4 Dec 2015 00:57:58 +0100 Subject: usb: s3c-otg: Rename struct s3c_udc to dwc2_udc The driver is actually for the Designware DWC2 controller. This patch renames struct s3c_udc to struct dwc2_udc to make things more obvious and clear. Signed-off-by: Marek Vasut --- include/usb/s3c_udc.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/usb/s3c_udc.h b/include/usb/s3c_udc.h index 7f49a4e2d5..f6c3a8693c 100644 --- a/include/usb/s3c_udc.h +++ b/include/usb/s3c_udc.h @@ -55,7 +55,7 @@ enum ep_type { struct s3c_ep { struct usb_ep ep; - struct s3c_udc *dev; + struct dwc2_udc *dev; const struct usb_endpoint_descriptor *desc; struct list_head queue; @@ -76,7 +76,7 @@ struct s3c_request { struct list_head queue; }; -struct s3c_udc { +struct dwc2_udc { struct usb_gadget gadget; struct usb_gadget_driver *driver; @@ -90,14 +90,14 @@ struct s3c_udc { unsigned req_pending:1, req_std:1; }; -extern struct s3c_udc *the_controller; +extern struct dwc2_udc *the_controller; #define ep_is_in(EP) (((EP)->bEndpointAddress&USB_DIR_IN) == USB_DIR_IN) #define ep_index(EP) ((EP)->bEndpointAddress&0xF) #define ep_maxpacket(EP) ((EP)->ep.maxpacket) -extern void otg_phy_init(struct s3c_udc *dev); -extern void otg_phy_off(struct s3c_udc *dev); +extern void otg_phy_init(struct dwc2_udc *dev); +extern void otg_phy_off(struct dwc2_udc *dev); extern void s3c_udc_ep_set_stall(struct s3c_ep *ep); extern int s3c_udc_probe(struct s3c_plat_otg_data *pdata); -- cgit From 2c12ff039ca6e36c8c2025befcda3d91fbf47dcd Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 4 Dec 2015 01:36:36 +0100 Subject: usb: s3c-otg: Split private bits from s3c_udc.h Most of the functions are local to the s3c_udc driver, remove them from the s3c_udc.h header to stop those bits from propagating all over the place. Instead, move all the private stuff into new private s3c_udc_otg_priv.h header. Signed-off-by: Marek Vasut --- include/usb/s3c_udc.h | 94 ++------------------------------------------------- 1 file changed, 3 insertions(+), 91 deletions(-) (limited to 'include') diff --git a/include/usb/s3c_udc.h b/include/usb/s3c_udc.h index f6c3a8693c..67c3e9112d 100644 --- a/include/usb/s3c_udc.h +++ b/include/usb/s3c_udc.h @@ -9,99 +9,8 @@ #ifndef __S3C_USB_GADGET #define __S3C_USB_GADGET -#include -#include -#include -#include -#include -#include - #define PHY0_SLEEP (1 << 5) -/*-------------------------------------------------------------------------*/ -/* DMA bounce buffer size, 16K is enough even for mass storage */ -#define DMA_BUFFER_SIZE (16*SZ_1K) - -#define EP0_FIFO_SIZE 64 -#define EP_FIFO_SIZE 512 -#define EP_FIFO_SIZE2 1024 -/* ep0-control, ep1in-bulk, ep2out-bulk, ep3in-int */ -#define S3C_MAX_ENDPOINTS 4 -#define S3C_MAX_HW_ENDPOINTS 16 - -#define WAIT_FOR_SETUP 0 -#define DATA_STATE_XMIT 1 -#define DATA_STATE_NEED_ZLP 2 -#define WAIT_FOR_OUT_STATUS 3 -#define DATA_STATE_RECV 4 -#define WAIT_FOR_COMPLETE 5 -#define WAIT_FOR_OUT_COMPLETE 6 -#define WAIT_FOR_IN_COMPLETE 7 -#define WAIT_FOR_NULL_COMPLETE 8 - -#define TEST_J_SEL 0x1 -#define TEST_K_SEL 0x2 -#define TEST_SE0_NAK_SEL 0x3 -#define TEST_PACKET_SEL 0x4 -#define TEST_FORCE_ENABLE_SEL 0x5 - -/* ************************************************************************* */ -/* IO - */ - -enum ep_type { - ep_control, ep_bulk_in, ep_bulk_out, ep_interrupt -}; - -struct s3c_ep { - struct usb_ep ep; - struct dwc2_udc *dev; - - const struct usb_endpoint_descriptor *desc; - struct list_head queue; - unsigned long pio_irqs; - int len; - void *dma_buf; - - u8 stopped; - u8 bEndpointAddress; - u8 bmAttributes; - - enum ep_type ep_type; - int fifo_num; -}; - -struct s3c_request { - struct usb_request req; - struct list_head queue; -}; - -struct dwc2_udc { - struct usb_gadget gadget; - struct usb_gadget_driver *driver; - - struct s3c_plat_otg_data *pdata; - - int ep0state; - struct s3c_ep ep[S3C_MAX_ENDPOINTS]; - - unsigned char usb_address; - - unsigned req_pending:1, req_std:1; -}; - -extern struct dwc2_udc *the_controller; - -#define ep_is_in(EP) (((EP)->bEndpointAddress&USB_DIR_IN) == USB_DIR_IN) -#define ep_index(EP) ((EP)->bEndpointAddress&0xF) -#define ep_maxpacket(EP) ((EP)->ep.maxpacket) - -extern void otg_phy_init(struct dwc2_udc *dev); -extern void otg_phy_off(struct dwc2_udc *dev); - -extern void s3c_udc_ep_set_stall(struct s3c_ep *ep); -extern int s3c_udc_probe(struct s3c_plat_otg_data *pdata); - struct s3c_plat_otg_data { int (*phy_control)(int on); unsigned int regs_phy; @@ -110,4 +19,7 @@ struct s3c_plat_otg_data { unsigned int usb_flags; unsigned int usb_gusbcfg; }; + +extern int s3c_udc_probe(struct s3c_plat_otg_data *pdata); + #endif -- cgit From 193979e2fe7cf75cb7434341562b1da7153750f7 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 4 Dec 2015 02:21:41 +0100 Subject: usb: s3c-otg: Zap useless externs The extern statements are useless, remove them. Also remove the extern ... controller, which is completely useless. Signed-off-by: Marek Vasut --- include/usb/s3c_udc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/usb/s3c_udc.h b/include/usb/s3c_udc.h index 67c3e9112d..20af629929 100644 --- a/include/usb/s3c_udc.h +++ b/include/usb/s3c_udc.h @@ -20,6 +20,6 @@ struct s3c_plat_otg_data { unsigned int usb_gusbcfg; }; -extern int s3c_udc_probe(struct s3c_plat_otg_data *pdata); +int s3c_udc_probe(struct s3c_plat_otg_data *pdata); #endif -- cgit From e179cedd09325f6e83107d6f437600de0fc81553 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 4 Dec 2015 02:55:37 +0100 Subject: usb: s3c-otg: Tweak the comments The driver is actually for the Designware DWC2 controller. Tweak the comments in the driver to reflect this fact. Signed-off-by: Marek Vasut --- include/usb/s3c_udc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/usb/s3c_udc.h b/include/usb/s3c_udc.h index 20af629929..497248dbee 100644 --- a/include/usb/s3c_udc.h +++ b/include/usb/s3c_udc.h @@ -1,6 +1,6 @@ /* * drivers/usb/gadget/s3c_udc.h - * Samsung S3C on-chip full/high speed USB device controllers + * Designware DWC2 on-chip full/high speed USB device controllers * Copyright (C) 2005 for Samsung Electronics * * SPDX-License-Identifier: GPL-2.0+ -- cgit From e30824f439c81070d97cff3f9a31952b58eb9ad3 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 19 Aug 2015 23:27:26 +0200 Subject: usb: s3c-otg: Rename USB_GADGET_S3C_UDC_OTG* to USB_GADGET_DWC2_OTG* The s3c-otg IP block is in fact a DWC2 OTG one, so finally rename the config option to make it less misleading. No functional change, just a mechanical change done using the following script: git grep USB_GADGET_S3C_UDC_OTG | cut -d : -f 1 | sort -u | \ while read line ; do sed -i "s/USB_GADGET_S3C_UDC_OTG/USB_GADGET_DWC2_OTG/g" $line ; done Signed-off-by: Marek Vasut --- include/configs/bcm28155_ap.h | 2 +- include/configs/exynos4-common.h | 4 ++-- include/configs/s5p_goni.h | 4 ++-- include/configs/s5pc210_universal.h | 4 ++-- include/configs/smdkv310.h | 4 ++-- include/configs/socfpga_common.h | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/configs/bcm28155_ap.h b/include/configs/bcm28155_ap.h index 131f613b68..a257084a03 100644 --- a/include/configs/bcm28155_ap.h +++ b/include/configs/bcm28155_ap.h @@ -142,7 +142,7 @@ #define CONFIG_USB_GADGET #define CONFIG_USB_GADGET_DUALSPEED #define CONFIG_USB_GADGET_VBUS_DRAW 0 -#define CONFIG_USB_GADGET_S3C_UDC_OTG +#define CONFIG_USB_GADGET_DWC2_OTG #define CONFIG_USB_GADGET_BCM_UDC_OTG_PHY #define CONFIG_USB_GADGET_DOWNLOAD #define CONFIG_USBID_ADDR 0x34052c46 diff --git a/include/configs/exynos4-common.h b/include/configs/exynos4-common.h index ec1f882f3a..d101a77473 100644 --- a/include/configs/exynos4-common.h +++ b/include/configs/exynos4-common.h @@ -51,8 +51,8 @@ #define CONFIG_SYS_MONITOR_LEN (256 << 10) /* Reserve 2 sectors */ #define CONFIG_USB_GADGET -#define CONFIG_USB_GADGET_S3C_UDC_OTG -#define CONFIG_USB_GADGET_S3C_UDC_OTG_PHY +#define CONFIG_USB_GADGET_DWC2_OTG +#define CONFIG_USB_GADGET_DWC2_OTG_PHY #define CONFIG_USB_GADGET_DUALSPEED #define CONFIG_USB_GADGET_VBUS_DRAW 2 diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h index 2877e19ad4..8f65d7ed7a 100644 --- a/include/configs/s5p_goni.h +++ b/include/configs/s5p_goni.h @@ -269,8 +269,8 @@ #define CONFIG_SYS_MAX_I2C_BUS 7 #define CONFIG_USB_GADGET -#define CONFIG_USB_GADGET_S3C_UDC_OTG -#define CONFIG_USB_GADGET_S3C_UDC_OTG_PHY +#define CONFIG_USB_GADGET_DWC2_OTG +#define CONFIG_USB_GADGET_DWC2_OTG_PHY #define CONFIG_USB_GADGET_DUALSPEED #define CONFIG_USB_GADGET_VBUS_DRAW 2 #define CONFIG_CMD_USB_MASS_STORAGE diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h index 35fef2b244..7bb62ca6c1 100644 --- a/include/configs/s5pc210_universal.h +++ b/include/configs/s5pc210_universal.h @@ -177,8 +177,8 @@ #define CONFIG_POWER_MAX8998 #define CONFIG_USB_GADGET -#define CONFIG_USB_GADGET_S3C_UDC_OTG -#define CONFIG_USB_GADGET_S3C_UDC_OTG_PHY +#define CONFIG_USB_GADGET_DWC2_OTG +#define CONFIG_USB_GADGET_DWC2_OTG_PHY #define CONFIG_USB_GADGET_DUALSPEED /* diff --git a/include/configs/smdkv310.h b/include/configs/smdkv310.h index 217cfc04ac..2492f99269 100644 --- a/include/configs/smdkv310.h +++ b/include/configs/smdkv310.h @@ -13,8 +13,8 @@ #undef CONFIG_BOARD_COMMON #undef CONFIG_USB_GADGET -#undef CONFIG_USB_GADGET_S3C_UDC_OTG -#undef CONFIG_USB_GADGET_S3C_UDC_OTG_PHY +#undef CONFIG_USB_GADGET_DWC2_OTG +#undef CONFIG_USB_GADGET_DWC2_OTG_PHY #undef CONFIG_CMD_USB_MASS_STORAGE #undef CONFIG_REVISION_TAG #undef CONFIG_CMD_THOR_DOWNLOAD diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h index b3f65b60d9..b0bc68952c 100644 --- a/include/configs/socfpga_common.h +++ b/include/configs/socfpga_common.h @@ -243,7 +243,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void); */ #if defined(CONFIG_CMD_DFU) || defined(CONFIG_CMD_USB_MASS_STORAGE) #define CONFIG_USB_GADGET -#define CONFIG_USB_GADGET_S3C_UDC_OTG +#define CONFIG_USB_GADGET_DWC2_OTG #define CONFIG_USB_GADGET_DUALSPEED #define CONFIG_USB_GADGET_VBUS_DRAW 2 -- cgit From c0982871df3ea6af1658cbf0f2fe38938b1780c7 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 4 Dec 2015 02:23:29 +0100 Subject: usb: s3c-otg: Rename struct s3c_plat_otg_data The driver is actually for the Designware DWC2 controller. This patch is the first to rename global symbol, the struct s3c_plat_otg_data. The rename is done automatically: $ sed -i "s/s3c_plat_otg_data/dwc2_plat_otg_data/g" \ `git grep s3c_plat_otg_data | cut -d : -f 1` Signed-off-by: Marek Vasut --- include/usb/s3c_udc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/usb/s3c_udc.h b/include/usb/s3c_udc.h index 497248dbee..3e83f7c56e 100644 --- a/include/usb/s3c_udc.h +++ b/include/usb/s3c_udc.h @@ -11,7 +11,7 @@ #define PHY0_SLEEP (1 << 5) -struct s3c_plat_otg_data { +struct dwc2_plat_otg_data { int (*phy_control)(int on); unsigned int regs_phy; unsigned int regs_otg; @@ -20,6 +20,6 @@ struct s3c_plat_otg_data { unsigned int usb_gusbcfg; }; -int s3c_udc_probe(struct s3c_plat_otg_data *pdata); +int s3c_udc_probe(struct dwc2_plat_otg_data *pdata); #endif -- cgit From a4bb9b3636fe6dfd1cadaf34c42f4fb3b1ebe46c Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 4 Dec 2015 02:26:33 +0100 Subject: usb: s3c-otg: Rename s3c_udc_probe() function The driver is actually for the Designware DWC2 controller. This patch is the second and final to rename global symbol, the s3c_udc_probe() function. The rename is done automatically: $ sed -i "s/s3c_udc_probe/dwc2_udc_probe/g" \ `git grep s3c_udc_probe | cut -d : -f 1` Signed-off-by: Marek Vasut --- include/usb/s3c_udc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/usb/s3c_udc.h b/include/usb/s3c_udc.h index 3e83f7c56e..9bc1aad9a7 100644 --- a/include/usb/s3c_udc.h +++ b/include/usb/s3c_udc.h @@ -20,6 +20,6 @@ struct dwc2_plat_otg_data { unsigned int usb_gusbcfg; }; -int s3c_udc_probe(struct dwc2_plat_otg_data *pdata); +int dwc2_udc_probe(struct dwc2_plat_otg_data *pdata); #endif -- cgit From 5d5716eebccaa9b9ab977b7d5a9fae2abb7a8829 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 4 Dec 2015 02:51:20 +0100 Subject: usb: s3c-otg: Rename usb/s3c_udc.h to usb/dwc2_udc.h The driver is actually for the Designware DWC2 controller. This patch renames the global s3c_udc.h header to dwc2_udc.h. The rename is done automatically: $ sed -i "s/s3c_udc\.h/dwc2_udc.h/g" \ `git grep "s3c_udc\.h" | cut -d : -f 1` Signed-off-by: Marek Vasut --- include/usb/dwc2_udc.h | 25 +++++++++++++++++++++++++ include/usb/s3c_udc.h | 25 ------------------------- 2 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 include/usb/dwc2_udc.h delete mode 100644 include/usb/s3c_udc.h (limited to 'include') diff --git a/include/usb/dwc2_udc.h b/include/usb/dwc2_udc.h new file mode 100644 index 0000000000..302e9a35a2 --- /dev/null +++ b/include/usb/dwc2_udc.h @@ -0,0 +1,25 @@ +/* + * drivers/usb/gadget/dwc2_udc.h + * Designware DWC2 on-chip full/high speed USB device controllers + * Copyright (C) 2005 for Samsung Electronics + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __DWC2_USB_GADGET +#define __DWC2_USB_GADGET + +#define PHY0_SLEEP (1 << 5) + +struct dwc2_plat_otg_data { + int (*phy_control)(int on); + unsigned int regs_phy; + unsigned int regs_otg; + unsigned int usb_phy_ctrl; + unsigned int usb_flags; + unsigned int usb_gusbcfg; +}; + +int dwc2_udc_probe(struct dwc2_plat_otg_data *pdata); + +#endif /* __DWC2_USB_GADGET */ diff --git a/include/usb/s3c_udc.h b/include/usb/s3c_udc.h deleted file mode 100644 index 9bc1aad9a7..0000000000 --- a/include/usb/s3c_udc.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * drivers/usb/gadget/s3c_udc.h - * Designware DWC2 on-chip full/high speed USB device controllers - * Copyright (C) 2005 for Samsung Electronics - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#ifndef __S3C_USB_GADGET -#define __S3C_USB_GADGET - -#define PHY0_SLEEP (1 << 5) - -struct dwc2_plat_otg_data { - int (*phy_control)(int on); - unsigned int regs_phy; - unsigned int regs_otg; - unsigned int usb_phy_ctrl; - unsigned int usb_flags; - unsigned int usb_gusbcfg; -}; - -int dwc2_udc_probe(struct dwc2_plat_otg_data *pdata); - -#endif -- cgit