Commit ed3c64f1acc958a7ee1a97f23acda13105f89443
Committed by
Joe Hershberger
1 parent
5a1899f9fc
Exists in
smarc_8mq_lf_v2020.04
and in
11 other branches
net: macb: add dma_burst_length config
GEM support higher DMA burst writes/reads than the default (4). add configuration structure with dma burst length so it could be applied later to DMA configuration. Signed-off-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Anup Patel <anup.patel@wdc.com> Tested-by: Anup Patel <anup.patel@wdc.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Showing 1 changed file with 21 additions and 1 deletions Side-by-side Diff
drivers/net/macb.c
... | ... | @@ -82,6 +82,7 @@ |
82 | 82 | |
83 | 83 | struct macb_device { |
84 | 84 | void *regs; |
85 | + unsigned int dma_burst_length; | |
85 | 86 | |
86 | 87 | unsigned int rx_tail; |
87 | 88 | unsigned int tx_head; |
... | ... | @@ -118,6 +119,11 @@ |
118 | 119 | phy_interface_t phy_interface; |
119 | 120 | #endif |
120 | 121 | }; |
122 | + | |
123 | +struct macb_config { | |
124 | + unsigned int dma_burst_length; | |
125 | +}; | |
126 | + | |
121 | 127 | #ifndef CONFIG_DM_ETH |
122 | 128 | #define to_macb(_nd) container_of(_nd, struct macb_device, netdev) |
123 | 129 | #endif |
124 | 130 | |
... | ... | @@ -1135,8 +1141,13 @@ |
1135 | 1141 | } |
1136 | 1142 | #endif |
1137 | 1143 | |
1144 | +static const struct macb_config default_gem_config = { | |
1145 | + .dma_burst_length = 16, | |
1146 | +}; | |
1147 | + | |
1138 | 1148 | static int macb_eth_probe(struct udevice *dev) |
1139 | 1149 | { |
1150 | + const struct macb_config *macb_config; | |
1140 | 1151 | struct eth_pdata *pdata = dev_get_platdata(dev); |
1141 | 1152 | struct macb_device *macb = dev_get_priv(dev); |
1142 | 1153 | const char *phy_mode; |
... | ... | @@ -1153,6 +1164,11 @@ |
1153 | 1164 | |
1154 | 1165 | macb->regs = (void *)pdata->iobase; |
1155 | 1166 | |
1167 | + macb_config = (struct macb_config *)dev_get_driver_data(dev); | |
1168 | + if (!macb_config) | |
1169 | + macb_config = &default_gem_config; | |
1170 | + | |
1171 | + macb->dma_burst_length = macb_config->dma_burst_length; | |
1156 | 1172 | #ifdef CONFIG_CLK |
1157 | 1173 | ret = macb_enable_clk(dev); |
1158 | 1174 | if (ret) |
1159 | 1175 | |
... | ... | @@ -1213,12 +1229,16 @@ |
1213 | 1229 | return macb_late_eth_ofdata_to_platdata(dev); |
1214 | 1230 | } |
1215 | 1231 | |
1232 | +static const struct macb_config sama5d4_config = { | |
1233 | + .dma_burst_length = 4, | |
1234 | +}; | |
1235 | + | |
1216 | 1236 | static const struct udevice_id macb_eth_ids[] = { |
1217 | 1237 | { .compatible = "cdns,macb" }, |
1218 | 1238 | { .compatible = "cdns,at91sam9260-macb" }, |
1219 | 1239 | { .compatible = "atmel,sama5d2-gem" }, |
1220 | 1240 | { .compatible = "atmel,sama5d3-gem" }, |
1221 | - { .compatible = "atmel,sama5d4-gem" }, | |
1241 | + { .compatible = "atmel,sama5d4-gem", .data = (ulong)&sama5d4_config }, | |
1222 | 1242 | { .compatible = "cdns,zynq-gem" }, |
1223 | 1243 | { } |
1224 | 1244 | }; |