[PATCH] phy: samsung_usb2: Fixup samsung_usb2_phy_power_on/off paths
Ensure we have balanced clk_prepare_enable/clk_disable_unprepare calls if .power_on or .power_off callbacks return error. Signed-off-by: Axel Lin axel@ingics.com --- drivers/phy/phy-samsung-usb2.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/phy/phy-samsung-usb2.c b/drivers/phy/phy-samsung-usb2.c index 4a12f66..55b6994 100644 --- a/drivers/phy/phy-samsung-usb2.c +++ b/drivers/phy/phy-samsung-usb2.c @@ -37,10 +37,14 @@ static int samsung_usb2_phy_power_on(struct phy *phy) spin_lock(drv-lock); ret = inst-cfg-power_on(inst); spin_unlock(drv-lock); + if (ret) + goto err_power_on; } return 0; +err_power_on: + clk_disable_unprepare(drv-ref_clk); err_instance_clk: clk_disable_unprepare(drv-clk); err_main_clk: @@ -51,7 +55,7 @@ static int samsung_usb2_phy_power_off(struct phy *phy) { struct samsung_usb2_phy_instance *inst = phy_get_drvdata(phy); struct samsung_usb2_phy_driver *drv = inst-drv; - int ret = 0; + int ret; dev_dbg(drv-dev, Request to power_off \%s\ usb phy\n, inst-cfg-label); @@ -59,10 +63,12 @@ static int samsung_usb2_phy_power_off(struct phy *phy) spin_lock(drv-lock); ret = inst-cfg-power_off(inst); spin_unlock(drv-lock); + if (ret) + return ret; } clk_disable_unprepare(drv-ref_clk); clk_disable_unprepare(drv-clk); - return ret; + return 0; } static struct phy_ops samsung_usb2_phy_ops = { -- 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
[PATCH] phy: exynos-mipi-video: Fix unbalanced lock on non-regmap path
Remove the second lock on non-regmap path. Fixes: 278270e39efa (phy: exynos-mipi-video: Use spin_lock to protct state-regmap rmw operations) Reported-by: Julia Lawall julia.law...@lip6.fr Signed-off-by: Axel Lin axel@ingics.com --- drivers/phy/phy-exynos-mipi-video.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c index 8d6d117..df7519a 100644 --- a/drivers/phy/phy-exynos-mipi-video.c +++ b/drivers/phy/phy-exynos-mipi-video.c @@ -75,7 +75,6 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state, } else { addr = state-regs + EXYNOS_MIPI_PHY_CONTROL(id / 2); - spin_lock(state-slock); val = readl(addr); if (on) val |= reset; -- 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
[PATCH] phy: samsung-usb2: Remove NULL terminating entry from phys array
Current code uses num_phys settings to tell the number of entries in phys. Thus remove the NULL terminating entry from phys array which is not necessary. Signed-off-by: Axel Lin axel@ingics.com --- drivers/phy/phy-exynos4210-usb2.c | 1 - drivers/phy/phy-exynos4x12-usb2.c | 1 - drivers/phy/phy-exynos5250-usb2.c | 1 - 3 files changed, 3 deletions(-) diff --git a/drivers/phy/phy-exynos4210-usb2.c b/drivers/phy/phy-exynos4210-usb2.c index 236a52a..f30bbb0 100644 --- a/drivers/phy/phy-exynos4210-usb2.c +++ b/drivers/phy/phy-exynos4210-usb2.c @@ -250,7 +250,6 @@ static const struct samsung_usb2_common_phy exynos4210_phys[] = { .power_on = exynos4210_power_on, .power_off = exynos4210_power_off, }, - {}, }; const struct samsung_usb2_phy_config exynos4210_usb2_phy_config = { diff --git a/drivers/phy/phy-exynos4x12-usb2.c b/drivers/phy/phy-exynos4x12-usb2.c index 0b9de88..765da90 100644 --- a/drivers/phy/phy-exynos4x12-usb2.c +++ b/drivers/phy/phy-exynos4x12-usb2.c @@ -361,7 +361,6 @@ static const struct samsung_usb2_common_phy exynos4x12_phys[] = { .power_on = exynos4x12_power_on, .power_off = exynos4x12_power_off, }, - {}, }; const struct samsung_usb2_phy_config exynos3250_usb2_phy_config = { diff --git a/drivers/phy/phy-exynos5250-usb2.c b/drivers/phy/phy-exynos5250-usb2.c index 1c139aa..2ed1735 100644 --- a/drivers/phy/phy-exynos5250-usb2.c +++ b/drivers/phy/phy-exynos5250-usb2.c @@ -391,7 +391,6 @@ static const struct samsung_usb2_common_phy exynos5250_phys[] = { .power_on = exynos5250_power_on, .power_off = exynos5250_power_off, }, - {}, }; const struct samsung_usb2_phy_config exynos5250_usb2_phy_config = { -- 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
[PATCH] phy: exynos5-usbdrd: Fix off-by-one valid value checking for args-args[0]
Current code uses args-args[0] as array subscript of phy_drd-phys[]. So the valid value range for args-args[0] is 0 ... EXYNOS5_DRDPHYS_NUM - 1. Signed-off-by: Axel Lin axel@ingics.com --- drivers/phy/phy-exynos5-usbdrd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c index 0437401..e2a0be7 100644 --- a/drivers/phy/phy-exynos5-usbdrd.c +++ b/drivers/phy/phy-exynos5-usbdrd.c @@ -531,7 +531,7 @@ static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev, { struct exynos5_usbdrd_phy *phy_drd = dev_get_drvdata(dev); - if (WARN_ON(args-args[0] EXYNOS5_DRDPHYS_NUM)) + if (WARN_ON(args-args[0] = EXYNOS5_DRDPHYS_NUM)) return ERR_PTR(-ENODEV); return phy_drd-phys[args-args[0]].phy; -- 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
[PATCH RFT] phy: exynos-mipi-video: Use spin_lock to protct state-regmap rmw operations
The state-regmap is initialized by devm_regmap_init_mmio(). So it's fine to use spin_lock rather than mutex to protct state-regmap rmw operations. Signed-off-by: Axel Lin axel@ingics.com --- Hi Sylwester, I don't have this hardware handy, so can you test if this patch works. This patch is on top of my previous patch (phy: exynos-mipi-video: Fixup the test for state-regmap) Thanks, Axel drivers/phy/phy-exynos-mipi-video.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c index d196493..8d6d117 100644 --- a/drivers/phy/phy-exynos-mipi-video.c +++ b/drivers/phy/phy-exynos-mipi-video.c @@ -43,7 +43,6 @@ struct exynos_mipi_video_phy { } phys[EXYNOS_MIPI_PHYS_NUM]; spinlock_t slock; void __iomem *regs; - struct mutex mutex; struct regmap *regmap; }; @@ -59,8 +58,9 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state, else reset = EXYNOS4_MIPI_PHY_SRESETN; + spin_lock(state-slock); + if (!IS_ERR(state-regmap)) { - mutex_lock(state-mutex); regmap_read(state-regmap, offset, val); if (on) val |= reset; @@ -72,7 +72,6 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state, else if (!(val EXYNOS4_MIPI_PHY_RESET_MASK)) val = ~EXYNOS4_MIPI_PHY_ENABLE; regmap_write(state-regmap, offset, val); - mutex_unlock(state-mutex); } else { addr = state-regs + EXYNOS_MIPI_PHY_CONTROL(id / 2); @@ -90,9 +89,9 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state, val = ~EXYNOS4_MIPI_PHY_ENABLE; writel(val, addr); - spin_unlock(state-slock); } + spin_unlock(state-slock); return 0; } @@ -158,7 +157,6 @@ static int exynos_mipi_video_phy_probe(struct platform_device *pdev) dev_set_drvdata(dev, state); spin_lock_init(state-slock); - mutex_init(state-mutex); for (i = 0; i EXYNOS_MIPI_PHYS_NUM; i++) { struct phy *phy = devm_phy_create(dev, NULL, -- 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
[PATCH] phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function
If IS_ERR(state-regs) the .probe fails. So IS_ERR(state-regs) test in exynos_dp_video_phy_pwr_isol() is not necessary. exynos_dp_video_phy_pwr_isol() simply does a regmap_update_bits() call now, just call regmap_update_bits() instead and return proper return value. Signed-off-by: Axel Lin axel@ingics.com --- drivers/phy/phy-exynos-dp-video.c | 24 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/phy/phy-exynos-dp-video.c b/drivers/phy/phy-exynos-dp-video.c index f86cbe6..179cbf9 100644 --- a/drivers/phy/phy-exynos-dp-video.c +++ b/drivers/phy/phy-exynos-dp-video.c @@ -30,28 +30,13 @@ struct exynos_dp_video_phy { const struct exynos_dp_video_phy_drvdata *drvdata; }; -static void exynos_dp_video_phy_pwr_isol(struct exynos_dp_video_phy *state, - unsigned int on) -{ - unsigned int val; - - if (IS_ERR(state-regs)) - return; - - val = on ? 0 : EXYNOS5_PHY_ENABLE; - - regmap_update_bits(state-regs, state-drvdata-phy_ctrl_offset, - EXYNOS5_PHY_ENABLE, val); -} - static int exynos_dp_video_phy_power_on(struct phy *phy) { struct exynos_dp_video_phy *state = phy_get_drvdata(phy); /* Disable power isolation on DP-PHY */ - exynos_dp_video_phy_pwr_isol(state, 0); - - return 0; + return regmap_update_bits(state-regs, state-drvdata-phy_ctrl_offset, + EXYNOS5_PHY_ENABLE, EXYNOS5_PHY_ENABLE); } static int exynos_dp_video_phy_power_off(struct phy *phy) @@ -59,9 +44,8 @@ static int exynos_dp_video_phy_power_off(struct phy *phy) struct exynos_dp_video_phy *state = phy_get_drvdata(phy); /* Enable power isolation on DP-PHY */ - exynos_dp_video_phy_pwr_isol(state, 1); - - return 0; + return regmap_update_bits(state-regs, state-drvdata-phy_ctrl_offset, + EXYNOS5_PHY_ENABLE, 0); } static struct phy_ops exynos_dp_video_phy_ops = { -- 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
[PATCH] phy: exynos-mipi-video: Fixup the test for state-regmap
syscon_regmap_lookup_by_phandle() returns ERR_PTR on error. Thus don't use null test against state-regmap. Signed-off-by: Axel Lin axel@ingics.com --- drivers/phy/phy-exynos-mipi-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c index f017b2f..d196493 100644 --- a/drivers/phy/phy-exynos-mipi-video.c +++ b/drivers/phy/phy-exynos-mipi-video.c @@ -59,7 +59,7 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state, else reset = EXYNOS4_MIPI_PHY_SRESETN; - if (state-regmap) { + if (!IS_ERR(state-regmap)) { mutex_lock(state-mutex); regmap_read(state-regmap, offset, val); if (on) -- 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
[PATCH] spi: s3c24xx: Convert to use devm_kzalloc
Simplify the cleanup code. Signed-off-by: Axel Lin axel@ingics.com --- drivers/spi/spi-s3c24xx.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c index bed2338..6db14e5 100644 --- a/drivers/spi/spi-s3c24xx.c +++ b/drivers/spi/spi-s3c24xx.c @@ -183,7 +183,9 @@ static int s3c24xx_spi_setup(struct spi_device *spi) /* allocate settings on the first call */ if (!cs) { - cs = kzalloc(sizeof(struct s3c24xx_spi_devstate), GFP_KERNEL); + cs = devm_kzalloc(spi-dev, + sizeof(struct s3c24xx_spi_devstate), + GFP_KERNEL); if (!cs) { dev_err(spi-dev, no memory for controller state\n); return -ENOMEM; @@ -209,11 +211,6 @@ static int s3c24xx_spi_setup(struct spi_device *spi) return 0; } -static void s3c24xx_spi_cleanup(struct spi_device *spi) -{ - kfree(spi-controller_state); -} - static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count) { return hw-tx ? hw-tx[count] : 0; @@ -543,7 +540,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev) hw-bitbang.txrx_bufs = s3c24xx_spi_txrx; hw-master-setup = s3c24xx_spi_setup; - hw-master-cleanup = s3c24xx_spi_cleanup; dev_dbg(hw-dev, bitbang at %p\n, hw-bitbang); -- 1.8.3.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
[RFT][PATCH 1/2] spi: s3c24xx: Add missing spi_master_{resume,suspend} calls to PM callbacks
This is required since commit 2025172e3280 spi/bitbang: Use core message pump. spi-bitbang now uses core message pump, so it needs to call spi_master_suspend/ spi_master_resume to start/stop the queue while suspend/resume. Signed-off-by: Axel Lin axel@ingics.com --- drivers/spi/spi-s3c24xx.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c index a275445..bed2338 100644 --- a/drivers/spi/spi-s3c24xx.c +++ b/drivers/spi/spi-s3c24xx.c @@ -633,6 +633,11 @@ static int s3c24xx_spi_remove(struct platform_device *dev) static int s3c24xx_spi_suspend(struct device *dev) { struct s3c24xx_spi *hw = dev_get_drvdata(dev); + int ret; + + ret = spi_master_suspend(hw-master); + if (ret) + return ret; if (hw-pdata hw-pdata-gpio_setup) hw-pdata-gpio_setup(hw-pdata, 0); @@ -646,7 +651,7 @@ static int s3c24xx_spi_resume(struct device *dev) struct s3c24xx_spi *hw = dev_get_drvdata(dev); s3c24xx_spi_initialsetup(hw); - return 0; + return spi_master_resume(hw-master); } static const struct dev_pm_ops s3c24xx_spi_pmops = { -- 1.8.1.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
[PATCH] spi: s3c24xx: Convert to let spi core validate bits_per_word
Set bits_per_word_mask so spi core will reject transfers that attempt to use an unsupported bits_per_word value. Signed-off-by: Axel Lin axel@ingics.com --- drivers/spi/spi-s3c24xx.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c index c20df45..a275445 100644 --- a/drivers/spi/spi-s3c24xx.c +++ b/drivers/spi/spi-s3c24xx.c @@ -122,25 +122,15 @@ static int s3c24xx_spi_update_state(struct spi_device *spi, { struct s3c24xx_spi *hw = to_hw(spi); struct s3c24xx_spi_devstate *cs = spi-controller_state; - unsigned int bpw; unsigned int hz; unsigned int div; unsigned long clk; - bpw = t ? t-bits_per_word : spi-bits_per_word; hz = t ? t-speed_hz : spi-max_speed_hz; - if (!bpw) - bpw = 8; - if (!hz) hz = spi-max_speed_hz; - if (bpw != 8) { - dev_err(spi-dev, invalid bits-per-word (%d)\n, bpw); - return -EINVAL; - } - if (spi-mode != cs-mode) { u8 spcon = SPCON_DEFAULT | S3C2410_SPCON_ENSCK; @@ -543,6 +533,7 @@ static int s3c24xx_spi_probe(struct platform_device *pdev) master-num_chipselect = hw-pdata-num_cs; master-bus_num = pdata-bus_num; + master-bits_per_word_mask = SPI_BPW_MASK(8); /* setup the state for the bitbang driver */ -- 1.8.1.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: [linux-next] make s5p64x0_defconfig build error
Hi Kukjin, Axel and Will, thanks for pointing out. Oops, I couldn't have much time to follow up :( But let me look at that in this weekend and I know, it can be escaped before merge window :) I also found the same build errors by: make s5pc100_defconfig make s5pv210_defconfig make exynos4_defconfig Regards, Axel -- 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
[linux-next] make s5p64x0_defconfig build error
Hi, I got below build error on linux-next 20111213. CC arch/arm/kernel/process.o In file included from arch/arm/mach-s5p64x0/include/mach/system.h:16, from arch/arm/kernel/process.c:64: arch/arm/plat-samsung/include/plat/system-reset.h:19:2: error: #error Fix me up make[1]: *** [arch/arm/kernel/process.o] Error 1 make: *** [arch/arm/kernel] Error 2 Regards, Axel -- 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 1/2] ARM: exynos4: Fix build error due to 'gic_bank_offset' undeclared
Fix below build error: CC arch/arm/mach-exynos/cpu.o arch/arm/mach-exynos/cpu.c: In function 'exynos4_init_irq': arch/arm/mach-exynos/cpu.c:245: error: 'gic_bank_offset' undeclared (first use in this function) arch/arm/mach-exynos/cpu.c:245: error: (Each undeclared identifier is reported only once arch/arm/mach-exynos/cpu.c:245: error: for each function it appears in.) arch/arm/mach-exynos/cpu.c:243: warning: unused variable 'bank_offset' make[1]: *** [arch/arm/mach-exynos/cpu.o] Error 1 make: *** [arch/arm/mach-exynos] Error 2 Signed-off-by: Axel Lin axel@gmail.com --- arch/arm/mach-exynos/cpu.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-exynos/cpu.c b/arch/arm/mach-exynos/cpu.c index fed62f4..c7cb462 100644 --- a/arch/arm/mach-exynos/cpu.c +++ b/arch/arm/mach-exynos/cpu.c @@ -240,7 +240,7 @@ static const struct of_device_id exynos4_dt_irq_match[] = { void __init exynos4_init_irq(void) { int irq; - unsigned int bank_offset; + unsigned int gic_bank_offset; gic_bank_offset = soc_is_exynos4412() ? 0x4000 : 0x8000; -- 1.7.5.4 -- 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 2/2] ARM: exynos4: Fix build error
Trivial fix to fix below build error: CC arch/arm/mach-exynos/mach-universal_c210.o arch/arm/mach-exynos/mach-universal_c210.c:24: error: expected identifier or '(' before '' token Signed-off-by: Axel Lin axel@gmail.com --- arch/arm/mach-exynos/mach-universal_c210.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c index 48e85b0..cfc7d50 100644 --- a/arch/arm/mach-exynos/mach-universal_c210.c +++ b/arch/arm/mach-exynos/mach-universal_c210.c @@ -21,7 +21,7 @@ #include linux/mmc/host.h #include linux/i2c-gpio.h #include linux/i2c/mcs.h - linux/i2c/atmel_mxt_ts.h +#include linux/i2c/atmel_mxt_ts.h #include asm/mach/arch.h #include asm/hardware/gic.h -- 1.7.5.4 -- 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