diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-15 05:23:04 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-15 05:23:04 -0400 |
| commit | c526c216fef0022611b0b7cd0f68d103e3378b49 (patch) | |
| tree | ece24f5d331c2e36e799c019f6182111f15c810d | |
| parent | 313e1a0a5f86cb129aa4542f61702a4bbb2079b9 (diff) | |
| parent | b1ff3231b2d4197ef5024f9c57ffc6cfa562590c (diff) | |
Merge tag 'for-4.0-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy into usb-linus
Kishon writes:
contains fixes all over drivers/phy and includes the following
*) Using phy_get_drvdata instead of dev_get_drvdata in armada375-usb2.c
*) Fixes w.r.t checking return values in regmap APIs, protecting regmap ops
with spin lock and directly using regmap_update_bits instead of having a
separate function to do the same in the various PHYs used in exynos.
*) check return value in platform_get_resource of hix5hd2-sata PHY
*) Removed NULL terminating entry from phys array and fix off-by-one
valid value checking for args->args[0] in of_xlate of exynos USB PHY.
*) Fixup rockchip_usb_phy_power_on failure path
*) Fix devm_phy_match to find the correct match in phy core and also fix to
return the correct value from PHY APIs if PM runtime is not enabled.
*) Removed redundant code in twl4030 and xgene
*) Fixed sizeof during memory allocation in miphy PHYs
*) simplify ti_pipe3_dpll_wait_lock implementation, fix missing clk_prepare
when using old dt name and nit pick in MOUDLE_ALIAS in TI PHYs.
| -rw-r--r-- | drivers/phy/phy-armada375-usb2.c | 3 | ||||
| -rw-r--r-- | drivers/phy/phy-core.c | 11 | ||||
| -rw-r--r-- | drivers/phy/phy-exynos-dp-video.c | 24 | ||||
| -rw-r--r-- | drivers/phy/phy-exynos-mipi-video.c | 11 | ||||
| -rw-r--r-- | drivers/phy/phy-exynos4210-usb2.c | 1 | ||||
| -rw-r--r-- | drivers/phy/phy-exynos4x12-usb2.c | 1 | ||||
| -rw-r--r-- | drivers/phy/phy-exynos5-usbdrd.c | 2 | ||||
| -rw-r--r-- | drivers/phy/phy-exynos5250-usb2.c | 1 | ||||
| -rw-r--r-- | drivers/phy/phy-hix5hd2-sata.c | 3 | ||||
| -rw-r--r-- | drivers/phy/phy-miphy28lp.c | 13 | ||||
| -rw-r--r-- | drivers/phy/phy-miphy365x.c | 12 | ||||
| -rw-r--r-- | drivers/phy/phy-omap-control.c | 2 | ||||
| -rw-r--r-- | drivers/phy/phy-omap-usb2.c | 7 | ||||
| -rw-r--r-- | drivers/phy/phy-rockchip-usb.c | 6 | ||||
| -rw-r--r-- | drivers/phy/phy-ti-pipe3.c | 12 | ||||
| -rw-r--r-- | drivers/phy/phy-twl4030-usb.c | 1 | ||||
| -rw-r--r-- | drivers/phy/phy-xgene.c | 1 |
17 files changed, 45 insertions, 66 deletions
diff --git a/drivers/phy/phy-armada375-usb2.c b/drivers/phy/phy-armada375-usb2.c index 7c99ca256f05..8ccc3952c13d 100644 --- a/drivers/phy/phy-armada375-usb2.c +++ b/drivers/phy/phy-armada375-usb2.c | |||
| @@ -37,7 +37,7 @@ static int armada375_usb_phy_init(struct phy *phy) | |||
| 37 | struct armada375_cluster_phy *cluster_phy; | 37 | struct armada375_cluster_phy *cluster_phy; |
| 38 | u32 reg; | 38 | u32 reg; |
| 39 | 39 | ||
| 40 | cluster_phy = dev_get_drvdata(phy->dev.parent); | 40 | cluster_phy = phy_get_drvdata(phy); |
| 41 | if (!cluster_phy) | 41 | if (!cluster_phy) |
| 42 | return -ENODEV; | 42 | return -ENODEV; |
| 43 | 43 | ||
| @@ -131,6 +131,7 @@ static int armada375_usb_phy_probe(struct platform_device *pdev) | |||
| 131 | cluster_phy->reg = usb_cluster_base; | 131 | cluster_phy->reg = usb_cluster_base; |
| 132 | 132 | ||
| 133 | dev_set_drvdata(dev, cluster_phy); | 133 | dev_set_drvdata(dev, cluster_phy); |
| 134 | phy_set_drvdata(phy, cluster_phy); | ||
| 134 | 135 | ||
| 135 | phy_provider = devm_of_phy_provider_register(&pdev->dev, | 136 | phy_provider = devm_of_phy_provider_register(&pdev->dev, |
| 136 | armada375_usb_phy_xlate); | 137 | armada375_usb_phy_xlate); |
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index a12d35338313..3791838f4bd4 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c | |||
| @@ -52,7 +52,9 @@ static void devm_phy_consume(struct device *dev, void *res) | |||
| 52 | 52 | ||
| 53 | static int devm_phy_match(struct device *dev, void *res, void *match_data) | 53 | static int devm_phy_match(struct device *dev, void *res, void *match_data) |
| 54 | { | 54 | { |
| 55 | return res == match_data; | 55 | struct phy **phy = res; |
| 56 | |||
| 57 | return *phy == match_data; | ||
| 56 | } | 58 | } |
| 57 | 59 | ||
| 58 | /** | 60 | /** |
| @@ -223,6 +225,7 @@ int phy_init(struct phy *phy) | |||
| 223 | ret = phy_pm_runtime_get_sync(phy); | 225 | ret = phy_pm_runtime_get_sync(phy); |
| 224 | if (ret < 0 && ret != -ENOTSUPP) | 226 | if (ret < 0 && ret != -ENOTSUPP) |
| 225 | return ret; | 227 | return ret; |
| 228 | ret = 0; /* Override possible ret == -ENOTSUPP */ | ||
| 226 | 229 | ||
| 227 | mutex_lock(&phy->mutex); | 230 | mutex_lock(&phy->mutex); |
| 228 | if (phy->init_count == 0 && phy->ops->init) { | 231 | if (phy->init_count == 0 && phy->ops->init) { |
| @@ -231,8 +234,6 @@ int phy_init(struct phy *phy) | |||
| 231 | dev_err(&phy->dev, "phy init failed --> %d\n", ret); | 234 | dev_err(&phy->dev, "phy init failed --> %d\n", ret); |
| 232 | goto out; | 235 | goto out; |
| 233 | } | 236 | } |
| 234 | } else { | ||
| 235 | ret = 0; /* Override possible ret == -ENOTSUPP */ | ||
| 236 | } | 237 | } |
| 237 | ++phy->init_count; | 238 | ++phy->init_count; |
| 238 | 239 | ||
| @@ -253,6 +254,7 @@ int phy_exit(struct phy *phy) | |||
| 253 | ret = phy_pm_runtime_get_sync(phy); | 254 | ret = phy_pm_runtime_get_sync(phy); |
| 254 | if (ret < 0 && ret != -ENOTSUPP) | 255 | if (ret < 0 && ret != -ENOTSUPP) |
| 255 | return ret; | 256 | return ret; |
| 257 | ret = 0; /* Override possible ret == -ENOTSUPP */ | ||
| 256 | 258 | ||
| 257 | mutex_lock(&phy->mutex); | 259 | mutex_lock(&phy->mutex); |
| 258 | if (phy->init_count == 1 && phy->ops->exit) { | 260 | if (phy->init_count == 1 && phy->ops->exit) { |
| @@ -287,6 +289,7 @@ int phy_power_on(struct phy *phy) | |||
| 287 | ret = phy_pm_runtime_get_sync(phy); | 289 | ret = phy_pm_runtime_get_sync(phy); |
| 288 | if (ret < 0 && ret != -ENOTSUPP) | 290 | if (ret < 0 && ret != -ENOTSUPP) |
| 289 | return ret; | 291 | return ret; |
| 292 | ret = 0; /* Override possible ret == -ENOTSUPP */ | ||
| 290 | 293 | ||
| 291 | mutex_lock(&phy->mutex); | 294 | mutex_lock(&phy->mutex); |
| 292 | if (phy->power_count == 0 && phy->ops->power_on) { | 295 | if (phy->power_count == 0 && phy->ops->power_on) { |
| @@ -295,8 +298,6 @@ int phy_power_on(struct phy *phy) | |||
| 295 | dev_err(&phy->dev, "phy poweron failed --> %d\n", ret); | 298 | dev_err(&phy->dev, "phy poweron failed --> %d\n", ret); |
| 296 | goto out; | 299 | goto out; |
| 297 | } | 300 | } |
| 298 | } else { | ||
| 299 | ret = 0; /* Override possible ret == -ENOTSUPP */ | ||
| 300 | } | 301 | } |
| 301 | ++phy->power_count; | 302 | ++phy->power_count; |
| 302 | mutex_unlock(&phy->mutex); | 303 | mutex_unlock(&phy->mutex); |
diff --git a/drivers/phy/phy-exynos-dp-video.c b/drivers/phy/phy-exynos-dp-video.c index f86cbe68ddaf..179cbf9451aa 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 { | |||
| 30 | const struct exynos_dp_video_phy_drvdata *drvdata; | 30 | const struct exynos_dp_video_phy_drvdata *drvdata; |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | static void exynos_dp_video_phy_pwr_isol(struct exynos_dp_video_phy *state, | ||
| 34 | unsigned int on) | ||
| 35 | { | ||
| 36 | unsigned int val; | ||
| 37 | |||
| 38 | if (IS_ERR(state->regs)) | ||
| 39 | return; | ||
| 40 | |||
| 41 | val = on ? 0 : EXYNOS5_PHY_ENABLE; | ||
| 42 | |||
| 43 | regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset, | ||
| 44 | EXYNOS5_PHY_ENABLE, val); | ||
| 45 | } | ||
| 46 | |||
| 47 | static int exynos_dp_video_phy_power_on(struct phy *phy) | 33 | static int exynos_dp_video_phy_power_on(struct phy *phy) |
| 48 | { | 34 | { |
| 49 | struct exynos_dp_video_phy *state = phy_get_drvdata(phy); | 35 | struct exynos_dp_video_phy *state = phy_get_drvdata(phy); |
| 50 | 36 | ||
| 51 | /* Disable power isolation on DP-PHY */ | 37 | /* Disable power isolation on DP-PHY */ |
| 52 | exynos_dp_video_phy_pwr_isol(state, 0); | 38 | return regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset, |
| 53 | 39 | EXYNOS5_PHY_ENABLE, EXYNOS5_PHY_ENABLE); | |
| 54 | return 0; | ||
| 55 | } | 40 | } |
| 56 | 41 | ||
| 57 | static int exynos_dp_video_phy_power_off(struct phy *phy) | 42 | 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) | |||
| 59 | struct exynos_dp_video_phy *state = phy_get_drvdata(phy); | 44 | struct exynos_dp_video_phy *state = phy_get_drvdata(phy); |
| 60 | 45 | ||
| 61 | /* Enable power isolation on DP-PHY */ | 46 | /* Enable power isolation on DP-PHY */ |
| 62 | exynos_dp_video_phy_pwr_isol(state, 1); | 47 | return regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset, |
| 63 | 48 | EXYNOS5_PHY_ENABLE, 0); | |
| 64 | return 0; | ||
| 65 | } | 49 | } |
| 66 | 50 | ||
| 67 | static struct phy_ops exynos_dp_video_phy_ops = { | 51 | static struct phy_ops exynos_dp_video_phy_ops = { |
diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c index f017b2f2a54e..df7519a39ba0 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 { | |||
| 43 | } phys[EXYNOS_MIPI_PHYS_NUM]; | 43 | } phys[EXYNOS_MIPI_PHYS_NUM]; |
| 44 | spinlock_t slock; | 44 | spinlock_t slock; |
| 45 | void __iomem *regs; | 45 | void __iomem *regs; |
| 46 | struct mutex mutex; | ||
| 47 | struct regmap *regmap; | 46 | struct regmap *regmap; |
| 48 | }; | 47 | }; |
| 49 | 48 | ||
| @@ -59,8 +58,9 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state, | |||
| 59 | else | 58 | else |
| 60 | reset = EXYNOS4_MIPI_PHY_SRESETN; | 59 | reset = EXYNOS4_MIPI_PHY_SRESETN; |
| 61 | 60 | ||
| 62 | if (state->regmap) { | 61 | spin_lock(&state->slock); |
| 63 | mutex_lock(&state->mutex); | 62 | |
| 63 | if (!IS_ERR(state->regmap)) { | ||
| 64 | regmap_read(state->regmap, offset, &val); | 64 | regmap_read(state->regmap, offset, &val); |
| 65 | if (on) | 65 | if (on) |
| 66 | val |= reset; | 66 | val |= reset; |
| @@ -72,11 +72,9 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state, | |||
| 72 | else if (!(val & EXYNOS4_MIPI_PHY_RESET_MASK)) | 72 | else if (!(val & EXYNOS4_MIPI_PHY_RESET_MASK)) |
| 73 | val &= ~EXYNOS4_MIPI_PHY_ENABLE; | 73 | val &= ~EXYNOS4_MIPI_PHY_ENABLE; |
| 74 | regmap_write(state->regmap, offset, val); | 74 | regmap_write(state->regmap, offset, val); |
| 75 | mutex_unlock(&state->mutex); | ||
| 76 | } else { | ||
