Skip to contentSkip to conversation

Mainline u-boot SPL for socfpga

U-Boot Superseded Charles Manning 5 participants 29 messages May 6, 2014 – Sep 15, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hello

I am trying to understand the state of the socfpga preloader in mainline u-boot.

#1 lore raw

Hi Charles,

Quoted 14 lines · Charles Manning

Hello

I am trying to understand the state of the socfpga preloader in mainline u-boot.

From what I see, this is broken and perhaps has never worked.

When I build the code in u-boot-socfpga I get a healthy working u-boot-spl.bin of approx 45kbytes.

Quoted 8 lines

When I build the mainline u-boot code I get a broken u-boot-spl.bin of approx 3kbytes.

It seems the mainline u-boot is missing stuff, including the all-critical sdram initialisation without which the SPL is useless.

As of now, we have most of the drivers already upstreamed to main line. The missing piece here are the SDRAM driver. The SDRAM driver poses a big challenge as its now licensed under BSD-3 clause. I am still working with legal team to look into potential to make it GPL license.

Quoted 9 lines

So, I have a few related questions:

1. The SDRAM init code, like other SocFPGA "hand-off" files is generated by the Altera tools. Since it is not hand written, and is not compliant with u-boot coding style. Is it more important to preserve coding style and have a broken SPL than it is to have a working SPL and broken code?

The SDRAM handoff files generated by tools is not compliance as the original code developer doesn't familiar with open source world. But if you look into the SDRAM handoff files within rocketboard.org git, the existing code already updated. I enhanced the code to ensure it meet with basic coding standard. But further enhancement is needed and on-going now.

Quoted 6 lines

2. Is there a practical "half-way" compromise whereby the generated code is run through lindent and we just accept that this is as good as it gets?

The on-going plan now is to use the enhanced SDRAM handoff file at rocketboard.org. From there, we want to streamline the driver by removing unused code. Once its ready, we will upstream this file.

Quoted 6 lines

3. Can we get some sort of coding style waiver, considering that this code is off in a board file and does not impact on anyone working on anything other than socfpga (indeed nobody even working on socfpga even reads it).

Quoted 7 lines

Clearly significant hand editing generated code makes for a very broken workflow, but running it through an automated step like lindent is Ok from a workflow point of view.

Unless this can be resolved we end up with a situation where people working on SocFPGA are forced to fork for practical reasons.

I believe it would be tough to get the waiver. Nevertheless, we are further enhancing the handoff files to a state which is good for upstreaming. At same time, I am also working with tools team to ensure all these enhancement is putting back to original code.

Thanks

Chin Liang

Quoted 9 lines

Regards

Charles

#2 lore raw
Quoted 42 lines · Chin Liang See

Hi Charles,

Quoted 14 lines · Charles Manning

Hello

I am trying to understand the state of the socfpga preloader in mainline u-boot.

From what I see, this is broken and perhaps has never worked.

When I build the code in u-boot-socfpga I get a healthy working u-boot-spl.bin of approx 45kbytes.

Quoted 8 lines

When I build the mainline u-boot code I get a broken u-boot-spl.bin of approx 3kbytes.

It seems the mainline u-boot is missing stuff, including the all-critical sdram initialisation without which the SPL is useless.

As of now, we have most of the drivers already upstreamed to main line. The missing piece here are the SDRAM driver. The SDRAM driver poses a big challenge as its now licensed under BSD-3 clause. I am still working with legal team to look into potential to make it GPL license.

Quoted 9 lines

So, I have a few related questions:

1. The SDRAM init code, like other SocFPGA "hand-off" files is generated by the Altera tools. Since it is not hand written, and is not compliant with u-boot coding style. Is it more important to preserve coding style and have a broken SPL than it is to have a working SPL and broken code?

Quoted 7 lines

The SDRAM handoff files generated by tools is not compliance as the original code developer doesn't familiar with open source world. But if you look into the SDRAM handoff files within rocketboard.org git, the existing code already updated. I enhanced the code to ensure it meet with basic coding standard. But further enhancement is needed and on-going now.

What is really needed is that the hand-off files are actually generated as compliant code.

Enhancing and hand-editing then checking in machine generated code is a broken work-flow because:

1) It has to be redone every time the code is regenerated.
2) There are so many changes that it is impossible to check for errors and diff for changes.

Quoted 7 lines
Quoted 7 lines

2. Is there a practical "half-way" compromise whereby the generated code is run through lindent and we just accept that this is as good as it gets?

Quoted 5 lines

The on-going plan now is to use the enhanced SDRAM handoff file at rocketboard.org. From there, we want to streamline the driver by removing unused code. Once its ready, we will upstream this file.

That might work if it is a once-off exercise that places the sdram code

in arch/arm/cpu/armv7/socfpga

The only stuff that should really be in a board/xxx directory is board-specific stuff and "tuning files".

In other words:
* sequence.c (a file of over 11000 lines of C code) should be in arch/.../scofpga
* sequencer_auto_ac_init.c (300 lines of board-specific register config values) should be in board/.../socfpga

Quoted 11 lines
Quoted 11 lines

3. Can we get some sort of coding style waiver, considering that this code is off in a board file and does not impact on anyone working on anything other than socfpga (indeed nobody even working on socfpga even reads it).

Clearly significant hand editing generated code makes for a very broken workflow, but running it through an automated step like lindent is Ok from a workflow point of view.

Quoted 9 lines
Quoted 2 lines

Unless this can be resolved we end up with a situation where people working on SocFPGA are forced to fork for practical reasons.

I believe it would be tough to get the waiver. Nevertheless, we are further enhancing the handoff files to a state which is good for upstreaming. At same time, I am also working with tools team to ensure all these enhancement is putting back to original code.

Maybe splitting the code better as I suggest above would make this far simpler.

If the board specific part of the hand-offs is reduced to just header files and register
config tables, then it is a trivial matter to run them through an extra **automated** step
to produce a compliant file.

Apart from gaining the mainstreaming, this would also make it far easier to create configs
for different boards (eg. sockit board would just become a few hundred lines of register configs and not 13 thousand lines of code - most of that duplicated between platforms).

Regards

Charles

#3 lore raw
In reply to Charles Manning

Hi!

Quoted 4 lines

I am trying to understand the state of the socfpga preloader in mainline u-boot.

Quoted 1 line

From what I see, this is broken and perhaps has never worked.

That's correct AFAICT.

Quoted 8 lines

When I build the code in u-boot-socfpga I get a healthy working u-boot-spl.bin of approx 45kbytes.

When I build the mainline u-boot code I get a broken u-boot-spl.bin of approx 3kbytes.

