linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: designware-pci: Add Baytrail PCI IDs
@ 2014-02-04 14:31 Mika Westerberg
       [not found] ` <1391524279-23409-1-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Mika Westerberg @ 2014-02-04 14:31 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: Wolfram Sang, Andy Shevchenko,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mika Westerberg

Intel Baytrail I2C controllers can be enumerated from PCI as well as from
ACPI. In order to support this add the Baytrail PCI IDs to the driver.

Signed-off-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/i2c/busses/i2c-designware-pcidrv.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index c0a87a5eb63e..0c13dc1b28ef 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -54,6 +54,8 @@ enum dw_pci_ctl_id_t {
 	medfield_3,
 	medfield_4,
 	medfield_5,
+
+	baytrail,
 };
 
 struct dw_pci_controller {
@@ -132,6 +134,13 @@ static struct  dw_pci_controller  dw_pci_controllers[] = {
 		.rx_fifo_depth = 32,
 		.clk_khz      = 25000,
 	},
+	[baytrail] = {
+		.bus_num = -1,
+		.bus_cfg = INTEL_MID_STD_CFG | DW_IC_CON_SPEED_FAST,
+		.tx_fifo_depth = 32,
+		.rx_fifo_depth = 32,
+		.clk_khz = 100000,
+	},
 };
 static struct i2c_algorithm i2c_dw_algo = {
 	.master_xfer	= i2c_dw_xfer,
@@ -226,8 +235,12 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
 	adap->algo = &i2c_dw_algo;
 	adap->dev.parent = &pdev->dev;
 	adap->nr = controller->bus_num;
-	snprintf(adap->name, sizeof(adap->name), "i2c-designware-pci-%d",
-		adap->nr);
+
+	if (adap->nr < 0)
+		snprintf(adap->name, sizeof(adap->name), "i2c-designware-pci");
+	else
+		snprintf(adap->name, sizeof(adap->name),
+			 "i2c-designware-pci-%d", adap->nr);
 
 	r = devm_request_irq(&pdev->dev, pdev->irq, i2c_dw_isr, IRQF_SHARED,
 			adap->name, dev);
@@ -278,6 +291,14 @@ static DEFINE_PCI_DEVICE_TABLE(i2_designware_pci_ids) = {
 	{ PCI_VDEVICE(INTEL, 0x082C), medfield_0 },
 	{ PCI_VDEVICE(INTEL, 0x082D), medfield_1 },
 	{ PCI_VDEVICE(INTEL, 0x082E), medfield_2 },
+	/* Baytrail */
+	{ PCI_VDEVICE(INTEL, 0x0F41), baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F42), baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F43), baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F44), baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F45), baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F46), baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F47), baytrail },
 	{ 0,}
 };
 MODULE_DEVICE_TABLE(pci, i2_designware_pci_ids);
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2c: designware-pci: Add Baytrail PCI IDs
       [not found] ` <1391524279-23409-1-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2014-02-15 15:27   ` Wolfram Sang
  2014-02-17  8:11     ` Mika Westerberg
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2014-02-15 15:27 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Andy Shevchenko,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 686 bytes --]

On Tue, Feb 04, 2014 at 04:31:19PM +0200, Mika Westerberg wrote:
> Intel Baytrail I2C controllers can be enumerated from PCI as well as from
> ACPI. In order to support this add the Baytrail PCI IDs to the driver.
> 
> Signed-off-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Basically fine, one question:

> -	snprintf(adap->name, sizeof(adap->name), "i2c-designware-pci-%d",
> -		adap->nr);
> +
> +	if (adap->nr < 0)
> +		snprintf(adap->name, sizeof(adap->name), "i2c-designware-pci");
> +	else
> +		snprintf(adap->name, sizeof(adap->name),
> +			 "i2c-designware-pci-%d", adap->nr);

Maybe we just drop the "-%d" suffix entirely?


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2c: designware-pci: Add Baytrail PCI IDs
  2014-02-15 15:27   ` Wolfram Sang
@ 2014-02-17  8:11     ` Mika Westerberg
  0 siblings, 0 replies; 3+ messages in thread
From: Mika Westerberg @ 2014-02-17  8:11 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Andy Shevchenko,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Benson Leung

On Sat, Feb 15, 2014 at 04:27:37PM +0100, Wolfram Sang wrote:
> On Tue, Feb 04, 2014 at 04:31:19PM +0200, Mika Westerberg wrote:
> > Intel Baytrail I2C controllers can be enumerated from PCI as well as from
> > ACPI. In order to support this add the Baytrail PCI IDs to the driver.
> > 
> > Signed-off-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> 
> Basically fine, one question:
> 
> > -	snprintf(adap->name, sizeof(adap->name), "i2c-designware-pci-%d",
> > -		adap->nr);
> > +
> > +	if (adap->nr < 0)
> > +		snprintf(adap->name, sizeof(adap->name), "i2c-designware-pci");
> > +	else
> > +		snprintf(adap->name, sizeof(adap->name),
> > +			 "i2c-designware-pci-%d", adap->nr);
> 
> Maybe we just drop the "-%d" suffix entirely?

I suggested that already when Benson (CC'd) sent his Haswell patch series.
His opinion was that it is useful in certain cases to know the bus number
(like grepping /proc/interrupts, IIRC).

For Baytrail we don't need it so if nobody objects, I'll just go ahead and
drop it.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-17  8:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-04 14:31 [PATCH] i2c: designware-pci: Add Baytrail PCI IDs Mika Westerberg
     [not found] ` <1391524279-23409-1-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-02-15 15:27   ` Wolfram Sang
2014-02-17  8:11     ` Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).