* [PATCH 0/2] QE clock source improvements
@ 2007-12-03 21:17 Timur Tabi
2007-12-03 21:17 ` [PATCH 1/2] qe: add function qe_clock_source() Timur Tabi
0 siblings, 1 reply; 8+ messages in thread
From: Timur Tabi @ 2007-12-03 21:17 UTC (permalink / raw)
To: netdev, linuxppc-dev, galak
This patch set adds a new property to make specifying QE clock sources
easier, adds a function to help parse the property, and updates the ucc_geth
driver to take advantage of all this.
Patch #1 is an arch/powerpc patch meant for Kumar's for-2.6.25 branch.
Patch #2 is a netdev patch, so it's either for Jeff G and/or Kumar.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] qe: add function qe_clock_source()
2007-12-03 21:17 [PATCH 0/2] QE clock source improvements Timur Tabi
@ 2007-12-03 21:17 ` Timur Tabi
2007-12-03 21:17 ` [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties Timur Tabi
2007-12-12 15:19 ` [PATCH 1/2] qe: add function qe_clock_source() Timur Tabi
0 siblings, 2 replies; 8+ messages in thread
From: Timur Tabi @ 2007-12-03 21:17 UTC (permalink / raw)
To: netdev, linuxppc-dev, galak; +Cc: Timur Tabi
Add function qe_clock_source() which takes a string containing the name of a
QE clock source (as is typically found in device trees) and returns the
matching enum qe_clock value.
Update booting-without-of.txt to indicate that the UCC properties rx-clock
and tx-clock are deprecated and replaced with rx-clock-name and tx-clock-name,
which use strings instead of numbers to indicate QE clock sources.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
This patch applies to Kumar's for-2.6.25 branch. You may need to apply
my other pending patch, "qe: add ability to upload QE firmware", first.
Documentation/powerpc/booting-without-of.txt | 13 ++++++++++
arch/powerpc/sysdev/qe_lib/qe.c | 32 ++++++++++++++++++++++++++
include/asm-powerpc/qe.h | 1 +
3 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index e9a3cb1..c4342d3 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1626,6 +1626,19 @@ platforms are moved over to use the flattened-device-tree model.
- interrupt-parent : the phandle for the interrupt controller that
services interrupts for this device.
- pio-handle : The phandle for the Parallel I/O port configuration.
+ - rx-clock-name: the UCC receive clock source
+ "none": clock source is disabled
+ "brg1" through "brg16": clock source is BRG1-BRG16, respectively
+ "clk1" through "clk24": clock source is CLK1-CLK24, respectively
+ - tx-clock-name: the UCC transmit clock source
+ "none": clock source is disabled
+ "brg1" through "brg16": clock source is BRG1-BRG16, respectively
+ "clk1" through "clk24": clock source is CLK1-CLK24, respectively
+ The following two properties are deprecated. rx-clock has been replaced
+ with rx-clock-name, and tx-clock has been replaced with tx-clock-name.
+ Drivers that currently use the deprecated properties should continue to
+ do so, in order to support older device trees, but they should be updated
+ to check for the new properties first.
- rx-clock : represents the UCC receive clock source.
0x00 : clock source is disabled;
0x1~0x10 : clock source is BRG1~BRG16 respectively;
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 865277b..5df8530 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -204,6 +204,38 @@ int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier)
}
EXPORT_SYMBOL(qe_setbrg);
+/* Convert a string to a QE clock source enum
+ *
+ * This function takes a string, typically from a property in the device
+ * tree, and returns the corresponding "enum qe_clock" value.
+*/
+enum qe_clock qe_clock_source(const char *source)
+{
+ unsigned int i;
+
+ if (strcasecmp(source, "none") == 0)
+ return QE_CLK_NONE;
+
+ if (strncasecmp(source, "brg", 3) == 0) {
+ i = simple_strtoul(source + 3, NULL, 10);
+ if ((i >= 1) && (i <= 16))
+ return (QE_BRG1 - 1) + i;
+ else
+ return QE_CLK_DUMMY;
+ }
+
+ if (strncasecmp(source, "clk", 3) == 0) {
+ i = simple_strtoul(source + 3, NULL, 10);
+ if ((i >= 1) && (i <= 24))
+ return (QE_CLK1 - 1) + i;
+ else
+ return QE_CLK_DUMMY;
+ }
+
+ return QE_CLK_DUMMY;
+}
+EXPORT_SYMBOL(qe_clock_source);
+
/* Initialize SNUMs (thread serial numbers) according to
* QE Module Control chapter, SNUM table
*/
diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h
index 35c7b8d..430dc77 100644
--- a/include/asm-powerpc/qe.h
+++ b/include/asm-powerpc/qe.h
@@ -84,6 +84,7 @@ extern int par_io_data_set(u8 port, u8 pin, u8 val);
/* QE internal API */
int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input);
+enum qe_clock qe_clock_source(const char *source);
int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier);
int qe_get_snum(void);
void qe_put_snum(u8 snum);
--
1.5.2.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties
2007-12-03 21:17 ` [PATCH 1/2] qe: add function qe_clock_source() Timur Tabi
@ 2007-12-03 21:17 ` Timur Tabi
2007-12-12 15:19 ` Timur Tabi
` (2 more replies)
2007-12-12 15:19 ` [PATCH 1/2] qe: add function qe_clock_source() Timur Tabi
1 sibling, 3 replies; 8+ messages in thread
From: Timur Tabi @ 2007-12-03 21:17 UTC (permalink / raw)
To: netdev, linuxppc-dev, galak; +Cc: Timur Tabi
Updates the ucc_geth device driver to check the new rx-clock-name and
tx-clock-name properties first. If present, it uses the new function
qe_clock_source() to obtain the clock source. Otherwise, it checks the
deprecated rx-clock and tx-clock properties.
Update the device trees for 832x, 836x, and 8568 to contain the new property
names only.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
This patch applies to Kumar's for-2.6.25 branch. ucc_geth will compile but not
run if my other patch, "qe: add function qe_clock_source" has not also been
applied.
arch/powerpc/boot/dts/mpc832x_mds.dts | 8 ++--
arch/powerpc/boot/dts/mpc832x_rdb.dts | 8 ++--
arch/powerpc/boot/dts/mpc836x_mds.dts | 8 ++--
arch/powerpc/boot/dts/mpc8568mds.dts | 8 ++--
drivers/net/ucc_geth.c | 55 ++++++++++++++++++++++++++++++--
5 files changed, 67 insertions(+), 20 deletions(-)
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index c64f303..fe54489 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -223,8 +223,8 @@
*/
mac-address = [ 00 00 00 00 00 00 ];
local-mac-address = [ 00 00 00 00 00 00 ];
- rx-clock = <19>;
- tx-clock = <1a>;
+ rx-clock-name = "clk9";
+ tx-clock-name = "clk10";
phy-handle = < &phy3 >;
pio-handle = < &pio3 >;
};
@@ -244,8 +244,8 @@
*/
mac-address = [ 00 00 00 00 00 00 ];
local-mac-address = [ 00 00 00 00 00 00 ];
- rx-clock = <17>;
- tx-clock = <18>;
+ rx-clock-name = "clk7";
+ tx-clock-name = "clk8";
phy-handle = < &phy4 >;
pio-handle = < &pio4 >;
};
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index 388c8a7..e68a08b 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -202,8 +202,8 @@
*/
mac-address = [ 00 00 00 00 00 00 ];
local-mac-address = [ 00 00 00 00 00 00 ];
- rx-clock = <20>;
- tx-clock = <13>;
+ rx-clock-name = "clk16";
+ tx-clock-name = "clk3";
phy-handle = <&phy00>;
pio-handle = <&ucc2pio>;
};
@@ -223,8 +223,8 @@
*/
mac-address = [ 00 00 00 00 00 00 ];
local-mac-address = [ 00 00 00 00 00 00 ];
- rx-clock = <19>;
- tx-clock = <1a>;
+ rx-clock-name = "clk9";
+ tx-clock-name = "clk10";
phy-handle = <&phy04>;
pio-handle = <&ucc3pio>;
};
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 0b2d2b5..bfd48d0 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -254,8 +254,8 @@
*/
mac-address = [ 00 00 00 00 00 00 ];
local-mac-address = [ 00 00 00 00 00 00 ];
- rx-clock = <0>;
- tx-clock = <19>;
+ rx-clock-name = "none";
+ tx-clock-name = "clk9";
phy-handle = < &phy0 >;
phy-connection-type = "rgmii-id";
pio-handle = < &pio1 >;
@@ -276,8 +276,8 @@
*/
mac-address = [ 00 00 00 00 00 00 ];
local-mac-address = [ 00 00 00 00 00 00 ];
- rx-clock = <0>;
- tx-clock = <14>;
+ rx-clock-name = "none";
+ tx-clock-name = "clk4";
phy-handle = < &phy1 >;
phy-connection-type = "rgmii-id";
pio-handle = < &pio2 >;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 5439437..cf45aab 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -333,8 +333,8 @@
*/
mac-address = [ 00 00 00 00 00 00 ];
local-mac-address = [ 00 00 00 00 00 00 ];
- rx-clock = <0>;
- tx-clock = <20>;
+ rx-clock-name = "none";
+ tx-clock-name = "clk16";
pio-handle = <&pio1>;
phy-handle = <&phy0>;
phy-connection-type = "rgmii-id";
@@ -355,8 +355,8 @@
*/
mac-address = [ 00 00 00 00 00 00 ];
local-mac-address = [ 00 00 00 00 00 00 ];
- rx-clock = <0>;
- tx-clock = <20>;
+ rx-clock-name = "none";
+ tx-clock-name = "clk16";
pio-handle = <&pio2>;
phy-handle = <&phy1>;
phy-connection-type = "rgmii-id";
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index a3ff270..a93342e 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3814,6 +3814,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
int err, ucc_num, max_speed = 0;
const phandle *ph;
const unsigned int *prop;
+ const char *sprop;
const void *mac_addr;
phy_interface_t phy_interface;
static const int enet_to_speed[] = {
@@ -3846,10 +3847,56 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
ug_info->uf_info.ucc_num = ucc_num;
- prop = of_get_property(np, "rx-clock", NULL);
- ug_info->uf_info.rx_clock = *prop;
- prop = of_get_property(np, "tx-clock", NULL);
- ug_info->uf_info.tx_clock = *prop;
+ sprop = of_get_property(np, "rx-clock-name", NULL);
+ if (sprop) {
+ ug_info->uf_info.rx_clock = qe_clock_source(sprop);
+ if ((ug_info->uf_info.rx_clock < QE_CLK_NONE) ||
+ (ug_info->uf_info.rx_clock > QE_CLK24)) {
+ printk(KERN_ERR
+ "ucc_geth: invalid rx-clock-name property\n");
+ return -EINVAL;
+ }
+ } else {
+ prop = of_get_property(np, "rx-clock", NULL);
+ if (!prop) {
+ /* If both rx-clock-name and rx-clock are missing,
+ we want to tell people to use rx-clock-name. */
+ printk(KERN_ERR
+ "ucc_geth: missing rx-clock-name property\n");
+ return -EINVAL;
+ }
+ if ((*prop < QE_CLK_NONE) || (*prop > QE_CLK24)) {
+ printk(KERN_ERR
+ "ucc_geth: invalid rx-clock propperty\n");
+ return -EINVAL;
+ }
+ ug_info->uf_info.rx_clock = *prop;
+ }
+
+ sprop = of_get_property(np, "tx-clock-name", NULL);
+ if (sprop) {
+ ug_info->uf_info.tx_clock = qe_clock_source(sprop);
+ if ((ug_info->uf_info.tx_clock < QE_CLK_NONE) ||
+ (ug_info->uf_info.tx_clock > QE_CLK24)) {
+ printk(KERN_ERR
+ "ucc_geth: invalid tx-clock-name property\n");
+ return -EINVAL;
+ }
+ } else {
+ prop = of_get_property(np, "rx-clock", NULL);
+ if (!prop) {
+ printk(KERN_ERR
+ "ucc_geth: mising tx-clock-name property\n");
+ return -EINVAL;
+ }
+ if ((*prop < QE_CLK_NONE) || (*prop > QE_CLK24)) {
+ printk(KERN_ERR
+ "ucc_geth: invalid tx-clock property\n");
+ return -EINVAL;
+ }
+ ug_info->uf_info.tx_clock = *prop;
+ }
+
err = of_address_to_resource(np, 0, &res);
if (err)
return -EINVAL;
--
1.5.2.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] qe: add function qe_clock_source()
2007-12-03 21:17 ` [PATCH 1/2] qe: add function qe_clock_source() Timur Tabi
2007-12-03 21:17 ` [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties Timur Tabi
@ 2007-12-12 15:19 ` Timur Tabi
1 sibling, 0 replies; 8+ messages in thread
From: Timur Tabi @ 2007-12-12 15:19 UTC (permalink / raw)
To: galak; +Cc: netdev, linuxppc-dev
Timur Tabi wrote:
> Add function qe_clock_source() which takes a string containing the name of a
> QE clock source (as is typically found in device trees) and returns the
> matching enum qe_clock value.
>
> Update booting-without-of.txt to indicate that the UCC properties rx-clock
> and tx-clock are deprecated and replaced with rx-clock-name and tx-clock-name,
> which use strings instead of numbers to indicate QE clock sources.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
If there are no objections, I'd like this patch to be pulled into 2.6.25. Thanks.
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties
2007-12-03 21:17 ` [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties Timur Tabi
@ 2007-12-12 15:19 ` Timur Tabi
2007-12-14 5:07 ` Kumar Gala
2007-12-14 7:19 ` Kumar Gala
2 siblings, 0 replies; 8+ messages in thread
From: Timur Tabi @ 2007-12-12 15:19 UTC (permalink / raw)
To: galak; +Cc: netdev, linuxppc-dev
Timur Tabi wrote:
> Updates the ucc_geth device driver to check the new rx-clock-name and
> tx-clock-name properties first. If present, it uses the new function
> qe_clock_source() to obtain the clock source. Otherwise, it checks the
> deprecated rx-clock and tx-clock properties.
>
> Update the device trees for 832x, 836x, and 8568 to contain the new property
> names only.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
If there are no objections, I'd like this patch to be pulled into 2.6.25. Thanks.
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties
2007-12-03 21:17 ` [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties Timur Tabi
2007-12-12 15:19 ` Timur Tabi
@ 2007-12-14 5:07 ` Kumar Gala
2007-12-14 6:45 ` Jeff Garzik
2007-12-14 7:19 ` Kumar Gala
2 siblings, 1 reply; 8+ messages in thread
From: Kumar Gala @ 2007-12-14 5:07 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, Timur Tabi, linuxppc-dev list
On Dec 3, 2007, at 3:17 PM, Timur Tabi wrote:
> Updates the ucc_geth device driver to check the new rx-clock-name and
> tx-clock-name properties first. If present, it uses the new function
> qe_clock_source() to obtain the clock source. Otherwise, it checks
> the
> deprecated rx-clock and tx-clock properties.
>
> Update the device trees for 832x, 836x, and 8568 to contain the new
> property
> names only.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>
> This patch applies to Kumar's for-2.6.25 branch. ucc_geth will
> compile but not
> run if my other patch, "qe: add function qe_clock_source" has not
> also been
> applied.
Jeff, I'll take this patch via powerpc.git if you don't have any issue
since its just touching probe/setup bits.
- k
> arch/powerpc/boot/dts/mpc832x_mds.dts | 8 ++--
> arch/powerpc/boot/dts/mpc832x_rdb.dts | 8 ++--
> arch/powerpc/boot/dts/mpc836x_mds.dts | 8 ++--
> arch/powerpc/boot/dts/mpc8568mds.dts | 8 ++--
> drivers/net/ucc_geth.c | 55 ++++++++++++++++++++++++
> ++++++--
> 5 files changed, 67 insertions(+), 20 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/
> boot/dts/mpc832x_mds.dts
> index c64f303..fe54489 100644
> --- a/arch/powerpc/boot/dts/mpc832x_mds.dts
> +++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
> @@ -223,8 +223,8 @@
> */
> mac-address = [ 00 00 00 00 00 00 ];
> local-mac-address = [ 00 00 00 00 00 00 ];
> - rx-clock = <19>;
> - tx-clock = <1a>;
> + rx-clock-name = "clk9";
> + tx-clock-name = "clk10";
> phy-handle = < &phy3 >;
> pio-handle = < &pio3 >;
> };
> @@ -244,8 +244,8 @@
> */
> mac-address = [ 00 00 00 00 00 00 ];
> local-mac-address = [ 00 00 00 00 00 00 ];
> - rx-clock = <17>;
> - tx-clock = <18>;
> + rx-clock-name = "clk7";
> + tx-clock-name = "clk8";
> phy-handle = < &phy4 >;
> pio-handle = < &pio4 >;
> };
> diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/
> boot/dts/mpc832x_rdb.dts
> index 388c8a7..e68a08b 100644
> --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
> +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
> @@ -202,8 +202,8 @@
> */
> mac-address = [ 00 00 00 00 00 00 ];
> local-mac-address = [ 00 00 00 00 00 00 ];
> - rx-clock = <20>;
> - tx-clock = <13>;
> + rx-clock-name = "clk16";
> + tx-clock-name = "clk3";
> phy-handle = <&phy00>;
> pio-handle = <&ucc2pio>;
> };
> @@ -223,8 +223,8 @@
> */
> mac-address = [ 00 00 00 00 00 00 ];
> local-mac-address = [ 00 00 00 00 00 00 ];
> - rx-clock = <19>;
> - tx-clock = <1a>;
> + rx-clock-name = "clk9";
> + tx-clock-name = "clk10";
> phy-handle = <&phy04>;
> pio-handle = <&ucc3pio>;
> };
> diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/
> boot/dts/mpc836x_mds.dts
> index 0b2d2b5..bfd48d0 100644
> --- a/arch/powerpc/boot/dts/mpc836x_mds.dts
> +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
> @@ -254,8 +254,8 @@
> */
> mac-address = [ 00 00 00 00 00 00 ];
> local-mac-address = [ 00 00 00 00 00 00 ];
> - rx-clock = <0>;
> - tx-clock = <19>;
> + rx-clock-name = "none";
> + tx-clock-name = "clk9";
> phy-handle = < &phy0 >;
> phy-connection-type = "rgmii-id";
> pio-handle = < &pio1 >;
> @@ -276,8 +276,8 @@
> */
> mac-address = [ 00 00 00 00 00 00 ];
> local-mac-address = [ 00 00 00 00 00 00 ];
> - rx-clock = <0>;
> - tx-clock = <14>;
> + rx-clock-name = "none";
> + tx-clock-name = "clk4";
> phy-handle = < &phy1 >;
> phy-connection-type = "rgmii-id";
> pio-handle = < &pio2 >;
> diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/
> boot/dts/mpc8568mds.dts
> index 5439437..cf45aab 100644
> --- a/arch/powerpc/boot/dts/mpc8568mds.dts
> +++ b/arch/powerpc/boot/dts/mpc8568mds.dts
> @@ -333,8 +333,8 @@
> */
> mac-address = [ 00 00 00 00 00 00 ];
> local-mac-address = [ 00 00 00 00 00 00 ];
> - rx-clock = <0>;
> - tx-clock = <20>;
> + rx-clock-name = "none";
> + tx-clock-name = "clk16";
> pio-handle = <&pio1>;
> phy-handle = <&phy0>;
> phy-connection-type = "rgmii-id";
> @@ -355,8 +355,8 @@
> */
> mac-address = [ 00 00 00 00 00 00 ];
> local-mac-address = [ 00 00 00 00 00 00 ];
> - rx-clock = <0>;
> - tx-clock = <20>;
> + rx-clock-name = "none";
> + tx-clock-name = "clk16";
> pio-handle = <&pio2>;
> phy-handle = <&phy1>;
> phy-connection-type = "rgmii-id";
> diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
> index a3ff270..a93342e 100644
> --- a/drivers/net/ucc_geth.c
> +++ b/drivers/net/ucc_geth.c
> @@ -3814,6 +3814,7 @@ static int ucc_geth_probe(struct of_device*
> ofdev, const struct of_device_id *ma
> int err, ucc_num, max_speed = 0;
> const phandle *ph;
> const unsigned int *prop;
> + const char *sprop;
> const void *mac_addr;
> phy_interface_t phy_interface;
> static const int enet_to_speed[] = {
> @@ -3846,10 +3847,56 @@ static int ucc_geth_probe(struct of_device*
> ofdev, const struct of_device_id *ma
>
> ug_info->uf_info.ucc_num = ucc_num;
>
> - prop = of_get_property(np, "rx-clock", NULL);
> - ug_info->uf_info.rx_clock = *prop;
> - prop = of_get_property(np, "tx-clock", NULL);
> - ug_info->uf_info.tx_clock = *prop;
> + sprop = of_get_property(np, "rx-clock-name", NULL);
> + if (sprop) {
> + ug_info->uf_info.rx_clock = qe_clock_source(sprop);
> + if ((ug_info->uf_info.rx_clock < QE_CLK_NONE) ||
> + (ug_info->uf_info.rx_clock > QE_CLK24)) {
> + printk(KERN_ERR
> + "ucc_geth: invalid rx-clock-name property\n");
> + return -EINVAL;
> + }
> + } else {
> + prop = of_get_property(np, "rx-clock", NULL);
> + if (!prop) {
> + /* If both rx-clock-name and rx-clock are missing,
> + we want to tell people to use rx-clock-name. */
> + printk(KERN_ERR
> + "ucc_geth: missing rx-clock-name property\n");
> + return -EINVAL;
> + }
> + if ((*prop < QE_CLK_NONE) || (*prop > QE_CLK24)) {
> + printk(KERN_ERR
> + "ucc_geth: invalid rx-clock propperty\n");
> + return -EINVAL;
> + }
> + ug_info->uf_info.rx_clock = *prop;
> + }
> +
> + sprop = of_get_property(np, "tx-clock-name", NULL);
> + if (sprop) {
> + ug_info->uf_info.tx_clock = qe_clock_source(sprop);
> + if ((ug_info->uf_info.tx_clock < QE_CLK_NONE) ||
> + (ug_info->uf_info.tx_clock > QE_CLK24)) {
> + printk(KERN_ERR
> + "ucc_geth: invalid tx-clock-name property\n");
> + return -EINVAL;
> + }
> + } else {
> + prop = of_get_property(np, "rx-clock", NULL);
> + if (!prop) {
> + printk(KERN_ERR
> + "ucc_geth: mising tx-clock-name property\n");
> + return -EINVAL;
> + }
> + if ((*prop < QE_CLK_NONE) || (*prop > QE_CLK24)) {
> + printk(KERN_ERR
> + "ucc_geth: invalid tx-clock property\n");
> + return -EINVAL;
> + }
> + ug_info->uf_info.tx_clock = *prop;
> + }
> +
> err = of_address_to_resource(np, 0, &res);
> if (err)
> return -EINVAL;
> --
> 1.5.2.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties
2007-12-14 5:07 ` Kumar Gala
@ 2007-12-14 6:45 ` Jeff Garzik
0 siblings, 0 replies; 8+ messages in thread
From: Jeff Garzik @ 2007-12-14 6:45 UTC (permalink / raw)
To: Kumar Gala; +Cc: netdev, Timur Tabi, linuxppc-dev list
Kumar Gala wrote:
>
> On Dec 3, 2007, at 3:17 PM, Timur Tabi wrote:
>
>> Updates the ucc_geth device driver to check the new rx-clock-name and
>> tx-clock-name properties first. If present, it uses the new function
>> qe_clock_source() to obtain the clock source. Otherwise, it checks the
>> deprecated rx-clock and tx-clock properties.
>>
>> Update the device trees for 832x, 836x, and 8568 to contain the new
>> property
>> names only.
>>
>> Signed-off-by: Timur Tabi <timur@freescale.com>
>> ---
>>
>> This patch applies to Kumar's for-2.6.25 branch. ucc_geth will
>> compile but not
>> run if my other patch, "qe: add function qe_clock_source" has not also
>> been
>> applied.
>
> Jeff, I'll take this patch via powerpc.git if you don't have any issue
> since its just touching probe/setup bits.
ACK
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties
2007-12-03 21:17 ` [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties Timur Tabi
2007-12-12 15:19 ` Timur Tabi
2007-12-14 5:07 ` Kumar Gala
@ 2007-12-14 7:19 ` Kumar Gala
2 siblings, 0 replies; 8+ messages in thread
From: Kumar Gala @ 2007-12-14 7:19 UTC (permalink / raw)
To: Timur Tabi; +Cc: netdev, linuxppc-dev
On Dec 3, 2007, at 3:17 PM, Timur Tabi wrote:
> Updates the ucc_geth device driver to check the new rx-clock-name and
> tx-clock-name properties first. If present, it uses the new function
> qe_clock_source() to obtain the clock source. Otherwise, it checks
> the
> deprecated rx-clock and tx-clock properties.
>
> Update the device trees for 832x, 836x, and 8568 to contain the new
> property
> names only.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>
> This patch applies to Kumar's for-2.6.25 branch. ucc_geth will
> compile but not
> run if my other patch, "qe: add function qe_clock_source" has not
> also been
> applied.
>
> arch/powerpc/boot/dts/mpc832x_mds.dts | 8 ++--
> arch/powerpc/boot/dts/mpc832x_rdb.dts | 8 ++--
> arch/powerpc/boot/dts/mpc836x_mds.dts | 8 ++--
> arch/powerpc/boot/dts/mpc8568mds.dts | 8 ++--
> drivers/net/ucc_geth.c | 55 ++++++++++++++++++++++++
> ++++++--
> 5 files changed, 67 insertions(+), 20 deletions(-)
applied.
- k
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-12-14 7:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-03 21:17 [PATCH 0/2] QE clock source improvements Timur Tabi
2007-12-03 21:17 ` [PATCH 1/2] qe: add function qe_clock_source() Timur Tabi
2007-12-03 21:17 ` [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties Timur Tabi
2007-12-12 15:19 ` Timur Tabi
2007-12-14 5:07 ` Kumar Gala
2007-12-14 6:45 ` Jeff Garzik
2007-12-14 7:19 ` Kumar Gala
2007-12-12 15:19 ` [PATCH 1/2] qe: add function qe_clock_source() Timur Tabi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).