Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1366486lqb; Thu, 30 May 2024 08:12:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXPRLN9jZ7a061WfiPezxzgS4Wio86PjRZ3iv1U3l7qHI9AGx5387xRLVr3ZLMG4aSx3KCEkDduZcrpLIZgLv4xEwJqZmh+KoD7UwHYjw== X-Google-Smtp-Source: AGHT+IFRFQe3s+hfHWn9l9grzcxK4lV6Pi3puSQ6a7NVmgHjblpIoH1Nh8EkySkoJ7pozdhQOXQi X-Received: by 2002:a05:6870:d695:b0:24f:cb64:9bfe with SMTP id 586e51a60fabf-25060b78967mr2877602fac.21.1717081933270; Thu, 30 May 2024 08:12:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717081933; cv=pass; d=google.com; s=arc-20160816; b=GXAezp8/d+SO+T5a6HXixEHNk26fDUJUbYgiNOo3tAQQvrm/yh/g5iWxxpNgJJhWSM O9UtATT2u2vYgQbt/PXjrVyiw9fWT5fHWx5i+6z3OQefDw69YfXvRgzmCIW0XYeuPPy2 n07Q9TrsWZRezTG22hVqwB66zcugqOPBNkfC8Rp/+uVjN1wDoT5rs+zgWAAAPraPukVH TK2kAO/jt9qhMf6DoeKAmMRHPBjTILjb2ACvNDrFxuMdgEweClENi4TxVOehnmAK5ldx mYOY3Tbmzy7YKksSEnxFD2gLIkcLVwcCJZJsHKD2vh5wFaISLJi2og8IhnFu6Wk5R1yC FDqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bUyHMXavJuPwI3xAc385VUHyjZRqUFsko0MVj71LpLA=; fh=LDKqGB8ZNl8NmJgUmuofQ9Azw0SMDgDBwSQzUt/rWWA=; b=x84CNqIT2rXLCVM2RdWXUmdvQBgMX78LFPTjB1SQuKLJRhl1N2y0KC0iOBc9yMRRl+ XTZMSoI2USem6BdO3jGypyknV5fzq9ZdhW0kx+aOWr841DN47a9L2AmOc+sTmvqk/UW/ cWftEysh3XXDN/DU4IpKMw4w3o6bELkBgYdwhzbGhHu7FIIxc+5N+zTgkowfq6oQVZTZ LsGRBm84oRxyuCGB77VeI4GIhi+vJRmmFh+hDn5ycRI2LjH90OnD4CBpJQWFQ8M38Eky Hv4Eix/2ZpTJT3/v/BxatBWdDjaIJcUYNjQSz6bzMHJDOwfjJp9W6Kgy0uyR7oXFa3Ps gzeQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QMnHOawy; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-195574-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195574-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ada2fe7eead31-48a3a20557esi2992468137.94.2024.05.30.08.12.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 08:12:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195574-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QMnHOawy; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-195574-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195574-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2BA2E1C23EE3 for ; Thu, 30 May 2024 15:12:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E43F18628B; Thu, 30 May 2024 15:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QMnHOawy" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 23CB1183069; Thu, 30 May 2024 15:11:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717081886; cv=none; b=L0Eq7JrRjvJewebE2hEaC0lcaibtbOAMz8dvrYY5lPix7AE2MUrBiQDu8XpFfxcC9uNd1Yym1w+qhKCRloSONWTOS6uzTPeJc0yxWEdMzeko1HxCwCSO5hu7fHy0a8dzTJDvnM088QbyMpyvw50uPJKPg41FISHtYq8oySz3JrI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717081886; c=relaxed/simple; bh=xuQ6DZkTEDRxFoGQhloOJPIufIaUVMudZOmQbEL7V4Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lm/tP6lVYWg+yrKUPzBk2fbfGr9wkyLgfaG8gdjp4ignsFwwIAuf6Bh84I9We+u3kdlSkrnr/rDh9VElusEsX92TuFj0xo2bu1EWCplOXfkRhYIFl+p/cAxVETsKh+jBC616D5izq/GASyl+7aWHmBcJs+84ujZP8n01Rn34OUI= 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=QMnHOawy; arc=none smtp.client-ip=198.175.65.10 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717081885; x=1748617885; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xuQ6DZkTEDRxFoGQhloOJPIufIaUVMudZOmQbEL7V4Q=; b=QMnHOawylzn5BpobWuukWsrntADyQKpMT//9lujXVWwgSSv+ozPvoXh/ WVdt6zd+f62f4+vc595dCuSpcW6puTe0dkLzpIYqMaItnw/T1U7HOzBjB sdKt04hQo/idrHa3RpkhmIP7smXbxfMkNAZVTcM3Hm4cV1/AbpcfdxDSl Z+88XSm3/2s39Cx0wyTJAJN2FuEajeOqmz+h76jHbYgg8h5XZ1/4c8OZj tn3y0/0RxgLNtcJK+mx2PcsuXA6BVRF7gDr9m4ShzhGkH9VSKfOFQAwRr rPs+KwnA4BEtMH6BDSgQ4c3wU07qxmM8yyX6e/izVfO/30SgOhI8k4jn2 w==; X-CSE-ConnectionGUID: igPybMNDQHGXLEI0PLk+wg== X-CSE-MsgGUID: 6j5A4VV8TyaimG7B+w1d6w== X-IronPort-AV: E=McAfee;i="6600,9927,11088"; a="31067931" X-IronPort-AV: E=Sophos;i="6.08,201,1712646000"; d="scan'208";a="31067931" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2024 08:11:22 -0700 X-CSE-ConnectionGUID: RHkbdXUlRvKwVAoxgpxB+g== X-CSE-MsgGUID: wsKMsGyIQ363d/2wS2JSeA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,201,1712646000"; d="scan'208";a="73329421" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa001.jf.intel.com with ESMTP; 30 May 2024 08:11:21 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2C1252DC; Thu, 30 May 2024 18:11:19 +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 v2 02/11] spi: pxa2xx: Reorganize the SSP type retrieval Date: Thu, 30 May 2024 18:09:58 +0300 Message-ID: <20240530151117.1130792-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240530151117.1130792-1-andriy.shevchenko@linux.intel.com> References: <20240530151117.1130792-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The old Intel platforms, such as Intel Braswell, also provide the property of SSP type. Reorganize the pxa2xx_spi_init_pdata() to take that into account. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 820a3702447a..f4dc113768cd 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1331,19 +1331,21 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) struct pxa2xx_spi_controller *pdata; struct device *dev = &pdev->dev; struct device *parent = dev->parent; + const void *match = device_get_match_data(dev); enum pxa_ssp_type type = SSP_UNDEFINED; - struct ssp_device *ssp = NULL; - const void *match; + struct ssp_device *ssp; bool is_lpss_priv; u32 num_cs = 1; int status; - is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); - - match = device_get_match_data(dev); - if (match) - type = (uintptr_t)match; - else if (is_lpss_priv) { + ssp = pxa2xx_spi_ssp_request(pdev); + if (IS_ERR(ssp)) + return ERR_CAST(ssp); + if (ssp) { + type = ssp->type; + } else if (match) { + type = (enum pxa_ssp_type)(uintptr_t)match; + } else { u32 value; status = device_property_read_u32(dev, "intel,spi-pxa2xx-type", &value); @@ -1351,12 +1353,6 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) return ERR_PTR(status); type = (enum pxa_ssp_type)value; - } else { - ssp = pxa2xx_spi_ssp_request(pdev); - if (IS_ERR(ssp)) - return ERR_CAST(ssp); - if (ssp) - type = ssp->type; } /* Validate the SSP type correctness */ @@ -1368,6 +1364,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) return ERR_PTR(-ENOMEM); /* Platforms with iDMA 64-bit */ + is_lpss_priv = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); if (is_lpss_priv) { pdata->tx_param = parent; pdata->rx_param = parent; -- 2.43.0.rc1.1336.g36b5255a03ac