All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 02/17] i2c: designware: Add Apollo Lake support
@ 2019-12-11  4:28 Simon Glass
  2019-12-13  2:48 ` Simon Glass
  2019-12-15  0:31 ` Bin Meng
  0 siblings, 2 replies; 4+ messages in thread
From: Simon Glass @ 2019-12-11  4:28 UTC (permalink / raw)
  To: u-boot

For Apollo Lake we need to take the I2C bus controller out of reset before
using this. Add this functionality to the driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---

Changes in v8:
- Add .data in compatible array

Changes in v7: None
Changes in v6:
- Add .driver_data in the designware_pci_supported array
- Add a comment about VANILLA
- Move lpss_reset_release() to this commit

Changes in v5:
- Drop unrelated change metioned by Heiko

Changes in v4:
- apollolake -> Apollo Lake

Changes in v3:
- Add a weak function to avoid errors on other platforms

Changes in v2: None

 drivers/i2c/designware_i2c_pci.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/i2c/designware_i2c_pci.c b/drivers/i2c/designware_i2c_pci.c
index bb1f809af3..7f0625df66 100644
--- a/drivers/i2c/designware_i2c_pci.c
+++ b/drivers/i2c/designware_i2c_pci.c
@@ -8,8 +8,14 @@
 #include <common.h>
 #include <dm.h>
 #include <spl.h>
+#include <asm/lpss.h>
 #include "designware_i2c.h"
 
