Received: by 10.192.165.148 with SMTP id m20csp2184596imm; Thu, 26 Apr 2018 07:10:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqDcVPF9j8ojDyIzeqREbVB8i9SYuqgp5V0BcQ2bqXhXxuJV8jwP8xgs7b9hJA4AUSpMCsC X-Received: by 2002:a17:902:2006:: with SMTP id n6-v6mr4333309pla.125.1524751815816; Thu, 26 Apr 2018 07:10:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524751815; cv=none; d=google.com; s=arc-20160816; b=0vn4D8046505XG0XpJsguhYrt6YTJB36jIKR0+ucn4b9X3mDG0ZCmIXuAtDADwUvb0 el5IlDskcGv5YgFDAhUlinCuzdmjZk0jY+f27LZGQISPOXGjHnvmo6FViibS8Mv5ht2Q W2M2JDjGdYXVtugXOK6eQxADpab6II6bqYwceBStRz3/TvHsyUifR7xNrhgBfInQDVx6 zZyujDZaJ29cF9qWnJKY0VZ+v7FQ99B1amuJDj7vzDM33v7K4oy3Z9rjPM0iph1q+3gk E3vQx5llhoNItlNQxNmOcYupR5jFK/T81y9sm3uBGU4DOdTAQo7ikR3nJsiErbeZEYTa +HUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=HyzT+UEBdJ/0ty/DMlr7SUDtajUKQdWYEsb07fz1Zug=; b=lleOt88CdahXXdsjbcqhaPssTsj4IJPhl2IPCNP7Lp6aSkVf51MvLcEkxKzx6LEhTz PgoKo3kxK/bM+YTDx9ixrxs7IyW8hqRjFbs6o7NyCoyrqcID9FB6qaSdg8EOSANGEWYq 5EVA4CKDI+ta2g9sg3pGKxwCUGCiC68YYlpGTEOyLvOaS6xo2tbaA2g/RLEUI2HZIqTl nIzs8kbzQt4juDbuYxAAKhEEleHPiq5lfrZMQbGso85Vznt43DZGVztdDhRu7Vstb8ye 59Fx78JZR9cG45XEB/+KjM16e1Qe8YzWMLzQZmDlIsEN/9y2IOBY7dyY8hV3hjRFlpYN Ubmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=IsQk0qsF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u127si11280403pgc.81.2018.04.26.07.09.54; Thu, 26 Apr 2018 07:10:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=IsQk0qsF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932094AbeDZOIe (ORCPT + 99 others); Thu, 26 Apr 2018 10:08:34 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33067 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756533AbeDZOI1 (ORCPT ); Thu, 26 Apr 2018 10:08:27 -0400 Received: by mail-wm0-f67.google.com with SMTP id x12so8789948wmc.0 for ; Thu, 26 Apr 2018 07:08:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id; bh=HyzT+UEBdJ/0ty/DMlr7SUDtajUKQdWYEsb07fz1Zug=; b=IsQk0qsFatfXw5VZvnLxPSIg2Er9DzfBnaurb+87QtKPBUm9WrpBbzWy8BugoCVScG aaaQrDEKOaQyuEk/4t7AnemKzd7lu6rjcBQUrURvZgKzzy1QhLnsWeuaVUf7DxLqCN1m YW3fhHstyAGiQ6FZiY172OobzJ4tVscc3veg3Yw4XHISdVhtIfJ/v93942TQ2tzQp3fQ pBKjb0+/g/ywSWNNnOu4YQ6SpfH/y6czjz/QjLbL+aLh80NuI5epTo6B22GD6Bw7I8sZ 1zVAidFFfQDDhW+kVZFVr3DN55UqF219cLgjoub5d+W8CtSMNPJKeQigikFTnSaF1It3 Y8Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=HyzT+UEBdJ/0ty/DMlr7SUDtajUKQdWYEsb07fz1Zug=; b=UpAAPuY8oKFgPgL0UwYJ9i1/wvnTFEElnD5gnaYeFdFxeWtJzSw19B3jg1zcNFQ3Z2 94FTnltogzzI6p4CC/aUAudsFZ7XUShKz93JvjPw30olLgq7L5URQ17Iy/6By5Qbu2Wb FG1pWZtp/EaMTAtQVmBWbkhky6rl7DIV0eY+l0/hN87anNivFM8awltXHmXNC5PEz+GV 08vGqsHYnNmbTlhcCHdp95tWv+XoRqQAn5etnUdjiTqok5E5HNRGK1ylcyReqHTyDNtp 5URC6DRJRXKZieAMq59NbKUZ7zxBHeFQp4DZpCT3elcgjIqeSJ7hxvjJlJLXsqy9Qrf9 4OVA== X-Gm-Message-State: ALQs6tA3cfz2SLdpfds7eNKH5oT8RqEOMKr2zKN6xZL8gnufU8VLD76X us3QWWXVISRFgRH/DbkpEhPoeBKn X-Received: by 10.28.88.195 with SMTP id m186mr19962601wmb.113.1524751705570; Thu, 26 Apr 2018 07:08:25 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id b5-v6sm19195683wrf.40.2018.04.26.07.08.24 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 26 Apr 2018 07:08:24 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu, gnomes@lxorguk.ukuu.org.uk, Alexander Graf Cc: devicetree@vger.kernel.org, Jiri Slaby , Greg Kroah-Hartman , Rob Herring , linux-serial@vger.kernel.org, Frank Rowand , linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 0/3] serial: uartps: Add run time support for more IPs than hardcoded 2 Date: Thu, 26 Apr 2018 16:08:16 +0200 Message-Id: X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, this series is trying to address discussion I had with Alan in past https://patchwork.kernel.org/patch/9738445/. It is moving uart_register_driver() to probe function like it is done in pl011 driver. And also introducing new function for alias compatibility checking to resolve cases where some IPs have alias and some of them not. This case is detected in pl011_probe_dt_alias() but not properly solved. Also keep status of free ids/minor numbers in bitmap to know what's the next unallocated number. The same solution can be used in pl011, uart16550 and uartlite to really get unified kernel. Tested on these use cases: Notes: ff000000 is the first PS uart listed in dtsi ff010000 is the second PS uart listed in dtsi Standard zcu102 setting serial0 = &uart0; serial1 = &uart1; [ 0.196628] ff000000.serial: ttyPS0 at MMIO 0xff000000 (irq = 33, base_baud = 6250000) is a xuartps [ 0.642542] ff010000.serial: ttyPS1 at MMIO 0xff010000 (irq = 34, base_baud = 6250000) is a xuartps Swapped zcu102 setting serial0 = &uart1; serial1 = &uart0; [ 0.196472] ff000000.serial: ttyPS1 at MMIO 0xff000000 (irq = 33, base_baud = 6250000) is a xuartps [ 0.196824] ff010000.serial: ttyPS0 at MMIO 0xff010000 (irq = 34, base_baud = 6250000) is a xuartps uart0 on alias higher then MAX uart ports serial0 = &uart1; serial200 = &uart0; [ 0.176793] ff000000.serial: ttyPS200 at MMIO 0xff000000 (irq = 33, base_baud = 6250000) is a xuartps [ 0.177288] ff010000.serial: ttyPS0 at MMIO 0xff010000 (irq = 34, base_baud = 6250000) is a xuartps Both uarts on higher aliases serial1 = &uart1; serial2 = &uart0; [ 0.196470] ff000000.serial: ttyPS2 at MMIO 0xff000000 (irq = 33, base_baud = 6250000) is a xuartps [ 0.196823] ff010000.serial: ttyPS1 at MMIO 0xff010000 (irq = 34, base_baud = 6250000) is a xuartps uart0 not listed but it is probed first that's why should be ttyPS0 but there is uart1 via alias serial0 = &uart1; [ 0.176656] xuartps ff000000.serial: No serial alias passed. Using the first free id [ 0.176671] xuartps ff000000.serial: Validate id 0 [ 0.176680] xuartps ff000000.serial: The empty id is 0 [ 0.176692] xuartps ff000000.serial: ID 0 already taken - skipped [ 0.176701] xuartps ff000000.serial: Validate id 1 [ 0.176710] xuartps ff000000.serial: The empty id is 1 [ 0.176719] xuartps ff000000.serial: Selected ID 1 allocation passed [ 0.176760] ff000000.serial: ttyPS1 at MMIO 0xff000000 (irq = 33, base_baud = 6250000) is a xuartps [ 0.177104] ff010000.serial: ttyPS0 at MMIO 0xff010000 (irq = 34, base_baud = 6250000) is a xuartps uart0 not listed but it is probed first that's why should be ttyPS0 serial1 = &uart1; [ 0.176661] xuartps ff000000.serial: No serial alias passed. Using the first free id [ 0.176676] xuartps ff000000.serial: Validate id 0 [ 0.176686] xuartps ff000000.serial: The empty id is 0 [ 0.176696] xuartps ff000000.serial: Selected ID 0 allocation passed [ 0.176737] ff000000.serial: ttyPS0 at MMIO 0xff000000 (irq = 33, base_baud = 6250000) is a xuartps [ 0.177069] ff010000.serial: ttyPS1 at MMIO 0xff010000 (irq = 34, base_baud = 6250000) is a xuartps uarts not listed in aliases list [ 0.176673] xuartps ff000000.serial: No serial alias passed. Using the first free id [ 0.176687] xuartps ff000000.serial: Validate id 0 [ 0.176697] xuartps ff000000.serial: The empty id is 0 [ 0.176707] xuartps ff000000.serial: Selected ID 0 allocation passed [ 0.176746] ff000000.serial: ttyPS0 at MMIO 0xff000000 (irq = 33, base_baud = 6250000) is a xuartps [ 0.177057] xuartps ff010000.serial: No serial alias passed. Using the first free id [ 0.177070] xuartps ff010000.serial: Validate id 0 [ 0.177079] xuartps ff010000.serial: The empty id is 0 [ 0.177089] xuartps ff010000.serial: Selected ID 0 allocation failed [ 0.177098] xuartps ff010000.serial: Validate id 1 [ 0.177107] xuartps ff010000.serial: The empty id is 1 [ 0.177116] xuartps ff010000.serial: Selected ID 1 allocation passed [ 0.177149] ff010000.serial: ttyPS1 at MMIO 0xff010000 (irq = 34, base_baud = 6250000) is a xuartps Thanks, Michal Michal Simek (3): of: base: Introduce of_alias_check_id() to check alias IDs serial: uartps: Move register to probe based on run time detection serial: uartps: Change uart ports allocation drivers/of/base.c | 49 +++++++++++ drivers/tty/serial/xilinx_uartps.c | 128 +++++++++++++++++++++++------ include/linux/of.h | 2 + 3 files changed, 153 insertions(+), 26 deletions(-) -- 2.17.0