It seems the mainline u-boot is missing stuff, including the all-critical sdram initialisation without which the SPL is useless.

Are you able to build working u-boot proper from recent sources?

I know u-boot SPL misses critical parts, but I was told that u-boot proper should have everything. Only... I was not able to get it to work. [I'm attempting to load recent u-boot from patched/old u-boot; I know this is not exactly recommended, but due to spl/proper split, it should work AFAIK... and does for old versions.]

Any ideas?

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#4 lore raw
Quoted 18 lines · On Thursday 15 May 2014 04:42:58 Pavel Machek wrote:

Hi!

Quoted 4 lines

I am trying to understand the state of the socfpga preloader in mainline u-boot.

Quoted 1 line

From what I see, this is broken and perhaps has never worked.

That's correct AFAICT.

Quoted 8 lines

When I build the code in u-boot-socfpga I get a healthy working u-boot-spl.bin of approx 45kbytes.

When I build the mainline u-boot code I get a broken u-boot-spl.bin of approx 3kbytes.

It seems the mainline u-boot is missing stuff, including the all-critical sdram initialisation without which the SPL is useless.

Quoted 7 lines

Are you able to build working u-boot proper from recent sources?

I know u-boot SPL misses critical parts, but I was told that u-boot proper should have everything. Only... I was not able to get it to work. [I'm attempting to load recent u-boot from patched/old u-boot; I know this is not exactly recommended, but due to spl/proper split, it should work AFAIK... and does for old versions.]

I have not tried booting u-boot proper from mainline. It just seemed pointless to me to be working from 2 source trees to make a single product.

I will give it a go though.

As Chin Liang See has said, there are two issues thwarting this: legal AND source conformance. The code we can fix, the legal can only be fixed by bending Altera - I am going to do that too.

Regards

Charles

#5 lore raw

Hi,

Quoted 9 lines · Charles Manning
Quoted 8 lines · On Thursday 15 May 2014 04:42:58 Pavel Machek wrote:

Hi!

Quoted 4 lines

I am trying to understand the state of the socfpga preloader in mainline u-boot.

Quoted 1 line

From what I see, this is broken and perhaps has never worked.

That's correct AFAICT.

Yup, Preloader without the SDRAM would not work correctly.

Quoted 18 lines
Quoted 10 lines
Quoted 9 lines

When I build the code in u-boot-socfpga I get a healthy working u-boot-spl.bin of approx 45kbytes.

When I build the mainline u-boot code I get a broken u-boot-spl.bin of approx 3kbytes.

It seems the mainline u-boot is missing stuff, including the all-critical sdram initialisation without which the SPL is useless.

Quoted 7 lines

Are you able to build working u-boot proper from recent sources?

I know u-boot SPL misses critical parts, but I was told that u-boot proper should have everything. Only... I was not able to get it to work. [I'm attempting to load recent u-boot from patched/old u-boot; I know this is not exactly recommended, but due to spl/proper split, it should work AFAIK... and does for old versions.]

Quoted 4 lines

I have not tried booting u-boot proper from mainline. It just seemed pointless to me to be working from 2 source trees to make a single product.

I will give it a go though.

Actually the U-Boot is working. You just need to #undef CONFIG_SOCFPGA_VIRTUAL_TARGET and build it. I loaded it using a working Preloader and I can reach the U-Boot console.

U-Boot SPL 2013.01.01 (May 16 2014 - 10:42:39)
BOARD : Altera SOCFPGA Cyclone V Board
CLOCK: EOSC1 clock 25000 KHz
CLOCK: EOSC2 clock 25000 KHz
CLOCK: F2S_SDR_REF clock 0 KHz
CLOCK: F2S_PER_REF clock 0 KHz
CLOCK: MPU clock 925 MHz
CLOCK: DDR clock 400 MHz
CLOCK: UART clock 100000 KHz
CLOCK: MMC clock 50000 KHz
CLOCK: QSPI clock 370000 KHz
INFO : Watchdog enabled
SDRAM: Initializing MMR registers
SDRAM: Calibrating PHY
SEQ.C: Preparing to start memory calibration
SEQ.C: CALIBRATION PASSED
SDRAM: 1024 MiB
SDRAM: ECC Enabled
ALTERA DWMMC: 0
reading u-boot.img
reading u-boot.img

U-Boot 2014.07-rc1-00079-g2072e72-dirty (May 16 2014 - 15:54:55)

CPU : Altera SOCFPGA Platform
BOARD : Altera SOCFPGA Cyclone5 Board
DRAM: 1 GiB
WARNING: Caches not enabled
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0
Wrong Image Format for bootm command
ERROR: can't get kernel image!
SOCFPGA_CYCLONE5 # help
?       - alias for 'help'
base    - print or set address offset
bdinfo  - print Board Info structure
boot    - boot default, i.e., run 'bootcmd'
bootd   - boot default, i.e., run 'bootcmd'
bootm   - boot application image from memory
bootp   - boot image via network using BOOTP/TFTP protocol
cmp     - memory compare
coninfo - print console devices and information
cp      - memory copy
crc32   - checksum calculation
echo    - echo args to console
editenv - edit environment variable
env     - environment handling commands
exit    - exit script
false   - do nothing, unsuccessfully
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls   - list files in a directory (default /)
fdt     - flattened device tree utility commands
go      - start application at address 'addr'
help    - print command description/usage
iminfo  - print header information for application image
imxtract- extract a part of a multi-image
itest   - return true/false on integer compare
loadb   - load binary file over serial line (kermit mode)
loads   - load S-Record file over serial line
loadx   - load binary file over serial line (xmodem mode)
loady   - load binary file over serial line (ymodem mode)
loop    - infinite loop on address range
md      - memory display
mm      - memory modify (auto-incrementing address)
mw      - memory write (fill)
nfs     - boot image via network using NFS protocol
nm      - memory modify (constant address)
printenv- print environment variables
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
setenv  - set environment variables
showvar - print local hushshell variables
sleep   - delay execution for some time
source  - run script from memory
test    - minimal test like /bin/sh

tftpboot- boot image via network using TFTP protocol
true - do nothing, successfully
version - print monitor, compiler and linker version SOCFPGA_CYCLONE5 #

Quoted 4 lines

As Chin Liang See has said, there are two issues thwarting this: legal AND source conformance. The code we can fix, the legal can only be fixed by bending Altera - I am going to do that too.

We are making some progress on this. Once we have final green light, we will start the upstreaming of SDRAM code. :)

Thanks

Chin Liang

Quoted 4 lines

Regards

Charles

#6 lore raw

Hi!

(Sorry for the delay)

Quoted 9 lines
Quoted 9 lines
Quoted 5 lines

I know u-boot SPL misses critical parts, but I was told that u-boot proper should have everything. Only... I was not able to get it to work. [I'm attempting to load recent u-boot from patched/old u-boot; I know this is not exactly recommended, but due to spl/proper split, it should work AFAIK... and does for old versions.]

I have not tried booting u-boot proper from mainline. It just seemed pointless to me to be working from 2 source trees to make a single product.

Quoted 6 lines
Quoted 1 line

I will give it a go though.

Actually the U-Boot is working. You just need to #undef CONFIG_SOCFPGA_VIRTUAL_TARGET and build it. I loaded it using a working Preloader and I can reach the U-Boot console.

Aha, you are right, I forgot about VIRTUAL_TARGET define.

Quoted 8 lines

U-Boot 2014.07-rc1-00079-g2072e72-dirty (May 16 2014 - 15:54:55)

CPU : Altera SOCFPGA Platform
BOARD : Altera SOCFPGA Cyclone5 Board
DRAM: 1 GiB
WARNING: Caches not enabled
Using default environment

Quoted 4 lines
In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.

Do you have any hints how to get ethernet to work?

Plus, for me it says:

tertiary u-boot 13.760972 Warning: Your board does not use generic board. Please read
tertiary u-boot 13.770775 doc/README.generic-board and take action. Boards not
tertiary u-boot 13.779813 upgraded by the late 2014 may break or be removed.

Quoted 7 lines
Quoted 3 lines

As Chin Liang See has said, there are two issues thwarting this: legal AND source conformance. The code we can fix, the legal can only be fixed by bending Altera - I am going to do that too.

We are making some progress on this. Once we have final green light, we will start the upstreaming of SDRAM code. :)

Looking forward :-).

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#7 lore raw

PATCH 1/1 generic board for socfpga

Socfpga u-boot works fine with CONFIG_SYS_GENERIC_BOARD, so enable that option as documentation suggests.

include/configs/socfpga_cyclone5.h +2 -0
index 2fc16ef..72d77f4 100644
@@ -16,6 +16,8 @@
 /* Virtual target or real hardware */
 #define CONFIG_SOCFPGA_VIRTUAL_TARGET
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 #define CONFIG_ARMV7
 #define CONFIG_SYS_DCACHE_OFF
 #undef CONFIG_USE_IRQ
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#8 lore raw

PATCH 1/1 generic board for socfpga

Hi Pavel,

Quoted 3 lines · ZY - pavel

Socfpga u-boot works fine with CONFIG_SYS_GENERIC_BOARD, so enable that option as documentation suggests.

Yup, it works well for me without modification.

Thanks
Chin Liang

Quoted 16 lines
include/configs/socfpga_cyclone5.h +2 -0
index 2fc16ef..72d77f4 100644
@@ -16,6 +16,8 @@
 /* Virtual target or real hardware */
 #define CONFIG_SOCFPGA_VIRTUAL_TARGET
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 #define CONFIG_ARMV7
 #define CONFIG_SYS_DCACHE_OFF
 #undef CONFIG_USE_IRQ
#9 lore raw

PATCH 1/1 generic board for socfpga

In reply to Pavel Machek

Hi Pavel,

Quoted 11 lines · Pavel Machek

Socfpga u-boot works fine with CONFIG_SYS_GENERIC_BOARD, so enable that option as documentation suggests.

include/configs/socfpga_cyclone5.h +0 -0
index 2fc16ef..72d77f4 100644

include/configs/socfpga_cyclone5.h line 23

Quoted 8 lines
include/configs/socfpga_cyclone5.h +2 -0
@@ -16,6 +16,8 @@
 /* Virtual target or real hardware */
 #define CONFIG_SOCFPGA_VIRTUAL_TARGET
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 #define CONFIG_ARMV7
 #define CONFIG_SYS_DCACHE_OFF
 #undef CONFIG_USE_IRQ

Sorry, I let this last too long before I reviewed it and now it does not apply cleanly at all. Can you have a look?

Amicalement,

Signature · 1 line
Albert.
#10 lore raw

PATCH v2 1/1 generic board for socfpga

Socfpga u-boot works fine with CONFIG_SYS_GENERIC_BOARD, so enable that option as documentation suggests.

---

Quoted 2 lines

Sorry, I let this last too long before I reviewed it and now it does not apply cleanly at all. Can you have a look?

Here you go.

include/configs/socfpga_cyclone5.h +2 -0
index 5d145cd..d3d1e48 100644
@@ -11,6 +11,8 @@
 #include "../../board/altera/socfpga/iocsr_config.h"
 #include "../../board/altera/socfpga/pll_config.h"
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 /*
  * High level configuration
  */
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#11 lore raw

PATCH 1/1 watchdog disable for socfpga

This adds watchdog disable. It is neccessary for running Linux kernel.

arch/arm/cpu/armv7/socfpga/reset_manager.c +13 -0
index e320c01..5503059 100644
@@ -14,6 +14,19 @@ DECLARE_GLOBAL_DATA_PTR;
 static const struct socfpga_reset_manager *reset_manager_base =
 		(void *)SOCFPGA_RSTMGR_ADDRESS;
 
+#define RSTMGR_PERMODRST_L4WD0_LSB 6
+
+/* Disable the watchdog (toggle reset to watchdog) */
+void watchdog_disable(void)
+{
+	/* assert reset for watchdog */
+	setbits_le32(&reset_manager_base->per_mod_reset,
+		     (1<<RSTMGR_PERMODRST_L4WD0_LSB));
+	/* deassert watchdog from reset (watchdog in not running state) */
+	clrbits_le32(&reset_manager_base->per_mod_reset,
+		     (1<<RSTMGR_PERMODRST_L4WD0_LSB));
+}
+
 /*
  * Write the reset manager register to cause reset
  */
arch/arm/include/asm/arch-socfpga/reset_manager.h +2 -0
index 3e95476..eb95c5b 100644
@@ -10,6 +10,8 @@
 void reset_cpu(ulong addr);
 void reset_deassert_peripherals_handoff(void);
 
+void watchdog_disable(void);
+
 struct socfpga_reset_manager {
 	u32	status;
 	u32	ctrl;
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#12 lore raw

PATCH 1/1 base addresses for more subsystems

Add base addresses for more subsystems.

arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h +6 -0
index 2d3152d..39a7874 100644
@@ -7,9 +7,15 @@
 #ifndef _SOCFPGA_BASE_ADDRS_H_
 #define _SOCFPGA_BASE_ADDRS_H_
 
+#define SOCFPGA_EMAC0_ADDRESS 0xff700000
+#define SOCFPGA_EMAC1_ADDRESS 0xff702000
+#define SOCFPGA_SDMMC_ADDRESS 0xff704000
+#define SOCFPGA_FPGAMGRREGS_ADDRESS 0xff706000
 #define SOCFPGA_L3REGS_ADDRESS 0xff800000
+#define SOCFPGA_FPGAMGRDATA_ADDRESS 0xffb90000
 #define SOCFPGA_UART0_ADDRESS 0xffc02000
 #define SOCFPGA_UART1_ADDRESS 0xffc03000
+#define SOCFPGA_SDR_ADDRESS 0xffc20000
 #define SOCFPGA_OSC1TIMER0_ADDRESS 0xffd00000
 #define SOCFPGA_L4WD0_ADDRESS 0xffd02000
 #define SOCFPGA_CLKMGR_ADDRESS 0xffd04000
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#13 lore raw

PATCH 1/1 cleanup drivers/net/phy/micrel.c

Old saying says that more than three exclamation marks in a row are sign of mental disease. Cleanup micrel.c.

drivers/net/phy/micrel.c +3 -4
index 5d7e3be..06a31b0 100644
@@ -25,8 +25,7 @@ static struct phy_driver KSZ804_driver = {
 #ifndef CONFIG_PHY_MICREL_KSZ9021
 /*
  * I can't believe Micrel used the exact same part number
- * for the KSZ9021
- * Shame Micrel, Shame!!!!!
+ * for the KSZ9021. Shame Micrel, Shame!
  */
 static struct phy_driver KS8721_driver = {
 	.name = "Micrel KS8721BL",
@@ -40,7 +39,7 @@ static struct phy_driver KS8721_driver = {
 #endif
 
 
-/**
+/*
  * KSZ9021 - KSZ9031 common
  */
 
@@ -69,8 +68,8 @@ static int ksz90xx_startup(struct phy_device *phydev)
 		phydev->speed = SPEED_10;
 	return 0;
 }
-#ifdef CONFIG_PHY_MICREL_KSZ9021
 
+#ifdef CONFIG_PHY_MICREL_KSZ9021
 /*
  * KSZ9021
  */
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#14 lore raw

PATCH 1/1 cleanup drivers/net/phy/micrel.c

Quoted 31 lines · ZY - pavel

Old saying says that more than three exclamation marks in a row are sign of mental disease. Cleanup micrel.c.

drivers/net/phy/micrel.c +2 -3
index 5d7e3be..06a31b0 100644
@@ -25,8 +25,7 @@ static struct phy_driver KSZ804_driver = {
 #ifndef CONFIG_PHY_MICREL_KSZ9021
 /*
  * I can't believe Micrel used the exact same part number
- * for the KSZ9021
- * Shame Micrel, Shame!!!!!
+ * for the KSZ9021. Shame Micrel, Shame!
  */
 static struct phy_driver KS8721_driver = {
 	.name = "Micrel KS8721BL",
@@ -40,7 +39,7 @@ static struct phy_driver KS8721_driver = {
 #endif
 
 
-/**
+/*
  * KSZ9021 - KSZ9031 common
  */
 

drivers/net/phy/micrel.c static int ksz90xx_startup(struct phy_device *phydev) · line 75

Quoted 9 lines
drivers/net/phy/micrel.c +1 -1
@@ -69,8 +68,8 @@ static int ksz90xx_startup(struct phy_device *phydev)
 		phydev->speed = SPEED_10;
 	return 0;
 }
-#ifdef CONFIG_PHY_MICREL_KSZ9021
 
+#ifdef CONFIG_PHY_MICREL_KSZ9021
 /*
  * KSZ9021
  */
#15 lore raw

PATCH 1/1 base addresses for more subsystems

In reply to Pavel Machek
Quoted 15 lines · ZY - pavel

Add base addresses for more subsystems.

arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h +2 -0
index 2d3152d..39a7874 100644
@@ -7,9 +7,15 @@
 #ifndef _SOCFPGA_BASE_ADDRS_H_
 #define _SOCFPGA_BASE_ADDRS_H_
 
+#define SOCFPGA_EMAC0_ADDRESS 0xff700000
+#define SOCFPGA_EMAC1_ADDRESS 0xff702000

arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h line 21

Quoted 10 lines
arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h +4 -0
+#define SOCFPGA_SDMMC_ADDRESS 0xff704000
+#define SOCFPGA_FPGAMGRREGS_ADDRESS 0xff706000
 #define SOCFPGA_L3REGS_ADDRESS 0xff800000
+#define SOCFPGA_FPGAMGRDATA_ADDRESS 0xffb90000
 #define SOCFPGA_UART0_ADDRESS 0xffc02000
 #define SOCFPGA_UART1_ADDRESS 0xffc03000
+#define SOCFPGA_SDR_ADDRESS 0xffc20000
 #define SOCFPGA_OSC1TIMER0_ADDRESS 0xffd00000
 #define SOCFPGA_L4WD0_ADDRESS 0xffd02000
 #define SOCFPGA_CLKMGR_ADDRESS 0xffd04000
#16 lore raw

PATCH 1/1 fix compilation of socfpga_dw_mmc

In reply to Pavel Machek

Fix compilation of socfpga_dw_mmc.

drivers/mmc/socfpga_dw_mmc.c +2 -0
index 1f96382..d8da7f5 100644
@@ -16,6 +16,8 @@ static const struct socfpga_clock_manager *clock_manager_base =
 static const struct socfpga_system_manager *system_manager_base =
 		(void *)SOCFPGA_SYSMGR_ADDRESS;
 
+#define CLKMGR_PERPLLGRP_EN_SDMMCCLK_MASK (1 << 8)
+
 static void socfpga_dwmci_clksel(struct dwmci_host *host)
 {
 	unsigned int drvsel;
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#17 lore raw

PATCH 1/1 fix compilation of socfpga_dw_mmc

Quoted 9 lines · Pavel Machek

Fix compilation of socfpga_dw_mmc.

drivers/mmc/socfpga_dw_mmc.c +0 -0
index 1f96382..d8da7f5 100644

drivers/mmc/socfpga_dw_mmc.c static const struct socfpga_clock_manager · line 23

Quoted 8 lines
drivers/mmc/socfpga_dw_mmc.c +2 -0
@@ -16,6 +16,8 @@ static const struct socfpga_clock_manager
 *clock_manager_base = static const struct socfpga_system_manager
 *system_manager_base = (void *)SOCFPGA_SYSMGR_ADDRESS;
 
+#define CLKMGR_PERPLLGRP_EN_SDMMCCLK_MASK (1 << 8)
+
 static void socfpga_dwmci_clksel(struct dwmci_host *host)
 {
 	unsigned int drvsel;

This macro should go into arch/arm/include/asm/arch-socfpga/clock_manager.h

Best regards,
Marek Vasut

#18 lore raw

PATCH 1/1 watchdog disable for socfpga

In reply to Pavel Machek
Quoted 1 line · Pavel Machek

This adds watchdog disable. It is neccessary for running Linux kernel.

Why do we not enable WDT in Linux instead ? Also, I recall there was a call to explicitly enable the L4 watchdog, so why do we not get rid of that instead ?

Quoted 32 lines
(quoted diff) +0 -0

b/arch/arm/cpu/armv7/socfpga/reset_manager.c index e320c01..5503059 100644

arch/arm/cpu/armv7/socfpga/reset_manager.c +13 -0
@@ -14,6 +14,19 @@ DECLARE_GLOBAL_DATA_PTR;
 static const struct socfpga_reset_manager *reset_manager_base =
 		(void *)SOCFPGA_RSTMGR_ADDRESS;
 
+#define RSTMGR_PERMODRST_L4WD0_LSB 6
+
+/* Disable the watchdog (toggle reset to watchdog) */
+void watchdog_disable(void)
+{
+	/* assert reset for watchdog */
+	setbits_le32(&reset_manager_base->per_mod_reset,
+		     (1<<RSTMGR_PERMODRST_L4WD0_LSB));
+	/* deassert watchdog from reset (watchdog in not running state) */
+	clrbits_le32(&reset_manager_base->per_mod_reset,
+		     (1<<RSTMGR_PERMODRST_L4WD0_LSB));
+}
+
 /*
  * Write the reset manager register to cause reset
  */
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-socfpga/reset_manager.h index 3e95476..eb95c5b 100644

arch/arm/include/asm/arch-socfpga/reset_manager.h line 17

Quoted 8 lines
arch/arm/include/asm/arch-socfpga/reset_manager.h +2 -0
@@ -10,6 +10,8 @@
 void reset_cpu(ulong addr);
 void reset_deassert_peripherals_handoff(void);
 
+void watchdog_disable(void);
+
 struct socfpga_reset_manager {
 	u32	status;
 	u32	ctrl;

Best regards,
Marek Vasut

#19 lore raw

PATCH 1/1 watchdog disable for socfpga

Quoted 6 lines · Marek Vasut
Quoted 1 line · Pavel Machek

This adds watchdog disable. It is neccessary for running Linux kernel.

Why do we not enable WDT in Linux instead ? Also, I recall there was a call to explicitly enable the L4 watchdog, so why do we not get rid of that instead ?

Booting linux kernel without watchdog support should be valid operation.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#20 lore raw

PATCH 1/1 watchdog disable for socfpga

Quoted 10 lines · Pavel Machek
Quoted 6 lines · Marek Vasut
Quoted 1 line · Pavel Machek

This adds watchdog disable. It is neccessary for running Linux kernel.

Why do we not enable WDT in Linux instead ? Also, I recall there was a call to explicitly enable the L4 watchdog, so why do we not get rid of that instead ?

Booting linux kernel without watchdog support should be valid operation.

If you watchdog is enabled, then not so much. Also, why can we not just disable the WDT in U-Boot instead using a config option ?

Best regards,
Marek Vasut

#21 lore raw

PATCH 1/1 watchdog disable for socfpga

Quoted 9 lines · Marek Vasut
Quoted 8 lines · Pavel Machek
Quoted 6 lines · Marek Vasut
Quoted 1 line · Pavel Machek

This adds watchdog disable. It is neccessary for running Linux kernel.

Why do we not enable WDT in Linux instead ? Also, I recall there was a call to explicitly enable the L4 watchdog, so why do we not get rid of that instead ?

Quoted 5 lines
Quoted 2 lines

Booting linux kernel without watchdog support should be valid operation.

If you watchdog is enabled, then not so much. Also, why can we not just disable the WDT in U-Boot instead using a config option ?

It seems that watchdog is enabled by default (by hardware or SPL), so yes, watchdog disable operation (and this patch) in u-boot is a good idea.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#22 lore raw

PATCH 1/1 watchdog disable for socfpga

Quoted 14 lines · Pavel Machek
Quoted 13 lines · Marek Vasut
Quoted 11 lines · Pavel Machek
Quoted 7 lines · Marek Vasut
Quoted 2 lines · Pavel Machek

This adds watchdog disable. It is neccessary for running Linux kernel.

Why do we not enable WDT in Linux instead ? Also, I recall there was a call to explicitly enable the L4 watchdog, so why do we not get rid of that instead ?

Booting linux kernel without watchdog support should be valid operation.

Quoted 6 lines
Quoted 2 lines

If you watchdog is enabled, then not so much. Also, why can we not just disable the WDT in U-Boot instead using a config option ?

It seems that watchdog is enabled by default (by hardware or SPL), so yes, watchdog disable operation (and this patch) in u-boot is a good idea.

OK.

Best regards,
Marek Vasut

#23 lore raw

PATCH 1/1 watchdog disable for socfpga

In reply to Pavel Machek

Hi Pavel,

Quoted 13 lines · ZY - pavel
Quoted 12 lines · Marek Vasut
Quoted 10 lines · Pavel Machek
Quoted 6 lines · Marek Vasut
Quoted 1 line · Pavel Machek

This adds watchdog disable. It is neccessary for running Linux kernel.

Why do we not enable WDT in Linux instead ? Also, I recall there was a call to explicitly enable the L4 watchdog, so why do we not get rid of that instead ?

Booting linux kernel without watchdog support should be valid operation.

Quoted 6 lines
Quoted 2 lines

If you watchdog is enabled, then not so much. Also, why can we not just disable the WDT in U-Boot instead using a config option ?

It seems that watchdog is enabled by default (by hardware or SPL), so yes, watchdog disable operation (and this patch) in u-boot is a good idea.

If refer to
http://rocketboards.org/gitweb/?p=u-boot-socfpga.git;a=blob_plain;f=arch/arm/cpu/armv7/socfpga/s_init.c;hb=fe010493a1754e761f77ba19243ba93a9d038443, its current disable during U-Boot initialization, s_init. Thanks

Chin Liang

Quoted 2 lines

Pavel

#24 lore raw

PATCH 1/1 watchdog disable for socfpga

In reply to Pavel Machek

Hi Pavel,

arch/arm/cpu/armv7/socfpga/reset_manager.c DECLARE_GLOBAL_DATA_PTR; · line 17

Quoted 13 lines · ZY - pavel

This adds watchdog disable. It is neccessary for running Linux kernel.

arch/arm/cpu/armv7/socfpga/reset_manager.c +1 -0
index e320c01..5503059 100644
@@ -14,6 +14,19 @@ DECLARE_GLOBAL_DATA_PTR;
 static const struct socfpga_reset_manager *reset_manager_base =
 		(void *)SOCFPGA_RSTMGR_ADDRESS;
 
+#define RSTMGR_PERMODRST_L4WD0_LSB 6

Would suggest to put this into header file.
Thanks

Chin Liang

Quoted 29 lines
arch/arm/cpu/armv7/socfpga/reset_manager.c +12 -0
+
+/* Disable the watchdog (toggle reset to watchdog) */
+void watchdog_disable(void)
+{
+	/* assert reset for watchdog */
+	setbits_le32(&reset_manager_base->per_mod_reset,
+		     (1<<RSTMGR_PERMODRST_L4WD0_LSB));
+	/* deassert watchdog from reset (watchdog in not running state) */
+	clrbits_le32(&reset_manager_base->per_mod_reset,
+		     (1<<RSTMGR_PERMODRST_L4WD0_LSB));
+}
+
 /*
  * Write the reset manager register to cause reset
  */
arch/arm/include/asm/arch-socfpga/reset_manager.h +2 -0
index 3e95476..eb95c5b 100644
@@ -10,6 +10,8 @@
 void reset_cpu(ulong addr);
 void reset_deassert_peripherals_handoff(void);
 
+void watchdog_disable(void);
+
 struct socfpga_reset_manager {
 	u32	status;
 	u32	ctrl;
#25 lore raw

PATCH 1/1 watchdog disable for socfpga

Quoted 14 lines · Chin Liang See

Hi Pavel,

Quoted 11 lines · ZY - pavel

This adds watchdog disable. It is neccessary for running Linux kernel.

(quoted diff) +0 -0

b/arch/arm/cpu/armv7/socfpga/reset_manager.c index e320c01..5503059 100644

arch/arm/cpu/armv7/socfpga/reset_manager.c +0 -0
@@ -14,6 +14,19 @@ DECLARE_GLOBAL_DATA_PTR;
 
Quoted 8 lines

arch/arm/cpu/armv7/socfpga/reset_manager.c DECLARE_GLOBAL_DATA_PTR; · line 17

Quoted 5 lines
arch/arm/cpu/armv7/socfpga/reset_manager.c +1 -0
 static const struct socfpga_reset_manager *reset_manager_base =
 
 		(void *)SOCFPGA_RSTMGR_ADDRESS;
 
+#define RSTMGR_PERMODRST_L4WD0_LSB 6

Would suggest to put this into header file.
Thanks

I agree. We're currently working on a proper cleanup, so please give us a few days to prepare a series.

Best regards,
Marek Vasut

#26 lore raw

PATCH v2 1/1 generic board for socfpga

In reply to Pavel Machek
Quoted 4 lines · ZY - pavel

Socfpga u-boot works fine with CONFIG_SYS_GENERIC_BOARD, so enable that option as documentation suggests.

Quoted 23 lines

---

Quoted 2 lines

Sorry, I let this last too long before I reviewed it and now it does not apply cleanly at all. Can you have a look?

Here you go.

include/configs/socfpga_cyclone5.h +2 -0
index 5d145cd..d3d1e48 100644
@@ -11,6 +11,8 @@
 #include "../../board/altera/socfpga/iocsr_config.h"
 #include "../../board/altera/socfpga/pll_config.h"
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 /*
  * High level configuration
  */
#27 lore raw
In reply to Pavel Machek

Hi Pavel,

Quoted 30 lines · ZY - pavel

Hi!

(Sorry for the delay)

Quoted 9 lines
Quoted 9 lines
Quoted 5 lines

I know u-boot SPL misses critical parts, but I was told that u-boot proper should have everything. Only... I was not able to get it to work. [I'm attempting to load recent u-boot from patched/old u-boot; I know this is not exactly recommended, but due to spl/proper split, it should work AFAIK... and does for old versions.]

I have not tried booting u-boot proper from mainline. It just seemed pointless to me to be working from 2 source trees to make a single product.

Quoted 6 lines
Quoted 1 line

I will give it a go though.

Actually the U-Boot is working. You just need to #undef CONFIG_SOCFPGA_VIRTUAL_TARGET and build it. I loaded it using a working Preloader and I can reach the U-Boot console.

Aha, you are right, I forgot about VIRTUAL_TARGET define.

Quoted 8 lines

U-Boot 2014.07-rc1-00079-g2072e72-dirty (May 16 2014 - 15:54:55)

CPU : Altera SOCFPGA Platform
BOARD : Altera SOCFPGA Cyclone5 Board
DRAM: 1 GiB
WARNING: Caches not enabled
Using default environment

Quoted 7 lines
Quoted 4 lines
In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.

Do you have any hints how to get ethernet to work?

I yet to upstream the ethernet part yet.
I plan to do that once I upstreamed all the minimum SPL code to run on dev kit.

Quoted 9 lines

Plus, for me it says:

tertiary u-boot 13.760972 Warning: Your board does not use generic board. Please read
tertiary u-boot 13.770775 doc/README.generic-board and take action. Boards not
tertiary u-boot 13.779813 upgraded by the late 2014 may break or be removed.

I believe your patch already resolved this :)

Quoted 10 lines
Quoted 8 lines
Quoted 4 lines

As Chin Liang See has said, there are two issues thwarting this: legal AND source conformance. The code we can fix, the legal can only be fixed by bending Altera - I am going to do that too.

We are making some progress on this. Once we have final green light, we will start the upstreaming of SDRAM code. :)

Looking forward :-).

Yup, work in progress.
It slightly time consuming especially removing some unused code :)

Thanks
Chin Liang

Quoted 5 lines

Thanks,
Pavel

#28 lore raw

Hi!

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

U-Boot 2014.07-rc1-00079-g2072e72-dirty (May 16 2014 - 15:54:55)

CPU : Altera SOCFPGA Platform
BOARD : Altera SOCFPGA Cyclone5 Board
DRAM: 1 GiB
WARNING: Caches not enabled
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Quoted 6 lines
Quoted 2 lines

Do you have any hints how to get ethernet to work?

I yet to upstream the ethernet part yet.
I plan to do that once I upstreamed all the minimum SPL code to run on dev kit.

I tried to get it to work, but did not succeed so far.

First, designware.c patches are for version before rewrite -- so I reverted to that version. For some reason, it detects phy at all possible places -- seems like the controller is not listening in the address space?

Then, it seems ethernet address reading depends on i2c, so I added that, and that in turn depends on clock framework.

This is what my current diff. If you have any ideas, let me know.

Best regards,
Pavel

arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h +3 -0
index f564046..c8e925a 100644
@@ -14,5 +14,8 @@
 #define SOCFPGA_CLKMGR_ADDRESS 0xffd04000
 #define SOCFPGA_RSTMGR_ADDRESS 0xffd05000
 #define SOCFPGA_SYSMGR_ADDRESS 0xffd08000
+#define SOCFPGA_EMAC0_ADDRESS 0xff700000
+#define SOCFPGA_EMAC1_ADDRESS 0xff702000
+
 
 #endif /* _SOCFPGA_BASE_ADDRS_H_ */
board/altera/socfpga/socfpga_cyclone5.c +173 -1

192 lines not on this page · raw message

board/bf609-ezkit/bf609-ezkit.c +2 -2
index 43a4330..cfc64fe 100644
@@ -41,12 +41,12 @@ int board_eth_init(bd_t *bis)
 	if (CONFIG_DW_PORTS & 1) {
 		static const unsigned short pins[] = P_RMII0;
 		if (!peripheral_request_list(pins, "emac0"))
-			ret += designware_initialize(EMAC0_MACCFG, 0);
+			ret += designware_initialize(0, EMAC0_MACCFG, 1, 0);
 	}
 	if (CONFIG_DW_PORTS & 2) {
 		static const unsigned short pins[] = P_RMII1;
 		if (!peripheral_request_list(pins, "emac1"))
-			ret += designware_initialize(EMAC1_MACCFG, 0);
+			ret += designware_initialize(1, EMAC1_MACCFG, 1, 0);
 	}
 
 	return ret;
board/spear/spear300/spear300.c +2 -1
index 6b6bd9f..e25aba2 100644
@@ -53,7 +53,8 @@ int board_eth_init(bd_t *bis)
 
 #if defined(CONFIG_DESIGNWARE_ETH)
 	u32 interface = PHY_INTERFACE_MODE_MII;
-	if (designware_initialize(CONFIG_SPEAR_ETHBASE, interface) >= 0)
+	if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY,
+				interface) >= 0)
 		ret++;
 #endif
 	return ret;
board/spear/spear310/spear310.c +2 -1
index a4c6a8e..70f9aa1 100644
@@ -54,7 +54,8 @@ int board_eth_init(bd_t *bis)
 
 #if defined(CONFIG_DESIGNWARE_ETH)
 	u32 interface = PHY_INTERFACE_MODE_MII;
-	if (designware_initialize(CONFIG_SPEAR_ETHBASE, interface) >= 0)
+	if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY,
+				interface) >= 0)
 		ret++;
 #endif
 #if defined(CONFIG_MACB)
board/spear/spear320/spear320.c +2 -1
index ab732a7..f6b1fdd 100644
@@ -65,7 +65,8 @@ int board_eth_init(bd_t *bis)
 
 #if defined(CONFIG_DESIGNWARE_ETH)
 	u32 interface = PHY_INTERFACE_MODE_MII;
-	if (designware_initialize(CONFIG_SPEAR_ETHBASE, interface) >= 0)
+	if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY,
+				interface) >= 0)
 		ret++;
 #endif
 #if defined(CONFIG_MACB)
board/spear/spear600/spear600.c +2 -1
index 8472002..e996a0e 100644
@@ -51,7 +51,8 @@ int board_eth_init(bd_t *bis)
 #if defined(CONFIG_DW_AUTONEG)
 	interface = PHY_INTERFACE_MODE_GMII;
 #endif
-	if (designware_initialize(CONFIG_SPEAR_ETHBASE, interface) >= 0)
+	if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY,
+				interface) >= 0)
 		ret++;
 #endif
 	return ret;
board/spear/x600/x600.c +12 -13
index b8edfcd..044d204 100644
@@ -67,32 +67,31 @@ void board_nand_init(void)
 		fsmc_nand_init(nand);
 }
 
-int board_phy_config(struct phy_device *phydev)
+int designware_board_phy_init(struct eth_device *dev, int phy_addr,
+	int (*mii_write)(struct eth_device *, u8, u8, u16),
+	int dw_reset_phy(struct eth_device *))
 {
 	/* Extended PHY control 1, select GMII */
-	phy_write(phydev, MDIO_DEVAD_NONE, 23, 0x0020);
+	mii_write(dev, phy_addr, 23, 0x0020);
 
 	/* Software reset necessary after GMII mode selction */
-	phy_reset(phydev);
+	dw_reset_phy(dev);
 
 	/* Enable extended page register access */
-	phy_write(phydev, MDIO_DEVAD_NONE, 31, 0x0001);
+	mii_write(dev, phy_addr, 31, 0x0001);
 
 	/* 17e: Enhanced LED behavior, needs to be written twice */
-	phy_write(phydev, MDIO_DEVAD_NONE, 17, 0x09ff);
-	phy_write(phydev, MDIO_DEVAD_NONE, 17, 0x09ff);
+	mii_write(dev, phy_addr, 17, 0x09ff);
+	mii_write(dev, phy_addr, 17, 0x09ff);
 
 	/* 16e: Enhanced LED method select */
-	phy_write(phydev, MDIO_DEVAD_NONE, 16, 0xe0ea);
+	mii_write(dev, phy_addr, 16, 0xe0ea);
 
 	/* Disable extended page register access */
-	phy_write(phydev, MDIO_DEVAD_NONE, 31, 0x0000);
+	mii_write(dev, phy_addr, 31, 0x0000);
 
 	/* Enable clock output pin */
-	phy_write(phydev, MDIO_DEVAD_NONE, 18, 0x0049);
-
-	if (phydev->drv->config)
-		phydev->drv->config(phydev);
+	mii_write(dev, phy_addr, 18, 0x0049);
 
 	return 0;
 }
