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]

 



HI Ozgur,

Please see my inline response below as [Khalid]

On Wednesday, April 13, 2022, 02:09:49 AM PDT, Ozgur Karatas <ozgurk@xxxxxxxx> wrote:




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?

[Khalid]: its not a card. the PHY is just a chip soldered on the board connected directly to Intel CPU via 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

[Khalid]: Thanks for he pointers. I will check those out. As Greg-K-H mentioned I will try to write some code in the driver, not the kernel core
as I was originally intending, and will see if I can read/modify the config space of this i211 PHY.

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