Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1459283ybj; Fri, 8 May 2020 01:40:41 -0700 (PDT) X-Google-Smtp-Source: APiQypLIiD0rwhW1vg78jlE+Tr01t4/Z67vPHxqFU+jqG5kLn5G2eNAXce4q03mfDHOu7kR7kVys X-Received: by 2002:aa7:cd01:: with SMTP id b1mr1187121edw.163.1588927241667; Fri, 08 May 2020 01:40:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588927241; cv=none; d=google.com; s=arc-20160816; b=GljOqBu/VMWuvCrtk9gjAxcOn3PMee5jauRjCbjEm3H7LOZoRcPr6Mpm9rBV0IxI7s w2OTnRPbHLSaJmb84mCMT/MKIomPMFSwM+YRLIT2mOX5un0AG4imK49J1Lsd4loao0G3 +zdyCu7S4Nj6bFRaJ97ZavoSV9k96OHQQWYGY0eXVw8zHoblPHvW/25xz2FaUJLDFtwy RoChiJJKeWxqrPi36FFvmMSu8pPrXbjkIOsH/MGKZ0LIyY3RSYjGIXhpM2PxZW4bhHEU 1LTMSv11b9iCKmK4lHcbcHoeYRSkUhjVvckMHYLQk/JMU8x9UCsDAgOaQCVoroLE2xvm yqCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=deNLsgNL2ReQNtS15m4E5hkYP817V3+gzkebt2Tr9mE=; b=dgEWV4HjxYON/unL/v2NALO088jjiAW39D2Zi6lhB1ofS1+cqCo5P1i9kuajK6XKdR N2GrXU6twuk1UtvFrSk2tYaBQ1QVFCphC39L2CUbR13p9OnHD1jrFI/TBeuigZNZcsbK Ics3K7z2GJM3g27eA0lTQTM3eJ5kt6QSCfSdHN5zCYtROrvGEsLwzoPlFkVu7ZVLj3AF 2WnrDkRJaZlN9Eaa8FulGjcQz+K/2hmgoJf2KEJmVFrFfOE7oG6/P2FtojmU0KLqejr7 ubnxZqNjJbMQI7UMMLXIH1TrOKwy1nQVtNjIFz9bq1EcU9VUlbaN/6a8+PPz0qy2SBge 4bdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g24si594836ejw.241.2020.05.08.01.40.18; Fri, 08 May 2020 01:40:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726756AbgEHIih (ORCPT + 99 others); Fri, 8 May 2020 04:38:37 -0400 Received: from server-x.ipv4.hkg02.ds.network ([27.111.83.178]:47746 "EHLO mail.gtsys.com.hk" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1726598AbgEHIih (ORCPT ); Fri, 8 May 2020 04:38:37 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.gtsys.com.hk (Postfix) with ESMTP id 8BAF520024AB; Fri, 8 May 2020 16:38:34 +0800 (HKT) X-Virus-Scanned: Debian amavisd-new at gtsys.com.hk Received: from mail.gtsys.com.hk ([127.0.0.1]) by localhost (mail.gtsys.com.hk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LeJQaVGZ0PTG; Fri, 8 May 2020 16:38:34 +0800 (HKT) Received: from s01.gtsys.com.hk (unknown [10.128.4.2]) by mail.gtsys.com.hk (Postfix) with ESMTP id 6A8CC20020CB; Fri, 8 May 2020 16:38:34 +0800 (HKT) Received: from armhf2.gtsys.com.hk (unknown [10.128.4.15]) by s01.gtsys.com.hk (Postfix) with ESMTP id 5D4DBC019F9; Fri, 8 May 2020 16:38:34 +0800 (HKT) Received: by armhf2.gtsys.com.hk (Postfix, from userid 1000) id 385EB201641; Fri, 8 May 2020 16:38:34 +0800 (HKT) From: Chris Ruehl To: Chris Ruehl , Jack Lo Cc: Mark Brown , Heiko Stuebner , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v0] spi: spi-rockchip spi slave mode Date: Fri, 8 May 2020 16:37:28 +0800 Message-Id: <20200508083729.5560-1-chris.ruehl@gtsys.com.hk> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver spi-rockchip does not support spi slave mode, but the register map has an entry indicate that the chip support it. An example implementation found here: https://dev.t-firefly.com/thread-101485-1-1.html The patch is my first approach to support slave mode which is needed in one of our projects, the PCBA is not yet available but we think to have it for testing very soon. Yes, the code in the patch isn't tested yet. I found it odd, that the num_chipselect is set fixed to the amount of native chip-select lines rather use the max_native_cs. Changed it. - master->num_chipselect = ROCKCHIP_SPI_MAX_CS_NUM; + of_property_read_u32(np, "num-cs", &num_cs); + master->num_chipselect = num_cs; + master->max_native_cs = ROCKCHIP_SPI_MAX_CS_NUM; That ask to enable cs_gpiods, and support gpio cs + master->use_gpio_descriptors = true; Patch against next-20200505 Thanks for review! Happy hacking Chris Signed-off-by: Chris Ruehl ---