On 26 August 2015 at 21:02, punnaiah choudary kalluri
Yes, I understand the generic nature of the GQSPI and it's good to
have all-in-one like generic spi, spi-nor and spi-nand and more
together, but Linux stacks were implemented in such a way to support
the each type of controller with connected slaves separably for better
handling.
Currently GQSPI driver is added in drivers/spi as it supports generic
spi nature and now it enhanced more through flags for supporting
spi-nor, what if we add spi-nand support for the same controller? do
we add one more driver in spi-nand framework (drivers/mtd/spi-nand -
an on going implementation)? My only observation here is even if the
controller is more generic to support more number of device classes,
and adding same driver and populate the slave stuff through flags or
different kind of mechanism to different driver stack, this is not a
better approach I thought.
Based on the above comments, there is an approach to handle this
support and I'm not 100% sure whether this fits or not but we
implemented the same - this is "probing child devices from parent"
(there was a discussion with Arnd earlier wrt this, but I'm unable to
get the mailing thread)
Added Arnd (probably will give more inputs or corrections)
Let me explain how we implemented on our design.
We have PCIe controller that support basic root complex handling, dma
and controller hotplug (not in-build pcie hp) and ideally we need to
write driver for handling root complex on drivers/pci/host and one
hotplug driver in drivers/pci and one more driver in drivers/dma for
handling pcie dma stuff. And some pcie calls need to navigate from
root complex driver to dma and hotplug driver that means there is call
transition from driver/pci to driver/dma which is absolutely not a
good approach (spi to spi-nor and spi-nand transition - in GQSPI case)
So the implementation we follow is like there is a pcie root complex
driver(probably generic spi driver in drivers/spi/*) and inside probe
we have register platform_device for hotplug (spi-nor) and dma
(spi-nand) and the dma driver in drivers/dma and hotplug driver in
driver/pci/ are platform drivers which is of legacy binding (not with
dts) so there should be a common dts for root complex driver
(drivers/spi/*) and individual child driver need to take those while
registering platform_device.
example pseudo:
drivers/dma/dma-child2.c
Legacy platform_driver binding and handling dma future as normal dma
driver, spi-nand in your case
drivers/pci/hotplug/hp-child1.c
Legacy platform_driver binding and handling hotplug future as normal
hotplug driver, spi-nor in your case.
drivers/pci/host/rc-parent-pci.c
static int rc_parent_pcie_probe_bridge(struct platform_device *pdev)
{
// Generic rc handling (genric spi stuff)
// Hotplug handling (spi-nor)
- platform_device_alloc
- assign need resources
- register pdev using platform_device_add
// DMA handling (spi-nand)
- same as above
}
static const struct of_device_id rc_parent_pcie_match_table[] = {
{.compatible = "abc,rc-parent",},
{},
};
static struct platform_driver rc_parent_pcie_driver = {
.driver = {
.name = "rc-parent",
.of_match_table = of_match_ptr(rc_parent_pcie_match_table),
},
.probe = rc_parent_pcie_probe_bridge,
};
module_platform_driver(rc_parent_pcie_driver);
I couldn't find any driver mainlined wrt this design, think more on
GQSPI front, whether this design fits well or not.