@@ -101,7 +100,7 @@ int board_eth_init(bd_t *bis)
 {
 	int ret = 0;
 
-	if (designware_initialize(CONFIG_SPEAR_ETHBASE,
+	if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_PHY_ADDR,
 				  PHY_INTERFACE_MODE_GMII) >= 0)
 		ret++;
 
drivers/net/designware.c +334 -149

573 lines not on this page · raw message

drivers/net/designware.h +16 -2
index 382b0c7..60b1103 100644
@@ -16,6 +16,8 @@
 
 #define CONFIG_MACRESET_TIMEOUT	(3 * CONFIG_SYS_HZ)
 #define CONFIG_MDIO_TIMEOUT	(3 * CONFIG_SYS_HZ)
+#define CONFIG_PHYRESET_TIMEOUT	(3 * CONFIG_SYS_HZ)
+#define CONFIG_AUTONEG_TIMEOUT	(5 * CONFIG_SYS_HZ)
 
 struct eth_mac_regs {
 	u32 conf;		/* 0x00 */
@@ -215,9 +217,14 @@ struct dmamacdescr {
 #endif
 
 struct dw_eth_dev {
+	u32 address;
 	u32 interface;
+	u32 speed;
+	u32 duplex;
 	u32 tx_currdescnum;
 	u32 rx_currdescnum;
+	u32 phy_configured;
+	u32 link_printed;
 
 	struct dmamacdescr tx_mac_descrtable[CONFIG_TX_DESCR_NUM];
 	struct dmamacdescr rx_mac_descrtable[CONFIG_RX_DESCR_NUM];
@@ -229,8 +236,15 @@ struct dw_eth_dev {
 	struct eth_dma_regs *dma_regs_p;
 
 	struct eth_device *dev;
-	struct phy_device *phydev;
-	struct mii_dev *bus;
 };
 
+/* Speed specific definitions */
+#define SPEED_10M		1
+#define SPEED_100M		2
+#define SPEED_1000M		3
+
+/* Duplex mode specific definitions */
+#define HALF_DUPLEX		1
+#define FULL_DUPLEX		2
+
 #endif
drivers/net/phy/micrel.c +3 -0
index 5d7e3be..506efb2 100644
@@ -53,6 +53,8 @@ static struct phy_driver KS8721_driver = {
 static int ksz90xx_startup(struct phy_device *phydev)
 {
 	unsigned phy_ctl;
+
+	printf("ksz90xx_startup\n");
 	genphy_update_link(phydev);
 	phy_ctl = phy_read(phydev, MDIO_DEVAD_NONE, MII_KSZ90xx_PHY_CTL);
 
@@ -215,6 +217,7 @@ static struct phy_driver ksz9031_driver = {
 
 int phy_micrel_init(void)
 {
+  printf("phy_micrel_init\n");
 	phy_register(&KSZ804_driver);
 #ifdef CONFIG_PHY_MICREL_KSZ9021
 	phy_register(&ksz9021_driver);
include/configs/bf609-ezkit.h +1 -2
index 12192ff..1a43e1b 100644
@@ -72,13 +72,12 @@
 #define CONFIG_NET_MULTI
 #define CONFIG_HOSTNAME		"bf609-ezkit"
 #define CONFIG_DESIGNWARE_ETH
-#define CONFIG_PHY_ADDR		1
 #define CONFIG_DW_PORTS		1
+#define CONFIG_DW_AUTONEG
 #define CONFIG_DW_ALTDESCRIPTOR
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_MII
 #define CONFIG_MII
-#define CONFIG_PHYLIB
 
 /* i2c Settings */
 #define CONFIG_BFIN_TWI_I2C
include/configs/socfpga_common.h +40 -0
index 56f993a..ded6cb6 100644
@@ -206,6 +206,46 @@
 #define CONFIG_ENV_IS_NOWHERE
 
 /*
+ * network support
+ */
+#ifndef CONFIG_SOCFPGA_VIRTUAL_TARGET
+#define CONFIG_DESIGNWARE_ETH          1
+#endif
+
+#ifdef CONFIG_DESIGNWARE_ETH
+#define CONFIG_EMAC0_BASE              SOCFPGA_EMAC0_ADDRESS
+#define CONFIG_EMAC1_BASE              SOCFPGA_EMAC1_ADDRESS
+/* console support for network */
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_PING
+/* designware */
+#define CONFIG_NET_MULTI
+#define CONFIG_DW_ALTDESCRIPTOR
+#define CONFIG_DW_SEARCH_PHY
+#define CONFIG_MII
+#define CONFIG_PHY_GIGE
+#define CONFIG_DW_AUTONEG
+#define CONFIG_AUTONEG_TIMEOUT         (15 * CONFIG_SYS_HZ)
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_MICREL
+#define CONFIG_PHY_MICREL_KSZ9021
+/* phy */
+#define CONFIG_EPHY0_PHY_ADDR          0
+#define CONFIG_EPHY1_PHY_ADDR          4
+#define CONFIG_KSZ9021_CLK_SKEW_ENV    "micrel-ksz9021-clk-skew"
+#define CONFIG_KSZ9021_CLK_SKEW_VAL    0xf0f0
+#define CONFIG_KSZ9021_DATA_SKEW_ENV   "micrel-ksz9021-data-skew"
+#define CONFIG_KSZ9021_DATA_SKEW_VAL   0x0
+/* Type of PHY available */
+#define SOCFPGA_PHYSEL_ENUM_GMII       0x0
+#define SOCFPGA_PHYSEL_ENUM_MII                0x1
+#define SOCFPGA_PHYSEL_ENUM_RGMII      0x2
+#define SOCFPGA_PHYSEL_ENUM_RMII       0x3
+#endif /* CONFIG_DESIGNWARE_ETH */
+
+/*
  * SPL "Second Program Loader" aka Initial Software
  */
 
include/configs/spear-common.h +3 -1
index c0eba37..55f100a 100644
@@ -17,9 +17,11 @@
 /* Ethernet driver configuration */
 #define CONFIG_MII
 #define CONFIG_DESIGNWARE_ETH
+#define CONFIG_DW_SEARCH_PHY
+#define CONFIG_DW0_PHY				1
 #define CONFIG_NET_MULTI
-#define CONFIG_PHYLIB
 #define CONFIG_PHY_RESET_DELAY			10000		/* in usec */
+#define CONFIG_DW_AUTONEG
 #define CONFIG_PHY_GIGE			/* Include GbE speed/duplex detection */
 
 /* USBD driver configuration */
include/configs/spear6xx_evb.h +0 -3
index 28dddcc..7f4dc58 100644
@@ -37,9 +37,6 @@
 #define CONFIG_SYS_FSMC_NAND_8BIT
 #define CONFIG_SYS_NAND_BASE			0xD2000000
 
-/* Ethernet PHY configuration */
-#define CONFIG_PHY_NATSEMI
-
 /* Environment Settings */
 #define CONFIG_EXTRA_ENV_SETTINGS              CONFIG_EXTRA_ENV_USBTTY
 
include/netdev.h +1 -1
index e211f18..72a0503 100644
@@ -36,7 +36,7 @@ int calxedaxgmac_initialize(u32 id, ulong base_addr);
 int cs8900_initialize(u8 dev_num, int base_addr);
 int davinci_emac_initialize(void);
 int dc21x4x_initialize(bd_t *bis);
-int designware_initialize(ulong base_addr, u32 interface);
+int designware_initialize(u32 id, ulong base_addr, u32 phy_addr, u32 interface);
 int dm9000_initialize(bd_t *bis);
 int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr);
 int e1000_initialize(bd_t *bis);
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html