[PATCH v4 0/2] Fix LPSS clock divider for XPS 9530

Aleksandrs Vinarskis posted 2 patches 1 year, 12 months ago
drivers/mfd/intel-lpss-pci.c | 28 ++++++++++++++++++++--------
drivers/mfd/intel-lpss.c     |  9 ++++++++-
drivers/mfd/intel-lpss.h     | 14 +++++++++++++-
3 files changed, 41 insertions(+), 10 deletions(-)
[PATCH v4 0/2] Fix LPSS clock divider for XPS 9530
Posted by Aleksandrs Vinarskis 1 year, 12 months ago
Dell XPS 9530 (2023) uses spi-pxa2xx with clock-divider enabled from
intel-lpss with the ratio of 1:32767 (Dell's firmware bug). This caps SPI
controller's speed at very low value of 3051Hz, which makes the interface
practically unusable. Since either spi-pxa2xx or intel-lpss should have
clock divider enabled, not both, and SPI controller can have higher speed
than requested by the device, it is preffered to disable intel-lpss
clock-divider, and let SPI controller handle it.

Fixing this issue directly in Dell firmware by setting lpss divider to 1:1
would've been the ideal solution, but is unlikely to ever happen.

Particular driver already implements customized solution for handling buggy
ACPI tables for select Microsoft devices. This patch series converts it to
a more generic quirk table, and adds a new quirk QUIRK_CLOCK_DIVIDER_UNITY
which forces clock divider to be set to 1:1. In the future, devices with
similar bug (if any) can be easily added to the same pci id lookup table.

Changes since v3:
- Altered "{ PCI.." style of quirk table
- Added CC to  Hans de Goede

Changes since v2:
- Added missing periods, moved variable declaration
- Altered "}, {" style of quirk table
- Confirmed to compile for 32-bit without warnings

Changes since v1:
- Applied suggestions by Andy Shevchenko

Aleksandrs Vinarskis (2):
  mfd: intel-lpss: Switch to generalized quirk table
  mfd: intel-lpss: Introduce QUIRK_CLOCK_DIVIDER_UNITY for XPS 9530

 drivers/mfd/intel-lpss-pci.c | 28 ++++++++++++++++++++--------
 drivers/mfd/intel-lpss.c     |  9 ++++++++-
 drivers/mfd/intel-lpss.h     | 14 +++++++++++++-
 3 files changed, 41 insertions(+), 10 deletions(-)

-- 
2.40.1
Re: [PATCH v4 0/2] Fix LPSS clock divider for XPS 9530
Posted by Lee Jones 1 year, 11 months ago
On Thu, 21 Dec 2023 19:51:40 +0100, Aleksandrs Vinarskis wrote:
> Dell XPS 9530 (2023) uses spi-pxa2xx with clock-divider enabled from
> intel-lpss with the ratio of 1:32767 (Dell's firmware bug). This caps SPI
> controller's speed at very low value of 3051Hz, which makes the interface
> practically unusable. Since either spi-pxa2xx or intel-lpss should have
> clock divider enabled, not both, and SPI controller can have higher speed
> than requested by the device, it is preffered to disable intel-lpss
> clock-divider, and let SPI controller handle it.
> 
> [...]

Applied, thanks!

[1/2] mfd: intel-lpss: Switch to generalized quirk table
      commit: d43b5230c38ed6001f996eb9262b457713b31ef8
[2/2] mfd: intel-lpss: Introduce QUIRK_CLOCK_DIVIDER_UNITY for XPS 9530
      commit: 106362167f49a0e83f4e6c26f9653f3061575229

--
Lee Jones [李琼斯]

Re: [PATCH v4 0/2] Fix LPSS clock divider for XPS 9530
Posted by Andy Shevchenko 1 year, 12 months ago
On Thu, Dec 21, 2023 at 07:51:40PM +0100, Aleksandrs Vinarskis wrote:
> Dell XPS 9530 (2023) uses spi-pxa2xx with clock-divider enabled from
> intel-lpss with the ratio of 1:32767 (Dell's firmware bug). This caps SPI
> controller's speed at very low value of 3051Hz, which makes the interface
> practically unusable. Since either spi-pxa2xx or intel-lpss should have
> clock divider enabled, not both, and SPI controller can have higher speed
> than requested by the device, it is preffered to disable intel-lpss
> clock-divider, and let SPI controller handle it.
> 
> Fixing this issue directly in Dell firmware by setting lpss divider to 1:1
> would've been the ideal solution, but is unlikely to ever happen.
> 
> Particular driver already implements customized solution for handling buggy
> ACPI tables for select Microsoft devices. This patch series converts it to
> a more generic quirk table, and adds a new quirk QUIRK_CLOCK_DIVIDER_UNITY
> which forces clock divider to be set to 1:1. In the future, devices with
> similar bug (if any) can be easily added to the same pci id lookup table.

LGTM now,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko