Re: [PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
Acked-by: Scott Wood [EMAIL PROTECTED], if I haven't already. -Scott I thought, you did it. Thank you. -- Dipl.-Ing. Sergej Stepanov Software-Entwicklung IDS GmbH E-PA (Entwicklung - Prozess Automatisierung) Nobelstr. 18, D-76275 Ettlingen T. (0) 72 43/2 18-615 F. (0) 72 43/2 18-100 E. [EMAIL PROTECTED] http://www.ids.de Geschäftsführer: Norbert Wagner, Friedrich Abriß Sitz der Gesellschaft: Ettlingen Amtsgericht Mannheim HRB 362503 ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
On Monday 10 March 2008 08:50, Sergej Stepanov wrote: Acked-by: Scott Wood [EMAIL PROTECTED], if I haven't already. -Scott I thought, you did it. Thank you. Your documentation patch states that The first reg resource is the I/O port register block on which MDIO resides. The second reg resource is the I/O port register block on which MDC resides. If there is only one reg resource, it is used for both MDIO and MDC. If I'm not mistaken the code uses the first reg resource for MDC and the second reg resource for MDIO. Which one should be fixed, the doc or the code ? Best regards, -- Laurent Pinchart CSE Semaphore Belgium Chaussée de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 pgpYSU5l95b8u.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
Am Montag, den 10.03.2008, 12:05 +0100 schrieb Laurent Pinchart: Your documentation patch states that The first reg resource is the I/O port register block on which MDIO resides. The second reg resource is the I/O port register block on which MDC resides. If there is only one reg resource, it is used for both MDIO and MDC. If I'm not mistaken the code uses the first reg resource for MDC and the second reg resource for MDIO. Which one should be fixed, the doc or the code ? Best regards, Ooops... Sorry... You are right: the first is MDC, second MDIO. I have to fix the docu, it would be simpler. Thank you and best regards Sergej. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
Hi Sergej, On Friday 15 February 2008 16:38, Sergej Stepanov wrote: Am Freitag, den 15.02.2008, 13:50 +0100 schrieb Laurent Pinchart: We're loosing the possibility of having MDC and MDIO on different ports. This is quite easy to fix for the non-CONFIG_PPC_CPM_NEW_BINDING case but I'm not familiar with OF bindings (yet) to fix the CONFIG_PPC_CPM_NEW_BINDING case. for OF issue i had this for a paar month: http://www.spinics.net/lists/netdev/msg45778.html http://www.spinics.net/lists/netdev/msg47159.html i'll be glad if it helps... Could these be applied ? Any showstopper ? Best regards, -- Laurent Pinchart CSE Semaphore Belgium Chaussée de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 pgp5yA0gAdi94.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
On Fri, Mar 07, 2008 at 04:23:39PM +0100, Laurent Pinchart wrote: Hi Sergej, On Friday 15 February 2008 16:38, Sergej Stepanov wrote: Am Freitag, den 15.02.2008, 13:50 +0100 schrieb Laurent Pinchart: We're loosing the possibility of having MDC and MDIO on different ports. This is quite easy to fix for the non-CONFIG_PPC_CPM_NEW_BINDING case but I'm not familiar with OF bindings (yet) to fix the CONFIG_PPC_CPM_NEW_BINDING case. for OF issue i had this for a paar month: http://www.spinics.net/lists/netdev/msg45778.html http://www.spinics.net/lists/netdev/msg47159.html i'll be glad if it helps... Could these be applied ? Any showstopper ? Acked-by: Scott Wood [EMAIL PROTECTED], if I haven't already. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
Hi Scott, I apologize for bringing this after so much time. Hope the better late than never motto applies. On Friday 21 September 2007 00:01, Scott Wood wrote: The existing OF glue code was crufty and broken. Rather than fix it, it will be removed, and the ethernet driver now talks to the device tree directly. The old, non-CONFIG_PPC_CPM_NEW_BINDING code can go away once CPM platforms are dropped from arch/ppc (which will hopefully be soon), and existing arch/powerpc boards that I wasn't able to test on for this patchset get converted (which should be even sooner). Signed-off-by: Scott Wood [EMAIL PROTECTED] [snip] diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h index f8c7ee8..14ebba8 100644 --- a/drivers/net/fs_enet/fs_enet.h +++ b/drivers/net/fs_enet/fs_enet.h @@ -24,19 +24,6 @@ struct fec_info { #include asm/cpm2.h #endif -/* This is used to operate with pins. - Note that the actual port size may -be different; cpm(s) handle it OK */ -struct bb_info { - u8 mdio_dat_msk; - u8 mdio_dir_msk; - u8 *mdio_dir; - u8 *mdio_dat; - u8 mdc_msk; - u8 *mdc_dat; - int delay; -}; - [snip] diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c index 8f766a5..2b9c44c 100644 --- a/drivers/net/fs_enet/mii-bitbang.c +++ b/drivers/net/fs_enet/mii-bitbang.c [snip] +struct bb_info { + __be32 __iomem *dir; + __be32 __iomem *dat; + u32 mdio_msk; + u32 mdc_msk; + int delay; +}; We're loosing the possibility of having MDC and MDIO on different ports. This is quite easy to fix for the non-CONFIG_PPC_CPM_NEW_BINDING case but I'm not familiar with OF bindings (yet) to fix the CONFIG_PPC_CPM_NEW_BINDING case. -- Laurent Pinchart CSE Semaphore Belgium Chaussée de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 pgpjs8I2SJNNv.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
Am Freitag, den 15.02.2008, 13:50 +0100 schrieb Laurent Pinchart: We're loosing the possibility of having MDC and MDIO on different ports. This is quite easy to fix for the non-CONFIG_PPC_CPM_NEW_BINDING case but I'm not familiar with OF bindings (yet) to fix the CONFIG_PPC_CPM_NEW_BINDING case. for OF issue i had this for a paar month: http://www.spinics.net/lists/netdev/msg45778.html http://www.spinics.net/lists/netdev/msg47159.html i'll be glad if it helps... Regards Sergej. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
The existing OF glue code was crufty and broken. Rather than fix it, it will be removed, and the ethernet driver now talks to the device tree directly. The old, non-CONFIG_PPC_CPM_NEW_BINDING code can go away once CPM platforms are dropped from arch/ppc (which will hopefully be soon), and existing arch/powerpc boards that I wasn't able to test on for this patchset get converted (which should be even sooner). Signed-off-by: Scott Wood [EMAIL PROTECTED] --- Resent, with linux/of_platform.h instead of asm/of_platform.h drivers/net/fs_enet/Kconfig|1 + drivers/net/fs_enet/fs_enet-main.c | 259 --- drivers/net/fs_enet/fs_enet.h | 55 +--- drivers/net/fs_enet/mac-fcc.c | 89 + drivers/net/fs_enet/mac-fec.c | 19 +++- drivers/net/fs_enet/mac-scc.c | 53 +-- drivers/net/fs_enet/mii-bitbang.c | 269 +++- drivers/net/fs_enet/mii-fec.c | 143 +++- include/linux/fs_enet_pd.h |5 + 9 files changed, 714 insertions(+), 179 deletions(-) diff --git a/drivers/net/fs_enet/Kconfig b/drivers/net/fs_enet/Kconfig index e27ee21..2765e49 100644 --- a/drivers/net/fs_enet/Kconfig +++ b/drivers/net/fs_enet/Kconfig @@ -11,6 +11,7 @@ config FS_ENET_HAS_SCC config FS_ENET_HAS_FCC bool Chip has an FCC usable for ethernet depends on FS_ENET CPM2 + select MDIO_BITBANG default y config FS_ENET_HAS_FEC diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index a4b76cd..c5abdea 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -44,12 +44,18 @@ #include asm/irq.h #include asm/uaccess.h +#ifdef CONFIG_PPC_CPM_NEW_BINDING +#include linux/of_platform.h +#endif + #include fs_enet.h /*/ +#ifndef CONFIG_PPC_CPM_NEW_BINDING static char version[] __devinitdata = DRV_MODULE_NAME .c:v DRV_MODULE_VERSION ( DRV_MODULE_RELDATE ) \n; +#endif MODULE_AUTHOR(Pantelis Antoniou [EMAIL PROTECTED]); MODULE_DESCRIPTION(Freescale Ethernet Driver); @@ -953,6 +959,7 @@ static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) extern int fs_mii_connect(struct net_device *dev); extern void fs_mii_disconnect(struct net_device *dev); +#ifndef CONFIG_PPC_CPM_NEW_BINDING static struct net_device *fs_init_instance(struct device *dev, struct fs_platform_info *fpi) { @@ -1132,6 +1139,7 @@ static int fs_cleanup_instance(struct net_device *ndev) return 0; } +#endif /**/ @@ -1140,35 +1148,250 @@ void *fs_enet_immap = NULL; static int setup_immap(void) { - phys_addr_t paddr = 0; - unsigned long size = 0; - #ifdef CONFIG_CPM1 - paddr = IMAP_ADDR; - size = 0x1; /* map 64K */ -#endif - -#ifdef CONFIG_CPM2 - paddr = CPM_MAP_ADDR; - size = 0x4; /* map 256 K */ + fs_enet_immap = ioremap(IMAP_ADDR, 0x4000); + WARN_ON(!fs_enet_immap); +#elif defined(CONFIG_CPM2) + fs_enet_immap = cpm2_immr; #endif - fs_enet_immap = ioremap(paddr, size); - if (fs_enet_immap == NULL) - return -EBADF; /* XXX ahem; maybe just BUG_ON? */ return 0; } static void cleanup_immap(void) { - if (fs_enet_immap != NULL) { - iounmap(fs_enet_immap); - fs_enet_immap = NULL; - } +#if defined(CONFIG_CPM1) + iounmap(fs_enet_immap); +#endif } /**/ +#ifdef CONFIG_PPC_CPM_NEW_BINDING +static int __devinit find_phy(struct device_node *np, + struct fs_platform_info *fpi) +{ + struct device_node *phynode, *mdionode; + struct resource res; + int ret = 0, len; + + const u32 *data = of_get_property(np, phy-handle, len); + if (!data || len != 4) + return -EINVAL; + + phynode = of_find_node_by_phandle(*data); + if (!phynode) + return -EINVAL; + + mdionode = of_get_parent(phynode); + if (!phynode) + goto out_put_phy; + + ret = of_address_to_resource(mdionode, 0, res); + if (ret) + goto out_put_mdio; + + data = of_get_property(phynode, reg, len); + if (!data || len != 4) + goto out_put_mdio; + + snprintf(fpi-bus_id, 16, PHY_ID_FMT, res.start, *data); + +out_put_mdio: + of_node_put(mdionode); +out_put_phy: + of_node_put(phynode); + return ret; +} + +#ifdef CONFIG_FS_ENET_HAS_FEC +#define IS_FEC(match) ((match)-data == fs_fec_ops) +#else +#define IS_FEC(match) 0 +#endif + +static int __devinit fs_enet_probe(struct of_device *ofdev, + const struct of_device_id *match) +{ + struct
[PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
The existing OF glue code was crufty and broken. Rather than fix it, it will be removed, and the ethernet driver now talks to the device tree directly. The old, non-CONFIG_PPC_CPM_NEW_BINDING code can go away once CPM platforms are dropped from arch/ppc (which will hopefully be soon), and existing arch/powerpc boards that I wasn't able to test on for this patchset get converted (which should be even sooner). Signed-off-by: Scott Wood [EMAIL PROTECTED] --- drivers/net/fs_enet/Kconfig|1 + drivers/net/fs_enet/fs_enet-main.c | 259 --- drivers/net/fs_enet/fs_enet.h | 55 +--- drivers/net/fs_enet/mac-fcc.c | 89 + drivers/net/fs_enet/mac-fec.c | 19 +++- drivers/net/fs_enet/mac-scc.c | 53 +-- drivers/net/fs_enet/mii-bitbang.c | 269 +++- drivers/net/fs_enet/mii-fec.c | 143 +++- include/linux/fs_enet_pd.h |5 + 9 files changed, 714 insertions(+), 179 deletions(-) diff --git a/drivers/net/fs_enet/Kconfig b/drivers/net/fs_enet/Kconfig index e27ee21..2765e49 100644 --- a/drivers/net/fs_enet/Kconfig +++ b/drivers/net/fs_enet/Kconfig @@ -11,6 +11,7 @@ config FS_ENET_HAS_SCC config FS_ENET_HAS_FCC bool Chip has an FCC usable for ethernet depends on FS_ENET CPM2 + select MDIO_BITBANG default y config FS_ENET_HAS_FEC diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index a4b76cd..281b7d7 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -44,12 +44,18 @@ #include asm/irq.h #include asm/uaccess.h +#ifdef CONFIG_PPC_CPM_NEW_BINDING +#include asm/of_platform.h +#endif + #include fs_enet.h /*/ +#ifndef CONFIG_PPC_CPM_NEW_BINDING static char version[] __devinitdata = DRV_MODULE_NAME .c:v DRV_MODULE_VERSION ( DRV_MODULE_RELDATE ) \n; +#endif MODULE_AUTHOR(Pantelis Antoniou [EMAIL PROTECTED]); MODULE_DESCRIPTION(Freescale Ethernet Driver); @@ -953,6 +959,7 @@ static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) extern int fs_mii_connect(struct net_device *dev); extern void fs_mii_disconnect(struct net_device *dev); +#ifndef CONFIG_PPC_CPM_NEW_BINDING static struct net_device *fs_init_instance(struct device *dev, struct fs_platform_info *fpi) { @@ -1132,6 +1139,7 @@ static int fs_cleanup_instance(struct net_device *ndev) return 0; } +#endif /**/ @@ -1140,35 +1148,250 @@ void *fs_enet_immap = NULL; static int setup_immap(void) { - phys_addr_t paddr = 0; - unsigned long size = 0; - #ifdef CONFIG_CPM1 - paddr = IMAP_ADDR; - size = 0x1; /* map 64K */ -#endif - -#ifdef CONFIG_CPM2 - paddr = CPM_MAP_ADDR; - size = 0x4; /* map 256 K */ + fs_enet_immap = ioremap(IMAP_ADDR, 0x4000); + WARN_ON(!fs_enet_immap); +#elif defined(CONFIG_CPM2) + fs_enet_immap = cpm2_immr; #endif - fs_enet_immap = ioremap(paddr, size); - if (fs_enet_immap == NULL) - return -EBADF; /* XXX ahem; maybe just BUG_ON? */ return 0; } static void cleanup_immap(void) { - if (fs_enet_immap != NULL) { - iounmap(fs_enet_immap); - fs_enet_immap = NULL; - } +#if defined(CONFIG_CPM1) + iounmap(fs_enet_immap); +#endif } /**/ +#ifdef CONFIG_PPC_CPM_NEW_BINDING +static int __devinit find_phy(struct device_node *np, + struct fs_platform_info *fpi) +{ + struct device_node *phynode, *mdionode; + struct resource res; + int ret = 0, len; + + const u32 *data = of_get_property(np, phy-handle, len); + if (!data || len != 4) + return -EINVAL; + + phynode = of_find_node_by_phandle(*data); + if (!phynode) + return -EINVAL; + + mdionode = of_get_parent(phynode); + if (!phynode) + goto out_put_phy; + + ret = of_address_to_resource(mdionode, 0, res); + if (ret) + goto out_put_mdio; + + data = of_get_property(phynode, reg, len); + if (!data || len != 4) + goto out_put_mdio; + + snprintf(fpi-bus_id, 16, PHY_ID_FMT, res.start, *data); + +out_put_mdio: + of_node_put(mdionode); +out_put_phy: + of_node_put(phynode); + return ret; +} + +#ifdef CONFIG_FS_ENET_HAS_FEC +#define IS_FEC(match) ((match)-data == fs_fec_ops) +#else +#define IS_FEC(match) 0 +#endif + +static int __devinit fs_enet_probe(struct of_device *ofdev, + const struct of_device_id *match) +{ + struct net_device *ndev; + struct fs_enet_private *fep; + struct
Re: [PATCH 6/9] fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
On Thu, 20 Sep 2007 17:01:21 -0500 Scott Wood [EMAIL PROTECTED] wrote: +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -44,12 +44,18 @@ #include asm/irq.h #include asm/uaccess.h +#ifdef CONFIG_PPC_CPM_NEW_BINDING +#include asm/of_platform.h Hmm, didn't I already ask you to change this to linux/of_platform.h? +++ b/drivers/net/fs_enet/mac-fcc.c @@ -42,6 +42,10 @@ #include asm/irq.h #include asm/uaccess.h +#ifdef CONFIG_PPC_CPM_NEW_BINDING +#include asm/of_device.h And this to linux/of_device.h +++ b/drivers/net/fs_enet/mac-fec.c @@ -43,6 +43,10 @@ #include asm/commproc.h #endif +#ifdef CONFIG_PPC_CPM_NEW_BINDING +#include asm/of_device.h And this? +++ b/drivers/net/fs_enet/mac-scc.c @@ -43,6 +43,10 @@ #include asm/commproc.h #endif +#ifdef CONFIG_PPC_CPM_NEW_BINDING +#include asm/of_platform.h And this +++ b/drivers/net/fs_enet/mii-fec.c @@ -36,6 +36,10 @@ #include asm/irq.h #include asm/uaccess.h +#ifdef CONFIG_PPC_CPM_NEW_BINDING +#include asm/of_platform.h And here Sorry if I missed these last time around. -- Cheers, Stephen Rothwell[EMAIL PROTECTED] http://www.canb.auug.org.au/~sfr/ pgp8lVw6y3WVU.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev