From patchwork Tue Aug 20 10:42:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Md Sadre Alam X-Patchwork-Id: 13769915 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D729518CC1F; Tue, 20 Aug 2024 10:43:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724150613; cv=none; b=dmGUAkdAdU9eyINeXNVOncwcw6wrPafG0GBIMDeMw6VUohbdm/Ef/OUlJo9l1vpVy8ZzOp7XgW+24H3eFJ+YgzvjfpOJDDJPsKHNQtisoEmDRtuuugps1FLwYEI2yb0rLeg+zyZv5rZYGZ3pkOZHOvmR0fC+lfiJPiSi5K32QME= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724150613; c=relaxed/simple; bh=kklbFG6mO3x3q/fuoB1swtpPlgX63c3VRGcyTkdXUa8=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=ASyQkdgkWLjhmNrgQbZU9/naztQOVNJ6ZEkONfLIorHb0+AcaSvu7HQj7u/UxopV0/eDrDlkfXNeMxBf+kfTQTA4bca4pIgYRU/j540hrfHClRBAVs2plEdZXWTSqAO+mUe6fH2/8kFmR7lqUteM8gt86/d6eGD9or4hMp3iBI4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=SK9nKNq1; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="SK9nKNq1" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47K7Bmnw019356; Tue, 20 Aug 2024 10:42:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=Ws2OI5JtKlKDH5Gm57dHFO eCu4MHt4lrEht93hnZ5F8=; b=SK9nKNq102mubTNqJ7LlQ58ljPJe9uyWob9Wme 6dWFQYYDI9J5MbQn6Lhfd8ipkywvKmTs8xEhgIj66XCqHjkq1tUWpCvtlO6XzumD pREcUhnm4TLETvT4YPW1m30ZDXZI1u5eaBMw5Lo/9rqbToc3gypKxSEUfuoGMHxU pUAsVpMGy03xFsO9OojBdk1m4MXHeSqUtOJsLtDtArus0b7qahn1hGYuNw0d9AfH WQsG88lWydpM9U3WsGJCMo+79T1+T6n/28729By6hK1CjfghG65LtnxJmtdzELjo ZXZzsx8REC31sdz4omOnbtuQWAMS9GEW5bCF9YnyNJc3GwnA== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 414phv8nqx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Aug 2024 10:42:58 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 47KAgwc6023233 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Aug 2024 10:42:58 GMT Received: from hu-mdalam-blr.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 20 Aug 2024 03:42:53 -0700 From: Md Sadre Alam To: , , , , , , , , , , , , , , , Subject: [PATCH v8 0/8] Add QPIC SPI NAND driver Date: Tue, 20 Aug 2024 16:12:31 +0530 Message-ID: <20240820104239.1774600-1-quic_mdalam@quicinc.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: cLlzMHxZWl4HAxp7V-h0wfJhjfNp8lXo X-Proofpoint-GUID: cLlzMHxZWl4HAxp7V-h0wfJhjfNp8lXo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-20_09,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 bulkscore=0 suspectscore=0 phishscore=0 lowpriorityscore=0 clxscore=1011 adultscore=0 mlxlogscore=697 spamscore=0 mlxscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408200079 v8: * Fixed compilation warning reported by kernel test robot * Added "chip" description in nandc_set_read_loc_first() * Added "chip" description" in nandc_set_read_loc_last() * Changed data type of read_location0, read_location1, read_location2, read_location3, addr0, addr1, cmd, cfg0, cfg1, ecc_bch_cfg, ecc_buf_cfg, clrflashstatus, clrreadstatus, orig_cmd1, orig_vld to __le32 to fix compilation warning. * Included bitfield.h header file in spi-qpic-snand.c to fix compilation warning * Removed unused variable "steps" variable from qcom_spi_ecc_init_ctx_pipelined() v7: * Added read_oob() and write_oob() api * Added FIELD_PREP() in spi init * Made CONFIG_SPI_QPIC_SNAND and CONFIG_MTD_NAND_QCOM as bool type * Removed offset 0 in oob_ecc() layout * Handled multiple error condition v6: * Added FIELD_PREP() and GENMASK() macro * Added qpic_spi_nand{..} structure for spi nand realted variables * Made qpic_common.c slectable based on either CONFIG_MTD_NAND_QCOM or CONFIG_SPI_QPIC_SNAND * Removed rawnand.h from qpic-common.h * Removed partitions.h and rawnand.h form spi-qpic-snand.c * Added qcom_nand_unalloc() in remove() v5: * Fixes nandbiterr issue * Added raw_read() and raw_write() API * Added qcom_ prefix to all the common API * Removed register indirection * Following tests for SPI-NAND devices passed - mtd_oobtest - mtd_pagetest - mtd_readtest - mtd_speedtest - mtd_stresstest - mtd_subpagetest - mtd_nandbiterrs - nandtest - nanddump - nandwrite - nandbiterr -i - mtd erase - mtd write - dd - hexddump v4: * In this patch series fixes kernel doc for all the cmmon api * Also fixes dm-binding commit message * Fix qpic_common.c compilation based on config v3: * In this patch series fixes multiple things like added clock-name, added _alloc_controller api instead of alloc_master, made common apis more generic etc. * Addressed all the comment from v2 patch series v2: * https://lore.kernel.org/linux-arm-msm/20240215134856.1313239-1-quic_mdalam@quicinc.com/ * In this series of patchs we have added basic working QPIC SPI NAND driver with READ, WRITE, ERASE etc functionality * Addressed all the comments given in RFC [v1] patch v1: * https://lore.kernel.org/linux-arm-msm/20231031120307.1600689-1-quic_mdalam@quicinc.com/ * Initial set of patches for handling QPIC SPI NAND. Md Sadre Alam (8): spi: dt-bindings: Introduce qcom,spi-qpic-snand mtd: rawnand: qcom: cleanup qcom_nandc driver mtd: rawnand: qcom: Add qcom prefix to common api mtd: nand: Add qpic_common API file mtd: rawnand: qcom: use FIELD_PREP and GENMASK spi: spi-qpic: add driver for QCOM SPI NAND flash Interface arm64: dts: qcom: ipq9574: Add SPI nand support arm64: dts: qcom: ipq9574: Disable eMMC node .../bindings/spi/qcom,spi-qpic-snand.yaml | 83 + .../boot/dts/qcom/ipq9574-rdp-common.dtsi | 43 + arch/arm64/boot/dts/qcom/ipq9574-rdp433.dts | 2 +- arch/arm64/boot/dts/qcom/ipq9574.dtsi | 27 + drivers/mtd/nand/Makefile | 7 + drivers/mtd/nand/qpic_common.c | 738 +++++++ drivers/mtd/nand/raw/Kconfig | 2 +- drivers/mtd/nand/raw/qcom_nandc.c | 1730 +++-------------- drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/spi-qpic-snand.c | 1637 ++++++++++++++++ include/linux/mtd/nand-qpic-common.h | 482 +++++ 12 files changed, 3331 insertions(+), 1429 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/qcom,spi-qpic-snand.yaml create mode 100644 drivers/mtd/nand/qpic_common.c create mode 100644 drivers/spi/spi-qpic-snand.c create mode 100644 include/linux/mtd/nand-qpic-common.h