Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1457417 > unrolled thread
| Started by | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| First post | 2016-08-07 03:40 +0200 |
| Last post | 2016-08-09 04:20 +0200 |
| Articles | 7 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v2 0/6] Add support of inverting power control and some minor cleanup Shawn Lin <shawn.lin@rock-chips.com> - 2016-08-07 03:40 +0200
[PATCH v2 2/6] mmc: dw_mmc: cleanup power setting of set_ios callback Shawn Lin <shawn.lin@rock-chips.com> - 2016-08-07 03:40 +0200
[PATCH v2 1/6] dt-bindings: rockchip-dw-mshc: add description of rockchip,power-invert Shawn Lin <shawn.lin@rock-chips.com> - 2016-08-07 03:40 +0200
Re: [PATCH v2 1/6] dt-bindings: rockchip-dw-mshc: add description of rockchip,power-invert Rob Herring <robh@kernel.org> - 2016-08-10 20:50 +0200
Re: [PATCH v2 0/6] Add support of inverting power control and some minor cleanup Jaehoon Chung <jh80.chung@samsung.com> - 2016-08-08 12:30 +0200
Re: [PATCH v2 0/6] Add support of inverting power control and some minor cleanup Shawn Lin <shawn.lin@rock-chips.com> - 2016-08-09 04:00 +0200
Re: [PATCH v2 0/6] Add support of inverting power control and some minor cleanup Shawn Lin <shawn.lin@rock-chips.com> - 2016-08-09 04:20 +0200
| From | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| Date | 2016-08-07 03:40 +0200 |
| Subject | [PATCH v2 0/6] Add support of inverting power control and some minor cleanup |
| Message-ID | <s3leh-5hH-3@gated-at.bofh.it> |
By default, dw_mmc outputs high level voltage to indicate powering
up the card and outputs low level vcltage to indicate powering
off the card. But that is not always correct. The power io should
be able to control different kind of hw components to supply or
cutoff power to the card. We have boards that need this patchset
to make the power control correct. Meanwhile let's expose it to
DT for board-specific usage.
Changes in v2:
- fix copy-paste err and typo
Shawn Lin (6):
dt-bindings: rockchip-dw-mshc: add description of
rockchip,power-invert
mmc: dw_mmc: cleanup power setting of set_ios callback
mmc: dw_mmc: split out dw_mci_set_power
mmc: dw_mmc: split out dw_mci_set_power_reg
mmc: dw_mmc: support inverted power control
mmc: dw_mmc-rockchip: add parsing of power control from DT
.../devicetree/bindings/mmc/rockchip-dw-mshc.txt | 6 +
drivers/mmc/host/dw_mmc-rockchip.c | 8 ++
drivers/mmc/host/dw_mmc.c | 134 ++++++++++++---------
drivers/mmc/host/dw_mmc.h | 1 +
4 files changed, 90 insertions(+), 59 deletions(-)
--
2.3.7
[toc] | [next] | [standalone]
| From | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| Date | 2016-08-07 03:40 +0200 |
| Subject | [PATCH v2 2/6] mmc: dw_mmc: cleanup power setting of set_ios callback |
| Message-ID | <s3lei-5hH-31@gated-at.bofh.it> |
| In reply to | #1457417 |
Remove the ret variable and combine the condition check
to simplify the code.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
Changes in v2: None
drivers/mmc/host/dw_mmc.c | 28 ++++++++++------------------
1 file changed, 10 insertions(+), 18 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 32380d5..59a5e9c 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1281,7 +1281,6 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
struct dw_mci_slot *slot = mmc_priv(mmc);
const struct dw_mci_drv_data *drv_data = slot->host->drv_data;
u32 regs;
- int ret;
switch (ios->bus_width) {
case MMC_BUS_WIDTH_4:
@@ -1319,15 +1318,12 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
switch (ios->power_mode) {
case MMC_POWER_UP:
- if (!IS_ERR(mmc->supply.vmmc)) {
- ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc,
- ios->vdd);
- if (ret) {
- dev_err(slot->host->dev,
- "failed to enable vmmc regulator\n");
- /*return, if failed turn on vmmc*/
- return;
- }
+ if (!IS_ERR(mmc->supply.vmmc) &&
+ mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd)) {
+ dev_err(slot->host->dev,
+ "failed to enable vmmc regulator\n");
+ /*return, if failed turn on vmmc*/
+ return;
}
set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags);
regs = mci_readl(slot->host, PWREN);
@@ -1336,14 +1332,10 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
break;
case MMC_POWER_ON:
if (!slot->host->vqmmc_enabled) {
- if (!IS_ERR(mmc->supply.vqmmc)) {
- ret = regulator_enable(mmc->supply.vqmmc);
- if (ret < 0)
- dev_err(slot->host->dev,
- "failed to enable vqmmc\n");
- else
- slot->host->vqmmc_enabled = true;
-
+ if (!IS_ERR(mmc->supply.vqmmc) &&
+ regulator_enable(mmc->supply.vqmmc)) {
+ dev_err(slot->host->dev,
+ "failed to enable vqmmc\n");
} else {
/* Keep track so we don't reset again */
slot->host->vqmmc_enabled = true;
--
2.3.7
[toc] | [prev] | [next] | [standalone]
| From | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| Date | 2016-08-07 03:40 +0200 |
| Subject | [PATCH v2 1/6] dt-bindings: rockchip-dw-mshc: add description of rockchip,power-invert |
| Message-ID | <s3lei-5hH-29@gated-at.bofh.it> |
| In reply to | #1457417 |
rockchip,power-invert is used for rockchip to introduce the flag
DW_MMC_CARD_PWR_INVERT from DT which should make the power control
of dw_mmc more flexible according to different hw design.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
Changes in v2: None
Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt
index 07184e8..5640659 100644
--- a/Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt
@@ -30,6 +30,12 @@ Optional Properties:
probing, low speeds or in case where all phases work at tuning time.
If not specified 0 deg will be used.
+* rockchip,power-invert: Invert the power control of PWREN register. If adding
+ it, the card should be in power-on state when the power io outputs high level
+ voltage, and it should be in power-off state when outputing low level voltage.
+ otherwise the behaviour of power control should be the opposite way which is
+ the default policy of dw mshc.
+
Example:
rkdwmmc0@12200000 {
--
2.3.7
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2016-08-10 20:50 +0200 |
| Subject | Re: [PATCH v2 1/6] dt-bindings: rockchip-dw-mshc: add description of rockchip,power-invert |
| Message-ID | <s4GJJ-j6-89@gated-at.bofh.it> |
| In reply to | #1457420 |
On Sun, Aug 07, 2016 at 09:34:04AM +0800, Shawn Lin wrote: > rockchip,power-invert is used for rockchip to introduce the flag > DW_MMC_CARD_PWR_INVERT from DT which should make the power control > of dw_mmc more flexible according to different hw design. > > Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> > > --- > > Changes in v2: None > > Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt | 6 ++++++ > 1 file changed, 6 insertions(+) Acked-by: Rob Herring <robh@kernel.org>
[toc] | [prev] | [next] | [standalone]
| From | Jaehoon Chung <jh80.chung@samsung.com> |
|---|---|
| Date | 2016-08-08 12:30 +0200 |
| Subject | Re: [PATCH v2 0/6] Add support of inverting power control and some minor cleanup |
| Message-ID | <s3PYK-7f-55@gated-at.bofh.it> |
| In reply to | #1457417 |
Hi Shawn, On 08/07/2016 10:33 AM, Shawn Lin wrote: > By default, dw_mmc outputs high level voltage to indicate powering > up the card and outputs low level vcltage to indicate powering > off the card. But that is not always correct. The power io should > be able to control different kind of hw components to supply or > cutoff power to the card. We have boards that need this patchset > to make the power control correct. Meanwhile let's expose it to > DT for board-specific usage. I have a question for this patch-set. Does DWMMC IP support to invert ON/OFF at Power Enable register? Hmm..Well, if use the DW_MMC_CARD_PWR_INVERT, it should also be the similar behavior with Quirks. Other flags are related with dwmmc IP. But this flag (DW_MMC_CARD_PWR_INVERT) is not related with IP side. I understood why you needs to add this flag..Is rockchip designed to invert the power controlling? But it's not general case. We can discuss about this. Best Regards, Jaehoon Chung > > > Changes in v2: > - fix copy-paste err and typo > > Shawn Lin (6): > dt-bindings: rockchip-dw-mshc: add description of > rockchip,power-invert > mmc: dw_mmc: cleanup power setting of set_ios callback > mmc: dw_mmc: split out dw_mci_set_power > mmc: dw_mmc: split out dw_mci_set_power_reg > mmc: dw_mmc: support inverted power control > mmc: dw_mmc-rockchip: add parsing of power control from DT > > .../devicetree/bindings/mmc/rockchip-dw-mshc.txt | 6 + > drivers/mmc/host/dw_mmc-rockchip.c | 8 ++ > drivers/mmc/host/dw_mmc.c | 134 ++++++++++++--------- > drivers/mmc/host/dw_mmc.h | 1 + > 4 files changed, 90 insertions(+), 59 deletions(-) >
[toc] | [prev] | [next] | [standalone]
| From | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| Date | 2016-08-09 04:00 +0200 |
| Subject | Re: [PATCH v2 0/6] Add support of inverting power control and some minor cleanup |
| Message-ID | <s44uJ-Zq-1@gated-at.bofh.it> |
| In reply to | #1457691 |
Hi, On 2016/8/8 18:24, Jaehoon Chung wrote: > Hi Shawn, > > On 08/07/2016 10:33 AM, Shawn Lin wrote: >> By default, dw_mmc outputs high level voltage to indicate powering >> up the card and outputs low level vcltage to indicate powering >> off the card. But that is not always correct. The power io should >> be able to control different kind of hw components to supply or >> cutoff power to the card. We have boards that need this patchset >> to make the power control correct. Meanwhile let's expose it to >> DT for board-specific usage. > > I have a question for this patch-set. Does DWMMC IP support to invert ON/OFF at Power Enable register? No. > Hmm..Well, if use the DW_MMC_CARD_PWR_INVERT, it should also be the similar behavior with Quirks. yup, it makes the power control more complicated than before. :( > > Other flags are related with dwmmc IP. But this flag (DW_MMC_CARD_PWR_INVERT) is not related with IP side. > I understood why you needs to add this flag..Is rockchip designed to invert the power controlling? We don't invert the power controlling but our customers do. The HW componet looks like some discrete LDOs which enable the related power supply when outputing low voltage from pwren.. > > But it's not general case. We can discuss about this. I have a solution which is to add gpio power control for slot-gpio of mmc core. once finished, we could add pwr_cap_invert just like what we did for cd/wp invert control.. Then we could remove PWREN from the default state of pinctrl inside the sdmmc dt node, and let dwmmc request gpio power control stuff after paring the property for pwr_cap_invert.. More over, it well fit for all mmc host's requirement of gpio power control and inverted control if they want it. :) That should be legit for us? If it sounds ok to you and Ulf, I will come up with a RFC one for community to comment it.:) > > Best Regards, > Jaehoon Chung > >> >> >> Changes in v2: >> - fix copy-paste err and typo >> >> Shawn Lin (6): >> dt-bindings: rockchip-dw-mshc: add description of >> rockchip,power-invert >> mmc: dw_mmc: cleanup power setting of set_ios callback >> mmc: dw_mmc: split out dw_mci_set_power >> mmc: dw_mmc: split out dw_mci_set_power_reg >> mmc: dw_mmc: support inverted power control >> mmc: dw_mmc-rockchip: add parsing of power control from DT >> >> .../devicetree/bindings/mmc/rockchip-dw-mshc.txt | 6 + >> drivers/mmc/host/dw_mmc-rockchip.c | 8 ++ >> drivers/mmc/host/dw_mmc.c | 134 ++++++++++++--------- >> drivers/mmc/host/dw_mmc.h | 1 + >> 4 files changed, 90 insertions(+), 59 deletions(-) >> > > > > -- Best Regards Shawn Lin
[toc] | [prev] | [next] | [standalone]
| From | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| Date | 2016-08-09 04:20 +0200 |
| Subject | Re: [PATCH v2 0/6] Add support of inverting power control and some minor cleanup |
| Message-ID | <s44O6-1op-7@gated-at.bofh.it> |
| In reply to | #1458367 |
On 2016/8/9 9:49, Shawn Lin wrote: > Hi, > > On 2016/8/8 18:24, Jaehoon Chung wrote: >> Hi Shawn, >> >> On 08/07/2016 10:33 AM, Shawn Lin wrote: >>> By default, dw_mmc outputs high level voltage to indicate powering >>> up the card and outputs low level vcltage to indicate powering >>> off the card. But that is not always correct. The power io should >>> be able to control different kind of hw components to supply or >>> cutoff power to the card. We have boards that need this patchset >>> to make the power control correct. Meanwhile let's expose it to >>> DT for board-specific usage. >> >> I have a question for this patch-set. Does DWMMC IP support to invert >> ON/OFF at Power Enable register? > > No. > >> Hmm..Well, if use the DW_MMC_CARD_PWR_INVERT, it should also be the >> similar behavior with Quirks. > > yup, it makes the power control more complicated than before. :( > >> >> Other flags are related with dwmmc IP. But this flag >> (DW_MMC_CARD_PWR_INVERT) is not related with IP side. >> I understood why you needs to add this flag..Is rockchip designed to >> invert the power controlling? > > We don't invert the power controlling but our customers do. > The HW componet looks like some discrete LDOs which enable the related > power supply when outputing low voltage from pwren.. > >> >> But it's not general case. We can discuss about this. > > I have a solution which is to add gpio power control for slot-gpio of > mmc core. once finished, we could add pwr_cap_invert just like what we > did for cd/wp invert control.. > > Then we could remove PWREN from the default state of > pinctrl inside the sdmmc dt node, and let dwmmc request gpio power > control stuff after paring the property for pwr_cap_invert.. > > More over, it well fit for all mmc host's requirement of gpio > power control and inverted control if they want it. :) > > > That should be legit for us? > If it sounds ok to you and Ulf, I will come up with a RFC one for > community to comment it.:) one more, maybe pwrseq is also a choice for us. But I'm not sure if it deserves a pwerseq_sd.c ? > >> >> Best Regards, >> Jaehoon Chung >> >>> >>> >>> Changes in v2: >>> - fix copy-paste err and typo >>> >>> Shawn Lin (6): >>> dt-bindings: rockchip-dw-mshc: add description of >>> rockchip,power-invert >>> mmc: dw_mmc: cleanup power setting of set_ios callback >>> mmc: dw_mmc: split out dw_mci_set_power >>> mmc: dw_mmc: split out dw_mci_set_power_reg >>> mmc: dw_mmc: support inverted power control >>> mmc: dw_mmc-rockchip: add parsing of power control from DT >>> >>> .../devicetree/bindings/mmc/rockchip-dw-mshc.txt | 6 + >>> drivers/mmc/host/dw_mmc-rockchip.c | 8 ++ >>> drivers/mmc/host/dw_mmc.c | 134 >>> ++++++++++++--------- >>> drivers/mmc/host/dw_mmc.h | 1 + >>> 4 files changed, 90 insertions(+), 59 deletions(-) >>> >> >> >> >> > > -- Best Regards Shawn Lin
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web