mirror of
				git://git.openwrt.org/openwrt/openwrt.git
				synced 2025-10-30 13:34:27 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			241 lines
		
	
	
		
			8.0 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			241 lines
		
	
	
		
			8.0 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From: Arend van Spriel <arend@broadcom.com>
 | |
| Date: Wed, 11 Mar 2015 16:11:29 +0100
 | |
| Subject: [PATCH] brcmfmac: rename chip download functions
 | |
| 
 | |
| The functions brcmf_chip_[enter/exit]_download() are not exclusively
 | |
| used for firmware download so rename these more appropriate.
 | |
| 
 | |
| Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
 | |
| Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
 | |
| Signed-off-by: Arend van Spriel <arend@broadcom.com>
 | |
| Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
 | |
| ---
 | |
| 
 | |
| --- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
 | |
| +++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
 | |
| @@ -807,7 +807,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
 | |
|  		err = -EINVAL;
 | |
|  	if (WARN_ON(!ops->prepare))
 | |
|  		err = -EINVAL;
 | |
| -	if (WARN_ON(!ops->exit_dl))
 | |
| +	if (WARN_ON(!ops->activate))
 | |
|  		err = -EINVAL;
 | |
|  	if (err < 0)
 | |
|  		return ERR_PTR(-EINVAL);
 | |
| @@ -905,7 +905,7 @@ void brcmf_chip_resetcore(struct brcmf_c
 | |
|  }
 | |
|  
 | |
|  static void
 | |
| -brcmf_chip_cm3_enterdl(struct brcmf_chip_priv *chip)
 | |
| +brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
 | |
