// SPDX-License-Identifier: GPL-2.0-or-later /* * portwell-ec.c: Portwell embedded controller driver. * * Tested on: * - Portwell NANO-6064 * * This driver provides support for GPIO and Watchdog Timer * functionalities of the Portwell boards with ITE embedded controller (EC). * The EC is accessed through I/O ports and provides: * - 8 GPIO pins for control and monitoring * - Hardware watchdog with 1-15300 second timeout range * * It integrates with the Linux GPIO and Watchdog subsystems, allowing * userspace interaction with EC GPIO pins and watchdog control, * ensuring system stability and configurability. * * (C) Copyright 2025 Portwell, Inc. * Author: Yen-Chi Huang (jesse.huang@portwell.com.tw)
*/
/* Ensure consistent min/sec read in case of second rollover. */ staticunsignedint pwec_wdt_get_timeleft(struct watchdog_device *wdd)
{
u8 sec, min, old_min;
do {
old_min = pwec_read(PORTWELL_WDT_EC_COUNT_MIN_ADDR);
sec = pwec_read(PORTWELL_WDT_EC_COUNT_SEC_ADDR);
min = pwec_read(PORTWELL_WDT_EC_COUNT_MIN_ADDR);
} while (min != old_min);
staticint pwec_probe(struct platform_device *pdev)
{ int ret;
if (!devm_request_region(&pdev->dev, PORTWELL_EC_IOSPACE,
PORTWELL_EC_IOSPACE_LEN, dev_name(&pdev->dev))) {
dev_err(&pdev->dev, "failed to get IO region\n"); return -EBUSY;
}
ret = pwec_firmware_vendor_check(); if (ret < 0) return ret;
ret = devm_gpiochip_add_data(&pdev->dev, &pwec_gpio_chip, NULL); if (ret < 0) {
dev_err(&pdev->dev, "failed to register Portwell EC GPIO\n"); return ret;
}
ec_wdt_dev.parent = &pdev->dev;
ret = devm_watchdog_register_device(&pdev->dev, &ec_wdt_dev); if (ret < 0) {
dev_err(&pdev->dev, "failed to register Portwell EC Watchdog\n"); return ret;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.