summaryrefslogtreecommitdiff
path: root/src/drivers/i2c/pi608gp/pi608gp.h
diff options
context:
space:
mode:
authorJan Samek <jan.samek@siemens.com>2023-04-12 14:36:02 +0200
committerFelix Held <felix-coreboot@felixheld.de>2023-05-08 13:11:22 +0000
commite59f18bf29a8db4447100c57d3400ec432a94961 (patch)
tree341552fe9873700dbdb3f8b843fbd0a94192d36b /src/drivers/i2c/pi608gp/pi608gp.h
parent995772f0c3126672773983cb8e7a7d8f0b23b379 (diff)
drivers/i2c: Add PI7C9X2G608GP PCIe switch driver (pi608gp)
This patch adds some of the variety of configuration options exported by the Pericom Inc. PI7C9X2G608GP PCIe switch over its SMBus interface. Currently implemented options are only used to adjust the switch upstream port amplitude and de-emphasis levels in millivolts. Only values specified in the switch datasheet (in tables 6-6 and 6-8) are allowed. Example of a devicetree.cb entry: chip drivers/i2c/pi608gp register "gen2_3p5_enable" = "true" register "gen2_3p5_amp" = "AMP_LVL_MV(425)" register "gen2_3p5_deemph" = \ "DEEMPH_LVL_MV(37, 5)" device i2c 0x6f on ops pi608gp_ops end end Link to the datasheet: https://web.archive.org/web/20210225074853/https://www.diodes.com/assets/Datasheets/PI7C9X2G608GP.pdf BUG=none TEST=Create devicetree.cb and Kconfig entries for this driver in a mainboard containing the switch and verify, that the values read out from the switch config space match the values programmed over the SMBus. Change-Id: Id191c4e97b99da58efd3ba38bf8cca3603ece4d5 Signed-off-by: Jan Samek <jan.samek@siemens.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/74433 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Mario Scheithauer <mario.scheithauer@siemens.com>
Diffstat (limited to 'src/drivers/i2c/pi608gp/pi608gp.h')
-rw-r--r--src/drivers/i2c/pi608gp/pi608gp.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/drivers/i2c/pi608gp/pi608gp.h b/src/drivers/i2c/pi608gp/pi608gp.h
new file mode 100644
index 0000000000..fe2776be01
--- /dev/null
+++ b/src/drivers/i2c/pi608gp/pi608gp.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _I2C_PI608GP_H_
+#define _I2C_PI608GP_H_
+
+/* Struct to store fixed-point millivolt values */
+struct deemph_lvl { uint32_t lvl, lvl_10; };
+
+#define AMP_LVL_MV(_LVL) (_LVL)
+#define DEEMPH_LVL_MV(_LVL, _LVL_10) { .lvl = _LVL, .lvl_10 = _LVL_10 }
+
+#endif