Skip to contentSkip to conversation

thunderbolt: Add support for ASMedia image format

PATCH Szuying Chen 2 participants 2 messages Sep 6, 2022 USB

lore
Share & tools
lore
#0 lore raw

From: Szuying Chen <[email protected]>

Hi,

Review

Quoted 12 lines
(quoted diff) +11 -0
+static int asmedia_switch_nvm_version(struct tb_nvm *nvm) {
+	struct tb_switch *sw = tb_to_switch(nvm->dev);
+	u32 val;
+	int ret;
+
+	ret = tb_switch_nvm_read(sw, ASMEDIA_NVM_VERSION, &val, sizeof(val));
+	if (ret)
+		return ret;
+
+	nvm->major = (val << 16) & 0xff0000;
+	nvm->minor |= val & 0x00ff00;
	nvm->major
Quoted 16 lines
(quoted diff) +16 -0
+	nvm->major |= (val >> 16) & 0x0000ff;
+
+	ret = tb_switch_nvm_read(sw, ASMEDIA_NVM_DATE, &val, sizeof(val));
+	if (ret)
+		return ret;
+
+	nvm->minor = (val << 16) & 0xff0000;
+	nvm->minor |= val & 0x00ff00;
+	nvm->minor |= (val >> 16) & 0x0000ff;
+
+	/* ASMedia NVM size is fixed to 512k */
+	nvm->active_size = SZ_512K;
+
+	return 0;
+}
+

Review

Quoted 10 lines
(quoted diff) +4 -1
+static const struct tb_nvm_vendor_ops asmedia_switch_nvm_ops = {
+	.read_version = asmedia_switch_nvm_version, };
+
 /* Router vendor NVM support table */
 static const struct tb_nvm_vendor switch_nvm_vendors[] = {
+	{ 0x174c, &asmedia_switch_nvm_ops },
 	{ PCI_VENDOR_ID_INTEL, &intel_switch_nvm_ops },
 	{ 0x8087, &intel_switch_nvm_ops },
 };
--

Thanks!

#1 lore raw
Quoted 5 lines · Szuying Chen

From: Szuying Chen <[email protected]>

Hi,

Quoted 1 line
Quoted 13 lines

Review

Quoted 11 lines
(quoted diff) +11 -0
+static int asmedia_switch_nvm_version(struct tb_nvm *nvm) {
+	struct tb_switch *sw = tb_to_switch(nvm->dev);
+	u32 val;
+	int ret;
+
+	ret = tb_switch_nvm_read(sw, ASMEDIA_NVM_VERSION, &val, sizeof(val));
+	if (ret)
+		return ret;
+
+	nvm->major = (val << 16) & 0xff0000;
+	nvm->minor |= val & 0x00ff00;
	nvm->major

Heh, that one was clearly a copy paste error ;-)

I will fix it up when applying. Thanks for checking.