Message ID | 1350468546-25901-3-git-send-email-simon.guinot@sequanux.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, This is more directed at Jason and the other maintainers than you, Simon -- it's something I noticed when looking at his pull request. On Wed, Oct 17, 2012 at 12:09:04PM +0200, Simon Guinot wrote: > diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig > index 50bca50..847e0c2 100644 > --- a/arch/arm/mach-kirkwood/Kconfig > +++ b/arch/arm/mach-kirkwood/Kconfig > @@ -130,6 +130,27 @@ config MACH_KM_KIRKWOOD_DT > Say 'Y' here if you want your kernel to support the > Keymile Kirkwood Reference Desgin, using Flattened Device Tree. > > +config MACH_INETSPACE_V2_DT > + bool "LaCie Internet Space v2 NAS (Flattened Device Tree)" > + select ARCH_KIRKWOOD_DT > + help > + Say 'Y' here if you want your kernel to support the LaCie > + Internet Space v2 NAS, using Flattened Device Tree. > + > +config MACH_NETSPACE_V2_DT > + bool "LaCie Network Space v2 NAS (Flattened Device Tree)" > + select ARCH_KIRKWOOD_DT > + help > + Say 'Y' here if you want your kernel to support the LaCie > + Network Space v2 NAS, using Flattened Device Tree. > + > +config MACH_NETSPACE_MAX_V2_DT > + bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)" > + select ARCH_KIRKWOOD_DT > + help > + Say 'Y' here if you want your kernel to support the LaCie > + Network Space Max v2 NAS, using Flattened Device Tree. It would be nice to get away from these config options. The whole point with device tree is to no longer have to do code changes for new similar boards. And even then, since they share the same init function, there's no need for three options, just one. > diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile > index 294779f..1f63d80 100644 > --- a/arch/arm/mach-kirkwood/Makefile > +++ b/arch/arm/mach-kirkwood/Makefile > @@ -31,3 +31,6 @@ obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o > obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o > obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o > obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o > +obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o > +obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o > +obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o Same here. > diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c > index 70c5a28..b3e0519 100644 > --- a/arch/arm/mach-kirkwood/board-dt.c > +++ b/arch/arm/mach-kirkwood/board-dt.c > @@ -96,6 +96,11 @@ static void __init kirkwood_dt_init(void) > if (of_machine_is_compatible("keymile,km_kirkwood")) > km_kirkwood_init(); > > + if (of_machine_is_compatible("lacie,inetspace_v2") || > + of_machine_is_compatible("lacie,netspace_v2") || > + of_machine_is_compatible("lacie,netspace_max_v2")) > + ns2_init(); > + This function is now a long sequence of if statments like the ones above. It would be great if they could be removed by moving most of the functionality implemented in the board file to the device tree. Looks like it's not a whole lot left, so that's promising. I'm guessing there's already efforts underway to take care of the last pieces. But, until then, I think it'd be nice to make this a table driven lookup instead of a sequence of open-coded if statements. Tegra had this early on before the board files were removed too. I.e. just a table of static struct match_table { char *compat; void (*fn)(void); } match_table = { { "lacie,inetspace_v2", ns2_init }, { "lacie,netspace_v2", ns2_init }, .... } and then an interator over that table. > @@ -112,6 +117,9 @@ static const char *kirkwood_dt_board_compat[] = { > "buffalo,lsxl", > "iom,ix2-200", > "keymile,km_kirkwood", > + "lacie,inetspace_v2", > + "lacie,netspace_max_v2", > + "lacie,netspace_v2", > NULL > }; Same here. I actually think this is a table that is no longer needed -- the board compat can/should be done on the generic compatible string instead of for each most-specific board string. > +static void ns2_power_off(void) > +{ > + gpio_set_value(NS2_GPIO_POWER_OFF, 1); > +} This kind of thing should be possible to generalize through a generic binding. -Olof
Hi Olof We are getting near to having boards fully described in DT. The last major piece we are missing is a DT binding for the Ethernet driver. Once that is in we can remove many of these per-board files and C code in board-dt.c. However, this is not going to happen before this merge window :-( > Same here. I actually think this is a table that is no longer needed -- the > board compat can/should be done on the generic compatible string instead of for > each most-specific board string. > > > +static void ns2_power_off(void) > > +{ > > + gpio_set_value(NS2_GPIO_POWER_OFF, 1); > > +} > > This kind of thing should be possible to generalize through a generic binding. Such a generic binding is part of the pull requests. We converted two existing boards to this new binding. However, the new boards don't make use of a lot of new features we added this cycle, including this generic binding and pinctrl. We might have time to convert them before the merge window, otherwise it will be one of the first things we do for the next cycle. Andrew
On Mon, Nov 26, 2012 at 2:00 AM, Andrew Lunn <andrew@lunn.ch> wrote: > Hi Olof > > We are getting near to having boards fully described in DT. The last > major piece we are missing is a DT binding for the Ethernet driver. > Once that is in we can remove many of these per-board files and C code > in board-dt.c. However, this is not going to happen before this merge > window :-( Yeah, no worries about timing for 3.8 -- it'll be a nice cleanup for 3.9 or so. >> Same here. I actually think this is a table that is no longer needed -- the >> board compat can/should be done on the generic compatible string instead of for >> each most-specific board string. >> >> > +static void ns2_power_off(void) >> > +{ >> > + gpio_set_value(NS2_GPIO_POWER_OFF, 1); >> > +} >> >> This kind of thing should be possible to generalize through a generic binding. > > Such a generic binding is part of the pull requests. We converted two > existing boards to this new binding. However, the new boards don't > make use of a lot of new features we added this cycle, including this > generic binding and pinctrl. We might have time to convert them before > the merge window, otherwise it will be one of the first things we do > for the next cycle. Yeah, I sent this based on the first branch (boards), and noticed that some things had already been taken care of in the second one (dt), and noticed that when I looked at contents when I pulled that in. Talk about quick turnaround :) There's no time left to convert for this merge window, so please just target 3.9 instead by now -- it'll be a nice cleanup for that release. -Olof
On Mon, Nov 26, 2012 at 01:02:53AM -0800, Olof Johansson wrote: > Hi, > > This is more directed at Jason and the other maintainers than you, Simon -- > it's something I noticed when looking at his pull request. > > On Wed, Oct 17, 2012 at 12:09:04PM +0200, Simon Guinot wrote: > > > diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig > > index 50bca50..847e0c2 100644 > > --- a/arch/arm/mach-kirkwood/Kconfig > > +++ b/arch/arm/mach-kirkwood/Kconfig > > @@ -130,6 +130,27 @@ config MACH_KM_KIRKWOOD_DT > > Say 'Y' here if you want your kernel to support the > > Keymile Kirkwood Reference Desgin, using Flattened Device Tree. > > > > +config MACH_INETSPACE_V2_DT > > + bool "LaCie Internet Space v2 NAS (Flattened Device Tree)" > > + select ARCH_KIRKWOOD_DT > > + help > > + Say 'Y' here if you want your kernel to support the LaCie > > + Internet Space v2 NAS, using Flattened Device Tree. > > + > > +config MACH_NETSPACE_V2_DT > > + bool "LaCie Network Space v2 NAS (Flattened Device Tree)" > > + select ARCH_KIRKWOOD_DT > > + help > > + Say 'Y' here if you want your kernel to support the LaCie > > + Network Space v2 NAS, using Flattened Device Tree. > > + > > +config MACH_NETSPACE_MAX_V2_DT > > + bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)" > > + select ARCH_KIRKWOOD_DT > > + help > > + Say 'Y' here if you want your kernel to support the LaCie > > + Network Space Max v2 NAS, using Flattened Device Tree. > > It would be nice to get away from these config options. The whole point with > device tree is to no longer have to do code changes for new similar boards. > > And even then, since they share the same init function, there's no need for > three options, just one. > > > diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile > > index 294779f..1f63d80 100644 > > --- a/arch/arm/mach-kirkwood/Makefile > > +++ b/arch/arm/mach-kirkwood/Makefile > > @@ -31,3 +31,6 @@ obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o > > obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o > > obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o > > obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o > > +obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o > > +obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o > > +obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o > > Same here. Hi, All this configuration options (plus those for ns2 lite and mini) are indeed useless as we are using a single init function. Moreover there is no code relying on this options in the file board-ns2.c. All the checks are made at run-time. I will send a patch to remove this options. Simon > > > diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c > > index 70c5a28..b3e0519 100644 > > --- a/arch/arm/mach-kirkwood/board-dt.c > > +++ b/arch/arm/mach-kirkwood/board-dt.c > > @@ -96,6 +96,11 @@ static void __init kirkwood_dt_init(void) > > if (of_machine_is_compatible("keymile,km_kirkwood")) > > km_kirkwood_init(); > > > > + if (of_machine_is_compatible("lacie,inetspace_v2") || > > + of_machine_is_compatible("lacie,netspace_v2") || > > + of_machine_is_compatible("lacie,netspace_max_v2")) > > + ns2_init(); > > + > > This function is now a long sequence of if statments like the ones above. It > would be great if they could be removed by moving most of the functionality > implemented in the board file to the device tree. Looks like it's not a whole > lot left, so that's promising. I'm guessing there's already efforts underway to > take care of the last pieces. > > But, until then, I think it'd be nice to make this a table driven lookup > instead of a sequence of open-coded if statements. Tegra had this early on > before the board files were removed too. I.e. just a table of > > static struct match_table { > char *compat; > void (*fn)(void); > } match_table = { > { "lacie,inetspace_v2", ns2_init }, > { "lacie,netspace_v2", ns2_init }, > .... > } > > and then an interator over that table. > > > @@ -112,6 +117,9 @@ static const char *kirkwood_dt_board_compat[] = { > > "buffalo,lsxl", > > "iom,ix2-200", > > "keymile,km_kirkwood", > > + "lacie,inetspace_v2", > > + "lacie,netspace_max_v2", > > + "lacie,netspace_v2", > > NULL > > }; > > Same here. I actually think this is a table that is no longer needed -- the > board compat can/should be done on the generic compatible string instead of for > each most-specific board string. > > > +static void ns2_power_off(void) > > +{ > > + gpio_set_value(NS2_GPIO_POWER_OFF, 1); > > +} > > This kind of thing should be possible to generalize through a generic binding. > > > -Olof > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On Mon, Nov 26, 2012 at 04:18:11PM +0100, Simon Guinot wrote: > On Mon, Nov 26, 2012 at 01:02:53AM -0800, Olof Johansson wrote: > > Hi, > > > > This is more directed at Jason and the other maintainers than you, Simon -- > > it's something I noticed when looking at his pull request. > > > > On Wed, Oct 17, 2012 at 12:09:04PM +0200, Simon Guinot wrote: > > > > > diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig > > > index 50bca50..847e0c2 100644 > > > --- a/arch/arm/mach-kirkwood/Kconfig > > > +++ b/arch/arm/mach-kirkwood/Kconfig > > > @@ -130,6 +130,27 @@ config MACH_KM_KIRKWOOD_DT > > > Say 'Y' here if you want your kernel to support the > > > Keymile Kirkwood Reference Desgin, using Flattened Device Tree. > > > > > > +config MACH_INETSPACE_V2_DT > > > + bool "LaCie Internet Space v2 NAS (Flattened Device Tree)" > > > + select ARCH_KIRKWOOD_DT > > > + help > > > + Say 'Y' here if you want your kernel to support the LaCie > > > + Internet Space v2 NAS, using Flattened Device Tree. > > > + > > > +config MACH_NETSPACE_V2_DT > > > + bool "LaCie Network Space v2 NAS (Flattened Device Tree)" > > > + select ARCH_KIRKWOOD_DT > > > + help > > > + Say 'Y' here if you want your kernel to support the LaCie > > > + Network Space v2 NAS, using Flattened Device Tree. > > > + > > > +config MACH_NETSPACE_MAX_V2_DT > > > + bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)" > > > + select ARCH_KIRKWOOD_DT > > > + help > > > + Say 'Y' here if you want your kernel to support the LaCie > > > + Network Space Max v2 NAS, using Flattened Device Tree. > > > > It would be nice to get away from these config options. The whole point with > > device tree is to no longer have to do code changes for new similar boards. > > > > And even then, since they share the same init function, there's no need for > > three options, just one. > > > > > diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile > > > index 294779f..1f63d80 100644 > > > --- a/arch/arm/mach-kirkwood/Makefile > > > +++ b/arch/arm/mach-kirkwood/Makefile > > > @@ -31,3 +31,6 @@ obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o > > > obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o > > > obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o > > > obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o > > > +obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o > > > +obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o > > > +obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o > > > > Same here. > > Hi, > > All this configuration options (plus those for ns2 lite and mini) are > indeed useless as we are using a single init function. Moreover there > is no code relying on this options in the file board-ns2.c. All the > checks are made at run-time. > > I will send a patch to remove this options. No need to jump on it just yet. Nothing more is going into 3.8. We plan on cleaning up a lot of this as the first part of stuff for 3.9. It'll be easier to have one series knocking it all out as opposed to several board-specific patches from individuals. Unless, of course, you're volunteering to do the whole cleanup. Then by all means, don't let me stand in your way. :-) Otherwise, I'll put this series together near v3.8-rc1. thx, Jason.
On Mon, Nov 26, 2012 at 11:04:49AM -0500, Jason Cooper wrote: > On Mon, Nov 26, 2012 at 04:18:11PM +0100, Simon Guinot wrote: > > On Mon, Nov 26, 2012 at 01:02:53AM -0800, Olof Johansson wrote: > > > Hi, > > > > > > This is more directed at Jason and the other maintainers than you, Simon -- > > > it's something I noticed when looking at his pull request. > > > > > > On Wed, Oct 17, 2012 at 12:09:04PM +0200, Simon Guinot wrote: > > > > > > > diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig > > > > index 50bca50..847e0c2 100644 > > > > --- a/arch/arm/mach-kirkwood/Kconfig > > > > +++ b/arch/arm/mach-kirkwood/Kconfig > > > > @@ -130,6 +130,27 @@ config MACH_KM_KIRKWOOD_DT > > > > Say 'Y' here if you want your kernel to support the > > > > Keymile Kirkwood Reference Desgin, using Flattened Device Tree. > > > > > > > > +config MACH_INETSPACE_V2_DT > > > > + bool "LaCie Internet Space v2 NAS (Flattened Device Tree)" > > > > + select ARCH_KIRKWOOD_DT > > > > + help > > > > + Say 'Y' here if you want your kernel to support the LaCie > > > > + Internet Space v2 NAS, using Flattened Device Tree. > > > > + > > > > +config MACH_NETSPACE_V2_DT > > > > + bool "LaCie Network Space v2 NAS (Flattened Device Tree)" > > > > + select ARCH_KIRKWOOD_DT > > > > + help > > > > + Say 'Y' here if you want your kernel to support the LaCie > > > > + Network Space v2 NAS, using Flattened Device Tree. > > > > + > > > > +config MACH_NETSPACE_MAX_V2_DT > > > > + bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)" > > > > + select ARCH_KIRKWOOD_DT > > > > + help > > > > + Say 'Y' here if you want your kernel to support the LaCie > > > > + Network Space Max v2 NAS, using Flattened Device Tree. > > > > > > It would be nice to get away from these config options. The whole point with > > > device tree is to no longer have to do code changes for new similar boards. > > > > > > And even then, since they share the same init function, there's no need for > > > three options, just one. > > > > > > > diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile > > > > index 294779f..1f63d80 100644 > > > > --- a/arch/arm/mach-kirkwood/Makefile > > > > +++ b/arch/arm/mach-kirkwood/Makefile > > > > @@ -31,3 +31,6 @@ obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o > > > > obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o > > > > obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o > > > > obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o > > > > +obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o > > > > +obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o > > > > +obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o > > > > > > Same here. > > > > Hi, > > > > All this configuration options (plus those for ns2 lite and mini) are > > indeed useless as we are using a single init function. Moreover there > > is no code relying on this options in the file board-ns2.c. All the > > checks are made at run-time. > > > > I will send a patch to remove this options. > > No need to jump on it just yet. Nothing more is going into 3.8. We > plan on cleaning up a lot of this as the first part of stuff for 3.9. > It'll be easier to have one series knocking it all out as opposed to > several board-specific patches from individuals. About the config duplicate options, I think that the ns2 is the only problem. But if you plan to remove the board-*.c files for 3.9, maybe there is no need at all to fix the issue ? > > Unless, of course, you're volunteering to do the whole cleanup. Then by > all means, don't let me stand in your way. :-) The whole cleanup, I don't know :) But for sure, I can help. For example, I could do the gpio-poweroff migration. Simon > > Otherwise, I'll put this series together near v3.8-rc1. > > thx, > > Jason. > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On Tue, Nov 27, 2012 at 12:14:55PM +0100, Simon Guinot wrote: > On Mon, Nov 26, 2012 at 11:04:49AM -0500, Jason Cooper wrote: > > On Mon, Nov 26, 2012 at 04:18:11PM +0100, Simon Guinot wrote: > > > On Mon, Nov 26, 2012 at 01:02:53AM -0800, Olof Johansson wrote: > > > > Hi, > > > > > > > > This is more directed at Jason and the other maintainers than you, Simon -- > > > > it's something I noticed when looking at his pull request. > > > > > > > > On Wed, Oct 17, 2012 at 12:09:04PM +0200, Simon Guinot wrote: > > > > > > > > > diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig > > > > > index 50bca50..847e0c2 100644 > > > > > --- a/arch/arm/mach-kirkwood/Kconfig > > > > > +++ b/arch/arm/mach-kirkwood/Kconfig > > > > > @@ -130,6 +130,27 @@ config MACH_KM_KIRKWOOD_DT > > > > > Say 'Y' here if you want your kernel to support the > > > > > Keymile Kirkwood Reference Desgin, using Flattened Device Tree. > > > > > > > > > > +config MACH_INETSPACE_V2_DT > > > > > + bool "LaCie Internet Space v2 NAS (Flattened Device Tree)" > > > > > + select ARCH_KIRKWOOD_DT > > > > > + help > > > > > + Say 'Y' here if you want your kernel to support the LaCie > > > > > + Internet Space v2 NAS, using Flattened Device Tree. > > > > > + > > > > > +config MACH_NETSPACE_V2_DT > > > > > + bool "LaCie Network Space v2 NAS (Flattened Device Tree)" > > > > > + select ARCH_KIRKWOOD_DT > > > > > + help > > > > > + Say 'Y' here if you want your kernel to support the LaCie > > > > > + Network Space v2 NAS, using Flattened Device Tree. > > > > > + > > > > > +config MACH_NETSPACE_MAX_V2_DT > > > > > + bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)" > > > > > + select ARCH_KIRKWOOD_DT > > > > > + help > > > > > + Say 'Y' here if you want your kernel to support the LaCie > > > > > + Network Space Max v2 NAS, using Flattened Device Tree. > > > > > > > > It would be nice to get away from these config options. The whole point with > > > > device tree is to no longer have to do code changes for new similar boards. > > > > > > > > And even then, since they share the same init function, there's no need for > > > > three options, just one. > > > > > > > > > diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile > > > > > index 294779f..1f63d80 100644 > > > > > --- a/arch/arm/mach-kirkwood/Makefile > > > > > +++ b/arch/arm/mach-kirkwood/Makefile > > > > > @@ -31,3 +31,6 @@ obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o > > > > > obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o > > > > > obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o > > > > > obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o > > > > > +obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o > > > > > +obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o > > > > > +obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o > > > > > > > > Same here. > > > > > > Hi, > > > > > > All this configuration options (plus those for ns2 lite and mini) are > > > indeed useless as we are using a single init function. Moreover there > > > is no code relying on this options in the file board-ns2.c. All the > > > checks are made at run-time. > > > > > > I will send a patch to remove this options. > > > > No need to jump on it just yet. Nothing more is going into 3.8. We > > plan on cleaning up a lot of this as the first part of stuff for 3.9. > > It'll be easier to have one series knocking it all out as opposed to > > several board-specific patches from individuals. > > About the config duplicate options, I think that the ns2 is the only > problem. But if you plan to remove the board-*.c files for 3.9, maybe > there is no need at all to fix the issue ? Correct. I think we might have one or two outliers when we're done, but board-dt.c should just compat with marvell,kirkwood. > > Unless, of course, you're volunteering to do the whole cleanup. Then by > > all means, don't let me stand in your way. :-) > > The whole cleanup, I don't know :) But for sure, I can help. For > example, I could do the gpio-poweroff migration. That would be much appreciated. Thanks! Jason.
On 27.11.2012 12:14, Simon Guinot wrote: > On Mon, Nov 26, 2012 at 11:04:49AM -0500, Jason Cooper wrote: >> On Mon, Nov 26, 2012 at 04:18:11PM +0100, Simon Guinot wrote: >>> On Mon, Nov 26, 2012 at 01:02:53AM -0800, Olof Johansson wrote: >>>>> +config MACH_NETSPACE_MAX_V2_DT >>>>> + bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)" >>>>> + select ARCH_KIRKWOOD_DT >>>>> + help >>>>> + Say 'Y' here if you want your kernel to support the LaCie >>>>> + Network Space Max v2 NAS, using Flattened Device Tree. >>>> >>>> It would be nice to get away from these config options. The whole point with >>>> device tree is to no longer have to do code changes for new similar boards. >>>> >>>> And even then, since they share the same init function, there's no need for >>>> three options, just one. >>>> >>> >>> I will send a patch to remove this options. >> No need to jump on it just yet. Nothing more is going into 3.8. We >> plan on cleaning up a lot of this as the first part of stuff for 3.9. >> It'll be easier to have one series knocking it all out as opposed to >> several board-specific patches from individuals. > > About the config duplicate options, I think that the ns2 is the only > problem. But if you plan to remove the board-*.c files for 3.9, maybe > there is no need at all to fix the issue ? > Are there any plans to convert the existing non-DT kirkwood boards in 3.9, too? Regards Stefan Peter
On Tue, Nov 27, 2012 at 09:57:24PM +0100, Stefan Peter wrote: > Are there any plans to convert the existing non-DT kirkwood boards in > 3.9, too? Yes, that's on the list. We were waiting for most of the drivers to be converted to DT first. Like the Dockstar, we'll leave the legacy setup file around for a few releases, then probably deprecate them. thx, Jason.
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index c1ce813..e6201b6 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -34,9 +34,12 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \ kirkwood-ib62x0.dtb \ kirkwood-iconnect.dtb \ kirkwood-iomega_ix2_200.dtb \ + kirkwood-is2.dtb \ kirkwood-km_kirkwood.dtb \ kirkwood-lschlv2.dtb \ kirkwood-lsxhl.dtb \ + kirkwood-ns2.dtb \ + kirkwood-ns2max.dtb \ kirkwood-ts219-6281.dtb \ kirkwood-ts219-6282.dtb dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \ diff --git a/arch/arm/boot/dts/kirkwood-is2.dts b/arch/arm/boot/dts/kirkwood-is2.dts new file mode 100644 index 0000000..0bdce0a --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-is2.dts @@ -0,0 +1,30 @@ +/dts-v1/; + +/include/ "kirkwood-ns2-common.dtsi" + +/ { + model = "LaCie Internet Space v2"; + compatible = "lacie,inetspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood"; + + memory { + device_type = "memory"; + reg = <0x00000000 0x8000000>; + }; + + ocp@f1000000 { + sata@80000 { + status = "okay"; + nr-ports = <1>; + }; + }; + + ns2-leds { + compatible = "lacie,ns2-leds"; + + blue-sata { + label = "ns2:blue:sata"; + slow-gpio = <&gpio0 29 0>; + cmd-gpio = <&gpio0 30 0>; + }; + }; +}; diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi new file mode 100644 index 0000000..9bc6785 --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi @@ -0,0 +1,63 @@ +/include/ "kirkwood.dtsi" + +/ { + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + ocp@f1000000 { + serial@12000 { + clock-frequency = <166666667>; + status = "okay"; + }; + + spi@10600 { + status = "okay"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "mx25l4005a"; + reg = <0>; + spi-max-frequency = <20000000>; + mode = <0>; + + partition@0 { + reg = <0x0 0x80000>; + label = "u-boot"; + }; + }; + }; + + i2c@11000 { + status = "okay"; + + eeprom@50 { + compatible = "at,24c04"; + pagesize = <16>; + reg = <0x50>; + }; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + + button@1 { + label = "Power push button"; + linux,code = <116>; + gpios = <&gpio1 0 0>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + red-fail { + label = "ns2:red:fail"; + gpios = <&gpio0 12 0>; + }; + }; +}; diff --git a/arch/arm/boot/dts/kirkwood-ns2.dts b/arch/arm/boot/dts/kirkwood-ns2.dts new file mode 100644 index 0000000..f2d36ecf --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-ns2.dts @@ -0,0 +1,30 @@ +/dts-v1/; + +/include/ "kirkwood-ns2-common.dtsi" + +/ { + model = "LaCie Network Space v2"; + compatible = "lacie,netspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood"; + + memory { + device_type = "memory"; + reg = <0x00000000 0x10000000>; + }; + + ocp@f1000000 { + sata@80000 { + status = "okay"; + nr-ports = <1>; + }; + }; + + ns2-leds { + compatible = "lacie,ns2-leds"; + + blue-sata { + label = "ns2:blue:sata"; + slow-gpio = <&gpio0 29 0>; + cmd-gpio = <&gpio0 30 0>; + }; + }; +}; diff --git a/arch/arm/boot/dts/kirkwood-ns2max.dts b/arch/arm/boot/dts/kirkwood-ns2max.dts new file mode 100644 index 0000000..bcec4d6 --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-ns2max.dts @@ -0,0 +1,49 @@ +/dts-v1/; + +/include/ "kirkwood-ns2-common.dtsi" + +/ { + model = "LaCie Network Space Max v2"; + compatible = "lacie,netspace_max_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood"; + + memory { + device_type = "memory"; + reg = <0x00000000 0x10000000>; + }; + + ocp@f1000000 { + sata@80000 { + status = "okay"; + nr-ports = <2>; + }; + }; + + gpio_fan { + compatible = "gpio-fan"; + gpios = <&gpio0 22 1 + &gpio0 7 1 + &gpio1 1 1 + &gpio0 23 1>; + gpio-fan,speed-map = + < 0 0 + 1500 15 + 1700 14 + 1800 13 + 2100 12 + 3100 11 + 3300 10 + 4300 9 + 5500 8>; + alarm-gpios = <&gpio0 25 1>; + }; + + ns2-leds { + compatible = "lacie,ns2-leds"; + + blue-sata { + label = "ns2:blue:sata"; + slow-gpio = <&gpio0 29 0>; + cmd-gpio = <&gpio0 30 0>; + }; + }; +}; diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index 50bca50..847e0c2 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig @@ -130,6 +130,27 @@ config MACH_KM_KIRKWOOD_DT Say 'Y' here if you want your kernel to support the Keymile Kirkwood Reference Desgin, using Flattened Device Tree. +config MACH_INETSPACE_V2_DT + bool "LaCie Internet Space v2 NAS (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + help + Say 'Y' here if you want your kernel to support the LaCie + Internet Space v2 NAS, using Flattened Device Tree. + +config MACH_NETSPACE_V2_DT + bool "LaCie Network Space v2 NAS (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + help + Say 'Y' here if you want your kernel to support the LaCie + Network Space v2 NAS, using Flattened Device Tree. + +config MACH_NETSPACE_MAX_V2_DT + bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + help + Say 'Y' here if you want your kernel to support the LaCie + Network Space Max v2 NAS, using Flattened Device Tree. + config MACH_TS219 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" help diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index 294779f..1f63d80 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile @@ -31,3 +31,6 @@ obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o +obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o +obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o +obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index 70c5a28..b3e0519 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c @@ -96,6 +96,11 @@ static void __init kirkwood_dt_init(void) if (of_machine_is_compatible("keymile,km_kirkwood")) km_kirkwood_init(); + if (of_machine_is_compatible("lacie,inetspace_v2") || + of_machine_is_compatible("lacie,netspace_v2") || + of_machine_is_compatible("lacie,netspace_max_v2")) + ns2_init(); + of_platform_populate(NULL, kirkwood_dt_match_table, kirkwood_auxdata_lookup, NULL); } @@ -112,6 +117,9 @@ static const char *kirkwood_dt_board_compat[] = { "buffalo,lsxl", "iom,ix2-200", "keymile,km_kirkwood", + "lacie,inetspace_v2", + "lacie,netspace_max_v2", + "lacie,netspace_v2", NULL }; diff --git a/arch/arm/mach-kirkwood/board-ns2.c b/arch/arm/mach-kirkwood/board-ns2.c new file mode 100644 index 0000000..b36c55c --- /dev/null +++ b/arch/arm/mach-kirkwood/board-ns2.c @@ -0,0 +1,83 @@ +/* + * Copyright 2012 (C), Simon Guinot <simon.guinot@sequanux.org> + * + * arch/arm/mach-kirkwood/board-ns2.c + * + * LaCie Network Space v2 board (and parents) initialization for drivers + * not converted to flattened device tree yet. + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/mv643xx_eth.h> +#include <linux/gpio.h> +#include "common.h" +#include "mpp.h" + +static struct mv643xx_eth_platform_data ns2_ge00_data = { + .phy_addr = MV643XX_ETH_PHY_ADDR(8), +}; + +static unsigned int ns2_mpp_config[] __initdata = { + MPP0_SPI_SCn, + MPP1_SPI_MOSI, + MPP2_SPI_SCK, + MPP3_SPI_MISO, + MPP4_NF_IO6, + MPP5_NF_IO7, + MPP6_SYSRST_OUTn, + MPP7_GPO, /* Fan speed (bit 1) */ + MPP8_TW0_SDA, + MPP9_TW0_SCK, + MPP10_UART0_TXD, + MPP11_UART0_RXD, + MPP12_GPO, /* Red led */ + MPP14_GPIO, /* USB fuse */ + MPP16_GPIO, /* SATA 0 power */ + MPP17_GPIO, /* SATA 1 power */ + MPP18_NF_IO0, + MPP19_NF_IO1, + MPP20_SATA1_ACTn, + MPP21_SATA0_ACTn, + MPP22_GPIO, /* Fan speed (bit 0) */ + MPP23_GPIO, /* Fan power */ + MPP24_GPIO, /* USB mode select */ + MPP25_GPIO, /* Fan rotation fail */ + MPP26_GPIO, /* USB device vbus */ + MPP28_GPIO, /* USB enable host vbus */ + MPP29_GPIO, /* Blue led (slow register) */ + MPP30_GPIO, /* Blue led (command register) */ + MPP31_GPIO, /* Board power off */ + MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */ + MPP33_GPO, /* Fan speed (bit 2) */ + 0 +}; + +#define NS2_GPIO_POWER_OFF 31 + +static void ns2_power_off(void) +{ + gpio_set_value(NS2_GPIO_POWER_OFF, 1); +} + +void __init ns2_init(void) +{ + /* + * Basic setup. Needs to be called early. + */ + kirkwood_mpp_conf(ns2_mpp_config); + + kirkwood_ehci_init(); + kirkwood_ge00_init(&ns2_ge00_data); + + if (gpio_request(NS2_GPIO_POWER_OFF, "power-off") == 0 && + gpio_direction_output(NS2_GPIO_POWER_OFF, 0) == 0) + pm_power_off = ns2_power_off; + else + pr_err("ns2: failed to configure power-off GPIO\n"); +} diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h index bcffd7c..2f75f3f 100644 --- a/arch/arm/mach-kirkwood/common.h +++ b/arch/arm/mach-kirkwood/common.h @@ -112,6 +112,14 @@ void km_kirkwood_init(void); static inline void km_kirkwood_init(void) {}; #endif +#if defined(CONFIG_MACH_INETSPACE_V2_DT) || \ + defined(CONFIG_MACH_NETSPACE_V2_DT) || \ + defined(CONFIG_MACH_NETSPACE_MAX_V2_DT) +void ns2_init(void); +#else +static inline void ns2_init(void) {}; +#endif + /* early init functions not converted to fdt yet */ char *kirkwood_id(void); void kirkwood_l2_init(void); diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index f508def..e455c08 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -379,7 +379,9 @@ config LEDS_NS2 tristate "LED support for Network Space v2 GPIO LEDs" depends on LEDS_CLASS depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || \ - MACH_NETSPACE_MAX_V2 || MACH_D2NET_V2 + MACH_NETSPACE_MAX_V2 || MACH_D2NET_V2 || \ + MACH_NETSPACE_V2_DT || MACH_INETSPACE_V2_DT || \ + MACH_NETSPACE_MAX_V2_DT default y help This option enable support for the dual-GPIO LED found on the
This patch adds DT board setup for LaCie Network Space v2 and parents, based on the Marvell Kirkwood 6281 SoC. This includes Network Space v2 (Max) and Internet Space v2. Signed-off-by: Simon Guinot <simon.guinot@sequanux.org> --- Changes for v2: - Rebased against Linux 3.7-rc1. - Add missing Kconfig options MACH_INETSPACE_V2_DT and MACH_NETSPACE_MAX_V2_DT. - Use ns2-leds DT binding. - Move gpio-leds definition out from kirkwood-ns2-common.dtsi. The ns2 lite board (patch 3/4) uses a different configuration for GPIO LEDs. Changes for v3: - Fix patch version (update to v3). - Fix compatibility string for driver leds-ns2. Use "lacie,ns2-leds". arch/arm/boot/dts/Makefile | 3 + arch/arm/boot/dts/kirkwood-is2.dts | 30 ++++++++++ arch/arm/boot/dts/kirkwood-ns2-common.dtsi | 63 +++++++++++++++++++++ arch/arm/boot/dts/kirkwood-ns2.dts | 30 ++++++++++ arch/arm/boot/dts/kirkwood-ns2max.dts | 49 ++++++++++++++++ arch/arm/mach-kirkwood/Kconfig | 21 +++++++ arch/arm/mach-kirkwood/Makefile | 3 + arch/arm/mach-kirkwood/board-dt.c | 8 +++ arch/arm/mach-kirkwood/board-ns2.c | 83 ++++++++++++++++++++++++++++ arch/arm/mach-kirkwood/common.h | 8 +++ drivers/leds/Kconfig | 4 +- 11 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/kirkwood-is2.dts create mode 100644 arch/arm/boot/dts/kirkwood-ns2-common.dtsi create mode 100644 arch/arm/boot/dts/kirkwood-ns2.dts create mode 100644 arch/arm/boot/dts/kirkwood-ns2max.dts create mode 100644 arch/arm/mach-kirkwood/board-ns2.c