@@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card *card)*switchtoHS200modeifbuswidthissetsuccessfully.*/err=mmc_select_bus_width(card);-if(!err){+if(err>0){val=EXT_CSD_TIMING_HS200|card->drive_strength<<EXT_CSD_DRV_STR_SHIFT;err=__mmc_switch(card,EXT_CSD_CMD_SET_NORMAL,
@@ -1583,7 +1583,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,}elseif(mmc_card_hs(card)){/* Select the desired bus width optionally */err=mmc_select_bus_width(card);-if(!err){+if(err>0){err=mmc_select_hs_ddr(card);if(err)gotofree_card;
Looks like this has already been 'fixed' in -rc2.
Although, this patch does not work for me.
commit f741494363c6c90e6744117d2771bbdf0fb3c455
Author: Chen-Yu Tsai [off-list ref]
Date: Sun May 29 15:04:42 2016 +0800
mmc: fix mmc mode selection for HS-DDR and higher
When IS_ERR_VALUE was removed from the mmc core code, it was replaced
with a simple not-zero check. This does not work, as the value checked
is the return value for mmc_select_bus_width, which returns the set
bit width on success. This made eMMC modes higher than HS-DDR unusable.
Fix this by checking for a positive return value instead.
Fixes: 287980e49ffc ("remove lots of IS_ERR_VALUE abuses")
Cc: Arnd Bergmann [off-list ref]
Signed-off-by: Chen-Yu Tsai [off-list ref]
Acked-by: Hans de Goede [off-list ref]
Reviewed-by: Krzysztof Kozlowski [off-list ref]
Acked-by: Jaehoon Chung [off-list ref]
Reviewed-by: Shawn Lin [off-list ref]
Tested-by: Marcel Ziswiler [off-list ref]
Tested-by: Bjorn Andersson [off-list ref]
Signed-off-by: Ulf Hansson [off-list ref]
@@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card *card)*switchtoHS200modeifbuswidthissetsuccessfully.*/err=mmc_select_bus_width(card);-if(!err){+if(err>0){val=EXT_CSD_TIMING_HS200|card->drive_strength<<EXT_CSD_DRV_STR_SHIFT;err=__mmc_switch(card,EXT_CSD_CMD_SET_NORMAL,
@@ -1583,7 +1583,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,}elseif(mmc_card_hs(card)){/* Select the desired bus width optionally */err=mmc_select_bus_width(card);-if(!err){+if(err>0){err=mmc_select_hs_ddr(card);if(err)gotofree_card;
Looks like this has already been 'fixed' in -rc2.
Ah, it seems I was on -rc1, not -rc2
quoted hunk
Although, this patch does not work for me.
mmc: fix mmc mode selection for HS-DDR and higher
When IS_ERR_VALUE was removed from the mmc core code, it was replaced
with a simple not-zero check. This does not work, as the value checked
is the return value for mmc_select_bus_width, which returns the set
bit width on success. This made eMMC modes higher than HS-DDR unusable.
Fix this by checking for a positive return value instead.
Fixes: 287980e49ffc ("remove lots of IS_ERR_VALUE abuses")
Cc: Arnd Bergmann [off-list ref]
Signed-off-by: Chen-Yu Tsai [off-list ref]
Acked-by: Hans de Goede [off-list ref]
Reviewed-by: Krzysztof Kozlowski [off-list ref]
Acked-by: Jaehoon Chung [off-list ref]
Reviewed-by: Shawn Lin [off-list ref]
Tested-by: Marcel Ziswiler [off-list ref]
Tested-by: Bjorn Andersson [off-list ref]
Signed-off-by: Ulf Hansson [off-list ref]
@@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card *card)*switchtoHS200modeifbuswidthissetsuccessfully.*/err=mmc_select_bus_width(card);-if(!err){+if(err>=0){
This patch looks wrong to me, as if zero is returned by mmc_select_bus_width() it
means setting the bus width failed, and you most likely don't want to switch to
hs200 mode.
Ulf - what is your opinion?
regards,
Peter.>
@@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card *card)*switchtoHS200modeifbuswidthissetsuccessfully.*/err=mmc_select_bus_width(card);-if(!err){+if(err>0){val=EXT_CSD_TIMING_HS200|card->drive_strength<<EXT_CSD_DRV_STR_SHIFT;err=__mmc_switch(card,EXT_CSD_CMD_SET_NORMAL,
@@ -1583,7 +1583,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,}elseif(mmc_card_hs(card)){/* Select the desired bus width optionally */err=mmc_select_bus_width(card);-if(!err){+if(err>0){err=mmc_select_hs_ddr(card);if(err)gotofree_card;
Looks like this has already been 'fixed' in -rc2.
Ah, it seems I was on -rc1, not -rc2
quoted
Although, this patch does not work for me.
mmc: fix mmc mode selection for HS-DDR and higher
When IS_ERR_VALUE was removed from the mmc core code, it was replaced
with a simple not-zero check. This does not work, as the value checked
is the return value for mmc_select_bus_width, which returns the set
bit width on success. This made eMMC modes higher than HS-DDR unusable.
Fix this by checking for a positive return value instead.
Fixes: 287980e49ffc ("remove lots of IS_ERR_VALUE abuses")
Cc: Arnd Bergmann [off-list ref]
Signed-off-by: Chen-Yu Tsai [off-list ref]
Acked-by: Hans de Goede [off-list ref]
Reviewed-by: Krzysztof Kozlowski [off-list ref]
Acked-by: Jaehoon Chung [off-list ref]
Reviewed-by: Shawn Lin [off-list ref]
Tested-by: Marcel Ziswiler [off-list ref]
Tested-by: Bjorn Andersson [off-list ref]
Signed-off-by: Ulf Hansson [off-list ref]
@@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card *card)*switchtoHS200modeifbuswidthissetsuccessfully.*/err=mmc_select_bus_width(card);-if(!err){+if(err>=0){
This patch looks wrong to me, as if zero is returned by mmc_select_bus_width() it
means setting the bus width failed, and you most likely don't want to switch to
hs200 mode.
Ulf - what is your opinion?
regards,
Peter.>
The commit above (mmc: fix mmc mode selection for HS-DDR and higher),
simply restored the old behaviour and that was sufficient to solve the
regressions.
Nevertheless I agree, that if mmc_select_bus_width() returns 0, that
should likely mean that we shouldn't try to switch to hs200. If we
want to change that, let's do that in a separate patch on top.
So, do you see a problem in rc2?
Kind regards
Uffe
@@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card *card)*switchtoHS200modeifbuswidthissetsuccessfully.*/err=mmc_select_bus_width(card);-if(!err){+if(err>0){val=EXT_CSD_TIMING_HS200|card->drive_strength<<EXT_CSD_DRV_STR_SHIFT;err=__mmc_switch(card,EXT_CSD_CMD_SET_NORMAL,
@@ -1583,7 +1583,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,}elseif(mmc_card_hs(card)){/* Select the desired bus width optionally */err=mmc_select_bus_width(card);-if(!err){+if(err>0){err=mmc_select_hs_ddr(card);if(err)gotofree_card;
Looks like this has already been 'fixed' in -rc2.
Ah, it seems I was on -rc1, not -rc2
quoted
Although, this patch does not work for me.
mmc: fix mmc mode selection for HS-DDR and higher
When IS_ERR_VALUE was removed from the mmc core code, it was replaced
with a simple not-zero check. This does not work, as the value checked
is the return value for mmc_select_bus_width, which returns the set
bit width on success. This made eMMC modes higher than HS-DDR unusable.
Fix this by checking for a positive return value instead.
Fixes: 287980e49ffc ("remove lots of IS_ERR_VALUE abuses")
Cc: Arnd Bergmann [off-list ref]
Signed-off-by: Chen-Yu Tsai [off-list ref]
Acked-by: Hans de Goede [off-list ref]
Reviewed-by: Krzysztof Kozlowski [off-list ref]
Acked-by: Jaehoon Chung [off-list ref]
Reviewed-by: Shawn Lin [off-list ref]
Tested-by: Marcel Ziswiler [off-list ref]
Tested-by: Bjorn Andersson [off-list ref]
Signed-off-by: Ulf Hansson [off-list ref]
@@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card *card)*switchtoHS200modeifbuswidthissetsuccessfully.*/err=mmc_select_bus_width(card);-if(!err){+if(err>=0){
This patch looks wrong to me, as if zero is returned by mmc_select_bus_width() it
means setting the bus width failed, and you most likely don't want to switch to
hs200 mode.
Ulf - what is your opinion?
regards,
Peter.>
The commit above (mmc: fix mmc mode selection for HS-DDR and higher),
simply restored the old behaviour and that was sufficient to solve the
regressions.
Nevertheless I agree, that if mmc_select_bus_width() returns 0, that
should likely mean that we shouldn't try to switch to hs200. If we
want to change that, let's do that in a separate patch on top.
OK, I will send a v2 patch in a moment.
So, do you see a problem in rc2?
No, despite what the commit message says, I wrote & tested the patch on
v4.7-rc1. A stock v4.7-rc2 enumerates the card correctly on my STi platform.
I think my patch is now only useful if setting the bus width were to fail.
regards,
Peter.