mpc83xx: MPC8360E-RDK related patches
Subsystems (3)
v2 cover mpc83xx: MPC8360E-RDK related patches
Hi all,
Here are few patches needed to support MPC8360E-RDK...
Thanks,
Signature · 4 lines
Anton Vorontsov email: cbou at mail.ru backup email: ya-cbou at yandex.ru irc://irc.freenode.net/bd2
PATCH v2 1/5 mpc83xx: add "fsl, qe" compatible fixups
New device trees will use "fsl,qe" compatible properties.
--- cpu/mpc83xx/fdt.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
cpu/mpc83xx/fdt.c +6 -0
@@ -52,6 +52,12 @@ void ft_cpu_setup(void *blob, bd_t *bd) "bus-frequency", gd->qe_clk, 1);do_fixup_by_prop_u32 (blob,"device_type" ,"qe" ,4 ,"brg-frequency" , gd->brg_clk,1 ); +do_fixup_by_compat_u32 (blob,"fsl,qe" , +"clock-frequency" , gd->qe_clk,1 ); +do_fixup_by_compat_u32 (blob,"fsl,qe" , +"bus-frequency" , gd->qe_clk,1 ); +do_fixup_by_compat_u32 (blob,"fsl,qe" , +"brg-frequency" , gd->brg_clk,1 );#endif #ifdef CFG_NS16550
Signature · 1 line
1.5.2.2
PATCH v2 2/5 mpc83xx: add support for the MPC8360E-RDK
In reply to Anton VorontsovThis is MPC8360E based board with:
- 256MB fixed SDRAM;
- 8MB Intel Strata NOR flash;
- StMICRO 64MiB NAND flash;
- two 10/100/1000 ethernet ports connected via Broadcom BCM5481 PHYs;
- two 10/100 ethernet ports connected via National DP83848 PHYs;
- one PCI and one miniPCI slots;
- four serial ports (two NS16550-compatible, two UCCs);
- four USB ports working through MPC8360E "FHCI" USB controller;
- Fujitsu MB86277 graphics controller;
- Analog to Digital Converter/Touchscreen controller, AD7843 connected to SPI.
Features not supported in this patch are:
- StMICRO 64MiB NAND flash (patch sent);
- MINT framebuffer initialization (patch is pending);
- Fetching production information from the EEPROM via I2C;
- FHCI USB;
- Two slow UCCs used as RS-485 UARTs.
--- MAINTAINERS | 4 + MAKEALL | 2 + Makefile | 11 + board/freescale/mpc8360erdk/Makefile | 50 +++ board/freescale/mpc8360erdk/config.mk | 28 ++ board/freescale/mpc8360erdk/mpc8360erdk.c | 340 ++++++++++++++++++ include/configs/MPC8360ERDK.h | 538 +++++++++++++++++++++++++++++ 7 files changed, 973 insertions(+), 0 deletions(-) create mode 100644 board/freescale/mpc8360erdk/Makefile create mode 100644 board/freescale/mpc8360erdk/config.mk create mode 100644 board/freescale/mpc8360erdk/mpc8360erdk.c create mode 100644 include/configs/MPC8360ERDK.h
MAINTAINERS +4 -0
@@ -366,6 +366,10 @@ David Updegraff <[email protected]> CRAYL1 PPC4xx +Anton Vorontsov <[email protected]> + + MPC8360ERDK MPC8360 + Josef Wagner <[email protected]> CPC45 MPC8245
MAKEALL +2 -0
@@ -313,6 +313,8 @@ LIST_83xx=" \ MPC8349ITXGP \ MPC8360EMDS \ MPC8360EMDS_ATM \ + MPC8360ERDK_33 \ + MPC8360ERDK_66 \ MPC837XEMDS \ sbc8349 \ TQM834x \
Makefile +11 -0
@@ -1922,6 +1922,17 @@ MPC8360EMDS_ATM_config: unconfig fi ; @$(MKCONFIG) -a MPC8360EMDS ppc mpc83xx mpc8360emds freescale +MPC8360ERDK_33_config \ +MPC8360ERDK_66_config \ +MPC8360ERDK_config: + @mkdir -p $(obj)include + @echo "" >$(obj)include/config.h ; \ + if [ "$(findstring _33_,$@)" ] ; then \ + echo -n "... CLKIN 33MHz " ; \ + echo "#define CONFIG_CLKIN_33MHZ" >>$(obj)include/config.h ;\ + fi ; + @$(MKCONFIG) -a MPC8360ERDK ppc mpc83xx mpc8360erdk freescale + MPC837XEMDS_config \ MPC837XEMDS_HOST_config: unconfig @mkdir -p $(obj)include
board/freescale/mpc8360erdk/Makefile new file +50 -0
50 lines not on this page · raw message
board/freescale/mpc8360erdk/config.mk new file +28 -0
@@ -0,0 +1,28 @@ +# +# (C) Copyright 2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +# +# MPC8360ERDK +# + +TEXT_BASE = 0xFF800000
board/freescale/mpc8360erdk/mpc8360erdk.c new file +340 -0
340 lines not on this page · raw message
include/configs/MPC8360ERDK.h new file +538 -0
538 lines not on this page · raw message
Signature · 1 line
1.5.2.2
PATCH v2 3/5 nand: FSL UPM NAND driver
In reply to Anton Vorontsov--- drivers/mtd/nand/Makefile | 2 + drivers/mtd/nand/fsl_upm.c | 188 +++++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/fsl_upm.h | 34 ++++++++ 3 files changed, 224 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/nand/fsl_upm.c create mode 100644 include/linux/mtd/fsl_upm.h
drivers/mtd/nand/Makefile +2 -0
@@ -32,6 +32,8 @@ COBJS-y += nand_ecc.o COBJS-y += nand_bbt.o COBJS-y += nand_util.o +COBJS-y += fsl_upm.o + COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
drivers/mtd/nand/fsl_upm.c new file +188 -0
188 lines not on this page · raw message
include/linux/mtd/fsl_upm.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* FSL UPM NAND driver +* +* Copyright (C) 2007 MontaVista Software, Inc. +* Anton Vorontsov <[email protected]> +* +* 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. +*/ + +#ifndef __LINUX_MTD_NAND_FSL_UPM +#define __LINUX_MTD_NAND_FSL_UPM + +#include <linux/mtd/nand.h> + +struct upm_data { +int width; +void *base; +void *upm_mxmr; +void *upm_mdr; +void *upm_mar; +u32 *upm_table; +int upm_cmd_offset; +int upm_addr_offset; +int wait_pattern; +int (*dev_ready)(void ); +int chip_delay; +}; + +extern int fsl_upm_nand_init (struct nand_chip *chip,struct upm_data *ud); + +#endif
Signature · 1 line
1.5.2.2
PATCH 3/5 nand: FSL UPM NAND driver
Quoted 1 line · Anton Vorontsov
Signed-off-by Anton Vorontsov <[email protected]>
This seems to be based on the current NAND infrastructure. You might have noticed that I'm trying right now to merge the patches from William Yuul with the Linux 2.6.22 based NAND subsystem. There will be small changes needed on the driver. Please take a look at the u-boot-nand-flash custodian repository and rebase your patch against this.
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH v2 3/5 nand: FSL UPM NAND driver
Quoted 6 lines · Stefan Roese
Quoted 1 line · Anton Vorontsov
Signed-off-by Anton Vorontsov <[email protected]>This seems to be based on the current NAND infrastructure. You might have noticed that I'm trying right now to merge the patches from William Yuul with the Linux 2.6.22 based NAND subsystem.
This is great news. Though, using u-boot-nand-flash tree I see that write.jffs2 isn't actually working (bad blocks skipping unimplemented), and read.jffs2 is unimplemented in whole...
Without .jffs2 variants nand support is almost useless. :-/ Unfortunately I don't have much time to help you with these updating efforts, implementing .jffs2... so I'd be glad if you'll ack second version of the patch[1] so we'll able to use it today with old nand layer. And I'll provide another patch[2] for your tree, that will update fsl_upm to use new infrastructure (tested to work on good blocks).
Will send [1] and [2] real soon now.
Thanks.
PATCH v2 1/2 nand: FSL UPM NAND driver
--- drivers/mtd/nand/Makefile | 2 + drivers/mtd/nand/fsl_upm.c | 201 +++++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/fsl_upm.h | 39 ++++++++ 3 files changed, 242 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/nand/fsl_upm.c create mode 100644 include/linux/mtd/fsl_upm.h
drivers/mtd/nand/Makefile +2 -0
@@ -32,6 +32,8 @@ COBJS-y += nand_ecc.o COBJS-y += nand_bbt.o COBJS-y += nand_util.o +COBJS-y += fsl_upm.o + COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
drivers/mtd/nand/fsl_upm.c new file +201 -0
201 lines not on this page · raw message
include/linux/mtd/fsl_upm.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* FSL UPM NAND driver +* +* Copyright (C) 2007 MontaVista Software, Inc. +* Anton Vorontsov <[email protected]> +* +* 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. +*/ + +#ifndef __LINUX_MTD_NAND_FSL_UPM +#define __LINUX_MTD_NAND_FSL_UPM + +#include <linux/mtd/nand.h> + +struct fsl_upm { +const u32 *array; +void __iomem *mdr; +void __iomem *mxmr; +void __iomem *mar; +void __iomem *io_addr; +}; + +struct fsl_upm_nand { +struct fsl_upm upm; + +int width; +int upm_cmd_offset; +int upm_addr_offset; +int wait_pattern; +int (*dev_ready)(void ); +int chip_delay; +}; + +extern int fsl_upm_nand_init (struct nand_chip *chip,struct fsl_upm_nand *fun); + +#endif
Signature · 1 line
1.5.2.2
Stefan Roese
AppliedPATCH v2 1/2 nand: FSL UPM NAND driver
Quoted 1 line · Anton Vorontsov
Signed-off-by Anton Vorontsov <[email protected]>
Applied, thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH v2 2/2 mpc83xx: MPC8360E-RDK: add support for NAND
In reply to Anton Vorontsov--- board/freescale/mpc8360erdk/Makefile | 2 +- board/freescale/mpc8360erdk/nand.c | 75 ++++++++++++++++++++++++++++++++++ include/configs/MPC8360ERDK.h | 24 +++++++++++ 3 files changed, 100 insertions(+), 1 deletions(-) create mode 100644 board/freescale/mpc8360erdk/nand.c
board/freescale/mpc8360erdk/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o +COBJS := $(BOARD).o nand.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
board/freescale/mpc8360erdk/nand.c new file +75 -0
75 lines not on this page · raw message
include/configs/MPC8360ERDK.h +24 -0
@@ -186,6 +186,11 @@* NAND flash on the local bus */ #define CFG_NAND_BASE 0x60000000 +#define CONFIG_CMD_NAND 1 +#define CONFIG_NAND_FSL_UPM 1 +#define CFG_MAX_NAND_DEVICE 1 +#define NAND_MAX_CHIPS 1 +#define CONFIG_MTD_NAND_VERIFY_WRITE #define CFG_LBLAWBAR1_PRELIM CFG_NAND_BASE#define CFG_LBLAWAR1_PRELIM 0x8000001b/* Access window size 4K */
@@ -514,23 +519,42 @@"fdtfile=dtb\0" \"fsfile=fs\0" \"ubootfile=u-boot.bin\0" \ +"mtdparts=mtdparts=60000000.nand-flash:4096k(kernel),128k(dtb),-(rootfs)\0" \"setbootargs=setenv bootargs console=$consoledev,$baudrate " \"$mtdparts panic=1\0" \"adddhcpargs=setenv bootargs $bootargs ip=on\0" \"addnfsargs=setenv bootargs $bootargs ip=$ipaddr:$serverip:" \"$gatewayip:$netmask:$hostname:$netdev:off " \"root=/dev/nfs rw nfsroot=$serverip:$rootpath\0" \ +"addnandargs=setenv bootargs $bootargs root=/dev/mtdblock3 " \ +"rootfstype=jffs2 rw\0" \"tftp_get_uboot=tftp 100000 $ubootfile\0" \"tftp_get_kernel=tftp $loadaddr $bootfile\0" \"tftp_get_dtb=tftp $fdtaddr $fdtfile\0" \"tftp_get_fs=tftp c00000 $fsfile\0" \ +"nand_erase_kernel=nand erase 0 400000\0" \ +"nand_erase_dtb=nand erase 400000 20000\0" \ +"nand_erase_fs=nand erase 420000 3be0000\0" \ +"nand_write_kernel=nand write.jffs2 $loadaddr 0 400000\0" \ +"nand_write_dtb=nand write.jffs2 $fdtaddr 400000 20000\0" \ +"nand_write_fs=nand write.jffs2 c00000 420000 $filesize\0" \ +"nand_read_kernel=nand read.jffs2 $loadaddr 0 400000\0" \ +"nand_read_dtb=nand read.jffs2 $fdtaddr 400000 20000\0" \"nor_reflash=protect off ff800000 ff87ffff ; erase ff800000 ff87ffff ; " \"cp.b 100000 ff800000 $filesize\0" \ +"nand_reflash_kernel=run tftp_get_kernel nand_erase_kernel " \ +"nand_write_kernel\0" \ +"nand_reflash_dtb=run tftp_get_dtb nand_erase_dtb nand_write_dtb\0" \ +"nand_reflash_fs=run tftp_get_fs nand_erase_fs nand_write_fs\0" \ +"nand_reflash=run nand_reflash_kernel nand_reflash_dtb " \ +"nand_reflash_fs\0" \"boot_m=bootm $loadaddr - $fdtaddr\0" \"dhcpboot=run setbootargs adddhcpargs tftp_get_kernel tftp_get_dtb " \"boot_m\0" \"nfsboot=run setbootargs addnfsargs tftp_get_kernel tftp_get_dtb " \"boot_m\0" \ +"nandboot=run setbootargs addnandargs nand_read_kernel nand_read_dtb " \ +"boot_m\0" \"" #define CONFIG_BOOTCOMMAND "run dhcpboot"
Signature · 1 line
1.5.2.2
PATCH 1/1 nand: fsl_upm: convert to updated MTD NAND infrastructure
In reply to Anton Vorontsov--- drivers/mtd/nand/fsl_upm.c | 68 +++++++++++-------------------------------- include/linux/mtd/fsl_upm.h | 3 ++ 2 files changed, 20 insertions(+), 51 deletions(-)
drivers/mtd/nand/fsl_upm.c +17 -51
@@ -61,51 +61,28 @@ static void fsl_upm_setup(struct fsl_upm *upm)eieio (); } -static void fun_cmdfunc (struct mtd_info *mtd,unsigned command,int column, -int page_addr) +static void fun_cmd_ctrl (struct mtd_info *mtd,int cmd,unsigned int ctrl) {struct nand_chip *chip = mtd->priv;struct fsl_upm_nand *fun = chip->priv; -fsl_upm_start_pattern (&fun->upm, fun->upm_cmd_offset); - -if (command ==NAND_CMD_SEQIN ) { -int readcmd; - -if (column >= mtd->oobblock) { -/* OOB area */ - column -= mtd->oobblock; - readcmd =NAND_CMD_READOOB ; - }else if (column <256 ) { -/* First 256 bytes --> READ0 */ - readcmd =NAND_CMD_READ0 ; - }else { - column -=256 ; - readcmd =NAND_CMD_READ1 ; - } -fsl_upm_run_pattern (&fun->upm, fun->width, readcmd); - } - -fsl_upm_run_pattern (&fun->upm, fun->width, command); +if (!(ctrl & fun->last_ctrl)) { +fsl_upm_end_pattern (&fun->upm); -fsl_upm_end_pattern (&fun->upm); +if (cmd ==NAND_CMD_NONE ) +return ; -fsl_upm_start_pattern (&fun->upm, fun->upm_addr_offset); - -if (column !=-1 ) -fsl_upm_run_pattern (&fun->upm, fun->width, column); + fun->last_ctrl = ctrl & (NAND_ALE |NAND_CLE ); + } -if (page_addr !=-1 ) { -fsl_upm_run_pattern (&fun->upm, fun->width, page_addr); -fsl_upm_run_pattern (&fun->upm, fun->width, - (page_addr >>8 ) &0xFF ); -if (chip->chipsize > (32 <<20 )) { -fsl_upm_run_pattern (&fun->upm, fun->width, - (page_addr >>16 ) &0x0f ); - } +if (ctrl &NAND_CTRL_CHANGE ) { +if (ctrl &NAND_ALE ) +fsl_upm_start_pattern (&fun->upm, fun->upm_addr_offset); +else if (ctrl &NAND_CLE ) +fsl_upm_start_pattern (&fun->upm, fun->upm_cmd_offset); } -fsl_upm_end_pattern (&fun->upm); +fsl_upm_run_pattern (&fun->upm, fun->width, cmd);if (fun->wait_pattern) {/*
@@ -119,13 +96,6 @@ static void fun_cmdfunc(struct mtd_info *mtd, unsigned command, int column, } } -static void nand_write_byte (struct mtd_info *mtd,u_char byte) -{ -struct nand_chip *chip = mtd->priv; - -out_8 (chip->IO_ADDR_W, byte); -} -static u8 nand_read_byte (struct mtd_info *mtd) {struct nand_chip *chip = mtd->priv;
@@ -164,10 +134,6 @@ static int nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)return 0 ; } -static void nand_hwcontrol (struct mtd_info *mtd,int cmd) -{ -} -static int nand_dev_ready (struct mtd_info *mtd) {struct nand_chip *chip = mtd->priv;
@@ -184,14 +150,14 @@ int fsl_upm_nand_init(struct nand_chip *chip, struct fsl_upm_nand *fun)fsl_upm_setup (&fun->upm); + fun->last_ctrl =NAND_CLE ; + chip->priv = fun; chip->chip_delay = fun->chip_delay; - chip->eccmode =NAND_ECC_SOFT ; - chip->cmdfunc = fun_cmdfunc; - chip->hwcontrol = nand_hwcontrol; + chip->ecc.mode =NAND_ECC_SOFT ; + chip->cmd_ctrl = fun_cmd_ctrl; chip->read_byte = nand_read_byte; chip->read_buf = nand_read_buf; - chip->write_byte = nand_write_byte; chip->write_buf = nand_write_buf; chip->verify_buf = nand_verify_buf; chip->dev_ready = nand_dev_ready;
include/linux/mtd/fsl_upm.h +3 -0
@@ -32,6 +32,9 @@ struct fsl_upm_nand {int wait_pattern;int (*dev_ready)(void );int chip_delay; + +/* no need to fill */ +int last_ctrl; };extern int fsl_upm_nand_init (struct nand_chip *chip,struct fsl_upm_nand *fun);
Signature · 1 line
1.5.2.2
Stefan Roese
AppliedPATCH 1/1 nand: fsl_upm: convert to updated MTD NAND infrastructure
Quoted 1 line · Anton Vorontsov
Signed-off-by Anton Vorontsov <[email protected]>
Applied to new "mtd-2.6.22.1" branch. Will push to git server in a short while.
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 3/5 nand: FSL UPM NAND driver
In reply to Anton VorontsovQuoted 8 lines · Anton Vorontsov
Quoted 6 lines · Stefan Roese
Quoted 1 line · Anton Vorontsov
Signed-off-by Anton Vorontsov <[email protected]>This seems to be based on the current NAND infrastructure. You might have noticed that I'm trying right now to merge the patches from William Yuul with the Linux 2.6.22 based NAND subsystem.
Quoted 5 lines
This is great news. Though, using u-boot-nand-flash tree I see that write.jffs2 isn't actually working (bad blocks skipping unimplemented), and read.jffs2 is unimplemented in whole...
Without .jffs2 variants nand support is almost useless. :-/
Yes, I was thinking how we should handle this NAND MTD update currently. I'll post a different mail about this in a short while.
Quoted 8 lines
Unfortunately
I don't have much time to help you with these updating efforts, implementing .jffs2... so I'd be glad if you'll ack second version of the patch[1] so we'll able to use it today with old nand layer. And I'll provide another patch[2] for your tree, that will updatefsl_upmto use new infrastructure (tested to work on good blocks).Will send [1] and [2] real soon now.
OK, if we all agree on how to handle the switch to the new NAND MTD subsystem (see other mail), then I'll accept your NAND driver patch right now. Let's wait how this discussion evolves.
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH v2 4/5 mpc83xx: MPC8360E-RDK: add support for NAND
In reply to Anton Vorontsov--- board/freescale/mpc8360erdk/Makefile | 2 +- board/freescale/mpc8360erdk/nand.c | 73 ++++++++++++++++++++++++++++++++++ include/configs/MPC8360ERDK.h | 24 +++++++++++ 3 files changed, 98 insertions(+), 1 deletions(-) create mode 100644 board/freescale/mpc8360erdk/nand.c
board/freescale/mpc8360erdk/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o +COBJS := $(BOARD).o nand.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
board/freescale/mpc8360erdk/nand.c new file +73 -0
73 lines not on this page · raw message
include/configs/MPC8360ERDK.h +24 -0
@@ -185,7 +185,12 @@/* * NAND flash on the local bus */ +#define CONFIG_CMD_NAND 1 +#define CONFIG_NAND_FSL_UPM 1#define CFG_NAND_BASE 0x60000000 +#define CFG_MAX_NAND_DEVICE 1 +#define NAND_MAX_CHIPS 1 +#define CONFIG_MTD_NAND_VERIFY_WRITE #define CFG_LBLAWBAR1_PRELIM CFG_NAND_BASE#define CFG_LBLAWAR1_PRELIM 0x8000001b/* Access window size 4K */
@@ -514,23 +519,42 @@"fdtfile=dtb\0" \"fsfile=fs\0" \"ubootfile=u-boot.bin\0" \ +"mtdparts=mtdparts=60000000.nand-flash:4096k(kernel),128k(dtb),-(rootfs)\0" \"setbootargs=setenv bootargs console=$consoledev,$baudrate " \"$mtdparts panic=1\0" \"adddhcpargs=setenv bootargs $bootargs ip=on\0" \"addnfsargs=setenv bootargs $bootargs ip=$ipaddr:$serverip:" \"$gatewayip:$netmask:$hostname:$netdev:off " \"root=/dev/nfs rw nfsroot=$serverip:$rootpath\0" \ +"addnandargs=setenv bootargs $bootargs root=/dev/mtdblock3 " \ +"rootfstype=jffs2 rw\0" \"tftp_get_uboot=tftp 100000 $ubootfile\0" \"tftp_get_kernel=tftp $loadaddr $bootfile\0" \"tftp_get_dtb=tftp $fdtaddr $fdtfile\0" \"tftp_get_fs=tftp c00000 $fsfile\0" \ +"nand_erase_kernel=nand erase 0 400000\0" \ +"nand_erase_dtb=nand erase 400000 20000\0" \ +"nand_erase_fs=nand erase 420000 3be0000\0" \ +"nand_write_kernel=nand write.jffs2 $loadaddr 0 400000\0" \ +"nand_write_dtb=nand write.jffs2 $fdtaddr 400000 20000\0" \ +"nand_write_fs=nand write.jffs2 c00000 420000 $filesize\0" \ +"nand_read_kernel=nand read.jffs2 $loadaddr 0 400000\0" \ +"nand_read_dtb=nand read.jffs2 $fdtaddr 400000 20000\0" \"nor_reflash=protect off ff800000 ff87ffff ; erase ff800000 ff87ffff ; " \"cp.b 100000 ff800000 $filesize\0" \ +"nand_reflash_kernel=run tftp_get_kernel nand_erase_kernel " \ +"nand_write_kernel\0" \ +"nand_reflash_dtb=run tftp_get_dtb nand_erase_dtb nand_write_dtb\0" \ +"nand_reflash_fs=run tftp_get_fs nand_erase_fs nand_write_fs\0" \ +"nand_reflash=run nand_reflash_kernel nand_reflash_dtb " \ +"nand_reflash_fs\0" \"boot_m=bootm $loadaddr - $fdtaddr\0" \"dhcpboot=run setbootargs adddhcpargs tftp_get_kernel tftp_get_dtb " \"boot_m\0" \"nfsboot=run setbootargs addnfsargs tftp_get_kernel tftp_get_dtb " \"boot_m\0" \ +"nandboot=run setbootargs addnandargs nand_read_kernel nand_read_dtb " \ +"boot_m\0" \"" #define CONFIG_BOOTCOMMAND "run dhcpboot"
Signature · 1 line
1.5.2.2
PATCH v2 4/5 mpc83xx: MPC8360E-RDK: add support for NAND
Quoted 9 lines · On Wed, 9 Jan 2008 20:57:58 +0300 Anton Vorontsov <[email protected]>…
Signed-off-by Anton Vorontsov <[email protected]>--- board/freescale/mpc8360erdk/Makefile | 2 +- board/freescale/mpc8360erdk/nand.c | 73 ++++++++++++++++++++++++++++++++++ include/configs/MPC8360ERDK.h | 24 +++++++++++ 3 files changed, 98 insertions(+), 1 deletions(-) create mode 100644 board/freescale/mpc8360erdk/nand.c
Hello Anton, since WD pulled the upm nand driver, I assumed this would apply, but it fails to build:
nand.c:55: error: variable 'ud' has initializer but incomplete type nand.c:56: error: unknown field 'width' specified in initializer
nand.c:56: warning: excess elements in struct initializer
nand.c:56: warning: (near initialization for 'ud')
nand.c:57: error: unknown field 'base' specified in initializer
nand.c:57: warning: excess elements in struct initializer
nand.c:57: warning: (near initialization for 'ud')
nand.c:58: error: unknown field 'upm_table' specified in initializer nand.c:58: warning: excess elements in struct initializer
nand.c:58: warning: (near initialization for 'ud')
nand.c:59: error: unknown field 'upm_cmd_offset' specified in initializer nand.c:59: warning: excess elements in struct initializer
nand.c:59: warning: (near initialization for 'ud')
nand.c:60: error: unknown field 'upm_addr_offset' specified in initializer nand.c:60: warning: excess elements in struct initializer
nand.c:60: warning: (near initialization for 'ud')
nand.c:61: error: unknown field 'dev_ready' specified in initializer nand.c:61: warning: excess elements in struct initializer
nand.c:61: warning: (near initialization for 'ud')
nand.c:62: error: unknown field 'wait_pattern' specified in initializer nand.c:62: warning: excess elements in struct initializer
nand.c:62: warning: (near initialization for 'ud')
nand.c:63: error: unknown field 'chip_delay' specified in initializer nand.c:63: warning: excess elements in struct initializer
nand.c:63: warning: (near initialization for 'ud')nand.c: In function 'board_nand_init':
nand.c:68: error: invalid use of undefined type 'struct upm_data'
nand.c:69: error: invalid use of undefined type 'struct upm_data'
nand.c:70: error: invalid use of undefined type 'struct upm_data'
nand.c:71: warning: passing argument 2 of 'fsl_upm_nand_init' from incompatible pointer type
can you rebase and resend?
Kim
PATCH v2 4/5 mpc83xx: MPC8360E-RDK: add support for NAND
Quoted 12 lines · Kim Phillips
Quoted 9 lines · On Wed, 9 Jan 2008 20:57:58 +0300 Anton Vorontsov <[email protected]>…
Signed-off-by Anton Vorontsov <[email protected]>--- board/freescale/mpc8360erdk/Makefile | 2 +- board/freescale/mpc8360erdk/nand.c | 73 ++++++++++++++++++++++++++++++++++ include/configs/MPC8360ERDK.h | 24 +++++++++++ 3 files changed, 98 insertions(+), 1 deletions(-) create mode 100644 board/freescale/mpc8360erdk/nand.c
Quoted 2 lines
Hello Anton, since WD pulled the upm nand driver, I assumed this would apply, but it fails to build:
You're trying to apply v1. I've sent v2 driver & RDK support on Monday 14. Ok, let's duplicate it. ;-)
- - - -
Date: Mon, 14 Jan 2008 23:09:45 +0300
Message-ID: <[email protected]>
From: Anton Vorontsov <[email protected]>
To: Kim Phillips <[email protected]>
Cc: Peter Barada <[email protected]>, Stefan Roese <[email protected]>, u-boot-users at lists.sourceforge.net
Subject: [U-Boot-Users] [PATCH v2 2/2] mpc83xx: MPC8360E-RDK: add support for NAND
--- board/freescale/mpc8360erdk/Makefile | 2 +- board/freescale/mpc8360erdk/nand.c | 75 ++++++++++++++++++++++++++++++++++ include/configs/MPC8360ERDK.h | 24 +++++++++++ 3 files changed, 100 insertions(+), 1 deletions(-) create mode 100644 board/freescale/mpc8360erdk/nand.c
board/freescale/mpc8360erdk/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o +COBJS := $(BOARD).o nand.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
board/freescale/mpc8360erdk/nand.c new file +75 -0
75 lines not on this page · raw message
include/configs/MPC8360ERDK.h +24 -0
@@ -186,6 +186,11 @@* NAND flash on the local bus */ #define CFG_NAND_BASE 0x60000000 +#define CONFIG_CMD_NAND 1 +#define CONFIG_NAND_FSL_UPM 1 +#define CFG_MAX_NAND_DEVICE 1 +#define NAND_MAX_CHIPS 1 +#define CONFIG_MTD_NAND_VERIFY_WRITE #define CFG_LBLAWBAR1_PRELIM CFG_NAND_BASE#define CFG_LBLAWAR1_PRELIM 0x8000001b/* Access window size 4K */
@@ -514,23 +519,42 @@"fdtfile=dtb\0" \"fsfile=fs\0" \"ubootfile=u-boot.bin\0" \ +"mtdparts=mtdparts=60000000.nand-flash:4096k(kernel),128k(dtb),-(rootfs)\0" \"setbootargs=setenv bootargs console=$consoledev,$baudrate " \"$mtdparts panic=1\0" \"adddhcpargs=setenv bootargs $bootargs ip=on\0" \"addnfsargs=setenv bootargs $bootargs ip=$ipaddr:$serverip:" \"$gatewayip:$netmask:$hostname:$netdev:off " \"root=/dev/nfs rw nfsroot=$serverip:$rootpath\0" \ +"addnandargs=setenv bootargs $bootargs root=/dev/mtdblock3 " \ +"rootfstype=jffs2 rw\0" \"tftp_get_uboot=tftp 100000 $ubootfile\0" \"tftp_get_kernel=tftp $loadaddr $bootfile\0" \"tftp_get_dtb=tftp $fdtaddr $fdtfile\0" \"tftp_get_fs=tftp c00000 $fsfile\0" \ +"nand_erase_kernel=nand erase 0 400000\0" \ +"nand_erase_dtb=nand erase 400000 20000\0" \ +"nand_erase_fs=nand erase 420000 3be0000\0" \ +"nand_write_kernel=nand write.jffs2 $loadaddr 0 400000\0" \ +"nand_write_dtb=nand write.jffs2 $fdtaddr 400000 20000\0" \ +"nand_write_fs=nand write.jffs2 c00000 420000 $filesize\0" \ +"nand_read_kernel=nand read.jffs2 $loadaddr 0 400000\0" \ +"nand_read_dtb=nand read.jffs2 $fdtaddr 400000 20000\0" \"nor_reflash=protect off ff800000 ff87ffff ; erase ff800000 ff87ffff ; " \"cp.b 100000 ff800000 $filesize\0" \ +"nand_reflash_kernel=run tftp_get_kernel nand_erase_kernel " \ +"nand_write_kernel\0" \ +"nand_reflash_dtb=run tftp_get_dtb nand_erase_dtb nand_write_dtb\0" \ +"nand_reflash_fs=run tftp_get_fs nand_erase_fs nand_write_fs\0" \ +"nand_reflash=run nand_reflash_kernel nand_reflash_dtb " \ +"nand_reflash_fs\0" \"boot_m=bootm $loadaddr - $fdtaddr\0" \"dhcpboot=run setbootargs adddhcpargs tftp_get_kernel tftp_get_dtb " \"boot_m\0" \"nfsboot=run setbootargs addnfsargs tftp_get_kernel tftp_get_dtb " \"boot_m\0" \ +"nandboot=run setbootargs addnandargs nand_read_kernel nand_read_dtb " \ +"boot_m\0" \"" #define CONFIG_BOOTCOMMAND "run dhcpboot"
Signature · 1 line
1.5.2.2
PATCH v2 5/5 mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
In reply to Anton VorontsovThis patch adds basic support for Broadcom BCM5481 PHY, with the quirk needed for at least MPC8360E-RDK.
Quirk comes from MPC8360E-RDK BSP source, I think author is Peter Barada <[email protected]>, but I'm not sure.
There are no openly available specifications for that PHY.
--- drivers/qe/uec_phy.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/qe/uec_phy.h | 5 +++ 2 files changed, 82 insertions(+), 0 deletions(-)
drivers/qe/uec_phy.c +77 -0
@@ -237,6 +237,44 @@ static int gbit_config_aneg (struct uec_mii_info *mii_info)return 0 ; } +static int gbit_read_status (struct uec_mii_info *mii_info) +{ +u16 status; +int err; + + err =genmii_update_link (mii_info); +if (err) +return err; + +if (mii_info->autoneg) { + mii_info->pause =0 ; + status =phy_read (mii_info,MII_1000BASETSTATUS ); +if (status & (LPA_1000FULL |LPA_1000HALF )) { + mii_info->speed =SPEED_1000 ; +if (status &LPA_1000FULL ) + mii_info->duplex =DUPLEX_FULL ; +else + mii_info->duplex =DUPLEX_HALF ; + }else { + status =phy_read (mii_info,PHY_ANLPAR ); + +if (status & (PHY_ANLPAR_10FD |PHY_ANLPAR_TXFD )) + mii_info->duplex =DUPLEX_FULL ; +else + mii_info->duplex =DUPLEX_HALF ; +if (status & (PHY_ANLPAR_TXFD |PHY_ANLPAR_TX )) + mii_info->speed =SPEED_100 ; +else + mii_info->speed =SPEED_10 ; + } + } +/* +* On non-aneg, we assume what we put in BMCR is the speed, +* though magic-aneg shouldn't prevent this case from occurring. +*/ +return 0 ; +} +static int marvell_config_aneg (struct uec_mii_info *mii_info) {/* The Marvell PHY has an errata which requires
@@ -319,6 +357,35 @@ static int genmii_read_status (struct uec_mii_info *mii_info)return 0 ; } +static int bcm_init (struct uec_mii_info *mii_info) +{ +gbit_config_aneg (mii_info); + +#ifdef CONFIG_MPC8360ERDK + { +u16 val; +int cnt =50 ; + +/* Wait for aneg to complete. */ +do + val =phy_read (mii_info,PHY_BMSR ); +while (--cnt && !(val &PHY_BMSR_AUTN_COMP )); + +/* Set RDX clk delay. */ +phy_write (mii_info,0x18 ,0x7 | (7 <<12 )); + + val =phy_read (mii_info,0x18 ); +/* Set RDX-RXC skew. */ + val |= (1 <<8 ); + val |= (7 | (7 <<12 )); +/* Write bits 14:0. */ + val |= (1 <<15 ); +phy_write (mii_info,0x18 , val); + } +#endif +return 0 ; +} +static int marvell_read_status (struct uec_mii_info *mii_info) {u16 status;
@@ -491,6 +558,15 @@ static struct phy_info phy_info_marvell = { .config_intr = &marvell_config_intr, }; +static struct phy_info phy_info_bcm5481 = { + .phy_id =0x0143bca0 , + .phy_id_mask =0xffffff0 , + .name ="Broadcom 5481" , + .features =MII_GBIT_FEATURES , + .read_status = gbit_read_status, + .init = bcm_init, +}; +static struct phy_info phy_info_genmii = { .phy_id =0x00000000 , .phy_id_mask =0x00000000 ,
@@ -504,6 +580,7 @@ static struct phy_info *phy_info[] = { &phy_info_dm9161, &phy_info_dm9161a, &phy_info_marvell, + &phy_info_bcm5481, &phy_info_genmii, NULL };
drivers/qe/uec_phy.h +5 -0
@@ -29,6 +29,11 @@#define MII_1000BASETCONTROL_FULLDUPLEXCAP 0x0200#define MII_1000BASETCONTROL_HALFDUPLEXCAP 0x0100 +/* 1000BT status */ +#define MII_1000BASETSTATUS 0x0a +#define LPA_1000FULL 0x0400 +#define LPA_1000HALF 0x0200 +/* Cicada Extended Control Register 1 */ #define MII_CIS8201_EXT_CON1 0x17#define MII_CIS8201_EXTCON1_INIT 0x0000
Signature · 1 line
1.5.2.2
PATCH 5/5 mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
Quoted 51 lines · Anton Vorontsov
This patch adds basic support for Broadcom BCM5481 PHY, with the quirk needed for at least MPC8360E-RDK.
Quirk comes from MPC8360E-RDK BSP source, I think author is Peter Barada <[email protected]>, but I'm not sure.
There are no openly available specifications for that PHY.
Signed-off-by Anton Vorontsov <[email protected]>--- drivers/qe/uec_phy.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/qe/uec_phy.h | 5 +++ 2 files changed, 82 insertions(+), 0 deletions(-)drivers/qe/uec_phy.c +29
-0@@ -237,6 +237,44 @@ static int gbit_config_aneg (struct uec_mii_info *mii_info)return 0 ; } +static int gbit_read_status (struct uec_mii_info *mii_info) +{ +u16 status; +int err; + + err =genmii_update_link (mii_info); +if (err) +return err; + +if (mii_info->autoneg) { + mii_info->pause =0 ; + status =phy_read (mii_info,MII_1000BASETSTATUS ); +if (status & (LPA_1000FULL |LPA_1000HALF )) { + mii_info->speed =SPEED_1000 ; +if (status &LPA_1000FULL ) + mii_info->duplex =DUPLEX_FULL ; +else + mii_info->duplex =DUPLEX_HALF ; + }else { + status =phy_read (mii_info,PHY_ANLPAR ); + +if (status & (PHY_ANLPAR_10FD |PHY_ANLPAR_TXFD )) + mii_info->duplex =DUPLEX_FULL ; +else + mii_info->duplex =DUPLEX_HALF ; +if (status & (PHY_ANLPAR_TXFD |PHY_ANLPAR_TX )) + mii_info->speed =SPEED_100 ; +else + mii_info->speed =SPEED_10 ;
drivers/qe/uec_phy.c static int gbit_config_aneg (struct uec_mii_info *mii_info) · line 278
Quoted 10 lines
drivers/qe/uec_phy.c +9
-0+ } + } +/* +* On non-aneg, we assume what we put in BMCR is the speed, +* though magic-aneg shouldn't prevent this case from occurring. +*/ +return 0 ; +} +
Please roll the 1Gb code into genmii_read_status. 10/100 PHYs should report 0 in theMII_1000BASETSTATUS register so it should work.
Quoted 24 lines
drivers/qe/uec_phy.c +0
-0static int marvell_config_aneg (struct uec_mii_info *mii_info) {drivers/qe/uec_phy.c +17
-0/* The Marvell PHY has an errata which requires @@ -319,6 +357,35 @@ static int genmii_read_status (struct uec_mii_info *mii_info)return 0 ; } +static int bcm_init (struct uec_mii_info *mii_info) +{ +gbit_config_aneg (mii_info); + +#ifdef CONFIG_MPC8360ERDK + { +u16 val; +int cnt =50 ; + +/* Wait for aneg to complete. */ +do + val =phy_read (mii_info,PHY_BMSR ); +while (--cnt && !(val &PHY_BMSR_AUTN_COMP )); + +/* Set RDX clk delay. */ +phy_write (mii_info,0x18 ,0x7 | (7 <<12 )); +
drivers/qe/uec_phy.c static int genmii_read_status (struct uec_mii_info *mii_info) · line 386
Quoted 10 lines
drivers/qe/uec_phy.c +9
-0+ val =phy_read (mii_info,0x18 ); +/* Set RDX-RXC skew. */ + val |= (1 <<8 ); + val |= (7 | (7 <<12 )); +/* Write bits 14:0. */ + val |= (1 <<15 ); + phy_write(mii_info, 0x18, val); + } +#endif
What is it that makes this specific to one board? Magic numbers are baaaad, especially for industry-standard memory maps (I'm thinking of offset 0x18 in case it's not obvious)
Quoted 47 lines
drivers/qe/uec_phy.c +3
-0+return 0 ; +} +static int marvell_read_status (struct uec_mii_info *mii_info) {drivers/qe/uec_phy.c +10
-0u16 status;@@ -491,6 +558,15 @@ static struct phy_info phy_info_marvell = { .config_intr = &marvell_config_intr, }; +static struct phy_info phy_info_bcm5481 = { + .phy_id =0x0143bca0 , + .phy_id_mask =0xffffff0 , + .name ="Broadcom 5481" , + .features =MII_GBIT_FEATURES , + .read_status = gbit_read_status, + .init = bcm_init, +}; +static struct phy_info phy_info_genmii = { .phy_id =0x00000000 , .phy_id_mask =0x00000000 ,@@ -504,6 +580,7 @@ static struct phy_info *phy_info[] = { &phy_info_dm9161, &phy_info_dm9161a, &phy_info_marvell, + &phy_info_bcm5481, &phy_info_genmii, NULL };drivers/qe/uec_phy.h +5
-0@@ -29,6 +29,11 @@#define MII_1000BASETCONTROL_FULLDUPLEXCAP 0x0200#define MII_1000BASETCONTROL_HALFDUPLEXCAP 0x0100 +/* 1000BT status */ +#define MII_1000BASETSTATUS 0x0a +#define LPA_1000FULL 0x0400 +#define LPA_1000HALF 0x0200 +/* Cicada Extended Control Register 1 */ #define MII_CIS8201_EXT_CON1 0x17#define MII_CIS8201_EXTCON1_INIT 0x0000
PATCH 5/5 mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
Quoted 94 lines · Ben Warren
Quoted 51 lines · Anton Vorontsov
This patch adds basic support for Broadcom BCM5481 PHY, with the quirk needed for at least MPC8360E-RDK.
Quirk comes from MPC8360E-RDK BSP source, I think author is Peter Barada <[email protected]>, but I'm not sure.
There are no openly available specifications for that PHY.
Signed-off-by Anton Vorontsov <[email protected]>--- drivers/qe/uec_phy.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/qe/uec_phy.h | 5 +++ 2 files changed, 82 insertions(+), 0 deletions(-)drivers/qe/uec_phy.c +29
-0@@ -237,6 +237,44 @@ static int gbit_config_aneg (struct uec_mii_info *mii_info)return 0 ; } +static int gbit_read_status (struct uec_mii_info *mii_info) +{ +u16 status; +int err; + + err =genmii_update_link (mii_info); +if (err) +return err; + +if (mii_info->autoneg) { + mii_info->pause =0 ; + status =phy_read (mii_info,MII_1000BASETSTATUS ); +if (status & (LPA_1000FULL |LPA_1000HALF )) { + mii_info->speed =SPEED_1000 ; +if (status &LPA_1000FULL ) + mii_info->duplex =DUPLEX_FULL ; +else + mii_info->duplex =DUPLEX_HALF ; + }else { + status =phy_read (mii_info,PHY_ANLPAR ); + +if (status & (PHY_ANLPAR_10FD |PHY_ANLPAR_TXFD )) + mii_info->duplex =DUPLEX_FULL ; +else + mii_info->duplex =DUPLEX_HALF ; +if (status & (PHY_ANLPAR_TXFD |PHY_ANLPAR_TX )) + mii_info->speed =SPEED_100 ; +else + mii_info->speed =SPEED_10 ;drivers/qe/uec_phy.c static int gbit_config_aneg (struct uec_mii_info *mii_info) · line 278
Quoted 10 lines
drivers/qe/uec_phy.c +9
-0+ } + } +/* +* On non-aneg, we assume what we put in BMCR is the speed, +* though magic-aneg shouldn't prevent this case from occurring. +*/ +return 0 ; +} +Please roll the 1Gb code into
genmii_read_status. 10/100 PHYs should report 0 in theMII_1000BASETSTATUSregister so it should work.Quoted 29 lines
drivers/qe/uec_phy.c +0
-0static int marvell_config_aneg (struct uec_mii_info *mii_info) {drivers/qe/uec_phy.c +22
-0/* The Marvell PHY has an errata which requires @@ -319,6 +357,35 @@ static int genmii_read_status (struct uec_mii_info *mii_info)return 0 ; } +static int bcm_init (struct uec_mii_info *mii_info) +{ +gbit_config_aneg (mii_info); + +#ifdef CONFIG_MPC8360ERDK + { +u16 val; +int cnt =50 ; + +/* Wait for aneg to complete. */ +do + val =phy_read (mii_info,PHY_BMSR ); +while (--cnt && !(val &PHY_BMSR_AUTN_COMP )); + +/* Set RDX clk delay. */ +phy_write (mii_info,0x18 ,0x7 | (7 <<12 )); + + val =phy_read (mii_info,0x18 ); +/* Set RDX-RXC skew. */ + val |= (1 <<8 ); + val |= (7 | (7 <<12 )); +/* Write bits 14:0. */
Quoted 8 lines
drivers/qe/uec_phy.c static int genmii_read_status (struct uec_mii_info *mii_info)
Quoted 5 lines
drivers/qe/uec_phy.c +4
-0+ val |= (1 <<15 ); + phy_write(mii_info, 0x18, val); + } +#endif What is it that makes this specific to one board? Magic numbers are baaaad, especially for industry-standard memory maps (I'm thinking of offset
0x18in case it's not obvious)
Its specific to the board, in that when hooked up via RGMII the setting in the PHY is required to supply adequate delay between the RXD and RXC signals instead of using trace lengths to achieve timing. I know magic numbers are baaaaad, but the PHY spec is only available under NDA and as such descriptions(including informative constants, etc) can not be disclosed. If it wasn't for this one register setting(after reset), the PHY, as used, wouldn't require any PHY-specific code(outside of ID'ng it as a 5481).
Quoted 48 lines
Quoted 47 lines
drivers/qe/uec_phy.c +3
-0+return 0 ; +} +static int marvell_read_status (struct uec_mii_info *mii_info) {drivers/qe/uec_phy.c +10
-0u16 status;@@ -491,6 +558,15 @@ static struct phy_info phy_info_marvell = { .config_intr = &marvell_config_intr, }; +static struct phy_info phy_info_bcm5481 = { + .phy_id =0x0143bca0 , + .phy_id_mask =0xffffff0 , + .name ="Broadcom 5481" , + .features =MII_GBIT_FEATURES , + .read_status = gbit_read_status, + .init = bcm_init, +}; +static struct phy_info phy_info_genmii = { .phy_id =0x00000000 , .phy_id_mask =0x00000000 ,@@ -504,6 +580,7 @@ static struct phy_info *phy_info[] = { &phy_info_dm9161, &phy_info_dm9161a, &phy_info_marvell, + &phy_info_bcm5481, &phy_info_genmii, NULL };drivers/qe/uec_phy.h +5
-0@@ -29,6 +29,11 @@#define MII_1000BASETCONTROL_FULLDUPLEXCAP 0x0200#define MII_1000BASETCONTROL_HALFDUPLEXCAP 0x0100 +/* 1000BT status */ +#define MII_1000BASETSTATUS 0x0a +#define LPA_1000FULL 0x0400 +#define LPA_1000HALF 0x0200 +/* Cicada Extended Control Register 1 */ #define MII_CIS8201_EXT_CON1 0x17#define MII_CIS8201_EXTCON1_INIT 0x0000
Signature · 1 line
Peter Barada <[email protected]>
PATCH 5/5 mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY
Quoted 110 lines · Peter Barada
Quoted 98 lines · Ben Warren
Quoted 52 lines · Anton Vorontsov
This patch adds basic support for Broadcom BCM5481 PHY, with the quirk needed for at least MPC8360E-RDK.
Quirk comes from MPC8360E-RDK BSP source, I think author is Peter Barada <[email protected]>, but I'm not sure.
There are no openly available specifications for that PHY.
Signed-off-by Anton Vorontsov <[email protected]>--- drivers/qe/uec_phy.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/qe/uec_phy.h | 5 +++ 2 files changed, 82 insertions(+), 0 deletions(-)drivers/qe/uec_phy.c +30
-0@@ -237,6 +237,44 @@ static int gbit_config_aneg (struct uec_mii_info *mii_info)return 0 ; } +static int gbit_read_status (struct uec_mii_info *mii_info) +{ +u16 status; +int err; + + err =genmii_update_link (mii_info); +if (err) +return err; + +if (mii_info->autoneg) { + mii_info->pause =0 ; + status =phy_read (mii_info,MII_1000BASETSTATUS ); +if (status & (LPA_1000FULL |LPA_1000HALF )) { + mii_info->speed =SPEED_1000 ; +if (status &LPA_1000FULL ) + mii_info->duplex =DUPLEX_FULL ; +else + mii_info->duplex =DUPLEX_HALF ; + }else { + status =phy_read (mii_info,PHY_ANLPAR ); + +if (status & (PHY_ANLPAR_10FD |PHY_ANLPAR_TXFD )) + mii_info->duplex =DUPLEX_FULL ; +else + mii_info->duplex =DUPLEX_HALF ; +if (status & (PHY_ANLPAR_TXFD |PHY_ANLPAR_TX )) + mii_info->speed =SPEED_100 ; +else + mii_info->speed =SPEED_10 ; + }drivers/qe/uec_phy.c static int gbit_config_aneg (struct uec_mii_info *mii_info) · line 279
Quoted 10 lines
drivers/qe/uec_phy.c +8
-0+ } +/* +* On non-aneg, we assume what we put in BMCR is the speed, +* though magic-aneg shouldn't prevent this case from occurring. +*/ +return 0 ; +} +Please roll the 1Gb code into
genmii_read_status. 10/100 PHYs should report 0 in theMII_1000BASETSTATUSregister so it should work.Quoted 30 lines
drivers/qe/uec_phy.c +0
-0static int marvell_config_aneg (struct uec_mii_info *mii_info){
drivers/qe/uec_phy.c +23
-0/* The Marvell PHY has an errata which requires @@ -319,6 +357,35 @@ static int genmii_read_status (struct uec_mii_info *mii_info)return 0 ; } +static int bcm_init (struct uec_mii_info *mii_info) +{ +gbit_config_aneg (mii_info); + +#ifdef CONFIG_MPC8360ERDK + { +u16 val; +int cnt =50 ; + +/* Wait for aneg to complete. */ +do + val =phy_read (mii_info,PHY_BMSR ); +while (--cnt && !(val &PHY_BMSR_AUTN_COMP )); + +/* Set RDX clk delay. */ +phy_write (mii_info,0x18 ,0x7 | (7 <<12 )); + + val =phy_read (mii_info,0x18 ); +/* Set RDX-RXC skew. */ + val |= (1 <<8 ); + val |= (7 | (7 <<12 )); +/* Write bits 14:0. */ + val |= (1 <<15 );Quoted 9 lines
drivers/qe/uec_phy.c static int genmii_read_status (struct uec_mii_info *mii_info)
Quoted 5 lines
drivers/qe/uec_phy.c +3
-0+ phy_write(mii_info, 0x18, val); + } +#endif What is it that makes this specific to one board? Magic numbers are baaaad, especially for industry-standard memory maps (I'm thinking of offset
0x18in case it's not obvious)
Quoted 10 lines
Its specific to the board, in that when hooked up via RGMII the setting in the PHY is required to supply adequate delay between the RXD and RXC signals instead of using trace lengths to achieve timing. I know magic numbers are baaaaad, but the PHY spec is only available under NDA and as such
descriptions(including informative constants, etc)can not be disclosed. If it wasn't for this one register setting(after reset), the PHY, as used, wouldn't require any PHY-specific code(outside of ID'ng it as a 5481).
Is this just due to a layout problem on the reference board, or do you always need to do this when connecting this MAC/PHY combo via RGMII? If the former, the additional registers needs to be set in board code. If the latter, please do something like this: Add an 'enet_interface_e if_mode' entry to the 'struct uec_mii_info' definition, and fill it in when you call 'uec_set_mac_if_mode()' and check the value for RGMII when 'bcm_init()' is called.
Sorry, but having a *reference* board #ifdef'd in library code is just wrong.
Regarding the magic numbers, something like this would be better:
#define MII_BCM_BCM_PRIVATE_0 0x16 #define MII_BCM_BCM_PRIVATE_1 0x17 #define MII_BCM_BCM_PRIVATE_2 0x18
regards,
Ben
v2 cover mpc83xx: MPC8360E-RDK related patches
In reply to Anton VorontsovQuoted 3 lines · On Wed, 9 Jan 2008 20:50:51 +0300 Anton Vorontsov <[email protected]>…
Hi all,
Here are few patches needed to support MPC8360E-RDK...
applied 1-2. looks like 4 depends on 3 going through Stefan, and 5 will go through Ben Warren.
Thanks Anton,
Kim