spi-pxa2xx.c (6dc81f6fc0eaf0714bc6e959f8769705f41fd708) | spi-pxa2xx.c (cddb339badb03dd96a5272195eec17e7899df154) |
---|---|
1/* 2 * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs 3 * Copyright (C) 2013, Intel Corporation 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 1026 unchanged lines hidden (view full) --- 1035 1036 if (drv_data->ssp_type != CE4100_SSP && gpio_is_valid(chip->gpio_cs)) 1037 gpio_free(chip->gpio_cs); 1038 1039 kfree(chip); 1040} 1041 1042#ifdef CONFIG_ACPI | 1/* 2 * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs 3 * Copyright (C) 2013, Intel Corporation 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 1026 unchanged lines hidden (view full) --- 1035 1036 if (drv_data->ssp_type != CE4100_SSP && gpio_is_valid(chip->gpio_cs)) 1037 gpio_free(chip->gpio_cs); 1038 1039 kfree(chip); 1040} 1041 1042#ifdef CONFIG_ACPI |
1043static int pxa2xx_spi_acpi_add_dma(struct acpi_resource *res, void *data) 1044{ 1045 struct pxa2xx_spi_master *pdata = data; 1046 1047 if (res->type == ACPI_RESOURCE_TYPE_FIXED_DMA) { 1048 const struct acpi_resource_fixed_dma *dma; 1049 1050 dma = &res->data.fixed_dma; 1051 if (pdata->tx_slave_id < 0) { 1052 pdata->tx_slave_id = dma->request_lines; 1053 pdata->tx_chan_id = dma->channels; 1054 } else if (pdata->rx_slave_id < 0) { 1055 pdata->rx_slave_id = dma->request_lines; 1056 pdata->rx_chan_id = dma->channels; 1057 } 1058 } 1059 1060 /* Tell the ACPI core to skip this resource */ 1061 return 1; 1062} 1063 | |
1064static struct pxa2xx_spi_master * 1065pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) 1066{ 1067 struct pxa2xx_spi_master *pdata; | 1043static struct pxa2xx_spi_master * 1044pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) 1045{ 1046 struct pxa2xx_spi_master *pdata; |
1068 struct list_head resource_list; | |
1069 struct acpi_device *adev; 1070 struct ssp_device *ssp; 1071 struct resource *res; 1072 int devid; 1073 1074 if (!ACPI_HANDLE(&pdev->dev) || 1075 acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev)) 1076 return NULL; --- 21 unchanged lines hidden (view full) --- 1098 ssp->type = LPSS_SSP; 1099 ssp->pdev = pdev; 1100 1101 ssp->port_id = -1; 1102 if (adev->pnp.unique_id && !kstrtoint(adev->pnp.unique_id, 0, &devid)) 1103 ssp->port_id = devid; 1104 1105 pdata->num_chipselect = 1; | 1047 struct acpi_device *adev; 1048 struct ssp_device *ssp; 1049 struct resource *res; 1050 int devid; 1051 1052 if (!ACPI_HANDLE(&pdev->dev) || 1053 acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev)) 1054 return NULL; --- 21 unchanged lines hidden (view full) --- 1076 ssp->type = LPSS_SSP; 1077 ssp->pdev = pdev; 1078 1079 ssp->port_id = -1; 1080 if (adev->pnp.unique_id && !kstrtoint(adev->pnp.unique_id, 0, &devid)) 1081 ssp->port_id = devid; 1082 1083 pdata->num_chipselect = 1; |
1106 pdata->rx_slave_id = -1; 1107 pdata->tx_slave_id = -1; | 1084 pdata->enable_dma = true; |
1108 | 1085 |
1109 INIT_LIST_HEAD(&resource_list); 1110 acpi_dev_get_resources(adev, &resource_list, pxa2xx_spi_acpi_add_dma, 1111 pdata); 1112 acpi_dev_free_resource_list(&resource_list); 1113 1114 pdata->enable_dma = pdata->rx_slave_id >= 0 && pdata->tx_slave_id >= 0; 1115 | |
1116 return pdata; 1117} 1118 1119static struct acpi_device_id pxa2xx_spi_acpi_match[] = { 1120 { "INT33C0", 0 }, 1121 { "INT33C1", 0 }, 1122 { }, 1123}; --- 85 unchanged lines hidden (view full) --- 1209 } 1210 1211 /* Setup DMA if requested */ 1212 drv_data->tx_channel = -1; 1213 drv_data->rx_channel = -1; 1214 if (platform_info->enable_dma) { 1215 status = pxa2xx_spi_dma_setup(drv_data); 1216 if (status) { | 1086 return pdata; 1087} 1088 1089static struct acpi_device_id pxa2xx_spi_acpi_match[] = { 1090 { "INT33C0", 0 }, 1091 { "INT33C1", 0 }, 1092 { }, 1093}; --- 85 unchanged lines hidden (view full) --- 1179 } 1180 1181 /* Setup DMA if requested */ 1182 drv_data->tx_channel = -1; 1183 drv_data->rx_channel = -1; 1184 if (platform_info->enable_dma) { 1185 status = pxa2xx_spi_dma_setup(drv_data); 1186 if (status) { |
1217 dev_warn(dev, "failed to setup DMA, using PIO\n"); | 1187 dev_dbg(dev, "no DMA channels available, using PIO\n"); |
1218 platform_info->enable_dma = false; 1219 } 1220 } 1221 1222 /* Enable SOC clock */ 1223 clk_prepare_enable(ssp->clk); 1224 1225 drv_data->max_clk_rate = clk_get_rate(ssp->clk); --- 175 unchanged lines hidden --- | 1188 platform_info->enable_dma = false; 1189 } 1190 } 1191 1192 /* Enable SOC clock */ 1193 clk_prepare_enable(ssp->clk); 1194 1195 drv_data->max_clk_rate = clk_get_rate(ssp->clk); --- 175 unchanged lines hidden --- |