diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2021-11-04 12:11:58 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-05 04:22:34 +0000 |
commit | 252457d4b21f46889eebad61d4c0a65331919cec (patch) | |
tree | 01856c4d31d710b20e85a74c8d7b5836e35c3b98 /board/fusb307bgevb | |
parent | 08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff) | |
download | chrome-ec-stabilize-14469.8.B-ish.tar.gz |
ish: Trim down the release branchstabilize-wristpin-14469.59.B-ishstabilize-voshyr-14637.B-ishstabilize-quickfix-14695.187.B-ishstabilize-quickfix-14695.124.B-ishstabilize-quickfix-14526.91.B-ishstabilize-14695.85.B-ishstabilize-14695.107.B-ishstabilize-14682.B-ishstabilize-14633.B-ishstabilize-14616.B-ishstabilize-14589.B-ishstabilize-14588.98.B-ishstabilize-14588.14.B-ishstabilize-14588.123.B-ishstabilize-14536.B-ishstabilize-14532.B-ishstabilize-14528.B-ishstabilize-14526.89.B-ishstabilize-14526.84.B-ishstabilize-14526.73.B-ishstabilize-14526.67.B-ishstabilize-14526.57.B-ishstabilize-14498.B-ishstabilize-14496.B-ishstabilize-14477.B-ishstabilize-14469.9.B-ishstabilize-14469.8.B-ishstabilize-14469.58.B-ishstabilize-14469.41.B-ishstabilize-14442.B-ishstabilize-14438.B-ishstabilize-14411.B-ishstabilize-14396.B-ishstabilize-14395.B-ishstabilize-14388.62.B-ishstabilize-14388.61.B-ishstabilize-14388.52.B-ishstabilize-14385.B-ishstabilize-14345.B-ishstabilize-14336.B-ishstabilize-14333.B-ishrelease-R99-14469.B-ishrelease-R98-14388.B-ishrelease-R102-14695.B-ishrelease-R101-14588.B-ishrelease-R100-14526.B-ishfirmware-cherry-14454.B-ishfirmware-brya-14505.B-ishfirmware-brya-14505.71.B-ishfactory-kukui-14374.B-ishfactory-guybrush-14600.B-ishfactory-cherry-14455.B-ishfactory-brya-14517.B-ish
In the interest of making long-term branch maintenance incur as little
technical debt on us as possible, we should not maintain any files on
the branch we are not actually using.
This has the added effect of making it extremely clear when merging CLs
from the main branch when changes have the possibility to affect us.
The follow-on CL adds a convenience script to actually pull updates from
the main branch and generate a CL for the update.
BUG=b:204206272
BRANCH=ish
TEST=make BOARD=arcada_ish && make BOARD=drallion_ish
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'board/fusb307bgevb')
-rw-r--r-- | board/fusb307bgevb/board.c | 328 | ||||
-rw-r--r-- | board/fusb307bgevb/board.h | 120 | ||||
-rw-r--r-- | board/fusb307bgevb/build.mk | 13 | ||||
-rw-r--r-- | board/fusb307bgevb/ec.tasklist | 13 | ||||
-rw-r--r-- | board/fusb307bgevb/gpio.inc | 31 | ||||
-rw-r--r-- | board/fusb307bgevb/lcd.c | 166 | ||||
-rw-r--r-- | board/fusb307bgevb/lcd.h | 69 | ||||
-rw-r--r-- | board/fusb307bgevb/vif_override.xml | 3 |
8 files changed, 0 insertions, 743 deletions
diff --git a/board/fusb307bgevb/board.c b/board/fusb307bgevb/board.c deleted file mode 100644 index 41b12d5a82..0000000000 --- a/board/fusb307bgevb/board.c +++ /dev/null @@ -1,328 +0,0 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -/* FUSB307BGEVB configuration */ - -#include "common.h" -#include "ec_version.h" -#include "fusb307.h" -#include "gpio.h" -#include "hooks.h" -#include "i2c.h" -#include "lcd.h" -#include "printf.h" -#include "queue_policies.h" -#include "registers.h" -#include "task.h" -#include "timer.h" -#include "usart-stm32f0.h" -#include "usart_tx_dma.h" -#include "usart_rx_dma.h" -#include "usb_gpio.h" -#include "usb-stream.h" -#include "usb_common.h" -#include "util.h" - -#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) - -static void tcpc_alert_event(enum gpio_signal signal) -{ - schedule_deferred_pd_interrupt(0); -} - -/****************************************************************************** - * Handle button presses. Press BUTTON REFRESH to refresh pdos shown on lcd. - * Press BUTTON DOWN to select pdo. Prss BUTTON ENTER to confirm selection. - */ -static int count; - -static void button_enter_event_deferred(void) -{ - uint32_t ma, mv, unused; - - CPRINTS("Button enter event"); - - if (count >= 0 && count < pd_get_src_cap_cnt(0)) { - pd_extract_pdo_power(pd_get_src_caps(0)[count], &ma, &mv, - &unused); - pd_request_source_voltage(0, mv); - } else { - CPRINTS("ERROR: button counter weird value."); - return; - } -} -DECLARE_DEFERRED(button_enter_event_deferred); - -void button_enter_event(enum gpio_signal signal) -{ - hook_call_deferred(&button_enter_event_deferred_data, 100 * MSEC); -} - -static void button_refresh_event_deferred(void) -{ - int i; - uint32_t ma, mv, unused; - char c[20]; - - CPRINTS("Button refresh event"); - count = 0; - - /* Display supply voltage on first page. */ - lcd_clear(); - for (i = 0; i < MIN(pd_get_src_cap_cnt(0), 4); i++) { - pd_extract_pdo_power(pd_get_src_caps(0)[i], &ma, &mv, &unused); - snprintf(c, ARRAY_SIZE(c), "[%d] %dmV %dmA", i, mv, ma); - lcd_set_cursor(0, i); - lcd_print_string(c); - } - - /* Display selector */ - lcd_set_cursor(19, 0); - lcd_print_string("V"); -} -DECLARE_DEFERRED(button_refresh_event_deferred); - -void button_refresh_event(enum gpio_signal signal) -{ - hook_call_deferred(&button_refresh_event_deferred_data, 100 * MSEC); -} - -static void button_down_event_deferred(void) -{ - int i; - uint32_t ma, mv, unused; - char c[20]; - - CPRINTS("Button down event"); - if (pd_get_src_cap_cnt(0) > 0) - count = (count + 1) % pd_get_src_cap_cnt(0); - else { - /* Hasn't plug in adaptor yet, do nothing. */ - return; - } - - /* Display all supply voltage, count will never be greater than 7 */ - if (count == 0) { - lcd_clear(); - for (i = 0; i < MIN(pd_get_src_cap_cnt(0), 4); i++) { - pd_extract_pdo_power(pd_get_src_caps(0)[i], &ma, &mv, - &unused); - snprintf(c, ARRAY_SIZE(c), "[%d] %dmV %dmA", i, mv, ma); - lcd_set_cursor(0, i); - lcd_print_string(c); - } - } - if (count == 4) { - lcd_clear(); - for (i = 4; i < pd_get_src_cap_cnt(0); i++) { - pd_extract_pdo_power(pd_get_src_caps(0)[i], &ma, &mv, - &unused); - snprintf(c, ARRAY_SIZE(c), "[%d] %dmV %dmA", i, mv, ma); - lcd_set_cursor(0, i - 4); - lcd_print_string(c); - } - } - - /* Clear last col on LCD */ - for (i = 0; i < 4; i++) { - lcd_set_cursor(19, i); - lcd_print_string(" "); - } - /* Display selector */ - lcd_set_cursor(19, count % 4); - lcd_print_string("V"); -} -DECLARE_DEFERRED(button_down_event_deferred); - -void button_down_event(enum gpio_signal signal) -{ - hook_call_deferred(&button_down_event_deferred_data, 100 * MSEC); -} - -/****************************************************************************** - * Build GPIO tables and expose a subset of the GPIOs over USB. - */ -#include "gpio_list.h" - -static enum gpio_signal const usb_gpio_list[] = { - GPIO_USER_BUTTON_ENTER, - GPIO_USER_BUTTON_REFRESH, - GPIO_USER_BUTTON_DOWN, -}; - -/* - * This instantiates struct usb_gpio_config const usb_gpio, plus several other - * variables, all named something beginning with usb_gpio_ - */ -USB_GPIO_CONFIG(usb_gpio, - usb_gpio_list, - USB_IFACE_GPIO, - USB_EP_GPIO); - -/****************************************************************************** - * Setup USART1 as a loopback device, it just echo's back anything sent to it. - */ -static struct usart_config const loopback_usart; - -static struct queue const loopback_queue = - QUEUE_DIRECT(64, uint8_t, - loopback_usart.producer, - loopback_usart.consumer); - -static struct usart_rx_dma const loopback_rx_dma = - USART_RX_DMA(STM32_DMAC_CH3, 8); - -static struct usart_tx_dma const loopback_tx_dma = - USART_TX_DMA(STM32_DMAC_CH2, 16); - -static struct usart_config const loopback_usart = - USART_CONFIG(usart1_hw, - loopback_rx_dma.usart_rx, - loopback_tx_dma.usart_tx, - 115200, - 0, - loopback_queue, - loopback_queue); - -/****************************************************************************** - * Forward USART4 as a simple USB serial interface. - */ -static struct usart_config const forward_usart; -struct usb_stream_config const forward_usb; - -static struct queue const usart_to_usb = QUEUE_DIRECT(64, uint8_t, - forward_usart.producer, - forward_usb.consumer); -static struct queue const usb_to_usart = QUEUE_DIRECT(64, uint8_t, - forward_usb.producer, - forward_usart.consumer); - -static struct usart_tx_dma const forward_tx_dma = - USART_TX_DMA(STM32_DMAC_CH7, 16); - -static struct usart_config const forward_usart = - USART_CONFIG(usart4_hw, - usart_rx_interrupt, - forward_tx_dma.usart_tx, - 115200, - 0, - usart_to_usb, - usb_to_usart); - -#define USB_STREAM_RX_SIZE 16 -#define USB_STREAM_TX_SIZE 16 - -USB_STREAM_CONFIG(forward_usb, - USB_IFACE_STREAM, - USB_STR_STREAM_NAME, - USB_EP_STREAM, - USB_STREAM_RX_SIZE, - USB_STREAM_TX_SIZE, - usb_to_usart, - usart_to_usb) - -/****************************************************************************** - * Define the strings used in our USB descriptors. - */ -const void *const usb_strings[] = { - [USB_STR_DESC] = usb_string_desc, - [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."), - [USB_STR_PRODUCT] = USB_STRING_DESC("fusb307bgevb"), - [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32), - [USB_STR_STREAM_NAME] = USB_STRING_DESC("Forward"), - [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Shell"), -}; - -BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT); - -/****************************************************************************** - * I2C interface. - */ -const struct i2c_port_t i2c_ports[] = { - {"tcpc", I2C_PORT_TCPC, 400 /* kHz */, GPIO_I2C2_SCL, GPIO_I2C2_SDA} -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - -/****************************************************************************** - * PD - */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .bus_type = EC_BUS_TYPE_I2C, - .i2c_info = { - .port = I2C_PORT_TCPC, - .addr_flags = FUSB307_I2C_ADDR_FLAGS, - }, - .drv = &fusb307_tcpm_drv, - }, -}; - - -uint16_t tcpc_get_alert_status(void) -{ - uint16_t status = 0; - - if (!gpio_get_level(GPIO_USB_C0_PD_INT_ODL)) - status |= PD_STATUS_TCPC_ALERT_0; - - return status; -} - -void board_reset_pd_mcu(void) -{ -} - -int pd_snk_is_vbus_provided(int port) -{ - return EC_ERROR_UNIMPLEMENTED; -} - -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ - /* No battery, nothing to do */ -} - -void pd_power_supply_reset(int port) -{ - /* Disable VBUS */ - fusb307_power_supply_reset(port); -} - -int pd_set_power_supply_ready(int port) -{ - return EC_SUCCESS; -} - -int pd_board_checks(void) -{ - return EC_SUCCESS; -} - -/****************************************************************************** - * Initialize board. - */ -static void board_init(void) -{ - /* Enable button interrupts */ - gpio_enable_interrupt(GPIO_USER_BUTTON_ENTER); - gpio_enable_interrupt(GPIO_USER_BUTTON_REFRESH); - gpio_enable_interrupt(GPIO_USER_BUTTON_DOWN); - /* Enable TCPC alert interrupts */ - gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL); - - lcd_init(20, 4, 0); - lcd_set_cursor(0, 0); - lcd_print_string("USB-C"); - lcd_set_cursor(0, 1); - lcd_print_string("Sink Advertiser"); - queue_init(&loopback_queue); - queue_init(&usart_to_usb); - queue_init(&usb_to_usart); - usart_init(&loopback_usart); - usart_init(&forward_usart); - -} -DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); diff --git a/board/fusb307bgevb/board.h b/board/fusb307bgevb/board.h deleted file mode 100644 index 3495f7125f..0000000000 --- a/board/fusb307bgevb/board.h +++ /dev/null @@ -1,120 +0,0 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Fusb307bgevb configuration */ - -#ifndef __CROS_EC_BOARD_H -#define __CROS_EC_BOARD_H - - -/* 48 MHz SYSCLK clock frequency */ -#define CPU_CLOCK 48000000 - -/* Debug Congifuation */ -#define DEBUG_GET_CC -#define DEBUG_ROLE_CTRL_UPDATES - -/* Enable USART1,3,4 and USB streams */ -#define CONFIG_STREAM_USART -#define CONFIG_STREAM_USART1 -#define CONFIG_STREAM_USART4 -#define CONFIG_STREAM_USB -#define CONFIG_CMD_USART_INFO - -/* the UART console is on USART2 (PA14/PA15) */ -#undef CONFIG_UART_CONSOLE -#define CONFIG_UART_CONSOLE 2 - -/* Optional features */ -#define CONFIG_STM_HWTIMER32 -#define CONFIG_HW_CRC -#define CONFIG_I2C -#define CONFIG_I2C_CONTROLLER - -/* USB Configuration */ -#define CONFIG_USB -#define CONFIG_USB_PID 0x1234 -#define CONFIG_USB_CONSOLE - -/* USB Power Delivery configuration */ -#define CONFIG_USB_POWER_DELIVERY -#define CONFIG_USB_PD_TCPMV1 -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PD_TCPM_TCPCI -#define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_VBUS_DETECT_TCPC -#define CONFIG_USB_PD_REV30 -#define CONFIG_USB_PD_DECODE_SOP -#define CONFIG_USBC_VCONN -#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE -#define CONFIG_USB_PD_TCPM_FUSB307 - -/* delay to turn on/off vconn */ -/* Define operating power and max power */ -#define PD_OPERATING_POWER_MW 15000 -#define PD_MAX_VOLTAGE_MV 20000 -#define PD_MAX_CURRENT_MA 3000 -#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000) - -/* Degine board specific type-C power constants */ -#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */ -#define PD_POWER_SUPPLY_TURN_ON_DELAY 160000 /* us */ - -/* I2C master port connected to the TCPC */ -#define I2C_PORT_TCPC 1 - -/* LCD Configuration */ -#define LCD_SLAVE_ADDR 0x27 - -/* USB interface indexes (use define rather than enum to expand them) */ -#define USB_IFACE_STREAM 0 -#define USB_IFACE_GPIO 1 -#define USB_IFACE_SPI 2 -#define USB_IFACE_CONSOLE 3 -#define USB_IFACE_COUNT 4 - -/* USB endpoint indexes (use define rather than enum to expand them) */ -#define USB_EP_CONTROL 0 -#define USB_EP_STREAM 1 -#define USB_EP_GPIO 2 -#define USB_EP_SPI 3 -#define USB_EP_CONSOLE 4 -#define USB_EP_COUNT 5 - -/* Enable control of GPIOs over USB */ -#define CONFIG_USB_GPIO - -#undef CONFIG_WATCHDOG_HELP -#undef CONFIG_LID_SWITCH - -/* - * Allow dangerous commands all the time, since we don't have a write protect - * switch. - */ -#define CONFIG_SYSTEM_UNLOCKED - -#ifndef __ASSEMBLER__ - -/* Timer selection */ -#define TIM_CLOCK32 2 - -#include "gpio_signal.h" - -/* USB string indexes */ -enum usb_strings { - USB_STR_DESC = 0, - USB_STR_VENDOR, - USB_STR_PRODUCT, - USB_STR_VERSION, - USB_STR_STREAM_NAME, - USB_STR_CONSOLE_NAME, - - USB_STR_COUNT -}; - -void board_reset_pd_mcu(void); - -#endif /* !__ASSEMBLER__ */ -#endif /* __CROS_EC_BOARD_H */ diff --git a/board/fusb307bgevb/build.mk b/board/fusb307bgevb/build.mk deleted file mode 100644 index 1372562107..0000000000 --- a/board/fusb307bgevb/build.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- -# Copyright 2020 The Chromium OS Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# -# Board specific files build - -# the IC is STmicro STM32F072RBT6 -CHIP:=stm32 -CHIP_FAMILY:=stm32f0 -CHIP_VARIANT:=stm32f07x - -board-y=board.o lcd.o diff --git a/board/fusb307bgevb/ec.tasklist b/board/fusb307bgevb/ec.tasklist deleted file mode 100644 index e25b8f7a68..0000000000 --- a/board/fusb307bgevb/ec.tasklist +++ /dev/null @@ -1,13 +0,0 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_C0, pd_task, NULL, 1280) \ - TASK_ALWAYS(PD_INT_C0, pd_interrupt_handler_task, 0, ULTRA_TASK_STACK_SIZE) diff --git a/board/fusb307bgevb/gpio.inc b/board/fusb307bgevb/gpio.inc deleted file mode 100644 index 16a845576d..0000000000 --- a/board/fusb307bgevb/gpio.inc +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- mode:c -*- - * - * Copyright 2020 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Declare symbolic names for all the GPIOs that we care about. - * Note: Those with interrupt handlers must be declared first. */ - -GPIO_INT(USB_C0_PD_INT_ODL, PIN(A, 8), GPIO_INT_FALLING | GPIO_PULL_UP, tcpc_alert_event) -GPIO_INT(USER_BUTTON_ENTER, PIN(A, 0), GPIO_INT_FALLING, button_enter_event) -GPIO_INT(USER_BUTTON_REFRESH, PIN(A, 1), GPIO_INT_FALLING, button_refresh_event) -GPIO_INT(USER_BUTTON_DOWN, PIN(A, 2), GPIO_INT_FALLING, button_down_event) - -/* - * I2C pins should be configured as inputs until I2C module is - * initialized. This will avoid driving the lines unintentionally. - */ -GPIO(I2C2_SCL, PIN(B, 10), GPIO_INPUT) -GPIO(I2C2_SDA, PIN(B, 11), GPIO_INPUT) - -ALTERNATE(PIN_MASK(B, 0x0C00), 1, MODULE_I2C, GPIO_ODR_HIGH ) /* I2C MASTER: PB10/11 */ - -/* Unimplemented signals which we need to emulate for now */ -UNIMPLEMENTED(ENTERING_RW) -UNIMPLEMENTED(WP_L) - -ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_USART, 0) /* USART1: PA09/PA10 */ -ALTERNATE(PIN_MASK(A, 0xC000), 1, MODULE_UART, 0) /* USART2: PA14/PA15 */ -ALTERNATE(PIN_MASK(C, 0x0C00), 0, MODULE_USART, 0) /* USART4: PC10/PC11 */ diff --git a/board/fusb307bgevb/lcd.c b/board/fusb307bgevb/lcd.c deleted file mode 100644 index 892888329e..0000000000 --- a/board/fusb307bgevb/lcd.c +++ /dev/null @@ -1,166 +0,0 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * LCD driver for I2C LCD 2004. - */ - -#include "i2c.h" -#include "lcd.h" -#include "timer.h" - -struct lcd_state_info { - uint8_t addr; - uint8_t displayfunction; - uint8_t displaycontrol; - uint8_t backlightval; -}; - -static struct lcd_state_info state = { - .addr = LCD_SLAVE_ADDR, - .backlightval = LCD_BACKLIGHT, - .displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5X8DOTS, -}; - -/************ low level data pushing commands **********/ -/* write either command or data */ -static void expander_write(uint8_t data) -{ - i2c_write8(I2C_PORT_TCPC, LCD_SLAVE_ADDR, 0x00, data | - state.backlightval); -} - -static void pulse_enable(uint8_t data) -{ - expander_write(data | LCD_EN);/* En high */ - usleep(1); /* enable pulse must be >450ns */ - - expander_write(data & ~LCD_EN);/* En low */ - usleep(50); /* commands need > 37us to settle */ -} - -static void write_4bits(uint8_t value) -{ - expander_write(value); - pulse_enable(value); -} - -static void send(uint8_t value, uint8_t mode) -{ - uint8_t highnib = value & 0xf0; - uint8_t lownib = (value << 4) & 0xf0; - - write_4bits(highnib | mode); - write_4bits(lownib | mode); -} - -/*********** mid level commands, for sending data/cmds */ -static void command(uint8_t value) -{ - send(value, 0); -} - -/********** high level commands, for the user! */ -void lcd_clear(void) -{ - command(LCD_CLEAR_DISPLAY);/* clear display, set cursor to zero */ - usleep(2000); /* this command takes a long time! */ -} - -void lcd_set_cursor(uint8_t col, uint8_t row) -{ - int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 }; - - command(LCD_SET_DDRAMADDR | (col + row_offsets[row])); -} - -void lcd_print_char(char data) -{ - send(data, LCD_RS); -} - -void lcd_print_string(const char *str) -{ - while (*str) - lcd_print_char(*str++); -} - -/* Turn the display on/off (quickly) */ -void lcd_disable_display(void) -{ - state.displaycontrol &= ~LCD_DISPLAY_ON; - command(LCD_DISPLAY_CONTROL | state.displaycontrol); -} -void lcd_enable_display(void) -{ - state.displaycontrol |= LCD_DISPLAY_ON; - command(LCD_DISPLAY_CONTROL | state.displaycontrol); -} - -/* Turn the (optional) backlight off/on */ -void lcd_disable_backlight(void) -{ - state.backlightval = LCD_NO_BACKLIGHT; - expander_write(0); -} - -void lcd_enable_backlight(void) -{ - state.backlightval = LCD_BACKLIGHT; - expander_write(0); -} - -void lcd_init(uint8_t cols, uint8_t rows, uint8_t dotsize) -{ - if (rows > 1) - state.displayfunction |= LCD_2LINE; - - /* for some 1 line displays you can select a 10 pixel high font */ - if ((dotsize != 0) && (rows == 1)) - state.displayfunction |= LCD_5X10DOTS; - - /* SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION! - * according to datasheet, we need at least 40ms after power rises - * above 2.7V before sending commands. Arduino can turn on way - * before 4.5V so we'll wait 50 - */ - usleep(50); - - /* Now we pull both RS and R/W low to begin commands */ - /* reset expanderand turn backlight off (Bit 8 =1) */ - expander_write(state.backlightval); - usleep(1000); - - /* put the LCD into 4 bit mode - * this is according to the hitachi HD44780 datasheet - * figure 24, pg 46 - * we start in 8bit mode, try to set 4 bit mode - */ - write_4bits(0x03 << 4); - usleep(4500); /* wait min 4.1ms */ - /*second try */ - write_4bits(0x03 << 4); - usleep(4500); /* wait min 4.1ms */ - /* third go! */ - write_4bits(0x03 << 4); - usleep(150); - /* finally, set to 4-bit interface */ - write_4bits(0x02 << 4); - - /* set # lines, font size, etc. */ - command(LCD_FUNCTION_SET | state.displayfunction); - - /* turn the display on with no cursor or blinking default */ - state.displaycontrol = LCD_DISPLAY_ON | LCD_CURSOR_OFF | LCD_BLINK_OFF; - lcd_enable_display(); - - /* clear it off */ - lcd_clear(); - - /* Initialize to default text direction (for roman languages) - * and set the entry mode - */ - command(LCD_ENTRYMODE_SET | LCD_ENTRY_LEFT | LCD_ENTRY_SHIFT_DECREMENT); - - lcd_set_cursor(0, 0); -} diff --git a/board/fusb307bgevb/lcd.h b/board/fusb307bgevb/lcd.h deleted file mode 100644 index 21b0ee9ce9..0000000000 --- a/board/fusb307bgevb/lcd.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * LCD driver for I2C LCD 2004. - */ - -#ifndef __CROS_EC_LCD_H -#define __CROS_EC_LCD_H - -#include "common.h" - -/* commands */ -#define LCD_CLEAR_DISPLAY BIT(0) -#define LCD_RETURN_HOME BIT(1) -#define LCD_ENTRYMODE_SET BIT(2) -#define LCD_DISPLAY_CONTROL BIT(3) -#define LCD_CURSOR_SHIFT BIT(4) -#define LCD_FUNCTION_SET BIT(5) -#define LCD_SET_CGRAMADDR BIT(6) -#define LCD_SET_DDRAMADDR BIT(7) - -/* flags for display entry mode */ -#define LCD_ENTRY_RIGHT 0x00 -#define LCD_ENTRY_LEFT BIT(1) -#define LCD_ENTRY_SHIFT_INCREMENT BIT(0) -#define LCD_ENTRY_SHIFT_DECREMENT 0x00 - -/* flags for display on/off control */ -#define LCD_DISPLAY_ON BIT(2) -#define LCD_DISPLAY_OFF 0x00 -#define LCD_CURSOR_ON BIT(1) -#define LCD_CURSOR_OFF 0x00 -#define LCD_BLINK_ON BIT(0) -#define LCD_BLINK_OFF 0x00 - -/* flags for display/cursor shift */ -#define LCD_DISPLAY_MOVE BIT(3) -#define LCD_CURSOR_MOVE 0x00 -#define LCD_MOVE_RIGHT BIT(2) -#define LCD_MOVE_LEFT 0x00 - -/* flags for function set */ -#define LCD_8BITMODE BIT(4) -#define LCD_4BITMODE 0x00 -#define LCD_2LINE BIT(3) -#define LCD_1LINE 0x00 -#define LCD_5X10DOTS BIT(2) -#define LCD_5X8DOTS 0x00 - -/* flags for backlight control */ -#define LCD_BACKLIGHT BIT(3) -#define LCD_NO_BACKLIGHT 0x00 - -#define LCD_EN BIT(2) /* Enable bit */ -#define LCD_RW BIT(1) /* Read/Write bit */ -#define LCD_RS BIT(0) /* Register select bit */ - -void lcd_init(uint8_t cols, uint8_t rows, uint8_t dotsize); -void lcd_set_cursor(uint8_t col, uint8_t row); -void lcd_set_char(char data); -void lcd_print_string(const char *str); -void lcd_clear(void); -void lcd_enable_display(void); -void lcd_disable_display(void); -void lcd_enable_backlight(void); -void lcd_disable_backlight(void); - -#endif /*__CROS_EC_LCD_H */ diff --git a/board/fusb307bgevb/vif_override.xml b/board/fusb307bgevb/vif_override.xml deleted file mode 100644 index 32736caf64..0000000000 --- a/board/fusb307bgevb/vif_override.xml +++ /dev/null @@ -1,3 +0,0 @@ -<!-- Add VIF field overrides here. See genvif.c and the Vendor Info File - Definition from the USB-IF. ---> |