From patchwork Tue Oct 5 13:53:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 12536809 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F577C433F5 for ; Tue, 5 Oct 2021 13:57:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 008E861074 for ; Tue, 5 Oct 2021 13:57:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235528AbhJEN7G (ORCPT ); Tue, 5 Oct 2021 09:59:06 -0400 Received: from mail-dm3nam07on2073.outbound.protection.outlook.com ([40.107.95.73]:28128 "EHLO NAM02-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236172AbhJEN56 (ORCPT ); Tue, 5 Oct 2021 09:57:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S+l5lH0jHPBBif1gr7Fo/GkIIcoIdLxmB3brQn20ad7vDNgFbz7zu6n2PTXcEobJ6r/9QPHH60SIFsHExYh+gQHliKYoMRBau3jC5u1cxjyMFPcbblBpeA7pN0n+xpdwxSey9Uykcylx6g/Jpx5E32m4ZDnodZ72bP9ioIr9Oy5xA/PIg4frYLyTi+O5gYg+D0niFfyw4L9LMAdAQiPUnMvVUGmhuOEvuL5MOze6t1fZyGxFJM0t1Aysa9coDdeEta39Jn98CpYTWI0mA55RpKC0Na3Mphd4haowdGbg412iAMMZ7nXtFMogX46DzFfct3c2J8UW+i5eSC+u0xhByQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F3g7guzqvrKfaNdeZZWJqv6GI+uApsXjTpnySDnMvHU=; b=agbv9KS9s8GpqAsT0stI50bQdb4RfHX9JWR8Mq2E9Vfdc7hseps2fmaDxZhKMCqqbo9XJZW/2BJ40HJYa8Sj6f40it4GdU/hHhC/iVG8O8AbVyxBeRdlXn+747p+qAJD4hEIbjx1PxnIkdMs6Xef+MbFapGPqLVtm9Z+ECNyNhg7Ej0f4yinrky6qfjIFKeyCjqtmWuzDwLQu0LdADL8Vcoem9hVjvqYMhIDaj1lhRU84/PX3+JcpBYYDToPlDKT7/vC7DU1PfmroxqllKydlx5cGLz6oQTvWaHlP+qk0Tt9vYBkU9u3/8OkUxHD34hQs0uRWFV/xJ0O5Z2a4X7a4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F3g7guzqvrKfaNdeZZWJqv6GI+uApsXjTpnySDnMvHU=; b=ICYpqNubz046RNsRNqUNXLH2pYY9Is02hybAWGDujDxPEM7PMcFtbHs3EMvikgbTRtQVExQJM50icHZk5Y/R4KK9VaELoUXHXL33qmZN5uyAnb3HBnx9a4ctgW+kyXRziKcq9GCU1y5J6EiaieIx/OguP3/aXo/X/ja4yYzxwbk= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=silabs.com; Received: from PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) by PH0PR11MB5643.namprd11.prod.outlook.com (2603:10b6:510:d5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14; Tue, 5 Oct 2021 13:54:40 +0000 Received: from PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::31cb:3b13:b0e8:d8f4]) by PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::31cb:3b13:b0e8:d8f4%9]) with mapi id 15.20.4566.022; Tue, 5 Oct 2021 13:54:40 +0000 From: Jerome Pouiller To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Kalle Valo Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "David S . Miller" , devicetree@vger.kernel.org, Rob Herring , linux-mmc@vger.kernel.org, =?utf-8?q?Pali?= =?utf-8?q?_Roh=C3=A1r?= , Ulf Hansson , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH v8 07/24] wfx: add bus_spi.c Date: Tue, 5 Oct 2021 15:53:43 +0200 Message-Id: <20211005135400.788058-8-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211005135400.788058-1-Jerome.Pouiller@silabs.com> References: <20211005135400.788058-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR3P189CA0084.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:b4::29) To PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) MIME-Version: 1.0 Received: from pc-42.silabs.com (37.71.187.125) by PR3P189CA0084.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:b4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14 via Frontend Transport; Tue, 5 Oct 2021 13:54:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 616c63d9-9bef-48d1-0d39-08d98807acf0 X-MS-TrafficTypeDiagnostic: PH0PR11MB5643: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7LegOknnjn89eHUKPKlatWsCoiLtGIeM6esObH3xvoqViYAehI1++bTP8Um689HB+n3OBz6p3LWDT4o2qaFHqb3K87Jb+cS9uYjK+OlYoifgjUo38JuXrdWQCps25BrSJ/YIEI7XbbBrCGkx8Ndw/bSIm+cyv90D+rhbp++9vATxmoXVqGbrJWhv3FdmIaL1lqcOPkqNy1TjYmPTNAJ/g+pZszJFwhLxQM8JVcQUNGgCaqfMKygnvTjQrSuD6nBKmprcvRTjUsbvhBtRlloycTN26GcPGE7G4JDT4gjvmCwS0YVnRKkqcgySPeqR1fzmzEMpHTvyBgkmKiz8a+SIiPOm4KnwAXd8Yd/USLMM74eKt7pJUMEMC85iFvPhWhZTenPWmKMcMNiV/sO8saSpfeupWCzB3r7vSLYdFcBLJAvDK/P/TPssRJ1WF37DledVqgoQB45/1mI+ocxLvKOSYcRyjuyr3jrweXT91etmp7DFuvX+iNDyHB9uVdSgNZ7qCJBs0GOWWBXBqGKykxiXIY2ilk0QTp0w8jA67ldNHnAmC1RKI2YBXAhT3ZKXWeRfoMsvEQUrZK8tGZCCVfkWUzMeIdoNOWFgK8+fcKc3x37wlkeGHG/x1npvT7foJnlATSU0E3/1M3Jnuq2lQJxDywAqYUVlrGmoSFwFOoJNZWa6UxYSMsMOP2AHdfYPlw35lK+uWx23rgON9mZjgYGq9A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5657.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(7416002)(2616005)(956004)(54906003)(8936002)(66574015)(36756003)(1076003)(186003)(38100700002)(86362001)(6486002)(83380400001)(6916009)(5660300002)(38350700002)(66946007)(66476007)(66556008)(52116002)(7696005)(508600001)(6666004)(2906002)(316002)(4326008)(26005)(107886003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?bfQguKQD2memi9iXmH/JuXibAmng?= =?utf-8?q?VsdUAoarSfrnNRc9pbJbJRZfQYvNwGAHd4UvDSUG5PMj70dhKuC1aRS9/rMLF0BBU?= =?utf-8?q?YMfkhxPN4KggxbfUxmKuemiWIpNxjn9fqhNjFdnPUWegaTlBy16Nv4WiL7UsX7dFj?= =?utf-8?q?GVq57stdJk7gD2aeKQY6rpSB0fAd0iKnx0R6UPW68/G+KxNiDY0kNqiwGW5fCjNbA?= =?utf-8?q?LQTMPlLZl7wVXMU/IvangeMh2lLSEb+bPnGBfKFO0mKhp9eZdnpSFKMVb3OX4cSRj?= =?utf-8?q?zNWfADoKj2E94TrjBfDjpVGLiClaNTgJ/zxIQWz9vKtII4wd8r/sK1MsbzZnoGmqr?= =?utf-8?q?MYMuXlCR4d73OpgmejgF8SvXQozcJadqtCtVbgGR9VIdcAw9e08VDd1y2Ge1jfuuC?= =?utf-8?q?89muyu/+pOhvmlpPwT+mp6OhRU9WXjBkaRs06j87yx4htS0P/JCOKq0vTw5dtFr4M?= =?utf-8?q?18BCZIs2fqlOX94p0100J/Wj8mBKUwx8tsoIz2drcGgc9h7jQzqUlko+JP0W+5FAl?= =?utf-8?q?JeVmqUtysRCOiLodLsp1WylW3VA+793TK3cq/wl8RglOeEsYH8nOFEBlSZn428/wJ?= =?utf-8?q?PuQhJ7GitqS01lgjJig1PcEbr1Qpy3cgK3BV9pttKgJQkX0iH7rvNH2t5e5OuAROr?= =?utf-8?q?KlhCa2PU5o8vnvzquatQR+hQjRF8Bik/axXc0/3EPbtUJlVV+oafFaDcVyEUuDdpb?= =?utf-8?q?EL0aBt/4tuKarcTK8dAWDpblwdtX4dBaQwnZSv2vLJJyhpdgBKJLNFlHK0CQ+Ifnl?= =?utf-8?q?DYLhOinZdQh6tnm5cB/UOHOIUyMY2P/32TsAV5Evov/ouklKge98pPDHsRw2RR7nq?= =?utf-8?q?NuOIDA7oOHFQePMfKUX0YdR7Yqaa5yLF8vHevwvnZyYmS/A72qU02RSCsacvpnFe8?= =?utf-8?q?8wwyPZuuUhFTBB1wFoctDQK5yOxN/9moI6ZUuat/g7yk1AybcCuxsWSmDghMqp0/G?= =?utf-8?q?afWK4/ZuF0EKnOKKfSjHVgqBDVZMfz7YKkSVbbdLhv0a7MRpdVW0jlOmk9euKVhab?= =?utf-8?q?Ago+qNEGSPNyCzJsNngqAXPpVbxgm9uUez83czRyjWK3ixtbE9ePf+De2SJ/5vsnC?= =?utf-8?q?ux1xSvsY67W+2lejDobvNQZ5VZ1R4uRDLncRDpPHzNbhgM3e6ezYHXccTOHcTnWgK?= =?utf-8?q?YpovIG4uxjp3e3vqJxFjmmy2a20Y7cCH8zDYVvSxAUi0Yygo2InQBYcWLTcGlOd9R?= =?utf-8?q?9r9lqOGuAwO2u4I33SuLv8+8ZPmCMIsyJQ+9I2B1goYXJ91uYv5Q8ylDmJRdUo9tB?= =?utf-8?q?fqpNAqYWoFsZbuyo?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 616c63d9-9bef-48d1-0d39-08d98807acf0 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5657.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2021 13:54:39.9766 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: buk9LcPoYHGz1h94+K6fJUIcFMDriiQFb4OlJWQFplPAqve7QDTRTkAMYYoUL7WSEoIhrQIwBFofD6YmOk9TcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5643 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Signed-off-by: Jérôme Pouiller --- drivers/net/wireless/silabs/wfx/bus_spi.c | 307 ++++++++++++++++++++++ 1 file changed, 307 insertions(+) create mode 100644 drivers/net/wireless/silabs/wfx/bus_spi.c diff --git a/drivers/net/wireless/silabs/wfx/bus_spi.c b/drivers/net/wireless/silabs/wfx/bus_spi.c new file mode 100644 index 000000000000..26b1b1fdebd8 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/bus_spi.c @@ -0,0 +1,307 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * SPI interface. + * + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. + * Copyright (c) 2011, Sagrad Inc. + * Copyright (c) 2010, ST-Ericsson + */ +#include +#include +#include +#include +#include +#include +#include + +#include "bus.h" +#include "wfx.h" +#include "hwio.h" +#include "main.h" +#include "bh.h" + +#define SET_WRITE 0x7FFF /* usage: and operation */ +#define SET_READ 0x8000 /* usage: or operation */ + +static const struct wfx_platform_data pdata_wf200 = { + .file_fw = "wfm_wf200", + .file_pds = "wf200.pds", + .use_rising_clk = true, +}; + +static const struct wfx_platform_data pdata_brd4001a = { + .file_fw = "wfm_wf200", + .file_pds = "brd4001a.pds", + .use_rising_clk = true, +}; + +static const struct wfx_platform_data pdata_brd8022a = { + .file_fw = "wfm_wf200", + .file_pds = "brd8022a.pds", + .use_rising_clk = true, +}; + +static const struct wfx_platform_data pdata_brd8023a = { + .file_fw = "wfm_wf200", + .file_pds = "brd8023a.pds", + .use_rising_clk = true, +}; + +/* Legacy DT don't use it */ +static const struct wfx_platform_data pdata_wfx_spi = { + .file_fw = "wfm_wf200", + .file_pds = "wf200.pds", + .use_rising_clk = true, + .reset_inverted = true, +}; + +struct wfx_spi_priv { + struct spi_device *func; + struct wfx_dev *core; + struct gpio_desc *gpio_reset; + bool need_swab; +}; + +/* The chip reads 16bits of data at time and place them directly into (little + * endian) CPU register. So, the chip expects bytes order to be "B1 B0 B3 B2" + * (while LE is "B0 B1 B2 B3" and BE is "B3 B2 B1 B0") + * + * A little endian host with bits_per_word == 16 should do the right job + * natively. The code below to support big endian host and commonly used SPI + * 8bits. + */ +static int wfx_spi_copy_from_io(void *priv, unsigned int addr, + void *dst, size_t count) +{ + struct wfx_spi_priv *bus = priv; + u16 regaddr = (addr << 12) | (count / 2) | SET_READ; + struct spi_message m; + struct spi_transfer t_addr = { + .tx_buf = ®addr, + .len = sizeof(regaddr), + }; + struct spi_transfer t_msg = { + .rx_buf = dst, + .len = count, + }; + u16 *dst16 = dst; + int ret, i; + + WARN(count % 2, "buffer size must be a multiple of 2"); + + cpu_to_le16s(®addr); + if (bus->need_swab) + swab16s(®addr); + + spi_message_init(&m); + spi_message_add_tail(&t_addr, &m); + spi_message_add_tail(&t_msg, &m); + ret = spi_sync(bus->func, &m); + + if (bus->need_swab && addr == WFX_REG_CONFIG) + for (i = 0; i < count / 2; i++) + swab16s(&dst16[i]); + return ret; +} + +static int wfx_spi_copy_to_io(void *priv, unsigned int addr, + const void *src, size_t count) +{ + struct wfx_spi_priv *bus = priv; + u16 regaddr = (addr << 12) | (count / 2); + /* FIXME: use a bounce buffer */ + u16 *src16 = (void *)src; + int ret, i; + struct spi_message m; + struct spi_transfer t_addr = { + .tx_buf = ®addr, + .len = sizeof(regaddr), + }; + struct spi_transfer t_msg = { + .tx_buf = src, + .len = count, + }; + + WARN(count % 2, "buffer size must be a multiple of 2"); + WARN(regaddr & SET_READ, "bad addr or size overflow"); + + cpu_to_le16s(®addr); + + /* Register address and CONFIG content always use 16bit big endian + * ("BADC" order) + */ + if (bus->need_swab) + swab16s(®addr); + if (bus->need_swab && addr == WFX_REG_CONFIG) + for (i = 0; i < count / 2; i++) + swab16s(&src16[i]); + + spi_message_init(&m); + spi_message_add_tail(&t_addr, &m); + spi_message_add_tail(&t_msg, &m); + ret = spi_sync(bus->func, &m); + + if (bus->need_swab && addr == WFX_REG_CONFIG) + for (i = 0; i < count / 2; i++) + swab16s(&src16[i]); + return ret; +} + +static void wfx_spi_lock(void *priv) +{ +} + +static void wfx_spi_unlock(void *priv) +{ +} + +static irqreturn_t wfx_spi_irq_handler(int irq, void *priv) +{ + struct wfx_spi_priv *bus = priv; + + wfx_bh_request_rx(bus->core); + return IRQ_HANDLED; +} + +static int wfx_spi_irq_subscribe(void *priv) +{ + struct wfx_spi_priv *bus = priv; + u32 flags; + + flags = irq_get_trigger_type(bus->func->irq); + if (!flags) + flags = IRQF_TRIGGER_HIGH; + flags |= IRQF_ONESHOT; + return devm_request_threaded_irq(&bus->func->dev, bus->func->irq, NULL, + wfx_spi_irq_handler, IRQF_ONESHOT, + "wfx", bus); +} + +static int wfx_spi_irq_unsubscribe(void *priv) +{ + struct wfx_spi_priv *bus = priv; + + devm_free_irq(&bus->func->dev, bus->func->irq, bus); + return 0; +} + +static size_t wfx_spi_align_size(void *priv, size_t size) +{ + /* Most of SPI controllers avoid DMA if buffer size is not 32bit aligned + */ + return ALIGN(size, 4); +} + +static const struct wfx_hwbus_ops wfx_spi_hwbus_ops = { + .copy_from_io = wfx_spi_copy_from_io, + .copy_to_io = wfx_spi_copy_to_io, + .irq_subscribe = wfx_spi_irq_subscribe, + .irq_unsubscribe = wfx_spi_irq_unsubscribe, + .lock = wfx_spi_lock, + .unlock = wfx_spi_unlock, + .align_size = wfx_spi_align_size, +}; + +static int wfx_spi_probe(struct spi_device *func) +{ + struct wfx_platform_data *pdata; + struct wfx_spi_priv *bus; + int ret; + + if (!func->bits_per_word) + func->bits_per_word = 16; + ret = spi_setup(func); + if (ret) + return ret; + pdata = (struct wfx_platform_data *)spi_get_device_id(func)->driver_data; + if (!pdata) { + dev_err(&func->dev, "unable to retrieve driver data (please report)\n"); + return -ENODEV; + } + + /* Trace below is also displayed by spi_setup() if compiled with DEBUG */ + dev_dbg(&func->dev, "SPI params: CS=%d, mode=%d bits/word=%d speed=%d\n", + func->chip_select, func->mode, func->bits_per_word, + func->max_speed_hz); + if (func->bits_per_word != 16 && func->bits_per_word != 8) + dev_warn(&func->dev, "unusual bits/word value: %d\n", + func->bits_per_word); + if (func->max_speed_hz > 50000000) + dev_warn(&func->dev, "%dHz is a very high speed\n", + func->max_speed_hz); + + bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL); + if (!bus) + return -ENOMEM; + bus->func = func; + if (func->bits_per_word == 8 || IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) + bus->need_swab = true; + spi_set_drvdata(func, bus); + + bus->gpio_reset = devm_gpiod_get_optional(&func->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(bus->gpio_reset)) + return PTR_ERR(bus->gpio_reset); + if (!bus->gpio_reset) { + dev_warn(&func->dev, + "gpio reset is not defined, trying to load firmware anyway\n"); + } else { + gpiod_set_consumer_name(bus->gpio_reset, "wfx reset"); + if (pdata->reset_inverted) + gpiod_toggle_active_low(bus->gpio_reset); + gpiod_set_value_cansleep(bus->gpio_reset, 1); + usleep_range(100, 150); + gpiod_set_value_cansleep(bus->gpio_reset, 0); + usleep_range(2000, 2500); + } + + bus->core = wfx_init_common(&func->dev, pdata, &wfx_spi_hwbus_ops, bus); + if (!bus->core) + return -EIO; + + return wfx_probe(bus->core); +} + +static int wfx_spi_remove(struct spi_device *func) +{ + struct wfx_spi_priv *bus = spi_get_drvdata(func); + + wfx_release(bus->core); + return 0; +} + +/* For dynamic driver binding, kernel does not use OF to match driver. It only + * use modalias and modalias is a copy of 'compatible' DT node with vendor + * stripped. + */ +static const struct spi_device_id wfx_spi_id[] = { + { "wf200", (kernel_ulong_t)&pdata_wf200 }, + { "brd4001a", (kernel_ulong_t)&pdata_brd4001a }, + { "brd8022a", (kernel_ulong_t)&pdata_brd8022a }, + { "brd8023a", (kernel_ulong_t)&pdata_brd8023a }, + { "wfx-spi", (kernel_ulong_t)&pdata_wfx_spi }, + { }, +}; +MODULE_DEVICE_TABLE(spi, wfx_spi_id); + +#ifdef CONFIG_OF +static const struct of_device_id wfx_spi_of_match[] = { + { .compatible = "silabs,wf200", .data = &pdata_wf200 }, + { .compatible = "silabs,brd4001a", .data = &pdata_brd4001a }, + { .compatible = "silabs,brd8022a", .data = &pdata_brd8022a }, + { .compatible = "silabs,brd8023a", .data = &pdata_brd8023a }, + { .compatible = "silabs,wfx-spi", .data = &pdata_wfx_spi }, + { }, +}; +MODULE_DEVICE_TABLE(of, wfx_spi_of_match); +#endif + +struct spi_driver wfx_spi_driver = { + .driver = { + .name = "wfx-spi", + .of_match_table = of_match_ptr(wfx_spi_of_match), + }, + .id_table = wfx_spi_id, + .probe = wfx_spi_probe, + .remove = wfx_spi_remove, +};