Re: How to write to a PCIe config space during kernel boot up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Wed, Apr 13, 2022 at 11:34 AM Greg KH <greg@xxxxxxxxx> wrote:
On Wed, Apr 13, 2022 at 07:01:01AM +0000, Khalid F. Sabzwari wrote:
>  Thanks Ozgur for quick reply.The link you shared below seems to work with MDIO interface.The PHY used on my board is Intel's i211 PHY which is controlled by PCIe interface.I found this link:https://docs.kernel.org/PCI/pci.html#how-to-access-pci-config-space
>
> I never wrote a kernel code before, and am trying to just hack for an experiment to write to config space of this PHY. so I will give it a try to see if i can read/write to i211's config space, during early kernel boot time, using pci_(read|write)_config_(byte|word|dword)


Hello, 

as Greg-KH said below, you dont need to do anything about kernel or PCI structure.
So I have question, this card already driven and initialized by Linux kernel?
Can you run this card inserting into slot as PCIE?

if it probably has a driver that uses phy.h I think and in  this case, will get a PHY id and use it to shift it after initing to PCIE address (for example PCIE0).
You just need to process module file before inital process and you dont need to work with an additional processing or PCIE structure on kernel side.

if you want to see an example please check these out:

Documentation/devicetree/bindings/pci/qcom,pcie.txt
Documentation/devicetree/bindings/phy/qcom-pcie-phy.txt
drivers/pci/host/pcie-qcom.c
drivers/phy/phy-qcom-pcie.c

These examples will show you PCIE addressing shift and PHY communication of a Qualcom PCIE etherner card.
Sorry for my bad English and wrong information.

Regards

                           Ozgur

 
Do so in the driver that binds to the device, before it initializes it.
Not in the kernel core, otherwise in the kernel core you do not have
access to the needed pci structures.

thanks,

greg k-h
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux