From 2596764f34a03e4f53704ca5efef71de5c4f9f4c Mon Sep 17 00:00:00 2001 From: Varadarajan Narayanan Date: Tue, 8 Mar 2016 15:02:56 +0530 Subject: soc/qualcomm/ipq40xx: Add support for BLSP QUP I2C Able to talk to the TPM device and the commands seem to succeed. BUG=chrome-os-partner:49249 chrome-os-partner:49250 TEST=All commands to the TPM succeed BRANCH=none Original-Commit-Id: c13900108f524c8422c38dee88469c8bfe24d0bd Original-Change-Id: Ie8c3c1ab1290cd8d7e6ddd1ae22f765c7be81019 Original-Signed-off-by: Varadarajan Narayanan Original-Reviewed-on: https://chromium-review.googlesource.com/333314 Original-Commit-Ready: David Hendricks Original-Tested-by: David Hendricks Original-Reviewed-by: David Hendricks squashed: soc/qualcomm/ipq40xx: Add support for BLSP QUP SPI - Enable BLSP SPI driver for ipq40xx - supports only FIFO mode BUG=chrome-os-partner:49249 TEST=None. Initial code not sure if it will even compile BRANCH=none Original-Commit-Id: 0714025975854dd048d35fe602824ead4c7d94e9 Original-Change-Id: If809b0fdf7d6c9405db6fd3747a3774c00ea9870 Original-Signed-off-by: Varadarajan Narayanan Original-Reviewed-on: https://chromium-review.googlesource.com/333303 Original-Commit-Ready: David Hendricks Original-Tested-by: David Hendricks Original-Reviewed-by: David Hendricks Change-Id: Ia518af5bfc782b08a0883ac93224d476d07e2426 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/14677 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/mainboard/google/gale/Kconfig | 2 +- src/mainboard/google/gale/Makefile.inc | 2 +- src/mainboard/google/gale/blsp.c | 77 ++++++++++++++++++++++++++++++++++ src/mainboard/google/gale/chromeos.c | 2 +- src/mainboard/google/gale/gsbi.c | 64 ---------------------------- src/mainboard/google/gale/mainboard.c | 3 +- 6 files changed, 82 insertions(+), 68 deletions(-) create mode 100644 src/mainboard/google/gale/blsp.c delete mode 100644 src/mainboard/google/gale/gsbi.c (limited to 'src/mainboard') diff --git a/src/mainboard/google/gale/Kconfig b/src/mainboard/google/gale/Kconfig index 6888e41ce5..b839fb45a1 100644 --- a/src/mainboard/google/gale/Kconfig +++ b/src/mainboard/google/gale/Kconfig @@ -56,7 +56,7 @@ config DRAM_SIZE_MB config DRIVER_TPM_I2C_BUS hex - default 0x1 + default 0x2 config DRIVER_TPM_I2C_ADDR hex diff --git a/src/mainboard/google/gale/Makefile.inc b/src/mainboard/google/gale/Makefile.inc index 491b5b5075..7ce1e0d38d 100644 --- a/src/mainboard/google/gale/Makefile.inc +++ b/src/mainboard/google/gale/Makefile.inc @@ -21,7 +21,7 @@ bootblock-y += reset.c verstage-y += boardid.c verstage-y += cdp.c verstage-y += chromeos.c -verstage-y += gsbi.c +verstage-y += blsp.c verstage-y += memlayout.ld verstage-y += reset.c diff --git a/src/mainboard/google/gale/blsp.c b/src/mainboard/google/gale/blsp.c new file mode 100644 index 0000000000..3be075f141 --- /dev/null +++ b/src/mainboard/google/gale/blsp.c @@ -0,0 +1,77 @@ +/* + * This file is part of the depthcharge project. + * + * Copyright (C) 2014 - 2015 The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#define IPQ40XX_I2C0_PINGROUP_1 1 +#define IPQ40XX_I2C0_PINGROUP_2 (!IPQ40XX_I2C0_PINGROUP_1) + +#if IPQ40XX_I2C0_PINGROUP_1 + +#define SCL_GPIO 20 +#define SDA_GPIO 21 +#define GPIO_FUNC_SCL 0x1 +#define GPIO_FUNC_SDA 0x1 + +#elif IPQ40XX_I2C0_PINGROUP_2 + +#define SCL_GPIO 58 +#define SDA_GPIO 59 +#define GPIO_FUNC_SCL 0x3 +#define GPIO_FUNC_SDA 0x2 + +#else + +#warning "TPM: I2C pingroup not specified" + +#endif + +int blsp_i2c_init_board(blsp_qup_id_t id) +{ + switch (id) { + case BLSP_QUP_ID_0: + case BLSP_QUP_ID_1: + case BLSP_QUP_ID_2: + case BLSP_QUP_ID_3: +#if defined(IPQ40XX_I2C0_PINGROUP_1) || defined(IPQ40XX_I2C0_PINGROUP_2) + gpio_tlmm_config_set(SDA_GPIO, GPIO_FUNC_SDA, + GPIO_NO_PULL, GPIO_2MA, 1); + gpio_tlmm_config_set(SCL_GPIO, GPIO_FUNC_SCL, + GPIO_NO_PULL, GPIO_2MA, 1); +#endif /* Pin Group 1 or 2 */ + break; + default: + return 1; + } + + return 0; +} diff --git a/src/mainboard/google/gale/chromeos.c b/src/mainboard/google/gale/chromeos.c index c4af04853c..7430407c89 100644 --- a/src/mainboard/google/gale/chromeos.c +++ b/src/mainboard/google/gale/chromeos.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/mainboard/google/gale/gsbi.c b/src/mainboard/google/gale/gsbi.c deleted file mode 100644 index 915f317df9..0000000000 --- a/src/mainboard/google/gale/gsbi.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This file is part of the depthcharge project. - * - * Copyright (C) 2014 - 2015 The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include -#include - -#define GPIO_FUNC_I2C 0x1 - -int gsbi_init_board(gsbi_id_t gsbi_id) -{ - switch (gsbi_id) { - case GSBI_ID_7: - gpio_tlmm_config_set(8, GPIO_FUNC_I2C, - GPIO_NO_PULL, GPIO_2MA, 1); - gpio_tlmm_config_set(9, GPIO_FUNC_I2C, - GPIO_NO_PULL, GPIO_2MA, 1); - break; - case GSBI_ID_4: - /* Configure GPIOs 13 - SCL, 12 - SDA, 2mA gpio_en */ - gpio_tlmm_config_set(12, GPIO_FUNC_I2C, - GPIO_NO_PULL, GPIO_2MA, 1); - gpio_tlmm_config_set(13, GPIO_FUNC_I2C, - GPIO_NO_PULL, GPIO_2MA, 1); - break; - case GSBI_ID_1: - /* Configure GPIOs 54 - SCL, 53 - SDA, 2mA gpio_en */ - gpio_tlmm_config_set(54, GPIO_FUNC_I2C, - GPIO_NO_PULL, GPIO_2MA, 1); - gpio_tlmm_config_set(53, GPIO_FUNC_I2C, - GPIO_NO_PULL, GPIO_2MA, 1); - break; - default: - return 1; - } - - return 0; -} diff --git a/src/mainboard/google/gale/mainboard.c b/src/mainboard/google/gale/mainboard.c index a8117af1e3..e1a23c937f 100644 --- a/src/mainboard/google/gale/mainboard.c +++ b/src/mainboard/google/gale/mainboard.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -37,7 +38,7 @@ static void setup_usb(void) } #define TPM_RESET_GPIO 19 -static void ipq_setup_tpm(void) +void ipq_setup_tpm(void) { #ifdef CONFIG_I2C_TPM gpio_tlmm_config_set(TPM_RESET_GPIO, FUNC_SEL_GPIO, -- cgit v1.2.3