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

From: Ben Mesman | Spark Narrowcasting
Date: Thu Jan 04 2024 - 05:31:38 EST


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