All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: Andy Green <andy@warmcat.com>, Shengyu Qu <wiagn233@outlook.com>
Cc: franky.lin@broadcom.com, linux-wireless@vger.kernel.org
Subject: Re: AP6275 / bcm43752 pcie on mainline brcmf
Date: Thu, 24 Nov 2022 10:42:38 +0100	[thread overview]
Message-ID: <1cbb3bf5-fd70-e9db-2405-640178862857@broadcom.com> (raw)
In-Reply-To: <3a562a50-0cef-4879-3691-3258596f5213@warmcat.com>

[-- Attachment #1: Type: text/plain, Size: 2417 bytes --]

On 11/18/2022 6:41 AM, Andy Green wrote:
> 
> 
> On 11/17/22 21:52, Arend Van Spriel wrote:
> 
>> I see. So could you load bcmdhd and provide log. Preferably with 
>> higher debug level. It also has a module parameter for it. I think it 
>> is called dhd_msg_level and please set it to 0x817.
> 
> It's here:
> 
> https://warmcat.com/ap6275p-dhd-log1.txt

Hi Andy,

Thanks for the log. Together with the dhd driver sources I could make 
some sense of it. Perhaps you can try the following hack and see if we 
make it over the first hurdle.

Regards,
Arend
---
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index 97f0f13dfe50..ba436d71a7ec 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -11,6 +11,7 @@
  #include <linux/delay.h>
  #include <linux/interrupt.h>
  #include <linux/bcma/bcma.h>
+#include <linux/random.h>
  #include <linux/sched.h>
  #include <linux/io.h>
  #include <asm/unaligned.h>
@@ -1527,6 +1528,33 @@ brcmf_pcie_init_share_ram_info(struct 
brcmf_pciedev_info *devinfo,
  	return 0;
  }

+#define BRCMF_SEED_SIGNATURE		0xFEEDC0DE
+#define BRCMF_ENTROPY_HOST_SEED_LEN	128
+
+struct brcmf_entropy_metadata {
+	__le32 count;
+	__le32 signature;
+};
+
+static void brcmf_pcie_write_entropy_bytes(struct brcmf_pciedev_info 
*devinfo,
+					   u32 nvram_len)
+{
+	struct brcmf_entropy_metadata entropy_info;
+	u8 seed[BRCMF_ENTROPY_HOST_SEED_LEN] = { 0 };
+	u32 count = sizeof(seed);
+	u32 addr = devinfo->ci->rambase + devinfo->ci->ramsize - nvram_len;
+
+	entropy_info.signture = cpu_to_le32(BRCMF_SEED_SIGNATURE);
+	entropy_info.count = cpu_to_le32(BRCMF_ENTROPY_HOST_SEED_LEN);
+
+	addr -= sizeof(entropy_info);
+	memcpy_toio(devinfo->tcm + addr, &entropy_info, sizeof(entropy_info));
+
+	get_random_bytes(seed, count);
+
+	addr -= sizeof(count);
+	memcpy_toio(devinfo->tcm + addr, seed, count);
+}

  static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info 
*devinfo,
  					const struct firmware *fw, void *nvram,
@@ -1568,6 +1596,8 @@ static int brcmf_pcie_download_fw_nvram(struct 
brcmf_pciedev_info *devinfo,
  			  devinfo->nvram_name);
  	}

+	brcmf_pcie_write_entropy_bytes(devinfo, nvram_len);
+
  	sharedram_addr_written = brcmf_pcie_read_ram32(devinfo,
  						       devinfo->ci->ramsize -
  						       4);

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4219 bytes --]

  reply	other threads:[~2022-11-24  9:42 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1D540F2B-17E8-4992-BD06-4AA4A66B1964@warmcat.com>
     [not found] ` <1845da4b838.279b.9b12b7fc0a3841636cfb5e919b41b954@broadcom.com>
     [not found]   ` <b5f564da-d0c1-4617-fef1-771ccdda18e4@warmcat.com>
2022-11-10  7:06     ` AP6275 / bcm43752 pcie on mainline brcmf Andy Green
2022-11-10  7:35       ` Arend Van Spriel
2022-11-13  8:26         ` Shengyu Qu
2022-11-13  9:03           ` Andy Green
2022-11-13  9:10             ` Shengyu Qu
2022-11-13  9:41               ` Andy Green
2022-11-13 10:04                 ` Shengyu Qu
2022-11-13 10:56             ` Arend Van Spriel
2022-11-13 15:52               ` Shengyu Qu
2022-11-13 17:35                 ` Arend Van Spriel
2022-11-13 18:43                   ` Andy Green
2022-11-16 12:25                   ` Shengyu Qu
2022-11-16 14:16                     ` Andy Green
2022-11-17  9:23                     ` Arend van Spriel
2022-11-17 12:01                       ` Andy Green
2022-11-17 16:06                         ` Angus Ainslie
2022-11-17 18:12                           ` Arend Van Spriel
2022-11-17 18:36                             ` Angus Ainslie
2022-11-29 19:48                               ` Arend van Spriel
2022-12-03 13:56                                 ` Angus Ainslie
2022-12-03 15:22                                   ` Arend Van Spriel
2022-12-03 15:37                                     ` Angus Ainslie
2022-12-03 17:08                                       ` Arend Van Spriel
2022-12-04 14:33                                         ` Angus Ainslie
2022-12-04 15:29                                           ` Arend Van Spriel
2022-11-17 21:52                         ` Arend Van Spriel
2022-11-18  5:41                           ` Andy Green
2022-11-24  9:42                             ` Arend van Spriel [this message]
2022-11-24 10:20                               ` Andy Green
2022-11-24 10:49                                 ` Arend van Spriel
2022-11-24 11:04                                   ` Andy Green
2022-11-24 11:07                                     ` Arend van Spriel
2022-11-24 11:11                                       ` Andy Green
2022-11-24 11:18                                         ` Arend van Spriel
2022-11-24 11:24                                           ` Andy Green
2022-11-24 12:14                               ` Andy Green
2022-11-24 12:22                                 ` Arend van Spriel
2022-11-24 12:24                                   ` Shengyu Qu
2022-11-24 12:26                                   ` Andy Green
2022-11-24 12:35                                     ` Shengyu Qu
2022-11-24 12:38                                       ` Arend van Spriel
2022-11-24 12:44                                     ` Arend van Spriel
2022-11-24 12:54                                       ` Andy Green
2022-11-24 13:47                                         ` Arend van Spriel
2022-11-24 14:16                                           ` Andy Green
2022-11-24 14:32                                             ` Andy Green

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1cbb3bf5-fd70-e9db-2405-640178862857@broadcom.com \
    --to=arend.vanspriel@broadcom.com \
    --cc=andy@warmcat.com \
    --cc=franky.lin@broadcom.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=wiagn233@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.