Commit b962ac794a26ff80269755c13c3e4fee65c3809e

Authored by Joachim Foerster
Committed by Wolfgang Denk
1 parent 29095f1a5c
Exists in master and in 55 other branches 8qm-imx_v2020.04_5.4.70_2.3.0, emb_lf_v2022.04, emb_lf_v2023.04, imx_v2015.04_4.1.15_1.0.0_ga, pitx_8mp_lf_v2020.04, smarc-8m-android-10.0.0_2.6.0, smarc-8m-android-11.0.0_2.0.0, smarc-8mp-android-11.0.0_2.0.0, smarc-emmc-imx_v2014.04_3.10.53_1.1.0_ga, smarc-emmc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx-l5.0.0_1.0.0-ga, smarc-imx6_v2018.03_4.14.98_2.0.0_ga, smarc-imx7_v2017.03_4.9.11_1.0.0_ga, smarc-imx7_v2018.03_4.14.98_2.0.0_ga, smarc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx_v2015.04_4.1.15_1.0.0_ga, smarc-imx_v2017.03_4.9.11_1.0.0_ga, smarc-imx_v2017.03_4.9.88_2.0.0_ga, smarc-imx_v2017.03_o8.1.0_1.3.0_8m, smarc-imx_v2018.03_4.14.78_1.0.0_ga, smarc-m6.0.1_2.1.0-ga, smarc-n7.1.2_2.0.0-ga, smarc-rel_imx_4.1.15_2.0.0_ga, smarc_8m-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8m-imx_v2019.04_4.19.35_1.1.0, smarc_8m_00d0-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2019.04_4.19.35_1.1.0, smarc_8mm-imx_v2020.04_5.4.24_2.1.0, smarc_8mp_lf_v2020.04, smarc_8mq-imx_v2020.04_5.4.24_2.1.0, smarc_8mq_lf_v2020.04, ti-u-boot-2015.07, u-boot-2013.01.y, v2013.10, v2013.10-smarct33, v2013.10-smartmen, v2014.01, v2014.04, v2014.04-smarct33, v2014.04-smarct33-emmc, v2014.04-smartmen, v2014.07, v2014.07-smarct33, v2014.07-smartmen, v2015.07-smarct33, v2015.07-smarct33-emmc, v2015.07-smarct4x, v2016.05-dlt, v2016.05-smarct3x, v2016.05-smarct3x-emmc, v2016.05-smarct4x, v2017.01-smarct3x, v2017.01-smarct3x-emmc, v2017.01-smarct4x

altera_tse: Add support for dedicated descriptor memory

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>

Showing 3 changed files with 27 additions and 5 deletions Side-by-side Diff

board/altera/nios2-generic/nios2-generic.c
... ... @@ -74,7 +74,15 @@
74 74 rc += altera_tse_initialize(0,
75 75 CONFIG_SYS_ALTERA_TSE_MAC_BASE,
76 76 CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE,
77   - CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE);
  77 + CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE,
  78 +#if defined(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE) && \
  79 + (CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE > 0)
  80 + CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE,
  81 + CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE);
  82 +#else
  83 + 0,
  84 + 0);
  85 +#endif
78 86 #endif
79 87 #ifdef CONFIG_ETHOC
80 88 rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE);
drivers/net/altera_tse.c
... ... @@ -882,7 +882,8 @@
882 882  
883 883 /* TSE init code */
884 884 int altera_tse_initialize(u8 dev_num, int mac_base,
885   - int sgdma_rx_base, int sgdma_tx_base)
  885 + int sgdma_rx_base, int sgdma_tx_base,
  886 + u32 sgdma_desc_base, u32 sgdma_desc_size)
886 887 {
887 888 struct altera_tse_priv *priv;
888 889 struct eth_device *dev;
... ... @@ -903,8 +904,20 @@
903 904 free(dev);
904 905 return 0;
905 906 }
906   - tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX),
907   - &dma_handle);
  907 + if (sgdma_desc_size) {
  908 + if (sgdma_desc_size < (sizeof(*tx_desc) * (3 + PKTBUFSRX))) {
  909 + printf("ALTERA_TSE-%hu: "
  910 + "descriptor memory is too small\n", dev_num);
  911 + free(priv);
  912 + free(dev);
  913 + return 0;
  914 + }
  915 + tx_desc = (struct alt_sgdma_descriptor *)sgdma_desc_base;
  916 + } else {
  917 + tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX),
  918 + &dma_handle);
  919 + }
  920 +
908 921 rx_desc = tx_desc + 2;
909 922 debug("tx desc: address = 0x%x\n", (unsigned int)tx_desc);
910 923 debug("rx desc: address = 0x%x\n", (unsigned int)rx_desc);
... ... @@ -42,7 +42,8 @@
42 42  
43 43 /* Driver initialization prototypes */
44 44 int altera_tse_initialize(u8 dev_num, int mac_base,
45   - int sgdma_rx_base, int sgdma_tx_base);
  45 + int sgdma_rx_base, int sgdma_tx_base,
  46 + u32 sgdma_desc_base, u32 sgdma_desc_size);
46 47 int at91emac_register(bd_t *bis, unsigned long iobase);
47 48 int au1x00_enet_initialize(bd_t*);
48 49 int ax88180_initialize(bd_t *bis);