FCC Ethernet PlatformDevice support for 82xx
RFC PATCH 1/3 FCC Ethernet PlatformDevice support for 82xx
This patch adds generic PlatformDevice support to the 82xx family.
Only FCC's exist currently in the structure, as there is the driver which will utilize this.
Signature · 1 line
Sincerely, Vitaly
arch/ppc/syslib/Makefile +3 -1
@@ -83,7 +83,9 @@ obj-$(CONFIG_8260) += m8260_setup.o obj-$(CONFIG_PCI_8260) += m8260_pci.o indirect_pci.o obj-$(CONFIG_8260_PCI9) += m8260_pci_erratum9.o -obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o +obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o mpc82xx_devices.o \ + mpc82xx_sys.o ppc_sys.o + ifeq ($(CONFIG_PPC_GEN550),y) obj-$(CONFIG_KGDB) += gen550_kgdb.o gen550_dbg.o obj-$(CONFIG_SERIAL_TEXT_DEBUG) += gen550_dbg.o
arch/ppc/syslib/m8260_setup.c +23 -0
@@ -19,6 +19,7 @@#include <linux/root_dev.h> #include <linux/seq_file.h> #include <linux/irq.h> +#include <linux/fsl_devices.h> #include <asm/mmu.h> #include <asm/io.h>
@@ -28,6 +29,7 @@#include <asm/machdep.h> #include <asm/bootinfo.h> #include <asm/time.h> +#include <asm/ppc_sys.h> #include "cpm2_pic.h"
@@ -46,6 +48,11 @@static void __init m8260_setup_arch (void ) { +bd_t *bi = (void *)__res; +#ifdef CONFIG_CPM2 +struct cpm2_fec_platform_data *fec; +#endif +/* Print out Vendor and Machine info. */ printk (KERN_INFO "%s %s port\n" ,CPUINFO_VENDOR ,CPUINFO_MACHINE );
@@ -63,6 +70,22 @@ROOT_DEV = Root_RAM0;#endif m82xx_board_setup (); +#ifdef CONFIG_CPM2 +identify_ppc_sys_by_id (cpm2_immr->im_memctl.memc_immr <<16 ); + +/* Set up the MAC addresses for the FECs +*/ + fec = ppc_sys_platform_devices[MPC82xx_FCC1].dev.platform_data; +memcpy (fec->mac_addr,bi->bi_enetaddr,6 ); + + fec = ppc_sys_platform_devices[MPC82xx_FCC2].dev.platform_data; +#ifdef CONFIG_ADS8272 +memcpy (fec->mac_addr,bi->bi_enet1addr,6 ); +#else +memcpy (fec->mac_addr,bi->bi_enetaddr,6 ); + fec->macaddr[5 ] ^=1 ; +#endif +#endif }/* The decrementer counts at the system (internal) clock frequency
arch/ppc/syslib/mpc82xx_devices.c new file +213 -0
213 lines not on this page · raw message
arch/ppc/syslib/mpc82xx_sys.c new file +42 -0
42 lines not on this page · raw message
include/asm-ppc/mpc8260.h +5 -0
@@ -74,6 +74,11 @@extern unsigned char __res[];#endif +enum ppc_sys_devices { + MPC82xx_FCC1, + MPC82xx_FCC2, +}; +#endif /* CONFIG_8260 */ #endif /* !__ASM_PPC_MPC8260_H__ */ #endif /* __KERNEL__ */
include/asm-ppc/ppc_sys.h +2 -0
@@ -27,6 +27,8 @@#include <asm/mpc85xx.h> #elif defined(CONFIG_PPC_MPC52xx)#include <asm/mpc52xx.h> +#elif defined(CONFIG_ADS8272 ) +#include <asm/mpc8260.h> #else #error "need definition of ppc_sys_devices"#endif
include/asm-ppc/ppcboot.h +1 -1
@@ -74,7 +74,7 @@hymod_conf_t bi_hymod_conf;/* hymod configuration information */ #endif #if defined(CONFIG_EVB64260 ) || defined(CONFIG_44x) || defined(CONFIG_85xx) ||\ - defined(CONFIG_83xx) + defined(CONFIG_83xx) || defined(CONFIG_ADS8272 )/* second onboard ethernet port */ unsigned char bi_enet1addr[6 ];#endif
include/linux/fsl_devices.h +26 -0
@@ -65,6 +65,32 @@/* Flags in gianfar_platform_data */ #define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001/* if not set use a timer */ +struct cpm2_fec_platform_data { +/* device specific information */ +u32 cp_page; +u32 cp_block; + +u32 clk_trx; +u32 clk_route; +u32 clk_mask; + +u32 mdio; +u32 mdck; + + +u32 device_flags; + +/* board specific information */ +u32 board_flags; +u32 phyid; +u32 interruptPHY; +u8 mac_addr[6 ]; +}; + +/* Flags in cpm_platform_data */ + +#define FSL_CPM2_FEC_BRD_HAS_PHY_INTR 0x00000001/* if not set use a timer */ +struct fsl_i2c_platform_data {/* device specific information */ u32 device_flags;
Quoted 4 lines · Vitaly Bordug
This patch adds generic PlatformDevice support to the 82xx family. Only FCC's exist currently in the structure, as there is the driver which will utilize this.
[snip]
Quoted 6 lines
arch/ppc/syslib/m8260_setup.c +6
-0+#ifdef CONFIG_CPM2 +identify_ppc_sys_by_id (cpm2_immr->im_memctl.memc_immr <<16 ); + +/* Set up the MAC addresses for the FECs +*/ + fec = ppc_sys_platform_devices[MPC82xx_FCC1].dev.platform_data;
arch/ppc/syslib/m8260_setup.c line 88
Quoted 10 lines
arch/ppc/syslib/m8260_setup.c +10
-0+memcpy (fec->mac_addr,bi->bi_enetaddr,6 ); + + fec = ppc_sys_platform_devices[MPC82xx_FCC2].dev.platform_data; +#ifdef CONFIG_ADS8272 +memcpy (fec->mac_addr,bi->bi_enet1addr,6 ); +#else +memcpy (fec->mac_addr,bi->bi_enetaddr,6 ); + fec->macaddr[5 ] ^=1 ; +#endif +#endif
What is this? Why does common file contain board specific ifdefs????
[snip]
arch/ppc/syslib/mpc82xx_devices.c line 38
Quoted 9 lines
arch/ppc/syslib/mpc82xx_devices.c new file +9
-0+/* FCC1 Clock Source Configuration. There are board specific. +Can only choose from CLK9-12 */ +#if defined(CONFIG_ADS8272 ) +#define F1_RXCLK 11 +#define F1_TXCLK 10 +#else +#define F1_RXCLK 12 +#define F1_TXCLK 11 +#endif
Same thing. Why on earth you continue current 8xxx trend of putting board specific crap into common files?
arch/ppc/syslib/mpc82xx_devices.c line 48
Quoted 10 lines
arch/ppc/syslib/mpc82xx_devices.c new file +10
-0+ +/* FCC2 Clock Source Configuration. There are board specific. +Can only choose from CLK13-16 */ +#ifdef CONFIG_ADS8272 +#define F2_RXCLK 15 +#define F2_TXCLK 16 +#else +#define F2_RXCLK 13 +#define F2_TXCLK 14 +#endif
Ditto.
arch/ppc/syslib/mpc82xx_devices.c line 86
Quoted 7 lines
arch/ppc/syslib/mpc82xx_devices.c new file +7
-0+#ifdef CONFIG_ADS8272 +#define PC_MDIO 0x00002000U +#define PC_MDCK 0x00001000U +#else +#define PC_MDIO 0x00000004U +#define PC_MDCK 0x00000020U +#endif
Ditto.
arch/ppc/syslib/mpc82xx_devices.c line 150
Quoted 5 lines
arch/ppc/syslib/mpc82xx_devices.c new file +5
-0+ .name = "phyinterrupt", + .start = SIU_INT_IRQ5, + .end = SIU_INT_IRQ5, + .flags = IORESOURCE_IRQ, + },
Why is this here? PHY interrupt routing is _board_ specific.
Signature · 1 line
Eugene
Quoted 85 lines · Eugene Surovegin
Quoted 5 lines · Vitaly Bordug
This patch adds generic PlatformDevice support to the 82xx family.
Only FCC's exist currently in the structure, as there is the driver which will utilize this.[snip]
Quoted 8 lines
arch/ppc/syslib/m8260_setup.c +6
-0+#ifdef CONFIG_CPM2 +identify_ppc_sys_by_id (cpm2_immr->im_memctl.memc_immr <<16 ); + +/* Set up the MAC addresses for the FECs +*/ + fec = ppc_sys_platform_devices[MPC82xx_FCC1].dev.platform_data;arch/ppc/syslib/m8260_setup.c line 88
Quoted 10 lines
arch/ppc/syslib/m8260_setup.c +10
-0+memcpy (fec->mac_addr,bi->bi_enetaddr,6 ); + + fec = ppc_sys_platform_devices[MPC82xx_FCC2].dev.platform_data; +#ifdef CONFIG_ADS8272 +memcpy (fec->mac_addr,bi->bi_enet1addr,6 ); +#else +memcpy (fec->mac_addr,bi->bi_enetaddr,6 ); + fec->macaddr[5 ] ^=1 ; +#endif +#endif What is this? Why does common file contain board specific ifdefs????
[snip]
arch/ppc/syslib/mpc82xx_devices.c line 38
Quoted 11 lines
arch/ppc/syslib/mpc82xx_devices.c new file +9
-0+/* FCC1 Clock Source Configuration. There are board specific. +Can only choose from CLK9-12 */ +#if defined(CONFIG_ADS8272 ) +#define F1_RXCLK 11 +#define F1_TXCLK 10 +#else +#define F1_RXCLK 12 +#define F1_TXCLK 11 +#endif Same thing. Why on earth you continue current 8xxx trend of putting board specific crap into common files?
arch/ppc/syslib/mpc82xx_devices.c line 48
Quoted 12 lines
arch/ppc/syslib/mpc82xx_devices.c new file +10
-0+ +/* FCC2 Clock Source Configuration. There are board specific. +Can only choose from CLK13-16 */ +#ifdef CONFIG_ADS8272 +#define F2_RXCLK 15 +#define F2_TXCLK 16 +#else +#define F2_RXCLK 13 +#define F2_TXCLK 14 +#endif Ditto.
arch/ppc/syslib/mpc82xx_devices.c line 86
Quoted 9 lines
arch/ppc/syslib/mpc82xx_devices.c new file +7
-0+#ifdef CONFIG_ADS8272 +#define PC_MDIO 0x00002000U +#define PC_MDCK 0x00001000U +#else +#define PC_MDIO 0x00000004U +#define PC_MDCK 0x00000020U +#endif Ditto.
Quoted 12 lines
arch/ppc/syslib/mpc82xx_devices.c line 150
Quoted 7 lines
arch/ppc/syslib/mpc82xx_devices.c new file +5
-0+ .name = "phyinterrupt", + .start = SIU_INT_IRQ5, + .end = SIU_INT_IRQ5, + .flags = IORESOURCE_IRQ, + },Why is this here? PHY interrupt routing is _board_ specific.
I have fixed these yet, but I think it will be more reasonable to update this together with respective driver which I'll work on together with Pantelis. Thank you for review.
Signature · 1 line
Sincerely, Vitaly
Can you send just an updated patch for just the base platform additions. What I'm looking for is just changes/additions of the following files:
arch/ppc/syslib/mpc82xx_device.carch/ppc/syslib/mpc82xx_sys.cinclude/asm-ppc/mpc8260.hinclude/asm-ppc/ppc_sys.h
thanks
- kumar
Quoted 91 lines · Vitaly Bordug
Eugene Surovegin wrote:
On Wed, May 04, 2005 at 06:35:16PM +0400, Vitaly Bordug wrote:This patch adds generic PlatformDevice support to the 82xx family. Only FCC's exist currently in the structure, as there is the driver which will utilize this.
[snip]
arch/ppc/syslib/m8260_setup.c +16
-0+#ifdef CONFIG_CPM2 +identify_ppc_sys_by_id (cpm2_immr->im_memctl.memc_immr <<16 ); + +/* Set up the MAC addresses for the FECs +*/ + fec = ppc_sys_platform_devices[MPC82xx_FCC1].dev.platform_data; +memcpy (fec->mac_addr,bi->bi_enetaddr,6 ); + + fec = ppc_sys_platform_devices[MPC82xx_FCC2].dev.platform_data; +#ifdef CONFIG_ADS8272 +memcpy (fec->mac_addr,bi->bi_enet1addr,6 ); +#else +memcpy (fec->mac_addr,bi->bi_enetaddr,6 ); + fec->macaddr[5 ] ^=1 ; +#endif +#endif What is this? Why does common file contain board specific ifdefs????
[snip]
arch/ppc/syslib/mpc82xx_devices.c new file +9
-0+/* FCC1 Clock Source Configuration. There are board specific. +Can only choose from CLK9-12 */ +#if defined(CONFIG_ADS8272 ) +#define F1_RXCLK 11 +#define F1_TXCLK 10 +#else +#define F1_RXCLK 12 +#define F1_TXCLK 11 +#endif Same thing. Why on earth you continue current 8xxx trend of putting board specific crap into common files?
arch/ppc/syslib/mpc82xx_devices.c new file +10
-0+ +/* FCC2 Clock Source Configuration. There are board specific. +Can only choose from CLK13-16 */ +#ifdef CONFIG_ADS8272 +#define F2_RXCLK 15 +#define F2_TXCLK 16 +#else +#define F2_RXCLK 13 +#define F2_TXCLK 14 +#endif Ditto.
arch/ppc/syslib/mpc82xx_devices.c new file +7
-0+#ifdef CONFIG_ADS8272 +#define PC_MDIO 0x00002000U +#define PC_MDCK 0x00001000U +#else +#define PC_MDIO 0x00000004U +#define PC_MDCK 0x00000020U +#endif Ditto.
arch/ppc/syslib/mpc82xx_devices.c new file +5
-0+ .name = "phyinterrupt", + .start = SIU_INT_IRQ5, + .end = SIU_INT_IRQ5, + .flags = IORESOURCE_IRQ, + },Why is this here? PHY interrupt routing is _board_ specific.
I have fixed these yet, but I think it will be more reasonable to
update this together with respective driver which I'll work on together with Pantelis.
Thank you for review.Signature · 4 lines
Sincerely, Vitaly <ATT400050.txt>