Skip to contentSkip to conversation

Enable network support on at91sam9n12ek board

PATCH Superseded Bo Shen 2 participants 7 messages Apr 23, 2013 – Apr 24, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Bo Shen

author
#0 lore raw

cover Enable network support on at91sam9n12ek board

This patch set base on the following patch set:
- arm: at91: add at91sam9n12ek board support
- http://patchwork.ozlabs.org/patch/237184/

And implement the following things
- add ks8851_16mll ethernet driver
- Enable network support on at91sam9n12ek board.

Bo Shen (1):
ARM: at91sam9n12: add network support with ksz8851_16mll

Roberto Cerati (1):
net: ks8851_mll: add ethernet support

 board/atmel/at91sam9n12ek/at91sam9n12ek.c |   36 ++
 drivers/net/Makefile                      |    1 +
 drivers/net/ks8851_mll.c                  |  635 +++++++++++++++++++++++++++++
 drivers/net/ks8851_mll.h                  |  357 ++++++++++++++++
 include/configs/at91sam9n12ek.h           |    4 +
 include/netdev.h                          |    1 +
 6 files changed, 1034 insertions(+)
 create mode 100644 drivers/net/ks8851_mll.c
 create mode 100644 drivers/net/ks8851_mll.h
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/2 net: ks8851_mll: add ethernet support

From: Roberto Cerati <[email protected]>

The device interface is 16 bits wide.
All the available packets are read from the incoming fifo.

[voice.shen at atmel.com: address comments from review results]
[voice.shen at atmel.com: clean up for submit]
---
 drivers/net/Makefile     |    1 +
 drivers/net/ks8851_mll.c |  635 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/ks8851_mll.h |  357 ++++++++++++++++++++++++++
 include/netdev.h         |    1 +
 4 files changed, 994 insertions(+)
 create mode 100644 drivers/net/ks8851_mll.c
 create mode 100644 drivers/net/ks8851_mll.h
drivers/net/Makefile +1 -0
index 786a656..f4cc072 100644
@@ -50,6 +50,7 @@ COBJS-$(CONFIG_FTMAC100) += ftmac100.o
 COBJS-$(CONFIG_GRETH) += greth.o
 COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
 COBJS-$(CONFIG_DRIVER_KS8695ETH) += ks8695eth.o
+COBJS-$(CONFIG_KS8851_MLL) += ks8851_mll.o
 COBJS-$(CONFIG_LAN91C96) += lan91c96.o
 COBJS-$(CONFIG_MACB) += macb.o
 COBJS-$(CONFIG_MCFFEC) += mcffec.o mcfmii.o
drivers/net/ks8851_mll.c new file +635 -0

635 lines not on this page · raw message

drivers/net/ks8851_mll.h new file +357 -0

357 lines not on this page · raw message

include/netdev.h +1 -0
index fd3e243..7c2aacb 100644
@@ -71,6 +71,7 @@ int greth_initialize(bd_t *bis);
 void gt6426x_eth_initialize(bd_t *bis);
 int inca_switch_initialize(bd_t *bis);
 int ks8695_eth_initialize(void);
+int ks8851_mll_initialize(u8 dev_num, int base_addr);
 int lan91c96_initialize(u8 dev_num, int base_addr);
 int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
 int mcdmafec_initialize(bd_t *bis);
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/2 net: ks8851_mll: add ethernet support

Quoted 4 lines · Bo Shen

From: Roberto Cerati <[email protected]>

The device interface is 16 bits wide.
All the available packets are read from the incoming fifo.

[snip]

Quoted 2 lines

