b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | From: Christian Lamparter <chunkeey@gmail.com> |
| 2 | Date: Sat, 16 Nov 2019 19:25:24 +0100 |
| 3 | Subject: [PATCH] owl_loader: compatibility patch |
| 4 | |
| 5 | This patch includes OpenWrt specific changes that are |
| 6 | not included in the upstream owl-loader. |
| 7 | |
| 8 | This includes a platform data handling changes for ar71xx. |
| 9 | |
| 10 | Signed-off-by: Christian Lamparter <chunkeey@gmail.com> |
| 11 | |
| 12 | --- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c |
| 13 | +++ b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c |
| 14 | @@ -103,6 +103,7 @@ static void owl_fw_cb(const struct firmw |
| 15 | { |
| 16 | struct pci_dev *pdev = (struct pci_dev *)context; |
| 17 | struct owl_ctx *ctx = (struct owl_ctx *)pci_get_drvdata(pdev); |
| 18 | + struct ath9k_platform_data *pdata = dev_get_platdata(&pdev->dev); |
| 19 | struct pci_bus *bus; |
| 20 | |
| 21 | complete(&ctx->eeprom_load); |
| 22 | @@ -118,6 +119,16 @@ static void owl_fw_cb(const struct firmw |
| 23 | goto release; |
| 24 | } |
| 25 | |
| 26 | + if (pdata) { |
| 27 | + memcpy(pdata->eeprom_data, fw->data, fw->size); |
| 28 | + |
| 29 | + /* |
| 30 | + * eeprom has been successfully loaded - pass the data to ath9k |
| 31 | + * but remove the eeprom_name, so it doesn't try to load it too. |
| 32 | + */ |
| 33 | + pdata->eeprom_name = NULL; |
| 34 | + } |
| 35 | + |
| 36 | if (ath9k_pci_fixup(pdev, (const u16 *)fw->data, fw->size)) |
| 37 | goto release; |
| 38 | |
| 39 | @@ -137,8 +148,14 @@ release: |
| 40 | static const char *owl_get_eeprom_name(struct pci_dev *pdev) |
| 41 | { |
| 42 | struct device *dev = &pdev->dev; |
| 43 | + struct ath9k_platform_data *pdata; |
| 44 | char *eeprom_name; |
| 45 | |
| 46 | + /* try the existing platform data first */ |
| 47 | + pdata = dev_get_platdata(dev); |
| 48 | + if (pdata && pdata->eeprom_name) |
| 49 | + return pdata->eeprom_name; |
| 50 | + |
| 51 | dev_dbg(dev, "using auto-generated eeprom filename\n"); |
| 52 | |
| 53 | eeprom_name = devm_kzalloc(dev, EEPROM_FILENAME_LEN, GFP_KERNEL); |