Skip to content

pcie: Add initial t8122 support#538

Draft
noopwafel wants to merge 1 commit intoAsahiLinux:mainfrom
noopwafel:t8122-pcie
Draft

pcie: Add initial t8122 support#538
noopwafel wants to merge 1 commit intoAsahiLinux:mainfrom
noopwafel:t8122-pcie

Conversation

@noopwafel
Copy link
Contributor

No description provided.

Signed-off-by: Alyssa Milburn <amilburn@zall.org>

if (state->pcie_regs->type == APCIE_T8122) {
// The T8122 init is very similar to the T602X, except with a different offset.
// (There is one write to +0x4000 which we handle by subtracting 0x4000, see below.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when comparing the apcie node in t6020 and t8122 adt it looks like reg[2], reg[3], reg[4] folded into reg[2]. So it might be easier to set phy_common_idx to 2 for t8122 and add here 0x4000 to phy_common_base

if (state->pcie_regs->type == APCIE_T602X) {
set32(state->phy_base[phy] + APCIE_PHY_CTRL, 0x300);
} else if (state->pcie_regs->type == APCIE_T8122) {
set32(state->phy_base[phy] - 0x4000, 0x1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it is

mask32(state->phy_common_base + APCIE_PHYCMN_CLK, APCIE_PHYCMN_CLK_MODE, FIELD_PREP(APCIE_PHYCMN_CLK_MODE, 1));

Made APCIE_T602X specific just 16 lines earlier

}
if (state->pcie_regs->type == APCIE_T602X) {
pmgr_adt_power_disable_index(path, 1);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be expressed shorted as

if (state->pcie_regs->type == APCIE_T8122) {
    clear32(state->axi_base + 0x600, 0x10000);
} else {
        if (controller == APCIE)
            clear32(state->rc_base + 0x3c, 0x1);
        pmgr_adt_power_disable_index(path, 1);
}

write32(state->port_base[port] + 0x3000 + 4 * i, 0);
}
}
if (state->pcie_regs->type == APCIE_T602X || state->pcie_regs->type == APCIE_T8122) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is always true as it is already in a if with the same condition

}
}
if (state->pcie_regs->type == APCIE_T602X || state->pcie_regs->type == APCIE_T8122) {
int msimap_count = 512;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this appears to be unused (now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants