From patchwork Thu Jan 25 11:05:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 125814 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1039906ljf; Thu, 25 Jan 2018 03:16:50 -0800 (PST) X-Google-Smtp-Source: AH8x225z/CcwbGZEL6J9OanNGyldOK/E+XKgB+iLRjtsJrg0ExvDNUoD1jXC0oADTd3VnJd+Kk/D X-Received: by 10.80.145.41 with SMTP id e38mr29049699eda.63.1516879010914; Thu, 25 Jan 2018 03:16:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516879010; cv=none; d=google.com; s=arc-20160816; b=A+RqRqQYGMrNkFX1Z/DgHH933odqi4JUzmpDZYtsGw9xNVsf1Gns5Jb7nqtN1YXqYF hQoXGYJNrL6PqBy1OrN5FQrgfFaL0TE0OPDBJ41/teKycHFefS+Bwcm/50lbgcV6x7J/ 7w2R1aQeok0+whsDSJOPMQTxQj8x06ZeNtaBzEdUpGRdMVXRcoAfiaxqhCqNoDSGfjNo e1W1m828bRkUnC8WIXjaaIzbrU+qqES23oUj84sBe12TWZgn+ymO2xZmlUd/jK51ehtv 1jPeir0I1MTJxjlsEsE1psoMUOtEbDajrTxKQvwyA2pl+JRo/1pO20bd/yhhtTut5wc8 ZLJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :arc-authentication-results; bh=G+jSstisTH/mWWsvcDK+hJZuKWR4kuiouEpJDMwYsps=; b=XFsEhrHW5x7T2pME2acBY3aMhnR0tDzvpULfqM6W38E0ZoFL2of7Sjed1oaZTypO7g jMelU9bg4++eRpIWjoflWWWD/pETUo0mH+M+OYUCQAmwlwlZMmSt0yLJJUmODfokiMsi qr2jhOUnVoszc1dTnCj2Iy/6Ale3QilLI8JqIEqinbCj0R1ZZDykkMExpcr/wuoTCvo+ yVu0Dtbd5aAB+3kwpk9fADpGGBPT6fuDUD9R4LZHgrzCatbSFuca0zkIGe44cCW96zdG KQRqBXBhZg8hthDCvOX8XR3DfoVK6CQJGblIA+WrxABFDHlCbBaBbkKHrLwjG6lzwz0A /fzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id u37si1878035edm.140.2018.01.25.03.16.50; Thu, 25 Jan 2018 03:16:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 7B1A8C22466; Thu, 25 Jan 2018 11:11:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 32510C223C6; Thu, 25 Jan 2018 11:11:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 924BCC223BE; Thu, 25 Jan 2018 11:05:58 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id C1274C2240A for ; Thu, 25 Jan 2018 11:05:57 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 42EA6AC9C; Thu, 25 Jan 2018 11:05:57 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 25 Jan 2018 12:05:41 +0100 Message-Id: <20180125110556.76352-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 Cc: Tom Rini Subject: [U-Boot] [PATCH v3 00/15] RPi: Properly handle dynamic serial configuration X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The RPi has proprietary firmware that can be configured (using config.txt) to expose either the PL11, Mini-UART or no serial device to the UART pins on the GPIO pin bar of the RPi. So far we've only half-heartedly dealt with that, with lost of heuristics that ended up falling apart at times. For example the RPi3 CM uses PL011 when serial is enabled in config.txt, but we disabled PL11 support for BCM2837 because the RPi3 uses the Mini-UART with enable_uart=1 is set in config.txt. This patch set always enables both serial outputs and determines at probe time whether a serial device is actually muxed to the UART pins on the board. Only in that case, it will be probed and thus used for in- and output in U-Boot. With this patch set applied, I have successfully used the same U-Boot binary with CONFIG_OF_BOARD=y and a RPi firmware provided device tree with both enable_uart=1 and without on both a RPi3 and RPi3 CM. This patch set depends on v3 of the patch set "Rpi: Add support for second sd host controller". v1 -> v2: - Make search logic easier to follow v2 -> v3: - Use bcm2835 specific serial devices to determine pinctrl state - New: Convert PL01* to Kconfig - New: Convert PL01* to dev_read - New: Convert BCM2835_MU to Kconfig - New: Add myself as maintainer - Use pinctrl driver to determine pinctrl state Alexander Graf (15): serial: Use next serial device if probing fails rpi: Remove runtime disabling support for serial serial: bcm283x_mu: Remove support for post-init disabling rpi: Determine PL011/Mini-UART availability at runtime serial_bcm283x_mu: Convert to dev_read serial_bcm283x_mu: Always skip init serial_bcm283x_mu: Fail loading if not muxed pl01x: Convert to dev_read pl010: Convert CONFIG_PL010_SERIAL to Kconfig pl011: Convert CONFIG_PL011_SERIAL to Kconfig pl01x: Convert CONFIG_PL01X_SERIAL to Kconfig bcm2835_mu_serial: Convert to Kconfig MAINTAINERS: Take over BCM2835 maintainership bcm2835_pl011_serial: Add BCM2835 specific serial driver bcm2835_pinctrl: Probe pre-reloc MAINTAINERS | 5 +- arch/arm/Kconfig | 31 ++++++++++++ arch/arm/dts/bcm283x-uboot.dtsi | 4 ++ board/raspberrypi/rpi/rpi.c | 43 ---------------- drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 3 +- drivers/serial/Kconfig | 34 +++++++++++++ drivers/serial/Makefile | 1 + drivers/serial/serial-uclass.c | 25 +++++++--- drivers/serial/serial_bcm283x_mu.c | 61 ++++++++++++++--------- drivers/serial/serial_bcm283x_pl011.c | 73 ++++++++++++++++++++++++++++ drivers/serial/serial_pl01x.c | 19 +++----- drivers/serial/serial_pl01x_internal.h | 15 +++++- include/configs/edb93xx.h | 1 - include/configs/highbank.h | 1 - include/configs/hikey.h | 3 -- include/configs/integrator-common.h | 2 - include/configs/mxs.h | 1 - include/configs/poplar.h | 3 -- include/configs/qemu-arm.h | 3 -- include/configs/rpi.h | 7 --- include/configs/spear-common.h | 1 - include/configs/stv0991.h | 3 -- include/configs/thunderx_88xx.h | 1 - include/configs/vexpress_aemv8a.h | 2 - include/configs/vexpress_common.h | 1 - include/configs/x600.h | 1 - include/dm/platform_data/serial_bcm283x_mu.h | 1 - scripts/config_whitelist.txt | 4 -- 28 files changed, 224 insertions(+), 125 deletions(-) create mode 100644 drivers/serial/serial_bcm283x_pl011.c