Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C14DC05027 for ; Wed, 1 Feb 2023 20:27:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 04EC485DAF; Wed, 1 Feb 2023 21:23:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="gWoEzeVc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 91C3585D5F; Wed, 1 Feb 2023 21:22:38 +0100 (CET) Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1DC4085D3D for ; Wed, 1 Feb 2023 21:22:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd33.google.com with SMTP id w24so4059152iow.13 for ; Wed, 01 Feb 2023 12:22:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5s1imS031zMU4+nsLGN4Yc01ph+VsbDwmjZEdn/Kdsc=; b=gWoEzeVcx+iDaP8caeE8UvOdZ5eCslHMgSoGb/pAbQJb7W3dD7LybDmO1l/QvVUyE1 OR0d0L4/FUkjIN5LInwZTGOhdPmMiG052LIm5e8kiarsCn+M/H+VYhz77xJuP+WcAZFz REpzYUiDKzgqWKvosvVuXkyCEVxG4dNstGS/E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5s1imS031zMU4+nsLGN4Yc01ph+VsbDwmjZEdn/Kdsc=; b=rqLKg5T5RSRGInUc7W/rn/C1Kcqi7j3d/wXq/geJbkAFT7S6iq9eIiBrztxM4awvRK nYyjrLnC8eqMpqfYFTn/za8T1m+JRBr8fm8Fo57QKTCQVYmrmt5eCSQzCyh9/wv91clx XqJw33UuIJtHHvQXEh+vLMRQa2wVOCInKHY4NJZeTHt0DmRYkUOWFSkVDXqyPwivzvJg Nlt4IoDC70VYLmS+u3v3flpAuapMytg7NL/lMHIULObWwJIE+74c/vUn+U5cQpMfwKt5 UEZdlfX2TBD9HonEgX4/0VY8kX+vY9R+w5jsgGgDHvmcDuXsSIs2NUw7gk3Z2HMHcXdM SU2w== X-Gm-Message-State: AO0yUKWYvO5oMPss/xNanc3n1G7FCnBTNgGSpexVJDrGwL0AEYHQHtd6 FbDsBzOklMhBz+VYP8GLGBMffATeryiEDqad X-Google-Smtp-Source: AK7set89Xg9c0jYt+WJjkF9pPImu+0Bxmurxbv7CLlI3AdBwT+zNLHY1KcZU8qnrr0tfIWyqhz6d0g== X-Received: by 2002:a05:6602:2dc2:b0:707:d9c9:458e with SMTP id l2-20020a0566022dc200b00707d9c9458emr213650iow.1.1675282947400; Wed, 01 Feb 2023 12:22:27 -0800 (PST) Received: from kea.bld.corp.google.com ([2620:15c:183:200:1fda:cca0:9a42:148c]) by smtp.gmail.com with ESMTPSA id i1-20020a6bf401000000b00704608527d1sm6166498iog.37.2023.02.01.12.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 12:22:27 -0800 (PST) From: Simon Glass To: u-boot@lists.denx.de Cc: Tom Rini , Simon Glass Subject: [PATCH v3 73/76] freescale: Drop unused vsc3316_3308 driver Date: Wed, 1 Feb 2023 13:20:24 -0700 Message-Id: <20230201202027.1943031-74-sjg@chromium.org> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog In-Reply-To: <20230201202027.1943031-1-sjg@chromium.org> References: <20230201202027.1943031-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean This is not used. Drop the driver and Kconfig option. Signed-off-by: Simon Glass --- (no changes since v1) board/freescale/common/Makefile | 1 - board/freescale/common/vsc3316_3308.c | 530 -------------------------- 2 files changed, 531 deletions(-) delete mode 100644 board/freescale/common/vsc3316_3308.c diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index 5f0503faf8d..c200cf4d403 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -54,7 +54,6 @@ obj-$(CONFIG_TARGET_MPC8548CDS) += cds_pci_ft.o obj-$(CONFIG_TARGET_P3041DS) += ics307_clk.o obj-$(CONFIG_TARGET_P4080DS) += ics307_clk.o obj-$(CONFIG_TARGET_P5040DS) += ics307_clk.o -obj-$(CONFIG_VSC_CROSSBAR) += vsc3316_3308.o obj-$(CONFIG_ZM7300) += zm7300.o ifeq ($(CONFIG_$(SPL_)POWER_LEGACY),y) obj-$(CONFIG_POWER_PFUZE100) += pfuze.o diff --git a/board/freescale/common/vsc3316_3308.c b/board/freescale/common/vsc3316_3308.c deleted file mode 100644 index c51f3c5aca2..00000000000 --- a/board/freescale/common/vsc3316_3308.c +++ /dev/null @@ -1,530 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright 2012 Freescale Semiconductor, Inc. - * Copyright 2020 NXP - */ - -#include "vsc3316_3308.h" -#include - -#define REVISION_ID_REG 0x7E -#define INTERFACE_MODE_REG 0x79 -#define CURRENT_PAGE_REGISTER 0x7F -#define CONNECTION_CONFIG_PAGE 0x00 -#define INPUT_STATE_REG 0x13 -#define GLOBAL_INPUT_ISE1 0x51 -#define GLOBAL_INPUT_ISE2 0x52 -#define GLOBAL_INPUT_GAIN 0x53 -#define GLOBAL_INPUT_LOS 0x55 -#define GLOBAL_OUTPUT_PE1 0x56 -#define GLOBAL_OUTPUT_PE2 0x57 -#define GLOBAL_OUTPUT_LEVEL 0x58 -#define GLOBAL_OUTPUT_TERMINATION 0x5A -#define GLOBAL_CORE_CNTRL 0x5D -#define OUTPUT_MODE_PAGE 0x23 -#define CORE_CONTROL_PAGE 0x25 -#define CORE_CONFIG_REG 0x75 - -int vsc_if_enable(unsigned int vsc_addr) -{ - u8 data; - - debug("VSC:Configuring VSC at I2C address 0x%2x" - " for 2-wire interface\n", vsc_addr); - - /* enable 2-wire Serial InterFace (I2C) */ - data = 0x02; -#if CONFIG_IS_ENABLED(DM_I2C) - int ret, bus_num = 0; - struct udevice *dev; - - ret = i2c_get_chip_for_busnum(bus_num, vsc_addr, - 1, &dev); - if (ret) { - printf("%s: Cannot find udev for a bus %d\n", __func__, - bus_num); - return ret; - } - - return dm_i2c_write(dev, INTERFACE_MODE_REG, &data, 1); -#else - return i2c_write(vsc_addr, INTERFACE_MODE_REG, 1, &data, 1); -#endif -} - -int vsc3316_config(unsigned int vsc_addr, int8_t con_arr[][2], - unsigned int num_con) -{ - unsigned int i; - u8 rev_id = 0; - int ret; - - debug("VSC:Initializing VSC3316 at I2C address 0x%2x" - " for Tx\n", vsc_addr); - -#if CONFIG_IS_ENABLED(DM_I2C) - int bus_num = 0; - struct udevice *dev; - - ret = i2c_get_chip_for_busnum(bus_num, vsc_addr, - 1, &dev); - if (ret) { - printf("%s: Cannot find udev for a bus %d\n", __func__, - bus_num); - return ret; - } - - ret = dm_i2c_read(dev, REVISION_ID_REG, &rev_id, 1); - if (ret < 0) { - printf("VSC:0x%x could not read REV_ID from device.\n", - vsc_addr); - return ret; - } - - if (rev_id != 0xab) { - printf("VSC: device at address 0x%x is not VSC3316/3308.\n", - vsc_addr); - return -ENODEV; - } - - ret = vsc_if_enable(vsc_addr); - if (ret) { - printf("VSC:0x%x could not configured for 2-wire I/F.\n", - vsc_addr); - return ret; - } - - /* config connections - page 0x00 */ - dm_i2c_reg_write(dev, CURRENT_PAGE_REGISTER, CONNECTION_CONFIG_PAGE); - - /* Making crosspoint connections, by connecting required - * input to output - */ - for (i = 0; i < num_con ; i++) - dm_i2c_reg_write(dev, con_arr[i][1], con_arr[i][0]); - - /* input state - page 0x13 */ - dm_i2c_reg_write(dev, CURRENT_PAGE_REGISTER, INPUT_STATE_REG); - /* Configuring the required input of the switch */ - for (i = 0; i < num_con ; i++) - dm_i2c_reg_write(dev, con_arr[i][0], 0x80); - - /* Setting Global Input LOS threshold value */ - dm_i2c_reg_write(dev, GLOBAL_INPUT_LOS, 0x60); - - /* config output mode - page 0x23 */ - dm_i2c_reg_write(dev, CURRENT_PAGE_REGISTER, OUTPUT_MODE_PAGE); - /* Turn ON the Output driver correspond to required output*/ - for (i = 0; i < num_con ; i++) - dm_i2c_reg_write(dev, con_arr[i][1], 0); - - /* configure global core control register, Turn on Global core power */ - dm_i2c_reg_write(dev, GLOBAL_CORE_CNTRL, 0); - -#else - ret = i2c_read(vsc_addr, REVISION_ID_REG, 1, &rev_id, 1); - if (ret < 0) { - printf("VSC:0x%x could not read REV_ID from device.\n", - vsc_addr); - return ret; - } - - if (rev_id != 0xab) { - printf("VSC: device at address 0x%x is not VSC3316/3308.\n", - vsc_addr); - return -ENODEV; - } - - ret = vsc_if_enable(vsc_addr); - if (ret) { - printf("VSC:0x%x could not configured for 2-wire I/F.\n", - vsc_addr); - return ret; - } - - /* config connections - page 0x00 */ - i2c_reg_write(vsc_addr, CURRENT_PAGE_REGISTER, CONNECTION_CONFIG_PAGE); - - /* Making crosspoint connections, by connecting required - * input to output */ - for (i = 0; i < num_con ; i++) - i2c_reg_write(vsc_addr, con_arr[i][1], con_arr[i][0]); - - /* input state - page 0x13 */ - i2c_reg_write(vsc_addr, CURRENT_PAGE_REGISTER, INPUT_STATE_REG); - /* Configuring the required input of the switch */ - for (i = 0; i < num_con ; i++) - i2c_reg_write(vsc_addr, con_arr[i][0], 0x80); - - /* Setting Global Input LOS threshold value */ - i2c_reg_write(vsc_addr, GLOBAL_INPUT_LOS, 0x60); - - /* config output mode - page 0x23 */ - i2c_reg_write(vsc_addr, CURRENT_PAGE_REGISTER, OUTPUT_MODE_PAGE); - /* Turn ON the Output driver correspond to required output*/ - for (i = 0; i < num_con ; i++) - i2c_reg_write(vsc_addr, con_arr[i][1], 0); - - /* configure global core control register, Turn on Global core power */ - i2c_reg_write(vsc_addr, GLOBAL_CORE_CNTRL, 0); -#endif - - vsc_wp_config(vsc_addr); - - return 0; -} - -#ifdef CONFIG_SYS_FSL_B4860QDS_XFI_ERR -int vsc3308_config_adjust(unsigned int vsc_addr, const int8_t con_arr[][2], - unsigned int num_con) -{ - unsigned int i; - u8 rev_id = 0; - int ret; - - debug("VSC:Initializing VSC3308 at I2C address 0x%x for Tx\n", - vsc_addr); - -#if CONFIG_IS_ENABLED(DM_I2C) - int bus_num = 0; - struct udevice *dev; - - ret = i2c_get_chip_for_busnum(bus_num, vsc_addr, - 1, &dev); - if (ret) { - printf("%s: Cannot find udev for a bus %d\n", __func__, - bus_num); - return ret; - } - - ret = dm_i2c_read(dev, REVISION_ID_REG, &rev_id, 1); - if (ret < 0) { - printf("VSC:0x%x could not read REV_ID from device.\n", - vsc_addr); - return ret; - } - - if (rev_id != 0xab) { - printf("VSC: device at address 0x%x is not VSC3316/3308.\n", - vsc_addr); - return -ENODEV; - } - - ret = vsc_if_enable(vsc_addr); - if (ret) { - printf("VSC:0x%x could not configured for 2-wire I/F.\n", - vsc_addr); - return ret; - } - - /* config connections - page 0x00 */ - dm_i2c_reg_write(dev, CURRENT_PAGE_REGISTER, CONNECTION_CONFIG_PAGE); - - /* Configure Global Input ISE */ - dm_i2c_reg_write(dev, GLOBAL_INPUT_ISE1, 0); - dm_i2c_reg_write(dev, GLOBAL_INPUT_ISE2, 0); - - /* Configure Tx/Rx Global Output PE1 */ - dm_i2c_reg_write(dev, GLOBAL_OUTPUT_PE1, 0); - - /* Configure Tx/Rx Global Output PE2 */ - dm_i2c_reg_write(dev, GLOBAL_OUTPUT_PE2, 0); - - /* Configure Tx/Rx Global Input GAIN */ - dm_i2c_reg_write(dev, GLOBAL_INPUT_GAIN, 0x3F); - - /* Setting Global Input LOS threshold value */ - dm_i2c_reg_write(dev, GLOBAL_INPUT_LOS, 0xE0); - - /* Setting Global output termination */ - dm_i2c_reg_write(dev, GLOBAL_OUTPUT_TERMINATION, 0); - - /* Configure Tx/Rx Global Output level */ - if (vsc_addr == VSC3308_TX_ADDRESS) - dm_i2c_reg_write(dev, GLOBAL_OUTPUT_LEVEL, 4); - else - dm_i2c_reg_write(dev, GLOBAL_OUTPUT_LEVEL, 2); - - /* Making crosspoint connections, by connecting required - * input to output - */ - for (i = 0; i < num_con ; i++) - dm_i2c_reg_write(dev, con_arr[i][1], con_arr[i][0]); - - /* input state - page 0x13 */ - dm_i2c_reg_write(dev, CURRENT_PAGE_REGISTER, INPUT_STATE_REG); - /* Turning off all the required input of the switch */ - for (i = 0; i < num_con; i++) - dm_i2c_reg_write(dev, con_arr[i][0], 1); - - /* only turn on specific Tx/Rx requested by the XFI erratum */ - if (vsc_addr == VSC3308_TX_ADDRESS) { - dm_i2c_reg_write(dev, 2, 0); - dm_i2c_reg_write(dev, 3, 0); - } else { - dm_i2c_reg_write(dev, 0, 0); - dm_i2c_reg_write(dev, 1, 0); - } - - /* config output mode - page 0x23 */ - dm_i2c_reg_write(dev, CURRENT_PAGE_REGISTER, OUTPUT_MODE_PAGE); - /* Turn off the Output driver correspond to required output*/ - for (i = 0; i < num_con ; i++) - dm_i2c_reg_write(dev, con_arr[i][1], 1); - - /* only turn on specific Tx/Rx requested by the XFI erratum */ - if (vsc_addr == VSC3308_TX_ADDRESS) { - dm_i2c_reg_write(dev, 0, 0); - dm_i2c_reg_write(dev, 1, 0); - } else { - dm_i2c_reg_write(dev, 3, 0); - dm_i2c_reg_write(dev, 4, 0); - } - - /* configure global core control register, Turn on Global core power */ - dm_i2c_reg_write(dev, GLOBAL_CORE_CNTRL, 0); -#else - ret = i2c_read(vsc_addr, REVISION_ID_REG, 1, &rev_id, 1); - if (ret < 0) { - printf("VSC:0x%x could not read REV_ID from device.\n", - vsc_addr); - return ret; - } - - if (rev_id != 0xab) { - printf("VSC: device at address 0x%x is not VSC3316/3308.\n", - vsc_addr); - return -ENODEV; - } - - ret = vsc_if_enable(vsc_addr); - if (ret) { - printf("VSC:0x%x could not configured for 2-wire I/F.\n", - vsc_addr); - return ret; - } - - /* config connections - page 0x00 */ - i2c_reg_write(vsc_addr, CURRENT_PAGE_REGISTER, CONNECTION_CONFIG_PAGE); - - /* Configure Global Input ISE */ - i2c_reg_write(vsc_addr, GLOBAL_INPUT_ISE1, 0); - i2c_reg_write(vsc_addr, GLOBAL_INPUT_ISE2, 0); - - /* Configure Tx/Rx Global Output PE1 */ - i2c_reg_write(vsc_addr, GLOBAL_OUTPUT_PE1, 0); - - /* Configure Tx/Rx Global Output PE2 */ - i2c_reg_write(vsc_addr, GLOBAL_OUTPUT_PE2, 0); - - /* Configure Tx/Rx Global Input GAIN */ - i2c_reg_write(vsc_addr, GLOBAL_INPUT_GAIN, 0x3F); - - /* Setting Global Input LOS threshold value */ - i2c_reg_write(vsc_addr, GLOBAL_INPUT_LOS, 0xE0); - - /* Setting Global output termination */ - i2c_reg_write(vsc_addr, GLOBAL_OUTPUT_TERMINATION, 0); - - /* Configure Tx/Rx Global Output level */ - if (vsc_addr == VSC3308_TX_ADDRESS) - i2c_reg_write(vsc_addr, GLOBAL_OUTPUT_LEVEL, 4); - else - i2c_reg_write(vsc_addr, GLOBAL_OUTPUT_LEVEL, 2); - - /* Making crosspoint connections, by connecting required - * input to output */ - for (i = 0; i < num_con ; i++) - i2c_reg_write(vsc_addr, con_arr[i][1], con_arr[i][0]); - - /* input state - page 0x13 */ - i2c_reg_write(vsc_addr, CURRENT_PAGE_REGISTER, INPUT_STATE_REG); - /* Turning off all the required input of the switch */ - for (i = 0; i < num_con; i++) - i2c_reg_write(vsc_addr, con_arr[i][0], 1); - - /* only turn on specific Tx/Rx requested by the XFI erratum */ - if (vsc_addr == VSC3308_TX_ADDRESS) { - i2c_reg_write(vsc_addr, 2, 0); - i2c_reg_write(vsc_addr, 3, 0); - } else { - i2c_reg_write(vsc_addr, 0, 0); - i2c_reg_write(vsc_addr, 1, 0); - } - - /* config output mode - page 0x23 */ - i2c_reg_write(vsc_addr, CURRENT_PAGE_REGISTER, OUTPUT_MODE_PAGE); - /* Turn off the Output driver correspond to required output*/ - for (i = 0; i < num_con ; i++) - i2c_reg_write(vsc_addr, con_arr[i][1], 1); - - /* only turn on specific Tx/Rx requested by the XFI erratum */ - if (vsc_addr == VSC3308_TX_ADDRESS) { - i2c_reg_write(vsc_addr, 0, 0); - i2c_reg_write(vsc_addr, 1, 0); - } else { - i2c_reg_write(vsc_addr, 3, 0); - i2c_reg_write(vsc_addr, 4, 0); - } - - /* configure global core control register, Turn on Global core power */ - i2c_reg_write(vsc_addr, GLOBAL_CORE_CNTRL, 0); -#endif - vsc_wp_config(vsc_addr); - - return 0; -} -#endif - -int vsc3308_config(unsigned int vsc_addr, const int8_t con_arr[][2], - unsigned int num_con) -{ - unsigned int i; - u8 rev_id = 0; - int ret; - - debug("VSC:Initializing VSC3308 at I2C address 0x%x" - " for Tx\n", vsc_addr); -#if CONFIG_IS_ENABLED(DM_I2C) - int bus_num = 0; - struct udevice *dev; - - ret = i2c_get_chip_for_busnum(bus_num, vsc_addr, - 1, &dev); - if (ret) { - printf("%s: Cannot find udev for a bus %d\n", __func__, - bus_num); - return ret; - } - - ret = dm_i2c_read(dev, REVISION_ID_REG, &rev_id, 1); - if (ret < 0) { - printf("VSC:0x%x could not read REV_ID from device.\n", - vsc_addr); - return ret; - } - - if (rev_id != 0xab) { - printf("VSC: device at address 0x%x is not VSC3316/3308.\n", - vsc_addr); - return -ENODEV; - } - - ret = vsc_if_enable(vsc_addr); - if (ret) { - printf("VSC:0x%x could not configured for 2-wire I/F.\n", - vsc_addr); - return ret; - } - - /* config connections - page 0x00 */ - dm_i2c_reg_write(dev, CURRENT_PAGE_REGISTER, CONNECTION_CONFIG_PAGE); - - /* Making crosspoint connections, by connecting required - * input to output - */ - for (i = 0; i < num_con ; i++) - dm_i2c_reg_write(dev, con_arr[i][1], con_arr[i][0]); - - /*Configure Global Input ISE and gain */ - dm_i2c_reg_write(dev, GLOBAL_INPUT_ISE1, 0x12); - dm_i2c_reg_write(dev, GLOBAL_INPUT_ISE2, 0x12); - - /* input state - page 0x13 */ - dm_i2c_reg_write(dev, CURRENT_PAGE_REGISTER, INPUT_STATE_REG); - /* Turning ON the required input of the switch */ - for (i = 0; i < num_con ; i++) - dm_i2c_reg_write(dev, con_arr[i][0], 0); - - /* Setting Global Input LOS threshold value */ - dm_i2c_reg_write(dev, GLOBAL_INPUT_LOS, 0x60); - - /* config output mode - page 0x23 */ - dm_i2c_reg_write(dev, CURRENT_PAGE_REGISTER, OUTPUT_MODE_PAGE); - /* Turn ON the Output driver correspond to required output*/ - for (i = 0; i < num_con ; i++) - dm_i2c_reg_write(dev, con_arr[i][1], 0); - - /* configure global core control register, Turn on Global core power */ - dm_i2c_reg_write(dev, GLOBAL_CORE_CNTRL, 0); -#else - ret = i2c_read(vsc_addr, REVISION_ID_REG, 1, &rev_id, 1); - if (ret < 0) { - printf("VSC:0x%x could not read REV_ID from device.\n", - vsc_addr); - return ret; - } - - if (rev_id != 0xab) { - printf("VSC: device at address 0x%x is not VSC3316/3308.\n", - vsc_addr); - return -ENODEV; - } - - ret = vsc_if_enable(vsc_addr); - if (ret) { - printf("VSC:0x%x could not configured for 2-wire I/F.\n", - vsc_addr); - return ret; - } - - /* config connections - page 0x00 */ - i2c_reg_write(vsc_addr, CURRENT_PAGE_REGISTER, CONNECTION_CONFIG_PAGE); - - /* Making crosspoint connections, by connecting required - * input to output */ - for (i = 0; i < num_con ; i++) - i2c_reg_write(vsc_addr, con_arr[i][1], con_arr[i][0]); - - /*Configure Global Input ISE and gain */ - i2c_reg_write(vsc_addr, GLOBAL_INPUT_ISE1, 0x12); - i2c_reg_write(vsc_addr, GLOBAL_INPUT_ISE2, 0x12); - - /* input state - page 0x13 */ - i2c_reg_write(vsc_addr, CURRENT_PAGE_REGISTER, INPUT_STATE_REG); - /* Turning ON the required input of the switch */ - for (i = 0; i < num_con ; i++) - i2c_reg_write(vsc_addr, con_arr[i][0], 0); - - /* Setting Global Input LOS threshold value */ - i2c_reg_write(vsc_addr, GLOBAL_INPUT_LOS, 0x60); - - /* config output mode - page 0x23 */ - i2c_reg_write(vsc_addr, CURRENT_PAGE_REGISTER, OUTPUT_MODE_PAGE); - /* Turn ON the Output driver correspond to required output*/ - for (i = 0; i < num_con ; i++) - i2c_reg_write(vsc_addr, con_arr[i][1], 0); - - /* configure global core control register, Turn on Global core power */ - i2c_reg_write(vsc_addr, GLOBAL_CORE_CNTRL, 0); -#endif - vsc_wp_config(vsc_addr); - - return 0; -} - -void vsc_wp_config(unsigned int vsc_addr) -{ - debug("VSC:Configuring VSC at address:0x%x for WP\n", vsc_addr); - - /* For new crosspoint configuration to occur, WP bit of - * CORE_CONFIG_REG should be set 1 and then reset to 0 */ -#if CONFIG_IS_ENABLED(DM_I2C) - int ret, bus_num = 0; - struct udevice *dev; - - ret = i2c_get_chip_for_busnum(bus_num, vsc_addr, - 1, &dev); - if (ret) { - printf("%s: Cannot find udev for a bus %d\n", __func__, - bus_num); - return; - } - - dm_i2c_reg_write(dev, CORE_CONFIG_REG, 0x01); - dm_i2c_reg_write(dev, CORE_CONFIG_REG, 0x0); -#else - i2c_reg_write(vsc_addr, CORE_CONFIG_REG, 0x01); - i2c_reg_write(vsc_addr, CORE_CONFIG_REG, 0x0); -#endif -} -- 2.39.1.456.gfc5497dd1b-goog