* [PATCH] reset: socfpga: use arch_initcall for early initialization @ 2014-10-09 2:44 dinguyen [not found] ` <1412822646-11257-1-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> 2014-10-12 14:30 ` Pavel Machek 0 siblings, 2 replies; 12+ messages in thread From: dinguyen @ 2014-10-09 2:44 UTC (permalink / raw) To: p.zabel Cc: dinh.linux, s.trumtrar, grant.likely, robh+dt, atull, devicetree, linux-kernel, Dinh Nguyen From: Dinh Nguyen <dinguyen@opensource.altera.com> There are certain drivers that are required to get loaded very early using arch_initcall. An example of such a driver is the SOCFPGA's FPGA bridge driver. This driver has to get loaded early because it needs to enable FPGA components that are connected to the bridge. This FPGA bridge driver will using the reset controller API to toggle it's reset bits, thus, it needs the reset driver to be loaded as early as possible in order for it to get used properly. Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com> --- drivers/reset/reset-socfpga.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c index 79c32ca..a5e8d37 100644 --- a/drivers/reset/reset-socfpga.c +++ b/drivers/reset/reset-socfpga.c @@ -139,7 +139,20 @@ static struct platform_driver socfpga_reset_driver = { .of_match_table = socfpga_reset_dt_ids, }, }; -module_platform_driver(socfpga_reset_driver); + +static int __init socfpga_reset_init(void) +{ + return platform_driver_probe(&socfpga_reset_driver, + socfpga_reset_probe); +} + +static void __exit socfpga_reset_exit(void) +{ + platform_driver_unregister(&socfpga_reset_driver); +} + +arch_initcall(socfpga_reset_init); +module_exit(socfpga_reset_exit); MODULE_AUTHOR("Steffen Trumtrar <s.trumtrar@pengutronix.de"); MODULE_DESCRIPTION("Socfpga Reset Controller Driver"); -- 2.0.3 ^ permalink raw reply related [flat|nested] 12+ messages in thread
[parent not found: <1412822646-11257-1-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>]
* Re: [PATCH] reset: socfpga: use arch_initcall for early initialization [not found] ` <1412822646-11257-1-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> @ 2014-10-09 9:03 ` Philipp Zabel [not found] ` <1412845410.6809.3.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 0 siblings, 1 reply; 12+ messages in thread From: Philipp Zabel @ 2014-10-09 9:03 UTC (permalink / raw) To: dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx Cc: dinh.linux-Re5JQEeQqe8AvxtiuMwx3w, s.trumtrar-bIcnvbaLZ9MEGnE8C9+IrQ, grant.likely-QSEj5FYQhm4dnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, atull-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA Am Mittwoch, den 08.10.2014, 21:44 -0500 schrieb dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org: > From: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> > > There are certain drivers that are required to get loaded very early using > arch_initcall. An example of such a driver is the SOCFPGA's FPGA bridge driver. > This driver has to get loaded early because it needs to enable FPGA components > that are connected to the bridge. > > This FPGA bridge driver will using the reset controller API to toggle it's > reset bits, thus, it needs the reset driver to be loaded as early as possible > in order for it to get used properly. Without knowing the details, this sounds like the wrong approach. Can't the bridge driver return -EPROBE_DEFER until the reset controller is available? regards Philipp -- 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] 12+ messages in thread
[parent not found: <1412845410.6809.3.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH] reset: socfpga: use arch_initcall for early initialization [not found] ` <1412845410.6809.3.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2014-10-09 13:16 ` Dinh Nguyen [not found] ` <54368AA2.9000104-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> 0 siblings, 1 reply; 12+ messages in thread From: Dinh Nguyen @ 2014-10-09 13:16 UTC (permalink / raw) To: Philipp Zabel Cc: dinh.linux-Re5JQEeQqe8AvxtiuMwx3w, s.trumtrar-bIcnvbaLZ9MEGnE8C9+IrQ, grant.likely-QSEj5FYQhm4dnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, atull-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA Hi Philipp, On 10/9/14, 4:03 AM, Philipp Zabel wrote: > Am Mittwoch, den 08.10.2014, 21:44 -0500 schrieb > dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org: >> From: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> >> >> There are certain drivers that are required to get loaded very early using >> arch_initcall. An example of such a driver is the SOCFPGA's FPGA bridge driver. >> This driver has to get loaded early because it needs to enable FPGA components >> that are connected to the bridge. >> >> This FPGA bridge driver will using the reset controller API to toggle it's >> reset bits, thus, it needs the reset driver to be loaded as early as possible >> in order for it to get used properly. > > Without knowing the details, this sounds like the wrong approach. Can't > the bridge driver return -EPROBE_DEFER until the reset controller is > available? > The bridge driver is also using arch_initcall, as it also needs to get loaded early for FPGA IPs to work, and so later driver loading will work for the FPGA IPs. Dinh -- 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] 12+ messages in thread
[parent not found: <54368AA2.9000104-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>]
* Re: [PATCH] reset: socfpga: use arch_initcall for early initialization [not found] ` <54368AA2.9000104-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> @ 2014-10-09 13:28 ` Steffen Trumtrar 2014-10-09 14:57 ` atull 0 siblings, 1 reply; 12+ messages in thread From: Steffen Trumtrar @ 2014-10-09 13:28 UTC (permalink / raw) To: Dinh Nguyen Cc: Philipp Zabel, dinh.linux-Re5JQEeQqe8AvxtiuMwx3w, grant.likely-QSEj5FYQhm4dnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, atull-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Thu, Oct 09, 2014 at 08:16:18AM -0500, Dinh Nguyen wrote: > Hi Philipp, > > On 10/9/14, 4:03 AM, Philipp Zabel wrote: > > Am Mittwoch, den 08.10.2014, 21:44 -0500 schrieb > > dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org: > >> From: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> > >> > >> There are certain drivers that are required to get loaded very early using > >> arch_initcall. An example of such a driver is the SOCFPGA's FPGA bridge driver. > >> This driver has to get loaded early because it needs to enable FPGA components > >> that are connected to the bridge. > >> > >> This FPGA bridge driver will using the reset controller API to toggle it's > >> reset bits, thus, it needs the reset driver to be loaded as early as possible > >> in order for it to get used properly. > > > > Without knowing the details, this sounds like the wrong approach. Can't > > the bridge driver return -EPROBE_DEFER until the reset controller is > > available? > > > > The bridge driver is also using arch_initcall, as it also needs to get > loaded early for FPGA IPs to work, and so later driver loading will work > for the FPGA IPs. > For the bridge driver the same is true. I guess that there *might* be IP cores where you need to be very early, but that shouldn't be the normal case. If the driver can't get loaded properly, the right thing would be to fix the driver. I have developed a bridge driver, too (which only needs the devicetree binding docu for a v1) and I have a driver+IP core that is directly connected to the bridge. I don't need any messing around with the initcalls to work properly. -EPROBE_DEFER works just fine. What I do need however is loading the FPGA very early of course, if it is not done in the bootloader. Regards, Steffen -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- 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] 12+ messages in thread
* Re: [PATCH] reset: socfpga: use arch_initcall for early initialization 2014-10-09 13:28 ` Steffen Trumtrar @ 2014-10-09 14:57 ` atull 2014-10-09 15:19 ` Steffen Trumtrar 0 siblings, 1 reply; 12+ messages in thread From: atull @ 2014-10-09 14:57 UTC (permalink / raw) To: Steffen Trumtrar Cc: Dinh Nguyen, Philipp Zabel, dinh.linux, grant.likely, robh+dt, devicetree, linux-kernel On Thu, 9 Oct 2014, Steffen Trumtrar wrote: > On Thu, Oct 09, 2014 at 08:16:18AM -0500, Dinh Nguyen wrote: > > Hi Philipp, > > > > On 10/9/14, 4:03 AM, Philipp Zabel wrote: > > > Am Mittwoch, den 08.10.2014, 21:44 -0500 schrieb > > > dinguyen@opensource.altera.com: > > >> From: Dinh Nguyen <dinguyen@opensource.altera.com> > > >> > > >> There are certain drivers that are required to get loaded very early using > > >> arch_initcall. An example of such a driver is the SOCFPGA's FPGA bridge driver. > > >> This driver has to get loaded early because it needs to enable FPGA components > > >> that are connected to the bridge. > > >> > > >> This FPGA bridge driver will using the reset controller API to toggle it's > > >> reset bits, thus, it needs the reset driver to be loaded as early as possible > > >> in order for it to get used properly. > > > > > > Without knowing the details, this sounds like the wrong approach. Can't > > > the bridge driver return -EPROBE_DEFER until the reset controller is > > > available? > > > I don't think we can do deferred probing for arch_initcall. > > > > The bridge driver is also using arch_initcall, as it also needs to get > > loaded early for FPGA IPs to work, and so later driver loading will work > > for the FPGA IPs. > > > > For the bridge driver the same is true. I guess that there *might* be > IP cores where you need to be very early, but that shouldn't be the normal > case. If the driver can't get loaded properly, the right thing would be to > fix the driver. Some fpga ip drivers will need to be early (and will assume that the fpga was programmed by the bootloader). We want to support that case. > > I have developed a bridge driver, too (which only needs the devicetree binding > docu for a v1) and I have a driver+IP core that is directly connected to the > bridge. I don't need any messing around with the initcalls to work properly. > -EPROBE_DEFER works just fine. Is this based on the "proposed fpga bridge framework" that I posted? What we are trying to do is update that bridge driver to use the reset driver for submitting v2. Alan > > What I do need however is loading the FPGA very early of course, if it is not > done in the bootloader. > > Regards, > Steffen > > -- > Pengutronix e.K. | | > Industrial Linux Solutions | http://www.pengutronix.de/ | > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] reset: socfpga: use arch_initcall for early initialization 2014-10-09 14:57 ` atull @ 2014-10-09 15:19 ` Steffen Trumtrar [not found] ` <20141009151935.GK15799-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 0 siblings, 1 reply; 12+ messages in thread From: Steffen Trumtrar @ 2014-10-09 15:19 UTC (permalink / raw) To: atull Cc: Dinh Nguyen, Philipp Zabel, dinh.linux-Re5JQEeQqe8AvxtiuMwx3w, grant.likely-QSEj5FYQhm4dnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA Hi! On Thu, Oct 09, 2014 at 09:57:49AM -0500, atull wrote: > On Thu, 9 Oct 2014, Steffen Trumtrar wrote: > > > On Thu, Oct 09, 2014 at 08:16:18AM -0500, Dinh Nguyen wrote: > > > Hi Philipp, > > > > > > On 10/9/14, 4:03 AM, Philipp Zabel wrote: > > > > Am Mittwoch, den 08.10.2014, 21:44 -0500 schrieb > > > > dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org: > > > >> From: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> > > > >> > > > >> There are certain drivers that are required to get loaded very early using > > > >> arch_initcall. An example of such a driver is the SOCFPGA's FPGA bridge driver. > > > >> This driver has to get loaded early because it needs to enable FPGA components > > > >> that are connected to the bridge. > > > >> > > > >> This FPGA bridge driver will using the reset controller API to toggle it's > > > >> reset bits, thus, it needs the reset driver to be loaded as early as possible > > > >> in order for it to get used properly. > > > > > > > > Without knowing the details, this sounds like the wrong approach. Can't > > > > the bridge driver return -EPROBE_DEFER until the reset controller is > > > > available? > > > > > > I don't think we can do deferred probing for arch_initcall. > > > > > > > The bridge driver is also using arch_initcall, as it also needs to get > > > loaded early for FPGA IPs to work, and so later driver loading will work > > > for the FPGA IPs. > > > > > > > For the bridge driver the same is true. I guess that there *might* be > > IP cores where you need to be very early, but that shouldn't be the normal > > case. If the driver can't get loaded properly, the right thing would be to > > fix the driver. > > Some fpga ip drivers will need to be early (and will assume that the fpga > was programmed by the bootloader). We want to support that case. > Do you have an example where this is really needed? > > > > I have developed a bridge driver, too (which only needs the devicetree binding > > docu for a v1) and I have a driver+IP core that is directly connected to the > > bridge. I don't need any messing around with the initcalls to work properly. > > -EPROBE_DEFER works just fine. > > Is this based on the "proposed fpga bridge framework" that I posted? > What we are trying to do is update that bridge driver to use the reset driver for > submitting v2. Are you talking about the FPGA manager patches? Then: no. If not, I seem to have missed the patches. The driver just probes and then releases the resets for the according bridge. It shall however support the GPV configuration also (which it doesn't at the moment) But this reminds me, why I didn't send the driver earlier. IIRC you want to reset the bridges after writing the bitstream to the FPGA manager. So, I would need to add that first so you can access that in your fpga manager driver. Regards, Steffen -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- 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] 12+ messages in thread
[parent not found: <20141009151935.GK15799-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH] reset: socfpga: use arch_initcall for early initialization [not found] ` <20141009151935.GK15799-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2014-10-10 16:32 ` atull 2014-10-14 18:45 ` atull 2014-10-18 9:22 ` Arnd Bergmann 0 siblings, 2 replies; 12+ messages in thread From: atull @ 2014-10-10 16:32 UTC (permalink / raw) To: Steffen Trumtrar Cc: Dinh Nguyen, Philipp Zabel, dinh.linux-Re5JQEeQqe8AvxtiuMwx3w, grant.likely-QSEj5FYQhm4dnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Thu, 9 Oct 2014, Steffen Trumtrar wrote: Hi Steffen, > Hi! > > On Thu, Oct 09, 2014 at 09:57:49AM -0500, atull wrote: > > On Thu, 9 Oct 2014, Steffen Trumtrar wrote: > > > > > On Thu, Oct 09, 2014 at 08:16:18AM -0500, Dinh Nguyen wrote: > > > > Hi Philipp, > > > > > > > > On 10/9/14, 4:03 AM, Philipp Zabel wrote: > > > > > Am Mittwoch, den 08.10.2014, 21:44 -0500 schrieb > > > > > dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org: > > > > >> From: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> > > > > >> > > > > >> There are certain drivers that are required to get loaded very early using > > > > >> arch_initcall. An example of such a driver is the SOCFPGA's FPGA bridge driver. > > > > >> This driver has to get loaded early because it needs to enable FPGA components > > > > >> that are connected to the bridge. > > > > >> > > > > >> This FPGA bridge driver will using the reset controller API to toggle it's > > > > >> reset bits, thus, it needs the reset driver to be loaded as early as possible > > > > >> in order for it to get used properly. > > > > > > > > > > Without knowing the details, this sounds like the wrong approach. Can't > > > > > the bridge driver return -EPROBE_DEFER until the reset controller is > > > > > available? > > > > > > > > > I don't think we can do deferred probing for arch_initcall. > > > > > > > > > > The bridge driver is also using arch_initcall, as it also needs to get > > > > loaded early for FPGA IPs to work, and so later driver loading will work > > > > for the FPGA IPs. > > > > > > > > > > For the bridge driver the same is true. I guess that there *might* be > > > IP cores where you need to be very early, but that shouldn't be the normal > > > case. If the driver can't get loaded properly, the right thing would be to > > > fix the driver. > > > > Some fpga ip drivers will need to be early (and will assume that the fpga > > was programmed by the bootloader). We want to support that case. > > > > Do you have an example where this is really needed? My last version of the fpga manager framework (https://lkml.org/lkml/2014/8/1/518) added fpga_mgr_firmware_write(). This can be called from a device driver's probe function to request a fpga image be loaded. I want to support FPGA based functionality being seen pretty similar to really hard hardware. So the FPGA could have a PCI bus or something else that would want to be early. > > > > > > > I have developed a bridge driver, too (which only needs the devicetree binding > > > docu for a v1) and I have a driver+IP core that is directly connected to the > > > bridge. I don't need any messing around with the initcalls to work properly. > > > -EPROBE_DEFER works just fine. > > > > Is this based on the "proposed fpga bridge framework" that I posted? > > What we are trying to do is update that bridge driver to use the reset driver for > > submitting v2. > > Are you talking about the FPGA manager patches? Then: no. > If not, I seem to have missed the patches. > > The driver just probes and then releases the resets for the according bridge. > It shall however support the GPV configuration also (which it doesn't at the moment) > > But this reminds me, why I didn't send the driver earlier. IIRC you want to reset > the bridges after writing the bitstream to the FPGA manager. > So, I would need to add that first so you can access that in your fpga manager > driver. We need to hold the bridges in reset as long as the FPGA is not programmed or is being programmed. We want to release the bridges from reset after programming. If we are going to re-program the FPGA, we will need to unload any device drivers, set the bridges into reset, then reprogram the FPGA, release the bridges, load the appropriate device drivers. The latest fpga manager code also handles reprogramming the FPGA when device tree fragments are loaded. Alan > > Regards, > Steffen > > -- > Pengutronix e.K. | | > Industrial Linux Solutions | http://www.pengutronix.de/ | > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > -- 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] 12+ messages in thread
* Re: [PATCH] reset: socfpga: use arch_initcall for early initialization 2014-10-10 16:32 ` atull @ 2014-10-14 18:45 ` atull 2014-10-15 10:02 ` Steffen Trumtrar 2014-10-18 9:22 ` Arnd Bergmann 1 sibling, 1 reply; 12+ messages in thread From: atull @ 2014-10-14 18:45 UTC (permalink / raw) To: Steffen Trumtrar Cc: Dinh Nguyen, Philipp Zabel, dinh.linux, grant.likely, robh+dt, devicetree, linux-kernel On Fri, 10 Oct 2014, atull wrote: > On Thu, 9 Oct 2014, Steffen Trumtrar wrote: > > Hi Steffen, > > > Hi! > > > > On Thu, Oct 09, 2014 at 09:57:49AM -0500, atull wrote: > > > On Thu, 9 Oct 2014, Steffen Trumtrar wrote: > > > > > > > On Thu, Oct 09, 2014 at 08:16:18AM -0500, Dinh Nguyen wrote: > > > > > Hi Philipp, > > > > > > > > > > On 10/9/14, 4:03 AM, Philipp Zabel wrote: > > > > > > Am Mittwoch, den 08.10.2014, 21:44 -0500 schrieb > > > > > > dinguyen@opensource.altera.com: > > > > > >> From: Dinh Nguyen <dinguyen@opensource.altera.com> > > > > > >> > > > > > >> There are certain drivers that are required to get loaded very early using > > > > > >> arch_initcall. An example of such a driver is the SOCFPGA's FPGA bridge driver. > > > > > >> This driver has to get loaded early because it needs to enable FPGA components > > > > > >> that are connected to the bridge. > > > > > >> > > > > > >> This FPGA bridge driver will using the reset controller API to toggle it's > > > > > >> reset bits, thus, it needs the reset driver to be loaded as early as possible > > > > > >> in order for it to get used properly. > > > > > > > > > > > > Without knowing the details, this sounds like the wrong approach. Can't > > > > > > the bridge driver return -EPROBE_DEFER until the reset controller is > > > > > > available? > > > > > > > > > > > > I don't think we can do deferred probing for arch_initcall. > > > > > > > > > > > > > The bridge driver is also using arch_initcall, as it also needs to get > > > > > loaded early for FPGA IPs to work, and so later driver loading will work > > > > > for the FPGA IPs. > > > > > > > > > > > > > For the bridge driver the same is true. I guess that there *might* be > > > > IP cores where you need to be very early, but that shouldn't be the normal > > > > case. If the driver can't get loaded properly, the right thing would be to > > > > fix the driver. > > > > > > Some fpga ip drivers will need to be early (and will assume that the fpga > > > was programmed by the bootloader). We want to support that case. > > > > > > > Do you have an example where this is really needed? > > My last version of the fpga manager framework > (https://lkml.org/lkml/2014/8/1/518) > added fpga_mgr_firmware_write(). This can be called from a device driver's > probe function to request a fpga image be loaded. I want to support FPGA > based functionality being seen pretty similar to really hard hardware. So > the FPGA could have a PCI bus or something else that would want to be > early. > > > > > > > > > > > I have developed a bridge driver, too (which only needs the devicetree binding > > > > docu for a v1) and I have a driver+IP core that is directly connected to the > > > > bridge. I don't need any messing around with the initcalls to work properly. > > > > -EPROBE_DEFER works just fine. > > > > > > Is this based on the "proposed fpga bridge framework" that I posted? > > > What we are trying to do is update that bridge driver to use the reset driver for > > > submitting v2. > > > > Are you talking about the FPGA manager patches? Then: no. > > If not, I seem to have missed the patches. > > > > The driver just probes and then releases the resets for the according bridge. > > It shall however support the GPV configuration also (which it doesn't at the moment) > > > > But this reminds me, why I didn't send the driver earlier. IIRC you want to reset > > the bridges after writing the bitstream to the FPGA manager. > > So, I would need to add that first so you can access that in your fpga manager > > driver. > > We need to hold the bridges in reset as long as the FPGA is not programmed > or is being programmed. We want to release the bridges from reset after > programming. If we are going to re-program the FPGA, we will need to > unload any device drivers, set the bridges into reset, then reprogram > the FPGA, release the bridges, load the appropriate device drivers. > The latest fpga manager code also handles reprogramming the FPGA when > device tree fragments are loaded. > > Alan > The FPGA bridge driver that I submitted last year handled the following things: * The bridges might have been brought out of reset in the bootloader. Some of the bridges have write-only registers (!) so this information had to be passed in DT * fpga2sdram bridge widths configured in DT * Supports enabling the following Altera fpga bridges: * fpga2sdram * fpga2hps * hps2fpga * lwhps2fpga * interface in sysfs for each bridge to be put in reset/taken out of reset * Enable (take out of reset): $ echo 1 > /sys/class/fpga-bridge/fpga2hps/enable * Disable (hold in reset): $ echo 0 > /sys/class/fpga-bridge/fpga2hps/enable * Check enable/disable status (checks for all bits set): $ cat /sys/class/fpga-bridge/fpga2hps/enable (will print '0' or '1') Now that I'm enabling programming the FPGA from DT overlays, I also want to support DT control of the bridges at the proper time. So that would support the use case where adding a DT overlay would: 1. program the FPGA 2. bring the appropriate bridges out of reset 3. modprobe the driver Deleting the DT overlay would undo these steps in reverse order. I submitted it on 10/8/2013 (I copied you on it), but I don't see it on lkml.org. Probably because I submitted it from a gmail email address and that sometimes doesn't play well with lkml. I'm planning on resubmitting when we have it better integrated with the reset subsystem. If you can give me an early idea of how this fits in with your needs, that would be great. Alan ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] reset: socfpga: use arch_initcall for early initialization 2014-10-14 18:45 ` atull @ 2014-10-15 10:02 ` Steffen Trumtrar 2014-10-15 13:53 ` Dinh Nguyen 0 siblings, 1 reply; 12+ messages in thread From: Steffen Trumtrar @ 2014-10-15 10:02 UTC (permalink / raw) To: atull Cc: Dinh Nguyen, Philipp Zabel, dinh.linux, grant.likely, robh+dt, devicetree, linux-kernel Hi! On Tue, Oct 14, 2014 at 01:45:29PM -0500, atull wrote: > The FPGA bridge driver that I submitted last year handled the following > things: > * The bridges might have been brought out of reset in the bootloader. Some > of the bridges have write-only registers (!) so this information had to > be passed in DT Regmap has infrastructure to handle this. > * fpga2sdram bridge widths configured in DT This should hold true for all bridges but the LWHPS. > * Supports enabling the following Altera fpga bridges: > * fpga2sdram > * fpga2hps > * hps2fpga > * lwhps2fpga > * interface in sysfs for each bridge to be put in reset/taken out of reset > * Enable (take out of reset): > $ echo 1 > /sys/class/fpga-bridge/fpga2hps/enable > * Disable (hold in reset): > $ echo 0 > /sys/class/fpga-bridge/fpga2hps/enable > * Check enable/disable status (checks for all bits set): > $ cat /sys/class/fpga-bridge/fpga2hps/enable > (will print '0' or '1') > I don't like that. The proper solution should be unloading/loading the module for the bridge. On a reset the driver has to completely reset its state. > Now that I'm enabling programming the FPGA from DT overlays, I also want > to support DT control of the bridges at the proper time. So that would > support the use case where adding a DT overlay would: > 1. program the FPGA > 2. bring the appropriate bridges out of reset > 3. modprobe the driver > > Deleting the DT overlay would undo these steps in reverse order. > > I submitted it on 10/8/2013 (I copied you on it), but I don't see it on > lkml.org. Probably because I submitted it from a gmail email address and > that sometimes doesn't play well with lkml. I'm planning on resubmitting > when we have it better integrated with the reset subsystem. If you can > give me an early idea of how this fits in with your needs, that would be > great. > I actually remember seeing that driver. The problem with the approach is, that the bridges are not some IP that you just turn on/off. The bridges are the busses that connect the FPGA to the SoC. So the driver and the DT has to accommodate for that. So, for the (LW)HPS that means we have a bus master driver, that has to booting: - check if FPGA manager is enabled in DT - EPROBE_DEFER if FPGA manager isn't loaded - check if FPGA is programmed - EPROBE_DEFER otherwise - probe subnodes of bridge DT node dynamic: - remove all drivers/devices previously probed by the bridge - put bridge in reset (maybe the remove call should always do that ?) - program FPGA with (different) bitstream - (update the DT) I haven't had time to really look at the overlay stuff, but I guess it will then just - probe bridge drivers with 'status = "okay"' which will probe subdevices Question is: who will remove the bridge driver? Do the DT overlays do that kind of stuff? With the FPGA2HPS(SDRAM) bridges it gets a little difficult I guess. Who is the master on the FPGA2HPS bridge? Depends on your FPGA config. Regards, Steffen -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] reset: socfpga: use arch_initcall for early initialization 2014-10-15 10:02 ` Steffen Trumtrar @ 2014-10-15 13:53 ` Dinh Nguyen 0 siblings, 0 replies; 12+ messages in thread From: Dinh Nguyen @ 2014-10-15 13:53 UTC (permalink / raw) To: Steffen Trumtrar, atull Cc: Philipp Zabel, dinh.linux, grant.likely, robh+dt, devicetree, linux-kernel On 10/15/14, 5:02 AM, Steffen Trumtrar wrote: > Hi! > > On Tue, Oct 14, 2014 at 01:45:29PM -0500, atull wrote: >> The FPGA bridge driver that I submitted last year handled the following >> things: >> * The bridges might have been brought out of reset in the bootloader. Some >> of the bridges have write-only registers (!) so this information had to >> be passed in DT > > Regmap has infrastructure to handle this. > The current implementation of Alan's bridge driver is using regmap to toggle the reset manager bits. However, that required adding "syscon" to the reset manager's DTS node. By doing this, the reset driver was not able to load. So that's the story behind why I'm looking to convert Alan's bridge driver to use the reset driver. Dinh ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] reset: socfpga: use arch_initcall for early initialization 2014-10-10 16:32 ` atull 2014-10-14 18:45 ` atull @ 2014-10-18 9:22 ` Arnd Bergmann 1 sibling, 0 replies; 12+ messages in thread From: Arnd Bergmann @ 2014-10-18 9:22 UTC (permalink / raw) To: atull Cc: Steffen Trumtrar, Dinh Nguyen, Philipp Zabel, dinh.linux, grant.likely, robh+dt, devicetree, linux-kernel On Friday 10 October 2014 11:32:35 atull wrote: > On Thu, 9 Oct 2014, Steffen Trumtrar wrote: > > Do you have an example where this is really needed? > > My last version of the fpga manager framework > (https://lkml.org/lkml/2014/8/1/518) > added fpga_mgr_firmware_write(). This can be called from a device driver's > probe function to request a fpga image be loaded. I want to support FPGA > based functionality being seen pretty similar to really hard hardware. So > the FPGA could have a PCI bus or something else that would want to be > early. Please be more specific. I agree we need a good reason for not just using deferred probing, and PCI host bridges in general are no longer something that needs to be probed early. If you have a particular use case in mind that can't be solved in a better way, we can talk about making this an earlier initcall (probably not arch_initcall), but in general we try hard to avoid new ones like this. Arnd ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] reset: socfpga: use arch_initcall for early initialization 2014-10-09 2:44 [PATCH] reset: socfpga: use arch_initcall for early initialization dinguyen [not found] ` <1412822646-11257-1-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> @ 2014-10-12 14:30 ` Pavel Machek 1 sibling, 0 replies; 12+ messages in thread From: Pavel Machek @ 2014-10-12 14:30 UTC (permalink / raw) To: dinguyen Cc: p.zabel, dinh.linux, s.trumtrar, grant.likely, robh+dt, atull, devicetree, linux-kernel Hi! > From: Dinh Nguyen <dinguyen@opensource.altera.com> > > There are certain drivers that are required to get loaded very early using > arch_initcall. An example of such a driver is the SOCFPGA's FPGA bridge driver. > This driver has to get loaded early because it needs to enable FPGA components > that are connected to the bridge. > > This FPGA bridge driver will using the reset controller API to toggle it's > reset bits, thus, it needs the reset driver to be loaded as early as possible > in order for it to get used properly. > > Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com> > +static int __init socfpga_reset_init(void) > +{ > + return platform_driver_probe(&socfpga_reset_driver, > + socfpga_reset_probe); > +} > + > +static void __exit socfpga_reset_exit(void) > +{ > + platform_driver_unregister(&socfpga_reset_driver); > +} > + > +arch_initcall(socfpga_reset_init); > +module_exit(socfpga_reset_exit); That is quite a strange combination. Driver can be module but needs to be initialized early? Should we make it always built in? > MODULE_AUTHOR("Steffen Trumtrar <s.trumtrar@pengutronix.de"); > MODULE_DESCRIPTION("Socfpga Reset Controller Driver"); -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-10-18 9:22 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-10-09 2:44 [PATCH] reset: socfpga: use arch_initcall for early initialization dinguyen [not found] ` <1412822646-11257-1-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> 2014-10-09 9:03 ` Philipp Zabel [not found] ` <1412845410.6809.3.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2014-10-09 13:16 ` Dinh Nguyen [not found] ` <54368AA2.9000104-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> 2014-10-09 13:28 ` Steffen Trumtrar 2014-10-09 14:57 ` atull 2014-10-09 15:19 ` Steffen Trumtrar [not found] ` <20141009151935.GK15799-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2014-10-10 16:32 ` atull 2014-10-14 18:45 ` atull 2014-10-15 10:02 ` Steffen Trumtrar 2014-10-15 13:53 ` Dinh Nguyen 2014-10-18 9:22 ` Arnd Bergmann 2014-10-12 14:30 ` Pavel Machek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).