From e3d7440c2212497b33f0b12f5112f1a99e3f201c Mon Sep 17 00:00:00 2001 From: Vivek Gautam Date: Sat, 14 Sep 2013 14:02:44 +0530 Subject: usb: Move 'bmRequestType' USB device request macros from EHCI header Macros defining bmRequestType field of USB device request, given in table 9.2 USB 2.0 spec, are rather generic macros which can be further used by other Host controller stacks. So moving them to usb_defs header. Signed-off-by: Vivek Gautam Cc: Julius Werner Cc: Simon Glass Cc: Minkyu Kang Cc: Dan Murphy Cc: Marek Vasut --- include/usb_defs.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include') diff --git a/include/usb_defs.h b/include/usb_defs.h index 0cf5f2d..236a5ec 100644 --- a/include/usb_defs.h +++ b/include/usb_defs.h @@ -63,6 +63,25 @@ #define USB_DIR_OUT 0 #define USB_DIR_IN 0x80 +/* + * bmRequestType: USB Device Requests, table 9.2 USB 2.0 spec. + * (shifted) direction/type/recipient. + */ +#define DeviceRequest \ + ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8) + +#define DeviceOutRequest \ + ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8) + +#define InterfaceRequest \ + ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8) + +#define EndpointRequest \ + ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8) + +#define EndpointOutRequest \ + ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8) + /* Descriptor types */ #define USB_DT_DEVICE 0x01 #define USB_DT_CONFIG 0x02 -- cgit v1.1 From 5853e1335cfc76c230cc28c4226b4d513ddb7542 Mon Sep 17 00:00:00 2001 From: Vivek Gautam Date: Sat, 14 Sep 2013 14:02:45 +0530 Subject: USB: xHCI: Add stack support for xHCI This adds stack layer for eXtensible Host Controller Interface which facilitates use of USB 3.0 in host mode. Adapting xHCI host controller driver in linux-kernel by Sarah Sharp to needs in u-boot. Initial porting from Linux kernel version 3.4, with following top commit history of drivers/usb/host/xhci* : cf84055 xHCI: Cleanup isoc transfer ring when TD length mismatch found This adds the basic xHCI host controller driver with bare minimum features: - Control/Bulk transfer support has been added with required infrastructure for necessary xHC data structures. - Stream protocol hasn't been supported yet. - No support for quirky devices has been added. Signed-off-by: Vikas C Sajjan Signed-off-by: Julius Werner Signed-off-by: Vivek Gautam Cc: Simon Glass Cc: Minkyu Kang Cc: Dan Murphy Cc: Marek Vasut --- include/usb.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/usb.h b/include/usb.h index 60db897..a96ec23 100644 --- a/include/usb.h +++ b/include/usb.h @@ -125,6 +125,8 @@ struct usb_device { struct usb_device *children[USB_MAXCHILDREN]; void *controller; /* hardware controller private data */ + /* slot_id - for xHCI enabled devices */ + unsigned int slot_id; }; /********************************************************************** @@ -138,7 +140,7 @@ struct usb_device { defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \ defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X) || \ defined(CONFIG_USB_MUSB_DSPS) || defined(CONFIG_USB_MUSB_AM35X) || \ - defined(CONFIG_USB_MUSB_OMAP2PLUS) + defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined(CONFIG_USB_XHCI) int usb_lowlevel_init(int index, void **controller); int usb_lowlevel_stop(int index); @@ -338,6 +340,10 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate); #define usb_pipecontrol(pipe) (usb_pipetype((pipe)) == PIPE_CONTROL) #define usb_pipebulk(pipe) (usb_pipetype((pipe)) == PIPE_BULK) +#define usb_pipe_ep_index(pipe) \ + usb_pipecontrol(pipe) ? (usb_pipeendpoint(pipe) * 2) : \ + ((usb_pipeendpoint(pipe) * 2) - \ + (usb_pipein(pipe) ? 0 : 1)) /************************************************************************* * Hub Stuff @@ -382,5 +388,6 @@ struct usb_device *usb_alloc_new_device(void *controller); int usb_new_device(struct usb_device *dev); void usb_free_device(void); +int usb_alloc_device(struct usb_device *dev); #endif /*_USB_H_ */ -- cgit v1.1 From 13194f3b5f51d104bdfdd7ff5a7556136b6dc35c Mon Sep 17 00:00:00 2001 From: Vivek Gautam Date: Sat, 14 Sep 2013 14:02:46 +0530 Subject: USB: XHCI: Add xHCI host controller support for Exynos5 This adds driver layer for xHCI controller in Samsung's exynos5 soc. This interacts with xHCI host controller stack. Signed-off-by: Vikas C Sajjan Signed-off-by: Vivek Gautam Cc: Julius Werner Cc: Simon Glass Cc: Minkyu Kang Cc: Dan Murphy Cc: Marek Vasut --- include/linux/usb/dwc3.h | 188 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 include/linux/usb/dwc3.h (limited to 'include') diff --git a/include/linux/usb/dwc3.h b/include/linux/usb/dwc3.h new file mode 100644 index 0000000..97d179a --- /dev/null +++ b/include/linux/usb/dwc3.h @@ -0,0 +1,188 @@ +/* include/linux/usb/dwc3.h + * + * Copyright (c) 2012 Samsung Electronics Co. Ltd + * + * Designware SuperSpeed USB 3.0 DRD Controller global and OTG registers + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __DWC3_H_ +#define __DWC3_H_ + +/* Global constants */ +#define DWC3_ENDPOINTS_NUM 32 + +#define DWC3_EVENT_BUFFERS_SIZE PAGE_SIZE +#define DWC3_EVENT_TYPE_MASK 0xfe + +#define DWC3_EVENT_TYPE_DEV 0 +#define DWC3_EVENT_TYPE_CARKIT 3 +#define DWC3_EVENT_TYPE_I2C 4 + +#define DWC3_DEVICE_EVENT_DISCONNECT 0 +#define DWC3_DEVICE_EVENT_RESET 1 +#define DWC3_DEVICE_EVENT_CONNECT_DONE 2 +#define DWC3_DEVICE_EVENT_LINK_STATUS_CHANGE 3 +#define DWC3_DEVICE_EVENT_WAKEUP 4 +#define DWC3_DEVICE_EVENT_EOPF 6 +#define DWC3_DEVICE_EVENT_SOF 7 +#define DWC3_DEVICE_EVENT_ERRATIC_ERROR 9 +#define DWC3_DEVICE_EVENT_CMD_CMPL 10 +#define DWC3_DEVICE_EVENT_OVERFLOW 11 + +#define DWC3_GEVNTCOUNT_MASK 0xfffc +#define DWC3_GSNPSID_MASK 0xffff0000 +#define DWC3_GSNPSID_SHIFT 16 +#define DWC3_GSNPSREV_MASK 0xffff + +#define DWC3_REVISION_MASK 0xffff + +#define DWC3_REG_OFFSET 0xC100 + +struct g_event_buffer { + u64 g_evntadr; + u32 g_evntsiz; + u32 g_evntcount; +}; + +struct d_physical_endpoint { + u32 d_depcmdpar2; + u32 d_depcmdpar1; + u32 d_depcmdpar0; + u32 d_depcmd; +}; + +struct dwc3 { /* offset: 0xC100 */ + u32 g_sbuscfg0; + u32 g_sbuscfg1; + u32 g_txthrcfg; + u32 g_rxthrcfg; + u32 g_ctl; + + u32 reserved1; + + u32 g_sts; + + u32 reserved2; + + u32 g_snpsid; + u32 g_gpio; + u32 g_uid; + u32 g_uctl; + u64 g_buserraddr; + u64 g_prtbimap; + + u32 g_hwparams0; + u32 g_hwparams1; + u32 g_hwparams2; + u32 g_hwparams3; + u32 g_hwparams4; + u32 g_hwparams5; + u32 g_hwparams6; + u32 g_hwparams7; + + u32 g_dbgfifospace; + u32 g_dbgltssm; + u32 g_dbglnmcc; + u32 g_dbgbmu; + u32 g_dbglspmux; + u32 g_dbglsp; + u32 g_dbgepinfo0; + u32 g_dbgepinfo1; + + u64 g_prtbimap_hs; + u64 g_prtbimap_fs; + + u32 reserved3[28]; + + u32 g_usb2phycfg[16]; + u32 g_usb2i2cctl[16]; + u32 g_usb2phyacc[16]; + u32 g_usb3pipectl[16]; + + u32 g_txfifosiz[32]; + u32 g_rxfifosiz[32]; + + struct g_event_buffer g_evnt_buf[32]; + + u32 g_hwparams8; + + u32 reserved4[63]; + + u32 d_cfg; + u32 d_ctl; + u32 d_evten; + u32 d_sts; + u32 d_gcmdpar; + u32 d_gcmd; + + u32 reserved5[2]; + + u32 d_alepena; + + u32 reserved6[55]; + + struct d_physical_endpoint d_phy_ep_cmd[32]; + + u32 reserved7[128]; + + u32 o_cfg; + u32 o_ctl; + u32 o_evt; + u32 o_evten; + u32 o_sts; + + u32 reserved8[3]; + + u32 adp_cfg; + u32 adp_ctl; + u32 adp_evt; + u32 adp_evten; + + u32 bc_cfg; + + u32 reserved9; + + u32 bc_evt; + u32 bc_evten; +}; + +/* Global Configuration Register */ +#define DWC3_GCTL_PWRDNSCALE(n) ((n) << 19) +#define DWC3_GCTL_U2RSTECN (1 << 16) +#define DWC3_GCTL_RAMCLKSEL(x) \ + (((x) & DWC3_GCTL_CLK_MASK) << 6) +#define DWC3_GCTL_CLK_BUS (0) +#define DWC3_GCTL_CLK_PIPE (1) +#define DWC3_GCTL_CLK_PIPEHALF (2) +#define DWC3_GCTL_CLK_MASK (3) +#define DWC3_GCTL_PRTCAP(n) (((n) & (3 << 12)) >> 12) +#define DWC3_GCTL_PRTCAPDIR(n) ((n) << 12) +#define DWC3_GCTL_PRTCAP_HOST 1 +#define DWC3_GCTL_PRTCAP_DEVICE 2 +#define DWC3_GCTL_PRTCAP_OTG 3 +#define DWC3_GCTL_CORESOFTRESET (1 << 11) +#define DWC3_GCTL_SCALEDOWN(n) ((n) << 4) +#define DWC3_GCTL_SCALEDOWN_MASK DWC3_GCTL_SCALEDOWN(3) +#define DWC3_GCTL_DISSCRAMBLE (1 << 3) +#define DWC3_GCTL_DSBLCLKGTNG (1 << 0) + +/* Global HWPARAMS1 Register */ +#define DWC3_GHWPARAMS1_EN_PWROPT(n) (((n) & (3 << 24)) >> 24) +#define DWC3_GHWPARAMS1_EN_PWROPT_NO 0 +#define DWC3_GHWPARAMS1_EN_PWROPT_CLK 1 + +/* Global USB2 PHY Configuration Register */ +#define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31) +#define DWC3_GUSB2PHYCFG_SUSPHY (1 << 6) + +/* Global USB3 PIPE Control Register */ +#define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 << 31) +#define DWC3_GUSB3PIPECTL_SUSPHY (1 << 17) + +/* Global TX Fifo Size Register */ +#define DWC3_GTXFIFOSIZ_TXFDEF(n) ((n) & 0xffff) +#define DWC3_GTXFIFOSIZ_TXFSTADDR(n) ((n) & 0xffff0000) + +#endif /* __DWC3_H_ */ -- cgit v1.1 From 108b85be25e4a87d59f762b5e6cca83313ecc9e8 Mon Sep 17 00:00:00 2001 From: Vivek Gautam Date: Sat, 14 Sep 2013 14:02:48 +0530 Subject: exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI Adding required compatible string for xHCI host controller as well as USB 3.0 PHY to enable dt support for usb 3.0 on exynos5. Signed-off-by: Vivek Gautam Cc: Julius Werner Cc: Simon Glass Cc: Minkyu Kang Cc: Dan Murphy Cc: Marek Vasut --- include/fdtdec.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/fdtdec.h b/include/fdtdec.h index 6bf83bf..433d6a7 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -73,7 +73,9 @@ enum fdt_compat_id { COMPAT_GOOGLE_CROS_EC, /* Google CROS_EC Protocol */ COMPAT_GOOGLE_CROS_EC_KEYB, /* Google CROS_EC Keyboard */ COMPAT_SAMSUNG_EXYNOS_EHCI, /* Exynos EHCI controller */ + COMPAT_SAMSUNG_EXYNOS5_XHCI, /* Exynos5 XHCI controller */ COMPAT_SAMSUNG_EXYNOS_USB_PHY, /* Exynos phy controller for usb2.0 */ + COMPAT_SAMSUNG_EXYNOS5_USB3_PHY,/* Exynos phy controller for usb3.0 */ COMPAT_SAMSUNG_EXYNOS_TMU, /* Exynos TMU */ COMPAT_SAMSUNG_EXYNOS_FIMD, /* Exynos Display controller */ COMPAT_SAMSUNG_EXYNOS5_DP, /* Exynos Display port controller */ -- cgit v1.1 From a6c86decbb27e3d1e64af222d3179a88d0ea0a0d Mon Sep 17 00:00:00 2001 From: Vivek Gautam Date: Sat, 14 Sep 2013 14:02:50 +0530 Subject: config: arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE XHCI stack driver needs this to align buffers to CacheLine boundary. So define the same to be '64' Signed-off-by: Vivek Gautam Cc: Julius Werner Cc: Simon Glass Cc: Minkyu Kang Cc: Dan Murphy Cc: Marek Vasut --- include/configs/exynos5250-dt.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h index 8c21909..c9c19a7 100644 --- a/include/configs/exynos5250-dt.h +++ b/include/configs/exynos5250-dt.h @@ -37,6 +37,8 @@ /* Keep L2 Cache Disabled */ #define CONFIG_SYS_DCACHE_OFF +#define CONFIG_SYS_CACHELINE_SIZE 64 + /* Enable ACE acceleration for SHA1 and SHA256 */ #define CONFIG_EXYNOS_ACE_SHA #define CONFIG_SHA_HW_ACCEL -- cgit v1.1 From 8f999f0cbcd4802095d7f812871661a3e7f479d7 Mon Sep 17 00:00:00 2001 From: Vivek Gautam Date: Sat, 14 Sep 2013 14:02:51 +0530 Subject: temp: config: exynos5250: Enable xHCI support for Exynos5 This enables support for xHCI host controller on Exynos5 and further disables EHCI support, to make sure only one host controller is enabled at a time, since right now using two controllers at a time is not possible with current usb core infrastructure. Anyone who wants to enable EHCI support again needs to enable CONFIG_USB_EHCI, CONFIG_USB_EHCI_EXYNOS once again in exynos5-dt config. Signed-off-by: Vikas C Sajjan Signed-off-by: Vivek Gautam Cc: Julius Werner Cc: Simon Glass Cc: Minkyu Kang Cc: Dan Murphy Cc: Marek Vasut --- include/configs/exynos5250-dt.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h index c9c19a7..8c07d8f 100644 --- a/include/configs/exynos5250-dt.h +++ b/include/configs/exynos5250-dt.h @@ -134,8 +134,9 @@ /* USB */ #define CONFIG_CMD_USB -#define CONFIG_USB_EHCI -#define CONFIG_USB_EHCI_EXYNOS +#define CONFIG_USB_XHCI +#define CONFIG_USB_XHCI_EXYNOS +#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2 #define CONFIG_USB_STORAGE /* USB boot mode */ -- cgit v1.1 From 1bd435bc70a03f150900be4ac70a7bc8bfa4b438 Mon Sep 17 00:00:00 2001 From: Dan Murphy Date: Mon, 26 Aug 2013 08:54:49 -0500 Subject: ARM: OMAP5: Power: Add new function to turn on SMPS10 Add new functionality to turn on SMPS10 regulator. This supplies the VBUS to devices connected to the USB host ports Signed-off-by: Dan Murphy --- include/palmas.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/palmas.h b/include/palmas.h index f74f08e..eaf3670 100644 --- a/include/palmas.h +++ b/include/palmas.h @@ -31,6 +31,7 @@ /* LDOUSB control/voltage */ #define LDOUSB_CTRL 0x64 #define LDOUSB_VOLTAGE 0x65 +#define LDO_CTRL 0x6a /* Control of 32 kHz audio clock */ #define CLK32KGAUDIO_CTRL 0xd5 @@ -62,6 +63,10 @@ #define SMPS9_CTRL 0x38 #define SMPS9_VOLTAGE 0x3b +/* SMPS10_CTRL */ +#define SMPS10_CTRL 0x3c +#define SMPS10_MODE_ACTIVE_D 0x0d + /* Bit field definitions for SMPSx_CTRL */ #define SMPS_MODE_ACT_AUTO 1 #define SMPS_MODE_ACT_ECO 2 @@ -114,5 +119,6 @@ int palmas_mmc1_poweron_ldo(void); int twl603x_mmc1_set_ldo9(u8 vsel); int twl603x_audio_power(u8 on); int twl603x_enable_bb_charge(u8 bb_fields); +int palmas_enable_ss_ldo(void); #endif /* PALMAS_H */ -- cgit v1.1 From f3d7cff55951e0b47bad150bf5c329bd577e2ce5 Mon Sep 17 00:00:00 2001 From: Troy Kisky Date: Wed, 25 Sep 2013 18:41:18 -0700 Subject: nitrogen6x: add CONFIG_MV_UDC Also, add other USB related config items. Signed-off-by: Troy Kisky --- include/configs/nitrogen6x.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h index 3454b86..065dc97 100644 --- a/include/configs/nitrogen6x.h +++ b/include/configs/nitrogen6x.h @@ -30,6 +30,12 @@ #define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_MISC_INIT_R #define CONFIG_MXC_GPIO +#define CONFIG_MV_UDC +#define CONFIG_USBD_HS +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_ETHER +#define CONFIG_USB_ETH_CDC +#define CONFIG_NETCONSOLE #define CONFIG_CMD_FUSE #ifdef CONFIG_CMD_FUSE -- cgit v1.1 From 16297cfb2a20c9d89834cd9e31edac5184a777a1 Mon Sep 17 00:00:00 2001 From: Mateusz Zalega Date: Fri, 4 Oct 2013 19:22:26 +0200 Subject: usb: new board-specific USB init interface This commit unifies board-specific USB initialization implementations under one symbol (usb_board_init), declaration of which is available in usb.h. New API allows selective initialization of USB controllers whenever needed. Signed-off-by: Mateusz Zalega Signed-off-by: Kyungmin Park Reviewed-by: Lukasz Majewski Cc: Marek Vasut Cc: Lukasz Majewski --- include/g_dnl.h | 2 -- include/usb.h | 30 ++++++++++++++++++++++++++++-- include/usb_mass_storage.h | 13 +++++-------- 3 files changed, 33 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/g_dnl.h b/include/g_dnl.h index 2b2f11a..b6c4dd4 100644 --- a/include/g_dnl.h +++ b/include/g_dnl.h @@ -14,6 +14,4 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *); int g_dnl_register(const char *s); void g_dnl_unregister(void); -/* USB initialization declaration - board specific */ -void board_usb_init(void); #endif /* __G_DOWNLOAD_H_ */ diff --git a/include/usb.h b/include/usb.h index a96ec23..17fb68c 100644 --- a/include/usb.h +++ b/include/usb.h @@ -167,10 +167,36 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, extern void udc_disconnect(void); -#else -#error USB Lowlevel not defined #endif +/* + * You can initialize platform's USB host or device + * ports by passing this enum as an argument to + * board_usb_init(). + */ +enum board_usb_init_type { + USB_INIT_HOST, + USB_INIT_DEVICE +}; + +/* + * board-specific hardware initialization, called by + * usb drivers and u-boot commands + * + * @param index USB controller number + * @param init initializes controller as USB host or device + */ +int board_usb_init(int index, enum board_usb_init_type init); + +/* + * can be used to clean up after failed USB initialization attempt + * vide: board_usb_init() + * + * @param index USB controller number for selective cleanup + * @param init board_usb_init_type passed to board_usb_init() + */ +int board_usb_cleanup(int index, enum board_usb_init_type init); + #ifdef CONFIG_USB_STORAGE #define USB_MAX_STOR_DEV 5 diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h index e08deb4..13f535c 100644 --- a/include/usb_mass_storage.h +++ b/include/usb_mass_storage.h @@ -31,14 +31,11 @@ struct ums_board_info { struct ums_device ums_dev; }; -extern void board_usb_init(void); - -extern int fsg_init(struct ums_board_info *); -extern void fsg_cleanup(void); -extern struct ums_board_info *board_ums_init(unsigned int, - unsigned int, unsigned int); -extern int usb_gadget_handle_interrupts(void); -extern int fsg_main_thread(void *); +int fsg_init(struct ums_board_info *); +void fsg_cleanup(void); +struct ums_board_info *board_ums_init(unsigned int, unsigned int, + unsigned int); +int fsg_main_thread(void *); #ifdef CONFIG_USB_GADGET_MASS_STORAGE int fsg_add(struct usb_configuration *c); -- cgit v1.1 From fed936ed8004dd4972777aa29d882b7e88c6da7b Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Tue, 8 Oct 2013 14:30:38 +0200 Subject: dfu:core: Find DFU alt setting number by passing its name New function - dfu_get_alt() - has been added to dfu core. If present, it returns alt setting's number corresponding to passed name. Signed-off-by: Lukasz Majewski --- include/dfu.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/dfu.h b/include/dfu.h index b2ecf1b..b144255 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -126,6 +126,7 @@ const char *dfu_get_layout(enum dfu_layout l); struct dfu_entity *dfu_get_entity(int alt); char *dfu_extract_token(char** e, int *n); void dfu_trigger_reset(void); +int dfu_get_alt(char *name); bool dfu_reset(void); int dfu_init_env_entities(char *interface, int dev); -- cgit v1.1 From d42782631d59ea12251629bb827f725ef4dfddf6 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Tue, 8 Oct 2013 14:30:39 +0200 Subject: dfu:core: Export dfu_{get|free}_buf functions Define the dfu_get_buf() and dfu_free_buf() as global functions. They are necessary for zero copy buffer management, when DFU backend is used for storing data. Signed-off-by: Lukasz Majewski --- include/dfu.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/dfu.h b/include/dfu.h index b144255..cc14044 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -129,6 +129,8 @@ void dfu_trigger_reset(void); int dfu_get_alt(char *name); bool dfu_reset(void); int dfu_init_env_entities(char *interface, int dev); +unsigned char *dfu_get_buf(void); +unsigned char *dfu_free_buf(void); int dfu_read(struct dfu_entity *de, void *buf, int size, int blk_seq_num); int dfu_write(struct dfu_entity *de, void *buf, int size, int blk_seq_num); -- cgit v1.1 From d6eae7b0b172b3ef31a3f816ce946857f382ac4e Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Tue, 8 Oct 2013 14:30:41 +0200 Subject: usb:g_dnl: Add name parameter to g_dnl_bind_fixup function New parameter, namely *name has been added to g_dnl_bind_fixup(). It is necessary (for compatibility reasons) to assign new USB idProduct and idVendor for different usb functions. Signed-off-by: Lukasz Majewski Cc: Marek Vasut --- include/g_dnl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/g_dnl.h b/include/g_dnl.h index b6c4dd4..de669fb 100644 --- a/include/g_dnl.h +++ b/include/g_dnl.h @@ -10,7 +10,7 @@ #include #include -int g_dnl_bind_fixup(struct usb_device_descriptor *); +int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *); int g_dnl_register(const char *s); void g_dnl_unregister(void); -- cgit v1.1 From c527937796cd18966e6c0bfcf0fa0483feada87d Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Tue, 8 Oct 2013 14:30:42 +0200 Subject: usb:g_dnl:f_thor: USB download function to support TIZEN's THOR protocol Implementation of USB download function which supports THOR protocol. Signed-off-by: Lukasz Majewski Cc: Marek Vasut --- include/thor.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 include/thor.h (limited to 'include') diff --git a/include/thor.h b/include/thor.h new file mode 100644 index 0000000..afeade4 --- /dev/null +++ b/include/thor.h @@ -0,0 +1,27 @@ +/* + * thor.h -- USB THOR Downloader protocol + * + * Copyright (C) 2013 Samsung Electronics + * Lukasz Majewski + * + * SPDX-License-Identifier: GPL-2.0+ + * + */ + +#ifndef __THOR_H_ +#define __THOR_H_ + +#include + +int thor_handle(void); +int thor_init(void); + +#ifdef CONFIG_THOR_FUNCTION +int thor_add(struct usb_configuration *c); +#else +int thor_add(struct usb_configuration *c) +{ + return 0; +} +#endif +#endif /* __THOR_H_ */ -- cgit v1.1 From e96751dad36ea220d2e7771435593b9301bdfa05 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Tue, 8 Oct 2013 14:30:46 +0200 Subject: trats: Update TRATS config to support TIZEN download A set of environment variables needs to be updated to provide support for TIZEN download command (tizendown). Since DFU is used as a flashing backend, it is also necessary to extent malloc pool size for DFU buffer allocation. Moreover, for compatibility reasons (Win vs. Lin) new USB idProduct number for download gadget had to be added. Signed-off-by: Lukasz Majewski Cc: Marek Vasut --- include/configs/trats.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/configs/trats.h b/include/configs/trats.h index 24ea06b..f5bb6aa 100644 --- a/include/configs/trats.h +++ b/include/configs/trats.h @@ -49,8 +49,9 @@ #define MACH_TYPE_TRATS 3928 #define CONFIG_MACH_TYPE MACH_TYPE_TRATS +#include /* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (16 << 20)) +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (80 * SZ_1M)) /* select serial console configuration */ #define CONFIG_SERIAL2 /* use SERIAL 2 */ @@ -91,12 +92,20 @@ /* USB Composite download gadget - g_dnl */ #define CONFIG_USBDOWNLOAD_GADGET + +/* TIZEN THOR downloader support */ +#define CONFIG_CMD_THOR_DOWNLOAD +#define CONFIG_THOR_FUNCTION + +#define CONFIG_SYS_DFU_DATA_BUF_SIZE SZ_32M #define CONFIG_DFU_FUNCTION #define CONFIG_DFU_MMC /* USB Samsung's IDs */ #define CONFIG_G_DNL_VENDOR_NUM 0x04E8 #define CONFIG_G_DNL_PRODUCT_NUM 0x6601 +#define CONFIG_G_DNL_THOR_VENDOR_NUM CONFIG_G_DNL_VENDOR_NUM +#define CONFIG_G_DNL_THOR_PRODUCT_NUM 0x685D #define CONFIG_G_DNL_MANUFACTURER "Samsung" #define CONFIG_BOOTDELAY 1 @@ -131,7 +140,8 @@ #define CONFIG_DFU_ALT \ "u-boot mmc 80 400;" \ "uImage ext4 0 2;" \ - "exynos4210-trats.dtb ext4 0 2\0" + "exynos4210-trats.dtb ext4 0 2;" \ + ""PARTS_ROOT" part 0 5\0" #define CONFIG_ENV_OVERWRITE #define CONFIG_SYS_CONSOLE_INFO_QUIET -- cgit v1.1 From 41b667b834aaf550faabbf1d222a456cb4fc97ec Mon Sep 17 00:00:00 2001 From: Dan Murphy Date: Fri, 11 Oct 2013 12:28:14 -0500 Subject: usb: omap: Move the xhci-omap header file to common location Moving the xhci-omap header to a more global location so that other code can reference this code. Signed-off-by: Dan Murphy --- include/linux/usb/xhci-omap.h | 124 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 include/linux/usb/xhci-omap.h (limited to 'include') diff --git a/include/linux/usb/xhci-omap.h b/include/linux/usb/xhci-omap.h new file mode 100644 index 0000000..b557a43 --- /dev/null +++ b/include/linux/usb/xhci-omap.h @@ -0,0 +1,124 @@ +/* + * (C) Copyright 2013 + * Texas Instruments Inc, + * + * Author: Dan Murphy + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef _ASM_ARCH_XHCI_OMAP_H_ +#define _ASM_ARCH_XHCI_OMAP_H_ + +#define OMAP_XHCI_BASE 0x4a030000 +#define OMAP_OCP1_SCP_BASE 0x4a084c00 +#define OMAP_OTG_WRAPPER_BASE 0x4A020000 + +/* Phy register MACRO definitions */ +#define PLL_REGM_MASK 0x001FFE00 +#define PLL_REGM_SHIFT 0x9 +#define PLL_REGM_F_MASK 0x0003FFFF +#define PLL_REGM_F_SHIFT 0x0 +#define PLL_REGN_MASK 0x000001FE +#define PLL_REGN_SHIFT 0x1 +#define PLL_SELFREQDCO_MASK 0x0000000E +#define PLL_SELFREQDCO_SHIFT 0x1 +#define PLL_SD_MASK 0x0003FC00 +#define PLL_SD_SHIFT 0x9 +#define SET_PLL_GO 0x1 +#define PLL_TICOPWDN 0x10000 +#define PLL_LOCK 0x2 +#define PLL_IDLE 0x1 + +#define USB3_PWRCTL_CLK_CMD_MASK 0x3FE000 +#define USB3_PWRCTL_CLK_FREQ_MASK 0xFFC +#define USB3_PHY_PARTIAL_RX_POWERON (1 << 6) +#define USB3_PHY_RX_POWERON (1 << 14) +#define USB3_PHY_TX_POWERON (1 << 15) +#define USB3_PHY_TX_RX_POWERON (USB3_PHY_RX_POWERON | USB3_PHY_TX_POWERON) +#define USB3_PWRCTL_CLK_CMD_SHIFT 14 +#define USB3_PWRCTL_CLK_FREQ_SHIFT 22 + +/* USBOTGSS_WRAPPER definitions */ +#define USBOTGSS_WRAPRESET (1 << 17) +#define USBOTGSS_DMADISABLE (1 << 16) +#define USBOTGSS_STANDBYMODE_NO_STANDBY (1 << 4) +#define USBOTGSS_STANDBYMODE_SMRT (1 << 5) +#define USBOTGSS_STANDBYMODE_SMRT_WKUP (0x3 << 4) +#define USBOTGSS_IDLEMODE_NOIDLE (1 << 2) +#define USBOTGSS_IDLEMODE_SMRT (1 << 3) +#define USBOTGSS_IDLEMODE_SMRT_WKUP (0x3 << 2) + +/* USBOTGSS_IRQENABLE_SET_0 bit */ +#define USBOTGSS_COREIRQ_EN (1 << 0) + +/* USBOTGSS_IRQENABLE_SET_1 bits */ +#define USBOTGSS_IRQ_SET_1_IDPULLUP_FALL_EN (1 << 0) +#define USBOTGSS_IRQ_SET_1_DISCHRGVBUS_FALL_EN (1 << 3) +#define USBOTGSS_IRQ_SET_1_CHRGVBUS_FALL_EN (1 << 4) +#define USBOTGSS_IRQ_SET_1_DRVVBUS_FALL_EN (1 << 5) +#define USBOTGSS_IRQ_SET_1_IDPULLUP_RISE_EN (1 << 8) +#define USBOTGSS_IRQ_SET_1_DISCHRGVBUS_RISE_EN (1 << 11) +#define USBOTGSS_IRQ_SET_1_CHRGVBUS_RISE_EN (1 << 12) +#define USBOTGSS_IRQ_SET_1_DRVVBUS_RISE_EN (1 << 13) +#define USBOTGSS_IRQ_SET_1_OEVT_EN (1 << 16) +#define USBOTGSS_IRQ_SET_1_DMADISABLECLR_EN (1 << 17) + +/* + * USBOTGSS_WRAPPER registers + */ +struct omap_dwc_wrapper { + u32 revision; + + u32 reserve_1[3]; + + u32 sysconfig; /* offset of 0x10 */ + + u32 reserve_2[3]; + u16 reserve_3; + + u32 irqstatus_raw_0; /* offset of 0x24 */ + u32 irqstatus_0; + u32 irqenable_set_0; + u32 irqenable_clr_0; + + u32 irqstatus_raw_1; /* offset of 0x34 */ + u32 irqstatus_1; + u32 irqenable_set_1; + u32 irqenable_clr_1; + + u32 reserve_4[15]; + + u32 utmi_otg_ctrl; /* offset of 0x80 */ + u32 utmi_otg_status; + + u32 reserve_5[30]; + + u32 mram_offset; /* offset of 0x100 */ + u32 fladj; + u32 dbg_config; + u32 dbg_data; + u32 dev_ebc_en; +}; + +/* XHCI PHY register structure */ +struct omap_usb3_phy { + u32 reserve1; + u32 pll_status; + u32 pll_go; + u32 pll_config_1; + u32 pll_config_2; + u32 pll_config_3; + u32 pll_ssc_config_1; + u32 pll_ssc_config_2; + u32 pll_config_4; +}; + +struct omap_xhci { + struct omap_dwc_wrapper *otg_wrapper; + struct omap_usb3_phy *usb3_phy; + struct xhci_hccr *hcd; + struct dwc3 *dwc3_reg; +}; + +#endif /* _ASM_ARCH_XHCI_OMAP_H_ */ -- cgit v1.1 From ba55453ccf6d82c46b9f3eef5b958aac58adb6fb Mon Sep 17 00:00:00 2001 From: Dan Murphy Date: Fri, 11 Oct 2013 12:28:16 -0500 Subject: usb: omap: Move the usb phy code to the usb/phy directory Moving the usb/phy code from xhci-omap to the usb/phy directory and moving the associated phy code over to the new file. Newer TI processors adding xHCI support will have different PHY configurations so therefore abstracting this code away will prevent messing around with the xhci-omap file itself. Signed-off-by: Dan Murphy --- include/linux/usb/xhci-omap.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/linux/usb/xhci-omap.h b/include/linux/usb/xhci-omap.h index b557a43..a73c0f9 100644 --- a/include/linux/usb/xhci-omap.h +++ b/include/linux/usb/xhci-omap.h @@ -121,4 +121,10 @@ struct omap_xhci { struct dwc3 *dwc3_reg; }; +/* USB PHY functions */ +void omap_enable_phy_clocks(struct omap_xhci *omap); +void omap_usb3_phy_init(struct omap_usb3_phy *phy_regs); +void omap_reset_usb_phy(struct dwc3 *dwc3_reg); +void usb3_phy_power(int on); + #endif /* _ASM_ARCH_XHCI_OMAP_H_ */ -- cgit v1.1 From 834e91af432479e3808e9cbd1d38199f724fc5aa Mon Sep 17 00:00:00 2001 From: Dan Murphy Date: Fri, 11 Oct 2013 12:28:17 -0500 Subject: usb: dra7xx: Add support for dra7xx xhci USB host Add the support for the dra7xx xhci usb host. dra7xx does not contain an EHCI controller so the headers can be removed from the board file. The xHCI host on dra7xx is connected to a usb2 phy so need to add support to enable those clocks. Signed-off-by: Dan Murphy --- include/configs/dra7xx_evm.h | 11 +++++++++++ include/linux/usb/xhci-omap.h | 12 +++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index 3a4c06b..a9f39f2 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -67,4 +67,15 @@ #define CONFIG_SPL_SPI_CS 0 #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 +/* USB xHCI HOST */ +#define CONFIG_CMD_USB +#define CONFIG_USB_HOST +#define CONFIG_USB_XHCI +#define CONFIG_USB_XHCI_OMAP +#define CONFIG_USB_STORAGE +#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2 + +#define CONFIG_OMAP_USB_PHY +#define CONFIG_OMAP_USB2PHY2_HOST + #endif /* __CONFIG_DRA7XX_EVM_H */ diff --git a/include/linux/usb/xhci-omap.h b/include/linux/usb/xhci-omap.h index a73c0f9..c3fcc03 100644 --- a/include/linux/usb/xhci-omap.h +++ b/include/linux/usb/xhci-omap.h @@ -10,9 +10,16 @@ #ifndef _ASM_ARCH_XHCI_OMAP_H_ #define _ASM_ARCH_XHCI_OMAP_H_ +#ifdef CONFIG_DRA7XX +#define OMAP_XHCI_BASE 0x488d0000 +#define OMAP_OCP1_SCP_BASE 0x4A081000 +#define OMAP_OTG_WRAPPER_BASE 0x488c0000 +#else +/* Default to the OMAP5 XHCI defines */ #define OMAP_XHCI_BASE 0x4a030000 #define OMAP_OCP1_SCP_BASE 0x4a084c00 #define OMAP_OTG_WRAPPER_BASE 0x4A020000 +#endif /* Phy register MACRO definitions */ #define PLL_REGM_MASK 0x001FFE00 @@ -122,9 +129,8 @@ struct omap_xhci { }; /* USB PHY functions */ -void omap_enable_phy_clocks(struct omap_xhci *omap); -void omap_usb3_phy_init(struct omap_usb3_phy *phy_regs); +void omap_enable_phy(struct omap_xhci *omap); void omap_reset_usb_phy(struct dwc3 *dwc3_reg); -void usb3_phy_power(int on); +void usb_phy_power(int on); #endif /* _ASM_ARCH_XHCI_OMAP_H_ */ -- cgit v1.1 From 3d799c7f5e0dd2bea3f4ec839ad7692f7122d992 Mon Sep 17 00:00:00 2001 From: Dan Murphy Date: Fri, 11 Oct 2013 12:28:18 -0500 Subject: usb: am437x: Add support for am437x xhci USB host Add the support for the am437x xhci usb host. The xHCI host on AM437 is connected to a usb2 phy so need to add support to enable those clocks. Signed-off-by: Dan Murphy --- include/configs/am43xx_evm.h | 11 +++++++++++ include/linux/usb/xhci-omap.h | 4 ++++ 2 files changed, 15 insertions(+) (limited to 'include') diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h index 5c802a1..64c4811 100644 --- a/include/configs/am43xx_evm.h +++ b/include/configs/am43xx_evm.h @@ -24,6 +24,7 @@ #define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */ #define CONFIG_SYS_PROMPT "U-Boot# " #define CONFIG_SYS_NO_FLASH +#define CONFIG_SYS_CACHELINE_SIZE 32 #define CONFIG_OF_LIBFDT #define CONFIG_CMD_BOOTZ @@ -132,4 +133,14 @@ /* Unsupported features */ #undef CONFIG_USE_IRQ +#define CONFIG_CMD_USB +#define CONFIG_USB_HOST +#define CONFIG_USB_XHCI +#define CONFIG_USB_XHCI_OMAP +#define CONFIG_USB_STORAGE +#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2 + +#define CONFIG_OMAP_USB_PHY +#define CONFIG_AM437X_USB2PHY2_HOST + #endif /* __CONFIG_AM43XX_EVM_H */ diff --git a/include/linux/usb/xhci-omap.h b/include/linux/usb/xhci-omap.h index c3fcc03..82630ad 100644 --- a/include/linux/usb/xhci-omap.h +++ b/include/linux/usb/xhci-omap.h @@ -14,6 +14,10 @@ #define OMAP_XHCI_BASE 0x488d0000 #define OMAP_OCP1_SCP_BASE 0x4A081000 #define OMAP_OTG_WRAPPER_BASE 0x488c0000 +#elif defined CONFIG_AM43XX +#define OMAP_XHCI_BASE 0x483d0000 +#define OMAP_OCP1_SCP_BASE 0x483E8000 +#define OMAP_OTG_WRAPPER_BASE 0x483dc100 #else /* Default to the OMAP5 XHCI defines */ #define OMAP_XHCI_BASE 0x4a030000 -- cgit v1.1 From bba679144d25b91bcd7befff5a96728a30875f54 Mon Sep 17 00:00:00 2001 From: Troy Kisky Date: Thu, 10 Oct 2013 15:27:55 -0700 Subject: usb: rename board_usb_init_type to usb_init_type This will be used by usb_lowlevel_init so it will no longer be used by only board specific functions. Move definition of enum usb_init_type higher in file so that it will be available for usb_low_level_init. Signed-off-by: Troy Kisky --- include/usb.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/usb.h b/include/usb.h index 17fb68c..b4fea52 100644 --- a/include/usb.h +++ b/include/usb.h @@ -129,6 +129,16 @@ struct usb_device { unsigned int slot_id; }; +/* + * You can initialize platform's USB host or device + * ports by passing this enum as an argument to + * board_usb_init(). + */ +enum usb_init_type { + USB_INIT_HOST, + USB_INIT_DEVICE +}; + /********************************************************************** * this is how the lowlevel part communicate with the outer world */ @@ -170,32 +180,22 @@ extern void udc_disconnect(void); #endif /* - * You can initialize platform's USB host or device - * ports by passing this enum as an argument to - * board_usb_init(). - */ -enum board_usb_init_type { - USB_INIT_HOST, - USB_INIT_DEVICE -}; - -/* * board-specific hardware initialization, called by * usb drivers and u-boot commands * * @param index USB controller number * @param init initializes controller as USB host or device */ -int board_usb_init(int index, enum board_usb_init_type init); +int board_usb_init(int index, enum usb_init_type init); /* * can be used to clean up after failed USB initialization attempt * vide: board_usb_init() * * @param index USB controller number for selective cleanup - * @param init board_usb_init_type passed to board_usb_init() + * @param init usb_init_type passed to board_usb_init() */ -int board_usb_cleanup(int index, enum board_usb_init_type init); +int board_usb_cleanup(int index, enum usb_init_type init); #ifdef CONFIG_USB_STORAGE -- cgit v1.1 From 06d513ecb61a6711157707ebe10b968aacc0f2a8 Mon Sep 17 00:00:00 2001 From: Troy Kisky Date: Thu, 10 Oct 2013 15:27:56 -0700 Subject: usb: add enum usb_init_type parameter to usb_lowlevel_init This parameter will later be used to verify OTG ports. Signed-off-by: Troy Kisky --- include/usb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/usb.h b/include/usb.h index b4fea52..d9fedee 100644 --- a/include/usb.h +++ b/include/usb.h @@ -152,7 +152,7 @@ enum usb_init_type { defined(CONFIG_USB_MUSB_DSPS) || defined(CONFIG_USB_MUSB_AM35X) || \ defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined(CONFIG_USB_XHCI) -int usb_lowlevel_init(int index, void **controller); +int usb_lowlevel_init(int index, enum usb_init_type init, void **controller); int usb_lowlevel_stop(int index); int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, -- cgit v1.1 From d1a5286099a1ccb43fa8599e2c806ca039783e2f Mon Sep 17 00:00:00 2001 From: Troy Kisky Date: Thu, 10 Oct 2013 15:27:59 -0700 Subject: usb: ehci-mx6: add support for otg port Previously, only host1 was supported using an index of 0. Now, otg has index 0, host1 is 1, host2 is 2, host3 is 3. Since OTG requires usbmode to be set after reset, I added CONFIG_EHCI_HCD_INIT_AFTER_RESET to nitrogen6x.h and mx6qsabreauto.h. I also added a weak function board_ehci_power to handle turning power on/off for otg. Type is type of device connected (USB stick vs Host.) Init is type of device desired. Only power up port if type == init == USB_INIT_HOST. Only return error if type != init. Signed-off-by: Troy Kisky --- include/configs/mx6qsabreauto.h | 3 ++- include/configs/nitrogen6x.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/configs/mx6qsabreauto.h b/include/configs/mx6qsabreauto.h index 5530fc6..9e48a49 100644 --- a/include/configs/mx6qsabreauto.h +++ b/include/configs/mx6qsabreauto.h @@ -23,7 +23,8 @@ #define CONFIG_USB_STORAGE #define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_ASIX -#define CONFIG_MXC_USB_PORT 1 +#define CONFIG_USB_MAX_CONTROLLER_COUNT 2 +#define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */ #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) #define CONFIG_MXC_USB_FLAGS 0 diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h index 065dc97..a08eea6 100644 --- a/include/configs/nitrogen6x.h +++ b/include/configs/nitrogen6x.h @@ -125,7 +125,8 @@ #define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_ASIX #define CONFIG_USB_ETHER_SMSC95XX -#define CONFIG_MXC_USB_PORT 1 +#define CONFIG_USB_MAX_CONTROLLER_COUNT 2 +#define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */ #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) #define CONFIG_MXC_USB_FLAGS 0 -- cgit v1.1 From 0f740cb8e48eb7c90e7977def98601c929101446 Mon Sep 17 00:00:00 2001 From: Troy Kisky Date: Thu, 10 Oct 2013 15:28:03 -0700 Subject: usb: gadget: mv_udc: split mv_udc.h file Move defines only needed by mv_udc.c to a file in the same directory. This allows usbtty to compile for mv_udc, but it still doesn't link. Signed-off-by: Troy Kisky --- include/usb/mv_udc.h | 118 --------------------------------------------------- 1 file changed, 118 deletions(-) (limited to 'include') diff --git a/include/usb/mv_udc.h b/include/usb/mv_udc.h index c71516c..f6c7b5e 100644 --- a/include/usb/mv_udc.h +++ b/include/usb/mv_udc.h @@ -9,124 +9,6 @@ #ifndef __MV_UDC_H__ #define __MV_UDC_H__ -#include -#include -#include -#include - -#include "../../drivers/usb/host/ehci.h" - -#define NUM_ENDPOINTS 6 - -/* Endpoint parameters */ -#define MAX_ENDPOINTS 4 - #define EP_MAX_PACKET_SIZE 0x200 #define EP0_MAX_PACKET_SIZE 64 - -struct mv_udc { -#define MICRO_8FRAME 0x8 -#define USBCMD_ITC(x) ((((x) > 0xff) ? 0xff : x) << 16) -#define USBCMD_FS2 (1 << 15) -#define USBCMD_RST (1 << 1) -#define USBCMD_RUN (1) - u32 usbcmd; /* 0x140 */ -#define STS_SLI (1 << 8) -#define STS_URI (1 << 6) -#define STS_PCI (1 << 2) -#define STS_UEI (1 << 1) -#define STS_UI (1 << 0) - u32 usbsts; /* 0x144 */ - u32 pad1[3]; - u32 devaddr; /* 0x154 */ - u32 epinitaddr; /* 0x158 */ - u32 pad2[10]; -#define PTS_ENABLE 2 -#define PTS(x) (((x) & 0x3) << 30) -#define PFSC (1 << 24) - u32 portsc; /* 0x184 */ - u32 pad3[8]; -#define USBMODE_DEVICE 2 - u32 usbmode; /* 0x1a8 */ - u32 epstat; /* 0x1ac */ -#define EPT_TX(x) (1 << (((x) & 0xffff) + 16)) -#define EPT_RX(x) (1 << ((x) & 0xffff)) - u32 epprime; /* 0x1b0 */ - u32 epflush; /* 0x1b4 */ - u32 pad4; - u32 epcomp; /* 0x1bc */ -#define CTRL_TXE (1 << 23) -#define CTRL_TXR (1 << 22) -#define CTRL_RXE (1 << 7) -#define CTRL_RXR (1 << 6) -#define CTRL_TXT_BULK (2 << 18) -#define CTRL_RXT_BULK (2 << 2) - u32 epctrl[16]; /* 0x1c0 */ -}; - -struct mv_ep { - struct usb_ep ep; - struct list_head queue; - const struct usb_endpoint_descriptor *desc; - - struct usb_request req; - uint8_t *b_buf; - uint32_t b_len; - uint8_t b_fast[64] __aligned(ARCH_DMA_MINALIGN); -}; - -struct mv_drv { - struct usb_gadget gadget; - struct usb_gadget_driver *driver; - struct ehci_ctrl *ctrl; - struct ept_queue_head *epts; - struct ept_queue_item *items[2 * NUM_ENDPOINTS]; - uint8_t *items_mem; - struct mv_ep ep[NUM_ENDPOINTS]; -}; - -struct ept_queue_head { - unsigned config; - unsigned current; /* read-only */ - - unsigned next; - unsigned info; - unsigned page0; - unsigned page1; - unsigned page2; - unsigned page3; - unsigned page4; - unsigned reserved_0; - - unsigned char setup_data[8]; - - unsigned reserved_1; - unsigned reserved_2; - unsigned reserved_3; - unsigned reserved_4; -}; - -#define CONFIG_MAX_PKT(n) ((n) << 16) -#define CONFIG_ZLT (1 << 29) /* stop on zero-len xfer */ -#define CONFIG_IOS (1 << 15) /* IRQ on setup */ - -struct ept_queue_item { - unsigned next; - unsigned info; - unsigned page0; - unsigned page1; - unsigned page2; - unsigned page3; - unsigned page4; - unsigned reserved; -}; - -#define TERMINATE 1 -#define INFO_BYTES(n) ((n) << 16) -#define INFO_IOC (1 << 15) -#define INFO_ACTIVE (1 << 7) -#define INFO_HALTED (1 << 6) -#define INFO_BUFFER_ERROR (1 << 5) -#define INFO_TX_ERROR (1 << 3) - #endif /* __MV_UDC_H__ */ -- cgit v1.1 From 449697f14ebc9f7cb5bf15bbad0d46c6ca2c4979 Mon Sep 17 00:00:00 2001 From: Troy Kisky Date: Thu, 10 Oct 2013 15:28:04 -0700 Subject: usb: udc: add udc.h include file Move common definitions to udc.h This allows musb_udc.h to be removed as well. Signed-off-by: Troy Kisky --- include/usb/designware_udc.h | 31 -------------------------- include/usb/mpc8xx_udc.h | 19 +--------------- include/usb/musb_udc.h | 40 --------------------------------- include/usb/omap1510_udc.h | 31 +++++--------------------- include/usb/pxa27x_udc.h | 26 +--------------------- include/usb/udc.h | 53 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 61 insertions(+), 139 deletions(-) delete mode 100644 include/usb/musb_udc.h create mode 100644 include/usb/udc.h (limited to 'include') diff --git a/include/usb/designware_udc.h b/include/usb/designware_udc.h index 2e29a7e..2e1cdf1 100644 --- a/include/usb/designware_udc.h +++ b/include/usb/designware_udc.h @@ -174,19 +174,6 @@ struct udcfifo_regs { }; /* - * USBTTY definitions - */ -#define EP0_MAX_PACKET_SIZE 64 -#define UDC_INT_ENDPOINT 1 -#define UDC_INT_PACKET_SIZE 64 -#define UDC_OUT_ENDPOINT 2 -#define UDC_BULK_PACKET_SIZE 64 -#define UDC_BULK_HS_PACKET_SIZE 512 -#define UDC_IN_ENDPOINT 3 -#define UDC_OUT_PACKET_SIZE 64 -#define UDC_IN_PACKET_SIZE 64 - -/* * UDC endpoint definitions */ #define UDC_EP0 0 @@ -194,22 +181,4 @@ struct udcfifo_regs { #define UDC_EP2 2 #define UDC_EP3 3 -/* - * Function declarations - */ - -void udc_irq(void); - -void udc_set_nak(int epid); -void udc_unset_nak(int epid); -int udc_endpoint_write(struct usb_endpoint_instance *endpoint); -int udc_init(void); -void udc_enable(struct usb_device_instance *device); -void udc_disable(void); -void udc_connect(void); -void udc_disconnect(void); -void udc_startup_events(struct usb_device_instance *device); -void udc_setup_ep(struct usb_device_instance *device, unsigned int ep, - struct usb_endpoint_instance *endpoint); - #endif /* __DW_UDC_H */ diff --git a/include/usb/mpc8xx_udc.h b/include/usb/mpc8xx_udc.h index 475dd41..9906c75 100644 --- a/include/usb/mpc8xx_udc.h +++ b/include/usb/mpc8xx_udc.h @@ -111,11 +111,9 @@ /* UDC device defines */ #define EP0_MAX_PACKET_SIZE EP_MAX_PKT -#define UDC_OUT_ENDPOINT 0x02 + #define UDC_OUT_PACKET_SIZE EP_MIN_PACKET_SIZE -#define UDC_IN_ENDPOINT 0x03 #define UDC_IN_PACKET_SIZE EP_MIN_PACKET_SIZE -#define UDC_INT_ENDPOINT 0x01 #define UDC_INT_PACKET_SIZE UDC_IN_PACKET_SIZE #define UDC_BULK_PACKET_SIZE EP_MIN_PACKET_SIZE @@ -178,18 +176,3 @@ typedef enum mpc8xx_udc_state{ STATE_READY, }mpc8xx_udc_state_t; -/* Declarations */ -int udc_init(void); -void udc_irq(void); -int udc_endpoint_write(struct usb_endpoint_instance *endpoint); -void udc_setup_ep(struct usb_device_instance *device, unsigned int ep, - struct usb_endpoint_instance *endpoint); -void udc_connect(void); -void udc_disconnect(void); -void udc_enable(struct usb_device_instance *device); -void udc_disable(void); -void udc_startup_events(struct usb_device_instance *device); - -/* Flow control */ -void udc_set_nak(int epid); -void udc_unset_nak (int epid); diff --git a/include/usb/musb_udc.h b/include/usb/musb_udc.h deleted file mode 100644 index 3500c7a..0000000 --- a/include/usb/musb_udc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2009 Wind River Systems, Inc. - * Tom Rix - * - * SPDX-License-Identifier: GPL-2.0+ - */ -#ifndef __MUSB_UDC_H__ -#define __MUSB_UDC_H__ - -#include - -/* UDC level routines */ -void udc_irq(void); -void udc_set_nak(int ep_num); -void udc_unset_nak(int ep_num); -int udc_endpoint_write(struct usb_endpoint_instance *endpoint); -void udc_setup_ep(struct usb_device_instance *device, unsigned int id, - struct usb_endpoint_instance *endpoint); -void udc_connect(void); -void udc_disconnect(void); -void udc_enable(struct usb_device_instance *device); -void udc_disable(void); -void udc_startup_events(struct usb_device_instance *device); -int udc_init(void); - -/* usbtty */ -#ifdef CONFIG_USB_TTY - -#define EP0_MAX_PACKET_SIZE 64 /* MUSB_EP0_FIFOSIZE */ -#define UDC_INT_ENDPOINT 1 -#define UDC_INT_PACKET_SIZE 64 -#define UDC_OUT_ENDPOINT 2 -#define UDC_OUT_PACKET_SIZE 64 -#define UDC_IN_ENDPOINT 3 -#define UDC_IN_PACKET_SIZE 64 -#define UDC_BULK_PACKET_SIZE 64 - -#endif /* CONFIG_USB_TTY */ - -#endif /* __MUSB_UDC_H__ */ diff --git a/include/usb/omap1510_udc.h b/include/usb/omap1510_udc.h index ece0e95..adfbf54 100644 --- a/include/usb/omap1510_udc.h +++ b/include/usb/omap1510_udc.h @@ -162,32 +162,13 @@ #define UDC_VBUS_MODE (1 << 18) /* OMAP Endpoint parameters */ -#define EP0_MAX_PACKET_SIZE 64 -#define UDC_OUT_ENDPOINT 2 -#define UDC_OUT_PACKET_SIZE 64 -#define UDC_IN_ENDPOINT 1 -#define UDC_IN_PACKET_SIZE 64 -#define UDC_INT_ENDPOINT 5 +#define UDC_OUT_PACKET_SIZE 64 +#define UDC_IN_PACKET_SIZE 64 #define UDC_INT_PACKET_SIZE 16 -#define UDC_BULK_PACKET_SIZE 16 - -void udc_irq (void); -/* Flow control */ -void udc_set_nak(int epid); -void udc_unset_nak (int epid); - -/* Higher level functions for abstracting away from specific device */ -int udc_endpoint_write(struct usb_endpoint_instance *endpoint); - -int udc_init (void); +#define UDC_BULK_PACKET_SIZE 16 -void udc_enable(struct usb_device_instance *device); -void udc_disable(void); - -void udc_connect(void); -void udc_disconnect(void); - -void udc_startup_events(struct usb_device_instance *device); -void udc_setup_ep(struct usb_device_instance *device, unsigned int ep, struct usb_endpoint_instance *endpoint); +#define UDC_INT_ENDPOINT 5 +#define UDC_OUT_ENDPOINT 2 +#define UDC_IN_ENDPOINT 1 #endif diff --git a/include/usb/pxa27x_udc.h b/include/usb/pxa27x_udc.h index 7fdbe2a..7eaa000 100644 --- a/include/usb/pxa27x_udc.h +++ b/include/usb/pxa27x_udc.h @@ -22,35 +22,11 @@ /* Endpoint parameters */ #define MAX_ENDPOINTS 4 -#define EP_MAX_PACKET_SIZE 64 #define EP0_MAX_PACKET_SIZE 16 + #define UDC_OUT_ENDPOINT 0x02 -#define UDC_OUT_PACKET_SIZE EP_MAX_PACKET_SIZE #define UDC_IN_ENDPOINT 0x01 -#define UDC_IN_PACKET_SIZE EP_MAX_PACKET_SIZE #define UDC_INT_ENDPOINT 0x05 -#define UDC_INT_PACKET_SIZE EP_MAX_PACKET_SIZE -#define UDC_BULK_PACKET_SIZE EP_MAX_PACKET_SIZE - -void udc_irq(void); -/* Flow control */ -void udc_set_nak(int epid); -void udc_unset_nak(int epid); - -/* Higher level functions for abstracting away from specific device */ -int udc_endpoint_write(struct usb_endpoint_instance *endpoint); - -int udc_init(void); - -void udc_enable(struct usb_device_instance *device); -void udc_disable(void); - -void udc_connect(void); -void udc_disconnect(void); - -void udc_startup_events(struct usb_device_instance *device); -void udc_setup_ep(struct usb_device_instance *device, - unsigned int ep, struct usb_endpoint_instance *endpoint); #endif diff --git a/include/usb/udc.h b/include/usb/udc.h new file mode 100644 index 0000000..1f545ec --- /dev/null +++ b/include/usb/udc.h @@ -0,0 +1,53 @@ +/* + * SPDX-License-Identifier: GPL-2.0+ + */ +#ifndef USB_UDC_H +#define USB_UDC_H + +#ifndef EP0_MAX_PACKET_SIZE +#define EP0_MAX_PACKET_SIZE 64 +#endif + +#ifndef EP_MAX_PACKET_SIZE +#define EP_MAX_PACKET_SIZE 64 +#endif + +#if !defined(CONFIG_PPC) && !defined(CONFIG_OMAP1510) +/* omap1510_udc.h and mpc8xx_udc.h will set these values */ +#define UDC_OUT_PACKET_SIZE EP_MAX_PACKET_SIZE +#define UDC_IN_PACKET_SIZE EP_MAX_PACKET_SIZE +#define UDC_INT_PACKET_SIZE EP_MAX_PACKET_SIZE +#define UDC_BULK_PACKET_SIZE EP_MAX_PACKET_SIZE +#endif + +#define UDC_BULK_HS_PACKET_SIZE 512 + +#ifndef UDC_INT_ENDPOINT +#define UDC_INT_ENDPOINT 1 +#endif + +#ifndef UDC_OUT_ENDPOINT +#define UDC_OUT_ENDPOINT 2 +#endif + +#ifndef UDC_IN_ENDPOINT +#define UDC_IN_ENDPOINT 3 +#endif + +/* function declarations */ +int udc_init(void); +void udc_irq(void); +int udc_endpoint_write(struct usb_endpoint_instance *endpoint); +void udc_setup_ep(struct usb_device_instance *device, unsigned int ep, + struct usb_endpoint_instance *endpoint); +void udc_connect(void); +void udc_disconnect(void); +void udc_enable(struct usb_device_instance *device); +void udc_disable(void); +void udc_startup_events(struct usb_device_instance *device); + +/* Flow control */ +void udc_set_nak(int epid); +void udc_unset_nak(int epid); + +#endif -- cgit v1.1