Re: [PATCH] PM / Domains: Change prototype for the -attach_dev() callback
Hi Rafael, On Thu, Nov 6, 2014 at 1:54 AM, Rafael J. Wysocki r...@rjwysocki.net wrote: On Wednesday, November 05, 2014 03:11:23 PM Kevin Hilman wrote: Rafael J. Wysocki r...@rjwysocki.net writes: On Wednesday, November 05, 2014 02:43:31 PM Kevin Hilman wrote: Dmitry Torokhov dmitry.torok...@gmail.com writes: On Thu, Oct 30, 2014 at 01:38:30PM -0700, Kevin Hilman wrote: Rafael J. Wysocki r...@rjwysocki.net writes: On Thursday, October 30, 2014 01:02:49 PM Ulf Hansson wrote: Convert the prototype to return and int. This is just an initial step, needed to support error handling. Signed-off-by: Ulf Hansson ulf.hans...@linaro.org Acked-by: Kevin Hilman khil...@linaro.org This patch is intended as fix for 3.18 rc[n]. Why? There are other SOC specific patches around that adds genpd support and which implements the -attach_dev() callback. To prevent having an atomic patch during the next release cycle, let's change the prototype now instead. Further patches will add the actual error handling in genpd and these can then be reviewed and tested thoroughly. So we have no users of -attach_dev at the moment, right? Not in mainline, but there are a couple getting ready to hit -next, so we wanted to fix this before they arrive so that adding the error handling will be easier. BTW, while we are at it, can we also pass the domain itself to attach_dev() and detach_dev()? If anything it helps with debugging (you can print domain name from the callbacks). Agreed, and it makes it match the other callbacks (power_off, power_on) which currently take struct generic_pm_domain *domain. Updated version of $SUBJECT patch below. The subject and changelog need to be updated too IMO. Right. Here you go. I've replaced the Ulf's original with this one, thanks! When do you plan to send a pull request for this to Linus? There are PM domain drivers blocked on entering -next due to this dependency. As they have to pass through arm-soc first, and the arm-soc merge window will close soon, time is running out. Alternatively, you could provide an immutable branch containing this fix to unblock dependents. Thanks for your understanding. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/4] ARM: dts: add fimd device node to exynos4415.dtsi
On 2014년 11월 07일 15:12, YoungJun Cho wrote: This patch adds fimd device node to exynos4415.dtsi. Hi Kukjin, Could you merge patch 3 and 4 to your tree? These are dt part for Exynos4415 drm support. For drm patches, I already merged them. Thanks, Inki Dae Signed-off-by: YoungJun Cho yj44@samsung.com Acked-by: Kyungmin Park kyungmin.p...@samsung.com --- arch/arm/boot/dts/exynos4415.dtsi | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/exynos4415.dtsi b/arch/arm/boot/dts/exynos4415.dtsi index c1c9b37..30acb3a 100644 --- a/arch/arm/boot/dts/exynos4415.dtsi +++ b/arch/arm/boot/dts/exynos4415.dtsi @@ -234,6 +234,18 @@ interrupts = 0 240 0; }; + fimd: fimd@11C0 { + compatible = samsung,exynos4415-fimd; + reg = 0x11C0 0x3; + interrupt-names = fifo, vsync, lcd_sys; + interrupts = 0 84 0, 0 85 0, 0 86 0; + clocks = cmu CLK_SCLK_FIMD0, cmu CLK_FIMD0; + clock-names = sclk_fimd, fimd; + samsung,power-domain = pd_lcd0; + samsung,sysreg = sysreg_system_controller; + status = disabled; + }; + hsotg: hsotg@1248 { compatible = samsung,s3c6400-hsotg; reg = 0x1248 0x2; -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/2] usb: dwc2/gadget: add mutex to serialize init/deinit calls
Hello, On 2014-11-13 21:55, Paul Zimmerman wrote: From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Thursday, November 13, 2014 7:18 AM On 2014-10-31 19:46, Paul Zimmerman wrote: From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Friday, October 31, 2014 3:13 AM This patch adds mutex, which protects initialization and deinitialization procedures against suspend/resume methods. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/usb/dwc2/core.h | 1 + drivers/usb/dwc2/gadget.c | 20 2 files changed, 21 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 9f77b4d1c5ff..58732a9a0019 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -187,6 +187,7 @@ struct s3c_hsotg { struct s3c_hsotg_plat*plat; spinlock_t lock; + struct mutexinit_mutex; void __iomem*regs; int irq; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index d8dda39c9e16..a2e4272a904e 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -21,6 +21,7 @@ #include linux/platform_device.h #include linux/dma-mapping.h #include linux/debugfs.h +#include linux/mutex.h #include linux/seq_file.h #include linux/delay.h #include linux/io.h @@ -2908,6 +2909,7 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, return -EINVAL; } + mutex_lock(hsotg-init_mutex); WARN_ON(hsotg-driver); driver-driver.bus = NULL; @@ -2933,9 +2935,12 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, dev_info(hsotg-dev, bound driver %s\n, driver-driver.name); + mutex_unlock(hsotg-init_mutex); + return 0; err: + mutex_unlock(hsotg-init_mutex); hsotg-driver = NULL; return ret; } @@ -2957,6 +2962,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, if (!hsotg) return -ENODEV; + mutex_lock(hsotg-init_mutex); + /* all endpoints should be shutdown */ for (ep = 1; ep hsotg-num_of_eps; ep++) s3c_hsotg_ep_disable(hsotg-eps[ep].ep); @@ -2974,6 +2981,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, clk_disable(hsotg-clk); + mutex_unlock(hsotg-init_mutex); + return 0; } @@ -3002,6 +3011,7 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) dev_dbg(hsotg-dev, %s: is_on: %d\n, __func__, is_on); + mutex_lock(hsotg-init_mutex); spin_lock_irqsave(hsotg-lock, flags); if (is_on) { clk_enable(hsotg-clk); @@ -3013,6 +3023,7 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) hsotg-gadget.speed = USB_SPEED_UNKNOWN; spin_unlock_irqrestore(hsotg-lock, flags); + mutex_unlock(hsotg-init_mutex); return 0; } @@ -3507,6 +3518,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev) } spin_lock_init(hsotg-lock); + mutex_init(hsotg-init_mutex); hsotg-irq = ret; @@ -3652,6 +3664,8 @@ static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state) unsigned long flags; int ret = 0; + mutex_lock(hsotg-init_mutex); + if (hsotg-driver) dev_info(hsotg-dev, suspending usb gadget %s\n, hsotg-driver-driver.name); @@ -3674,6 +3688,8 @@ static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state) clk_disable(hsotg-clk); } + mutex_unlock(hsotg-init_mutex); + return ret; } @@ -3683,7 +3699,9 @@ static int s3c_hsotg_resume(struct platform_device *pdev) unsigned long flags; int ret = 0; + mutex_lock(hsotg-init_mutex); if (hsotg-driver) { + dev_info(hsotg-dev, resuming usb gadget %s\n, hsotg-driver-driver.name); @@ -3699,6 +3717,8 @@ static int s3c_hsotg_resume(struct platform_device *pdev) s3c_hsotg_core_connect(hsotg); spin_unlock_irqrestore(hsotg-lock, flags); + mutex_unlock(hsotg-init_mutex); + return ret; } Hmm. I can't find any other UDC driver that uses a mutex in its suspend/resume functions. Can you explain why this is needed only for dwc2? I've posted this version because I thought you were not convinced that the patch usb: dwc2/gadget: rework suspend/resume code to correctly restore gadget state can add code for initialization and deinitialization in suspend/resume paths. My problem with that patch was that you were checking the -enabled flag outside of the spinlock. To address that, you only need to move the check inside of the spinlock. I don't see why a mutex is needed. It is not that simple. I can add spin_lock() before checking enabled, but then I would need to spin_unlock() to call
Re: [PATCH v2 5/5] ARM: dts: exynos4412-trats2: Enable TMU support at Trats2
Hi Kukjin, Lukasz Majewski wrote: Hi Kukjin, Hi Kukjin, This patch enables support for TMU at Exynos4412 based Trats2 board. Signed-off-by: Lukasz Majewski l.majew...@samsung.com Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com Reviewed-by: Tomasz Figa t.f...@samsung.com --- Changes for v2: - None arch/arm/boot/dts/exynos4412-trats2.dts |5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index fb7b9ae..57136f8 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -467,6 +467,11 @@ status = okay; }; + tmu@100C { + vtmu-supply = ldo10_reg; + status = okay; + }; + i2c_ak8975: i2c-gpio-0 { compatible = i2c-gpio; gpios = gpy2 4 0, gpy2 5 0; Can you pull this DT node definition for TMU (as a fix to v3.12)? It is crucial for Exynos4412. Other patches from this patch set were already pulled as v3.12 fixes. Kukjin, could you pull this patch? Applied, thanks. It is strange, but it seems like this patch hasn't found its way to mainline (3.18-rc3). This patch should be applied with the following one: [PATCH v2 4/5] ARM: dts: exynos4x12: Device tree node definition for TMU on Exynos4x12 Anyway, I will resend them. If possible, please add them to your tree ASAP. Kukjin -- To unsubscribe from this list: send the line unsubscribe linux-pm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best regards, Lukasz Majewski Samsung RD Institute Poland (SRPOL) | Linux Platform Group -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RESEND PATCH 2/2] ARM: dts: exynos4412-trats2: Enable TMU support at Trats2
This patch enables support for TMU at Exynos4412 based Trats2 board. Signed-off-by: Lukasz Majewski l.majew...@samsung.com Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com Reviewed-by: Tomasz Figa tomasz.f...@gmail.com --- arch/arm/boot/dts/exynos4412-trats2.dts | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 5e066cd..121430d 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -551,6 +551,11 @@ status = okay; }; + tmu@100C { + vtmu-supply = ldo10_reg; + status = okay; + }; + i2c_ak8975: i2c-gpio-0 { compatible = i2c-gpio; gpios = gpy2 4 0, gpy2 5 0; -- 2.0.0.rc2 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RESEND PATCH 1/2] ARM: dts: exynos4x12: Device tree node definition for TMU on Exynos4x12
The TMU device tree node definition for Exynos4x12 family of SoCs. Signed-off-by: Lukasz Majewski l.majew...@samsung.com Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com Reviewed-by: Tomasz Figa tomasz.f...@gmail.com --- arch/arm/boot/dts/exynos4x12.dtsi | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi index 861bb91..2e9f1f7 100644 --- a/arch/arm/boot/dts/exynos4x12.dtsi +++ b/arch/arm/boot/dts/exynos4x12.dtsi @@ -271,4 +271,14 @@ compatible = samsung,exynos4x12-usb2-phy; samsung,sysreg-phandle = sys_reg; }; + + tmu@100C { + compatible = samsung,exynos4412-tmu; + interrupt-parent = combiner; + interrupts = 2 4; + reg = 0x100C 0x100; + clocks = clock 383; + clock-names = tmu_apbif; + status = disabled; + }; }; -- 2.0.0.rc2 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] usb: dwc2/gadget: report disconnect event from 'end session' irq
On 2014-11-13 21:50, Paul Zimmerman wrote: From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Thursday, November 13, 2014 5:40 AM On 2014-10-31 19:15, Paul Zimmerman wrote: From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Friday, October 31, 2014 1:04 AM To: linux-...@vger.kernel.org; linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski; Kyungmin Park; Robert Baldyga; Paul Zimmerman; Krzysztof Kozlowski; Felipe Balbi Subject: [PATCH v3] usb: dwc2/gadget: report disconnect event from 'end session' irq This patch adds a call to s3c_hsotg_disconnect() from 'end session' interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem about unplugged usb cable. 'disconnected' interrupt (DISCONNINT) might look a bit more suitable for this event, but it is asserted only in host mode, so in device mode we need to use something else. Additional check has been added in s3c_hsotg_disconnect() function to ensure that the event is reported only once after successful device enumeration. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/usb/dwc2/core.h | 1 + drivers/usb/dwc2/gadget.c | 10 ++ 2 files changed, 11 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 55c90c53f2d6..b42df32e7737 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -212,6 +212,7 @@ struct s3c_hsotg { struct usb_gadget gadget; unsigned intsetup; unsigned long last_rst; + unsigned intaddress; struct s3c_hsotg_ep *eps; }; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index fcd2bb55ccca..6304efba11aa 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1114,6 +1114,7 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg, DCFG_DEVADDR_SHIFT) DCFG_DEVADDR_MASK; writel(dcfg, hsotg-regs + DCFG); + hsotg-address = ctrl-wValue; dev_info(hsotg-dev, new address %d\n, ctrl-wValue); ret = s3c_hsotg_send_reply(hsotg, ep0, NULL, 0); @@ -2031,6 +2032,10 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg) { unsigned ep; + if (!hsotg-address) + return; + + hsotg-address = 0; for (ep = 0; ep hsotg-num_of_eps; ep++) kill_all_requests(hsotg, hsotg-eps[ep], -ESHUTDOWN, true); @@ -2290,6 +2295,11 @@ irq_retry: dev_info(hsotg-dev, OTGInt: %08x\n, otgint); writel(otgint, hsotg-regs + GOTGINT); + + if (otgint GOTGINT_SES_END_DET) { + s3c_hsotg_disconnect(hsotg); + hsotg-gadget.speed = USB_SPEED_UNKNOWN; + } } if (gintsts GINTSTS_SESSREQINT) { I don't think this is right. The host can send control requests to the device before it sends a SetAddress to change from the default address of 0. So if a GOTGINT_SES_END_DET happens before the SetAddress, it will be ignored. Or am I missing something? Well, right. However before finishing enumeration (setting the address) host usually only retrieves some usb descriptors what doesn't change the state of the gadget. Right now we always reported 'disconnected' event before setting the new address, what is a bit overkill (in some cases gadget driver got this even more than once). The above code handles all cases correctly and reports disconnect event only once. Well, if the disconnect happens before the SetAddress, the disconnect won't be reported at all. Unless I'm reading the code wrong. Right, although this is not really an issue for any gadget driver. However if you prefer to report disconnect event more than once, I'm okay and I will remove the check based on the device address. Best regards -- Marek Szyprowski, PhD Samsung RD Institute Poland -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] spi: s3c64xx: add support for exynos7 SPI controller
Hi Mark, On 11/10/14, Padma Venkat padma@gmail.com wrote: Hi Mark, On 11/7/14, Mark Brown broo...@kernel.org wrote: On Fri, Nov 07, 2014 at 02:01:57PM +0530, Padma Venkat wrote: CS can also be controlled automatically by setting AUTO_N_MANUAL to 1 in CS_CFG. When it is auto CS automatically toggles between packet to packet. NCS_TIME_COUNT in CS_CFG controls the inactive period. The driver by default uses manual mode. But on exynos7 the manual mode is removed. OK, but what's a packet here? Packet is either 1 byte or 4 bytes size depends on width of the SPI channel. I tested the driver with wm5110 codec. Did you try firmware downloads or something else that generates multiple transfers in a message? Normal register writes will use a single transfer so I'd expect them to just work. OK. I don't have provision to test on this board. I will try to test on older boards by disabling manual mode. I tested on exynos5420 peach-pit by enabling auto mode. I used dd command to read 1MB data from spi flash and I compared the result with manual mode. Both are same. Thanks padma -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ARM: exynos_defconfig: Use 16 minors per MMC block device
16 minors per MMC block device are required to boot Rinato (Gear 2) board because up to 15 partitions are used. With default 8 minors booting failed with: [1.329092] mmcblk0: mmc0:0001 F5X5MA 3.64 GiB [1.329448] mmcblk0boot0: mmc0:0001 F5X5MA partition 1 4.00 MiB [1.329627] mmcblk0boot1: mmc0:0001 F5X5MA partition 2 4.00 MiB [1.329808] mmcblk0rpmb: mmc0:0001 F5X5MA partition 3 512 KiB [1.335717] mmcblk0: p1 p2 p3 p4 p5 p6 p7 [1.436553] Waiting for root device /dev/mmcblk0p15... while the correct list of partitions on mmcblk0 for Gear 2 is: [1.436651] mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com --- arch/arm/configs/exynos_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig index 72058b8a6f4d..aa32931bdd30 100644 --- a/arch/arm/configs/exynos_defconfig +++ b/arch/arm/configs/exynos_defconfig @@ -134,6 +134,7 @@ CONFIG_USB_STORAGE=y CONFIG_USB_DWC3=y CONFIG_USB_HSIC_USB3503=y CONFIG_MMC=y +CONFIG_MMC_BLOCK_MINORS=16 CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_S3C=y CONFIG_MMC_SDHCI_S3C_DMA=y -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] usb: dwc2/gadget: report disconnect event from 'end session' irq
Hello, On 2014-11-13 21:50, Paul Zimmerman wrote: From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Thursday, November 13, 2014 5:40 AM On 2014-10-31 19:15, Paul Zimmerman wrote: From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Friday, October 31, 2014 1:04 AM To: linux-...@vger.kernel.org; linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski; Kyungmin Park; Robert Baldyga; Paul Zimmerman; Krzysztof Kozlowski; Felipe Balbi Subject: [PATCH v3] usb: dwc2/gadget: report disconnect event from 'end session' irq This patch adds a call to s3c_hsotg_disconnect() from 'end session' interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem about unplugged usb cable. 'disconnected' interrupt (DISCONNINT) might look a bit more suitable for this event, but it is asserted only in host mode, so in device mode we need to use something else. Additional check has been added in s3c_hsotg_disconnect() function to ensure that the event is reported only once after successful device enumeration. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/usb/dwc2/core.h | 1 + drivers/usb/dwc2/gadget.c | 10 ++ 2 files changed, 11 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 55c90c53f2d6..b42df32e7737 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -212,6 +212,7 @@ struct s3c_hsotg { struct usb_gadget gadget; unsigned intsetup; unsigned long last_rst; + unsigned intaddress; struct s3c_hsotg_ep *eps; }; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index fcd2bb55ccca..6304efba11aa 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1114,6 +1114,7 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg, DCFG_DEVADDR_SHIFT) DCFG_DEVADDR_MASK; writel(dcfg, hsotg-regs + DCFG); + hsotg-address = ctrl-wValue; dev_info(hsotg-dev, new address %d\n, ctrl-wValue); ret = s3c_hsotg_send_reply(hsotg, ep0, NULL, 0); @@ -2031,6 +2032,10 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg) { unsigned ep; + if (!hsotg-address) + return; + + hsotg-address = 0; for (ep = 0; ep hsotg-num_of_eps; ep++) kill_all_requests(hsotg, hsotg-eps[ep], -ESHUTDOWN, true); @@ -2290,6 +2295,11 @@ irq_retry: dev_info(hsotg-dev, OTGInt: %08x\n, otgint); writel(otgint, hsotg-regs + GOTGINT); + + if (otgint GOTGINT_SES_END_DET) { + s3c_hsotg_disconnect(hsotg); + hsotg-gadget.speed = USB_SPEED_UNKNOWN; + } } if (gintsts GINTSTS_SESSREQINT) { I don't think this is right. The host can send control requests to the device before it sends a SetAddress to change from the default address of 0. So if a GOTGINT_SES_END_DET happens before the SetAddress, it will be ignored. Or am I missing something? Well, right. However before finishing enumeration (setting the address) host usually only retrieves some usb descriptors what doesn't change the state of the gadget. Right now we always reported 'disconnected' event before setting the new address, what is a bit overkill (in some cases gadget driver got this even more than once). The above code handles all cases correctly and reports disconnect event only once. Well, if the disconnect happens before the SetAddress, the disconnect won't be reported at all. Unless I'm reading the code wrong. Ok, I found other way to ensure that disconnect event is reported only once. I will post a patch in a few minutes. Best regards -- Marek Szyprowski, PhD Samsung RD Institute Poland -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4] usb: dwc2/gadget: rework disconnect event handling
This patch adds a call to s3c_hsotg_disconnect() from 'end session' interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem about unplugged usb cable. DISCONNINT interrupt cannot be used for this purpose, because it is asserted only in host mode. To avoid reporting disconnect event more than once, a disconnect call has been moved from USB_REQ_SET_ADDRESS handling function to SESSREQINT interrupt. This way driver ensures that disconnect event is reported either when usb cable is unplugged or every time the host starts a new session. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/usb/dwc2/core.h | 1 + drivers/usb/dwc2/gadget.c | 13 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 55c90c53f2d6..78b9090ebf71 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -210,6 +210,7 @@ struct s3c_hsotg { u8 ctrl_buff[8]; struct usb_gadget gadget; + unsigned intsession:1; unsigned intsetup; unsigned long last_rst; struct s3c_hsotg_ep *eps; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index fcd2bb55ccca..c7f68dc1cf6b 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1029,7 +1029,6 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg, } static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg); -static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg); /** * s3c_hsotg_stall_ep0 - stall ep0 @@ -1107,7 +1106,6 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg, if ((ctrl-bRequestType USB_TYPE_MASK) == USB_TYPE_STANDARD) { switch (ctrl-bRequest) { case USB_REQ_SET_ADDRESS: - s3c_hsotg_disconnect(hsotg); dcfg = readl(hsotg-regs + DCFG); dcfg = ~DCFG_DEVADDR_MASK; dcfg |= (le16_to_cpu(ctrl-wValue) @@ -2031,6 +2029,10 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg) { unsigned ep; + if (!hsotg-session) + return; + + hsotg-session = 0; for (ep = 0; ep hsotg-num_of_eps; ep++) kill_all_requests(hsotg, hsotg-eps[ep], -ESHUTDOWN, true); @@ -2290,11 +2292,18 @@ irq_retry: dev_info(hsotg-dev, OTGInt: %08x\n, otgint); writel(otgint, hsotg-regs + GOTGINT); + + if (otgint GOTGINT_SES_END_DET) { + s3c_hsotg_disconnect(hsotg); + hsotg-gadget.speed = USB_SPEED_UNKNOWN; + } } if (gintsts GINTSTS_SESSREQINT) { dev_dbg(hsotg-dev, %s: SessReqInt\n, __func__); writel(GINTSTS_SESSREQINT, hsotg-regs + GINTSTS); + s3c_hsotg_disconnect(hsotg); + hsotg-session = 1; } if (gintsts GINTSTS_ENUMDONE) { -- 1.9.2 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 0/7] Enable L2 cache support on Exynos4210/4x12 SoCs
Hello, On 2014-11-13 14:18, Marek Szyprowski wrote: This is an updated patchset, which intends to add support for L2 cache on Exynos4 SoCs on boards running under secure firmware, which requires certain initialization steps to be done with help of firmware, as selected registers are writable only from secure mode. First four patches extend existing support for secure write in L2C driver to account for design of secure firmware running on Exynos. Namely: 1) direct read access to certain registers is needed on Exynos, because secure firmware calls set several registers at once, 2) not all boards are running secure firmware, so .write_sec callback needs to be installed in Exynos firmware ops initialization code, 3) write access to {DATA,TAG}_LATENCY_CTRL registers fron non-secure world is not allowed and so must use l2c_write_sec as well, 4) on certain boards, default value of prefetch register is incorrect and must be overridden at L2C initialization. For boards running with firmware that provides access to individual L2C registers this series should introduce no functional changes. However since the driver is widely used on other platforms I'd like to kindly ask any interested people for testing. Further three patches add implementation of .write_sec and .configure callbacks for Exynos secure firmware and necessary DT nodes to enable L2 cache. Changes in this version tested on Exynos4412-based TRATS2 and OdroidU3+ boards (both with secure firmware). There should be no functional change for Exynos boards running without secure firmware. I do not have access to affected non-Exynos boards, so I could not test on them. Depends on: - [PATCH v3 0/5] Firmware-assisted suspend/resume of Exynos SoCs (https://lkml.org/lkml/2014/8/26/445) available in samsung/pm2 branch in git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git - L2C patches merged to v3.18-rc3 I assume that after all comments from previous versions, no more changes are needed to this patchset and I would really like to have it queued to v3.19. Arnd, Olof: could you take this patchset thought arm-soc tree? It already contains all dependencies. Kukjin: could you ack this patchset? Changelog: Changes since v7: (https://lkml.org/lkml/2014/10/29/158) - rebased onto arm-soc/for-next kernel tree (depends on patches merged to v3.18-rc3 and arm-soc/samsung/pm2 branch) - removed 'ARM: l2c: unify L2C-310 OF initialization error messages' patch (no longer needed) Changes since v6: (https://lkml.org/lkml/2014/10/27/233) - changed PL310 to L2C-310 prefix in error messages - added patch shortening the error message about incorrect associativity Changes since v5: (https://lkml.org/lkml/2014/9/24/364) - rebased onto v3.18-rc2 - added error message about missing properties values Changes since v4: (https://lkml.org/lkml/2014/8/26/461) - rewrote the code accessing l2x0_saved_regs from assembly code - added comment and reworked unconditional call to SMC_CMD_L2X0INVALL Patch summary: Tomasz Figa (7): ARM: l2c: Refactor the driver to use commit-like interface ARM: l2c: Add interface to ask hypervisor to configure L2C ARM: l2c: Get outer cache .write_sec callback from mach_desc only if not NULL ARM: l2c: Add support for overriding prefetch settings ARM: EXYNOS: Add .write_sec outer cache callback for L2C-310 ARM: EXYNOS: Add support for non-secure L2X0 resume ARM: dts: exynos4: Add nodes for L2 cache controller Documentation/devicetree/bindings/arm/l2cc.txt | 10 + arch/arm/boot/dts/exynos4210.dtsi | 9 + arch/arm/boot/dts/exynos4x12.dtsi | 14 ++ arch/arm/include/asm/outercache.h | 3 + arch/arm/kernel/irq.c | 3 +- arch/arm/mach-exynos/firmware.c| 50 + arch/arm/mach-exynos/sleep.S | 46 + arch/arm/mm/cache-l2x0.c | 270 - 8 files changed, 309 insertions(+), 96 deletions(-) Best regards -- Marek Szyprowski, PhD Samsung RD Institute Poland -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 0/7] Enable L2 cache support on Exynos4210/4x12 SoCs
On Friday 14 November 2014 15:11:58 Marek Szyprowski wrote: I assume that after all comments from previous versions, no more changes are needed to this patchset and I would really like to have it queued to v3.19. Arnd, Olof: could you take this patchset thought arm-soc tree? It already contains all dependencies. Kukjin: could you ack this patchset? I'd rather see this merged through Russell's tree, as most of the patches are for core code, and only three are for the platform. For the exynos patches: Acked-by: Arnd Bergmann a...@arndb.de Arnd -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v4] usb: dwc2/gadget: rework disconnect event handling
-Original Message- From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Friday, November 14, 2014 4:20 AM This patch adds a call to s3c_hsotg_disconnect() from 'end session' interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem about unplugged usb cable. DISCONNINT interrupt cannot be used for this purpose, because it is asserted only in host mode. To avoid reporting disconnect event more than once, a disconnect call has been moved from USB_REQ_SET_ADDRESS handling function to SESSREQINT interrupt. This way driver ensures that disconnect event is reported either when usb cable is unplugged or every time the host starts a new session. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/usb/dwc2/core.h | 1 + drivers/usb/dwc2/gadget.c | 13 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 55c90c53f2d6..78b9090ebf71 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -210,6 +210,7 @@ struct s3c_hsotg { u8 ctrl_buff[8]; struct usb_gadget gadget; + unsigned intsession:1; unsigned intsetup; unsigned long last_rst; struct s3c_hsotg_ep *eps; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index fcd2bb55ccca..c7f68dc1cf6b 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1029,7 +1029,6 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg, } static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg); -static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg); /** * s3c_hsotg_stall_ep0 - stall ep0 @@ -1107,7 +1106,6 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg, if ((ctrl-bRequestType USB_TYPE_MASK) == USB_TYPE_STANDARD) { switch (ctrl-bRequest) { case USB_REQ_SET_ADDRESS: - s3c_hsotg_disconnect(hsotg); dcfg = readl(hsotg-regs + DCFG); dcfg = ~DCFG_DEVADDR_MASK; dcfg |= (le16_to_cpu(ctrl-wValue) @@ -2031,6 +2029,10 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg) { unsigned ep; + if (!hsotg-session) + return; + + hsotg-session = 0; for (ep = 0; ep hsotg-num_of_eps; ep++) kill_all_requests(hsotg, hsotg-eps[ep], -ESHUTDOWN, true); @@ -2290,11 +2292,18 @@ irq_retry: dev_info(hsotg-dev, OTGInt: %08x\n, otgint); writel(otgint, hsotg-regs + GOTGINT); + + if (otgint GOTGINT_SES_END_DET) { + s3c_hsotg_disconnect(hsotg); I think you should clear hsotg-session here, shouldn't you? Otherwise I think s3c_hsotg_disconnect() will be called twice, once here and once when the next GINTSTS_SESSREQINT comes. -- Paul + hsotg-gadget.speed = USB_SPEED_UNKNOWN; + } } if (gintsts GINTSTS_SESSREQINT) { dev_dbg(hsotg-dev, %s: SessReqInt\n, __func__); writel(GINTSTS_SESSREQINT, hsotg-regs + GINTSTS); + s3c_hsotg_disconnect(hsotg); + hsotg-session = 1; } if (gintsts GINTSTS_ENUMDONE) { -- 1.9.2 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4] usb: dwc2/gadget: rework disconnect event handling
On Fri, Nov 14, 2014 at 07:01:37PM +, Paul Zimmerman wrote: -Original Message- From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Friday, November 14, 2014 4:20 AM This patch adds a call to s3c_hsotg_disconnect() from 'end session' interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem about unplugged usb cable. DISCONNINT interrupt cannot be used for this purpose, because it is asserted only in host mode. To avoid reporting disconnect event more than once, a disconnect call has been moved from USB_REQ_SET_ADDRESS handling function to SESSREQINT interrupt. This way driver ensures that disconnect event is reported either when usb cable is unplugged or every time the host starts a new session. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/usb/dwc2/core.h | 1 + drivers/usb/dwc2/gadget.c | 13 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 55c90c53f2d6..78b9090ebf71 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -210,6 +210,7 @@ struct s3c_hsotg { u8 ctrl_buff[8]; struct usb_gadget gadget; + unsigned intsession:1; unsigned intsetup; unsigned long last_rst; struct s3c_hsotg_ep *eps; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index fcd2bb55ccca..c7f68dc1cf6b 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1029,7 +1029,6 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg, } static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg); -static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg); /** * s3c_hsotg_stall_ep0 - stall ep0 @@ -1107,7 +1106,6 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg, if ((ctrl-bRequestType USB_TYPE_MASK) == USB_TYPE_STANDARD) { switch (ctrl-bRequest) { case USB_REQ_SET_ADDRESS: - s3c_hsotg_disconnect(hsotg); dcfg = readl(hsotg-regs + DCFG); dcfg = ~DCFG_DEVADDR_MASK; dcfg |= (le16_to_cpu(ctrl-wValue) @@ -2031,6 +2029,10 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg) { unsigned ep; + if (!hsotg-session) + return; + + hsotg-session = 0; for (ep = 0; ep hsotg-num_of_eps; ep++) kill_all_requests(hsotg, hsotg-eps[ep], -ESHUTDOWN, true); @@ -2290,11 +2292,18 @@ irq_retry: dev_info(hsotg-dev, OTGInt: %08x\n, otgint); writel(otgint, hsotg-regs + GOTGINT); + + if (otgint GOTGINT_SES_END_DET) { + s3c_hsotg_disconnect(hsotg); I think you should clear hsotg-session here, shouldn't you? Otherwise I think s3c_hsotg_disconnect() will be called twice, once here and once when the next GINTSTS_SESSREQINT comes. the best way to avoid that would be fiddle with hsotg-session inside s3c_hsotg_disconnect() only. -- balbi signature.asc Description: Digital signature
RE: [PATCH v3 1/2] usb: dwc2/gadget: add mutex to serialize init/deinit calls
From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Friday, November 14, 2014 1:19 AM On 2014-11-13 21:55, Paul Zimmerman wrote: From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Thursday, November 13, 2014 7:18 AM On 2014-10-31 19:46, Paul Zimmerman wrote: From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Friday, October 31, 2014 3:13 AM This patch adds mutex, which protects initialization and deinitialization procedures against suspend/resume methods. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/usb/dwc2/core.h | 1 + drivers/usb/dwc2/gadget.c | 20 2 files changed, 21 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 9f77b4d1c5ff..58732a9a0019 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -187,6 +187,7 @@ struct s3c_hsotg { struct s3c_hsotg_plat*plat; spinlock_t lock; +struct mutexinit_mutex; void __iomem*regs; int irq; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index d8dda39c9e16..a2e4272a904e 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -21,6 +21,7 @@ #include linux/platform_device.h #include linux/dma-mapping.h #include linux/debugfs.h +#include linux/mutex.h #include linux/seq_file.h #include linux/delay.h #include linux/io.h @@ -2908,6 +2909,7 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, return -EINVAL; } +mutex_lock(hsotg-init_mutex); WARN_ON(hsotg-driver); driver-driver.bus = NULL; @@ -2933,9 +2935,12 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, dev_info(hsotg-dev, bound driver %s\n, driver-driver.name); +mutex_unlock(hsotg-init_mutex); + return 0; err: +mutex_unlock(hsotg-init_mutex); hsotg-driver = NULL; return ret; } @@ -2957,6 +2962,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, if (!hsotg) return -ENODEV; +mutex_lock(hsotg-init_mutex); + /* all endpoints should be shutdown */ for (ep = 1; ep hsotg-num_of_eps; ep++) s3c_hsotg_ep_disable(hsotg-eps[ep].ep); @@ -2974,6 +2981,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, clk_disable(hsotg-clk); +mutex_unlock(hsotg-init_mutex); + return 0; } @@ -3002,6 +3011,7 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) dev_dbg(hsotg-dev, %s: is_on: %d\n, __func__, is_on); +mutex_lock(hsotg-init_mutex); spin_lock_irqsave(hsotg-lock, flags); if (is_on) { clk_enable(hsotg-clk); @@ -3013,6 +3023,7 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) hsotg-gadget.speed = USB_SPEED_UNKNOWN; spin_unlock_irqrestore(hsotg-lock, flags); +mutex_unlock(hsotg-init_mutex); return 0; } @@ -3507,6 +3518,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev) } spin_lock_init(hsotg-lock); +mutex_init(hsotg-init_mutex); hsotg-irq = ret; @@ -3652,6 +3664,8 @@ static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state) unsigned long flags; int ret = 0; +mutex_lock(hsotg-init_mutex); + if (hsotg-driver) dev_info(hsotg-dev, suspending usb gadget %s\n, hsotg-driver-driver.name); @@ -3674,6 +3688,8 @@ static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state) clk_disable(hsotg-clk); } +mutex_unlock(hsotg-init_mutex); + return ret; } @@ -3683,7 +3699,9 @@ static int s3c_hsotg_resume(struct platform_device *pdev) unsigned long flags; int ret = 0; +mutex_lock(hsotg-init_mutex); if (hsotg-driver) { + dev_info(hsotg-dev, resuming usb gadget %s\n, hsotg-driver-driver.name); @@ -3699,6 +3717,8 @@ static int s3c_hsotg_resume(struct platform_device *pdev) s3c_hsotg_core_connect(hsotg); spin_unlock_irqrestore(hsotg-lock, flags); +mutex_unlock(hsotg-init_mutex); + return ret; } Hmm. I can't find any other UDC driver that uses a mutex in its suspend/resume functions. Can you explain why this is needed only for dwc2? I've posted this version because I thought you were not convinced that the patch usb: dwc2/gadget: rework suspend/resume code to
[PATCH] ARM: dts: Explicitly set dr_mode on exynos5250-snow
Explicitly set the dr_mode for the dwc3 controller on the Snow board to host mode. This is required to ensure the controller is initialized in the right mode if the kernel is build with USB gadget support. Signed-off-by: Sjoerd Simons sjoerd.sim...@collabora.co.uk --- arch/arm/boot/dts/exynos5250-snow.dts | 4 arch/arm/boot/dts/exynos5250.dtsi | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts index e51fcef..60429ad 100644 --- a/arch/arm/boot/dts/exynos5250-snow.dts +++ b/arch/arm/boot/dts/exynos5250-snow.dts @@ -624,4 +624,8 @@ num-cs = 1; }; +usbdrd_dwc3 { + dr_mode = host; +}; + #include cros-ec-keyboard.dtsi diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index f21b9aa..d55c1a2 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi @@ -555,7 +555,7 @@ #size-cells = 1; ranges; - dwc3 { + usbdrd_dwc3: dwc3 { compatible = synopsys,dwc3; reg = 0x1200 0x1; interrupts = 0 72 0; -- 2.1.3 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/2] usb: dwc2/gadget: add mutex to serialize init/deinit calls
Hi, On Fri, Nov 14, 2014 at 07:43:23PM +, Paul Zimmerman wrote: @@ -3699,6 +3717,8 @@ static int s3c_hsotg_resume(struct platform_device *pdev) s3c_hsotg_core_connect(hsotg); spin_unlock_irqrestore(hsotg-lock, flags); + mutex_unlock(hsotg-init_mutex); + return ret; } Hmm. I can't find any other UDC driver that uses a mutex in its suspend/resume functions. Can you explain why this is needed only for dwc2? I've posted this version because I thought you were not convinced that the patch usb: dwc2/gadget: rework suspend/resume code to correctly restore gadget state can add code for initialization and deinitialization in suspend/resume paths. My problem with that patch was that you were checking the -enabled flag outside of the spinlock. To address that, you only need to move the check inside of the spinlock. I don't see why a mutex is needed. It is not that simple. I can add spin_lock() before checking enabled, but then I would need to spin_unlock() to call regulator_bulk_enable() and phy_enable(), because both cannot be called from atomic context. This means that the spinlock in such case will not protect anything and is simply useless. Ah, OK. So you're using the mutex instead of the -enabled flag that you proposed in the rework suspend/resume code patch. So this patch is a replacement for that one. Somehow I was thinking this patch was on top of that one. So I guess this is OK, but I would like to get Felipe's opinion about it before we apply this. Felipe? I can't think of a better way, I'm afraid :-( -- balbi signature.asc Description: Digital signature
RE: [PATCH v4] usb: dwc2/gadget: rework disconnect event handling
From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Felipe Balbi Sent: Friday, November 14, 2014 11:05 AM On Fri, Nov 14, 2014 at 07:01:37PM +, Paul Zimmerman wrote: -Original Message- From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Friday, November 14, 2014 4:20 AM This patch adds a call to s3c_hsotg_disconnect() from 'end session' interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem about unplugged usb cable. DISCONNINT interrupt cannot be used for this purpose, because it is asserted only in host mode. To avoid reporting disconnect event more than once, a disconnect call has been moved from USB_REQ_SET_ADDRESS handling function to SESSREQINT interrupt. This way driver ensures that disconnect event is reported either when usb cable is unplugged or every time the host starts a new session. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/usb/dwc2/core.h | 1 + drivers/usb/dwc2/gadget.c | 13 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 55c90c53f2d6..78b9090ebf71 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -210,6 +210,7 @@ struct s3c_hsotg { u8 ctrl_buff[8]; struct usb_gadget gadget; + unsigned intsession:1; unsigned intsetup; unsigned long last_rst; struct s3c_hsotg_ep *eps; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index fcd2bb55ccca..c7f68dc1cf6b 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1029,7 +1029,6 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg, } static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg); -static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg); /** * s3c_hsotg_stall_ep0 - stall ep0 @@ -1107,7 +1106,6 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg, if ((ctrl-bRequestType USB_TYPE_MASK) == USB_TYPE_STANDARD) { switch (ctrl-bRequest) { case USB_REQ_SET_ADDRESS: - s3c_hsotg_disconnect(hsotg); dcfg = readl(hsotg-regs + DCFG); dcfg = ~DCFG_DEVADDR_MASK; dcfg |= (le16_to_cpu(ctrl-wValue) @@ -2031,6 +2029,10 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg) { unsigned ep; + if (!hsotg-session) + return; + + hsotg-session = 0; for (ep = 0; ep hsotg-num_of_eps; ep++) kill_all_requests(hsotg, hsotg-eps[ep], -ESHUTDOWN, true); @@ -2290,11 +2292,18 @@ irq_retry: dev_info(hsotg-dev, OTGInt: %08x\n, otgint); writel(otgint, hsotg-regs + GOTGINT); + + if (otgint GOTGINT_SES_END_DET) { + s3c_hsotg_disconnect(hsotg); I think you should clear hsotg-session here, shouldn't you? Otherwise I think s3c_hsotg_disconnect() will be called twice, once here and once when the next GINTSTS_SESSREQINT comes. the best way to avoid that would be fiddle with hsotg-session inside s3c_hsotg_disconnect() only. Whoops, I just noticed that hsotg-session *is* cleared inside of s3c_hsotg_disconnect(). So I think the patch is good as-is. Acked-by: Paul Zimmerman pa...@synopsys.com -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v4] usb: dwc2/gadget: rework disconnect event handling
From: Paul Zimmerman Sent: Friday, November 14, 2014 1:21 PM From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Felipe Balbi Sent: Friday, November 14, 2014 11:05 AM On Fri, Nov 14, 2014 at 07:01:37PM +, Paul Zimmerman wrote: -Original Message- From: Marek Szyprowski [mailto:m.szyprow...@samsung.com] Sent: Friday, November 14, 2014 4:20 AM This patch adds a call to s3c_hsotg_disconnect() from 'end session' interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem about unplugged usb cable. DISCONNINT interrupt cannot be used for this purpose, because it is asserted only in host mode. To avoid reporting disconnect event more than once, a disconnect call has been moved from USB_REQ_SET_ADDRESS handling function to SESSREQINT interrupt. This way driver ensures that disconnect event is reported either when usb cable is unplugged or every time the host starts a new session. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/usb/dwc2/core.h | 1 + drivers/usb/dwc2/gadget.c | 13 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 55c90c53f2d6..78b9090ebf71 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -210,6 +210,7 @@ struct s3c_hsotg { u8 ctrl_buff[8]; struct usb_gadget gadget; + unsigned intsession:1; unsigned intsetup; unsigned long last_rst; struct s3c_hsotg_ep *eps; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index fcd2bb55ccca..c7f68dc1cf6b 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1029,7 +1029,6 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg, } static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg); -static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg); /** * s3c_hsotg_stall_ep0 - stall ep0 @@ -1107,7 +1106,6 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg, if ((ctrl-bRequestType USB_TYPE_MASK) == USB_TYPE_STANDARD) { switch (ctrl-bRequest) { case USB_REQ_SET_ADDRESS: - s3c_hsotg_disconnect(hsotg); dcfg = readl(hsotg-regs + DCFG); dcfg = ~DCFG_DEVADDR_MASK; dcfg |= (le16_to_cpu(ctrl-wValue) @@ -2031,6 +2029,10 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg) { unsigned ep; + if (!hsotg-session) + return; + + hsotg-session = 0; for (ep = 0; ep hsotg-num_of_eps; ep++) kill_all_requests(hsotg, hsotg-eps[ep], -ESHUTDOWN, true); @@ -2290,11 +2292,18 @@ irq_retry: dev_info(hsotg-dev, OTGInt: %08x\n, otgint); writel(otgint, hsotg-regs + GOTGINT); + + if (otgint GOTGINT_SES_END_DET) { + s3c_hsotg_disconnect(hsotg); I think you should clear hsotg-session here, shouldn't you? Otherwise I think s3c_hsotg_disconnect() will be called twice, once here and once when the next GINTSTS_SESSREQINT comes. the best way to avoid that would be fiddle with hsotg-session inside s3c_hsotg_disconnect() only. Whoops, I just noticed that hsotg-session *is* cleared inside of s3c_hsotg_disconnect(). So I think the patch is good as-is. Acked-by: Paul Zimmerman pa...@synopsys.com I'm having second thoughts about this. Currently, the GINTSTS_SESSREQINT interrupt in the gadget does nothing except print a debug message. So I'm not sure that all versions of the controller actually assert this interrupt when a connection is made. If they don't, then this patch would break the disconnect handling, since hsotg-session would never get set. In particular, I'm thinking that a core which is synthesized without SRP support may not implement the GINTSTS_SESSREQINT interrupt. The databook seems to imply that: SessReqInt: In Device mode, this interrupt is asserted when the utmisrp_bvalid signal goes high. And in the section which describes the utmisrp_bvalid signal, there is a note that says: This interface is present only when parameter OTG_MODE specifies an SRP-capable configuration. So Marek, can you try moving the line which sets hsotg-session = 1 into s3c_hsotg_irq_enumdone() instead? Then we will be sure it gets set to one after a connect. Probably it should be renamed from 'session' to 'connect' in that case. -- Paul -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message
[PATCH] [media] exynos4-is: fix error handling of irq_of_parse_and_map
Return value of irq_of_parse_and_map() is unsigned int, with 0 indicating failure, so testing for negative result never works. Signed-off-by: Dmitry Torokhov d...@chromium.org --- Not tested, found by casual code inspection. drivers/media/platform/exynos4-is/fimc-is.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 94c6b47..0fdca86 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -814,9 +814,9 @@ static int fimc_is_probe(struct platform_device *pdev) return -ENOMEM; is-irq = irq_of_parse_and_map(dev-of_node, 0); - if (is-irq 0) { + if (!is-irq) { dev_err(dev, no irq found\n); - return is-irq; + return -EINVAL; } ret = fimc_is_get_clocks(is); -- 2.1.0.rc2.206.gedb03e5 -- Dmitry -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] PM / Domains: Change prototype for the -attach_dev() callback
On Wednesday, November 05, 2014 03:11:23 PM Kevin Hilman wrote: Rafael J. Wysocki r...@rjwysocki.net writes: On Wednesday, November 05, 2014 02:43:31 PM Kevin Hilman wrote: Dmitry Torokhov dmitry.torok...@gmail.com writes: On Thu, Oct 30, 2014 at 01:38:30PM -0700, Kevin Hilman wrote: Rafael J. Wysocki r...@rjwysocki.net writes: On Thursday, October 30, 2014 01:02:49 PM Ulf Hansson wrote: Convert the prototype to return and int. This is just an initial step, needed to support error handling. Signed-off-by: Ulf Hansson ulf.hans...@linaro.org Acked-by: Kevin Hilman khil...@linaro.org This patch is intended as fix for 3.18 rc[n]. Why? There are other SOC specific patches around that adds genpd support and which implements the -attach_dev() callback. To prevent having an atomic patch during the next release cycle, let's change the prototype now instead. Further patches will add the actual error handling in genpd and these can then be reviewed and tested thoroughly. So we have no users of -attach_dev at the moment, right? Not in mainline, but there are a couple getting ready to hit -next, so we wanted to fix this before they arrive so that adding the error handling will be easier. BTW, while we are at it, can we also pass the domain itself to attach_dev() and detach_dev()? If anything it helps with debugging (you can print domain name from the callbacks). Agreed, and it makes it match the other callbacks (power_off, power_on) which currently take struct generic_pm_domain *domain. Updated version of $SUBJECT patch below. The subject and changelog need to be updated too IMO. Right. Here you go. Kevin - 8 -- From c18a6bf3121979c4102ba4f7edb3ac41e3921fc6 Mon Sep 17 00:00:00 2001 From: Ulf Hansson ulf.hans...@linaro.org Date: Thu, 30 Oct 2014 13:02:49 +0100 Subject: [PATCH] PM / Domains: Change prototype for the attach and detach callbacks Convert the prototypes to return an int in order to support error handling in these callbacks. Also, as suggested by Dmitry Torokhov, pass the domain pointer for use inside the callbacks, and so that they match the existing power_on/power_off callbacks which currently take the domain pointer. Acked-by: Dmitry Torokhov dmitry.torok...@gmail.com [khilman: added domain as parameter to callbacks, as suggested by Dmitry] Signed-off-by: Ulf Hansson ulf.hans...@linaro.org Signed-off-by: Kevin Hilman khil...@linaro.org That's in the Linus' tree now. --- drivers/base/power/domain.c | 4 ++-- include/linux/pm_domain.h | 6 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 40bc2f4072cc..b520687046d4 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1437,7 +1437,7 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, spin_unlock_irq(dev-power.lock); if (genpd-attach_dev) - genpd-attach_dev(dev); + genpd-attach_dev(genpd, dev); mutex_lock(gpd_data-lock); gpd_data-base.dev = dev; @@ -1499,7 +1499,7 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd, genpd-max_off_time_changed = true; if (genpd-detach_dev) - genpd-detach_dev(dev); + genpd-detach_dev(genpd, dev); spin_lock_irq(dev-power.lock); diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 73e938b7e937..b3ed7766a291 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -72,8 +72,10 @@ struct generic_pm_domain { bool max_off_time_changed; bool cached_power_down_ok; struct gpd_cpuidle_data *cpuidle_data; - void (*attach_dev)(struct device *dev); - void (*detach_dev)(struct device *dev); + int (*attach_dev)(struct generic_pm_domain *domain, + struct device *dev); + void (*detach_dev)(struct generic_pm_domain *domain, +struct device *dev); }; static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2] PM / Domains: Fix initial default state of the need_restore flag
On Tuesday, November 11, 2014 11:07:08 AM Ulf Hansson wrote: The initial state of the device's need_restore flag should'nt depend on the current state of the PM domain. For example it should be perfectly valid to attach an inactive device to a powered PM domain. The pm_genpd_dev_need_restore() API allow us to update the need_restore flag to somewhat cope with such scenarios. Typically that should have been done from drivers/buses -probe() since it's those that put the requirements on the value of the need_restore flag. Until recently, the Exynos SOCs were the only user of the pm_genpd_dev_need_restore() API, though invoking it from a centralized location while adding devices to their PM domains. Due to that Exynos now have swithed to the generic OF-based PM domain look-up, it's no longer possible to invoke the API from a centralized location. The reason is because devices are now added to their PM domains during the probe sequence. Commit ARM: exynos: Move to generic PM domain DT bindings did the switch for Exynos to the generic OF-based PM domain look-up, but it also removed the call to pm_genpd_dev_need_restore(). This caused a regression for some of the Exynos drivers. To handle things more properly in the generic PM domain, let's change the default initial value of the need_restore flag to reflect that the state is unknown. As soon as some of the runtime PM callbacks gets invoked, update the initial value accordingly. Moreover, since the generic PM domain is verifying that all device's are both runtime PM enabled and suspended, using pm_runtime_suspended() while pm_genpd_poweroff() is invoked from the scheduled work, we can be sure of that the PM domain won't be powering off while having active devices. Do note that, the generic PM domain can still only know about active devices which has been activated through invoking its runtime PM resume callback. In other words, buses/drivers using pm_runtime_set_active() during -probe() will still suffer from a race condition, potentially probing a device without having its PM domain being powered. That issue will have to be solved using a different approach. This a log from the boot regression for Exynos5, which is being fixed in this patch. [ cut here ] WARNING: CPU: 0 PID: 308 at ../drivers/clk/clk.c:851 clk_disable+0x24/0x30() Modules linked in: CPU: 0 PID: 308 Comm: kworker/0:1 Not tainted 3.18.0-rc3-00569-gbd9449f-dirty #10 Workqueue: pm pm_runtime_work [c0013c64] (unwind_backtrace) from [c0010dec] (show_stack+0x10/0x14) [c0010dec] (show_stack) from [c03ee4cc] (dump_stack+0x70/0xbc) [c03ee4cc] (dump_stack) from [c0020d34] (warn_slowpath_common+0x64/0x88) [c0020d34] (warn_slowpath_common) from [c0020d74] (warn_slowpath_null+0x1c/0x24) [c0020d74] (warn_slowpath_null) from [c03107b0] (clk_disable+0x24/0x30) [c03107b0] (clk_disable) from [c02cc834] (gsc_runtime_suspend+0x128/0x160) [c02cc834] (gsc_runtime_suspend) from [c0249024] (pm_generic_runtime_suspend+0x2c/0x38) [c0249024] (pm_generic_runtime_suspend) from [c024f44c] (pm_genpd_default_save_state+0x2c/0x8c) [c024f44c] (pm_genpd_default_save_state) from [c024ff2c] (pm_genpd_poweroff+0x224/0x3ec) [c024ff2c] (pm_genpd_poweroff) from [c02501b4] (pm_genpd_runtime_suspend+0x9c/0xcc) [c02501b4] (pm_genpd_runtime_suspend) from [c024a4f8] (__rpm_callback+0x2c/0x60) [c024a4f8] (__rpm_callback) from [c024a54c] (rpm_callback+0x20/0x74) [c024a54c] (rpm_callback) from [c024a930] (rpm_suspend+0xd4/0x43c) [c024a930] (rpm_suspend) from [c024bbcc] (pm_runtime_work+0x80/0x90) [c024bbcc] (pm_runtime_work) from [c0032a9c] (process_one_work+0x12c/0x314) [c0032a9c] (process_one_work) from [c0032cf4] (worker_thread+0x3c/0x4b0) [c0032cf4] (worker_thread) from [c003747c] (kthread+0xcc/0xe8) [c003747c] (kthread) from [c000e738] (ret_from_fork+0x14/0x3c) ---[ end trace 40cd58bcd6988f12 ]--- Fixes: a4a8c2c4962bb655 (ARM: exynos: Move to generic PM domain DT bindings) Reported-by: Sylwester Nawrocki s.nawro...@samsung.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com Tested-by: Sylwester Nawrocki s.nawro...@samsung.com Reviewed-by: Kevin Hilman khil...@linaro.org Signed-off-by: Ulf Hansson ulf.hans...@linaro.org --- I am resending the v2, since I realized that I forgot to update the version in the patch header. This patch is in the Linus' tree now. Changes in v2: Applied some Reviewed|Tested-by tags. Added some newlines. (Kevin) Checking for the sign instead of for a specific value. (Rafael) This patch is intended as fix for 3.18 rc[n] due to the regression for Exynos SOCs. I would also like to call for help in getting this thoroughly tested. I have tested this on Arndale Dual, Exynos 5250. According the log attached in the commit message as well. I have tested this on UX500, which support for the generic PM domain is about to be queued for 3.19. Since UX500