+/* union ks_tx_hdr - tx header data
+ * @txb: The header as bytes

/*
* union ks_tx_hdr...

Please fix globally.

[snip]

Quoted 1 line

+#define RXFSHR_ERR (RXFSHR_RXCE | RXFSHR_RXRF |\

#define<space> please, thanks.

Looks fine aside from these style problems however, 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/20130423/9179269a/attachment.pgp>
author
#3 lore raw

PATCH 1/2 net: ks8851_mll: add ethernet support

Hi Tom,

Quoted 4 lines · Tom Rini
Quoted 2 lines · Bo Shen

From: Roberto Cerati <[email protected]>

Quoted 8 lines
Quoted 2 lines

The device interface is 16 bits wide.
All the available packets are read from the incoming fifo.

[snip]

Quoted 2 lines

+/* union ks_tx_hdr - tx header data
+ * @txb: The header as bytes

/*
* union ks_tx_hdr...

If I use this style comments, when use checkpatch.pl to check, it will report:
--->8---
WARNING: networking block comments don't use an empty /* line, use /* Comment...
#81: FILE: drivers/net/ks8851_mll.c:41:
+
+/*
---<8---

Quoted 1 line

Please fix globally.

So, do you think I should ignore the warning and fix this?

Quoted 4 lines

[snip]

Quoted 1 line

+#define RXFSHR_ERR (RXFSHR_RXCE | RXFSHR_RXRF |\

#define<space> please, thanks.

I will fix it in next version.

Quoted 2 lines

Looks fine aside from these style problems however, thanks!

Best Regards,
Bo Shen

#4 lore raw

PATCH 1/2 net: ks8851_mll: add ethernet support

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 15 lines · Bo Shen

Hi Tom,

Quoted 11 lines · Tom Rini
Quoted 4 lines · Bo Shen

From: Roberto Cerati <[email protected]>

The device interface is 16 bits wide. All the available packets are read from the incoming fifo.

[snip]

Quoted 2 lines

+/* union ks_tx_hdr - tx header data + * @txb: The header as bytes

/* * union ks_tx_hdr...

Quoted 8 lines

If I use this style comments, when use checkpatch.pl to check, it will report: --->8--- WARNING: networking block comments don't use an empty /* line, use /* Comment... #81: FILE:
drivers/net/ks8851_mll.c:41: + +/* ---<8---

Quoted 1 line

Please fix globally.

So, do you think I should ignore the warning and fix this?

Add a patch that adds:
- --ignore NETWORKING_BLOCK_COMMENT_STYLE

To .checkpatch.conf to the series first, as that should turn off that check. Then correct as U-Boot uses the same style in all drivers.

Thanks again!

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRdzeWAAoJENk4IS6UOR1WA+gP/3tiJGaGdGXepBVzNr5xwrFW 0R7aBWx9buMKwyKCxFNlKz1fUfCwOfzS1nHQGN95fK3pvApI7XyYLcmUPN7+bx3p CdgNVlaSHX5gqpl4+CHMKvF2QP4DjMT3jlUQPdTeYaaNCukMZDd3YRRpenazpWnL igruu+NVghwgZxOQF7D9ubovizBdXzwHcV45R5iW2ZCkUAwr2PYnilOOt9hhizqB bHScCXZ8rEWHttGpq+KeYVqWjhFyN/sgFcTuSyrBv56tXRgkUIrKfb6v/bUYI4Xz 8lx1AEBBsA6XVGupgPVLWXLwxYDLDS7vHklKrj68iAlqf7Rj2O2SYWbxHe6NL1vG 4sHJpExtieRcGAV632RmQTqduskOiJMYLxbvU+UVeTLyCV9CCFrae+c2E8oIYO2R OSp1FrX5cdmXQWFY4SdoQ2NTWl/rUDOoUaTjLFBONMg8j9Z37JqZoO2GXohbv0El Pl1BQmYfTRdrqa+MAF7ukxlOeDVLNzi0F2dOpB/R01Tn9qKfw+/lg5hFChp1E2je f5hSqlLl932sPCUCuJzuwZbr1Ye77sJx88ns8V3dldrwYhG4VA5tLYFcioIXg81Y SUzvmAjly92OXc34hXnrhK0Bny4evblHfaDVW+fhVADac4JhHKSoj8wbhWFyllkt 7QMgxq6ycR76u01Z1Q4e
=nsHB
-----END PGP SIGNATURE-----

author
#5 lore raw

PATCH 1/2 net: ks8851_mll: add ethernet support

Hi Tom,

Quoted 26 lines · Tom Rini

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 22 lines · Bo Shen

Hi Tom,

Quoted 11 lines · Tom Rini
Quoted 4 lines · Bo Shen

From: Roberto Cerati <[email protected]>

The device interface is 16 bits wide. All the available packets are read from the incoming fifo.

[snip]

Quoted 2 lines

+/* union ks_tx_hdr - tx header data + * @txb: The header as bytes

/* * union ks_tx_hdr...

If I use this style comments, when use checkpatch.pl to check, it will report: --->8--- WARNING: networking block comments don't use an empty /* line, use /* Comment... #81: FILE:
drivers/net/ks8851_mll.c:41: + +/* ---<8---

Quoted 1 line

Please fix globally.

Quoted 7 lines
Quoted 1 line

So, do you think I should ignore the warning and fix this?

Add a patch that adds:
- --ignore NETWORKING_BLOCK_COMMENT_STYLE

To .checkpatch.conf to the series first, as that should turn off that check. Then correct as U-Boot uses the same style in all drivers.

Thanks for your information.
I will add this patch and fix the comment style in next version.

Best Regards,
Bo Shen

Quoted 23 lines

Thanks again!

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRdzeWAAoJENk4IS6UOR1WA+gP/3tiJGaGdGXepBVzNr5xwrFW 0R7aBWx9buMKwyKCxFNlKz1fUfCwOfzS1nHQGN95fK3pvApI7XyYLcmUPN7+bx3p CdgNVlaSHX5gqpl4+CHMKvF2QP4DjMT3jlUQPdTeYaaNCukMZDd3YRRpenazpWnL igruu+NVghwgZxOQF7D9ubovizBdXzwHcV45R5iW2ZCkUAwr2PYnilOOt9hhizqB bHScCXZ8rEWHttGpq+KeYVqWjhFyN/sgFcTuSyrBv56tXRgkUIrKfb6v/bUYI4Xz 8lx1AEBBsA6XVGupgPVLWXLwxYDLDS7vHklKrj68iAlqf7Rj2O2SYWbxHe6NL1vG 4sHJpExtieRcGAV632RmQTqduskOiJMYLxbvU+UVeTLyCV9CCFrae+c2E8oIYO2R OSp1FrX5cdmXQWFY4SdoQ2NTWl/rUDOoUaTjLFBONMg8j9Z37JqZoO2GXohbv0El Pl1BQmYfTRdrqa+MAF7ukxlOeDVLNzi0F2dOpB/R01Tn9qKfw+/lg5hFChp1E2je f5hSqlLl932sPCUCuJzuwZbr1Ye77sJx88ns8V3dldrwYhG4VA5tLYFcioIXg81Y SUzvmAjly92OXc34hXnrhK0Bny4evblHfaDVW+fhVADac4JhHKSoj8wbhWFyllkt 7QMgxq6ycR76u01Z1Q4e
=nsHB
-----END PGP SIGNATURE-----

author
#6 lore raw

PATCH 2/2 ARM: at91sam9n12: add network support with ksz8851_16mll

In reply to Bo Shen

add network support with ksz8851_16mll on at91sam9n12ek board

---
 board/atmel/at91sam9n12ek/at91sam9n12ek.c |   36 +++++++++++++++++++++++++++++
 include/configs/at91sam9n12ek.h           |    4 ++++
 2 files changed, 40 insertions(+)
board/atmel/at91sam9n12ek/at91sam9n12ek.c +36 -0
index 8752794..3013a42 100644
@@ -33,6 +33,7 @@
 #include <lcd.h>
 #include <atmel_hlcdc.h>
 #include <atmel_mci.h>
+#include <netdev.h>
 
 #ifdef CONFIG_LCD_INFO
 #include <nand.h>
@@ -190,6 +191,30 @@ int board_mmc_init(bd_t *bd)
 }
 #endif
 
+#ifdef CONFIG_KS8851_MLL
+void at91sam9n12ek_ks8851_hw_init(void)
+{
+	struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
+
+	writel(AT91_SMC_SETUP_NWE(2) | AT91_SMC_SETUP_NCS_WR(0) |
+	       AT91_SMC_SETUP_NRD(1) | AT91_SMC_SETUP_NCS_RD(0),
+	       &smc->cs[2].setup);
+	writel(AT91_SMC_PULSE_NWE(7) | AT91_SMC_PULSE_NCS_WR(7) |
+	       AT91_SMC_PULSE_NRD(7) | AT91_SMC_PULSE_NCS_RD(7),
+	       &smc->cs[2].pulse);
+	writel(AT91_SMC_CYCLE_NWE(9) | AT91_SMC_CYCLE_NRD(9),
+	       &smc->cs[2].cycle);
+	writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
+	       AT91_SMC_MODE_EXNW_DISABLE |
+	       AT91_SMC_MODE_BAT | AT91_SMC_MODE_DBW_16 |
+	       AT91_SMC_MODE_TDF_CYCLE(1),
+	       &smc->cs[2].mode);
+
+	/* Configure NCS2 PIN */
+	at91_set_b_periph(AT91_PIO_PORTD, 19, 0);
+}
+#endif
+
 int board_early_init_f(void)
 {
 	/* Enable clocks for all PIOs */
@@ -217,9 +242,20 @@ int board_init(void)
 	at91_lcd_hw_init();
 #endif
 
+#ifdef CONFIG_KS8851_MLL
+	at91sam9n12ek_ks8851_hw_init();
+#endif
+
 	return 0;
 }
 
+#ifdef CONFIG_KS8851_MLL
+int board_eth_init(bd_t *bis)
+{
+	return ks8851_mll_initialize(0, CONFIG_KS8851_MLL_BASEADDR);
+}
+#endif
+
 int dram_init(void)
 {
 	gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
include/configs/at91sam9n12ek.h +4 -0
index 8d2673d..b4b1c31 100644
@@ -167,6 +167,10 @@
 #define CONFIG_DOS_PARTITION
 #endif
 
+/* Ethernet */
+#define CONFIG_KS8851_MLL
+#define CONFIG_KS8851_MLL_BASEADDR	0x30000000 /* use NCS2 */
+
 #define CONFIG_SYS_LOAD_ADDR		0x22000000 /* load address */
 
 #define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
Signature · 1 line
1.7.9.5