2011-03-15 08:22:50

by wwang

[permalink] [raw]
Subject: [PATCH 2/2] staging: rts_pstor: set lun_mode in a different place

From: wwang <[email protected]>

In sony notebook, card reader will be configured as two-lun mode
through EFUSE. In this situation, MS card can't be recognized
properly because driver does only support single-lun mode in default.
In this patch, lun_mode is set in a different place, so driver can
detect the EFUSE configuation automatically.

Signed-off-by: wwang <[email protected]>
---
drivers/staging/rts_pstor/rtsx_chip.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rts_pstor/rtsx_chip.c b/drivers/staging/rts_pstor/rtsx_chip.c
index f443d97..d2f1c71 100644
--- a/drivers/staging/rts_pstor/rtsx_chip.c
+++ b/drivers/staging/rts_pstor/rtsx_chip.c
@@ -684,6 +684,11 @@ static int rts5209_init(struct rtsx_chip *chip)
RTSX_DEBUGP("dw in 0x724: 0x%x\n", lval);
val = (u8)lval;
if (!(val & 0x80)) {
+ if (val & 0x08)
+ chip->lun_mode = DEFAULT_SINGLE;
+ else
+ chip->lun_mode = SD_MS_2LUN;
+
if (val & 0x04) {
SET_SDIO_EXIST(chip);
} else {
@@ -705,12 +710,6 @@ static int rts5209_init(struct rtsx_chip *chip)

chip->aspm_l0s_l1_en = (val >> 5) & 0x03;

- if (val & 0x08) {
- chip->lun_mode = DEFAULT_SINGLE;
- } else {
- chip->lun_mode = SD_MS_2LUN;
- }
-
val = (u8)(lval >> 8);

clk = (val >> 5) & 0x07;
--
1.7.4.1


2011-03-15 08:46:50

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: rts_pstor: set lun_mode in a different place

On Tue, Mar 15, 2011 at 04:22:16PM +0800, [email protected] wrote:
> From: wwang <[email protected]>
>
> In sony notebook, card reader will be configured as two-lun mode
> through EFUSE. In this situation, MS card can't be recognized
> properly because driver does only support single-lun mode in default.
> In this patch, lun_mode is set in a different place, so driver can
> detect the EFUSE configuation automatically.
>

Hm... The auto detect code is never run because chip->use_hw_setting is
always 0. Are you sure the right fix isn't to set chip->use_hw_setting
to 1?

regards,
dan carpenter

2011-03-15 08:57:12

by wwang

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: rts_pstor: set lun_mode in a differentplace

?? 2011??03??15?? 16:46, Dan Carpenter д??:
> Hm... The auto detect code is never run because chip->use_hw_setting is
> always 0. Are you sure the right fix isn't to set chip->use_hw_setting
> to 1?
>
> regards,
> dan carpenter
>
Yes, setting chip->use_hw_setting is not a wise choice.
Normally, if chip->use_hw_setting is set to 1, more configurations will
be turned on, such as auto_delink_en.
auto_delink_en can only work well when pcie hotplug is configured and
pciehp.pciehp_force is set to 1. This condition can't be met in default
kernel config by now.
So, I have to choose to set lun_mode detection code in a different place.

Best regards,
wwang

2011-03-15 12:49:54

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: rts_pstor: set lun_mode in a differentplace

On Tue, Mar 15, 2011 at 04:56:38PM +0800, wwang wrote:
> 于 2011年03月15日 16:46, Dan Carpenter 写道:
> > Hm... The auto detect code is never run because chip->use_hw_setting is
> > always 0. Are you sure the right fix isn't to set chip->use_hw_setting
> > to 1?
> >
> > regards,
> > dan carpenter
> >
> Yes, setting chip->use_hw_setting is not a wise choice.
> Normally, if chip->use_hw_setting is set to 1, more configurations will
> be turned on, such as auto_delink_en.
> auto_delink_en can only work well when pcie hotplug is configured and
> pciehp.pciehp_force is set to 1. This condition can't be met in default
> kernel config by now.
> So, I have to choose to set lun_mode detection code in a different place.
>

Ok. Cool. But you're going to fix the places that use ->use_hw_setting
later on yes? For example, the rts5288 chip has the same problem earlier
in the file where the lun_mode doesn't get set correctly.

regards,
dan carpenter