Added support for PRTLVT based boards (MPC5121)
PATCH 1/2 Added support for PRTLVT based boards (MPC5121)
Made MPC5121_ADS board support generic
--- arch/powerpc/boot/dts/prtlvt.dts | 267 +++++++++++++++++++++++++ arch/powerpc/platforms/512x/Kconfig | 15 ++ arch/powerpc/platforms/512x/Makefile | 2 +- arch/powerpc/platforms/512x/mpc5121_ads.c | 104 ---------- arch/powerpc/platforms/512x/mpc5121_generic.c | 105 ++++++++++ 5 files changed, 388 insertions(+), 105 deletions(-) create mode 100644 arch/powerpc/boot/dts/prtlvt.dts delete mode 100644 arch/powerpc/platforms/512x/mpc5121_ads.c create mode 100644 arch/powerpc/platforms/512x/mpc5121_generic.c
arch/powerpc/boot/dts/prtlvt.dts new file +267 -0
@@ -0,0 +1,267 @@ +/* + * Device tree source for PRTLVT based boards, base on: + * MPC5121E MDS Device Tree Source + * + * Copyright 2007 Freescale Semiconductor Inc. + * Copyright 2008 Protonic Holland + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + + /* compile with: ./dtc -p 10240 -R 20 -I dts -o prtlvt.dtb -O dtb -b 0 dts/prtlvt.dts */ + +/dts-v1/; + +/ { + model = "prtlvt"; + compatible = "prt,prtlvt"; + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + PowerPC,5121@0 { + device_type = "cpu"; + reg = <0>; + d-cache-line-size = <0x20>; // 32 bytes + i-cache-line-size = <0x20>; // 32 bytes + d-cache-size = <0x8000>; // L1, 32K + i-cache-size = <0x8000>; // L1, 32K + timebase-frequency = <50000000>;// 50 MHz (csb/4) + bus-frequency = <200000000>; // 200 MHz csb bus + clock-frequency = <400000000>; // 400 MHz ppc core + }; + }; + + memory { + device_type = "memory"; + reg = <0x00000000 0x10000000>; // 256MB at 0 + }; + + flash@fe000000 { + device_type = "rom"; + compatible = "direct-mapped"; + probe-type = "CFI"; + reg = <0xfe000000 0x02000000>; + bank-width = <2>; + partitions = <0x00000000 0x01800000 // filesystem + 0x01800000 0x00200000 // config0 + 0x01a00000 0x00200000 // config1 + 0x01c00000 0x002e0000 // kernel + 0x01ee0000 0x00020000 // one sector for device tree + 0x01f00000 0x00100000>; // u-boot + partition-names = "filesystem", "config0", "config1","kernel", "device-tree", "u-boot"; + }; + + soc@80000000 { + compatible = "fsl,mpc5121-immr"; + #address-cells = <1>; + #size-cells = <1>; + #interrupt-cells = <2>; + ranges = <0x0 0x80000000 0x400000>; + reg = <0x80000000 0x400000>; + bus-frequency = <66000000>; // 66 MHz ips bus + + + // IPIC + // interrupts cell = <intr #, sense> + // sense values match linux IORESOURCE_IRQ_* defines: + // sense == 8: Level, low assertion + // sense == 2: Edge, high-to-low change + // + ipic: interrupt-controller@c00 { + compatible = "fsl,mpc5121-ipic", "fsl,ipic"; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + reg = <0xc00 0x100>; + }; + + // 512x PSCs are not 52xx PSCs compatible + // PSC0 serial port aka ttyPSC0 + serial@11000 { + device_type = "serial"; + compatible = "fsl,mpc5121-psc-uart"; + port-number = <0>; + cell-index = <0>; + reg = <0x11000 0x100>; + interrupts = <0x28 0x8>; // actually the fifo irq + interrupt-parent = < &ipic >; + }; + + // PSC1 serial port aka ttyPSC1 + serial@11100 { + device_type = "serial"; + compatible = "fsl,mpc5121-psc-uart"; + port-number = <1>; + cell-index = <1>; + reg = <0x11100 0x100>; + interrupts = <0x28 0x8>; // actually the fifo irq + interrupt-parent = < &ipic >; + }; + + // PSC2 serial port aka ttyPSC2 + serial@11200 { + device_type = "serial"; + compatible = "fsl,mpc5121-psc-uart"; + port-number = <2>; + cell-index = <2>; + reg = <0x11200 0x100>; + interrupts = <0x28 0x8>; // actually the fifo irq + interrupt-parent = < &ipic >; + }; + + // PSC3 serial port aka ttyPSC3 + serial@11300 { + device_type = "serial"; + compatible = "fsl,mpc5121-psc-uart"; + port-number = <3>; + cell-index = <3>; + reg = <0x11300 0x100>; + interrupts = <0x28 0x8>; // actually the fifo irq + interrupt-parent = < &ipic >; + }; + + pscsfifo@11f00 { + compatible = "fsl,mpc5121-psc-fifo"; + reg = <0x11f00 0x100>; + interrupts = <0x28 0x8>; + interrupt-parent = < &ipic >; + }; + + i2c@1700 { + compatible = "fsl,mpc5121-i2c", "fsl-i2c"; + reg = <0x1700 0x20>; + interrupts = <0x9 0x8>; + interrupt-parent = < &ipic >; + fsl5200-clocking; + }; + + i2c@1720 { + compatible = "fsl,mpc5121-i2c", "fsl-i2c"; + reg = <0x1720 0x20>; + interrupts = <0xa 0x8>; + interrupt-parent = < &ipic >; + fsl5200-clocking; + }; + + i2c@1740 { + compatible = "fsl,mpc5121-i2c", "fsl-i2c"; + reg = <0x1740 0x20>; + interrupts = <0xb 0x8>; + interrupt-parent = < &ipic >; + fsl5200-clocking; + }; + + i2ccontrol@1760 { + compatible = "fsl,mpc5121-i2c-ctrl"; + reg = <0x1760 0x8>; + }; + + //axe@2000 { + // compatible = "mpc512x-axe"; + // reg = <2000 100>; + // interrupts = <2a 8>; + // interrupt-parent = < &ipic >; + //}; + + diu@2100 { + compatible = "fsl,mpc5121-diu", "fsl-diu"; + reg = <0x2100 0x100>; + interrupts = <0x40 0x8>; + interrupt-parent = < &ipic >; + clk-name = "diu_clk"; + clk-parent = "ips_clk"; + clk-ctrl = <0x1 0x1f>; // sccr2 bit 31 + }; + + mdio@2800 { + device_type = "mdio"; + compatible = "fsl,mpc5121-fec-mdio"; + reg = <0x2800 0x800>; + #address-cells = <1>; + #size-cells = <0>; + phy: ethernet-phy@0 { + reg = <1>; + device_type = "ethernet-phy"; + }; + }; + + ethernet@2800 { + device_type = "network"; + compatible = "fsl,mpc5121-fec"; + reg = <0x2800 0x800>; + local-mac-address = [ 00 00 00 00 00 00 ]; + interrupts = <0x4 0x8 >; + interrupt-parent = < &ipic >; + phy-handle = < &phy >; + }; + + // port1 using extern ULPI PHY + usb@3000 { + device_type = "usb"; + compatible = "fsl,fsl-usb2-dr"; + reg = <0x3000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + interrupt-parent = < &ipic >; + interrupts = <0x2c 0x8>; + dr_mode = "otg"; + phy_type = "ulpi"; + port1; + }; + + // port0 using internal UTMI PHY + usb@4000 { + device_type = "usb"; + compatible = "fsl,fsl-usb2-dr"; + reg = <0x4000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + interrupt-parent = < &ipic >; + interrupts = <0x2b 0x8>; + dr_mode = "otg"; + phy_type = "utmi"; + port0; + }; + + // PSC4 in i2s mode + i2s@11500 { + device_type = "i2s"; + compatible = "fsl,mpc5121-psc-i2s"; + cell-index = <4>; + reg = <0x11400 0x100>; + interrupts = <0x20 8>; + interrupt-parent = < &ipic >; + }; + + // PSC5 in SPI mode for touchscreen + spi@11500 { + device_type = "spi"; + compatible = "fsl,mpc5121-psc-spi"; + cell-index = <5>; + reg = <0x11500 0x100>; + interrupts = <0x21 8>; + interrupt-parent = < &ipic >; + }; + + dma2@14000 { + compatible = "fsl,mpc5121-dma2"; + reg = <0x14000 0x1800>; + interrupts = <0x41 0x8>; + interrupt-parent = < &ipic >; + }; + + sata@20000 { + compatible = "fsl,mpc5121-sata"; + reg = <0x20000 0x2000>; + interrupts = <0x2d 0x8 0x56 0x8>; + interrupt-parent = < &ipic >; + }; + }; +};
arch/powerpc/platforms/512x/Kconfig +15 -0
@@ -9,11 +9,26 @@ config PPC_MPC5121 select PPC_MPC512x default n +config MPC5121_GENERIC + bool + default n + config MPC5121_ADS bool "Freescale MPC5121E ADS" depends on PPC_MULTIPLATFORM && PPC32 select DEFAULT_UIMAGE select PPC_MPC5121 + select MPC5121_GENERIC help This option enables support for the MPC5121E ADS board. default n + +config PRTLVT + bool "Protonic LVT family of MPC5121 based boards" + depends on PPC_MULTIPLATFORM && PPC32 + select DEFAULT_UIMAGE + select PPC_MPC5121 + select MPC5121_GENERIC + help + This option enables support for the Protonic LVT family (ZANMCU and VICVT2). + default n
arch/powerpc/platforms/512x/Makefile +1 -1
@@ -1,4 +1,4 @@ # # Makefile for the Freescale PowerPC 512x linux kernel. # -obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o +obj-$(CONFIG_MPC5121_GENERIC) += mpc5121_generic.o
arch/powerpc/platforms/512x/mpc5121_ads.c deleted +0 -104
104 lines not on this page · raw message
arch/powerpc/platforms/512x/mpc5121_generic.c new file +105 -0
105 lines not on this page · raw message
Signature · 1 line
1.5.4.3
PATCH 2/2 Re-added support for FEC on MPC5121 from Freescale LTIB
to current head
--- drivers/net/fs_enet/Kconfig | 16 ++++- drivers/net/fs_enet/fec_mpc5121.h | 120 ++++++++++++++++++++++++++++++++++++ drivers/net/fs_enet/fs_enet-main.c | 90 +++++++++++++++++++++++---- drivers/net/fs_enet/fs_enet.h | 14 +++- drivers/net/fs_enet/mac-fec.c | 22 ++++++- drivers/net/fs_enet/mii-fec.c | 10 +++- 6 files changed, 249 insertions(+), 23 deletions(-) create mode 100644 drivers/net/fs_enet/fec_mpc5121.h
drivers/net/fs_enet/Kconfig +13 -3
@@ -1,9 +1,17 @@ config FS_ENET tristate "Freescale Ethernet Driver" - depends on CPM1 || CPM2 + depends on CPM1 || CPM2 || FS_ENET_MPC5121_FEC select MII select PHYLIB +config FS_ENET_MPC5121_FEC + bool "Freescale MPC512x FEC driver" + depends on PPC_MPC512x + select FS_ENET + select FS_ENET_HAS_FEC + select PPC_CPM_NEW_BINDING + default n + config FS_ENET_HAS_SCC bool "Chip has an SCC usable for ethernet" depends on FS_ENET && (CPM1 || CPM2)
@@ -16,13 +24,15 @@ config FS_ENET_HAS_FCC config FS_ENET_HAS_FEC bool "Chip has an FEC usable for ethernet" - depends on FS_ENET && CPM1 + depends on FS_ENET && (CPM1 || FS_ENET_MPC5121_FEC) select FS_ENET_MDIO_FEC default y + config FS_ENET_MDIO_FEC tristate "MDIO driver for FEC" - depends on FS_ENET && CPM1 + depends on FS_ENET && (CPM1 || FS_ENET_MPC5121_FEC) + config FS_ENET_MDIO_FCC tristate "MDIO driver for FCC"
drivers/net/fs_enet/fec_mpc5121.h new file +120 -0
120 lines not on this page · raw message
drivers/net/fs_enet/fs_enet-main.c +77 -13
159 lines not on this page · raw message
drivers/net/fs_enet/fs_enet.h +10 -4
@@ -9,11 +9,17 @@#include <linux/dma-mapping.h> #include <linux/fs_enet_pd.h> +#ifndef CONFIG_FS_ENET_MPC5121_FEC #include <asm/fs_pd.h> +#else +#include "fec_mpc5121.h" +#endif #ifdef CONFIG_CPM1 #include <asm/cpm1.h> +#endif +#if defined(CONFIG_CPM1) || defined(CONFIG_FS_ENET_MPC5121_FEC) struct fec_info { fec_t __iomem *fecp; u32 mii_speed;
@@ -170,10 +176,10 @@ void fs_enet_platform_cleanup(void);#define __cbd_in16 (addr) __raw_readw(addr)#else /* for others play it safe */ -#define __cbd_out32 (addr, x) out_be32(addr, x) -#define __cbd_out16 (addr, x) out_be16(addr, x) -#define __cbd_in32 (addr) in_be32(addr) -#define __cbd_in16 (addr) in_be16(addr) +#define __cbd_out32 (addr, x) out_be32((volatile void __iomem *)addr, x) +#define __cbd_out16 (addr, x) out_be16((volatile void __iomem *)addr, x) +#define __cbd_in32 (addr) in_be32((volatile void __iomem *)addr) +#define __cbd_in16 (addr) in_be16((volatile void __iomem *)addr)#endif /* write */
drivers/net/fs_enet/mac-fec.c +20 -2
@@ -42,6 +42,9 @@#include <asm/mpc8xx.h> #include <asm/cpm1.h> #endif +#ifdef CONFIG_FS_ENET_MPC5121_FEC +#include "fec_mpc5121.h" +#endif #ifdef CONFIG_PPC_CPM_NEW_BINDING #include <asm/of_device.h>
@@ -306,7 +309,9 @@ static void restart(struct net_device *dev)* Set maximum receive buffer size. */ FW (fecp, r_buff_size,PKT_MAXBLR_SIZE ); +#ifndef CONFIG_FS_ENET_MPC5121_FEC FW (fecp, r_hash,PKT_MAXBUF_SIZE ); +#endif /* get physical address */ rx_bd_base_phys = fep->ring_mem_addr;
@@ -320,10 +325,17 @@ static void restart(struct net_device *dev)fs_init_bds (dev); +#ifndef CONFIG_FS_ENET_MPC5121_FEC /* * Enable big endian and don't care about SDMA FC. */ FW (fecp, fun_code,0x78000000 ); +#else +/* +* Set DATA_BO and DESC_BO and leave the rest unchanged +*/ +FS (fecp, dma_control,0xc0000000 ); +#endif /* * Set MII speed.
@@ -334,11 +346,13 @@ static void restart(struct net_device *dev)* Clear any outstanding interrupt. */ FW (fecp, ievent,0xffc0 ); +#ifndef CONFIG_FS_ENET_MPC5121_FEC #ifndef CONFIG_PPC_MERGE FW (fecp, ivec, (fep->interrupt /2 ) <<29 );#else FW (fecp, ivec, (virq_to_hw (fep->interrupt) /2 ) <<29 );#endif +#endif /* * adjust to speed (only for DUET & RMII)
@@ -368,9 +382,13 @@ static void restart(struct net_device *dev) out_be32(&immap->im_cpm.cp_cptr, cptr); }#endif - - +#ifdef CONFIG_FS_ENET_MPC5121_FEC +FW (fecp, r_cntrl,PKT_MAXBUF_SIZE <<16 );/* max frame size */ +FS (fecp, r_cntrl,FEC_RCNTRL_MII_MODE );/* MII enable */ +#else FW (fecp, r_cntrl,FEC_RCNTRL_MII_MODE );/* MII enable */ +#endif +/* * adjust to duplex mode */
drivers/net/fs_enet/mii-fec.c +9 -1
@@ -38,6 +38,7 @@#ifdef CONFIG_PPC_CPM_NEW_BINDING #include <asm/of_platform.h> +#include <asm/time.h> #endif #include "fs_enet.h"
@@ -71,7 +72,7 @@ static int fs_mii_fec_init(struct fec_info* fec, struct fs_mii_fec_platform_info {struct resource *r;fec_t __iomem *fecp; -char * name ="fsl-cpm-fec" ; +char *name ="fsl-cpm-fec" ;/* we need fec in order to be useful */ struct platform_device *fec_pdev =
@@ -261,9 +262,16 @@ static int fs_enet_mdio_remove(struct of_device *ofdev) } static struct of_device_id fs_enet_mdio_fec_match[] = { +#ifdef CONFIG_FS_ENET_FEC { .compatible = "fsl,pq1-fec-mdio", }, +#endif +#ifdef CONFIG_FS_ENET_MPC5121_FEC + { + .compatible = "fsl,mpc5121-fec-mdio", + }, +#endif {}, };
Signature · 1 line
1.5.4.3
Scott Wood
NAKRe: [PATCH 2/2] Re-added support for FEC on MPC5121 from Freescale LTIB
Please post patches to linuxppc-dev rather than linuxppc-embedded -- you'll get a larger reviewing audience.
drivers/net/fs_enet/Kconfig line 12
Quoted 6 lines · David Jander
drivers/net/fs_enet/Kconfig +6
-0+config FS_ENET_MPC5121_FEC + bool "Freescale MPC512x FEC driver" + depends on PPC_MPC512x + select FS_ENET + select FS_ENET_HAS_FEC + select PPC_CPM_NEW_BINDING
PPC_CPM_NEW_BINDING is default y, and will be going away as an option as soon as arch/ppc does. In the meantime, instead of selecting it here, add FS_ENET_MPC5121_FEC to the depends list of PPC_CPM_NEW_BINDING -- or just remove the depends list altogether.
drivers/net/fs_enet/Kconfig line 13
Quoted 1 line
drivers/net/fs_enet/Kconfig +1
-0+ default n
Unnecessary, please omit.
drivers/net/fs_enet/fec_mpc5121.h line 68
Quoted 8 lines
drivers/net/fs_enet/fec_mpc5121.h new file +8
-0+/* +* Define the buffer descriptor structure. +*/ +typedef struct bufdesc { +unsigned short cbd_sc;/* Control and status info */ +unsigned short cbd_datlen;/* Data length */ +unsigned long cbd_bufaddr;/* Buffer address */ +}cbd_t ;
This can be factored out into a common header -- along with most if not all of the flag defines.
drivers/net/fs_enet/fs_enet-main.c MODULE_PARM_DESC(fs_enet_debug, · line 72
Quoted 9 lines
drivers/net/fs_enet/fs_enet-main.c +1
-0@@ -69,6 +69,7 @@ MODULE_PARM_DESC(fs_enet_debug,static void fs_enet_netpoll (struct net_device *dev);#endif +#define ENET_RX_ALIGN 16
This is already defined in fs_enet.h.
Quoted 15 lines
drivers/net/fs_enet/fs_enet-main.c +15
-0+#define TX_ALIGN_WORKAROUND +#ifdef TX_ALIGN_WORKAROUND +static struct sk_buff *aligntxskb (struct net_device *dev,struct sk_buff *skb) +{ +struct sk_buff *skbn; + skbn =dev_alloc_skb (ENET_RX_FRSIZE +0x20 ); +if (skbn) +skb_align (skbn,0x20 ); + +if (!skbn) { + printk(KERN_WARNING DRV_MODULE_NAME +": %s Memory squeeze, dropping tx packet.\n" , + dev->name); +dev_kfree_skb_any (skb); +return NULL ;
drivers/net/fs_enet/fs_enet-main.c void fs_cleanup_bds(struct net_device *dev) · line 620
Quoted 10 lines
drivers/net/fs_enet/fs_enet-main.c +10
-0+ } + +skb_copy_from_linear_data (skb, skbn->data, skb->len); +skb_put (skbn, skb->len); +dev_kfree_skb_any (skb); +return skbn; +} +#else +#define aligntxskb (skb) skb +#endif
Can we encode the required alignment for rx and tx in the device tree?
drivers/net/fs_enet/fs_enet-main.c static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) · line 983
Quoted 6 lines
drivers/net/fs_enet/fs_enet-main.c +1
-1@@ -951,7 +980,7 @@ static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {struct fs_enet_private *fep =netdev_priv (dev);struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&rq->ifr_data; - +printk ("<1> %s: %s (%d)\n" ,__FILE__,__FUNCTION__,__LINE__);
Please use the KERN_ prefixes rather than hardcoding the number, and put spaces after commas. Of course, if this is to be here at all, this should be dev_dbg() rather than KERN_ALERT.
drivers/net/fs_enet/fs_enet-main.c static void cleanup_immap(void) · line 1204
Quoted 12 lines
drivers/net/fs_enet/fs_enet-main.c +5
-0+#ifndef CONFIG_FS_ENET_MPC5121_FEC /* handy pointer to the immap */ void __iomem *fs_enet_immap =NULL ;@@ -1168,6 +1198,10 @@ static void cleanup_immap(void)iounmap (fs_enet_immap); #endif } +#else +#define setup_immap () 0 +#define cleanup_immap () do {} while (0) +#endif
NACK, this precludes a 52xx/82xx multiplatform kernel.
drivers/net/fs_enet/fs_enet-main.c static int fs_enet_remove(struct device *dev) · line 1506
Quoted 7 lines
drivers/net/fs_enet/fs_enet-main.c +4
-0static struct device_driver fs_enet_fec_driver = { +#ifndef CONFIG_FS_ENET_MPC5121_FEC .name ="fsl-cpm-fec" , +#else + .name ="fsl-mpc5121-fec" , +#endif .bus = &platform_bus_type,
This is non-PPC_CPM_NEW_BINDING stuff which is now for arch/ppc only -- we don't need to support 52xx with it if it didn't already.
drivers/net/fs_enet/fs_enet-main.c
Quoted 5 lines
drivers/net/fs_enet/fs_enet-main.c +4
-0+#ifndef CONFIG_FS_ENET_MPC5121_FEC #include <asm/fs_pd.h> +#else +#include "fec_mpc5121.h" +#endif
Why can't we unconditionally include asm/fs_pd.h?
drivers/net/fs_enet/fs_enet-main.c
Quoted 8 lines
drivers/net/fs_enet/fs_enet-main.c +4
-4-#define __cbd_out32 (addr, x) out_be32(addr, x) -#define __cbd_out16 (addr, x) out_be16(addr, x) -#define __cbd_in32 (addr) in_be32(addr) -#define __cbd_in16 (addr) in_be16(addr) +#define __cbd_out32 (addr, x) out_be32((volatile void __iomem *)addr, x) +#define __cbd_out16 (addr, x) out_be16((volatile void __iomem *)addr, x) +#define __cbd_in32 (addr) in_be32((volatile void __iomem *)addr) +#define __cbd_in16 (addr) in_be16((volatile void __iomem *)addr)
NACK, please don't remove type checking.
Quoted 11 lines
drivers/net/fs_enet/fs_enet-main.c +3
-0+#ifndef CONFIG_FS_ENET_MPC5121_FEC FW (fecp, r_hash,PKT_MAXBUF_SIZE ); +#endif /* get physical address */ rx_bd_base_phys = fep->ring_mem_addr;@@ -320,10 +325,17 @@ static void restart(struct net_device *dev)fs_init_bds (dev); +#ifndef CONFIG_FS_ENET_MPC5121_FEC
drivers/net/fs_enet/fs_enet-main.c static void restart(struct net_device *dev) · line 338
Quoted 10 lines
drivers/net/fs_enet/fs_enet-main.c +6
-0/* * Enable big endian and don't care about SDMA FC. */ FW (fecp, fun_code,0x78000000 ); +#else +/* +* Set DATA_BO and DESC_BO and leave the rest unchanged +*/ +FS (fecp, dma_control,0xc0000000 ); +#endif
Please do a runtime check for hw type rather than compile-time (here and elsewhere).
-Scott
Re: [PATCH 2/2] Re-added support for FEC on MPC5121 from Freescale LTIB
Quoted 2 lines · On Wednesday 11 June 2008 20:19:17 Scott Wood wrote:
Please post patches to linuxppc-dev rather than linuxppc-embedded -- you'll get a larger reviewing audience.
Ok, but I thought linuxppc-dev was for all non-embedded development only...
Quoted 4 lines
PPC_CPM_NEW_BINDINGis default y, and will be going away as an option as soon asarch/ppcdoes. In the meantime, instead of selecting it here, addFS_ENET_MPC5121_FECto the depends list ofPPC_CPM_NEW_BINDING-- or just remove the depends list altogether.
Good idea, done that.
Quoted 11 lines
drivers/net/fs_enet/fec_mpc5121.h line 68
Quoted 8 lines
drivers/net/fs_enet/fec_mpc5121.h new file +8
-0+/* +* Define the buffer descriptor structure. +*/ +typedef struct bufdesc { +unsigned short cbd_sc;/* Control and status info */ +unsigned short cbd_datlen;/* Data length */ +unsigned long cbd_bufaddr;/* Buffer address */ +}cbd_t ;This can be factored out into a common header -- along with most if not all of the flag defines.
Ok, I added the changes to ../fec.h inside an #if-#else.
Quoted 19 lines
Quoted 19 lines
drivers/net/fs_enet/fs_enet-main.c +3
-0+#define TX_ALIGN_WORKAROUND +#ifdef TX_ALIGN_WORKAROUND +static struct sk_buff *aligntxskb(struct net_device *dev, struct sk_buff*skb) +{
drivers/net/fs_enet/fs_enet-main.c +15
-0+struct sk_buff *skbn; + skbn =dev_alloc_skb (ENET_RX_FRSIZE +0x20 ); +if (skbn) +skb_align (skbn,0x20 ); + +if (!skbn) { + printk(KERN_WARNING DRV_MODULE_NAME +": %s Memory squeeze, dropping tx packet.\n" , + dev->name); +dev_kfree_skb_any (skb); +return NULL ; + } + +skb_copy_from_linear_data (skb, skbn->data, skb->len); +skb_put (skbn, skb->len);
Quoted 8 lines
drivers/net/fs_enet/fs_enet-main.c void fs_cleanup_bds(struct net_device *dev) · line 620
Quoted 6 lines
drivers/net/fs_enet/fs_enet-main.c +6
-0+dev_kfree_skb_any (skb); + return skbn; +} +#else +#define aligntxskb (skb) skb +#endif Can we encode the required alignment for rx and tx in the device tree?
Hmmm... This actually is a silicon-bug workaround AFAIK.
I agree with you that this solution is not good, but I doubt resolving this in the device-tree is much better. It will add run-time overhead just because right now there are some buggy chips around. I think this could better be a Kconfig option, so people can have faster kernels if they want later. If you are concerned about multiplatform kernels, this shouldn't harm.
Quoted 6 lines
[...]
drivers/net/fs_enet/fs_enet-main.c static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) · line 983
Quoted 1 line
drivers/net/fs_enet/fs_enet-main.c +1
-0+printk ("<1> %s: %s (%d)\n" ,__FILE__,__FUNCTION__,__LINE__);Please use the
KERN_prefixes rather than hardcoding the number, and put spaces after commas. Of course, if this is to be here at all, this should bedev_dbg()rather thanKERN_ALERT.
Ooops. This shouldn't be here. Removing it.
Quoted 10 lines
drivers/net/fs_enet/fs_enet.h void fs_enet_platform_cleanup(void); · line 182
Quoted 8 lines
drivers/net/fs_enet/fs_enet.h +4
-4-#define __cbd_out32 (addr, x) out_be32(addr, x) -#define __cbd_out16 (addr, x) out_be16(addr, x) -#define __cbd_in32 (addr) in_be32(addr) -#define __cbd_in16 (addr) in_be16(addr) +#define __cbd_out32 (addr, x) out_be32((volatile void __iomem *)addr, x) +#define __cbd_out16 (addr, x) out_be16((volatile void __iomem *)addr, x) +#define __cbd_in32 (addr) in_be32((volatile void __iomem *)addr) +#define __cbd_in16 (addr) in_be16((volatile void __iomem *)addr)NACK, please don't remove type checking.
Ok, but given the macro's further down, I'll have to cast there...
#define CBDR_BUFADDR(_cbd) __cbd_in32((volatile void __iomem *)&(_cbd)->cbd_bufaddr)
Quoted 10 lines
Quoted 10 lines
drivers/net/fs_enet/mac-fec.c +2
-0+#ifndef CONFIG_FS_ENET_MPC5121_FEC FW (fecp, r_hash,PKT_MAXBUF_SIZE ); +#endif /* get physical address */ rx_bd_base_phys = fep->ring_mem_addr;@@ -320,10 +325,17 @@ static void restart(struct net_device *dev)fs_init_bds (dev);
Quoted 11 lines
drivers/net/fs_enet/mac-fec.c static void restart(struct net_device *dev) · line 338
Quoted 11 lines
drivers/net/fs_enet/mac-fec.c +7
-0+#ifndef CONFIG_FS_ENET_MPC5121_FEC /* * Enable big endian and don't care about SDMA FC. */ FW (fecp, fun_code,0x78000000 ); +#else +/* +* Set DATA_BO and DESC_BO and leave the rest unchanged +*/ +FS (fecp, dma_control,0xc0000000 ); +#endif
I have tried, but it is almost impossible, since both FEC types use a struct named "fec_t" which very different betwen both types. That means that the code would have enormous amounts of "if" statements all over.
Any suggestion?
Best regards,
Signature · 2 lines
David Jander Protonic Holland.
Re: [PATCH 2/2] Re-added support for FEC on MPC5121 from Freescale LTIB
Quoted 5 lines · David Jander
Quoted 2 lines · On Wednesday 11 June 2008 20:19:17 Scott Wood wrote:
Please post patches to linuxppc-dev rather than linuxppc-embedded -- you'll get a larger reviewing audience.
Ok, but I thought linuxppc-dev was for all non-embedded development only...
No, it's for all Linux/PowerPC development. linuxppc-embedded is more for user questions.
Quoted 8 lines
Quoted 1 line
Can we encode the required alignment for rx and tx in the device tree?
Hmmm... This actually is a silicon-bug workaround AFAIK.
I agree with you that this solution is not good, but I doubt resolving this in the device-tree is much better. It will add run-time overhead just because right now there are some buggy chips around. I think this could better be aKconfigoption, so people can have faster kernels if they want later. If you are concerned about multiplatform kernels, this shouldn't harm.
OK.
Quoted 11 lines
Quoted 10 lines
drivers/net/fs_enet/fs_enet.h void fs_enet_platform_cleanup(void); · line 182
Quoted 8 lines
drivers/net/fs_enet/fs_enet.h +4
-4-#define __cbd_out32 (addr, x) out_be32(addr, x) -#define __cbd_out16 (addr, x) out_be16(addr, x) -#define __cbd_in32 (addr) in_be32(addr) -#define __cbd_in16 (addr) in_be16(addr) +#define __cbd_out32 (addr, x) out_be32((volatile void __iomem *)addr, x) +#define __cbd_out16 (addr, x) out_be16((volatile void __iomem *)addr, x) +#define __cbd_in32 (addr) in_be32((volatile void __iomem *)addr) +#define __cbd_in16 (addr) in_be16((volatile void __iomem *)addr)NACK, please don't remove type checking.
Quoted 3 lines
Ok, but given the macro's further down, I'll have to cast there...
#define
CBDR_BUFADDR(_cbd)__cbd_in32((volatile void __iomem *)&(_cbd)->cbd_bufaddr)
Why? cbd should already have an __iomem annotation, and the volatile is unnecessary.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/net/fs_enet/mac-fec.c +2
-0+#ifndef CONFIG_FS_ENET_MPC5121_FEC FW (fecp, r_hash,PKT_MAXBUF_SIZE ); +#endif /* get physical address */ rx_bd_base_phys = fep->ring_mem_addr;@@ -320,10 +325,17 @@ static void restart(struct net_device *dev)fs_init_bds (dev);
Quoted 16 lines
Quoted 11 lines
drivers/net/fs_enet/mac-fec.c static void restart(struct net_device *dev) · line 338
Quoted 11 lines
drivers/net/fs_enet/mac-fec.c +7
-0+#ifndef CONFIG_FS_ENET_MPC5121_FEC /* * Enable big endian and don't care about SDMA FC. */ FW (fecp, fun_code,0x78000000 ); +#else +/* +* Set DATA_BO and DESC_BO and leave the rest unchanged +*/ +FS (fecp, dma_control,0xc0000000 ); +#endif I have tried, but it is almost impossible, since both FEC types use a struct named "
fec_t" which very different betwen both types. That means that the code would have enormous amounts of "if" statements all over.
Any suggestion?
OK, I missed that this was FEC-specific code and not general fs-enet.
8xx/512x multiplatform is already unsupported due to core differences, but make sure that 82xx/512x multiplatform doesn't get broken.
-Scott
Re: [PATCH 2/2] Re-added support for FEC on MPC5121 from Freescale LTIB
Quoted 18 lines · Scott Wood
Quoted 8 lines · David Jander
Quoted 8 lines
Quoted 8 lines
drivers/net/fs_enet/mac-fec.c +4
-0+#ifndef CONFIG_FS_ENET_MPC5121_FEC /* * Enable big endian and don't care about SDMA FC. */ FW (fecp, fun_code,0x78000000 ); +#else +/* +* Set DATA_BO and DESC_BO and leave the rest unchanged Quoted 8 lines
Quoted 3 lines
drivers/net/fs_enet/mac-fec.c static void restart(struct net_device *dev) · line 338
Quoted 3 lines
drivers/net/fs_enet/mac-fec.c +3
-0+*/ +FS (fecp, dma_control,0xc0000000 ); +#endif I have tried, but it is almost impossible, since both FEC types use a struct named "
fec_t" which very different betwen both types. That means that the code would have enormous amounts of "if" statements all over.
Any suggestion?
Quoted 4 lines
OK, I missed that this was FEC-specific code and not general fs-enet.
8xx/512x multiplatform is already unsupported due to core differences, but make sure that 82xx/512x multiplatform doesn't get broken.
Yeah, but the amount of #ifdefs required in this drivers adds a maintenance burden. I think I'd rather see it either refactored or cloned.
Cheers,
g.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
Re: [PATCH 2/2] Re-added support for FEC on MPC5121 from Freescale LTIB
In reply to David JanderDavid,
Sorry for the late response but I have been away for the last week.
This looks like a verbatim copy of the patches authored by me in ltib. I think it is considered gauche to submit someone else's work with your Signed-off-by.
Others have already spoken of the problems with this patch. I am working on an alternative with far fewer ifdefs that may actually pass review. It has passed an off line review by Scott Wood.
I'll submit my latest patch and we will see what people think.
John
Quoted 525 lines · David Jander
to current head
Signed-off-by David Jander <[email protected]>--- drivers/net/fs_enet/Kconfig | 16 ++++- drivers/net/fs_enet/fec_mpc5121.h | 120 ++++++++++++++++++++++++++++++++++++ drivers/net/fs_enet/fs_enet-main.c | 90 +++++++++++++++++++++++---- drivers/net/fs_enet/fs_enet.h | 14 +++- drivers/net/fs_enet/mac-fec.c | 22 ++++++- drivers/net/fs_enet/mii-fec.c | 10 +++- 6 files changed, 249 insertions(+), 23 deletions(-) create mode 100644 drivers/net/fs_enet/fec_mpc5121.hdrivers/net/fs_enet/Kconfig +13
-3@@ -1,9 +1,17 @@ config FS_ENET tristate "Freescale Ethernet Driver" - depends on CPM1 || CPM2 + depends on CPM1 || CPM2 || FS_ENET_MPC5121_FEC select MII select PHYLIB +config FS_ENET_MPC5121_FEC + bool "Freescale MPC512x FEC driver" + depends on PPC_MPC512x + select FS_ENET + select FS_ENET_HAS_FEC + select PPC_CPM_NEW_BINDING + default n + config FS_ENET_HAS_SCC bool "Chip has an SCC usable for ethernet" depends on FS_ENET && (CPM1 || CPM2)@@ -16,13 +24,15 @@ config FS_ENET_HAS_FCC config FS_ENET_HAS_FEC bool "Chip has an FEC usable for ethernet" - depends on FS_ENET && CPM1 + depends on FS_ENET && (CPM1 || FS_ENET_MPC5121_FEC) select FS_ENET_MDIO_FEC default y + config FS_ENET_MDIO_FEC tristate "MDIO driver for FEC" - depends on FS_ENET && CPM1 + depends on FS_ENET && (CPM1 || FS_ENET_MPC5121_FEC) + config FS_ENET_MDIO_FCC tristate "MDIO driver for FCC"drivers/net/fs_enet/fec_mpc5121.h new file +2
-0@@ -0,0 +1,120 @@ +/* +* Copyright (C) 2007,2008 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: John Rigby, <[email protected]>
+ *
+ * Modified version ofdrivers/net/fec.h:
+ *
+ *fec.h-- Fast Ethernet Controller for Motorola ColdFire SoC
+ * processors.
+ *
+ * (C) Copyright 2000-2005, Greg Ungerer ([email protected])
+ * (C) Copyright 2000-2001, Lineo (www.lineo.com)
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */drivers/net/fs_enet/fec_mpc5121.h new file +47
-0+#ifndef FEC_MPC5121_H +#define FEC_MPC5121_H + +typedef struct fec { + u32 fec_reserved0; + u32 fec_ievent; /* Interrupt event reg */ + u32 fec_imask; /* Interrupt mask reg */ + u32 fec_reserved1; + u32 fec_r_des_active; /* Receive descriptor reg */ + u32 fec_x_des_active; /* Transmit descriptor reg */ + u32 fec_reserved2[3]; + u32 fec_ecntrl; /* Ethernet control reg */ + u32 fec_reserved3[6]; + u32 fec_mii_data; /* MII manage frame reg */ + u32 fec_mii_speed; /* MII speed control reg */ + u32 fec_reserved4[7]; + u32 fec_mib_ctrlstat; /* MIB control/status reg */ + u32 fec_reserved5[7]; + u32 fec_r_cntrl; /* Receive control reg */ + u32 fec_reserved6[15]; + u32 fec_x_cntrl; /* Transmit Control reg */ + u32 fec_reserved7[7]; + u32 fec_addr_low; /* Low 32bits MAC address */ + u32 fec_addr_high; /* High 16bits MAC address */ + u32 fec_opd; /* Opcode + Pause duration */ + u32 fec_reserved8[10]; + u32 fec_hash_table_high; /* High 32bits hash table */ + u32 fec_hash_table_low; /* Low 32bits hash table */ + u32 fec_grp_hash_table_high;/* High 32bits hash table */ + u32 fec_grp_hash_table_low; /* Low 32bits hash table */ + u32 fec_reserved9[7]; + u32 fec_x_wmrk; /* FIFO transmit water mark */ + u32 fec_reserved10; + u32 fec_r_bound; /* FIFO receive bound reg */ + u32 fec_r_fstart; /* FIFO receive start reg */ + u32 fec_reserved11[11]; + u32 fec_r_des_start; /* Receive descriptor ring */ + u32 fec_x_des_start; /* Transmit descriptor ring */ + u32 fec_r_buff_size; /* Maximum receive buff size */ + u32 fec_dma_control; /* DMA Endian and other ctrl */ +} fec_t; + +/* + * Define the buffer descriptor structure. + */ +typedef struct bufdesc { + unsigned short cbd_sc; /* Control and status info*/
drivers/net/fs_enet/fec_mpc5121.h new file +11
-0+unsigned short cbd_datlen;/* Data length */ +unsigned long cbd_bufaddr;/* Buffer address */ +} cbd_t; + +/* +* The following definitions courtesy of commproc.h, which where +* Copyright (c) 1997 Dan Malek ([email protected]). +*/ +#define BD_SC_EMPTY ((ushort)0x8000)/* Recieve is empty */ +#define BD_SC_READY ((ushort)0x8000)/* Transmit is ready */ +#define BD_SC_WRAP ((ushort)0x2000)/* Last buffer descriptor */
drivers/net/fs_enet/fec_mpc5121.h new file +25
-0+#define BD_SC_INTRPT ((ushort)0x1000)/* Interrupt on change */ +#define BD_SC_CM ((ushort)0x0200)/* Continous mode */ +#define BD_SC_ID ((ushort)0x0100)/* Rec'd too many idles */ +#define BD_SC_P ((ushort)0x0100)/* xmt preamble */ +#define BD_SC_BR ((ushort)0x0020)/* Break received */ +#define BD_SC_FR ((ushort)0x0010)/* Framing error */ +#define BD_SC_PR ((ushort)0x0008)/* Parity error */ +#define BD_SC_OV ((ushort)0x0002)/* Overrun */ +#define BD_SC_CD ((ushort)0x0001)/* ?? */ + +/* Buffer descriptor control/status used by Ethernet receive. +*/ +#define BD_ENET_RX_EMPTY ((ushort)0x8000) +#define BD_ENET_RX_WRAP ((ushort)0x2000) +#define BD_ENET_RX_INTR ((ushort)0x1000) +#define BD_ENET_RX_LAST ((ushort)0x0800) +#define BD_ENET_RX_FIRST ((ushort)0x0400) +#define BD_ENET_RX_MISS ((ushort)0x0100) +#define BD_ENET_RX_LG ((ushort)0x0020) +#define BD_ENET_RX_NO ((ushort)0x0010) +#define BD_ENET_RX_SH ((ushort)0x0008) +#define BD_ENET_RX_CR ((ushort)0x0004) +#define BD_ENET_RX_OV ((ushort)0x0002) +#define BD_ENET_RX_CL ((ushort)0x0001) +#define BD_ENET_RX_STATS ((ushort)0x013f)/* All status bits */
drivers/net/fs_enet/fec_mpc5121.h new file +17
-0+ +/* Buffer descriptor control/status used by Ethernet transmit. +*/ +#define BD_ENET_TX_READY ((ushort)0x8000) +#define BD_ENET_TX_PAD ((ushort)0x4000) +#define BD_ENET_TX_WRAP ((ushort)0x2000) +#define BD_ENET_TX_INTR ((ushort)0x1000) +#define BD_ENET_TX_LAST ((ushort)0x0800) +#define BD_ENET_TX_TC ((ushort)0x0400) +#define BD_ENET_TX_DEF ((ushort)0x0200) +#define BD_ENET_TX_HB ((ushort)0x0100) +#define BD_ENET_TX_LC ((ushort)0x0080) +#define BD_ENET_TX_RL ((ushort)0x0040) +#define BD_ENET_TX_RCMASK ((ushort)0x003c) +#define BD_ENET_TX_UN ((ushort)0x0002) +#define BD_ENET_TX_CSL ((ushort)0x0001) +#define BD_ENET_TX_STATS ((ushort)0x03ff)/* All status bits */
drivers/net/fs_enet/fec_mpc5121.h new file +2
-0+ +#endif /* FEC_MPC5121_H */ drivers/net/fs_enet/fs_enet-main.c +28
-0@@ -69,6 +69,7 @@ MODULE_PARM_DESC(fs_enet_debug,static void fs_enet_netpoll (struct net_device *dev);#endif +#define ENET_RX_ALIGN 16static void fs_set_multicast_list (struct net_device *dev) {struct fs_enet_private *fep =netdev_priv (dev);@@ -592,6 +593,33 @@ void fs_cleanup_bds(struct net_device *dev)/**********************************************************************************/ +#define TX_ALIGN_WORKAROUND +#ifdef TX_ALIGN_WORKAROUND +static struct sk_buff *aligntxskb (struct net_device *dev,struct sk_buff *skb) +{ +struct sk_buff *skbn; + skbn =dev_alloc_skb (ENET_RX_FRSIZE +0x20 ); +if (skbn) +skb_align (skbn,0x20 ); + +if (!skbn) { + printk(KERN_WARNING DRV_MODULE_NAME +": %s Memory squeeze, dropping tx packet.\n" , + dev->name); +dev_kfree_skb_any (skb); +return NULL ; + } + +skb_copy_from_linear_data (skb, skbn->data, skb->len); +skb_put (skbn, skb->len); +dev_kfree_skb_any (skb); +return skbn; +} +#else +#define aligntxskb (skb) skb +#endif + +static int fs_enet_start_xmit (struct sk_buff *skb,struct net_device *dev){ struct fs_enet_private *fep = netdev_priv(dev);drivers/net/fs_enet/fs_enet-main.c +1
-0@@ -600,6 +628,7 @@ static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) u16 sc;unsigned long flags; + skb =aligntxskb (dev, skb);spin_lock_irqsave (&fep->tx_lock, flags);/*drivers/net/fs_enet/fs_enet-main.c +2
-1@@ -951,7 +980,7 @@ static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {struct fs_enet_private *fep =netdev_priv (dev);struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&rq->ifr_data; - +printk ("<1> %s: %s (%d)\n" ,__FILE__,__FUNCTION__,__LINE__);if (!netif_running (dev))return -EINVAL ;@@ -1147,6 +1176,7 @@ static int fs_cleanup_instance(struct net_device *ndev)/**************************************************************************************/ +#ifndef CONFIG_FS_ENET_MPC5121_FEC /* handy pointer to the immap */ void
__iomem*fs_enet_immap= NULL;drivers/net/fs_enet/fs_enet-main.c +46
-12@@ -1168,6 +1198,10 @@ static void cleanup_immap(void)iounmap (fs_enet_immap); #endif } +#else +#define setup_immap () 0 +#define cleanup_immap () do {} while (0) +#endif /**************************************************************************************/ @@ -1370,10 +1404,17 @@ static struct of_device_id fs_enet_match[] = { },#endif #ifdef CONFIG_FS_ENET_HAS_FEC +#ifndef CONFIG_FS_ENET_MPC5121_FEC { .compatible = "fsl,pq1-fec-enet", .data = (void *)&fs_fec_ops, }, +#else + { + .compatible = "fsl,mpc5121-fec", + .data = (void *)&fs_fec_ops, + }, +#endif #endif {} };@@ -1431,15 +1472,42 @@ static int fs_enet_remove(struct device *dev)return fs_cleanup_instance (dev_get_drvdata (dev)); } +#ifdef CONFIG_PM +static int fs_enet_suspend (struct device *dev,pm_message_t state) +{ +struct net_device *ndev =dev_get_drvdata (dev); + +if (netif_running (ndev)) +fs_enet_close (ndev); + +return 0 ; +} + +static int fs_enet_resume (struct device *dev) +{ +struct net_device *ndev =dev_get_drvdata (dev); + +if (netif_running (ndev)) +fs_enet_open (ndev); + +return 0 ; +} +#else +#define fs_enet_suspend NULL +#define fs_enet_resume NULL +#endif +static struct device_driver fs_enet_fec_driver = { +#ifndef CONFIG_FS_ENET_MPC5121_FEC .name ="fsl-cpm-fec" , +#else + .name ="fsl-mpc5121-fec" , +#endif .bus = &platform_bus_type, .probe = fs_enet_probe, .remove = fs_enet_remove, -#ifdef CONFIG_PM -/* .suspend = fs_enet_suspend, TODO */ -/* .resume = fs_enet_resume, TODO */ -#endif + .suspend = fs_enet_suspend, + .resume = fs_enet_resume, };static struct device_driver fs_enet_scc_driver = {@@ -1447,10 +1515,8 @@ static struct device_driver fs_enet_scc_driver = { .bus = &platform_bus_type, .probe = fs_enet_probe, .remove = fs_enet_remove, -#ifdef CONFIG_PM -/* .suspend = fs_enet_suspend, TODO */ -/* .resume = fs_enet_resume, TODO */ -#endif + .suspend = fs_enet_suspend, + .resume = fs_enet_resume, };static struct device_driver fs_enet_fcc_driver = {@@ -1458,10 +1524,8 @@ static struct device_driver fs_enet_fcc_driver = { .bus = &platform_bus_type, .probe = fs_enet_probe, .remove = fs_enet_remove, -#ifdef CONFIG_PM -/* .suspend = fs_enet_suspend, TODO */ -/* .resume = fs_enet_resume, TODO */ -#endif + .suspend = fs_enet_suspend, + .resume = fs_enet_resume, };static int __init fs_init (void )drivers/net/fs_enet/fs_enet.h +10
-4@@ -9,11 +9,17 @@#include <linux/dma-mapping.h> #include <linux/fs_enet_pd.h> +#ifndef CONFIG_FS_ENET_MPC5121_FEC #include <asm/fs_pd.h> +#else +#include "fec_mpc5121.h" +#endif #ifdef CONFIG_CPM1 #include <asm/cpm1.h> +#endif +#if defined(CONFIG_CPM1) || defined(CONFIG_FS_ENET_MPC5121_FEC) struct fec_info { fec_t __iomem *fecp; u32 mii_speed;@@ -170,10 +176,10 @@ void fs_enet_platform_cleanup(void);#define __cbd_in16 (addr) __raw_readw(addr)#else /* for others play it safe */ -#define __cbd_out32 (addr, x) out_be32(addr, x) -#define __cbd_out16 (addr, x) out_be16(addr, x) -#define __cbd_in32 (addr) in_be32(addr) -#define __cbd_in16 (addr) in_be16(addr) +#define __cbd_out32 (addr, x) out_be32((volatile void __iomem *)addr, x) +#define __cbd_out16 (addr, x) out_be16((volatile void __iomem *)addr, x) +#define __cbd_in32 (addr) in_be32((volatile void __iomem *)addr) +#define __cbd_in16 (addr) in_be16((volatile void __iomem *)addr)#endif /* write */ drivers/net/fs_enet/mac-fec.c +20
-2@@ -42,6 +42,9 @@#include <asm/mpc8xx.h> #include <asm/cpm1.h> #endif +#ifdef CONFIG_FS_ENET_MPC5121_FEC +#include "fec_mpc5121.h" +#endif #ifdef CONFIG_PPC_CPM_NEW_BINDING #include <asm/of_device.h> @@ -306,7 +309,9 @@ static void restart(struct net_device *dev)* Set maximum receive buffer size. */ FW (fecp, r_buff_size,PKT_MAXBLR_SIZE ); +#ifndef CONFIG_FS_ENET_MPC5121_FEC FW (fecp, r_hash,PKT_MAXBUF_SIZE ); +#endif /* get physical address */ rx_bd_base_phys = fep->ring_mem_addr;@@ -320,10 +325,17 @@ static void restart(struct net_device *dev)fs_init_bds (dev); +#ifndef CONFIG_FS_ENET_MPC5121_FEC /* * Enable big endian and don't care about SDMA FC. */ FW (fecp, fun_code,0x78000000 ); +#else +/* +* Set DATA_BO and DESC_BO and leave the rest unchanged +*/ +FS (fecp, dma_control,0xc0000000 ); +#endif /* * Set MII speed. @@ -334,11 +346,13 @@ static void restart(struct net_device *dev)* Clear any outstanding interrupt. */ FW (fecp, ievent,0xffc0 ); +#ifndef CONFIG_FS_ENET_MPC5121_FEC #ifndef CONFIG_PPC_MERGE FW (fecp, ivec, (fep->interrupt /2 ) <<29 );#else FW (fecp, ivec, (virq_to_hw (fep->interrupt) /2 ) <<29 );#endif +#endif /* * adjust to speed (only for DUET & RMII) @@ -368,9 +382,13 @@ static void restart(struct net_device *dev) out_be32(&immap->im_cpm.cp_cptr, cptr); }#endif - - +#ifdef CONFIG_FS_ENET_MPC5121_FEC +FW (fecp, r_cntrl,PKT_MAXBUF_SIZE <<16 );/* max frame size */ +FS (fecp, r_cntrl,FEC_RCNTRL_MII_MODE );/* MII enable */ +#else FW (fecp, r_cntrl,FEC_RCNTRL_MII_MODE );/* MII enable */ +#endif +/* * adjust to duplex mode */ drivers/net/fs_enet/mii-fec.c +1
-0@@ -38,6 +38,7 @@#ifdef CONFIG_PPC_CPM_NEW_BINDING #include <asm/of_platform.h> +#include <asm/time.h> #endif #include "fs_enet.h" @@ -71,7 +72,7 @@ static int fs_mii_fec_init(struct fec_info* fec, struct
fs_mii_fec_platform_info{ struct resource *r; fec_t __iomem *fecp;drivers/net/fs_enet/mii-fec.c +8
-2-char * name ="fsl-cpm-fec" ; +char *name ="fsl-cpm-fec" ;/* we need fec in order to be useful */ struct platform_device *fec_pdev =@@ -261,9 +262,16 @@ static int fs_enet_mdio_remove(struct of_device *ofdev) } static struct of_device_id fs_enet_mdio_fec_match[] = { +#ifdef CONFIG_FS_ENET_FEC { .compatible = "fsl,pq1-fec-mdio", }, +#endif +#ifdef CONFIG_FS_ENET_MPC5121_FEC + { + .compatible = "fsl,mpc5121-fec-mdio", + }, +#endif {}, }; --1.5.4.3
_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded
Quoted 2 lines · David Jander
arch/powerpc/platforms/512x/mpc5121_ads.c | 104 ---------- arch/powerpc/platforms/512x/mpc5121_generic.c | 105 ++++++++++
Pass -B -M -C to git-format-patch to detect renames, copies, etc.
Quoted 4 lines
arch/powerpc/boot/dts/prtlvt.dts new file +4
-0+ flash@fe000000 { + device_type = "rom"; + compatible = "direct-mapped"; + probe-type = "CFI";
arch/powerpc/boot/dts/prtlvt.dts line 59
Quoted 10 lines
arch/powerpc/boot/dts/prtlvt.dts new file +10
-0+ reg = <0xfe000000 0x02000000>; + bank-width = <2>; + partitions = <0x00000000 0x01800000 // filesystem + 0x01800000 0x00200000 // config0 + 0x01a00000 0x00200000 // config1 + 0x01c00000 0x002e0000 // kernel + 0x01ee0000 0x00020000 // one sector for device tree + 0x01f00000 0x00100000>; // u-boot + partition-names = "filesystem", "config0", "config1","kernel", "device-tree", "u-boot"; + };
This is an old flash binding. Please use the one currently described in Documentation/booting-without-of.txt.
arch/powerpc/boot/dts/prtlvt.dts line 62
Quoted 2 lines
arch/powerpc/boot/dts/prtlvt.dts new file +2
-0+ soc@80000000 { + compatible = "fsl,mpc5121-immr";
Also simple-bus.
arch/powerpc/boot/dts/prtlvt.dts line 171
Quoted 6 lines
arch/powerpc/boot/dts/prtlvt.dts new file +6
-0+ //axe@2000 { + // compatible = "mpc512x-axe"; + // reg = <2000 100>; + // interrupts = <2a 8>; + // interrupt-parent = < &ipic >; + //};
Why is this here, but commented out?
arch/powerpc/boot/dts/prtlvt.dts line 184
Quoted 2 lines
arch/powerpc/boot/dts/prtlvt.dts new file +2
-0+ mdio@2800 { + device_type = "mdio";
No device_type.
arch/powerpc/boot/dts/prtlvt.dts line 235
Quoted 3 lines
arch/powerpc/boot/dts/prtlvt.dts new file +3
-0+ // PSC4 in i2s mode + i2s@11500 { + device_type = "i2s";
No device_type.
arch/powerpc/boot/dts/prtlvt.dts line 245
Quoted 3 lines
arch/powerpc/boot/dts/prtlvt.dts new file +3
-0+ // PSC5 in SPI mode for touchscreen + spi@11500 { + device_type = "spi";
No device_type.
arch/powerpc/boot/dts/prtlvt.dts line 254
Quoted 2 lines
arch/powerpc/boot/dts/prtlvt.dts new file +2
-0+ dma2@14000 { + compatible = "fsl,mpc5121-dma2";
Is this DMA controller compatible with drivers/dma/fsldma.c? If so, follow the established binding.
Quoted 13 lines
arch/powerpc/platforms/512x/Kconfig +5
-0+config MPC5121_GENERIC + bool + default n + config MPC5121_ADS bool "Freescale MPC5121E ADS" depends on PPC_MULTIPLATFORM && PPC32 select DEFAULT_UIMAGE select PPC_MPC5121 + select MPC5121_GENERIC help This option enables support for the MPC5121E ADS board. default n
arch/powerpc/platforms/512x/Kconfig config PPC_MPC5121 · line 34
Quoted 10 lines
arch/powerpc/platforms/512x/Kconfig +10
-0+ +config PRTLVT + bool "Protonic LVT family of MPC5121 based boards" + depends on PPC_MULTIPLATFORM && PPC32 + select DEFAULT_UIMAGE + select PPC_MPC5121 + select MPC5121_GENERIC + help + This option enables support for the Protonic LVT family (ZANMCU and VICVT2). + default n
Can we leave out the "default n" lines? They're no-ops.
I don't think these configs should depend on an option (PPC_MULTIPLATFORM) that is described as "Generic desktop/server/laptop"...
-Scott
Quoted 28 lines · Scott Wood
Quoted 22 lines · David Jander
arch/powerpc/platforms/512x/Kconfig +14
-0+config MPC5121_GENERIC + bool + default n + config MPC5121_ADS bool "Freescale MPC5121E ADS" depends on PPC_MULTIPLATFORM && PPC32 select DEFAULT_UIMAGE select PPC_MPC5121 + select MPC5121_GENERIC help This option enables support for the MPC5121E ADS board. default n + +config PRTLVT + bool "Protonic LVT family of MPC5121 based boards" + depends on PPC_MULTIPLATFORM && PPC32 + select DEFAULT_UIMAGE + select PPC_MPC5121 + select MPC5121_GENERIC + help + This option enables support for the Protonic LVT family (ZANMCUQuoted 2 lines
and VICVT2).
+ default nCan we leave out the "default n" lines? They're no-ops.
Quoted 2 lines
I don't think these configs should depend on an option (
PPC_MULTIPLATFORM) that is described as "Generic desktop/server/laptop"...
PPC_MULTIPLATFORM may be described poorly, but it is the appropriate option. However, it should probably be that the whole 5121 support Kconfig should depend on MULTIPLATFORM, not individual board ports. That being said, David is just duplicating what was already done for the ADS board, so I'm not going to harp on him to change it in this patch.
Cheers,
g.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
Quoted 1 line · On Wednesday 11 June 2008 19:58:32 Scott Wood wrote:
Pass -B -M -C to git-format-patch to detect renames, copies, etc.
Thanks for the hint. I am still a git-noob ;-)
Quoted 3 lines
[...]
This is an old flash binding. Please use the one currently described inDocumentation/booting-without-of.txt.
Thanks again, I was searching for documentation about dts, and couldn't find much.
Quoted 8 lines
arch/powerpc/boot/dts/prtlvt.dts line 171
Quoted 6 lines
arch/powerpc/boot/dts/prtlvt.dts new file +6
-0+ //axe@2000 { + // compatible = "mpc512x-axe"; + // reg = <2000 100>; + // interrupts = <2a 8>; + // interrupt-parent = < &ipic >; + //};Why is this here, but commented out?
Hmm, I know we are going to use it, but there are no drivers still... I'll leave it out, and add it again later when axe-support has arrived.
Quoted 5 lines
arch/powerpc/boot/dts/prtlvt.dts line 254
Quoted 2 lines
arch/powerpc/boot/dts/prtlvt.dts new file +2
-0+ dma2@14000 { + compatible = "fsl,mpc5121-dma2";Is this DMA controller compatible with
drivers/dma/fsldma.c? If so, follow the established binding.
No, it's not compatible with any other dma controller AFAIK. It special for this chip. John Rigby is writing the driver for it right now.
Quoted 17 lines
Quoted 17 lines
arch/powerpc/platforms/512x/Kconfig +9
-0+config MPC5121_GENERIC + bool + default n + config MPC5121_ADS bool "Freescale MPC5121E ADS" depends on PPC_MULTIPLATFORM && PPC32 select DEFAULT_UIMAGE select PPC_MPC5121 + select MPC5121_GENERIC help This option enables support for the MPC5121E ADS board. default n + +config PRTLVT + bool "Protonic LVT family of MPC5121 based boards" + depends on PPC_MULTIPLATFORM && PPC32
Quoted 8 lines
Quoted 6 lines
arch/powerpc/platforms/512x/Kconfig +5
-0+ select DEFAULT_UIMAGE + select PPC_MPC5121 + select MPC5121_GENERIC + help + This option enables support for the Protonic LVT family (ZANMCU andVICVT2). + default n
Can we leave out the "default n" lines? They're no-ops.
Ok, I removed also several others (all of them in this file). I hope that it is not a problem not making this a separate patch?
Quoted 2 lines
I don't think these configs should depend on an option (
PPC_MULTIPLATFORM) that is described as "Generic desktop/server/laptop"...
I think right now they need to. That's the way someone broke...err changed platform selection.
We should fix that later, but I don't really know what would be the right way to fix this right now. I'll think about it after this...
Btw, is it ok I just re-submit the fixed patches (with cc to linuxppc-dev)?
Thanks.
Greetings,
Signature · 2 lines
David Jander Protonic Holland.
Quoted 10 lines · David Jander
Quoted 8 lines · On Wednesday 11 June 2008 19:58:32 Scott Wood wrote:
arch/powerpc/boot/dts/prtlvt.dts line 171
Quoted 6 lines
arch/powerpc/boot/dts/prtlvt.dts new file +6
-0+ //axe@2000 { + // compatible = "mpc512x-axe"; + // reg = <2000 100>; + // interrupts = <2a 8>; + // interrupt-parent = < &ipic >; + //};Why is this here, but commented out?
Quoted 2 lines
Hmm, I know we are going to use it, but there are no drivers still... I'll leave it out, and add it again later when axe-support has arrived.
Just uncomment it -- there's no harm in a device node for which Linux has no driver, and it avoids problems with old device trees being used once a driver is added.
Compatible should have "fsl," prepended, though, and ideally a concrete chip should be represented rather than "512x".
Quoted 8 lines
Quoted 5 lines
arch/powerpc/boot/dts/prtlvt.dts line 254
Quoted 2 lines
arch/powerpc/boot/dts/prtlvt.dts new file +2
-0+ dma2@14000 { + compatible = "fsl,mpc5121-dma2";Is this DMA controller compatible with
drivers/dma/fsldma.c? If so, follow the established binding.No, it's not compatible with any other dma controller AFAIK. It special for this chip. John Rigby is writing the driver for it right now.
OK.
Quoted 1 line
Btw, is it ok I just re-submit the fixed patches (with cc to linuxppc-dev)?
Yes.
-Scott
Looking good. A few more comments below.
Quoted 2 lines · David Jander
Made
MPC5121_ADSboard support generic
This description isn't verbose enough. Describe what this patch changes in more detail please.
arch/powerpc/boot/dts/prtlvt.dts line 2
Quoted 11 lines
Signed-off-by David Jander <[email protected]>---
arch/powerpc/boot/dts/prtlvt.dts new file +2
-0@@ -0,0 +1,267 @@ + soc@80000000 { + compatible = "fsl,mpc5121-immr";
As Scott mentioned, this should be:
compatible = "fsl,mpc5121-immr", "simple-bus";
arch/powerpc/boot/dts/prtlvt.dts line 167
Quoted 2 lines
arch/powerpc/boot/dts/prtlvt.dts new file +2
-0+ //axe@2000 { + // compatible = "mpc512x-axe";
Even though this is commented out; the compatible value is in the wrong form.
arch/powerpc/boot/dts/prtlvt.dts line 208
Quoted 4 lines
arch/powerpc/boot/dts/prtlvt.dts new file +4
-0+ // port1 using extern ULPI PHY + usb@3000 { + device_type = "usb"; + compatible = "fsl,fsl-usb2-dr";
Poor compatible form. fsl,fsl-usb2-dr does not specify a particular implementation of the device and is rather redundant. Should probably be:
compatible = "fsl,mpc5121-usb2-dr", "fsl-usb2-dr";
Which means: 'this is a usb-dr controller on the MPC5121, which is also compatible with the pre-existing "fsl-usb2-dr" device tree binding.' "fsl-usb2-dr" is used on line 656 of fsl_soc.c. It's not a very good values for a compatible field (for various reasons), but it is already in existence so it is okay to claim compatibility with it.
If this USB controller is *not* compatible with fsl-usb2-dr, then you should not have that value.
arch/powerpc/boot/dts/prtlvt.dts line 222
Quoted 4 lines
arch/powerpc/boot/dts/prtlvt.dts new file +4
-0+ // port0 using internal UTMI PHY + usb@4000 { + device_type = "usb"; + compatible = "fsl,fsl-usb2-dr";
Ditto
Quoted 21 lines
arch/powerpc/platforms/512x/Kconfig +5
-0@@ -9,11 +9,26 @@ config PPC_MPC5121 select PPC_MPC512x default n +config MPC5121_GENERIC + bool + default n + config MPC5121_ADS bool "Freescale MPC5121E ADS" depends on PPC_MULTIPLATFORM && PPC32 select DEFAULT_UIMAGE select PPC_MPC5121 + select MPC5121_GENERIC help This option enables support for the MPC5121E ADS board. default n
arch/powerpc/platforms/512x/Kconfig config PPC_MPC5121 · line 34
Quoted 10 lines
arch/powerpc/platforms/512x/Kconfig +10
-0+ +config PRTLVT + bool "Protonic LVT family of MPC5121 based boards" + depends on PPC_MULTIPLATFORM && PPC32 + select DEFAULT_UIMAGE + select PPC_MPC5121 + select MPC5121_GENERIC + help + This option enables support for the Protonic LVT family (ZANMCU and VICVT2). + default n
Personally, I wouldn't bother with separate Kconfig entrys for each supported board. Just have a single MPC5121_GENERIC config property and add to the help text the list of boards that it supports. Boards that require extra platform code can add extra Kconfig entries.
Quoted 6 lines
arch/powerpc/platforms/512x/Makefile +0
-0@@ -1,4 +1,4 @@ #
arch/powerpc/platforms/512x/Makefile
Quoted 10 lines
arch/powerpc/platforms/512x/Makefile +7
-1# Makefile for the Freescale PowerPC 512x linux kernel. # -obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o +obj-$(CONFIG_MPC5121_GENERIC) += mpc5121_generic.o +static int __init mpc5121_generic_probe(void) +{ + unsigned long root = of_get_flat_dt_root(); + + return of_flat_dt_is_compatible(root, "fsl,mpc5121ads") || + of_flat_dt_is_compatible(root, "prt,prtlvt");
This list is just going to get bigger. Maybe consider a list like is used in arch/powerpc/platforms/52xx/mpc5200_simple.c
Otherwise, this patch is looking pretty good.
Cheers,
g.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.