Commit bea8e86c authored by John Youn's avatar John Youn Committed by Felipe Balbi

usb: dwc2: Declare the core params struct statically

This makes it consistent with the hw_params struct and simplifies the
memory management for future refactoring. Fix up usage in all files.
Signed-off-by: default avatarJohn Youn <johnyoun@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 323230ef
...@@ -135,7 +135,7 @@ int dwc2_exit_hibernation(struct dwc2_hsotg *hsotg, bool restore) ...@@ -135,7 +135,7 @@ int dwc2_exit_hibernation(struct dwc2_hsotg *hsotg, bool restore)
u32 pcgcctl; u32 pcgcctl;
int ret = 0; int ret = 0;
if (!hsotg->core_params->hibernation) if (!hsotg->params.hibernation)
return -ENOTSUPP; return -ENOTSUPP;
pcgcctl = dwc2_readl(hsotg->regs + PCGCTL); pcgcctl = dwc2_readl(hsotg->regs + PCGCTL);
...@@ -188,7 +188,7 @@ int dwc2_enter_hibernation(struct dwc2_hsotg *hsotg) ...@@ -188,7 +188,7 @@ int dwc2_enter_hibernation(struct dwc2_hsotg *hsotg)
u32 pcgcctl; u32 pcgcctl;
int ret = 0; int ret = 0;
if (!hsotg->core_params->hibernation) if (!hsotg->params.hibernation)
return -ENOTSUPP; return -ENOTSUPP;
/* Backup all registers */ /* Backup all registers */
...@@ -541,7 +541,7 @@ void dwc2_dump_host_registers(struct dwc2_hsotg *hsotg) ...@@ -541,7 +541,7 @@ void dwc2_dump_host_registers(struct dwc2_hsotg *hsotg)
addr = hsotg->regs + HAINTMSK; addr = hsotg->regs + HAINTMSK;
dev_dbg(hsotg->dev, "HAINTMSK @0x%08lX : 0x%08X\n", dev_dbg(hsotg->dev, "HAINTMSK @0x%08lX : 0x%08X\n",
(unsigned long)addr, dwc2_readl(addr)); (unsigned long)addr, dwc2_readl(addr));
if (hsotg->core_params->dma_desc_enable > 0) { if (hsotg->params.dma_desc_enable > 0) {
addr = hsotg->regs + HFLBADDR; addr = hsotg->regs + HFLBADDR;
dev_dbg(hsotg->dev, "HFLBADDR @0x%08lX : 0x%08X\n", dev_dbg(hsotg->dev, "HFLBADDR @0x%08lX : 0x%08X\n",
(unsigned long)addr, dwc2_readl(addr)); (unsigned long)addr, dwc2_readl(addr));
...@@ -551,7 +551,7 @@ void dwc2_dump_host_registers(struct dwc2_hsotg *hsotg) ...@@ -551,7 +551,7 @@ void dwc2_dump_host_registers(struct dwc2_hsotg *hsotg)
dev_dbg(hsotg->dev, "HPRT0 @0x%08lX : 0x%08X\n", dev_dbg(hsotg->dev, "HPRT0 @0x%08lX : 0x%08X\n",
(unsigned long)addr, dwc2_readl(addr)); (unsigned long)addr, dwc2_readl(addr));
for (i = 0; i < hsotg->core_params->host_channels; i++) { for (i = 0; i < hsotg->params.host_channels; i++) {
dev_dbg(hsotg->dev, "Host Channel %d Specific Registers\n", i); dev_dbg(hsotg->dev, "Host Channel %d Specific Registers\n", i);
addr = hsotg->regs + HCCHAR(i); addr = hsotg->regs + HCCHAR(i);
dev_dbg(hsotg->dev, "HCCHAR @0x%08lX : 0x%08X\n", dev_dbg(hsotg->dev, "HCCHAR @0x%08lX : 0x%08X\n",
...@@ -571,7 +571,7 @@ void dwc2_dump_host_registers(struct dwc2_hsotg *hsotg) ...@@ -571,7 +571,7 @@ void dwc2_dump_host_registers(struct dwc2_hsotg *hsotg)
addr = hsotg->regs + HCDMA(i); addr = hsotg->regs + HCDMA(i);
dev_dbg(hsotg->dev, "HCDMA @0x%08lX : 0x%08X\n", dev_dbg(hsotg->dev, "HCDMA @0x%08lX : 0x%08X\n",
(unsigned long)addr, dwc2_readl(addr)); (unsigned long)addr, dwc2_readl(addr));
if (hsotg->core_params->dma_desc_enable > 0) { if (hsotg->params.dma_desc_enable > 0) {
addr = hsotg->regs + HCDMAB(i); addr = hsotg->regs + HCDMAB(i);
dev_dbg(hsotg->dev, "HCDMAB @0x%08lX : 0x%08X\n", dev_dbg(hsotg->dev, "HCDMAB @0x%08lX : 0x%08X\n",
(unsigned long)addr, dwc2_readl(addr)); (unsigned long)addr, dwc2_readl(addr));
...@@ -753,7 +753,7 @@ bool dwc2_force_mode_if_needed(struct dwc2_hsotg *hsotg, bool host) ...@@ -753,7 +753,7 @@ bool dwc2_force_mode_if_needed(struct dwc2_hsotg *hsotg, bool host)
u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg) u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg)
{ {
return hsotg->core_params->otg_ver == 1 ? 0x0200 : 0x0103; return hsotg->params.otg_ver == 1 ? 0x0200 : 0x0103;
} }
bool dwc2_is_controller_alive(struct dwc2_hsotg *hsotg) bool dwc2_is_controller_alive(struct dwc2_hsotg *hsotg)
......
...@@ -850,7 +850,7 @@ struct dwc2_hsotg { ...@@ -850,7 +850,7 @@ struct dwc2_hsotg {
/** Params detected from hardware */ /** Params detected from hardware */
struct dwc2_hw_params hw_params; struct dwc2_hw_params hw_params;
/** Params to actually use */ /** Params to actually use */
struct dwc2_core_params *core_params; struct dwc2_core_params params;
enum usb_otg_state op_state; enum usb_otg_state op_state;
enum usb_dr_mode dr_mode; enum usb_dr_mode dr_mode;
unsigned int hcd_enabled:1; unsigned int hcd_enabled:1;
......
...@@ -159,9 +159,9 @@ static void dwc2_handle_otg_intr(struct dwc2_hsotg *hsotg) ...@@ -159,9 +159,9 @@ static void dwc2_handle_otg_intr(struct dwc2_hsotg *hsotg)
" ++OTG Interrupt: Session Request Success Status Change++\n"); " ++OTG Interrupt: Session Request Success Status Change++\n");
gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
if (gotgctl & GOTGCTL_SESREQSCS) { if (gotgctl & GOTGCTL_SESREQSCS) {
if (hsotg->core_params->phy_type == if (hsotg->params.phy_type ==
DWC2_PHY_TYPE_PARAM_FS DWC2_PHY_TYPE_PARAM_FS
&& hsotg->core_params->i2c_enable > 0) { && hsotg->params.i2c_enable > 0) {
hsotg->srp_success = 1; hsotg->srp_success = 1;
} else { } else {
/* Clear Session Request */ /* Clear Session Request */
...@@ -370,7 +370,7 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) ...@@ -370,7 +370,7 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
/* Change to L0 state */ /* Change to L0 state */
hsotg->lx_state = DWC2_L0; hsotg->lx_state = DWC2_L0;
} else { } else {
if (hsotg->core_params->hibernation) if (hsotg->params.hibernation)
return; return;
if (hsotg->lx_state != DWC2_L1) { if (hsotg->lx_state != DWC2_L1) {
......
...@@ -2557,7 +2557,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg, ...@@ -2557,7 +2557,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
GINTSTS_USBSUSP | GINTSTS_WKUPINT | GINTSTS_USBSUSP | GINTSTS_WKUPINT |
GINTSTS_INCOMPL_SOIN | GINTSTS_INCOMPL_SOOUT; GINTSTS_INCOMPL_SOIN | GINTSTS_INCOMPL_SOOUT;
if (hsotg->core_params->external_id_pin_ctl <= 0) if (hsotg->params.external_id_pin_ctl <= 0)
intmsk |= GINTSTS_CONIDSTSCHNG; intmsk |= GINTSTS_CONIDSTSCHNG;
dwc2_writel(intmsk, hsotg->regs + GINTMSK); dwc2_writel(intmsk, hsotg->regs + GINTMSK);
......
...@@ -79,9 +79,9 @@ static void dwc2_enable_common_interrupts(struct dwc2_hsotg *hsotg) ...@@ -79,9 +79,9 @@ static void dwc2_enable_common_interrupts(struct dwc2_hsotg *hsotg)
/* Enable the interrupts in the GINTMSK */ /* Enable the interrupts in the GINTMSK */
intmsk = GINTSTS_MODEMIS | GINTSTS_OTGINT; intmsk = GINTSTS_MODEMIS | GINTSTS_OTGINT;
if (hsotg->core_params->dma_enable <= 0) if (hsotg->params.dma_enable <= 0)
intmsk |= GINTSTS_RXFLVL; intmsk |= GINTSTS_RXFLVL;
if (hsotg->core_params->external_id_pin_ctl <= 0) if (hsotg->params.external_id_pin_ctl <= 0)
intmsk |= GINTSTS_CONIDSTSCHNG; intmsk |= GINTSTS_CONIDSTSCHNG;
intmsk |= GINTSTS_WKUPINT | GINTSTS_USBSUSP | intmsk |= GINTSTS_WKUPINT | GINTSTS_USBSUSP |
...@@ -100,8 +100,8 @@ static void dwc2_init_fs_ls_pclk_sel(struct dwc2_hsotg *hsotg) ...@@ -100,8 +100,8 @@ static void dwc2_init_fs_ls_pclk_sel(struct dwc2_hsotg *hsotg)
if ((hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_ULPI && if ((hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_ULPI &&
hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED && hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED &&
hsotg->core_params->ulpi_fs_ls > 0) || hsotg->params.ulpi_fs_ls > 0) ||
hsotg->core_params->phy_type == DWC2_PHY_TYPE_PARAM_FS) { hsotg->params.phy_type == DWC2_PHY_TYPE_PARAM_FS) {
/* Full speed PHY */ /* Full speed PHY */
val = HCFG_FSLSPCLKSEL_48_MHZ; val = HCFG_FSLSPCLKSEL_48_MHZ;
} else { } else {
...@@ -152,7 +152,7 @@ static int dwc2_fs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy) ...@@ -152,7 +152,7 @@ static int dwc2_fs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
if (dwc2_is_host_mode(hsotg)) if (dwc2_is_host_mode(hsotg))
dwc2_init_fs_ls_pclk_sel(hsotg); dwc2_init_fs_ls_pclk_sel(hsotg);
if (hsotg->core_params->i2c_enable > 0) { if (hsotg->params.i2c_enable > 0) {
dev_dbg(hsotg->dev, "FS PHY enabling I2C\n"); dev_dbg(hsotg->dev, "FS PHY enabling I2C\n");
/* Program GUSBCFG.OtgUtmiFsSel to I2C */ /* Program GUSBCFG.OtgUtmiFsSel to I2C */
...@@ -189,20 +189,20 @@ static int dwc2_hs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy) ...@@ -189,20 +189,20 @@ static int dwc2_hs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
* so only program the first time. Do a soft reset immediately after * so only program the first time. Do a soft reset immediately after
* setting phyif. * setting phyif.
*/ */
switch (hsotg->core_params->phy_type) { switch (hsotg->params.phy_type) {
case DWC2_PHY_TYPE_PARAM_ULPI: case DWC2_PHY_TYPE_PARAM_ULPI:
/* ULPI interface */ /* ULPI interface */
dev_dbg(hsotg->dev, "HS ULPI PHY selected\n"); dev_dbg(hsotg->dev, "HS ULPI PHY selected\n");
usbcfg |= GUSBCFG_ULPI_UTMI_SEL; usbcfg |= GUSBCFG_ULPI_UTMI_SEL;
usbcfg &= ~(GUSBCFG_PHYIF16 | GUSBCFG_DDRSEL); usbcfg &= ~(GUSBCFG_PHYIF16 | GUSBCFG_DDRSEL);
if (hsotg->core_params->phy_ulpi_ddr > 0) if (hsotg->params.phy_ulpi_ddr > 0)
usbcfg |= GUSBCFG_DDRSEL; usbcfg |= GUSBCFG_DDRSEL;
break; break;
case DWC2_PHY_TYPE_PARAM_UTMI: case DWC2_PHY_TYPE_PARAM_UTMI:
/* UTMI+ interface */ /* UTMI+ interface */
dev_dbg(hsotg->dev, "HS UTMI+ PHY selected\n"); dev_dbg(hsotg->dev, "HS UTMI+ PHY selected\n");
usbcfg &= ~(GUSBCFG_ULPI_UTMI_SEL | GUSBCFG_PHYIF16); usbcfg &= ~(GUSBCFG_ULPI_UTMI_SEL | GUSBCFG_PHYIF16);
if (hsotg->core_params->phy_utmi_width == 16) if (hsotg->params.phy_utmi_width == 16)
usbcfg |= GUSBCFG_PHYIF16; usbcfg |= GUSBCFG_PHYIF16;
break; break;
default: default:
...@@ -230,8 +230,8 @@ static int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy) ...@@ -230,8 +230,8 @@ static int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
u32 usbcfg; u32 usbcfg;
int retval = 0; int retval = 0;
if (hsotg->core_params->speed == DWC2_SPEED_PARAM_FULL && if (hsotg->params.speed == DWC2_SPEED_PARAM_FULL &&
hsotg->core_params->phy_type == DWC2_PHY_TYPE_PARAM_FS) { hsotg->params.phy_type == DWC2_PHY_TYPE_PARAM_FS) {
/* If FS mode with FS PHY */ /* If FS mode with FS PHY */
retval = dwc2_fs_phy_init(hsotg, select_phy); retval = dwc2_fs_phy_init(hsotg, select_phy);
if (retval) if (retval)
...@@ -245,7 +245,7 @@ static int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy) ...@@ -245,7 +245,7 @@ static int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
if (hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_ULPI && if (hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_ULPI &&
hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED && hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED &&
hsotg->core_params->ulpi_fs_ls > 0) { hsotg->params.ulpi_fs_ls > 0) {
dev_dbg(hsotg->dev, "Setting ULPI FSLS\n"); dev_dbg(hsotg->dev, "Setting ULPI FSLS\n");
usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
usbcfg |= GUSBCFG_ULPI_FS_LS; usbcfg |= GUSBCFG_ULPI_FS_LS;
...@@ -272,9 +272,9 @@ static int dwc2_gahbcfg_init(struct dwc2_hsotg *hsotg) ...@@ -272,9 +272,9 @@ static int dwc2_gahbcfg_init(struct dwc2_hsotg *hsotg)
case GHWCFG2_INT_DMA_ARCH: case GHWCFG2_INT_DMA_ARCH:
dev_dbg(hsotg->dev, "Internal DMA Mode\n"); dev_dbg(hsotg->dev, "Internal DMA Mode\n");
if (hsotg->core_params->ahbcfg != -1) { if (hsotg->params.ahbcfg != -1) {
ahbcfg &= GAHBCFG_CTRL_MASK; ahbcfg &= GAHBCFG_CTRL_MASK;
ahbcfg |= hsotg->core_params->ahbcfg & ahbcfg |= hsotg->params.ahbcfg &
~GAHBCFG_CTRL_MASK; ~GAHBCFG_CTRL_MASK;
} }
break; break;
...@@ -286,20 +286,20 @@ static int dwc2_gahbcfg_init(struct dwc2_hsotg *hsotg) ...@@ -286,20 +286,20 @@ static int dwc2_gahbcfg_init(struct dwc2_hsotg *hsotg)
} }
dev_dbg(hsotg->dev, "dma_enable:%d dma_desc_enable:%d\n", dev_dbg(hsotg->dev, "dma_enable:%d dma_desc_enable:%d\n",
hsotg->core_params->dma_enable, hsotg->params.dma_enable,
hsotg->core_params->dma_desc_enable); hsotg->params.dma_desc_enable);
if (hsotg->core_params->dma_enable > 0) { if (hsotg->params.dma_enable > 0) {
if (hsotg->core_params->dma_desc_enable > 0) if (hsotg->params.dma_desc_enable > 0)
dev_dbg(hsotg->dev, "Using Descriptor DMA mode\n"); dev_dbg(hsotg->dev, "Using Descriptor DMA mode\n");
else else
dev_dbg(hsotg->dev, "Using Buffer DMA mode\n"); dev_dbg(hsotg->dev, "Using Buffer DMA mode\n");
} else { } else {
dev_dbg(hsotg->dev, "Using Slave mode\n"); dev_dbg(hsotg->dev, "Using Slave mode\n");
hsotg->core_params->dma_desc_enable = 0; hsotg->params.dma_desc_enable = 0;
} }
if (hsotg->core_params->dma_enable > 0) if (hsotg->params.dma_enable > 0)
ahbcfg |= GAHBCFG_DMA_EN; ahbcfg |= GAHBCFG_DMA_EN;
dwc2_writel(ahbcfg, hsotg->regs + GAHBCFG); dwc2_writel(ahbcfg, hsotg->regs + GAHBCFG);
...@@ -316,10 +316,10 @@ static void dwc2_gusbcfg_init(struct dwc2_hsotg *hsotg) ...@@ -316,10 +316,10 @@ static void dwc2_gusbcfg_init(struct dwc2_hsotg *hsotg)
switch (hsotg->hw_params.op_mode) { switch (hsotg->hw_params.op_mode) {
case GHWCFG2_OP_MODE_HNP_SRP_CAPABLE: case GHWCFG2_OP_MODE_HNP_SRP_CAPABLE:
if (hsotg->core_params->otg_cap == if (hsotg->params.otg_cap ==
DWC2_CAP_PARAM_HNP_SRP_CAPABLE) DWC2_CAP_PARAM_HNP_SRP_CAPABLE)
usbcfg |= GUSBCFG_HNPCAP; usbcfg |= GUSBCFG_HNPCAP;
if (hsotg->core_params->otg_cap != if (hsotg->params.otg_cap !=
DWC2_CAP_PARAM_NO_HNP_SRP_CAPABLE) DWC2_CAP_PARAM_NO_HNP_SRP_CAPABLE)
usbcfg |= GUSBCFG_SRPCAP; usbcfg |= GUSBCFG_SRPCAP;
break; break;
...@@ -327,7 +327,7 @@ static void dwc2_gusbcfg_init(struct dwc2_hsotg *hsotg) ...@@ -327,7 +327,7 @@ static void dwc2_gusbcfg_init(struct dwc2_hsotg *hsotg)
case GHWCFG2_OP_MODE_SRP_ONLY_CAPABLE: case GHWCFG2_OP_MODE_SRP_ONLY_CAPABLE:
case GHWCFG2_OP_MODE_SRP_CAPABLE_DEVICE: case GHWCFG2_OP_MODE_SRP_CAPABLE_DEVICE:
case GHWCFG2_OP_MODE_SRP_CAPABLE_HOST: case GHWCFG2_OP_MODE_SRP_CAPABLE_HOST:
if (hsotg->core_params->otg_cap != if (hsotg->params.otg_cap !=
DWC2_CAP_PARAM_NO_HNP_SRP_CAPABLE) DWC2_CAP_PARAM_NO_HNP_SRP_CAPABLE)
usbcfg |= GUSBCFG_SRPCAP; usbcfg |= GUSBCFG_SRPCAP;
break; break;
...@@ -390,7 +390,7 @@ static void dwc2_disable_host_interrupts(struct dwc2_hsotg *hsotg) ...@@ -390,7 +390,7 @@ static void dwc2_disable_host_interrupts(struct dwc2_hsotg *hsotg)
*/ */
static void dwc2_calculate_dynamic_fifo(struct dwc2_hsotg *hsotg) static void dwc2_calculate_dynamic_fifo(struct dwc2_hsotg *hsotg)
{ {
struct dwc2_core_params *params = hsotg->core_params; struct dwc2_core_params *params = &hsotg->params;
struct dwc2_hw_params *hw = &hsotg->hw_params; struct dwc2_hw_params *hw = &hsotg->hw_params;
u32 rxfsiz, nptxfsiz, ptxfsiz, total_fifo_size; u32 rxfsiz, nptxfsiz, ptxfsiz, total_fifo_size;
...@@ -449,7 +449,7 @@ static void dwc2_calculate_dynamic_fifo(struct dwc2_hsotg *hsotg) ...@@ -449,7 +449,7 @@ static void dwc2_calculate_dynamic_fifo(struct dwc2_hsotg *hsotg)
static void dwc2_config_fifos(struct dwc2_hsotg *hsotg) static void dwc2_config_fifos(struct dwc2_hsotg *hsotg)
{ {
struct dwc2_core_params *params = hsotg->core_params; struct dwc2_core_params *params = &hsotg->params;
u32 nptxfsiz, hptxfsiz, dfifocfg, grxfsiz; u32 nptxfsiz, hptxfsiz, dfifocfg, grxfsiz;
if (!params->enable_dynamic_fifo) if (!params->enable_dynamic_fifo)
...@@ -490,7 +490,7 @@ static void dwc2_config_fifos(struct dwc2_hsotg *hsotg) ...@@ -490,7 +490,7 @@ static void dwc2_config_fifos(struct dwc2_hsotg *hsotg)
dev_dbg(hsotg->dev, "new hptxfsiz=%08x\n", dev_dbg(hsotg->dev, "new hptxfsiz=%08x\n",
dwc2_readl(hsotg->regs + HPTXFSIZ)); dwc2_readl(hsotg->regs + HPTXFSIZ));
if (hsotg->core_params->en_multiple_tx_fifo > 0 && if (hsotg->params.en_multiple_tx_fifo > 0 &&
hsotg->hw_params.snpsid <= DWC2_CORE_REV_2_94a) { hsotg->hw_params.snpsid <= DWC2_CORE_REV_2_94a) {
/* /*
* Global DFIFOCFG calculation for Host mode - * Global DFIFOCFG calculation for Host mode -
...@@ -598,7 +598,7 @@ static void dwc2_dump_channel_info(struct dwc2_hsotg *hsotg, ...@@ -598,7 +598,7 @@ static void dwc2_dump_channel_info(struct dwc2_hsotg *hsotg,
struct dwc2_host_chan *chan) struct dwc2_host_chan *chan)
{ {
#ifdef VERBOSE_DEBUG #ifdef VERBOSE_DEBUG
int num_channels = hsotg->core_params->host_channels; int num_channels = hsotg->params.host_channels;
struct dwc2_qh *qh; struct dwc2_qh *qh;
u32 hcchar; u32 hcchar;
u32 hcsplt; u32 hcsplt;
...@@ -741,7 +741,7 @@ static void dwc2_hc_enable_dma_ints(struct dwc2_hsotg *hsotg, ...@@ -741,7 +741,7 @@ static void dwc2_hc_enable_dma_ints(struct dwc2_hsotg *hsotg,
* For Descriptor DMA mode core halts the channel on AHB error. * For Descriptor DMA mode core halts the channel on AHB error.
* Interrupt is not required. * Interrupt is not required.
*/ */
if (hsotg->core_params->dma_desc_enable <= 0) { if (hsotg->params.dma_desc_enable <= 0) {
if (dbg_hc(chan)) if (dbg_hc(chan))
dev_vdbg(hsotg->dev, "desc DMA disabled\n"); dev_vdbg(hsotg->dev, "desc DMA disabled\n");
hcintmsk |= HCINTMSK_AHBERR; hcintmsk |= HCINTMSK_AHBERR;
...@@ -774,7 +774,7 @@ static void dwc2_hc_enable_ints(struct dwc2_hsotg *hsotg, ...@@ -774,7 +774,7 @@ static void dwc2_hc_enable_ints(struct dwc2_hsotg *hsotg,
{ {
u32 intmsk; u32 intmsk;
if (hsotg->core_params->dma_enable > 0) { if (hsotg->params.dma_enable > 0) {
if (dbg_hc(chan)) if (dbg_hc(chan))
dev_vdbg(hsotg->dev, "DMA enabled\n"); dev_vdbg(hsotg->dev, "DMA enabled\n");
dwc2_hc_enable_dma_ints(hsotg, chan); dwc2_hc_enable_dma_ints(hsotg, chan);
...@@ -994,7 +994,7 @@ void dwc2_hc_halt(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan, ...@@ -994,7 +994,7 @@ void dwc2_hc_halt(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan,
/* No need to set the bit in DDMA for disabling the channel */ /* No need to set the bit in DDMA for disabling the channel */
/* TODO check it everywhere channel is disabled */ /* TODO check it everywhere channel is disabled */
if (hsotg->core_params->dma_desc_enable <= 0) { if (hsotg->params.dma_desc_enable <= 0) {
if (dbg_hc(chan)) if (dbg_hc(chan))
dev_vdbg(hsotg->dev, "desc DMA disabled\n"); dev_vdbg(hsotg->dev, "desc DMA disabled\n");
hcchar |= HCCHAR_CHENA; hcchar |= HCCHAR_CHENA;
...@@ -1004,7 +1004,7 @@ void dwc2_hc_halt(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan, ...@@ -1004,7 +1004,7 @@ void dwc2_hc_halt(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan,
} }
hcchar |= HCCHAR_CHDIS; hcchar |= HCCHAR_CHDIS;
if (hsotg->core_params->dma_enable <= 0) { if (hsotg->params.dma_enable <= 0) {
if (dbg_hc(chan)) if (dbg_hc(chan))
dev_vdbg(hsotg->dev, "DMA not enabled\n"); dev_vdbg(hsotg->dev, "DMA not enabled\n");
hcchar |= HCCHAR_CHENA; hcchar |= HCCHAR_CHENA;
...@@ -1143,7 +1143,7 @@ static void dwc2_hc_set_even_odd_frame(struct dwc2_hsotg *hsotg, ...@@ -1143,7 +1143,7 @@ static void dwc2_hc_set_even_odd_frame(struct dwc2_hsotg *hsotg,
fifo_space = (dwc2_readl(hsotg->regs + HPTXSTS) & fifo_space = (dwc2_readl(hsotg->regs + HPTXSTS) &
TXSTS_FSPCAVAIL_MASK) >> TXSTS_FSPCAVAIL_SHIFT; TXSTS_FSPCAVAIL_MASK) >> TXSTS_FSPCAVAIL_SHIFT;
bytes_in_fifo = sizeof(u32) * bytes_in_fifo = sizeof(u32) *
(hsotg->core_params->host_perio_tx_fifo_size - (hsotg->params.host_perio_tx_fifo_size -
fifo_space); fifo_space);
/* /*
...@@ -1339,8 +1339,8 @@ static void dwc2_hc_do_ping(struct dwc2_hsotg *hsotg, ...@@ -1339,8 +1339,8 @@ static void dwc2_hc_do_ping(struct dwc2_hsotg *hsotg,
static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg, static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg,
struct dwc2_host_chan *chan) struct dwc2_host_chan *chan)
{ {
u32 max_hc_xfer_size = hsotg->core_params->max_transfer_size; u32 max_hc_xfer_size = hsotg->params.max_transfer_size;
u16 max_hc_pkt_count = hsotg->core_params->max_packet_count; u16 max_hc_pkt_count = hsotg->params.max_packet_count;
u32 hcchar; u32 hcchar;
u32 hctsiz = 0; u32 hctsiz = 0;
u16 num_packets; u16 num_packets;
...@@ -1350,7 +1350,7 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg, ...@@ -1350,7 +1350,7 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg,
dev_vdbg(hsotg->dev, "%s()\n", __func__); dev_vdbg(hsotg->dev, "%s()\n", __func__);
if (chan->do_ping) { if (chan->do_ping) {
if (hsotg->core_params->dma_enable <= 0) { if (hsotg->params.dma_enable <= 0) {
if (dbg_hc(chan)) if (dbg_hc(chan))
dev_vdbg(hsotg->dev, "ping, no DMA\n"); dev_vdbg(hsotg->dev, "ping, no DMA\n");
dwc2_hc_do_ping(hsotg, chan); dwc2_hc_do_ping(hsotg, chan);
...@@ -1478,7 +1478,7 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg, ...@@ -1478,7 +1478,7 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg,
TSIZ_SC_MC_PID_SHIFT); TSIZ_SC_MC_PID_SHIFT);
} }
if (hsotg->core_params->dma_enable > 0) { if (hsotg->params.dma_enable > 0) {
dwc2_writel((u32)chan->xfer_dma, dwc2_writel((u32)chan->xfer_dma,
hsotg->regs + HCDMA(chan->hc_num)); hsotg->regs + HCDMA(chan->hc_num));
if (dbg_hc(chan)) if (dbg_hc(chan))
...@@ -1521,7 +1521,7 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg, ...@@ -1521,7 +1521,7 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg,
chan->xfer_started = 1; chan->xfer_started = 1;
chan->requests++; chan->requests++;
if (hsotg->core_params->dma_enable <= 0 && if (hsotg->params.dma_enable <= 0 &&
!chan->ep_is_in && chan->xfer_len > 0) !chan->ep_is_in && chan->xfer_len > 0)
/* Load OUT packet into the appropriate Tx FIFO */ /* Load OUT packet into the appropriate Tx FIFO */
dwc2_hc_write_packet(hsotg, chan); dwc2_hc_write_packet(hsotg, chan);
...@@ -1799,12 +1799,12 @@ void dwc2_hcd_start(struct dwc2_hsotg *hsotg) ...@@ -1799,12 +1799,12 @@ void dwc2_hcd_start(struct dwc2_hsotg *hsotg)
/* Must be called with interrupt disabled and spinlock held */ /* Must be called with interrupt disabled and spinlock held */
static void dwc2_hcd_cleanup_channels(struct dwc2_hsotg *hsotg) static void dwc2_hcd_cleanup_channels(struct dwc2_hsotg *hsotg)
{ {
int num_channels = hsotg->core_params->host_channels; int num_channels = hsotg->params.host_channels;
struct dwc2_host_chan *channel; struct dwc2_host_chan *channel;
u32 hcchar; u32 hcchar;
int i; int i;
if (hsotg->core_params->dma_enable <= 0) { if (hsotg->params.dma_enable <= 0) {
/* Flush out any channel requests in slave mode */ /* Flush out any channel requests in slave mode */
for (i = 0; i < num_channels; i++) { for (i = 0; i < num_channels; i++) {
channel = hsotg->hc_ptr_array[i]; channel = hsotg->hc_ptr_array[i];
...@@ -1840,9 +1840,9 @@ static void dwc2_hcd_cleanup_channels(struct dwc2_hsotg *hsotg) ...@@ -1840,9 +1840,9 @@ static void dwc2_hcd_cleanup_channels(struct dwc2_hsotg *hsotg)
channel->qh = NULL; channel->qh = NULL;
} }
/* All channels have been freed, mark them available */ /* All channels have been freed, mark them available */
if (hsotg->core_params->uframe_sched > 0) { if (hsotg->params.uframe_sched > 0) {
hsotg->available_host_channels = hsotg->available_host_channels =
hsotg->core_params->host_channels; hsotg->params.host_channels;
} else { } else {
hsotg->non_periodic_channels = 0; hsotg->non_periodic_channels = 0;
hsotg->periodic_channels = 0; hsotg->periodic_channels = 0;
...@@ -2077,7 +2077,7 @@ static int dwc2_hcd_urb_dequeue(struct dwc2_hsotg *hsotg, ...@@ -2077,7 +2077,7 @@ static int dwc2_hcd_urb_dequeue(struct dwc2_hsotg *hsotg,
* Free the QTD and clean up the associated QH. Leave the QH in the * Free the QTD and clean up the associated QH. Leave the QH in the
* schedule if it has any remaining QTDs. * schedule if it has any remaining QTDs.
*/ */
if (hsotg->core_params->dma_desc_enable <= 0) { if (hsotg->params.dma_desc_enable <= 0) {
u8 in_process = urb_qtd->in_process; u8 in_process = urb_qtd->in_process;
dwc2_hcd_qtd_unlink_and_free(hsotg, urb_qtd, qh); dwc2_hcd_qtd_unlink_and_free(hsotg, urb_qtd, qh);
...@@ -2185,13 +2185,13 @@ static int dwc2_core_init(struct dwc2_hsotg *hsotg, bool initial_setup) ...@@ -2185,13 +2185,13 @@ static int dwc2_core_init(struct dwc2_hsotg *hsotg, bool initial_setup)
/* Set ULPI External VBUS bit if needed */ /* Set ULPI External VBUS bit if needed */
usbcfg &= ~GUSBCFG_ULPI_EXT_VBUS_DRV; usbcfg &= ~GUSBCFG_ULPI_EXT_VBUS_DRV;
if (hsotg->core_params->phy_ulpi_ext_vbus == if (hsotg->params.phy_ulpi_ext_vbus ==
DWC2_PHY_ULPI_EXTERNAL_VBUS) DWC2_PHY_ULPI_EXTERNAL_VBUS)
usbcfg |= GUSBCFG_ULPI_EXT_VBUS_DRV; usbcfg |= GUSBCFG_ULPI_EXT_VBUS_DRV;
/* Set external TS Dline pulsing bit if needed */ /* Set external TS Dline pulsing bit if needed */
usbcfg &= ~GUSBCFG_TERMSELDLPULSE; usbcfg &= ~GUSBCFG_TERMSELDLPULSE;
if (hsotg->core_params->ts_dline > 0) if (hsotg->params.ts_dline > 0)
usbcfg |= GUSBCFG_TERMSELDLPULSE; usbcfg |= GUSBCFG_TERMSELDLPULSE;
dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
...@@ -2230,10 +2230,10 @@ static int dwc2_core_init(struct dwc2_hsotg *hsotg, bool initial_setup) ...@@ -2230,10 +2230,10 @@ static int dwc2_core_init(struct dwc2_hsotg *hsotg, bool initial_setup)
/* Program the GOTGCTL register */ /* Program the GOTGCTL register */
otgctl = dwc2_readl(hsotg->regs + GOTGCTL); otgctl = dwc2_readl(hsotg->regs + GOTGCTL);
otgctl &= ~GOTGCTL_OTGVER; otgctl &= ~GOTGCTL_OTGVER;
if (hsotg->core_params->otg_ver > 0) if (hsotg->params.otg_ver > 0)
otgctl |= GOTGCTL_OTGVER; otgctl |= GOTGCTL_OTGVER;
dwc2_writel(otgctl, hsotg->regs + GOTGCTL); dwc2_writel(otgctl, hsotg->regs + GOTGCTL);
dev_dbg(hsotg->dev, "OTG VER PARAM: %d\n", hsotg->core_params->otg_ver); dev_dbg(hsotg->dev, "OTG VER PARAM: %d\n", hsotg->params.otg_ver);
/* Clear the SRP success bit for FS-I2c */ /* Clear the SRP success bit for FS-I2c */
hsotg->srp_success = 0; hsotg->srp_success = 0;
...@@ -2277,7 +2277,7 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg) ...@@ -2277,7 +2277,7 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg)
/* Initialize Host Configuration Register */ /* Initialize Host Configuration Register */
dwc2_init_fs_ls_pclk_sel(hsotg); dwc2_init_fs_ls_pclk_sel(hsotg);
if (hsotg->core_params->speed == DWC2_SPEED_PARAM_FULL) { if (hsotg->params.speed == DWC2_SPEED_PARAM_FULL) {
hcfg = dwc2_readl(hsotg->regs + HCFG); hcfg = dwc2_readl(hsotg->regs + HCFG);
hcfg |= HCFG_FSLSSUPP; hcfg |= HCFG_FSLSSUPP;
dwc2_writel(hcfg, hsotg->regs + HCFG); dwc2_writel(hcfg, hsotg->regs + HCFG);
...@@ -2288,13 +2288,13 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg) ...@@ -2288,13 +2288,13 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg)
* runtime. This bit needs to be programmed during initial configuration * runtime. This bit needs to be programmed during initial configuration
* and its value must not be changed during runtime. * and its value must not be changed during runtime.
*/ */
if (hsotg->core_params->reload_ctl > 0) { if (hsotg->params.reload_ctl > 0) {
hfir = dwc2_readl(hsotg->regs + HFIR); hfir = dwc2_readl(hsotg->regs + HFIR);
hfir |= HFIR_RLDCTRL; hfir |= HFIR_RLDCTRL;
dwc2_writel(hfir, hsotg->regs + HFIR); dwc2_writel(hfir, hsotg->regs + HFIR);
} }
if (hsotg->core_params->dma_desc_enable > 0) { if (hsotg->params.dma_desc_enable > 0) {
u32 op_mode = hsotg->hw_params.op_mode; u32 op_mode = hsotg->hw_params.op_mode;
if (hsotg->hw_params.snpsid < DWC2_CORE_REV_2_90a || if (hsotg->hw_params.snpsid < DWC2_CORE_REV_2_90a ||
...@@ -2306,7 +2306,7 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg) ...@@ -2306,7 +2306,7 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg)
"Hardware does not support descriptor DMA mode -\n"); "Hardware does not support descriptor DMA mode -\n");
dev_err(hsotg->dev, dev_err(hsotg->dev,
"falling back to buffer DMA mode.\n"); "falling back to buffer DMA mode.\n");
hsotg->core_params->dma_desc_enable = 0; hsotg->params.dma_desc_enable = 0;
} else { } else {
hcfg = dwc2_readl(hsotg->regs + HCFG); hcfg = dwc2_readl(hsotg->regs + HCFG);
hcfg |= HCFG_DESCDMA; hcfg |= HCFG_DESCDMA;
...@@ -2332,12 +2332,12 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg) ...@@ -2332,12 +2332,12 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg)
otgctl &= ~GOTGCTL_HSTSETHNPEN; otgctl &= ~GOTGCTL_HSTSETHNPEN;
dwc2_writel(otgctl, hsotg->regs + GOTGCTL); dwc2_writel(otgctl, hsotg->regs + GOTGCTL);
if (hsotg->core_params->dma_desc_enable <= 0) { if (hsotg->params.dma_desc_enable <= 0) {
int num_channels, i; int num_channels, i;
u32 hcchar; u32 hcchar;
/* Flush out any leftover queued requests */ /* Flush out any leftover queued requests */
num_channels = hsotg->core_params->host_channels; num_channels = hsotg->params.host_channels;
for (i = 0; i < num_channels; i++) { for (i = 0; i < num_channels; i++) {
hcchar = dwc2_readl(hsotg->regs + HCCHAR(i)); hcchar = dwc2_readl(hsotg->regs + HCCHAR(i));
hcchar &= ~HCCHAR_CHENA; hcchar &= ~HCCHAR_CHENA;
...@@ -2399,9 +2399,9 @@ static void dwc2_hcd_reinit(struct dwc2_hsotg *hsotg) ...@@ -2399,9 +2399,9 @@ static void dwc2_hcd_reinit(struct dwc2_hsotg *hsotg)
hsotg->flags.d32 = 0; hsotg->flags.d32 = 0;
hsotg->non_periodic_qh_ptr = &hsotg->non_periodic_sched_active; hsotg->non_periodic_qh_ptr = &hsotg->non_periodic_sched_active;
if (hsotg->core_params->uframe_sched > 0) { if (hsotg->params.uframe_sched > 0) {
hsotg->available_host_channels = hsotg->available_host_channels =
hsotg->core_params->host_channels; hsotg->params.host_channels;
} else { } else {
hsotg->non_periodic_channels = 0; hsotg->non_periodic_channels = 0;
hsotg->periodic_channels = 0; hsotg->periodic_channels = 0;
...@@ -2415,7 +2415,7 @@ static void dwc2_hcd_reinit(struct dwc2_hsotg *hsotg) ...@@ -2415,7 +2415,7 @@ static void dwc2_hcd_reinit(struct dwc2_hsotg *hsotg)
hc_list_entry) hc_list_entry)
list_del_init(&chan->hc_list_entry); list_del_init(&chan->hc_list_entry);
num_channels = hsotg->core_params->host_channels; num_channels = hsotg->params.host_channels;
for (i = 0; i < num_channels; i++) { for (i = 0; i < num_channels; i++) {
chan = hsotg->hc_ptr_array[i]; chan = hsotg->hc_ptr_array[i];
list_add_tail(&chan->hc_list_entry, &hsotg->free_hc_list); list_add_tail(&chan->hc_list_entry, &hsotg->free_hc_list);
...@@ -2457,7 +2457,7 @@ static void dwc2_hc_init_xfer(struct dwc2_hsotg *hsotg, ...@@ -2457,7 +2457,7 @@ static void dwc2_hc_init_xfer(struct dwc2_hsotg *hsotg,
chan->do_ping = 0; chan->do_ping = 0;
chan->ep_is_in = 0; chan->ep_is_in = 0;
chan->data_pid_start = DWC2_HC_PID_SETUP; chan->data_pid_start = DWC2_HC_PID_SETUP;
if (hsotg->core_params->dma_enable > 0) if (hsotg->params.dma_enable > 0)
chan->xfer_dma = urb->setup_dma; chan->xfer_dma = urb->setup_dma;
else else
chan->xfer_buf = urb->setup_packet; chan->xfer_buf = urb->setup_packet;
...@@ -2484,7 +2484,7 @@ static void dwc2_hc_init_xfer(struct dwc2_hsotg *hsotg, ...@@ -2484,7 +2484,7 @@ static void dwc2_hc_init_xfer(struct dwc2_hsotg *hsotg,
chan->do_ping = 0; chan->do_ping = 0;
chan->data_pid_start = DWC2_HC_PID_DATA1; chan->data_pid_start = DWC2_HC_PID_DATA1;
chan->xfer_len = 0; chan->xfer_len = 0;
if (hsotg->core_params->dma_enable > 0) if (hsotg->params.dma_enable > 0)
chan->xfer_dma = hsotg->status_buf_dma; chan->xfer_dma = hsotg->status_buf_dma;
else else
chan->xfer_buf = hsotg->status_buf; chan->xfer_buf = hsotg->status_buf;
...@@ -2502,13 +2502,13 @@ static void dwc2_hc_init_xfer(struct dwc2_hsotg *hsotg, ...@@ -2502,13 +2502,13 @@ static void dwc2_hc_init_xfer(struct dwc2_hsotg *hsotg,
case USB_ENDPOINT_XFER_ISOC: case USB_ENDPOINT_XFER_ISOC:
chan->ep_type = USB_ENDPOINT_XFER_ISOC; chan->ep_type = USB_ENDPOINT_XFER_ISOC;
if (hsotg->core_params->dma_desc_enable > 0) if (hsotg->params.dma_desc_enable > 0)
break; break;
frame_desc = &urb->iso_descs[qtd->isoc_frame_index]; frame_desc = &urb->iso_descs[qtd->isoc_frame_index];
frame_desc->status = 0; frame_desc->status = 0;
if (hsotg->core_params->dma_enable > 0) { if (hsotg->params.dma_enable > 0) {
chan->xfer_dma = urb->dma; chan->xfer_dma = urb->dma;
chan->xfer_dma += frame_desc->offset + chan->xfer_dma += frame_desc->offset +
qtd->isoc_split_offset; qtd->isoc_split_offset;
...@@ -2690,7 +2690,7 @@ static int dwc2_assign_and_init_hc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -2690,7 +2690,7 @@ static int dwc2_assign_and_init_hc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
!dwc2_hcd_is_pipe_in(&urb->pipe_info)) !dwc2_hcd_is_pipe_in(&urb->pipe_info))
urb->actual_length = urb->length; urb->actual_length = urb->length;
if (hsotg->core_params->dma_enable > 0) if (hsotg->params.dma_enable > 0)
chan->xfer_dma = urb->dma + urb->actual_length; chan->xfer_dma = urb->dma + urb->actual_length;
else else
chan->xfer_buf = (u8 *)urb->buf + urb->actual_length; chan->xfer_buf = (u8 *)urb->buf + urb->actual_length;
...@@ -2715,7 +2715,7 @@ static int dwc2_assign_and_init_hc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -2715,7 +2715,7 @@ static int dwc2_assign_and_init_hc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
*/ */
chan->multi_count = dwc2_hb_mult(qh->maxp); chan->multi_count = dwc2_hb_mult(qh->maxp);
if (hsotg->core_params->dma_desc_enable > 0) { if (hsotg->params.dma_desc_enable > 0) {
chan->desc_list_addr = qh->desc_list_dma; chan->desc_list_addr = qh->desc_list_dma;
chan->desc_list_sz = qh->desc_list_sz; chan->desc_list_sz = qh->desc_list_sz;
} }
...@@ -2752,7 +2752,7 @@ enum dwc2_transaction_type dwc2_hcd_select_transactions( ...@@ -2752,7 +2752,7 @@ enum dwc2_transaction_type dwc2_hcd_select_transactions(
while (qh_ptr != &hsotg->periodic_sched_ready) { while (qh_ptr != &hsotg->periodic_sched_ready) {
if (list_empty(&hsotg->free_hc_list)) if (list_empty(&hsotg->free_hc_list))
break; break;
if (hsotg->core_params->uframe_sched > 0) { if (hsotg->params.uframe_sched > 0) {
if (hsotg->available_host_channels <= 1) if (hsotg->available_host_channels <= 1)
break; break;
hsotg->available_host_channels--; hsotg->available_host_channels--;
...@@ -2776,17 +2776,17 @@ enum dwc2_transaction_type dwc2_hcd_select_transactions( ...@@ -2776,17 +2776,17 @@ enum dwc2_transaction_type dwc2_hcd_select_transactions(
* schedule. Some free host channels may not be used if they are * schedule. Some free host channels may not be used if they are
* reserved for periodic transfers. * reserved for periodic transfers.
*/ */
num_channels = hsotg->core_params->host_channels; num_channels = hsotg->params.host_channels;
qh_ptr = hsotg->non_periodic_sched_inactive.next; qh_ptr = hsotg->non_periodic_sched_inactive.next;
while (qh_ptr != &hsotg->non_periodic_sched_inactive) { while (qh_ptr != &hsotg->non_periodic_sched_inactive) {
if (hsotg->core_params->uframe_sched <= 0 && if (hsotg->params.uframe_sched <= 0 &&
hsotg->non_periodic_channels >= num_channels - hsotg->non_periodic_channels >= num_channels -
hsotg->periodic_channels) hsotg->periodic_channels)
break; break;
if (list_empty(&hsotg->free_hc_list)) if (list_empty(&hsotg->free_hc_list))
break; break;
qh = list_entry(qh_ptr, struct dwc2_qh, qh_list_entry); qh = list_entry(qh_ptr, struct dwc2_qh, qh_list_entry);
if (hsotg->core_params->uframe_sched > 0) { if (hsotg->params.uframe_sched > 0) {
if (hsotg->available_host_channels < 1) if (hsotg->available_host_channels < 1)
break; break;
hsotg->available_host_channels--; hsotg->available_host_channels--;
...@@ -2808,7 +2808,7 @@ enum dwc2_transaction_type dwc2_hcd_select_transactions( ...@@ -2808,7 +2808,7 @@ enum dwc2_transaction_type dwc2_hcd_select_transactions(
else else
ret_val = DWC2_TRANSACTION_ALL; ret_val = DWC2_TRANSACTION_ALL;
if (hsotg->core_params->uframe_sched <= 0) if (hsotg->params.uframe_sched <= 0)
hsotg->non_periodic_channels++; hsotg->non_periodic_channels++;
} }
...@@ -2847,8 +2847,8 @@ static int dwc2_queue_transaction(struct dwc2_hsotg *hsotg, ...@@ -2847,8 +2847,8 @@ static int dwc2_queue_transaction(struct dwc2_hsotg *hsotg,
list_move_tail(&chan->split_order_list_entry, list_move_tail(&chan->split_order_list_entry,
&hsotg->split_order); &hsotg->split_order);
if (hsotg->core_params->dma_enable > 0) { if (hsotg->params.dma_enable > 0) {
if (hsotg->core_params->dma_desc_enable > 0) { if (hsotg->params.dma_desc_enable > 0) {
if (!chan->xfer_started || if (!chan->xfer_started ||
chan->ep_type == USB_ENDPOINT_XFER_ISOC) { chan->ep_type == USB_ENDPOINT_XFER_ISOC) {
dwc2_hcd_start_xfer_ddma(hsotg, chan->qh); dwc2_hcd_start_xfer_ddma(hsotg, chan->qh);
...@@ -2957,7 +2957,7 @@ static void dwc2_process_periodic_channels(struct dwc2_hsotg *hsotg) ...@@ -2957,7 +2957,7 @@ static void dwc2_process_periodic_channels(struct dwc2_hsotg *hsotg)
* The flag prevents any halts to get into the request queue in * The flag prevents any halts to get into the request queue in
* the middle of multiple high-bandwidth packets getting queued. * the middle of multiple high-bandwidth packets getting queued.
*/ */
if (hsotg->core_params->dma_enable <= 0 && if (hsotg->params.dma_enable <= 0 &&
qh->channel->multi_count > 1) qh->channel->multi_count > 1)
hsotg->queuing_high_bandwidth = 1; hsotg->queuing_high_bandwidth = 1;
...@@ -2976,7 +2976,7 @@ static void dwc2_process_periodic_channels(struct dwc2_hsotg *hsotg) ...@@ -2976,7 +2976,7 @@ static void dwc2_process_periodic_channels(struct dwc2_hsotg *hsotg)
* controller automatically handles multiple packets for * controller automatically handles multiple packets for
* high-bandwidth transfers. * high-bandwidth transfers.
*/ */
if (hsotg->core_params->dma_enable > 0 || status == 0 || if (hsotg->params.dma_enable > 0 || status == 0 ||
qh->channel->requests == qh->channel->multi_count) { qh->channel->requests == qh->channel->multi_count) {
qh_ptr = qh_ptr->next; qh_ptr = qh_ptr->next;
/* /*
...@@ -2993,7 +2993,7 @@ static void dwc2_process_periodic_channels(struct dwc2_hsotg *hsotg) ...@@ -2993,7 +2993,7 @@ static void dwc2_process_periodic_channels(struct dwc2_hsotg *hsotg)
exit: exit:
if (no_queue_space || no_fifo_space || if (no_queue_space || no_fifo_space ||
(hsotg->core_params->dma_enable <= 0 && (hsotg->params.dma_enable <= 0 &&
!list_empty(&hsotg->periodic_sched_assigned))) { !list_empty(&hsotg->periodic_sched_assigned))) {
/* /*
* May need to queue more transactions as the request * May need to queue more transactions as the request
...@@ -3073,7 +3073,7 @@ static void dwc2_process_non_periodic_channels(struct dwc2_hsotg *hsotg) ...@@ -3073,7 +3073,7 @@ static void dwc2_process_non_periodic_channels(struct dwc2_hsotg *hsotg)
tx_status = dwc2_readl(hsotg->regs + GNPTXSTS); tx_status = dwc2_readl(hsotg->regs + GNPTXSTS);
qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >> qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
TXSTS_QSPCAVAIL_SHIFT; TXSTS_QSPCAVAIL_SHIFT;
if (hsotg->core_params->dma_enable <= 0 && qspcavail == 0) { if (hsotg->params.dma_enable <= 0 && qspcavail == 0) {
no_queue_space = 1; no_queue_space = 1;
break; break;
} }
...@@ -3106,7 +3106,7 @@ static void dwc2_process_non_periodic_channels(struct dwc2_hsotg *hsotg) ...@@ -3106,7 +3106,7 @@ static void dwc2_process_non_periodic_channels(struct dwc2_hsotg *hsotg)
hsotg->non_periodic_qh_ptr->next; hsotg->non_periodic_qh_ptr->next;
} while (hsotg->non_periodic_qh_ptr != orig_qh_ptr); } while (hsotg->non_periodic_qh_ptr != orig_qh_ptr);
if (hsotg->core_params->dma_enable <= 0) { if (hsotg->params.dma_enable <= 0) {
tx_status = dwc2_readl(hsotg->regs + GNPTXSTS); tx_status = dwc2_readl(hsotg->regs + GNPTXSTS);
qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >> qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
TXSTS_QSPCAVAIL_SHIFT; TXSTS_QSPCAVAIL_SHIFT;
...@@ -3307,7 +3307,7 @@ static void dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex) ...@@ -3307,7 +3307,7 @@ static void dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex)
* If hibernation is supported, Phy clock will be suspended * If hibernation is supported, Phy clock will be suspended
* after registers are backuped. * after registers are backuped.
*/ */
if (!hsotg->core_params->hibernation) { if (!hsotg->params.hibernation) {
/* Suspend the Phy Clock */ /* Suspend the Phy Clock */
pcgctl = dwc2_readl(hsotg->regs + PCGCTL); pcgctl = dwc2_readl(hsotg->regs + PCGCTL);
pcgctl |= PCGCTL_STOPPCLK; pcgctl |= PCGCTL_STOPPCLK;
...@@ -3342,7 +3342,7 @@ static void dwc2_port_resume(struct dwc2_hsotg *hsotg) ...@@ -3342,7 +3342,7 @@ static void dwc2_port_resume(struct dwc2_hsotg *hsotg)
* If hibernation is supported, Phy clock is already resumed * If hibernation is supported, Phy clock is already resumed
* after registers restore. * after registers restore.
*/ */
if (!hsotg->core_params->hibernation) { if (!hsotg->params.hibernation) {
pcgctl = dwc2_readl(hsotg->regs + PCGCTL); pcgctl = dwc2_readl(hsotg->regs + PCGCTL);
pcgctl &= ~PCGCTL_STOPPCLK; pcgctl &= ~PCGCTL_STOPPCLK;
dwc2_writel(pcgctl, hsotg->regs + PCGCTL); dwc2_writel(pcgctl, hsotg->regs + PCGCTL);
...@@ -3569,7 +3569,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, ...@@ -3569,7 +3569,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
port_status |= USB_PORT_STAT_TEST; port_status |= USB_PORT_STAT_TEST;
/* USB_PORT_FEAT_INDICATOR unsupported always 0 */ /* USB_PORT_FEAT_INDICATOR unsupported always 0 */
if (hsotg->core_params->dma_desc_fs_enable) { if (hsotg->params.dma_desc_fs_enable) {
/* /*
* Enable descriptor DMA only if a full speed * Enable descriptor DMA only if a full speed
* device is connected. * device is connected.
...@@ -3583,7 +3583,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, ...@@ -3583,7 +3583,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
u32 hcfg; u32 hcfg;
dev_info(hsotg->dev, "Enabling descriptor DMA mode\n"); dev_info(hsotg->dev, "Enabling descriptor DMA mode\n");
hsotg->core_params->dma_desc_enable = 1; hsotg->params.dma_desc_enable = 1;
hcfg = dwc2_readl(hsotg->regs + HCFG); hcfg = dwc2_readl(hsotg->regs + HCFG);
hcfg |= HCFG_DESCDMA; hcfg |= HCFG_DESCDMA;
dwc2_writel(hcfg, hsotg->regs + HCFG); dwc2_writel(hcfg, hsotg->regs + HCFG);
...@@ -3824,7 +3824,7 @@ void dwc2_hcd_dump_state(struct dwc2_hsotg *hsotg) ...@@ -3824,7 +3824,7 @@ void dwc2_hcd_dump_state(struct dwc2_hsotg *hsotg)
u32 p_tx_status; u32 p_tx_status;
int i; int i;
num_channels = hsotg->core_params->host_channels; num_channels = hsotg->params.host_channels;
dev_dbg(hsotg->dev, "\n"); dev_dbg(hsotg->dev, "\n");
dev_dbg(hsotg->dev, dev_dbg(hsotg->dev,
"************************************************************\n"); "************************************************************\n");
...@@ -4365,7 +4365,7 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd) ...@@ -4365,7 +4365,7 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
if (!HCD_HW_ACCESSIBLE(hcd)) if (!HCD_HW_ACCESSIBLE(hcd))
goto unlock; goto unlock;
if (!hsotg->core_params->hibernation) if (!hsotg->params.hibernation)
goto skip_power_saving; goto skip_power_saving;
/* /*
...@@ -4417,7 +4417,7 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd) ...@@ -4417,7 +4417,7 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd)
if (hsotg->lx_state != DWC2_L2) if (hsotg->lx_state != DWC2_L2)
goto unlock; goto unlock;
if (!hsotg->core_params->hibernation) { if (!hsotg->params.hibernation) {
hsotg->lx_state = DWC2_L0; hsotg->lx_state = DWC2_L0;
goto unlock; goto unlock;
} }
...@@ -4919,7 +4919,7 @@ static void dwc2_hcd_free(struct dwc2_hsotg *hsotg) ...@@ -4919,7 +4919,7 @@ static void dwc2_hcd_free(struct dwc2_hsotg *hsotg)
} }
} }
if (hsotg->core_params->dma_enable > 0) { if (hsotg->params.dma_enable > 0) {
if (hsotg->status_buf) { if (hsotg->status_buf) {
dma_free_coherent(hsotg->dev, DWC2_HCD_STATUS_BUF_SIZE, dma_free_coherent(hsotg->dev, DWC2_HCD_STATUS_BUF_SIZE,
hsotg->status_buf, hsotg->status_buf,
...@@ -4999,16 +4999,16 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) ...@@ -4999,16 +4999,16 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
hsotg->last_frame_num = HFNUM_MAX_FRNUM; hsotg->last_frame_num = HFNUM_MAX_FRNUM;
/* Check if the bus driver or platform code has setup a dma_mask */ /* Check if the bus driver or platform code has setup a dma_mask */
if (hsotg->core_params->dma_enable > 0 && if (hsotg->params.dma_enable > 0 &&
hsotg->dev->dma_mask == NULL) { hsotg->dev->dma_mask == NULL) {
dev_warn(hsotg->dev, dev_warn(hsotg->dev,
"dma_mask not set, disabling DMA\n"); "dma_mask not set, disabling DMA\n");
hsotg->core_params->dma_enable = 0; hsotg->params.dma_enable = 0;
hsotg->core_params->dma_desc_enable = 0; hsotg->params.dma_desc_enable = 0;
} }
/* Set device flags indicating whether the HCD supports DMA */ /* Set device flags indicating whether the HCD supports DMA */
if (hsotg->core_params->dma_enable > 0) { if (hsotg->params.dma_enable > 0) {
if (dma_set_mask(hsotg->dev, DMA_BIT_MASK(32)) < 0) if (dma_set_mask(hsotg->dev, DMA_BIT_MASK(32)) < 0)
dev_warn(hsotg->dev, "can't set DMA mask\n"); dev_warn(hsotg->dev, "can't set DMA mask\n");
if (dma_set_coherent_mask(hsotg->dev, DMA_BIT_MASK(32)) < 0) if (dma_set_coherent_mask(hsotg->dev, DMA_BIT_MASK(32)) < 0)
...@@ -5019,7 +5019,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) ...@@ -5019,7 +5019,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
if (!hcd) if (!hcd)
goto error1; goto error1;
if (hsotg->core_params->dma_enable <= 0) if (hsotg->params.dma_enable <= 0)
hcd->self.uses_dma = 0; hcd->self.uses_dma = 0;
hcd->has_tt = 1; hcd->has_tt = 1;
...@@ -5067,7 +5067,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) ...@@ -5067,7 +5067,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
* in the controller. Initialize the channel descriptor array. * in the controller. Initialize the channel descriptor array.
*/ */
INIT_LIST_HEAD(&hsotg->free_hc_list); INIT_LIST_HEAD(&hsotg->free_hc_list);
num_channels = hsotg->core_params->host_channels; num_channels = hsotg->params.host_channels;
memset(&hsotg->hc_ptr_array[0], 0, sizeof(hsotg->hc_ptr_array)); memset(&hsotg->hc_ptr_array[0], 0, sizeof(hsotg->hc_ptr_array));
for (i = 0; i < num_channels; i++) { for (i = 0; i < num_channels; i++) {
...@@ -5091,7 +5091,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) ...@@ -5091,7 +5091,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
* done after usb_add_hcd since that function allocates the DMA buffer * done after usb_add_hcd since that function allocates the DMA buffer
* pool. * pool.
*/ */
if (hsotg->core_params->dma_enable > 0) if (hsotg->params.dma_enable > 0)
hsotg->status_buf = dma_alloc_coherent(hsotg->dev, hsotg->status_buf = dma_alloc_coherent(hsotg->dev,
DWC2_HCD_STATUS_BUF_SIZE, DWC2_HCD_STATUS_BUF_SIZE,
&hsotg->status_buf_dma, GFP_KERNEL); &hsotg->status_buf_dma, GFP_KERNEL);
...@@ -5107,8 +5107,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) ...@@ -5107,8 +5107,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
* DMA mode. * DMA mode.
* Alignment must be set to 512 bytes. * Alignment must be set to 512 bytes.
*/ */
if (hsotg->core_params->dma_desc_enable || if (hsotg->params.dma_desc_enable ||
hsotg->core_params->dma_desc_fs_enable) { hsotg->params.dma_desc_fs_enable) {
hsotg->desc_gen_cache = kmem_cache_create("dwc2-gen-desc", hsotg->desc_gen_cache = kmem_cache_create("dwc2-gen-desc",
sizeof(struct dwc2_hcd_dma_desc) * sizeof(struct dwc2_hcd_dma_desc) *
MAX_DMA_DESC_NUM_GENERIC, 512, SLAB_CACHE_DMA, MAX_DMA_DESC_NUM_GENERIC, 512, SLAB_CACHE_DMA,
...@@ -5121,8 +5121,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) ...@@ -5121,8 +5121,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
* Disable descriptor dma mode since it will not be * Disable descriptor dma mode since it will not be
* usable. * usable.
*/ */
hsotg->core_params->dma_desc_enable = 0; hsotg->params.dma_desc_enable = 0;
hsotg->core_params->dma_desc_fs_enable = 0; hsotg->params.dma_desc_fs_enable = 0;
} }
hsotg->desc_hsisoc_cache = kmem_cache_create("dwc2-hsisoc-desc", hsotg->desc_hsisoc_cache = kmem_cache_create("dwc2-hsisoc-desc",
...@@ -5138,8 +5138,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) ...@@ -5138,8 +5138,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
* Disable descriptor dma mode since it will not be * Disable descriptor dma mode since it will not be
* usable. * usable.
*/ */
hsotg->core_params->dma_desc_enable = 0; hsotg->params.dma_desc_enable = 0;
hsotg->core_params->dma_desc_fs_enable = 0; hsotg->params.dma_desc_fs_enable = 0;
} }
} }
...@@ -5249,7 +5249,7 @@ int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) ...@@ -5249,7 +5249,7 @@ int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg)
hr = &hsotg->hr_backup; hr = &hsotg->hr_backup;
hr->hcfg = dwc2_readl(hsotg->regs + HCFG); hr->hcfg = dwc2_readl(hsotg->regs + HCFG);
hr->haintmsk = dwc2_readl(hsotg->regs + HAINTMSK); hr->haintmsk = dwc2_readl(hsotg->regs + HAINTMSK);
for (i = 0; i < hsotg->core_params->host_channels; ++i) for (i = 0; i < hsotg->params.host_channels; ++i)
hr->hcintmsk[i] = dwc2_readl(hsotg->regs + HCINTMSK(i)); hr->hcintmsk[i] = dwc2_readl(hsotg->regs + HCINTMSK(i));
hr->hprt0 = dwc2_read_hprt0(hsotg); hr->hprt0 = dwc2_read_hprt0(hsotg);
...@@ -5285,7 +5285,7 @@ int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg) ...@@ -5285,7 +5285,7 @@ int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg)
dwc2_writel(hr->hcfg, hsotg->regs + HCFG); dwc2_writel(hr->hcfg, hsotg->regs + HCFG);
dwc2_writel(hr->haintmsk, hsotg->regs + HAINTMSK); dwc2_writel(hr->haintmsk, hsotg->regs + HAINTMSK);
for (i = 0; i < hsotg->core_params->host_channels; ++i) for (i = 0; i < hsotg->params.host_channels; ++i)
dwc2_writel(hr->hcintmsk[i], hsotg->regs + HCINTMSK(i)); dwc2_writel(hr->hcintmsk[i], hsotg->regs + HCINTMSK(i));
dwc2_writel(hr->hprt0, hsotg->regs + HPRT0); dwc2_writel(hr->hprt0, hsotg->regs + HPRT0);
......
...@@ -297,7 +297,7 @@ static void dwc2_release_channel_ddma(struct dwc2_hsotg *hsotg, ...@@ -297,7 +297,7 @@ static void dwc2_release_channel_ddma(struct dwc2_hsotg *hsotg,
struct dwc2_host_chan *chan = qh->channel; struct dwc2_host_chan *chan = qh->channel;
if (dwc2_qh_is_non_per(qh)) { if (dwc2_qh_is_non_per(qh)) {
if (hsotg->core_params->uframe_sched > 0) if (hsotg->params.uframe_sched > 0)
hsotg->available_host_channels++; hsotg->available_host_channels++;
else else
hsotg->non_periodic_channels--; hsotg->non_periodic_channels--;
...@@ -404,7 +404,7 @@ void dwc2_hcd_qh_free_ddma(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -404,7 +404,7 @@ void dwc2_hcd_qh_free_ddma(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
if ((qh->ep_type == USB_ENDPOINT_XFER_ISOC || if ((qh->ep_type == USB_ENDPOINT_XFER_ISOC ||
qh->ep_type == USB_ENDPOINT_XFER_INT) && qh->ep_type == USB_ENDPOINT_XFER_INT) &&
(hsotg->core_params->uframe_sched > 0 || (hsotg->params.uframe_sched > 0 ||
!hsotg->periodic_channels) && hsotg->frame_list) { !hsotg->periodic_channels) && hsotg->frame_list) {
dwc2_per_sched_disable(hsotg); dwc2_per_sched_disable(hsotg);
dwc2_frame_list_free(hsotg); dwc2_frame_list_free(hsotg);
......
...@@ -256,7 +256,7 @@ static void dwc2_perio_tx_fifo_empty_intr(struct dwc2_hsotg *hsotg) ...@@ -256,7 +256,7 @@ static void dwc2_perio_tx_fifo_empty_intr(struct dwc2_hsotg *hsotg)
static void dwc2_hprt0_enable(struct dwc2_hsotg *hsotg, u32 hprt0, static void dwc2_hprt0_enable(struct dwc2_hsotg *hsotg, u32 hprt0,
u32 *hprt0_modify) u32 *hprt0_modify)
{ {
struct dwc2_core_params *params = hsotg->core_params; struct dwc2_core_params *params = &hsotg->params;
int do_reset = 0; int do_reset = 0;
u32 usbcfg; u32 usbcfg;
u32 prtspd; u32 prtspd;
...@@ -395,10 +395,10 @@ static void dwc2_port_intr(struct dwc2_hsotg *hsotg) ...@@ -395,10 +395,10 @@ static void dwc2_port_intr(struct dwc2_hsotg *hsotg)
dwc2_hprt0_enable(hsotg, hprt0, &hprt0_modify); dwc2_hprt0_enable(hsotg, hprt0, &hprt0_modify);
} else { } else {
hsotg->flags.b.port_enable_change = 1; hsotg->flags.b.port_enable_change = 1;
if (hsotg->core_params->dma_desc_fs_enable) { if (hsotg->params.dma_desc_fs_enable) {
u32 hcfg; u32 hcfg;
hsotg->core_params->dma_desc_enable = 0; hsotg->params.dma_desc_enable = 0;
hsotg->new_connection = false; hsotg->new_connection = false;
hcfg = dwc2_readl(hsotg->regs + HCFG); hcfg = dwc2_readl(hsotg->regs + HCFG);
hcfg &= ~HCFG_DESCDMA; hcfg &= ~HCFG_DESCDMA;
...@@ -604,7 +604,7 @@ static enum dwc2_halt_status dwc2_update_isoc_urb_state( ...@@ -604,7 +604,7 @@ static enum dwc2_halt_status dwc2_update_isoc_urb_state(
/* Skip whole frame */ /* Skip whole frame */
if (chan->qh->do_split && if (chan->qh->do_split &&
chan->ep_type == USB_ENDPOINT_XFER_ISOC && chan->ep_is_in && chan->ep_type == USB_ENDPOINT_XFER_ISOC && chan->ep_is_in &&
hsotg->core_params->dma_enable > 0) { hsotg->params.dma_enable > 0) {
qtd->complete_split = 0; qtd->complete_split = 0;
qtd->isoc_split_offset = 0; qtd->isoc_split_offset = 0;
} }
...@@ -743,7 +743,7 @@ static void dwc2_release_channel(struct dwc2_hsotg *hsotg, ...@@ -743,7 +743,7 @@ static void dwc2_release_channel(struct dwc2_hsotg *hsotg,
dwc2_hc_cleanup(hsotg, chan); dwc2_hc_cleanup(hsotg, chan);
list_add_tail(&chan->hc_list_entry, &hsotg->free_hc_list); list_add_tail(&chan->hc_list_entry, &hsotg->free_hc_list);
if (hsotg->core_params->uframe_sched > 0) { if (hsotg->params.uframe_sched > 0) {
hsotg->available_host_channels++; hsotg->available_host_channels++;
} else { } else {
switch (chan->ep_type) { switch (chan->ep_type) {
...@@ -789,7 +789,7 @@ static void dwc2_halt_channel(struct dwc2_hsotg *hsotg, ...@@ -789,7 +789,7 @@ static void dwc2_halt_channel(struct dwc2_hsotg *hsotg,
if (dbg_hc(chan)) if (dbg_hc(chan))
dev_vdbg(hsotg->dev, "%s()\n", __func__); dev_vdbg(hsotg->dev, "%s()\n", __func__);
if (hsotg->core_params->dma_enable > 0) { if (hsotg->params.dma_enable > 0) {
if (dbg_hc(chan)) if (dbg_hc(chan))
dev_vdbg(hsotg->dev, "DMA enabled\n"); dev_vdbg(hsotg->dev, "DMA enabled\n");
dwc2_release_channel(hsotg, chan, qtd, halt_status); dwc2_release_channel(hsotg, chan, qtd, halt_status);
...@@ -974,7 +974,7 @@ static void dwc2_hc_xfercomp_intr(struct dwc2_hsotg *hsotg, ...@@ -974,7 +974,7 @@ static void dwc2_hc_xfercomp_intr(struct dwc2_hsotg *hsotg,
pipe_type = dwc2_hcd_get_pipe_type(&urb->pipe_info); pipe_type = dwc2_hcd_get_pipe_type(&urb->pipe_info);
if (hsotg->core_params->dma_desc_enable > 0) { if (hsotg->params.dma_desc_enable > 0) {
dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, halt_status); dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, halt_status);
if (pipe_type == USB_ENDPOINT_XFER_ISOC) if (pipe_type == USB_ENDPOINT_XFER_ISOC)
/* Do not disable the interrupt, just clear it */ /* Do not disable the interrupt, just clear it */
...@@ -985,7 +985,7 @@ static void dwc2_hc_xfercomp_intr(struct dwc2_hsotg *hsotg, ...@@ -985,7 +985,7 @@ static void dwc2_hc_xfercomp_intr(struct dwc2_hsotg *hsotg,
/* Handle xfer complete on CSPLIT */ /* Handle xfer complete on CSPLIT */
if (chan->qh->do_split) { if (chan->qh->do_split) {
if (chan->ep_type == USB_ENDPOINT_XFER_ISOC && chan->ep_is_in && if (chan->ep_type == USB_ENDPOINT_XFER_ISOC && chan->ep_is_in &&
hsotg->core_params->dma_enable > 0) { hsotg->params.dma_enable > 0) {
if (qtd->complete_split && if (qtd->complete_split &&
dwc2_xfercomp_isoc_split_in(hsotg, chan, chnum, dwc2_xfercomp_isoc_split_in(hsotg, chan, chnum,
qtd)) qtd))
...@@ -1097,7 +1097,7 @@ static void dwc2_hc_stall_intr(struct dwc2_hsotg *hsotg, ...@@ -1097,7 +1097,7 @@ static void dwc2_hc_stall_intr(struct dwc2_hsotg *hsotg,
dev_dbg(hsotg->dev, "--Host Channel %d Interrupt: STALL Received--\n", dev_dbg(hsotg->dev, "--Host Channel %d Interrupt: STALL Received--\n",
chnum); chnum);
if (hsotg->core_params->dma_desc_enable > 0) { if (hsotg->params.dma_desc_enable > 0) {
dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,
DWC2_HC_XFER_STALL); DWC2_HC_XFER_STALL);
goto handle_stall_done; goto handle_stall_done;
...@@ -1207,7 +1207,7 @@ static void dwc2_hc_nak_intr(struct dwc2_hsotg *hsotg, ...@@ -1207,7 +1207,7 @@ static void dwc2_hc_nak_intr(struct dwc2_hsotg *hsotg,
switch (dwc2_hcd_get_pipe_type(&qtd->urb->pipe_info)) { switch (dwc2_hcd_get_pipe_type(&qtd->urb->pipe_info)) {
case USB_ENDPOINT_XFER_CONTROL: case USB_ENDPOINT_XFER_CONTROL:
case USB_ENDPOINT_XFER_BULK: case USB_ENDPOINT_XFER_BULK:
if (hsotg->core_params->dma_enable > 0 && chan->ep_is_in) { if (hsotg->params.dma_enable > 0 && chan->ep_is_in) {
/* /*
* NAK interrupts are enabled on bulk/control IN * NAK interrupts are enabled on bulk/control IN
* transfers in DMA mode for the sole purpose of * transfers in DMA mode for the sole purpose of
...@@ -1353,7 +1353,7 @@ static void dwc2_hc_nyet_intr(struct dwc2_hsotg *hsotg, ...@@ -1353,7 +1353,7 @@ static void dwc2_hc_nyet_intr(struct dwc2_hsotg *hsotg,
*/ */
if (chan->do_split && chan->complete_split) { if (chan->do_split && chan->complete_split) {
if (chan->ep_is_in && chan->ep_type == USB_ENDPOINT_XFER_ISOC && if (chan->ep_is_in && chan->ep_type == USB_ENDPOINT_XFER_ISOC &&
hsotg->core_params->dma_enable > 0) { hsotg->params.dma_enable > 0) {
qtd->complete_split = 0; qtd->complete_split = 0;
qtd->isoc_split_offset = 0; qtd->isoc_split_offset = 0;
qtd->isoc_frame_index++; qtd->isoc_frame_index++;
...@@ -1374,7 +1374,7 @@ static void dwc2_hc_nyet_intr(struct dwc2_hsotg *hsotg, ...@@ -1374,7 +1374,7 @@ static void dwc2_hc_nyet_intr(struct dwc2_hsotg *hsotg,
struct dwc2_qh *qh = chan->qh; struct dwc2_qh *qh = chan->qh;
bool past_end; bool past_end;
if (hsotg->core_params->uframe_sched <= 0) { if (hsotg->params.uframe_sched <= 0) {
int frnum = dwc2_hcd_get_frame_number(hsotg); int frnum = dwc2_hcd_get_frame_number(hsotg);
/* Don't have num_hs_transfers; simple logic */ /* Don't have num_hs_transfers; simple logic */
...@@ -1467,7 +1467,7 @@ static void dwc2_hc_babble_intr(struct dwc2_hsotg *hsotg, ...@@ -1467,7 +1467,7 @@ static void dwc2_hc_babble_intr(struct dwc2_hsotg *hsotg,
dwc2_hc_handle_tt_clear(hsotg, chan, qtd); dwc2_hc_handle_tt_clear(hsotg, chan, qtd);
if (hsotg->core_params->dma_desc_enable > 0) { if (hsotg->params.dma_desc_enable > 0) {
dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,
DWC2_HC_XFER_BABBLE_ERR); DWC2_HC_XFER_BABBLE_ERR);
goto disable_int; goto disable_int;
...@@ -1572,7 +1572,7 @@ static void dwc2_hc_ahberr_intr(struct dwc2_hsotg *hsotg, ...@@ -1572,7 +1572,7 @@ static void dwc2_hc_ahberr_intr(struct dwc2_hsotg *hsotg,
dev_err(hsotg->dev, " Interval: %d\n", urb->interval); dev_err(hsotg->dev, " Interval: %d\n", urb->interval);
/* Core halts the channel for Descriptor DMA mode */ /* Core halts the channel for Descriptor DMA mode */
if (hsotg->core_params->dma_desc_enable > 0) { if (hsotg->params.dma_desc_enable > 0) {
dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,
DWC2_HC_XFER_AHB_ERR); DWC2_HC_XFER_AHB_ERR);
goto handle_ahberr_done; goto handle_ahberr_done;
...@@ -1604,7 +1604,7 @@ static void dwc2_hc_xacterr_intr(struct dwc2_hsotg *hsotg, ...@@ -1604,7 +1604,7 @@ static void dwc2_hc_xacterr_intr(struct dwc2_hsotg *hsotg,
dwc2_hc_handle_tt_clear(hsotg, chan, qtd); dwc2_hc_handle_tt_clear(hsotg, chan, qtd);
if (hsotg->core_params->dma_desc_enable > 0) { if (hsotg->params.dma_desc_enable > 0) {
dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,
DWC2_HC_XFER_XACT_ERR); DWC2_HC_XFER_XACT_ERR);
goto handle_xacterr_done; goto handle_xacterr_done;
...@@ -1798,8 +1798,8 @@ static void dwc2_hc_chhltd_intr_dma(struct dwc2_hsotg *hsotg, ...@@ -1798,8 +1798,8 @@ static void dwc2_hc_chhltd_intr_dma(struct dwc2_hsotg *hsotg,
if (chan->halt_status == DWC2_HC_XFER_URB_DEQUEUE || if (chan->halt_status == DWC2_HC_XFER_URB_DEQUEUE ||
(chan->halt_status == DWC2_HC_XFER_AHB_ERR && (chan->halt_status == DWC2_HC_XFER_AHB_ERR &&
hsotg->core_params->dma_desc_enable <= 0)) { hsotg->params.dma_desc_enable <= 0)) {
if (hsotg->core_params->dma_desc_enable > 0) if (hsotg->params.dma_desc_enable > 0)
dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,
chan->halt_status); chan->halt_status);
else else
...@@ -1830,7 +1830,7 @@ static void dwc2_hc_chhltd_intr_dma(struct dwc2_hsotg *hsotg, ...@@ -1830,7 +1830,7 @@ static void dwc2_hc_chhltd_intr_dma(struct dwc2_hsotg *hsotg,
} else if (chan->hcint & HCINTMSK_STALL) { } else if (chan->hcint & HCINTMSK_STALL) {
dwc2_hc_stall_intr(hsotg, chan, chnum, qtd); dwc2_hc_stall_intr(hsotg, chan, chnum, qtd);
} else if ((chan->hcint & HCINTMSK_XACTERR) && } else if ((chan->hcint & HCINTMSK_XACTERR) &&
hsotg->core_params->dma_desc_enable <= 0) { hsotg->params.dma_desc_enable <= 0) {
if (out_nak_enh) { if (out_nak_enh) {
if (chan->hcint & if (chan->hcint &
(HCINTMSK_NYET | HCINTMSK_NAK | HCINTMSK_ACK)) { (HCINTMSK_NYET | HCINTMSK_NAK | HCINTMSK_ACK)) {
...@@ -1850,10 +1850,10 @@ static void dwc2_hc_chhltd_intr_dma(struct dwc2_hsotg *hsotg, ...@@ -1850,10 +1850,10 @@ static void dwc2_hc_chhltd_intr_dma(struct dwc2_hsotg *hsotg,
*/ */
dwc2_hc_xacterr_intr(hsotg, chan, chnum, qtd); dwc2_hc_xacterr_intr(hsotg, chan, chnum, qtd);
} else if ((chan->hcint & HCINTMSK_XCS_XACT) && } else if ((chan->hcint & HCINTMSK_XCS_XACT) &&
hsotg->core_params->dma_desc_enable > 0) { hsotg->params.dma_desc_enable > 0) {
dwc2_hc_xacterr_intr(hsotg, chan, chnum, qtd); dwc2_hc_xacterr_intr(hsotg, chan, chnum, qtd);
} else if ((chan->hcint & HCINTMSK_AHBERR) && } else if ((chan->hcint & HCINTMSK_AHBERR) &&
hsotg->core_params->dma_desc_enable > 0) { hsotg->params.dma_desc_enable > 0) {
dwc2_hc_ahberr_intr(hsotg, chan, chnum, qtd); dwc2_hc_ahberr_intr(hsotg, chan, chnum, qtd);
} else if (chan->hcint & HCINTMSK_BBLERR) { } else if (chan->hcint & HCINTMSK_BBLERR) {
dwc2_hc_babble_intr(hsotg, chan, chnum, qtd); dwc2_hc_babble_intr(hsotg, chan, chnum, qtd);
...@@ -1946,7 +1946,7 @@ static void dwc2_hc_chhltd_intr(struct dwc2_hsotg *hsotg, ...@@ -1946,7 +1946,7 @@ static void dwc2_hc_chhltd_intr(struct dwc2_hsotg *hsotg,
dev_vdbg(hsotg->dev, "--Host Channel %d Interrupt: Channel Halted--\n", dev_vdbg(hsotg->dev, "--Host Channel %d Interrupt: Channel Halted--\n",
chnum); chnum);
if (hsotg->core_params->dma_enable > 0) { if (hsotg->params.dma_enable > 0) {
dwc2_hc_chhltd_intr_dma(hsotg, chan, chnum, qtd); dwc2_hc_chhltd_intr_dma(hsotg, chan, chnum, qtd);
} else { } else {
if (!dwc2_halt_status_ok(hsotg, chan, chnum, qtd)) if (!dwc2_halt_status_ok(hsotg, chan, chnum, qtd))
...@@ -2023,7 +2023,7 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum) ...@@ -2023,7 +2023,7 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum)
* interrupt unmasked * interrupt unmasked
*/ */
WARN_ON(hcint != HCINTMSK_CHHLTD); WARN_ON(hcint != HCINTMSK_CHHLTD);
if (hsotg->core_params->dma_desc_enable > 0) if (hsotg->params.dma_desc_enable > 0)
dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,
chan->halt_status); chan->halt_status);
else else
...@@ -2051,7 +2051,7 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum) ...@@ -2051,7 +2051,7 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum)
qtd = list_first_entry(&chan->qh->qtd_list, struct dwc2_qtd, qtd = list_first_entry(&chan->qh->qtd_list, struct dwc2_qtd,
qtd_list_entry); qtd_list_entry);
if (hsotg->core_params->dma_enable <= 0) { if (hsotg->params.dma_enable <= 0) {
if ((hcint & HCINTMSK_CHHLTD) && hcint != HCINTMSK_CHHLTD) if ((hcint & HCINTMSK_CHHLTD) && hcint != HCINTMSK_CHHLTD)
hcint &= ~HCINTMSK_CHHLTD; hcint &= ~HCINTMSK_CHHLTD;
} }
...@@ -2156,7 +2156,7 @@ static void dwc2_hc_intr(struct dwc2_hsotg *hsotg) ...@@ -2156,7 +2156,7 @@ static void dwc2_hc_intr(struct dwc2_hsotg *hsotg)
} }
} }
for (i = 0; i < hsotg->core_params->host_channels; i++) { for (i = 0; i < hsotg->params.host_channels; i++) {
if (haint & (1 << i)) if (haint & (1 << i))
dwc2_hc_n_intr(hsotg, i); dwc2_hc_n_intr(hsotg, i);
} }
......
...@@ -75,7 +75,7 @@ static int dwc2_periodic_channel_available(struct dwc2_hsotg *hsotg) ...@@ -75,7 +75,7 @@ static int dwc2_periodic_channel_available(struct dwc2_hsotg *hsotg)
int status; int status;
int num_channels; int num_channels;
num_channels = hsotg->core_params->host_channels; num_channels = hsotg->params.host_channels;
if (hsotg->periodic_channels + hsotg->non_periodic_channels < if (hsotg->periodic_channels + hsotg->non_periodic_channels <
num_channels num_channels
&& hsotg->periodic_channels < num_channels - 1) { && hsotg->periodic_channels < num_channels - 1) {
...@@ -1104,7 +1104,7 @@ static void dwc2_pick_first_frame(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -1104,7 +1104,7 @@ static void dwc2_pick_first_frame(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
next_active_frame = earliest_frame; next_active_frame = earliest_frame;
/* Get the "no microframe schduler" out of the way... */ /* Get the "no microframe schduler" out of the way... */
if (hsotg->core_params->uframe_sched <= 0) { if (hsotg->params.uframe_sched <= 0) {
if (qh->do_split) if (qh->do_split)
/* Splits are active at microframe 0 minus 1 */ /* Splits are active at microframe 0 minus 1 */
next_active_frame |= 0x7; next_active_frame |= 0x7;
...@@ -1197,7 +1197,7 @@ static int dwc2_do_reserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -1197,7 +1197,7 @@ static int dwc2_do_reserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
{ {
int status; int status;
if (hsotg->core_params->uframe_sched > 0) { if (hsotg->params.uframe_sched > 0) {
status = dwc2_uframe_schedule(hsotg, qh); status = dwc2_uframe_schedule(hsotg, qh);
} else { } else {
status = dwc2_periodic_channel_available(hsotg); status = dwc2_periodic_channel_available(hsotg);
...@@ -1218,7 +1218,7 @@ static int dwc2_do_reserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -1218,7 +1218,7 @@ static int dwc2_do_reserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
return status; return status;
} }
if (hsotg->core_params->uframe_sched <= 0) if (hsotg->params.uframe_sched <= 0)
/* Reserve periodic channel */ /* Reserve periodic channel */
hsotg->periodic_channels++; hsotg->periodic_channels++;
...@@ -1254,7 +1254,7 @@ static void dwc2_do_unreserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -1254,7 +1254,7 @@ static void dwc2_do_unreserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
/* Update claimed usecs per (micro)frame */ /* Update claimed usecs per (micro)frame */
hsotg->periodic_usecs -= qh->host_us; hsotg->periodic_usecs -= qh->host_us;
if (hsotg->core_params->uframe_sched > 0) { if (hsotg->params.uframe_sched > 0) {
dwc2_uframe_unschedule(hsotg, qh); dwc2_uframe_unschedule(hsotg, qh);
} else { } else {
/* Release periodic channel reservation */ /* Release periodic channel reservation */
...@@ -1328,7 +1328,7 @@ static int dwc2_check_max_xfer_size(struct dwc2_hsotg *hsotg, ...@@ -1328,7 +1328,7 @@ static int dwc2_check_max_xfer_size(struct dwc2_hsotg *hsotg,
int status = 0; int status = 0;
max_xfer_size = dwc2_max_packet(qh->maxp) * dwc2_hb_mult(qh->maxp); max_xfer_size = dwc2_max_packet(qh->maxp) * dwc2_hb_mult(qh->maxp);
max_channel_xfer_size = hsotg->core_params->max_transfer_size; max_channel_xfer_size = hsotg->params.max_transfer_size;
if (max_xfer_size > max_channel_xfer_size) { if (max_xfer_size > max_channel_xfer_size) {
dev_err(hsotg->dev, dev_err(hsotg->dev,
...@@ -1391,7 +1391,7 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -1391,7 +1391,7 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
qh->unreserve_pending = 0; qh->unreserve_pending = 0;
if (hsotg->core_params->dma_desc_enable > 0) if (hsotg->params.dma_desc_enable > 0)
/* Don't rely on SOF and start in ready schedule */ /* Don't rely on SOF and start in ready schedule */
list_add_tail(&qh->qh_list_entry, &hsotg->periodic_sched_ready); list_add_tail(&qh->qh_list_entry, &hsotg->periodic_sched_ready);
else else
...@@ -1599,7 +1599,7 @@ struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, ...@@ -1599,7 +1599,7 @@ struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg,
dwc2_qh_init(hsotg, qh, urb, mem_flags); dwc2_qh_init(hsotg, qh, urb, mem_flags);
if (hsotg->core_params->dma_desc_enable > 0 && if (hsotg->params.dma_desc_enable > 0 &&
dwc2_hcd_qh_init_ddma(hsotg, qh, mem_flags) < 0) { dwc2_hcd_qh_init_ddma(hsotg, qh, mem_flags) < 0) {
dwc2_hcd_qh_free(hsotg, qh); dwc2_hcd_qh_free(hsotg, qh);
return NULL; return NULL;
...@@ -1711,7 +1711,7 @@ void dwc2_hcd_qh_unlink(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -1711,7 +1711,7 @@ void dwc2_hcd_qh_unlink(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
dwc2_deschedule_periodic(hsotg, qh); dwc2_deschedule_periodic(hsotg, qh);
hsotg->periodic_qh_count--; hsotg->periodic_qh_count--;
if (!hsotg->periodic_qh_count && if (!hsotg->periodic_qh_count &&
hsotg->core_params->dma_desc_enable <= 0) { hsotg->params.dma_desc_enable <= 0) {
intr_mask = dwc2_readl(hsotg->regs + GINTMSK); intr_mask = dwc2_readl(hsotg->regs + GINTMSK);
intr_mask &= ~GINTSTS_SOF; intr_mask &= ~GINTSTS_SOF;
dwc2_writel(intr_mask, hsotg->regs + GINTMSK); dwc2_writel(intr_mask, hsotg->regs + GINTMSK);
......
...@@ -264,7 +264,7 @@ void dwc2_set_param_otg_cap(struct dwc2_hsotg *hsotg, int val) ...@@ -264,7 +264,7 @@ void dwc2_set_param_otg_cap(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting otg_cap to %d\n", val); dev_dbg(hsotg->dev, "Setting otg_cap to %d\n", val);
} }
hsotg->core_params->otg_cap = val; hsotg->params.otg_cap = val;
} }
void dwc2_set_param_dma_enable(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_dma_enable(struct dwc2_hsotg *hsotg, int val)
...@@ -285,14 +285,14 @@ void dwc2_set_param_dma_enable(struct dwc2_hsotg *hsotg, int val) ...@@ -285,14 +285,14 @@ void dwc2_set_param_dma_enable(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting dma_enable to %d\n", val); dev_dbg(hsotg->dev, "Setting dma_enable to %d\n", val);
} }
hsotg->core_params->dma_enable = val; hsotg->params.dma_enable = val;
} }
void dwc2_set_param_dma_desc_enable(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_dma_desc_enable(struct dwc2_hsotg *hsotg, int val)
{ {
int valid = 1; int valid = 1;
if (val > 0 && (hsotg->core_params->dma_enable <= 0 || if (val > 0 && (hsotg->params.dma_enable <= 0 ||
!hsotg->hw_params.dma_desc_enable)) !hsotg->hw_params.dma_desc_enable))
valid = 0; valid = 0;
if (val < 0) if (val < 0)
...@@ -303,19 +303,19 @@ void dwc2_set_param_dma_desc_enable(struct dwc2_hsotg *hsotg, int val) ...@@ -303,19 +303,19 @@ void dwc2_set_param_dma_desc_enable(struct dwc2_hsotg *hsotg, int val)
dev_err(hsotg->dev, dev_err(hsotg->dev,
"%d invalid for dma_desc_enable parameter. Check HW configuration.\n", "%d invalid for dma_desc_enable parameter. Check HW configuration.\n",
val); val);
val = (hsotg->core_params->dma_enable > 0 && val = (hsotg->params.dma_enable > 0 &&
hsotg->hw_params.dma_desc_enable); hsotg->hw_params.dma_desc_enable);
dev_dbg(hsotg->dev, "Setting dma_desc_enable to %d\n", val); dev_dbg(hsotg->dev, "Setting dma_desc_enable to %d\n", val);
} }
hsotg->core_params->dma_desc_enable = val; hsotg->params.dma_desc_enable = val;
} }
void dwc2_set_param_dma_desc_fs_enable(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_dma_desc_fs_enable(struct dwc2_hsotg *hsotg, int val)
{ {
int valid = 1; int valid = 1;
if (val > 0 && (hsotg->core_params->dma_enable <= 0 || if (val > 0 && (hsotg->params.dma_enable <= 0 ||
!hsotg->hw_params.dma_desc_enable)) !hsotg->hw_params.dma_desc_enable))
valid = 0; valid = 0;
if (val < 0) if (val < 0)
...@@ -326,11 +326,11 @@ void dwc2_set_param_dma_desc_fs_enable(struct dwc2_hsotg *hsotg, int val) ...@@ -326,11 +326,11 @@ void dwc2_set_param_dma_desc_fs_enable(struct dwc2_hsotg *hsotg, int val)
dev_err(hsotg->dev, dev_err(hsotg->dev,
"%d invalid for dma_desc_fs_enable parameter. Check HW configuration.\n", "%d invalid for dma_desc_fs_enable parameter. Check HW configuration.\n",
val); val);
val = (hsotg->core_params->dma_enable > 0 && val = (hsotg->params.dma_enable > 0 &&
hsotg->hw_params.dma_desc_enable); hsotg->hw_params.dma_desc_enable);
} }
hsotg->core_params->dma_desc_fs_enable = val; hsotg->params.dma_desc_fs_enable = val;
dev_dbg(hsotg->dev, "Setting dma_desc_fs_enable to %d\n", val); dev_dbg(hsotg->dev, "Setting dma_desc_fs_enable to %d\n", val);
} }
...@@ -349,7 +349,7 @@ void dwc2_set_param_host_support_fs_ls_low_power(struct dwc2_hsotg *hsotg, ...@@ -349,7 +349,7 @@ void dwc2_set_param_host_support_fs_ls_low_power(struct dwc2_hsotg *hsotg,
"Setting host_support_fs_low_power to %d\n", val); "Setting host_support_fs_low_power to %d\n", val);
} }
hsotg->core_params->host_support_fs_ls_low_power = val; hsotg->params.host_support_fs_ls_low_power = val;
} }
void dwc2_set_param_enable_dynamic_fifo(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_enable_dynamic_fifo(struct dwc2_hsotg *hsotg, int val)
...@@ -370,7 +370,7 @@ void dwc2_set_param_enable_dynamic_fifo(struct dwc2_hsotg *hsotg, int val) ...@@ -370,7 +370,7 @@ void dwc2_set_param_enable_dynamic_fifo(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting enable_dynamic_fifo to %d\n", val); dev_dbg(hsotg->dev, "Setting enable_dynamic_fifo to %d\n", val);
} }
hsotg->core_params->enable_dynamic_fifo = val; hsotg->params.enable_dynamic_fifo = val;
} }
void dwc2_set_param_host_rx_fifo_size(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_host_rx_fifo_size(struct dwc2_hsotg *hsotg, int val)
...@@ -389,7 +389,7 @@ void dwc2_set_param_host_rx_fifo_size(struct dwc2_hsotg *hsotg, int val) ...@@ -389,7 +389,7 @@ void dwc2_set_param_host_rx_fifo_size(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting host_rx_fifo_size to %d\n", val); dev_dbg(hsotg->dev, "Setting host_rx_fifo_size to %d\n", val);
} }
hsotg->core_params->host_rx_fifo_size = val; hsotg->params.host_rx_fifo_size = val;
} }
void dwc2_set_param_host_nperio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_host_nperio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val)
...@@ -409,7 +409,7 @@ void dwc2_set_param_host_nperio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val) ...@@ -409,7 +409,7 @@ void dwc2_set_param_host_nperio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val)
val); val);
} }
hsotg->core_params->host_nperio_tx_fifo_size = val; hsotg->params.host_nperio_tx_fifo_size = val;
} }
void dwc2_set_param_host_perio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_host_perio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val)
...@@ -429,7 +429,7 @@ void dwc2_set_param_host_perio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val) ...@@ -429,7 +429,7 @@ void dwc2_set_param_host_perio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val)
val); val);
} }
hsotg->core_params->host_perio_tx_fifo_size = val; hsotg->params.host_perio_tx_fifo_size = val;
} }
void dwc2_set_param_max_transfer_size(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_max_transfer_size(struct dwc2_hsotg *hsotg, int val)
...@@ -448,7 +448,7 @@ void dwc2_set_param_max_transfer_size(struct dwc2_hsotg *hsotg, int val) ...@@ -448,7 +448,7 @@ void dwc2_set_param_max_transfer_size(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting max_transfer_size to %d\n", val); dev_dbg(hsotg->dev, "Setting max_transfer_size to %d\n", val);
} }
hsotg->core_params->max_transfer_size = val; hsotg->params.max_transfer_size = val;
} }
void dwc2_set_param_max_packet_count(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_max_packet_count(struct dwc2_hsotg *hsotg, int val)
...@@ -467,7 +467,7 @@ void dwc2_set_param_max_packet_count(struct dwc2_hsotg *hsotg, int val) ...@@ -467,7 +467,7 @@ void dwc2_set_param_max_packet_count(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting max_packet_count to %d\n", val); dev_dbg(hsotg->dev, "Setting max_packet_count to %d\n", val);
} }
hsotg->core_params->max_packet_count = val; hsotg->params.max_packet_count = val;
} }
void dwc2_set_param_host_channels(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_host_channels(struct dwc2_hsotg *hsotg, int val)
...@@ -486,7 +486,7 @@ void dwc2_set_param_host_channels(struct dwc2_hsotg *hsotg, int val) ...@@ -486,7 +486,7 @@ void dwc2_set_param_host_channels(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting host_channels to %d\n", val); dev_dbg(hsotg->dev, "Setting host_channels to %d\n", val);
} }
hsotg->core_params->host_channels = val; hsotg->params.host_channels = val;
} }
void dwc2_set_param_phy_type(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_phy_type(struct dwc2_hsotg *hsotg, int val)
...@@ -534,12 +534,12 @@ void dwc2_set_param_phy_type(struct dwc2_hsotg *hsotg, int val) ...@@ -534,12 +534,12 @@ void dwc2_set_param_phy_type(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting phy_type to %d\n", val); dev_dbg(hsotg->dev, "Setting phy_type to %d\n", val);
} }
hsotg->core_params->phy_type = val; hsotg->params.phy_type = val;
} }
static int dwc2_get_param_phy_type(struct dwc2_hsotg *hsotg) static int dwc2_get_param_phy_type(struct dwc2_hsotg *hsotg)
{ {
return hsotg->core_params->phy_type; return hsotg->params.phy_type;
} }
void dwc2_set_param_speed(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_speed(struct dwc2_hsotg *hsotg, int val)
...@@ -568,7 +568,7 @@ void dwc2_set_param_speed(struct dwc2_hsotg *hsotg, int val) ...@@ -568,7 +568,7 @@ void dwc2_set_param_speed(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting speed to %d\n", val); dev_dbg(hsotg->dev, "Setting speed to %d\n", val);
} }
hsotg->core_params->speed = val; hsotg->params.speed = val;
} }
void dwc2_set_param_host_ls_low_power_phy_clk(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_host_ls_low_power_phy_clk(struct dwc2_hsotg *hsotg, int val)
...@@ -602,7 +602,7 @@ void dwc2_set_param_host_ls_low_power_phy_clk(struct dwc2_hsotg *hsotg, int val) ...@@ -602,7 +602,7 @@ void dwc2_set_param_host_ls_low_power_phy_clk(struct dwc2_hsotg *hsotg, int val)
val); val);
} }
hsotg->core_params->host_ls_low_power_phy_clk = val; hsotg->params.host_ls_low_power_phy_clk = val;
} }
void dwc2_set_param_phy_ulpi_ddr(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_phy_ulpi_ddr(struct dwc2_hsotg *hsotg, int val)
...@@ -616,7 +616,7 @@ void dwc2_set_param_phy_ulpi_ddr(struct dwc2_hsotg *hsotg, int val) ...@@ -616,7 +616,7 @@ void dwc2_set_param_phy_ulpi_ddr(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting phy_upli_ddr to %d\n", val); dev_dbg(hsotg->dev, "Setting phy_upli_ddr to %d\n", val);
} }
hsotg->core_params->phy_ulpi_ddr = val; hsotg->params.phy_ulpi_ddr = val;
} }
void dwc2_set_param_phy_ulpi_ext_vbus(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_phy_ulpi_ext_vbus(struct dwc2_hsotg *hsotg, int val)
...@@ -632,7 +632,7 @@ void dwc2_set_param_phy_ulpi_ext_vbus(struct dwc2_hsotg *hsotg, int val) ...@@ -632,7 +632,7 @@ void dwc2_set_param_phy_ulpi_ext_vbus(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting phy_ulpi_ext_vbus to %d\n", val); dev_dbg(hsotg->dev, "Setting phy_ulpi_ext_vbus to %d\n", val);
} }
hsotg->core_params->phy_ulpi_ext_vbus = val; hsotg->params.phy_ulpi_ext_vbus = val;
} }
void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg, int val)
...@@ -662,7 +662,7 @@ void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg, int val) ...@@ -662,7 +662,7 @@ void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting phy_utmi_width to %d\n", val); dev_dbg(hsotg->dev, "Setting phy_utmi_width to %d\n", val);
} }
hsotg->core_params->phy_utmi_width = val; hsotg->params.phy_utmi_width = val;
} }
void dwc2_set_param_ulpi_fs_ls(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_ulpi_fs_ls(struct dwc2_hsotg *hsotg, int val)
...@@ -676,7 +676,7 @@ void dwc2_set_param_ulpi_fs_ls(struct dwc2_hsotg *hsotg, int val) ...@@ -676,7 +676,7 @@ void dwc2_set_param_ulpi_fs_ls(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting ulpi_fs_ls to %d\n", val); dev_dbg(hsotg->dev, "Setting ulpi_fs_ls to %d\n", val);
} }
hsotg->core_params->ulpi_fs_ls = val; hsotg->params.ulpi_fs_ls = val;
} }
void dwc2_set_param_ts_dline(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_ts_dline(struct dwc2_hsotg *hsotg, int val)
...@@ -690,7 +690,7 @@ void dwc2_set_param_ts_dline(struct dwc2_hsotg *hsotg, int val) ...@@ -690,7 +690,7 @@ void dwc2_set_param_ts_dline(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting ts_dline to %d\n", val); dev_dbg(hsotg->dev, "Setting ts_dline to %d\n", val);
} }
hsotg->core_params->ts_dline = val; hsotg->params.ts_dline = val;
} }
void dwc2_set_param_i2c_enable(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_i2c_enable(struct dwc2_hsotg *hsotg, int val)
...@@ -718,7 +718,7 @@ void dwc2_set_param_i2c_enable(struct dwc2_hsotg *hsotg, int val) ...@@ -718,7 +718,7 @@ void dwc2_set_param_i2c_enable(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting i2c_enable to %d\n", val); dev_dbg(hsotg->dev, "Setting i2c_enable to %d\n", val);
} }
hsotg->core_params->i2c_enable = val; hsotg->params.i2c_enable = val;
} }
void dwc2_set_param_en_multiple_tx_fifo(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_en_multiple_tx_fifo(struct dwc2_hsotg *hsotg, int val)
...@@ -747,7 +747,7 @@ void dwc2_set_param_en_multiple_tx_fifo(struct dwc2_hsotg *hsotg, int val) ...@@ -747,7 +747,7 @@ void dwc2_set_param_en_multiple_tx_fifo(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting en_multiple_tx_fifo to %d\n", val); dev_dbg(hsotg->dev, "Setting en_multiple_tx_fifo to %d\n", val);
} }
hsotg->core_params->en_multiple_tx_fifo = val; hsotg->params.en_multiple_tx_fifo = val;
} }
void dwc2_set_param_reload_ctl(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_reload_ctl(struct dwc2_hsotg *hsotg, int val)
...@@ -775,15 +775,15 @@ void dwc2_set_param_reload_ctl(struct dwc2_hsotg *hsotg, int val) ...@@ -775,15 +775,15 @@ void dwc2_set_param_reload_ctl(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting reload_ctl to %d\n", val); dev_dbg(hsotg->dev, "Setting reload_ctl to %d\n", val);
} }
hsotg->core_params->reload_ctl = val; hsotg->params.reload_ctl = val;
} }
void dwc2_set_param_ahbcfg(struct dwc2_hsotg *hsotg, int val) void dwc2_set_param_ahbcfg(struct dwc2_hsotg *hsotg, int val)
{ {
if (val != -1) if (val != -1)
hsotg->core_params->ahbcfg = val; hsotg->params.ahbcfg = val;
else else
hsotg->core_params->ahbcfg = GAHBCFG_HBSTLEN_INCR4 << hsotg->params.ahbcfg = GAHBCFG_HBSTLEN_INCR4 <<
GAHBCFG_HBSTLEN_SHIFT; GAHBCFG_HBSTLEN_SHIFT;
} }
...@@ -800,7 +800,7 @@ void dwc2_set_param_otg_ver(struct dwc2_hsotg *hsotg, int val) ...@@ -800,7 +800,7 @@ void dwc2_set_param_otg_ver(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting otg_ver to %d\n", val); dev_dbg(hsotg->dev, "Setting otg_ver to %d\n", val);
} }
hsotg->core_params->otg_ver = val; hsotg->params.otg_ver = val;
} }
static void dwc2_set_param_uframe_sched(struct dwc2_hsotg *hsotg, int val) static void dwc2_set_param_uframe_sched(struct dwc2_hsotg *hsotg, int val)
...@@ -816,7 +816,7 @@ static void dwc2_set_param_uframe_sched(struct dwc2_hsotg *hsotg, int val) ...@@ -816,7 +816,7 @@ static void dwc2_set_param_uframe_sched(struct dwc2_hsotg *hsotg, int val)
dev_dbg(hsotg->dev, "Setting uframe_sched to %d\n", val); dev_dbg(hsotg->dev, "Setting uframe_sched to %d\n", val);
} }
hsotg->core_params->uframe_sched = val; hsotg->params.uframe_sched = val;
} }
static void dwc2_set_param_external_id_pin_ctl(struct dwc2_hsotg *hsotg, static void dwc2_set_param_external_id_pin_ctl(struct dwc2_hsotg *hsotg,
...@@ -833,7 +833,7 @@ static void dwc2_set_param_external_id_pin_ctl(struct dwc2_hsotg *hsotg, ...@@ -833,7 +833,7 @@ static void dwc2_set_param_external_id_pin_ctl(struct dwc2_hsotg *hsotg,
dev_dbg(hsotg->dev, "Setting external_id_pin_ctl to %d\n", val); dev_dbg(hsotg->dev, "Setting external_id_pin_ctl to %d\n", val);
} }
hsotg->core_params->external_id_pin_ctl = val; hsotg->params.external_id_pin_ctl = val;
} }
static void dwc2_set_param_hibernation(struct dwc2_hsotg *hsotg, static void dwc2_set_param_hibernation(struct dwc2_hsotg *hsotg,
...@@ -850,7 +850,7 @@ static void dwc2_set_param_hibernation(struct dwc2_hsotg *hsotg, ...@@ -850,7 +850,7 @@ static void dwc2_set_param_hibernation(struct dwc2_hsotg *hsotg,
dev_dbg(hsotg->dev, "Setting hibernation to %d\n", val); dev_dbg(hsotg->dev, "Setting hibernation to %d\n", val);
} }
hsotg->core_params->hibernation = val; hsotg->params.hibernation = val;
} }
/* /*
......
...@@ -418,12 +418,7 @@ static int dwc2_driver_probe(struct platform_device *dev) ...@@ -418,12 +418,7 @@ static int dwc2_driver_probe(struct platform_device *dev)
spin_lock_init(&hsotg->lock); spin_lock_init(&hsotg->lock);
hsotg->core_params = devm_kzalloc(&dev->dev, dwc2_set_all_params(&hsotg->params, -1);
sizeof(*hsotg->core_params), GFP_KERNEL);
if (!hsotg->core_params)
return -ENOMEM;
dwc2_set_all_params(hsotg->core_params, -1);
hsotg->irq = platform_get_irq(dev, 0); hsotg->irq = platform_get_irq(dev, 0);
if (hsotg->irq < 0) { if (hsotg->irq < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment