net: emaclite: Fix OF initialization
Subsystems (4)
PATCH v2 1/6 net: emaclite: Fix OF initialization
- Add xilinx_emaclite_of_init to netdev.h
- Remove global data pointer from the driver
- Add better handling for error state.
---
Changes in v2:
- Remove bis parameter which was causing compilation error
drivers/net/xilinx_emaclite.c | 17 +++++++++-------- include/netdev.h | 1 + 2 files changed, 10 insertions(+), 8 deletions(-)
drivers/net/xilinx_emaclite.c +9 -8
@@ -14,8 +14,6 @@#include <asm/io.h> #include <fdtdec.h> -DECLARE_GLOBAL_DATA_PTR ; -#undef DEBUG#define ENET_ADDR_LENGTH 6
@@ -364,24 +362,27 @@ int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr, }#ifdef CONFIG_OF_CONTROL -int xilinx_emaclite_init (bd_t *bis) +int xilinx_emaclite_of_init (const void *blob) {int offset =0 ;u32 ret =0 ;u32 reg;do { - offset =fdt_node_offset_by_compatible (gd->fdt_blob, offset, + offset =fdt_node_offset_by_compatible (blob, offset,"xlnx,xps-ethernetlite-1.00.a" );if (offset !=-1 ) { - reg =fdtdec_get_addr (gd->fdt_blob, offset,"reg" ); + reg =fdtdec_get_addr (blob, offset,"reg" );if (reg !=FDT_ADDR_T_NONE ) { -u32 rxpp =fdtdec_get_int (gd->fdt_blob, offset, +u32 rxpp =fdtdec_get_int (blob, offset,"xlnx,rx-ping-pong" ,0 ); -u32 txpp =fdtdec_get_int (gd->fdt_blob, offset, +u32 txpp =fdtdec_get_int (blob, offset,"xlnx,tx-ping-pong" ,0 ); - ret |=xilinx_emaclite_initialize (bis, reg, + ret |=xilinx_emaclite_initialize (NULL , reg, txpp, rxpp); + }else { +debug ("EMACLITE: Can't get base address\n" ); +return -1 ; } } }while (offset !=-1 );
include/netdev.h +1 -0
@@ -86,6 +86,7 @@ int uli526x_initialize(bd_t *bis);int armada100_fec_register (unsigned long base_addr);int xilinx_axiemac_initialize (bd_t *bis,unsigned long base_addr,unsigned long dma_addr); +int xilinx_emaclite_of_init (const void *blob);int xilinx_emaclite_initialize (bd_t *bis,unsigned long base_addr,int txpp,int rxpp); int xilinx_ll_temac_eth_init(bd_t *bis, unsigned long base_addr, int flags,
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140224/70b58233/attachment.pgp>
PATCH v2 2/6 zynq: Do not use SPL OF initialization
Disable CONFIG_OF_CONTROL for SPL compilation.
---
Changes in v2:
- Do not init SPL from DTB - not supported now
- New patch in this series
include/configs/zynq-common.h | 1 + 1 file changed, 1 insertion(+)
include/configs/zynq-common.h +1 -0
@@ -242,6 +242,7 @@#ifdef CONFIG_SPL_BUILD #define CONFIG_SYS_DCACHE_OFF #undef CONFIG_FPGA +#undef CONFIG_OF_CONTROL#endif /* MMC support */
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140224/ec87fd84/attachment.pgp>
PATCH v2 2/6 zynq: Do not use SPL OF initialization
Quoted 3 lines · Michal Simek
Disable
CONFIG_OF_CONTROLfor SPL compilation.Signed-off-by Michal Simek <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140304/668b5681/attachment.pgp>
PATCH v2 3/6 net: gem: Add OF initialization support
In reply to Michal SimekGem can be directly initialized from DTB.
---
Changes in v2: None
drivers/net/zynq_gem.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/netdev.h | 1 + 2 files changed, 43 insertions(+)
drivers/net/zynq_gem.c +42 -0
@@ -12,6 +12,8 @@#include <common.h> #include <net.h> #include <config.h> +#include <fdtdec.h> +#include <libfdt.h> #include <malloc.h> #include <asm/io.h> #include <phy.h>
@@ -534,3 +536,43 @@ int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr, u32 emio)return 1 ; } + +#ifdef CONFIG_OF_CONTROL +int zynq_gem_of_init (const void *blob) +{ +int offset =0 ; +u32 ret =0 ; +u32 reg, phy_reg; + +debug ("ZYNQ GEM: Initialization\n" ); + +do { + offset =fdt_node_offset_by_compatible (blob, offset, +"xlnx,ps7-ethernet-1.00.a" ); +if (offset !=-1 ) { + reg =fdtdec_get_addr (blob, offset,"reg" ); +if (reg !=FDT_ADDR_T_NONE ) { + offset =fdtdec_lookup_phandle (blob, offset, +"phy-handle" ); +if (offset !=-1 ) + phy_reg =fdtdec_get_addr (blob, offset, +"reg" ); +else + phy_reg =0 ; + +debug ("ZYNQ GEM: addr %x, phyaddr %x\n" , + reg, phy_reg); + + ret |=zynq_gem_initialize (NULL , reg, + phy_reg,0 ); + + }else { +debug ("ZYNQ GEM: Can't get base address\n" ); +return -1 ; + } + } + }while (offset !=-1 ); + +return ret; +} +#endif
include/netdev.h +1 -0
@@ -91,6 +91,7 @@ int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr, int txpp, int rxpp);int xilinx_ll_temac_eth_init (bd_t *bis,unsigned long base_addr,int flags,unsigned long ctrl_addr); +int zynq_gem_of_init (const void *blob);int zynq_gem_initialize (bd_t *bis,int base_addr,int phy_addr,u32 emio);/* * As long as the Xilinx xps_ll_temac ethernet driver has not its own interface
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140224/0d5a521f/attachment.pgp>
PATCH v2 3/6 net: gem: Add OF initialization support
Quoted 3 lines · Michal Simek
Gem can be directly initialized from DTB.
Signed-off-by Michal Simek <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140304/3b2459cc/attachment.pgp>
PATCH v2 4/6 mmc: zynq: Add OF initialization support
In reply to Michal SimekEnable initialize sdhci from DTB.
---
Changes in v2: None
arch/arm/include/asm/arch-zynq/sys_proto.h | 1 + drivers/mmc/zynq_sdhci.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+)
arch/arm/include/asm/arch-zynq/sys_proto.h +1 -0
@@ -19,5 +19,6 @@ extern void zynq_ddrc_init(void);/* Driver extern functions */ extern int zynq_sdhci_init (u32 regbase); +extern int zynq_sdhci_of_init (const void *blob);#endif /* _SYS_PROTO_H_ */
drivers/mmc/zynq_sdhci.c +29 -0
@@ -7,6 +7,8 @@*/ #include <common.h> +#include <fdtdec.h> +#include <libfdt.h> #include <malloc.h> #include <sdhci.h> #include <asm/arch/sys_proto.h>
@@ -32,3 +34,30 @@ int zynq_sdhci_init(u32 regbase)add_sdhci (host,52000000 ,52000000 >>9 );return 0 ; } + +#ifdef CONFIG_OF_CONTROL +int zynq_sdhci_of_init (const void *blob) +{ +int offset =0 ; +u32 ret =0 ; +u32 reg; + +debug ("ZYNQ SDHCI: Initialization\n" ); + +do { + offset =fdt_node_offset_by_compatible (blob, offset, +"arasan,sdhci-8.9a" ); +if (offset !=-1 ) { + reg =fdtdec_get_addr (blob, offset,"reg" ); +if (reg !=FDT_ADDR_T_NONE ) { + ret |=zynq_sdhci_init (reg); + }else { +debug ("ZYNQ SDHCI: Can't get base address\n" ); +return -1 ; + } + } + }while (offset !=-1 ); + +return ret; +} +#endif
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140224/e848667e/attachment.pgp>
PATCH v2 4/6 mmc: zynq: Add OF initialization support
Quoted 3 lines · Michal Simek
Enable initialize sdhci from DTB.
Signed-off-by Michal Simek <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140304/37b1b8b0/attachment.pgp>
PATCH v2 5/6 zynq: Add OF ram initialization support
In reply to Michal SimekRead ram size directly from DTB.
---
Changes in v2: None
board/xilinx/zynq/board.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
board/xilinx/zynq/board.c +21 -1
@@ -5,6 +5,7 @@*/ #include <common.h> +#include <fdtdec.h> #include <netdev.h> #include <zynqpl.h> #include <asm/arch/hardware.h>
@@ -134,8 +135,27 @@ int board_mmc_init(bd_t *bd)int dram_init (void ) { +#ifdef CONFIG_OF_CONTROL +int node; +fdt_addr_t addr; +fdt_size_t size; +const void *blob = gd->fdt_blob; + + node =fdt_node_offset_by_prop_value (blob,-1 ,"device_type" , +"memory" ,7 ); +if (node == -FDT_ERR_NOTFOUND ) { +debug ("ZYNQ DRAM: Can't get memory node\n" ); +return -1 ; + } + addr =fdtdec_get_addr_size (blob, node,"reg" , &size); +if (addr ==FDT_ADDR_T_NONE || size ==0 ) { +debug ("ZYNQ DRAM: Can't get base address or size\n" ); +return -1 ; + } + gd->ram_size = size; +#else gd->ram_size =CONFIG_SYS_SDRAM_SIZE ; - +#endif zynq_ddrc_init ();return 0 ;
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140224/43cb1820/attachment.pgp>
PATCH v2 5/6 zynq: Add OF ram initialization support
Quoted 4 lines · Michal Simek
Read ram size directly from DTB.
Signed-off-by Michal Simek <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140304/f19cde15/attachment.pgp>
PATCH v2 6/6 serial: zynq: Add OF initialization support
In reply to Michal SimekAdd console selection from DTB which is enough to have OF driven solution.
---
Changes in v2: None
drivers/serial/serial_zynq.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/serial/serial_zynq.c +28 -0
@@ -6,6 +6,7 @@*/ #include <common.h> +#include <fdtdec.h> #include <watchdog.h> #include <asm/io.h> #include <linux/compiler.h>
@@ -13,6 +14,8 @@#include <asm/arch/clk.h> #include <asm/arch/hardware.h> +DECLARE_GLOBAL_DATA_PTR ; +#define ZYNQ_UART_SR_TXFULL 0x00000010/* TX FIFO full */ #define ZYNQ_UART_SR_RXEMPTY 0x00000002/* RX FIFO empty */
@@ -182,6 +185,30 @@ DECLARE_PSSERIAL_FUNCTIONS(1);struct serial_device uart_zynq_serial1_device =INIT_PSSERIAL_STRUCTURE (1 ,"ttyPS1" ); +#ifdef CONFIG_OF_CONTROL +__weak struct serial_device *default_serial_console (void ) +{ +const void *blob = gd->fdt_blob; +int node; +unsigned int base_addr; + + node =fdt_path_offset (blob,"serial0" ); +if (node <0 ) +return NULL ; + + base_addr =fdtdec_get_addr (blob, node,"reg" ); +if (base_addr ==FDT_ADDR_T_NONE ) +return NULL ; + +if (base_addr ==ZYNQ_SERIAL_BASEADDR0 ) +return &uart_zynq_serial0_device; + +if (base_addr ==ZYNQ_SERIAL_BASEADDR1 ) +return &uart_zynq_serial1_device; + +return NULL ; +} +#else __weak struct serial_device *default_serial_console (void ) {#if defined(CONFIG_ZYNQ_SERIAL_UART0 )
@@ -194,6 +221,7 @@ __weak struct serial_device *default_serial_console(void)#endif return NULL; } +#endif void zynq_serial_initalize (void ) {
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140224/ac077fec/attachment.pgp>
PATCH v2 6/6 serial: zynq: Add OF initialization support
Quoted 4 lines · Michal Simek
Add console selection from DTB which is enough to have OF driven solution.
Signed-off-by Michal Simek <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140304/726e159d/attachment.pgp>
PATCH v2 1/6 net: emaclite: Fix OF initialization
In reply to Michal SimekQuoted 5 lines · Michal Simek
- Add
xilinx_emaclite_of_inittonetdev.h
- Remove global data pointer from the driver
- Add better handling for error state.Signed-off-by Michal Simek <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140304/9af04191/attachment.pgp>