+enum {
+	VANILLA		= 0,	/* standard I2C with no tweaks */
+	INTEL_APL,		/* Apollo Lake I2C */
+};
+
 /* BayTrail HCNT/LCNT/SDA hold time */
 static struct dw_scl_sda_cfg byt_config = {
 	.ss_hcnt = 0x200,
@@ -19,6 +25,9 @@ static struct dw_scl_sda_cfg byt_config = {
 	.sda_hold = 0x6,
 };
 
+/* Have a weak function for now - possibly should be a new uclass */
+__weak void lpss_reset_release(void *regs);
+
 static int designware_i2c_pci_ofdata_to_platdata(struct udevice *dev)
 {
 	struct dw_i2c *priv = dev_get_priv(dev);
@@ -59,6 +68,15 @@ static int designware_i2c_pci_ofdata_to_platdata(struct udevice *dev)
 
 static int designware_i2c_pci_probe(struct udevice *dev)
 {
+	struct dw_i2c *priv = dev_get_priv(dev);
+
+	if (dev_get_driver_data(dev) == INTEL_APL) {
+		/* Ensure controller is in D0 state */
+		lpss_set_power_state(dev, STATE_D0);
+
+		lpss_reset_release(priv->regs);
+	}
+
 	return designware_i2c_probe(dev);
 }
 
@@ -88,6 +106,7 @@ static int designware_i2c_pci_bind(struct udevice *dev)
 
 static const struct udevice_id designware_i2c_pci_ids[] = {
 	{ .compatible = "snps,designware-i2c-pci" },
+	{ .compatible = "intel,apl-i2c", .data = INTEL_APL },
 	{ }
 };
 
@@ -113,6 +132,12 @@ static struct pci_device_id designware_pci_supported[] = {
 	{ PCI_VDEVICE(INTEL, 0x0f45) },
 	{ PCI_VDEVICE(INTEL, 0x0f46) },
 	{ PCI_VDEVICE(INTEL, 0x0f47) },
+	{ PCI_VDEVICE(INTEL, 0x5aac), .driver_data = INTEL_APL },
+	{ PCI_VDEVICE(INTEL, 0x5aae), .driver_data = INTEL_APL },
+	{ PCI_VDEVICE(INTEL, 0x5ab0), .driver_data = INTEL_APL },
+	{ PCI_VDEVICE(INTEL, 0x5ab2), .driver_data = INTEL_APL },
+	{ PCI_VDEVICE(INTEL, 0x5ab4), .driver_data = INTEL_APL },
+	{ PCI_VDEVICE(INTEL, 0x5ab6), .driver_data = INTEL_APL },
 	{},
 };
 
-- 
2.24.0.525.g8f36a354ae-goog

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

* [PATCH v8 02/17] i2c: designware: Add Apollo Lake support
  2019-12-11  4:28 [PATCH v8 02/17] i2c: designware: Add Apollo Lake support Simon Glass
@ 2019-12-13  2:48 ` Simon Glass
  2019-12-13  9:21   ` Bin Meng
  2019-12-15  0:31 ` Bin Meng
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Glass @ 2019-12-13  2:48 UTC (permalink / raw)
  To: u-boot

Hi Bin,

On Tue, 10 Dec 2019 at 21:28, Simon Glass <sjg@chromium.org> wrote:
>
> For Apollo Lake we need to take the I2C bus controller out of reset before
> using this. Add this functionality to the driver.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Heiko Schocher <hs@denx.de>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Changes in v8:
> - Add .data in compatible array
>
> Changes in v7: None
> Changes in v6:
> - Add .driver_data in the designware_pci_supported array
> - Add a comment about VANILLA
> - Move lpss_reset_release() to this commit
>
> Changes in v5:
> - Drop unrelated change metioned by Heiko
>
> Changes in v4:
> - apollolake -> Apollo Lake
>
> Changes in v3:
> - Add a weak function to avoid errors on other platforms
>
> Changes in v2: None
>
>  drivers/i2c/designware_i2c_pci.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)

I think that is the last of the changes for this serial, but please
let me know if anything needs adjusting.

Also Tom has set up a -next tree now!

Regards,
SImon

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

* [PATCH v8 02/17] i2c: designware: Add Apollo Lake support
  2019-12-13  2:48 ` Simon Glass
@ 2019-12-13  9:21   ` Bin Meng
  0 siblings, 0 replies; 4+ messages in thread
From: Bin Meng @ 2019-12-13  9:21 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Fri, Dec 13, 2019 at 10:48 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Bin,
>
> On Tue, 10 Dec 2019 at 21:28, Simon Glass <sjg@chromium.org> wrote:
> >
> > For Apollo Lake we need to take the I2C bus controller out of reset before
> > using this. Add this functionality to the driver.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > Reviewed-by: Heiko Schocher <hs@denx.de>
> > Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> > ---
> >
> > Changes in v8:
> > - Add .data in compatible array
> >
> > Changes in v7: None
> > Changes in v6:
> > - Add .driver_data in the designware_pci_supported array
> > - Add a comment about VANILLA
> > - Move lpss_reset_release() to this commit
> >
> > Changes in v5:
> > - Drop unrelated change metioned by Heiko
> >
> > Changes in v4:
> > - apollolake -> Apollo Lake
> >
> > Changes in v3:
> > - Add a weak function to avoid errors on other platforms
> >
> > Changes in v2: None
> >
> >  drivers/i2c/designware_i2c_pci.c | 25 +++++++++++++++++++++++++
> >  1 file changed, 25 insertions(+)
>
> I think that is the last of the changes for this serial, but please
> let me know if anything needs adjusting.
>
> Also Tom has set up a -next tree now!
>

Yes, I noticed this -next tree. I will apply the series and send PR to
u-boot/next.

Regards,
Bin

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

* [PATCH v8 02/17] i2c: designware: Add Apollo Lake support
  2019-12-11  4:28 [PATCH v8 02/17] i2c: designware: Add Apollo Lake support Simon Glass
  2019-12-13  2:48 ` Simon Glass
@ 2019-12-15  0:31 ` Bin Meng
  1 sibling, 0 replies; 4+ messages in thread
From: Bin Meng @ 2019-12-15  0:31 UTC (permalink / raw)
  To: u-boot

On Wed, Dec 11, 2019 at 12:28 PM Simon Glass <sjg@chromium.org> wrote:
>
> For Apollo Lake we need to take the I2C bus controller out of reset before
> using this. Add this functionality to the driver.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Heiko Schocher <hs@denx.de>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Changes in v8:
> - Add .data in compatible array
>
> Changes in v7: None
> Changes in v6:
> - Add .driver_data in the designware_pci_supported array
> - Add a comment about VANILLA
> - Move lpss_reset_release() to this commit
>
> Changes in v5:
> - Drop unrelated change metioned by Heiko
>
> Changes in v4:
> - apollolake -> Apollo Lake
>
> Changes in v3:
> - Add a weak function to avoid errors on other platforms
>
> Changes in v2: None
>
>  drivers/i2c/designware_i2c_pci.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>

applied to u-boot-x86/next, thanks!

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

end of thread, other threads:[~2019-12-15  0:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11  4:28 [PATCH v8 02/17] i2c: designware: Add Apollo Lake support Simon Glass
2019-12-13  2:48 ` Simon Glass
2019-12-13  9:21   ` Bin Meng
2019-12-15  0:31 ` Bin Meng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.