* [PATCH] usb: dwc2: gadget: Replace phyif with phy_utmi_width
2019-05-04 9:52 [PATCH 1/2] dmaengine: fsl-edma: Fix typo in Vybrid name Krzysztof Kozlowski
@ 2019-05-04 9:52 ` Krzysztof Kozlowski
2019-05-04 9:52 ` [PATCH 2/2] dmaengine: fsl-edma: Adjust indentation Krzysztof Kozlowski
2019-05-04 10:21 ` [PATCH 1/2] dmaengine: fsl-edma: Fix typo in Vybrid name Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2019-05-04 9:52 UTC (permalink / raw)
To: Vinod Koul, Dan Williams, Minas Harutyunyan, Greg Kroah-Hartman,
dmaengine, linux-kernel, linux-usb
Cc: Jules Maselbas, Felipe Balbi
From: Jules Maselbas <jmaselbas@kalray.eu>
The phy utmi width information is already set in hsotg params,
phyif is only used in few places and I don't see any reason to
not use hsotg's params.
Moreover the utmi width was being forced to 16 bits by platform
initialization which doesn't take in account HW configuration.
Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
drivers/usb/dwc2/core.h | 2 --
drivers/usb/dwc2/gadget.c | 20 ++++++++++++++------
drivers/usb/dwc2/platform.c | 5 +----
3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 764c78ebee28..8e3edf10d76d 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -871,7 +871,6 @@ struct dwc2_hregs_backup {
* removed once all SoCs support usb transceiver.
* @supplies: Definition of USB power supplies
* @vbus_supply: Regulator supplying vbus.
- * @phyif: PHY interface width
* @lock: Spinlock that protects all the driver data structures
* @priv: Stores a pointer to the struct usb_hcd
* @queuing_high_bandwidth: True if multiple packets of a high-bandwidth
@@ -1056,7 +1055,6 @@ struct dwc2_hsotg {
struct dwc2_hsotg_plat *plat;
struct regulator_bulk_data supplies[DWC2_NUM_SUPPLIES];
struct regulator *vbus_supply;
- u32 phyif;
spinlock_t lock;
void *priv;
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 9b737c4e8f50..614f8c34d759 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3314,20 +3314,28 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
/* keep other bits untouched (so e.g. forced modes are not lost) */
usbcfg = dwc2_readl(hsotg, GUSBCFG);
+ /* remove the HNP/SRP */
usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
- GUSBCFG_HNPCAP | GUSBCFG_USBTRDTIM_MASK);
+ GUSBCFG_HNPCAP);
+ usbcfg |= GUSBCFG_TOUTCAL(7);
if (hsotg->params.phy_type == DWC2_PHY_TYPE_PARAM_FS &&
(hsotg->params.speed == DWC2_SPEED_PARAM_FULL ||
hsotg->params.speed == DWC2_SPEED_PARAM_LOW)) {
/* FS/LS Dedicated Transceiver Interface */
usbcfg |= GUSBCFG_PHYSEL;
- } else {
- /* set the PLL on, remove the HNP/SRP and set the PHY */
- val = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
- usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) |
- (val << GUSBCFG_USBTRDTIM_SHIFT);
+ } else if (hsotg->params.phy_type == DWC2_PHY_TYPE_PARAM_UTMI) {
+ if (hsotg->params.phy_utmi_width == 16)
+ usbcfg |= GUSBCFG_PHYIF16;
+
+ /* Set turnaround time */
+ usbcfg &= ~GUSBCFG_USBTRDTIM_MASK;
+ if (hsotg->params.phy_utmi_width == 16)
+ usbcfg |= 5 << GUSBCFG_USBTRDTIM_SHIFT;
+ else
+ usbcfg |= 9 << GUSBCFG_USBTRDTIM_SHIFT;
}
+
dwc2_writel(hsotg, usbcfg, GUSBCFG);
dwc2_hsotg_init_fifo(hsotg);
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index c01fa8ffc0c8..d10a7f8daec3 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -230,9 +230,6 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
reset_control_deassert(hsotg->reset_ecc);
- /* Set default UTMI width */
- hsotg->phyif = GUSBCFG_PHYIF16;
-
/*
* Attempt to find a generic PHY, then look for an old style
* USB PHY and then fall back to pdata
@@ -280,7 +277,7 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
* width is 8-bit and set the phyif appropriately.
*/
if (phy_get_bus_width(hsotg->phy) == 8)
- hsotg->phyif = GUSBCFG_PHYIF8;
+ hsotg->params.phy_utmi_width = 8;
}
/* Clock */
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] dmaengine: fsl-edma: Adjust indentation
2019-05-04 9:52 [PATCH 1/2] dmaengine: fsl-edma: Fix typo in Vybrid name Krzysztof Kozlowski
2019-05-04 9:52 ` [PATCH] usb: dwc2: gadget: Replace phyif with phy_utmi_width Krzysztof Kozlowski
@ 2019-05-04 9:52 ` Krzysztof Kozlowski
2019-05-04 10:21 ` [PATCH 1/2] dmaengine: fsl-edma: Fix typo in Vybrid name Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2019-05-04 9:52 UTC (permalink / raw)
To: Vinod Koul, Dan Williams, Minas Harutyunyan, Greg Kroah-Hartman,
dmaengine, linux-kernel, linux-usb
Cc: Krzysztof Kozlowski
Fix indentation and remove unneeded space after 'return' keyword. This
fixes checkpatch warning:
WARNING: Statements should start on a tabstop
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/dma/fsl-edma.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/fsl-edma.c b/drivers/dma/fsl-edma.c
index 75e8a7ba3a22..d641ef85a634 100644
--- a/drivers/dma/fsl-edma.c
+++ b/drivers/dma/fsl-edma.c
@@ -144,21 +144,21 @@ fsl_edma_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma
fsl_edma_irq_handler, 0, "eDMA", fsl_edma);
if (ret) {
dev_err(&pdev->dev, "Can't register eDMA IRQ.\n");
- return ret;
+ return ret;
}
} else {
ret = devm_request_irq(&pdev->dev, fsl_edma->txirq,
fsl_edma_tx_handler, 0, "eDMA tx", fsl_edma);
if (ret) {
dev_err(&pdev->dev, "Can't register eDMA tx IRQ.\n");
- return ret;
+ return ret;
}
ret = devm_request_irq(&pdev->dev, fsl_edma->errirq,
fsl_edma_err_handler, 0, "eDMA err", fsl_edma);
if (ret) {
dev_err(&pdev->dev, "Can't register eDMA err IRQ.\n");
- return ret;
+ return ret;
}
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] dmaengine: fsl-edma: Fix typo in Vybrid name
2019-05-04 9:52 [PATCH 1/2] dmaengine: fsl-edma: Fix typo in Vybrid name Krzysztof Kozlowski
2019-05-04 9:52 ` [PATCH] usb: dwc2: gadget: Replace phyif with phy_utmi_width Krzysztof Kozlowski
2019-05-04 9:52 ` [PATCH 2/2] dmaengine: fsl-edma: Adjust indentation Krzysztof Kozlowski
@ 2019-05-04 10:21 ` Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2019-05-04 10:21 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Dan Williams, Minas Harutyunyan, Greg Kroah-Hartman, dmaengine,
linux-kernel, linux-usb
On 04-05-19, 11:52, Krzysztof Kozlowski wrote:
> Fix typo in comment for Vybrid SoC family.
Applied both in the series and ignore the (3rd?) usb patch! thanks
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread