From 0ad7f0950a9bc0a69b3cd5f34ccf7da25fcf1c6d Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Fri, 23 Jul 2010 21:16:26 +0200 Subject: [PATCH 01/16] ppc4xx: cleanup default environment for AMCC boards None of the AMCC boards uses an embedded environment, so there is no need to run "saveenv" after updating U-Boot. Drop the redundant commands from the default environment. Signed-off-by: Wolfgang Denk Signed-off-by: Stefan Roese --- include/configs/amcc-common.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/configs/amcc-common.h b/include/configs/amcc-common.h index 13a941ef63..23a859fcb4 100644 --- a/include/configs/amcc-common.h +++ b/include/configs/amcc-common.h @@ -278,15 +278,13 @@ "load=tftp 200000 ${u-boot}\0" \ "update=protect off " xstr(CONFIG_SYS_MONITOR_BASE) " FFFFFFFF;" \ "era " xstr(CONFIG_SYS_MONITOR_BASE) " FFFFFFFF;" \ - "cp.b ${fileaddr} " xstr(CONFIG_SYS_MONITOR_BASE) " ${filesize};" \ - "setenv filesize;saveenv\0" \ + "cp.b ${fileaddr} " xstr(CONFIG_SYS_MONITOR_BASE) " ${filesize}" \ "upd=run load update\0" \ #define CONFIG_AMCC_DEF_ENV_NAND_UPD \ "u-boot-nand=" xstr(CONFIG_HOSTNAME) "/u-boot-nand.bin\0" \ "nload=tftp 200000 ${u-boot-nand}\0" \ - "nupdate=nand erase 0 100000;nand write 200000 0 100000;" \ - "setenv filesize;saveenv\0" \ + "nupdate=nand erase 0 100000;nand write 200000 0 100000" \ "nupd=run nload nupdate\0" #endif /* __AMCC_COMMON_H */ From f3dc7f197716e4c4d9349f14b4a951399fcbcd52 Mon Sep 17 00:00:00 2001 From: Matthias Fuchs Date: Mon, 26 Jul 2010 17:17:51 +0200 Subject: [PATCH 02/16] ppc4xx: Fix building of AR405 board Update image size after addition of new environment handling. Signed-off-by: Matthias Fuchs Signed-off-by: Stefan Roese --- board/esd/ar405/config.mk | 9 +-------- include/configs/AR405.h | 10 +++++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/board/esd/ar405/config.mk b/board/esd/ar405/config.mk index 3e8baf6563..da7c10728f 100644 --- a/board/esd/ar405/config.mk +++ b/board/esd/ar405/config.mk @@ -20,11 +20,4 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # - -# -# esd AR405 boards -# - -#TEXT_BASE = 0xFFFE0000 -#TEXT_BASE = 0xFFFD0000 -TEXT_BASE = 0xFFFC0000 +TEXT_BASE = 0xFFFA0000 diff --git a/include/configs/AR405.h b/include/configs/AR405.h index 52ead43aa4..45c64c2d2c 100644 --- a/include/configs/AR405.h +++ b/include/configs/AR405.h @@ -175,9 +175,9 @@ * Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0 */ #define CONFIG_SYS_SDRAM_BASE 0x00000000 -#define CONFIG_SYS_FLASH_BASE 0xFFFC0000 -#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE -#define CONFIG_SYS_MONITOR_LEN (256 * 1024) /* Reserve 256 kB for Monitor */ +#define CONFIG_SYS_FLASH_BASE CONFIG_SYS_MONITOR_BASE +#define CONFIG_SYS_MONITOR_BASE TEXT_BASE +#define CONFIG_SYS_MONITOR_LEN (~(TEXT_BASE) + 1) #define CONFIG_SYS_MALLOC_LEN (128 * 1024) /* Reserve 128 kB for malloc() */ /* @@ -209,11 +209,11 @@ #define CONFIG_SYS_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */ #define CONFIG_ENV_IS_IN_FLASH 1 -#define CONFIG_ENV_ADDR 0xFFFB0000 /* Address of Environment Sector*/ +#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SECT_SIZE) #define CONFIG_ENV_SECT_SIZE 0x10000 /* see README - env sector total size */ #define CONFIG_ENV_SIZE 0x04000 /* Size of Environment */ -#define CONFIG_ENV_ADDR_REDUND 0xFFFA0000 +#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR - CONFIG_ENV_SECT_SIZE) #define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE /* From a00c137e041ad8df19da1fe693b56eff040e0b80 Mon Sep 17 00:00:00 2001 From: Matthias Fuchs Date: Mon, 26 Jul 2010 17:17:52 +0200 Subject: [PATCH 03/16] ppc4xx: Fix building of CANBT board Update image size after addition of new environment handling. Signed-off-by: Matthias Fuchs Signed-off-by: Stefan Roese --- board/esd/canbt/config.mk | 8 +------- include/configs/CANBT.h | 6 +++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/board/esd/canbt/config.mk b/board/esd/canbt/config.mk index 80076cd943..ae855dc057 100644 --- a/board/esd/canbt/config.mk +++ b/board/esd/canbt/config.mk @@ -20,10 +20,4 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # - -# -# esd ADCIOP boards -# - -TEXT_BASE = 0xFFFE0000 -#TEXT_BASE = 0xFFFD0000 +TEXT_BASE = 0xFFFC0000 diff --git a/include/configs/CANBT.h b/include/configs/CANBT.h index cdba81d323..115a6f9886 100644 --- a/include/configs/CANBT.h +++ b/include/configs/CANBT.h @@ -120,9 +120,9 @@ * Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0 */ #define CONFIG_SYS_SDRAM_BASE 0x00000000 -#define CONFIG_SYS_FLASH_BASE 0xFFFE0000 -#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE -#define CONFIG_SYS_MONITOR_LEN (128 * 1024) /* Reserve 128 kB for Monitor */ +#define CONFIG_SYS_FLASH_BASE CONFIG_SYS_MONITOR_BASE +#define CONFIG_SYS_MONITOR_BASE TEXT_BASE +#define CONFIG_SYS_MONITOR_LEN (~(TEXT_BASE) + 1) #define CONFIG_SYS_MALLOC_LEN (128 * 1024) /* Reserve 128 kB for malloc() */ /* From 5baefbba382854ed824ee381796174a7401362fa Mon Sep 17 00:00:00 2001 From: Matthias Fuchs Date: Mon, 26 Jul 2010 17:17:53 +0200 Subject: [PATCH 04/16] ppc4xx: Fix building of PMC440 board Update image size and default environment after addition of new environment handling. Signed-off-by: Matthias Fuchs Signed-off-by: Stefan Roese --- board/esd/pmc440/config.mk | 2 +- include/configs/PMC440.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/board/esd/pmc440/config.mk b/board/esd/pmc440/config.mk index 91e65ec8a9..6e9f735f42 100644 --- a/board/esd/pmc440/config.mk +++ b/board/esd/pmc440/config.mk @@ -23,7 +23,7 @@ sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp ifndef TEXT_BASE -TEXT_BASE = 0xFFFA0000 +TEXT_BASE = 0xFFF90000 endif PLATFORM_CPPFLAGS += -DCONFIG_440=1 diff --git a/include/configs/PMC440.h b/include/configs/PMC440.h index c2fb56c6f9..3c19f52d9c 100644 --- a/include/configs/PMC440.h +++ b/include/configs/PMC440.h @@ -53,7 +53,7 @@ * Base addresses -- Note these are effective addresses where the * actual resources get mapped (not physical addresses) *----------------------------------------------------------------------*/ -#define CONFIG_SYS_MONITOR_LEN (384 * 1024) /* Reserve 384 kB for Monitor */ +#define CONFIG_SYS_MONITOR_LEN (~(TEXT_BASE) + 1) #define CONFIG_SYS_MALLOC_LEN (1024 * 1024) /* Reserve 256 kB for malloc() */ #define CONFIG_PRAM 0 /* use pram variable to overwrite */ @@ -61,7 +61,7 @@ #define CONFIG_SYS_BOOT_BASE_ADDR 0xf0000000 #define CONFIG_SYS_SDRAM_BASE 0x00000000 /* _must_ be 0 */ #define CONFIG_SYS_FLASH_BASE 0xfc000000 /* start of FLASH */ -#define CONFIG_SYS_MONITOR_BASE TEXT_BASE +#define CONFIG_SYS_MONITOR_BASE TEXT_BASE #define CONFIG_SYS_NAND_ADDR 0xd0000000 /* NAND Flash */ #define CONFIG_SYS_OCM_BASE 0xe0010000 /* ocm */ #define CONFIG_SYS_OCM_DATA_ADDR CONFIG_SYS_OCM_BASE @@ -301,8 +301,8 @@ "fdt_addr_r=800000\0" \ "fpga=fpga loadb 0 ${fpga_addr}\0" \ "load=tftp 200000 /tftpboot/pmc440/u-boot.bin\0" \ - "update=protect off fffa0000 ffffffff;era fffa0000 ffffffff;" \ - "cp.b 200000 fffa0000 60000\0" \ + "update=protect off fff90000 ffffffff;era fff90000 ffffffff;" \ + "cp.b 200000 fff90000 70000\0" \ "" #define CONFIG_BOOTDELAY 3 /* autoboot after 3 seconds */ From 5bea7e6ce3837e12e507a78211bbf902ab43252a Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Tue, 27 Jul 2010 07:07:24 +0200 Subject: [PATCH 05/16] ppc4xx: Fix building of sc3 board Update image size after addition of new environment handling. Signed-off-by: Heiko Schocher Signed-off-by: Stefan Roese --- board/sc3/config.mk | 2 +- include/configs/sc3.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/board/sc3/config.mk b/board/sc3/config.mk index 1bdf5e4fcf..a46b197249 100644 --- a/board/sc3/config.mk +++ b/board/sc3/config.mk @@ -21,4 +21,4 @@ # MA 02111-1307 USA # -TEXT_BASE = 0xFFFC0000 +TEXT_BASE = 0xFFFA0000 diff --git a/include/configs/sc3.h b/include/configs/sc3.h index 61eb26ed84..19084cec43 100644 --- a/include/configs/sc3.h +++ b/include/configs/sc3.h @@ -379,8 +379,9 @@ */ #define CONFIG_SYS_SDRAM_BASE 0x00000000 #define CONFIG_SYS_FLASH_BASE 0xFFE00000 -#define CONFIG_SYS_MONITOR_BASE 0xFFFC0000 /* placed last 256k */ -#define CONFIG_SYS_MONITOR_LEN (224 * 1024) /* Reserve 224 KiB for Monitor */ + +#define CONFIG_SYS_MONITOR_BASE TEXT_BASE /* Start of U-Boot */ +#define CONFIG_SYS_MONITOR_LEN (0xFFFFFFFF - CONFIG_SYS_MONITOR_BASE + 1) #define CONFIG_SYS_MALLOC_LEN (128 * 1024) /* Reserve 128 KiB for malloc() */ /* From fc21cd552bf7845fd2002e7a090d53ee5d12d335 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Tue, 3 Aug 2010 10:29:50 +0200 Subject: [PATCH 06/16] ppc4xx: Fix/Update katmai board header This patch has the following fixes/changes: - Set 'kernel_addr' and 'ramdisk_addr' to correct values and add 'fdt_addr' environment variable - Remove 'kozio' environment variable - Remove environmant variables to boot ancient arch/ppc Linux kernels - Remove CONFIG_SYS_BOOTMAPSZ definition. It's already defined to the same value in amcc-common.h Signed-off-by: Stefan Roese --- include/configs/katmai.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/include/configs/katmai.h b/include/configs/katmai.h index 76e9a76264..2a7ab8de0e 100644 --- a/include/configs/katmai.h +++ b/include/configs/katmai.h @@ -53,13 +53,6 @@ #define CONFIG_HOSTNAME katmai #include "amcc-common.h" -/* - * For booting 256K-paged Linux we should have 16MB of memory - * for Linux initial memory map - */ -#undef CONFIG_SYS_BOOTMAPSZ -#define CONFIG_SYS_BOOTMAPSZ (16 << 20) - #define CONFIG_BOARD_EARLY_INIT_F 1 /* Call board_pre_init */ #undef CONFIG_SHOW_BOOT_PROGRESS @@ -188,11 +181,10 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ CONFIG_AMCC_DEF_ENV \ CONFIG_AMCC_DEF_ENV_POWERPC \ - CONFIG_AMCC_DEF_ENV_PPC_OLD \ CONFIG_AMCC_DEF_ENV_NOR_UPD \ - "kernel_addr=fff10000\0" \ - "ramdisk_addr=fff20000\0" \ - "kozio=bootm ffc60000\0" \ + "kernel_addr=ff000000\0" \ + "fdt_addr=ff1e0000\0" \ + "ramdisk_addr=ff200000\0" \ "pciconfighost=1\0" \ "pcie_mode=RP:RP:RP\0" \ "" From f699fe1e1fa6e53fe52853acea4976aa3303274c Mon Sep 17 00:00:00 2001 From: Stefano Babic Date: Tue, 20 Jul 2010 07:57:07 +0200 Subject: [PATCH 07/16] net,fec: Shorten device name as done for other drivers After discussion on the ML it is suggested to drop unrequired and not useful characters from the device name. This patch changes the name for the fec_mxc driver from "FEC_MXC" to "FEC". Signed-off-by: Stefano Babic Signed-off-by: Ben Warren --- drivers/net/fec_mxc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 57f89a37a6..6b801ce24a 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -743,7 +743,7 @@ static int fec_probe(bd_t *bd) writel(0x05ee0024, &fec->eth->r_cntrl); /* FIXME 0x05ee0004 */ fec_mii_setspeed(fec); - sprintf(edev->name, "FEC_MXC"); + sprintf(edev->name, "FEC"); miiphy_register(edev->name, fec_miiphy_read, fec_miiphy_write); From 48690d8024eeeaee3120db702e54fcb238e6d9c7 Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Tue, 20 Jul 2010 17:45:02 +0200 Subject: [PATCH 08/16] net ppc: fix ethernet device names with spaces since commit 1384f3bb8a4f9066805b70c1418eda78ecb73fdd ethernet names with spaces drop a Warning: eth device name has a space! message. This patch fix it for: - "FEC ETHERNET" devices found on mpc512x, mpc5xxx, mpc8xx and mpc8220 boards. renamed to "FEC". - "SCC ETHERNET" devices found on mpc8xx, mpc82xx based boards. Renamed to "SCC". - "HDLC ETHERNET" devices found on mpc8xx boards Renamed to "HDLC" - "FCC ETHERNET" devices found on mpc8260 and mpc85xx based boards. Renamed to "FCC" Tested on the kup4k board. Signed-off-by: Heiko Schocher Signed-off-by: Ben Warren --- README | 8 ++++---- arch/powerpc/cpu/mpc8220/fec.c | 2 +- arch/powerpc/cpu/mpc8260/ether_fcc.c | 2 +- arch/powerpc/cpu/mpc8260/ether_scc.c | 2 +- arch/powerpc/cpu/mpc85xx/ether_fcc.c | 2 +- arch/powerpc/cpu/mpc8xx/fec.c | 4 ++-- arch/powerpc/cpu/mpc8xx/scc.c | 2 +- board/freescale/mpc8560ads/mpc8560ads.c | 2 +- board/funkwerk/vovpn-gw/vovpn-gw.c | 2 +- board/keymile/common/keymile_hdlc_enet.c | 4 ++-- board/keymile/km8xx/km8xx_hdlc_enet.c | 2 +- board/motionpro/motionpro.c | 4 ++-- board/sbc8560/sbc8560.c | 2 +- board/stx/stxgp3/stxgp3.c | 2 +- board/stx/stxssa/stxssa.c | 2 +- board/stx/stxxtc/stxxtc.c | 6 +++--- board/tqc/tqm8xx/tqm8xx.c | 4 ++-- doc/uImage.FIT/howto.txt | 4 ++-- drivers/net/mpc512x_fec.c | 2 +- include/configs/NSCU.h | 1 - include/configs/TK885D.h | 6 +++--- include/configs/TQM855L.h | 2 +- include/configs/TQM855M.h | 2 +- include/configs/TQM860L.h | 2 +- include/configs/TQM860M.h | 2 +- include/configs/TQM862L.h | 2 +- include/configs/TQM862M.h | 2 +- include/configs/TQM866M.h | 2 +- include/configs/TQM885D.h | 2 +- include/configs/ep82xxm.h | 2 +- include/configs/idmr.h | 2 +- include/configs/keymile-common.h | 4 ++-- include/configs/km8xx.h | 2 +- include/configs/v38b.h | 2 +- 34 files changed, 46 insertions(+), 47 deletions(-) diff --git a/README b/README index b6bf451400..ccaace797f 100644 --- a/README +++ b/README @@ -3158,10 +3158,10 @@ List of environment variables (most likely not complete): interface is currently active. For example you can do the following - => setenv ethact FEC ETHERNET - => ping 192.168.0.1 # traffic sent on FEC ETHERNET - => setenv ethact SCC ETHERNET - => ping 10.0.0.1 # traffic sent on SCC ETHERNET + => setenv ethact FEC + => ping 192.168.0.1 # traffic sent on FEC + => setenv ethact SCC + => ping 10.0.0.1 # traffic sent on SCC ethrotate - When set to "no" U-Boot does not go through all available network interfaces. diff --git a/arch/powerpc/cpu/mpc8220/fec.c b/arch/powerpc/cpu/mpc8220/fec.c index 5df9735332..9a6d434dba 100644 --- a/arch/powerpc/cpu/mpc8220/fec.c +++ b/arch/powerpc/cpu/mpc8220/fec.c @@ -840,7 +840,7 @@ int mpc8220_fec_initialize (bd_t * bis) dev->send = mpc8220_fec_send; dev->recv = mpc8220_fec_recv; - sprintf (dev->name, "FEC ETHERNET"); + sprintf (dev->name, "FEC"); eth_register (dev); #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) diff --git a/arch/powerpc/cpu/mpc8260/ether_fcc.c b/arch/powerpc/cpu/mpc8260/ether_fcc.c index 5ac02a09c0..c82958db1b 100644 --- a/arch/powerpc/cpu/mpc8260/ether_fcc.c +++ b/arch/powerpc/cpu/mpc8260/ether_fcc.c @@ -383,7 +383,7 @@ int fec_initialize(bd_t *bis) dev = (struct eth_device*) malloc(sizeof *dev); memset(dev, 0, sizeof *dev); - sprintf(dev->name, "FCC%d ETHERNET", + sprintf(dev->name, "FCC%d", ether_fcc_info[i].ether_index + 1); dev->priv = ðer_fcc_info[i]; dev->init = fec_init; diff --git a/arch/powerpc/cpu/mpc8260/ether_scc.c b/arch/powerpc/cpu/mpc8260/ether_scc.c index 432111df4c..2870a9cf94 100644 --- a/arch/powerpc/cpu/mpc8260/ether_scc.c +++ b/arch/powerpc/cpu/mpc8260/ether_scc.c @@ -375,7 +375,7 @@ int mpc82xx_scc_enet_initialize(bd_t *bis) dev = (struct eth_device *) malloc(sizeof *dev); memset(dev, 0, sizeof *dev); - sprintf(dev->name, "SCC ETHERNET"); + sprintf(dev->name, "SCC"); dev->init = sec_init; dev->halt = sec_halt; dev->send = sec_send; diff --git a/arch/powerpc/cpu/mpc85xx/ether_fcc.c b/arch/powerpc/cpu/mpc85xx/ether_fcc.c index 5f1414d758..f69b2e649f 100644 --- a/arch/powerpc/cpu/mpc85xx/ether_fcc.c +++ b/arch/powerpc/cpu/mpc85xx/ether_fcc.c @@ -446,7 +446,7 @@ int fec_initialize(bd_t *bis) dev = (struct eth_device*) malloc(sizeof *dev); memset(dev, 0, sizeof *dev); - sprintf(dev->name, "FCC%d ETHERNET", + sprintf(dev->name, "FCC%d", ether_fcc_info[i].ether_index + 1); dev->priv = ðer_fcc_info[i]; dev->init = fec_init; diff --git a/arch/powerpc/cpu/mpc8xx/fec.c b/arch/powerpc/cpu/mpc8xx/fec.c index 89c1ff939d..754f8db9ed 100644 --- a/arch/powerpc/cpu/mpc8xx/fec.c +++ b/arch/powerpc/cpu/mpc8xx/fec.c @@ -164,9 +164,9 @@ int fec_initialize(bd_t *bis) /* for FEC1 make sure that the name of the interface is the same as the old one for compatibility reasons */ if (i == 0) { - sprintf (dev->name, "FEC ETHERNET"); + sprintf (dev->name, "FEC"); } else { - sprintf (dev->name, "FEC%d ETHERNET", + sprintf (dev->name, "FEC%d", ether_fcc_info[i].ether_index + 1); } diff --git a/arch/powerpc/cpu/mpc8xx/scc.c b/arch/powerpc/cpu/mpc8xx/scc.c index effb967e32..e376c64d52 100644 --- a/arch/powerpc/cpu/mpc8xx/scc.c +++ b/arch/powerpc/cpu/mpc8xx/scc.c @@ -77,7 +77,7 @@ int scc_initialize(bd_t *bis) dev = (struct eth_device*) malloc(sizeof *dev); memset(dev, 0, sizeof *dev); - sprintf(dev->name, "SCC ETHERNET"); + sprintf(dev->name, "SCC"); dev->iobase = 0; dev->priv = 0; dev->init = scc_init; diff --git a/board/freescale/mpc8560ads/mpc8560ads.c b/board/freescale/mpc8560ads/mpc8560ads.c index 489f90b14b..423e9d72a7 100644 --- a/board/freescale/mpc8560ads/mpc8560ads.c +++ b/board/freescale/mpc8560ads/mpc8560ads.c @@ -236,7 +236,7 @@ void reset_phy (void) #endif #if defined(CONFIG_MII) && defined(CONFIG_ETHER_ON_FCC) /* reset PHY */ - miiphy_reset("FCC1 ETHERNET", 0x0); + miiphy_reset("FCC1", 0x0); /* change PHY address to 0x02 */ bb_miiphy_write(NULL, 0, PHY_MIPSCR, 0xf028); diff --git a/board/funkwerk/vovpn-gw/vovpn-gw.c b/board/funkwerk/vovpn-gw/vovpn-gw.c index 889ba3f074..e856adaee5 100644 --- a/board/funkwerk/vovpn-gw/vovpn-gw.c +++ b/board/funkwerk/vovpn-gw/vovpn-gw.c @@ -198,7 +198,7 @@ void reset_phy (void) iop->pdat |= 0x00080000; for (i=0; i<100; i++) { udelay(20000); - if (bb_miiphy_read("FCC1 ETHERNET", CONFIG_SYS_PHY_ADDR,2,&val ) == 0) { + if (bb_miiphy_read("FCC1", CONFIG_SYS_PHY_ADDR,2,&val ) == 0) { break; } } diff --git a/board/keymile/common/keymile_hdlc_enet.c b/board/keymile/common/keymile_hdlc_enet.c index ce5e4d6a45..a545211d19 100644 --- a/board/keymile/common/keymile_hdlc_enet.c +++ b/board/keymile/common/keymile_hdlc_enet.c @@ -40,7 +40,7 @@ extern char keymile_slot; /* our slot number in the backplane */ #define TOUT_LOOP 50000 /* - * Since, except during initialization, ethact is always HDLC ETHERNET + * Since, except during initialization, ethact is always HDLC * while we're in the driver, just use serial_printf() everywhere for * output. This avoids possible conflicts when netconsole is being * used. @@ -124,7 +124,7 @@ int keymile_hdlc_enet_initialize(bd_t *bis) seth = dev; #endif - sprintf(dev->name, "HDLC ETHERNET"); + sprintf(dev->name, "HDLC"); dev->init = keymile_hdlc_enet_init; dev->halt = keymile_hdlc_enet_halt; dev->send = keymile_hdlc_enet_send; diff --git a/board/keymile/km8xx/km8xx_hdlc_enet.c b/board/keymile/km8xx/km8xx_hdlc_enet.c index 04782884e4..ca00576925 100644 --- a/board/keymile/km8xx/km8xx_hdlc_enet.c +++ b/board/keymile/km8xx/km8xx_hdlc_enet.c @@ -34,7 +34,7 @@ char keymile_slot; /* our slot number in the backplane */ /* - * Since, except during initialization, ethact is always HDLC ETHERNET + * Since, except during initialization, ethact is always HDLC * while we're in the driver, just use serial_printf() everywhere for * output. This avoids possible conflicts when netconsole is being * used. diff --git a/board/motionpro/motionpro.c b/board/motionpro/motionpro.c index b3692190b9..47ef6e53ed 100644 --- a/board/motionpro/motionpro.c +++ b/board/motionpro/motionpro.c @@ -90,8 +90,8 @@ void reset_phy(void) { unsigned short mode_control; - miiphy_read("FEC ETHERNET", CONFIG_PHY_ADDR, 0x15, &mode_control); - miiphy_write("FEC ETHERNET", CONFIG_PHY_ADDR, 0x15, + miiphy_read("FEC", CONFIG_PHY_ADDR, 0x15, &mode_control); + miiphy_write("FEC", CONFIG_PHY_ADDR, 0x15, mode_control & 0xfffe); return; } diff --git a/board/sbc8560/sbc8560.c b/board/sbc8560/sbc8560.c index 10ba62fa49..77abde5d41 100644 --- a/board/sbc8560/sbc8560.c +++ b/board/sbc8560/sbc8560.c @@ -225,7 +225,7 @@ void reset_phy (void) #endif #if defined(CONFIG_MII) && defined(CONFIG_ETHER_ON_FCC) /* reset PHY */ - miiphy_reset("FCC1 ETHERNET", 0x0); + miiphy_reset("FCC1", 0x0); /* change PHY address to 0x02 */ bb_miiphy_write(NULL, 0, PHY_MIPSCR, 0xf028); diff --git a/board/stx/stxgp3/stxgp3.c b/board/stx/stxgp3/stxgp3.c index 3804fe0800..25d5211700 100644 --- a/board/stx/stxgp3/stxgp3.c +++ b/board/stx/stxgp3/stxgp3.c @@ -239,7 +239,7 @@ reset_phy(void) #endif #if defined(CONFIG_MII) && defined(CONFIG_ETHER_ON_FCC) /* reset PHY */ - miiphy_reset("FCC1 ETHERNET", 0x0); + miiphy_reset("FCC1", 0x0); /* change PHY address to 0x02 */ bb_miiphy_write(NULL, 0, PHY_MIPSCR, 0xf028); diff --git a/board/stx/stxssa/stxssa.c b/board/stx/stxssa/stxssa.c index 0b2584c6b1..1e0acab546 100644 --- a/board/stx/stxssa/stxssa.c +++ b/board/stx/stxssa/stxssa.c @@ -238,7 +238,7 @@ reset_phy(void) #endif #if defined(CONFIG_MII) && defined(CONFIG_ETHER_ON_FCC) /* reset PHY */ - miiphy_reset("FCC1 ETHERNET", 0x0); + miiphy_reset("FCC1", 0x0); /* change PHY address to 0x02 */ bb_miiphy_write(NULL, 0, PHY_MIPSCR, 0xf028); diff --git a/board/stx/stxxtc/stxxtc.c b/board/stx/stxxtc/stxxtc.c index 717dbe2084..6693a7051b 100644 --- a/board/stx/stxxtc/stxxtc.c +++ b/board/stx/stxxtc/stxxtc.c @@ -481,12 +481,12 @@ void reset_phys(void) mii_init(); for (phyno = 0; phyno < 32; ++phyno) { - miiphy_read("FEC ETHERNET", phyno, PHY_PHYIDR1, &v); + miiphy_read("FEC", phyno, PHY_PHYIDR1, &v); if (v == 0xFFFF) continue; - miiphy_write("FEC ETHERNET", phyno, PHY_BMCR, PHY_BMCR_POWD); + miiphy_write("FEC", phyno, PHY_BMCR, PHY_BMCR_POWD); udelay(10000); - miiphy_write("FEC ETHERNET", phyno, PHY_BMCR, PHY_BMCR_RESET | PHY_BMCR_AUTON); + miiphy_write("FEC", phyno, PHY_BMCR, PHY_BMCR_RESET | PHY_BMCR_AUTON); udelay(10000); } } diff --git a/board/tqc/tqm8xx/tqm8xx.c b/board/tqc/tqm8xx/tqm8xx.c index 53f79e8b80..cde780b2df 100644 --- a/board/tqc/tqm8xx/tqm8xx.c +++ b/board/tqc/tqm8xx/tqm8xx.c @@ -745,13 +745,13 @@ int last_stage_init(void) return 0; for (i = 0; i < 2; i++) { - ret = miiphy_read("FEC ETHERNET", phy[i], PHY_BMCR, ®); + ret = miiphy_read("FEC", phy[i], PHY_BMCR, ®); if (ret) { printf("Cannot read BMCR on PHY %d\n", phy[i]); return 0; } /* Auto-negotiation off, hard set full duplex, 100Mbps */ - ret = miiphy_write("FEC ETHERNET", phy[i], + ret = miiphy_write("FEC", phy[i], PHY_BMCR, (reg | PHY_BMCR_100MB | PHY_BMCR_DPLX) & ~PHY_BMCR_AUTON); if (ret) { diff --git a/doc/uImage.FIT/howto.txt b/doc/uImage.FIT/howto.txt index 8065e9e1d8..59e21e91e3 100644 --- a/doc/uImage.FIT/howto.txt +++ b/doc/uImage.FIT/howto.txt @@ -93,7 +93,7 @@ nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off panic=1 => run nfsargs addip => tftp 900000 /path/to/tftp/location/kernel.itb -Using FEC ETHERNET device +Using FEC device TFTP from server 192.168.1.1; our IP address is 192.168.160.5 Filename '/path/to/tftp/location/kernel.itb'. Load address: 0x900000 @@ -207,7 +207,7 @@ inspected and booted: [on the target system] => tftp 900000 /path/to/tftp/location/kernel_fdt.itb -Using FEC ETHERNET device +Using FEC device TFTP from server 192.168.1.1; our IP address is 192.168.160.5 Filename '/path/to/tftp/location/kernel_fdt.itb'. Load address: 0x900000 diff --git a/drivers/net/mpc512x_fec.c b/drivers/net/mpc512x_fec.c index c580c827a6..6ea4a2b342 100644 --- a/drivers/net/mpc512x_fec.c +++ b/drivers/net/mpc512x_fec.c @@ -637,7 +637,7 @@ int mpc512x_fec_initialize (bd_t * bis) dev->send = mpc512x_fec_send; dev->recv = mpc512x_fec_recv; - sprintf (dev->name, "FEC ETHERNET"); + sprintf (dev->name, "FEC"); eth_register (dev); #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) diff --git a/include/configs/NSCU.h b/include/configs/NSCU.h index 5724f45a8d..6a4c47d888 100644 --- a/include/configs/NSCU.h +++ b/include/configs/NSCU.h @@ -485,7 +485,6 @@ #undef CONFIG_SCC1_ENET #define CONFIG_FEC_ENET -/* #define CONFIG_ETHPRIME "FEC ETHERNET" */ /* pass open firmware flat tree */ #define CONFIG_OF_LIBFDT 1 diff --git a/include/configs/TK885D.h b/include/configs/TK885D.h index 0df1b6e042..7cefa32d7a 100644 --- a/include/configs/TK885D.h +++ b/include/configs/TK885D.h @@ -65,8 +65,8 @@ #undef CONFIG_BOOTARGS #define CONFIG_EXTRA_ENV_SETTINGS \ - "ethprime=FEC ETHERNET\0" \ - "ethact=FEC ETHERNET\0" \ + "ethprime=FEC\0" \ + "ethact=FEC\0" \ "netdev=eth0\0" \ "nfsargs=setenv bootargs root=/dev/nfs rw " \ "nfsroot=${serverip}:${rootpath}\0" \ @@ -514,7 +514,7 @@ #define CONFIG_MII_INIT 1 #define CONFIG_NET_RETRY_COUNT 3 -#define CONFIG_ETHPRIME "FEC ETHERNET" +#define CONFIG_ETHPRIME "FEC" /* pass open firmware flat tree */ #define CONFIG_OF_LIBFDT 1 diff --git a/include/configs/TQM855L.h b/include/configs/TQM855L.h index 32a7e79a4b..5bf8f0239d 100644 --- a/include/configs/TQM855L.h +++ b/include/configs/TQM855L.h @@ -481,7 +481,7 @@ #define CONFIG_SCC1_ENET #define CONFIG_FEC_ENET -#define CONFIG_ETHPRIME "SCC ETHERNET" +#define CONFIG_ETHPRIME "SCC" /* pass open firmware flat tree */ #define CONFIG_OF_LIBFDT 1 diff --git a/include/configs/TQM855M.h b/include/configs/TQM855M.h index 4f44be31bb..456ed7e473 100644 --- a/include/configs/TQM855M.h +++ b/include/configs/TQM855M.h @@ -516,7 +516,7 @@ #define CONFIG_SCC1_ENET #define CONFIG_FEC_ENET -#define CONFIG_ETHPRIME "SCC ETHERNET" +#define CONFIG_ETHPRIME "SCC" /* pass open firmware flat tree */ #define CONFIG_OF_LIBFDT 1 diff --git a/include/configs/TQM860L.h b/include/configs/TQM860L.h index e86fe5ef96..94b9a3b1eb 100644 --- a/include/configs/TQM860L.h +++ b/include/configs/TQM860L.h @@ -480,7 +480,7 @@ #define CONFIG_SCC1_ENET #define CONFIG_FEC_ENET -#define CONFIG_ETHPRIME "SCC ETHERNET" +#define CONFIG_ETHPRIME "SCC" /* pass open firmware flat tree */ #define CONFIG_OF_LIBFDT 1 diff --git a/include/configs/TQM860M.h b/include/configs/TQM860M.h index 4fd873b1bd..ce5e6917c7 100644 --- a/include/configs/TQM860M.h +++ b/include/configs/TQM860M.h @@ -484,7 +484,7 @@ #define CONFIG_SCC1_ENET #define CONFIG_FEC_ENET -#define CONFIG_ETHPRIME "SCC ETHERNET" +#define CONFIG_ETHPRIME "SCC" /* pass open firmware flat tree */ #define CONFIG_OF_LIBFDT 1 diff --git a/include/configs/TQM862L.h b/include/configs/TQM862L.h index 0c966c9e0c..d77df9cad2 100644 --- a/include/configs/TQM862L.h +++ b/include/configs/TQM862L.h @@ -486,7 +486,7 @@ #define CONFIG_NET_MULTI #define CONFIG_SCC1_ENET #define CONFIG_FEC_ENET -#define CONFIG_ETHPRIME "SCC ETHERNET" +#define CONFIG_ETHPRIME "SCC" /* pass open firmware flat tree */ #define CONFIG_OF_LIBFDT 1 diff --git a/include/configs/TQM862M.h b/include/configs/TQM862M.h index 178e6e2137..a6c465b318 100644 --- a/include/configs/TQM862M.h +++ b/include/configs/TQM862M.h @@ -487,7 +487,7 @@ #define CONFIG_NET_MULTI #define CONFIG_SCC1_ENET #define CONFIG_FEC_ENET -#define CONFIG_ETHPRIME "SCC ETHERNET" +#define CONFIG_ETHPRIME "SCC" /* pass open firmware flat tree */ #define CONFIG_OF_LIBFDT 1 diff --git a/include/configs/TQM866M.h b/include/configs/TQM866M.h index a65946deb2..9ec815c600 100644 --- a/include/configs/TQM866M.h +++ b/include/configs/TQM866M.h @@ -506,7 +506,7 @@ #define CONFIG_SCC1_ENET #define CONFIG_FEC_ENET -#define CONFIG_ETHPRIME "SCC ETHERNET" +#define CONFIG_ETHPRIME "SCC" /* pass open firmware flat tree */ #define CONFIG_OF_LIBFDT 1 diff --git a/include/configs/TQM885D.h b/include/configs/TQM885D.h index 0fc4b69acf..c715c0783e 100644 --- a/include/configs/TQM885D.h +++ b/include/configs/TQM885D.h @@ -506,7 +506,7 @@ switching to another netwok (if the tried network is unreachable) */ -#define CONFIG_ETHPRIME "SCC ETHERNET" +#define CONFIG_ETHPRIME "SCC" /* pass open firmware flat tree */ #define CONFIG_OF_LIBFDT 1 diff --git a/include/configs/ep82xxm.h b/include/configs/ep82xxm.h index c737f10ec9..b52b94179f 100644 --- a/include/configs/ep82xxm.h +++ b/include/configs/ep82xxm.h @@ -147,7 +147,7 @@ #define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */ #define CONFIG_ENV_IN_OWN_SECT 1 #define CONFIG_AUTO_COMPLETE 1 -#define CONFIG_EXTRA_ENV_SETTINGS "ethprime=FCC3 ETHERNET" +#define CONFIG_EXTRA_ENV_SETTINGS "ethprime=FCC3" #if defined(CONFIG_CMD_KGDB) #undef CONFIG_KGDB_ON_SMC /* define if kgdb on SMC */ diff --git a/include/configs/idmr.h b/include/configs/idmr.h index 61e3bad4f3..8105876e4e 100644 --- a/include/configs/idmr.h +++ b/include/configs/idmr.h @@ -74,7 +74,7 @@ "net_nfs=tftp 200000 $(bootfile);run nfsargs addip;bootm\0" \ "nfsargs=setenv bootargs root=/dev/nfs rw " \ "nfsroot=$(serverip):$(rootpath)\0" \ - "ethact=FEC ETHERNET\0" \ + "ethact=FEC\0 " \ "update=prot off ff800000 ff81ffff; era ff800000 ff81ffff; " \ "cp.b 200000 ff800000 $(filesize);" \ "prot on ff800000 ff81ffff\0" \ diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h index 3a9f790f3f..6c14ca00c5 100644 --- a/include/configs/keymile-common.h +++ b/include/configs/keymile-common.h @@ -139,8 +139,8 @@ #ifdef CONFIG_IO_MUXING #define CONFIG_KM_DEF_ENV_IOMUX \ - "nc=setenv ethact HDLC ETHERNET \0" \ - "nce=setenv ethact SCC ETHERNET \0" \ + "nc=setenv ethact HDLC \0" \ + "nce=setenv ethact SCC \0" \ "stderr=serial,nc \0" \ "stdin=serial,nc \0" \ "stdout=serial,nc \0" \ diff --git a/include/configs/km8xx.h b/include/configs/km8xx.h index b5552d217c..a10744e882 100644 --- a/include/configs/km8xx.h +++ b/include/configs/km8xx.h @@ -280,7 +280,7 @@ #define BOOTFLAG_WARM 0x02 /* Software reboot */ #define CONFIG_SCC3_ENET -#define CONFIG_ETHPRIME "SCC ETHERNET" +#define CONFIG_ETHPRIME "SCC" #define CONFIG_HAS_ETH0 /* pass open firmware flat tree */ diff --git a/include/configs/v38b.h b/include/configs/v38b.h index d462ed0f1e..600ccfbab1 100644 --- a/include/configs/v38b.h +++ b/include/configs/v38b.h @@ -154,7 +154,7 @@ "nfsargs=setenv bootargs root=/dev/nfs rw " \ "nfsroot=$(serverip):$(rootpath) wdt=off\0" \ "hostname=v38b\0" \ - "ethact=FEC ETHERNET\0" \ + "ethact=FEC\0" \ "rootpath=/opt/eldk-3.1.1/ppc_6xx\0" \ "update=prot off ff000000 ff03ffff; era ff000000 ff03ffff; " \ "cp.b 200000 ff000000 $(filesize);" \ From 78b7a8ef8b37582a37a5c2381191061380b42831 Mon Sep 17 00:00:00 2001 From: Kim Phillips Date: Mon, 26 Jul 2010 18:34:57 -0500 Subject: [PATCH 09/16] net: rename "FSL UECx" net interfaces "UECx" continuation of commit 2ecc2262d66a286e3aac79005bcb5f461312dea8 "net ppc: fix ethernet device names with spaces" (currently in u-boot-net.git) for QE based parts. Signed-off-by: Kim Phillips Acked-by: Dave Liu Signed-off-by: Ben Warren --- doc/README.kmeter1 | 2 +- drivers/qe/uec.c | 2 +- drivers/qe/uec_phy.c | 6 +++--- include/configs/MPC8323ERDB.h | 2 +- include/configs/MPC832XEMDS.h | 2 +- include/configs/MPC8360EMDS.h | 2 +- include/configs/MPC8360ERDK.h | 2 +- include/configs/MPC8568MDS.h | 2 +- include/configs/MPC8569MDS.h | 2 +- include/configs/kmeter1.h | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/README.kmeter1 b/doc/README.kmeter1 index 44ebb7a781..7f4fc999f8 100644 --- a/doc/README.kmeter1 +++ b/doc/README.kmeter1 @@ -51,7 +51,7 @@ Keymile kmeter1 Board tftp 10000 u-boot.bin => run load - Using FSL UEC0 device + Using UEC0 device TFTP from server 192.168.1.1; our IP address is 192.168.205.4 Filename '/tftpboot/kmeter1/u-boot.bin'. Load address: 0x200000 diff --git a/drivers/qe/uec.c b/drivers/qe/uec.c index ccbf27d0be..3e92fe95a6 100644 --- a/drivers/qe/uec.c +++ b/drivers/qe/uec.c @@ -1367,7 +1367,7 @@ int uec_initialize(bd_t *bis, uec_info_t *uec_info) uec->uec_info = uec_info; uec->dev = dev; - sprintf(dev->name, "FSL UEC%d", uec_info->uf_info.ucc_num); + sprintf(dev->name, "UEC%d", uec_info->uf_info.ucc_num); dev->iobase = 0; dev->priv = (void *)uec; dev->init = uec_init; diff --git a/drivers/qe/uec_phy.c b/drivers/qe/uec_phy.c index 3baffe42fb..2d3a896d6f 100644 --- a/drivers/qe/uec_phy.c +++ b/drivers/qe/uec_phy.c @@ -71,8 +71,8 @@ * {name, speed, duplex}, * * #define CONFIG_SYS_FIXED_PHY_PORTS \ - * CONFIG_SYS_FIXED_PHY_PORT("FSL UEC0",SPEED_100,DUPLEX_FULL) \ - * CONFIG_SYS_FIXED_PHY_PORT("FSL UEC2",SPEED_100,DUPLEX_HALF) + * CONFIG_SYS_FIXED_PHY_PORT("UEC0",SPEED_100,DUPLEX_FULL) \ + * CONFIG_SYS_FIXED_PHY_PORT("UEC2",SPEED_100,DUPLEX_HALF) */ #ifndef CONFIG_FIXED_PHY @@ -102,7 +102,7 @@ static const struct fixed_phy_port fixed_phy_port[] = { * Example board header file to define bitbang ethernet ports: * * #define CONFIG_SYS_BITBANG_PHY_PORT(name) name, - * #define CONFIG_SYS_BITBANG_PHY_PORTS CONFIG_SYS_BITBANG_PHY_PORT("FSL UEC0") + * #define CONFIG_SYS_BITBANG_PHY_PORTS CONFIG_SYS_BITBANG_PHY_PORT("UEC0") */ #ifndef CONFIG_SYS_BITBANG_PHY_PORTS #define CONFIG_SYS_BITBANG_PHY_PORTS /* default is an empty array */ diff --git a/include/configs/MPC8323ERDB.h b/include/configs/MPC8323ERDB.h index 7c843939c2..9a296a1e4a 100644 --- a/include/configs/MPC8323ERDB.h +++ b/include/configs/MPC8323ERDB.h @@ -338,7 +338,7 @@ * QE UEC ethernet configuration */ #define CONFIG_UEC_ETH -#define CONFIG_ETHPRIME "FSL UEC0" +#define CONFIG_ETHPRIME "UEC0" #define CONFIG_UEC_ETH1 /* ETH3 */ diff --git a/include/configs/MPC832XEMDS.h b/include/configs/MPC832XEMDS.h index 7bd279369e..68ff191667 100644 --- a/include/configs/MPC832XEMDS.h +++ b/include/configs/MPC832XEMDS.h @@ -353,7 +353,7 @@ * QE UEC ethernet configuration */ #define CONFIG_UEC_ETH -#define CONFIG_ETHPRIME "FSL UEC0" +#define CONFIG_ETHPRIME "UEC0" #define CONFIG_UEC_ETH1 /* ETH3 */ diff --git a/include/configs/MPC8360EMDS.h b/include/configs/MPC8360EMDS.h index 87a137b3a3..c58e0031ae 100644 --- a/include/configs/MPC8360EMDS.h +++ b/include/configs/MPC8360EMDS.h @@ -390,7 +390,7 @@ * QE UEC ethernet configuration */ #define CONFIG_UEC_ETH -#define CONFIG_ETHPRIME "FSL UEC0" +#define CONFIG_ETHPRIME "UEC0" #define CONFIG_PHY_MODE_NEED_CHANGE #define CONFIG_UEC_ETH1 /* GETH1 */ diff --git a/include/configs/MPC8360ERDK.h b/include/configs/MPC8360ERDK.h index e78cf60a10..9fa577df9b 100644 --- a/include/configs/MPC8360ERDK.h +++ b/include/configs/MPC8360ERDK.h @@ -309,7 +309,7 @@ * QE UEC ethernet configuration */ #define CONFIG_UEC_ETH -#define CONFIG_ETHPRIME "FSL UEC0" +#define CONFIG_ETHPRIME "UEC0" #define CONFIG_UEC_ETH1 /* GETH1 */ diff --git a/include/configs/MPC8568MDS.h b/include/configs/MPC8568MDS.h index ea7a134b8d..2dc2932524 100644 --- a/include/configs/MPC8568MDS.h +++ b/include/configs/MPC8568MDS.h @@ -313,7 +313,7 @@ extern unsigned long get_clock_freq(void); */ #define CONFIG_UEC_ETH #ifndef CONFIG_TSEC_ENET -#define CONFIG_ETHPRIME "FSL UEC0" +#define CONFIG_ETHPRIME "UEC0" #endif #define CONFIG_PHY_MODE_NEED_CHANGE #define CONFIG_eTSEC_MDIO_BUS diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h index f69b650185..8177db371a 100644 --- a/include/configs/MPC8569MDS.h +++ b/include/configs/MPC8569MDS.h @@ -363,7 +363,7 @@ extern unsigned long get_clock_freq(void); #define CONFIG_MIIM_ADDRESS (CONFIG_SYS_CCSRBAR + 0x82120) #define CONFIG_UEC_ETH -#define CONFIG_ETHPRIME "FSL UEC0" +#define CONFIG_ETHPRIME "UEC0" #define CONFIG_PHY_MODE_NEED_CHANGE #define CONFIG_UEC_ETH1 /* GETH1 */ diff --git a/include/configs/kmeter1.h b/include/configs/kmeter1.h index 64972317fb..f7d36b1ff2 100644 --- a/include/configs/kmeter1.h +++ b/include/configs/kmeter1.h @@ -284,7 +284,7 @@ * QE UEC ethernet configuration */ #define CONFIG_UEC_ETH -#define CONFIG_ETHPRIME "FSL UEC0" +#define CONFIG_ETHPRIME "UEC0" #define CONFIG_UEC_ETH1 /* GETH1 */ #define UEC_VERBOSE_DEBUG 1 From 5700bb63522c2af9276f25a15448b61f19d72841 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 27 Jul 2010 18:35:08 -0400 Subject: [PATCH 10/16] miiphy: constify device name The driver name does not need to be writable, so constify it. Signed-off-by: Mike Frysinger Signed-off-by: Ben Warren --- arch/arm/cpu/arm920t/at91rm9200/ether.c | 4 +-- arch/arm/cpu/ixp/npe/include/npe.h | 4 +-- arch/arm/cpu/ixp/npe/miiphy.c | 4 +-- arch/m68k/include/asm/fec.h | 4 +-- arch/mips/cpu/au1x00_eth.c | 4 +-- arch/powerpc/cpu/mpc8220/fec.c | 8 ++--- arch/powerpc/cpu/mpc8xx/fec.c | 8 ++--- arch/powerpc/cpu/ppc4xx/miiphy.c | 4 +-- board/evb64260/eth.c | 6 ++-- board/prodrive/p3mx/mv_eth.c | 8 ++--- common/cmd_mii.c | 2 +- common/miiphyutil.c | 41 +++++++++++++------------ drivers/net/4xx_enet.c | 4 +-- drivers/net/altera_tse.c | 4 +-- drivers/net/at91_emac.c | 4 +-- drivers/net/bfin_mac.c | 4 +-- drivers/net/davinci_emac.c | 4 +-- drivers/net/designware.c | 4 +-- drivers/net/eepro100.c | 4 +-- drivers/net/ep93xx_eth.c | 8 ++--- drivers/net/fec_mxc.c | 4 +-- drivers/net/macb.c | 4 +-- drivers/net/mcfmii.c | 4 +-- drivers/net/mpc512x_fec.c | 8 ++--- drivers/net/mpc5xxx_fec.c | 8 ++--- drivers/net/mvgbe.c | 4 +-- drivers/net/ns7520_eth.c | 4 +-- drivers/net/tsec.c | 8 ++--- drivers/qe/uec.c | 6 ++-- include/miiphy.h | 30 +++++++++--------- 30 files changed, 107 insertions(+), 106 deletions(-) diff --git a/arch/arm/cpu/arm920t/at91rm9200/ether.c b/arch/arm/cpu/arm920t/at91rm9200/ether.c index 91eab95eed..e1cdebab9d 100644 --- a/arch/arm/cpu/arm920t/at91rm9200/ether.c +++ b/arch/arm/cpu/arm920t/at91rm9200/ether.c @@ -283,7 +283,7 @@ void eth_halt (void) }; #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) -int at91rm9200_miiphy_read(char *devname, unsigned char addr, +int at91rm9200_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short * value) { at91rm9200_EmacEnableMDIO (p_mac); @@ -292,7 +292,7 @@ int at91rm9200_miiphy_read(char *devname, unsigned char addr, return 0; } -int at91rm9200_miiphy_write(char *devname, unsigned char addr, +int at91rm9200_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { at91rm9200_EmacEnableMDIO (p_mac); diff --git a/arch/arm/cpu/ixp/npe/include/npe.h b/arch/arm/cpu/ixp/npe/include/npe.h index 3d6f727476..b5eef8633f 100644 --- a/arch/arm/cpu/ixp/npe/include/npe.h +++ b/arch/arm/cpu/ixp/npe/include/npe.h @@ -82,9 +82,9 @@ struct npe { /* * prototypes... */ -extern int npe_miiphy_read (char *devname, unsigned char addr, +extern int npe_miiphy_read (const char *devname, unsigned char addr, unsigned char reg, unsigned short *value); -extern int npe_miiphy_write (char *devname, unsigned char addr, +extern int npe_miiphy_write (const char *devname, unsigned char addr, unsigned char reg, unsigned short value); #endif /* ifndef NPE_H */ diff --git a/arch/arm/cpu/ixp/npe/miiphy.c b/arch/arm/cpu/ixp/npe/miiphy.c index b208c51eae..4b0201a357 100644 --- a/arch/arm/cpu/ixp/npe/miiphy.c +++ b/arch/arm/cpu/ixp/npe/miiphy.c @@ -100,7 +100,7 @@ int phy_setup_aneg (char *devname, unsigned char addr) } -int npe_miiphy_read (char *devname, unsigned char addr, +int npe_miiphy_read (const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { u16 val; @@ -112,7 +112,7 @@ int npe_miiphy_read (char *devname, unsigned char addr, } /* phy_read */ -int npe_miiphy_write (char *devname, unsigned char addr, +int npe_miiphy_write (const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { ixEthAccMiiWriteRtn(addr, reg, value); diff --git a/arch/m68k/include/asm/fec.h b/arch/m68k/include/asm/fec.h index 49311e596f..cecec59ff6 100644 --- a/arch/m68k/include/asm/fec.h +++ b/arch/m68k/include/asm/fec.h @@ -357,9 +357,9 @@ int fecpin_setclear(struct eth_device *dev, int setclear); void __mii_init(void); uint mii_send(uint mii_cmd); int mii_discover_phy(struct eth_device *dev); -int mcffec_miiphy_read(char *devname, unsigned char addr, +int mcffec_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value); -int mcffec_miiphy_write(char *devname, unsigned char addr, +int mcffec_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value); #endif diff --git a/arch/mips/cpu/au1x00_eth.c b/arch/mips/cpu/au1x00_eth.c index 5074997a29..c51079961c 100644 --- a/arch/mips/cpu/au1x00_eth.c +++ b/arch/mips/cpu/au1x00_eth.c @@ -89,7 +89,7 @@ mac_fifo_t mac_fifo[NO_OF_FIFOS]; #define MAX_WAIT 1000 #if defined(CONFIG_CMD_MII) -int au1x00_miiphy_read(char *devname, unsigned char addr, +int au1x00_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short * value) { volatile u32 *mii_control_reg = (volatile u32*)(ETH0_BASE+MAC_MII_CNTRL); @@ -122,7 +122,7 @@ int au1x00_miiphy_read(char *devname, unsigned char addr, return 0; } -int au1x00_miiphy_write(char *devname, unsigned char addr, +int au1x00_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { volatile u32 *mii_control_reg = (volatile u32*)(ETH0_BASE+MAC_MII_CNTRL); diff --git a/arch/powerpc/cpu/mpc8220/fec.c b/arch/powerpc/cpu/mpc8220/fec.c index 9a6d434dba..00879dff5c 100644 --- a/arch/powerpc/cpu/mpc8220/fec.c +++ b/arch/powerpc/cpu/mpc8220/fec.c @@ -34,8 +34,8 @@ typedef struct { u8 head[16]; /* MAC header(6 + 6 + 2) + 2(aligned) */ } NBUF; -int fec8220_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal); -int fec8220_miiphy_write (char *devname, u8 phyAddr, u8 regAddr, u16 data); +int fec8220_miiphy_read (const char *devname, u8 phyAddr, u8 regAddr, u16 *retVal); +int fec8220_miiphy_write (const char *devname, u8 phyAddr, u8 regAddr, u16 data); /********************************************************************/ #ifdef DEBUG @@ -881,7 +881,7 @@ int mpc8220_fec_initialize (bd_t * bis) /* MII-interface related functions */ /********************************************************************/ -int fec8220_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal) +int fec8220_miiphy_read (const char *devname, u8 phyAddr, u8 regAddr, u16 *retVal) { ethernet_regs *eth = (ethernet_regs *) MMAP_FEC1; u32 reg; /* convenient holder for the PHY register */ @@ -925,7 +925,7 @@ int fec8220_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal) } /********************************************************************/ -int fec8220_miiphy_write (char *devname, u8 phyAddr, u8 regAddr, u16 data) +int fec8220_miiphy_write(const char *devname, u8 phyAddr, u8 regAddr, u16 data) { ethernet_regs *eth = (ethernet_regs *) MMAP_FEC1; u32 reg; /* convenient holder for the PHY register */ diff --git a/arch/powerpc/cpu/mpc8xx/fec.c b/arch/powerpc/cpu/mpc8xx/fec.c index 754f8db9ed..d4abeb1b2f 100644 --- a/arch/powerpc/cpu/mpc8xx/fec.c +++ b/arch/powerpc/cpu/mpc8xx/fec.c @@ -63,9 +63,9 @@ DECLARE_GLOBAL_DATA_PTR; static int mii_discover_phy(struct eth_device *dev); #endif -int fec8xx_miiphy_read(char *devname, unsigned char addr, +int fec8xx_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value); -int fec8xx_miiphy_write(char *devname, unsigned char addr, +int fec8xx_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value); static struct ether_fcc_info_s @@ -990,7 +990,7 @@ void mii_init (void) * Otherwise they hang in mii_send() !!! Sorry! *****************************************************************************/ -int fec8xx_miiphy_read(char *devname, unsigned char addr, +int fec8xx_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { short rdreg; /* register working value */ @@ -1007,7 +1007,7 @@ int fec8xx_miiphy_read(char *devname, unsigned char addr, return 0; } -int fec8xx_miiphy_write(char *devname, unsigned char addr, +int fec8xx_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { short rdreg; /* register working value */ diff --git a/arch/powerpc/cpu/ppc4xx/miiphy.c b/arch/powerpc/cpu/ppc4xx/miiphy.c index 22ed5c25ea..4fec126f40 100644 --- a/arch/powerpc/cpu/ppc4xx/miiphy.c +++ b/arch/powerpc/cpu/ppc4xx/miiphy.c @@ -338,7 +338,7 @@ static int emac_miiphy_command(u8 addr, u8 reg, int cmd, u16 value) return 0; } -int emac4xx_miiphy_read (char *devname, unsigned char addr, unsigned char reg, +int emac4xx_miiphy_read (const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { unsigned long sta_reg; @@ -359,7 +359,7 @@ int emac4xx_miiphy_read (char *devname, unsigned char addr, unsigned char reg, /* write a phy reg and return the value with a rc */ /***********************************************************/ -int emac4xx_miiphy_write (char *devname, unsigned char addr, unsigned char reg, +int emac4xx_miiphy_write (const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { return emac_miiphy_command(addr, reg, EMAC_STACR_WRITE, value); diff --git a/board/evb64260/eth.c b/board/evb64260/eth.c index 8d1b606213..a96e65590f 100644 --- a/board/evb64260/eth.c +++ b/board/evb64260/eth.c @@ -89,7 +89,7 @@ static const char ether_port_phy_addr[3]={4,5,6}; /* MII PHY access routines are common for all i/f, use gal_ent0 */ #define GT6426x_MII_DEVNAME "gal_enet0" -int gt6426x_miiphy_read(char *devname, unsigned char phy, +int gt6426x_miiphy_read(const char *devname, unsigned char phy, unsigned char reg, unsigned short *val); static inline unsigned short @@ -345,7 +345,7 @@ gt6426x_eth_disable(void *v) MII utilities - write: write to an MII register via SMI ***************************************************************************/ int -gt6426x_miiphy_write(char *devname, unsigned char phy, +gt6426x_miiphy_write(const char *devname, unsigned char phy, unsigned char reg, unsigned short data) { unsigned int temp= (reg<<21) | (phy<<16) | data; @@ -360,7 +360,7 @@ gt6426x_miiphy_write(char *devname, unsigned char phy, MII utilities - read: read from an MII register via SMI ***************************************************************************/ int -gt6426x_miiphy_read(char *devname, unsigned char phy, +gt6426x_miiphy_read(const char *devname, unsigned char phy, unsigned char reg, unsigned short *val) { unsigned int temp= (reg<<21) | (phy<<16) | 1<<26; diff --git a/board/prodrive/p3mx/mv_eth.c b/board/prodrive/p3mx/mv_eth.c index e67596bd1a..567ae99d06 100644 --- a/board/prodrive/p3mx/mv_eth.c +++ b/board/prodrive/p3mx/mv_eth.c @@ -99,9 +99,9 @@ int mv64460_eth_receive (struct eth_device *dev); int mv64460_eth_xmit (struct eth_device *, volatile void *packet, int length); -int mv_miiphy_read(char *devname, unsigned char phy_addr, +int mv_miiphy_read(const char *devname, unsigned char phy_addr, unsigned char phy_reg, unsigned short *value); -int mv_miiphy_write(char *devname, unsigned char phy_addr, +int mv_miiphy_write(const char *devname, unsigned char phy_addr, unsigned char phy_reg, unsigned short value); int phy_setup_aneg (char *devname, unsigned char addr); @@ -2544,7 +2544,7 @@ static bool eth_port_read_smi_reg (ETH_PORT eth_port_num, return true; } -int mv_miiphy_read(char *devname, unsigned char phy_addr, +int mv_miiphy_read(const char *devname, unsigned char phy_addr, unsigned char phy_reg, unsigned short *value) { unsigned int reg_value; @@ -2629,7 +2629,7 @@ static bool eth_port_write_smi_reg (ETH_PORT eth_port_num, return true; } -int mv_miiphy_write(char *devname, unsigned char phy_addr, +int mv_miiphy_write(const char *devname, unsigned char phy_addr, unsigned char phy_reg, unsigned short value) { unsigned int reg_value; diff --git a/common/cmd_mii.c b/common/cmd_mii.c index bb941862db..3ea493ba49 100644 --- a/common/cmd_mii.c +++ b/common/cmd_mii.c @@ -299,7 +299,7 @@ int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) unsigned char addr, reg; unsigned short data; int rcode = 0; - char *devname; + const char *devname; if (argc < 2) return cmd_usage(cmdtp); diff --git a/common/miiphyutil.c b/common/miiphyutil.c index 4b186dd28c..a299b129a2 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -46,10 +46,10 @@ struct mii_dev { struct list_head link; - char *name; - int (*read) (char *devname, unsigned char addr, + const char *name; + int (*read) (const char *devname, unsigned char addr, unsigned char reg, unsigned short *value); - int (*write) (char *devname, unsigned char addr, + int (*write) (const char *devname, unsigned char addr, unsigned char reg, unsigned short value); }; @@ -60,7 +60,7 @@ static struct mii_dev *current_mii; * * Initialize global data. Need to be called before any other miiphy routine. */ -void miiphy_init () +void miiphy_init(void) { INIT_LIST_HEAD (&mii_devs); current_mii = NULL; @@ -70,16 +70,17 @@ void miiphy_init () * * Register read and write MII access routines for the device . */ -void miiphy_register (char *name, - int (*read) (char *devname, unsigned char addr, +void miiphy_register(const char *name, + int (*read) (const char *devname, unsigned char addr, unsigned char reg, unsigned short *value), - int (*write) (char *devname, unsigned char addr, + int (*write) (const char *devname, unsigned char addr, unsigned char reg, unsigned short value)) { struct list_head *entry; struct mii_dev *new_dev; struct mii_dev *miidev; unsigned int name_len; + char *new_name; /* check if we have unique name */ list_for_each (entry, &mii_devs) { @@ -107,9 +108,9 @@ void miiphy_register (char *name, INIT_LIST_HEAD (&new_dev->link); new_dev->read = read; new_dev->write = write; - new_dev->name = (char *)(new_dev + 1); - strncpy (new_dev->name, name, name_len); - new_dev->name[name_len] = '\0'; + new_dev->name = new_name = (char *)(new_dev + 1); + strncpy (new_name, name, name_len); + new_name[name_len] = '\0'; debug ("miiphy_register: added '%s', read=0x%08lx, write=0x%08lx\n", new_dev->name, new_dev->read, new_dev->write); @@ -121,7 +122,7 @@ void miiphy_register (char *name, current_mii = new_dev; } -int miiphy_set_current_dev (char *devname) +int miiphy_set_current_dev(const char *devname) { struct list_head *entry; struct mii_dev *dev; @@ -139,7 +140,7 @@ int miiphy_set_current_dev (char *devname) return 1; } -char *miiphy_get_current_dev () +const char *miiphy_get_current_dev(void) { if (current_mii) return current_mii->name; @@ -155,7 +156,7 @@ char *miiphy_get_current_dev () * Returns: * 0 on success */ -int miiphy_read (char *devname, unsigned char addr, unsigned char reg, +int miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { struct list_head *entry; @@ -192,7 +193,7 @@ int miiphy_read (char *devname, unsigned char addr, unsigned char reg, * Returns: * 0 on success */ -int miiphy_write (char *devname, unsigned char addr, unsigned char reg, +int miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { struct list_head *entry; @@ -252,7 +253,7 @@ void miiphy_listdev (void) * Returns: * 0 on success */ -int miiphy_info (char *devname, unsigned char addr, unsigned int *oui, +int miiphy_info(const char *devname, unsigned char addr, unsigned int *oui, unsigned char *model, unsigned char *rev) { unsigned int reg = 0; @@ -290,7 +291,7 @@ int miiphy_info (char *devname, unsigned char addr, unsigned int *oui, * Returns: * 0 on success */ -int miiphy_reset (char *devname, unsigned char addr) +int miiphy_reset(const char *devname, unsigned char addr) { unsigned short reg; int timeout = 500; @@ -332,7 +333,7 @@ int miiphy_reset (char *devname, unsigned char addr) * * Determine the ethernet speed (10/100/1000). Return 10 on error. */ -int miiphy_speed (char *devname, unsigned char addr) +int miiphy_speed(const char *devname, unsigned char addr) { u16 bmcr, anlpar; @@ -386,7 +387,7 @@ miiphy_read_failed: * * Determine full/half duplex. Return half on error. */ -int miiphy_duplex (char *devname, unsigned char addr) +int miiphy_duplex(const char *devname, unsigned char addr) { u16 bmcr, anlpar; @@ -446,7 +447,7 @@ miiphy_read_failed: * Return 1 if PHY supports 1000BASE-X, 0 if PHY supports 10BASE-T/100BASE-TX/ * 1000BASE-T, or on error. */ -int miiphy_is_1000base_x (char *devname, unsigned char addr) +int miiphy_is_1000base_x(const char *devname, unsigned char addr) { #if defined(CONFIG_PHY_GIGE) u16 exsr; @@ -467,7 +468,7 @@ int miiphy_is_1000base_x (char *devname, unsigned char addr) * * Determine link status */ -int miiphy_link (char *devname, unsigned char addr) +int miiphy_link(const char *devname, unsigned char addr) { unsigned short reg; diff --git a/drivers/net/4xx_enet.c b/drivers/net/4xx_enet.c index 144b851357..d9487ad732 100644 --- a/drivers/net/4xx_enet.c +++ b/drivers/net/4xx_enet.c @@ -305,9 +305,9 @@ static void mal_err (struct eth_device *dev, unsigned long isr, static void emac_err (struct eth_device *dev, unsigned long isr); extern int phy_setup_aneg (char *devname, unsigned char addr); -extern int emac4xx_miiphy_read (char *devname, unsigned char addr, +extern int emac4xx_miiphy_read (const char *devname, unsigned char addr, unsigned char reg, unsigned short *value); -extern int emac4xx_miiphy_write (char *devname, unsigned char addr, +extern int emac4xx_miiphy_write (const char *devname, unsigned char addr, unsigned char reg, unsigned short value); int board_emac_count(void); diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index 5c0c274ba3..d45aab1306 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -426,7 +426,7 @@ static int tse_mdio_write(struct altera_tse_priv *priv, unsigned int regnum, /* MDIO access to phy */ #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) && !defined(BITBANGMII) -static int altera_tse_miiphy_write(char *devname, unsigned char addr, +static int altera_tse_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { struct eth_device *dev; @@ -439,7 +439,7 @@ static int altera_tse_miiphy_write(char *devname, unsigned char addr, return 0; } -static int altera_tse_miiphy_read(char *devname, unsigned char addr, +static int altera_tse_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { struct eth_device *dev; diff --git a/drivers/net/at91_emac.c b/drivers/net/at91_emac.c index 245da121b9..0912f52822 100644 --- a/drivers/net/at91_emac.c +++ b/drivers/net/at91_emac.c @@ -170,7 +170,7 @@ at91_emac_t *get_emacbase_by_name(char *devname) return (at91_emac_t *) netdev->iobase; } -int at91emac_mii_read(char *devname, unsigned char addr, +int at91emac_mii_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { at91_emac_t *emac; @@ -181,7 +181,7 @@ int at91emac_mii_read(char *devname, unsigned char addr, } -int at91emac_mii_write(char *devname, unsigned char addr, +int at91emac_mii_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { at91_emac_t *emac; diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index e691bdf211..36d4046ec1 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c @@ -71,7 +71,7 @@ static int bfin_miiphy_wait(void) return 0; } -static int bfin_miiphy_read(char *devname, uchar addr, uchar reg, ushort *val) +static int bfin_miiphy_read(const char *devname, uchar addr, uchar reg, ushort *val) { if (bfin_miiphy_wait()) return 1; @@ -82,7 +82,7 @@ static int bfin_miiphy_read(char *devname, uchar addr, uchar reg, ushort *val) return 0; } -static int bfin_miiphy_write(char *devname, uchar addr, uchar reg, ushort val) +static int bfin_miiphy_write(const char *devname, uchar addr, uchar reg, ushort val) { if (bfin_miiphy_wait()) return 1; diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 02bbb8c0af..41a9910919 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c @@ -252,12 +252,12 @@ static int gen_auto_negotiate(int phy_addr) #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) -static int davinci_mii_phy_read(char *devname, unsigned char addr, unsigned char reg, unsigned short *value) +static int davinci_mii_phy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { return(davinci_eth_phy_read(addr, reg, value) ? 0 : 1); } -static int davinci_mii_phy_write(char *devname, unsigned char addr, unsigned char reg, unsigned short value) +static int davinci_mii_phy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { return(davinci_eth_phy_write(addr, reg, value) ? 0 : 1); } diff --git a/drivers/net/designware.c b/drivers/net/designware.c index d0d98277ea..2f923f26f9 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -451,7 +451,7 @@ static int configure_phy(struct eth_device *dev) } #if defined(CONFIG_MII) -static int dw_mii_read(char *devname, u8 addr, u8 reg, u16 *val) +static int dw_mii_read(const char *devname, u8 addr, u8 reg, u16 *val) { struct eth_device *dev; @@ -462,7 +462,7 @@ static int dw_mii_read(char *devname, u8 addr, u8 reg, u16 *val) return 0; } -static int dw_mii_write(char *devname, u8 addr, u8 reg, u16 val) +static int dw_mii_write(const char *devname, u8 addr, u8 reg, u16 val) { struct eth_device *dev; diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 9c06b25569..5cb767a795 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -350,7 +350,7 @@ static struct eth_device* verify_phyaddr (char *devname, unsigned char addr) return dev; } -static int eepro100_miiphy_read (char *devname, unsigned char addr, +static int eepro100_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { struct eth_device *dev; @@ -367,7 +367,7 @@ static int eepro100_miiphy_read (char *devname, unsigned char addr, return 0; } -static int eepro100_miiphy_write (char *devname, unsigned char addr, +static int eepro100_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { struct eth_device *dev; diff --git a/drivers/net/ep93xx_eth.c b/drivers/net/ep93xx_eth.c index 4e39948d2f..c09384c632 100644 --- a/drivers/net/ep93xx_eth.c +++ b/drivers/net/ep93xx_eth.c @@ -44,9 +44,9 @@ #define GET_REGS(eth_dev) (GET_PRIV(eth_dev)->regs) /* ep93xx_miiphy ops forward declarations */ -static int ep93xx_miiphy_read(char * const dev, unsigned char const addr, +static int ep93xx_miiphy_read(const char * const dev, unsigned char const addr, unsigned char const reg, unsigned short * const value); -static int ep93xx_miiphy_write(char * const dev, unsigned char const addr, +static int ep93xx_miiphy_write(const char * const dev, unsigned char const addr, unsigned char const reg, unsigned short const value); #if defined(EP93XX_MAC_DEBUG) @@ -555,7 +555,7 @@ eth_init_done: /** * Read a 16-bit value from an MII register. */ -static int ep93xx_miiphy_read(char * const dev, unsigned char const addr, +static int ep93xx_miiphy_read(const char * const dev, unsigned char const addr, unsigned char const reg, unsigned short * const value) { struct mac_regs *mac = (struct mac_regs *)MAC_BASE; @@ -607,7 +607,7 @@ static int ep93xx_miiphy_read(char * const dev, unsigned char const addr, /** * Write a 16-bit value to an MII register. */ -static int ep93xx_miiphy_write(char * const dev, unsigned char const addr, +static int ep93xx_miiphy_write(const char * const dev, unsigned char const addr, unsigned char const reg, unsigned short const value) { struct mac_regs *mac = (struct mac_regs *)MAC_BASE; diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 6b801ce24a..2d4ffed4fa 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -62,7 +62,7 @@ struct fec_priv gfec = { /* * MII-interface related functions */ -static int fec_miiphy_read(char *dev, uint8_t phyAddr, uint8_t regAddr, +static int fec_miiphy_read(const char *dev, uint8_t phyAddr, uint8_t regAddr, uint16_t *retVal) { struct eth_device *edev = eth_get_dev_by_name(dev); @@ -119,7 +119,7 @@ static void fec_mii_setspeed(struct fec_priv *fec) debug("fec_init: mii_speed %#lx\n", fec->eth->mii_speed); } -static int fec_miiphy_write(char *dev, uint8_t phyAddr, uint8_t regAddr, +static int fec_miiphy_write(const char *dev, uint8_t phyAddr, uint8_t regAddr, uint16_t data) { struct eth_device *edev = eth_get_dev_by_name(dev); diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 6a58a374b2..acb8d20b13 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -167,7 +167,7 @@ static u16 macb_mdio_read(struct macb_device *macb, u8 reg) #if defined(CONFIG_CMD_MII) -int macb_miiphy_read(char *devname, u8 phy_adr, u8 reg, u16 *value) +int macb_miiphy_read(const char *devname, u8 phy_adr, u8 reg, u16 *value) { struct eth_device *dev = eth_get_dev_by_name(devname); struct macb_device *macb = to_macb(dev); @@ -180,7 +180,7 @@ int macb_miiphy_read(char *devname, u8 phy_adr, u8 reg, u16 *value) return 0; } -int macb_miiphy_write(char *devname, u8 phy_adr, u8 reg, u16 value) +int macb_miiphy_write(const char *devname, u8 phy_adr, u8 reg, u16 value) { struct eth_device *dev = eth_get_dev_by_name(devname); struct macb_device *macb = to_macb(dev); diff --git a/drivers/net/mcfmii.c b/drivers/net/mcfmii.c index 060bdd7397..401182d426 100644 --- a/drivers/net/mcfmii.c +++ b/drivers/net/mcfmii.c @@ -293,7 +293,7 @@ void __mii_init(void) * Otherwise they hang in mii_send() !!! Sorry! */ -int mcffec_miiphy_read(char *devname, unsigned char addr, unsigned char reg, +int mcffec_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { short rdreg; /* register working value */ @@ -312,7 +312,7 @@ int mcffec_miiphy_read(char *devname, unsigned char addr, unsigned char reg, return 0; } -int mcffec_miiphy_write(char *devname, unsigned char addr, unsigned char reg, +int mcffec_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { short rdreg; /* register working value */ diff --git a/drivers/net/mpc512x_fec.c b/drivers/net/mpc512x_fec.c index 6ea4a2b342..f56d940f91 100644 --- a/drivers/net/mpc512x_fec.c +++ b/drivers/net/mpc512x_fec.c @@ -25,8 +25,8 @@ DECLARE_GLOBAL_DATA_PTR; #error "CONFIG_MII has to be defined!" #endif -int fec512x_miiphy_read(char *devname, u8 phyAddr, u8 regAddr, u16 * retVal); -int fec512x_miiphy_write(char *devname, u8 phyAddr, u8 regAddr, u16 data); +int fec512x_miiphy_read(const char *devname, u8 phyAddr, u8 regAddr, u16 * retVal); +int fec512x_miiphy_write(const char *devname, u8 phyAddr, u8 regAddr, u16 data); int mpc512x_fec_init_phy(struct eth_device *dev, bd_t * bis); static uchar rx_buff[FEC_BUFFER_SIZE]; @@ -672,7 +672,7 @@ int mpc512x_fec_initialize (bd_t * bis) /* MII-interface related functions */ /********************************************************************/ -int fec512x_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal) +int fec512x_miiphy_read(const char *devname, u8 phyAddr, u8 regAddr, u16 *retVal) { volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR; volatile fec512x_t *eth = &im->fec; @@ -719,7 +719,7 @@ int fec512x_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal) } /********************************************************************/ -int fec512x_miiphy_write (char *devname, u8 phyAddr, u8 regAddr, u16 data) +int fec512x_miiphy_write(const char *devname, u8 phyAddr, u8 regAddr, u16 data) { volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR; volatile fec512x_t *eth = &im->fec; diff --git a/drivers/net/mpc5xxx_fec.c b/drivers/net/mpc5xxx_fec.c index 4a1c8e6e42..c88e596c01 100644 --- a/drivers/net/mpc5xxx_fec.c +++ b/drivers/net/mpc5xxx_fec.c @@ -35,8 +35,8 @@ typedef struct { uint8 head[16]; /* MAC header(6 + 6 + 2) + 2(aligned) */ } NBUF; -int fec5xxx_miiphy_read(char *devname, uint8 phyAddr, uint8 regAddr, uint16 * retVal); -int fec5xxx_miiphy_write(char *devname, uint8 phyAddr, uint8 regAddr, uint16 data); +int fec5xxx_miiphy_read(const char *devname, uint8 phyAddr, uint8 regAddr, uint16 *retVal); +int fec5xxx_miiphy_write(const char *devname, uint8 phyAddr, uint8 regAddr, uint16 data); static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis); @@ -941,7 +941,7 @@ int mpc5xxx_fec_initialize(bd_t * bis) /* MII-interface related functions */ /********************************************************************/ -int fec5xxx_miiphy_read(char *devname, uint8 phyAddr, uint8 regAddr, uint16 * retVal) +int fec5xxx_miiphy_read(const char *devname, uint8 phyAddr, uint8 regAddr, uint16 * retVal) { ethernet_regs *eth = (ethernet_regs *)MPC5XXX_FEC; uint32 reg; /* convenient holder for the PHY register */ @@ -983,7 +983,7 @@ int fec5xxx_miiphy_read(char *devname, uint8 phyAddr, uint8 regAddr, uint16 * re } /********************************************************************/ -int fec5xxx_miiphy_write(char *devname, uint8 phyAddr, uint8 regAddr, uint16 data) +int fec5xxx_miiphy_write(const char *devname, uint8 phyAddr, uint8 regAddr, uint16 data) { ethernet_regs *eth = (ethernet_regs *)MPC5XXX_FEC; uint32 reg; /* convenient holder for the PHY register */ diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c index cad40237c9..c701f43ad6 100644 --- a/drivers/net/mvgbe.c +++ b/drivers/net/mvgbe.c @@ -54,7 +54,7 @@ DECLARE_GLOBAL_DATA_PTR; * * Returns 16bit phy register value, or 0xffff on error */ -static int smi_reg_read(char *devname, u8 phy_adr, u8 reg_ofs, u16 * data) +static int smi_reg_read(const char *devname, u8 phy_adr, u8 reg_ofs, u16 * data) { struct eth_device *dev = eth_get_dev_by_name(devname); struct mvgbe_device *dmvgbe = to_mvgbe(dev); @@ -131,7 +131,7 @@ static int smi_reg_read(char *devname, u8 phy_adr, u8 reg_ofs, u16 * data) * Returns 0 if write succeed, -EINVAL on bad parameters * -ETIME on timeout */ -static int smi_reg_write(char *devname, u8 phy_adr, u8 reg_ofs, u16 data) +static int smi_reg_write(const char *devname, u8 phy_adr, u8 reg_ofs, u16 data) { struct eth_device *dev = eth_get_dev_by_name(devname); struct mvgbe_device *dmvgbe = to_mvgbe(dev); diff --git a/drivers/net/ns7520_eth.c b/drivers/net/ns7520_eth.c index c28726e698..bfa651b7bf 100644 --- a/drivers/net/ns7520_eth.c +++ b/drivers/net/ns7520_eth.c @@ -761,7 +761,7 @@ enum mii_status { /** * Read a 16-bit value from an MII register. */ -extern int ns7520_miiphy_read(char *devname, unsigned char const addr, +extern int ns7520_miiphy_read(const char *devname, unsigned char const addr, unsigned char const reg, unsigned short *const value) { int ret = MII_STATUS_FAILURE; @@ -807,7 +807,7 @@ extern int ns7520_miiphy_read(char *devname, unsigned char const addr, /** * Write a 16-bit value to an MII register. */ -extern int ns7520_miiphy_write(char *devname, unsigned char const addr, +extern int ns7520_miiphy_write(const char *devname, unsigned char const addr, unsigned char const reg, unsigned short const value) { int ret = MII_STATUS_FAILURE; diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 54c4a704a5..9b5dd92fbb 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -60,9 +60,9 @@ static void phy_run_commands(struct tsec_private *priv, struct phy_cmd *cmd); static void adjust_link(struct eth_device *dev); #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) \ && !defined(BITBANGMII) -static int tsec_miiphy_write(char *devname, unsigned char addr, +static int tsec_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value); -static int tsec_miiphy_read(char *devname, unsigned char addr, +static int tsec_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value); #endif #ifdef CONFIG_MCAST_TFTP @@ -1919,7 +1919,7 @@ static void phy_run_commands(struct tsec_private *priv, struct phy_cmd *cmd) * Returns: * 0 on success */ -static int tsec_miiphy_read(char *devname, unsigned char addr, +static int tsec_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { unsigned short ret; @@ -1942,7 +1942,7 @@ static int tsec_miiphy_read(char *devname, unsigned char addr, * Returns: * 0 on success */ -static int tsec_miiphy_write(char *devname, unsigned char addr, +static int tsec_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { struct tsec_private *priv = privlist[0]; diff --git a/drivers/qe/uec.c b/drivers/qe/uec.c index 3e92fe95a6..e10c0f328c 100644 --- a/drivers/qe/uec.c +++ b/drivers/qe/uec.c @@ -603,7 +603,7 @@ static void phy_change(struct eth_device *dev) * Returns: * The index where the device is located, -1 on error */ -static int uec_miiphy_find_dev_by_name(char *devname) +static int uec_miiphy_find_dev_by_name(const char *devname) { int i; @@ -628,7 +628,7 @@ static int uec_miiphy_find_dev_by_name(char *devname) * Returns: * 0 on success */ -static int uec_miiphy_read(char *devname, unsigned char addr, +static int uec_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { int devindex = 0; @@ -650,7 +650,7 @@ static int uec_miiphy_read(char *devname, unsigned char addr, * Returns: * 0 on success */ -static int uec_miiphy_write(char *devname, unsigned char addr, +static int uec_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { int devindex = 0; diff --git a/include/miiphy.h b/include/miiphy.h index 5362125233..2f7d915526 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -36,30 +36,30 @@ #include -int miiphy_read (char *devname, unsigned char addr, unsigned char reg, +int miiphy_read (const char *devname, unsigned char addr, unsigned char reg, unsigned short *value); -int miiphy_write (char *devname, unsigned char addr, unsigned char reg, +int miiphy_write (const char *devname, unsigned char addr, unsigned char reg, unsigned short value); -int miiphy_info (char *devname, unsigned char addr, unsigned int *oui, +int miiphy_info (const char *devname, unsigned char addr, unsigned int *oui, unsigned char *model, unsigned char *rev); -int miiphy_reset (char *devname, unsigned char addr); -int miiphy_speed (char *devname, unsigned char addr); -int miiphy_duplex (char *devname, unsigned char addr); -int miiphy_is_1000base_x (char *devname, unsigned char addr); +int miiphy_reset (const char *devname, unsigned char addr); +int miiphy_speed (const char *devname, unsigned char addr); +int miiphy_duplex (const char *devname, unsigned char addr); +int miiphy_is_1000base_x (const char *devname, unsigned char addr); #ifdef CONFIG_SYS_FAULT_ECHO_LINK_DOWN -int miiphy_link (char *devname, unsigned char addr); +int miiphy_link (const char *devname, unsigned char addr); #endif void miiphy_init (void); -void miiphy_register (char *devname, - int (*read) (char *devname, unsigned char addr, +void miiphy_register (const char *devname, + int (*read) (const char *devname, unsigned char addr, unsigned char reg, unsigned short *value), - int (*write) (char *devname, unsigned char addr, + int (*write) (const char *devname, unsigned char addr, unsigned char reg, unsigned short value)); -int miiphy_set_current_dev (char *devname); -char *miiphy_get_current_dev (void); +int miiphy_set_current_dev (const char *devname); +const char *miiphy_get_current_dev (void); void miiphy_listdev (void); @@ -85,9 +85,9 @@ extern struct bb_miiphy_bus bb_miiphy_buses[]; extern int bb_miiphy_buses_num; void bb_miiphy_init (void); -int bb_miiphy_read (char *devname, unsigned char addr, +int bb_miiphy_read (const char *devname, unsigned char addr, unsigned char reg, unsigned short *value); -int bb_miiphy_write (char *devname, unsigned char addr, +int bb_miiphy_write (const char *devname, unsigned char addr, unsigned char reg, unsigned short value); #endif From 0daac97801fa5989d3740487aa824fbab9ff0503 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 27 Jul 2010 18:35:09 -0400 Subject: [PATCH 11/16] miiphy: unify device list lookup Rather than have every func re-implement the list walking code, do it one local function. This shrinks the resulting object code a little while making the source much more manageable. Signed-off-by: Mike Frysinger Signed-off-by: Ben Warren --- common/miiphyutil.c | 100 ++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 60 deletions(-) diff --git a/common/miiphyutil.c b/common/miiphyutil.c index a299b129a2..e055c08fbd 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -56,6 +56,30 @@ struct mii_dev { static struct list_head mii_devs; static struct mii_dev *current_mii; +/* + * Lookup the mii_dev struct by the registered device name. + */ +static struct mii_dev *miiphy_get_dev_by_name(const char *devname, int quiet) +{ + struct list_head *entry; + struct mii_dev *dev; + + if (!devname) { + printf("NULL device name!\n"); + return NULL; + } + + list_for_each(entry, &mii_devs) { + dev = list_entry(entry, struct mii_dev, link); + if (strcmp(dev->name, devname) == 0) + return dev; + } + + if (!quiet) + printf("No such device: %s\n", devname); + return NULL; +} + /***************************************************************************** * * Initialize global data. Need to be called before any other miiphy routine. @@ -76,20 +100,15 @@ void miiphy_register(const char *name, int (*write) (const char *devname, unsigned char addr, unsigned char reg, unsigned short value)) { - struct list_head *entry; struct mii_dev *new_dev; - struct mii_dev *miidev; unsigned int name_len; char *new_name; /* check if we have unique name */ - list_for_each (entry, &mii_devs) { - miidev = list_entry (entry, struct mii_dev, link); - if (strcmp (miidev->name, name) == 0) { - printf ("miiphy_register: non unique device name " - "'%s'\n", name); - return; - } + new_dev = miiphy_get_dev_by_name(name, 1); + if (new_dev) { + printf("miiphy_register: non unique device name '%s'\n", name); + return; } /* allocate memory */ @@ -124,19 +143,14 @@ void miiphy_register(const char *name, int miiphy_set_current_dev(const char *devname) { - struct list_head *entry; struct mii_dev *dev; - list_for_each (entry, &mii_devs) { - dev = list_entry (entry, struct mii_dev, link); - - if (strcmp (devname, dev->name) == 0) { - current_mii = dev; - return 0; - } + dev = miiphy_get_dev_by_name(devname, 0); + if (dev) { + current_mii = dev; + return 0; } - printf ("No such device: %s\n", devname); return 1; } @@ -159,30 +173,13 @@ const char *miiphy_get_current_dev(void) int miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { - struct list_head *entry; struct mii_dev *dev; - int found_dev = 0; - int read_ret = 0; - if (!devname) { - printf ("NULL device name!\n"); - return 1; - } + dev = miiphy_get_dev_by_name(devname, 0); + if (dev) + return dev->read(devname, addr, reg, value); - list_for_each (entry, &mii_devs) { - dev = list_entry (entry, struct mii_dev, link); - - if (strcmp (devname, dev->name) == 0) { - found_dev = 1; - read_ret = dev->read (devname, addr, reg, value); - break; - } - } - - if (found_dev == 0) - printf ("No such device: %s\n", devname); - - return ((found_dev) ? read_ret : 1); + return 1; } /***************************************************************************** @@ -196,30 +193,13 @@ int miiphy_read(const char *devname, unsigned char addr, unsigned char reg, int miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { - struct list_head *entry; struct mii_dev *dev; - int found_dev = 0; - int write_ret = 0; - if (!devname) { - printf ("NULL device name!\n"); - return 1; - } + dev = miiphy_get_dev_by_name(devname, 0); + if (dev) + return dev->write(devname, addr, reg, value); - list_for_each (entry, &mii_devs) { - dev = list_entry (entry, struct mii_dev, link); - - if (strcmp (devname, dev->name) == 0) { - found_dev = 1; - write_ret = dev->write (devname, addr, reg, value); - break; - } - } - - if (found_dev == 0) - printf ("No such device: %s\n", devname); - - return ((found_dev) ? write_ret : 1); + return 1; } /***************************************************************************** From ede16ea32da7a37f892bf63dcb43c16118ba39d6 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 27 Jul 2010 18:35:10 -0400 Subject: [PATCH 12/16] miiphy: leverage current_mii cache more For code that uses miiphy_{read,write}, every call invokes a full look up of the mii list. There is already a "current_mii" cache that is used by some code, but have the miiphy_{read,write} function use it as well. This does increase the code size slightly, but I think it's worth it. Signed-off-by: Mike Frysinger Signed-off-by: Ben Warren --- common/miiphyutil.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/common/miiphyutil.c b/common/miiphyutil.c index e055c08fbd..9cf845f605 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -162,6 +162,20 @@ const char *miiphy_get_current_dev(void) return NULL; } +static struct mii_dev *miiphy_get_active_dev(const char *devname) +{ + /* If the current mii is the one we want, return it */ + if (current_mii) + if (strcmp(current_mii->name, devname) == 0) + return current_mii; + + /* Otherwise, set the active one to the one we want */ + if (miiphy_set_current_dev(devname)) + return NULL; + else + return current_mii; +} + /***************************************************************************** * * Read to variable from the PHY attached to device , @@ -175,7 +189,7 @@ int miiphy_read(const char *devname, unsigned char addr, unsigned char reg, { struct mii_dev *dev; - dev = miiphy_get_dev_by_name(devname, 0); + dev = miiphy_get_active_dev(devname); if (dev) return dev->read(devname, addr, reg, value); @@ -195,7 +209,7 @@ int miiphy_write(const char *devname, unsigned char addr, unsigned char reg, { struct mii_dev *dev; - dev = miiphy_get_dev_by_name(devname, 0); + dev = miiphy_get_active_dev(devname); if (dev) return dev->write(devname, addr, reg, value); From d7fb9bcfb29a1cbdbda7006658e76c2d9da0f66f Mon Sep 17 00:00:00 2001 From: Ben Warren Date: Thu, 29 Jul 2010 12:56:11 -0700 Subject: [PATCH 13/16] Fix compile warnings for const correctness Commit 6e37b1a3a25004d3df5867de49fff6b3fc9c4f04 modifies several net calls to take a (const char *) parameter instead of (char *), but in some cases the modified functions call other functions taking (char *). The end result is warnings about discarding the const qualifier. This patch fixes these other function signatures. Signed-off-by: Ben Warren --- drivers/net/at91_emac.c | 2 +- drivers/net/eepro100.c | 3 ++- drivers/net/phy/miiphybb.c | 6 +++--- include/net.h | 2 +- net/eth.c | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/at91_emac.c b/drivers/net/at91_emac.c index 0912f52822..d82459b1ce 100644 --- a/drivers/net/at91_emac.c +++ b/drivers/net/at91_emac.c @@ -162,7 +162,7 @@ int at91emac_write(at91_emac_t *at91mac, unsigned char addr, #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) -at91_emac_t *get_emacbase_by_name(char *devname) +at91_emac_t *get_emacbase_by_name(const char *devname) { struct eth_device *netdev; diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 5cb767a795..22e14e3814 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -321,7 +321,8 @@ static int set_phyreg (struct eth_device *dev, unsigned char addr, /* Check if given phyaddr is valid, i.e. there is a PHY connected. * Do this by checking model value field from ID2 register. */ -static struct eth_device* verify_phyaddr (char *devname, unsigned char addr) +static struct eth_device* verify_phyaddr (const char *devname, + unsigned char addr) { struct eth_device *dev; unsigned short value; diff --git a/drivers/net/phy/miiphybb.c b/drivers/net/phy/miiphybb.c index 2768c7584e..1045cf1ba9 100644 --- a/drivers/net/phy/miiphybb.c +++ b/drivers/net/phy/miiphybb.c @@ -143,7 +143,7 @@ void bb_miiphy_init(void) } } -static inline struct bb_miiphy_bus *bb_miiphy_getbus(char *devname) +static inline struct bb_miiphy_bus *bb_miiphy_getbus(const char *devname) { #ifdef CONFIG_BITBANGMII_MULTI int i; @@ -246,7 +246,7 @@ static void miiphy_pre(struct bb_miiphy_bus *bus, char read, * Returns: * 0 on success */ -int bb_miiphy_read(char *devname, unsigned char addr, +int bb_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { short rdreg; /* register working value */ @@ -327,7 +327,7 @@ int bb_miiphy_read(char *devname, unsigned char addr, * Returns: * 0 on success */ -int bb_miiphy_write (char *devname, unsigned char addr, +int bb_miiphy_write (const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { struct bb_miiphy_bus *bus; diff --git a/include/net.h b/include/net.h index a180881dc7..ab571eb3ee 100644 --- a/include/net.h +++ b/include/net.h @@ -117,7 +117,7 @@ extern void eth_try_another(int first_restart); /* Change the device */ extern void eth_set_current(void); /* set nterface to ethcur var */ #endif extern struct eth_device *eth_get_dev(void); /* get the current device MAC */ -extern struct eth_device *eth_get_dev_by_name(char *devname); /* get device */ +extern struct eth_device *eth_get_dev_by_name(const char *devname); extern struct eth_device *eth_get_dev_by_index(int index); /* get dev @ index */ extern int eth_get_dev_index (void); /* get the device index */ extern void eth_parse_enetaddr(const char *addr, uchar *enetaddr); diff --git a/net/eth.c b/net/eth.c index de6d5c6040..993306f0a4 100644 --- a/net/eth.c +++ b/net/eth.c @@ -102,7 +102,7 @@ struct eth_device *eth_get_dev(void) return eth_current; } -struct eth_device *eth_get_dev_by_name(char *devname) +struct eth_device *eth_get_dev_by_name(const char *devname) { struct eth_device *dev, *target_dev; From 69a2a4d9a5884a6f2d04a551308980d452b9b349 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sun, 8 Aug 2010 15:05:39 +0300 Subject: [PATCH 14/16] disk/part.c: 'usb storage' avoiding overflow when output capacity Before: Marvell>> usb storage Device 0: Vendor: StoreJet Rev: Prod: Transcend Type: Hard Disk Capacity: 28759.9 MB = 28.0 GB (488397168 x 512) After: Marvell>> usb storage Device 0: Vendor: StoreJet Rev: Prod: Transcend Type: Hard Disk Capacity: 238475.1 MB = 232.8 GB (488397168 x 512) Signed-off-by: Sergei Trofimovich --- disk/part.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/disk/part.c b/disk/part.c index b6bae17940..3ba88c7e81 100644 --- a/disk/part.c +++ b/disk/part.c @@ -109,13 +109,30 @@ block_dev_desc_t *get_dev(char* ifname, int dev) /* * reports device info to the user */ + +#ifdef CONFIG_LBA48 +typedef uint64_t lba512_t; +#else +typedef lbaint_t lba512_t; +#endif + +/* + * Overflowless variant of (block_count * mul_by / div_by) + * when div_by > mul_by + */ +static lba512_t lba512_muldiv (lba512_t block_count, lba512_t mul_by, lba512_t div_by) +{ + lba512_t bc_quot, bc_rem; + + /* x * m / d == x / d * m + (x % d) * m / d */ + bc_quot = block_count / div_by; + bc_rem = block_count - div_by * bc_quot; + return bc_quot * mul_by + (bc_rem * mul_by) / div_by; +} + void dev_print (block_dev_desc_t *dev_desc) { -#ifdef CONFIG_LBA48 - uint64_t lba512; /* number of blocks if 512bytes block size */ -#else - lbaint_t lba512; -#endif + lba512_t lba512; /* number of blocks if 512bytes block size */ if (dev_desc->type == DEV_TYPE_UNKNOWN) { puts ("not available\n"); @@ -184,8 +201,9 @@ void dev_print (block_dev_desc_t *dev_desc) lba = dev_desc->lba; lba512 = (lba * (dev_desc->blksz/512)); - mb = (10 * lba512) / 2048; /* 2048 = (1024 * 1024) / 512 MB */ /* round to 1 digit */ + mb = lba512_muldiv(lba512, 10, 2048); /* 2048 = (1024 * 1024) / 512 MB */ + mb_quot = mb / 10; mb_rem = mb - (10 * mb_quot); From 8bbf4307c7a44ecf6a1cff905913a630ac949f18 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Wed, 11 Aug 2010 15:51:12 -0700 Subject: [PATCH 15/16] mmc: omap3: make local symbols static Make driver local variables and functions static and remove them from the arch header. Signed-off-by: Grazvydas Ignotas Tested-by: Steve Sakoman Signed-off-by: Sandeep Paulraj --- drivers/mmc/omap3_mmc.c | 33 +++++++++++++++++---------------- drivers/mmc/omap3_mmc.h | 9 --------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/drivers/mmc/omap3_mmc.c b/drivers/mmc/omap3_mmc.c index 9506cca218..238f537a25 100644 --- a/drivers/mmc/omap3_mmc.c +++ b/drivers/mmc/omap3_mmc.c @@ -33,7 +33,7 @@ #include "omap3_mmc.h" -const unsigned short mmc_transspeed_val[15][4] = { +static const unsigned short mmc_transspeed_val[15][4] = { {CLKD(10, 1), CLKD(10, 10), CLKD(10, 100), CLKD(10, 1000)}, {CLKD(12, 1), CLKD(12, 10), CLKD(12, 100), CLKD(12, 1000)}, {CLKD(13, 1), CLKD(13, 10), CLKD(13, 100), CLKD(13, 1000)}, @@ -51,7 +51,7 @@ const unsigned short mmc_transspeed_val[15][4] = { {CLKD(80, 1), CLKD(80, 10), CLKD(80, 100), CLKD(80, 1000)} }; -mmc_card_data cur_card_data; +static mmc_card_data cur_card_data; static block_dev_desc_t mmc_blk_dev; static hsmmc_t *mmc_base = (hsmmc_t *)OMAP_HSMMC1_BASE; @@ -80,7 +80,7 @@ block_dev_desc_t *mmc_get_dev(int dev) return (block_dev_desc_t *) &mmc_blk_dev; } -unsigned char mmc_board_init(void) +static unsigned char mmc_board_init(void) { #if defined(CONFIG_TWL4030_POWER) twl4030_power_mmc_init(); @@ -114,7 +114,7 @@ unsigned char mmc_board_init(void) return 1; } -void mmc_init_stream(void) +static void mmc_init_stream(void) { writel(readl(&mmc_base->con) | INIT_INITSTREAM, &mmc_base->con); @@ -129,7 +129,7 @@ void mmc_init_stream(void) writel(readl(&mmc_base->con) & ~INIT_INITSTREAM, &mmc_base->con); } -unsigned char mmc_clock_config(unsigned int iclk, unsigned short clk_div) +static unsigned char mmc_clock_config(unsigned int iclk, unsigned short clk_div) { unsigned int val; @@ -158,7 +158,7 @@ unsigned char mmc_clock_config(unsigned int iclk, unsigned short clk_div) return 1; } -unsigned char mmc_init_setup(void) +static unsigned char mmc_init_setup(void) { unsigned int reg_val; @@ -192,7 +192,7 @@ unsigned char mmc_init_setup(void) return 1; } -unsigned char mmc_send_cmd(unsigned int cmd, unsigned int arg, +static unsigned char mmc_send_cmd(unsigned int cmd, unsigned int arg, unsigned int *response) { unsigned int mmc_stat; @@ -228,7 +228,7 @@ unsigned char mmc_send_cmd(unsigned int cmd, unsigned int arg, return 1; } -unsigned char mmc_read_data(unsigned int *output_buf) +static unsigned char mmc_read_data(unsigned int *output_buf) { unsigned int mmc_stat; unsigned int read_count = 0; @@ -269,7 +269,7 @@ unsigned char mmc_read_data(unsigned int *output_buf) return 1; } -unsigned char mmc_detect_card(mmc_card_data *mmc_card_cur) +static unsigned char mmc_detect_card(mmc_card_data *mmc_card_cur) { unsigned char err; unsigned int argument = 0; @@ -380,7 +380,7 @@ unsigned char mmc_detect_card(mmc_card_data *mmc_card_cur) return 1; } -unsigned char mmc_read_cardsize(mmc_card_data *mmc_dev_data, +static unsigned char mmc_read_cardsize(mmc_card_data *mmc_dev_data, mmc_csd_reg_t *cur_csd) { mmc_extended_csd_reg_t ext_csd; @@ -434,9 +434,9 @@ unsigned char mmc_read_cardsize(mmc_card_data *mmc_dev_data, return 1; } -unsigned char omap_mmc_read_sect(unsigned int start_sec, unsigned int num_bytes, - mmc_card_data *mmc_c, - unsigned long *output_buf) +static unsigned char omap_mmc_read_sect(unsigned int start_sec, + unsigned int num_bytes, mmc_card_data *mmc_c, + unsigned long *output_buf) { unsigned char err; unsigned int argument; @@ -472,7 +472,7 @@ unsigned char omap_mmc_read_sect(unsigned int start_sec, unsigned int num_bytes, return 1; } -unsigned char configure_mmc(mmc_card_data *mmc_card_cur) +static unsigned char configure_mmc(mmc_card_data *mmc_card_cur) { unsigned char ret_val; unsigned int argument; @@ -541,8 +541,9 @@ unsigned char configure_mmc(mmc_card_data *mmc_card_cur) return 1; } -unsigned long mmc_bread(int dev_num, unsigned long blknr, lbaint_t blkcnt, - void *dst) + +static unsigned long mmc_bread(int dev_num, unsigned long blknr, + lbaint_t blkcnt, void *dst) { omap_mmc_read_sect(blknr, (blkcnt * MMCSD_SECTOR_SIZE), &cur_card_data, (unsigned long *) dst); diff --git a/drivers/mmc/omap3_mmc.h b/drivers/mmc/omap3_mmc.h index cbb3dc3a3a..e4d263c877 100644 --- a/drivers/mmc/omap3_mmc.h +++ b/drivers/mmc/omap3_mmc.h @@ -230,13 +230,4 @@ typedef union { mmc_csd_reg_t Card_CSD; } mmc_resp_t; -extern mmc_card_data mmc_dev; - -unsigned char mmc_lowlevel_init(void); -unsigned char mmc_send_command(unsigned int cmd, unsigned int arg, - unsigned int *response); -unsigned char mmc_setup_clock(unsigned int iclk, unsigned short clkd); -unsigned char mmc_set_opendrain(unsigned char state); -unsigned char mmc_read_data(unsigned int *output_buf); - #endif /* MMC_H */ From dc41b8bf3df2b2c3bd833f871d88ff5ef40a19f3 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Wed, 11 Aug 2010 15:56:03 -0700 Subject: [PATCH 16/16] mmc: omap3: fix block read function The OMAP3 block read function is not following API and always returning 1 instead of read block count, fix it. Also to simplify code, merge it with with a helper function, which was only called from the block read function. After this patch ext2 filesystem can be used properly. Signed-off-by: Grazvydas Ignotas Tested-by: Steve Sakoman Signed-off-by: Sandeep Paulraj --- drivers/mmc/omap3_mmc.c | 47 ++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/drivers/mmc/omap3_mmc.c b/drivers/mmc/omap3_mmc.c index 238f537a25..15d41e55bd 100644 --- a/drivers/mmc/omap3_mmc.c +++ b/drivers/mmc/omap3_mmc.c @@ -434,42 +434,45 @@ static unsigned char mmc_read_cardsize(mmc_card_data *mmc_dev_data, return 1; } -static unsigned char omap_mmc_read_sect(unsigned int start_sec, - unsigned int num_bytes, mmc_card_data *mmc_c, - unsigned long *output_buf) +static unsigned long mmc_bread(int dev_num, unsigned long blknr, + lbaint_t blkcnt, void *dst) { unsigned char err; unsigned int argument; unsigned int resp[4]; - unsigned int num_sec_val = - (num_bytes + (MMCSD_SECTOR_SIZE - 1)) / MMCSD_SECTOR_SIZE; + unsigned int *output_buf = dst; unsigned int sec_inc_val; + lbaint_t i; - if (num_sec_val == 0) - return 1; + if (blkcnt == 0) + return 0; - if (mmc_c->mode == SECTOR_MODE) { - argument = start_sec; + if (cur_card_data.mode == SECTOR_MODE) { + argument = blknr; sec_inc_val = 1; } else { - argument = start_sec * MMCSD_SECTOR_SIZE; + argument = blknr * MMCSD_SECTOR_SIZE; sec_inc_val = MMCSD_SECTOR_SIZE; } - while (num_sec_val) { + for (i = 0; i < blkcnt; i++) { err = mmc_send_cmd(MMC_CMD17, argument, resp); - if (err != 1) - return err; + if (err != 1) { + printf("mmc: CMD17 failed, status = %08x\n", err); + break; + } - err = mmc_read_data((unsigned int *) output_buf); - if (err != 1) - return err; + err = mmc_read_data(output_buf); + if (err != 1) { + printf("mmc: read failed, status = %08x\n", err); + break; + } output_buf += (MMCSD_SECTOR_SIZE / 4); argument += sec_inc_val; - num_sec_val--; } - return 1; + + return i; } static unsigned char configure_mmc(mmc_card_data *mmc_card_cur) @@ -542,14 +545,6 @@ static unsigned char configure_mmc(mmc_card_data *mmc_card_cur) return 1; } -static unsigned long mmc_bread(int dev_num, unsigned long blknr, - lbaint_t blkcnt, void *dst) -{ - omap_mmc_read_sect(blknr, (blkcnt * MMCSD_SECTOR_SIZE), &cur_card_data, - (unsigned long *) dst); - return 1; -} - int mmc_legacy_init(int dev) { if (mmc_set_dev(dev) != 0)