Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1182231pxb; Wed, 16 Feb 2022 12:57:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvq9sb+m8HtQN7i1iqVboP9FQVO3PmFTNY1SiHe8h/846AiGrybk8WdURoRVUljSGQ0NTT X-Received: by 2002:a17:906:fac4:b0:6ce:ea4:a153 with SMTP id lu4-20020a170906fac400b006ce0ea4a153mr3673409ejb.411.1645045070234; Wed, 16 Feb 2022 12:57:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645045070; cv=none; d=google.com; s=arc-20160816; b=Rw6FcqJvaXfjEuJf6Ez/XymGczkrP2/M2p5fvg0P9n21QNsBdlgKdZph0DabqRYEwx Z8zHb3mq7PK3VMPRHUCLf96dhP5owou2R1g+ls8HXcjjVbAVAnlGTlD7AuTGXFjAX9/Z rQQhsMaJBAPiYS3aSfdFh0A00tHw3rzUiZMNXxFmlb0Zeuxmz2G9ofMh7SSQqpGdBZ5d D6iTlYKrL8AVuu3QUTEJ10V0x7EnrRDXeFRAHK+QeHHMQsRxL64K3ItuyTZSGn12AlrX jk/Hn4dAImxgLD5/vDduJIS/2vBvtC6f6ydaL81nsaGQG964WesWVxTb02rBiE5YD7uQ Gc7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=7AB8VBpyFBQKRoN6d6vVzUF8grAsjn3IGpYvohsqVUY=; b=Iu4QTdaRe0pnFhZ+QDafZRC+4MtJBgEYLZ7jE0I2U5w3YMzA2S1/An7jdCGhIw+AYI x9SQuSa0YTRm7n2OAPInMkZAOAQjeg2SM0Y/kGInhE5ZUVm2C2YJUWG0tXJoEWyPVHmw X7nwnnIbq8Llmxtn5rf0WyFHjI0eZPZHA9Eql6ZaFUO7EHWL8Oidvp+vAYlrBmgPxvCI Bcb+hv8asTlsH5w/vBfQeTbEI/K8/Nw+rAeCOYsvX61hxvkqaaQWNTWacUqk7DPkbl8V peIuBzfOtTSD7gQH7tVScDE3xt9wyuRGPrRcXPPIK6ePkDk3kHeSXOyCNeUYuTzihG2q Si7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b="XUlEGO8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e13si3151877edz.46.2022.02.16.12.57.25; Wed, 16 Feb 2022 12:57:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b="XUlEGO8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236243AbiBPQSr (ORCPT + 99 others); Wed, 16 Feb 2022 11:18:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236220AbiBPQSq (ORCPT ); Wed, 16 Feb 2022 11:18:46 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C00FD1FFF7D for ; Wed, 16 Feb 2022 08:18:29 -0800 (PST) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 24F3922246; Wed, 16 Feb 2022 17:18:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1645028307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=7AB8VBpyFBQKRoN6d6vVzUF8grAsjn3IGpYvohsqVUY=; b=XUlEGO8/0o2gpwuSbOUUklB3WX45dX2DxfaFJ6f1VD0048KatWTVsWqKE/7woCd3Ugw6p4 DkRS8IPWyqCSQ3fDD+iDtpJxSx3HlcgHThKAQKDb4XigY4r9hTsjykgZEtbF3x+s5OxH1m Bjb2M/z+NdUeUfAibmlZA2gir71oT1A= From: Michael Walle To: Richard Genoud , Greg Kroah-Hartman , Jiri Slaby , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea Cc: linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Michael Walle Subject: [PATCH] tty: serial: atmel: add earlycon support Date: Wed, 16 Feb 2022 17:18:22 +0100 Message-Id: <20220216161822.1071245-1-michael@walle.cc> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add early console support which relies on the bootloader for the initialization of the UART. Please note, that the compatibles are taken from at91-usart MFD driver. Signed-off-by: Michael Walle --- drivers/tty/serial/atmel_serial.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 2d09a89974a2..50fc6d51ff0d 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -2673,6 +2673,30 @@ static struct console atmel_console = { .data = &atmel_uart, }; +static void atmel_serial_early_write(struct console *con, const char *s, + unsigned int n) +{ + struct earlycon_device *dev = con->data; + + uart_console_write(&dev->port, s, n, atmel_console_putchar); +} + +static int __init atmel_early_console_setup(struct earlycon_device *device, + const char *options) +{ + if (!device->port.membase) + return -ENODEV; + + device->con->write = atmel_serial_early_write; + + return 0; +} + +OF_EARLYCON_DECLARE(atmelserial, "atmel,at91rm9200-usart", + atmel_early_console_setup); +OF_EARLYCON_DECLARE(atmelserial, "atmel,at91sam9260-usart", + atmel_early_console_setup); + #define ATMEL_CONSOLE_DEVICE (&atmel_console) #else -- 2.30.2