RE: [PATCH v3 5/6] PCI: cadence: Add callback functions for RP and EP controller

Manikandan Karunakaran Pillai
2025-04-24T03:54:19Z

>> >What exactly is shared between these 2 implementations. Link handling,
>> >config space accesses, address translation, and host init are all
>> >different. What's left to share? MSIs (if not passed thru) and
>> >interrupts? I think it's questionable that this be the same driver.
>> >
>> The address of both these have changed as the controller architecture has
>> changed. In the event these driver have to be same driver, there will lot of
>> sprinkled "if(is_hpa)" and that was already rejected in earlier version of
>code.
>
>I'm saying they should *not* be the same driver because you don't
>share hardly anything. Again, what is really common here?

The architecture of the PCie controller is next generation but the software flow
and functions are almost same. The addresses of the registers accessed for the
newly added functions have changed and to ensure that we reduce "if(is_hpa)"
checks, the ops method was adopted as in other existing drivers.

>
>> Hence it was done similar to other drivers by architecture specific "ops".
>
>Yes, and IMO driver private/custom ops is the wrong direction to go.
>Read my prior reply below again.
>
>> The "if(is_hpa)" is now very limited where a specific ops functions does not
>make
>> any sense.
>
>But you still have them. In a separate driver, you would have 0.

The architecture is one changed and from a driver viewpoint, the addresses of the registers have changed.
The logic within the function still remains the same but it now accesses a different set of registers.
In the pcie-cadence-host.c and pcie-cadence-ep.c, there are still a lot of common functions.
If it is a separate driver, then the entire code needs to be put in two different files. The "is_hpa" checks will be
0, but there will be a lot more of replicated code.

>
>> >A bunch of driver specific 'ops' is not the right direction despite
>> >other drivers (DWC) having that. If there are common parts, then make
>> >them library functions multiple drivers can call.