diff options
author | Joshua Stein <jcs@cvs.openbsd.org> | 2019-07-16 19:12:33 +0000 |
---|---|---|
committer | Joshua Stein <jcs@cvs.openbsd.org> | 2019-07-16 19:12:33 +0000 |
commit | d2026e1834bf12902d9c0a87da24c33571f2d9a9 (patch) | |
tree | cabd4985674983869ed83ecc31041add1cce37e8 /sys/dev | |
parent | d1f9da99abf646810d0fb5ab5150eeb312567192 (diff) |
don't bother reading default timing parameters if they're just going
to be overridden from ACPI
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/acpi/dwiic_acpi.c | 7 | ||||
-rw-r--r-- | sys/dev/ic/dwiic.c | 14 | ||||
-rw-r--r-- | sys/dev/pci/dwiic_pci.c | 11 |
3 files changed, 16 insertions, 16 deletions
diff --git a/sys/dev/acpi/dwiic_acpi.c b/sys/dev/acpi/dwiic_acpi.c index 890418923df..b03642402cc 100644 --- a/sys/dev/acpi/dwiic_acpi.c +++ b/sys/dev/acpi/dwiic_acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwiic_acpi.c,v 1.8 2018/07/01 11:37:11 kettenis Exp $ */ +/* $OpenBSD: dwiic_acpi.c,v 1.9 2019/07/16 19:12:32 jcs Exp $ */ /* * Synopsys DesignWare I2C controller * @@ -143,11 +143,6 @@ dwiic_acpi_attach(struct device *parent, struct device *self, void *aux) dwiic_acpi_power(sc, 1); /* fetch timing parameters */ - sc->ss_hcnt = dwiic_read(sc, DW_IC_SS_SCL_HCNT); - sc->ss_lcnt = dwiic_read(sc, DW_IC_SS_SCL_LCNT); - sc->fs_hcnt = dwiic_read(sc, DW_IC_FS_SCL_HCNT); - sc->fs_lcnt = dwiic_read(sc, DW_IC_FS_SCL_LCNT); - sc->sda_hold_time = dwiic_read(sc, DW_IC_SDA_HOLD); dwiic_acpi_get_params(sc, "SSCN", &sc->ss_hcnt, &sc->ss_lcnt, NULL); dwiic_acpi_get_params(sc, "FMCN", &sc->fs_hcnt, &sc->fs_lcnt, &sc->sda_hold_time); diff --git a/sys/dev/ic/dwiic.c b/sys/dev/ic/dwiic.c index 01d4549f55b..89489a909eb 100644 --- a/sys/dev/ic/dwiic.c +++ b/sys/dev/ic/dwiic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwiic.c,v 1.4 2018/05/23 22:08:00 kettenis Exp $ */ +/* $OpenBSD: dwiic.c,v 1.5 2019/07/16 19:12:32 jcs Exp $ */ /* * Synopsys DesignWare I2C controller * @@ -137,6 +137,18 @@ dwiic_init(struct dwiic_softc *sc) return 1; } + /* fetch default timing parameters if not already specified */ + if (!sc->ss_hcnt) + sc->ss_hcnt = dwiic_read(sc, DW_IC_SS_SCL_HCNT); + if (!sc->ss_lcnt) + sc->ss_lcnt = dwiic_read(sc, DW_IC_SS_SCL_LCNT); + if (!sc->fs_hcnt) + sc->fs_hcnt = dwiic_read(sc, DW_IC_FS_SCL_HCNT); + if (!sc->fs_lcnt) + sc->fs_lcnt = dwiic_read(sc, DW_IC_FS_SCL_LCNT); + if (!sc->sda_hold_time) + sc->sda_hold_time = dwiic_read(sc, DW_IC_SDA_HOLD); + /* disable the adapter */ dwiic_enable(sc, 0); diff --git a/sys/dev/pci/dwiic_pci.c b/sys/dev/pci/dwiic_pci.c index f87aaa0c43a..520c1aaea81 100644 --- a/sys/dev/pci/dwiic_pci.c +++ b/sys/dev/pci/dwiic_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwiic_pci.c,v 1.7 2019/07/16 19:00:25 jcs Exp $ */ +/* $OpenBSD: dwiic_pci.c,v 1.8 2019/07/16 19:12:32 jcs Exp $ */ /* * Synopsys DesignWare I2C controller * PCI attachment @@ -121,15 +121,8 @@ dwiic_pci_attach(struct device *parent, struct device *self, void *aux) bus_space_write_4(sc->sc_iot, sc->sc_ioh, LPSS_RESETS, (LPSS_RESETS_I2C | LPSS_RESETS_IDMA)); - /* fetch timing parameters */ - sc->ss_hcnt = dwiic_read(sc, DW_IC_SS_SCL_HCNT); - sc->ss_lcnt = dwiic_read(sc, DW_IC_SS_SCL_LCNT); - sc->fs_hcnt = dwiic_read(sc, DW_IC_FS_SCL_HCNT); - sc->fs_lcnt = dwiic_read(sc, DW_IC_FS_SCL_LCNT); - sc->sda_hold_time = dwiic_read(sc, DW_IC_SDA_HOLD); - #if NACPI > 0 - /* fetch more accurate timing parameters from ACPI, if possible */ + /* fetch timing parameters from ACPI, if possible */ node = acpi_pci_match(self, &sc->sc_paa); if (node != NULL) { sc->sc_devnode = node; |