Messages in this thread | | | Subject | Re: [PATCH 4/8] minnowboard: Add base platform driver for the MinnowBoard | From | Darren Hart <> | Date | Thu, 27 Jun 2013 22:43:38 -0700 |
| |
On Thu, 2013-06-27 at 11:14 +0200, Linus Walleij wrote: > On Wed, Jun 26, 2013 at 3:53 AM, Darren Hart <dvhart@linux.intel.com> wrote: > > > Provide a minimal public interface: > > minnow_detect() > > minnow_lvds_detect() > > minnow_hwid() > > minnow_phy_reset() > > So instead of these calling drivers issueing gpio_request() themselves > to obtain a resource, they make a function call to this proxy that issue > gpio_request() for them. > > This is generally not how we do things. A driver should request its > GPIO just as it requests its regulator or clock or IRQ line or anything > else.
I'll fix this for minnow_phy_reset() by moving the reset routine into the pch_gbe driver and have it request the GPIO, using the pci_id structure to determine the GPIO line.
I'll drop minnow_lvds_detect() and work toward the firmware managing this aspect instead.
minnow_detect() doesn't access GPIO.
minnow_hwid() just returns an int that the minnowboard platform driver read from the GPIO. This seems like a proper abstraction to me. Do you object to this one as well?
> Centralizing resource handling is not a good idea IMO, it's better > that each driver request it's GPIO pin(s) and do the stuff it needs > with them.
Understood. Since minnow_hwid() is not currently used anywhere anyway, I'll take Olof's advice and just drop it. We can always add it back if it becomes necessary.
> This of course creates the problem of associating the GPIOs to a > driver and how it should look that up, which I guess ACPI can do, > isn't that what acpi_find_gpio() is for?
The only one that remains is pch_gbe and we have a PCI Subsystem ID there that we can use. Once we determine it is a MinnowBoard, we can look the GPIO up by chip and offset. If this changes in future board revs, we'll need minnow_hwid(), or we'll have to figure something out either in the PCI config space or via ACPI as you suggested.
Thanks Linus, appreciate all the feedback.
-- Darren Hart Intel Open Source Technology Center Yocto Project - Technical Lead - Linux Kernel
| |