* Re: [RFC PATCH] [media]: of: move graph helpers from drivers/media/v4l2-core to drivers/of
From: Rob Herring @ 2014-02-11 16:30 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Philipp Zabel, Mauro Carvalho Chehab, Grant Likely, Rob Herring,
Sylwester Nawrocki, Laurent Pinchart, Tomi Valkeinen,
Kyungmin Park, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
Philipp Zabel
In-Reply-To: <20140211145248.GI26684@n2100.arm.linux.org.uk>
On Tue, Feb 11, 2014 at 8:52 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Tue, Feb 11, 2014 at 07:56:33AM -0600, Rob Herring wrote:
>> On Tue, Feb 11, 2014 at 5:45 AM, Philipp Zabel <p.zabel@pengutronix.de> wrote:
>> > This allows to reuse the same parser code from outside the V4L2 framework,
>> > most importantly from display drivers. There have been patches that duplicate
>> > the code (and I am going to send one of my own), such as
>> > http://lists.freedesktop.org/archives/dri-devel/2013-August/043308.html
>> > and others that parse the same binding in a different way:
>> > https://www.mail-archive.com/linux-omap@vger.kernel.org/msg100761.html
>> >
>> > I think that all common video interface parsing helpers should be moved to a
>> > single place, outside of the specific subsystems, so that it can be reused
>> > by all drivers.
>>
>> Perhaps that should be done rather than moving to drivers/of now and
>> then again to somewhere else.
>
> Do you have a better suggestion where it should move to?
No.
> drivers/gpu/drm - no, because v4l2 wants to use it
> drivers/media/video - no, because DRM drivers want to use it
> drivers/video - no, because v4l2 and drm drivers want to use it
I don't believe it exists currently, so it would need to be created.
Perhaps adding a layer of directory to combine these. This patch alone
is not enough to really justify that, but if there's a lot more shared
code possible then it would be the right direction.
> Maybe drivers/of-graph/ ? Or maybe it's just as good a place to move it
> into drivers/of ?
I assume you weren't serious, but no for /of-graph. If a better place
can't be found/made, I'll take it.
Rob
^ permalink raw reply
* [PATCH 8/8] cpufreq: ppc: make use of of_find_matching_node_and_match
From: Josh Cartwright @ 2014-02-11 16:24 UTC (permalink / raw)
To: Rafael J. Wysocki, Viresh Kumar
Cc: devicetree, linux-kernel, cpufreq, linux-pm
In-Reply-To: <1392135847-30791-1-git-send-email-joshc@codeaurora.org>
Instead of the of_find_matching_node()/of_match_node() pair, which requires two
iterations through the match table, make use of of_find_matching_node_and_match(),
which only iterates through the table once.
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
drivers/cpufreq/ppc-corenet-cpufreq.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c
index 051000f..041ef3a 100644
--- a/drivers/cpufreq/ppc-corenet-cpufreq.c
+++ b/drivers/cpufreq/ppc-corenet-cpufreq.c
@@ -278,7 +278,7 @@ static int __init ppc_corenet_cpufreq_init(void)
const struct soc_data *data;
unsigned int cpu;
- np = of_find_matching_node(NULL, node_matches);
+ np = of_find_matching_node_and_match(NULL, node_matches, &match);
if (!np)
return -ENODEV;
@@ -288,7 +288,6 @@ static int __init ppc_corenet_cpufreq_init(void)
cpumask_copy(per_cpu(cpu_mask, cpu), cpu_core_mask(cpu));
}
- match = of_match_node(node_matches, np);
data = match->data;
if (data) {
if (data->flag)
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply related
* [PATCH 7/8] C6X: make use of of_find_matching_node_and_match
From: Josh Cartwright @ 2014-02-11 16:24 UTC (permalink / raw)
To: Mark Salter, Aurelien Jacquiot, linux-kernel; +Cc: devicetree, linux-c6x-dev
In-Reply-To: <1392135847-30791-1-git-send-email-joshc@codeaurora.org>
Instead of the of_find_matching_node()/of_match_node() pair, which requires two
iterations through the match table, make use of of_find_matching_node_and_match(),
which only iterates through the table once.
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
arch/c6x/platforms/plldata.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/c6x/platforms/plldata.c b/arch/c6x/platforms/plldata.c
index 755359e..8fddc46 100644
--- a/arch/c6x/platforms/plldata.c
+++ b/arch/c6x/platforms/plldata.c
@@ -397,7 +397,7 @@ static void __init c6678_setup_clocks(struct device_node *node)
}
#endif /* CONFIG_SOC_TMS320C6678 */
-static struct of_device_id c6x_clkc_match[] __initdata = {
+static const struct of_device_id c6x_clkc_match[] __initdata = {
#ifdef CONFIG_SOC_TMS320C6455
{ .compatible = "ti,c6455-pll", .data = c6455_setup_clocks },
#endif
@@ -426,7 +426,7 @@ void __init c64x_setup_clocks(void)
int err;
u32 val;
- node = of_find_matching_node(NULL, c6x_clkc_match);
+ node = of_find_matching_node_and_match(NULL, c6x_clkc_match, &id);
if (!node)
return;
@@ -458,8 +458,7 @@ void __init c64x_setup_clocks(void)
pll->lock_delay = val;
/* id->data is a pointer to SoC-specific setup */
- id = of_match_node(c6x_clkc_match, node);
- if (id && id->data) {
+ if (id->data) {
__setup_clocks = id->data;
__setup_clocks(node);
}
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply related
* [PATCH 6/8] ARM: l2x0: make use of of_find_matching_node_and_match
From: Josh Cartwright @ 2014-02-11 16:24 UTC (permalink / raw)
To: Russell King, linux-kernel; +Cc: devicetree, linux-arm-kernel
In-Reply-To: <1392135847-30791-1-git-send-email-joshc@codeaurora.org>
Instead of the of_find_matching_node()/of_match_node() pair, which requires two
iterations through the match table, make use of of_find_matching_node_and_match(),
which only iterates through the table once.
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
arch/arm/mm/cache-l2x0.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 7abde2c..e35fff3 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -970,11 +970,12 @@ static const struct of_device_id l2x0_ids[] __initconst = {
int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
{
+ const struct of_device_id *match;
struct device_node *np;
const struct l2x0_of_data *data;
struct resource res;
- np = of_find_matching_node(NULL, l2x0_ids);
+ np = of_find_matching_node_and_match(NULL, l2x0_ids, &match);
if (!np)
return -ENODEV;
@@ -987,7 +988,7 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
l2x0_saved_regs.phy_base = res.start;
- data = of_match_node(l2x0_ids, np)->data;
+ data = match->data;
/* L2 configuration can only be changed if the cache is disabled */
if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply related
* [PATCH 5/8] ARM: prima2: make use of of_find_matching_node_and_match
From: Josh Cartwright @ 2014-02-11 16:24 UTC (permalink / raw)
To: Barry Song; +Cc: devicetree, linux-kernel, Russell King, linux-arm-kernel
In-Reply-To: <1392135847-30791-1-git-send-email-joshc@codeaurora.org>
Instead of the of_find_matching_node()/of_match_node() pair, which requires two
iterations through the match table, make use of of_find_matching_node_and_match(),
which only iterates through the table once.
While we're here, mark the prima2_l2x0 table const.
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
arch/arm/mach-prima2/l2x0.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-prima2/l2x0.c b/arch/arm/mach-prima2/l2x0.c
index cbcbe9c..982b0b6 100644
--- a/arch/arm/mach-prima2/l2x0.c
+++ b/arch/arm/mach-prima2/l2x0.c
@@ -28,7 +28,7 @@ static struct l2x0_aux marco_l2x0_aux __initconst = {
.mask = L2X0_AUX_CTRL_MASK,
};
-static struct of_device_id sirf_l2x0_ids[] __initconst = {
+static const struct of_device_id sirf_l2x0_ids[] __initconst = {
{ .compatible = "sirf,prima2-pl310-cache", .data = &prima2_l2x0_aux, },
{ .compatible = "sirf,marco-pl310-cache", .data = &marco_l2x0_aux, },
{},
@@ -36,12 +36,13 @@ static struct of_device_id sirf_l2x0_ids[] __initconst = {
static int __init sirfsoc_l2x0_init(void)
{
+ const struct of_device_id *match;
struct device_node *np;
const struct l2x0_aux *aux;
- np = of_find_matching_node(NULL, sirf_l2x0_ids);
+ np = of_find_matching_node_and_match(NULL, sirf_l2x0_ids, &match);
if (np) {
- aux = of_match_node(sirf_l2x0_ids, np)->data;
+ aux = match->data;
return l2x0_of_init(aux->val, aux->mask);
}
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply related
* [PATCH 4/8] ARM: mvebu: make use of of_find_matching_node_and_match
From: Josh Cartwright @ 2014-02-11 16:24 UTC (permalink / raw)
To: Jason Cooper, Andrew Lunn, Gregory Clement, Sebastian Hesselbarth
Cc: devicetree, Russell King, linux-kernel, linux-arm-kernel
In-Reply-To: <1392135847-30791-1-git-send-email-joshc@codeaurora.org>
Instead of the of_find_matching_node()/of_match_node() pair, which requires two
iterations through the match table, make use of of_find_matching_node_and_match(),
which only iterates through the table once.
While we're here, mark the of_system_controller table const.
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
arch/arm/mach-mvebu/system-controller.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index a7fb89a..e6e300a 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -54,7 +54,7 @@ static const struct mvebu_system_controller orion_system_controller = {
.system_soft_reset = 0x1,
};
-static struct of_device_id of_system_controller_table[] = {
+static const struct of_device_id of_system_controller_table[] = {
{
.compatible = "marvell,orion-system-controller",
.data = (void *) &orion_system_controller,
@@ -90,13 +90,12 @@ void mvebu_restart(enum reboot_mode mode, const char *cmd)
static int __init mvebu_system_controller_init(void)
{
+ const struct of_device_id *match;
struct device_node *np;
- np = of_find_matching_node(NULL, of_system_controller_table);
+ np = of_find_matching_node_and_match(NULL, of_system_controller_table,
+ &match);
if (np) {
- const struct of_device_id *match =
- of_match_node(of_system_controller_table, np);
- BUG_ON(!match);
system_controller_base = of_iomap(np, 0);
mvebu_sc = (struct mvebu_system_controller *)match->data;
of_node_put(np);
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply related
* [PATCH 3/8] ARM: at91: make use of of_find_matching_node_and_match
From: Josh Cartwright @ 2014-02-11 16:24 UTC (permalink / raw)
To: Andrew Victor, Nicolas Ferre, Jean-Christophe Plagniol-Villard
Cc: devicetree, linux-kernel, Russell King, linux-arm-kernel
In-Reply-To: <1392135847-30791-1-git-send-email-joshc@codeaurora.org>
Instead of the of_find_matching_node()/of_match_node() pair, which requires two
iterations through the match table, make use of of_find_matching_node_and_match(),
which only iterates through the table once.
While we're here, mark the rtsc id table const.
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
arch/arm/mach-at91/setup.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index f7ca97b..e884de8 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -352,7 +352,7 @@ void __init at91_ioremap_matrix(u32 base_addr)
}
#if defined(CONFIG_OF)
-static struct of_device_id rstc_ids[] = {
+static const struct of_device_id rstc_ids[] = {
{ .compatible = "atmel,at91sam9260-rstc", .data = at91sam9_alt_restart },
{ .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart },
{ /*sentinel*/ }
@@ -363,7 +363,7 @@ static void at91_dt_rstc(void)
struct device_node *np;
const struct of_device_id *of_id;
- np = of_find_matching_node(NULL, rstc_ids);
+ np = of_find_matching_node_and_match(NULL, rstc_ids, &of_id);
if (!np)
panic("unable to find compatible rstc node in dtb\n");
@@ -371,10 +371,6 @@ static void at91_dt_rstc(void)
if (!at91_rstc_base)
panic("unable to map rstc cpu registers\n");
- of_id = of_match_node(rstc_ids, np);
- if (!of_id)
- panic("AT91: rtsc no restart function available\n");
-
arm_pm_restart = of_id->data;
of_node_put(np);
@@ -392,7 +388,7 @@ static void at91_dt_ramc(void)
struct device_node *np;
const struct of_device_id *of_id;
- np = of_find_matching_node(NULL, ramc_ids);
+ np = of_find_matching_node_and_match(NULL, ramc_ids, &of_id);
if (!np)
panic("unable to find compatible ram controller node in dtb\n");
@@ -402,11 +398,7 @@ static void at91_dt_ramc(void)
/* the controller may have 2 banks */
at91_ramc_base[1] = of_iomap(np, 1);
- of_id = of_match_node(ramc_ids, np);
- if (!of_id)
- pr_warn("AT91: ramc no standby function available\n");
- else
- at91_pm_set_standby(of_id->data);
+ at91_pm_set_standby(of_id->data);
of_node_put(np);
}
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply related
* [PATCH 2/8] bus: mvebu-mbus: make use of of_find_matching_node_and_match
From: Josh Cartwright @ 2014-02-11 16:24 UTC (permalink / raw)
To: Jason Cooper, Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
linux-kernel
Cc: devicetree, linux-arm-kernel
In-Reply-To: <1392135847-30791-1-git-send-email-joshc@codeaurora.org>
Instead of the of_find_matching_node()/of_match_node() pair, which requires two
iterations through the match table, make use of of_find_matching_node_and_match(),
which only iterates through the table once.
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
drivers/bus/mvebu-mbus.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index 725c461..31f2c80 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -890,13 +890,12 @@ int __init mvebu_mbus_dt_init(void)
const __be32 *prop;
int ret;
- np = of_find_matching_node(NULL, of_mvebu_mbus_ids);
+ np = of_find_matching_node_and_match(NULL, of_mvebu_mbus_ids, &of_id);
if (!np) {
pr_err("could not find a matching SoC family\n");
return -ENODEV;
}
- of_id = of_match_node(of_mvebu_mbus_ids, np);
mbus_state.soc = of_id->data;
prop = of_get_property(np, "controller", NULL);
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply related
* [PATCH 1/8] bus: arm-cci: make use of of_find_matching_node_and_match
From: Josh Cartwright @ 2014-02-11 16:23 UTC (permalink / raw)
To: Nicolas Pitre, Will Deacon, Lorenzo Pieralisi,
Sudeep KarkadaNagesha, linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <1392135847-30791-1-git-send-email-joshc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Instead of the of_find_matching_node()/of_match_node() pair, which requires two
iterations through the match table, make use of of_find_matching_node_and_match(),
which only iterates through the table once.
This also has the side effect of fixing the following following error hit
during randconfig testing:
drivers/bus/arm-cci.c: In function ‘cci_probe’:
drivers/bus/arm-cci.c:976:49: warning: dereferencing ‘void *’ pointer [enabled by default]
cci_config = of_match_node(arm_cci_matches, np)->data;
^
drivers/bus/arm-cci.c:976:49: error: request for member ‘data’ in something not a structure or union
Signed-off-by: Josh Cartwright <joshc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
drivers/bus/arm-cci.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index 962fd35..e249cdb2 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -962,6 +962,7 @@ static const struct of_device_id arm_cci_ctrl_if_matches[] = {
static int cci_probe(void)
{
+ const struct of_device_id *match;
struct cci_nb_ports const *cci_config;
int ret, i, nb_ace = 0, nb_ace_lite = 0;
struct device_node *np, *cp;
@@ -969,11 +970,11 @@ static int cci_probe(void)
const char *match_str;
bool is_ace;
- np = of_find_matching_node(NULL, arm_cci_matches);
+ np = of_find_matching_node_and_match(NULL, arm_cci_matches, &match);
if (!np)
return -ENODEV;
- cci_config = of_match_node(arm_cci_matches, np)->data;
+ cci_config = match->data;
if (!cci_config)
return -ENODEV;
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
--
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 related
* [PATCH 0/8] of_find_matching_node/of_match_node -> of_find_matching_node_and_match
From: Josh Cartwright @ 2014-02-11 16:23 UTC (permalink / raw)
To: linux-arm-kernel, cpufreq, linux-pm
Cc: devicetree, linux-kernel, Stephen Warren, Laurent Pinchart,
linux-c6x-dev
This patchset updates users of the of_find_matching_node()/of_match_node() pair
to leverage of_find_matching_node_and_match(), which only requires one walk
through the match table. This functionality was added by Stephen Warren[1], and
landed in v3.8.
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
1: 50c8af4cf9 (of: introduce for_each_matching_node_and_match())
Josh Cartwright (8):
bus: arm-cci: make use of of_find_matching_node_and_match
bus: mvebu-mbus: make use of of_find_matching_node_and_match
ARM: at91: make use of of_find_matching_node_and_match
ARM: mvebu: make use of of_find_matching_node_and_match
ARM: prima2: make use of of_find_matching_node_and_match
ARM: l2x0: make use of of_find_matching_node_and_match
C6X: make use of of_find_matching_node_and_match
cpufreq: ppc: make use of of_find_matching_node_and_match
arch/arm/mach-at91/setup.c | 16 ++++------------
arch/arm/mach-mvebu/system-controller.c | 9 ++++-----
arch/arm/mach-prima2/l2x0.c | 7 ++++---
arch/arm/mm/cache-l2x0.c | 5 +++--
arch/c6x/platforms/plldata.c | 7 +++----
drivers/bus/arm-cci.c | 5 +++--
drivers/bus/mvebu-mbus.c | 3 +--
drivers/cpufreq/ppc-corenet-cpufreq.c | 3 +--
8 files changed, 23 insertions(+), 32 deletions(-)
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply
* Re: [RFC/PATCH 1/1] mtd: nand: Add a devicetree binding for ECC strength and ECC step size
From: Ezequiel Garcia @ 2014-02-11 16:08 UTC (permalink / raw)
To: Gupta, Pekon
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Brian Norris,
David Woodhouse, Thomas Petazzoni, Gregory Clement, Seif Mazareeb,
Lior Amsalem,
b.brezillon.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
Grant Likely
In-Reply-To: <20980858CB6D3A4BAE95CA194937D5E73EA6F815-yXqyApvAXouIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
On Tue, Feb 11, 2014 at 03:49:24PM +0000, Gupta, Pekon wrote:
> Hi Ezequiel,
>
> >From: Ezequiel Garcia [mailto:ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org]
> >> diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt
> >> index 03855c8..683a310 100644
> >> --- a/Documentation/devicetree/bindings/mtd/nand.txt
> >> +++ b/Documentation/devicetree/bindings/mtd/nand.txt
> >> @@ -3,5 +3,9 @@
> >> - nand-ecc-mode : String, operation mode of the NAND ecc mode.
> >> Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first",
> >> "soft_bch".
> >>
> Should nand-ecc-mode also be marked as <deprecated>, and but we continue
> supporting it in kernel code ?
No, I wouldn't deprecate them, as they're in use by the atmel-nand and
mxc-nand drivers.
> If yes, then what is the life-time of these <deprecated> bindings.
> I mean exactly how many kernel versions should
> continue support deprecated bindings ?
>
Well, if we ever decide to deprecate a DT binding, I'd say we must keep
backwards compatible forever. Yes, forever.
Or at least, until the last user dies or we can steal his board :-)
--
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
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
* Re: [PATCH v3] sh_eth: add device tree support
From: Laurent Pinchart @ 2014-02-11 16:08 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: robh+dt, pawel.moll, mark.rutland, grant.likely, devicetree,
linux-sh, ijc+devicetree, galak, nobuhiro.iwamatsu.yj, rob,
linux-doc
In-Reply-To: <201402060258.57025.sergei.shtylyov@cogentembedded.com>
Hi Sergei,
Thanks a lot for the patch. DT support for sh-eth was number one on my most
wanted list :-)
Please see below for two minor comments.
On Thursday 06 February 2014 02:58:56 Sergei Shtylyov wrote:
> Add support of the device tree probing for the Renesas SH-Mobile SoCs
> documenting the device tree binding as necessary.
>
> This work is loosely based on the original patch by Nobuhiro Iwamatsu
> <nobuhiro.iwamatsu.yj@renesas.com>.
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
> ---
> This patch is against DaveM's 'net-next.git' repo but should also apply to
> the recent 'renesas.git' repo's 'devel' branch. It assumes the patch
> documenting all Ethernet bindings in one file to be applied as well.
> Not posting it to netdev@vger.kernel.org this time, or Dave will scold me.
> :-)
>
> Changes in version 3:
> - added probing for R8A7791 and R7S72100;
> - added irq_of_parse_and_map() call to read PHY IRQ from device tree;
> - removed '!phy' check before reading the PHY node's "reg" property;
> - replaced "phy-handle" and "phy-mode" property descriptions with references
> to the common Ethernet bindings file;
> - added "clocks" required property;
> - removed "local-mac-address" optional property;
> - replaced Armadiallo800EVA board with Lager board in the binding example;
> - updated driver's copyrights;
> - refreshed the patch.
>
> Changes in version 2:
> - added sh_eth_match_table[] entry for "renesas,ether-r8a7778", documented
> it; - clarified descriptions of the "reg" and "interrupt" properties;
> - moved "interrupt-parent" from required properties to optional;
> - mentioned the necessary PHY subnode to the "phy-handle" property
> description, documented the requered "#address-cells" and "#size-cells"
> properties; - clarified the types/descriptions of the Renesas specific
> properties; - refreshed the patch.
>
> Documentation/devicetree/bindings/net/sh_eth.txt | 55 ++++++++++++++++
> drivers/net/ethernet/renesas/sh_eth.c | 75
> ++++++++++++++++++++++- 2 files changed, 127 insertions(+), 3 deletions(-)
>
> Index: net-next/Documentation/devicetree/bindings/net/sh_eth.txt
> ===================================================================
> --- /dev/null
> +++ net-next/Documentation/devicetree/bindings/net/sh_eth.txt
> @@ -0,0 +1,55 @@
> +* Renesas Electronics SH EtherMAC
> +
> +This file provides information on what the device node for the SH EtherMAC
> +interface contains.
> +
> +Required properties:
> +- compatible: "renesas,gether-r8a7740" if the device is a part of R8A7740
> SoC.
> + "renesas,ether-r8a7778" if the device is a part of R8A7778 SoC.
> + "renesas,ether-r8a7779" if the device is a part of R8A7779 SoC.
> + "renesas,ether-r8a7790" if the device is a part of R8A7790 SoC.
> + "renesas,ether-r8a7791" if the device is a part of R8A7791 SoC.
> + "renesas,ether-r7s72100" if the device is a part of R7S72100 SoC.
> +- reg: offset and length of (1) the E-DMAC/feLic register block (required),
> + (2) the TSU register block (optional).
> +- interrupts: interrupt specifier for the sole interrupt.
> +- phy-mode: see ethernet.txt file in the same directory.
> +- phy-handle: see ethernet.txt file in the same directory.
> +- #address-cells: number of address cells for the MDIO bus, must be equal
> to 1.
> +- #size-cells: number of size cells on the MDIO bus, must be equal to 0.
> +- clocks: clock phandle and specifier pair.
> +- pinctrl-0: phandle, referring to a default pin configuration node.
> +
> +Optional properties:
> +- interrupt-parent: the phandle for the interrupt controller that services
> + interrupts for this device.
> +- pinctrl-names: pin configuration state name ("default").
> +- renesas,no-ether-link: boolean, specify when a board does not provide a
> proper
> + Ether LINK signal.
> +- renesas,ether-link-active-low: boolean, specify when the Ether LINK
> signal is
> + active-low instead of normal active-high.
> +
> +Example (Lager board):
> +
> + ethernet@ee700000 {
> + compatible = "renesas,ether-r8a7790";
> + reg = <0 0xee700000 0 0x400>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 162 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&mstp8_clks R8A7790_CLK_ETHER>;
> + phy-mode = "rmii";
> + phy-handle = <&phy1>;
> + pinctrl-0 = <ðer_pins>;
> + pinctrl-names = "default";
> + renesas,ether-link-active-low;
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + phy1: ethernet-phy@1 {
> + reg = <1>;
> + interrupt-parent = <&irqc0>;
> + interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> + pinctrl-0 = <&phy1_pins>;
> + pinctrl-names = "default";
> + };
> + };
> Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
> ===================================================================
> --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
> +++ net-next/drivers/net/ethernet/renesas/sh_eth.c
> @@ -1,8 +1,8 @@
> /* SuperH Ethernet device driver
> *
> * Copyright (C) 2006-2012 Nobuhiro Iwamatsu
> - * Copyright (C) 2008-2013 Renesas Solutions Corp.
> - * Copyright (C) 2013 Cogent Embedded, Inc.
> + * Copyright (C) 2008-2014 Renesas Solutions Corp.
> + * Copyright (C) 2013-2014 Cogent Embedded, Inc.
> *
> * This program is free software; you can redistribute it and/or modify it
> * under the terms and conditions of the GNU General Public License, @@
> -27,6 +27,10 @@
> #include <linux/platform_device.h>
> #include <linux/mdio-bitbang.h>
> #include <linux/netdevice.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +#include <linux/of_net.h>
> #include <linux/phy.h>
> #include <linux/cache.h>
> #include <linux/io.h>
> @@ -2710,6 +2714,56 @@ static const struct net_device_ops sh_et
> .ndo_change_mtu = eth_change_mtu,
> };
>
> +#ifdef CONFIG_OF
> +static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
> +{
> + struct device_node *np = dev->of_node;
> + struct sh_eth_plat_data *pdata;
> + struct device_node *phy;
> + const char *mac_addr;
> +
> + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata)
> + return NULL;
> +
> + pdata->phy_interface = of_get_phy_mode(np);
> +
> + phy = of_parse_phandle(np, "phy-handle", 0);
> + if (of_property_read_u32(phy, "reg", &pdata->phy)) {
> + devm_kfree(dev, pdata);
No need to free memory here, this will be handled by the core after the
probe() function fails.
> + return NULL;
> + }
> + pdata->phy_irq = irq_of_parse_and_map(phy, 0);
> +
> + mac_addr = of_get_mac_address(np);
> + if (mac_addr)
> + memcpy(pdata->mac_addr, mac_addr, ETH_ALEN);
> +
> + pdata->no_ether_link =
> + of_property_read_bool(np, "renesas,no-ether-link");
> + pdata->ether_link_active_low =
> + of_property_read_bool(np, "renesas,ether-link-active-low");
> +
> + return pdata;
> +}
> +
> +static const struct of_device_id sh_eth_match_table[] = {
> + { .compatible = "renesas,gether-r8a7740", .data = &r8a7740_data },
> + { .compatible = "renesas,ether-r8a7778", .data = &r8a777x_data },
> + { .compatible = "renesas,ether-r8a7779", .data = &r8a777x_data },
> + { .compatible = "renesas,ether-r8a7790", .data = &r8a779x_data },
> + { .compatible = "renesas,ether-r8a7791", .data = &r8a779x_data },
> + { .compatible = "renesas,ether-r7s72100", .data = &r7s72100_data },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, sh_eth_match_table);
> +#else
> +static inline struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
> +{
> + return NULL;
> +}
> +#endif
> +
> static int sh_eth_drv_probe(struct platform_device *pdev)
> {
> int ret, devno = 0;
> @@ -2763,6 +2817,8 @@ static int sh_eth_drv_probe(struct platf
> pm_runtime_enable(&pdev->dev);
> pm_runtime_resume(&pdev->dev);
>
> + if (pdev->dev.of_node)
> + pd = sh_eth_parse_dt(&pdev->dev);
> if (!pd) {
> dev_err(&pdev->dev, "no platform data\n");
> ret = -EINVAL;
> @@ -2778,7 +2834,19 @@ static int sh_eth_drv_probe(struct platf
> mdp->ether_link_active_low = pd->ether_link_active_low;
>
> /* set cpu data */
> - mdp->cd = (struct sh_eth_cpu_data *)id->driver_data;
> + if (id) {
> + mdp->cd = (struct sh_eth_cpu_data *)id->driver_data;
> + } else {
> + const struct of_device_id *match;
> +
> + match = of_match_device(of_match_ptr(sh_eth_match_table),
> + &pdev->dev);
> + if (!match) {
> + ret = -EINVAL;
> + goto out_release;
> + }
You can probably remove error checking, if no match is found the probe
function wouldn't have been called in the first place.
> + mdp->cd = (struct sh_eth_cpu_data *)match->data;
> + }
> mdp->reg_offset = sh_eth_get_register_offset(mdp->cd->register_type);
> sh_eth_set_default_cpu_data(mdp->cd);
>
> @@ -2920,6 +2988,7 @@ static struct platform_driver sh_eth_dri
> .driver = {
> .name = CARDNAME,
> .pm = SH_ETH_PM_OPS,
> + .of_match_table = of_match_ptr(sh_eth_match_table),
> },
> };
--
Regards,
Laurent Pinchart
^ permalink raw reply
* [PATCH] phy-core: Don't allow building phy-core as a module
From: Hans de Goede @ 2014-02-11 16:03 UTC (permalink / raw)
To: Kishon Vijay Abraham I
Cc: Greg Kroah-Hartman, Roger Quadros, Maxime Ripard,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
include/phy/phy.h has stub code in there for when building without the
phy-core enabled. This is useful for generic drivers such as ahci-platform,
ehci-platoform and ohci-platform which have support for driving an optional
phy passed to them through the devicetree.
Since on some boards this phy functionality is not needed, being able to
disable the phy subsystem without needing a lot of #ifdef magic in the
driver using it is quite useful.
However this breaks when the module using the phy subsystem is build-in and
the phy-core is not, which leads to the build failing with missing symbol
errors in the linking stage of the zImage.
Which leads to gems such as this being added to the Kconfig for achi_platform:
depends on GENERIC_PHY || !GENERIC_PHY
Rather then duplicating this code in a lot of places using the phy-core,
I believe it is better to simply not allow the phy-core to be built as a
module. The phy core is quite small and has no external dependencies, so
always building it in when enabling it should not be an issue.
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
drivers/phy/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 6070c99..6e336b4 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -5,7 +5,7 @@
menu "PHY Subsystem"
config GENERIC_PHY
- tristate "PHY Core"
+ bool "PHY Core"
help
Generic PHY support.
--
1.8.5.3
^ permalink raw reply related
* Re: [RFC/PATCH 1/1] mtd: nand: Add a devicetree binding for ECC strength and ECC step size
From: Boris BREZILLON @ 2014-02-11 15:56 UTC (permalink / raw)
To: Gupta, Pekon, Ezequiel Garcia,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Brian Norris
Cc: David Woodhouse, Thomas Petazzoni, Gregory Clement, Seif Mazareeb,
Lior Amsalem, Grant Likely
In-Reply-To: <20980858CB6D3A4BAE95CA194937D5E73EA6F815-yXqyApvAXouIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
Hi Gupta,
On 11/02/2014 16:49, Gupta, Pekon wrote:
> Hi Ezequiel,
>
>> From: Ezequiel Garcia [mailto:ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org]
>>> diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt
>>> index 03855c8..683a310 100644
>>> --- a/Documentation/devicetree/bindings/mtd/nand.txt
>>> +++ b/Documentation/devicetree/bindings/mtd/nand.txt
>>> @@ -3,5 +3,9 @@
>>> - nand-ecc-mode : String, operation mode of the NAND ecc mode.
>>> Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first",
>>> "soft_bch".
>>>
> Should nand-ecc-mode also be marked as <deprecated>, and but we continue
> supporting it in kernel code ? If yes, then what is the life-time of these
> <deprecated> bindings. I mean exactly how many kernel versions should
> continue support deprecated bindings ?
What do you mean by deprecated ? How would a NAND flash controller
driver choose amongs
its supported NAND ecc modes if we remove this property ?
Is there another patch series removing this property in the wild ?
>
>>> +- nand-ecc-strength : integer ECC required strength.
> With recent patches from 'Boris BREZILLON <b.brezillon.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>'
> "[RFC PATCH] mtd: add per NAND partition ECC config"
> Would you like 'nand-ecc-strength' to be per partition based ?
I don't think we should rely on this for the moment: I'm still working
on it but it's far from stable.
Moreover, we can keep a default ecc mode for the NAND chip and
partitions will inherit this ECC
mode when they do not specify any specific ECC config.
Best Regards,
Boris
>
> with regards, pekon
--
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
* Re: ohci-/ehci-platform: Change compatible string to ?hci-platform
From: Hans de Goede @ 2014-02-11 15:54 UTC (permalink / raw)
To: Arnd Bergmann, Alan Stern
Cc: Greg Kroah-Hartman, Roger Quadros, Tony Prisk, Florian Fainelli,
Maxime Ripard, linux-usb, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
Al Cooper
In-Reply-To: <1635726.gc3dEs0zOi@wuerfel>
Hi,
On 02/11/2014 04:43 PM, Arnd Bergmann wrote:
> On Tuesday 11 February 2014 10:27:12 Alan Stern wrote:
>>
>> It might even be a good idea to change the "xhci-platform" string to
>> match, it that doesn't cause too much trouble.
>
> The original xhci binding was contributed by Al Cooper, but I don't
> see any dts files using it. I agree that xhci-generic is a better
> name than xhci-platform, and I think we should make that the recommended
> string. If Al or someone thinks the xhci-generic string might already
> be used in production devices, we should however allow both names
> in the binding and in the driver.
I can live with generic as pre/post fix. Looking at what seems to
be the common trend I believe it should be a pre-fix and nost a post-fix
though.
The common way to build a compatible string seems to be:
vendor,soc_model-function. We have a few deviations from this in the
usb bindings, but ie the interrupt-controller bindings use this
structure for the compatible strings everywhere.
So since generic has no vendor, we fill just the soc_model-function
part leading to:
generic-ohci
generic-ehci
And possible also:
generic-uhci
generic-xhci
So I'm going to respin my 2 fixup patches to move from ?hci-platform
to generic-?hci.
Regards,
Hans
^ permalink raw reply
* DeviceTree fixes for 3.14
From: Rob Herring @ 2014-02-11 15:52 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Grant Likely
Linus,
Please pull DT fixes for 3.14.
Rob
The following changes since commit 38dbfb59d1175ef458d006556061adeaa8751b72:
Linus 3.14-rc1 (2014-02-02 16:42:13 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
tags/dt-fixes-for-3.14
for you to fetch changes up to 860a445c25aa2f99aa5881603a1f4ed2cec64025:
DT: Add vendor prefix for Spansion Inc. (2014-02-05 10:39:17 -0600)
----------------------------------------------------------------
DeviceTree fixes for 3.14:
- Fix compile error drivers/spi/spi-rspi.c with !CONFIG_OF
- Fix warnings for unused/uninitialized variables with !CONFIG_OF
- Fix PCIe bus matching for powerpc
- Add documentation for various vendor strings
----------------------------------------------------------------
Emilio López (1):
of: add vendor prefix for Allwinner Technology
Geert Uytterhoeven (2):
of/device: Nullify match table in of_match_device() for CONFIG_OF=n
DT: Add vendor prefix for Spansion Inc.
Heiko Stuebner (1):
dt-bindings: add vendor-prefix for neonode
Kleber Sacilotto de Souza (1):
of: fix PCI bus match for PCIe slots
Kumar Gala (1):
of: Update qcom vendor prefix description
Marek Belisko (1):
of: add vendor prefix for Honeywell
Rob Herring (1):
of: restructure for_each macros to fix compile warnings
.../devicetree/bindings/vendor-prefixes.txt | 6 +-
drivers/of/address.c | 5 +-
include/linux/of.h | 153 +++++++++++----------
include/linux/of_device.h | 4 +-
4 files changed, 95 insertions(+), 73 deletions(-)
--
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
* RE: [RFC/PATCH 1/1] mtd: nand: Add a devicetree binding for ECC strength and ECC step size
From: Gupta, Pekon @ 2014-02-11 15:49 UTC (permalink / raw)
To: Ezequiel Garcia,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Brian Norris
Cc: David Woodhouse, Thomas Petazzoni, Gregory Clement, Seif Mazareeb,
Lior Amsalem,
b.brezillon.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
Grant Likely
In-Reply-To: <20140211141914.GC23150@localhost>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1208 bytes --]
Hi Ezequiel,
>From: Ezequiel Garcia [mailto:ezequiel.garcia@free-electrons.com]
>> diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt
>> index 03855c8..683a310 100644
>> --- a/Documentation/devicetree/bindings/mtd/nand.txt
>> +++ b/Documentation/devicetree/bindings/mtd/nand.txt
>> @@ -3,5 +3,9 @@
>> - nand-ecc-mode : String, operation mode of the NAND ecc mode.
>> Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first",
>> "soft_bch".
>>
Should nand-ecc-mode also be marked as <deprecated>, and but we continue
supporting it in kernel code ? If yes, then what is the life-time of these
<deprecated> bindings. I mean exactly how many kernel versions should
continue support deprecated bindings ?
>> +- nand-ecc-strength : integer ECC required strength.
With recent patches from 'Boris BREZILLON <b.brezillon.dev@gmail.com>'
"[RFC PATCH] mtd: add per NAND partition ECC config"
Would you like 'nand-ecc-strength' to be per partition based ?
with regards, pekon
N§²æìr¸yúèØb²X¬¶Ç§vØ^)Þº{.nÇ+·zøzÚÞz)í
æèw*\x1fjg¬±¨\x1e¶Ý¢j.ïÛ°\½½MúgjÌæa×\x02' ©Þ¢¸\f¢·¦j:+v¨wèjØm¶ÿ¾\a«êçzZ+ùÝ¢j"ú!¶i
^ permalink raw reply
* Re: [PATCH 4/7] spi: pl022: attempt to get sspclk by name
From: Arnd Bergmann @ 2014-02-11 15:48 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Mark Brown, Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA,
pawel.moll-5wv7dgnIgG8, Linus Walleij,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <20140211150438.GJ26684-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
On Tuesday 11 February 2014 15:04:38 Russell King - ARM Linux wrote:
> On Tue, Feb 11, 2014 at 03:08:06PM +0100, Arnd Bergmann wrote:
> > On Tuesday 11 February 2014, Mark Brown wrote:
> > > On Tue, Feb 11, 2014 at 11:37:09AM +0000, Mark Rutland wrote:
> > >
> > > > - pl022->clk = devm_clk_get(&adev->dev, NULL);
> > > > + /*
> > > > + * For compatibility with old DTBs and platform data, fall back to the
> > > > + * first clock if there's not an explicitly named "sspclk" entry.
> > > > + */
> > > > + pl022->clk = devm_clk_get(&adev->dev, "sspclk");
> > > > + if (IS_ERR(pl022->clk))
> > > > + pl022->clk = devm_clk_get(&adev->dev, NULL);
> > > > +
> > >
> > > I'll just have a bit of a grumble here and point out that this sort of
> > > stuff always worries me with the convention of using nameless clocks -
> > > it causes hassle adding further clocks.
> >
> > I think the best solution for this is to continue with anonymous clocks
> > rather than adding names after the fact. This could be done (for DT-only
> > drivers) using the of_clk_get() interface that takes an index, or
> > we could add a generic dev_clk_get_index() or similar interface that
> > has the same behavior but also works for clkdev.
>
> Mixing devm_* and non-devm_* interfaces doesn't work. If you want to do
> that, devm_of_clk_get() would be a prerequisit.
Yes, good point. So if we want to do it, we would have to add a new
function anyway, there is just the question whether it should be
devm_of_clk_get() or devm_clk_get_index() if that can also work for
non-DT devices. Do you think the latter actually makes sense in
the clkdev interfaces? I'm not familiar enough with the code to
tell how that would be implemented in a reasonable way.
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
* Re: [PATCH 2/2] spi: Add Qualcomm QUP SPI controller support
From: Ivan T. Ivanov @ 2014-02-11 15:46 UTC (permalink / raw)
To: Courtney Cavin
Cc: Andy Gross, Mark Brown, Grant Likely, Rob Herring,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Alok Chauhan,
Gilad Avidov, Kiran Gunda, Sagar Dharia
In-Reply-To: <20140210202926.GV1706-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
Hi,
On Mon, 2014-02-10 at 12:29 -0800, Courtney Cavin wrote:
> On Mon, Feb 10, 2014 at 08:41:44PM +0100, Ivan T. Ivanov wrote:
> >
> > Hi,
> >
> > On Mon, 2014-02-10 at 11:47 -0600, Andy Gross wrote:
> > > On Mon, Feb 10, 2014 at 06:55:02PM +0200, Ivan T. Ivanov wrote:
> > >
> > > [....]
> > >
> > > > > > > Bail here?
> > > > > >
> > > > > > I don't know. What will be the consequences if controller continue to
> > > > > > operate on its default rate?
> > > > > >
> > > > >
> > > > > It is unclear. But if you can't set the rate that is configured or if there is
> > > > > a misconfiguration, it's probably better to exit the probe and catch it here.
> > > >
> > > >
> > > > My preference is to delay clock speed change till first
> > > > SPI transfer. And use wherever transfer itself mandate.
> > > >
> > >
> > > That works. My only concern is that it might be nice to catch a configuration
> > > problem early rather than wait for the SPI transfer to fail continuously.
> >
> > If developer is skilled enough to know which version controller is,
> > (s)he will be able to put the right frequency constrain here :-)
>
> A developer doesn't have to have much skill at all to copy-paste DT
> configurations around and muck with numbers.... I agree with Andy here,
> early validation is a good idea here, at the very least, some sanity
> checks.
Actually, thinking more on this. Supplying SPI controller with,
let say 50MHz, which is what success of clk_set_rate() means, doesn't
necessarily guaranteer that controller will be able to do transfers
properly, right? Setting frequency at this point didn't bring any
benefit.
Regards,
Ivan
>
> -Courtney
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" 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
* Re: ohci-/ehci-platform: Change compatible string to ?hci-platform
From: Arnd Bergmann @ 2014-02-11 15:43 UTC (permalink / raw)
To: Alan Stern
Cc: Hans de Goede, Greg Kroah-Hartman, Roger Quadros, Tony Prisk,
Florian Fainelli, Maxime Ripard, linux-usb,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
Al Cooper
In-Reply-To: <Pine.LNX.4.44L0.1402111023240.1209-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
On Tuesday 11 February 2014 10:27:12 Alan Stern wrote:
>
> It might even be a good idea to change the "xhci-platform" string to
> match, it that doesn't cause too much trouble.
The original xhci binding was contributed by Al Cooper, but I don't
see any dts files using it. I agree that xhci-generic is a better
name than xhci-platform, and I think we should make that the recommended
string. If Al or someone thinks the xhci-generic string might already
be used in production devices, we should however allow both names
in the binding and in the driver.
Arnd
^ permalink raw reply
* Re: [PATCH 1/2] ohci-platform: Change compatible string from usb-ohci to ohci-platform
From: Kumar Gala @ 2014-02-11 15:34 UTC (permalink / raw)
To: Hans de Goede
Cc: Greg Kroah-Hartman, devicetree, Florian Fainelli, linux-usb,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Alan Stern, Maxime Ripard,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Roger Quadros
In-Reply-To: <52FA3FE6.8040308-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Feb 11, 2014, at 9:21 AM, Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> Hi,
>
> On 02/11/2014 04:06 PM, Kumar Gala wrote:
>>
>> On Feb 11, 2014, at 8:10 AM, Hans De Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>>
>>> The initial versions of the devicetree enablement patches for ohci-platform
>>> used "ohci-platform" as compatible string. However this was disliked by various
>>> reviewers because the platform bus is a Linux invention and devicetree is
>>> supposed to be OS agnostic. After much discussion I gave up and went with
>>> the generic usb-ohci as requested.
>>>
>>> In retro-spect I should have stuck to my guns, because the dts files for many
>>> existing boards already claim to be compatible with "usb-ohci", ie they have:
>>>
>>> compatible = "ti,ohci-omap3", "usb-ohci";
>>>
>>> In theory this should not be a problem since the "ti,ohci-omap3" entry takes
>>> presedence, but in practice using a conflicting compatible string is an issue,
>>> because it makes which driver gets used depent on driver registration order.
>>>
>>> This patch changes the compatible string claimed by ohci-platform (back) to
>>> "ohci-platform", avoiding the driver registration / module loading ordering
>>> problems. Note that there already is a precedent for using ?hci-platform, in
>>> the form of xhci-platform.c using "xhci-platfrom" as compatible string.
>>>
>>> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>> ---
>>> Documentation/devicetree/bindings/usb/usb-ohci.txt | 4 ++--
>>> drivers/usb/host/ohci-platform.c | 2 +-
>>> 2 files changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/usb/usb-ohci.txt b/Documentation/devicetree/bindings/usb/usb-ohci.txt
>>> index 6933b0c..a8e576a 100644
>>> --- a/Documentation/devicetree/bindings/usb/usb-ohci.txt
>>> +++ b/Documentation/devicetree/bindings/usb/usb-ohci.txt
>>> @@ -1,7 +1,7 @@
>>> USB OHCI controllers
>>>
>>> Required properties:
>>> -- compatible : "usb-ohci"
>>
>> Why not leave 'usb-ohci' and deprecate it?
>
> As it was introduced just a couple of days ago in linux-next, and has never seen
> the light in any released kernel.
ah, never mind :)
- k
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply
* [PATCH v2 2/2] dp83640: Get pin and master/slave configuration from DT
From: Stefan Sørensen @ 2014-02-11 15:29 UTC (permalink / raw)
To: richardcochran, grant.likely, robh+dt, mark.rutland, netdev,
linux-kernel, devicetree
Cc: Stefan Sørensen
In-Reply-To: <1392132562-23644-1-git-send-email-stefan.sorensen@spectralink.com>
This patch adds configuration of the periodic output and external timestamp
pins available on the dp83640 family of PHYs. It also configures the
master/slave relationship in a group of PHYs on the same MDIO bus and the pins
used for clock calibration in the group.
The configuration is retrieved from DT through the properties
dp83640,slave
dp83640,calibrate-pin
dp83640,perout-pins
dp83640,extts-pins
The configuration module parameters are retained as fallback for the non-DT
case.
Since the pin configuration is now stored for each clock device, groups of
devices on different mdio busses can now have different pin configurations.
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
---
Documentation/devicetree/bindings/net/dp83640.txt | 29 +++++
drivers/net/phy/dp83640.c | 152 ++++++++++++++++++----
2 files changed, 154 insertions(+), 27 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/dp83640.txt
diff --git a/Documentation/devicetree/bindings/net/dp83640.txt b/Documentation/devicetree/bindings/net/dp83640.txt
new file mode 100644
index 0000000..b9a57c0
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/dp83640.txt
@@ -0,0 +1,29 @@
+Required properties for the National DP83640 ethernet phy:
+
+- compatible : Must contain "national,dp83640"
+
+Optional properties:
+
+- dp83640,slave: If present, this phy will be slave to another dp83640
+ on the same mdio bus.
+- dp83640,perout-pins : List of the pin pins used for periodic output
+ triggers.
+- dp83640,extts-pins : List of the pin pins used for external event
+ timestamping.
+- dp83640,calibrate-pin : The pin used for master/slave calibration.
+
+Example:
+
+ ethernet-phy@1 {
+ compatible = "national,dp83640", "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ dp83640,perout-pins = <2>;
+ dp83640,extts-pins = <3 4 8 9 10 11>;
+ dp83640,calibrate-pin = <1>;
+ };
+
+ ethernet-phy@2 {
+ compatible = "national,dp83640", "ethernet-phy-ieee802.3-c22";
+ reg = <2>;
+ dp83640,slave;
+ };
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index d4fe95d..a9bd553 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -30,6 +30,7 @@
#include <linux/phy.h>
#include <linux/ptp_classify.h>
#include <linux/ptp_clock_kernel.h>
+#include <linux/of_device.h>
#include "dp83640_reg.h"
@@ -119,6 +120,8 @@ struct dp83640_private {
/* queues of incoming and outgoing packets */
struct sk_buff_head rx_queue;
struct sk_buff_head tx_queue;
+ /* is this phyter a slave */
+ bool slave;
};
struct dp83640_clock {
@@ -140,6 +143,7 @@ struct dp83640_clock {
struct list_head phylist;
/* reference to our PTP hardware clock */
struct ptp_clock *ptp_clock;
+ u32 perout_pins[N_EXT], extts_pins[N_EXT], calibrate_pin;
};
@@ -263,8 +267,8 @@ static void periodic_output(struct dp83640_clock *clock,
u32 sec, nsec, period;
u16 gpio, ptp_trig, trigger, val;
- gpio = on ? perout_pins[index] : 0;
- trigger = n_ext_ts + index;
+ gpio = on ? clock->perout_pins[index] : 0;
+ trigger = clock->caps.n_ext_ts + index;
ptp_trig = TRIG_WR |
(trigger & TRIG_CSEL_MASK) << TRIG_CSEL_SHIFT |
@@ -419,12 +423,12 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
switch (rq->type) {
case PTP_CLK_REQ_EXTTS:
index = rq->extts.index;
- if (index < 0 || index >= n_ext_ts)
+ if (index < 0 || index >= clock->caps.n_ext_ts)
return -EINVAL;
event_num = index;
evnt = EVNT_WR | (event_num & EVNT_SEL_MASK) << EVNT_SEL_SHIFT;
if (on) {
- gpio_num = extts_pins[index];
+ gpio_num = clock->extts_pins[index];
evnt |= (gpio_num & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT;
evnt |= EVNT_RISE;
}
@@ -433,7 +437,7 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
case PTP_CLK_REQ_PEROUT:
index = rq->perout.index;
- if (index < 0 || index >= n_per_out)
+ if (index < 0 || index >= clock->caps.n_per_out)
return -EINVAL;
periodic_output(clock, rq, index, on);
return 0;
@@ -530,7 +534,7 @@ static void recalibrate(struct dp83640_clock *clock)
struct phy_device *master = clock->chosen->phydev;
u16 cfg0, evnt, ptp_trig, trigger, val;
- trigger = n_ext_ts + n_per_out;
+ trigger = clock->caps.n_ext_ts + clock->caps.n_per_out;
mutex_lock(&clock->extreg_lock);
@@ -554,7 +558,7 @@ static void recalibrate(struct dp83640_clock *clock)
*/
evnt = EVNT_WR | EVNT_RISE | EVNT_SINGLE;
evnt |= (trigger & EVNT_SEL_MASK) << EVNT_SEL_SHIFT;
- evnt |= (calibrate_pin & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT;
+ evnt |= (clock->calibrate_pin & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT;
list_for_each(this, &clock->phylist) {
tmp = list_entry(this, struct dp83640_private, list);
@@ -567,7 +571,7 @@ static void recalibrate(struct dp83640_clock *clock)
*/
ptp_trig = TRIG_WR | TRIG_IF_LATE | TRIG_PULSE;
ptp_trig |= (trigger & TRIG_CSEL_MASK) << TRIG_CSEL_SHIFT;
- ptp_trig |= (calibrate_pin & TRIG_GPIO_MASK) << TRIG_GPIO_SHIFT;
+ ptp_trig |= (clock->calibrate_pin & TRIG_GPIO_MASK) << TRIG_GPIO_SHIFT;
ext_write(0, master, PAGE5, PTP_TRIG, ptp_trig);
/* load trigger */
@@ -672,7 +676,7 @@ static int decode_evnt(struct dp83640_private *dp83640,
event.type = PTP_CLOCK_EXTTS;
event.timestamp = phy2txts(&dp83640->edata);
- for (i = 0; i < n_ext_ts; i++) {
+ for (i = 0; i < dp83640->clock->caps.n_ext_ts; i++) {
if (ext_status & exts_chan_to_edata(i)) {
event.index = i;
ptp_clock_event(dp83640->clock->ptp_clock, &event);
@@ -874,12 +878,11 @@ static void dp83640_clock_init(struct dp83640_clock *clock, struct mii_bus *bus)
mutex_init(&clock->extreg_lock);
mutex_init(&clock->clock_lock);
INIT_LIST_HEAD(&clock->phylist);
+ clock->calibrate_pin = -1;
clock->caps.owner = THIS_MODULE;
sprintf(clock->caps.name, "dp83640 timer");
clock->caps.max_adj = 1953124;
clock->caps.n_alarm = 0;
- clock->caps.n_ext_ts = n_ext_ts;
- clock->caps.n_per_out = n_per_out;
clock->caps.pps = 0;
clock->caps.adjfreq = ptp_dp83640_adjfreq;
clock->caps.adjtime = ptp_dp83640_adjtime;
@@ -892,18 +895,6 @@ static void dp83640_clock_init(struct dp83640_clock *clock, struct mii_bus *bus)
get_device(&bus->dev);
}
-static int choose_this_phy(struct dp83640_clock *clock,
- struct phy_device *phydev)
-{
- if (chosen_phy == -1 && !clock->chosen)
- return 1;
-
- if (chosen_phy == phydev->addr)
- return 1;
-
- return 0;
-}
-
static struct dp83640_clock *dp83640_clock_get(struct dp83640_clock *clock)
{
if (clock)
@@ -949,6 +940,95 @@ static void dp83640_clock_put(struct dp83640_clock *clock)
mutex_unlock(&clock->clock_lock);
}
+#ifdef CONFIG_OF
+static int dp83640_probe_dt(struct device_node *node,
+ struct dp83640_private *dp83640)
+{
+ struct dp83640_clock *clock = dp83640->clock;
+ struct property *prop;
+ int err, proplen;
+
+ dp83640->slave = of_property_read_bool(node, "dp83640,slave");
+ if (!dp83640->slave && clock->chosen) {
+ pr_err("dp83640,slave must be set if more than one device on the same bus");
+ return -EINVAL;
+ }
+
+ prop = of_find_property(node, "dp83640,perout-pins", &proplen);
+ if (prop) {
+ if (dp83640->slave) {
+ pr_err("dp83640,perout-pins property can not be set together with dp83640,slave");
+ return -EINVAL;
+ }
+
+ clock->caps.n_per_out = proplen / sizeof(u32);
+ if (clock->caps.n_per_out > N_EXT) {
+ pr_err("dp83640,perout-pins may not have more than %d entries",
+ N_EXT);
+ return -EINVAL;
+ }
+ err = of_property_read_u32_array(node, "dp83640,perout-pins",
+ clock->perout_pins,
+ clock->caps.n_per_out);
+ if (err < 0)
+ return err;
+ }
+
+ prop = of_find_property(node, "dp83640,extts-pins", &proplen);
+ if (prop) {
+ if (dp83640->slave) {
+ pr_err("dp83640,extts-pins property can not be set together with dp83640,slave");
+ return -EINVAL;
+ }
+
+ clock->caps.n_ext_ts = proplen / sizeof(u32);
+ if (clock->caps.n_ext_ts > N_EXT) {
+ pr_err("dp83640,extts-pins may not have more than %d entries",
+ N_EXT);
+ return -EINVAL;
+ }
+ err = of_property_read_u32_array(node, "dp83640,extts-pins",
+ clock->extts_pins,
+ clock->caps.n_ext_ts);
+ if (err < 0)
+ return err;
+ }
+
+ prop = of_find_property(node, "dp83640,calibrate-pin", &proplen);
+ if (prop) {
+ if (dp83640->slave) {
+ pr_err("dp83640,calibrate-pin property can not be set together with dp83640,slave");
+ return -EINVAL;
+ }
+ of_property_read_u32(node, "dp83640,calibrate-pin",
+ &clock->calibrate_pin);
+ }
+
+ if (!dp83640->slave) {
+ if (clock->caps.n_per_out + clock->caps.n_ext_ts +
+ (clock->calibrate_pin != -1 ? 1 : 0) > N_EXT) {
+ pr_err("Too many pins configured");
+ return -EINVAL;
+ }
+ }
+
+ return 0;
+}
+
+static const struct of_device_id dp83640_of_match_table[] = {
+ { .compatible = "national,dp83640", },
+ { },
+};
+MODULE_DEVICE_TABLE(of, dp83640_of_match_table);
+#else
+
+static inline int dp83640_probe_dt(struct device_node *node,
+ struct dp83640_private *dp83640)
+{
+ return 0;
+}
+#endif
+
static int dp83640_probe(struct phy_device *phydev)
{
struct dp83640_clock *clock;
@@ -966,7 +1046,24 @@ static int dp83640_probe(struct phy_device *phydev)
if (!dp83640)
goto no_memory;
+ dp83640->clock = clock;
dp83640->phydev = phydev;
+
+ if (phydev->dev.of_node) {
+ err = dp83640_probe_dt(phydev->dev.of_node, dp83640);
+ if (err)
+ return err;
+ } else {
+ clock->calibrate_pin = calibrate_pin;
+ memcpy(clock->perout_pins, perout_pins,
+ sizeof(clock->perout_pins));
+ memcpy(clock->extts_pins, extts_pins,
+ sizeof(clock->extts_pins));
+ if (clock->chosen ||
+ (chosen_phy != -1 && phydev->addr != chosen_phy))
+ dp83640->slave = true;
+ }
+
INIT_WORK(&dp83640->ts_work, rx_timestamp_work);
INIT_LIST_HEAD(&dp83640->rxts);
@@ -980,9 +1077,7 @@ static int dp83640_probe(struct phy_device *phydev)
skb_queue_head_init(&dp83640->rx_queue);
skb_queue_head_init(&dp83640->tx_queue);
- dp83640->clock = clock;
-
- if (choose_this_phy(clock, phydev)) {
+ if (!dp83640->slave) {
clock->chosen = dp83640;
clock->ptp_clock = ptp_clock_register(&clock->caps, &phydev->dev);
if (IS_ERR(clock->ptp_clock)) {
@@ -1327,7 +1422,10 @@ static struct phy_driver dp83640_driver = {
.hwtstamp = dp83640_hwtstamp,
.rxtstamp = dp83640_rxtstamp,
.txtstamp = dp83640_txtstamp,
- .driver = {.owner = THIS_MODULE,}
+ .driver = {
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(dp83640_of_match_table),
+ }
};
static int __init dp83640_init(void)
--
1.8.5.3
^ permalink raw reply related
* [PATCH v2 1/2] dp83640: Support a configurable number of periodic outputs
From: Stefan Sørensen @ 2014-02-11 15:29 UTC (permalink / raw)
To: richardcochran, grant.likely, robh+dt, mark.rutland, netdev,
linux-kernel, devicetree
Cc: Stefan Sørensen
In-Reply-To: <1392132562-23644-1-git-send-email-stefan.sorensen@spectralink.com>
The driver is currently limited to a single periodic output. This patch makes
the number of peridodic output dynamic by dropping the gpio_tab module
parameter and adding calibrate_pin, perout_pins, and extts_pins parameters.
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
---
drivers/net/phy/dp83640.c | 75 ++++++++++++++++++++---------------------------
1 file changed, 32 insertions(+), 43 deletions(-)
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index 547725f..d4fe95d 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -38,15 +38,11 @@
#define LAYER4 0x02
#define LAYER2 0x01
#define MAX_RXTS 64
-#define N_EXT_TS 6
+#define N_EXT 8
#define PSF_PTPVER 2
#define PSF_EVNT 0x4000
#define PSF_RX 0x2000
#define PSF_TX 0x1000
-#define EXT_EVENT 1
-#define CAL_EVENT 7
-#define CAL_TRIGGER 7
-#define PER_TRIGGER 6
#define MII_DP83640_MICR 0x11
#define MII_DP83640_MISR 0x12
@@ -146,32 +142,24 @@ struct dp83640_clock {
struct ptp_clock *ptp_clock;
};
-/* globals */
-
-enum {
- CALIBRATE_GPIO,
- PEROUT_GPIO,
- EXTTS0_GPIO,
- EXTTS1_GPIO,
- EXTTS2_GPIO,
- EXTTS3_GPIO,
- EXTTS4_GPIO,
- EXTTS5_GPIO,
- GPIO_TABLE_SIZE
-};
static int chosen_phy = -1;
-static ushort gpio_tab[GPIO_TABLE_SIZE] = {
- 1, 2, 3, 4, 8, 9, 10, 11
-};
+static int calibrate_pin = 1;
+static int perout_pins[N_EXT] = {2};
+static int n_per_out = 1;
+static int extts_pins[N_EXT] = {3, 4, 8, 9, 10, 11};
+static int n_ext_ts = 6;
module_param(chosen_phy, int, 0444);
-module_param_array(gpio_tab, ushort, NULL, 0444);
+module_param(calibrate_pin, int, 0444);
+module_param_array(perout_pins, int, &n_per_out, 0444);
+module_param_array(extts_pins, int, &n_ext_ts, 0444);
MODULE_PARM_DESC(chosen_phy, \
"The address of the PHY to use for the ancillary clock features");
-MODULE_PARM_DESC(gpio_tab, \
- "Which GPIO line to use for which purpose: cal,perout,extts1,...,extts6");
+MODULE_PARM_DESC(calibrate_pin, "Which pin to use for calibration");
+MODULE_PARM_DESC(perout_pins, "Which pins to use for periodic output");
+MODULE_PARM_DESC(extts_pins, "Which pins to use for external timestamping");
/* a list of clocks and a mutex to protect it */
static LIST_HEAD(phyter_clocks);
@@ -267,15 +255,16 @@ static u64 phy2txts(struct phy_txts *p)
}
static void periodic_output(struct dp83640_clock *clock,
- struct ptp_clock_request *clkreq, bool on)
+ struct ptp_clock_request *clkreq, int index,
+ bool on)
{
struct dp83640_private *dp83640 = clock->chosen;
struct phy_device *phydev = dp83640->phydev;
u32 sec, nsec, period;
u16 gpio, ptp_trig, trigger, val;
- gpio = on ? gpio_tab[PEROUT_GPIO] : 0;
- trigger = PER_TRIGGER;
+ gpio = on ? perout_pins[index] : 0;
+ trigger = n_ext_ts + index;
ptp_trig = TRIG_WR |
(trigger & TRIG_CSEL_MASK) << TRIG_CSEL_SHIFT |
@@ -430,12 +419,12 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
switch (rq->type) {
case PTP_CLK_REQ_EXTTS:
index = rq->extts.index;
- if (index < 0 || index >= N_EXT_TS)
+ if (index < 0 || index >= n_ext_ts)
return -EINVAL;
- event_num = EXT_EVENT + index;
+ event_num = index;
evnt = EVNT_WR | (event_num & EVNT_SEL_MASK) << EVNT_SEL_SHIFT;
if (on) {
- gpio_num = gpio_tab[EXTTS0_GPIO + index];
+ gpio_num = extts_pins[index];
evnt |= (gpio_num & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT;
evnt |= EVNT_RISE;
}
@@ -443,9 +432,10 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
return 0;
case PTP_CLK_REQ_PEROUT:
- if (rq->perout.index != 0)
+ index = rq->perout.index;
+ if (index < 0 || index >= n_per_out)
return -EINVAL;
- periodic_output(clock, rq, on);
+ periodic_output(clock, rq, index, on);
return 0;
default:
@@ -538,10 +528,9 @@ static void recalibrate(struct dp83640_clock *clock)
struct list_head *this;
struct dp83640_private *tmp;
struct phy_device *master = clock->chosen->phydev;
- u16 cal_gpio, cfg0, evnt, ptp_trig, trigger, val;
+ u16 cfg0, evnt, ptp_trig, trigger, val;
- trigger = CAL_TRIGGER;
- cal_gpio = gpio_tab[CALIBRATE_GPIO];
+ trigger = n_ext_ts + n_per_out;
mutex_lock(&clock->extreg_lock);
@@ -564,8 +553,8 @@ static void recalibrate(struct dp83640_clock *clock)
* enable an event timestamp
*/
evnt = EVNT_WR | EVNT_RISE | EVNT_SINGLE;
- evnt |= (CAL_EVENT & EVNT_SEL_MASK) << EVNT_SEL_SHIFT;
- evnt |= (cal_gpio & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT;
+ evnt |= (trigger & EVNT_SEL_MASK) << EVNT_SEL_SHIFT;
+ evnt |= (calibrate_pin & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT;
list_for_each(this, &clock->phylist) {
tmp = list_entry(this, struct dp83640_private, list);
@@ -578,7 +567,7 @@ static void recalibrate(struct dp83640_clock *clock)
*/
ptp_trig = TRIG_WR | TRIG_IF_LATE | TRIG_PULSE;
ptp_trig |= (trigger & TRIG_CSEL_MASK) << TRIG_CSEL_SHIFT;
- ptp_trig |= (cal_gpio & TRIG_GPIO_MASK) << TRIG_GPIO_SHIFT;
+ ptp_trig |= (calibrate_pin & TRIG_GPIO_MASK) << TRIG_GPIO_SHIFT;
ext_write(0, master, PAGE5, PTP_TRIG, ptp_trig);
/* load trigger */
@@ -642,7 +631,7 @@ static void recalibrate(struct dp83640_clock *clock)
static inline u16 exts_chan_to_edata(int ch)
{
- return 1 << ((ch + EXT_EVENT) * 2);
+ return 1 << ((ch) * 2);
}
static int decode_evnt(struct dp83640_private *dp83640,
@@ -676,14 +665,14 @@ static int decode_evnt(struct dp83640_private *dp83640,
parsed = words + 2;
} else {
parsed = words + 1;
- i = ((ests >> EVNT_NUM_SHIFT) & EVNT_NUM_MASK) - EXT_EVENT;
+ i = ((ests >> EVNT_NUM_SHIFT) & EVNT_NUM_MASK);
ext_status = exts_chan_to_edata(i);
}
event.type = PTP_CLOCK_EXTTS;
event.timestamp = phy2txts(&dp83640->edata);
- for (i = 0; i < N_EXT_TS; i++) {
+ for (i = 0; i < n_ext_ts; i++) {
if (ext_status & exts_chan_to_edata(i)) {
event.index = i;
ptp_clock_event(dp83640->clock->ptp_clock, &event);
@@ -889,8 +878,8 @@ static void dp83640_clock_init(struct dp83640_clock *clock, struct mii_bus *bus)
sprintf(clock->caps.name, "dp83640 timer");
clock->caps.max_adj = 1953124;
clock->caps.n_alarm = 0;
- clock->caps.n_ext_ts = N_EXT_TS;
- clock->caps.n_per_out = 1;
+ clock->caps.n_ext_ts = n_ext_ts;
+ clock->caps.n_per_out = n_per_out;
clock->caps.pps = 0;
clock->caps.adjfreq = ptp_dp83640_adjfreq;
clock->caps.adjtime = ptp_dp83640_adjtime;
--
1.8.5.3
^ permalink raw reply related
* [PATCH v2 0/2] dp83640: Get pin and master/slave configuration from DT
From: Stefan Sørensen @ 2014-02-11 15:29 UTC (permalink / raw)
To: richardcochran, grant.likely, robh+dt, mark.rutland, netdev,
linux-kernel, devicetree
Cc: Stefan Sørensen
This patch series add DT configuration to the DP83640 PHY driver and makes
the configuration of periodic output pins dynamic.
Changes since v1:
- Add bindings documentation
- Keep module parameters
- Rename gpio->pin
- Split patch into DT part and dynamic periodic output support
Stefan
Stefan Sørensen (2):
dp83640: Support a configurable number of periodic outputs
dp83640: Get pin and master/slave configuration from DT
Documentation/devicetree/bindings/net/dp83640.txt | 29 +++
drivers/net/phy/dp83640.c | 205 +++++++++++++++-------
2 files changed, 175 insertions(+), 59 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/dp83640.txt
--
1.8.5.3
^ permalink raw reply
* [PATCH] ARM: dts: omap3-n9 family: mark proper OMAP version
From: Nishanth Menon @ 2014-02-11 15:29 UTC (permalink / raw)
To: Benoît Cousson, Tony Lindgren
Cc: linux-omap, devicetree, linux-arm-kernel, linux-kernel,
Nishanth Menon, Aaro Koskinen
Nokia N900 uses OMAP3430 and N9/N950 uses OMAP3630. Mark SoC compatibilty
as per Documentation/devicetree/bindings/arm/omap/omap.txt else
N9/N950 will be probed as a OMAP3430 type device, since default ti,omap3
maps to OMAP3430 compatibility.
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
just build tested. but given examples such as
http://thread.gmane.org/gmane.linux.ports.arm.omap/110006
I guess, some form of failure is expected.
based on v3.14-rc2
arch/arm/boot/dts/omap3-n9.dts | 2 +-
arch/arm/boot/dts/omap3-n900.dts | 2 +-
arch/arm/boot/dts/omap3-n950.dts | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boot/dts/omap3-n9.dts b/arch/arm/boot/dts/omap3-n9.dts
index 39828ce..9938b5d 100644
--- a/arch/arm/boot/dts/omap3-n9.dts
+++ b/arch/arm/boot/dts/omap3-n9.dts
@@ -14,5 +14,5 @@
/ {
model = "Nokia N9";
- compatible = "nokia,omap3-n9", "ti,omap3";
+ compatible = "nokia,omap3-n9", "ti,omap36xx", "ti,omap3";
};
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
index 6fc85f9..97db027 100644
--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -13,7 +13,7 @@
/ {
model = "Nokia N900";
- compatible = "nokia,omap3-n900", "ti,omap3";
+ compatible = "nokia,omap3-n900", "ti,omap3430", "ti,omap3";
cpus {
cpu@0 {
diff --git a/arch/arm/boot/dts/omap3-n950.dts b/arch/arm/boot/dts/omap3-n950.dts
index b076a52..261c558 100644
--- a/arch/arm/boot/dts/omap3-n950.dts
+++ b/arch/arm/boot/dts/omap3-n950.dts
@@ -14,5 +14,5 @@
/ {
model = "Nokia N950";
- compatible = "nokia,omap3-n950", "ti,omap3";
+ compatible = "nokia,omap3-n950", "ti,omap36xx", "ti,omap3";
};
--
1.7.9.5
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox