All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] PCI express slot bindings
@ 2014-06-09 23:38 Sarah Newman
       [not found] ` <5396455F.30303-bdq14YP6qtRg9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Sarah Newman @ 2014-06-09 23:38 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA

Greetings,

I have a client whose board has two mini pci express slots.  Having reviewed the pinouts at
http://www.allpinouts.org/index.php/PCI_Express_Card_and_PCI_Express_Mini_Card and some of the PCI
express documentation I believe the below may be sufficient to adequately describe the interface.

Feedback on style and/or correctness would be deeply appreciated. I have not written any drivers yet
and I'm not sure it would make sense to submit this as a patch until a minimal driver is present.

Thanks, Sarah

--
pcieslot-gpio.txt

Defines a pci express or mini pci express card slot.

This binding makes the assumption that pcie bridges are not dynamically
added and removed such that pci addressing should remain constant.

Required properties:
- compatible: should contain "pcieslot-gpio"
- #address-cells: set to <2>
- #size-cells: set to <0>
- reg: A cell where the first number is the pci bus and the second number is the slot.

Optional properties:
- wake-up-gpio: GPIO for WAKE#.
	Will be a falling edge interrupt enabled while the slot is enabled.
	No special handling will occur for this interrupt at this time.
- wdisable-gpio: GPIO for W_DISABLE# or W_DISABLE1#.  Active low.
- wdisable2-gpio: GPIO for W_DISABLE2#. Active low.
- reset-gpio: GPIO for PERST#.
- vdd-supplies: List of regulator phandles required to power on/off the slot.
- hot-pluggable: If present, the slot may be powered on and off at after boot.
- cd-gpio: GPIO for card detection on hot-swappable slots.
   Implies hot-pluggable. Typically active low.
- cd-inverted: If present, polarity on the CD line is active high.
- usb: usb controller associated with this slot.
- smb: system management bus associated with this slot.

Example:

	pcislots {
   		#address-cells = <2>;
		#size-cells = <0>;

		slot@3,0 {
			compatible = "pcieslot-gpio";
			reg = <3 0>;
			wake-up-gpio = <&gpio1 5 0>;
			disable1-gpio = <&gpio4 14 0>;
			vdd-supplies = <&pcie1_fixed_3v3>;
			usb = <&usbotg>;
			smb = <&i2c3>;
		};
	};
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC] PCI express slot bindings
       [not found] ` <5396455F.30303-bdq14YP6qtRg9hUCZPvPmw@public.gmane.org>
@ 2014-06-10  7:47   ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2014-06-10  7:47 UTC (permalink / raw)
  To: Sarah Newman; +Cc: devicetree-u79uwXL29TY76Z2rM5mHXA

On Monday 09 June 2014 16:38:07 Sarah Newman wrote:
> Greetings,
> 
> I have a client whose board has two mini pci express slots.  Having reviewed the pinouts at
> http://www.allpinouts.org/index.php/PCI_Express_Card_and_PCI_Express_Mini_Card and some of the PCI
> express documentation I believe the below may be sufficient to adequately describe the interface.
> 
> Feedback on style and/or correctness would be deeply appreciated. I have not written any drivers yet
> and I'm not sure it would make sense to submit this as a patch until a minimal driver is present.
> 

Hi Sarah,

Have you had a look at the way that PCI slots are described in the original
Open Firmware binding? I think you should try to aim to have a binding that
is backwards compatible with that.

The original document is at
http://www.openfirmware.org/1275/bindings/pci/pci2_1.pdf

Unfortunately, this is one of the most confusing bindings we have for
newcomers, so please ask if you have problems understanding it.


An alternative would be to have it more like your binding but decouple it
from PCI some more, which would let us describe USB-only slots better.

> pcieslot-gpio.txt
> 
> Defines a pci express or mini pci express card slot.
> 
> This binding makes the assumption that pcie bridges are not dynamically
> added and removed such that pci addressing should remain constant.
>
> Required properties:
> - compatible: should contain "pcieslot-gpio"
> - #address-cells: set to <2>
> - #size-cells: set to <0>
> - reg: A cell where the first number is the pci bus and the second number is the slot.

I think it can work to have this node be the same as the node for the device
plugged into the slot, logically speaking. In the "flattened device tree"
variant of the above binding, we normally don't list device nodes for any
PCI devices other than the root, but we don't prohibit that either. I'd have
to check the code to see if the PCI core currently connects the 'struct device_node'
correctly to the 'struct pci_dev'. We probably do that on PowerPC but not on
ARM. Can you say which SoC or at least CPU architecture you are working on?

> Optional properties:
> - wake-up-gpio: GPIO for WAKE#.
>         Will be a falling edge interrupt enabled while the slot is enabled.
>         No special handling will occur for this interrupt at this time.
> - wdisable-gpio: GPIO for W_DISABLE# or W_DISABLE1#.  Active low.
> - wdisable2-gpio: GPIO for W_DISABLE2#. Active low.
> - reset-gpio: GPIO for PERST#.

Do I understand it right that you have hardware using actual GPIOs here,
or do you have a PCI host bridge that has pins for these purposes and you
plan to expose them as GPIOs so you can link them to this node?

I think the convention is to use 'gpios' rather than 'gpio', even if there
is just one of them.

> - vdd-supplies: List of regulator phandles required to power on/off the slot.

For both the regulators and gpios, I think you should refer to the 
entries as 'specifiers'. A specifier consists of a phandle to the
controller device node followed by a variable number (which is often
zero) of cells describing the individual resource.

> - hot-pluggable: If present, the slot may be powered on and off at after boot.
> - cd-gpio: GPIO for card detection on hot-swappable slots.
>    Implies hot-pluggable. Typically active low.
> - cd-inverted: If present, polarity on the CD line is active high.

Do we need the 'hot-pluggable' property if it's implied by cd-gpios?

What would be a use-case for non-hot-pluggable slots?

> - usb: usb controller associated with this slot.

Hmm, this seems rather asymmetric. As I understand it (haven't read
the spec in detail), a pcie mini slot is connected to both a USB
host controller and a pcie host controller, but isn't necessarily
the only device connected to them, as you could have intermediate
pcie switches or usb hubs.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-10  7:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-09 23:38 [RFC] PCI express slot bindings Sarah Newman
     [not found] ` <5396455F.30303-bdq14YP6qtRg9hUCZPvPmw@public.gmane.org>
2014-06-10  7:47   ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.