From patchwork Tue Jan 11 17:14:07 2022 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: 12710125 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97992C433FE for ; Tue, 11 Jan 2022 17:15:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240668AbiAKRPp (ORCPT ); Tue, 11 Jan 2022 12:15:45 -0500 Received: from mail-mw2nam12on2061.outbound.protection.outlook.com ([40.107.244.61]:39649 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1343977AbiAKRPP (ORCPT ); Tue, 11 Jan 2022 12:15:15 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=McLO15sInIbLw5tbgnx1fGmDfAd481N95qwkIcJCxlmmyArPDPpNC7hY6UNRkeiZz+TpsjBGVCPN7Ij+o9a5iXKm8tRapVAtTUFEUX1YDmSInHtfIbopnBDm1zrCwYRv7X5O34BSWbPo/WttE+K1s4fh4gUqGNB5TWryWv8bzk/IL4MTlzgdaWyt5Do895SxX3p16FBGKEFkK8hWQLb38cDLGRPK98vDjOASr2YkHBK7mRDwbWgm2/tQdBOu90NrrL32Cyg8m+RnKb7j1xUvEr3OVAjeUgD3uhukfAARXyPeDA0I5hAwhN5rPvEgDPJiO1KOOqVQ7YIcJYRJXPVZiw== 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=d8LEXyL5xb1rEtqXTwZntz1tUdFOXbdlqgqU2/wWu+s=; b=INzUY/xnoJBD4sfajT6Ex19Ik2Odm+4STrdibC8ioFkxcXMn/83mBfOe1yD6qHN532p0rPofuU7dGS/nGV7lHqDyIeT44Eclj0jNgimscmS7bjkKvwozNfguSxDzR63kRa2oT3Uasd3B2yw3IsmfAjsA9zVHr+5Aod6vVKIM3+/Lvam71lH/CJDFd9i22JUI0myAzmW9Q7WsszmJh5rr/8ACNYSmHsy4I+08F77FN3aZPGUH6PABf1UsGHak5w/Acyj/JG/Na3LExtFoRn5IhnKTzF+qQX7lP53RJXgmP8+RDpWWH8ckQ3hDY7xnhCa3UrucWXtVWGADKv4FUH3kqQ== 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=d8LEXyL5xb1rEtqXTwZntz1tUdFOXbdlqgqU2/wWu+s=; b=LdqD7XazfNcfO/WYo3M8RfDnRuaLNMyt2PjVh6h+WOEtsPU4WQtWs1N/NeqEV4p1/e30V8/xFhMpbXMlcpegON8PNRLSBt5yJlEOdkKKhdS9xSjzofWY5b3BdMcG32HPtBs+20HDtRrMnl+FrLmzdU05prXcIJhbk0VJ5FP3/t0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silabs.com; Received: from PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) by PH0PR11MB5595.namprd11.prod.outlook.com (2603:10b6:510:e5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.7; Tue, 11 Jan 2022 17:15:04 +0000 Received: from PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::d031:da9e:71a:73e4]) by PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::d031:da9e:71a:73e4%6]) with mapi id 15.20.4867.012; Tue, 11 Jan 2022 17:15:04 +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 v9 07/24] wfx: add bus_spi.c Date: Tue, 11 Jan 2022 18:14:07 +0100 Message-Id: <20220111171424.862764-8-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220111171424.862764-1-Jerome.Pouiller@silabs.com> References: <20220111171424.862764-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: SN1PR12CA0099.namprd12.prod.outlook.com (2603:10b6:802:21::34) To PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 64ad4d96-ccd0-4b54-5cb0-08d9d525e899 X-MS-TrafficTypeDiagnostic: PH0PR11MB5595:EE_ 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: NLTjy/LOAAKXhKDoHIk/Id2ageizBADKuqyhvyACJ5j1oC9gXNN0U5xMIXDedbPd5UOKJeRmaaliMMu5/dhTPhqEvG8xfQxNJVk7naI6jERW3yDVjFF6t9E3nHR4UVvsCeJmImHVPGaHNB20Py6IoQnxfOIieiIJ4PQ6lihKOPgwp3DXNLhaev/X5jO/vYDAEGKi345HwHKsSHsAq+soZRnZFac+GHEh6dITdj1TvQ11/3bxCAMxf3MQ84NZgPLViOrPUiDMZ7PI0+fkV3EDTZNMg7j8QpcmIBb2vD5FzvKC4BdoutbpWsIEyM60FJUDh2VO+74dttX8/0MPEeBRA5Q+NY4Zc8JgSLOB0HzVgDrcB4a1WNYPVYRBk2Ma2N2SnKDJpcVjjGSnlQYmskkjfX33yTQ+WlqIYOTJIuoEzIfPYBuCmOqbTJdnN1WZ5IYqU/vWF+erwlsWEpaWjb61LGFIG8aUumcV07/R/PdRychnK3qcIuQJBRZ4wFq9SqIvaprhUzwYVvUHI3lKES+sBKoBjibex2rvJO3Iim2tbxykoU4VLn3jRgW2q7AHScfhY6BGj76qt236E7W9WhmKvkSCpovm89QH+SnO+Gxlp6dXIfmJGuqB28cd+MZb80/utBTMMaVqvwRGAJPd/3nn0g== 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)(36756003)(66946007)(6512007)(2906002)(107886003)(66574015)(8936002)(2616005)(7416002)(38100700002)(6506007)(4326008)(66476007)(8676002)(54906003)(6916009)(316002)(66556008)(83380400001)(52116002)(86362001)(186003)(5660300002)(6486002)(508600001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?+qpOEdu5V5xNBT5nGpH6n3UkuHo5?= =?utf-8?q?+kIkN7v9AeF0cDE3DrhKA45LAkeh6Roq8YfOn6+X06AIcC5NNmRtaZQ6xDEjzSrOI?= =?utf-8?q?48ibU+OE5s7/3p0PxdnLS0E578FtqjePvP03V99ObiykVX79juZFrsIZ18rIe6qbA?= =?utf-8?q?LNHArVgz6xJkn+q1y/16u9auIkLi7RPM0uKzQeq4vQhc8PjA8M/Fxyq4AceGM+pde?= =?utf-8?q?MI4GM09cn5JutoDYOFnqybY7AN1nTm0YSMfudfF8+vAKc6qg95r74C482PJr3WcC8?= =?utf-8?q?dyk9EXKk7Cy1PfKT2DJbJOCs5MyEh1F9Vk84U38xoT49eJ41cx1f/MYZo2jvPvPfy?= =?utf-8?q?T6s7aa8g/ebBANRSnjtsMojqZHCe3jJ3aWhNP/3NmvmpwyEoRHOkRX+Wo7sHHgdD6?= =?utf-8?q?iABFS7JlsmZtNxgzrbeNXZwK6ODJiGPu3Jq2U83Mos7y/51MSyQYkMD7yzY9nx5Gg?= =?utf-8?q?0IAIT4hpM0C3Fjq0HyC2ARak+ow09uquZ37LV+d7Qpydosu+MR6DGi6DjanBFc+Bx?= =?utf-8?q?RvytTCR+kT/L6zztQu2Izxl83l1BK5xswk24fJ0i8rhdQ36/DZjYHr9cXbizOwruK?= =?utf-8?q?2x+EyW8QLgB71Ds1Ivck/ljXHMt06Q+9tVDbUy+nhFZyFHDBZaldqMdwOucwimQf4?= =?utf-8?q?gYSZPjmvQwhPNf+ccDylajzGyGwfhK0Szh3aLXVyRiL7iQwUMBaL+eyazNG8+v1qv?= =?utf-8?q?8+bIMVU0bkZftTMpJIY0HF5dqsKEXtmsKnk3GFnvcZGWCs50xMR2+TrW2zl50GTvE?= =?utf-8?q?qmgu4Mpx6MuioIbJg8KdXVu9u2Qlxj3t59PoXZPtS6AsIgAaJJz0vpyKABJBega2W?= =?utf-8?q?e5J2dXDkEgOL1xaD6sP5hFOVyn7WD/N77zClo95eRJvqoPRmIH/X9BgEt6n0Bzcbd?= =?utf-8?q?kMGDQzqxn+qktwHGhD7YYWmrFSijI1/22Rr7uLst6p0Tk2cg5zqNHenew8plo7GEu?= =?utf-8?q?kWt/YR/hj3MqexpxWkekVpsEOIn1a058aOuwHMt0L9MfVzFqB7n4JUxc5o1t2JvJ/?= =?utf-8?q?Kw8KNPwI8BhPuUml1G5R4781cjm138vL2PDxWwCE39l6uzA2NIWFvBQtzQ7BBY2P0?= =?utf-8?q?S1/Z2v8zCNxGBWaaBYHnB22uJiGuXonL+7/98bI0JMEMwIraXz/NJT1Z79flDwpBy?= =?utf-8?q?MxmPCWznVgr1shhomwtawwxXKkhu2Z07CmS/NEQ7Njvn14fs2ew0OlDXhXLmx6NFH?= =?utf-8?q?bGL/VEOhl6wT7bNaPhgc2Aj7s6UPhJFc5Vq+Qafw++0SKgZYQo5CsA23U6iIva+sv?= =?utf-8?q?O0KjVF0aTXzqmVAWSqGXsmaHnxVnLIFF0DFmeHc5UjA46oJV6gIhesoq9U+hel/g4?= =?utf-8?q?4sQViUv6Apmu6be5kt9+togO/trHK6zaR4DmddrY5+eg4F4I6OMZRJy26I2UOSnzh?= =?utf-8?q?OHNVoKctkK/YFgjI3IetM9wP7897KSaBqH2AL9PgC5ak2DRaK3kGLepQ9a/CeB0ws?= =?utf-8?q?Voo7XdXzvIIHS04adtLsWl00K/fOU2qOvkzXHw0fp01fPMhbqP5SYHiIDWTAmORUo?= =?utf-8?q?SnGeNIVkyjVahM6anEEb5PsT0bRz5EdkfmGi+a+96QFYrF5JpZZ8Gzd8B8dV4FgR6?= =?utf-8?q?DDeFhHCpsiXWF8+wVYO7l5CDYXS6PPKIVtLVBThHRSfiWXcrunXCR4=3D?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64ad4d96-ccd0-4b54-5cb0-08d9d525e899 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5657.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2022 17:15:04.4381 (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: 395U7OsM9RiKEKS8QiCuVQZi7m5oOi2WY8gGgiLQ0ALb0ByK+NgWsMHuitdGLxkltSbcxzQTp7yc0X+dF6Kshg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5595 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 | 297 ++++++++++++++++++++++ 1 file changed, 297 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..6b4f9fff8b44 --- /dev/null +++ b/drivers/net/wireless/silabs/wfx/bus_spi.c @@ -0,0 +1,297 @@ +// 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 = "wfx/wfm_wf200", + .file_pds = "wfx/wf200.pds", + .use_rising_clk = true, +}; + +static const struct wfx_platform_data pdata_brd4001a = { + .file_fw = "wfx/wfm_wf200", + .file_pds = "wfx/brd4001a.pds", + .use_rising_clk = true, +}; + +static const struct wfx_platform_data pdata_brd8022a = { + .file_fw = "wfx/wfm_wf200", + .file_pds = "wfx/brd8022a.pds", + .use_rising_clk = true, +}; + +static const struct wfx_platform_data pdata_brd8023a = { + .file_fw = "wfx/wfm_wf200", + .file_pds = "wfx/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" }, + { .compatible = "silabs,brd4001a" }, + { .compatible = "silabs,brd8022a" }, + { .compatible = "silabs,brd8023a" }, + { .compatible = "silabs,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, +};