Re: [PATCH v4 2/8] PCI: armada8k: Add AC5 SoC support
From: Bjorn Helgaas
Date: Mon Mar 13 2023 - 15:44:07 EST
On Mon, Mar 13, 2023 at 02:40:10PM +0200, Elad Nachman wrote:
> From: Raz Adashi <raza@xxxxxxxxxxx>
>
> pcie-armada8k driver is utilized to serve also AC5.
>
> Driver assumes interrupt mask registers are located
> in the same address inboth CPUs. This assumption is
> incorrect - fix it for AC5.
s/inboth/in both/
Rewrap to fill 75 columns.
> +#define PCIE_VENDOR_REGS_OFFSET 0x8000 /* in ac5 is 0x10000 */
Don't add this comment in patch [2/8] and then update it in patch
[6/8]. Make it what you want the first time. Also nice if you make
it fit in 80 columns like the rest of the file.
> -static const struct dw_pcie_ops dw_pcie_ops = {
> +static u32 ac5_xlate_dbi_reg(u32 reg)
> +{
> + /* Handle AC5 ATU access */
> + if ((reg & ~0xfffff) == PCIE_ATU_ACCESS_MASK_AC5) {
> + reg &= 0xfffff;
> + /* ATU registers offset is 0xC00 + 0x200 * n,
> + * from RFU registers.
> + */
> + reg = 0xc000 | (0x200 * (reg >> 9)) | (reg & 0xff);
> + } else if ((reg & 0xfffff000) == PCIE_VENDOR_REGS_OFFSET) {
> + /* PCIe RFU registers in A8K are at offset 0x8000 from base
> + * (0xf2600000) while in AC5 offset is 0x10000 from base
> + * (0x800a0000) therefore need the addition of 0x8000.
> + */
> + reg += PCIE_VENDOR_REGS_OFFSET;
This is a hidden assumption that the AC5 offset (0x10000) happens to
be twice PCIE_VENDOR_REGS_OFFSET (0x8000). I think the AC5 offset
deserves its own separate #define.
Use the conventional multi-line comment style:
/*
* ...
*/
> + pci->ops = data->pcie_ops;
> pci->dev = dev;
> - pci->ops = &dw_pcie_ops;
The diff is easier to read if you don't move the "pci->ops ="
assignment. Move it if there's a *reason* to move it, but leave it
at the same spot otherwise.