From patchwork Wed Apr 17 10:54:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 789720 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 08D7613C80B; Wed, 17 Apr 2024 11:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351826; cv=none; b=Qrb+8cgSnuny1PdC6vOWQuhGGl4GFh97OXJXf5eXX1RoQWRDSM9oY3zHejtnXxczHtySGyu1lf9ed3E5ucCmo4S1z1l9ruATPQARcXizpaPqEFejT8T8N2tsXKvxauQ04T8/OyBdg4Mv3Dj8VEBRMaL3KZIZ/bd5eO0AHIMblj8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351826; c=relaxed/simple; bh=Vq5PKqs9ah/OwO8gQhBqXkVQsO/11Ccf4mxzPDr98VU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bprhYRgO4bxoZlISeSfIFB9e1oSp9bR2ZvOzdGlXrGtQMdbH1Jmpvv7VGH1lsrUtTtUHJsrfIp+ZMv0HTStYjyGZJJHbJdf5uLOqMeovKXFvHauvL5kywtzt8qCcEJPjVl2bi4NyusQb7nIC67QhsAuB6arr6dj5zfjvJYMLdUA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=F520NppO; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="F520NppO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713351824; x=1744887824; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Vq5PKqs9ah/OwO8gQhBqXkVQsO/11Ccf4mxzPDr98VU=; b=F520NppOW02iE8jTGCSSM7FshVaCZKTIBQDpFXgV3ES+xclShaS7JrvV mYMirhbpI0lDAd+bCSAsSy2FmZHsBgBnvQYDNNl+6Uk/N5TQtjlQb2g5K +uRwqegcBmiWqMTUcD0X7e3et7UR9bm+c5VpCtMc9KkzWUucvW6DdUqKZ 42zhh3zVxKRkrsKI8AqBCpUxQ7TFYU9Fokc7FMK6L3TzV6lms6/1PHkep Qr7XDtpL4gSGEH6dZc1QX5vA7ga9UYUP47heGAfMQ/nIY9R1Zj67fUOL6 VcfEmJ/3X+UvqWALwv0tj90uqfnMAEy8HlJsL7STYsXw1UV3jn0nzkREr g==; X-CSE-ConnectionGUID: 2Ud1LrFXRr+iu+uUPXPR2w== X-CSE-MsgGUID: VIyvxnj9ReKG/HfWYQXFXg== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="8698114" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="8698114" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 04:03:40 -0700 X-CSE-ConnectionGUID: 3Ibp+FXhRzya5MRcf5MVig== X-CSE-MsgGUID: zvXo1qisReSOzfHnmLrEpw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="27380694" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 17 Apr 2024 04:03:37 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5678021A; Wed, 17 Apr 2024 14:03:36 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v3 1/9] spi: pxa2xx: Allow number of chip select pins to be read from property Date: Wed, 17 Apr 2024 13:54:28 +0300 Message-ID: <20240417110334.2671228-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> References: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In some cases the number of the chip select pins might come from the device property. Allow driver to use it. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- drivers/spi/spi-pxa2xx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 2f60b2fde8d5..ab6fd55237cd 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1357,6 +1357,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) struct ssp_device *ssp = NULL; const void *match; bool is_lpss_priv; + u32 num_cs = 1; int status; is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); @@ -1395,8 +1396,11 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) pdata->dma_filter = pxa2xx_spi_idma_filter; } + /* Read number of chip select pins, if provided */ + device_property_read_u32(dev, "num-cs", &num_cs); + + pdata->num_chipselect = num_cs; pdata->is_target = device_property_read_bool(dev, "spi-slave"); - pdata->num_chipselect = 1; pdata->enable_dma = true; pdata->dma_burst_size = 1; From patchwork Wed Apr 17 10:54:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 791169 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 DD8D913C8E6; Wed, 17 Apr 2024 11:03:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351831; cv=none; b=btGUqtXXjL7MZL5Pj3nDfaolTFNd+WpmmEMU38pk3u3V//o9ceS45Tv2zlqDJ/2DLu2UZ02SuIM9Hg8lt+mBRyW6IvII/SZciyLQEZdLnQ6N2yv2HEv5Y9QsyZeMoxeYnLe0jl+tm1x+kjLE2J3Wnl94cnSxuoqbveCGtEDw3HI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351831; c=relaxed/simple; bh=7sawocPjOagJUQ2+8wxEYpmTin9d1vFp3+a7/mwIYfc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G62PIwtNb1LARIY0SgQ8yYokkfpEXlO9PfljIj6CpvcU+uCPUM88K3FXAWi8fxbcpWlJqlW+LBFcQYuleQgIJf+3mTlkKqNB0P8YA4czf/6medY4vRfL8ZqqtyRnzo829ncEmtFxFxUilR2UqNr3HQolqSjVTzJzFO2dzBkVpMI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=C0sZTOY1; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="C0sZTOY1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713351827; x=1744887827; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7sawocPjOagJUQ2+8wxEYpmTin9d1vFp3+a7/mwIYfc=; b=C0sZTOY1/JUvfgi8bASZRU/le36jk/j5mQBG7xYNl0T0u5nBY0kPJlCD bx4zFMbM9NGBvlCnHt57RUx30VZfiuLe1rvjMeHqIqEI/QRKxEMkoVo8Z g+sgDffq5HiztoPQ45ad0/ePziqWV7KGiHGXJAN524jzeP8SZMh1zfsbD hUdiORayR9rGBRC4+h0w21vQZa179LqNeArXL+CDYrgr4p+Ocbmbq7v+D 5PGF72zZVyFtUyvBXVtniJjmD8Ir2s8CBZ2PiM40elV7iRyVPJH9xnLOj QZRQK4y1lStk6xF0kONPPqk0UOYkOqu8NU79m7QpDy0mvB+o3dWrvlhtl g==; X-CSE-ConnectionGUID: ShePTBwfTkq+WEW0Sf4lqw== X-CSE-MsgGUID: kmEtQreqRSyVtQjTcOboOA== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="8698134" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="8698134" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 04:03:40 -0700 X-CSE-ConnectionGUID: p/Zrm9xVRU21uEXEaLnLUA== X-CSE-MsgGUID: RTEU5jY+TESOsi2V5D/y/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="27380696" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 17 Apr 2024 04:03:37 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 655EDBCD; Wed, 17 Apr 2024 14:03:36 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v3 2/9] spi: pxa2xx: Provide num-cs for Sharp PDAs via device properties Date: Wed, 17 Apr 2024 13:54:29 +0300 Message-ID: <20240417110334.2671228-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> References: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since driver can parse num-cs device property, replace platform data with this new approach. This pursues the following objectives: - getting rid of the public header that barely used outside of the SPI subsystem (more specifically the SPI PXA2xx drivers) - making a trampoline for the driver to support non-default number of the chip select pins in case the original code is going to be converted to Device Tree model It's not expected to have more users in board files except this one. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- arch/arm/mach-pxa/spitz.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 318402ad685e..3c5f5a3cb480 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -18,10 +18,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include @@ -569,10 +569,6 @@ static struct spi_board_info spitz_spi_devices[] = { }, }; -static struct pxa2xx_spi_controller spitz_spi_info = { - .num_chipselect = 3, -}; - static struct gpiod_lookup_table spitz_spi_gpio_table = { .dev_id = "spi2", .table = { @@ -583,10 +579,20 @@ static struct gpiod_lookup_table spitz_spi_gpio_table = { }, }; +static const struct property_entry spitz_spi_properties[] = { + PROPERTY_ENTRY_U32("num-cs", 3), + { } +}; + +static const struct software_node spitz_spi_node = { + .properties = spitz_spi_properties, +}; + static void __init spitz_spi_init(void) { struct platform_device *pd; int id = 2; + int err; if (machine_is_akita()) gpiod_add_lookup_table(&akita_lcdcon_gpio_table); @@ -601,8 +607,13 @@ static void __init spitz_spi_init(void) if (pd == NULL) { pr_err("pxa2xx-spi: failed to allocate device id %d\n", id); } else { - pd->dev.platform_data = &spitz_spi_info; - platform_device_add(pd); + err = device_add_software_node(&pd->dev, &spitz_spi_node); + if (err) { + platform_device_put(pd); + pr_err("pxa2xx-spi: failed to add software node\n"); + } else { + platform_device_add(pd); + } } spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); From patchwork Wed Apr 17 10:54:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 791170 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 BE9D113C836; Wed, 17 Apr 2024 11:03:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351828; cv=none; b=udXQUW8jhzbmbQNXFaDFGdppssBKpN47G2LAmoNAz5B23E5CMDI59S1yV4UQYzL6ZZ1/GO2c6KOfOkO5wc+DDpsHHpHW7RRZPUZ1EI1MAx3/W75W5uoLzsYNUWqOcMbd8QXagZbkQF98l+4YqEZ8GV1+K4Jee6FWyvkszUT9RLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351828; c=relaxed/simple; bh=NPM74tt5sE/MfVe6VeyuUXpMJ6J+W7rv/GRbFNzrHKk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ljecXfQpGfER+1l6sOn+HyQnFTY6m9LdV8Sbl5pHEgylDR6SxIskvDDKIcixgQGoi2JTTy9tf+Z33db6RoEkdz7HiAh/elf9cBkFUc70yD7p2gBl8rrsdmD9CrkdaCPsSSiBNUL5bWIY158cu2z3ehiz+XF/ZznF9W4n+D7dIiE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QJELr/DN; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QJELr/DN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713351827; x=1744887827; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NPM74tt5sE/MfVe6VeyuUXpMJ6J+W7rv/GRbFNzrHKk=; b=QJELr/DN0tDDQ7tthSq/lmcYLGL8EUtjOTOgjEgTHcbmVZ5PAgC4hozr 1ZipQwO/rn3TrgF1LkLHW8nzQwLh9bC5+mVpz/T0LcsZjpiWiaGSw9oip zX/U9cRQMKDJReZVh64U8VLAUUs04CPTUgyF1Cra/w20GaH/cCsVkaCdf OGDr6IQlhfi3LtrYchRBMK6DpLI/gTeNzQMRiTwRkterJZhiu/jFjZ4qx JgRIyza5ahIfIuuSh3hk1oX9a5M84q6vVE6zI8YGrTFWRwIDDMw8CyZUi 7zhVp3FD7M9p2GMpRNbgBHkS13dDxAFkVLNvcR4rgd3vxM/0789hoYeL8 Q==; X-CSE-ConnectionGUID: cJgUvDf0QFCJnCmtIKfLRg== X-CSE-MsgGUID: 80k3Dv0TT/yHr4R3lx5TAw== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="8698143" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="8698143" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 04:03:40 -0700 X-CSE-ConnectionGUID: YRij57pxQtugkdQU/3ruUQ== X-CSE-MsgGUID: AMQHOuj6QxSkffgk80mOmg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="27380697" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 17 Apr 2024 04:03:37 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7060460B; Wed, 17 Apr 2024 14:03:36 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King , Arnd Bergmann Subject: [PATCH v3 3/9] spi: pxa2xx: Move contents of linux/spi/pxa2xx_spi.h to a local one Date: Wed, 17 Apr 2024 13:54:30 +0300 Message-ID: <20240417110334.2671228-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> References: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There is no user of the linux/spi/pxa2xx_spi.h. Move its contents to the drivers/spi/spi-pxa2xx.h. Suggested-by: Arnd Bergmann Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- drivers/spi/spi-pxa2xx-dma.c | 1 - drivers/spi/spi-pxa2xx-pci.c | 4 +-- drivers/spi/spi-pxa2xx.c | 1 - drivers/spi/spi-pxa2xx.h | 36 ++++++++++++++++++++++++- include/linux/spi/pxa2xx_spi.h | 48 ---------------------------------- 5 files changed, 37 insertions(+), 53 deletions(-) delete mode 100644 include/linux/spi/pxa2xx_spi.h diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c index be563f0dd03a..26416ced6505 100644 --- a/drivers/spi/spi-pxa2xx-dma.c +++ b/drivers/spi/spi-pxa2xx-dma.c @@ -12,7 +12,6 @@ #include #include -#include #include #include "spi-pxa2xx.h" diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index 861b21c63504..e11a613bc340 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -10,11 +10,11 @@ #include #include -#include - #include #include +#include "spi-pxa2xx.h" + #define PCI_DEVICE_ID_INTEL_QUARK_X1000 0x0935 #define PCI_DEVICE_ID_INTEL_BYT 0x0f0e #define PCI_DEVICE_ID_INTEL_MRFLD 0x1194 diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index ab6fd55237cd..82633682b581 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -24,7 +24,6 @@ #include #include -#include #include #include "spi-pxa2xx.h" diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index 45cdbbc71c4b..08296729ea80 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -7,6 +7,7 @@ #ifndef SPI_PXA2XX_H #define SPI_PXA2XX_H +#include #include #include #include @@ -15,7 +16,40 @@ #include struct gpio_desc; -struct pxa2xx_spi_controller; + +/* + * The platform data for SSP controller devices + * (resides in device.platform_data). + */ +struct pxa2xx_spi_controller { + u8 num_chipselect; + u8 enable_dma; + u8 dma_burst_size; + bool is_target; + + /* DMA engine specific config */ + dma_filter_fn dma_filter; + void *tx_param; + void *rx_param; + + /* For non-PXA arches */ + struct ssp_device ssp; +}; + +/* + * The controller specific data for SPI target devices + * (resides in spi_board_info.controller_data), + * copied to spi_device.platform_data ... mostly for + * DMA tuning. + */ +struct pxa2xx_spi_chip { + u8 tx_threshold; + u8 tx_hi_threshold; + u8 rx_threshold; + u8 dma_burst_size; + u32 timeout; +}; + struct spi_controller; struct spi_device; struct spi_transfer; diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h deleted file mode 100644 index e5a4a045fb67..000000000000 --- a/include/linux/spi/pxa2xx_spi.h +++ /dev/null @@ -1,48 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs - */ -#ifndef __LINUX_SPI_PXA2XX_SPI_H -#define __LINUX_SPI_PXA2XX_SPI_H - -#include -#include - -#include - -struct dma_chan; - -/* - * The platform data for SSP controller devices - * (resides in device.platform_data). - */ -struct pxa2xx_spi_controller { - u8 num_chipselect; - u8 enable_dma; - u8 dma_burst_size; - bool is_target; - - /* DMA engine specific config */ - dma_filter_fn dma_filter; - void *tx_param; - void *rx_param; - - /* For non-PXA arches */ - struct ssp_device ssp; -}; - -/* - * The controller specific data for SPI target devices - * (resides in spi_board_info.controller_data), - * copied to spi_device.platform_data ... mostly for - * DMA tuning. - */ -struct pxa2xx_spi_chip { - u8 tx_threshold; - u8 tx_hi_threshold; - u8 rx_threshold; - u8 dma_burst_size; - u32 timeout; -}; - -#endif /* __LINUX_SPI_PXA2XX_SPI_H */ From patchwork Wed Apr 17 10:54:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 791171 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 0A3A913B295; Wed, 17 Apr 2024 11:03:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351826; cv=none; b=t5xjY4NwKMDbtLqoWX77vjIiJZJ8cxJcxSyJKOtoRAkBivBW9UGmJB3zKkiWvjuf48kSlx3TEB7o9Iv+jrXSfMPaSTVNogDuYI46YxYgwHwcsI4nft0AB3c1rLVOZyarEw2Xgqwn/9wK5BE0khedgjyUtqBXE2HkYfm/YDiYkxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351826; c=relaxed/simple; bh=G5pptn3K/PBYPEPwaUeTaoyPGvV+rl6wz59CCnYxbh0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dRlGTvf0hxS6s4vx2LNFMbjgD0LN2GcCqVhraLumZaXCW1tr1lD79zghCUizXIo2qu1GEhdoTVNyGIQE7Xii8xfu3wK7wbYnapaiCkMUT60Rfrit3NtsIvL/ebVAMMRvGMZd5VM+EJZt5MyLtfT8Na8vqDWpWGyEVUcDFuvIk/E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Bi9DI9fP; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Bi9DI9fP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713351821; x=1744887821; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G5pptn3K/PBYPEPwaUeTaoyPGvV+rl6wz59CCnYxbh0=; b=Bi9DI9fP/ndKmoxllFtKgG9zwLtHxkHbpxIwyr7svyUvJA57UQEPOIpd KhI+hgqTvKNVOCHav2z5OyJaFml8+scI2TugZ+O2Xo2NO5tD0mFUKVt6w RIVRkh1TxV10SFO8kuBlOXelR1LY9L7k8LIuiUMAvin0sLCYctwql7vdn uXehOI+VLGA9/qWY0FL7cH7caTKjt1aAN8lzoiEbsqgvGsDxUCrbCgAa3 XZV2jGcHVJgP9GRH+Jq6fIpslUbTy8yKvc7ED5wCjQ888DbvktGNph8as XS77AhjWO93oTjGTLWIXuO9SnuA464qqmeI52B0Bz7TXTl0+V8UYVh1rK w==; X-CSE-ConnectionGUID: K2QP8xW3Q+G/3qkSg9EihA== X-CSE-MsgGUID: Q5PJw6WBTQyVDA5QbUxx5g== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="8698118" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="8698118" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 04:03:40 -0700 X-CSE-ConnectionGUID: 4QEddFqER9eJZ56NLODEtg== X-CSE-MsgGUID: C4be8bkETF+3AroxRRYVGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="22653274" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 17 Apr 2024 04:03:37 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 81B5D12B5; Wed, 17 Apr 2024 14:03:36 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v3 4/9] spi: pxa2xx: Remove outdated documentation Date: Wed, 17 Apr 2024 13:54:31 +0300 Message-ID: <20240417110334.2671228-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> References: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The documentation is referring to the legacy enumeration of the SPI host controllers and target devices. It has nothing to do with the modern way, which is the only supported in kernel right now. Hence, remove outdated documentation file. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- Documentation/spi/pxa2xx.rst | 208 ----------------------------------- drivers/spi/Kconfig | 3 +- 2 files changed, 1 insertion(+), 210 deletions(-) delete mode 100644 Documentation/spi/pxa2xx.rst diff --git a/Documentation/spi/pxa2xx.rst b/Documentation/spi/pxa2xx.rst deleted file mode 100644 index 33d2ad95901e..000000000000 --- a/Documentation/spi/pxa2xx.rst +++ /dev/null @@ -1,208 +0,0 @@ -============================== -PXA2xx SPI on SSP driver HOWTO -============================== - -This a mini HOWTO on the pxa2xx_spi driver. The driver turns a PXA2xx -synchronous serial port into an SPI host controller -(see Documentation/spi/spi-summary.rst). The driver has the following features - -- Support for any PXA2xx and compatible SSP. -- SSP PIO and SSP DMA data transfers. -- External and Internal (SSPFRM) chip selects. -- Per peripheral device (chip) configuration. -- Full suspend, freeze, resume support. - -The driver is built around a &struct spi_message FIFO serviced by kernel -thread. The kernel thread, spi_pump_messages(), drives message FIFO and -is responsible for queuing SPI transactions and setting up and launching -the DMA or interrupt driven transfers. - -Declaring PXA2xx host controllers ---------------------------------- -Typically, for a legacy platform, an SPI host controller is defined in the -arch/.../mach-*/board-*.c as a "platform device". The host controller configuration -is passed to the driver via a table found in include/linux/spi/pxa2xx_spi.h:: - - struct pxa2xx_spi_controller { - u8 num_chipselect; - u8 enable_dma; - ... - }; - -The "pxa2xx_spi_controller.num_chipselect" field is used to determine the number of -peripheral devices (chips) attached to this SPI host controller. - -The "pxa2xx_spi_controller.enable_dma" field informs the driver that SSP DMA should -be used. This caused the driver to acquire two DMA channels: Rx channel and -Tx channel. The Rx channel has a higher DMA service priority than the Tx channel. -See the "PXA2xx Developer Manual" section "DMA Controller". - -For the new platforms the description of the controller and peripheral devices -comes from Device Tree or ACPI. - -NSSP HOST SAMPLE ----------------- -Below is a sample configuration using the PXA255 NSSP for a legacy platform:: - - static struct resource pxa_spi_nssp_resources[] = { - [0] = { - .start = __PREG(SSCR0_P(2)), /* Start address of NSSP */ - .end = __PREG(SSCR0_P(2)) + 0x2c, /* Range of registers */ - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = IRQ_NSSP, /* NSSP IRQ */ - .end = IRQ_NSSP, - .flags = IORESOURCE_IRQ, - }, - }; - - static struct pxa2xx_spi_controller pxa_nssp_controller_info = { - .num_chipselect = 1, /* Matches the number of chips attached to NSSP */ - .enable_dma = 1, /* Enables NSSP DMA */ - }; - - static struct platform_device pxa_spi_nssp = { - .name = "pxa2xx-spi", /* MUST BE THIS VALUE, so device match driver */ - .id = 2, /* Bus number, MUST MATCH SSP number 1..n */ - .resource = pxa_spi_nssp_resources, - .num_resources = ARRAY_SIZE(pxa_spi_nssp_resources), - .dev = { - .platform_data = &pxa_nssp_controller_info, /* Passed to driver */ - }, - }; - - static struct platform_device *devices[] __initdata = { - &pxa_spi_nssp, - }; - - static void __init board_init(void) - { - (void)platform_add_device(devices, ARRAY_SIZE(devices)); - } - -Declaring peripheral devices ----------------------------- -Typically, for a legacy platform, each SPI peripheral device (chip) is defined in the -arch/.../mach-*/board-*.c using the "spi_board_info" structure found in -"linux/spi/spi.h". See "Documentation/spi/spi-summary.rst" for additional -information. - -Each peripheral device (chip) attached to the PXA2xx must provide specific chip configuration -information via the structure "pxa2xx_spi_chip" found in -"include/linux/spi/pxa2xx_spi.h". The PXA2xx host controller driver will use -the configuration whenever the driver communicates with the peripheral -device. All fields are optional. - -:: - - struct pxa2xx_spi_chip { - u8 tx_threshold; - u8 rx_threshold; - u8 dma_burst_size; - u32 timeout; - }; - -The "pxa2xx_spi_chip.tx_threshold" and "pxa2xx_spi_chip.rx_threshold" fields are -used to configure the SSP hardware FIFO. These fields are critical to the -performance of pxa2xx_spi driver and misconfiguration will result in rx -FIFO overruns (especially in PIO mode transfers). Good default values are:: - - .tx_threshold = 8, - .rx_threshold = 8, - -The range is 1 to 16 where zero indicates "use default". - -The "pxa2xx_spi_chip.dma_burst_size" field is used to configure PXA2xx DMA -engine and is related the "spi_device.bits_per_word" field. Read and understand -the PXA2xx "Developer Manual" sections on the DMA controller and SSP Controllers -to determine the correct value. An SSP configured for byte-wide transfers would -use a value of 8. The driver will determine a reasonable default if -dma_burst_size == 0. - -The "pxa2xx_spi_chip.timeout" fields is used to efficiently handle -trailing bytes in the SSP receiver FIFO. The correct value for this field is -dependent on the SPI bus speed ("spi_board_info.max_speed_hz") and the specific -peripheral device. Please note that the PXA2xx SSP 1 does not support trailing byte -timeouts and must busy-wait any trailing bytes. - -NOTE: the SPI driver cannot control the chip select if SSPFRM is used, so the -chipselect is dropped after each spi_transfer. Most devices need chip select -asserted around the complete message. Use SSPFRM as a GPIO (through a descriptor) -to accommodate these chips. - - -NSSP PERIPHERAL SAMPLE ----------------------- -For a legacy platform or in some other cases, the pxa2xx_spi_chip structure -is passed to the pxa2xx_spi driver in the "spi_board_info.controller_data" -field. Below is a sample configuration using the PXA255 NSSP. - -:: - - static struct pxa2xx_spi_chip cs8415a_chip_info = { - .tx_threshold = 8, /* SSP hardware FIFO threshold */ - .rx_threshold = 8, /* SSP hardware FIFO threshold */ - .dma_burst_size = 8, /* Byte wide transfers used so 8 byte bursts */ - .timeout = 235, /* See Intel documentation */ - }; - - static struct pxa2xx_spi_chip cs8405a_chip_info = { - .tx_threshold = 8, /* SSP hardware FIFO threshold */ - .rx_threshold = 8, /* SSP hardware FIFO threshold */ - .dma_burst_size = 8, /* Byte wide transfers used so 8 byte bursts */ - .timeout = 235, /* See Intel documentation */ - }; - - static struct spi_board_info streetracer_spi_board_info[] __initdata = { - { - .modalias = "cs8415a", /* Name of spi_driver for this device */ - .max_speed_hz = 3686400, /* Run SSP as fast a possible */ - .bus_num = 2, /* Framework bus number */ - .chip_select = 0, /* Framework chip select */ - .platform_data = NULL; /* No spi_driver specific config */ - .controller_data = &cs8415a_chip_info, /* Host controller config */ - .irq = STREETRACER_APCI_IRQ, /* Peripheral device interrupt */ - }, - { - .modalias = "cs8405a", /* Name of spi_driver for this device */ - .max_speed_hz = 3686400, /* Run SSP as fast a possible */ - .bus_num = 2, /* Framework bus number */ - .chip_select = 1, /* Framework chip select */ - .controller_data = &cs8405a_chip_info, /* Host controller config */ - .irq = STREETRACER_APCI_IRQ, /* Peripheral device interrupt */ - }, - }; - - static void __init streetracer_init(void) - { - spi_register_board_info(streetracer_spi_board_info, - ARRAY_SIZE(streetracer_spi_board_info)); - } - - -DMA and PIO I/O Support ------------------------ -The pxa2xx_spi driver supports both DMA and interrupt driven PIO message -transfers. The driver defaults to PIO mode and DMA transfers must be enabled -by setting the "enable_dma" flag in the "pxa2xx_spi_controller" structure. -For the newer platforms, that are known to support DMA, the driver will enable -it automatically and try it first with a possible fallback to PIO. The DMA -mode supports both coherent and stream based DMA mappings. - -The following logic is used to determine the type of I/O to be used on -a per "spi_transfer" basis:: - - if spi_message.len > 65536 then - print "rate limited" warning - use PIO transfers - - if enable_dma and the size is in the range [DMA burst size..65536] then - use streaming DMA mode - - otherwise - use PIO transfer - -THANKS TO ---------- -David Brownell and others for mentoring the development of this driver. diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 5c9432c700a4..24e4feb75d01 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -821,8 +821,7 @@ config SPI_PXA2XX select PXA_SSP if ARCH_PXA || ARCH_MMP help This enables using a PXA2xx or Sodaville SSP port as a SPI master - controller. The driver can be configured to use any SSP port and - additional documentation can be found a Documentation/spi/pxa2xx.rst. + controller. The driver can be configured to use any SSP port. config SPI_PXA2XX_PCI def_tristate SPI_PXA2XX && PCI && COMMON_CLK From patchwork Wed Apr 17 10:54:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 789717 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 F065313CFB1; Wed, 17 Apr 2024 11:03:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351832; cv=none; b=opAx4rHjd1Xu4uc4baIfG20bLFXvBpSp6TFaPrFRUu2s/3k7FIyDw1gh0Cn0cLzG5WsTpbaNxtzi2n4PkOMJRHRBQ47kGwfyhhNg6gjB4a/kDdYkTfANMcggALCy8278lors2flxBrRoINAqgxusSPQ0JzrPSUu7IVQF+rUOO0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351832; c=relaxed/simple; bh=fTowosBJawg2jktG1ze451cVnqPzvsaV6zeLVnumwuA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fHCvJeH4uqM1RDsxao8/25EcbAsndmyJrgthKzF5Hs/Jxh0Rzi72DzikT7T/DwYDmkwIkutnzbrvsUU/LNTKxl9Wbd2QaMvactGZPqRlYaB9GKLk8fmiuUnrHFCIWYzOKXIoQVo8VcorJ8gWkJ7DYnOpjIaPNOvsjYekMbjChw0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OOh3VPBG; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OOh3VPBG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713351829; x=1744887829; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fTowosBJawg2jktG1ze451cVnqPzvsaV6zeLVnumwuA=; b=OOh3VPBGlDCbF2REGLlSMNjLPdtmALVUnByowv5WNbKfjI11z1tbgcfR Jjk6+iJgU3Qyn4cNhF0PuN+umt++jgoVhwqj6Xmna70sSZoYhiZLRzrtn EOue2MD+CgLWM+wphGFCWWSaxFus75lvebzcetylpsVtsZrphwkxh7TF3 z1OMsbiICqVwqpexb2/PdXp9hdW1Wf595PGGSo9Q06TGeS9BF2ByNylsm KTtU/Exg0PmHCxeot+i5P5AH+u7I41X4bnrDDpFHeKGTaXY7QZU70zdMj w9OPyck67wif5TL8UVRsw+4TaA1VNa3RSQIanM5igfTsbs/L0Bwq56S/5 g==; X-CSE-ConnectionGUID: Y72OuRhxQ3WPgMwVbpRhhA== X-CSE-MsgGUID: mL5UuXUKShmo6Nj0jUyrWw== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="8698171" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="8698171" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 04:03:43 -0700 X-CSE-ConnectionGUID: WpLsJvJ1SNiayBxDZVMrRw== X-CSE-MsgGUID: n7HqInwdROGiMLC6JgpESw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="22653280" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 17 Apr 2024 04:03:40 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9232D134D; Wed, 17 Apr 2024 14:03:36 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v3 5/9] spi: pxa2xx: Don't use "proxy" headers Date: Wed, 17 Apr 2024 13:54:32 +0300 Message-ID: <20240417110334.2671228-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> References: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Update header inclusions to follow IWYU (Include What You Use) principle. Signed-off-by: Andy Shevchenko Acked-by: Linus Walleij --- drivers/spi/spi-pxa2xx-dma.c | 10 ++++++++-- drivers/spi/spi-pxa2xx-pci.c | 6 ++++++ drivers/spi/spi-pxa2xx.c | 10 +++++++--- drivers/spi/spi-pxa2xx.h | 3 +-- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c index 26416ced6505..751cb0f77b62 100644 --- a/drivers/spi/spi-pxa2xx-dma.c +++ b/drivers/spi/spi-pxa2xx-dma.c @@ -6,16 +6,22 @@ * Author: Mika Westerberg */ -#include +#include +#include #include #include +#include +#include #include -#include +#include +#include #include #include "spi-pxa2xx.h" +struct device; + static void pxa2xx_spi_dma_transfer_complete(struct driver_data *drv_data, bool error) { diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index e11a613bc340..6d2efdb0e95f 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -6,9 +6,15 @@ * Copyright (C) 2016, 2021 Intel Corporation */ #include +#include +#include #include #include #include +#include +#include +#include +#include #include #include diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 82633682b581..cc0e54f8d2c3 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -5,24 +5,28 @@ */ #include +#include #include +#include #include #include #include #include #include -#include #include #include #include +#include #include -#include -#include +#include +#include #include +#include #include #include #include #include +#include #include diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index 08296729ea80..f1097c96c50f 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -8,8 +8,7 @@ #define SPI_PXA2XX_H #include -#include -#include +#include #include #include From patchwork Wed Apr 17 10:54:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 789718 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 DB8FC13C9A7; Wed, 17 Apr 2024 11:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351830; cv=none; b=aNb75KDib6yqTPlg5rrqRz0do2oDt5HyJvVbc6uJCRT+1mp2AwoDhqvSjbDMYXDVgZnMyzOXFRSIVMBvUUWT/hvozT7z3SjfkEct1bac/Bz68ntFAgf80JA3yKRe6NVDJbkbuCAtQplMjFSnu/mAnCI3u8Aq7LwvTEKnvbOwdGQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351830; c=relaxed/simple; bh=fcw6oS8bqcoF1z0F8TEGeK5SgUH/8wJTF4cXw541tEA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VY0n6hXOUfszI1DljZ2zIJz7qY/uYmhcZd4gv0M1kyLQyQmw3NMvoLZ21nH33yfAmNfd0DsNq2fE0Xu+uHj/rcz28dkGtZ/b6RM+3D80BDQ+nq0p/KPSVXHm6nxG4I+eR729nBHbPIGW1jzWW+mhdrOr2pL2XONmD0kS2fxfcsk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Gvw/aL19; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Gvw/aL19" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713351828; x=1744887828; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fcw6oS8bqcoF1z0F8TEGeK5SgUH/8wJTF4cXw541tEA=; b=Gvw/aL19O5d0SiAL8DNuKPtVOpXmYCCsTjRGLfe9m4Fy80OLuFqHlb6d l4eewbrCX6JwK9kr73CapFozocFexZJhRp4O4salCzTCYhNupYptO5GkU Cwdyw2Wz6CgG9AkEzdZHIGtOlovnmvJVD6UVJW63ae9RYTBqwtnTLSzGE 6sR/kgqmNo9obeKtVN5noIpgGjA2dStXe+udiNeYJUbW11t9hEaqpfT9t DWbGEff35Ob2r55i3b6ZGKa/Iuo9OWl+O5PQ+hsWWFkh9BWSS2uSnj8E5 F+m7GtLthMOCRl4xpfR6gj/nFwoEfZ8i+KGXgpK974X0vP9jKl/VSdHH4 w==; X-CSE-ConnectionGUID: syA/YU2ZQWaHSrscTyPOMQ== X-CSE-MsgGUID: Irn530xkSd6KKT5U6EWQqg== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="8698158" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="8698158" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 04:03:43 -0700 X-CSE-ConnectionGUID: NiOePWkJTmar9IgsX+1sIA== X-CSE-MsgGUID: mrw5q278QeaT6K1T2BscNA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="22653279" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 17 Apr 2024 04:03:40 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9C647F69; Wed, 17 Apr 2024 14:03:36 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v3 6/9] spi: pxa2xx: Drop struct pxa2xx_spi_chip Date: Wed, 17 Apr 2024 13:54:33 +0300 Message-ID: <20240417110334.2671228-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> References: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 No more users. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- drivers/spi/spi-pxa2xx-dma.c | 9 ++------- drivers/spi/spi-pxa2xx.c | 25 ------------------------- drivers/spi/spi-pxa2xx.h | 14 -------------- 3 files changed, 2 insertions(+), 46 deletions(-) diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c index 751cb0f77b62..d77279c3acd8 100644 --- a/drivers/spi/spi-pxa2xx-dma.c +++ b/drivers/spi/spi-pxa2xx-dma.c @@ -231,16 +231,11 @@ int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip, u8 bits_per_word, u32 *burst_code, u32 *threshold) { - struct pxa2xx_spi_chip *chip_info = spi->controller_data; struct driver_data *drv_data = spi_controller_get_devdata(spi->controller); u32 dma_burst_size = drv_data->controller_info->dma_burst_size; - /* - * If the DMA burst size is given in chip_info we use that, - * otherwise we use the default. Also we use the default FIFO - * thresholds for now. - */ - *burst_code = chip_info ? chip_info->dma_burst_size : dma_burst_size; + /* We use the default the DMA burst size and FIFO thresholds for now */ + *burst_code = dma_burst_size; *threshold = SSCR1_RxTresh(RX_THRESH_DFLT) | SSCR1_TxTresh(TX_THRESH_DFLT); diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index cc0e54f8d2c3..00aa33c937bf 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1154,7 +1154,6 @@ static int pxa2xx_spi_unprepare_transfer(struct spi_controller *controller) static int setup(struct spi_device *spi) { - struct pxa2xx_spi_chip *chip_info; struct chip_data *chip; const struct lpss_config *config; struct driver_data *drv_data = @@ -1218,25 +1217,6 @@ static int setup(struct spi_device *spi) chip->timeout = TIMOUT_DFLT; } - /* - * Protocol drivers may change the chip settings, so... - * if chip_info exists, use it. - */ - chip_info = spi->controller_data; - - /* chip_info isn't always needed */ - if (chip_info) { - if (chip_info->timeout) - chip->timeout = chip_info->timeout; - if (chip_info->tx_threshold) - tx_thres = chip_info->tx_threshold; - if (chip_info->tx_hi_threshold) - tx_hi_thres = chip_info->tx_hi_threshold; - if (chip_info->rx_threshold) - rx_thres = chip_info->rx_threshold; - chip->dma_threshold = 0; - } - chip->cr1 = 0; if (spi_controller_is_target(drv_data->controller)) { chip->cr1 |= SSCR1_SCFR; @@ -1256,11 +1236,6 @@ static int setup(struct spi_device *spi) chip->lpss_tx_threshold = tx_thres; } - /* - * Set DMA burst and threshold outside of chip_info path so that if - * chip_info goes away after setting chip->enable_dma, the burst and - * threshold can still respond to changes in bits_per_word. - */ if (chip->enable_dma) { /* Set up legal burst and threshold for DMA */ if (pxa2xx_spi_set_dma_burst_and_threshold(chip, spi, diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index f1097c96c50f..ae9c99bc9f6c 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -35,20 +35,6 @@ struct pxa2xx_spi_controller { struct ssp_device ssp; }; -/* - * The controller specific data for SPI target devices - * (resides in spi_board_info.controller_data), - * copied to spi_device.platform_data ... mostly for - * DMA tuning. - */ -struct pxa2xx_spi_chip { - u8 tx_threshold; - u8 tx_hi_threshold; - u8 rx_threshold; - u8 dma_burst_size; - u32 timeout; -}; - struct spi_controller; struct spi_device; struct spi_transfer; From patchwork Wed Apr 17 10:54:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 789716 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 B384C13D62C; Wed, 17 Apr 2024 11:03:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351833; cv=none; b=rrSSXZhfga7NhPhf3zx6DnVoWZSOR2uDzNxGnO8BThx9ZNAgtUVkGiFlGkNuTZbU2BN/3pccmRYgG9E8qePvvA3JXcvTRIjl1In/Pb+iGrkJryPIweYTPqp6oSlDj+0rxTmnwhXZPr3FyKc3eiXEMwFwZMzC/eSV5hIHpToCBSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351833; c=relaxed/simple; bh=3O1RfKMO38M6MA1PHV2hF+B/pd342ZSGZsdVfT+KePw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q2LVbPdQ9dOFaQqDnrjINSDpPkBLn8FD1t4MfNimxizbFXJNm8txfHUHRaPiE8+O5RTCm9xGsYGJexRqt9mVEYoP7LqGR9vnncQnBJtcTsN9OWiVhVdr8ND0jXut5UWJqdubTXCbpexFOpCBsZsGiCfKGL6xdnizVVDjeJkLhnU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XE0vXkMb; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XE0vXkMb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713351832; x=1744887832; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3O1RfKMO38M6MA1PHV2hF+B/pd342ZSGZsdVfT+KePw=; b=XE0vXkMbLJMQH9hqjAtyhOThlqPZyfIoJzIi8v/H434E1qgcggd+Bnws rNz/u19P1gi0KsGS7O6DDeowvFEkNQ6dSXEN7Hzd0wF1sTu9eMF6dKcVL ImchjzHNev0B2mSucu2pBloh1X298i5z4kBxalJ1LCoIo47ItpQPO6qdr lHdf2dUv/uG5kNi0w8FKdIkTUJAJrSMkeCDm+NhvUZDfEwEdQ3/0+50gt 9Bb/gN5BndIIdEqxjcYCdZmWFzZmrltDfM+graveH4Puovz0l3lgWbuOF PCaUa5DG0j2SadEY8DcB7qusjg40LCKcKRfVvoPOihEsM908wBuWoHs6+ w==; X-CSE-ConnectionGUID: wVkBKRI5TE6x0dlKdHbDkg== X-CSE-MsgGUID: qDXxbVDtTVS23Ax++Ud49Q== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="8698179" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="8698179" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 04:03:44 -0700 X-CSE-ConnectionGUID: fbnb+ukYQemUNSsOpV1opQ== X-CSE-MsgGUID: b8mYUruDRl2VTktJTkjJJw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="27380728" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 17 Apr 2024 04:03:41 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id ACA9814BC; Wed, 17 Apr 2024 14:03:36 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v3 7/9] spi: pxa2xx: Remove DMA parameters from struct chip_data Date: Wed, 17 Apr 2024 13:54:34 +0300 Message-ID: <20240417110334.2671228-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> References: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The DMA related fields are set once and never modified. It effectively repeats the content of the same fields in struct pxa2xx_spi_controller. With that, remove DMA parameters from struct chip_data. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- drivers/spi/spi-pxa2xx-dma.c | 22 ++------------------ drivers/spi/spi-pxa2xx.c | 40 +++++++----------------------------- drivers/spi/spi-pxa2xx.h | 8 -------- 3 files changed, 9 insertions(+), 61 deletions(-) diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c index d77279c3acd8..08cb6e96ac94 100644 --- a/drivers/spi/spi-pxa2xx-dma.c +++ b/drivers/spi/spi-pxa2xx-dma.c @@ -68,8 +68,6 @@ pxa2xx_spi_dma_prepare_one(struct driver_data *drv_data, enum dma_transfer_direction dir, struct spi_transfer *xfer) { - struct chip_data *chip = - spi_get_ctldata(drv_data->controller->cur_msg->spi); enum dma_slave_buswidth width; struct dma_slave_config cfg; struct dma_chan *chan; @@ -94,14 +92,14 @@ pxa2xx_spi_dma_prepare_one(struct driver_data *drv_data, if (dir == DMA_MEM_TO_DEV) { cfg.dst_addr = drv_data->ssp->phys_base + SSDR; cfg.dst_addr_width = width; - cfg.dst_maxburst = chip->dma_burst_size; + cfg.dst_maxburst = drv_data->controller_info->dma_burst_size; sgt = &xfer->tx_sg; chan = drv_data->controller->dma_tx; } else { cfg.src_addr = drv_data->ssp->phys_base + SSDR; cfg.src_addr_width = width; - cfg.src_maxburst = chip->dma_burst_size; + cfg.src_maxburst = drv_data->controller_info->dma_burst_size; sgt = &xfer->rx_sg; chan = drv_data->controller->dma_rx; @@ -225,19 +223,3 @@ void pxa2xx_spi_dma_release(struct driver_data *drv_data) controller->dma_tx = NULL; } } - -int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip, - struct spi_device *spi, - u8 bits_per_word, u32 *burst_code, - u32 *threshold) -{ - struct driver_data *drv_data = spi_controller_get_devdata(spi->controller); - u32 dma_burst_size = drv_data->controller_info->dma_burst_size; - - /* We use the default the DMA burst size and FIFO thresholds for now */ - *burst_code = dma_burst_size; - *threshold = SSCR1_RxTresh(RX_THRESH_DFLT) - | SSCR1_TxTresh(TX_THRESH_DFLT); - - return 0; -} diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 00aa33c937bf..3ba0f5816f7f 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -934,11 +934,11 @@ static bool pxa2xx_spi_can_dma(struct spi_controller *controller, struct spi_device *spi, struct spi_transfer *xfer) { - struct chip_data *chip = spi_get_ctldata(spi); + struct driver_data *drv_data = spi_controller_get_devdata(controller); - return chip->enable_dma && + return drv_data->controller_info->enable_dma && xfer->len <= MAX_DMA_LEN && - xfer->len >= chip->dma_burst_size; + xfer->len >= drv_data->controller_info->dma_burst_size; } static int pxa2xx_spi_transfer_one(struct spi_controller *controller, @@ -947,9 +947,8 @@ static int pxa2xx_spi_transfer_one(struct spi_controller *controller, { struct driver_data *drv_data = spi_controller_get_devdata(controller); struct chip_data *chip = spi_get_ctldata(spi); - u32 dma_thresh = chip->dma_threshold; - u32 dma_burst = chip->dma_burst_size; u32 change_mask = pxa2xx_spi_get_ssrc1_change_mask(drv_data); + u32 dma_thresh; u32 clk_div; u8 bits; u32 speed; @@ -959,7 +958,7 @@ static int pxa2xx_spi_transfer_one(struct spi_controller *controller, int dma_mapped; /* Check if we can DMA this transfer */ - if (transfer->len > MAX_DMA_LEN && chip->enable_dma) { + if (transfer->len > MAX_DMA_LEN && drv_data->controller_info->enable_dma) { /* Warn ... we force this to PIO mode */ dev_warn_ratelimited(&spi->dev, "DMA disabled for transfer length %u greater than %d\n", @@ -995,19 +994,8 @@ static int pxa2xx_spi_transfer_one(struct spi_controller *controller, drv_data->read = drv_data->rx ? u32_reader : null_reader; drv_data->write = drv_data->tx ? u32_writer : null_writer; } - /* - * If bits per word is changed in DMA mode, then must check - * the thresholds and burst also. - */ - if (chip->enable_dma) { - if (pxa2xx_spi_set_dma_burst_and_threshold(chip, - spi, - bits, &dma_burst, - &dma_thresh)) - dev_warn_ratelimited(&spi->dev, - "DMA burst size reduced to match bits_per_word\n"); - } + dma_thresh = SSCR1_RxTresh(RX_THRESH_DFLT) | SSCR1_TxTresh(TX_THRESH_DFLT); dma_mapped = controller->can_dma && controller->can_dma(controller, spi, transfer) && controller->cur_msg_mapped; @@ -1213,7 +1201,6 @@ static int setup(struct spi_device *spi) if (!chip) return -ENOMEM; - chip->enable_dma = drv_data->controller_info->enable_dma; chip->timeout = TIMOUT_DFLT; } @@ -1236,20 +1223,6 @@ static int setup(struct spi_device *spi) chip->lpss_tx_threshold = tx_thres; } - if (chip->enable_dma) { - /* Set up legal burst and threshold for DMA */ - if (pxa2xx_spi_set_dma_burst_and_threshold(chip, spi, - spi->bits_per_word, - &chip->dma_burst_size, - &chip->dma_threshold)) { - dev_warn(&spi->dev, - "in setup: DMA burst size reduced to match bits_per_word\n"); - } - dev_dbg(&spi->dev, - "in setup: DMA burst size set to %u\n", - chip->dma_burst_size); - } - switch (drv_data->ssp_type) { case QUARK_X1000_SSP: chip->threshold = (QUARK_X1000_SSCR1_RxTresh(rx_thres) @@ -1439,6 +1412,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) if (IS_ERR(platform_info)) return dev_err_probe(dev, PTR_ERR(platform_info), "missing platform data\n"); } + dev_dbg(dev, "DMA burst size set to %u\n", platform_info->dma_burst_size); ssp = pxa_ssp_request(pdev->id, pdev->name); if (!ssp) diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index ae9c99bc9f6c..10294ef209d9 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -79,9 +79,6 @@ struct chip_data { u32 cr1; u32 dds_rate; u32 timeout; - u8 enable_dma; - u32 dma_burst_size; - u32 dma_threshold; u32 threshold; u16 lpss_rx_threshold; u16 lpss_tx_threshold; @@ -142,10 +139,5 @@ extern void pxa2xx_spi_dma_start(struct driver_data *drv_data); extern void pxa2xx_spi_dma_stop(struct driver_data *drv_data); extern int pxa2xx_spi_dma_setup(struct driver_data *drv_data); extern void pxa2xx_spi_dma_release(struct driver_data *drv_data); -extern int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip, - struct spi_device *spi, - u8 bits_per_word, - u32 *burst_code, - u32 *threshold); #endif /* SPI_PXA2XX_H */ From patchwork Wed Apr 17 10:54:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 791168 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 E95E513D53B; Wed, 17 Apr 2024 11:03:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351832; cv=none; b=byLMOhUh7iHFnaX4n8oeDnInhG3WQLg05S77eqRU/MBHh8cPQDBbXf5WmG8eyYcq68XJYQHjkuJo5Q33KCQXYlP44w0aXCKnTvwpVX5ec7eUlPOT/WWFI3gamZJoj2ZPuw2YdcUA72HcFiyanvL37UoM7qdB3b8qzk8Y8jNy6Q0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351832; c=relaxed/simple; bh=9qZmuA7jLecFtZoV4feOe4GVLTIJuoKfF/zfVdw+9zo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tYJo8BOv6/LP4cDwuiGlzMv5GGLaii3wZInSJVchinoZngSRz5Y66DrMN9faLTB/la5rhZQY68uvOsVafLCuNAqFWUfQ+IQ1iM3NiQEoSuH7va9cKRg+idSJy7dwW/8OGAXAKsISraRYM8zPJM8ZE/00ulIQ3i2FqowppvkYaJY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=lTSmCMF6; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lTSmCMF6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713351831; x=1744887831; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9qZmuA7jLecFtZoV4feOe4GVLTIJuoKfF/zfVdw+9zo=; b=lTSmCMF61ASYxaPcxACUiPJ/srReKf4FVkkuV9O/eIvuP5WrhlN55RNl HdW6WHQB3rNQCG44738bH4jK6x+VpATsfucCoUV8O1G/skAoUIeg4fQsI GYGV011a14IKoDzCJaqTL4U4ZvD/1N/fap9UwExjwyVEwXmTvD7aZ0y3f 8ASywVREDRGor0ouczqFaUlkWC6xWIeE4uVzgvPuNpmA7NgDd4HCzDp// Qi9JWVg9LUe64P4iPaE6TTATVILRrAvYKV/vdPcClkXsmGUCYEc8RCIdQ LZrRJD/y8uYFoXDHFc0xVOyTvtO3stY9zcRlWfndl1Q969//yW8lbbog6 w==; X-CSE-ConnectionGUID: /r2GSI1oQtK42qQfds5RNA== X-CSE-MsgGUID: An3vu9AmSVK074CDC406nw== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="8698172" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="8698172" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 04:03:43 -0700 X-CSE-ConnectionGUID: 4bTWfvTES7mPrLoDdsjZqQ== X-CSE-MsgGUID: ADbg6H6IQJWW1oHVrXNl+Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="22653281" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 17 Apr 2024 04:03:41 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id B7B1514F6; Wed, 17 Apr 2024 14:03:36 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v3 8/9] spi: pxa2xx: Remove timeout field from struct chip_data Date: Wed, 17 Apr 2024 13:54:35 +0300 Message-ID: <20240417110334.2671228-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> References: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The timeout field is used only once and assigned to a predefined constant. Replace all that by using the constant directly. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- drivers/spi/spi-pxa2xx.c | 4 +--- drivers/spi/spi-pxa2xx.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 3ba0f5816f7f..030afb17e606 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1058,7 +1058,7 @@ static int pxa2xx_spi_transfer_one(struct spi_controller *controller, pxa_ssp_disable(drv_data->ssp); if (!pxa25x_ssp_comp(drv_data)) - pxa2xx_spi_write(drv_data, SSTO, chip->timeout); + pxa2xx_spi_write(drv_data, SSTO, TIMOUT_DFLT); /* First set CR1 without interrupt and service enables */ pxa2xx_spi_update(drv_data, SSCR1, change_mask, cr1); @@ -1200,8 +1200,6 @@ static int setup(struct spi_device *spi) chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); if (!chip) return -ENOMEM; - - chip->timeout = TIMOUT_DFLT; } chip->cr1 = 0; diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index 10294ef209d9..5f741bb30240 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -78,7 +78,6 @@ struct driver_data { struct chip_data { u32 cr1; u32 dds_rate; - u32 timeout; u32 threshold; u16 lpss_rx_threshold; u16 lpss_tx_threshold; From patchwork Wed Apr 17 10:54:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 791167 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 75F4913DDC1; Wed, 17 Apr 2024 11:03:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351837; cv=none; b=SboA3X+g4yRRoSas0t1iQ1WDjoBrhM1zanfJ/Ie75W2Tof/mMFahJvguRUsrZcwc06wtXPf08ry50zP9Eq2tB2t1iu4iz8//C/7fKAhfWeWkwKgatDdx+rMqwNx9wWK0SX8qDsyLcfHQ8HETFiR6ZwnC0kvpt3GYIbOxgv1WhWM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713351837; c=relaxed/simple; bh=eKJwuwJhkJP8lPZ256GGIvTQ2O29fyGfookXc2AP3LI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o8Apu7mwPmdllTO3GfPY+sWq35YPBjaJpIKBPWt5hgrTYmEHfVLEUK6qKaUAIttz1WHSlZvOcr4gIqrNv5xkvs5G9GI8K6WHS09aA73QsGkvJKGDZty7Zc8/3FFeWS0Hpx3o+VSpK1dHC0hlMM26ihJQaQKsEBmt4hcFeAYnv7Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gNeQx4E1; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gNeQx4E1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713351833; x=1744887833; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eKJwuwJhkJP8lPZ256GGIvTQ2O29fyGfookXc2AP3LI=; b=gNeQx4E1ZPPMzjuLBjxljm4ldj0WwZMqwXG5awpm+cj+2jMAnNZqYLl3 yL69o+TfFCfldwr/SGlBsFU9bHj1hbGv+Nt4CSG77tUcjLZ18BaDQ98hQ qvfmr98AhRAj/kIJedxjjG08kSV6wY3DEhAl8aIg+FSioUGTMcQVzviSM k81FBUBEPjTmN+87IyF4TAPp/yv5ceElUXXSgjyJmWKYKXGKJHK0VGjSp kZbL+BESUr24MMEgowie/pn/3122PIL3+Ci2jvrIMxsakaPQr1xe6A7km aYaxAt7HxxsszWwzB0RXsQvliy9yLFag1ENEofpbnQbDlAaO138bD+/Bs w==; X-CSE-ConnectionGUID: qbvh1V9XSYqEAsnea8ec6A== X-CSE-MsgGUID: GyfY9DBySraO8PFTrxZkKQ== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="8698188" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="8698188" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 04:03:44 -0700 X-CSE-ConnectionGUID: 5ym2ePKORKagtOqI1/Mr8Q== X-CSE-MsgGUID: +5ppQoSEQ/GP0uKHk1l4Zw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="27380729" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 17 Apr 2024 04:03:41 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id BFF241506; Wed, 17 Apr 2024 14:03:36 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King Subject: [PATCH v3 9/9] spi: pxa2xx: Don't provide struct chip_data for others Date: Wed, 17 Apr 2024 13:54:36 +0300 Message-ID: <20240417110334.2671228-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> References: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Now the struct chip_data is local to spi-pxa2xx.c, move its definition to the C file. This will slightly speed up a build and also hide badly named data type (too generic). Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- drivers/spi/spi-pxa2xx.c | 8 ++++++++ drivers/spi/spi-pxa2xx.h | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 030afb17e606..efe76d0c21bb 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -66,6 +66,14 @@ MODULE_ALIAS("platform:pxa2xx-spi"); | CE4100_SSCR1_RFT | CE4100_SSCR1_TFT | SSCR1_MWDS \ | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM) +struct chip_data { + u32 cr1; + u32 dds_rate; + u32 threshold; + u16 lpss_rx_threshold; + u16 lpss_tx_threshold; +}; + #define LPSS_GENERAL_REG_RXTO_HOLDOFF_DISABLE BIT(24) #define LPSS_CS_CONTROL_SW_MODE BIT(0) #define LPSS_CS_CONTROL_CS_HIGH BIT(1) diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index 5f741bb30240..93e1e471e1c6 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -75,14 +75,6 @@ struct driver_data { struct gpio_desc *gpiod_ready; }; -struct chip_data { - u32 cr1; - u32 dds_rate; - u32 threshold; - u16 lpss_rx_threshold; - u16 lpss_tx_threshold; -}; - static inline u32 pxa2xx_spi_read(const struct driver_data *drv_data, u32 reg) { return pxa_ssp_read_reg(drv_data->ssp, reg);