Nathaniel Roach has uploaded a new patch set (#2). ( https://review.coreboot.org/29565 )
Change subject: lenovo/h8,thinkpads: Re-do USB Always On
......................................................................
lenovo/h8,thinkpads: Re-do USB Always On
Re-write the UAO handling code as it had stopped working (#171)
(the flag was not getting read from the RTC properly in SMM)
Remove the SMM code as it's not needed (but EC flag won't be set
upon entering S3 now)
Set the EC flags on boot the same way other flags are set
Document bitwise operators for clarity
Propagate changes to other Thinkpads
(updated X201 to have 2 bits for the flag as it only had 1)
Per Nicola Corna's previous commits, 0x0d is set for "AC only"
"AC only" does exhibit different behaviour - the USB port is
turned on a few seconds after entering S3, rather than < 1 sec,
regardless of AC status
Tested on X220
Change-Id: If812cd1ef8fb1a24d7fadbe834f574b40cbcd56a
Signed-off-by: Nathaniel Roach <nroach44(a)gmail.com>
---
M src/ec/lenovo/h8/Makefile.inc
M src/ec/lenovo/h8/h8.c
M src/ec/lenovo/h8/h8.h
D src/ec/lenovo/h8/smm.c
M src/mainboard/lenovo/l520/smihandler.c
M src/mainboard/lenovo/t420/smihandler.c
M src/mainboard/lenovo/t420s/smihandler.c
M src/mainboard/lenovo/t430/smihandler.c
M src/mainboard/lenovo/t430s/smihandler.c
M src/mainboard/lenovo/t520/smihandler.c
M src/mainboard/lenovo/t530/smihandler.c
M src/mainboard/lenovo/x201/cmos.layout
M src/mainboard/lenovo/x201/smihandler.c
M src/mainboard/lenovo/x220/cmos.layout
M src/mainboard/lenovo/x220/smihandler.c
M src/mainboard/lenovo/x230/smihandler.c
16 files changed, 43 insertions(+), 73 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/29565/2
--
To view, visit https://review.coreboot.org/29565
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If812cd1ef8fb1a24d7fadbe834f574b40cbcd56a
Gerrit-Change-Number: 29565
Gerrit-PatchSet: 2
Gerrit-Owner: Nathaniel Roach <nroach44(a)gmail.com>
Nathaniel Roach has uploaded this change for review. ( https://review.coreboot.org/29565
Change subject: lenovo/h8,thinkpads: Re-do USB Always On
......................................................................
lenovo/h8,thinkpads: Re-do USB Always On
Re-write the UAO handling code as it had stopped working (#171)
(the flag was not getting read from the RTC properly in SMM)
Remove the SMM code as it's not needed (but EC flag won't be set
upon entering S3 now)
Set the EC flags on boot the same way other flags are set
Document bitwise operators for clarity
Propagate changes to other Thinkpads
(updated X201 to have 2 bits for the flag as it only had 1)
Per Nicola Corna's previous commits, 0x0d is set for "AC only"
"AC only" does exhibit different behaviour - the USB port is
turned on a few seconds after entering S3, rather than < 1 sec,
regardless of AC status
Tested on X220
Change-Id: If812cd1ef8fb1a24d7fadbe834f574b40cbcd56a
Signed-off-by: Nathaniel Roach <nroach44(a)gmail.com>
---
M src/ec/lenovo/h8/Makefile.inc
M src/ec/lenovo/h8/h8.c
M src/ec/lenovo/h8/h8.h
M src/mainboard/lenovo/l520/smihandler.c
M src/mainboard/lenovo/t420/smihandler.c
M src/mainboard/lenovo/t420s/smihandler.c
M src/mainboard/lenovo/t430/smihandler.c
M src/mainboard/lenovo/t430s/smihandler.c
M src/mainboard/lenovo/t520/smihandler.c
M src/mainboard/lenovo/t530/smihandler.c
M src/mainboard/lenovo/x201/cmos.layout
M src/mainboard/lenovo/x201/smihandler.c
M src/mainboard/lenovo/x220/cmos.layout
M src/mainboard/lenovo/x220/smihandler.c
M src/mainboard/lenovo/x230/smihandler.c
15 files changed, 43 insertions(+), 26 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/29565/1
diff --git a/src/ec/lenovo/h8/Makefile.inc b/src/ec/lenovo/h8/Makefile.inc
index e4408f1..ebf6d7d 100644
--- a/src/ec/lenovo/h8/Makefile.inc
+++ b/src/ec/lenovo/h8/Makefile.inc
@@ -9,6 +9,5 @@
ramstage-y += bluetooth.c
ramstage-y += wwan.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += ssdt.c
-smm-y += smm.c
endif
diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c
index 1f1655d..d70de78 100644
--- a/src/ec/lenovo/h8/h8.c
+++ b/src/ec/lenovo/h8/h8.c
@@ -128,6 +128,35 @@
}
+void h8_usb_always_on_enable(enum usb_always_on on)
+{
+ u8 val;
+
+ // bit 0 enables USB Always On
+ // bits 2&3 equal, when they are 0 AC_AND_BATTERY, when 1 AC_ONLY
+
+ switch(on) {
+ case UAO_OFF:
+ val = ec_read(H8_USB_ALWAYS_ON);
+ val &= 0xF2; // Clear bits 0,2,3
+ ec_write(H8_USB_ALWAYS_ON, val);
+ break;
+
+ case UAO_AC_AND_BATTERY:
+ val = ec_read(H8_USB_ALWAYS_ON);
+ val |= 0x01; // Set bit 0
+ val &= 0xF3; // Clear bits 2 and 3
+ ec_write(H8_USB_ALWAYS_ON, val);
+ break;
+
+ case UAO_AC_ONLY:
+ val = ec_read(H8_USB_ALWAYS_ON);
+ val |= 0x0D; // Set bits 0,2,3
+ ec_write(H8_USB_ALWAYS_ON, val);
+ break;
+ }
+}
+
void h8_usb_power_enable(int onoff)
{
if (onoff)
@@ -270,8 +299,10 @@
ec_write(0x1f, conf->eventf_enable);
ec_write(H8_FAN_CONTROL, H8_FAN_CONTROL_AUTO);
- ec_write(H8_USB_ALWAYS_ON, ec_read(H8_USB_ALWAYS_ON) &
- ~H8_USB_ALWAYS_ON_ENABLE);
+
+ if (get_option(&val, "usb_always_on") != CB_SUCCESS)
+ val = 0;
+ h8_usb_always_on_enable(val);
if (get_option(&val, "wlan") != CB_SUCCESS)
val = 1;
diff --git a/src/ec/lenovo/h8/h8.h b/src/ec/lenovo/h8/h8.h
index 4ac395a..7deb0b8 100644
--- a/src/ec/lenovo/h8/h8.h
+++ b/src/ec/lenovo/h8/h8.h
@@ -19,9 +19,16 @@
#include <stdint.h>
#include <device/device.h>
+enum usb_always_on {
+ UAO_OFF = 0,
+ UAO_AC_AND_BATTERY = 1,
+ UAO_AC_ONLY = 2
+};
+
void h8_trackpoint_enable(int on);
void h8_wlan_enable(int on);
void h8_set_audio_mute(int on);
+void h8_usb_always_on_enable(enum usb_always_on on);
void h8_usb_power_enable(int on);
void h8_enable_event(int event);
void h8_disable_event(int event);
@@ -87,7 +94,7 @@
#define H8_USB_ALWAYS_ON 0x0d
#define H8_USB_ALWAYS_ON_ENABLE 0x01
-#define H8_USB_ALWAYS_ON_AC_ONLY 0x0c
+#define H8_USB_ALWAYS_ON_AC_ONLY 0x0d
#define H8_FAN_CONTROL 0x2f
#define H8_FAN_CONTROL_AUTO 0x80
diff --git a/src/mainboard/lenovo/l520/smihandler.c b/src/mainboard/lenovo/l520/smihandler.c
index fa038ed..982233d 100644
--- a/src/mainboard/lenovo/l520/smihandler.c
+++ b/src/mainboard/lenovo/l520/smihandler.c
@@ -73,8 +73,6 @@
void mainboard_smi_sleep(u8 slp_typ)
{
- h8_usb_always_on();
-
if (slp_typ == 3) {
u8 ec_wake = ec_read(0x32);
/* If EC wake events are enabled, enable wake on EC WAKE GPE. */
diff --git a/src/mainboard/lenovo/t420/smihandler.c b/src/mainboard/lenovo/t420/smihandler.c
index dd29232..bc92cf1 100644
--- a/src/mainboard/lenovo/t420/smihandler.c
+++ b/src/mainboard/lenovo/t420/smihandler.c
@@ -72,8 +72,6 @@
void mainboard_smi_sleep(u8 slp_typ)
{
- h8_usb_always_on();
-
if (slp_typ == 3) {
u8 ec_wake = ec_read(0x32);
/* If EC wake events are enabled, enable wake on EC WAKE GPE. */
diff --git a/src/mainboard/lenovo/t420s/smihandler.c b/src/mainboard/lenovo/t420s/smihandler.c
index c34cb5b..e361ebb 100644
--- a/src/mainboard/lenovo/t420s/smihandler.c
+++ b/src/mainboard/lenovo/t420s/smihandler.c
@@ -107,8 +107,6 @@
void mainboard_smi_sleep(u8 slp_typ)
{
- h8_usb_always_on();
-
if (slp_typ == 3) {
u8 ec_wake = ec_read(0x32);
/* If EC wake events are enabled, enable wake on EC WAKE GPE. */
diff --git a/src/mainboard/lenovo/t430/smihandler.c b/src/mainboard/lenovo/t430/smihandler.c
index 120d9a0..f9d2373 100644
--- a/src/mainboard/lenovo/t430/smihandler.c
+++ b/src/mainboard/lenovo/t430/smihandler.c
@@ -74,8 +74,6 @@
void mainboard_smi_sleep(u8 slp_typ)
{
if (slp_typ == 3) {
- h8_usb_always_on();
-
u8 ec_wake = ec_read(0x32);
/* If EC wake events are enabled, enable wake on EC WAKE GPE. */
if (ec_wake & 0x14) {
diff --git a/src/mainboard/lenovo/t430s/smihandler.c b/src/mainboard/lenovo/t430s/smihandler.c
index 1313eac..3259b9d 100644
--- a/src/mainboard/lenovo/t430s/smihandler.c
+++ b/src/mainboard/lenovo/t430s/smihandler.c
@@ -106,8 +106,6 @@
void mainboard_smi_sleep(u8 slp_typ)
{
- h8_usb_always_on();
-
if (slp_typ == 3) {
u8 ec_wake = ec_read(0x32);
/* If EC wake events are enabled, enable wake on EC WAKE GPE. */
diff --git a/src/mainboard/lenovo/t520/smihandler.c b/src/mainboard/lenovo/t520/smihandler.c
index 4e61a98..9a154a1 100644
--- a/src/mainboard/lenovo/t520/smihandler.c
+++ b/src/mainboard/lenovo/t520/smihandler.c
@@ -107,8 +107,6 @@
void mainboard_smi_sleep(u8 slp_typ)
{
- h8_usb_always_on();
-
if (slp_typ == 3) {
u8 ec_wake = ec_read(0x32);
/* If EC wake events are enabled, enable wake on EC WAKE GPE. */
diff --git a/src/mainboard/lenovo/t530/smihandler.c b/src/mainboard/lenovo/t530/smihandler.c
index 0491392..20137f8 100644
--- a/src/mainboard/lenovo/t530/smihandler.c
+++ b/src/mainboard/lenovo/t530/smihandler.c
@@ -107,8 +107,6 @@
void mainboard_smi_sleep(u8 slp_typ)
{
- h8_usb_always_on();
-
if (slp_typ == 3) {
u8 ec_wake = ec_read(0x32);
/* If EC wake events are enabled, enable wake on EC WAKE GPE. */
diff --git a/src/mainboard/lenovo/x201/cmos.layout b/src/mainboard/lenovo/x201/cmos.layout
index d8d8794..0cda679 100644
--- a/src/mainboard/lenovo/x201/cmos.layout
+++ b/src/mainboard/lenovo/x201/cmos.layout
@@ -70,7 +70,7 @@
419 1 e 1 power_management_beeps
420 1 e 1 low_battery_beep
421 1 e 9 sata_mode
-422 1 e 11 usb_always_on
+422 2 e 11 usb_always_on
#423 1 r 1 unused
# coreboot config options: northbridge
diff --git a/src/mainboard/lenovo/x201/smihandler.c b/src/mainboard/lenovo/x201/smihandler.c
index fbbec09..2106c57 100644
--- a/src/mainboard/lenovo/x201/smihandler.c
+++ b/src/mainboard/lenovo/x201/smihandler.c
@@ -177,8 +177,6 @@
void mainboard_smi_sleep(u8 slp_typ)
{
- h8_usb_always_on();
-
if (slp_typ == 3) {
u8 ec_wake = ec_read(0x32);
/* If EC wake events are enabled, enable wake on EC WAKE GPE. */
diff --git a/src/mainboard/lenovo/x220/cmos.layout b/src/mainboard/lenovo/x220/cmos.layout
index c6e270a..d4a4ed3 100644
--- a/src/mainboard/lenovo/x220/cmos.layout
+++ b/src/mainboard/lenovo/x220/cmos.layout
@@ -69,7 +69,7 @@
418 1 e 1 sticky_fn
419 1 e 1 power_management_beeps
421 1 e 9 sata_mode
-422 1 e 12 usb_always_on
+422 2 e 12 usb_always_on
#423 1 r 1 unused
# coreboot config options: cpu
diff --git a/src/mainboard/lenovo/x220/smihandler.c b/src/mainboard/lenovo/x220/smihandler.c
index 0491392..20137f8 100644
--- a/src/mainboard/lenovo/x220/smihandler.c
+++ b/src/mainboard/lenovo/x220/smihandler.c
@@ -107,8 +107,6 @@
void mainboard_smi_sleep(u8 slp_typ)
{
- h8_usb_always_on();
-
if (slp_typ == 3) {
u8 ec_wake = ec_read(0x32);
/* If EC wake events are enabled, enable wake on EC WAKE GPE. */
diff --git a/src/mainboard/lenovo/x230/smihandler.c b/src/mainboard/lenovo/x230/smihandler.c
index a69b78f..2425927 100644
--- a/src/mainboard/lenovo/x230/smihandler.c
+++ b/src/mainboard/lenovo/x230/smihandler.c
@@ -72,8 +72,6 @@
void mainboard_smi_sleep(u8 slp_typ)
{
- h8_usb_always_on();
-
if (slp_typ == 3) {
u8 ec_wake = ec_read(0x32);
/* If EC wake events are enabled, enable wake on EC WAKE GPE. */
--
To view, visit https://review.coreboot.org/29565
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If812cd1ef8fb1a24d7fadbe834f574b40cbcd56a
Gerrit-Change-Number: 29565
Gerrit-PatchSet: 1
Gerrit-Owner: Nathaniel Roach <nroach44(a)gmail.com>
Caveh Jalali has posted comments on this change. ( https://review.coreboot.org/29553 )
Change subject: mb/google/poppy/variant/atlas: I2C: run trackpad at 1MHz
......................................................................
Patch Set 3:
(2 comments)
https://review.coreboot.org/#/c/29553/1//COMMIT_MSG
Commit Message:
https://review.coreboot.org/#/c/29553/1//COMMIT_MSG@15
PS1, Line 15: Data Hold_time larger than 0ns.
> It shouldn't be 260ns. According to Grant, it should be 0ns for fast plus mode, please double check. […]
Done
https://review.coreboot.org/#/c/29553/1//COMMIT_MSG@34
PS1, Line 34: Verified by gaggery.tsai(a)intel.corp-partner.google.com.
: Scope shots posted here:
: https://b.corp.google.com/issues/78601949#comment177
:
: BUG=b:78601949
> Do we need this in comment?
Done
--
To view, visit https://review.coreboot.org/29553
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iaf42ba7b8818b7cd9c8dcc657823dac705659d38
Gerrit-Change-Number: 29553
Gerrit-PatchSet: 3
Gerrit-Owner: Caveh Jalali <caveh(a)google.com>
Gerrit-Reviewer: Caveh Jalali <caveh(a)google.com>
Gerrit-Reviewer: Duncan Laurie <dlaurie(a)chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Gaggery Tsai <gaggery.tsai(a)intel.com>
Gerrit-Reviewer: Gaggery Tsai <gaggery.tsai(a)intel.corp-partner.google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Reviewer: caveh jalali <caveh(a)chromium.org>
Gerrit-Comment-Date: Fri, 09 Nov 2018 23:22:47 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
Hello Gaggery Tsai, caveh jalali, Duncan Laurie, Gaggery Tsai, build bot (Jenkins), Furquan Shaikh,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/29553
to look at the new patch set (#3).
Change subject: mb/google/poppy/variant/atlas: I2C: run trackpad at 1MHz
......................................................................
mb/google/poppy/variant/atlas: I2C: run trackpad at 1MHz
With this change, coreboot thinks we're running at 1MHz:
DW I2C bus 2 at 0xd1133000 (1000 KHz)
Elan eKT3644 IC Specification (trackpad) requires:
Low Time larger than 500ns (61 * 8.3ns = 506ns).
High Time larger than 260ns (32 * 8.3ns = 265ns),
Data Hold_time larger than 0ns.
Start Condition Hold time larger than 250ns.
Rise/Fall time of less than 120ns.
HCNT controls both High Time and Start Condition Hold time.
LCNT controls Low Time.
SDA_HOLD controls Data Hold Time.
P2 Atlas "Rise time" is 90ns and "Fall time" is 32ns and tuned
using resistors on the board and must be considered when
adjusting any of the parameters since these times are all measured
at 30 or 70% of base and peak voltages (0v/1.8v).
The eKT3644 requirements are met with LCNT=69, HCNT=33, SDA_HOLD=20
which yields the SCL at around 950KHz - suboptimal but compliant.
Lower LCNT or HCNT results in "lost arbitration" errors or not complying
with eKT3644 requirements.
Verified by gaggery.tsai(a)intel.corp-partner.google.com.
Scope shots posted here:
https://b.corp.google.com/issues/78601949#comment177
BUG=b:78601949
BRANCH=none
TEST=Farzam provided test points on track pad for SCL/SDA/GND.
Waveforms measured with oscilloscope and screen shots attached
to bug (comment #177, #155, #100).
Operate trackpad/touchscreen
Review dmesg (kernel) output for correct speed, parameters, and
no errors (e.g. "lost arbitration" or "host controller timeout")
Change-Id: Iaf42ba7b8818b7cd9c8dcc657823dac705659d38
Signed-off-by: Caveh Jalali <caveh(a)chromium.org>
Signed-off-by: Grant Grundler <grundler(a)chromium.org>
Tested-by: gaggery.tsai(a)intel.corp-partner.google.com
Tested-by: grundler(a)chromium.org
---
M src/mainboard/google/poppy/variants/atlas/devicetree.cb
1 file changed, 8 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/53/29553/3
--
To view, visit https://review.coreboot.org/29553
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iaf42ba7b8818b7cd9c8dcc657823dac705659d38
Gerrit-Change-Number: 29553
Gerrit-PatchSet: 3
Gerrit-Owner: Caveh Jalali <caveh(a)google.com>
Gerrit-Reviewer: Caveh Jalali <caveh(a)google.com>
Gerrit-Reviewer: Duncan Laurie <dlaurie(a)chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Gaggery Tsai <gaggery.tsai(a)intel.com>
Gerrit-Reviewer: Gaggery Tsai <gaggery.tsai(a)intel.corp-partner.google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Reviewer: caveh jalali <caveh(a)chromium.org>