From patchwork Fri May 17 19:47:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 797656 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 977E0140E4D; Fri, 17 May 2024 19:53:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715975632; cv=none; b=DwBqx+oAopSyGY2sWA4c0Q5e8lOWfV1n/12LAS4aB78ZuPPphCTNA2oG1RkAuFVByKWXlGs7wuDo0WuoGJ2Jrse0x0pJ8SGyUvt3W3ccM90hvEEKElvIwlkJyfv0CEBBuq8B8HSVn9paShnThHXQlKIH9XUZRMCPmTQ5BSe/N0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715975632; c=relaxed/simple; bh=0gIMmyJJTI2Ipz0HBjg4zm0dtXuKg8fOksHpUFhIUT8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MwhKLT67LjVeq45/lq0lkZ5hGRTtMwnVvHeS/gjfHh3gCljFrQTiwQ1cE9Xoxbi98edgZ/MWzfwRBtIwIS77s4PDZTpBUZdfFy5CG3lQRhK2Nc6WvaMAoZ3nnmHJ1ucEc0lefnDOI/Sg6YrOIiR2M6faahnG9TKfwitnRKNuyV0= 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=DoN+pkcU; arc=none smtp.client-ip=192.198.163.12 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="DoN+pkcU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975630; x=1747511630; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0gIMmyJJTI2Ipz0HBjg4zm0dtXuKg8fOksHpUFhIUT8=; b=DoN+pkcUQWe/a+4QvDupuIQm4702lvGmm7fyytDacl09mV0fr/XFkJJf gATP0iNUm9cAKL8lIquntFpj+5g1xkM2UoQkxoGs0WwPCwIRRFC0IjTM1 r8zWYElyIXwhW6ByTbJh9cY4zP7O1ewCuu3SJuJ26NhrJkB1QqkqO4RG6 dyiJQzk/4rDzgvGblBhUi91a90p+XRko4itpuR0mEmcXQcVvKJBvuT8zd 0czyQoStVmD8TJYOUy14t9yHDS1eNciLa+RyL3X+jqY6vROjd4Ep/7kU6 U3kJ3zOfJFgvCRO58xckCsaafsFJb8qsJZ1onUZ5wHJ3aw0W7p/TmemSO g==; X-CSE-ConnectionGUID: quSNOe/aQUiq8EiVahdhXQ== X-CSE-MsgGUID: VcfRgHXhRlWeMASrXzBLQg== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="16004899" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="16004899" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:48 -0700 X-CSE-ConnectionGUID: pbsSzbLrRxSzszoL9NFkNg== X-CSE-MsgGUID: zYbAUfGpSa6EtnedYR+6CQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="36313502" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa005.fm.intel.com with ESMTP; 17 May 2024 12:53:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3856B44E; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 03/10] spi: pxa2xx: Remove hard coded number of chip select pins Date: Fri, 17 May 2024 22:47:37 +0300 Message-ID: <20240517195344.813032-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-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 Remove hard coded number of chip select pins for Intel Braswell. This comes via property. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index dee5513936ec..e7087228505e 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -99,7 +99,6 @@ struct lpss_config { /* Chip select control */ unsigned cs_sel_shift; unsigned cs_sel_mask; - unsigned cs_num; /* Quirks */ unsigned cs_clk_stays_gated : 1; }; @@ -137,7 +136,6 @@ static const struct lpss_config lpss_platforms[] = { .tx_threshold_hi = 224, .cs_sel_shift = 2, .cs_sel_mask = 1 << 2, - .cs_num = 2, }, { /* LPSS_SPT_SSP */ .offset = 0x200, @@ -1574,8 +1572,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) tmp &= LPSS_CAPS_CS_EN_MASK; tmp >>= LPSS_CAPS_CS_EN_SHIFT; platform_info->num_chipselect = ffz(tmp); - } else if (config->cs_num) { - platform_info->num_chipselect = config->cs_num; } } controller->num_chipselect = platform_info->num_chipselect; From patchwork Fri May 17 19:47:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 797655 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 B33AE1411E8; Fri, 17 May 2024 19:53:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715975633; cv=none; b=kEZ9Zx3XO/ECI6i7hbVeRnK0zHv6k1SpjKTcZNuSEQ6ZF6Q/tQroMm6aBJooUM8FsC8HDtej80jKJ9/mlcGIg60uAtbEvaxuCh4skymFj/h1HD8SUHxDS9TR1VknNj7tFQLbLWnGy1rCOzZJZNTMZWTVAxVyTIlFrnOeOeyVAH0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715975633; c=relaxed/simple; bh=6yxGDk7ROsAHdlN45SFSGOkUAPyIsLceEo5pzjgzRq0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nUPy2rJZwi0oPitXP+owGFr7Q/HuxPeYN1GJ/6hZavIjequhjQa+FrkEU+L9T+htnELaR45KeRTdxXCv+7KZkX0KSM9LD00Zbw6nW4XqHssRN7MnMHDbWH0U4euF0Wbq8GJGTQ2bk3UNa4Xm27MxxkBGjxL6T+UPIVRyykVYcS4= 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=YGJQmR+x; arc=none smtp.client-ip=198.175.65.18 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="YGJQmR+x" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975632; x=1747511632; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6yxGDk7ROsAHdlN45SFSGOkUAPyIsLceEo5pzjgzRq0=; b=YGJQmR+x07kFasJWFsj83RkQwa0qfmIp/WvRlNRzDTXPSkiyqB3h8PE9 rlqRlrOyNLAGs5XSCiz3OkLIL/h9KGZZE2BOXHkMGFLMqHCEbsnvgwkaD FLbDpbyrs1cD/YLcNOo+LkQkx2mTnRHxQKXceflmx+Tyl6/Ejwii7Q0uJ 8md8vilQBTUhHs2uRfmGsDDlPF4JFBSSFw4938amOO1LueHsX1V0alchK EkCOG1pkatWVMgKBAL2elA47UH7nOuUPJQl/tAGhGdnVk0PUDjDDfBqBL H8XG/qKrhusNkIcVDLbkNxe9tLq4khg3I+T6TzbEXy+sy0olH9IPI+VZE g==; X-CSE-ConnectionGUID: r4mK80jnSbmMki9XUge75Q== X-CSE-MsgGUID: sZURCCQ0S2mkvD96nsrS7g== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="12348660" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="12348660" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:51 -0700 X-CSE-ConnectionGUID: yG+fqxbaS3eJAIHu8L2Vjg== X-CSE-MsgGUID: cYaIy8bnRoWTHwLpCa8toQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="31915014" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 17 May 2024 12:53:49 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 50F664B1; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 05/10] spi: pxa2xx: Print DMA burst size only when DMA is enabled Date: Fri, 17 May 2024 22:47:39 +0300 Message-ID: <20240517195344.813032-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-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 Print DMA burst size only when DMA is enabled to avoid making a false impression that DMA is enabled when it may be not. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 56ff296925b7..6bbeb1d09ed9 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1412,7 +1412,6 @@ 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) @@ -1496,6 +1495,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) controller->max_dma_len = MAX_DMA_LEN; controller->max_transfer_size = pxa2xx_spi_max_dma_transfer_size; + + dev_dbg(dev, "DMA burst size set to %u\n", platform_info->dma_burst_size); } } From patchwork Fri May 17 19:47:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 797653 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 4F9661422A4; Fri, 17 May 2024 19:53:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715975634; cv=none; b=ENUSZSLMUztPDvj0Yr9I+VnWd8lyaD8+MqE41JZvclILhEGdspEza5ZCnm4RwGZ8q/jw7SqRELe+YqRD4GluAo7C/mq99UoV5O7CgeqBVj+WfIeazBx2iLDxgWtzo/rSw8/7t8u+Rny7EcRiw4Iphperg1aiUSzRySI4tTjGb+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715975634; c=relaxed/simple; bh=y0fN4jjiP8CI1asO2p9oSxaF0MzR6arWo4rn+6QIULI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=itblkTHLy/Ebh6Kn4T/FGc0Df9DhnSWcyUXH9FQwJOnDtwwaYU2z9Yft/0Quulmd1f39wpjOufTzhQZ3TCsVbPbHzrrC89LBJoBbMo0cqbVcGQdcSanVcVA5ABhnQJZX/CoXI0J7MnYYbNTnsYAJxZMzQ0G+lOXyEOIW0tOFjVQ= 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=RwvGRjHG; arc=none smtp.client-ip=198.175.65.18 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="RwvGRjHG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975633; x=1747511633; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=y0fN4jjiP8CI1asO2p9oSxaF0MzR6arWo4rn+6QIULI=; b=RwvGRjHGgiw/tu+QPvI5IKtewo67YGbMhGg40JVd98TcIS+bdBnFKuPZ 5SRRyvLxZQV0RrxHpyHmtE7sM0B3HaINS29nq6qDA79vSx8sXg8Iu0SkV gP2kxEi92Fo6bqurHLpnyCsiPvztVzWfWK9cfaFpbgg+8L625Ibl56RB4 8M8RR3vT0UH+MxPrQS5KvLeL6z3sghwBKE+lfcDD6MncuFIFzS/Qz6KrU bvyVzYUHvQQ6svFpAuQOfUDWyFYj9YDXIw78RpFP27uA2LGOVrOjzPzJT kAeepbZQh1CeBeGiV6RdSUyMmZmEMKdfw9SvyejQu23+2rwXtkllZqj+2 w==; X-CSE-ConnectionGUID: jfCCpSd2Ts2JWp4IoqElzw== X-CSE-MsgGUID: Ni+KzhoESdyBFNa/uBl8+w== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="12348679" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="12348679" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:52 -0700 X-CSE-ConnectionGUID: cp0OGmhWSwOiPsy7hw7/TA== X-CSE-MsgGUID: 44wEwEV0SbmoZyp3eCNvrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="31915017" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 17 May 2024 12:53:49 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 665A455A; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 07/10] spi: pxa2xx: Remove superflous check for Intel Atom SoCs Date: Fri, 17 May 2024 22:47:41 +0300 Message-ID: <20240517195344.813032-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-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 pxa2xx_spi_fw_translate_cs() checks for the ACPI companion device presence along with the SSP type. But the SSP type is uniquely determines the case. Hence remove the superflous check. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index cd28b798b53b..3ea4b9821a8e 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1371,23 +1371,19 @@ static int pxa2xx_spi_fw_translate_cs(struct spi_controller *controller, { struct driver_data *drv_data = spi_controller_get_devdata(controller); - if (has_acpi_companion(drv_data->ssp->dev)) { - switch (drv_data->ssp_type) { - /* - * For Atoms the ACPI DeviceSelection used by the Windows - * driver starts from 1 instead of 0 so translate it here - * to match what Linux expects. - */ - case LPSS_BYT_SSP: - case LPSS_BSW_SSP: - return cs - 1; + switch (drv_data->ssp_type) { + /* + * For some of Intel Atoms the ACPI DeviceSelection used by the Windows + * driver starts from 1 instead of 0 so translate it here to match what + * Linux expects. + */ + case LPSS_BYT_SSP: + case LPSS_BSW_SSP: + return cs - 1; - default: - break; - } + default: + return cs; } - - return cs; } static size_t pxa2xx_spi_max_dma_transfer_size(struct spi_device *spi) From patchwork Fri May 17 19:47:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 797654 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 24E1B14198A; Fri, 17 May 2024 19:53:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715975633; cv=none; b=VtZB817mS/CVDuVC0NkQvtenMg50L16rBmDMkOu5QcTH54o4UhXVf7MgndsHLLKTuJZDgcd9UbD9qziqZnzrLekZVP7Ufv1hp2R2BJDLfL1/PCz9+HKUNMc4ZI1QOpWDnH3pR1MqDgPetIZZdifbOUlS6tffPK7pWr3qT6iCaY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715975633; c=relaxed/simple; bh=y1UPm7DX7C60ENAe+k+9dpW4n3R67mPRIBKTRmhcBrk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NetHaHWPRCBkkTC8h8VyToLgZBKu5EACi+XrMa00ZAYarl6AdAYaPji31LFygTSeXyEx8q5bn2ArCmtKQlfeFeEDXOJ3B4J8O3cnLnek7bw+eva4eN+JoqkrEDXjE3czN44fhk82hog63hUzMzqEZqqh24PKxiF4EPVrzt9HFkM= 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=I77hG0Qm; arc=none smtp.client-ip=192.198.163.12 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="I77hG0Qm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715975632; x=1747511632; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=y1UPm7DX7C60ENAe+k+9dpW4n3R67mPRIBKTRmhcBrk=; b=I77hG0QmaMJxkxCyc+h8xqoTkLsOCh5lyNB1ylLL1hQM+l5RO2PFdm0q LVWXnWxFFHu5/DJ+06iz3eBfR80EqE+5X80tQ2x3NX24JheytbSPOE6A3 D8Z58V0FsIWFnAwME65EtPYYfciqDhz92vxVtjvtI+QM7lJG3B+qfY92j DjJLn7RXpMVdSt/S8XP9WdTnuL7tVDFWA7E8Im4YMb0tY3tO33xKeH2QJ whVb69Nfxd0vvr425mRBXGaF8CzUB8NRS6YitWLoMe96/vFvZ86NG/1PR iMtF1zT6XFJW90zErbSZRVJmqZVRYyRguBOiIHafEote0/u0yBfz6bZC0 g==; X-CSE-ConnectionGUID: /ou79cBoTaiyflhEbT0oHw== X-CSE-MsgGUID: vB2Dj5zZTyGd+LIpld5gBA== X-IronPort-AV: E=McAfee;i="6600,9927,11075"; a="16004917" X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="16004917" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 12:53:51 -0700 X-CSE-ConnectionGUID: Wft6TsYRRoSZHbMsnWL+HA== X-CSE-MsgGUID: fzXitw+FQg2Sx5qys0iupA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,168,1712646000"; d="scan'208";a="36313506" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa005.fm.intel.com with ESMTP; 17 May 2024 12:53:49 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 727D45C5; Fri, 17 May 2024 22:53:45 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v1 08/10] spi: pxa2xx: Extract pxa2xx_spi_platform_*() callbacks Date: Fri, 17 May 2024 22:47:42 +0300 Message-ID: <20240517195344.813032-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240517195344.813032-1-andriy.shevchenko@linux.intel.com> References: <20240517195344.813032-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 preparation of the extracting platform driver from spi-pxa2xx.c split the probe and remove functions so we have bus independent and platform device ones. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 63 +++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 3ea4b9821a8e..f53827d61a21 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1391,28 +1391,16 @@ static size_t pxa2xx_spi_max_dma_transfer_size(struct spi_device *spi) return MAX_DMA_LEN; } -static int pxa2xx_spi_probe(struct platform_device *pdev) +static int pxa2xx_spi_probe(struct device *dev, struct ssp_device *ssp) { - struct device *dev = &pdev->dev; struct pxa2xx_spi_controller *platform_info; struct spi_controller *controller; struct driver_data *drv_data; - struct ssp_device *ssp; const struct lpss_config *config; int status; u32 tmp; platform_info = dev_get_platdata(dev); - if (!platform_info) { - platform_info = pxa2xx_spi_init_pdata(pdev); - if (IS_ERR(platform_info)) - return dev_err_probe(dev, PTR_ERR(platform_info), "missing platform data\n"); - } - - ssp = pxa_ssp_request(pdev->id, pdev->name); - if (!ssp) - ssp = &platform_info->ssp; - if (platform_info->is_target) controller = devm_spi_alloc_target(dev, sizeof(*drv_data)); else @@ -1610,9 +1598,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) return status; } -static void pxa2xx_spi_remove(struct platform_device *pdev) +static void pxa2xx_spi_remove(struct device *dev) { - struct device *dev = &pdev->dev; struct driver_data *drv_data = dev_get_drvdata(dev); struct ssp_device *ssp = drv_data->ssp; @@ -1633,9 +1620,6 @@ static void pxa2xx_spi_remove(struct platform_device *pdev) /* Release IRQ */ free_irq(ssp->irq, drv_data); - - /* Release SSP */ - pxa_ssp_free(ssp); } static int pxa2xx_spi_suspend(struct device *dev) @@ -1693,6 +1677,45 @@ static const struct dev_pm_ops pxa2xx_spi_pm_ops = { RUNTIME_PM_OPS(pxa2xx_spi_runtime_suspend, pxa2xx_spi_runtime_resume, NULL) }; +static int pxa2xx_spi_platform_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct pxa2xx_spi_controller *platform_info; + struct ssp_device *ssp; + int status; + + platform_info = dev_get_platdata(dev); + if (!platform_info) { + platform_info = pxa2xx_spi_init_pdata(pdev); + if (IS_ERR(platform_info)) + return dev_err_probe(dev, PTR_ERR(platform_info), "missing platform data\n"); + + dev->platform_data = platform_info; + + } + + ssp = pxa_ssp_request(pdev->id, pdev->name); + if (!ssp) + ssp = &platform_info->ssp; + + status = pxa2xx_spi_probe(dev, ssp); + if (status) + pxa_ssp_free(ssp); + + return status; +} + +static void pxa2xx_spi_platform_remove(struct platform_device *pdev) +{ + struct driver_data *drv_data = platform_get_drvdata(pdev); + struct ssp_device *ssp = drv_data->ssp; + + pxa2xx_spi_remove(&pdev->dev); + + /* Release SSP */ + pxa_ssp_free(ssp); +} + static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { { "80860F0E" }, { "8086228E" }, @@ -1717,8 +1740,8 @@ static struct platform_driver driver = { .acpi_match_table = pxa2xx_spi_acpi_match, .of_match_table = pxa2xx_spi_of_match, }, - .probe = pxa2xx_spi_probe, - .remove_new = pxa2xx_spi_remove, + .probe = pxa2xx_spi_platform_probe, + .remove_new = pxa2xx_spi_platform_remove, }; static int __init pxa2xx_spi_init(void)