[coreboot-gerrit] Change in coreboot[master]: google/kahlee: Set USB OC pins

Marc Jones (Code Review) gerrit at coreboot.org
Sat Dec 2 01:23:50 CET 2017


Marc Jones has uploaded this change for review. ( https://review.coreboot.org/22679


Change subject: google/kahlee: Set USB OC pins
......................................................................

google/kahlee: Set USB OC pins

Set the USB over current pins for the Grunt baseboard and
Kahlee mainboard. Removes the ACPI ASL OC code, which is not
used on Stoney Ridge SOC.

BUG=b:69229635
TEST=Build and boot Kahlee. Not tested with OC test fixture.

Change-Id: I5a9b3409d9c91b89fd02f8eecf9e04c435f14342
Signed-off-by: Marc Jones <marcj303 at gmail.com>
---
M src/mainboard/google/kahlee/dsdt.asl
M src/mainboard/google/kahlee/mainboard.c
M src/mainboard/google/kahlee/variants/baseboard/gpio.c
D src/mainboard/google/kahlee/variants/baseboard/include/baseboard/acpi/usb_oc.asl
M src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h
D src/mainboard/google/kahlee/variants/grunt/include/variant/acpi/usb_oc.asl
M src/mainboard/google/kahlee/variants/kahlee/gpio.c
D src/mainboard/google/kahlee/variants/kahlee/include/variant/acpi/usb_oc.asl
8 files changed, 45 insertions(+), 85 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/79/22679/1

diff --git a/src/mainboard/google/kahlee/dsdt.asl b/src/mainboard/google/kahlee/dsdt.asl
index ded0dc8..ff3bb73 100644
--- a/src/mainboard/google/kahlee/dsdt.asl
+++ b/src/mainboard/google/kahlee/dsdt.asl
@@ -33,9 +33,6 @@
 	/* Globals for the platform */
 	#include "acpi/mainboard.asl"
 
-	/* Describe the USB Overcurrent pins */
-	#include "variant/acpi/usb_oc.asl"
-
 	/* PCI IRQ mapping for the Southbridge */
 	#include <pcie.asl>
 
diff --git a/src/mainboard/google/kahlee/mainboard.c b/src/mainboard/google/kahlee/mainboard.c
index f757504..67a9fec 100644
--- a/src/mainboard/google/kahlee/mainboard.c
+++ b/src/mainboard/google/kahlee/mainboard.c
@@ -23,6 +23,7 @@
 #include <boardid.h>
 #include <soc/nvs.h>
 #include <soc/smi.h>
+#include <soc/southbridge.h>
 #include <variant/ec.h>
 #include <variant/thermal.h>
 #include <vendorcode/google/chromeos/chromeos.h>
@@ -125,6 +126,16 @@
 	}
 }
 
+int get_xhci_oc_map(uint16_t *map)
+{
+	return variant_get_xhci_oc_map(map);
+}
+
+int get_ehci_oc_map(uint16_t *map)
+{
+	return variant_get_ehci_oc_map(map);
+}
+
 struct chip_operations mainboard_ops = {
 	.init = mainboard_init,
 	.enable_dev = kahlee_enable,
diff --git a/src/mainboard/google/kahlee/variants/baseboard/gpio.c b/src/mainboard/google/kahlee/variants/baseboard/gpio.c
index 4dc6d45..0f0015f 100644
--- a/src/mainboard/google/kahlee/variants/baseboard/gpio.c
+++ b/src/mainboard/google/kahlee/variants/baseboard/gpio.c
@@ -42,3 +42,17 @@
 	*num = ARRAY_SIZE(gpe_table);
 	return gpe_table;
 }
+
+int __attribute__((weak)) variant_get_xhci_oc_map(uint16_t *map)
+{
+	*map =  USB_OC0 << OC_PORT0_SHIFT; /* USB-C Port0 = OC0 */
+	*map |= USB_OC1 << OC_PORT1_SHIFT; /* USB-C Port1 = OC1 */
+	return 0;
+}
+
+int __attribute__((weak)) variant_get_ehci_oc_map(uint16_t *map)
+{
+	*map =  USB_OC2 << OC_PORT0_SHIFT; /* USB-A Port0 = OC2 */
+	*map |= USB_OC3 << OC_PORT1_SHIFT; /* USB-A Port1 = OC3 */
+	return 0;
+}
diff --git a/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/acpi/usb_oc.asl b/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/acpi/usb_oc.asl
deleted file mode 100644
index 72f26d8..0000000
--- a/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/acpi/usb_oc.asl
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2015 Advanced Micro Devices, Inc.
- * Copyright (C) 2013 Sage Electronic Engineering, LLC
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-/* USB overcurrent mapping pins.   */
-Name (UOM0, 0)
-Name (UOM1, 0)
-Name (UOM2, 0)
-Name (UOM3, 0)
-Name (UOM4, 0)
-Name (UOM5, 0)
-Name (UOM6, 0)
-Name (UOM7, 0)
-Name (UOM8, 0)
-Name (UOM9, 0)
-
-/* USB Overcurrent GPEs */
diff --git a/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h
index 1d38bd4..33054f5 100644
--- a/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h
@@ -25,5 +25,7 @@
 const struct sci_source *get_gpe_table(size_t *num);
 uint8_t variant_memory_sku(void);
 int variant_mainboard_read_spd(uint8_t spdAddress, char *buf, size_t len);
+int variant_get_xhci_oc_map(uint16_t *usb_oc_map);
+int variant_get_ehci_oc_map(uint16_t *usb_oc_map);
 
 #endif /* __BASEBOARD_VARIANTS_H__ */
diff --git a/src/mainboard/google/kahlee/variants/grunt/include/variant/acpi/usb_oc.asl b/src/mainboard/google/kahlee/variants/grunt/include/variant/acpi/usb_oc.asl
deleted file mode 100644
index d22628c..0000000
--- a/src/mainboard/google/kahlee/variants/grunt/include/variant/acpi/usb_oc.asl
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright 2017 Google Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <baseboard/acpi/usb_oc.asl>
diff --git a/src/mainboard/google/kahlee/variants/kahlee/gpio.c b/src/mainboard/google/kahlee/variants/kahlee/gpio.c
index d90a99c..5cc0608 100644
--- a/src/mainboard/google/kahlee/variants/kahlee/gpio.c
+++ b/src/mainboard/google/kahlee/variants/kahlee/gpio.c
@@ -148,3 +148,21 @@
 	*num = ARRAY_SIZE(gpe_table);
 	return gpe_table;
 }
+
+int variant_get_xhci_oc_map(uint16_t *map)
+{
+	*map = USB_OC_DISABLE_ALL;
+	*map &= ~(USB_OC_DISABLE << OC_PORT0_SHIFT);
+	*map |= USB_OC0 << OC_PORT0_SHIFT;	/* USB-C Port0 = OC0 */
+	*map &= ~(USB_OC_DISABLE << OC_PORT1_SHIFT);
+	*map |= USB_OC1 << OC_PORT1_SHIFT;	/* USB-C Port1 = OC1 */
+	return 0;
+}
+
+int variant_get_ehci_oc_map(uint16_t *map)
+{
+	*map = USB_OC_DISABLE_ALL;
+	*map &= ~(USB_OC_DISABLE << OC_PORT0_SHIFT);
+	*map |= USB_OC2 << OC_PORT0_SHIFT;	/* USB-A Port0 = OC2 */
+	return 0;
+}
diff --git a/src/mainboard/google/kahlee/variants/kahlee/include/variant/acpi/usb_oc.asl b/src/mainboard/google/kahlee/variants/kahlee/include/variant/acpi/usb_oc.asl
deleted file mode 100644
index 068d6fd..0000000
--- a/src/mainboard/google/kahlee/variants/kahlee/include/variant/acpi/usb_oc.asl
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2015 Advanced Micro Devices, Inc.
- * Copyright (C) 2013 Sage Electronic Engineering, LLC
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-/* simple name description */
-/*
- * DefinitionBlock ("DSDT.AML","DSDT",0x01,"XXXXXX","XXXXXXXX",0x00010001)
- * {
- *	#include "usb.asl"
- * }
- */
-
-/* USB overcurrent mapping pins.   */
-Name (UOM0, 0)
-Name (UOM1, 2)
-Name (UOM2, 0)
-Name (UOM3, 7)
-Name (UOM4, 2)
-Name (UOM5, 2)
-Name (UOM6, 6)
-Name (UOM7, 2)
-Name (UOM8, 6)
-Name (UOM9, 6)
-
-/* USB Overcurrent GPEs */

-- 
To view, visit https://review.coreboot.org/22679
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a9b3409d9c91b89fd02f8eecf9e04c435f14342
Gerrit-Change-Number: 22679
Gerrit-PatchSet: 1
Gerrit-Owner: Marc Jones <marc at marcjonesconsulting.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171202/988e6587/attachment-0001.html>


More information about the coreboot-gerrit mailing list