• Home
  • Raw
  • Download

Lines Matching refs:hellcreek

96 static u16 hellcreek_read(struct hellcreek *hellcreek, unsigned int offset)  in hellcreek_read()  argument
98 return readw(hellcreek->base + offset); in hellcreek_read()
101 static u16 hellcreek_read_ctrl(struct hellcreek *hellcreek) in hellcreek_read_ctrl() argument
103 return readw(hellcreek->base + HR_CTRL_C); in hellcreek_read_ctrl()
106 static u16 hellcreek_read_stat(struct hellcreek *hellcreek) in hellcreek_read_stat() argument
108 return readw(hellcreek->base + HR_SWSTAT); in hellcreek_read_stat()
111 static void hellcreek_write(struct hellcreek *hellcreek, u16 data, in hellcreek_write() argument
114 writew(data, hellcreek->base + offset); in hellcreek_write()
117 static void hellcreek_select_port(struct hellcreek *hellcreek, int port) in hellcreek_select_port() argument
121 hellcreek_write(hellcreek, val, HR_PSEL); in hellcreek_select_port()
124 static void hellcreek_select_prio(struct hellcreek *hellcreek, int prio) in hellcreek_select_prio() argument
128 hellcreek_write(hellcreek, val, HR_PSEL); in hellcreek_select_prio()
131 static void hellcreek_select_port_prio(struct hellcreek *hellcreek, int port, in hellcreek_select_port_prio() argument
138 hellcreek_write(hellcreek, val, HR_PSEL); in hellcreek_select_port_prio()
141 static void hellcreek_select_counter(struct hellcreek *hellcreek, int counter) in hellcreek_select_counter() argument
145 hellcreek_write(hellcreek, val, HR_CSEL); in hellcreek_select_counter()
151 static void hellcreek_select_vlan(struct hellcreek *hellcreek, int vid, in hellcreek_select_vlan() argument
159 hellcreek_write(hellcreek, val, HR_VIDCFG); in hellcreek_select_vlan()
163 hellcreek_write(hellcreek, val, HR_VIDCFG); in hellcreek_select_vlan()
166 static void hellcreek_select_tgd(struct hellcreek *hellcreek, int port) in hellcreek_select_tgd() argument
170 hellcreek_write(hellcreek, val, TR_TGDSEL); in hellcreek_select_tgd()
173 static int hellcreek_wait_until_ready(struct hellcreek *hellcreek) in hellcreek_wait_until_ready() argument
178 return readx_poll_timeout(hellcreek_read_ctrl, hellcreek, in hellcreek_wait_until_ready()
183 static int hellcreek_wait_until_transitioned(struct hellcreek *hellcreek) in hellcreek_wait_until_transitioned() argument
187 return readx_poll_timeout_atomic(hellcreek_read_ctrl, hellcreek, in hellcreek_wait_until_transitioned()
192 static int hellcreek_wait_fdb_ready(struct hellcreek *hellcreek) in hellcreek_wait_fdb_ready() argument
196 return readx_poll_timeout_atomic(hellcreek_read_stat, hellcreek, in hellcreek_wait_fdb_ready()
201 static int hellcreek_detect(struct hellcreek *hellcreek) in hellcreek_detect() argument
207 id = hellcreek_read(hellcreek, HR_MODID_C); in hellcreek_detect()
208 rel_low = hellcreek_read(hellcreek, HR_REL_L_C); in hellcreek_detect()
209 rel_high = hellcreek_read(hellcreek, HR_REL_H_C); in hellcreek_detect()
210 date_low = hellcreek_read(hellcreek, HR_BLD_L_C); in hellcreek_detect()
211 date_high = hellcreek_read(hellcreek, HR_BLD_H_C); in hellcreek_detect()
212 tgd_ver = hellcreek_read(hellcreek, TR_TGDVER); in hellcreek_detect()
214 if (id != hellcreek->pdata->module_id) in hellcreek_detect()
222 dev_info(hellcreek->dev, "Module ID=%02x Release=%04x Date=%04x TGD Version=%02x.%02x\n", in hellcreek_detect()
228 static void hellcreek_feature_detect(struct hellcreek *hellcreek) in hellcreek_feature_detect() argument
232 features = hellcreek_read(hellcreek, HR_FEABITS0); in hellcreek_feature_detect()
237 hellcreek->fdb_entries = ((features & HR_FEABITS0_FDBBINS_MASK) >> in hellcreek_feature_detect()
251 struct hellcreek *hellcreek = ds->priv; in hellcreek_port_enable() local
255 hellcreek_port = &hellcreek->ports[port]; in hellcreek_port_enable()
257 dev_dbg(hellcreek->dev, "Enable port %d\n", port); in hellcreek_port_enable()
259 mutex_lock(&hellcreek->reg_lock); in hellcreek_port_enable()
261 hellcreek_select_port(hellcreek, port); in hellcreek_port_enable()
264 hellcreek_write(hellcreek, val, HR_PTCFG); in hellcreek_port_enable()
267 mutex_unlock(&hellcreek->reg_lock); in hellcreek_port_enable()
274 struct hellcreek *hellcreek = ds->priv; in hellcreek_port_disable() local
278 hellcreek_port = &hellcreek->ports[port]; in hellcreek_port_disable()
280 dev_dbg(hellcreek->dev, "Disable port %d\n", port); in hellcreek_port_disable()
282 mutex_lock(&hellcreek->reg_lock); in hellcreek_port_disable()
284 hellcreek_select_port(hellcreek, port); in hellcreek_port_disable()
287 hellcreek_write(hellcreek, val, HR_PTCFG); in hellcreek_port_disable()
290 mutex_unlock(&hellcreek->reg_lock); in hellcreek_port_disable()
317 struct hellcreek *hellcreek = ds->priv; in hellcreek_get_ethtool_stats() local
321 hellcreek_port = &hellcreek->ports[port]; in hellcreek_get_ethtool_stats()
329 mutex_lock(&hellcreek->reg_lock); in hellcreek_get_ethtool_stats()
331 hellcreek_select_counter(hellcreek, offset); in hellcreek_get_ethtool_stats()
337 high = hellcreek_read(hellcreek, HR_CRDH); in hellcreek_get_ethtool_stats()
338 low = hellcreek_read(hellcreek, HR_CRDL); in hellcreek_get_ethtool_stats()
344 mutex_unlock(&hellcreek->reg_lock); in hellcreek_get_ethtool_stats()
357 struct hellcreek *hellcreek = ds->priv; in hellcreek_vlan_prepare() local
360 dev_dbg(hellcreek->dev, "VLAN prepare for port %d\n", port); in hellcreek_vlan_prepare()
366 for (i = 0; i < hellcreek->pdata->num_ports; ++i) { in hellcreek_vlan_prepare()
381 static void hellcreek_select_vlan_params(struct hellcreek *hellcreek, int port, in hellcreek_select_vlan_params() argument
403 dev_err(hellcreek->dev, "Unknown port %d selected!\n", port); in hellcreek_select_vlan_params()
407 static void hellcreek_apply_vlan(struct hellcreek *hellcreek, int port, u16 vid, in hellcreek_apply_vlan() argument
413 dev_dbg(hellcreek->dev, "Apply VLAN: port=%d vid=%u pvid=%d untagged=%d", in hellcreek_apply_vlan()
416 mutex_lock(&hellcreek->reg_lock); in hellcreek_apply_vlan()
418 hellcreek_select_port(hellcreek, port); in hellcreek_apply_vlan()
419 hellcreek_select_vlan(hellcreek, vid, pvid); in hellcreek_apply_vlan()
422 hellcreek_select_vlan_params(hellcreek, port, &shift, &mask); in hellcreek_apply_vlan()
423 val = hellcreek->vidmbrcfg[vid]; in hellcreek_apply_vlan()
430 hellcreek_write(hellcreek, val, HR_VIDMBRCFG); in hellcreek_apply_vlan()
431 hellcreek->vidmbrcfg[vid] = val; in hellcreek_apply_vlan()
433 mutex_unlock(&hellcreek->reg_lock); in hellcreek_apply_vlan()
436 static void hellcreek_unapply_vlan(struct hellcreek *hellcreek, int port, in hellcreek_unapply_vlan() argument
442 dev_dbg(hellcreek->dev, "Unapply VLAN: port=%d vid=%u\n", port, vid); in hellcreek_unapply_vlan()
444 mutex_lock(&hellcreek->reg_lock); in hellcreek_unapply_vlan()
446 hellcreek_select_vlan(hellcreek, vid, false); in hellcreek_unapply_vlan()
449 hellcreek_select_vlan_params(hellcreek, port, &shift, &mask); in hellcreek_unapply_vlan()
450 val = hellcreek->vidmbrcfg[vid]; in hellcreek_unapply_vlan()
454 hellcreek_write(hellcreek, val, HR_VIDMBRCFG); in hellcreek_unapply_vlan()
455 hellcreek->vidmbrcfg[vid] = val; in hellcreek_unapply_vlan()
457 mutex_unlock(&hellcreek->reg_lock); in hellcreek_unapply_vlan()
466 struct hellcreek *hellcreek = ds->priv; in hellcreek_vlan_add() local
473 dev_dbg(hellcreek->dev, "Add VLAN %d on port %d, %s, %s\n", in hellcreek_vlan_add()
477 hellcreek_apply_vlan(hellcreek, port, vlan->vid, pvid, untagged); in hellcreek_vlan_add()
485 struct hellcreek *hellcreek = ds->priv; in hellcreek_vlan_del() local
487 dev_dbg(hellcreek->dev, "Remove VLAN %d on port %d\n", vlan->vid, port); in hellcreek_vlan_del()
489 hellcreek_unapply_vlan(hellcreek, port, vlan->vid); in hellcreek_vlan_del()
497 struct hellcreek *hellcreek = ds->priv; in hellcreek_port_stp_state_set() local
502 mutex_lock(&hellcreek->reg_lock); in hellcreek_port_stp_state_set()
504 hellcreek_port = &hellcreek->ports[port]; in hellcreek_port_stp_state_set()
537 hellcreek_select_port(hellcreek, port); in hellcreek_port_stp_state_set()
538 hellcreek_write(hellcreek, val, HR_PTCFG); in hellcreek_port_stp_state_set()
541 mutex_unlock(&hellcreek->reg_lock); in hellcreek_port_stp_state_set()
543 dev_dbg(hellcreek->dev, "Configured STP state for port %d: %s\n", in hellcreek_port_stp_state_set()
547 static void hellcreek_setup_ingressflt(struct hellcreek *hellcreek, int port, in hellcreek_setup_ingressflt() argument
550 struct hellcreek_port *hellcreek_port = &hellcreek->ports[port]; in hellcreek_setup_ingressflt()
553 mutex_lock(&hellcreek->reg_lock); in hellcreek_setup_ingressflt()
562 hellcreek_select_port(hellcreek, port); in hellcreek_setup_ingressflt()
563 hellcreek_write(hellcreek, ptcfg, HR_PTCFG); in hellcreek_setup_ingressflt()
566 mutex_unlock(&hellcreek->reg_lock); in hellcreek_setup_ingressflt()
569 static void hellcreek_setup_vlan_awareness(struct hellcreek *hellcreek, in hellcreek_setup_vlan_awareness() argument
574 mutex_lock(&hellcreek->reg_lock); in hellcreek_setup_vlan_awareness()
576 swcfg = hellcreek->swcfg; in hellcreek_setup_vlan_awareness()
583 hellcreek_write(hellcreek, swcfg, HR_SWCFG); in hellcreek_setup_vlan_awareness()
585 mutex_unlock(&hellcreek->reg_lock); in hellcreek_setup_vlan_awareness()
594 struct hellcreek *hellcreek = ds->priv; in hellcreek_setup_vlan_membership() local
598 hellcreek_apply_vlan(hellcreek, port, vid, true, true); in hellcreek_setup_vlan_membership()
600 hellcreek_unapply_vlan(hellcreek, port, vid); in hellcreek_setup_vlan_membership()
604 hellcreek_apply_vlan(hellcreek, upstream, vid, false, true); in hellcreek_setup_vlan_membership()
606 hellcreek_unapply_vlan(hellcreek, upstream, vid); in hellcreek_setup_vlan_membership()
609 static void hellcreek_port_set_ucast_flood(struct hellcreek *hellcreek, in hellcreek_port_set_ucast_flood() argument
615 hellcreek_port = &hellcreek->ports[port]; in hellcreek_port_set_ucast_flood()
617 dev_dbg(hellcreek->dev, "%s unicast flooding on port %d\n", in hellcreek_port_set_ucast_flood()
620 mutex_lock(&hellcreek->reg_lock); in hellcreek_port_set_ucast_flood()
622 hellcreek_select_port(hellcreek, port); in hellcreek_port_set_ucast_flood()
628 hellcreek_write(hellcreek, val, HR_PTCFG); in hellcreek_port_set_ucast_flood()
631 mutex_unlock(&hellcreek->reg_lock); in hellcreek_port_set_ucast_flood()
634 static void hellcreek_port_set_mcast_flood(struct hellcreek *hellcreek, in hellcreek_port_set_mcast_flood() argument
640 hellcreek_port = &hellcreek->ports[port]; in hellcreek_port_set_mcast_flood()
642 dev_dbg(hellcreek->dev, "%s multicast flooding on port %d\n", in hellcreek_port_set_mcast_flood()
645 mutex_lock(&hellcreek->reg_lock); in hellcreek_port_set_mcast_flood()
647 hellcreek_select_port(hellcreek, port); in hellcreek_port_set_mcast_flood()
653 hellcreek_write(hellcreek, val, HR_PTCFG); in hellcreek_port_set_mcast_flood()
656 mutex_unlock(&hellcreek->reg_lock); in hellcreek_port_set_mcast_flood()
673 struct hellcreek *hellcreek = ds->priv; in hellcreek_bridge_flags() local
676 hellcreek_port_set_ucast_flood(hellcreek, port, in hellcreek_bridge_flags()
680 hellcreek_port_set_mcast_flood(hellcreek, port, in hellcreek_bridge_flags()
691 struct hellcreek *hellcreek = ds->priv; in hellcreek_port_bridge_join() local
693 dev_dbg(hellcreek->dev, "Port %d joins a bridge\n", port); in hellcreek_port_bridge_join()
697 hellcreek_setup_vlan_awareness(hellcreek, false); in hellcreek_port_bridge_join()
708 struct hellcreek *hellcreek = ds->priv; in hellcreek_port_bridge_leave() local
710 dev_dbg(hellcreek->dev, "Port %d leaves a bridge\n", port); in hellcreek_port_bridge_leave()
713 hellcreek_setup_vlan_awareness(hellcreek, true); in hellcreek_port_bridge_leave()
719 static int __hellcreek_fdb_add(struct hellcreek *hellcreek, in __hellcreek_fdb_add() argument
724 dev_dbg(hellcreek->dev, "Add static FDB entry: MAC=%pM, MASK=0x%02x, " in __hellcreek_fdb_add()
730 hellcreek_write(hellcreek, entry->mac[1] | (entry->mac[0] << 8), HR_FDBWDH); in __hellcreek_fdb_add()
731 hellcreek_write(hellcreek, entry->mac[3] | (entry->mac[2] << 8), HR_FDBWDM); in __hellcreek_fdb_add()
732 hellcreek_write(hellcreek, entry->mac[5] | (entry->mac[4] << 8), HR_FDBWDL); in __hellcreek_fdb_add()
744 hellcreek_write(hellcreek, meta, HR_FDBWRM0); in __hellcreek_fdb_add()
747 hellcreek_write(hellcreek, 0x00, HR_FDBWRCMD); in __hellcreek_fdb_add()
750 return hellcreek_wait_fdb_ready(hellcreek); in __hellcreek_fdb_add()
753 static int __hellcreek_fdb_del(struct hellcreek *hellcreek, in __hellcreek_fdb_del() argument
756 dev_dbg(hellcreek->dev, "Delete FDB entry: MAC=%pM!\n", entry->mac); in __hellcreek_fdb_del()
759 hellcreek_write(hellcreek, entry->idx | HR_FDBWRCMD_FDBDEL, HR_FDBWRCMD); in __hellcreek_fdb_del()
762 return hellcreek_wait_fdb_ready(hellcreek); in __hellcreek_fdb_del()
765 static void hellcreek_populate_fdb_entry(struct hellcreek *hellcreek, in hellcreek_populate_fdb_entry() argument
773 meta = hellcreek_read(hellcreek, HR_FDBMDRD); in hellcreek_populate_fdb_entry()
774 mac = hellcreek_read(hellcreek, HR_FDBRDL); in hellcreek_populate_fdb_entry()
777 mac = hellcreek_read(hellcreek, HR_FDBRDM); in hellcreek_populate_fdb_entry()
780 mac = hellcreek_read(hellcreek, HR_FDBRDH); in hellcreek_populate_fdb_entry()
803 static int hellcreek_fdb_get(struct hellcreek *hellcreek, in hellcreek_fdb_get() argument
813 hellcreek_read(hellcreek, HR_FDBMAX); in hellcreek_fdb_get()
814 hellcreek_write(hellcreek, 0x00, HR_FDBMAX); in hellcreek_fdb_get()
819 for (i = 0; i < hellcreek->fdb_entries; ++i) { in hellcreek_fdb_get()
823 hellcreek_populate_fdb_entry(hellcreek, &tmp, i); in hellcreek_fdb_get()
826 hellcreek_write(hellcreek, 0x00, HR_FDBRDH); in hellcreek_fdb_get()
845 struct hellcreek *hellcreek = ds->priv; in hellcreek_fdb_add() local
848 dev_dbg(hellcreek->dev, "Add FDB entry for MAC=%pM\n", addr); in hellcreek_fdb_add()
850 mutex_lock(&hellcreek->reg_lock); in hellcreek_fdb_add()
852 ret = hellcreek_fdb_get(hellcreek, addr, &entry); in hellcreek_fdb_add()
858 ret = __hellcreek_fdb_add(hellcreek, &entry); in hellcreek_fdb_add()
860 dev_err(hellcreek->dev, "Failed to add FDB entry!\n"); in hellcreek_fdb_add()
865 ret = __hellcreek_fdb_del(hellcreek, &entry); in hellcreek_fdb_add()
867 dev_err(hellcreek->dev, "Failed to delete FDB entry!\n"); in hellcreek_fdb_add()
873 ret = __hellcreek_fdb_add(hellcreek, &entry); in hellcreek_fdb_add()
875 dev_err(hellcreek->dev, "Failed to add FDB entry!\n"); in hellcreek_fdb_add()
881 mutex_unlock(&hellcreek->reg_lock); in hellcreek_fdb_add()
891 struct hellcreek *hellcreek = ds->priv; in hellcreek_fdb_del() local
894 dev_dbg(hellcreek->dev, "Delete FDB entry for MAC=%pM\n", addr); in hellcreek_fdb_del()
896 mutex_lock(&hellcreek->reg_lock); in hellcreek_fdb_del()
898 ret = hellcreek_fdb_get(hellcreek, addr, &entry); in hellcreek_fdb_del()
901 dev_err(hellcreek->dev, "FDB entry for deletion not found!\n"); in hellcreek_fdb_del()
904 ret = __hellcreek_fdb_del(hellcreek, &entry); in hellcreek_fdb_del()
906 dev_err(hellcreek->dev, "Failed to delete FDB entry!\n"); in hellcreek_fdb_del()
913 ret = __hellcreek_fdb_add(hellcreek, &entry); in hellcreek_fdb_del()
915 dev_err(hellcreek->dev, "Failed to add FDB entry!\n"); in hellcreek_fdb_del()
922 mutex_unlock(&hellcreek->reg_lock); in hellcreek_fdb_del()
930 struct hellcreek *hellcreek = ds->priv; in hellcreek_fdb_dump() local
935 mutex_lock(&hellcreek->reg_lock); in hellcreek_fdb_dump()
941 entries = hellcreek_read(hellcreek, HR_FDBMAX); in hellcreek_fdb_dump()
942 hellcreek_write(hellcreek, 0x00, HR_FDBMAX); in hellcreek_fdb_dump()
944 dev_dbg(hellcreek->dev, "FDB dump for port %d, entries=%d!\n", port, entries); in hellcreek_fdb_dump()
947 for (i = 0; i < hellcreek->fdb_entries; ++i) { in hellcreek_fdb_dump()
951 hellcreek_populate_fdb_entry(hellcreek, &entry, i); in hellcreek_fdb_dump()
954 hellcreek_write(hellcreek, 0x00, HR_FDBRDH); in hellcreek_fdb_dump()
969 mutex_unlock(&hellcreek->reg_lock); in hellcreek_fdb_dump()
978 struct hellcreek *hellcreek = ds->priv; in hellcreek_vlan_filtering() local
980 dev_dbg(hellcreek->dev, "%s VLAN filtering on port %d\n", in hellcreek_vlan_filtering()
984 hellcreek_setup_ingressflt(hellcreek, port, vlan_filtering); in hellcreek_vlan_filtering()
989 hellcreek_setup_vlan_awareness(hellcreek, vlan_filtering); in hellcreek_vlan_filtering()
994 static int hellcreek_enable_ip_core(struct hellcreek *hellcreek) in hellcreek_enable_ip_core() argument
999 mutex_lock(&hellcreek->reg_lock); in hellcreek_enable_ip_core()
1001 val = hellcreek_read(hellcreek, HR_CTRL_C); in hellcreek_enable_ip_core()
1003 hellcreek_write(hellcreek, val, HR_CTRL_C); in hellcreek_enable_ip_core()
1004 ret = hellcreek_wait_until_transitioned(hellcreek); in hellcreek_enable_ip_core()
1006 mutex_unlock(&hellcreek->reg_lock); in hellcreek_enable_ip_core()
1011 static void hellcreek_setup_cpu_and_tunnel_port(struct hellcreek *hellcreek) in hellcreek_setup_cpu_and_tunnel_port() argument
1013 struct hellcreek_port *tunnel_port = &hellcreek->ports[TUNNEL_PORT]; in hellcreek_setup_cpu_and_tunnel_port()
1014 struct hellcreek_port *cpu_port = &hellcreek->ports[CPU_PORT]; in hellcreek_setup_cpu_and_tunnel_port()
1019 mutex_lock(&hellcreek->reg_lock); in hellcreek_setup_cpu_and_tunnel_port()
1021 hellcreek_select_port(hellcreek, CPU_PORT); in hellcreek_setup_cpu_and_tunnel_port()
1022 hellcreek_write(hellcreek, ptcfg, HR_PTCFG); in hellcreek_setup_cpu_and_tunnel_port()
1024 hellcreek_select_port(hellcreek, TUNNEL_PORT); in hellcreek_setup_cpu_and_tunnel_port()
1025 hellcreek_write(hellcreek, ptcfg, HR_PTCFG); in hellcreek_setup_cpu_and_tunnel_port()
1030 mutex_unlock(&hellcreek->reg_lock); in hellcreek_setup_cpu_and_tunnel_port()
1033 static void hellcreek_setup_tc_identity_mapping(struct hellcreek *hellcreek) in hellcreek_setup_tc_identity_mapping() argument
1056 mutex_lock(&hellcreek->reg_lock); in hellcreek_setup_tc_identity_mapping()
1058 hellcreek_select_prio(hellcreek, i); in hellcreek_setup_tc_identity_mapping()
1059 hellcreek_write(hellcreek, in hellcreek_setup_tc_identity_mapping()
1063 mutex_unlock(&hellcreek->reg_lock); in hellcreek_setup_tc_identity_mapping()
1067 static int hellcreek_setup_fdb(struct hellcreek *hellcreek) in hellcreek_setup_fdb() argument
1148 mutex_lock(&hellcreek->reg_lock); in hellcreek_setup_fdb()
1149 ret = __hellcreek_fdb_add(hellcreek, &l2_ptp); in hellcreek_setup_fdb()
1152 ret = __hellcreek_fdb_add(hellcreek, &udp4_ptp); in hellcreek_setup_fdb()
1155 ret = __hellcreek_fdb_add(hellcreek, &udp6_ptp); in hellcreek_setup_fdb()
1158 ret = __hellcreek_fdb_add(hellcreek, &l2_p2p); in hellcreek_setup_fdb()
1161 ret = __hellcreek_fdb_add(hellcreek, &udp4_p2p); in hellcreek_setup_fdb()
1164 ret = __hellcreek_fdb_add(hellcreek, &udp6_p2p); in hellcreek_setup_fdb()
1167 ret = __hellcreek_fdb_add(hellcreek, &stp); in hellcreek_setup_fdb()
1169 mutex_unlock(&hellcreek->reg_lock); in hellcreek_setup_fdb()
1178 struct hellcreek *hellcreek = ds->priv; in hellcreek_devlink_info_get() local
1187 hellcreek->pdata->name); in hellcreek_devlink_info_get()
1192 struct hellcreek *hellcreek = priv; in hellcreek_devlink_vlan_table_get() local
1196 mutex_lock(&hellcreek->reg_lock); in hellcreek_devlink_vlan_table_get()
1198 if (hellcreek->vidmbrcfg[i]) in hellcreek_devlink_vlan_table_get()
1200 mutex_unlock(&hellcreek->reg_lock); in hellcreek_devlink_vlan_table_get()
1207 struct hellcreek *hellcreek = priv; in hellcreek_devlink_fdb_table_get() local
1213 mutex_lock(&hellcreek->reg_lock); in hellcreek_devlink_fdb_table_get()
1214 count = hellcreek_read(hellcreek, HR_FDBMAX); in hellcreek_devlink_fdb_table_get()
1215 mutex_unlock(&hellcreek->reg_lock); in hellcreek_devlink_fdb_table_get()
1224 struct hellcreek *hellcreek = ds->priv; in hellcreek_setup_devlink_resources() local
1232 hellcreek->fdb_entries, in hellcreek_setup_devlink_resources()
1233 hellcreek->fdb_entries, in hellcreek_setup_devlink_resources()
1243 err = dsa_devlink_resource_register(ds, "FDB", hellcreek->fdb_entries, in hellcreek_setup_devlink_resources()
1253 hellcreek); in hellcreek_setup_devlink_resources()
1258 hellcreek); in hellcreek_setup_devlink_resources()
1275 struct hellcreek *hellcreek = ds->priv; in hellcreek_devlink_region_vlan_snapshot() local
1284 mutex_lock(&hellcreek->reg_lock); in hellcreek_devlink_region_vlan_snapshot()
1286 entry->member = hellcreek->vidmbrcfg[i]; in hellcreek_devlink_region_vlan_snapshot()
1289 mutex_unlock(&hellcreek->reg_lock); in hellcreek_devlink_region_vlan_snapshot()
1303 struct hellcreek *hellcreek = ds->priv; in hellcreek_devlink_region_fdb_snapshot() local
1306 table = kcalloc(hellcreek->fdb_entries, sizeof(*entry), GFP_KERNEL); in hellcreek_devlink_region_fdb_snapshot()
1312 mutex_lock(&hellcreek->reg_lock); in hellcreek_devlink_region_fdb_snapshot()
1315 hellcreek_read(hellcreek, HR_FDBMAX); in hellcreek_devlink_region_fdb_snapshot()
1316 hellcreek_write(hellcreek, 0x00, HR_FDBMAX); in hellcreek_devlink_region_fdb_snapshot()
1318 for (i = 0; i < hellcreek->fdb_entries; ++i, ++entry) { in hellcreek_devlink_region_fdb_snapshot()
1320 hellcreek_populate_fdb_entry(hellcreek, entry, i); in hellcreek_devlink_region_fdb_snapshot()
1323 hellcreek_write(hellcreek, 0x00, HR_FDBRDH); in hellcreek_devlink_region_fdb_snapshot()
1326 mutex_unlock(&hellcreek->reg_lock); in hellcreek_devlink_region_fdb_snapshot()
1347 struct hellcreek *hellcreek = ds->priv; in hellcreek_setup_devlink_regions() local
1361 hellcreek->vlan_region = region; in hellcreek_setup_devlink_regions()
1364 size = hellcreek->fdb_entries * sizeof(struct hellcreek_fdb_entry); in hellcreek_setup_devlink_regions()
1373 hellcreek->fdb_region = region; in hellcreek_setup_devlink_regions()
1378 dsa_devlink_region_destroy(hellcreek->vlan_region); in hellcreek_setup_devlink_regions()
1385 struct hellcreek *hellcreek = ds->priv; in hellcreek_teardown_devlink_regions() local
1387 dsa_devlink_region_destroy(hellcreek->fdb_region); in hellcreek_teardown_devlink_regions()
1388 dsa_devlink_region_destroy(hellcreek->vlan_region); in hellcreek_teardown_devlink_regions()
1393 struct hellcreek *hellcreek = ds->priv; in hellcreek_setup() local
1397 dev_dbg(hellcreek->dev, "Set up the switch\n"); in hellcreek_setup()
1400 ret = hellcreek_enable_ip_core(hellcreek); in hellcreek_setup()
1402 dev_err(hellcreek->dev, "Failed to enable IP core!\n"); in hellcreek_setup()
1407 hellcreek_setup_cpu_and_tunnel_port(hellcreek); in hellcreek_setup()
1417 hellcreek->swcfg = swcfg; in hellcreek_setup()
1418 hellcreek_write(hellcreek, swcfg, HR_SWCFG); in hellcreek_setup()
1429 hellcreek_setup_tc_identity_mapping(hellcreek); in hellcreek_setup()
1438 ret = hellcreek_setup_fdb(hellcreek); in hellcreek_setup()
1440 dev_err(hellcreek->dev, in hellcreek_setup()
1448 dev_err(hellcreek->dev, in hellcreek_setup()
1455 dev_err(hellcreek->dev, in hellcreek_setup()
1477 struct hellcreek *hellcreek = ds->priv; in hellcreek_phylink_get_caps() local
1493 if (hellcreek->pdata->is_100_mbits) in hellcreek_phylink_get_caps()
1503 struct hellcreek *hellcreek = ds->priv; in hellcreek_port_prechangeupper() local
1509 dev_dbg(hellcreek->dev, "Pre change upper for port %d\n", port); in hellcreek_port_prechangeupper()
1525 mutex_lock(&hellcreek->vlan_lock); in hellcreek_port_prechangeupper()
1526 for (i = 0; i < hellcreek->pdata->num_ports; ++i) { in hellcreek_port_prechangeupper()
1533 used = used && test_bit(vid, hellcreek->ports[i].vlan_dev_bitmap); in hellcreek_port_prechangeupper()
1540 set_bit(vid, hellcreek->ports[port].vlan_dev_bitmap); in hellcreek_port_prechangeupper()
1545 mutex_unlock(&hellcreek->vlan_lock); in hellcreek_port_prechangeupper()
1550 static void hellcreek_setup_maxsdu(struct hellcreek *hellcreek, int port, in hellcreek_setup_maxsdu() argument
1562 dev_dbg(hellcreek->dev, "Configure max-sdu %u for tc %d on port %d\n", in hellcreek_setup_maxsdu()
1565 hellcreek_select_port_prio(hellcreek, port, tc); in hellcreek_setup_maxsdu()
1569 hellcreek_write(hellcreek, val, HR_PTPRTCCFG); in hellcreek_setup_maxsdu()
1573 static void hellcreek_reset_maxsdu(struct hellcreek *hellcreek, int port) in hellcreek_reset_maxsdu() argument
1580 hellcreek_select_port_prio(hellcreek, port, tc); in hellcreek_reset_maxsdu()
1585 hellcreek_write(hellcreek, val, HR_PTPRTCCFG); in hellcreek_reset_maxsdu()
1589 static void hellcreek_setup_gcl(struct hellcreek *hellcreek, int port, in hellcreek_setup_gcl() argument
1615 hellcreek_write(hellcreek, data, TR_GCLDAT); in hellcreek_setup_gcl()
1618 hellcreek_write(hellcreek, in hellcreek_setup_gcl()
1621 hellcreek_write(hellcreek, in hellcreek_setup_gcl()
1629 hellcreek_write(hellcreek, data, TR_GCLCMD); in hellcreek_setup_gcl()
1636 static void hellcreek_set_cycle_time(struct hellcreek *hellcreek, in hellcreek_set_cycle_time() argument
1641 hellcreek_write(hellcreek, cycle_time & 0x0000ffff, TR_CTWRL); in hellcreek_set_cycle_time()
1642 hellcreek_write(hellcreek, (cycle_time & 0xffff0000) >> 16, TR_CTWRH); in hellcreek_set_cycle_time()
1645 static void hellcreek_switch_schedule(struct hellcreek *hellcreek, in hellcreek_switch_schedule() argument
1651 hellcreek_write(hellcreek, ts.tv_nsec & 0x0000ffff, TR_ESTWRL); in hellcreek_switch_schedule()
1652 hellcreek_write(hellcreek, (ts.tv_nsec & 0xffff0000) >> 16, TR_ESTWRH); in hellcreek_switch_schedule()
1655 hellcreek_write(hellcreek, TR_ESTCMD_ESTARM | TR_ESTCMD_ESTSWCFG | in hellcreek_switch_schedule()
1660 static bool hellcreek_schedule_startable(struct hellcreek *hellcreek, int port) in hellcreek_schedule_startable() argument
1662 struct hellcreek_port *hellcreek_port = &hellcreek->ports[port]; in hellcreek_schedule_startable()
1673 mutex_lock(&hellcreek->ptp_lock); in hellcreek_schedule_startable()
1674 current_ns = hellcreek->seconds * NSEC_PER_SEC + hellcreek->last_ts; in hellcreek_schedule_startable()
1675 mutex_unlock(&hellcreek->ptp_lock); in hellcreek_schedule_startable()
1683 static void hellcreek_start_schedule(struct hellcreek *hellcreek, int port) in hellcreek_start_schedule() argument
1685 struct hellcreek_port *hellcreek_port = &hellcreek->ports[port]; in hellcreek_start_schedule()
1691 hellcreek_select_tgd(hellcreek, port); in hellcreek_start_schedule()
1694 mutex_lock(&hellcreek->ptp_lock); in hellcreek_start_schedule()
1695 current_ns = hellcreek->seconds * NSEC_PER_SEC + hellcreek->last_ts; in hellcreek_start_schedule()
1696 mutex_unlock(&hellcreek->ptp_lock); in hellcreek_start_schedule()
1711 hellcreek_switch_schedule(hellcreek, base_time); in hellcreek_start_schedule()
1716 dev_dbg(hellcreek->dev, "Armed EST timer for port %d\n", in hellcreek_start_schedule()
1724 struct hellcreek *hellcreek; in hellcreek_check_schedule() local
1728 hellcreek = hellcreek_port->hellcreek; in hellcreek_check_schedule()
1730 mutex_lock(&hellcreek->reg_lock); in hellcreek_check_schedule()
1733 startable = hellcreek_schedule_startable(hellcreek, in hellcreek_check_schedule()
1736 hellcreek_start_schedule(hellcreek, hellcreek_port->port); in hellcreek_check_schedule()
1737 mutex_unlock(&hellcreek->reg_lock); in hellcreek_check_schedule()
1741 mutex_unlock(&hellcreek->reg_lock); in hellcreek_check_schedule()
1751 struct hellcreek *hellcreek = ds->priv; in hellcreek_port_set_schedule() local
1756 hellcreek_port = &hellcreek->ports[port]; in hellcreek_port_set_schedule()
1758 dev_dbg(hellcreek->dev, "Configure traffic schedule on port %d\n", in hellcreek_port_set_schedule()
1764 mutex_lock(&hellcreek->reg_lock); in hellcreek_port_set_schedule()
1773 hellcreek_setup_maxsdu(hellcreek, port, hellcreek_port->current_schedule); in hellcreek_port_set_schedule()
1776 hellcreek_select_tgd(hellcreek, port); in hellcreek_port_set_schedule()
1780 hellcreek_write(hellcreek, ctrl, TR_TGDCTRL); in hellcreek_port_set_schedule()
1783 hellcreek_write(hellcreek, 0x00, TR_ESTCMD); in hellcreek_port_set_schedule()
1786 hellcreek_setup_gcl(hellcreek, port, hellcreek_port->current_schedule); in hellcreek_port_set_schedule()
1789 hellcreek_set_cycle_time(hellcreek, hellcreek_port->current_schedule); in hellcreek_port_set_schedule()
1792 startable = hellcreek_schedule_startable(hellcreek, port); in hellcreek_port_set_schedule()
1794 hellcreek_start_schedule(hellcreek, port); in hellcreek_port_set_schedule()
1795 mutex_unlock(&hellcreek->reg_lock); in hellcreek_port_set_schedule()
1799 mutex_unlock(&hellcreek->reg_lock); in hellcreek_port_set_schedule()
1810 struct hellcreek *hellcreek = ds->priv; in hellcreek_port_del_schedule() local
1813 hellcreek_port = &hellcreek->ports[port]; in hellcreek_port_del_schedule()
1815 dev_dbg(hellcreek->dev, "Remove traffic schedule on port %d\n", port); in hellcreek_port_del_schedule()
1820 mutex_lock(&hellcreek->reg_lock); in hellcreek_port_del_schedule()
1828 hellcreek_reset_maxsdu(hellcreek, port); in hellcreek_port_del_schedule()
1831 hellcreek_select_tgd(hellcreek, port); in hellcreek_port_del_schedule()
1834 hellcreek_write(hellcreek, 0xff << TR_TGDCTRL_ADMINGATESTATES_SHIFT, in hellcreek_port_del_schedule()
1837 mutex_unlock(&hellcreek->reg_lock); in hellcreek_port_del_schedule()
1842 static bool hellcreek_validate_schedule(struct hellcreek *hellcreek, in hellcreek_validate_schedule() argument
1848 if (!hellcreek->pdata->qbv_support) in hellcreek_validate_schedule()
1885 struct hellcreek *hellcreek = ds->priv; in hellcreek_port_setup_tc() local
1893 if (!hellcreek_validate_schedule(hellcreek, taprio)) in hellcreek_port_setup_tc()
1940 struct hellcreek *hellcreek; in hellcreek_probe() local
1944 hellcreek = devm_kzalloc(dev, sizeof(*hellcreek), GFP_KERNEL); in hellcreek_probe()
1945 if (!hellcreek) in hellcreek_probe()
1948 hellcreek->vidmbrcfg = devm_kcalloc(dev, VLAN_N_VID, in hellcreek_probe()
1949 sizeof(*hellcreek->vidmbrcfg), in hellcreek_probe()
1951 if (!hellcreek->vidmbrcfg) in hellcreek_probe()
1954 hellcreek->pdata = of_device_get_match_data(dev); in hellcreek_probe()
1956 hellcreek->ports = devm_kcalloc(dev, hellcreek->pdata->num_ports, in hellcreek_probe()
1957 sizeof(*hellcreek->ports), in hellcreek_probe()
1959 if (!hellcreek->ports) in hellcreek_probe()
1962 for (i = 0; i < hellcreek->pdata->num_ports; ++i) { in hellcreek_probe()
1963 struct hellcreek_port *port = &hellcreek->ports[i]; in hellcreek_probe()
1978 port->hellcreek = hellcreek; in hellcreek_probe()
1985 mutex_init(&hellcreek->reg_lock); in hellcreek_probe()
1986 mutex_init(&hellcreek->vlan_lock); in hellcreek_probe()
1987 mutex_init(&hellcreek->ptp_lock); in hellcreek_probe()
1989 hellcreek->dev = dev; in hellcreek_probe()
1997 hellcreek->base = devm_ioremap_resource(dev, res); in hellcreek_probe()
1998 if (IS_ERR(hellcreek->base)) in hellcreek_probe()
1999 return PTR_ERR(hellcreek->base); in hellcreek_probe()
2007 hellcreek->ptp_base = devm_ioremap_resource(dev, res); in hellcreek_probe()
2008 if (IS_ERR(hellcreek->ptp_base)) in hellcreek_probe()
2009 return PTR_ERR(hellcreek->ptp_base); in hellcreek_probe()
2011 ret = hellcreek_detect(hellcreek); in hellcreek_probe()
2017 ret = hellcreek_wait_until_ready(hellcreek); in hellcreek_probe()
2023 hellcreek_feature_detect(hellcreek); in hellcreek_probe()
2025 hellcreek->ds = devm_kzalloc(dev, sizeof(*hellcreek->ds), GFP_KERNEL); in hellcreek_probe()
2026 if (!hellcreek->ds) in hellcreek_probe()
2029 hellcreek->ds->dev = dev; in hellcreek_probe()
2030 hellcreek->ds->priv = hellcreek; in hellcreek_probe()
2031 hellcreek->ds->ops = &hellcreek_ds_ops; in hellcreek_probe()
2032 hellcreek->ds->num_ports = hellcreek->pdata->num_ports; in hellcreek_probe()
2033 hellcreek->ds->num_tx_queues = HELLCREEK_NUM_EGRESS_QUEUES; in hellcreek_probe()
2035 ret = dsa_register_switch(hellcreek->ds); in hellcreek_probe()
2041 ret = hellcreek_ptp_setup(hellcreek); in hellcreek_probe()
2047 ret = hellcreek_hwtstamp_setup(hellcreek); in hellcreek_probe()
2053 platform_set_drvdata(pdev, hellcreek); in hellcreek_probe()
2058 hellcreek_ptp_free(hellcreek); in hellcreek_probe()
2060 dsa_unregister_switch(hellcreek->ds); in hellcreek_probe()
2067 struct hellcreek *hellcreek = platform_get_drvdata(pdev); in hellcreek_remove() local
2069 if (!hellcreek) in hellcreek_remove()
2072 hellcreek_hwtstamp_free(hellcreek); in hellcreek_remove()
2073 hellcreek_ptp_free(hellcreek); in hellcreek_remove()
2074 dsa_unregister_switch(hellcreek->ds); in hellcreek_remove()
2081 struct hellcreek *hellcreek = platform_get_drvdata(pdev); in hellcreek_shutdown() local
2083 if (!hellcreek) in hellcreek_shutdown()
2086 dsa_switch_shutdown(hellcreek->ds); in hellcreek_shutdown()