Commit 59494dd6 authored by David S. Miller's avatar David S. Miller

Merge branch 'cpsw-delete-rx_descs'

Ivan Khoronzhuk says:

====================
net: ethernet: ti: cpsw: delete rx_descs property

There is no reason in rx_descs property because davinici_cpdma
driver splits pool of descriptors equally between tx and rx channels.
So, this patch series makes driver to use available number of
descriptors for rx channels.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0350cb48 6774b68b
...@@ -15,7 +15,6 @@ Required properties: ...@@ -15,7 +15,6 @@ Required properties:
- cpdma_channels : Specifies number of channels in CPDMA - cpdma_channels : Specifies number of channels in CPDMA
- ale_entries : Specifies No of entries ALE can hold - ale_entries : Specifies No of entries ALE can hold
- bd_ram_size : Specifies internal descriptor RAM size - bd_ram_size : Specifies internal descriptor RAM size
- rx_descs : Specifies number of Rx descriptors
- mac_control : Specifies Default MAC control register content - mac_control : Specifies Default MAC control register content
for the specific platform for the specific platform
- slaves : Specifies number for slaves - slaves : Specifies number for slaves
......
...@@ -766,7 +766,6 @@ mac: ethernet@4a100000 { ...@@ -766,7 +766,6 @@ mac: ethernet@4a100000 {
ale_entries = <1024>; ale_entries = <1024>;
bd_ram_size = <0x2000>; bd_ram_size = <0x2000>;
no_bd_ram = <0>; no_bd_ram = <0>;
rx_descs = <64>;
mac_control = <0x20>; mac_control = <0x20>;
slaves = <2>; slaves = <2>;
active_slave = <0>; active_slave = <0>;
......
...@@ -626,7 +626,6 @@ GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH ...@@ -626,7 +626,6 @@ GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH
ale_entries = <1024>; ale_entries = <1024>;
bd_ram_size = <0x2000>; bd_ram_size = <0x2000>;
no_bd_ram = <0>; no_bd_ram = <0>;
rx_descs = <64>;
mac_control = <0x20>; mac_control = <0x20>;
slaves = <2>; slaves = <2>;
active_slave = <0>; active_slave = <0>;
......
...@@ -509,7 +509,6 @@ mac: ethernet@4a100000 { ...@@ -509,7 +509,6 @@ mac: ethernet@4a100000 {
ale_entries = <1024>; ale_entries = <1024>;
bd_ram_size = <0x2000>; bd_ram_size = <0x2000>;
no_bd_ram = <0>; no_bd_ram = <0>;
rx_descs = <64>;
mac_control = <0x20>; mac_control = <0x20>;
slaves = <2>; slaves = <2>;
active_slave = <0>; active_slave = <0>;
......
...@@ -1626,7 +1626,6 @@ mac: ethernet@48484000 { ...@@ -1626,7 +1626,6 @@ mac: ethernet@48484000 {
ale_entries = <1024>; ale_entries = <1024>;
bd_ram_size = <0x2000>; bd_ram_size = <0x2000>;
no_bd_ram = <0>; no_bd_ram = <0>;
rx_descs = <64>;
mac_control = <0x20>; mac_control = <0x20>;
slaves = <2>; slaves = <2>;
active_slave = <0>; active_slave = <0>;
......
...@@ -1277,6 +1277,7 @@ static int cpsw_ndo_open(struct net_device *ndev) ...@@ -1277,6 +1277,7 @@ static int cpsw_ndo_open(struct net_device *ndev)
if (!cpsw_common_res_usage_state(priv)) { if (!cpsw_common_res_usage_state(priv)) {
struct cpsw_priv *priv_sl0 = cpsw_get_slave_priv(priv, 0); struct cpsw_priv *priv_sl0 = cpsw_get_slave_priv(priv, 0);
int buf_num;
/* setup tx dma to fixed prio and zero offset */ /* setup tx dma to fixed prio and zero offset */
cpdma_control_set(priv->dma, CPDMA_TX_PRIO_FIXED, 1); cpdma_control_set(priv->dma, CPDMA_TX_PRIO_FIXED, 1);
...@@ -1304,10 +1305,8 @@ static int cpsw_ndo_open(struct net_device *ndev) ...@@ -1304,10 +1305,8 @@ static int cpsw_ndo_open(struct net_device *ndev)
enable_irq(priv->irqs_table[0]); enable_irq(priv->irqs_table[0]);
} }
if (WARN_ON(!priv->data.rx_descs)) buf_num = cpdma_chan_get_rx_buf_num(priv->dma);
priv->data.rx_descs = 128; for (i = 0; i < buf_num; i++) {
for (i = 0; i < priv->data.rx_descs; i++) {
struct sk_buff *skb; struct sk_buff *skb;
ret = -ENOMEM; ret = -ENOMEM;
...@@ -1998,12 +1997,6 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, ...@@ -1998,12 +1997,6 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
} }
data->bd_ram_size = prop; data->bd_ram_size = prop;
if (of_property_read_u32(node, "rx_descs", &prop)) {
dev_err(&pdev->dev, "Missing rx_descs property in the DT.\n");
return -EINVAL;
}
data->rx_descs = prop;
if (of_property_read_u32(node, "mac_control", &prop)) { if (of_property_read_u32(node, "mac_control", &prop)) {
dev_err(&pdev->dev, "Missing mac_control property in the DT.\n"); dev_err(&pdev->dev, "Missing mac_control property in the DT.\n");
return -EINVAL; return -EINVAL;
......
...@@ -35,7 +35,6 @@ struct cpsw_platform_data { ...@@ -35,7 +35,6 @@ struct cpsw_platform_data {
u32 cpts_clock_shift; /* convert input clock ticks to nanoseconds */ u32 cpts_clock_shift; /* convert input clock ticks to nanoseconds */
u32 ale_entries; /* ale table size */ u32 ale_entries; /* ale table size */
u32 bd_ram_size; /*buffer descriptor ram size */ u32 bd_ram_size; /*buffer descriptor ram size */
u32 rx_descs; /* Number of Rx Descriptios */
u32 mac_control; /* Mac control register */ u32 mac_control; /* Mac control register */
u16 default_vlan; /* Def VLAN for ALE lookup in VLAN aware mode*/ u16 default_vlan; /* Def VLAN for ALE lookup in VLAN aware mode*/
bool dual_emac; /* Enable Dual EMAC mode */ bool dual_emac; /* Enable Dual EMAC mode */
......
...@@ -543,6 +543,12 @@ struct cpdma_chan *cpdma_chan_create(struct cpdma_ctlr *ctlr, int chan_num, ...@@ -543,6 +543,12 @@ struct cpdma_chan *cpdma_chan_create(struct cpdma_ctlr *ctlr, int chan_num,
} }
EXPORT_SYMBOL_GPL(cpdma_chan_create); EXPORT_SYMBOL_GPL(cpdma_chan_create);
int cpdma_chan_get_rx_buf_num(struct cpdma_ctlr *ctlr)
{
return ctlr->pool->num_desc / 2;
}
EXPORT_SYMBOL_GPL(cpdma_chan_get_rx_buf_num);
int cpdma_chan_destroy(struct cpdma_chan *chan) int cpdma_chan_destroy(struct cpdma_chan *chan)
{ {
struct cpdma_ctlr *ctlr; struct cpdma_ctlr *ctlr;
......
...@@ -81,6 +81,7 @@ int cpdma_ctlr_dump(struct cpdma_ctlr *ctlr); ...@@ -81,6 +81,7 @@ int cpdma_ctlr_dump(struct cpdma_ctlr *ctlr);
struct cpdma_chan *cpdma_chan_create(struct cpdma_ctlr *ctlr, int chan_num, struct cpdma_chan *cpdma_chan_create(struct cpdma_ctlr *ctlr, int chan_num,
cpdma_handler_fn handler); cpdma_handler_fn handler);
int cpdma_chan_get_rx_buf_num(struct cpdma_ctlr *ctlr);
int cpdma_chan_destroy(struct cpdma_chan *chan); int cpdma_chan_destroy(struct cpdma_chan *chan);
int cpdma_chan_start(struct cpdma_chan *chan); int cpdma_chan_start(struct cpdma_chan *chan);
int cpdma_chan_stop(struct cpdma_chan *chan); int cpdma_chan_stop(struct cpdma_chan *chan);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment