Files
u-boot/drivers/usb/gadget/dwc2_udc_otg_regs.h
Kongyang Liu 24b0e2604e usb: dwc2: Extract macro definitions to common header
Some macros are shared between host and gadget code, causing duplicated
definitions. Move DWC2 macro definitions from host and gadget code into a
common header to reduce duplication.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20250110-dwc2-dev-v4-6-987f4fd6f8b2@pigmoral.tech
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-06-02 09:57:25 +02:00

69 lines
1.8 KiB
C

/* SPDX-License-Identifier: GPL-2.0+ */
/* linux/arch/arm/plat-s3c/include/plat/regs-otg.h
*
* Copyright (C) 2004 Herbert Poetzl <herbert@13thfloor.at>
*
* Registers remapping:
* Lukasz Majewski <l.majewski@samsumg.com>
*/
#ifndef __ASM_ARCH_REGS_USB_OTG_HS_H
#define __ASM_ARCH_REGS_USB_OTG_HS_H
#include "../common/dwc2_core.h"
struct dwc2_usbotg_phy {
u32 phypwr;
u32 phyclk;
u32 rstcon;
};
#define FULL_SPEED_CONTROL_PKT_SIZE 8
#define FULL_SPEED_BULK_PKT_SIZE 64
#define HIGH_SPEED_CONTROL_PKT_SIZE 64
#define HIGH_SPEED_BULK_PKT_SIZE 512
#define RX_FIFO_SIZE 1024
#define NPTX_FIFO_SIZE 1024
#define PTX_FIFO_SIZE 384
#define USB_PHY_CTRL_EN0 BIT(0)
/* OPHYPWR */
#define PHY_0_SLEEP BIT(5)
#define OTG_DISABLE_0 BIT(4)
#define ANALOG_PWRDOWN BIT(3)
#define FORCE_SUSPEND_0 BIT(0)
/* URSTCON */
#define HOST_SW_RST BIT(4)
#define PHY_SW_RST1 BIT(3)
#define PHYLNK_SW_RST BIT(2)
#define LINK_SW_RST BIT(1)
#define PHY_SW_RST0 BIT(0)
/* OPHYCLK */
#define COMMON_ON_N1 BIT(7)
#define COMMON_ON_N0 BIT(4)
#define ID_PULLUP0 BIT(2)
#define CLK_SEL_24MHZ (0x3 << 0)
#define CLK_SEL_12MHZ (0x2 << 0)
#define CLK_SEL_48MHZ (0x0 << 0)
#define EXYNOS4X12_ID_PULLUP0 BIT(3)
#define EXYNOS4X12_COMMON_ON_N0 BIT(4)
#define EXYNOS4X12_CLK_SEL_12MHZ (0x02 << 0)
#define EXYNOS4X12_CLK_SEL_24MHZ (0x05 << 0)
/* Masks definitions */
#define GINTMSK_INIT (GINTSTS_WKUPINT | GINTSTS_OEPINT | GINTSTS_IEPINT | GINTSTS_ENUMDONE | \
GINTSTS_USBRST | GINTSTS_USBSUSP | GINTSTS_OTGINT)
#define DOEPMSK_INIT (DOEPMSK_SETUPMSK | DOEPMSK_AHBERRMSK | DOEPMSK_XFERCOMPLMSK)
#define DIEPMSK_INIT (DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK | DIEPMSK_XFERCOMPLMSK)
#define GAHBCFG_INIT (GAHBCFG_DMA_EN | \
FIELD_PREP(GAHBCFG_HBSTLEN_MASK, GAHBCFG_HBSTLEN_INCR4) | \
GAHBCFG_GLBL_INTR_EN)
#endif