Skip to content

Commit 660e3d9

Browse files
bijudasdavem330
authored andcommitted
ravb: Initialize GbEthernet DMAC
Initialize GbEthernet DMAC found on RZ/G2L SoC. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent feab85c commit 660e3d9

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

drivers/net/ethernet/renesas/ravb.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ enum ravb_reg {
8181
RQC3 = 0x00A0,
8282
RQC4 = 0x00A4,
8383
RPC = 0x00B0,
84+
RTC = 0x00B4, /* R-Car Gen3 and RZ/G2L only */
8485
UFCW = 0x00BC,
8586
UFCS = 0x00C0,
8687
UFCV0 = 0x00C4,
@@ -193,7 +194,7 @@ enum ravb_reg {
193194
GECMR = 0x05b0,
194195
MAHR = 0x05c0,
195196
MALR = 0x05c8,
196-
TROCR = 0x0700, /* R-Car Gen3 only */
197+
TROCR = 0x0700, /* R-Car Gen3 and RZ/G2L only */
197198
CEFCR = 0x0740,
198199
FRECR = 0x0748,
199200
TSFRCR = 0x0750,

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,35 @@ static void ravb_emac_init(struct net_device *ndev)
489489

490490
static int ravb_dmac_init_gbeth(struct net_device *ndev)
491491
{
492-
/* Place holder */
492+
int error;
493+
494+
error = ravb_ring_init(ndev, RAVB_BE);
495+
if (error)
496+
return error;
497+
498+
/* Descriptor format */
499+
ravb_ring_format(ndev, RAVB_BE);
500+
501+
/* Set AVB RX */
502+
ravb_write(ndev, 0x60000000, RCR);
503+
504+
/* Set Max Frame Length (RTC) */
505+
ravb_write(ndev, 0x7ffc0000 | GBETH_RX_BUFF_MAX, RTC);
506+
507+
/* Set FIFO size */
508+
ravb_write(ndev, 0x00222200, TGC);
509+
510+
ravb_write(ndev, 0, TCCR);
511+
512+
/* Frame receive */
513+
ravb_write(ndev, RIC0_FRE0, RIC0);
514+
/* Disable FIFO full warning */
515+
ravb_write(ndev, 0x0, RIC1);
516+
/* Receive FIFO full error, descriptor empty */
517+
ravb_write(ndev, RIC2_QFE0 | RIC2_RFFE, RIC2);
518+
519+
ravb_write(ndev, TIC_FTE0, TIC);
520+
493521
return 0;
494522
}
495523

0 commit comments

Comments
 (0)