From patchwork Tue Dec 6 22:54:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Xu X-Patchwork-Id: 13066325 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 BE711C3A5A7 for ; Tue, 6 Dec 2022 22:54:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229507AbiLFWyg (ORCPT ); Tue, 6 Dec 2022 17:54:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbiLFWyf (ORCPT ); Tue, 6 Dec 2022 17:54:35 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2072.outbound.protection.outlook.com [40.107.20.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BF9A4A060; Tue, 6 Dec 2022 14:54:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iM/sm7qUjU5jUgs/7DL+rIfGzFVGAjx0TL2cUfnVu+X88twbYN2AzBw1tEkOIiJSuoAEAOFvSYMfkI5eVzXSF2Sd9JH/P5Cd6DrDStUJk0jgQCprAfFCJPvwvb3PP0ylm4c/LUnSY/HsJJr0Opkaa8wvVk21P+vk0gayxbCc+FY4886u6VK8w0tMiQeN6KpKyvowXLo5KLpUA0DnQNkep2G4W/LRWZSzAQxS2DEb1Htu4cJ4Weas1GYhXeCHs07IyA4rC4OAadxLCYFZw44tQCoe2uqp4rqwE8Ooi9VeEOpRp7KX+hfgERtd3idiWsIceOQ9yWgW0MGBiVmINN5HGw== 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=IcK5aA850YMuuBztijnk1NO/u6DVdhGVehdDYsNuDbM=; b=VO457gjZq3Bm/Q5laqFvFVcwY+1s1AIomSam8lAKGyUcMQkx4/luPOtD0tcdqQFabkOSxNJXXO1AhsrggvY5kPNeTGBLz45MZ/jXXbJeX4eBI0weRoeUQQB0IE85BstTrk8IIsGWUuSAa90bIBPRznVg5MxAZ+6G4/XlWk224XiV18VnYuYetMC1UAzdjknmp02VXKyWBWGjzKHv7xbtihD17xFWjyL6Ds2y+AMPFS7Lg26BnWn48ygXRfwYr/FV49bXYolZfU5w7Ming+UY6wPKc80tI6ktB3h6+yyQAfZ/xb2rfWPJUYhay0ql/nls8MdPVKOZ93Jkm8ULLkB01g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IcK5aA850YMuuBztijnk1NO/u6DVdhGVehdDYsNuDbM=; b=CfP0F6QEcOFXp58nD603Phx3Mi5eaZ4ig7ZPRBssRid21MdAOcNCbHPo7vtP6wMQRF47wAbZ3SjPkFmZxI57Ofc5KDE8iAxvpZtykn1GZ705gmN+/PsvYC2XObfWcJn/a23Nd6oAR0ScwpoUgmWwoZaeUUk424oqjAJpnbKzzIo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9071.eurprd04.prod.outlook.com (2603:10a6:150:22::11) by PA4PR04MB9318.eurprd04.prod.outlook.com (2603:10a6:102:2a5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Tue, 6 Dec 2022 22:54:31 +0000 Received: from GV1PR04MB9071.eurprd04.prod.outlook.com ([fe80::ef72:e2bf:2ff6:a953]) by GV1PR04MB9071.eurprd04.prod.outlook.com ([fe80::ef72:e2bf:2ff6:a953%6]) with mapi id 15.20.5880.014; Tue, 6 Dec 2022 22:54:30 +0000 From: Han Xu To: broonie@kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: han.xu@nxp.com Subject: [PATCH 1/2] spi: spi-fsl-lpspi: support multiple cs for lpspi Date: Tue, 6 Dec 2022 16:54:09 -0600 Message-Id: <20221206225410.604482-1-han.xu@nxp.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: BY5PR13CA0001.namprd13.prod.outlook.com (2603:10b6:a03:180::14) To GV1PR04MB9071.eurprd04.prod.outlook.com (2603:10a6:150:22::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR04MB9071:EE_|PA4PR04MB9318:EE_ X-MS-Office365-Filtering-Correlation-Id: 68c5b404-7b6c-44e0-26f7-08dad7dcd404 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NFHwy08r6co9wmz3hC3IoOSYO8t0Xs7p6Lnxks7EcgtcmJ71qQftNuJU5CddolUhNSx0zqIxOyYh3I0NDYXmRDfIhvrwqRGYYzowubP8I2jaUqe6RufN73UTpyijVyifBlOAow+WG2M5O4Sy7wvcQ7aJcl95Kwpy1/r+rtQoaWLat3RECAyWB+EXhjWEXs44k0zolrnOz0IgOQf7OWOJHAqN/ExO6dYm7RDfNqQvkoYmIJdKbod9KuZzdcNgOmMngcodR96AJJKajp4ycWBgDAbYzR8o7rNEVDlP6KAHM4rGD3qcNrogBSScruGgS5zZAdGuhe+DzT3YXsfnDINsn8tMOGindxEOC71z7mXAFLZ5pojK8tx/JMPM94eC63yl7Vum06Ci6t7YzfGyJBrNxuL+Dk/qFa18ld1OH9fKFVpDcyOjEFTrnQaNkCKvJGL+HN9A3W1BldYm32JA+9DBZ/t/DkP4AxpAXDr93JSUA1FKiQH52lmYRVJSCGGtQj3Mx8PhMik7k1agOxFzp9QyFHKQoZblmUOeGqp8qEzKdsJexka2ezYFrGSplpZfQZ3VfFlK3NF2EIjMOEvrObEUiH98W4ghP5TqXy1bcEbuOAMyCYwnXpZxi0g/02YIcaHZuBjfhze6pNjQSsLW2SJF8danLpP0icy/ZPXm79Rw8K3JKRUIYuyx3EJ146k5ei7T9/rmQAnSrsU0H1g/eUo3EQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9071.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(136003)(376002)(39860400002)(396003)(366004)(451199015)(38100700002)(38350700002)(86362001)(8936002)(44832011)(5660300002)(4326008)(2906002)(41300700001)(478600001)(8676002)(26005)(6506007)(52116002)(1076003)(186003)(6512007)(6666004)(316002)(2616005)(66556008)(66476007)(6486002)(66946007)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: N+ELHZ/eiwzxEUcod6xrsQTgLj3bUK0Vj4vU66nuHHssZz2qdgs7qnNFUKOd6jNEUbBBNOjzAPwucC1FNrJ/ZBLUdtLWbGGnlyRQG97dqVqf8QRpH1Mhr99i/sRBb0OGGWmfzD7YtD9ccNi9RgMOTV9gQeVIK7vBO9nDpIk9MCGiCvHiKY9g1Ym1lkR6BUYwk3H2eqmev/HIu73NqOtzFqEjqwSFN+ZoyUmMQVKXiyWIp/NWqCKeRj23PgBYKVc9rJmGJG5Qh2H/116YhgS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UXdfJuYHdlaROB8LjD9zxLZJt1wbcwyzeTyW0Qwbf7Mmh/3uo4FEwIOkKTDaxVChGBl3Mh1pLGbgw+bb+PvupA0DwiS/vhqWLk3G+VjCK4RNgrWpd5fAteS5BGhOJLY3m2eJ63KOyc/By/7U6zHMGgrF1b8T7+ZyGUxqqbHXXfdimsz7JVLlUBxGcJVkpOxShE+GvRkMVJuwHsGtpdrx7Igkfk4pUa+CRc= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68c5b404-7b6c-44e0-26f7-08dad7dcd404 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9071.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 22:54:30.8144 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: D8LUH0qgunR6xqFFAN0cKEn8hB+R85XI2HqAht5YOyVRi4AY5pt4uSU92HVZCLwm X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9318 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org support to get chip select number from DT file. Signed-off-by: Han Xu --- drivers/spi/spi-fsl-lpspi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index 6454b88c31fe..7f0562ed4d09 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -98,6 +98,7 @@ struct fsl_lpspi_data { struct clk *clk_ipg; struct clk *clk_per; bool is_slave; + u32 num_cs; bool is_only_cs1; bool is_first_byte; @@ -850,6 +851,9 @@ static int fsl_lpspi_probe(struct platform_device *pdev) fsl_lpspi->is_slave = is_slave; fsl_lpspi->is_only_cs1 = of_property_read_bool((&pdev->dev)->of_node, "fsl,spi-only-use-cs1-sel"); + if (of_property_read_u32((&pdev->dev)->of_node, "num-cs", + &fsl_lpspi->num_cs)) + fsl_lpspi->num_cs = 1; controller->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32); controller->transfer_one = fsl_lpspi_transfer_one; @@ -859,6 +863,7 @@ static int fsl_lpspi_probe(struct platform_device *pdev) controller->flags = SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX; controller->dev.of_node = pdev->dev.of_node; controller->bus_num = pdev->id; + controller->num_chipselect = fsl_lpspi->num_cs; controller->slave_abort = fsl_lpspi_slave_abort; if (!fsl_lpspi->is_slave) controller->use_gpio_descriptors = true;