From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380149; b=TW2zK+EZVG0CCAvEKBLAcLHU7n+AfY9iooKYy4cHbrM4uIcS/lZg/wHwktk7nh5bXGFn soeuzPVbWbCHoKjWHbz6qbNrR0tYsUojYzB70LCo9n0vjNs8IM3aqsCc3UMz75dwCcJm3 I50dqUht2OCQEML6a40TKJxdXEAv6QGbL2P7lsgvacvSF9I3i+l8VlBvQcV1m/U3wfyuW jtn2RFfddfOwu15AGkyK0x5Kf4GMt/2HoOd2DbemiLp8QZi0h5wzxM3OkJuR/Pb8grflf 8PPHGGDImxBc15P3nIVKEPYW5ZwRBRAU5AJLfglqEH3jT4LQaGPPHiSaNPcNOAOhj9w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380149; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer; bh=dNO/YOuv99hZZbGGjMb73ilx7lS3JYUo2vTlwLxb5aM=; b=x13UyLEGTCH8qF+xqbZ/02ggU8x6AY+OgqJDA21WU/u4+iKMob/Xg/vwixXMSnLUgQ6J mQO8VVWJo+TYgilTpfw/NaM6sRdT8rh28qUxD8yF0TfxeQz2ssUcS9IdC2JNcW6xzkJQ7 31FDvdXw24Xu2BFwgE+QIZ/XSY5U22jJfU08MvfT/6gRAKWeJyM3BcAOCKAQrpePHVuFT BJEfwN+F4dk58DdtMyS+41XmZYkZtnn0bfgsBZnOOSBddhKgq/cxqI6fs4c0VSUGuoGvJ CspOGawy4uplypRiBfQglGcRtRKfPD6WARKS3x+MmasAiqxAjkMLoxztW4QQw6+bgLA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=DgK7DFGt; arc=none smtp.remote-ip=209.85.160.48 Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B019606A32F for ; Fri, 4 Dec 2026 10:29:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4B019606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=DgK7DFGt Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-483c607ccb4so449214fac.0 for ; Fri, 04 Dec 2026 02:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796380148; x=1796984948; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=dNO/YOuv99hZZbGGjMb73ilx7lS3JYUo2vTlwLxb5aM=; b=DgK7DFGtWctHN0WIehBszVQRHIXOAD4I1ra+VcHDHMj68SzbcMa8wAtID97cADcdO6 QknxZeWtfizO52tCveX44ycvoT0vaTNHva0nL+Ehg0pDDuLJ4t9F70Z57yRpzoSAOgZS KTIO3C7KwcHGY27NWh/d0R1Nqo4miGiRxRHdbxAgxKwiwUCS5kHBQcbPC0GnjjEYRoJE yDdle0MAsUeDHy5hlDacg50wshl95yH7p7YRg7XztcyXrpKjkTgBdOZyGtz2f517/dds 9LgMWAdECoVU4j11U890Z4XmLGS1HNpZ7QiD4Tn4DMbdMxMXblr0ghM4wbRNreEAiFgy WTmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796380148; x=1796984948; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=dNO/YOuv99hZZbGGjMb73ilx7lS3JYUo2vTlwLxb5aM=; b=J9IA8J6oD+6Di2syNnNC+71Tv9WuL3/K9hLD3TxBYB8ebjmFRHyCidlSMcuiQ64p7v lvNxQ0jolaC19DW5cJP6COZq8I/DGSGfS/fcymtIruaSjTIW84mz4drKBaqkDCol0Wdk MHEo91+jMJlXDaUV+rfKUVHI8TIVopUP5E9QodHOsiHPmYSKcDiuCgmqxos1/g/yMya+ MME/RtTBD4UFDx87wteQTGmE3qaLwbhSc0Wb1w9vG1IPSlFliiySc9oUqARRcEyI7tcG u2rOH2xhyLHPDVawuSIr4arw+2cIz80EYfrZJCla6g6T3fCIeFvHip5gsOW2Bc5AVSoO u7gQ== X-Gm-Message-State: APuU4Z9XNr8HTUU27jUo5w37wa2fqNfkI4f+FAO7tq9njMTLj9IKwkJK DB3zprBU90bV6iiQ/Cqvt0WxxU955qW/Iap/Edld/+OcMzPEtrsWO0kY X-Gm-Gg: AZFdTZeyk47SF/NWqkUl2M8yUUG0GhRSNkBCiuxd9VAGECmxxFJEnP7Sp0sCErVtwHF kfVA891RlekuMJccfxlutFNtF5rGwc2eoirQyarnPqBK+JJmolsjrD0j7RfpF9ooQtje04WT64G tBk+jVsKVk4SrNDOiAhI1GFNnnlOR+iURBYIS6TIfbGMz+1Y9zrositBPSs96d5cxC/xfvJHNGg 3+tG2EAUQTGVJGYxu9Q+afIiI9Jq2NctmUBf/3osnAw9muY8z+/cIsMQNk4ETs7ipOPkv0it4Wo OdmAztISsxKgYpEwVxlXNkogpzo3oCJ+yvQy62trxovbl35a96IGZkrVe2+ZRABmR18P/CcqaA0 L2v9rgYi+VKe2By0dwOPSGeaIw4J+5Ts+3Qu+GQzYEzDxXmLqJbO1OjYyjnm1YTPBMJgJFB0eNB O0iDSYiTFEiV2TBEPUpI7vmrOvWfTqS+KOX+MoOEsaI7R+RIcxL0ojQWsnp77biyW/jOluB3Bag xwEbXsxB/nyaYiIv5r6B9dReG1rWLPj8ux10n8KvMn5MW4ilIVjHjSo996ShAtKUlDwg+ppYORR jhGoZdA36k4frSi3b1oZbw0kvvr1wFy/gjU3bxCqSr0DkqRBWKNO6yEXpGsEy1ZGGxtlhIXyBwk c3b5YWDztNw8xHTA6yYAV+E28EBoH9z4bxzvD7QTS5bSyljvKheeHt6Tj9flrap1UE7JoE4rHoN TxdMGN30cz8dZj8UHpCr48b/yiLhOGDTunouOTsjAUTUgz6q09vlT8Sw== X-Received: by 2002:a05:6820:a65d:20b0:71b:187f:1d05 with SMTP id 006d021491bc7-71bf2092728mr816118eaf.68.1796380148193; Fri, 04 Dec 2026 02:29:08 -0800 (PST) Received: from [127.0.1.1] (174-29-20-82.hlrn.qwest.net. [174.29.20.82]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-863f81fad14sm1747533a34.9.2026.12.04.02.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 02:29:07 -0800 (PST) From: James Hilliard Date: Fri, 04 Dec 2026 03:28:47 -0700 Subject: [PATCH v10 02/11] serial: 8250_dw: select port setup through platform data X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20261204-submit-h616-uart-fifo-v1-v10-2-1a9fb4f79635@gmail.com> References: <20261204-submit-h616-uart-fifo-v1-v10-0-1a9fb4f79635@gmail.com> In-Reply-To: <20261204-submit-h616-uart-fifo-v1-v10-0-1a9fb4f79635@gmail.com> To: Andy Shevchenko , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Greg Kroah-Hartman , Jiri Slaby , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, James Hilliard X-Mailer: b4 0.17-dev Select feature discovery and DMA attachment through a platform-data setup callback. The generic callback probes the optional registers and attaches DMA when a FIFO size is available. Integrations with a fixed configuration can supply their own setup before the port is registered. Allow setup to return an error so integrations can reject invalid configuration before registration. Replace skip_autocfg with the Octeon setup selection. Octeon is a 64-bit platform and continues to skip optional-register probing while preserving its existing conditional DMA attachment. Select the DMA setup helper directly for this integration. Keep generic setup for devices without matched platform data as well. Reviewed-by: Ilpo Järvinen Reviewed-by: Andy Shevchenko Signed-off-by: James Hilliard --- drivers/tty/serial/8250/8250_dw.c | 44 +++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 7d2920106f58..a20adb38e046 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -64,6 +64,7 @@ struct dw8250_platform_data { u8 usr_reg; u32 cpr_value; unsigned int quirks; + int (*setup)(struct uart_port *p); }; struct dw8250_data { @@ -76,7 +77,6 @@ struct dw8250_data { struct clk *pclk; struct reset_control *rst; - unsigned int skip_autocfg:1; unsigned int uart_16550_compatible:1; unsigned int in_idle:1; @@ -596,7 +596,6 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) p->serial_out = dw8250_serial_outq; p->flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE; p->type = PORT_OCTEON; - data->skip_autocfg = true; } #endif @@ -631,6 +630,33 @@ static void dw8250_shutdown(struct uart_port *port) d->no_int_count = 0; } +static int dw8250_setup_dma(struct uart_port *p) +{ + struct dw8250_data *data = to_dw8250_data(p->private_data); + struct uart_8250_port *up = up_to_u8250p(p); + + /* DMA setup requires a FIFO */ + if (!p->fifosize) + return 0; + + data->data.dma.rxconf.src_maxburst = p->fifosize / 4; + data->data.dma.txconf.dst_maxburst = p->fifosize / 4; + up->dma = &data->data.dma; + + return 0; +} + +static int dw8250_setup(struct uart_port *p) +{ + int ret; + + ret = dw8250_setup_port(p); + if (ret) + return ret; + + return dw8250_setup_dma(p); +} + static int dw8250_probe(struct platform_device *pdev) { struct uart_8250_port uart = {}, *up = &uart; @@ -765,21 +791,16 @@ static int dw8250_probe(struct platform_device *pdev) dw8250_setup_dma_filter(p, data); - if (!data->skip_autocfg) - err = dw8250_setup_port(p); + if (data->pdata && data->pdata->setup) + err = data->pdata->setup(p); + else + err = dw8250_setup(p); if (err) return err; /* Use the BUSY-safe sequence for both integer and fractional divisors. */ p->set_divisor = dw8250_set_divisor; - /* If we have a valid fifosize, try hooking up DMA */ - if (p->fifosize) { - data->data.dma.rxconf.src_maxburst = p->fifosize / 4; - data->data.dma.txconf.dst_maxburst = p->fifosize / 4; - up->dma = &data->data.dma; - } - data->data.uport = serial8250_register_8250_port(up); if (IS_ERR(data->data.uport)) return PTR_ERR(data->data.uport); @@ -862,6 +883,7 @@ static const struct dw8250_platform_data dw8250_dw_apb = { static const struct dw8250_platform_data dw8250_octeon_3860_data = { .usr_reg = OCTEON_UART_USR, .quirks = DW_UART_QUIRK_OCTEON, + .setup = dw8250_setup_dma, }; static const struct dw8250_platform_data dw8250_armada_38x_data = { -- 2.53.0