public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Martin Volf <martin.volf.42@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Jean Delvare <jdelvare@suse.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	linux-i2c@vger.kernel.org, linux-hwmon@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>
Subject: Re: [regression] nct6775 does not load in 5.4 and 5.5, bisected to b84398d6d7f90080
Date: Tue, 25 Feb 2020 14:13:25 +0200	[thread overview]
Message-ID: <20200225121325.GX2667@lahna.fi.intel.com> (raw)
In-Reply-To: <CAM1AHpQW_=vvcjXHa8UOrdOohABm0sE2UPr4sfK2AtfWHsm4Ag@mail.gmail.com>

On Mon, Feb 24, 2020 at 06:30:21PM +0100, Martin Volf wrote:
> On Mon, Feb 24, 2020 at 12:27 PM Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
> >
> > On Mon, Feb 24, 2020 at 12:51:25PM +0200, Mika Westerberg wrote:
> > > > I'm wondering if
> > > >
> > > >             pci_dev_is_present(...);
> > > >
> > > > returns false here.
> > >
> > > Well that might also be the case since lspci shows this:
> > >
> > > 00:1f.0 ISA bridge: Intel Corporation Z390 Chipset LPC/eSPI Controller (rev 10)
> > > 00:1f.3 Audio device: Intel Corporation Cannon Lake PCH cAVS (rev 10)
> > > 00:1f.4 SMBus: Intel Corporation Cannon Lake PCH SMBus Controller (rev 10)
> > >
> > > PMC is 1f.2 and not present here. However, it may be that the PMC is
> > > still there it just does not "enumerate" because its devid/vendorid are
> > > set to 0xffff. Similar hiding was done for the P2SB bridge.
> >
> > Actually I think this is the case here.
> >
> > I don't know the iTCO_wdt well enough to say if it could live without
> > the ICH_RES_IO_SMI. It looks like this register is used to disable SMI
> > generation but not sure how well it works if it is left to BIOS to
> > configure. I suppose these systems should use WDAT instead.
> >
> > Martin, can you try the below patch?
> >
> > diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> > index ba87305f4332..c16e5ad08641 100644
> > --- a/drivers/i2c/busses/i2c-i801.c
> > +++ b/drivers/i2c/busses/i2c-i801.c
> > @@ -1593,7 +1593,7 @@ i801_add_tco_cnl(struct i801_priv *priv, struct pci_dev *pci_dev,
> >  static void i801_add_tco(struct i801_priv *priv)
> >  {
> >         u32 base_addr, tco_base, tco_ctl, ctrl_val;
> > -       struct pci_dev *pci_dev = priv->pci_dev;
> > +       struct pci_dev *pmc_dev, *pci_dev = priv->pci_dev;
> >         struct resource tco_res[3], *res;
> >         unsigned int devfn;
> >
> > @@ -1620,7 +1620,12 @@ static void i801_add_tco(struct i801_priv *priv)
> >          * Power Management registers.
> >          */
> >         devfn = PCI_DEVFN(PCI_SLOT(pci_dev->devfn), 2);
> > -       pci_bus_read_config_dword(pci_dev->bus, devfn, ACPIBASE, &base_addr);
> > +       pmc_dev = pci_get_slot(pci_dev->bus, devfn);
> > +       if (!pmc_dev) {
> > +               dev_info(&pci_dev->dev, "PMC device disabled, not enabling iTCO\n");
> > +               return;
> > +       }
> > +       pci_read_config_dword(pmc_dev, ACPIBASE, &base_addr);
> >
> >         res = &tco_res[ICH_RES_IO_SMI];
> >         res->start = (base_addr & ~1) + ACPIBASE_SMI_OFF;
> > @@ -1630,15 +1635,17 @@ static void i801_add_tco(struct i801_priv *priv)
> >         /*
> >          * Enable the ACPI I/O space.
> >          */
> > -       pci_bus_read_config_dword(pci_dev->bus, devfn, ACPICTRL, &ctrl_val);
> > +       pci_read_config_dword(pmc_dev, ACPICTRL, &ctrl_val);
> >         ctrl_val |= ACPICTRL_EN;
> > -       pci_bus_write_config_dword(pci_dev->bus, devfn, ACPICTRL, ctrl_val);
> > +       pci_write_config_dword(pmc_dev, ACPICTRL, ctrl_val);
> >
> >         if (priv->features & FEATURE_TCO_CNL)
> >                 priv->tco_pdev = i801_add_tco_cnl(priv, pci_dev, tco_res);
> >         else
> >                 priv->tco_pdev = i801_add_tco_spt(priv, pci_dev, tco_res);
> >
> > +       pci_dev_put(pmc_dev);
> > +
> >         if (IS_ERR(priv->tco_pdev))
> >                 dev_warn(&pci_dev->dev, "failed to create iTCO device\n");
> >  }
> 
> Hello,
> 
> with the patch applied, the sensors are working, dmesg says:
> ...
> [    2.804423] i801_smbus 0000:00:1f.4: SPD Write Disable is set
> [    2.804478] i801_smbus 0000:00:1f.4: SMBus using PCI interrupt
> [    2.804491] i801_smbus 0000:00:1f.4: PMC device disabled, not enabling iTCO
> ...
> [    2.826373] nct6775: Enabling hardware monitor logical device mappings.
> [    2.826447] nct6775: Found NCT6798D or compatible chip at 0x2e:0x290
> ...
> 
> and there is no "002e-0031" line in /proc/ioports.

Great, thanks for testing. I'll make an updated patch as suggested by
Guenter that makes the SMI resource optional and send it to you guys.

  reply	other threads:[~2020-02-25 12:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-22 11:13 [regression] nct6775 does not load in 5.4 and 5.5, bisected to b84398d6d7f90080 Martin Volf
2020-02-22 11:51 ` Wolfram Sang
2020-02-22 15:41 ` Guenter Roeck
2020-02-22 17:55   ` Martin Volf
2020-02-22 19:05     ` Guenter Roeck
2020-02-22 20:49       ` Martin Volf
2020-02-22 21:26         ` Guenter Roeck
2020-02-23  7:06           ` Martin Volf
2020-02-23 16:39           ` Wolfram Sang
2020-02-24 10:18           ` Mika Westerberg
2020-02-24 10:37             ` Andy Shevchenko
2020-02-24 10:51               ` Mika Westerberg
2020-02-24 11:27                 ` Mika Westerberg
2020-02-24 17:30                   ` Martin Volf
2020-02-25 12:13                     ` Mika Westerberg [this message]
2020-02-24 18:27                   ` Guenter Roeck
2020-02-25 12:14                     ` Mika Westerberg
2020-02-23 17:56 ` Gabriel C

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200225121325.GX2667@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=martin.volf.42@gmail.com \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox