aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSuthikulpanit, Suravee <Suravee.Suthikulpanit@amd.com>2015-06-10 12:08:56 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-06-15 08:40:49 -0400
commitc9a49642aef95d5adb6b7a4bd6a6f5df852cdb98 (patch)
treebf8450a9902fdb304a7063ca14a3ae8282741032 /drivers/net
parent04825cfedf525b455384547adb90102d02b293b4 (diff)
amd-xgbe: Unify coherency checking logic with device_dma_is_coherent()
Currently, amd-xgbe driver has separate logic to determine device coherency for DT vs. ACPI. This patch simplifies the code with a call to device_dma_is_coherent(). Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-main.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
index 714905384900..6d2c702c8e4a 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
@@ -168,13 +168,8 @@ static void xgbe_init_all_fptrs(struct xgbe_prv_data *pdata)
168#ifdef CONFIG_ACPI 168#ifdef CONFIG_ACPI
169static int xgbe_acpi_support(struct xgbe_prv_data *pdata) 169static int xgbe_acpi_support(struct xgbe_prv_data *pdata)
170{ 170{
171 struct acpi_device *adev = pdata->adev;
172 struct device *dev = pdata->dev; 171 struct device *dev = pdata->dev;
173 u32 property; 172 u32 property;
174 acpi_handle handle;
175 acpi_status status;
176 unsigned long long data;
177 int cca;
178 int ret; 173 int ret;
179 174
180 /* Obtain the system clock setting */ 175 /* Obtain the system clock setting */
@@ -195,24 +190,6 @@ static int xgbe_acpi_support(struct xgbe_prv_data *pdata)
195 } 190 }
196 pdata->ptpclk_rate = property; 191 pdata->ptpclk_rate = property;
197 192
198 /* Retrieve the device cache coherency value */
199 handle = adev->handle;
200 do {
201 status = acpi_evaluate_integer(handle, "_CCA", NULL, &data);
202 if (!ACPI_FAILURE(status)) {
203 cca = data;
204 break;
205 }
206
207 status = acpi_get_parent(handle, &handle);
208 } while (!ACPI_FAILURE(status));
209
210 if (ACPI_FAILURE(status)) {
211 dev_err(dev, "error obtaining acpi coherency value\n");
212 return -EINVAL;
213 }
214 pdata->coherent = !!cca;
215
216 return 0; 193 return 0;
217} 194}
218#else /* CONFIG_ACPI */ 195#else /* CONFIG_ACPI */
@@ -243,9 +220,6 @@ static int xgbe_of_support(struct xgbe_prv_data *pdata)
243 } 220 }
244 pdata->ptpclk_rate = clk_get_rate(pdata->ptpclk); 221 pdata->ptpclk_rate = clk_get_rate(pdata->ptpclk);
245 222
246 /* Retrieve the device cache coherency value */
247 pdata->coherent = of_dma_is_coherent(dev->of_node);
248
249 return 0; 223 return 0;
250} 224}
251#else /* CONFIG_OF */ 225#else /* CONFIG_OF */
@@ -364,6 +338,7 @@ static int xgbe_probe(struct platform_device *pdev)
364 goto err_io; 338 goto err_io;
365 339
366 /* Set the DMA coherency values */ 340 /* Set the DMA coherency values */
341 pdata->coherent = device_dma_is_coherent(pdata->dev);
367 if (pdata->coherent) { 342 if (pdata->coherent) {
368 pdata->axdomain = XGBE_DMA_OS_AXDOMAIN; 343 pdata->axdomain = XGBE_DMA_OS_AXDOMAIN;
369 pdata->arcache = XGBE_DMA_OS_ARCACHE; 344 pdata->arcache = XGBE_DMA_OS_ARCACHE;