From patchwork Sat Feb 29 00:09:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 1246929 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=timesys.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=timesys-com.20150623.gappssmtp.com header.i=@timesys-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=hQwxn6PM; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Tmtv1HNsz9sRG for ; Sat, 29 Feb 2020 11:07:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6696480911; Sat, 29 Feb 2020 01:07:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=timesys.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=timesys-com.20150623.gappssmtp.com header.i=@timesys-com.20150623.gappssmtp.com header.b="hQwxn6PM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2839D80E45; Sat, 29 Feb 2020 01:07:28 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (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 BF16680671 for ; Sat, 29 Feb 2020 01:07:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=timesys.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=angelo.dureghello@timesys.com Received: by mail-wm1-x341.google.com with SMTP id p9so5241456wmc.2 for ; Fri, 28 Feb 2020 16:07:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=timesys-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CZdsWzIATE4/VoNwXw6VorM2IUaT+OKzu9EP6GGvF9E=; b=hQwxn6PM5qLFRUJWWNpaeqPo/IjnGWHEYUOVDvhVPdZF+7YpVlwyU0KqEtAmVQDy5N asP+xU1qYIBsjho+qVQwIbiLVp+eyFNlr8yMuMEqM4YmMf7KbEuAC+0u5+TaBWpw3/Od NHlIdtVsMwS3lAtzegiWnSUd6h6LSNwSg5M6Vat1dc/ej+lmW0lfyC2AeJ05UdFh+0SW UDBeCC529vdOMwTZRajD4D91YGvDM7SWzoFZRjUgpFAxAZYHo02QMkbgPgDF6MLER0H5 u3UOQYF5K7BHNpfAKhM549Vb9aZwRy4DoVa2tXzENH56BAhrYeQbVSShOI31CaD0JYad 5p6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CZdsWzIATE4/VoNwXw6VorM2IUaT+OKzu9EP6GGvF9E=; b=oL5fmFvcF16OlKZuxJrliU/QRNSfKcbtfGLbWN/5O/Bvk3oxzhePArpbYZSKVV1gqA zkxkGnZGhhCcGb9Vj2vT2OBJrRVwSkYjjmkZ3de0RfOiLW22UFRWJ8xt0Zb9+gxF/i6v ZqcrgpaMo2ABgWOf7GJDI69B3itnKOZzbBj8CxVz24JKdP37O2VmPyxXmAakCg224iVf ctR5ulZGCW/lmCjB6mDz534JyRH4kRAniCnN0AkAk92z3eLKraGm9mKcjm+HLRZt0GaQ /1nqHsh3bzKs5oDUfCz9w7YNwumc4aUtbBF++Yv+vtCPBGDMG3U6rwUeOInmo8wzciF4 J3wA== X-Gm-Message-State: APjAAAXVDtPZtJbzeNkJOi/GzlmVxyG6ZisuBVxPbuPx4M5Ot5JqQKnJ RxYOvc5UIshM06Vg5Kyhqvq2Pw== X-Google-Smtp-Source: APXvYqwvIjivpG8QSFylYb3gYZxvPf6FPXnj+NmR0gB2IUziTpn7Xv/X/0ruXBpmz5eLz8RIh8gjog== X-Received: by 2002:a1c:99c5:: with SMTP id b188mr6872093wme.176.1582934844154; Fri, 28 Feb 2020 16:07:24 -0800 (PST) Received: from localhost.localdomain (host134-3-dynamic.50-79-r.retail.telecomitalia.it. [79.50.3.134]) by smtp.gmail.com with ESMTPSA id c8sm4455898wru.7.2020.02.28.16.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 16:07:23 -0800 (PST) From: Angelo Dureghello To: trini@konsulko.com Cc: u-boot@lists.denx.de, sjg@chromium.org, Angelo Durgehello Subject: [PATCH] serial: mcfuart: renaming to a more appropriate name Date: Sat, 29 Feb 2020 01:09:35 +0100 Message-Id: <20200229000935.625379-1-angelo.dureghello@timesys.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean From: Angelo Durgehello All drivers seems to align now to serial_xxx maning, so, aligning also this driver, to allow to be found easily. Signed-off-by: Angelo Durgehello --- drivers/serial/Makefile | 2 +- drivers/serial/mcfuart.c | 179 --------------------------------------- 2 files changed, 1 insertion(+), 180 deletions(-) delete mode 100644 drivers/serial/mcfuart.c diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index e26b64494e..e4a92bbbb7 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -39,7 +39,7 @@ obj-$(CONFIG_COREBOOT_SERIAL) += serial_coreboot.o obj-$(CONFIG_CORTINA_UART) += serial_cortina.o obj-$(CONFIG_EFI_APP) += serial_efi.o obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o -obj-$(CONFIG_MCFUART) += mcfuart.o +obj-$(CONFIG_MCFUART) += serial_mcf.o obj-$(CONFIG_SYS_NS16550) += ns16550.o obj-$(CONFIG_S5P) += serial_s5p.o obj-$(CONFIG_MXC_UART) += serial_mxc.o diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c deleted file mode 100644 index b599064b48..0000000000 --- a/drivers/serial/mcfuart.c +++ /dev/null @@ -1,179 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2004-2007 Freescale Semiconductor, Inc. - * TsiChung Liew, Tsi-Chung.Liew@freescale.com. - * - * Modified to add device model (DM) support - * (C) Copyright 2015 Angelo Dureghello - * - * Modified to add DM and fdt support, removed non DM code - * (C) Copyright 2018 Angelo Dureghello - */ - -/* - * Minimal serial functions needed to use one of the uart ports - * as serial console interface. - */ - -#include -#include -#include -#include -#include -#include -#include - -DECLARE_GLOBAL_DATA_PTR; - -extern void uart_port_conf(int port); - -static int mcf_serial_init_common(uart_t *uart, int port_idx, int baudrate) -{ - u32 counter; - - uart_port_conf(port_idx); - - /* write to SICR: SIM2 = uart mode,dcd does not affect rx */ - writeb(UART_UCR_RESET_RX, &uart->ucr); - writeb(UART_UCR_RESET_TX, &uart->ucr); - writeb(UART_UCR_RESET_ERROR, &uart->ucr); - writeb(UART_UCR_RESET_MR, &uart->ucr); - __asm__("nop"); - - writeb(0, &uart->uimr); - - /* write to CSR: RX/TX baud rate from timers */ - writeb(UART_UCSR_RCS_SYS_CLK | UART_UCSR_TCS_SYS_CLK, &uart->ucsr); - - writeb(UART_UMR_BC_8 | UART_UMR_PM_NONE, &uart->umr); - writeb(UART_UMR_SB_STOP_BITS_1, &uart->umr); - - /* Setting up BaudRate */ - counter = (u32) ((gd->bus_clk / 32) + (baudrate / 2)); - counter = counter / baudrate; - - /* write to CTUR: divide counter upper byte */ - writeb((u8)((counter & 0xff00) >> 8), &uart->ubg1); - /* write to CTLR: divide counter lower byte */ - writeb((u8)(counter & 0x00ff), &uart->ubg2); - - writeb(UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED, &uart->ucr); - - return (0); -} - -static void mcf_serial_setbrg_common(uart_t *uart, int baudrate) -{ - u32 counter; - - /* Setting up BaudRate */ - counter = (u32) ((gd->bus_clk / 32) + (baudrate / 2)); - counter = counter / baudrate; - - /* write to CTUR: divide counter upper byte */ - writeb(((counter & 0xff00) >> 8), &uart->ubg1); - /* write to CTLR: divide counter lower byte */ - writeb((counter & 0x00ff), &uart->ubg2); - - writeb(UART_UCR_RESET_RX, &uart->ucr); - writeb(UART_UCR_RESET_TX, &uart->ucr); - - writeb(UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED, &uart->ucr); -} - -static int coldfire_serial_probe(struct udevice *dev) -{ - struct coldfire_serial_platdata *plat = dev->platdata; - - plat->port = dev->seq; - - return mcf_serial_init_common((uart_t *)plat->base, - plat->port, plat->baudrate); -} - -static int coldfire_serial_putc(struct udevice *dev, const char ch) -{ - struct coldfire_serial_platdata *plat = dev->platdata; - uart_t *uart = (uart_t *)plat->base; - - /* Wait for last character to go. */ - if (!(readb(&uart->usr) & UART_USR_TXRDY)) - return -EAGAIN; - - writeb(ch, &uart->utb); - - return 0; -} - -static int coldfire_serial_getc(struct udevice *dev) -{ - struct coldfire_serial_platdata *plat = dev->platdata; - uart_t *uart = (uart_t *)(plat->base); - - /* Wait for a character to arrive. */ - if (!(readb(&uart->usr) & UART_USR_RXRDY)) - return -EAGAIN; - - return readb(&uart->urb); -} - -int coldfire_serial_setbrg(struct udevice *dev, int baudrate) -{ - struct coldfire_serial_platdata *plat = dev->platdata; - uart_t *uart = (uart_t *)(plat->base); - - mcf_serial_setbrg_common(uart, baudrate); - - return 0; -} - -static int coldfire_serial_pending(struct udevice *dev, bool input) -{ - struct coldfire_serial_platdata *plat = dev->platdata; - uart_t *uart = (uart_t *)(plat->base); - - if (input) - return readb(&uart->usr) & UART_USR_RXRDY ? 1 : 0; - else - return readb(&uart->usr) & UART_USR_TXRDY ? 0 : 1; - - return 0; -} - -static int coldfire_ofdata_to_platdata(struct udevice *dev) -{ - struct coldfire_serial_platdata *plat = dev_get_platdata(dev); - fdt_addr_t addr_base; - - addr_base = devfdt_get_addr(dev); - if (addr_base == FDT_ADDR_T_NONE) - return -ENODEV; - - plat->base = (uint32_t)addr_base; - plat->baudrate = gd->baudrate; - - return 0; -} - -static const struct dm_serial_ops coldfire_serial_ops = { - .putc = coldfire_serial_putc, - .pending = coldfire_serial_pending, - .getc = coldfire_serial_getc, - .setbrg = coldfire_serial_setbrg, -}; - -static const struct udevice_id coldfire_serial_ids[] = { - { .compatible = "fsl,mcf-uart" }, - { } -}; - -U_BOOT_DRIVER(serial_coldfire) = { - .name = "serial_coldfire", - .id = UCLASS_SERIAL, - .of_match = coldfire_serial_ids, - .ofdata_to_platdata = coldfire_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct coldfire_serial_platdata), - .probe = coldfire_serial_probe, - .ops = &coldfire_serial_ops, - .flags = DM_FLAG_PRE_RELOC, -};