回复: Bug: After a 'warm' reboot the disk is missing (not detected by the bios) on a HP t640

From: Fred Ai(WH)
Date: Sun Jan 07 2024 - 21:02:28 EST


Hi Ben Mesman,

> I tried the patch, but it didn't solve the issue, sorry.

> Do you need any extra info? Any other help I can give to solve this problem?

Please make sure you compile in a way that allows our patch to take effect, or you can add debugging information to ensure that our patch works.

Thanks
Fred

-----邮件原件-----
发件人: Ben Mesman | Spark Narrowcasting <ben@xxxxxxxxxxxxxxxxxxxxx>
发送时间: 2024年1月4日 18:31
收件人: Fred Ai(WH) <fred.ai@xxxxxxxxxxxxxx>; Sean Christopherson <seanjc@xxxxxxxxxx>
抄送: Thomas Gleixner <tglx@xxxxxxxxxxxxx>; Ingo Molnar <mingo@xxxxxxxxxx>; Borislav Petkov <bp@xxxxxxxxx>; Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>; x86@xxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Ulf Hansson <ulf.hansson@xxxxxxxxxx>; Adrian Hunter <adrian.hunter@xxxxxxxxx>; Chevron Li (WH) <chevron.li@xxxxxxxxxxxxxx>; Shaper Liu (WH) <shaper.liu@xxxxxxxxxxxxxx>
主题: Re: Bug: After a 'warm' reboot the disk is missing (not detected by the bios) on a HP t640

Hi Fred Ai,

> Hi Sean Christopherson
> I am maintainer of module “sdhci-pci-o2micro”. I provide the attachment code to fix this issue, but I didn't test this path code. You can test attachment patch code and give the feedback to me.
> If this issue can be fixed by this patch, I will consider committing the new patch to fix this issue at linux master branch.

I tried the patch, but it didn't solve the issue, sorry.

Do you need any extra info? Any other help I can give to solve this problem?

Thanks,
Ben Mesman.

--
> Diff patch in "linux/drivers/mmc/host/sdhci-pci-o2micro.c" as below:
>
> diff --git a/sdhci-pci-o2micro.c b/sdhci-pci-o2micro.c index
> 620f52a..d520369 100644
> --- a/sdhci-pci-o2micro.c
> +++ b/sdhci-pci-o2micro.c
> @@ -603,6 +603,31 @@ static void sdhci_pci_o2_set_clock(struct
> sdhci_host *host, unsigned int clock)
>        sdhci_o2_enable_clk(host, clk);
>  }
>
> +static void sdhci_pci_o2_remove_slot(struct sdhci_pci_slot *slot, int
> +dead) {
> +       u8 scratch_8 = 0;
> +       u32 reg_val = 0;
> +       struct sdhci_pci_chip *chip;
> +
> +       chip = slot->chip;
> +
> +       /* UnLock WP */
> +       pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch_8);
> +       scratch_8 &= 0x7f;
> +       pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch_8);
> +
> +       /* Set pcr 0x354[16] to switch Clock Source back to OPE Clock
> +*/
> +       pci_read_config_dword(chip->pdev,
> +O2_SD_OUTPUT_CLK_SOURCE_SWITCH, &reg_val);
> +       reg_val &= ~(O2_SD_SEL_DLL);
> +       pci_write_config_dword(chip->pdev,
> +O2_SD_OUTPUT_CLK_SOURCE_SWITCH, reg_val);
> +
> +       /* Lock WP */
> +       pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch_8);
> +       scratch_8 |= 0x80;
> +       pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch_8);
> +
> +}
> +
>  static int sdhci_pci_o2_probe_slot(struct sdhci_pci_slot *slot)
>  {
>         struct sdhci_pci_chip *chip;
> @@ -924,4 +949,5 @@ const struct sdhci_pci_fixes sdhci_o2 = {
>  #endif
>         .ops = &sdhci_pci_o2_ops,
>         .priv_size = sizeof(struct o2_host),
> +       .remove_slot= sdhci_pci_o2_remove_slot,
>  };
>
>
> Thanks
> Fred