Skip to content

Commit d5cd454

Browse files
Merge patch series "R-Car CANFD fixes"
Biju Das <[email protected]> says: This patch series addresses 2 issues 1) Fix typo in pattern properties for R-Car V4M. 2) Fix page entries in the AFL list. v2->v3: * Collected tags. * Dropped unused variables cfg and start from rcar_canfd_configure_afl_rules(). * Link to v2: https://lore.kernel.org/all/[email protected] v1->v2: * Split fixes patches as separate series. * Added Rb tag from Geert for binding patch. * Added the tag Cc:[email protected] Link: https://patch.msgid.link/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
2 parents 80b5f90 + 1dba0a3 commit d5cd454

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ allOf:
170170
const: renesas,r8a779h0-canfd
171171
then:
172172
patternProperties:
173-
"^channel[5-7]$": false
173+
"^channel[4-7]$": false
174174
else:
175175
if:
176176
not:

drivers/net/can/rcar/rcar_canfd.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -787,22 +787,14 @@ static void rcar_canfd_configure_controller(struct rcar_canfd_global *gpriv)
787787
}
788788

789789
static void rcar_canfd_configure_afl_rules(struct rcar_canfd_global *gpriv,
790-
u32 ch)
790+
u32 ch, u32 rule_entry)
791791
{
792-
u32 cfg;
793-
int offset, start, page, num_rules = RCANFD_CHANNEL_NUMRULES;
792+
int offset, page, num_rules = RCANFD_CHANNEL_NUMRULES;
793+
u32 rule_entry_index = rule_entry % 16;
794794
u32 ridx = ch + RCANFD_RFFIFO_IDX;
795795

796-
if (ch == 0) {
797-
start = 0; /* Channel 0 always starts from 0th rule */
798-
} else {
799-
/* Get number of Channel 0 rules and adjust */
800-
cfg = rcar_canfd_read(gpriv->base, RCANFD_GAFLCFG(ch));
801-
start = RCANFD_GAFLCFG_GETRNC(gpriv, 0, cfg);
802-
}
803-
804796
/* Enable write access to entry */
805-
page = RCANFD_GAFL_PAGENUM(start);
797+
page = RCANFD_GAFL_PAGENUM(rule_entry);
806798
rcar_canfd_set_bit(gpriv->base, RCANFD_GAFLECTR,
807799
(RCANFD_GAFLECTR_AFLPN(gpriv, page) |
808800
RCANFD_GAFLECTR_AFLDAE));
@@ -818,13 +810,13 @@ static void rcar_canfd_configure_afl_rules(struct rcar_canfd_global *gpriv,
818810
offset = RCANFD_C_GAFL_OFFSET;
819811

820812
/* Accept all IDs */
821-
rcar_canfd_write(gpriv->base, RCANFD_GAFLID(offset, start), 0);
813+
rcar_canfd_write(gpriv->base, RCANFD_GAFLID(offset, rule_entry_index), 0);
822814
/* IDE or RTR is not considered for matching */
823-
rcar_canfd_write(gpriv->base, RCANFD_GAFLM(offset, start), 0);
815+
rcar_canfd_write(gpriv->base, RCANFD_GAFLM(offset, rule_entry_index), 0);
824816
/* Any data length accepted */
825-
rcar_canfd_write(gpriv->base, RCANFD_GAFLP0(offset, start), 0);
817+
rcar_canfd_write(gpriv->base, RCANFD_GAFLP0(offset, rule_entry_index), 0);
826818
/* Place the msg in corresponding Rx FIFO entry */
827-
rcar_canfd_set_bit(gpriv->base, RCANFD_GAFLP1(offset, start),
819+
rcar_canfd_set_bit(gpriv->base, RCANFD_GAFLP1(offset, rule_entry_index),
828820
RCANFD_GAFLP1_GAFLFDP(ridx));
829821

830822
/* Disable write access to page */
@@ -1851,6 +1843,7 @@ static int rcar_canfd_probe(struct platform_device *pdev)
18511843
unsigned long channels_mask = 0;
18521844
int err, ch_irq, g_irq;
18531845
int g_err_irq, g_recc_irq;
1846+
u32 rule_entry = 0;
18541847
bool fdmode = true; /* CAN FD only mode - default */
18551848
char name[9] = "channelX";
18561849
int i;
@@ -2023,7 +2016,8 @@ static int rcar_canfd_probe(struct platform_device *pdev)
20232016
rcar_canfd_configure_tx(gpriv, ch);
20242017

20252018
/* Configure receive rules */
2026-
rcar_canfd_configure_afl_rules(gpriv, ch);
2019+
rcar_canfd_configure_afl_rules(gpriv, ch, rule_entry);
2020+
rule_entry += RCANFD_CHANNEL_NUMRULES;
20272021
}
20282022

20292023
/* Configure common interrupts */

0 commit comments

Comments
 (0)