|  {
 | |
|  	struct brcmf_core *core;
 | |
|  
 | |
| @@ -919,7 +919,7 @@ brcmf_chip_cm3_enterdl(struct brcmf_chip
 | |
|  	brcmf_chip_resetcore(core, 0, 0, 0);
 | |
|  }
 | |
|  
 | |
| -static bool brcmf_chip_cm3_exitdl(struct brcmf_chip_priv *chip)
 | |
| +static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
 | |
|  {
 | |
|  	struct brcmf_core *core;
 | |
|  
 | |
| @@ -929,7 +929,7 @@ static bool brcmf_chip_cm3_exitdl(struct
 | |
|  		return false;
 | |
|  	}
 | |
|  
 | |
| -	chip->ops->exit_dl(chip->ctx, &chip->pub, 0);
 | |
| +	chip->ops->activate(chip->ctx, &chip->pub, 0);
 | |
|  
 | |
|  	core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CM3);
 | |
|  	brcmf_chip_resetcore(core, 0, 0, 0);
 | |
| @@ -938,7 +938,7 @@ static bool brcmf_chip_cm3_exitdl(struct
 | |
|  }
 | |
|  
 | |
|  static inline void
 | |
| -brcmf_chip_cr4_enterdl(struct brcmf_chip_priv *chip)
 | |
| +brcmf_chip_cr4_set_passive(struct brcmf_chip_priv *chip)
 | |
|  {
 | |
|  	struct brcmf_core *core;
 | |
|  
 | |
| @@ -951,11 +951,11 @@ brcmf_chip_cr4_enterdl(struct brcmf_chip
 | |
|  			     D11_BCMA_IOCTL_PHYCLOCKEN);
 | |
|  }
 | |
|  
 | |
| -static bool brcmf_chip_cr4_exitdl(struct brcmf_chip_priv *chip, u32 rstvec)
 | |
| +static bool brcmf_chip_cr4_set_active(struct brcmf_chip_priv *chip, u32 rstvec)
 | |
|  {
 | |
|  	struct brcmf_core *core;
 | |
|  
 | |
| -	chip->ops->exit_dl(chip->ctx, &chip->pub, rstvec);
 | |
| +	chip->ops->activate(chip->ctx, &chip->pub, rstvec);
 | |
|  
 | |
|  	/* restore ARM */
 | |
|  	core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CR4);
 | |
| @@ -964,7 +964,7 @@ static bool brcmf_chip_cr4_exitdl(struct
 | |
|  	return true;
 | |
|  }
 | |
|  
 | |
| -void brcmf_chip_enter_download(struct brcmf_chip *pub)
 | |
| +void brcmf_chip_set_passive(struct brcmf_chip *pub)
 | |
|  {
 | |
|  	struct brcmf_chip_priv *chip;
 | |
|  	struct brcmf_core *arm;
 | |
| @@ -974,14 +974,14 @@ void brcmf_chip_enter_download(struct br
 | |
|  	chip = container_of(pub, struct brcmf_chip_priv, pub);
 | |
|  	arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
 | |
|  	if (arm) {
 | |
| -		brcmf_chip_cr4_enterdl(chip);
 | |
| +		brcmf_chip_cr4_set_passive(chip);
 | |
|  		return;
 | |
|  	}
 | |
|  
 | |
| -	brcmf_chip_cm3_enterdl(chip);
 | |
| +	brcmf_chip_cm3_set_passive(chip);
 | |
|  }
 | |
|  
 | |
| -bool brcmf_chip_exit_download(struct brcmf_chip *pub, u32 rstvec)
 | |
| +bool brcmf_chip_set_active(struct brcmf_chip *pub, u32 rstvec)
 | |
|  {
 | |
|  	struct brcmf_chip_priv *chip;
 | |
|  	struct brcmf_core *arm;
 | |
| @@ -991,9 +991,9 @@ bool brcmf_chip_exit_download(struct brc
 | |
|  	chip = container_of(pub, struct brcmf_chip_priv, pub);
 | |
|  	arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
 | |
|  	if (arm)
 | |
| -		return brcmf_chip_cr4_exitdl(chip, rstvec);
 | |
| +		return brcmf_chip_cr4_set_active(chip, rstvec);
 | |
|  
 | |
| -	return brcmf_chip_cm3_exitdl(chip);
 | |
| +	return brcmf_chip_cm3_set_active(chip);
 | |
|  }
 | |
|  
 | |
|  bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
 | |
| --- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
 | |
| +++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
 | |
| @@ -64,7 +64,7 @@ struct brcmf_core {
 | |
|   * @write32: write 32-bit value over bus.
 | |
|   * @prepare: prepare bus for core configuration.
 | |
|   * @setup: bus-specific core setup.
 | |
| - * @exit_dl: exit download state.
 | |
| + * @active: chip becomes active.
 | |
|   *	The callback should use the provided @rstvec when non-zero.
 | |
|   */
 | |
|  struct brcmf_buscore_ops {
 | |
| @@ -72,7 +72,7 @@ struct brcmf_buscore_ops {
 | |
|  	void (*write32)(void *ctx, u32 addr, u32 value);
 | |
|  	int (*prepare)(void *ctx);
 | |
|  	int (*setup)(void *ctx, struct brcmf_chip *chip);
 | |
| -	void (*exit_dl)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
 | |
| +	void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
 | |
|  };
 | |
|  
 | |
|  struct brcmf_chip *brcmf_chip_attach(void *ctx,
 | |
| @@ -84,8 +84,8 @@ bool brcmf_chip_iscoreup(struct brcmf_co
 | |
|  void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
 | |
|  void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
 | |
|  			  u32 postreset);
 | |
| -void brcmf_chip_enter_download(struct brcmf_chip *ci);
 | |
| -bool brcmf_chip_exit_download(struct brcmf_chip *ci, u32 rstvec);
 | |
| +void brcmf_chip_set_passive(struct brcmf_chip *ci);
 | |
| +bool brcmf_chip_set_active(struct brcmf_chip *ci, u32 rstvec);
 | |
|  bool brcmf_chip_sr_capable(struct brcmf_chip *pub);
 | |
|  
 | |
|  #endif /* BRCMF_AXIDMP_H */
 | |
| --- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
 | |
| +++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
 | |
| @@ -509,7 +509,7 @@ static void brcmf_pcie_attach(struct brc
 | |
|  
 | |
|  static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
 | |
|  {
 | |
| -	brcmf_chip_enter_download(devinfo->ci);
 | |
| +	brcmf_chip_set_passive(devinfo->ci);
 | |
|  
 | |
|  	if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
 | |
|  		brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
 | |
| @@ -536,7 +536,7 @@ static int brcmf_pcie_exit_download_stat
 | |
|  		brcmf_chip_resetcore(core, 0, 0, 0);
 | |
|  	}
 | |
|  
 | |
| -	return !brcmf_chip_exit_download(devinfo->ci, resetintr);
 | |
| +	return !brcmf_chip_set_active(devinfo->ci, resetintr);
 | |
|  }
 | |
|  
 | |
|  
 | |
| @@ -1566,8 +1566,8 @@ static int brcmf_pcie_buscoreprep(void *
 | |
|  }
 | |
|  
 | |
|  
 | |
| -static void brcmf_pcie_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
 | |
| -				      u32 rstvec)
 | |
| +static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
 | |
| +					u32 rstvec)
 | |
|  {
 | |
|  	struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
 | |
|  
 | |
| @@ -1577,7 +1577,7 @@ static void brcmf_pcie_buscore_exitdl(vo
 | |
|  
 | |
|  static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
 | |
|  	.prepare = brcmf_pcie_buscoreprep,
 | |
| -	.exit_dl = brcmf_pcie_buscore_exitdl,
 | |
| +	.activate = brcmf_pcie_buscore_activate,
 | |
|  	.read32 = brcmf_pcie_buscore_read32,
 | |
|  	.write32 = brcmf_pcie_buscore_write32,
 | |
|  };
 | |
| --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
 | |
| +++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
 | |
| @@ -3357,7 +3357,7 @@ static int brcmf_sdio_download_firmware(
 | |
|  	brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
 | |
|  
 | |
|  	/* Keep arm in reset */
 | |
| -	brcmf_chip_enter_download(bus->ci);
 | |
| +	brcmf_chip_set_passive(bus->ci);
 | |
|  
 | |
|  	rstvec = get_unaligned_le32(fw->data);
 | |
|  	brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
 | |
| @@ -3378,7 +3378,7 @@ static int brcmf_sdio_download_firmware(
 | |
|  	}
 | |
|  
 | |
|  	/* Take arm out of reset */
 | |
| -	if (!brcmf_chip_exit_download(bus->ci, rstvec)) {
 | |
| +	if (!brcmf_chip_set_active(bus->ci, rstvec)) {
 | |
|  		brcmf_err("error getting out of ARM core reset\n");
 | |
|  		goto err;
 | |
|  	}
 | |
| @@ -3771,8 +3771,8 @@ static int brcmf_sdio_buscoreprep(void *
 | |
|  	return 0;
 | |
|  }
 | |
|  
 | |
| -static void brcmf_sdio_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
 | |
| -				      u32 rstvec)
 | |
| +static void brcmf_sdio_buscore_activate(void *ctx, struct brcmf_chip *chip,
 | |
| +					u32 rstvec)
 | |
|  {
 | |
|  	struct brcmf_sdio_dev *sdiodev = ctx;
 | |
|  	struct brcmf_core *core;
 | |
| @@ -3815,7 +3815,7 @@ static void brcmf_sdio_buscore_write32(v
 | |
|  
 | |
|  static const struct brcmf_buscore_ops brcmf_sdio_buscore_ops = {
 | |
|  	.prepare = brcmf_sdio_buscoreprep,
 | |
| -	.exit_dl = brcmf_sdio_buscore_exitdl,
 | |
| +	.activate = brcmf_sdio_buscore_activate,
 | |
|  	.read32 = brcmf_sdio_buscore_read32,
 | |
|  	.write32 = brcmf_sdio_buscore_write32,
 | |
|  };
 | |
| @@ -4239,12 +4239,11 @@ void brcmf_sdio_remove(struct brcmf_sdio
 | |
|  				sdio_claim_host(bus->sdiodev->func[1]);
 | |
|  				brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
 | |
|  				/* Leave the device in state where it is
 | |
| -				 * 'quiet'. This is done by putting it in
 | |
| -				 * download_state which essentially resets
 | |
| -				 * all necessary cores.
 | |
| +				 * 'passive'. This is done by resetting all
 | |
| +				 * necessary cores.
 | |
|  				 */
 | |
|  				msleep(20);
 | |
| -				brcmf_chip_enter_download(bus->ci);
 | |
| +				brcmf_chip_set_passive(bus->ci);
 | |
|  				brcmf_sdio_clkctl(bus, CLK_NONE, false);
 | |
|  				sdio_release_host(bus->sdiodev->func[1]);
 | |
|  			}
 |