/linux-4.4.14/drivers/isdn/capi/ |
H A D | capilib.c | 31 static inline void mq_init(struct capilib_ncci *np) mq_init() argument 34 np->msgidqueue = NULL; mq_init() 35 np->msgidlast = NULL; mq_init() 36 np->nmsg = 0; mq_init() 37 memset(np->msgidpool, 0, sizeof(np->msgidpool)); mq_init() 38 np->msgidfree = &np->msgidpool[0]; mq_init() 39 for (i = 1; i < np->winsize; i++) { mq_init() 40 np->msgidpool[i].next = np->msgidfree; mq_init() 41 np->msgidfree = &np->msgidpool[i]; mq_init() 45 static inline int mq_enqueue(struct capilib_ncci *np, u16 msgid) mq_enqueue() argument 48 if ((mq = np->msgidfree) == NULL) mq_enqueue() 50 np->msgidfree = mq->next; mq_enqueue() 53 if (np->msgidlast) mq_enqueue() 54 np->msgidlast->next = mq; mq_enqueue() 55 np->msgidlast = mq; mq_enqueue() 56 if (!np->msgidqueue) mq_enqueue() 57 np->msgidqueue = mq; mq_enqueue() 58 np->nmsg++; mq_enqueue() 62 static inline int mq_dequeue(struct capilib_ncci *np, u16 msgid) mq_dequeue() argument 65 for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) { mq_dequeue() 69 if (mq == np->msgidlast) mq_dequeue() 70 np->msgidlast = NULL; mq_dequeue() 71 mq->next = np->msgidfree; mq_dequeue() 72 np->msgidfree = mq; mq_dequeue() 73 np->nmsg--; mq_dequeue() 82 struct capilib_ncci *np; capilib_new_ncci() local 84 np = kmalloc(sizeof(*np), GFP_ATOMIC); capilib_new_ncci() 85 if (!np) { capilib_new_ncci() 94 np->applid = applid; capilib_new_ncci() 95 np->ncci = ncci; capilib_new_ncci() 96 np->winsize = winsize; capilib_new_ncci() 97 mq_init(np); capilib_new_ncci() 98 list_add_tail(&np->list, head); capilib_new_ncci() 107 struct capilib_ncci *np; capilib_free_ncci() local 110 np = list_entry(l, struct capilib_ncci, list); list_for_each() 111 if (np->applid != applid) list_for_each() 113 if (np->ncci != ncci) list_for_each() 116 list_del(&np->list); list_for_each() 117 kfree(np); list_for_each() 128 struct capilib_ncci *np; capilib_release_appl() local 131 np = list_entry(l, struct capilib_ncci, list); list_for_each_safe() 132 if (np->applid != applid) list_for_each_safe() 134 printk(KERN_INFO "kcapi: appl %d ncci 0x%x forced down\n", applid, np->ncci); list_for_each_safe() 135 list_del(&np->list); list_for_each_safe() 136 kfree(np); list_for_each_safe() 145 struct capilib_ncci *np; capilib_release() local 148 np = list_entry(l, struct capilib_ncci, list); list_for_each_safe() 149 printk(KERN_INFO "kcapi: appl %d ncci 0x%x forced down\n", np->applid, np->ncci); list_for_each_safe() 150 list_del(&np->list); list_for_each_safe() 151 kfree(np); list_for_each_safe() 160 struct capilib_ncci *np; capilib_data_b3_req() local 163 np = list_entry(l, struct capilib_ncci, list); list_for_each() 164 if (np->applid != applid) list_for_each() 166 if (np->ncci != ncci) list_for_each() 169 if (mq_enqueue(np, msgid) == 0) list_for_each() 183 struct capilib_ncci *np; capilib_data_b3_conf() local 186 np = list_entry(l, struct capilib_ncci, list); list_for_each() 187 if (np->applid != applid) list_for_each() 189 if (np->ncci != ncci) list_for_each() 192 if (mq_dequeue(np, msgid) == 0) { list_for_each()
|
/linux-4.4.14/include/linux/ |
H A D | of_mtd.h | 15 int of_get_nand_ecc_mode(struct device_node *np); 16 int of_get_nand_ecc_step_size(struct device_node *np); 17 int of_get_nand_ecc_strength(struct device_node *np); 18 int of_get_nand_bus_width(struct device_node *np); 19 bool of_get_nand_on_flash_bbt(struct device_node *np); 23 static inline int of_get_nand_ecc_mode(struct device_node *np) of_get_nand_ecc_mode() argument 28 static inline int of_get_nand_ecc_step_size(struct device_node *np) of_get_nand_ecc_step_size() argument 33 static inline int of_get_nand_ecc_strength(struct device_node *np) of_get_nand_ecc_strength() argument 38 static inline int of_get_nand_bus_width(struct device_node *np) of_get_nand_bus_width() argument 43 static inline bool of_get_nand_on_flash_bbt(struct device_node *np) of_get_nand_on_flash_bbt() argument
|
H A D | of_net.h | 14 extern int of_get_phy_mode(struct device_node *np); 15 extern const void *of_get_mac_address(struct device_node *np); 16 extern struct net_device *of_find_net_device_by_node(struct device_node *np); 18 static inline int of_get_phy_mode(struct device_node *np) of_get_phy_mode() argument 23 static inline const void *of_get_mac_address(struct device_node *np) of_get_mac_address() argument 28 static inline struct net_device *of_find_net_device_by_node(struct device_node *np) of_find_net_device_by_node() argument
|
H A D | netpoll.h | 57 void netpoll_send_udp(struct netpoll *np, const char *msg, int len); netpoll_poll_enable() 58 void netpoll_print_options(struct netpoll *np); netpoll_poll_enable() 59 int netpoll_parse_options(struct netpoll *np, char *opt); netpoll_poll_enable() 60 int __netpoll_setup(struct netpoll *np, struct net_device *ndev); netpoll_poll_enable() 61 int netpoll_setup(struct netpoll *np); netpoll_poll_enable() 62 void __netpoll_cleanup(struct netpoll *np); netpoll_poll_enable() 63 void __netpoll_free_async(struct netpoll *np); netpoll_poll_enable() 64 void netpoll_cleanup(struct netpoll *np); netpoll_poll_enable() 65 void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, netpoll_poll_enable() 67 static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) netpoll_send_skb() argument 71 netpoll_send_skb_on_dev(np, skb, np->dev); netpoll_send_skb()
|
H A D | of_dma.h | 38 extern int of_dma_controller_register(struct device_node *np, 42 extern void of_dma_controller_free(struct device_node *np); 44 extern int of_dma_router_register(struct device_node *np, 50 extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np, 58 static inline int of_dma_controller_register(struct device_node *np, of_dma_controller_register() argument 66 static inline void of_dma_controller_free(struct device_node *np) of_dma_controller_free() argument 70 static inline int of_dma_router_register(struct device_node *np, of_dma_router_register() argument 80 static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np, of_dma_request_slave_channel() argument
|
H A D | of_mdio.h | 16 extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); 27 extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np); 30 static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) of_mdiobus_register() argument 66 const struct device_node *np) of_mdio_parse_addr() 73 extern int of_phy_register_fixed_link(struct device_node *np); 74 extern bool of_phy_is_fixed_link(struct device_node *np); 76 static inline int of_phy_register_fixed_link(struct device_node *np) of_phy_register_fixed_link() argument 80 static inline bool of_phy_is_fixed_link(struct device_node *np) of_phy_is_fixed_link() argument 65 of_mdio_parse_addr(struct device *dev, const struct device_node *np) of_mdio_parse_addr() argument
|
H A D | of_gpio.h | 51 extern int of_get_named_gpio_flags(struct device_node *np, 54 extern int of_mm_gpiochip_add(struct device_node *np, 67 static inline int of_get_named_gpio_flags(struct device_node *np, of_get_named_gpio_flags() argument 87 * @np: device node to count GPIOs for of_gpiochip_remove() 105 static inline int of_gpio_named_count(struct device_node *np, const char* propname) of_gpio_named_count() argument 107 return of_count_phandle_with_args(np, propname, "#gpio-cells"); of_gpio_named_count() 112 * @np: device node to count GPIOs for 116 static inline int of_gpio_count(struct device_node *np) of_gpio_count() argument 118 return of_gpio_named_count(np, "gpios"); of_gpio_count() 121 static inline int of_get_gpio_flags(struct device_node *np, int index, of_get_gpio_flags() argument 124 return of_get_named_gpio_flags(np, "gpios", index, flags); of_get_gpio_flags() 129 * @np: device node to get GPIO from 136 static inline int of_get_named_gpio(struct device_node *np, of_get_named_gpio() argument 139 return of_get_named_gpio_flags(np, propname, index, NULL); of_get_named_gpio() 144 * @np: device node to get GPIO from 150 static inline int of_get_gpio(struct device_node *np, int index) of_get_gpio() argument 152 return of_get_gpio_flags(np, index, NULL); of_get_gpio()
|
H A D | of.h | 73 struct device_node *np; member in struct:of_phandle_args 234 static inline const char *of_node_full_name(const struct device_node *np) of_node_full_name() argument 236 return np ? np->full_name : "<no-node>"; of_node_full_name() 276 extern struct property *of_find_property(const struct device_node *np, 279 extern int of_property_count_elems_of_size(const struct device_node *np, 281 extern int of_property_read_u32_index(const struct device_node *np, 284 extern int of_property_read_u8_array(const struct device_node *np, 286 extern int of_property_read_u16_array(const struct device_node *np, 288 extern int of_property_read_u32_array(const struct device_node *np, 292 extern int of_property_read_u64(const struct device_node *np, 294 extern int of_property_read_u64_array(const struct device_node *np, 299 extern int of_property_read_string(struct device_node *np, 302 extern int of_property_match_string(struct device_node *np, 305 extern int of_property_read_string_helper(struct device_node *np, 319 extern int of_n_addr_cells(struct device_node *np); 320 extern int of_n_size_cells(struct device_node *np); 325 extern struct device_node *of_parse_phandle(const struct device_node *np, 328 extern int of_parse_phandle_with_args(const struct device_node *np, 331 extern int of_parse_phandle_with_fixed_args(const struct device_node *np, 334 extern int of_count_phandle_with_args(const struct device_node *np, 338 extern int of_alias_get_id(struct device_node *np, const char *stem); 343 extern int of_add_property(struct device_node *np, struct property *prop); 344 extern int of_remove_property(struct device_node *np, struct property *prop); 345 extern int of_update_property(struct device_node *np, struct property *newprop); 364 * of_property_for_each_u32(np, "propname", prop, p, u) 373 * of_property_for_each_string(np, "propname", prop, s) 396 static inline const char* of_node_full_name(const struct device_node *np) of_node_full_name() argument 488 static inline struct property *of_find_property(const struct device_node *np, of_find_property() argument 503 static inline int of_property_count_elems_of_size(const struct device_node *np, of_property_count_elems_of_size() argument 509 static inline int of_property_read_u32_index(const struct device_node *np, of_property_read_u32_index() argument 515 static inline int of_property_read_u8_array(const struct device_node *np, of_property_read_u8_array() argument 521 static inline int of_property_read_u16_array(const struct device_node *np, of_property_read_u16_array() argument 527 static inline int of_property_read_u32_array(const struct device_node *np, of_property_read_u32_array() argument 534 static inline int of_property_read_u64_array(const struct device_node *np, of_property_read_u64_array() argument 541 static inline int of_property_read_string(struct device_node *np, of_property_read_string() argument 548 static inline int of_property_read_string_helper(struct device_node *np, of_property_read_string_helper() argument 568 static inline int of_property_read_u64(const struct device_node *np, of_property_read_u64() argument 574 static inline int of_property_match_string(struct device_node *np, of_property_match_string() argument 581 static inline struct device_node *of_parse_phandle(const struct device_node *np, of_parse_phandle() argument 588 static inline int of_parse_phandle_with_args(struct device_node *np, of_parse_phandle_with_args() argument 597 static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, of_parse_phandle_with_fixed_args() argument 604 static inline int of_count_phandle_with_args(struct device_node *np, of_count_phandle_with_args() argument 611 static inline int of_alias_get_id(struct device_node *np, const char *stem) of_alias_get_id() argument 680 extern int of_node_to_nid(struct device_node *np); 698 * @np: device node from which the property value is to be read. 706 static inline int of_property_count_u8_elems(const struct device_node *np, of_property_count_u8_elems() argument 709 return of_property_count_elems_of_size(np, propname, sizeof(u8)); of_property_count_u8_elems() 715 * @np: device node from which the property value is to be read. 723 static inline int of_property_count_u16_elems(const struct device_node *np, of_property_count_u16_elems() argument 726 return of_property_count_elems_of_size(np, propname, sizeof(u16)); of_property_count_u16_elems() 732 * @np: device node from which the property value is to be read. 740 static inline int of_property_count_u32_elems(const struct device_node *np, of_property_count_u32_elems() argument 743 return of_property_count_elems_of_size(np, propname, sizeof(u32)); of_property_count_u32_elems() 749 * @np: device node from which the property value is to be read. 757 static inline int of_property_count_u64_elems(const struct device_node *np, of_property_count_u64_elems() argument 760 return of_property_count_elems_of_size(np, propname, sizeof(u64)); of_property_count_u64_elems() 766 * @np: device node from which the property value is to be read. 776 static inline int of_property_read_string_array(struct device_node *np, of_property_read_string_array() argument 780 return of_property_read_string_helper(np, propname, out_strs, sz, 0); of_property_read_string_array() 786 * @np: device node from which the property value is to be read. 795 static inline int of_property_count_strings(struct device_node *np, of_property_count_strings() argument 798 return of_property_read_string_helper(np, propname, NULL, 0, 0); of_property_count_strings() 804 * @np: device node from which the property value is to be read. 819 static inline int of_property_read_string_index(struct device_node *np, of_property_read_string_index() argument 823 int rc = of_property_read_string_helper(np, propname, output, 1, index); of_property_read_string_index() 829 * @np: device node from which the property value is to be read. 835 static inline bool of_property_read_bool(const struct device_node *np, of_property_read_bool() argument 838 struct property *prop = of_find_property(np, propname, NULL); of_property_read_bool() 843 static inline int of_property_read_u8(const struct device_node *np, of_property_read_u8() argument 847 return of_property_read_u8_array(np, propname, out_value, 1); of_property_read_u8() 850 static inline int of_property_read_u16(const struct device_node *np, of_property_read_u16() argument 854 return of_property_read_u16_array(np, propname, out_value, 1); of_property_read_u16() 857 static inline int of_property_read_u32(const struct device_node *np, of_property_read_u32() argument 861 return of_property_read_u32_array(np, propname, out_value, 1); of_property_read_u32() 864 static inline int of_property_read_s32(const struct device_node *np, of_property_read_s32() argument 868 return of_property_read_u32(np, propname, (u32*) out_value); of_property_read_s32() 871 #define of_property_for_each_u32(np, propname, prop, p, u) \ 872 for (prop = of_find_property(np, propname, NULL), \ 877 #define of_property_for_each_string(np, propname, prop, s) \ 878 for (prop = of_find_property(np, propname, NULL), \ 910 static inline int of_get_child_count(const struct device_node *np) of_get_child_count() argument 915 for_each_child_of_node(np, child) of_get_child_count() 921 static inline int of_get_available_child_count(const struct device_node *np) of_get_available_child_count() argument 926 for_each_available_child_of_node(np, child) of_get_available_child_count() 959 * @np: pointer to the device node affected 971 struct device_node *np; member in struct:of_changeset_entry 1008 unsigned long action, struct device_node *np, 1012 struct device_node *np) of_changeset_attach_node() 1014 return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL); of_changeset_attach_node() 1018 struct device_node *np) of_changeset_detach_node() 1020 return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL); of_changeset_detach_node() 1024 struct device_node *np, struct property *prop) of_changeset_add_property() 1026 return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop); of_changeset_add_property() 1030 struct device_node *np, struct property *prop) of_changeset_remove_property() 1032 return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop); of_changeset_remove_property() 1036 struct device_node *np, struct property *prop) of_changeset_update_property() 1038 return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop); of_changeset_update_property() 1066 * @np: Pointer to the given device_node 1070 static inline bool of_device_is_system_power_controller(const struct device_node *np) of_device_is_system_power_controller() argument 1072 return of_property_read_bool(np, "system-power-controller"); of_device_is_system_power_controller() 1011 of_changeset_attach_node(struct of_changeset *ocs, struct device_node *np) of_changeset_attach_node() argument 1017 of_changeset_detach_node(struct of_changeset *ocs, struct device_node *np) of_changeset_detach_node() argument 1023 of_changeset_add_property(struct of_changeset *ocs, struct device_node *np, struct property *prop) of_changeset_add_property() argument 1029 of_changeset_remove_property(struct of_changeset *ocs, struct device_node *np, struct property *prop) of_changeset_remove_property() argument 1035 of_changeset_update_property(struct of_changeset *ocs, struct device_node *np, struct property *prop) of_changeset_update_property() argument
|
H A D | cpu_cooling.h | 48 * @np: a valid struct device_node to the cooling device device tree node. 53 of_cpufreq_cooling_register(struct device_node *np, 57 of_cpufreq_power_cooling_register(struct device_node *np, 63 of_cpufreq_cooling_register(struct device_node *np, of_cpufreq_cooling_register() argument 70 of_cpufreq_power_cooling_register(struct device_node *np, of_cpufreq_power_cooling_register() argument 100 of_cpufreq_cooling_register(struct device_node *np, of_cpufreq_cooling_register() argument 107 of_cpufreq_power_cooling_register(struct device_node *np, of_cpufreq_power_cooling_register() argument
|
/linux-4.4.14/drivers/net/ethernet/dlink/ |
H A D | dl2k.c | 60 static void dl2k_enable_int(struct netdev_private *np) dl2k_enable_int() argument 62 void __iomem *ioaddr = np->ioaddr; dl2k_enable_int() 117 struct netdev_private *np; rio_probe1() local 142 dev = alloc_etherdev (sizeof (*np)); rio_probe1() 147 np = netdev_priv(dev); rio_probe1() 153 np->eeprom_addr = ioaddr; rio_probe1() 161 np->ioaddr = ioaddr; rio_probe1() 162 np->chip_id = chip_idx; rio_probe1() 163 np->pdev = pdev; rio_probe1() 164 spin_lock_init (&np->tx_lock); rio_probe1() 165 spin_lock_init (&np->rx_lock); rio_probe1() 168 np->an_enable = 1; rio_probe1() 169 np->tx_coalesce = 1; rio_probe1() 172 np->an_enable = 0; rio_probe1() 176 np->an_enable = 2; rio_probe1() 179 np->speed = 100; rio_probe1() 180 np->full_duplex = 1; rio_probe1() 183 np->speed = 100; rio_probe1() 184 np->full_duplex = 0; rio_probe1() 187 np->speed = 10; rio_probe1() 188 np->full_duplex = 1; rio_probe1() 191 np->speed = 10; rio_probe1() 192 np->full_duplex = 0; rio_probe1() 195 np->speed=1000; rio_probe1() 196 np->full_duplex=1; rio_probe1() 199 np->speed = 1000; rio_probe1() 200 np->full_duplex = 0; rio_probe1() 202 np->an_enable = 1; rio_probe1() 206 np->jumbo = 1; rio_probe1() 209 np->jumbo = 0; rio_probe1() 213 np->vlan = (vlan[card_idx] > 0 && vlan[card_idx] < 4096) ? rio_probe1() 216 np->rx_coalesce = rx_coalesce; rio_probe1() 217 np->rx_timeout = rx_timeout; rio_probe1() 218 np->coalesce = 1; rio_probe1() 220 np->tx_flow = (tx_flow == 0) ? 0 : 1; rio_probe1() 221 np->rx_flow = (rx_flow == 0) ? 0 : 1; rio_probe1() 239 np->tx_ring = ring_space; rio_probe1() 240 np->tx_ring_dma = ring_dma; rio_probe1() 245 np->rx_ring = ring_space; rio_probe1() 246 np->rx_ring_dma = ring_dma; rio_probe1() 256 if (np->chip_id == CHIP_IP1000A && rio_probe1() 257 (np->pdev->revision == 0x40 || np->pdev->revision == 0x41)) { rio_probe1() 259 mii_write(dev, np->phy_addr, 31, 0x0001); rio_probe1() 260 mii_write(dev, np->phy_addr, 27, 0x01e0); rio_probe1() 261 mii_write(dev, np->phy_addr, 31, 0x0002); rio_probe1() 262 mii_write(dev, np->phy_addr, 27, 0xeb8e); rio_probe1() 263 mii_write(dev, np->phy_addr, 31, 0x0000); rio_probe1() 264 mii_write(dev, np->phy_addr, 30, 0x005e); rio_probe1() 266 mii_write(dev, np->phy_addr, MII_CTRL1000, 0x0700); rio_probe1() 270 np->phy_media = (dr16(ASICCtrl) & PhyMedia) ? 1 : 0; rio_probe1() 271 np->link_status = 0; rio_probe1() 273 if (np->phy_media) { rio_probe1() 275 if (np->an_enable == 2) { rio_probe1() 276 np->an_enable = 1; rio_probe1() 282 if (np->speed == 1000) rio_probe1() 283 np->an_enable = 1; rio_probe1() 294 dev->name, np->name, dev->dev_addr, irq); rio_probe1() 298 if (np->coalesce) rio_probe1() 302 np->rx_coalesce, np->rx_timeout*640); rio_probe1() 303 if (np->vlan) rio_probe1() 304 printk(KERN_INFO "vlan(id):\t%d\n", np->vlan); rio_probe1() 308 pci_free_consistent (pdev, RX_TOTAL_SIZE, np->rx_ring, np->rx_ring_dma); rio_probe1() 310 pci_free_consistent (pdev, TX_TOTAL_SIZE, np->tx_ring, np->tx_ring_dma); rio_probe1() 313 pci_iounmap(pdev, np->ioaddr); rio_probe1() 315 pci_iounmap(pdev, np->eeprom_addr); rio_probe1() 328 struct netdev_private *np = netdev_priv(dev); find_miiphy() local 330 np = netdev_priv(dev); find_miiphy() 331 np->phy_addr = 1; find_miiphy() 336 np->phy_addr = i; find_miiphy() 350 struct netdev_private *np = netdev_priv(dev); parse_eeprom() local 351 void __iomem *ioaddr = np->ioaddr; parse_eeprom() 361 ((__le16 *) sromdata)[i] = cpu_to_le16(read_eeprom(np, i)); parse_eeprom() 363 if (np->pdev->vendor == PCI_VENDOR_ID_DLINK) { /* D-Link Only */ parse_eeprom() 377 if (np->chip_id == CHIP_IP1000A) { parse_eeprom() 378 np->led_mode = psrom->led_mode; parse_eeprom() 382 if (np->pdev->vendor != PCI_VENDOR_ID_DLINK) { parse_eeprom() 402 np->duplex_polarity = psib[i]; parse_eeprom() 406 np->wake_polarity = psib[i]; parse_eeprom() 410 memcpy (np->name, &(psib[i]), j); parse_eeprom() 429 struct netdev_private *np = netdev_priv(dev); rio_set_led_mode() local 430 void __iomem *ioaddr = np->ioaddr; rio_set_led_mode() 433 if (np->chip_id != CHIP_IP1000A) rio_set_led_mode() 439 if (np->led_mode & 0x01) rio_set_led_mode() 441 if (np->led_mode & 0x02) rio_set_led_mode() 443 if (np->led_mode & 0x08) rio_set_led_mode() 452 struct netdev_private *np = netdev_priv(dev); rio_open() local 453 void __iomem *ioaddr = np->ioaddr; rio_open() 454 const int irq = np->pdev->irq; rio_open() 473 if (np->jumbo != 0) rio_open() 487 if (np->coalesce) { rio_open() 488 dw32(RxDMAIntCtrl, np->rx_coalesce | np->rx_timeout << 16); rio_open() 500 if (np->vlan) { rio_open() 504 dw16(VLANId, np->vlan); rio_open() 506 dw32(VLANTag, 0x8100 << 16 | np->vlan); rio_open() 512 setup_timer(&np->timer, rio_timer, (unsigned long)dev); rio_open() 513 np->timer.expires = jiffies + 1*HZ; rio_open() 514 add_timer (&np->timer); rio_open() 520 macctrl |= (np->vlan) ? AutoVLANuntagging : 0; rio_open() 521 macctrl |= (np->full_duplex) ? DuplexSelect : 0; rio_open() 522 macctrl |= (np->tx_flow) ? TxFlowControlEnable : 0; rio_open() 523 macctrl |= (np->rx_flow) ? RxFlowControlEnable : 0; rio_open() 528 dl2k_enable_int(np); rio_open() 536 struct netdev_private *np = netdev_priv(dev); rio_timer() local 541 spin_lock_irqsave(&np->rx_lock, flags); rio_timer() 543 if (np->cur_rx - np->old_rx >= RX_RING_SIZE) { rio_timer() 546 for (; np->cur_rx - np->old_rx > 0; np->old_rx++) { rio_timer() 548 entry = np->old_rx % RX_RING_SIZE; rio_timer() 550 if (np->rx_skbuff[entry] == NULL) { rio_timer() 552 np->rx_buf_sz); rio_timer() 554 np->rx_ring[entry].fraginfo = 0; rio_timer() 560 np->rx_skbuff[entry] = skb; rio_timer() 561 np->rx_ring[entry].fraginfo = rio_timer() 563 (np->pdev, skb->data, np->rx_buf_sz, rio_timer() 566 np->rx_ring[entry].fraginfo |= rio_timer() 567 cpu_to_le64((u64)np->rx_buf_sz << 48); rio_timer() 568 np->rx_ring[entry].status = 0; rio_timer() 571 spin_unlock_irqrestore (&np->rx_lock, flags); rio_timer() 572 np->timer.expires = jiffies + next_tick; rio_timer() 573 add_timer(&np->timer); rio_timer() 579 struct netdev_private *np = netdev_priv(dev); rio_tx_timeout() local 580 void __iomem *ioaddr = np->ioaddr; rio_tx_timeout() 593 struct netdev_private *np = netdev_priv(dev); alloc_list() local 594 void __iomem *ioaddr = np->ioaddr; alloc_list() 597 np->cur_rx = np->cur_tx = 0; alloc_list() 598 np->old_rx = np->old_tx = 0; alloc_list() 599 np->rx_buf_sz = (dev->mtu <= 1500 ? PACKET_SIZE : dev->mtu + 32); alloc_list() 603 np->tx_skbuff[i] = NULL; alloc_list() 604 np->tx_ring[i].status = cpu_to_le64 (TFDDone); alloc_list() 605 np->tx_ring[i].next_desc = cpu_to_le64 (np->tx_ring_dma + alloc_list() 612 np->rx_ring[i].next_desc = cpu_to_le64 (np->rx_ring_dma + alloc_list() 615 np->rx_ring[i].status = 0; alloc_list() 616 np->rx_ring[i].fraginfo = 0; alloc_list() 617 np->rx_skbuff[i] = NULL; alloc_list() 625 skb = netdev_alloc_skb_ip_align(dev, np->rx_buf_sz); alloc_list() 626 np->rx_skbuff[i] = skb; alloc_list() 631 np->rx_ring[i].fraginfo = alloc_list() 633 np->pdev, skb->data, np->rx_buf_sz, alloc_list() 635 np->rx_ring[i].fraginfo |= cpu_to_le64((u64)np->rx_buf_sz << 48); alloc_list() 639 dw32(RFDListPtr0, np->rx_ring_dma); alloc_list() 646 struct netdev_private *np = netdev_priv(dev); start_xmit() local 647 void __iomem *ioaddr = np->ioaddr; start_xmit() 652 if (np->link_status == 0) { /* Link Down */ start_xmit() 656 entry = np->cur_tx % TX_RING_SIZE; start_xmit() 657 np->tx_skbuff[entry] = skb; start_xmit() 658 txdesc = &np->tx_ring[entry]; start_xmit() 667 if (np->vlan) { start_xmit() 669 ((u64)np->vlan << 32) | start_xmit() 672 txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data, start_xmit() 679 if (entry % np->tx_coalesce == 0 || np->speed == 10) start_xmit() 693 np->cur_tx = (np->cur_tx + 1) % TX_RING_SIZE; start_xmit() 694 if ((np->cur_tx - np->old_tx + TX_RING_SIZE) % TX_RING_SIZE start_xmit() 695 < TX_QUEUE_LEN - 1 && np->speed != 10) { start_xmit() 703 dw32(TFDListPtr0, np->tx_ring_dma + start_xmit() 715 struct netdev_private *np = netdev_priv(dev); rio_interrupt() local 716 void __iomem *ioaddr = np->ioaddr; rio_interrupt() 746 if (np->cur_tx != np->old_tx) rio_interrupt() 759 struct netdev_private *np = netdev_priv(dev); rio_free_tx() local 760 int entry = np->old_tx % TX_RING_SIZE; rio_free_tx() 765 spin_lock(&np->tx_lock); rio_free_tx() 767 spin_lock_irqsave(&np->tx_lock, flag); rio_free_tx() 770 while (entry != np->cur_tx) { rio_free_tx() 773 if (!(np->tx_ring[entry].status & cpu_to_le64(TFDDone))) rio_free_tx() 775 skb = np->tx_skbuff[entry]; rio_free_tx() 776 pci_unmap_single (np->pdev, rio_free_tx() 777 desc_to_dma(&np->tx_ring[entry]), rio_free_tx() 784 np->tx_skbuff[entry] = NULL; rio_free_tx() 789 spin_unlock(&np->tx_lock); rio_free_tx() 791 spin_unlock_irqrestore(&np->tx_lock, flag); rio_free_tx() 792 np->old_tx = entry; rio_free_tx() 798 ((np->cur_tx - np->old_tx + TX_RING_SIZE) % TX_RING_SIZE rio_free_tx() 799 < TX_QUEUE_LEN - 1 || np->speed == 10)) { rio_free_tx() 807 struct netdev_private *np = netdev_priv(dev); tx_error() local 808 void __iomem *ioaddr = np->ioaddr; tx_error() 815 np->stats.tx_errors++; tx_error() 818 np->stats.tx_fifo_errors++; tx_error() 832 dw32(TFDListPtr0, np->tx_ring_dma + tx_error() 833 np->old_tx * sizeof (struct netdev_desc)); tx_error() 840 np->stats.tx_fifo_errors++; tx_error() 855 np->stats.collisions16++; tx_error() 858 np->stats.collisions++; tx_error() 867 struct netdev_private *np = netdev_priv(dev); receive_packet() local 868 int entry = np->cur_rx % RX_RING_SIZE; receive_packet() 873 struct netdev_desc *desc = &np->rx_ring[entry]; receive_packet() 889 np->stats.rx_errors++; receive_packet() 891 np->stats.rx_length_errors++; receive_packet() 893 np->stats.rx_crc_errors++; receive_packet() 894 if (frame_status & RxAlignmentError && np->speed != 1000) receive_packet() 895 np->stats.rx_frame_errors++; receive_packet() 897 np->stats.rx_fifo_errors++; receive_packet() 903 pci_unmap_single (np->pdev, receive_packet() 905 np->rx_buf_sz, receive_packet() 907 skb_put (skb = np->rx_skbuff[entry], pkt_len); receive_packet() 908 np->rx_skbuff[entry] = NULL; receive_packet() 910 pci_dma_sync_single_for_cpu(np->pdev, receive_packet() 912 np->rx_buf_sz, receive_packet() 915 np->rx_skbuff[entry]->data, receive_packet() 918 pci_dma_sync_single_for_device(np->pdev, receive_packet() 920 np->rx_buf_sz, receive_packet() 926 if (np->pdev->pci_rev_id >= 0x0c && receive_packet() 935 spin_lock(&np->rx_lock); receive_packet() 936 np->cur_rx = entry; receive_packet() 938 entry = np->old_rx; receive_packet() 939 while (entry != np->cur_rx) { receive_packet() 942 if (np->rx_skbuff[entry] == NULL) { receive_packet() 943 skb = netdev_alloc_skb_ip_align(dev, np->rx_buf_sz); receive_packet() 945 np->rx_ring[entry].fraginfo = 0; receive_packet() 952 np->rx_skbuff[entry] = skb; receive_packet() 953 np->rx_ring[entry].fraginfo = receive_packet() 955 (np->pdev, skb->data, np->rx_buf_sz, receive_packet() 958 np->rx_ring[entry].fraginfo |= receive_packet() 959 cpu_to_le64((u64)np->rx_buf_sz << 48); receive_packet() 960 np->rx_ring[entry].status = 0; receive_packet() 963 np->old_rx = entry; receive_packet() 964 spin_unlock(&np->rx_lock); receive_packet() 971 struct netdev_private *np = netdev_priv(dev); rio_error() local 972 void __iomem *ioaddr = np->ioaddr; rio_error() 979 if (np->phy_media) rio_error() 983 if (np->speed == 1000) rio_error() 984 np->tx_coalesce = tx_coalesce; rio_error() 986 np->tx_coalesce = 1; rio_error() 988 macctrl |= (np->vlan) ? AutoVLANuntagging : 0; rio_error() 989 macctrl |= (np->full_duplex) ? DuplexSelect : 0; rio_error() 990 macctrl |= (np->tx_flow) ? rio_error() 992 macctrl |= (np->rx_flow) ? rio_error() 995 np->link_status = 1; rio_error() 999 np->link_status = 0; rio_error() 1023 struct netdev_private *np = netdev_priv(dev); get_stats() local 1024 void __iomem *ioaddr = np->ioaddr; get_stats() 1033 np->stats.rx_packets += dr32(FramesRcvOk); get_stats() 1034 np->stats.tx_packets += dr32(FramesXmtOk); get_stats() 1035 np->stats.rx_bytes += dr32(OctetRcvOk); get_stats() 1036 np->stats.tx_bytes += dr32(OctetXmtOk); get_stats() 1038 np->stats.multicast = dr32(McstFramesRcvdOk); get_stats() 1039 np->stats.collisions += dr32(SingleColFrames) get_stats() 1044 np->stats.tx_aborted_errors += stat_reg; get_stats() 1045 np->stats.tx_errors += stat_reg; get_stats() 1048 np->stats.tx_carrier_errors += stat_reg; get_stats() 1049 np->stats.tx_errors += stat_reg; get_stats() 1079 return &np->stats; get_stats() 1085 struct netdev_private *np = netdev_priv(dev); clear_stats() local 1086 void __iomem *ioaddr = np->ioaddr; clear_stats() 1141 struct netdev_private *np = netdev_priv(dev); change_mtu() local 1142 int max = (np->jumbo) ? MAX_JUMBO : 1536; change_mtu() 1156 struct netdev_private *np = netdev_priv(dev); set_multicast() local 1157 void __iomem *ioaddr = np->ioaddr; set_multicast() 1190 if (np->vlan) { 1202 struct netdev_private *np = netdev_priv(dev); rio_get_drvinfo() local 1206 strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info)); rio_get_drvinfo() 1211 struct netdev_private *np = netdev_priv(dev); rio_get_settings() local 1212 if (np->phy_media) { rio_get_settings() 1231 if ( np->link_status ) { rio_get_settings() 1232 ethtool_cmd_speed_set(cmd, np->speed); rio_get_settings() 1233 cmd->duplex = np->full_duplex ? DUPLEX_FULL : DUPLEX_HALF; rio_get_settings() 1238 if ( np->an_enable) rio_get_settings() 1243 cmd->phy_address = np->phy_addr; rio_get_settings() 1249 struct netdev_private *np = netdev_priv(dev); rio_set_settings() local 1252 if (np->an_enable) rio_set_settings() 1255 np->an_enable = 1; rio_set_settings() 1260 np->an_enable = 0; rio_set_settings() 1261 if (np->speed == 1000) { rio_set_settings() 1268 np->speed = 10; rio_set_settings() 1269 np->full_duplex = (cmd->duplex == DUPLEX_FULL); rio_set_settings() 1272 np->speed = 100; rio_set_settings() 1273 np->full_duplex = (cmd->duplex == DUPLEX_FULL); rio_set_settings() 1286 struct netdev_private *np = netdev_priv(dev); rio_get_link() local 1287 return np->link_status; rio_get_link() 1301 struct netdev_private *np = netdev_priv(dev); rio_ioctl() local 1304 phy_addr = np->phy_addr; rio_ioctl() 1327 static int read_eeprom(struct netdev_private *np, int eep_addr) read_eeprom() argument 1329 void __iomem *ioaddr = np->eeprom_addr; read_eeprom() 1349 struct netdev_private *np = netdev_priv(dev); mii_sendbit() local 1350 void __iomem *ioaddr = np->ioaddr; mii_sendbit() 1362 struct netdev_private *np = netdev_priv(dev); mii_getbit() local 1363 void __iomem *ioaddr = np->ioaddr; mii_getbit() 1432 struct netdev_private *np; mii_wait_link() local 1434 np = netdev_priv(dev); mii_wait_link() 1435 phy_addr = np->phy_addr; mii_wait_link() 1453 struct netdev_private *np; mii_get_media() local 1455 np = netdev_priv(dev); mii_get_media() 1456 phy_addr = np->phy_addr; mii_get_media() 1459 if (np->an_enable) { mii_get_media() 1469 np->speed = 1000; mii_get_media() 1470 np->full_duplex = 1; mii_get_media() 1473 np->speed = 1000; mii_get_media() 1474 np->full_duplex = 0; mii_get_media() 1477 np->speed = 100; mii_get_media() 1478 np->full_duplex = 1; mii_get_media() 1481 np->speed = 100; mii_get_media() 1482 np->full_duplex = 0; mii_get_media() 1485 np->speed = 10; mii_get_media() 1486 np->full_duplex = 1; mii_get_media() 1489 np->speed = 10; mii_get_media() 1490 np->full_duplex = 0; mii_get_media() 1494 np->tx_flow &= 1; mii_get_media() 1495 np->rx_flow &= 1; mii_get_media() 1497 np->tx_flow = 0; mii_get_media() 1498 np->rx_flow &= 1; mii_get_media() 1519 if (np->tx_flow) mii_get_media() 1523 if (np->rx_flow) mii_get_media() 1539 struct netdev_private *np; mii_set_media() local 1540 np = netdev_priv(dev); mii_set_media() 1541 phy_addr = np->phy_addr; mii_set_media() 1544 if (np->an_enable) { mii_set_media() 1596 if (np->speed == 100) { mii_set_media() 1599 } else if (np->speed == 10) { mii_set_media() 1602 if (np->full_duplex) { mii_set_media() 1626 struct netdev_private *np; mii_get_media_pcs() local 1628 np = netdev_priv(dev); mii_get_media_pcs() 1629 phy_addr = np->phy_addr; mii_get_media_pcs() 1632 if (np->an_enable) { mii_get_media_pcs() 1639 np->speed = 1000; mii_get_media_pcs() 1642 np->full_duplex = 1; mii_get_media_pcs() 1645 np->full_duplex = 0; mii_get_media_pcs() 1648 np->tx_flow &= 1; mii_get_media_pcs() 1649 np->rx_flow &= 1; mii_get_media_pcs() 1651 np->tx_flow = 0; mii_get_media_pcs() 1652 np->rx_flow &= 1; mii_get_media_pcs() 1664 if (np->tx_flow) mii_get_media_pcs() 1668 if (np->rx_flow) mii_get_media_pcs() 1683 struct netdev_private *np; mii_set_media_pcs() local 1684 np = netdev_priv(dev); mii_set_media_pcs() 1685 phy_addr = np->phy_addr; mii_set_media_pcs() 1688 if (np->an_enable) { mii_set_media_pcs() 1712 if (np->full_duplex) { mii_set_media_pcs() 1732 struct netdev_private *np = netdev_priv(dev); rio_close() local 1733 void __iomem *ioaddr = np->ioaddr; rio_close() 1735 struct pci_dev *pdev = np->pdev; rio_close() 1748 del_timer_sync (&np->timer); rio_close() 1752 skb = np->rx_skbuff[i]; rio_close() 1754 pci_unmap_single(pdev, desc_to_dma(&np->rx_ring[i]), rio_close() 1757 np->rx_skbuff[i] = NULL; rio_close() 1759 np->rx_ring[i].status = 0; rio_close() 1760 np->rx_ring[i].fraginfo = 0; rio_close() 1763 skb = np->tx_skbuff[i]; rio_close() 1765 pci_unmap_single(pdev, desc_to_dma(&np->tx_ring[i]), rio_close() 1768 np->tx_skbuff[i] = NULL; rio_close() 1781 struct netdev_private *np = netdev_priv(dev); rio_remove1() local 1784 pci_free_consistent (pdev, RX_TOTAL_SIZE, np->rx_ring, rio_remove1() 1785 np->rx_ring_dma); rio_remove1() 1786 pci_free_consistent (pdev, TX_TOTAL_SIZE, np->tx_ring, rio_remove1() 1787 np->tx_ring_dma); rio_remove1() 1789 pci_iounmap(pdev, np->ioaddr); rio_remove1() 1791 pci_iounmap(pdev, np->eeprom_addr); rio_remove1()
|
H A D | sundance.c | 455 struct netdev_private *np = netdev_priv(dev); sundance_reset() local 456 void __iomem *ioaddr = np->base + ASICCtrl; sundance_reset() 475 struct netdev_private *np = netdev_priv(dev); sundance_poll_controller() local 477 disable_irq(np->pci_dev->irq); sundance_poll_controller() 478 intr_handler(np->pci_dev->irq, dev); sundance_poll_controller() 479 enable_irq(np->pci_dev->irq); sundance_poll_controller() 503 struct netdev_private *np; sundance_probe1() local 532 dev = alloc_etherdev(sizeof(*np)); sundance_probe1() 548 np = netdev_priv(dev); sundance_probe1() 549 np->base = ioaddr; sundance_probe1() 550 np->pci_dev = pdev; sundance_probe1() 551 np->chip_id = chip_idx; sundance_probe1() 552 np->msg_enable = (1 << debug) - 1; sundance_probe1() 553 spin_lock_init(&np->lock); sundance_probe1() 554 spin_lock_init(&np->statlock); sundance_probe1() 555 tasklet_init(&np->rx_tasklet, rx_poll, (unsigned long)dev); sundance_probe1() 556 tasklet_init(&np->tx_tasklet, tx_poll, (unsigned long)dev); sundance_probe1() 562 np->tx_ring = (struct netdev_desc *)ring_space; sundance_probe1() 563 np->tx_ring_dma = ring_dma; sundance_probe1() 569 np->rx_ring = (struct netdev_desc *)ring_space; sundance_probe1() 570 np->rx_ring_dma = ring_dma; sundance_probe1() 572 np->mii_if.dev = dev; sundance_probe1() 573 np->mii_if.mdio_read = mdio_read; sundance_probe1() 574 np->mii_if.mdio_write = mdio_write; sundance_probe1() 575 np->mii_if.phy_id_mask = 0x1f; sundance_probe1() 576 np->mii_if.reg_num_mask = 0x1f; sundance_probe1() 593 np->phys[0] = 1; /* Default setting */ sundance_probe1() 594 np->mii_preamble_required++; sundance_probe1() 600 if (sundance_pci_tbl[np->chip_id].device == 0x0200) { sundance_probe1() 611 np->phys[phy_idx++] = phyx; sundance_probe1() 612 np->mii_if.advertising = mdio_read(dev, phyx, MII_ADVERTISE); sundance_probe1() 614 np->mii_preamble_required++; sundance_probe1() 617 dev->name, phyx, mii_status, np->mii_if.advertising); sundance_probe1() 620 np->mii_preamble_required--; sundance_probe1() 628 np->mii_if.phy_id = np->phys[0]; sundance_probe1() 631 np->an_enable = 1; sundance_probe1() 634 np->an_enable = 0; sundance_probe1() 637 np->speed = 100; sundance_probe1() 638 np->mii_if.full_duplex = 1; sundance_probe1() 641 np->speed = 100; sundance_probe1() 642 np->mii_if.full_duplex = 0; sundance_probe1() 645 np->speed = 10; sundance_probe1() 646 np->mii_if.full_duplex = 1; sundance_probe1() 649 np->speed = 10; sundance_probe1() 650 np->mii_if.full_duplex = 0; sundance_probe1() 652 np->an_enable = 1; sundance_probe1() 656 np->flowctrl = 1; sundance_probe1() 662 if (np->an_enable) { sundance_probe1() 663 np->speed = 100; sundance_probe1() 664 np->mii_if.full_duplex = 1; sundance_probe1() 665 np->an_enable = 0; sundance_probe1() 669 mdio_write (dev, np->phys[0], MII_BMCR, BMCR_RESET); sundance_probe1() 672 if (np->flowctrl) sundance_probe1() 673 mdio_write (dev, np->phys[0], MII_ADVERTISE, np->mii_if.advertising | 0x0400); sundance_probe1() 674 mdio_write (dev, np->phys[0], MII_BMCR, BMCR_ANENABLE|BMCR_ANRESTART); sundance_probe1() 676 if (!np->an_enable) { sundance_probe1() 678 mii_ctl |= (np->speed == 100) ? BMCR_SPEED100 : 0; sundance_probe1() 679 mii_ctl |= (np->mii_if.full_duplex) ? BMCR_FULLDPLX : 0; sundance_probe1() 680 mdio_write (dev, np->phys[0], MII_BMCR, mii_ctl); sundance_probe1() 682 np->speed, np->mii_if.full_duplex ? "Full" : "Half"); sundance_probe1() 688 if (netif_msg_hw(np)) sundance_probe1() 691 if (netif_msg_hw(np)) sundance_probe1() 701 np->rx_ring, np->rx_ring_dma); sundance_probe1() 704 np->tx_ring, np->tx_ring_dma); sundance_probe1() 772 struct netdev_private *np = netdev_priv(dev); mdio_read() local 773 void __iomem *mdio_addr = np->base + MIICtrl; mdio_read() 777 if (np->mii_preamble_required) mdio_read() 802 struct netdev_private *np = netdev_priv(dev); mdio_write() local 803 void __iomem *mdio_addr = np->base + MIICtrl; mdio_write() 807 if (np->mii_preamble_required) mdio_write() 832 struct netdev_private *np; mdio_wait_link() local 834 np = netdev_priv(dev); mdio_wait_link() 835 phy_id = np->phys[0]; mdio_wait_link() 848 struct netdev_private *np = netdev_priv(dev); netdev_open() local 849 void __iomem *ioaddr = np->base; netdev_open() 850 const int irq = np->pci_dev->irq; netdev_open() 860 if (netif_msg_ifup(np)) netdev_open() 865 iowrite32(np->rx_ring_dma, ioaddr + RxListPtr); netdev_open() 881 dev->if_port = np->default_port; netdev_open() 883 spin_lock_init(&np->mcastlock); netdev_open() 892 if (np->pci_dev->revision >= 0x14) netdev_open() 896 spin_lock_irqsave(&np->lock, flags); netdev_open() 898 spin_unlock_irqrestore(&np->lock, flags); netdev_open() 904 np->wol_enabled = 0; netdev_open() 906 if (netif_msg_ifup(np)) netdev_open() 914 init_timer(&np->timer); netdev_open() 915 np->timer.expires = jiffies + 3*HZ; netdev_open() 916 np->timer.data = (unsigned long)dev; netdev_open() 917 np->timer.function = netdev_timer; /* timer handler */ netdev_open() 918 add_timer(&np->timer); netdev_open() 928 struct netdev_private *np = netdev_priv(dev); check_duplex() local 929 void __iomem *ioaddr = np->base; check_duplex() 930 int mii_lpa = mdio_read(dev, np->phys[0], MII_LPA); check_duplex() 931 int negotiated = mii_lpa & np->mii_if.advertising; check_duplex() 935 if (!np->an_enable || mii_lpa == 0xffff) { check_duplex() 936 if (np->mii_if.full_duplex) check_duplex() 944 if (np->mii_if.full_duplex != duplex) { check_duplex() 945 np->mii_if.full_duplex = duplex; check_duplex() 946 if (netif_msg_link(np)) check_duplex() 949 duplex ? "full" : "half", np->phys[0], negotiated); check_duplex() 957 struct netdev_private *np = netdev_priv(dev); netdev_timer() local 958 void __iomem *ioaddr = np->base; netdev_timer() 961 if (netif_msg_timer(np)) { netdev_timer() 968 np->timer.expires = jiffies + next_tick; netdev_timer() 969 add_timer(&np->timer); netdev_timer() 974 struct netdev_private *np = netdev_priv(dev); tx_timeout() local 975 void __iomem *ioaddr = np->base; tx_timeout() 979 tasklet_disable(&np->tx_tasklet); tx_timeout() 990 (unsigned long long)(np->tx_ring_dma + i*sizeof(*np->tx_ring)), tx_timeout() 991 le32_to_cpu(np->tx_ring[i].next_desc), tx_timeout() 992 le32_to_cpu(np->tx_ring[i].status), tx_timeout() 993 (le32_to_cpu(np->tx_ring[i].status) >> 2) & 0xff, tx_timeout() 994 le32_to_cpu(np->tx_ring[i].frag[0].addr), tx_timeout() 995 le32_to_cpu(np->tx_ring[i].frag[0].length)); tx_timeout() 998 ioread32(np->base + TxListPtr), tx_timeout() 1001 np->cur_tx, np->cur_tx % TX_RING_SIZE, tx_timeout() 1002 np->dirty_tx, np->dirty_tx % TX_RING_SIZE); tx_timeout() 1003 printk(KERN_DEBUG "cur_rx=%d dirty_rx=%d\n", np->cur_rx, np->dirty_rx); tx_timeout() 1004 printk(KERN_DEBUG "cur_task=%d\n", np->cur_task); tx_timeout() 1006 spin_lock_irqsave(&np->lock, flag); tx_timeout() 1010 spin_unlock_irqrestore(&np->lock, flag); tx_timeout() 1016 if (np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) { tx_timeout() 1020 tasklet_enable(&np->tx_tasklet); tx_timeout() 1027 struct netdev_private *np = netdev_priv(dev); init_ring() local 1030 np->cur_rx = np->cur_tx = 0; init_ring() 1031 np->dirty_rx = np->dirty_tx = 0; init_ring() 1032 np->cur_task = 0; init_ring() 1034 np->rx_buf_sz = (dev->mtu <= 1520 ? PKT_BUF_SZ : dev->mtu + 16); init_ring() 1038 np->rx_ring[i].next_desc = cpu_to_le32(np->rx_ring_dma + init_ring() 1039 ((i+1)%RX_RING_SIZE)*sizeof(*np->rx_ring)); init_ring() 1040 np->rx_ring[i].status = 0; init_ring() 1041 np->rx_ring[i].frag[0].length = 0; init_ring() 1042 np->rx_skbuff[i] = NULL; init_ring() 1048 netdev_alloc_skb(dev, np->rx_buf_sz + 2); init_ring() 1049 np->rx_skbuff[i] = skb; init_ring() 1053 np->rx_ring[i].frag[0].addr = cpu_to_le32( init_ring() 1054 dma_map_single(&np->pci_dev->dev, skb->data, init_ring() 1055 np->rx_buf_sz, DMA_FROM_DEVICE)); init_ring() 1056 if (dma_mapping_error(&np->pci_dev->dev, init_ring() 1057 np->rx_ring[i].frag[0].addr)) { init_ring() 1059 np->rx_skbuff[i] = NULL; init_ring() 1062 np->rx_ring[i].frag[0].length = cpu_to_le32(np->rx_buf_sz | LastFrag); init_ring() 1064 np->dirty_rx = (unsigned int)(i - RX_RING_SIZE); init_ring() 1067 np->tx_skbuff[i] = NULL; init_ring() 1068 np->tx_ring[i].status = 0; init_ring() 1075 struct netdev_private *np = netdev_priv(dev); tx_poll() local 1076 unsigned head = np->cur_task % TX_RING_SIZE; tx_poll() 1078 &np->tx_ring[(np->cur_tx - 1) % TX_RING_SIZE]; tx_poll() 1081 for (; np->cur_tx - np->cur_task > 0; np->cur_task++) { tx_poll() 1082 int entry = np->cur_task % TX_RING_SIZE; tx_poll() 1083 txdesc = &np->tx_ring[entry]; tx_poll() 1084 if (np->last_tx) { tx_poll() 1085 np->last_tx->next_desc = cpu_to_le32(np->tx_ring_dma + tx_poll() 1088 np->last_tx = txdesc; tx_poll() 1093 if (ioread32 (np->base + TxListPtr) == 0) tx_poll() 1094 iowrite32 (np->tx_ring_dma + head * sizeof(struct netdev_desc), tx_poll() 1095 np->base + TxListPtr); tx_poll() 1101 struct netdev_private *np = netdev_priv(dev); start_tx() local 1106 entry = np->cur_tx % TX_RING_SIZE; start_tx() 1107 np->tx_skbuff[entry] = skb; start_tx() 1108 txdesc = &np->tx_ring[entry]; start_tx() 1112 txdesc->frag[0].addr = cpu_to_le32(dma_map_single(&np->pci_dev->dev, start_tx() 1114 if (dma_mapping_error(&np->pci_dev->dev, start_tx() 1120 np->cur_tx++; start_tx() 1123 tasklet_schedule(&np->tx_tasklet); start_tx() 1126 if (np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 1 && start_tx() 1132 if (netif_msg_tx_queued(np)) { start_tx() 1135 dev->name, np->cur_tx, entry); start_tx() 1141 np->tx_skbuff[entry] = NULL; start_tx() 1150 struct netdev_private *np = netdev_priv(dev); reset_tx() local 1151 void __iomem *ioaddr = np->base; reset_tx() 1161 np->tx_ring[i].next_desc = 0; reset_tx() 1163 skb = np->tx_skbuff[i]; reset_tx() 1165 dma_unmap_single(&np->pci_dev->dev, reset_tx() 1166 le32_to_cpu(np->tx_ring[i].frag[0].addr), reset_tx() 1169 np->tx_skbuff[i] = NULL; reset_tx() 1173 np->cur_tx = np->dirty_tx = 0; reset_tx() 1174 np->cur_task = 0; reset_tx() 1176 np->last_tx = NULL; reset_tx() 1188 struct netdev_private *np = netdev_priv(dev); intr_handler() local 1189 void __iomem *ioaddr = np->base; intr_handler() 1201 if (netif_msg_intr(np)) intr_handler() 1213 if (np->budget < 0) intr_handler() 1214 np->budget = RX_BUDGET; intr_handler() 1215 tasklet_schedule(&np->rx_tasklet); intr_handler() 1220 if (netif_msg_tx_done(np)) intr_handler() 1225 if (netif_msg_tx_err(np)) intr_handler() 1269 if (np->pci_dev->revision >= 0x14) { intr_handler() 1270 spin_lock(&np->lock); intr_handler() 1271 for (; np->cur_tx - np->dirty_tx > 0; np->dirty_tx++) { intr_handler() 1272 int entry = np->dirty_tx % TX_RING_SIZE; intr_handler() 1276 np->tx_ring[entry].status) >> 2) & 0xff; intr_handler() 1278 !(le32_to_cpu(np->tx_ring[entry].status) intr_handler() 1284 skb = np->tx_skbuff[entry]; intr_handler() 1286 dma_unmap_single(&np->pci_dev->dev, intr_handler() 1287 le32_to_cpu(np->tx_ring[entry].frag[0].addr), intr_handler() 1289 dev_kfree_skb_irq (np->tx_skbuff[entry]); intr_handler() 1290 np->tx_skbuff[entry] = NULL; intr_handler() 1291 np->tx_ring[entry].frag[0].addr = 0; intr_handler() 1292 np->tx_ring[entry].frag[0].length = 0; intr_handler() 1294 spin_unlock(&np->lock); intr_handler() 1296 spin_lock(&np->lock); intr_handler() 1297 for (; np->cur_tx - np->dirty_tx > 0; np->dirty_tx++) { intr_handler() 1298 int entry = np->dirty_tx % TX_RING_SIZE; intr_handler() 1300 if (!(le32_to_cpu(np->tx_ring[entry].status) intr_handler() 1303 skb = np->tx_skbuff[entry]; intr_handler() 1305 dma_unmap_single(&np->pci_dev->dev, intr_handler() 1306 le32_to_cpu(np->tx_ring[entry].frag[0].addr), intr_handler() 1308 dev_kfree_skb_irq (np->tx_skbuff[entry]); intr_handler() 1309 np->tx_skbuff[entry] = NULL; intr_handler() 1310 np->tx_ring[entry].frag[0].addr = 0; intr_handler() 1311 np->tx_ring[entry].frag[0].length = 0; intr_handler() 1313 spin_unlock(&np->lock); intr_handler() 1317 np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) { intr_handler() 1325 if (netif_msg_intr(np)) intr_handler() 1334 struct netdev_private *np = netdev_priv(dev); rx_poll() local 1335 int entry = np->cur_rx % RX_RING_SIZE; rx_poll() 1336 int boguscnt = np->budget; rx_poll() 1337 void __iomem *ioaddr = np->base; rx_poll() 1342 struct netdev_desc *desc = &(np->rx_ring[entry]); rx_poll() 1352 if (netif_msg_rx_status(np)) rx_poll() 1357 if (netif_msg_rx_err(np)) rx_poll() 1377 if (netif_msg_rx_status(np)) rx_poll() 1387 dma_sync_single_for_cpu(&np->pci_dev->dev, rx_poll() 1389 np->rx_buf_sz, DMA_FROM_DEVICE); rx_poll() 1390 skb_copy_to_linear_data(skb, np->rx_skbuff[entry]->data, pkt_len); rx_poll() 1391 dma_sync_single_for_device(&np->pci_dev->dev, rx_poll() 1393 np->rx_buf_sz, DMA_FROM_DEVICE); rx_poll() 1396 dma_unmap_single(&np->pci_dev->dev, rx_poll() 1398 np->rx_buf_sz, DMA_FROM_DEVICE); rx_poll() 1399 skb_put(skb = np->rx_skbuff[entry], pkt_len); rx_poll() 1400 np->rx_skbuff[entry] = NULL; rx_poll() 1409 np->cur_rx = entry; rx_poll() 1411 np->budget -= received; rx_poll() 1416 np->cur_rx = entry; rx_poll() 1420 np->budget -= received; rx_poll() 1421 if (np->budget <= 0) rx_poll() 1422 np->budget = RX_BUDGET; rx_poll() 1423 tasklet_schedule(&np->rx_tasklet); rx_poll() 1428 struct netdev_private *np = netdev_priv(dev); refill_rx() local 1433 for (;(np->cur_rx - np->dirty_rx + RX_RING_SIZE) % RX_RING_SIZE > 0; refill_rx() 1434 np->dirty_rx = (np->dirty_rx + 1) % RX_RING_SIZE) { refill_rx() 1436 entry = np->dirty_rx % RX_RING_SIZE; refill_rx() 1437 if (np->rx_skbuff[entry] == NULL) { refill_rx() 1438 skb = netdev_alloc_skb(dev, np->rx_buf_sz + 2); refill_rx() 1439 np->rx_skbuff[entry] = skb; refill_rx() 1443 np->rx_ring[entry].frag[0].addr = cpu_to_le32( refill_rx() 1444 dma_map_single(&np->pci_dev->dev, skb->data, refill_rx() 1445 np->rx_buf_sz, DMA_FROM_DEVICE)); refill_rx() 1446 if (dma_mapping_error(&np->pci_dev->dev, refill_rx() 1447 np->rx_ring[entry].frag[0].addr)) { refill_rx() 1449 np->rx_skbuff[entry] = NULL; refill_rx() 1454 np->rx_ring[entry].frag[0].length = refill_rx() 1455 cpu_to_le32(np->rx_buf_sz | LastFrag); refill_rx() 1456 np->rx_ring[entry].status = 0; refill_rx() 1462 struct netdev_private *np = netdev_priv(dev); netdev_error() local 1463 void __iomem *ioaddr = np->base; netdev_error() 1470 if (np->an_enable) { netdev_error() 1471 mii_advertise = mdio_read(dev, np->phys[0], netdev_error() 1473 mii_lpa = mdio_read(dev, np->phys[0], MII_LPA); netdev_error() 1478 np->speed = 100; netdev_error() 1481 np->speed = 100; netdev_error() 1484 np->speed = 10; netdev_error() 1487 np->speed = 10; netdev_error() 1493 mii_ctl = mdio_read(dev, np->phys[0], MII_BMCR); netdev_error() 1495 np->speed = speed; netdev_error() 1503 if (np->flowctrl && np->mii_if.full_duplex) { netdev_error() 1527 struct netdev_private *np = netdev_priv(dev); get_stats() local 1528 void __iomem *ioaddr = np->base; get_stats() 1532 spin_lock_irqsave(&np->statlock, flags); get_stats() 1540 np->xstats.tx_multiple_collisions += mult_coll; get_stats() 1542 np->xstats.tx_single_collisions += single_coll; get_stats() 1544 np->xstats.tx_late_collisions += late_coll; get_stats() 1549 np->xstats.tx_deferred += ioread8(ioaddr + StatsTxDefer); get_stats() 1550 np->xstats.tx_deferred_excessive += ioread8(ioaddr + StatsTxXSDefer); get_stats() 1551 np->xstats.tx_aborted += ioread8(ioaddr + StatsTxAbort); get_stats() 1552 np->xstats.tx_bcasts += ioread8(ioaddr + StatsBcastTx); get_stats() 1553 np->xstats.rx_bcasts += ioread8(ioaddr + StatsBcastRx); get_stats() 1554 np->xstats.tx_mcasts += ioread8(ioaddr + StatsMcastTx); get_stats() 1555 np->xstats.rx_mcasts += ioread8(ioaddr + StatsMcastRx); get_stats() 1562 spin_unlock_irqrestore(&np->statlock, flags); get_stats() 1569 struct netdev_private *np = netdev_priv(dev); set_rx_mode() local 1570 void __iomem *ioaddr = np->base; set_rx_mode() 1600 if (np->mii_if.full_duplex && np->flowctrl) 1610 struct netdev_private *np = netdev_priv(dev); __set_mac_addr() local 1614 iowrite16(addr16, np->base + StationAddr); __set_mac_addr() 1616 iowrite16(addr16, np->base + StationAddr+2); __set_mac_addr() 1618 iowrite16(addr16, np->base + StationAddr+4); __set_mac_addr() 1659 struct netdev_private *np = netdev_priv(dev); get_drvinfo() local 1662 strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); get_drvinfo() 1667 struct netdev_private *np = netdev_priv(dev); get_settings() local 1668 spin_lock_irq(&np->lock); get_settings() 1669 mii_ethtool_gset(&np->mii_if, ecmd); get_settings() 1670 spin_unlock_irq(&np->lock); get_settings() 1676 struct netdev_private *np = netdev_priv(dev); set_settings() local 1678 spin_lock_irq(&np->lock); set_settings() 1679 res = mii_ethtool_sset(&np->mii_if, ecmd); set_settings() 1680 spin_unlock_irq(&np->lock); set_settings() 1686 struct netdev_private *np = netdev_priv(dev); nway_reset() local 1687 return mii_nway_restart(&np->mii_if); nway_reset() 1692 struct netdev_private *np = netdev_priv(dev); get_link() local 1693 return mii_link_ok(&np->mii_if); get_link() 1698 struct netdev_private *np = netdev_priv(dev); get_msglevel() local 1699 return np->msg_enable; get_msglevel() 1704 struct netdev_private *np = netdev_priv(dev); set_msglevel() local 1705 np->msg_enable = val; set_msglevel() 1728 struct netdev_private *np = netdev_priv(dev); get_ethtool_stats() local 1732 data[i++] = np->xstats.tx_multiple_collisions; get_ethtool_stats() 1733 data[i++] = np->xstats.tx_single_collisions; get_ethtool_stats() 1734 data[i++] = np->xstats.tx_late_collisions; get_ethtool_stats() 1735 data[i++] = np->xstats.tx_deferred; get_ethtool_stats() 1736 data[i++] = np->xstats.tx_deferred_excessive; get_ethtool_stats() 1737 data[i++] = np->xstats.tx_aborted; get_ethtool_stats() 1738 data[i++] = np->xstats.tx_bcasts; get_ethtool_stats() 1739 data[i++] = np->xstats.rx_bcasts; get_ethtool_stats() 1740 data[i++] = np->xstats.tx_mcasts; get_ethtool_stats() 1741 data[i++] = np->xstats.rx_mcasts; get_ethtool_stats() 1749 struct netdev_private *np = netdev_priv(dev); sundance_get_wol() local 1750 void __iomem *ioaddr = np->base; sundance_get_wol() 1756 if (!np->wol_enabled) sundance_get_wol() 1769 struct netdev_private *np = netdev_priv(dev); sundance_set_wol() local 1770 void __iomem *ioaddr = np->base; sundance_set_wol() 1773 if (!device_can_wakeup(&np->pci_dev->dev)) sundance_set_wol() 1776 np->wol_enabled = !!(wol->wolopts); sundance_set_wol() 1781 if (np->wol_enabled) { sundance_set_wol() 1789 device_set_wakeup_enable(&np->pci_dev->dev, np->wol_enabled); sundance_set_wol() 1816 struct netdev_private *np = netdev_priv(dev); netdev_ioctl() local 1822 spin_lock_irq(&np->lock); netdev_ioctl() 1823 rc = generic_mii_ioctl(&np->mii_if, if_mii(rq), cmd, NULL); netdev_ioctl() 1824 spin_unlock_irq(&np->lock); netdev_ioctl() 1831 struct netdev_private *np = netdev_priv(dev); netdev_close() local 1832 void __iomem *ioaddr = np->base; netdev_close() 1837 tasklet_kill(&np->rx_tasklet); netdev_close() 1838 tasklet_kill(&np->tx_tasklet); netdev_close() 1839 np->cur_tx = 0; netdev_close() 1840 np->dirty_tx = 0; netdev_close() 1841 np->cur_task = 0; netdev_close() 1842 np->last_tx = NULL; netdev_close() 1846 if (netif_msg_ifdown(np)) { netdev_close() 1852 dev->name, np->cur_tx, np->dirty_tx, np->cur_rx, np->dirty_rx); netdev_close() 1880 if (netif_msg_hw(np)) { netdev_close() 1882 (int)(np->tx_ring_dma)); netdev_close() 1885 i, np->tx_ring[i].status, np->tx_ring[i].frag[0].addr, netdev_close() 1886 np->tx_ring[i].frag[0].length); netdev_close() 1888 (int)(np->rx_ring_dma)); netdev_close() 1891 i, np->rx_ring[i].status, np->rx_ring[i].frag[0].addr, netdev_close() 1892 np->rx_ring[i].frag[0].length); netdev_close() 1897 free_irq(np->pci_dev->irq, dev); netdev_close() 1899 del_timer_sync(&np->timer); netdev_close() 1903 np->rx_ring[i].status = 0; netdev_close() 1904 skb = np->rx_skbuff[i]; netdev_close() 1906 dma_unmap_single(&np->pci_dev->dev, netdev_close() 1907 le32_to_cpu(np->rx_ring[i].frag[0].addr), netdev_close() 1908 np->rx_buf_sz, DMA_FROM_DEVICE); netdev_close() 1910 np->rx_skbuff[i] = NULL; netdev_close() 1912 np->rx_ring[i].frag[0].addr = cpu_to_le32(0xBADF00D0); /* poison */ netdev_close() 1915 np->tx_ring[i].next_desc = 0; netdev_close() 1916 skb = np->tx_skbuff[i]; netdev_close() 1918 dma_unmap_single(&np->pci_dev->dev, netdev_close() 1919 le32_to_cpu(np->tx_ring[i].frag[0].addr), netdev_close() 1922 np->tx_skbuff[i] = NULL; netdev_close() 1934 struct netdev_private *np = netdev_priv(dev); sundance_remove1() local 1937 np->rx_ring, np->rx_ring_dma); sundance_remove1() 1939 np->tx_ring, np->tx_ring_dma); sundance_remove1() 1940 pci_iounmap(pdev, np->base); sundance_remove1() 1951 struct netdev_private *np = netdev_priv(dev); sundance_suspend() local 1952 void __iomem *ioaddr = np->base; sundance_suspend() 1961 if (np->wol_enabled) { sundance_suspend() 1966 np->wol_enabled); sundance_suspend()
|
/linux-4.4.14/drivers/net/ethernet/nvidia/ |
H A D | forcedeth.c | 794 * Locking: Within irq hander or disable_irq+spin_lock(&np->lock); 818 * Locking: Within irq hander or disable_irq+spin_lock(&np->lock); 964 static bool nv_optimized(struct fe_priv *np) nv_optimized() argument 966 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) nv_optimized() 1001 struct fe_priv *np = get_nvpriv(dev); setup_hw_rings() local 1004 if (!nv_optimized(np)) { setup_hw_rings() 1006 writel(dma_low(np->ring_addr), base + NvRegRxRingPhysAddr); setup_hw_rings() 1008 writel(dma_low(np->ring_addr + np->rx_ring_size*sizeof(struct ring_desc)), base + NvRegTxRingPhysAddr); setup_hw_rings() 1011 writel(dma_low(np->ring_addr), base + NvRegRxRingPhysAddr); setup_hw_rings() 1012 writel(dma_high(np->ring_addr), base + NvRegRxRingPhysAddrHigh); setup_hw_rings() 1015 writel(dma_low(np->ring_addr + np->rx_ring_size*sizeof(struct ring_desc_ex)), base + NvRegTxRingPhysAddr); setup_hw_rings() 1016 writel(dma_high(np->ring_addr + np->rx_ring_size*sizeof(struct ring_desc_ex)), base + NvRegTxRingPhysAddrHigh); setup_hw_rings() 1023 struct fe_priv *np = get_nvpriv(dev); free_rings() local 1025 if (!nv_optimized(np)) { free_rings() 1026 if (np->rx_ring.orig) free_rings() 1027 pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (np->rx_ring_size + np->tx_ring_size), free_rings() 1028 np->rx_ring.orig, np->ring_addr); free_rings() 1030 if (np->rx_ring.ex) free_rings() 1031 pci_free_consistent(np->pci_dev, sizeof(struct ring_desc_ex) * (np->rx_ring_size + np->tx_ring_size), free_rings() 1032 np->rx_ring.ex, np->ring_addr); free_rings() 1034 kfree(np->rx_skb); free_rings() 1035 kfree(np->tx_skb); free_rings() 1040 struct fe_priv *np = get_nvpriv(dev); using_multi_irqs() local 1042 if (!(np->msi_flags & NV_MSI_X_ENABLED) || using_multi_irqs() 1043 ((np->msi_flags & NV_MSI_X_ENABLED) && using_multi_irqs() 1044 ((np->msi_flags & NV_MSI_X_VECTORS_MASK) == 0x1))) using_multi_irqs() 1052 struct fe_priv *np = get_nvpriv(dev); nv_txrx_gate() local 1056 if (!np->mac_in_use && nv_txrx_gate() 1057 (np->driver_data & DEV_HAS_POWER_CNTRL)) { nv_txrx_gate() 1069 struct fe_priv *np = get_nvpriv(dev); nv_enable_irq() local 1072 if (np->msi_flags & NV_MSI_X_ENABLED) nv_enable_irq() 1073 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); nv_enable_irq() 1075 enable_irq(np->pci_dev->irq); nv_enable_irq() 1077 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); nv_enable_irq() 1078 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); nv_enable_irq() 1079 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); nv_enable_irq() 1085 struct fe_priv *np = get_nvpriv(dev); nv_disable_irq() local 1088 if (np->msi_flags & NV_MSI_X_ENABLED) nv_disable_irq() 1089 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); nv_disable_irq() 1091 disable_irq(np->pci_dev->irq); nv_disable_irq() 1093 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); nv_disable_irq() 1094 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); nv_disable_irq() 1095 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector); nv_disable_irq() 1109 struct fe_priv *np = get_nvpriv(dev); nv_disable_hw_interrupts() local 1112 if (np->msi_flags & NV_MSI_X_ENABLED) { nv_disable_hw_interrupts() 1115 if (np->msi_flags & NV_MSI_ENABLED) nv_disable_hw_interrupts() 1123 struct fe_priv *np = get_nvpriv(dev); nv_napi_enable() local 1125 napi_enable(&np->napi); nv_napi_enable() 1130 struct fe_priv *np = get_nvpriv(dev); nv_napi_disable() local 1132 napi_disable(&np->napi); nv_napi_disable() 1178 struct fe_priv *np = netdev_priv(dev); phy_reset() local 1183 if (mii_rw(dev, np->phyaddr, MII_BMCR, miicontrol)) phy_reset() 1192 miicontrol = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); phy_reset() 1200 static int init_realtek_8211b(struct net_device *dev, struct fe_priv *np) init_realtek_8211b() argument 1217 if (mii_rw(dev, np->phyaddr, ri[i].reg, ri[i].init)) init_realtek_8211b() 1224 static int init_realtek_8211c(struct net_device *dev, struct fe_priv *np) init_realtek_8211c() argument 1239 reg = mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG6, MII_READ); init_realtek_8211c() 1241 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG6, reg)) init_realtek_8211c() 1243 if (mii_rw(dev, np->phyaddr, init_realtek_8211c() 1246 reg = mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG7, MII_READ); init_realtek_8211c() 1249 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG7, reg)) init_realtek_8211c() 1252 if (mii_rw(dev, np->phyaddr, init_realtek_8211c() 1259 static int init_realtek_8201(struct net_device *dev, struct fe_priv *np) init_realtek_8201() argument 1263 if (np->driver_data & DEV_NEED_PHY_INIT_FIX) { init_realtek_8201() 1264 phy_reserved = mii_rw(dev, np->phyaddr, init_realtek_8201() 1267 if (mii_rw(dev, np->phyaddr, init_realtek_8201() 1275 static int init_realtek_8201_cross(struct net_device *dev, struct fe_priv *np) init_realtek_8201_cross() argument 1280 if (mii_rw(dev, np->phyaddr, init_realtek_8201_cross() 1283 phy_reserved = mii_rw(dev, np->phyaddr, init_realtek_8201_cross() 1287 if (mii_rw(dev, np->phyaddr, init_realtek_8201_cross() 1290 if (mii_rw(dev, np->phyaddr, init_realtek_8201_cross() 1298 static int init_cicada(struct net_device *dev, struct fe_priv *np, init_cicada() argument 1304 phy_reserved = mii_rw(dev, np->phyaddr, MII_RESV1, MII_READ); init_cicada() 1307 if (mii_rw(dev, np->phyaddr, MII_RESV1, phy_reserved)) init_cicada() 1309 phy_reserved = mii_rw(dev, np->phyaddr, MII_NCONFIG, MII_READ); init_cicada() 1311 if (mii_rw(dev, np->phyaddr, MII_NCONFIG, phy_reserved)) init_cicada() 1314 phy_reserved = mii_rw(dev, np->phyaddr, MII_SREVISION, MII_READ); init_cicada() 1316 if (mii_rw(dev, np->phyaddr, MII_SREVISION, phy_reserved)) init_cicada() 1322 static int init_vitesse(struct net_device *dev, struct fe_priv *np) init_vitesse() argument 1326 if (mii_rw(dev, np->phyaddr, init_vitesse() 1329 if (mii_rw(dev, np->phyaddr, init_vitesse() 1332 phy_reserved = mii_rw(dev, np->phyaddr, init_vitesse() 1334 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG4, phy_reserved)) init_vitesse() 1336 phy_reserved = mii_rw(dev, np->phyaddr, init_vitesse() 1340 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG3, phy_reserved)) init_vitesse() 1342 if (mii_rw(dev, np->phyaddr, init_vitesse() 1345 if (mii_rw(dev, np->phyaddr, init_vitesse() 1348 phy_reserved = mii_rw(dev, np->phyaddr, init_vitesse() 1352 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG4, phy_reserved)) init_vitesse() 1354 phy_reserved = mii_rw(dev, np->phyaddr, init_vitesse() 1356 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG3, phy_reserved)) init_vitesse() 1358 if (mii_rw(dev, np->phyaddr, init_vitesse() 1361 if (mii_rw(dev, np->phyaddr, init_vitesse() 1364 phy_reserved = mii_rw(dev, np->phyaddr, init_vitesse() 1366 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG4, phy_reserved)) init_vitesse() 1368 phy_reserved = mii_rw(dev, np->phyaddr, init_vitesse() 1372 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG3, phy_reserved)) init_vitesse() 1374 if (mii_rw(dev, np->phyaddr, init_vitesse() 1377 if (mii_rw(dev, np->phyaddr, init_vitesse() 1386 struct fe_priv *np = get_nvpriv(dev); phy_init() local 1392 if (np->phy_model == PHY_MODEL_MARVELL_E3016) { phy_init() 1393 reg = mii_rw(dev, np->phyaddr, MII_NCONFIG, MII_READ); phy_init() 1395 if (mii_rw(dev, np->phyaddr, MII_NCONFIG, reg)) { phy_init() 1397 pci_name(np->pci_dev)); phy_init() 1401 if (np->phy_oui == PHY_OUI_REALTEK) { phy_init() 1402 if (np->phy_model == PHY_MODEL_REALTEK_8211 && phy_init() 1403 np->phy_rev == PHY_REV_REALTEK_8211B) { phy_init() 1404 if (init_realtek_8211b(dev, np)) { phy_init() 1406 pci_name(np->pci_dev)); phy_init() 1409 } else if (np->phy_model == PHY_MODEL_REALTEK_8211 && phy_init() 1410 np->phy_rev == PHY_REV_REALTEK_8211C) { phy_init() 1411 if (init_realtek_8211c(dev, np)) { phy_init() 1413 pci_name(np->pci_dev)); phy_init() 1416 } else if (np->phy_model == PHY_MODEL_REALTEK_8201) { phy_init() 1417 if (init_realtek_8201(dev, np)) { phy_init() 1419 pci_name(np->pci_dev)); phy_init() 1426 reg = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); phy_init() 1430 if (mii_rw(dev, np->phyaddr, MII_ADVERTISE, reg)) { phy_init() 1432 pci_name(np->pci_dev)); phy_init() 1440 mii_status = mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); phy_init() 1442 np->gigabit = PHY_GIGABIT; phy_init() 1443 mii_control_1000 = mii_rw(dev, np->phyaddr, phy_init() 1451 if (mii_rw(dev, np->phyaddr, MII_CTRL1000, mii_control_1000)) { phy_init() 1453 pci_name(np->pci_dev)); phy_init() 1457 np->gigabit = 0; phy_init() 1459 mii_control = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); phy_init() 1462 if (np->phy_oui == PHY_OUI_REALTEK && phy_init() 1463 np->phy_model == PHY_MODEL_REALTEK_8211 && phy_init() 1464 np->phy_rev == PHY_REV_REALTEK_8211C) { phy_init() 1467 if (mii_rw(dev, np->phyaddr, MII_BMCR, mii_control)) { phy_init() 1469 pci_name(np->pci_dev)); phy_init() 1478 pci_name(np->pci_dev)); phy_init() 1484 if (np->phy_oui == PHY_OUI_CICADA) { phy_init() 1485 if (init_cicada(dev, np, phyinterface)) { phy_init() 1487 pci_name(np->pci_dev)); phy_init() 1490 } else if (np->phy_oui == PHY_OUI_VITESSE) { phy_init() 1491 if (init_vitesse(dev, np)) { phy_init() 1493 pci_name(np->pci_dev)); phy_init() 1496 } else if (np->phy_oui == PHY_OUI_REALTEK) { phy_init() 1497 if (np->phy_model == PHY_MODEL_REALTEK_8211 && phy_init() 1498 np->phy_rev == PHY_REV_REALTEK_8211B) { phy_init() 1500 if (init_realtek_8211b(dev, np)) { phy_init() 1502 pci_name(np->pci_dev)); phy_init() 1505 } else if (np->phy_model == PHY_MODEL_REALTEK_8201) { phy_init() 1506 if (init_realtek_8201(dev, np) || phy_init() 1507 init_realtek_8201_cross(dev, np)) { phy_init() 1509 pci_name(np->pci_dev)); phy_init() 1516 mii_rw(dev, np->phyaddr, MII_ADVERTISE, reg); phy_init() 1519 mii_control = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); phy_init() 1523 if (mii_rw(dev, np->phyaddr, MII_BMCR, mii_control)) phy_init() 1531 struct fe_priv *np = netdev_priv(dev); nv_start_rx() local 1536 if ((readl(base + NvRegReceiverControl) & NVREG_RCVCTL_START) && !np->mac_in_use) { nv_start_rx() 1541 writel(np->linkspeed, base + NvRegLinkSpeed); nv_start_rx() 1544 if (np->mac_in_use) nv_start_rx() 1552 struct fe_priv *np = netdev_priv(dev); nv_stop_rx() local 1556 if (!np->mac_in_use) nv_stop_rx() 1567 if (!np->mac_in_use) nv_stop_rx() 1573 struct fe_priv *np = netdev_priv(dev); nv_start_tx() local 1578 if (np->mac_in_use) nv_start_tx() 1586 struct fe_priv *np = netdev_priv(dev); nv_stop_tx() local 1590 if (!np->mac_in_use) nv_stop_tx() 1601 if (!np->mac_in_use) nv_stop_tx() 1620 struct fe_priv *np = netdev_priv(dev); nv_txrx_reset() local 1623 writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET | np->txrxctl_bits, base + NvRegTxRxControl); nv_txrx_reset() 1626 writel(NVREG_TXRXCTL_BIT2 | np->txrxctl_bits, base + NvRegTxRxControl); nv_txrx_reset() 1632 struct fe_priv *np = netdev_priv(dev); nv_mac_reset() local 1636 writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET | np->txrxctl_bits, base + NvRegTxRxControl); nv_mac_reset() 1656 writel(NVREG_TXRXCTL_BIT2 | np->txrxctl_bits, base + NvRegTxRxControl); nv_mac_reset() 1663 struct fe_priv *np = netdev_priv(dev); nv_update_stats() local 1670 assert_spin_locked(&np->hwstats_lock); nv_update_stats() 1673 np->estats.tx_bytes += readl(base + NvRegTxCnt); nv_update_stats() 1674 np->estats.tx_zero_rexmt += readl(base + NvRegTxZeroReXmt); nv_update_stats() 1675 np->estats.tx_one_rexmt += readl(base + NvRegTxOneReXmt); nv_update_stats() 1676 np->estats.tx_many_rexmt += readl(base + NvRegTxManyReXmt); nv_update_stats() 1677 np->estats.tx_late_collision += readl(base + NvRegTxLateCol); nv_update_stats() 1678 np->estats.tx_fifo_errors += readl(base + NvRegTxUnderflow); nv_update_stats() 1679 np->estats.tx_carrier_errors += readl(base + NvRegTxLossCarrier); nv_update_stats() 1680 np->estats.tx_excess_deferral += readl(base + NvRegTxExcessDef); nv_update_stats() 1681 np->estats.tx_retry_error += readl(base + NvRegTxRetryErr); nv_update_stats() 1682 np->estats.rx_frame_error += readl(base + NvRegRxFrameErr); nv_update_stats() 1683 np->estats.rx_extra_byte += readl(base + NvRegRxExtraByte); nv_update_stats() 1684 np->estats.rx_late_collision += readl(base + NvRegRxLateCol); nv_update_stats() 1685 np->estats.rx_runt += readl(base + NvRegRxRunt); nv_update_stats() 1686 np->estats.rx_frame_too_long += readl(base + NvRegRxFrameTooLong); nv_update_stats() 1687 np->estats.rx_over_errors += readl(base + NvRegRxOverflow); nv_update_stats() 1688 np->estats.rx_crc_errors += readl(base + NvRegRxFCSErr); nv_update_stats() 1689 np->estats.rx_frame_align_error += readl(base + NvRegRxFrameAlignErr); nv_update_stats() 1690 np->estats.rx_length_error += readl(base + NvRegRxLenErr); nv_update_stats() 1691 np->estats.rx_unicast += readl(base + NvRegRxUnicast); nv_update_stats() 1692 np->estats.rx_multicast += readl(base + NvRegRxMulticast); nv_update_stats() 1693 np->estats.rx_broadcast += readl(base + NvRegRxBroadcast); nv_update_stats() 1694 np->estats.rx_packets = nv_update_stats() 1695 np->estats.rx_unicast + nv_update_stats() 1696 np->estats.rx_multicast + nv_update_stats() 1697 np->estats.rx_broadcast; nv_update_stats() 1698 np->estats.rx_errors_total = nv_update_stats() 1699 np->estats.rx_crc_errors + nv_update_stats() 1700 np->estats.rx_over_errors + nv_update_stats() 1701 np->estats.rx_frame_error + nv_update_stats() 1702 (np->estats.rx_frame_align_error - np->estats.rx_extra_byte) + nv_update_stats() 1703 np->estats.rx_late_collision + nv_update_stats() 1704 np->estats.rx_runt + nv_update_stats() 1705 np->estats.rx_frame_too_long; nv_update_stats() 1706 np->estats.tx_errors_total = nv_update_stats() 1707 np->estats.tx_late_collision + nv_update_stats() 1708 np->estats.tx_fifo_errors + nv_update_stats() 1709 np->estats.tx_carrier_errors + nv_update_stats() 1710 np->estats.tx_excess_deferral + nv_update_stats() 1711 np->estats.tx_retry_error; nv_update_stats() 1713 if (np->driver_data & DEV_HAS_STATISTICS_V2) { nv_update_stats() 1714 np->estats.tx_deferral += readl(base + NvRegTxDef); nv_update_stats() 1715 np->estats.tx_packets += readl(base + NvRegTxFrame); nv_update_stats() 1716 np->estats.rx_bytes += readl(base + NvRegRxCnt); nv_update_stats() 1717 np->estats.tx_pause += readl(base + NvRegTxPause); nv_update_stats() 1718 np->estats.rx_pause += readl(base + NvRegRxPause); nv_update_stats() 1719 np->estats.rx_drop_frame += readl(base + NvRegRxDropFrame); nv_update_stats() 1720 np->estats.rx_errors_total += np->estats.rx_drop_frame; nv_update_stats() 1723 if (np->driver_data & DEV_HAS_STATISTICS_V3) { nv_update_stats() 1724 np->estats.tx_unicast += readl(base + NvRegTxUnicast); nv_update_stats() 1725 np->estats.tx_multicast += readl(base + NvRegTxMulticast); nv_update_stats() 1726 np->estats.tx_broadcast += readl(base + NvRegTxBroadcast); nv_update_stats() 1741 struct fe_priv *np = netdev_priv(dev); netdev_priv() local 1756 syncp_start = u64_stats_fetch_begin_irq(&np->swstats_rx_syncp); netdev_priv() 1757 storage->rx_packets = np->stat_rx_packets; netdev_priv() 1758 storage->rx_bytes = np->stat_rx_bytes; netdev_priv() 1759 storage->rx_dropped = np->stat_rx_dropped; netdev_priv() 1760 storage->rx_missed_errors = np->stat_rx_missed_errors; netdev_priv() 1761 } while (u64_stats_fetch_retry_irq(&np->swstats_rx_syncp, syncp_start)); netdev_priv() 1764 syncp_start = u64_stats_fetch_begin_irq(&np->swstats_tx_syncp); netdev_priv() 1765 storage->tx_packets = np->stat_tx_packets; netdev_priv() 1766 storage->tx_bytes = np->stat_tx_bytes; netdev_priv() 1767 storage->tx_dropped = np->stat_tx_dropped; netdev_priv() 1768 } while (u64_stats_fetch_retry_irq(&np->swstats_tx_syncp, syncp_start)); netdev_priv() 1771 if (np->driver_data & DEV_HAS_STATISTICS_V123) { netdev_priv() 1772 spin_lock_bh(&np->hwstats_lock); netdev_priv() 1777 storage->rx_errors = np->estats.rx_errors_total; netdev_priv() 1778 storage->tx_errors = np->estats.tx_errors_total; netdev_priv() 1781 storage->multicast = np->estats.rx_multicast; netdev_priv() 1784 storage->rx_length_errors = np->estats.rx_length_error; netdev_priv() 1785 storage->rx_over_errors = np->estats.rx_over_errors; netdev_priv() 1786 storage->rx_crc_errors = np->estats.rx_crc_errors; netdev_priv() 1787 storage->rx_frame_errors = np->estats.rx_frame_align_error; netdev_priv() 1788 storage->rx_fifo_errors = np->estats.rx_drop_frame; netdev_priv() 1791 storage->tx_carrier_errors = np->estats.tx_carrier_errors; netdev_priv() 1792 storage->tx_fifo_errors = np->estats.tx_fifo_errors; netdev_priv() 1794 spin_unlock_bh(&np->hwstats_lock); netdev_priv() 1807 struct fe_priv *np = netdev_priv(dev); nv_alloc_rx() local 1810 less_rx = np->get_rx.orig; nv_alloc_rx() 1811 if (less_rx-- == np->first_rx.orig) nv_alloc_rx() 1812 less_rx = np->last_rx.orig; nv_alloc_rx() 1814 while (np->put_rx.orig != less_rx) { nv_alloc_rx() 1815 struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz + NV_RX_ALLOC_PAD); nv_alloc_rx() 1817 np->put_rx_ctx->skb = skb; nv_alloc_rx() 1818 np->put_rx_ctx->dma = pci_map_single(np->pci_dev, nv_alloc_rx() 1822 if (pci_dma_mapping_error(np->pci_dev, nv_alloc_rx() 1823 np->put_rx_ctx->dma)) { nv_alloc_rx() 1827 np->put_rx_ctx->dma_len = skb_tailroom(skb); nv_alloc_rx() 1828 np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); nv_alloc_rx() 1830 np->put_rx.orig->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); nv_alloc_rx() 1831 if (unlikely(np->put_rx.orig++ == np->last_rx.orig)) nv_alloc_rx() 1832 np->put_rx.orig = np->first_rx.orig; nv_alloc_rx() 1833 if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) nv_alloc_rx() 1834 np->put_rx_ctx = np->first_rx_ctx; nv_alloc_rx() 1837 u64_stats_update_begin(&np->swstats_rx_syncp); nv_alloc_rx() 1838 np->stat_rx_dropped++; nv_alloc_rx() 1839 u64_stats_update_end(&np->swstats_rx_syncp); nv_alloc_rx() 1848 struct fe_priv *np = netdev_priv(dev); nv_alloc_rx_optimized() local 1851 less_rx = np->get_rx.ex; nv_alloc_rx_optimized() 1852 if (less_rx-- == np->first_rx.ex) nv_alloc_rx_optimized() 1853 less_rx = np->last_rx.ex; nv_alloc_rx_optimized() 1855 while (np->put_rx.ex != less_rx) { nv_alloc_rx_optimized() 1856 struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz + NV_RX_ALLOC_PAD); nv_alloc_rx_optimized() 1858 np->put_rx_ctx->skb = skb; nv_alloc_rx_optimized() 1859 np->put_rx_ctx->dma = pci_map_single(np->pci_dev, nv_alloc_rx_optimized() 1863 if (pci_dma_mapping_error(np->pci_dev, nv_alloc_rx_optimized() 1864 np->put_rx_ctx->dma)) { nv_alloc_rx_optimized() 1868 np->put_rx_ctx->dma_len = skb_tailroom(skb); nv_alloc_rx_optimized() 1869 np->put_rx.ex->bufhigh = cpu_to_le32(dma_high(np->put_rx_ctx->dma)); nv_alloc_rx_optimized() 1870 np->put_rx.ex->buflow = cpu_to_le32(dma_low(np->put_rx_ctx->dma)); nv_alloc_rx_optimized() 1872 np->put_rx.ex->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX2_AVAIL); nv_alloc_rx_optimized() 1873 if (unlikely(np->put_rx.ex++ == np->last_rx.ex)) nv_alloc_rx_optimized() 1874 np->put_rx.ex = np->first_rx.ex; nv_alloc_rx_optimized() 1875 if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) nv_alloc_rx_optimized() 1876 np->put_rx_ctx = np->first_rx_ctx; nv_alloc_rx_optimized() 1879 u64_stats_update_begin(&np->swstats_rx_syncp); nv_alloc_rx_optimized() 1880 np->stat_rx_dropped++; nv_alloc_rx_optimized() 1881 u64_stats_update_end(&np->swstats_rx_syncp); nv_alloc_rx_optimized() 1892 struct fe_priv *np = netdev_priv(dev); nv_do_rx_refill() local 1895 napi_schedule(&np->napi); nv_do_rx_refill() 1900 struct fe_priv *np = netdev_priv(dev); nv_init_rx() local 1903 np->get_rx = np->put_rx = np->first_rx = np->rx_ring; nv_init_rx() 1905 if (!nv_optimized(np)) nv_init_rx() 1906 np->last_rx.orig = &np->rx_ring.orig[np->rx_ring_size-1]; nv_init_rx() 1908 np->last_rx.ex = &np->rx_ring.ex[np->rx_ring_size-1]; nv_init_rx() 1909 np->get_rx_ctx = np->put_rx_ctx = np->first_rx_ctx = np->rx_skb; nv_init_rx() 1910 np->last_rx_ctx = &np->rx_skb[np->rx_ring_size-1]; nv_init_rx() 1912 for (i = 0; i < np->rx_ring_size; i++) { nv_init_rx() 1913 if (!nv_optimized(np)) { nv_init_rx() 1914 np->rx_ring.orig[i].flaglen = 0; nv_init_rx() 1915 np->rx_ring.orig[i].buf = 0; nv_init_rx() 1917 np->rx_ring.ex[i].flaglen = 0; nv_init_rx() 1918 np->rx_ring.ex[i].txvlan = 0; nv_init_rx() 1919 np->rx_ring.ex[i].bufhigh = 0; nv_init_rx() 1920 np->rx_ring.ex[i].buflow = 0; nv_init_rx() 1922 np->rx_skb[i].skb = NULL; nv_init_rx() 1923 np->rx_skb[i].dma = 0; nv_init_rx() 1929 struct fe_priv *np = netdev_priv(dev); nv_init_tx() local 1932 np->get_tx = np->put_tx = np->first_tx = np->tx_ring; nv_init_tx() 1934 if (!nv_optimized(np)) nv_init_tx() 1935 np->last_tx.orig = &np->tx_ring.orig[np->tx_ring_size-1]; nv_init_tx() 1937 np->last_tx.ex = &np->tx_ring.ex[np->tx_ring_size-1]; nv_init_tx() 1938 np->get_tx_ctx = np->put_tx_ctx = np->first_tx_ctx = np->tx_skb; nv_init_tx() 1939 np->last_tx_ctx = &np->tx_skb[np->tx_ring_size-1]; nv_init_tx() 1940 netdev_reset_queue(np->dev); nv_init_tx() 1941 np->tx_pkts_in_progress = 0; nv_init_tx() 1942 np->tx_change_owner = NULL; nv_init_tx() 1943 np->tx_end_flip = NULL; nv_init_tx() 1944 np->tx_stop = 0; nv_init_tx() 1946 for (i = 0; i < np->tx_ring_size; i++) { nv_init_tx() 1947 if (!nv_optimized(np)) { nv_init_tx() 1948 np->tx_ring.orig[i].flaglen = 0; nv_init_tx() 1949 np->tx_ring.orig[i].buf = 0; nv_init_tx() 1951 np->tx_ring.ex[i].flaglen = 0; nv_init_tx() 1952 np->tx_ring.ex[i].txvlan = 0; nv_init_tx() 1953 np->tx_ring.ex[i].bufhigh = 0; nv_init_tx() 1954 np->tx_ring.ex[i].buflow = 0; nv_init_tx() 1956 np->tx_skb[i].skb = NULL; nv_init_tx() 1957 np->tx_skb[i].dma = 0; nv_init_tx() 1958 np->tx_skb[i].dma_len = 0; nv_init_tx() 1959 np->tx_skb[i].dma_single = 0; nv_init_tx() 1960 np->tx_skb[i].first_tx_desc = NULL; nv_init_tx() 1961 np->tx_skb[i].next_tx_ctx = NULL; nv_init_tx() 1967 struct fe_priv *np = netdev_priv(dev); nv_init_ring() local 1972 if (!nv_optimized(np)) nv_init_ring() 1978 static void nv_unmap_txskb(struct fe_priv *np, struct nv_skb_map *tx_skb) nv_unmap_txskb() argument 1982 pci_unmap_single(np->pci_dev, tx_skb->dma, nv_unmap_txskb() 1986 pci_unmap_page(np->pci_dev, tx_skb->dma, nv_unmap_txskb() 1993 static int nv_release_txskb(struct fe_priv *np, struct nv_skb_map *tx_skb) nv_release_txskb() argument 1995 nv_unmap_txskb(np, tx_skb); nv_release_txskb() 2006 struct fe_priv *np = netdev_priv(dev); nv_drain_tx() local 2009 for (i = 0; i < np->tx_ring_size; i++) { nv_drain_tx() 2010 if (!nv_optimized(np)) { nv_drain_tx() 2011 np->tx_ring.orig[i].flaglen = 0; nv_drain_tx() 2012 np->tx_ring.orig[i].buf = 0; nv_drain_tx() 2014 np->tx_ring.ex[i].flaglen = 0; nv_drain_tx() 2015 np->tx_ring.ex[i].txvlan = 0; nv_drain_tx() 2016 np->tx_ring.ex[i].bufhigh = 0; nv_drain_tx() 2017 np->tx_ring.ex[i].buflow = 0; nv_drain_tx() 2019 if (nv_release_txskb(np, &np->tx_skb[i])) { nv_drain_tx() 2020 u64_stats_update_begin(&np->swstats_tx_syncp); nv_drain_tx() 2021 np->stat_tx_dropped++; nv_drain_tx() 2022 u64_stats_update_end(&np->swstats_tx_syncp); nv_drain_tx() 2024 np->tx_skb[i].dma = 0; nv_drain_tx() 2025 np->tx_skb[i].dma_len = 0; nv_drain_tx() 2026 np->tx_skb[i].dma_single = 0; nv_drain_tx() 2027 np->tx_skb[i].first_tx_desc = NULL; nv_drain_tx() 2028 np->tx_skb[i].next_tx_ctx = NULL; nv_drain_tx() 2030 np->tx_pkts_in_progress = 0; nv_drain_tx() 2031 np->tx_change_owner = NULL; nv_drain_tx() 2032 np->tx_end_flip = NULL; nv_drain_tx() 2037 struct fe_priv *np = netdev_priv(dev); nv_drain_rx() local 2040 for (i = 0; i < np->rx_ring_size; i++) { nv_drain_rx() 2041 if (!nv_optimized(np)) { nv_drain_rx() 2042 np->rx_ring.orig[i].flaglen = 0; nv_drain_rx() 2043 np->rx_ring.orig[i].buf = 0; nv_drain_rx() 2045 np->rx_ring.ex[i].flaglen = 0; nv_drain_rx() 2046 np->rx_ring.ex[i].txvlan = 0; nv_drain_rx() 2047 np->rx_ring.ex[i].bufhigh = 0; nv_drain_rx() 2048 np->rx_ring.ex[i].buflow = 0; nv_drain_rx() 2051 if (np->rx_skb[i].skb) { nv_drain_rx() 2052 pci_unmap_single(np->pci_dev, np->rx_skb[i].dma, nv_drain_rx() 2053 (skb_end_pointer(np->rx_skb[i].skb) - nv_drain_rx() 2054 np->rx_skb[i].skb->data), nv_drain_rx() 2056 dev_kfree_skb(np->rx_skb[i].skb); nv_drain_rx() 2057 np->rx_skb[i].skb = NULL; nv_drain_rx() 2068 static inline u32 nv_get_empty_tx_slots(struct fe_priv *np) nv_get_empty_tx_slots() argument 2070 return (u32)(np->tx_ring_size - ((np->tx_ring_size + (np->put_tx_ctx - np->get_tx_ctx)) % np->tx_ring_size)); nv_get_empty_tx_slots() 2085 * Caller has already gained np->lock. nv_legacybackoff_reseed() 2187 struct fe_priv *np = netdev_priv(dev); nv_start_xmit() local 2189 u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); nv_start_xmit() 2212 spin_lock_irqsave(&np->lock, flags); nv_start_xmit() 2213 empty_slots = nv_get_empty_tx_slots(np); nv_start_xmit() 2216 np->tx_stop = 1; nv_start_xmit() 2217 spin_unlock_irqrestore(&np->lock, flags); nv_start_xmit() 2220 spin_unlock_irqrestore(&np->lock, flags); nv_start_xmit() 2222 start_tx = put_tx = np->put_tx.orig; nv_start_xmit() 2227 prev_tx_ctx = np->put_tx_ctx; nv_start_xmit() 2229 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, nv_start_xmit() 2231 if (pci_dma_mapping_error(np->pci_dev, nv_start_xmit() 2232 np->put_tx_ctx->dma)) { nv_start_xmit() 2235 u64_stats_update_begin(&np->swstats_tx_syncp); nv_start_xmit() 2236 np->stat_tx_dropped++; nv_start_xmit() 2237 u64_stats_update_end(&np->swstats_tx_syncp); nv_start_xmit() 2240 np->put_tx_ctx->dma_len = bcnt; nv_start_xmit() 2241 np->put_tx_ctx->dma_single = 1; nv_start_xmit() 2242 put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma); nv_start_xmit() 2245 tx_flags = np->tx_flags; nv_start_xmit() 2248 if (unlikely(put_tx++ == np->last_tx.orig)) nv_start_xmit() 2249 put_tx = np->first_tx.orig; nv_start_xmit() 2250 if (unlikely(np->put_tx_ctx++ == np->last_tx_ctx)) nv_start_xmit() 2251 np->put_tx_ctx = np->first_tx_ctx; nv_start_xmit() 2262 prev_tx_ctx = np->put_tx_ctx; nv_start_xmit() 2264 start_tx_ctx = tmp_tx_ctx = np->put_tx_ctx; nv_start_xmit() 2267 np->put_tx_ctx->dma = skb_frag_dma_map( nv_start_xmit() 2268 &np->pci_dev->dev, nv_start_xmit() 2272 if (dma_mapping_error(&np->pci_dev->dev, np->put_tx_ctx->dma)) { nv_start_xmit() 2276 nv_unmap_txskb(np, start_tx_ctx); nv_start_xmit() 2277 if (unlikely(tmp_tx_ctx++ == np->last_tx_ctx)) nv_start_xmit() 2278 tmp_tx_ctx = np->first_tx_ctx; nv_start_xmit() 2279 } while (tmp_tx_ctx != np->put_tx_ctx); nv_start_xmit() 2281 np->put_tx_ctx = start_tx_ctx; nv_start_xmit() 2282 u64_stats_update_begin(&np->swstats_tx_syncp); nv_start_xmit() 2283 np->stat_tx_dropped++; nv_start_xmit() 2284 u64_stats_update_end(&np->swstats_tx_syncp); nv_start_xmit() 2288 np->put_tx_ctx->dma_len = bcnt; nv_start_xmit() 2289 np->put_tx_ctx->dma_single = 0; nv_start_xmit() 2290 put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma); nv_start_xmit() 2295 if (unlikely(put_tx++ == np->last_tx.orig)) nv_start_xmit() 2296 put_tx = np->first_tx.orig; nv_start_xmit() 2297 if (unlikely(np->put_tx_ctx++ == np->last_tx_ctx)) nv_start_xmit() 2298 np->put_tx_ctx = np->first_tx_ctx; nv_start_xmit() 2314 spin_lock_irqsave(&np->lock, flags); nv_start_xmit() 2319 netdev_sent_queue(np->dev, skb->len); nv_start_xmit() 2323 np->put_tx.orig = put_tx; nv_start_xmit() 2325 spin_unlock_irqrestore(&np->lock, flags); nv_start_xmit() 2327 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); nv_start_xmit() 2334 struct fe_priv *np = netdev_priv(dev); nv_start_xmit_optimized() local 2360 spin_lock_irqsave(&np->lock, flags); nv_start_xmit_optimized() 2361 empty_slots = nv_get_empty_tx_slots(np); nv_start_xmit_optimized() 2364 np->tx_stop = 1; nv_start_xmit_optimized() 2365 spin_unlock_irqrestore(&np->lock, flags); nv_start_xmit_optimized() 2368 spin_unlock_irqrestore(&np->lock, flags); nv_start_xmit_optimized() 2370 start_tx = put_tx = np->put_tx.ex; nv_start_xmit_optimized() 2371 start_tx_ctx = np->put_tx_ctx; nv_start_xmit_optimized() 2376 prev_tx_ctx = np->put_tx_ctx; nv_start_xmit_optimized() 2378 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, nv_start_xmit_optimized() 2380 if (pci_dma_mapping_error(np->pci_dev, nv_start_xmit_optimized() 2381 np->put_tx_ctx->dma)) { nv_start_xmit_optimized() 2384 u64_stats_update_begin(&np->swstats_tx_syncp); nv_start_xmit_optimized() 2385 np->stat_tx_dropped++; nv_start_xmit_optimized() 2386 u64_stats_update_end(&np->swstats_tx_syncp); nv_start_xmit_optimized() 2389 np->put_tx_ctx->dma_len = bcnt; nv_start_xmit_optimized() 2390 np->put_tx_ctx->dma_single = 1; nv_start_xmit_optimized() 2391 put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma)); nv_start_xmit_optimized() 2392 put_tx->buflow = cpu_to_le32(dma_low(np->put_tx_ctx->dma)); nv_start_xmit_optimized() 2398 if (unlikely(put_tx++ == np->last_tx.ex)) nv_start_xmit_optimized() 2399 put_tx = np->first_tx.ex; nv_start_xmit_optimized() 2400 if (unlikely(np->put_tx_ctx++ == np->last_tx_ctx)) nv_start_xmit_optimized() 2401 np->put_tx_ctx = np->first_tx_ctx; nv_start_xmit_optimized() 2412 prev_tx_ctx = np->put_tx_ctx; nv_start_xmit_optimized() 2415 start_tx_ctx = tmp_tx_ctx = np->put_tx_ctx; nv_start_xmit_optimized() 2416 np->put_tx_ctx->dma = skb_frag_dma_map( nv_start_xmit_optimized() 2417 &np->pci_dev->dev, nv_start_xmit_optimized() 2422 if (dma_mapping_error(&np->pci_dev->dev, np->put_tx_ctx->dma)) { nv_start_xmit_optimized() 2426 nv_unmap_txskb(np, start_tx_ctx); nv_start_xmit_optimized() 2427 if (unlikely(tmp_tx_ctx++ == np->last_tx_ctx)) nv_start_xmit_optimized() 2428 tmp_tx_ctx = np->first_tx_ctx; nv_start_xmit_optimized() 2429 } while (tmp_tx_ctx != np->put_tx_ctx); nv_start_xmit_optimized() 2431 np->put_tx_ctx = start_tx_ctx; nv_start_xmit_optimized() 2432 u64_stats_update_begin(&np->swstats_tx_syncp); nv_start_xmit_optimized() 2433 np->stat_tx_dropped++; nv_start_xmit_optimized() 2434 u64_stats_update_end(&np->swstats_tx_syncp); nv_start_xmit_optimized() 2437 np->put_tx_ctx->dma_len = bcnt; nv_start_xmit_optimized() 2438 np->put_tx_ctx->dma_single = 0; nv_start_xmit_optimized() 2439 put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma)); nv_start_xmit_optimized() 2440 put_tx->buflow = cpu_to_le32(dma_low(np->put_tx_ctx->dma)); nv_start_xmit_optimized() 2445 if (unlikely(put_tx++ == np->last_tx.ex)) nv_start_xmit_optimized() 2446 put_tx = np->first_tx.ex; nv_start_xmit_optimized() 2447 if (unlikely(np->put_tx_ctx++ == np->last_tx_ctx)) nv_start_xmit_optimized() 2448 np->put_tx_ctx = np->first_tx_ctx; nv_start_xmit_optimized() 2471 spin_lock_irqsave(&np->lock, flags); nv_start_xmit_optimized() 2473 if (np->tx_limit) { nv_start_xmit_optimized() 2479 if (np->tx_pkts_in_progress == NV_TX_LIMIT_COUNT) { nv_start_xmit_optimized() 2480 if (!np->tx_change_owner) nv_start_xmit_optimized() 2481 np->tx_change_owner = start_tx_ctx; nv_start_xmit_optimized() 2486 start_tx_ctx->next_tx_ctx = np->put_tx_ctx; nv_start_xmit_optimized() 2487 np->tx_end_flip = np->put_tx_ctx; nv_start_xmit_optimized() 2489 np->tx_pkts_in_progress++; nv_start_xmit_optimized() 2496 netdev_sent_queue(np->dev, skb->len); nv_start_xmit_optimized() 2500 np->put_tx.ex = put_tx; nv_start_xmit_optimized() 2502 spin_unlock_irqrestore(&np->lock, flags); nv_start_xmit_optimized() 2504 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); nv_start_xmit_optimized() 2510 struct fe_priv *np = netdev_priv(dev); nv_tx_flip_ownership() local 2512 np->tx_pkts_in_progress--; nv_tx_flip_ownership() 2513 if (np->tx_change_owner) { nv_tx_flip_ownership() 2514 np->tx_change_owner->first_tx_desc->flaglen |= nv_tx_flip_ownership() 2516 np->tx_pkts_in_progress++; nv_tx_flip_ownership() 2518 np->tx_change_owner = np->tx_change_owner->next_tx_ctx; nv_tx_flip_ownership() 2519 if (np->tx_change_owner == np->tx_end_flip) nv_tx_flip_ownership() 2520 np->tx_change_owner = NULL; nv_tx_flip_ownership() 2522 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); nv_tx_flip_ownership() 2529 * Caller must own np->lock. 2533 struct fe_priv *np = netdev_priv(dev); nv_tx_done() local 2536 struct ring_desc *orig_get_tx = np->get_tx.orig; nv_tx_done() 2539 while ((np->get_tx.orig != np->put_tx.orig) && nv_tx_done() 2540 !((flags = le32_to_cpu(np->get_tx.orig->flaglen)) & NV_TX_VALID) && nv_tx_done() 2543 nv_unmap_txskb(np, np->get_tx_ctx); nv_tx_done() 2545 if (np->desc_ver == DESC_VER_1) { nv_tx_done() 2552 u64_stats_update_begin(&np->swstats_tx_syncp); nv_tx_done() 2553 np->stat_tx_packets++; nv_tx_done() 2554 np->stat_tx_bytes += np->get_tx_ctx->skb->len; nv_tx_done() 2555 u64_stats_update_end(&np->swstats_tx_syncp); nv_tx_done() 2557 bytes_compl += np->get_tx_ctx->skb->len; nv_tx_done() 2558 dev_kfree_skb_any(np->get_tx_ctx->skb); nv_tx_done() 2559 np->get_tx_ctx->skb = NULL; nv_tx_done() 2569 u64_stats_update_begin(&np->swstats_tx_syncp); nv_tx_done() 2570 np->stat_tx_packets++; nv_tx_done() 2571 np->stat_tx_bytes += np->get_tx_ctx->skb->len; nv_tx_done() 2572 u64_stats_update_end(&np->swstats_tx_syncp); nv_tx_done() 2574 bytes_compl += np->get_tx_ctx->skb->len; nv_tx_done() 2575 dev_kfree_skb_any(np->get_tx_ctx->skb); nv_tx_done() 2576 np->get_tx_ctx->skb = NULL; nv_tx_done() 2580 if (unlikely(np->get_tx.orig++ == np->last_tx.orig)) nv_tx_done() 2581 np->get_tx.orig = np->first_tx.orig; nv_tx_done() 2582 if (unlikely(np->get_tx_ctx++ == np->last_tx_ctx)) nv_tx_done() 2583 np->get_tx_ctx = np->first_tx_ctx; nv_tx_done() 2586 netdev_completed_queue(np->dev, tx_work, bytes_compl); nv_tx_done() 2588 if (unlikely((np->tx_stop == 1) && (np->get_tx.orig != orig_get_tx))) { nv_tx_done() 2589 np->tx_stop = 0; nv_tx_done() 2597 struct fe_priv *np = netdev_priv(dev); nv_tx_done_optimized() local 2600 struct ring_desc_ex *orig_get_tx = np->get_tx.ex; nv_tx_done_optimized() 2603 while ((np->get_tx.ex != np->put_tx.ex) && nv_tx_done_optimized() 2604 !((flags = le32_to_cpu(np->get_tx.ex->flaglen)) & NV_TX2_VALID) && nv_tx_done_optimized() 2607 nv_unmap_txskb(np, np->get_tx_ctx); nv_tx_done_optimized() 2613 if (np->driver_data & DEV_HAS_GEAR_MODE) nv_tx_done_optimized() 2619 u64_stats_update_begin(&np->swstats_tx_syncp); nv_tx_done_optimized() 2620 np->stat_tx_packets++; nv_tx_done_optimized() 2621 np->stat_tx_bytes += np->get_tx_ctx->skb->len; nv_tx_done_optimized() 2622 u64_stats_update_end(&np->swstats_tx_syncp); nv_tx_done_optimized() 2625 bytes_cleaned += np->get_tx_ctx->skb->len; nv_tx_done_optimized() 2626 dev_kfree_skb_any(np->get_tx_ctx->skb); nv_tx_done_optimized() 2627 np->get_tx_ctx->skb = NULL; nv_tx_done_optimized() 2630 if (np->tx_limit) nv_tx_done_optimized() 2634 if (unlikely(np->get_tx.ex++ == np->last_tx.ex)) nv_tx_done_optimized() 2635 np->get_tx.ex = np->first_tx.ex; nv_tx_done_optimized() 2636 if (unlikely(np->get_tx_ctx++ == np->last_tx_ctx)) nv_tx_done_optimized() 2637 np->get_tx_ctx = np->first_tx_ctx; nv_tx_done_optimized() 2640 netdev_completed_queue(np->dev, tx_work, bytes_cleaned); nv_tx_done_optimized() 2642 if (unlikely((np->tx_stop == 1) && (np->get_tx.ex != orig_get_tx))) { nv_tx_done_optimized() 2643 np->tx_stop = 0; nv_tx_done_optimized() 2655 struct fe_priv *np = netdev_priv(dev); nv_tx_timeout() local 2661 if (np->msi_flags & NV_MSI_X_ENABLED) nv_tx_timeout() 2671 netdev_info(dev, "Ring at %lx\n", (unsigned long)np->ring_addr); nv_tx_timeout() 2673 for (i = 0; i <= np->register_size; i += 32) { nv_tx_timeout() 2684 for (i = 0; i < np->tx_ring_size; i += 4) { nv_tx_timeout() 2685 if (!nv_optimized(np)) { nv_tx_timeout() 2690 le32_to_cpu(np->tx_ring.orig[i].buf), nv_tx_timeout() 2691 le32_to_cpu(np->tx_ring.orig[i].flaglen), nv_tx_timeout() 2692 le32_to_cpu(np->tx_ring.orig[i+1].buf), nv_tx_timeout() 2693 le32_to_cpu(np->tx_ring.orig[i+1].flaglen), nv_tx_timeout() 2694 le32_to_cpu(np->tx_ring.orig[i+2].buf), nv_tx_timeout() 2695 le32_to_cpu(np->tx_ring.orig[i+2].flaglen), nv_tx_timeout() 2696 le32_to_cpu(np->tx_ring.orig[i+3].buf), nv_tx_timeout() 2697 le32_to_cpu(np->tx_ring.orig[i+3].flaglen)); nv_tx_timeout() 2705 le32_to_cpu(np->tx_ring.ex[i].bufhigh), nv_tx_timeout() 2706 le32_to_cpu(np->tx_ring.ex[i].buflow), nv_tx_timeout() 2707 le32_to_cpu(np->tx_ring.ex[i].flaglen), nv_tx_timeout() 2708 le32_to_cpu(np->tx_ring.ex[i+1].bufhigh), nv_tx_timeout() 2709 le32_to_cpu(np->tx_ring.ex[i+1].buflow), nv_tx_timeout() 2710 le32_to_cpu(np->tx_ring.ex[i+1].flaglen), nv_tx_timeout() 2711 le32_to_cpu(np->tx_ring.ex[i+2].bufhigh), nv_tx_timeout() 2712 le32_to_cpu(np->tx_ring.ex[i+2].buflow), nv_tx_timeout() 2713 le32_to_cpu(np->tx_ring.ex[i+2].flaglen), nv_tx_timeout() 2714 le32_to_cpu(np->tx_ring.ex[i+3].bufhigh), nv_tx_timeout() 2715 le32_to_cpu(np->tx_ring.ex[i+3].buflow), nv_tx_timeout() 2716 le32_to_cpu(np->tx_ring.ex[i+3].flaglen)); nv_tx_timeout() 2721 spin_lock_irq(&np->lock); nv_tx_timeout() 2727 saved_tx_limit = np->tx_limit; nv_tx_timeout() 2728 np->tx_limit = 0; /* prevent giving HW any limited pkts */ nv_tx_timeout() 2729 np->tx_stop = 0; /* prevent waking tx queue */ nv_tx_timeout() 2730 if (!nv_optimized(np)) nv_tx_timeout() 2731 nv_tx_done(dev, np->tx_ring_size); nv_tx_timeout() 2733 nv_tx_done_optimized(dev, np->tx_ring_size); nv_tx_timeout() 2736 if (np->tx_change_owner) nv_tx_timeout() 2737 put_tx.ex = np->tx_change_owner->first_tx_desc; nv_tx_timeout() 2739 put_tx = np->put_tx; nv_tx_timeout() 2746 np->get_tx = np->put_tx = put_tx; nv_tx_timeout() 2747 np->tx_limit = saved_tx_limit; nv_tx_timeout() 2752 spin_unlock_irq(&np->lock); nv_tx_timeout() 2800 struct fe_priv *np = netdev_priv(dev); nv_rx_process() local 2806 while ((np->get_rx.orig != np->put_rx.orig) && nv_rx_process() 2807 !((flags = le32_to_cpu(np->get_rx.orig->flaglen)) & NV_RX_AVAIL) && nv_rx_process() 2815 pci_unmap_single(np->pci_dev, np->get_rx_ctx->dma, nv_rx_process() 2816 np->get_rx_ctx->dma_len, nv_rx_process() 2818 skb = np->get_rx_ctx->skb; nv_rx_process() 2819 np->get_rx_ctx->skb = NULL; nv_rx_process() 2822 if (np->desc_ver == DESC_VER_1) { nv_rx_process() 2841 u64_stats_update_begin(&np->swstats_rx_syncp); nv_rx_process() 2842 np->stat_rx_missed_errors++; nv_rx_process() 2843 u64_stats_update_end(&np->swstats_rx_syncp); nv_rx_process() 2886 napi_gro_receive(&np->napi, skb); nv_rx_process() 2887 u64_stats_update_begin(&np->swstats_rx_syncp); nv_rx_process() 2888 np->stat_rx_packets++; nv_rx_process() 2889 np->stat_rx_bytes += len; nv_rx_process() 2890 u64_stats_update_end(&np->swstats_rx_syncp); nv_rx_process() 2892 if (unlikely(np->get_rx.orig++ == np->last_rx.orig)) nv_rx_process() 2893 np->get_rx.orig = np->first_rx.orig; nv_rx_process() 2894 if (unlikely(np->get_rx_ctx++ == np->last_rx_ctx)) nv_rx_process() 2895 np->get_rx_ctx = np->first_rx_ctx; nv_rx_process() 2905 struct fe_priv *np = netdev_priv(dev); nv_rx_process_optimized() local 2912 while ((np->get_rx.ex != np->put_rx.ex) && nv_rx_process_optimized() 2913 !((flags = le32_to_cpu(np->get_rx.ex->flaglen)) & NV_RX2_AVAIL) && nv_rx_process_optimized() 2921 pci_unmap_single(np->pci_dev, np->get_rx_ctx->dma, nv_rx_process_optimized() 2922 np->get_rx_ctx->dma_len, nv_rx_process_optimized() 2924 skb = np->get_rx_ctx->skb; nv_rx_process_optimized() 2925 np->get_rx_ctx->skb = NULL; nv_rx_process_optimized() 2959 vlanflags = le32_to_cpu(np->get_rx.ex->buflow); nv_rx_process_optimized() 2972 napi_gro_receive(&np->napi, skb); nv_rx_process_optimized() 2973 u64_stats_update_begin(&np->swstats_rx_syncp); nv_rx_process_optimized() 2974 np->stat_rx_packets++; nv_rx_process_optimized() 2975 np->stat_rx_bytes += len; nv_rx_process_optimized() 2976 u64_stats_update_end(&np->swstats_rx_syncp); nv_rx_process_optimized() 2981 if (unlikely(np->get_rx.ex++ == np->last_rx.ex)) nv_rx_process_optimized() 2982 np->get_rx.ex = np->first_rx.ex; nv_rx_process_optimized() 2983 if (unlikely(np->get_rx_ctx++ == np->last_rx_ctx)) nv_rx_process_optimized() 2984 np->get_rx_ctx = np->first_rx_ctx; nv_rx_process_optimized() 2994 struct fe_priv *np = netdev_priv(dev); set_bufsize() local 2997 np->rx_buf_sz = ETH_DATA_LEN + NV_RX_HEADERS; set_bufsize() 2999 np->rx_buf_sz = dev->mtu + NV_RX_HEADERS; set_bufsize() 3008 struct fe_priv *np = netdev_priv(dev); nv_change_mtu() local 3011 if (new_mtu < 64 || new_mtu > np->pkt_limit) nv_change_mtu() 3036 spin_lock(&np->lock); nv_change_mtu() 3045 if (!np->in_shutdown) nv_change_mtu() 3046 mod_timer(&np->oom_kick, jiffies + OOM_REFILL); nv_change_mtu() 3049 writel(np->rx_buf_sz, base + NvRegOffloadConfig); nv_change_mtu() 3051 writel(((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), nv_change_mtu() 3054 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); nv_change_mtu() 3059 spin_unlock(&np->lock); nv_change_mtu() 3087 struct fe_priv *np = netdev_priv(dev); nv_set_mac_address() local 3099 spin_lock_irq(&np->lock); nv_set_mac_address() 3109 spin_unlock_irq(&np->lock); nv_set_mac_address() 3124 struct fe_priv *np = netdev_priv(dev); nv_set_multicast() local 3171 spin_lock_irq(&np->lock); 3179 spin_unlock_irq(&np->lock); 3184 struct fe_priv *np = netdev_priv(dev); nv_update_pause() local 3187 np->pause_flags &= ~(NV_PAUSEFRAME_TX_ENABLE | NV_PAUSEFRAME_RX_ENABLE); nv_update_pause() 3189 if (np->pause_flags & NV_PAUSEFRAME_RX_CAPABLE) { nv_update_pause() 3193 np->pause_flags |= NV_PAUSEFRAME_RX_ENABLE; nv_update_pause() 3198 if (np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE) { nv_update_pause() 3202 if (np->driver_data & DEV_HAS_PAUSEFRAME_TX_V2) nv_update_pause() 3204 if (np->driver_data & DEV_HAS_PAUSEFRAME_TX_V3) { nv_update_pause() 3211 np->pause_flags |= NV_PAUSEFRAME_TX_ENABLE; nv_update_pause() 3221 struct fe_priv *np = netdev_priv(dev); nv_force_linkspeed() local 3226 np->linkspeed = NVREG_LINKSPEED_FORCE|speed; nv_force_linkspeed() 3227 np->duplex = duplex; nv_force_linkspeed() 3230 mii_status = mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); nv_force_linkspeed() 3232 np->gigabit = PHY_GIGABIT; nv_force_linkspeed() 3235 if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_10) nv_force_linkspeed() 3237 else if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_100) nv_force_linkspeed() 3239 else if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_1000) nv_force_linkspeed() 3246 if (np->duplex == 0) nv_force_linkspeed() 3248 if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_100) nv_force_linkspeed() 3250 else if ((np->linkspeed & NVREG_LINKSPEED_MASK) == nv_force_linkspeed() 3256 if ((np->linkspeed & NVREG_LINKSPEED_MASK) == nv_force_linkspeed() 3266 if (np->desc_ver == DESC_VER_1) { nv_force_linkspeed() 3269 if ((np->linkspeed & NVREG_LINKSPEED_MASK) == nv_force_linkspeed() 3277 writel(NVREG_MISC1_FORCE | (np->duplex ? 0 : NVREG_MISC1_HD), nv_force_linkspeed() 3280 writel(np->linkspeed, base + NvRegLinkSpeed); nv_force_linkspeed() 3299 struct fe_priv *np = netdev_priv(dev); nv_update_linkspeed() local 3304 int newls = np->linkspeed; nv_update_linkspeed() 3305 int newdup = np->duplex; nv_update_linkspeed() 3316 bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); nv_update_linkspeed() 3329 mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); nv_update_linkspeed() 3330 mii_status = mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); nv_update_linkspeed() 3339 if (np->autoneg == 0) { nv_update_linkspeed() 3340 if (np->fixed_mode & LPA_100FULL) { nv_update_linkspeed() 3343 } else if (np->fixed_mode & LPA_100HALF) { nv_update_linkspeed() 3346 } else if (np->fixed_mode & LPA_10FULL) { nv_update_linkspeed() 3365 adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); nv_update_linkspeed() 3366 lpa = mii_rw(dev, np->phyaddr, MII_LPA, MII_READ); nv_update_linkspeed() 3369 if (np->gigabit == PHY_GIGABIT) { nv_update_linkspeed() 3370 control_1000 = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ); nv_update_linkspeed() 3371 status_1000 = mii_rw(dev, np->phyaddr, MII_STAT1000, MII_READ); nv_update_linkspeed() 3401 if (np->duplex == newdup && np->linkspeed == newls) nv_update_linkspeed() 3404 np->duplex = newdup; nv_update_linkspeed() 3405 np->linkspeed = newls; nv_update_linkspeed() 3417 if (np->gigabit == PHY_GIGABIT) { nv_update_linkspeed() 3420 if (((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_10) || nv_update_linkspeed() 3421 ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_100)) nv_update_linkspeed() 3423 else if ((np->linkspeed & 0xFFF) == NVREG_LINKSPEED_1000) nv_update_linkspeed() 3430 if (np->duplex == 0) nv_update_linkspeed() 3432 if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_100) nv_update_linkspeed() 3434 else if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_1000) nv_update_linkspeed() 3438 phy_exp = mii_rw(dev, np->phyaddr, MII_EXPANSION, MII_READ) & EXPANSION_NWAY; /* autoneg capable */ nv_update_linkspeed() 3440 if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_1000) { nv_update_linkspeed() 3443 if (!phy_exp && !np->duplex && (np->driver_data & DEV_HAS_COLLISION_FIX)) { nv_update_linkspeed() 3444 if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_10) nv_update_linkspeed() 3453 if (!phy_exp && !np->duplex && (np->driver_data & DEV_HAS_COLLISION_FIX)) nv_update_linkspeed() 3460 if (np->desc_ver == DESC_VER_1) { nv_update_linkspeed() 3463 if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_1000) nv_update_linkspeed() 3470 writel(NVREG_MISC1_FORCE | (np->duplex ? 0 : NVREG_MISC1_HD), nv_update_linkspeed() 3473 writel(np->linkspeed, base + NvRegLinkSpeed); nv_update_linkspeed() 3478 if (netif_running(dev) && (np->duplex != 0)) { nv_update_linkspeed() 3479 if (np->autoneg && np->pause_flags & NV_PAUSEFRAME_AUTONEG) { nv_update_linkspeed() 3487 if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) nv_update_linkspeed() 3498 if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) nv_update_linkspeed() 3506 pause_flags = np->pause_flags; nv_update_linkspeed() 3550 static void nv_msi_workaround(struct fe_priv *np) nv_msi_workaround() argument 3556 if (np->msi_flags & NV_MSI_ENABLED) { nv_msi_workaround() 3557 u8 __iomem *base = np->base; nv_msi_workaround() 3566 struct fe_priv *np = netdev_priv(dev); nv_change_interrupt_mode() local 3571 np->quiet_count = 0; nv_change_interrupt_mode() 3572 if (np->irqmask != NVREG_IRQMASK_CPU) { nv_change_interrupt_mode() 3573 np->irqmask = NVREG_IRQMASK_CPU; nv_change_interrupt_mode() 3577 if (np->quiet_count < NV_DYNAMIC_MAX_QUIET_COUNT) { nv_change_interrupt_mode() 3578 np->quiet_count++; nv_change_interrupt_mode() 3582 if (np->irqmask != NVREG_IRQMASK_THROUGHPUT) { nv_change_interrupt_mode() 3583 np->irqmask = NVREG_IRQMASK_THROUGHPUT; nv_change_interrupt_mode() 3595 struct fe_priv *np = netdev_priv(dev); nv_nic_irq() local 3598 if (!(np->msi_flags & NV_MSI_X_ENABLED)) { nv_nic_irq() 3599 np->events = readl(base + NvRegIrqStatus); nv_nic_irq() 3600 writel(np->events, base + NvRegIrqStatus); nv_nic_irq() 3602 np->events = readl(base + NvRegMSIXIrqStatus); nv_nic_irq() 3603 writel(np->events, base + NvRegMSIXIrqStatus); nv_nic_irq() 3605 if (!(np->events & np->irqmask)) nv_nic_irq() 3608 nv_msi_workaround(np); nv_nic_irq() 3610 if (napi_schedule_prep(&np->napi)) { nv_nic_irq() 3615 __napi_schedule(&np->napi); nv_nic_irq() 3628 struct fe_priv *np = netdev_priv(dev); nv_nic_irq_optimized() local 3631 if (!(np->msi_flags & NV_MSI_X_ENABLED)) { nv_nic_irq_optimized() 3632 np->events = readl(base + NvRegIrqStatus); nv_nic_irq_optimized() 3633 writel(np->events, base + NvRegIrqStatus); nv_nic_irq_optimized() 3635 np->events = readl(base + NvRegMSIXIrqStatus); nv_nic_irq_optimized() 3636 writel(np->events, base + NvRegMSIXIrqStatus); nv_nic_irq_optimized() 3638 if (!(np->events & np->irqmask)) nv_nic_irq_optimized() 3641 nv_msi_workaround(np); nv_nic_irq_optimized() 3643 if (napi_schedule_prep(&np->napi)) { nv_nic_irq_optimized() 3648 __napi_schedule(&np->napi); nv_nic_irq_optimized() 3657 struct fe_priv *np = netdev_priv(dev); nv_nic_irq_tx() local 3667 if (!(events & np->irqmask)) nv_nic_irq_tx() 3670 spin_lock_irqsave(&np->lock, flags); nv_nic_irq_tx() 3672 spin_unlock_irqrestore(&np->lock, flags); nv_nic_irq_tx() 3675 spin_lock_irqsave(&np->lock, flags); nv_nic_irq_tx() 3680 if (!np->in_shutdown) { nv_nic_irq_tx() 3681 np->nic_poll_irq |= NVREG_IRQ_TX_ALL; nv_nic_irq_tx() 3682 mod_timer(&np->nic_poll, jiffies + POLL_WAIT); nv_nic_irq_tx() 3684 spin_unlock_irqrestore(&np->lock, flags); nv_nic_irq_tx() 3697 struct fe_priv *np = container_of(napi, struct fe_priv, napi); nv_napi_poll() local 3698 struct net_device *dev = np->dev; nv_napi_poll() 3705 if (!nv_optimized(np)) { nv_napi_poll() 3706 spin_lock_irqsave(&np->lock, flags); nv_napi_poll() 3707 tx_work += nv_tx_done(dev, np->tx_ring_size); nv_napi_poll() 3708 spin_unlock_irqrestore(&np->lock, flags); nv_napi_poll() 3713 spin_lock_irqsave(&np->lock, flags); nv_napi_poll() 3714 tx_work += nv_tx_done_optimized(dev, np->tx_ring_size); nv_napi_poll() 3715 spin_unlock_irqrestore(&np->lock, flags); nv_napi_poll() 3725 spin_lock_irqsave(&np->lock, flags); nv_napi_poll() 3726 if (!np->in_shutdown) nv_napi_poll() 3727 mod_timer(&np->oom_kick, jiffies + OOM_REFILL); nv_napi_poll() 3728 spin_unlock_irqrestore(&np->lock, flags); nv_napi_poll() 3733 if (unlikely(np->events & NVREG_IRQ_LINK)) { nv_napi_poll() 3734 spin_lock_irqsave(&np->lock, flags); nv_napi_poll() 3736 spin_unlock_irqrestore(&np->lock, flags); nv_napi_poll() 3738 if (unlikely(np->need_linktimer && time_after(jiffies, np->link_timeout))) { nv_napi_poll() 3739 spin_lock_irqsave(&np->lock, flags); nv_napi_poll() 3741 spin_unlock_irqrestore(&np->lock, flags); nv_napi_poll() 3742 np->link_timeout = jiffies + LINK_TIMEOUT; nv_napi_poll() 3744 if (unlikely(np->events & NVREG_IRQ_RECOVER_ERROR)) { nv_napi_poll() 3745 spin_lock_irqsave(&np->lock, flags); nv_napi_poll() 3746 if (!np->in_shutdown) { nv_napi_poll() 3747 np->nic_poll_irq = np->irqmask; nv_napi_poll() 3748 np->recover_error = 1; nv_napi_poll() 3749 mod_timer(&np->nic_poll, jiffies + POLL_WAIT); nv_napi_poll() 3751 spin_unlock_irqrestore(&np->lock, flags); nv_napi_poll() 3761 writel(np->irqmask, base + NvRegIrqMask); nv_napi_poll() 3769 struct fe_priv *np = netdev_priv(dev); nv_nic_irq_rx() local 3779 if (!(events & np->irqmask)) nv_nic_irq_rx() 3784 spin_lock_irqsave(&np->lock, flags); nv_nic_irq_rx() 3785 if (!np->in_shutdown) nv_nic_irq_rx() 3786 mod_timer(&np->oom_kick, jiffies + OOM_REFILL); nv_nic_irq_rx() 3787 spin_unlock_irqrestore(&np->lock, flags); nv_nic_irq_rx() 3792 spin_lock_irqsave(&np->lock, flags); nv_nic_irq_rx() 3797 if (!np->in_shutdown) { nv_nic_irq_rx() 3798 np->nic_poll_irq |= NVREG_IRQ_RX_ALL; nv_nic_irq_rx() 3799 mod_timer(&np->nic_poll, jiffies + POLL_WAIT); nv_nic_irq_rx() 3801 spin_unlock_irqrestore(&np->lock, flags); nv_nic_irq_rx() 3814 struct fe_priv *np = netdev_priv(dev); nv_nic_irq_other() local 3824 if (!(events & np->irqmask)) nv_nic_irq_other() 3828 spin_lock_irqsave(&np->lock, flags); nv_nic_irq_other() 3830 spin_unlock_irqrestore(&np->lock, flags); nv_nic_irq_other() 3833 spin_lock_irqsave(&np->lock, flags); nv_nic_irq_other() 3835 spin_unlock_irqrestore(&np->lock, flags); nv_nic_irq_other() 3837 if (np->need_linktimer && time_after(jiffies, np->link_timeout)) { nv_nic_irq_other() 3838 spin_lock_irqsave(&np->lock, flags); nv_nic_irq_other() 3840 spin_unlock_irqrestore(&np->lock, flags); nv_nic_irq_other() 3841 np->link_timeout = jiffies + LINK_TIMEOUT; nv_nic_irq_other() 3844 spin_lock_irqsave(&np->lock, flags); nv_nic_irq_other() 3849 if (!np->in_shutdown) { nv_nic_irq_other() 3850 np->nic_poll_irq |= NVREG_IRQ_OTHER; nv_nic_irq_other() 3851 np->recover_error = 1; nv_nic_irq_other() 3852 mod_timer(&np->nic_poll, jiffies + POLL_WAIT); nv_nic_irq_other() 3854 spin_unlock_irqrestore(&np->lock, flags); nv_nic_irq_other() 3858 spin_lock_irqsave(&np->lock, flags); nv_nic_irq_other() 3863 if (!np->in_shutdown) { nv_nic_irq_other() 3864 np->nic_poll_irq |= NVREG_IRQ_OTHER; nv_nic_irq_other() 3865 mod_timer(&np->nic_poll, jiffies + POLL_WAIT); nv_nic_irq_other() 3867 spin_unlock_irqrestore(&np->lock, flags); nv_nic_irq_other() 3881 struct fe_priv *np = netdev_priv(dev); nv_nic_irq_test() local 3885 if (!(np->msi_flags & NV_MSI_X_ENABLED)) { nv_nic_irq_test() 3896 nv_msi_workaround(np); nv_nic_irq_test() 3898 spin_lock(&np->lock); nv_nic_irq_test() 3899 np->intr_test = 1; nv_nic_irq_test() 3900 spin_unlock(&np->lock); nv_nic_irq_test() 3931 struct fe_priv *np = get_nvpriv(dev); nv_request_irq() local 3940 if (nv_optimized(np)) nv_request_irq() 3946 if (np->msi_flags & NV_MSI_X_CAPABLE) { nv_request_irq() 3947 for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) nv_request_irq() 3948 np->msi_x_entry[i].entry = i; nv_request_irq() 3949 ret = pci_enable_msix_range(np->pci_dev, nv_request_irq() 3950 np->msi_x_entry, nv_request_irq() 3951 np->msi_flags & NV_MSI_X_VECTORS_MASK, nv_request_irq() 3952 np->msi_flags & NV_MSI_X_VECTORS_MASK); nv_request_irq() 3954 np->msi_flags |= NV_MSI_X_ENABLED; nv_request_irq() 3957 sprintf(np->name_rx, "%s-rx", dev->name); nv_request_irq() 3958 ret = request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, nv_request_irq() 3959 nv_nic_irq_rx, IRQF_SHARED, np->name_rx, dev); nv_request_irq() 3964 pci_disable_msix(np->pci_dev); nv_request_irq() 3965 np->msi_flags &= ~NV_MSI_X_ENABLED; nv_request_irq() 3969 sprintf(np->name_tx, "%s-tx", dev->name); nv_request_irq() 3970 ret = request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, nv_request_irq() 3971 nv_nic_irq_tx, IRQF_SHARED, np->name_tx, dev); nv_request_irq() 3976 pci_disable_msix(np->pci_dev); nv_request_irq() 3977 np->msi_flags &= ~NV_MSI_X_ENABLED; nv_request_irq() 3981 sprintf(np->name_other, "%s-other", dev->name); nv_request_irq() 3982 ret = request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, nv_request_irq() 3983 nv_nic_irq_other, IRQF_SHARED, np->name_other, dev); nv_request_irq() 3988 pci_disable_msix(np->pci_dev); nv_request_irq() 3989 np->msi_flags &= ~NV_MSI_X_ENABLED; nv_request_irq() 4000 ret = request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, nv_request_irq() 4006 pci_disable_msix(np->pci_dev); nv_request_irq() 4007 np->msi_flags &= ~NV_MSI_X_ENABLED; nv_request_irq() 4019 if (np->msi_flags & NV_MSI_CAPABLE) { nv_request_irq() 4020 ret = pci_enable_msi(np->pci_dev); nv_request_irq() 4022 np->msi_flags |= NV_MSI_ENABLED; nv_request_irq() 4023 ret = request_irq(np->pci_dev->irq, handler, IRQF_SHARED, dev->name, dev); nv_request_irq() 4027 pci_disable_msi(np->pci_dev); nv_request_irq() 4028 np->msi_flags &= ~NV_MSI_ENABLED; nv_request_irq() 4042 if (request_irq(np->pci_dev->irq, handler, IRQF_SHARED, dev->name, dev) != 0) nv_request_irq() 4047 free_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, dev); nv_request_irq() 4049 free_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, dev); nv_request_irq() 4056 struct fe_priv *np = get_nvpriv(dev); nv_free_irq() local 4059 if (np->msi_flags & NV_MSI_X_ENABLED) { nv_free_irq() 4060 for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) nv_free_irq() 4061 free_irq(np->msi_x_entry[i].vector, dev); nv_free_irq() 4062 pci_disable_msix(np->pci_dev); nv_free_irq() 4063 np->msi_flags &= ~NV_MSI_X_ENABLED; nv_free_irq() 4065 free_irq(np->pci_dev->irq, dev); nv_free_irq() 4066 if (np->msi_flags & NV_MSI_ENABLED) { nv_free_irq() 4067 pci_disable_msi(np->pci_dev); nv_free_irq() 4068 np->msi_flags &= ~NV_MSI_ENABLED; nv_free_irq() 4076 struct fe_priv *np = netdev_priv(dev); nv_do_nic_poll() local 4089 if (np->msi_flags & NV_MSI_X_ENABLED) nv_do_nic_poll() 4090 irq = np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector; nv_do_nic_poll() 4092 irq = np->pci_dev->irq; nv_do_nic_poll() 4093 mask = np->irqmask; nv_do_nic_poll() 4095 if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { nv_do_nic_poll() 4096 irq = np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector; nv_do_nic_poll() 4099 if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) { nv_do_nic_poll() 4100 irq = np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector; nv_do_nic_poll() 4103 if (np->nic_poll_irq & NVREG_IRQ_OTHER) { nv_do_nic_poll() 4104 irq = np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector; nv_do_nic_poll() 4112 if (np->recover_error) { nv_do_nic_poll() 4113 np->recover_error = 0; nv_do_nic_poll() 4118 spin_lock(&np->lock); nv_do_nic_poll() 4121 if (np->driver_data & DEV_HAS_POWER_CNTRL) nv_do_nic_poll() 4129 if (!np->in_shutdown) nv_do_nic_poll() 4130 mod_timer(&np->oom_kick, jiffies + OOM_REFILL); nv_do_nic_poll() 4133 writel(np->rx_buf_sz, base + NvRegOffloadConfig); nv_do_nic_poll() 4135 writel(((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), nv_do_nic_poll() 4138 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); nv_do_nic_poll() 4141 if (!(np->msi_flags & NV_MSI_X_ENABLED)) nv_do_nic_poll() 4148 spin_unlock(&np->lock); nv_do_nic_poll() 4158 np->nic_poll_irq = 0; nv_do_nic_poll() 4159 if (nv_optimized(np)) nv_do_nic_poll() 4164 if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { nv_do_nic_poll() 4165 np->nic_poll_irq &= ~NVREG_IRQ_RX_ALL; nv_do_nic_poll() 4168 if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) { nv_do_nic_poll() 4169 np->nic_poll_irq &= ~NVREG_IRQ_TX_ALL; nv_do_nic_poll() 4172 if (np->nic_poll_irq & NVREG_IRQ_OTHER) { nv_do_nic_poll() 4173 np->nic_poll_irq &= ~NVREG_IRQ_OTHER; nv_do_nic_poll() 4193 struct fe_priv *np = netdev_priv(dev); netdev_priv() local 4197 if (spin_trylock(&np->hwstats_lock)) { netdev_priv() 4199 spin_unlock(&np->hwstats_lock); netdev_priv() 4202 if (!np->in_shutdown) netdev_priv() 4203 mod_timer(&np->stats_poll, netdev_priv() 4209 struct fe_priv *np = netdev_priv(dev); nv_get_drvinfo() local 4212 strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); nv_get_drvinfo() 4217 struct fe_priv *np = netdev_priv(dev); nv_get_wol() local 4220 spin_lock_irq(&np->lock); nv_get_wol() 4221 if (np->wolenabled) nv_get_wol() 4223 spin_unlock_irq(&np->lock); nv_get_wol() 4228 struct fe_priv *np = netdev_priv(dev); nv_set_wol() local 4233 np->wolenabled = 0; nv_set_wol() 4235 np->wolenabled = 1; nv_set_wol() 4239 spin_lock_irq(&np->lock); nv_set_wol() 4241 spin_unlock_irq(&np->lock); nv_set_wol() 4243 device_set_wakeup_enable(&np->pci_dev->dev, np->wolenabled); nv_set_wol() 4249 struct fe_priv *np = netdev_priv(dev); nv_get_settings() local 4253 spin_lock_irq(&np->lock); nv_get_settings() 4268 switch (np->linkspeed & (NVREG_LINKSPEED_MASK)) { nv_get_settings() 4283 if (np->duplex) nv_get_settings() 4290 ecmd->autoneg = np->autoneg; nv_get_settings() 4293 if (np->autoneg) { nv_get_settings() 4295 adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); nv_get_settings() 4304 if (np->gigabit == PHY_GIGABIT) { nv_get_settings() 4305 adv = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ); nv_get_settings() 4314 if (np->gigabit == PHY_GIGABIT) nv_get_settings() 4317 ecmd->phy_address = np->phyaddr; nv_get_settings() 4321 spin_unlock_irq(&np->lock); nv_get_settings() 4327 struct fe_priv *np = netdev_priv(dev); nv_set_settings() local 4334 if (ecmd->phy_address != np->phyaddr) { nv_set_settings() 4344 if (np->gigabit == PHY_GIGABIT) nv_set_settings() 4370 spin_lock_irqsave(&np->lock, flags); nv_set_settings() 4381 spin_unlock_irqrestore(&np->lock, flags); nv_set_settings() 4389 np->autoneg = 1; nv_set_settings() 4392 adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); nv_set_settings() 4402 if (np->pause_flags & NV_PAUSEFRAME_RX_REQ) /* for rx we set both advertisements but disable tx pause */ nv_set_settings() 4404 if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) nv_set_settings() 4406 mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv); nv_set_settings() 4408 if (np->gigabit == PHY_GIGABIT) { nv_set_settings() 4409 adv = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ); nv_set_settings() 4413 mii_rw(dev, np->phyaddr, MII_CTRL1000, adv); nv_set_settings() 4418 bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); nv_set_settings() 4419 if (np->phy_model == PHY_MODEL_MARVELL_E3016) { nv_set_settings() 4429 mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); nv_set_settings() 4434 np->autoneg = 0; nv_set_settings() 4436 adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); nv_set_settings() 4446 np->pause_flags &= ~(NV_PAUSEFRAME_AUTONEG|NV_PAUSEFRAME_RX_ENABLE|NV_PAUSEFRAME_TX_ENABLE); nv_set_settings() 4447 if (np->pause_flags & NV_PAUSEFRAME_RX_REQ) {/* for rx we set both advertisements but disable tx pause */ nv_set_settings() 4449 np->pause_flags |= NV_PAUSEFRAME_RX_ENABLE; nv_set_settings() 4451 if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) { nv_set_settings() 4453 np->pause_flags |= NV_PAUSEFRAME_TX_ENABLE; nv_set_settings() 4455 mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv); nv_set_settings() 4456 np->fixed_mode = adv; nv_set_settings() 4458 if (np->gigabit == PHY_GIGABIT) { nv_set_settings() 4459 adv = mii_rw(dev, np->phyaddr, MII_CTRL1000, MII_READ); nv_set_settings() 4461 mii_rw(dev, np->phyaddr, MII_CTRL1000, adv); nv_set_settings() 4464 bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); nv_set_settings() 4466 if (np->fixed_mode & (ADVERTISE_10FULL|ADVERTISE_100FULL)) nv_set_settings() 4468 if (np->fixed_mode & (ADVERTISE_100HALF|ADVERTISE_100FULL)) nv_set_settings() 4470 if (np->phy_oui == PHY_OUI_MARVELL) { nv_set_settings() 4477 mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); nv_set_settings() 4498 struct fe_priv *np = netdev_priv(dev); nv_get_regs_len() local 4499 return np->register_size; nv_get_regs_len() 4504 struct fe_priv *np = netdev_priv(dev); nv_get_regs() local 4510 spin_lock_irq(&np->lock); nv_get_regs() 4511 for (i = 0; i < np->register_size/sizeof(u32); i++) nv_get_regs() 4513 spin_unlock_irq(&np->lock); nv_get_regs() 4518 struct fe_priv *np = netdev_priv(dev); nv_nway_reset() local 4521 if (np->autoneg) { nv_nway_reset() 4529 spin_lock(&np->lock); nv_nway_reset() 4532 spin_unlock(&np->lock); nv_nway_reset() 4538 bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); nv_nway_reset() 4539 if (np->phy_model == PHY_MODEL_MARVELL_E3016) { nv_nway_reset() 4548 mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); nv_nway_reset() 4565 struct fe_priv *np = netdev_priv(dev); nv_get_ringparam() local 4567 ring->rx_max_pending = (np->desc_ver == DESC_VER_1) ? RING_MAX_DESC_VER_1 : RING_MAX_DESC_VER_2_3; nv_get_ringparam() 4568 ring->tx_max_pending = (np->desc_ver == DESC_VER_1) ? RING_MAX_DESC_VER_1 : RING_MAX_DESC_VER_2_3; nv_get_ringparam() 4570 ring->rx_pending = np->rx_ring_size; nv_get_ringparam() 4571 ring->tx_pending = np->tx_ring_size; nv_get_ringparam() 4576 struct fe_priv *np = netdev_priv(dev); nv_set_ringparam() local 4585 (np->desc_ver == DESC_VER_1 && nv_set_ringparam() 4588 (np->desc_ver != DESC_VER_1 && nv_set_ringparam() 4595 if (!nv_optimized(np)) { nv_set_ringparam() 4596 rxtx_ring = pci_alloc_consistent(np->pci_dev, nv_set_ringparam() 4600 rxtx_ring = pci_alloc_consistent(np->pci_dev, nv_set_ringparam() 4608 if (!nv_optimized(np)) { nv_set_ringparam() 4610 pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (ring->rx_pending + ring->tx_pending), nv_set_ringparam() 4614 pci_free_consistent(np->pci_dev, sizeof(struct ring_desc_ex) * (ring->rx_pending + ring->tx_pending), nv_set_ringparam() 4628 spin_lock(&np->lock); nv_set_ringparam() 4639 np->rx_ring_size = ring->rx_pending; nv_set_ringparam() 4640 np->tx_ring_size = ring->tx_pending; nv_set_ringparam() 4642 if (!nv_optimized(np)) { nv_set_ringparam() 4643 np->rx_ring.orig = (struct ring_desc *)rxtx_ring; nv_set_ringparam() 4644 np->tx_ring.orig = &np->rx_ring.orig[np->rx_ring_size]; nv_set_ringparam() 4646 np->rx_ring.ex = (struct ring_desc_ex *)rxtx_ring; nv_set_ringparam() 4647 np->tx_ring.ex = &np->rx_ring.ex[np->rx_ring_size]; nv_set_ringparam() 4649 np->rx_skb = (struct nv_skb_map *)rx_skbuff; nv_set_ringparam() 4650 np->tx_skb = (struct nv_skb_map *)tx_skbuff; nv_set_ringparam() 4651 np->ring_addr = ring_addr; nv_set_ringparam() 4653 memset(np->rx_skb, 0, sizeof(struct nv_skb_map) * np->rx_ring_size); nv_set_ringparam() 4654 memset(np->tx_skb, 0, sizeof(struct nv_skb_map) * np->tx_ring_size); nv_set_ringparam() 4660 if (!np->in_shutdown) nv_set_ringparam() 4661 mod_timer(&np->oom_kick, jiffies + OOM_REFILL); nv_set_ringparam() 4665 writel(np->rx_buf_sz, base + NvRegOffloadConfig); nv_set_ringparam() 4667 writel(((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), nv_set_ringparam() 4670 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); nv_set_ringparam() 4675 spin_unlock(&np->lock); nv_set_ringparam() 4688 struct fe_priv *np = netdev_priv(dev); nv_get_pauseparam() local 4690 pause->autoneg = (np->pause_flags & NV_PAUSEFRAME_AUTONEG) != 0; nv_get_pauseparam() 4691 pause->rx_pause = (np->pause_flags & NV_PAUSEFRAME_RX_ENABLE) != 0; nv_get_pauseparam() 4692 pause->tx_pause = (np->pause_flags & NV_PAUSEFRAME_TX_ENABLE) != 0; nv_get_pauseparam() 4697 struct fe_priv *np = netdev_priv(dev); nv_set_pauseparam() local 4700 if ((!np->autoneg && np->duplex == 0) || nv_set_pauseparam() 4701 (np->autoneg && !pause->autoneg && np->duplex == 0)) { nv_set_pauseparam() 4705 if (pause->tx_pause && !(np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE)) { nv_set_pauseparam() 4715 spin_lock(&np->lock); nv_set_pauseparam() 4718 spin_unlock(&np->lock); nv_set_pauseparam() 4723 np->pause_flags &= ~(NV_PAUSEFRAME_RX_REQ|NV_PAUSEFRAME_TX_REQ); nv_set_pauseparam() 4725 np->pause_flags |= NV_PAUSEFRAME_RX_REQ; nv_set_pauseparam() 4727 np->pause_flags |= NV_PAUSEFRAME_TX_REQ; nv_set_pauseparam() 4729 if (np->autoneg && pause->autoneg) { nv_set_pauseparam() 4730 np->pause_flags |= NV_PAUSEFRAME_AUTONEG; nv_set_pauseparam() 4732 adv = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); nv_set_pauseparam() 4734 if (np->pause_flags & NV_PAUSEFRAME_RX_REQ) /* for rx we set both advertisements but disable tx pause */ nv_set_pauseparam() 4736 if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) nv_set_pauseparam() 4738 mii_rw(dev, np->phyaddr, MII_ADVERTISE, adv); nv_set_pauseparam() 4742 bmcr = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); nv_set_pauseparam() 4744 mii_rw(dev, np->phyaddr, MII_BMCR, bmcr); nv_set_pauseparam() 4746 np->pause_flags &= ~(NV_PAUSEFRAME_AUTONEG|NV_PAUSEFRAME_RX_ENABLE|NV_PAUSEFRAME_TX_ENABLE); nv_set_pauseparam() 4748 np->pause_flags |= NV_PAUSEFRAME_RX_ENABLE; nv_set_pauseparam() 4750 np->pause_flags |= NV_PAUSEFRAME_TX_ENABLE; nv_set_pauseparam() 4755 nv_update_pause(dev, np->pause_flags); nv_set_pauseparam() 4767 struct fe_priv *np = netdev_priv(dev); nv_set_loopback() local 4772 spin_lock_irqsave(&np->lock, flags); nv_set_loopback() 4773 miicontrol = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); nv_set_loopback() 4776 spin_unlock_irqrestore(&np->lock, flags); nv_set_loopback() 4783 err = mii_rw(dev, np->phyaddr, MII_BMCR, miicontrol); nv_set_loopback() 4786 spin_unlock_irqrestore(&np->lock, flags); nv_set_loopback() 4796 spin_unlock_irqrestore(&np->lock, flags); nv_set_loopback() 4802 spin_unlock_irqrestore(&np->lock, flags); nv_set_loopback() 4808 spin_unlock_irqrestore(&np->lock, flags); nv_set_loopback() 4813 spin_lock_irqsave(&np->lock, flags); nv_set_loopback() 4815 spin_unlock_irqrestore(&np->lock, flags); nv_set_loopback() 4832 struct fe_priv *np = get_nvpriv(dev); nv_vlan_mode() local 4834 spin_lock_irq(&np->lock); nv_vlan_mode() 4837 np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP; nv_vlan_mode() 4839 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP; nv_vlan_mode() 4842 np->txrxctl_bits |= NVREG_TXRXCTL_VLANINS; nv_vlan_mode() 4844 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS; nv_vlan_mode() 4846 writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); nv_vlan_mode() 4848 spin_unlock_irq(&np->lock); nv_vlan_mode() 4853 struct fe_priv *np = netdev_priv(dev); nv_set_features() local 4865 spin_lock_irq(&np->lock); nv_set_features() 4868 np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; nv_set_features() 4870 np->txrxctl_bits &= ~NVREG_TXRXCTL_RXCHECK; nv_set_features() 4873 writel(np->txrxctl_bits, base + NvRegTxRxControl); nv_set_features() 4875 spin_unlock_irq(&np->lock); nv_set_features() 4886 struct fe_priv *np = netdev_priv(dev); nv_get_sset_count() local 4890 if (np->driver_data & DEV_HAS_TEST_EXTENDED) nv_get_sset_count() 4895 if (np->driver_data & DEV_HAS_STATISTICS_V3) nv_get_sset_count() 4897 else if (np->driver_data & DEV_HAS_STATISTICS_V2) nv_get_sset_count() 4899 else if (np->driver_data & DEV_HAS_STATISTICS_V1) nv_get_sset_count() 4913 struct fe_priv *np = netdev_priv(dev); netdev_priv() local 4915 spin_lock_bh(&np->hwstats_lock); netdev_priv() 4917 memcpy(buffer, &np->estats, netdev_priv() 4919 spin_unlock_bh(&np->hwstats_lock); netdev_priv() 4924 struct fe_priv *np = netdev_priv(dev); nv_link_test() local 4927 mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); nv_link_test() 4928 mii_status = mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); nv_link_test() 4967 struct fe_priv *np = netdev_priv(dev); nv_interrupt_test() local 4980 np->intr_test = 0; nv_interrupt_test() 4983 save_msi_flags = np->msi_flags; nv_interrupt_test() 4984 np->msi_flags &= ~NV_MSI_X_VECTORS_MASK; nv_interrupt_test() 4985 np->msi_flags |= 0x001; /* setup 1 vector */ nv_interrupt_test() 4998 spin_lock_irq(&np->lock); nv_interrupt_test() 5001 testcnt = np->intr_test; nv_interrupt_test() 5006 if (!(np->msi_flags & NV_MSI_X_ENABLED)) nv_interrupt_test() 5011 spin_unlock_irq(&np->lock); nv_interrupt_test() 5015 np->msi_flags = save_msi_flags; nv_interrupt_test() 5030 struct fe_priv *np = netdev_priv(dev); nv_loopback_test() local 5034 u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); nv_loopback_test() 5059 writel(np->rx_buf_sz, base + NvRegOffloadConfig); nv_loopback_test() 5061 writel(((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), nv_loopback_test() 5075 test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, nv_loopback_test() 5078 if (pci_dma_mapping_error(np->pci_dev, nv_loopback_test() 5087 if (!nv_optimized(np)) { nv_loopback_test() 5088 np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr); nv_loopback_test() 5089 np->tx_ring.orig[0].flaglen = cpu_to_le32((pkt_len-1) | np->tx_flags | tx_flags_extra); nv_loopback_test() 5091 np->tx_ring.ex[0].bufhigh = cpu_to_le32(dma_high(test_dma_addr)); nv_loopback_test() 5092 np->tx_ring.ex[0].buflow = cpu_to_le32(dma_low(test_dma_addr)); nv_loopback_test() 5093 np->tx_ring.ex[0].flaglen = cpu_to_le32((pkt_len-1) | np->tx_flags | tx_flags_extra); nv_loopback_test() 5095 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); nv_loopback_test() 5101 if (!nv_optimized(np)) { nv_loopback_test() 5102 flags = le32_to_cpu(np->rx_ring.orig[0].flaglen); nv_loopback_test() 5103 len = nv_descr_getlength(&np->rx_ring.orig[0], np->desc_ver); nv_loopback_test() 5106 flags = le32_to_cpu(np->rx_ring.ex[0].flaglen); nv_loopback_test() 5107 len = nv_descr_getlength_ex(&np->rx_ring.ex[0], np->desc_ver); nv_loopback_test() 5112 } else if (np->desc_ver == DESC_VER_1) { nv_loopback_test() 5124 rx_skb = np->rx_skb[0].skb; nv_loopback_test() 5134 pci_unmap_single(np->pci_dev, test_dma_addr, nv_loopback_test() 5156 struct fe_priv *np = netdev_priv(dev); nv_self_test() local 5174 spin_lock_irq(&np->lock); nv_self_test() 5175 nv_disable_hw_interrupts(dev, np->irqmask); nv_self_test() 5176 if (!(np->msi_flags & NV_MSI_X_ENABLED)) nv_self_test() 5185 spin_unlock_irq(&np->lock); nv_self_test() 5214 if (!np->in_shutdown) nv_self_test() 5215 mod_timer(&np->oom_kick, jiffies + OOM_REFILL); nv_self_test() 5218 writel(np->rx_buf_sz, base + NvRegOffloadConfig); nv_self_test() 5220 writel(((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), nv_self_test() 5223 writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); nv_self_test() 5229 nv_enable_hw_interrupts(dev, np->irqmask); nv_self_test() 5270 struct fe_priv *np = netdev_priv(dev); nv_mgmt_acquire_sema() local 5294 np->mgmt_sema = 1; nv_mgmt_acquire_sema() 5305 struct fe_priv *np = netdev_priv(dev); nv_mgmt_release_sema() local 5309 if (np->driver_data & DEV_HAS_MGMT_UNIT) { nv_mgmt_release_sema() 5310 if (np->mgmt_sema) { nv_mgmt_release_sema() 5321 struct fe_priv *np = netdev_priv(dev); nv_mgmt_get_version() local 5343 np->mgmt_version = readl(base + NvRegMgmtUnitVersion) & NVREG_MGMTUNITVERSION; nv_mgmt_get_version() 5350 struct fe_priv *np = netdev_priv(dev); nv_open() local 5357 mii_rw(dev, np->phyaddr, MII_BMCR, nv_open() 5358 mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ) & ~BMCR_PDOWN); nv_open() 5362 if (np->driver_data & DEV_HAS_POWER_CNTRL) nv_open() 5375 if (np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE) nv_open() 5387 np->in_shutdown = 0; nv_open() 5391 writel(((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), nv_open() 5394 writel(np->linkspeed, base + NvRegLinkSpeed); nv_open() 5395 if (np->desc_ver == DESC_VER_1) nv_open() 5399 writel(np->txrxctl_bits, base + NvRegTxRxControl); nv_open() 5400 writel(np->vlanctl_bits, base + NvRegVlanControl); nv_open() 5402 writel(NVREG_TXRXCTL_BIT1|np->txrxctl_bits, base + NvRegTxRxControl); nv_open() 5416 writel(np->rx_buf_sz, base + NvRegOffloadConfig); nv_open() 5422 if (np->desc_ver == DESC_VER_1) { nv_open() 5425 if (!(np->driver_data & DEV_HAS_GEAR_MODE)) { nv_open() 5443 writel((np->phyaddr << NVREG_ADAPTCTL_PHYSHIFT)|NVREG_ADAPTCTL_PHYVALID|NVREG_ADAPTCTL_RUNNING, nv_open() 5447 if (np->wolenabled) nv_open() 5458 nv_disable_hw_interrupts(dev, np->irqmask); nv_open() 5468 nv_enable_hw_interrupts(dev, np->irqmask); nv_open() 5470 spin_lock_irq(&np->lock); nv_open() 5486 np->linkspeed = 0; nv_open() 5499 mod_timer(&np->oom_kick, jiffies + OOM_REFILL); nv_open() 5502 if (np->driver_data & (DEV_HAS_STATISTICS_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_STATISTICS_V3)) nv_open() 5503 mod_timer(&np->stats_poll, nv_open() 5506 spin_unlock_irq(&np->lock); nv_open() 5522 struct fe_priv *np = netdev_priv(dev); nv_close() local 5525 spin_lock_irq(&np->lock); nv_close() 5526 np->in_shutdown = 1; nv_close() 5527 spin_unlock_irq(&np->lock); nv_close() 5529 synchronize_irq(np->pci_dev->irq); nv_close() 5531 del_timer_sync(&np->oom_kick); nv_close() 5532 del_timer_sync(&np->nic_poll); nv_close() 5533 del_timer_sync(&np->stats_poll); nv_close() 5536 spin_lock_irq(&np->lock); nv_close() 5543 nv_disable_hw_interrupts(dev, np->irqmask); nv_close() 5546 spin_unlock_irq(&np->lock); nv_close() 5552 if (np->wolenabled || !phy_power_down) { nv_close() 5558 mii_rw(dev, np->phyaddr, MII_BMCR, nv_close() 5559 mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ)|BMCR_PDOWN); nv_close() 5605 struct fe_priv *np; nv_probe() local 5623 np = netdev_priv(dev); nv_probe() 5624 np->dev = dev; nv_probe() 5625 np->pci_dev = pci_dev; nv_probe() 5626 spin_lock_init(&np->lock); nv_probe() 5627 spin_lock_init(&np->hwstats_lock); nv_probe() 5629 u64_stats_init(&np->swstats_rx_syncp); nv_probe() 5630 u64_stats_init(&np->swstats_tx_syncp); nv_probe() 5632 init_timer(&np->oom_kick); nv_probe() 5633 np->oom_kick.data = (unsigned long) dev; nv_probe() 5634 np->oom_kick.function = nv_do_rx_refill; /* timer handler */ nv_probe() 5635 init_timer(&np->nic_poll); nv_probe() 5636 np->nic_poll.data = (unsigned long) dev; nv_probe() 5637 np->nic_poll.function = nv_do_nic_poll; /* timer handler */ nv_probe() 5638 init_timer_deferrable(&np->stats_poll); nv_probe() 5639 np->stats_poll.data = (unsigned long) dev; nv_probe() 5640 np->stats_poll.function = nv_do_stats_poll; /* timer handler */ nv_probe() 5653 np->register_size = NV_PCI_REGSZ_VER3; nv_probe() 5655 np->register_size = NV_PCI_REGSZ_VER2; nv_probe() 5657 np->register_size = NV_PCI_REGSZ_VER1; nv_probe() 5663 pci_resource_len(pci_dev, i) >= np->register_size) { nv_probe() 5674 np->driver_data = id->driver_data; nv_probe() 5676 np->device_id = id->device; nv_probe() 5681 np->desc_ver = DESC_VER_3; nv_probe() 5682 np->txrxctl_bits = NVREG_TXRXCTL_DESC_3; nv_probe() 5696 np->desc_ver = DESC_VER_2; nv_probe() 5697 np->txrxctl_bits = NVREG_TXRXCTL_DESC_2; nv_probe() 5700 np->desc_ver = DESC_VER_1; nv_probe() 5701 np->txrxctl_bits = NVREG_TXRXCTL_DESC_1; nv_probe() 5704 np->pkt_limit = NV_PKTLIMIT_1; nv_probe() 5706 np->pkt_limit = NV_PKTLIMIT_2; nv_probe() 5709 np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; nv_probe() 5714 np->vlanctl_bits = 0; nv_probe() 5716 np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE; nv_probe() 5726 np->pause_flags = NV_PAUSEFRAME_RX_CAPABLE | NV_PAUSEFRAME_RX_REQ | NV_PAUSEFRAME_AUTONEG; nv_probe() 5730 np->pause_flags |= NV_PAUSEFRAME_TX_CAPABLE | NV_PAUSEFRAME_TX_REQ; nv_probe() 5734 np->base = ioremap(addr, np->register_size); nv_probe() 5735 if (!np->base) nv_probe() 5738 np->rx_ring_size = RX_RING_DEFAULT; nv_probe() 5739 np->tx_ring_size = TX_RING_DEFAULT; nv_probe() 5741 if (!nv_optimized(np)) { nv_probe() 5742 np->rx_ring.orig = pci_alloc_consistent(pci_dev, nv_probe() 5743 sizeof(struct ring_desc) * (np->rx_ring_size + np->tx_ring_size), nv_probe() 5744 &np->ring_addr); nv_probe() 5745 if (!np->rx_ring.orig) nv_probe() 5747 np->tx_ring.orig = &np->rx_ring.orig[np->rx_ring_size]; nv_probe() 5749 np->rx_ring.ex = pci_alloc_consistent(pci_dev, nv_probe() 5750 sizeof(struct ring_desc_ex) * (np->rx_ring_size + np->tx_ring_size), nv_probe() 5751 &np->ring_addr); nv_probe() 5752 if (!np->rx_ring.ex) nv_probe() 5754 np->tx_ring.ex = &np->rx_ring.ex[np->rx_ring_size]; nv_probe() 5756 np->rx_skb = kcalloc(np->rx_ring_size, sizeof(struct nv_skb_map), GFP_KERNEL); nv_probe() 5757 np->tx_skb = kcalloc(np->tx_ring_size, sizeof(struct nv_skb_map), GFP_KERNEL); nv_probe() 5758 if (!np->rx_skb || !np->tx_skb) nv_probe() 5761 if (!nv_optimized(np)) nv_probe() 5766 netif_napi_add(dev, &np->napi, nv_napi_poll, RX_WORK_PER_LOOP); nv_probe() 5774 np->orig_mac[0] = readl(base + NvRegMacAddrA); nv_probe() 5775 np->orig_mac[1] = readl(base + NvRegMacAddrB); nv_probe() 5781 dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff; nv_probe() 5782 dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff; nv_probe() 5783 dev->dev_addr[2] = (np->orig_mac[0] >> 16) & 0xff; nv_probe() 5784 dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff; nv_probe() 5785 dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff; nv_probe() 5786 dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff; nv_probe() 5789 dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff; nv_probe() 5790 dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff; nv_probe() 5791 dev->dev_addr[2] = (np->orig_mac[0] >> 16) & 0xff; nv_probe() 5792 dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff; nv_probe() 5793 dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff; nv_probe() 5794 dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff; nv_probe() 5800 np->orig_mac[0] = (dev->dev_addr[5] << 0) + (dev->dev_addr[4] << 8) + nv_probe() 5802 np->orig_mac[1] = (dev->dev_addr[1] << 0) + (dev->dev_addr[0] << 8); nv_probe() 5805 dev->dev_addr[0] = (np->orig_mac[1] >> 8) & 0xff; nv_probe() 5806 dev->dev_addr[1] = (np->orig_mac[1] >> 0) & 0xff; nv_probe() 5807 dev->dev_addr[2] = (np->orig_mac[0] >> 24) & 0xff; nv_probe() 5808 dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff; nv_probe() 5809 dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; nv_probe() 5810 dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; nv_probe() 5835 np->wolenabled = 0; nv_probe() 5849 if (np->desc_ver == DESC_VER_1) nv_probe() 5850 np->tx_flags = NV_TX_VALID; nv_probe() 5852 np->tx_flags = NV_TX2_VALID; nv_probe() 5854 np->msi_flags = 0; nv_probe() 5856 np->msi_flags |= NV_MSI_CAPABLE; nv_probe() 5863 np->msi_flags |= NV_MSI_X_CAPABLE; nv_probe() 5868 np->irqmask = NVREG_IRQMASK_CPU; nv_probe() 5869 if (np->msi_flags & NV_MSI_X_CAPABLE) /* set number of vectors */ nv_probe() 5870 np->msi_flags |= 0x0001; nv_probe() 5874 np->irqmask = NVREG_IRQMASK_THROUGHPUT; nv_probe() 5876 np->msi_flags &= ~NV_MSI_X_CAPABLE; nv_probe() 5879 np->irqmask = NVREG_IRQMASK_THROUGHPUT; nv_probe() 5880 if (np->msi_flags & NV_MSI_X_CAPABLE) /* set number of vectors */ nv_probe() 5881 np->msi_flags |= 0x0003; nv_probe() 5885 np->irqmask |= NVREG_IRQ_TIMER; nv_probe() 5887 np->need_linktimer = 1; nv_probe() 5888 np->link_timeout = jiffies + LINK_TIMEOUT; nv_probe() 5890 np->need_linktimer = 0; nv_probe() 5895 np->tx_limit = 1; nv_probe() 5898 np->tx_limit = 0; nv_probe() 5917 np->mac_in_use = 1; nv_probe() 5918 if (np->mgmt_version > 0) nv_probe() 5919 np->mac_in_use = readl(base + NvRegMgmtUnitControl) & NVREG_MGMTUNITCONTROL_INUSE; nv_probe() 5921 if (np->mac_in_use && nv_probe() 5937 spin_lock_irq(&np->lock); nv_probe() 5939 spin_unlock_irq(&np->lock); nv_probe() 5942 spin_lock_irq(&np->lock); nv_probe() 5944 spin_unlock_irq(&np->lock); nv_probe() 5948 np->phy_model = id2 & PHYID2_MODEL_MASK; nv_probe() 5951 np->phyaddr = phyaddr; nv_probe() 5952 np->phy_oui = id1 | id2; nv_probe() 5955 if (np->phy_oui == PHY_OUI_REALTEK2) nv_probe() 5956 np->phy_oui = PHY_OUI_REALTEK; nv_probe() 5958 if (np->phy_oui == PHY_OUI_REALTEK && np->phy_model == PHY_MODEL_REALTEK_8211) nv_probe() 5959 np->phy_rev = mii_rw(dev, phyaddr, MII_RESV1, MII_READ) & PHY_REV_MASK; nv_probe() 5973 u32 mii_status = mii_rw(dev, np->phyaddr, MII_BMSR, MII_READ); nv_probe() 5975 np->gigabit = PHY_GIGABIT; nv_probe() 5979 np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; nv_probe() 5980 np->duplex = 0; nv_probe() 5981 np->autoneg = 1; nv_probe() 6003 dev->name, np->phy_oui, np->phyaddr, dev->dev_addr); nv_probe() 6017 np->gigabit == PHY_GIGABIT ? "gbit " : "", nv_probe() 6018 np->need_linktimer ? "lnktim " : "", nv_probe() 6019 np->msi_flags & NV_MSI_CAPABLE ? "msi " : "", nv_probe() 6020 np->msi_flags & NV_MSI_X_CAPABLE ? "msi-x " : "", nv_probe() 6021 np->desc_ver); nv_probe() 6044 struct fe_priv *np = netdev_priv(dev); nv_restore_phy() local 6047 if (np->phy_oui == PHY_OUI_REALTEK && nv_restore_phy() 6048 np->phy_model == PHY_MODEL_REALTEK_8201 && nv_restore_phy() 6050 mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT3); nv_restore_phy() 6051 phy_reserved = mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG2, MII_READ); nv_restore_phy() 6054 mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG2, phy_reserved); nv_restore_phy() 6055 mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1); nv_restore_phy() 6058 mii_control = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); nv_restore_phy() 6060 mii_rw(dev, np->phyaddr, MII_BMCR, mii_control); nv_restore_phy() 6067 struct fe_priv *np = netdev_priv(dev); nv_restore_mac_addr() local 6073 writel(np->orig_mac[0], base + NvRegMacAddrA); nv_restore_mac_addr() 6074 writel(np->orig_mac[1], base + NvRegMacAddrB); nv_restore_mac_addr() 6105 struct fe_priv *np = netdev_priv(dev); nv_suspend() local 6116 for (i = 0; i <= np->register_size/sizeof(u32); i++) nv_suspend() 6117 np->saved_config_space[i] = readl(base + i*sizeof(u32)); nv_suspend() 6126 struct fe_priv *np = netdev_priv(dev); nv_resume() local 6131 for (i = 0; i <= np->register_size/sizeof(u32); i++) nv_resume() 6132 writel(np->saved_config_space[i], base+i*sizeof(u32)); nv_resume() 6134 if (np->driver_data & DEV_NEED_MSI_FIX) nv_resume() 6159 struct fe_priv *np = netdev_priv(dev); nv_shutdown() local 6178 pci_wake_from_d3(pdev, np->wolenabled); nv_shutdown()
|
/linux-4.4.14/drivers/net/ethernet/sun/ |
H A D | niu.c | 71 #define nr64(reg) readq(np->regs + (reg)) 72 #define nw64(reg, val) writeq((val), np->regs + (reg)) 74 #define nr64_mac(reg) readq(np->mac_regs + (reg)) 75 #define nw64_mac(reg, val) writeq((val), np->mac_regs + (reg)) 77 #define nr64_ipp(reg) readq(np->regs + np->ipp_off + (reg)) 78 #define nw64_ipp(reg, val) writeq((val), np->regs + np->ipp_off + (reg)) 80 #define nr64_pcs(reg) readq(np->regs + np->pcs_off + (reg)) 81 #define nw64_pcs(reg, val) writeq((val), np->regs + np->pcs_off + (reg)) 83 #define nr64_xpcs(reg) readq(np->regs + np->xpcs_off + (reg)) 84 #define nw64_xpcs(reg, val) writeq((val), np->regs + np->xpcs_off + (reg)) 93 #define niu_lock_parent(np, flags) \ 94 spin_lock_irqsave(&np->parent->lock, flags) 95 #define niu_unlock_parent(np, flags) \ 96 spin_unlock_irqrestore(&np->parent->lock, flags) 98 static int serdes_init_10g_serdes(struct niu *np); 100 static int __niu_wait_bits_clear_mac(struct niu *np, unsigned long reg, __niu_wait_bits_clear_mac() argument 115 static int __niu_set_and_wait_clear_mac(struct niu *np, unsigned long reg, __niu_set_and_wait_clear_mac() argument 122 err = __niu_wait_bits_clear_mac(np, reg, bits, limit, delay); __niu_set_and_wait_clear_mac() 124 netdev_err(np->dev, "bits (%llx) of register %s would not clear, val[%llx]\n", __niu_set_and_wait_clear_mac() 135 static int __niu_wait_bits_clear_ipp(struct niu *np, unsigned long reg, __niu_wait_bits_clear_ipp() argument 150 static int __niu_set_and_wait_clear_ipp(struct niu *np, unsigned long reg, __niu_set_and_wait_clear_ipp() argument 161 err = __niu_wait_bits_clear_ipp(np, reg, bits, limit, delay); __niu_set_and_wait_clear_ipp() 163 netdev_err(np->dev, "bits (%llx) of register %s would not clear, val[%llx]\n", __niu_set_and_wait_clear_ipp() 174 static int __niu_wait_bits_clear(struct niu *np, unsigned long reg, __niu_wait_bits_clear() argument 194 static int __niu_set_and_wait_clear(struct niu *np, unsigned long reg, __niu_set_and_wait_clear() argument 201 err = __niu_wait_bits_clear(np, reg, bits, limit, delay); __niu_set_and_wait_clear() 203 netdev_err(np->dev, "bits (%llx) of register %s would not clear, val[%llx]\n", __niu_set_and_wait_clear() 214 static void niu_ldg_rearm(struct niu *np, struct niu_ldg *lp, int on) niu_ldg_rearm() argument 224 static int niu_ldn_irq_enable(struct niu *np, int ldn, int on) niu_ldn_irq_enable() argument 250 static int niu_enable_ldn_in_ldg(struct niu *np, struct niu_ldg *lp, int on) niu_enable_ldn_in_ldg() argument 252 struct niu_parent *parent = np->parent; niu_enable_ldn_in_ldg() 261 err = niu_ldn_irq_enable(np, i, on); niu_enable_ldn_in_ldg() 268 static int niu_enable_interrupts(struct niu *np, int on) niu_enable_interrupts() argument 272 for (i = 0; i < np->num_ldg; i++) { niu_enable_interrupts() 273 struct niu_ldg *lp = &np->ldg[i]; niu_enable_interrupts() 276 err = niu_enable_ldn_in_ldg(np, lp, on); niu_enable_interrupts() 280 for (i = 0; i < np->num_ldg; i++) niu_enable_interrupts() 281 niu_ldg_rearm(np, &np->ldg[i], on); niu_enable_interrupts() 296 static int mdio_wait(struct niu *np) mdio_wait() argument 312 static int mdio_read(struct niu *np, int port, int dev, int reg) mdio_read() argument 317 err = mdio_wait(np); mdio_read() 322 return mdio_wait(np); mdio_read() 325 static int mdio_write(struct niu *np, int port, int dev, int reg, int data) mdio_write() argument 330 err = mdio_wait(np); mdio_write() 335 err = mdio_wait(np); mdio_write() 342 static int mii_read(struct niu *np, int port, int reg) mii_read() argument 345 return mdio_wait(np); mii_read() 348 static int mii_write(struct niu *np, int port, int reg, int data) mii_write() argument 353 err = mdio_wait(np); mii_write() 360 static int esr2_set_tx_cfg(struct niu *np, unsigned long channel, u32 val) esr2_set_tx_cfg() argument 364 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, esr2_set_tx_cfg() 368 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, esr2_set_tx_cfg() 374 static int esr2_set_rx_cfg(struct niu *np, unsigned long channel, u32 val) esr2_set_rx_cfg() argument 378 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, esr2_set_rx_cfg() 382 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, esr2_set_rx_cfg() 389 static int serdes_init_niu_10g_fiber(struct niu *np) serdes_init_niu_10g_fiber() argument 391 struct niu_link_config *lp = &np->link_config; serdes_init_niu_10g_fiber() 403 mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, serdes_init_niu_10g_fiber() 412 int err = esr2_set_tx_cfg(np, i, tx_cfg); serdes_init_niu_10g_fiber() 418 int err = esr2_set_rx_cfg(np, i, rx_cfg); serdes_init_niu_10g_fiber() 426 static int serdes_init_niu_1g_serdes(struct niu *np) serdes_init_niu_1g_serdes() argument 428 struct niu_link_config *lp = &np->link_config; serdes_init_niu_1g_serdes() 442 if (np->port == 0) serdes_init_niu_1g_serdes() 448 mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, serdes_init_niu_1g_serdes() 458 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, serdes_init_niu_1g_serdes() 461 netdev_err(np->dev, "NIU Port %d %s() mdio write to ESR2_TI_PLL_CFG_L failed\n", serdes_init_niu_1g_serdes() 462 np->port, __func__); serdes_init_niu_1g_serdes() 468 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, serdes_init_niu_1g_serdes() 471 netdev_err(np->dev, "NIU Port %d %s() mdio write to ESR2_TI_PLL_STS_L failed\n", serdes_init_niu_1g_serdes() 472 np->port, __func__); serdes_init_niu_1g_serdes() 480 err = esr2_set_tx_cfg(np, i, tx_cfg); serdes_init_niu_1g_serdes() 486 err = esr2_set_rx_cfg(np, i, rx_cfg); serdes_init_niu_1g_serdes() 491 switch (np->port) { serdes_init_niu_1g_serdes() 515 netdev_err(np->dev, "Port %u signal bits [%08x] are not [%08x]\n", serdes_init_niu_1g_serdes() 516 np->port, (int)(sig & mask), (int)val); serdes_init_niu_1g_serdes() 523 static int serdes_init_niu_10g_serdes(struct niu *np) serdes_init_niu_10g_serdes() argument 525 struct niu_link_config *lp = &np->link_config; serdes_init_niu_10g_serdes() 540 mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, serdes_init_niu_10g_serdes() 550 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, serdes_init_niu_10g_serdes() 553 netdev_err(np->dev, "NIU Port %d %s() mdio write to ESR2_TI_PLL_CFG_L failed\n", serdes_init_niu_10g_serdes() 554 np->port, __func__); serdes_init_niu_10g_serdes() 560 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, serdes_init_niu_10g_serdes() 563 netdev_err(np->dev, "NIU Port %d %s() mdio write to ESR2_TI_PLL_STS_L failed\n", serdes_init_niu_10g_serdes() 564 np->port, __func__); serdes_init_niu_10g_serdes() 572 err = esr2_set_tx_cfg(np, i, tx_cfg); serdes_init_niu_10g_serdes() 578 err = esr2_set_rx_cfg(np, i, rx_cfg); serdes_init_niu_10g_serdes() 585 switch (np->port) { serdes_init_niu_10g_serdes() 622 np->port, (int)(sig & mask), (int)val); serdes_init_niu_10g_serdes() 625 err = serdes_init_niu_1g_serdes(np); serdes_init_niu_10g_serdes() 627 np->flags &= ~NIU_FLAGS_10G; serdes_init_niu_10g_serdes() 628 np->mac_xcvr = MAC_XCVR_PCS; serdes_init_niu_10g_serdes() 630 netdev_err(np->dev, "Port %u 10G/1G SERDES Link Failed\n", serdes_init_niu_10g_serdes() 631 np->port); serdes_init_niu_10g_serdes() 638 static int esr_read_rxtx_ctrl(struct niu *np, unsigned long chan, u32 *val) esr_read_rxtx_ctrl() argument 642 err = mdio_read(np, np->port, NIU_ESR_DEV_ADDR, ESR_RXTX_CTRL_L(chan)); esr_read_rxtx_ctrl() 645 err = mdio_read(np, np->port, NIU_ESR_DEV_ADDR, esr_read_rxtx_ctrl() 654 static int esr_read_glue0(struct niu *np, unsigned long chan, u32 *val) esr_read_glue0() argument 658 err = mdio_read(np, np->port, NIU_ESR_DEV_ADDR, esr_read_glue0() 662 err = mdio_read(np, np->port, NIU_ESR_DEV_ADDR, esr_read_glue0() 672 static int esr_read_reset(struct niu *np, u32 *val) esr_read_reset() argument 676 err = mdio_read(np, np->port, NIU_ESR_DEV_ADDR, esr_read_reset() 680 err = mdio_read(np, np->port, NIU_ESR_DEV_ADDR, esr_read_reset() 690 static int esr_write_rxtx_ctrl(struct niu *np, unsigned long chan, u32 val) esr_write_rxtx_ctrl() argument 694 err = mdio_write(np, np->port, NIU_ESR_DEV_ADDR, esr_write_rxtx_ctrl() 697 err = mdio_write(np, np->port, NIU_ESR_DEV_ADDR, esr_write_rxtx_ctrl() 702 static int esr_write_glue0(struct niu *np, unsigned long chan, u32 val) esr_write_glue0() argument 706 err = mdio_write(np, np->port, NIU_ESR_DEV_ADDR, esr_write_glue0() 709 err = mdio_write(np, np->port, NIU_ESR_DEV_ADDR, esr_write_glue0() 714 static int esr_reset(struct niu *np) esr_reset() argument 719 err = mdio_write(np, np->port, NIU_ESR_DEV_ADDR, esr_reset() 723 err = mdio_write(np, np->port, NIU_ESR_DEV_ADDR, esr_reset() 729 err = mdio_write(np, np->port, NIU_ESR_DEV_ADDR, esr_reset() 735 err = mdio_write(np, np->port, NIU_ESR_DEV_ADDR, esr_reset() 741 err = esr_read_reset(np, &reset); esr_reset() 745 netdev_err(np->dev, "Port %u ESR_RESET did not clear [%08x]\n", esr_reset() 746 np->port, reset); esr_reset() 753 static int serdes_init_10g(struct niu *np) serdes_init_10g() argument 755 struct niu_link_config *lp = &np->link_config; serdes_init_10g() 760 switch (np->port) { serdes_init_10g() 805 err = esr_read_rxtx_ctrl(np, i, &rxtx_ctrl); serdes_init_10g() 808 err = esr_read_glue0(np, i, &glue0); serdes_init_10g() 825 err = esr_write_rxtx_ctrl(np, i, rxtx_ctrl); serdes_init_10g() 828 err = esr_write_glue0(np, i, glue0); serdes_init_10g() 833 err = esr_reset(np); serdes_init_10g() 838 switch (np->port) { serdes_init_10g() 866 if (np->flags & NIU_FLAGS_HOTPLUG_PHY) { serdes_init_10g() 867 np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; serdes_init_10g() 870 netdev_err(np->dev, "Port %u signal bits [%08x] are not [%08x]\n", serdes_init_10g() 871 np->port, (int)(sig & mask), (int)val); serdes_init_10g() 874 if (np->flags & NIU_FLAGS_HOTPLUG_PHY) serdes_init_10g() 875 np->flags |= NIU_FLAGS_HOTPLUG_PHY_PRESENT; serdes_init_10g() 879 static int serdes_init_1g(struct niu *np) serdes_init_1g() argument 885 switch (np->port) { serdes_init_1g() 906 static int serdes_init_1g_serdes(struct niu *np) serdes_init_1g_serdes() argument 908 struct niu_link_config *lp = &np->link_config; serdes_init_1g_serdes() 917 switch (np->port) { serdes_init_1g_serdes() 973 err = esr_read_rxtx_ctrl(np, i, &rxtx_ctrl); serdes_init_1g_serdes() 976 err = esr_read_glue0(np, i, &glue0); serdes_init_1g_serdes() 993 err = esr_write_rxtx_ctrl(np, i, rxtx_ctrl); serdes_init_1g_serdes() 996 err = esr_write_glue0(np, i, glue0); serdes_init_1g_serdes() 1003 switch (np->port) { serdes_init_1g_serdes() 1019 netdev_err(np->dev, "Port %u signal bits [%08x] are not [%08x]\n", serdes_init_1g_serdes() 1020 np->port, (int)(sig & mask), (int)val); serdes_init_1g_serdes() 1027 static int link_status_1g_serdes(struct niu *np, int *link_up_p) link_status_1g_serdes() argument 1029 struct niu_link_config *lp = &np->link_config; link_status_1g_serdes() 1040 spin_lock_irqsave(&np->lock, flags); link_status_1g_serdes() 1052 spin_unlock_irqrestore(&np->lock, flags); link_status_1g_serdes() 1058 static int link_status_10g_serdes(struct niu *np, int *link_up_p) link_status_10g_serdes() argument 1061 struct niu_link_config *lp = &np->link_config; link_status_10g_serdes() 1068 if (!(np->flags & NIU_FLAGS_10G)) link_status_10g_serdes() 1069 return link_status_1g_serdes(np, link_up_p); link_status_10g_serdes() 1073 spin_lock_irqsave(&np->lock, flags); link_status_10g_serdes() 1087 spin_unlock_irqrestore(&np->lock, flags); link_status_10g_serdes() 1092 static int link_status_mii(struct niu *np, int *link_up_p) link_status_mii() argument 1094 struct niu_link_config *lp = &np->link_config; link_status_mii() 1099 err = mii_read(np, np->phy_addr, MII_BMCR); link_status_mii() 1104 err = mii_read(np, np->phy_addr, MII_BMSR); link_status_mii() 1109 err = mii_read(np, np->phy_addr, MII_ADVERTISE); link_status_mii() 1114 err = mii_read(np, np->phy_addr, MII_LPA); link_status_mii() 1120 err = mii_read(np, np->phy_addr, MII_ESTATUS); link_status_mii() 1125 err = mii_read(np, np->phy_addr, MII_CTRL1000); link_status_mii() 1130 err = mii_read(np, np->phy_addr, MII_STAT1000); link_status_mii() 1205 static int link_status_1g_rgmii(struct niu *np, int *link_up_p) link_status_1g_rgmii() argument 1207 struct niu_link_config *lp = &np->link_config; link_status_1g_rgmii() 1217 spin_lock_irqsave(&np->lock, flags); link_status_1g_rgmii() 1221 err = mii_read(np, np->phy_addr, MII_BMSR); link_status_1g_rgmii() 1229 err = mii_read(np, np->phy_addr, MII_ADVERTISE); link_status_1g_rgmii() 1234 err = mii_read(np, np->phy_addr, MII_LPA); link_status_1g_rgmii() 1239 err = mii_read(np, np->phy_addr, MII_ESTATUS); link_status_1g_rgmii() 1252 spin_unlock_irqrestore(&np->lock, flags); link_status_1g_rgmii() 1258 static int link_status_1g(struct niu *np, int *link_up_p) link_status_1g() argument 1260 struct niu_link_config *lp = &np->link_config; link_status_1g() 1264 spin_lock_irqsave(&np->lock, flags); link_status_1g() 1266 err = link_status_mii(np, link_up_p); link_status_1g() 1270 spin_unlock_irqrestore(&np->lock, flags); link_status_1g() 1274 static int bcm8704_reset(struct niu *np) bcm8704_reset() argument 1278 err = mdio_read(np, np->phy_addr, bcm8704_reset() 1283 err = mdio_write(np, np->phy_addr, BCM8704_PHYXS_DEV_ADDR, bcm8704_reset() 1290 err = mdio_read(np, np->phy_addr, bcm8704_reset() 1298 netdev_err(np->dev, "Port %u PHY will not reset (bmcr=%04x)\n", bcm8704_reset() 1299 np->port, (err & 0xffff)); bcm8704_reset() 1308 static int bcm8704_user_dev3_readback(struct niu *np, int reg) bcm8704_user_dev3_readback() argument 1310 int err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, reg); bcm8704_user_dev3_readback() 1313 err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, reg); bcm8704_user_dev3_readback() 1319 static int bcm8706_init_user_dev3(struct niu *np) bcm8706_init_user_dev3() argument 1324 err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, bcm8706_init_user_dev3() 1331 err = mdio_write(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, bcm8706_init_user_dev3() 1341 static int bcm8704_init_user_dev3(struct niu *np) bcm8704_init_user_dev3() argument 1345 err = mdio_write(np, np->phy_addr, bcm8704_init_user_dev3() 1359 err = mdio_write(np, np->phy_addr, bcm8704_init_user_dev3() 1368 err = bcm8704_user_dev3_readback(np, BCM8704_USER_CONTROL); bcm8704_init_user_dev3() 1371 err = bcm8704_user_dev3_readback(np, BCM8704_USER_PMD_TX_CONTROL); bcm8704_init_user_dev3() 1375 err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, bcm8704_init_user_dev3() 1381 err = mdio_write(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, bcm8704_init_user_dev3() 1391 static int mrvl88x2011_act_led(struct niu *np, int val) mrvl88x2011_act_led() argument 1395 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR, mrvl88x2011_act_led() 1403 return mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR, mrvl88x2011_act_led() 1407 static int mrvl88x2011_led_blink_rate(struct niu *np, int rate) mrvl88x2011_led_blink_rate() argument 1411 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR, mrvl88x2011_led_blink_rate() 1417 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR, mrvl88x2011_led_blink_rate() 1424 static int xcvr_init_10g_mrvl88x2011(struct niu *np) xcvr_init_10g_mrvl88x2011() argument 1429 err = mrvl88x2011_led_blink_rate(np, MRVL88X2011_LED_BLKRATE_134MS); xcvr_init_10g_mrvl88x2011() 1434 err = mrvl88x2011_act_led(np, MRVL88X2011_LED_CTL_OFF); xcvr_init_10g_mrvl88x2011() 1438 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR, xcvr_init_10g_mrvl88x2011() 1445 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR, xcvr_init_10g_mrvl88x2011() 1450 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR, xcvr_init_10g_mrvl88x2011() 1455 if (np->link_config.loopback_mode == LOOPBACK_MAC) xcvr_init_10g_mrvl88x2011() 1460 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR, xcvr_init_10g_mrvl88x2011() 1466 return mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR, xcvr_init_10g_mrvl88x2011() 1471 static int xcvr_diag_bcm870x(struct niu *np) xcvr_diag_bcm870x() argument 1477 err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR, xcvr_diag_bcm870x() 1481 pr_info("Port %u PMA_PMD(MII_STAT1000) [%04x]\n", np->port, err); xcvr_diag_bcm870x() 1483 err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, 0x20); xcvr_diag_bcm870x() 1486 pr_info("Port %u USER_DEV3(0x20) [%04x]\n", np->port, err); xcvr_diag_bcm870x() 1488 err = mdio_read(np, np->phy_addr, BCM8704_PHYXS_DEV_ADDR, xcvr_diag_bcm870x() 1492 pr_info("Port %u PHYXS(MII_NWAYTEST) [%04x]\n", np->port, err); xcvr_diag_bcm870x() 1496 err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, xcvr_diag_bcm870x() 1500 err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, xcvr_diag_bcm870x() 1506 err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, xcvr_diag_bcm870x() 1510 err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, xcvr_diag_bcm870x() 1519 np->port); xcvr_diag_bcm870x() 1522 np->port); xcvr_diag_bcm870x() 1529 static int xcvr_10g_set_lb_bcm870x(struct niu *np) xcvr_10g_set_lb_bcm870x() argument 1531 struct niu_link_config *lp = &np->link_config; xcvr_10g_set_lb_bcm870x() 1534 err = mdio_read(np, np->phy_addr, BCM8704_PCS_DEV_ADDR, xcvr_10g_set_lb_bcm870x() 1544 err = mdio_write(np, np->phy_addr, BCM8704_PCS_DEV_ADDR, xcvr_10g_set_lb_bcm870x() 1552 static int xcvr_init_10g_bcm8706(struct niu *np) xcvr_init_10g_bcm8706() argument 1557 if ((np->flags & NIU_FLAGS_HOTPLUG_PHY) && xcvr_init_10g_bcm8706() 1558 (np->flags & NIU_FLAGS_HOTPLUG_PHY_PRESENT) == 0) xcvr_init_10g_bcm8706() 1570 err = bcm8704_reset(np); xcvr_init_10g_bcm8706() 1574 err = xcvr_10g_set_lb_bcm870x(np); xcvr_init_10g_bcm8706() 1578 err = bcm8706_init_user_dev3(np); xcvr_init_10g_bcm8706() 1582 err = xcvr_diag_bcm870x(np); xcvr_init_10g_bcm8706() 1589 static int xcvr_init_10g_bcm8704(struct niu *np) xcvr_init_10g_bcm8704() argument 1593 err = bcm8704_reset(np); xcvr_init_10g_bcm8704() 1597 err = bcm8704_init_user_dev3(np); xcvr_init_10g_bcm8704() 1601 err = xcvr_10g_set_lb_bcm870x(np); xcvr_init_10g_bcm8704() 1605 err = xcvr_diag_bcm870x(np); xcvr_init_10g_bcm8704() 1612 static int xcvr_init_10g(struct niu *np) xcvr_init_10g() argument 1627 phy_id = phy_decode(np->parent->port_phy, np->port); xcvr_init_10g() 1628 phy_id = np->parent->phy_probe_info.phy_id[phy_id][np->port]; xcvr_init_10g() 1633 err = xcvr_init_10g_mrvl88x2011(np); xcvr_init_10g() 1637 err = xcvr_init_10g_bcm8704(np); xcvr_init_10g() 1644 static int mii_reset(struct niu *np) mii_reset() argument 1648 err = mii_write(np, np->phy_addr, MII_BMCR, BMCR_RESET); mii_reset() 1655 err = mii_read(np, np->phy_addr, MII_BMCR); mii_reset() 1662 netdev_err(np->dev, "Port %u MII would not reset, bmcr[%04x]\n", mii_reset() 1663 np->port, err); mii_reset() 1670 static int xcvr_init_1g_rgmii(struct niu *np) xcvr_init_1g_rgmii() argument 1680 err = mii_reset(np); xcvr_init_1g_rgmii() 1684 err = mii_read(np, np->phy_addr, MII_BMSR); xcvr_init_1g_rgmii() 1691 err = mii_read(np, np->phy_addr, MII_ESTATUS); xcvr_init_1g_rgmii() 1698 err = mii_write(np, np->phy_addr, MII_BMCR, bmcr); xcvr_init_1g_rgmii() 1707 err = mii_write(np, np->phy_addr, MII_CTRL1000, ctrl1000); xcvr_init_1g_rgmii() 1714 err = mii_write(np, np->phy_addr, MII_BMCR, bmcr); xcvr_init_1g_rgmii() 1718 err = mii_read(np, np->phy_addr, MII_BMCR); xcvr_init_1g_rgmii() 1721 bmcr = mii_read(np, np->phy_addr, MII_BMCR); xcvr_init_1g_rgmii() 1723 err = mii_read(np, np->phy_addr, MII_BMSR); xcvr_init_1g_rgmii() 1730 static int mii_init_common(struct niu *np) mii_init_common() argument 1732 struct niu_link_config *lp = &np->link_config; mii_init_common() 1736 err = mii_reset(np); mii_init_common() 1740 err = mii_read(np, np->phy_addr, MII_BMSR); mii_init_common() 1747 err = mii_read(np, np->phy_addr, MII_ESTATUS); mii_init_common() 1754 err = mii_write(np, np->phy_addr, MII_BMCR, bmcr); mii_init_common() 1771 err = mii_write(np, np->phy_addr, BCM5464R_AUX_CTL, aux); mii_init_common() 1792 err = mii_write(np, np->phy_addr, MII_ADVERTISE, adv); mii_init_common() 1804 err = mii_write(np, np->phy_addr, mii_init_common() 1843 err = mii_write(np, np->phy_addr, MII_BMCR, bmcr); mii_init_common() 1848 err = mii_read(np, np->phy_addr, MII_BMCR); mii_init_common() 1853 err = mii_read(np, np->phy_addr, MII_BMSR); mii_init_common() 1859 np->port, bmcr, bmsr); mii_init_common() 1865 static int xcvr_init_1g(struct niu *np) xcvr_init_1g() argument 1874 return mii_init_common(np); xcvr_init_1g() 1877 static int niu_xcvr_init(struct niu *np) niu_xcvr_init() argument 1879 const struct niu_phy_ops *ops = np->phy_ops; niu_xcvr_init() 1884 err = ops->xcvr_init(np); niu_xcvr_init() 1889 static int niu_serdes_init(struct niu *np) niu_serdes_init() argument 1891 const struct niu_phy_ops *ops = np->phy_ops; niu_serdes_init() 1896 err = ops->serdes_init(np); niu_serdes_init() 1904 static int niu_link_status_common(struct niu *np, int link_up) niu_link_status_common() argument 1906 struct niu_link_config *lp = &np->link_config; niu_link_status_common() 1907 struct net_device *dev = np->dev; niu_link_status_common() 1911 netif_info(np, link, dev, "Link is up at %s, %s duplex\n", niu_link_status_common() 1918 spin_lock_irqsave(&np->lock, flags); niu_link_status_common() 1919 niu_init_xif(np); niu_link_status_common() 1920 niu_handle_led(np, 1); niu_link_status_common() 1921 spin_unlock_irqrestore(&np->lock, flags); niu_link_status_common() 1925 netif_warn(np, link, dev, "Link is down\n"); niu_link_status_common() 1926 spin_lock_irqsave(&np->lock, flags); niu_link_status_common() 1927 niu_handle_led(np, 0); niu_link_status_common() 1928 spin_unlock_irqrestore(&np->lock, flags); niu_link_status_common() 1935 static int link_status_10g_mrvl(struct niu *np, int *link_up_p) link_status_10g_mrvl() argument 1941 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR, link_status_10g_mrvl() 1947 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR, link_status_10g_mrvl() 1955 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR, link_status_10g_mrvl() 1960 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR, link_status_10g_mrvl() 1968 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV4_ADDR, link_status_10g_mrvl() 1979 np->link_config.active_speed = SPEED_10000; link_status_10g_mrvl() 1980 np->link_config.active_duplex = DUPLEX_FULL; link_status_10g_mrvl() 1983 mrvl88x2011_act_led(np, (link_up ? link_status_10g_mrvl() 1991 static int link_status_10g_bcm8706(struct niu *np, int *link_up_p) link_status_10g_bcm8706() argument 1996 err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR, link_status_10g_bcm8706() 2005 err = mdio_read(np, np->phy_addr, BCM8704_PCS_DEV_ADDR, link_status_10g_bcm8706() 2015 err = mdio_read(np, np->phy_addr, BCM8704_PHYXS_DEV_ADDR, link_status_10g_bcm8706() 2027 np->link_config.active_speed = SPEED_INVALID; link_status_10g_bcm8706() 2028 np->link_config.active_duplex = DUPLEX_INVALID; link_status_10g_bcm8706() 2033 np->link_config.active_speed = SPEED_10000; link_status_10g_bcm8706() 2034 np->link_config.active_duplex = DUPLEX_FULL; link_status_10g_bcm8706() 2042 static int link_status_10g_bcom(struct niu *np, int *link_up_p) link_status_10g_bcom() argument 2048 err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR, link_status_10g_bcom() 2057 err = mdio_read(np, np->phy_addr, BCM8704_PCS_DEV_ADDR, link_status_10g_bcom() 2066 err = mdio_read(np, np->phy_addr, BCM8704_PHYXS_DEV_ADDR, link_status_10g_bcom() 2082 np->link_config.active_speed = SPEED_10000; link_status_10g_bcom() 2083 np->link_config.active_duplex = DUPLEX_FULL; link_status_10g_bcom() 2091 static int link_status_10g(struct niu *np, int *link_up_p) link_status_10g() argument 2096 spin_lock_irqsave(&np->lock, flags); link_status_10g() 2098 if (np->link_config.loopback_mode == LOOPBACK_DISABLED) { link_status_10g() 2101 phy_id = phy_decode(np->parent->port_phy, np->port); link_status_10g() 2102 phy_id = np->parent->phy_probe_info.phy_id[phy_id][np->port]; link_status_10g() 2107 err = link_status_10g_mrvl(np, link_up_p); link_status_10g() 2111 err = link_status_10g_bcom(np, link_up_p); link_status_10g() 2116 spin_unlock_irqrestore(&np->lock, flags); link_status_10g() 2121 static int niu_10g_phy_present(struct niu *np) niu_10g_phy_present() argument 2126 switch (np->port) { niu_10g_phy_present() 2158 static int link_status_10g_hotplug(struct niu *np, int *link_up_p) link_status_10g_hotplug() argument 2165 spin_lock_irqsave(&np->lock, flags); link_status_10g_hotplug() 2167 if (np->link_config.loopback_mode == LOOPBACK_DISABLED) { link_status_10g_hotplug() 2168 phy_present_prev = (np->flags & NIU_FLAGS_HOTPLUG_PHY_PRESENT) ? link_status_10g_hotplug() 2170 phy_present = niu_10g_phy_present(np); link_status_10g_hotplug() 2175 np->flags |= NIU_FLAGS_HOTPLUG_PHY_PRESENT; link_status_10g_hotplug() 2176 if (np->phy_ops->xcvr_init) link_status_10g_hotplug() 2177 err = np->phy_ops->xcvr_init(np); link_status_10g_hotplug() 2179 err = mdio_read(np, np->phy_addr, link_status_10g_hotplug() 2186 np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; link_status_10g_hotplug() 2189 np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; link_status_10g_hotplug() 2191 netif_warn(np, link, np->dev, link_status_10g_hotplug() 2196 if (np->flags & NIU_FLAGS_HOTPLUG_PHY_PRESENT) { link_status_10g_hotplug() 2197 err = link_status_10g_bcm8706(np, link_up_p); link_status_10g_hotplug() 2201 np->link_config.active_speed = SPEED_10000; link_status_10g_hotplug() 2202 np->link_config.active_duplex = DUPLEX_FULL; link_status_10g_hotplug() 2207 spin_unlock_irqrestore(&np->lock, flags); link_status_10g_hotplug() 2212 static int niu_link_status(struct niu *np, int *link_up_p) niu_link_status() argument 2214 const struct niu_phy_ops *ops = np->phy_ops; niu_link_status() 2219 err = ops->link_status(np, link_up_p); niu_link_status() 2226 struct niu *np = (struct niu *) __opaque; niu_timer() local 2230 err = niu_link_status(np, &link_up); niu_timer() 2232 niu_link_status_common(np, link_up); niu_timer() 2234 if (netif_carrier_ok(np->dev)) niu_timer() 2238 np->timer.expires = jiffies + off; niu_timer() 2240 add_timer(&np->timer); niu_timer() 2367 static int serdes_init_10g_serdes(struct niu *np) serdes_init_10g_serdes() argument 2369 struct niu_link_config *lp = &np->link_config; serdes_init_10g_serdes() 2373 switch (np->port) { serdes_init_10g_serdes() 2413 esr_reset(np); serdes_init_10g_serdes() 2423 err = esr_read_rxtx_ctrl(np, i, &rxtx_ctrl); serdes_init_10g_serdes() 2426 err = esr_read_glue0(np, i, &glue0); serdes_init_10g_serdes() 2443 err = esr_write_rxtx_ctrl(np, i, rxtx_ctrl); serdes_init_10g_serdes() 2446 err = esr_write_glue0(np, i, glue0); serdes_init_10g_serdes() 2453 switch (np->port) { serdes_init_10g_serdes() 2482 err = serdes_init_1g_serdes(np); serdes_init_10g_serdes() 2484 np->flags &= ~NIU_FLAGS_10G; serdes_init_10g_serdes() 2485 np->mac_xcvr = MAC_XCVR_PCS; serdes_init_10g_serdes() 2487 netdev_err(np->dev, "Port %u 10G/1G SERDES Link Failed\n", serdes_init_10g_serdes() 2488 np->port); serdes_init_10g_serdes() 2496 static int niu_determine_phy_disposition(struct niu *np) niu_determine_phy_disposition() argument 2498 struct niu_parent *parent = np->parent; niu_determine_phy_disposition() 2504 switch (np->flags & niu_determine_phy_disposition() 2519 if (np->flags & NIU_FLAGS_HOTPLUG_PHY) { niu_determine_phy_disposition() 2521 if (np->port == 0) niu_determine_phy_disposition() 2523 if (np->port == 1) niu_determine_phy_disposition() 2527 phy_addr_off += np->port; niu_determine_phy_disposition() 2532 switch (np->flags & niu_determine_phy_disposition() 2544 phy_addr_off += (np->port ^ 0x3); niu_determine_phy_disposition() 2563 phy_addr_off += np->port; niu_determine_phy_disposition() 2564 if (np->flags & NIU_FLAGS_HOTPLUG_PHY) { niu_determine_phy_disposition() 2566 if (np->port == 0) niu_determine_phy_disposition() 2568 if (np->port == 1) niu_determine_phy_disposition() 2576 switch(np->port) { niu_determine_phy_disposition() 2588 phy_addr_off = niu_atca_port_num[np->port]; niu_determine_phy_disposition() 2596 np->phy_ops = tp->ops; niu_determine_phy_disposition() 2597 np->phy_addr = tp->phy_addr_base + phy_addr_off; niu_determine_phy_disposition() 2602 static int niu_init_link(struct niu *np) niu_init_link() argument 2604 struct niu_parent *parent = np->parent; niu_init_link() 2608 err = niu_xcvr_init(np); niu_init_link() 2613 err = niu_serdes_init(np); niu_init_link() 2614 if (err && !(np->flags & NIU_FLAGS_HOTPLUG_PHY)) niu_init_link() 2617 err = niu_xcvr_init(np); niu_init_link() 2618 if (!err || (np->flags & NIU_FLAGS_HOTPLUG_PHY)) niu_init_link() 2619 niu_link_status(np, &ignore); niu_init_link() 2623 static void niu_set_primary_mac(struct niu *np, unsigned char *addr) niu_set_primary_mac() argument 2629 if (np->flags & NIU_FLAGS_XMAC) { niu_set_primary_mac() 2640 static int niu_num_alt_addr(struct niu *np) niu_num_alt_addr() argument 2642 if (np->flags & NIU_FLAGS_XMAC) niu_num_alt_addr() 2648 static int niu_set_alt_mac(struct niu *np, int index, unsigned char *addr) niu_set_alt_mac() argument 2654 if (index >= niu_num_alt_addr(np)) niu_set_alt_mac() 2657 if (np->flags & NIU_FLAGS_XMAC) { niu_set_alt_mac() 2670 static int niu_enable_alt_mac(struct niu *np, int index, int on) niu_enable_alt_mac() argument 2675 if (index >= niu_num_alt_addr(np)) niu_enable_alt_mac() 2678 if (np->flags & NIU_FLAGS_XMAC) { niu_enable_alt_mac() 2696 static void __set_rdc_table_num_hw(struct niu *np, unsigned long reg, __set_rdc_table_num_hw() argument 2707 static int __set_rdc_table_num(struct niu *np, __set_rdc_table_num() argument 2715 if (np->flags & NIU_FLAGS_XMAC) __set_rdc_table_num() 2719 __set_rdc_table_num_hw(np, reg, rdc_table_num, mac_pref); __set_rdc_table_num() 2723 static int niu_set_primary_mac_rdc_table(struct niu *np, int table_num, niu_set_primary_mac_rdc_table() argument 2726 return __set_rdc_table_num(np, 17, 0, table_num, mac_pref); niu_set_primary_mac_rdc_table() 2729 static int niu_set_multicast_mac_rdc_table(struct niu *np, int table_num, niu_set_multicast_mac_rdc_table() argument 2732 return __set_rdc_table_num(np, 16, 8, table_num, mac_pref); niu_set_multicast_mac_rdc_table() 2735 static int niu_set_alt_mac_rdc_table(struct niu *np, int idx, niu_set_alt_mac_rdc_table() argument 2738 if (idx >= niu_num_alt_addr(np)) niu_set_alt_mac_rdc_table() 2740 return __set_rdc_table_num(np, idx, idx + 1, table_num, mac_pref); niu_set_alt_mac_rdc_table() 2764 static void vlan_tbl_write(struct niu *np, unsigned long index, vlan_tbl_write() argument 2782 static void vlan_tbl_clear(struct niu *np) vlan_tbl_clear() argument 2790 static int tcam_wait_bit(struct niu *np, u64 bit) tcam_wait_bit() argument 2805 static int tcam_flush(struct niu *np, int index) tcam_flush() argument 2811 return tcam_wait_bit(np, TCAM_CTL_STAT); tcam_flush() 2815 static int tcam_read(struct niu *np, int index, 2821 err = tcam_wait_bit(np, TCAM_CTL_STAT); 2836 static int tcam_write(struct niu *np, int index, tcam_write() argument 2849 return tcam_wait_bit(np, TCAM_CTL_STAT); tcam_write() 2853 static int tcam_assoc_read(struct niu *np, int index, u64 *data) 2858 err = tcam_wait_bit(np, TCAM_CTL_STAT); 2866 static int tcam_assoc_write(struct niu *np, int index, u64 assoc_data) tcam_assoc_write() argument 2871 return tcam_wait_bit(np, TCAM_CTL_STAT); tcam_assoc_write() 2874 static void tcam_enable(struct niu *np, int on) tcam_enable() argument 2885 static void tcam_set_lat_and_ratio(struct niu *np, u64 latency, u64 ratio) tcam_set_lat_and_ratio() argument 2901 static int tcam_user_eth_class_enable(struct niu *np, unsigned long class, tcam_user_eth_class_enable() argument 2923 static int tcam_user_eth_class_set(struct niu *np, unsigned long class, 2944 static int tcam_user_ip_class_enable(struct niu *np, unsigned long class, tcam_user_ip_class_enable() argument 2965 static int tcam_user_ip_class_set(struct niu *np, unsigned long class, tcam_user_ip_class_set() argument 2993 static int tcam_early_init(struct niu *np) tcam_early_init() argument 2998 tcam_enable(np, 0); tcam_early_init() 2999 tcam_set_lat_and_ratio(np, tcam_early_init() 3003 err = tcam_user_eth_class_enable(np, i, 0); tcam_early_init() 3008 err = tcam_user_ip_class_enable(np, i, 0); tcam_early_init() 3016 static int tcam_flush_all(struct niu *np) tcam_flush_all() argument 3020 for (i = 0; i < np->parent->tcam_num_entries; i++) { tcam_flush_all() 3021 int err = tcam_flush(np, i); tcam_flush_all() 3034 static int hash_read(struct niu *np, unsigned long partition, 3053 static int hash_write(struct niu *np, unsigned long partition, hash_write() argument 3071 static void fflp_reset(struct niu *np) fflp_reset() argument 3083 static void fflp_set_timings(struct niu *np) fflp_set_timings() argument 3102 static int fflp_set_partition(struct niu *np, u64 partition, fflp_set_partition() argument 3126 static int fflp_disable_all_partitions(struct niu *np) fflp_disable_all_partitions() argument 3131 int err = fflp_set_partition(np, 0, 0, 0, 0); fflp_disable_all_partitions() 3138 static void fflp_llcsnap_enable(struct niu *np, int on) fflp_llcsnap_enable() argument 3149 static void fflp_errors_enable(struct niu *np, int on) fflp_errors_enable() argument 3160 static int fflp_hash_clear(struct niu *np) fflp_hash_clear() argument 3170 int err = hash_write(np, 0, i, 1, (u64 *) &ent); fflp_hash_clear() 3177 static int fflp_early_init(struct niu *np) fflp_early_init() argument 3183 niu_lock_parent(np, flags); fflp_early_init() 3185 parent = np->parent; fflp_early_init() 3188 if (np->parent->plat_type != PLAT_TYPE_NIU) { fflp_early_init() 3189 fflp_reset(np); fflp_early_init() 3190 fflp_set_timings(np); fflp_early_init() 3191 err = fflp_disable_all_partitions(np); fflp_early_init() 3193 netif_printk(np, probe, KERN_DEBUG, np->dev, fflp_early_init() 3200 err = tcam_early_init(np); fflp_early_init() 3202 netif_printk(np, probe, KERN_DEBUG, np->dev, fflp_early_init() 3206 fflp_llcsnap_enable(np, 1); fflp_early_init() 3207 fflp_errors_enable(np, 0); fflp_early_init() 3211 err = tcam_flush_all(np); fflp_early_init() 3213 netif_printk(np, probe, KERN_DEBUG, np->dev, fflp_early_init() 3217 if (np->parent->plat_type != PLAT_TYPE_NIU) { fflp_early_init() 3218 err = fflp_hash_clear(np); fflp_early_init() 3220 netif_printk(np, probe, KERN_DEBUG, np->dev, fflp_early_init() 3227 vlan_tbl_clear(np); fflp_early_init() 3232 niu_unlock_parent(np, flags); fflp_early_init() 3236 static int niu_set_flow_key(struct niu *np, unsigned long class_code, u64 key) niu_set_flow_key() argument 3246 static int niu_set_tcam_key(struct niu *np, unsigned long class_code, u64 key) niu_set_tcam_key() argument 3257 static u16 tcam_get_index(struct niu *np, u16 idx) tcam_get_index() argument 3260 if (idx >= (np->clas.tcam_sz - 1)) tcam_get_index() 3262 return np->clas.tcam_top + ((idx+1) * np->parent->num_ports); tcam_get_index() 3265 static u16 tcam_get_size(struct niu *np) tcam_get_size() argument 3268 return np->clas.tcam_sz - 1; tcam_get_size() 3271 static u16 tcam_get_valid_entry_cnt(struct niu *np) tcam_get_valid_entry_cnt() argument 3274 return np->clas.tcam_valid_entries - 1; tcam_get_valid_entry_cnt() 3324 static int niu_rbr_add_page(struct niu *np, struct rx_ring_info *rp, niu_rbr_add_page() argument 3335 addr = np->ops->map_page(np->device, page, 0, niu_rbr_add_page() 3356 static void niu_rbr_refill(struct niu *np, struct rx_ring_info *rp, gfp_t mask) niu_rbr_refill() argument 3362 int err = niu_rbr_add_page(np, rp, mask, index); niu_rbr_refill() 3381 static int niu_rx_pkt_ignore(struct niu *np, struct rx_ring_info *rp) niu_rx_pkt_ignore() argument 3403 np->ops->unmap_page(np->device, page->index, niu_rx_pkt_ignore() 3421 static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, niu_process_rx_pkt() argument 3429 skb = netdev_alloc_skb(np->dev, RX_SKB_ALLOC_SIZE); niu_process_rx_pkt() 3431 return niu_rx_pkt_ignore(np, rp); niu_process_rx_pkt() 3473 np->ops->unmap_page(np->device, page->index, niu_process_rx_pkt() 3493 if (np->dev->features & NETIF_F_RXHASH) niu_process_rx_pkt() 3505 skb->protocol = eth_type_trans(skb, np->dev); niu_process_rx_pkt() 3512 static int niu_rbr_fill(struct niu *np, struct rx_ring_info *rp, gfp_t mask) niu_rbr_fill() argument 3519 err = niu_rbr_add_page(np, rp, mask, index); niu_rbr_fill() 3530 static void niu_rbr_free(struct niu *np, struct rx_ring_info *rp) niu_rbr_free() argument 3542 np->ops->unmap_page(np->device, base, PAGE_SIZE, niu_rbr_free() 3558 static int release_tx_packet(struct niu *np, struct tx_ring_info *rp, int idx) release_tx_packet() argument 3574 np->ops->unmap_single(np->device, tb->mapping, release_tx_packet() 3589 np->ops->unmap_page(np->device, tb->mapping, release_tx_packet() 3602 static void niu_tx_work(struct niu *np, struct tx_ring_info *rp) niu_tx_work() argument 3609 index = (rp - np->tx_rings); niu_tx_work() 3610 txq = netdev_get_tx_queue(np->dev, index); niu_tx_work() 3624 netif_printk(np, tx_done, KERN_DEBUG, np->dev, niu_tx_work() 3628 cons = release_tx_packet(np, rp, cons); niu_tx_work() 3644 static inline void niu_sync_rx_discard_stats(struct niu *np, niu_sync_rx_discard_stats() argument 3673 dev_err(np->device, "rx-%d: Counter overflow RXMISC discard\n", niu_sync_rx_discard_stats() 3676 netif_printk(np, rx_err, KERN_DEBUG, np->dev, niu_sync_rx_discard_stats() 3688 dev_err(np->device, "rx-%d: Counter overflow WRED discard\n", rx_channel); niu_sync_rx_discard_stats() 3690 netif_printk(np, rx_err, KERN_DEBUG, np->dev, niu_sync_rx_discard_stats() 3696 static int niu_rx_work(struct napi_struct *napi, struct niu *np, niu_rx_work() argument 3713 netif_printk(np, rx_status, KERN_DEBUG, np->dev, niu_rx_work() 3720 rcr_done += niu_process_rx_pkt(napi, np, rp); niu_rx_work() 3728 niu_rbr_refill(np, rp, GFP_ATOMIC); niu_rx_work() 3740 niu_sync_rx_discard_stats(np, rp, 0x7FFF); niu_rx_work() 3745 static int niu_poll_core(struct niu *np, struct niu_ldg *lp, int budget) niu_poll_core() argument 3752 netif_printk(np, intr, KERN_DEBUG, np->dev, niu_poll_core() 3755 for (i = 0; i < np->num_tx_rings; i++) { niu_poll_core() 3756 struct tx_ring_info *rp = &np->tx_rings[i]; niu_poll_core() 3758 niu_tx_work(np, rp); niu_poll_core() 3762 for (i = 0; i < np->num_rx_rings; i++) { niu_poll_core() 3763 struct rx_ring_info *rp = &np->rx_rings[i]; niu_poll_core() 3768 this_work_done = niu_rx_work(&lp->napi, np, rp, niu_poll_core() 3783 struct niu *np = lp->np; niu_poll() local 3786 work_done = niu_poll_core(np, lp, budget); niu_poll() 3790 niu_ldg_rearm(np, lp, 1); niu_poll() 3795 static void niu_log_rxchan_errors(struct niu *np, struct rx_ring_info *rp, niu_log_rxchan_errors() argument 3798 netdev_err(np->dev, "RX channel %u errors ( ", rp->rx_channel); niu_log_rxchan_errors() 3832 static int niu_rx_error(struct niu *np, struct rx_ring_info *rp) niu_rx_error() argument 3843 netdev_err(np->dev, "RX channel %u error, stat[%llx]\n", niu_rx_error() 3847 niu_log_rxchan_errors(np, rp, stat); niu_rx_error() 3856 static void niu_log_txchan_errors(struct niu *np, struct tx_ring_info *rp, niu_log_txchan_errors() argument 3859 netdev_err(np->dev, "TX channel %u errors ( ", rp->tx_channel); niu_log_txchan_errors() 3881 static int niu_tx_error(struct niu *np, struct tx_ring_info *rp) niu_tx_error() argument 3889 netdev_err(np->dev, "TX channel %u error, cs[%llx] logh[%llx] logl[%llx]\n", niu_tx_error() 3895 niu_log_txchan_errors(np, rp, cs); niu_tx_error() 3900 static int niu_mif_interrupt(struct niu *np) niu_mif_interrupt() argument 3905 if (np->flags & NIU_FLAGS_XMAC) { niu_mif_interrupt() 3912 netdev_err(np->dev, "MIF interrupt, stat[%llx] phy_mdint(%d)\n", niu_mif_interrupt() 3918 static void niu_xmac_interrupt(struct niu *np) niu_xmac_interrupt() argument 3920 struct niu_xmac_stats *mp = &np->mac_stats.xmac; niu_xmac_interrupt() 3990 static void niu_bmac_interrupt(struct niu *np) niu_bmac_interrupt() argument 3992 struct niu_bmac_stats *mp = &np->mac_stats.bmac; niu_bmac_interrupt() 4026 static int niu_mac_interrupt(struct niu *np) niu_mac_interrupt() argument 4028 if (np->flags & NIU_FLAGS_XMAC) niu_mac_interrupt() 4029 niu_xmac_interrupt(np); niu_mac_interrupt() 4031 niu_bmac_interrupt(np); niu_mac_interrupt() 4036 static void niu_log_device_error(struct niu *np, u64 stat) niu_log_device_error() argument 4038 netdev_err(np->dev, "Core device errors ( "); niu_log_device_error() 4066 static int niu_device_error(struct niu *np) niu_device_error() argument 4070 netdev_err(np->dev, "Core device error, stat[%llx]\n", niu_device_error() 4073 niu_log_device_error(np, stat); niu_device_error() 4078 static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp, niu_slowpath_interrupt() argument 4091 for (i = 0; i < np->num_rx_rings; i++) { niu_slowpath_interrupt() 4092 struct rx_ring_info *rp = &np->rx_rings[i]; niu_slowpath_interrupt() 4095 int r = niu_rx_error(np, rp); niu_slowpath_interrupt() 4109 for (i = 0; i < np->num_tx_rings; i++) { niu_slowpath_interrupt() 4110 struct tx_ring_info *rp = &np->tx_rings[i]; niu_slowpath_interrupt() 4113 int r = niu_tx_error(np, rp); niu_slowpath_interrupt() 4120 int r = niu_mif_interrupt(np); niu_slowpath_interrupt() 4126 int r = niu_mac_interrupt(np); niu_slowpath_interrupt() 4131 int r = niu_device_error(np); niu_slowpath_interrupt() 4138 niu_enable_interrupts(np, 0); niu_slowpath_interrupt() 4143 static void niu_rxchan_intr(struct niu *np, struct rx_ring_info *rp, niu_rxchan_intr() argument 4153 netif_printk(np, intr, KERN_DEBUG, np->dev, niu_rxchan_intr() 4157 static void niu_txchan_intr(struct niu *np, struct tx_ring_info *rp, niu_txchan_intr() argument 4162 netif_printk(np, intr, KERN_DEBUG, np->dev, niu_txchan_intr() 4166 static void __niu_fastpath_interrupt(struct niu *np, int ldg, u64 v0) __niu_fastpath_interrupt() argument 4168 struct niu_parent *parent = np->parent; __niu_fastpath_interrupt() 4175 for (i = 0; i < np->num_rx_rings; i++) { __niu_fastpath_interrupt() 4176 struct rx_ring_info *rp = &np->rx_rings[i]; __niu_fastpath_interrupt() 4184 niu_rxchan_intr(np, rp, ldn); __niu_fastpath_interrupt() 4187 for (i = 0; i < np->num_tx_rings; i++) { __niu_fastpath_interrupt() 4188 struct tx_ring_info *rp = &np->tx_rings[i]; __niu_fastpath_interrupt() 4196 niu_txchan_intr(np, rp, ldn); __niu_fastpath_interrupt() 4200 static void niu_schedule_napi(struct niu *np, struct niu_ldg *lp, niu_schedule_napi() argument 4207 __niu_fastpath_interrupt(np, lp->ldg_num, v0); niu_schedule_napi() 4215 struct niu *np = lp->np; niu_interrupt() local 4220 if (netif_msg_intr(np)) niu_interrupt() 4224 spin_lock_irqsave(&np->lock, flags); niu_interrupt() 4230 if (netif_msg_intr(np)) niu_interrupt() 4237 spin_unlock_irqrestore(&np->lock, flags); niu_interrupt() 4242 int err = niu_slowpath_interrupt(np, lp, v0, v1, v2); niu_interrupt() 4247 niu_schedule_napi(np, lp, v0, v1, v2); niu_interrupt() 4249 niu_ldg_rearm(np, lp, 1); niu_interrupt() 4251 spin_unlock_irqrestore(&np->lock, flags); niu_interrupt() 4256 static void niu_free_rx_ring_info(struct niu *np, struct rx_ring_info *rp) niu_free_rx_ring_info() argument 4259 np->ops->free_coherent(np->device, niu_free_rx_ring_info() 4265 np->ops->free_coherent(np->device, niu_free_rx_ring_info() 4273 niu_rbr_free(np, rp); niu_free_rx_ring_info() 4275 np->ops->free_coherent(np->device, niu_free_rx_ring_info() 4286 static void niu_free_tx_ring_info(struct niu *np, struct tx_ring_info *rp) niu_free_tx_ring_info() argument 4289 np->ops->free_coherent(np->device, niu_free_tx_ring_info() 4299 (void) release_tx_packet(np, rp, i); niu_free_tx_ring_info() 4302 np->ops->free_coherent(np->device, niu_free_tx_ring_info() 4313 static void niu_free_channels(struct niu *np) niu_free_channels() argument 4317 if (np->rx_rings) { niu_free_channels() 4318 for (i = 0; i < np->num_rx_rings; i++) { niu_free_channels() 4319 struct rx_ring_info *rp = &np->rx_rings[i]; niu_free_channels() 4321 niu_free_rx_ring_info(np, rp); niu_free_channels() 4323 kfree(np->rx_rings); niu_free_channels() 4324 np->rx_rings = NULL; niu_free_channels() 4325 np->num_rx_rings = 0; niu_free_channels() 4328 if (np->tx_rings) { niu_free_channels() 4329 for (i = 0; i < np->num_tx_rings; i++) { niu_free_channels() 4330 struct tx_ring_info *rp = &np->tx_rings[i]; niu_free_channels() 4332 niu_free_tx_ring_info(np, rp); niu_free_channels() 4334 kfree(np->tx_rings); niu_free_channels() 4335 np->tx_rings = NULL; niu_free_channels() 4336 np->num_tx_rings = 0; niu_free_channels() 4340 static int niu_alloc_rx_ring_info(struct niu *np, niu_alloc_rx_ring_info() argument 4350 rp->mbox = np->ops->alloc_coherent(np->device, niu_alloc_rx_ring_info() 4356 netdev_err(np->dev, "Coherent alloc gives misaligned RXDMA mailbox %p\n", niu_alloc_rx_ring_info() 4361 rp->rcr = np->ops->alloc_coherent(np->device, niu_alloc_rx_ring_info() 4367 netdev_err(np->dev, "Coherent alloc gives misaligned RXDMA RCR table %p\n", niu_alloc_rx_ring_info() 4374 rp->rbr = np->ops->alloc_coherent(np->device, niu_alloc_rx_ring_info() 4380 netdev_err(np->dev, "Coherent alloc gives misaligned RXDMA RBR table %p\n", niu_alloc_rx_ring_info() 4391 static void niu_set_max_burst(struct niu *np, struct tx_ring_info *rp) niu_set_max_burst() argument 4393 int mtu = np->dev->mtu; niu_set_max_burst() 4403 static int niu_alloc_tx_ring_info(struct niu *np, niu_alloc_tx_ring_info() argument 4408 rp->mbox = np->ops->alloc_coherent(np->device, niu_alloc_tx_ring_info() 4414 netdev_err(np->dev, "Coherent alloc gives misaligned TXDMA mailbox %p\n", niu_alloc_tx_ring_info() 4419 rp->descr = np->ops->alloc_coherent(np->device, niu_alloc_tx_ring_info() 4425 netdev_err(np->dev, "Coherent alloc gives misaligned TXDMA descr table %p\n", niu_alloc_tx_ring_info() 4438 niu_set_max_burst(np, rp); niu_alloc_tx_ring_info() 4443 static void niu_size_rbr(struct niu *np, struct rx_ring_info *rp) niu_size_rbr() argument 4454 if (np->dev->mtu > ETH_DATA_LEN) { niu_size_rbr() 4470 static int niu_alloc_channels(struct niu *np) niu_alloc_channels() argument 4472 struct niu_parent *parent = np->parent; niu_alloc_channels() 4479 port = np->port; niu_alloc_channels() 4495 np->num_rx_rings = num_rx_rings; niu_alloc_channels() 4497 np->rx_rings = rx_rings; niu_alloc_channels() 4499 netif_set_real_num_rx_queues(np->dev, num_rx_rings); niu_alloc_channels() 4501 for (i = 0; i < np->num_rx_rings; i++) { niu_alloc_channels() 4502 struct rx_ring_info *rp = &np->rx_rings[i]; niu_alloc_channels() 4504 rp->np = np; niu_alloc_channels() 4507 err = niu_alloc_rx_ring_info(np, rp); niu_alloc_channels() 4511 niu_size_rbr(np, rp); niu_alloc_channels() 4524 err = niu_rbr_fill(np, rp, GFP_KERNEL); niu_alloc_channels() 4535 np->num_tx_rings = num_tx_rings; niu_alloc_channels() 4537 np->tx_rings = tx_rings; niu_alloc_channels() 4539 netif_set_real_num_tx_queues(np->dev, num_tx_rings); niu_alloc_channels() 4541 for (i = 0; i < np->num_tx_rings; i++) { niu_alloc_channels() 4542 struct tx_ring_info *rp = &np->tx_rings[i]; niu_alloc_channels() 4544 rp->np = np; niu_alloc_channels() 4547 err = niu_alloc_tx_ring_info(np, rp); niu_alloc_channels() 4555 niu_free_channels(np); niu_alloc_channels() 4559 static int niu_tx_cs_sng_poll(struct niu *np, int channel) niu_tx_cs_sng_poll() argument 4571 static int niu_tx_channel_stop(struct niu *np, int channel) niu_tx_channel_stop() argument 4578 return niu_tx_cs_sng_poll(np, channel); niu_tx_channel_stop() 4581 static int niu_tx_cs_reset_poll(struct niu *np, int channel) niu_tx_cs_reset_poll() argument 4593 static int niu_tx_channel_reset(struct niu *np, int channel) niu_tx_channel_reset() argument 4601 err = niu_tx_cs_reset_poll(np, channel); niu_tx_channel_reset() 4608 static int niu_tx_channel_lpage_init(struct niu *np, int channel) niu_tx_channel_lpage_init() argument 4620 val = (u64)np->port << TX_LOG_PAGE_VLD_FUNC_SHIFT; niu_tx_channel_lpage_init() 4629 static void niu_txc_enable_port(struct niu *np, int on) niu_txc_enable_port() argument 4634 niu_lock_parent(np, flags); niu_txc_enable_port() 4636 mask = (u64)1 << np->port; niu_txc_enable_port() 4645 niu_unlock_parent(np, flags); niu_txc_enable_port() 4648 static void niu_txc_set_imask(struct niu *np, u64 imask) niu_txc_set_imask() argument 4653 niu_lock_parent(np, flags); niu_txc_set_imask() 4655 val &= ~TXC_INT_MASK_VAL(np->port); niu_txc_set_imask() 4656 val |= (imask << TXC_INT_MASK_VAL_SHIFT(np->port)); niu_txc_set_imask() 4657 niu_unlock_parent(np, flags); niu_txc_set_imask() 4660 static void niu_txc_port_dma_enable(struct niu *np, int on) niu_txc_port_dma_enable() argument 4667 for (i = 0; i < np->num_tx_rings; i++) niu_txc_port_dma_enable() 4668 val |= (1 << np->tx_rings[i].tx_channel); niu_txc_port_dma_enable() 4670 nw64(TXC_PORT_DMA(np->port), val); niu_txc_port_dma_enable() 4673 static int niu_init_one_tx_channel(struct niu *np, struct tx_ring_info *rp) niu_init_one_tx_channel() argument 4678 err = niu_tx_channel_stop(np, channel); niu_init_one_tx_channel() 4682 err = niu_tx_channel_reset(np, channel); niu_init_one_tx_channel() 4686 err = niu_tx_channel_lpage_init(np, channel); niu_init_one_tx_channel() 4695 netdev_err(np->dev, "TX ring channel %d DMA addr (%llx) is not aligned\n", niu_init_one_tx_channel() 4713 netdev_err(np->dev, "TX ring channel %d MBOX addr (%llx) has invalid bits\n", niu_init_one_tx_channel() 4727 static void niu_init_rdc_groups(struct niu *np) niu_init_rdc_groups() argument 4729 struct niu_rdc_tables *tp = &np->parent->rdc_group_cfg[np->port]; niu_init_rdc_groups() 4742 nw64(DEF_RDC(np->port), np->parent->rdc_default[np->port]); niu_init_rdc_groups() 4745 static void niu_init_drr_weight(struct niu *np) niu_init_drr_weight() argument 4747 int type = phy_decode(np->parent->port_phy, np->port); niu_init_drr_weight() 4760 nw64(PT_DRR_WT(np->port), val); niu_init_drr_weight() 4763 static int niu_init_hostinfo(struct niu *np) niu_init_hostinfo() argument 4765 struct niu_parent *parent = np->parent; niu_init_hostinfo() 4766 struct niu_rdc_tables *tp = &parent->rdc_group_cfg[np->port]; niu_init_hostinfo() 4767 int i, err, num_alt = niu_num_alt_addr(np); niu_init_hostinfo() 4770 err = niu_set_primary_mac_rdc_table(np, first_rdc_table, 1); niu_init_hostinfo() 4774 err = niu_set_multicast_mac_rdc_table(np, first_rdc_table, 1); niu_init_hostinfo() 4779 err = niu_set_alt_mac_rdc_table(np, i, first_rdc_table, 1); niu_init_hostinfo() 4787 static int niu_rx_channel_reset(struct niu *np, int channel) niu_rx_channel_reset() argument 4789 return niu_set_and_wait_clear(np, RXDMA_CFIG1(channel), niu_rx_channel_reset() 4794 static int niu_rx_channel_lpage_init(struct niu *np, int channel) niu_rx_channel_lpage_init() argument 4806 val = (u64)np->port << RX_LOG_PAGE_VLD_FUNC_SHIFT; niu_rx_channel_lpage_init() 4813 static void niu_rx_channel_wred_init(struct niu *np, struct rx_ring_info *rp) niu_rx_channel_wred_init() argument 4904 static int niu_enable_rx_channel(struct niu *np, int channel, int on) niu_enable_rx_channel() argument 4926 static int niu_init_one_rx_channel(struct niu *np, struct rx_ring_info *rp) niu_init_one_rx_channel() argument 4931 err = niu_rx_channel_reset(np, channel); niu_init_one_rx_channel() 4935 err = niu_rx_channel_lpage_init(np, channel); niu_init_one_rx_channel() 4939 niu_rx_channel_wred_init(np, rp); niu_init_one_rx_channel() 4966 err = niu_enable_rx_channel(np, channel, 1); niu_init_one_rx_channel() 4979 static int niu_init_rx_channels(struct niu *np) niu_init_rx_channels() argument 4985 niu_lock_parent(np, flags); niu_init_rx_channels() 4986 nw64(RX_DMA_CK_DIV, np->parent->rxdma_clock_divider); niu_init_rx_channels() 4988 niu_unlock_parent(np, flags); niu_init_rx_channels() 4992 niu_init_rdc_groups(np); niu_init_rx_channels() 4993 niu_init_drr_weight(np); niu_init_rx_channels() 4995 err = niu_init_hostinfo(np); niu_init_rx_channels() 4999 for (i = 0; i < np->num_rx_rings; i++) { niu_init_rx_channels() 5000 struct rx_ring_info *rp = &np->rx_rings[i]; niu_init_rx_channels() 5002 err = niu_init_one_rx_channel(np, rp); niu_init_rx_channels() 5010 static int niu_set_ip_frag_rule(struct niu *np) niu_set_ip_frag_rule() argument 5012 struct niu_parent *parent = np->parent; niu_set_ip_frag_rule() 5013 struct niu_classifier *cp = &np->clas; niu_set_ip_frag_rule() 5028 err = tcam_write(np, index, tp->key, tp->key_mask); niu_set_ip_frag_rule() 5031 err = tcam_assoc_write(np, index, tp->assoc_data); niu_set_ip_frag_rule() 5040 static int niu_init_classifier_hw(struct niu *np) niu_init_classifier_hw() argument 5042 struct niu_parent *parent = np->parent; niu_init_classifier_hw() 5043 struct niu_classifier *cp = &np->clas; niu_init_classifier_hw() 5049 err = niu_init_hostinfo(np); niu_init_classifier_hw() 5056 vlan_tbl_write(np, i, np->port, niu_init_classifier_hw() 5063 err = niu_set_alt_mac_rdc_table(np, ap->alt_mac_num, niu_init_classifier_hw() 5072 err = niu_set_tcam_key(np, i, parent->tcam_key[index]); niu_init_classifier_hw() 5075 err = niu_set_flow_key(np, i, parent->flow_key[index]); niu_init_classifier_hw() 5080 err = niu_set_ip_frag_rule(np); niu_init_classifier_hw() 5084 tcam_enable(np, 1); niu_init_classifier_hw() 5089 static int niu_zcp_write(struct niu *np, int index, u64 *data) niu_zcp_write() argument 5100 (ZCP_RAM_SEL_CFIFO(np->port) << ZCP_RAM_ACC_RAM_SEL_SHIFT))); niu_zcp_write() 5102 return niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY, niu_zcp_write() 5106 static int niu_zcp_read(struct niu *np, int index, u64 *data) niu_zcp_read() argument 5110 err = niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY, niu_zcp_read() 5113 netdev_err(np->dev, "ZCP read busy won't clear, ZCP_RAM_ACC[%llx]\n", niu_zcp_read() 5121 (ZCP_RAM_SEL_CFIFO(np->port) << ZCP_RAM_ACC_RAM_SEL_SHIFT))); niu_zcp_read() 5123 err = niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY, niu_zcp_read() 5126 netdev_err(np->dev, "ZCP read busy2 won't clear, ZCP_RAM_ACC[%llx]\n", niu_zcp_read() 5140 static void niu_zcp_cfifo_reset(struct niu *np) niu_zcp_cfifo_reset() argument 5144 val |= RESET_CFIFO_RST(np->port); niu_zcp_cfifo_reset() 5148 val &= ~RESET_CFIFO_RST(np->port); niu_zcp_cfifo_reset() 5152 static int niu_init_zcp(struct niu *np) niu_init_zcp() argument 5157 if (np->parent->plat_type != PLAT_TYPE_NIU) { niu_init_zcp() 5158 if (np->port == 0 || np->port == 1) niu_init_zcp() 5172 err = niu_zcp_write(np, i, data); niu_init_zcp() 5175 err = niu_zcp_read(np, i, rbuf); niu_init_zcp() 5180 niu_zcp_cfifo_reset(np); niu_init_zcp() 5181 nw64(CFIFO_ECC(np->port), 0); niu_init_zcp() 5189 static void niu_ipp_write(struct niu *np, int index, u64 *data) niu_ipp_write() argument 5203 static void niu_ipp_read(struct niu *np, int index, u64 *data) niu_ipp_read() argument 5213 static int niu_ipp_reset(struct niu *np) niu_ipp_reset() argument 5215 return niu_set_and_wait_clear_ipp(np, IPP_CFIG, IPP_CFIG_SOFT_RST, niu_ipp_reset() 5219 static int niu_init_ipp(struct niu *np) niu_init_ipp() argument 5224 if (np->parent->plat_type != PLAT_TYPE_NIU) { niu_init_ipp() 5225 if (np->port == 0 || np->port == 1) niu_init_ipp() 5239 niu_ipp_write(np, i, data); niu_init_ipp() 5240 niu_ipp_read(np, i, rbuf); niu_init_ipp() 5246 err = niu_ipp_reset(np); niu_init_ipp() 5270 static void niu_handle_led(struct niu *np, int status) niu_handle_led() argument 5275 if ((np->flags & NIU_FLAGS_10G) != 0 && niu_handle_led() 5276 (np->flags & NIU_FLAGS_FIBER) != 0) { niu_handle_led() 5289 static void niu_init_xif_xmac(struct niu *np) niu_init_xif_xmac() argument 5291 struct niu_link_config *lp = &np->link_config; niu_init_xif_xmac() 5294 if (np->flags & NIU_FLAGS_XCVR_SERDES) { niu_init_xif_xmac() 5312 if (np->flags & NIU_FLAGS_10G) { niu_init_xif_xmac() 5316 if (!(np->flags & NIU_FLAGS_FIBER) && niu_init_xif_xmac() 5317 !(np->flags & NIU_FLAGS_XCVR_SERDES)) niu_init_xif_xmac() 5334 if (np->flags & NIU_FLAGS_10G) { niu_init_xif_xmac() 5346 static void niu_init_xif_bmac(struct niu *np) niu_init_xif_bmac() argument 5348 struct niu_link_config *lp = &np->link_config; niu_init_xif_bmac() 5366 if (!(np->flags & NIU_FLAGS_10G) && niu_init_xif_bmac() 5367 !(np->flags & NIU_FLAGS_FIBER) && niu_init_xif_bmac() 5376 static void niu_init_xif(struct niu *np) niu_init_xif() argument 5378 if (np->flags & NIU_FLAGS_XMAC) niu_init_xif() 5379 niu_init_xif_xmac(np); niu_init_xif() 5381 niu_init_xif_bmac(np); niu_init_xif() 5384 static void niu_pcs_mii_reset(struct niu *np) niu_pcs_mii_reset() argument 5396 static void niu_xpcs_reset(struct niu *np) niu_xpcs_reset() argument 5408 static int niu_init_pcs(struct niu *np) niu_init_pcs() argument 5410 struct niu_link_config *lp = &np->link_config; niu_init_pcs() 5413 switch (np->flags & (NIU_FLAGS_10G | niu_init_pcs() 5420 niu_pcs_mii_reset(np); niu_init_pcs() 5427 if (!(np->flags & NIU_FLAGS_XMAC)) niu_init_pcs() 5435 niu_xpcs_reset(np); niu_init_pcs() 5452 niu_pcs_mii_reset(np); niu_init_pcs() 5462 niu_pcs_mii_reset(np); niu_init_pcs() 5472 static int niu_reset_tx_xmac(struct niu *np) niu_reset_tx_xmac() argument 5474 return niu_set_and_wait_clear_mac(np, XTXMAC_SW_RST, niu_reset_tx_xmac() 5480 static int niu_reset_tx_bmac(struct niu *np) niu_reset_tx_bmac() argument 5492 dev_err(np->device, "Port %u TX BMAC would not reset, BTXMAC_SW_RST[%llx]\n", niu_reset_tx_bmac() 5493 np->port, niu_reset_tx_bmac() 5501 static int niu_reset_tx_mac(struct niu *np) niu_reset_tx_mac() argument 5503 if (np->flags & NIU_FLAGS_XMAC) niu_reset_tx_mac() 5504 return niu_reset_tx_xmac(np); niu_reset_tx_mac() 5506 return niu_reset_tx_bmac(np); niu_reset_tx_mac() 5509 static void niu_init_tx_xmac(struct niu *np, u64 min, u64 max) niu_init_tx_xmac() argument 5525 if (np->flags & NIU_FLAGS_10G) { niu_init_tx_xmac() 5545 static void niu_init_tx_bmac(struct niu *np, u64 min, u64 max) niu_init_tx_bmac() argument 5562 static void niu_init_tx_mac(struct niu *np) niu_init_tx_mac() argument 5567 if (np->dev->mtu > ETH_DATA_LEN) niu_init_tx_mac() 5577 if (np->flags & NIU_FLAGS_XMAC) niu_init_tx_mac() 5578 niu_init_tx_xmac(np, min, max); niu_init_tx_mac() 5580 niu_init_tx_bmac(np, min, max); niu_init_tx_mac() 5583 static int niu_reset_rx_xmac(struct niu *np) niu_reset_rx_xmac() argument 5597 dev_err(np->device, "Port %u RX XMAC would not reset, XRXMAC_SW_RST[%llx]\n", niu_reset_rx_xmac() 5598 np->port, niu_reset_rx_xmac() 5606 static int niu_reset_rx_bmac(struct niu *np) niu_reset_rx_bmac() argument 5618 dev_err(np->device, "Port %u RX BMAC would not reset, BRXMAC_SW_RST[%llx]\n", niu_reset_rx_bmac() 5619 np->port, niu_reset_rx_bmac() 5627 static int niu_reset_rx_mac(struct niu *np) niu_reset_rx_mac() argument 5629 if (np->flags & NIU_FLAGS_XMAC) niu_reset_rx_mac() 5630 return niu_reset_rx_xmac(np); niu_reset_rx_mac() 5632 return niu_reset_rx_bmac(np); niu_reset_rx_mac() 5635 static void niu_init_rx_xmac(struct niu *np) niu_init_rx_xmac() argument 5637 struct niu_parent *parent = np->parent; niu_init_rx_xmac() 5638 struct niu_rdc_tables *tp = &parent->rdc_group_cfg[np->port]; niu_init_rx_xmac() 5651 niu_set_primary_mac_rdc_table(np, first_rdc_table, 1); niu_init_rx_xmac() 5652 niu_set_multicast_mac_rdc_table(np, first_rdc_table, 1); niu_init_rx_xmac() 5687 static void niu_init_rx_bmac(struct niu *np) niu_init_rx_bmac() argument 5689 struct niu_parent *parent = np->parent; niu_init_rx_bmac() 5690 struct niu_rdc_tables *tp = &parent->rdc_group_cfg[np->port]; niu_init_rx_bmac() 5702 niu_set_primary_mac_rdc_table(np, first_rdc_table, 1); niu_init_rx_bmac() 5703 niu_set_multicast_mac_rdc_table(np, first_rdc_table, 1); niu_init_rx_bmac() 5722 static void niu_init_rx_mac(struct niu *np) niu_init_rx_mac() argument 5724 niu_set_primary_mac(np, np->dev->dev_addr); niu_init_rx_mac() 5726 if (np->flags & NIU_FLAGS_XMAC) niu_init_rx_mac() 5727 niu_init_rx_xmac(np); niu_init_rx_mac() 5729 niu_init_rx_bmac(np); niu_init_rx_mac() 5732 static void niu_enable_tx_xmac(struct niu *np, int on) niu_enable_tx_xmac() argument 5743 static void niu_enable_tx_bmac(struct niu *np, int on) niu_enable_tx_bmac() argument 5754 static void niu_enable_tx_mac(struct niu *np, int on) niu_enable_tx_mac() argument 5756 if (np->flags & NIU_FLAGS_XMAC) niu_enable_tx_mac() 5757 niu_enable_tx_xmac(np, on); niu_enable_tx_mac() 5759 niu_enable_tx_bmac(np, on); niu_enable_tx_mac() 5762 static void niu_enable_rx_xmac(struct niu *np, int on) niu_enable_rx_xmac() argument 5769 if (np->flags & NIU_FLAGS_MCAST) niu_enable_rx_xmac() 5771 if (np->flags & NIU_FLAGS_PROMISC) niu_enable_rx_xmac() 5781 static void niu_enable_rx_bmac(struct niu *np, int on) niu_enable_rx_bmac() argument 5788 if (np->flags & NIU_FLAGS_MCAST) niu_enable_rx_bmac() 5790 if (np->flags & NIU_FLAGS_PROMISC) niu_enable_rx_bmac() 5800 static void niu_enable_rx_mac(struct niu *np, int on) niu_enable_rx_mac() argument 5802 if (np->flags & NIU_FLAGS_XMAC) niu_enable_rx_mac() 5803 niu_enable_rx_xmac(np, on); niu_enable_rx_mac() 5805 niu_enable_rx_bmac(np, on); niu_enable_rx_mac() 5808 static int niu_init_mac(struct niu *np) niu_init_mac() argument 5812 niu_init_xif(np); niu_init_mac() 5813 err = niu_init_pcs(np); niu_init_mac() 5817 err = niu_reset_tx_mac(np); niu_init_mac() 5820 niu_init_tx_mac(np); niu_init_mac() 5821 err = niu_reset_rx_mac(np); niu_init_mac() 5824 niu_init_rx_mac(np); niu_init_mac() 5831 niu_init_tx_mac(np); niu_init_mac() 5832 niu_enable_tx_mac(np, 1); niu_init_mac() 5834 niu_enable_rx_mac(np, 1); niu_init_mac() 5839 static void niu_stop_one_tx_channel(struct niu *np, struct tx_ring_info *rp) niu_stop_one_tx_channel() argument 5841 (void) niu_tx_channel_stop(np, rp->tx_channel); niu_stop_one_tx_channel() 5844 static void niu_stop_tx_channels(struct niu *np) niu_stop_tx_channels() argument 5848 for (i = 0; i < np->num_tx_rings; i++) { niu_stop_tx_channels() 5849 struct tx_ring_info *rp = &np->tx_rings[i]; niu_stop_tx_channels() 5851 niu_stop_one_tx_channel(np, rp); niu_stop_tx_channels() 5855 static void niu_reset_one_tx_channel(struct niu *np, struct tx_ring_info *rp) niu_reset_one_tx_channel() argument 5857 (void) niu_tx_channel_reset(np, rp->tx_channel); niu_reset_one_tx_channel() 5860 static void niu_reset_tx_channels(struct niu *np) niu_reset_tx_channels() argument 5864 for (i = 0; i < np->num_tx_rings; i++) { niu_reset_tx_channels() 5865 struct tx_ring_info *rp = &np->tx_rings[i]; niu_reset_tx_channels() 5867 niu_reset_one_tx_channel(np, rp); niu_reset_tx_channels() 5871 static void niu_stop_one_rx_channel(struct niu *np, struct rx_ring_info *rp) niu_stop_one_rx_channel() argument 5873 (void) niu_enable_rx_channel(np, rp->rx_channel, 0); niu_stop_one_rx_channel() 5876 static void niu_stop_rx_channels(struct niu *np) niu_stop_rx_channels() argument 5880 for (i = 0; i < np->num_rx_rings; i++) { niu_stop_rx_channels() 5881 struct rx_ring_info *rp = &np->rx_rings[i]; niu_stop_rx_channels() 5883 niu_stop_one_rx_channel(np, rp); niu_stop_rx_channels() 5887 static void niu_reset_one_rx_channel(struct niu *np, struct rx_ring_info *rp) niu_reset_one_rx_channel() argument 5891 (void) niu_rx_channel_reset(np, channel); niu_reset_one_rx_channel() 5894 (void) niu_enable_rx_channel(np, channel, 0); niu_reset_one_rx_channel() 5897 static void niu_reset_rx_channels(struct niu *np) niu_reset_rx_channels() argument 5901 for (i = 0; i < np->num_rx_rings; i++) { niu_reset_rx_channels() 5902 struct rx_ring_info *rp = &np->rx_rings[i]; niu_reset_rx_channels() 5904 niu_reset_one_rx_channel(np, rp); niu_reset_rx_channels() 5908 static void niu_disable_ipp(struct niu *np) niu_disable_ipp() argument 5922 netdev_err(np->dev, "IPP would not quiesce, rd_ptr[%llx] wr_ptr[%llx]\n", niu_disable_ipp() 5934 (void) niu_ipp_reset(np); niu_disable_ipp() 5937 static int niu_init_hw(struct niu *np) niu_init_hw() argument 5941 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize TXC\n"); niu_init_hw() 5942 niu_txc_enable_port(np, 1); niu_init_hw() 5943 niu_txc_port_dma_enable(np, 1); niu_init_hw() 5944 niu_txc_set_imask(np, 0); niu_init_hw() 5946 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize TX channels\n"); niu_init_hw() 5947 for (i = 0; i < np->num_tx_rings; i++) { niu_init_hw() 5948 struct tx_ring_info *rp = &np->tx_rings[i]; niu_init_hw() 5950 err = niu_init_one_tx_channel(np, rp); niu_init_hw() 5955 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize RX channels\n"); niu_init_hw() 5956 err = niu_init_rx_channels(np); niu_init_hw() 5960 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize classifier\n"); niu_init_hw() 5961 err = niu_init_classifier_hw(np); niu_init_hw() 5965 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize ZCP\n"); niu_init_hw() 5966 err = niu_init_zcp(np); niu_init_hw() 5970 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize IPP\n"); niu_init_hw() 5971 err = niu_init_ipp(np); niu_init_hw() 5975 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize MAC\n"); niu_init_hw() 5976 err = niu_init_mac(np); niu_init_hw() 5983 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Uninit IPP\n"); niu_init_hw() 5984 niu_disable_ipp(np); niu_init_hw() 5987 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Uninit RX channels\n"); niu_init_hw() 5988 niu_stop_rx_channels(np); niu_init_hw() 5989 niu_reset_rx_channels(np); niu_init_hw() 5992 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Uninit TX channels\n"); niu_init_hw() 5993 niu_stop_tx_channels(np); niu_init_hw() 5994 niu_reset_tx_channels(np); niu_init_hw() 5999 static void niu_stop_hw(struct niu *np) niu_stop_hw() argument 6001 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Disable interrupts\n"); niu_stop_hw() 6002 niu_enable_interrupts(np, 0); niu_stop_hw() 6004 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Disable RX MAC\n"); niu_stop_hw() 6005 niu_enable_rx_mac(np, 0); niu_stop_hw() 6007 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Disable IPP\n"); niu_stop_hw() 6008 niu_disable_ipp(np); niu_stop_hw() 6010 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Stop TX channels\n"); niu_stop_hw() 6011 niu_stop_tx_channels(np); niu_stop_hw() 6013 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Stop RX channels\n"); niu_stop_hw() 6014 niu_stop_rx_channels(np); niu_stop_hw() 6016 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Reset TX channels\n"); niu_stop_hw() 6017 niu_reset_tx_channels(np); niu_stop_hw() 6019 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Reset RX channels\n"); niu_stop_hw() 6020 niu_reset_rx_channels(np); niu_stop_hw() 6023 static void niu_set_irq_name(struct niu *np) niu_set_irq_name() argument 6025 int port = np->port; niu_set_irq_name() 6028 sprintf(np->irq_name[0], "%s:MAC", np->dev->name); niu_set_irq_name() 6031 sprintf(np->irq_name[1], "%s:MIF", np->dev->name); niu_set_irq_name() 6032 sprintf(np->irq_name[2], "%s:SYSERR", np->dev->name); niu_set_irq_name() 6036 for (i = 0; i < np->num_ldg - j; i++) { niu_set_irq_name() 6037 if (i < np->num_rx_rings) niu_set_irq_name() 6038 sprintf(np->irq_name[i+j], "%s-rx-%d", niu_set_irq_name() 6039 np->dev->name, i); niu_set_irq_name() 6040 else if (i < np->num_tx_rings + np->num_rx_rings) niu_set_irq_name() 6041 sprintf(np->irq_name[i+j], "%s-tx-%d", np->dev->name, niu_set_irq_name() 6042 i - np->num_rx_rings); niu_set_irq_name() 6046 static int niu_request_irq(struct niu *np) niu_request_irq() argument 6050 niu_set_irq_name(np); niu_request_irq() 6053 for (i = 0; i < np->num_ldg; i++) { niu_request_irq() 6054 struct niu_ldg *lp = &np->ldg[i]; niu_request_irq() 6057 np->irq_name[i], lp); niu_request_irq() 6067 struct niu_ldg *lp = &np->ldg[j]; niu_request_irq() 6074 static void niu_free_irq(struct niu *np) niu_free_irq() argument 6078 for (i = 0; i < np->num_ldg; i++) { niu_free_irq() 6079 struct niu_ldg *lp = &np->ldg[i]; niu_free_irq() 6085 static void niu_enable_napi(struct niu *np) niu_enable_napi() argument 6089 for (i = 0; i < np->num_ldg; i++) niu_enable_napi() 6090 napi_enable(&np->ldg[i].napi); niu_enable_napi() 6093 static void niu_disable_napi(struct niu *np) niu_disable_napi() argument 6097 for (i = 0; i < np->num_ldg; i++) niu_disable_napi() 6098 napi_disable(&np->ldg[i].napi); niu_disable_napi() 6103 struct niu *np = netdev_priv(dev); niu_open() local 6108 err = niu_alloc_channels(np); niu_open() 6112 err = niu_enable_interrupts(np, 0); niu_open() 6116 err = niu_request_irq(np); niu_open() 6120 niu_enable_napi(np); niu_open() 6122 spin_lock_irq(&np->lock); niu_open() 6124 err = niu_init_hw(np); niu_open() 6126 init_timer(&np->timer); niu_open() 6127 np->timer.expires = jiffies + HZ; niu_open() 6128 np->timer.data = (unsigned long) np; niu_open() 6129 np->timer.function = niu_timer; niu_open() 6131 err = niu_enable_interrupts(np, 1); niu_open() 6133 niu_stop_hw(np); niu_open() 6136 spin_unlock_irq(&np->lock); niu_open() 6139 niu_disable_napi(np); niu_open() 6145 if (np->link_config.loopback_mode != LOOPBACK_DISABLED) niu_open() 6148 add_timer(&np->timer); niu_open() 6153 niu_free_irq(np); niu_open() 6156 niu_free_channels(np); niu_open() 6162 static void niu_full_shutdown(struct niu *np, struct net_device *dev) niu_full_shutdown() argument 6164 cancel_work_sync(&np->reset_task); niu_full_shutdown() 6166 niu_disable_napi(np); niu_full_shutdown() 6169 del_timer_sync(&np->timer); niu_full_shutdown() 6171 spin_lock_irq(&np->lock); niu_full_shutdown() 6173 niu_stop_hw(np); niu_full_shutdown() 6175 spin_unlock_irq(&np->lock); niu_full_shutdown() 6180 struct niu *np = netdev_priv(dev); niu_close() local 6182 niu_full_shutdown(np, dev); niu_close() 6184 niu_free_irq(np); niu_close() 6186 niu_free_channels(np); niu_close() 6188 niu_handle_led(np, 0); niu_close() 6193 static void niu_sync_xmac_stats(struct niu *np) niu_sync_xmac_stats() argument 6195 struct niu_xmac_stats *mp = &np->mac_stats.xmac; niu_sync_xmac_stats() 6218 static void niu_sync_bmac_stats(struct niu *np) niu_sync_bmac_stats() argument 6220 struct niu_bmac_stats *mp = &np->mac_stats.bmac; niu_sync_bmac_stats() 6231 static void niu_sync_mac_stats(struct niu *np) niu_sync_mac_stats() argument 6233 if (np->flags & NIU_FLAGS_XMAC) niu_sync_mac_stats() 6234 niu_sync_xmac_stats(np); niu_sync_mac_stats() 6236 niu_sync_bmac_stats(np); niu_sync_mac_stats() 6239 static void niu_get_rx_stats(struct niu *np, niu_get_rx_stats() argument 6248 rx_rings = ACCESS_ONCE(np->rx_rings); niu_get_rx_stats() 6252 for (i = 0; i < np->num_rx_rings; i++) { niu_get_rx_stats() 6255 niu_sync_rx_discard_stats(np, rp, 0); niu_get_rx_stats() 6270 static void niu_get_tx_stats(struct niu *np, niu_get_tx_stats() argument 6279 tx_rings = ACCESS_ONCE(np->tx_rings); niu_get_tx_stats() 6283 for (i = 0; i < np->num_tx_rings; i++) { niu_get_tx_stats() 6300 struct niu *np = netdev_priv(dev); niu_get_stats() local 6303 niu_get_rx_stats(np, stats); niu_get_stats() 6304 niu_get_tx_stats(np, stats); niu_get_stats() 6310 static void niu_load_hash_xmac(struct niu *np, u16 *hash) niu_load_hash_xmac() argument 6318 static void niu_load_hash_bmac(struct niu *np, u16 *hash) niu_load_hash_bmac() argument 6326 static void niu_load_hash(struct niu *np, u16 *hash) niu_load_hash() argument 6328 if (np->flags & NIU_FLAGS_XMAC) niu_load_hash() 6329 niu_load_hash_xmac(np, hash); niu_load_hash() 6331 niu_load_hash_bmac(np, hash); niu_load_hash() 6336 struct niu *np = netdev_priv(dev); niu_set_rx_mode() local 6342 spin_lock_irqsave(&np->lock, flags); niu_set_rx_mode() 6343 niu_enable_rx_mac(np, 0); niu_set_rx_mode() 6345 np->flags &= ~(NIU_FLAGS_MCAST | NIU_FLAGS_PROMISC); niu_set_rx_mode() 6347 np->flags |= NIU_FLAGS_PROMISC; niu_set_rx_mode() 6349 np->flags |= NIU_FLAGS_MCAST; niu_set_rx_mode() 6352 if (alt_cnt > niu_num_alt_addr(np)) { niu_set_rx_mode() 6354 np->flags |= NIU_FLAGS_PROMISC; niu_set_rx_mode() 6361 err = niu_set_alt_mac(np, index, ha->addr); netdev_for_each_uc_addr() 6365 err = niu_enable_alt_mac(np, index, 1); netdev_for_each_uc_addr() 6374 if (np->flags & NIU_FLAGS_XMAC) 6378 for (i = alt_start; i < niu_num_alt_addr(np); i++) { 6379 err = niu_enable_alt_mac(np, i, 0); 6397 if (np->flags & NIU_FLAGS_MCAST) 6398 niu_load_hash(np, hash); 6400 niu_enable_rx_mac(np, 1); 6401 spin_unlock_irqrestore(&np->lock, flags); 6406 struct niu *np = netdev_priv(dev); niu_set_mac_addr() local 6418 spin_lock_irqsave(&np->lock, flags); niu_set_mac_addr() 6419 niu_enable_rx_mac(np, 0); niu_set_mac_addr() 6420 niu_set_primary_mac(np, dev->dev_addr); niu_set_mac_addr() 6421 niu_enable_rx_mac(np, 1); niu_set_mac_addr() 6422 spin_unlock_irqrestore(&np->lock, flags); niu_set_mac_addr() 6432 static void niu_netif_stop(struct niu *np) niu_netif_stop() argument 6434 np->dev->trans_start = jiffies; /* prevent tx timeout */ niu_netif_stop() 6436 niu_disable_napi(np); niu_netif_stop() 6438 netif_tx_disable(np->dev); niu_netif_stop() 6441 static void niu_netif_start(struct niu *np) niu_netif_start() argument 6447 netif_tx_wake_all_queues(np->dev); niu_netif_start() 6449 niu_enable_napi(np); niu_netif_start() 6451 niu_enable_interrupts(np, 1); niu_netif_start() 6454 static void niu_reset_buffers(struct niu *np) niu_reset_buffers() argument 6458 if (np->rx_rings) { niu_reset_buffers() 6459 for (i = 0; i < np->num_rx_rings; i++) { niu_reset_buffers() 6460 struct rx_ring_info *rp = &np->rx_rings[i]; niu_reset_buffers() 6476 err = niu_rbr_add_page(np, rp, GFP_ATOMIC, k); niu_reset_buffers() 6487 if (np->tx_rings) { niu_reset_buffers() 6488 for (i = 0; i < np->num_tx_rings; i++) { niu_reset_buffers() 6489 struct tx_ring_info *rp = &np->tx_rings[i]; niu_reset_buffers() 6493 (void) release_tx_packet(np, rp, j); niu_reset_buffers() 6506 struct niu *np = container_of(work, struct niu, reset_task); niu_reset_task() local 6510 spin_lock_irqsave(&np->lock, flags); niu_reset_task() 6511 if (!netif_running(np->dev)) { niu_reset_task() 6512 spin_unlock_irqrestore(&np->lock, flags); niu_reset_task() 6516 spin_unlock_irqrestore(&np->lock, flags); niu_reset_task() 6518 del_timer_sync(&np->timer); niu_reset_task() 6520 niu_netif_stop(np); niu_reset_task() 6522 spin_lock_irqsave(&np->lock, flags); niu_reset_task() 6524 niu_stop_hw(np); niu_reset_task() 6526 spin_unlock_irqrestore(&np->lock, flags); niu_reset_task() 6528 niu_reset_buffers(np); niu_reset_task() 6530 spin_lock_irqsave(&np->lock, flags); niu_reset_task() 6532 err = niu_init_hw(np); niu_reset_task() 6534 np->timer.expires = jiffies + HZ; niu_reset_task() 6535 add_timer(&np->timer); niu_reset_task() 6536 niu_netif_start(np); niu_reset_task() 6539 spin_unlock_irqrestore(&np->lock, flags); niu_reset_task() 6544 struct niu *np = netdev_priv(dev); niu_tx_timeout() local 6546 dev_err(np->device, "%s: Transmit timed out, resetting\n", niu_tx_timeout() 6549 schedule_work(&np->reset_task); niu_tx_timeout() 6632 struct niu *np = netdev_priv(dev); niu_start_xmit() local 6643 rp = &np->tx_rings[i]; niu_start_xmit() 6648 dev_err(np->device, "%s: BUG! Tx ring full when queue awake!\n", dev->name); niu_start_xmit() 6679 mapping = np->ops->map_single(np->device, skb->data, niu_start_xmit() 6719 mapping = np->ops->map_page(np->device, skb_frag_page(frag), niu_start_xmit() 6754 struct niu *np = netdev_priv(dev); niu_change_mtu() local 6769 niu_full_shutdown(np, dev); niu_change_mtu() 6771 niu_free_channels(np); niu_change_mtu() 6773 niu_enable_napi(np); niu_change_mtu() 6775 err = niu_alloc_channels(np); niu_change_mtu() 6779 spin_lock_irq(&np->lock); niu_change_mtu() 6781 err = niu_init_hw(np); niu_change_mtu() 6783 init_timer(&np->timer); niu_change_mtu() 6784 np->timer.expires = jiffies + HZ; niu_change_mtu() 6785 np->timer.data = (unsigned long) np; niu_change_mtu() 6786 np->timer.function = niu_timer; niu_change_mtu() 6788 err = niu_enable_interrupts(np, 1); niu_change_mtu() 6790 niu_stop_hw(np); niu_change_mtu() 6793 spin_unlock_irq(&np->lock); niu_change_mtu() 6797 if (np->link_config.loopback_mode != LOOPBACK_DISABLED) niu_change_mtu() 6800 add_timer(&np->timer); niu_change_mtu() 6809 struct niu *np = netdev_priv(dev); niu_get_drvinfo() local 6810 struct niu_vpd *vpd = &np->vpd; niu_get_drvinfo() 6816 if (np->parent->plat_type != PLAT_TYPE_NIU) niu_get_drvinfo() 6817 strlcpy(info->bus_info, pci_name(np->pdev), niu_get_drvinfo() 6823 struct niu *np = netdev_priv(dev); niu_get_settings() local 6826 lp = &np->link_config; niu_get_settings() 6829 cmd->phy_address = np->phy_addr; niu_get_settings() 6835 cmd->port = (np->flags & NIU_FLAGS_FIBER) ? PORT_FIBRE : PORT_TP; niu_get_settings() 6836 cmd->transceiver = (np->flags & NIU_FLAGS_XCVR_SERDES) ? niu_get_settings() 6844 struct niu *np = netdev_priv(dev); niu_set_settings() local 6845 struct niu_link_config *lp = &np->link_config; niu_set_settings() 6851 return niu_init_link(np); niu_set_settings() 6856 struct niu *np = netdev_priv(dev); niu_get_msglevel() local 6857 return np->msg_enable; niu_get_msglevel() 6862 struct niu *np = netdev_priv(dev); niu_set_msglevel() local 6863 np->msg_enable = value; niu_set_msglevel() 6868 struct niu *np = netdev_priv(dev); niu_nway_reset() local 6870 if (np->link_config.autoneg) niu_nway_reset() 6871 return niu_init_link(np); niu_nway_reset() 6878 struct niu *np = netdev_priv(dev); niu_get_eeprom_len() local 6880 return np->eeprom_len; niu_get_eeprom_len() 6886 struct niu *np = netdev_priv(dev); niu_get_eeprom() local 6894 if (offset >= np->eeprom_len) niu_get_eeprom() 6896 if (offset + len > np->eeprom_len) niu_get_eeprom() 6897 len = eeprom->len = np->eeprom_len - offset; niu_get_eeprom() 7082 static int niu_get_hash_opts(struct niu *np, struct ethtool_rxnfc *nfc) niu_get_hash_opts() argument 7091 if (np->parent->tcam_key[class - CLASS_CODE_USER_PROG1] & niu_get_hash_opts() 7095 nfc->data = niu_flowkey_to_ethflow(np->parent->flow_key[class - niu_get_hash_opts() 7176 static int niu_get_ethtool_tcam_entry(struct niu *np, niu_get_ethtool_tcam_entry() argument 7179 struct niu_parent *parent = np->parent; niu_get_ethtool_tcam_entry() 7186 idx = tcam_get_index(np, (u16)nfc->fs.location); niu_get_ethtool_tcam_entry() 7190 netdev_info(np->dev, "niu%d: entry [%d] invalid for idx[%d]\n", niu_get_ethtool_tcam_entry() 7200 netdev_info(np->dev, "niu%d: niu_class_to_ethflow failed\n", niu_get_ethtool_tcam_entry() 7250 nfc->data = tcam_get_size(np); niu_get_ethtool_tcam_entry() 7255 static int niu_get_ethtool_tcam_all(struct niu *np, niu_get_ethtool_tcam_all() argument 7259 struct niu_parent *parent = np->parent; niu_get_ethtool_tcam_all() 7266 nfc->data = tcam_get_size(np); niu_get_ethtool_tcam_all() 7268 niu_lock_parent(np, flags); niu_get_ethtool_tcam_all() 7270 idx = tcam_get_index(np, i); niu_get_ethtool_tcam_all() 7281 niu_unlock_parent(np, flags); niu_get_ethtool_tcam_all() 7291 struct niu *np = netdev_priv(dev); niu_get_nfc() local 7296 ret = niu_get_hash_opts(np, cmd); niu_get_nfc() 7299 cmd->data = np->num_rx_rings; niu_get_nfc() 7302 cmd->rule_cnt = tcam_get_valid_entry_cnt(np); niu_get_nfc() 7305 ret = niu_get_ethtool_tcam_entry(np, cmd); niu_get_nfc() 7308 ret = niu_get_ethtool_tcam_all(np, cmd, rule_locs); niu_get_nfc() 7318 static int niu_set_hash_opts(struct niu *np, struct ethtool_rxnfc *nfc) niu_set_hash_opts() argument 7332 niu_lock_parent(np, flags); niu_set_hash_opts() 7333 flow_key = np->parent->tcam_key[class - niu_set_hash_opts() 7337 np->parent->tcam_key[class - CLASS_CODE_USER_PROG1] = flow_key; niu_set_hash_opts() 7338 niu_unlock_parent(np, flags); niu_set_hash_opts() 7342 if (np->parent->tcam_key[class - CLASS_CODE_USER_PROG1] & niu_set_hash_opts() 7344 niu_lock_parent(np, flags); niu_set_hash_opts() 7345 flow_key = np->parent->tcam_key[class - niu_set_hash_opts() 7350 np->parent->tcam_key[class - CLASS_CODE_USER_PROG1] = niu_set_hash_opts() 7352 niu_unlock_parent(np, flags); niu_set_hash_opts() 7359 niu_lock_parent(np, flags); niu_set_hash_opts() 7361 np->parent->flow_key[class - CLASS_CODE_USER_PROG1] = flow_key; niu_set_hash_opts() 7362 niu_unlock_parent(np, flags); niu_set_hash_opts() 7435 static int niu_add_ethtool_tcam_entry(struct niu *np, niu_add_ethtool_tcam_entry() argument 7438 struct niu_parent *parent = np->parent; niu_add_ethtool_tcam_entry() 7441 struct niu_rdc_tables *rdc_table = &parent->rdc_group_cfg[np->port]; niu_add_ethtool_tcam_entry() 7451 if (idx >= tcam_get_size(np)) niu_add_ethtool_tcam_entry() 7463 niu_lock_parent(np, flags); niu_add_ethtool_tcam_entry() 7491 ret = tcam_user_ip_class_set(np, class, 0, niu_add_ethtool_tcam_entry() 7498 ret = tcam_user_ip_class_enable(np, class, 1); niu_add_ethtool_tcam_entry() 7509 netdev_info(np->dev, "niu%d: %s(): Could not find/insert class for pid %d\n", niu_add_ethtool_tcam_entry() 7514 niu_unlock_parent(np, flags); niu_add_ethtool_tcam_entry() 7521 niu_lock_parent(np, flags); niu_add_ethtool_tcam_entry() 7523 idx = tcam_get_index(np, idx); niu_add_ethtool_tcam_entry() 7543 netdev_info(np->dev, "niu%d: In %s(): flow %d for IPv6 not implemented\n", niu_add_ethtool_tcam_entry() 7551 netdev_info(np->dev, "niu%d: In %s(): Unknown flow type %d\n", niu_add_ethtool_tcam_entry() 7561 if (fsp->ring_cookie >= np->num_rx_rings) { niu_add_ethtool_tcam_entry() 7562 netdev_info(np->dev, "niu%d: In %s(): Invalid RX ring %lld\n", niu_add_ethtool_tcam_entry() 7573 err = tcam_write(np, idx, tp->key, tp->key_mask); niu_add_ethtool_tcam_entry() 7578 err = tcam_assoc_write(np, idx, tp->assoc_data); niu_add_ethtool_tcam_entry() 7586 np->clas.tcam_valid_entries++; niu_add_ethtool_tcam_entry() 7588 niu_unlock_parent(np, flags); niu_add_ethtool_tcam_entry() 7593 static int niu_del_ethtool_tcam_entry(struct niu *np, u32 loc) niu_del_ethtool_tcam_entry() argument 7595 struct niu_parent *parent = np->parent; niu_del_ethtool_tcam_entry() 7602 if (loc >= tcam_get_size(np)) niu_del_ethtool_tcam_entry() 7605 niu_lock_parent(np, flags); niu_del_ethtool_tcam_entry() 7607 idx = tcam_get_index(np, loc); niu_del_ethtool_tcam_entry() 7621 ret = tcam_user_ip_class_enable(np, niu_del_ethtool_tcam_entry() 7633 netdev_info(np->dev, "niu%d: In %s(): Usr class 0x%llx not found\n", niu_del_ethtool_tcam_entry() 7641 ret = tcam_flush(np, idx); niu_del_ethtool_tcam_entry() 7647 np->clas.tcam_valid_entries--; niu_del_ethtool_tcam_entry() 7649 niu_unlock_parent(np, flags); niu_del_ethtool_tcam_entry() 7656 struct niu *np = netdev_priv(dev); niu_set_nfc() local 7661 ret = niu_set_hash_opts(np, cmd); niu_set_nfc() 7664 ret = niu_add_ethtool_tcam_entry(np, cmd); niu_set_nfc() 7667 ret = niu_del_ethtool_tcam_entry(np, cmd->fs.location); niu_set_nfc() 7757 struct niu *np = netdev_priv(dev); niu_get_strings() local 7763 if (np->flags & NIU_FLAGS_XMAC) { niu_get_strings() 7772 for (i = 0; i < np->num_rx_rings; i++) { niu_get_strings() 7777 for (i = 0; i < np->num_tx_rings; i++) { niu_get_strings() 7786 struct niu *np = netdev_priv(dev); niu_get_sset_count() local 7791 return (np->flags & NIU_FLAGS_XMAC ? niu_get_sset_count() 7794 (np->num_rx_rings * NUM_RXCHAN_STAT_KEYS) + niu_get_sset_count() 7795 (np->num_tx_rings * NUM_TXCHAN_STAT_KEYS); niu_get_sset_count() 7801 struct niu *np = netdev_priv(dev); niu_get_ethtool_stats() local 7804 niu_sync_mac_stats(np); niu_get_ethtool_stats() 7805 if (np->flags & NIU_FLAGS_XMAC) { niu_get_ethtool_stats() 7806 memcpy(data, &np->mac_stats.xmac, niu_get_ethtool_stats() 7810 memcpy(data, &np->mac_stats.bmac, niu_get_ethtool_stats() 7814 for (i = 0; i < np->num_rx_rings; i++) { niu_get_ethtool_stats() 7815 struct rx_ring_info *rp = &np->rx_rings[i]; niu_get_ethtool_stats() 7817 niu_sync_rx_discard_stats(np, rp, 0); niu_get_ethtool_stats() 7826 for (i = 0; i < np->num_tx_rings; i++) { niu_get_ethtool_stats() 7827 struct tx_ring_info *rp = &np->tx_rings[i]; niu_get_ethtool_stats() 7837 static u64 niu_led_state_save(struct niu *np) niu_led_state_save() argument 7839 if (np->flags & NIU_FLAGS_XMAC) niu_led_state_save() 7845 static void niu_led_state_restore(struct niu *np, u64 val) niu_led_state_restore() argument 7847 if (np->flags & NIU_FLAGS_XMAC) niu_led_state_restore() 7853 static void niu_force_led(struct niu *np, int on) niu_force_led() argument 7857 if (np->flags & NIU_FLAGS_XMAC) { niu_force_led() 7877 struct niu *np = netdev_priv(dev); niu_set_phys_id() local 7884 np->orig_led_state = niu_led_state_save(np); niu_set_phys_id() 7888 niu_force_led(np, 1); niu_set_phys_id() 7892 niu_force_led(np, 0); niu_set_phys_id() 7896 niu_led_state_restore(np, np->orig_led_state); niu_set_phys_id() 7920 static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent, niu_ldg_assign_ldn() argument 7930 if (np->parent->plat_type == PLAT_TYPE_NIU) { niu_ldg_assign_ldn() 7937 dev_err(np->device, "Port %u, mis-matched LDG assignment for ldn %d, should be %d is %llu\n", niu_ldg_assign_ldn() 7938 np->port, ldn, ldg, niu_ldg_assign_ldn() 7948 static int niu_set_ldg_timer_res(struct niu *np, int res) niu_set_ldg_timer_res() argument 7959 static int niu_set_ldg_sid(struct niu *np, int ldg, int func, int vector) niu_set_ldg_sid() argument 7971 static int niu_pci_eeprom_read(struct niu *np, u32 addr) niu_pci_eeprom_read() argument 7990 dev_err(np->device, "EEPROM read timeout frame[%llx]\n", niu_pci_eeprom_read() 8005 dev_err(np->device, "EEPROM read timeout frame[%llx]\n", niu_pci_eeprom_read() 8014 static int niu_pci_eeprom_read16(struct niu *np, u32 off) niu_pci_eeprom_read16() argument 8016 int err = niu_pci_eeprom_read(np, off); niu_pci_eeprom_read16() 8022 err = niu_pci_eeprom_read(np, off + 1); niu_pci_eeprom_read16() 8030 static int niu_pci_eeprom_read16_swp(struct niu *np, u32 off) niu_pci_eeprom_read16_swp() argument 8032 int err = niu_pci_eeprom_read(np, off); niu_pci_eeprom_read16_swp() 8039 err = niu_pci_eeprom_read(np, off + 1); niu_pci_eeprom_read16_swp() 8048 static int niu_pci_vpd_get_propname(struct niu *np, u32 off, char *namebuf, niu_pci_vpd_get_propname() argument 8054 int err = niu_pci_eeprom_read(np, off + i); niu_pci_vpd_get_propname() 8067 static void niu_vpd_parse_version(struct niu *np) niu_vpd_parse_version() argument 8069 struct niu_vpd *vpd = &np->vpd; niu_vpd_parse_version() 8084 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_vpd_parse_version() 8090 np->flags |= NIU_FLAGS_VPD_VALID; niu_vpd_parse_version() 8094 static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end) niu_pci_vpd_scan_props() argument 8105 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_pci_vpd_scan_props() 8114 niu_vpd_parse_version(np); niu_pci_vpd_scan_props() 8118 err = niu_pci_eeprom_read(np, start + 2); niu_pci_vpd_scan_props() 8124 prop_len = niu_pci_eeprom_read(np, start + 4); niu_pci_vpd_scan_props() 8125 err = niu_pci_vpd_get_propname(np, start + 5, namebuf, 64); niu_pci_vpd_scan_props() 8132 prop_buf = np->vpd.model; niu_pci_vpd_scan_props() 8136 prop_buf = np->vpd.board_model; niu_pci_vpd_scan_props() 8140 prop_buf = np->vpd.version; niu_pci_vpd_scan_props() 8144 prop_buf = np->vpd.local_mac; niu_pci_vpd_scan_props() 8148 prop_buf = &np->vpd.mac_num; niu_pci_vpd_scan_props() 8152 prop_buf = np->vpd.phy_type; niu_pci_vpd_scan_props() 8158 dev_err(np->device, "Property '%s' length (%d) is too long\n", namebuf, prop_len); niu_pci_vpd_scan_props() 8166 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_pci_vpd_scan_props() 8170 *prop_buf++ = niu_pci_eeprom_read(np, off + i); niu_pci_vpd_scan_props() 8180 static void niu_pci_vpd_fetch(struct niu *np, u32 start) niu_pci_vpd_fetch() argument 8185 err = niu_pci_eeprom_read16_swp(np, start + 1); niu_pci_vpd_fetch() 8195 err = niu_pci_eeprom_read(np, here); niu_pci_vpd_fetch() 8199 err = niu_pci_eeprom_read16_swp(np, here + 1); niu_pci_vpd_fetch() 8208 err = niu_pci_vpd_scan_props(np, here, end); niu_pci_vpd_fetch() 8215 static u32 niu_pci_vpd_offset(struct niu *np) niu_pci_vpd_offset() argument 8224 err = niu_pci_eeprom_read16(np, start + 0); niu_pci_vpd_offset() 8229 err = niu_pci_eeprom_read16(np, start + 23); niu_pci_vpd_offset() 8235 err = niu_pci_eeprom_read16(np, start + 0); niu_pci_vpd_offset() 8238 err = niu_pci_eeprom_read16(np, start + 2); niu_pci_vpd_offset() 8243 err = niu_pci_eeprom_read(np, start + 20); niu_pci_vpd_offset() 8247 err = niu_pci_eeprom_read(np, ret + 2); niu_pci_vpd_offset() 8255 err = niu_pci_eeprom_read16_swp(np, start + 8); niu_pci_vpd_offset() 8260 err = niu_pci_eeprom_read(np, ret + 0); niu_pci_vpd_offset() 8270 static int niu_phy_type_prop_decode(struct niu *np, const char *phy_prop) niu_phy_type_prop_decode() argument 8274 np->flags &= ~(NIU_FLAGS_FIBER | niu_phy_type_prop_decode() 8276 np->mac_xcvr = MAC_XCVR_MII; niu_phy_type_prop_decode() 8279 np->flags |= (NIU_FLAGS_10G | niu_phy_type_prop_decode() 8281 np->mac_xcvr = MAC_XCVR_XPCS; niu_phy_type_prop_decode() 8284 np->flags &= ~NIU_FLAGS_10G; niu_phy_type_prop_decode() 8285 np->flags |= NIU_FLAGS_FIBER; niu_phy_type_prop_decode() 8286 np->mac_xcvr = MAC_XCVR_PCS; niu_phy_type_prop_decode() 8289 np->flags |= NIU_FLAGS_10G; niu_phy_type_prop_decode() 8290 np->flags &= ~NIU_FLAGS_FIBER; niu_phy_type_prop_decode() 8291 np->mac_xcvr = MAC_XCVR_XPCS; niu_phy_type_prop_decode() 8294 np->flags |= NIU_FLAGS_10G; niu_phy_type_prop_decode() 8295 np->flags &= ~NIU_FLAGS_FIBER; niu_phy_type_prop_decode() 8296 np->flags |= NIU_FLAGS_XCVR_SERDES; niu_phy_type_prop_decode() 8297 np->mac_xcvr = MAC_XCVR_XPCS; niu_phy_type_prop_decode() 8304 static int niu_pci_vpd_get_nports(struct niu *np) niu_pci_vpd_get_nports() argument 8308 if ((!strcmp(np->vpd.model, NIU_QGC_LP_MDL_STR)) || niu_pci_vpd_get_nports() 8309 (!strcmp(np->vpd.model, NIU_QGC_PEM_MDL_STR)) || niu_pci_vpd_get_nports() 8310 (!strcmp(np->vpd.model, NIU_MARAMBA_MDL_STR)) || niu_pci_vpd_get_nports() 8311 (!strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) || niu_pci_vpd_get_nports() 8312 (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR))) { niu_pci_vpd_get_nports() 8314 } else if ((!strcmp(np->vpd.model, NIU_2XGF_LP_MDL_STR)) || niu_pci_vpd_get_nports() 8315 (!strcmp(np->vpd.model, NIU_2XGF_PEM_MDL_STR)) || niu_pci_vpd_get_nports() 8316 (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) || niu_pci_vpd_get_nports() 8317 (!strcmp(np->vpd.model, NIU_2XGF_MRVL_MDL_STR))) { niu_pci_vpd_get_nports() 8324 static void niu_pci_vpd_validate(struct niu *np) niu_pci_vpd_validate() argument 8326 struct net_device *dev = np->dev; niu_pci_vpd_validate() 8327 struct niu_vpd *vpd = &np->vpd; niu_pci_vpd_validate() 8331 dev_err(np->device, "VPD MAC invalid, falling back to SPROM\n"); niu_pci_vpd_validate() 8333 np->flags &= ~NIU_FLAGS_VPD_VALID; niu_pci_vpd_validate() 8337 if (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR) || niu_pci_vpd_validate() 8338 !strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) { niu_pci_vpd_validate() 8339 np->flags |= NIU_FLAGS_10G; niu_pci_vpd_validate() 8340 np->flags &= ~NIU_FLAGS_FIBER; niu_pci_vpd_validate() 8341 np->flags |= NIU_FLAGS_XCVR_SERDES; niu_pci_vpd_validate() 8342 np->mac_xcvr = MAC_XCVR_PCS; niu_pci_vpd_validate() 8343 if (np->port > 1) { niu_pci_vpd_validate() 8344 np->flags |= NIU_FLAGS_FIBER; niu_pci_vpd_validate() 8345 np->flags &= ~NIU_FLAGS_10G; niu_pci_vpd_validate() 8347 if (np->flags & NIU_FLAGS_10G) niu_pci_vpd_validate() 8348 np->mac_xcvr = MAC_XCVR_XPCS; niu_pci_vpd_validate() 8349 } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) { niu_pci_vpd_validate() 8350 np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER | niu_pci_vpd_validate() 8352 } else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { niu_pci_vpd_validate() 8353 dev_err(np->device, "Illegal phy string [%s]\n", niu_pci_vpd_validate() 8354 np->vpd.phy_type); niu_pci_vpd_validate() 8355 dev_err(np->device, "Falling back to SPROM\n"); niu_pci_vpd_validate() 8356 np->flags &= ~NIU_FLAGS_VPD_VALID; niu_pci_vpd_validate() 8363 dev->dev_addr[5] += np->port; niu_pci_vpd_validate() 8368 static int niu_pci_probe_sprom(struct niu *np) niu_pci_probe_sprom() argument 8370 struct net_device *dev = np->dev; niu_pci_probe_sprom() 8379 np->eeprom_len = len; niu_pci_probe_sprom() 8381 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_pci_probe_sprom() 8392 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_pci_probe_sprom() 8395 dev_err(np->device, "Bad SPROM checksum (%x, should be 0xab)\n", (int)(sum & 0xff)); niu_pci_probe_sprom() 8400 switch (np->port) { niu_pci_probe_sprom() 8418 dev_err(np->device, "Bogus port number %u\n", niu_pci_probe_sprom() 8419 np->port); niu_pci_probe_sprom() 8422 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_pci_probe_sprom() 8428 np->flags &= ~(NIU_FLAGS_FIBER | niu_pci_probe_sprom() 8430 np->mac_xcvr = MAC_XCVR_MII; niu_pci_probe_sprom() 8435 np->flags &= ~NIU_FLAGS_10G; niu_pci_probe_sprom() 8436 np->flags |= NIU_FLAGS_FIBER; niu_pci_probe_sprom() 8437 np->mac_xcvr = MAC_XCVR_PCS; niu_pci_probe_sprom() 8442 np->flags |= NIU_FLAGS_10G; niu_pci_probe_sprom() 8443 np->flags &= ~NIU_FLAGS_FIBER; niu_pci_probe_sprom() 8444 np->mac_xcvr = MAC_XCVR_XPCS; niu_pci_probe_sprom() 8449 np->flags |= (NIU_FLAGS_10G | niu_pci_probe_sprom() 8451 np->mac_xcvr = MAC_XCVR_XPCS; niu_pci_probe_sprom() 8455 dev_err(np->device, "Bogus SPROM phy type %u\n", val8); niu_pci_probe_sprom() 8460 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_pci_probe_sprom() 8468 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_pci_probe_sprom() 8474 dev_err(np->device, "SPROM MAC address invalid [ %pM ]\n", niu_pci_probe_sprom() 8480 dev->dev_addr[5] += np->port; niu_pci_probe_sprom() 8485 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_pci_probe_sprom() 8493 np->vpd.model[i + 3] = (tmp >> 0) & 0xff; niu_pci_probe_sprom() 8494 np->vpd.model[i + 2] = (tmp >> 8) & 0xff; niu_pci_probe_sprom() 8495 np->vpd.model[i + 1] = (tmp >> 16) & 0xff; niu_pci_probe_sprom() 8496 np->vpd.model[i + 0] = (tmp >> 24) & 0xff; niu_pci_probe_sprom() 8498 np->vpd.model[val] = '\0'; niu_pci_probe_sprom() 8501 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_pci_probe_sprom() 8509 np->vpd.board_model[i + 3] = (tmp >> 0) & 0xff; niu_pci_probe_sprom() 8510 np->vpd.board_model[i + 2] = (tmp >> 8) & 0xff; niu_pci_probe_sprom() 8511 np->vpd.board_model[i + 1] = (tmp >> 16) & 0xff; niu_pci_probe_sprom() 8512 np->vpd.board_model[i + 0] = (tmp >> 24) & 0xff; niu_pci_probe_sprom() 8514 np->vpd.board_model[val] = '\0'; niu_pci_probe_sprom() 8516 np->vpd.mac_num = niu_pci_probe_sprom() 8518 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_pci_probe_sprom() 8519 "SPROM: NUM_PORTS_MACS[%d]\n", np->vpd.mac_num); niu_pci_probe_sprom() 8524 static int niu_get_and_validate_port(struct niu *np) niu_get_and_validate_port() argument 8526 struct niu_parent *parent = np->parent; niu_get_and_validate_port() 8528 if (np->port <= 1) niu_get_and_validate_port() 8529 np->flags |= NIU_FLAGS_XMAC; niu_get_and_validate_port() 8535 parent->num_ports = niu_pci_vpd_get_nports(np); niu_get_and_validate_port() 8552 if (np->port >= parent->num_ports) niu_get_and_validate_port() 8760 static int fill_phy_probe_info(struct niu *np, struct niu_parent *parent, fill_phy_probe_info() argument 8769 niu_lock_parent(np, flags); fill_phy_probe_info() 8774 dev_id_1 = mdio_read(np, port, fill_phy_probe_info() 8776 dev_id_2 = mdio_read(np, port, fill_phy_probe_info() 8782 dev_id_1 = mdio_read(np, port, fill_phy_probe_info() 8784 dev_id_2 = mdio_read(np, port, fill_phy_probe_info() 8790 dev_id_1 = mii_read(np, port, MII_PHYSID1); fill_phy_probe_info() 8791 dev_id_2 = mii_read(np, port, MII_PHYSID2); fill_phy_probe_info() 8797 niu_unlock_parent(np, flags); fill_phy_probe_info() 8802 static int walk_phys(struct niu *np, struct niu_parent *parent) walk_phys() argument 8812 if (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR) || walk_phys() 8813 !strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) { walk_phys() 8822 } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) { walk_phys() 8828 } else if ((np->flags & NIU_FLAGS_XCVR_SERDES) && walk_phys() 8831 if (np->flags & NIU_FLAGS_10G) { walk_phys() 8839 err = fill_phy_probe_info(np, parent, info); walk_phys() 8869 val = phy_encode(PORT_TYPE_10G, np->port); walk_phys() 8931 static int niu_probe_ports(struct niu *np) niu_probe_ports() argument 8933 struct niu_parent *parent = np->parent; niu_probe_ports() 8937 err = walk_phys(np, parent); niu_probe_ports() 8941 niu_set_ldg_timer_res(np, 2); niu_probe_ports() 8943 niu_ldn_irq_enable(np, i, 0); niu_probe_ports() 8952 static int niu_classifier_swstate_init(struct niu *np) niu_classifier_swstate_init() argument 8954 struct niu_classifier *cp = &np->clas; niu_classifier_swstate_init() 8956 cp->tcam_top = (u16) np->port; niu_classifier_swstate_init() 8957 cp->tcam_sz = np->parent->tcam_num_entries / np->parent->num_ports; niu_classifier_swstate_init() 8961 return fflp_early_init(np); niu_classifier_swstate_init() 8964 static void niu_link_config_init(struct niu *np) niu_link_config_init() argument 8966 struct niu_link_config *lp = &np->link_config; niu_link_config_init() 8989 static int niu_init_mac_ipp_pcs_base(struct niu *np) niu_init_mac_ipp_pcs_base() argument 8991 switch (np->port) { niu_init_mac_ipp_pcs_base() 8993 np->mac_regs = np->regs + XMAC_PORT0_OFF; niu_init_mac_ipp_pcs_base() 8994 np->ipp_off = 0x00000; niu_init_mac_ipp_pcs_base() 8995 np->pcs_off = 0x04000; niu_init_mac_ipp_pcs_base() 8996 np->xpcs_off = 0x02000; niu_init_mac_ipp_pcs_base() 9000 np->mac_regs = np->regs + XMAC_PORT1_OFF; niu_init_mac_ipp_pcs_base() 9001 np->ipp_off = 0x08000; niu_init_mac_ipp_pcs_base() 9002 np->pcs_off = 0x0a000; niu_init_mac_ipp_pcs_base() 9003 np->xpcs_off = 0x08000; niu_init_mac_ipp_pcs_base() 9007 np->mac_regs = np->regs + BMAC_PORT2_OFF; niu_init_mac_ipp_pcs_base() 9008 np->ipp_off = 0x04000; niu_init_mac_ipp_pcs_base() 9009 np->pcs_off = 0x0e000; niu_init_mac_ipp_pcs_base() 9010 np->xpcs_off = ~0UL; niu_init_mac_ipp_pcs_base() 9014 np->mac_regs = np->regs + BMAC_PORT3_OFF; niu_init_mac_ipp_pcs_base() 9015 np->ipp_off = 0x0c000; niu_init_mac_ipp_pcs_base() 9016 np->pcs_off = 0x12000; niu_init_mac_ipp_pcs_base() 9017 np->xpcs_off = ~0UL; niu_init_mac_ipp_pcs_base() 9021 dev_err(np->device, "Port %u is invalid, cannot compute MAC block offset\n", np->port); niu_init_mac_ipp_pcs_base() 9028 static void niu_try_msix(struct niu *np, u8 *ldg_num_map) niu_try_msix() argument 9031 struct niu_parent *parent = np->parent; niu_try_msix() 9032 struct pci_dev *pdev = np->pdev; niu_try_msix() 9036 first_ldg = (NIU_NUM_LDG / parent->num_ports) * np->port; niu_try_msix() 9040 num_irqs = (parent->rxchan_per_port[np->port] + niu_try_msix() 9041 parent->txchan_per_port[np->port] + niu_try_msix() 9042 (np->port == 0 ? 3 : 1)); niu_try_msix() 9052 np->flags &= ~NIU_FLAGS_MSIX; niu_try_msix() 9056 np->flags |= NIU_FLAGS_MSIX; niu_try_msix() 9058 np->ldg[i].irq = msi_vec[i].vector; niu_try_msix() 9059 np->num_ldg = num_irqs; niu_try_msix() 9062 static int niu_n2_irq_init(struct niu *np, u8 *ldg_num_map) niu_n2_irq_init() argument 9065 struct platform_device *op = np->op; niu_n2_irq_init() 9075 np->ldg[i].irq = op->archdata.irqs[i]; niu_n2_irq_init() 9078 np->num_ldg = op->archdata.num_irqs; niu_n2_irq_init() 9086 static int niu_ldg_init(struct niu *np) niu_ldg_init() argument 9088 struct niu_parent *parent = np->parent; niu_ldg_init() 9094 np->num_ldg = 1; niu_ldg_init() 9095 np->ldg[0].irq = np->dev->irq; niu_ldg_init() 9097 err = niu_n2_irq_init(np, ldg_num_map); niu_ldg_init() 9101 niu_try_msix(np, ldg_num_map); niu_ldg_init() 9103 port = np->port; niu_ldg_init() 9104 for (i = 0; i < np->num_ldg; i++) { niu_ldg_init() 9105 struct niu_ldg *lp = &np->ldg[i]; niu_ldg_init() 9107 netif_napi_add(np->dev, &lp->napi, niu_poll, 64); niu_ldg_init() 9109 lp->np = np; niu_ldg_init() 9117 if (np->parent->plat_type != PLAT_TYPE_NIU) { niu_ldg_init() 9118 err = niu_set_ldg_sid(np, lp->ldg_num, port, i); niu_ldg_init() 9137 err = niu_ldg_assign_ldn(np, parent, ldg_num_map[ldg_rotor], niu_ldg_init() 9143 if (ldg_rotor == np->num_ldg) niu_ldg_init() 9147 err = niu_ldg_assign_ldn(np, parent, niu_ldg_init() 9154 if (ldg_rotor == np->num_ldg) niu_ldg_init() 9157 err = niu_ldg_assign_ldn(np, parent, niu_ldg_init() 9164 if (ldg_rotor == np->num_ldg) niu_ldg_init() 9175 err = niu_ldg_assign_ldn(np, parent, niu_ldg_init() 9181 if (ldg_rotor == np->num_ldg) niu_ldg_init() 9190 err = niu_ldg_assign_ldn(np, parent, niu_ldg_init() 9196 if (ldg_rotor == np->num_ldg) niu_ldg_init() 9203 static void niu_ldg_free(struct niu *np) niu_ldg_free() argument 9205 if (np->flags & NIU_FLAGS_MSIX) niu_ldg_free() 9206 pci_disable_msix(np->pdev); niu_ldg_free() 9209 static int niu_get_of_props(struct niu *np) niu_get_of_props() argument 9212 struct net_device *dev = np->dev; niu_get_of_props() 9219 if (np->parent->plat_type == PLAT_TYPE_NIU) niu_get_of_props() 9220 dp = np->op->dev.of_node; niu_get_of_props() 9222 dp = pci_device_to_OF_node(np->pdev); niu_get_of_props() 9234 strcpy(np->vpd.phy_type, phy_type); niu_get_of_props() 9236 if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { niu_get_of_props() 9238 dp->full_name, np->vpd.phy_type); niu_get_of_props() 9263 strcpy(np->vpd.model, model); niu_get_of_props() 9266 np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER | niu_get_of_props() 9276 static int niu_get_invariants(struct niu *np) niu_get_invariants() argument 9281 err = niu_get_of_props(np); niu_get_invariants() 9287 err = niu_init_mac_ipp_pcs_base(np); niu_get_invariants() 9292 err = niu_get_and_validate_port(np); niu_get_invariants() 9297 if (np->parent->plat_type == PLAT_TYPE_NIU) niu_get_invariants() 9301 offset = niu_pci_vpd_offset(np); niu_get_invariants() 9302 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_get_invariants() 9305 niu_pci_vpd_fetch(np, offset); niu_get_invariants() 9308 if (np->flags & NIU_FLAGS_VPD_VALID) { niu_get_invariants() 9309 niu_pci_vpd_validate(np); niu_get_invariants() 9310 err = niu_get_and_validate_port(np); niu_get_invariants() 9315 if (!(np->flags & NIU_FLAGS_VPD_VALID)) { niu_get_invariants() 9316 err = niu_get_and_validate_port(np); niu_get_invariants() 9319 err = niu_pci_probe_sprom(np); niu_get_invariants() 9325 err = niu_probe_ports(np); niu_get_invariants() 9329 niu_ldg_init(np); niu_get_invariants() 9331 niu_classifier_swstate_init(np); niu_get_invariants() 9332 niu_link_config_init(np); niu_get_invariants() 9334 err = niu_determine_phy_disposition(np); niu_get_invariants() 9336 err = niu_init_link(np); niu_get_invariants() 9455 static struct niu_parent *niu_new_parent(struct niu *np, niu_new_parent() argument 9519 static struct niu_parent *niu_get_parent(struct niu *np, niu_get_parent() argument 9523 int port = np->port; niu_get_parent() 9534 p = niu_new_parent(np, id, ptype); niu_get_parent() 9542 &np->device->kobj, niu_get_parent() 9545 p->ports[port] = np; niu_get_parent() 9554 static void niu_put_parent(struct niu *np) niu_put_parent() argument 9556 struct niu_parent *p = np->parent; niu_put_parent() 9557 u8 port = np->port; niu_put_parent() 9560 BUG_ON(!p || p->ports[port] != np); niu_put_parent() 9562 netif_printk(np, probe, KERN_DEBUG, np->dev, niu_put_parent() 9572 np->parent = NULL; niu_put_parent() 9650 struct niu *np; niu_alloc_and_init() local 9658 np = netdev_priv(dev); niu_alloc_and_init() 9659 np->dev = dev; niu_alloc_and_init() 9660 np->pdev = pdev; niu_alloc_and_init() 9661 np->op = op; niu_alloc_and_init() 9662 np->device = gen_dev; niu_alloc_and_init() 9663 np->ops = ops; niu_alloc_and_init() 9665 np->msg_enable = niu_debug; niu_alloc_and_init() 9667 spin_lock_init(&np->lock); niu_alloc_and_init() 9668 INIT_WORK(&np->reset_task, niu_reset_task); niu_alloc_and_init() 9670 np->port = port; niu_alloc_and_init() 9695 static void niu_device_announce(struct niu *np) niu_device_announce() argument 9697 struct net_device *dev = np->dev; niu_device_announce() 9701 if (np->parent->plat_type == PLAT_TYPE_ATCA_CP3220) { niu_device_announce() 9704 (np->flags & NIU_FLAGS_XMAC ? "XMAC" : "BMAC"), niu_device_announce() 9705 (np->flags & NIU_FLAGS_10G ? "10G" : "1G"), niu_device_announce() 9706 (np->flags & NIU_FLAGS_FIBER ? "RGMII FIBER" : "SERDES"), niu_device_announce() 9707 (np->mac_xcvr == MAC_XCVR_MII ? "MII" : niu_device_announce() 9708 (np->mac_xcvr == MAC_XCVR_PCS ? "PCS" : "XPCS")), niu_device_announce() 9709 np->vpd.phy_type); niu_device_announce() 9713 (np->flags & NIU_FLAGS_XMAC ? "XMAC" : "BMAC"), niu_device_announce() 9714 (np->flags & NIU_FLAGS_10G ? "10G" : "1G"), niu_device_announce() 9715 (np->flags & NIU_FLAGS_FIBER ? "FIBER" : niu_device_announce() 9716 (np->flags & NIU_FLAGS_XCVR_SERDES ? "SERDES" : niu_device_announce() 9718 (np->mac_xcvr == MAC_XCVR_MII ? "MII" : niu_device_announce() 9719 (np->mac_xcvr == MAC_XCVR_PCS ? "PCS" : "XPCS")), niu_device_announce() 9720 np->vpd.phy_type); niu_device_announce() 9735 struct niu *np; niu_pci_init_one() local 9772 np = netdev_priv(dev); niu_pci_init_one() 9779 np->parent = niu_get_parent(np, &parent_id, niu_pci_init_one() 9781 if (!np->parent) { niu_pci_init_one() 9814 np->regs = pci_ioremap_bar(pdev, 0); niu_pci_init_one() 9815 if (!np->regs) { niu_pci_init_one() 9828 err = niu_get_invariants(np); niu_pci_init_one() 9843 niu_device_announce(np); niu_pci_init_one() 9848 if (np->regs) { niu_pci_init_one() 9849 iounmap(np->regs); niu_pci_init_one() 9850 np->regs = NULL; niu_pci_init_one() 9854 niu_put_parent(np); niu_pci_init_one() 9873 struct niu *np = netdev_priv(dev); niu_pci_remove_one() local 9876 if (np->regs) { niu_pci_remove_one() 9877 iounmap(np->regs); niu_pci_remove_one() 9878 np->regs = NULL; niu_pci_remove_one() 9881 niu_ldg_free(np); niu_pci_remove_one() 9883 niu_put_parent(np); niu_pci_remove_one() 9894 struct niu *np = netdev_priv(dev); niu_suspend() local 9900 flush_work(&np->reset_task); niu_suspend() 9901 niu_netif_stop(np); niu_suspend() 9903 del_timer_sync(&np->timer); niu_suspend() 9905 spin_lock_irqsave(&np->lock, flags); niu_suspend() 9906 niu_enable_interrupts(np, 0); niu_suspend() 9907 spin_unlock_irqrestore(&np->lock, flags); niu_suspend() 9911 spin_lock_irqsave(&np->lock, flags); niu_suspend() 9912 niu_stop_hw(np); niu_suspend() 9913 spin_unlock_irqrestore(&np->lock, flags); niu_suspend() 9923 struct niu *np = netdev_priv(dev); niu_resume() local 9934 spin_lock_irqsave(&np->lock, flags); niu_resume() 9936 err = niu_init_hw(np); niu_resume() 9938 np->timer.expires = jiffies + HZ; niu_resume() 9939 add_timer(&np->timer); niu_resume() 9940 niu_netif_start(np); niu_resume() 9943 spin_unlock_irqrestore(&np->lock, flags); niu_resume() 10020 struct niu *np; niu_of_probe() local 10039 np = netdev_priv(dev); niu_of_probe() 10044 np->parent = niu_get_parent(np, &parent_id, niu_of_probe() 10046 if (!np->parent) { niu_of_probe() 10053 np->regs = of_ioremap(&op->resource[1], 0, niu_of_probe() 10056 if (!np->regs) { niu_of_probe() 10062 np->vir_regs_1 = of_ioremap(&op->resource[2], 0, niu_of_probe() 10065 if (!np->vir_regs_1) { niu_of_probe() 10071 np->vir_regs_2 = of_ioremap(&op->resource[3], 0, niu_of_probe() 10074 if (!np->vir_regs_2) { niu_of_probe() 10082 err = niu_get_invariants(np); niu_of_probe() 10097 niu_device_announce(np); niu_of_probe() 10102 if (np->vir_regs_1) { niu_of_probe() 10103 of_iounmap(&op->resource[2], np->vir_regs_1, niu_of_probe() 10105 np->vir_regs_1 = NULL; niu_of_probe() 10108 if (np->vir_regs_2) { niu_of_probe() 10109 of_iounmap(&op->resource[3], np->vir_regs_2, niu_of_probe() 10111 np->vir_regs_2 = NULL; niu_of_probe() 10114 if (np->regs) { niu_of_probe() 10115 of_iounmap(&op->resource[1], np->regs, niu_of_probe() 10117 np->regs = NULL; niu_of_probe() 10121 niu_put_parent(np); niu_of_probe() 10135 struct niu *np = netdev_priv(dev); niu_of_remove() local 10139 if (np->vir_regs_1) { niu_of_remove() 10140 of_iounmap(&op->resource[2], np->vir_regs_1, niu_of_remove() 10142 np->vir_regs_1 = NULL; niu_of_remove() 10145 if (np->vir_regs_2) { niu_of_remove() 10146 of_iounmap(&op->resource[3], np->vir_regs_2, niu_of_remove() 10148 np->vir_regs_2 = NULL; niu_of_remove() 10151 if (np->regs) { niu_of_remove() 10152 of_iounmap(&op->resource[1], np->regs, niu_of_remove() 10154 np->regs = NULL; niu_of_remove() 10157 niu_ldg_free(np); niu_of_remove() 10159 niu_put_parent(np); niu_of_remove()
|
/linux-4.4.14/arch/powerpc/platforms/85xx/ |
H A D | common.c | 66 struct device_node *np; mpc85xx_cpm2_pic_init() local 70 np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic"); mpc85xx_cpm2_pic_init() 71 if (np == NULL) { mpc85xx_cpm2_pic_init() 75 irq = irq_of_parse_and_map(np, 0); mpc85xx_cpm2_pic_init() 77 of_node_put(np); mpc85xx_cpm2_pic_init() 82 cpm2_pic_init(np); mpc85xx_cpm2_pic_init() 83 of_node_put(np); mpc85xx_cpm2_pic_init() 91 struct device_node *np; mpc85xx_qe_init() local 93 np = of_find_compatible_node(NULL, NULL, "fsl,qe"); mpc85xx_qe_init() 94 if (!np) { mpc85xx_qe_init() 95 np = of_find_node_by_name(NULL, "qe"); mpc85xx_qe_init() 96 if (!np) { mpc85xx_qe_init() 103 if (!of_device_is_available(np)) { mpc85xx_qe_init() 104 of_node_put(np); mpc85xx_qe_init() 109 of_node_put(np); mpc85xx_qe_init() 115 struct device_node *np; mpc85xx_qe_par_io_init() local 117 np = of_find_node_by_name(NULL, "par_io"); mpc85xx_qe_par_io_init() 118 if (np) { mpc85xx_qe_par_io_init() 121 par_io_init(np); mpc85xx_qe_par_io_init() 122 of_node_put(np); mpc85xx_qe_par_io_init()
|
H A D | mpc85xx_mds.c | 163 struct device_node *np; mpc85xx_mds_reset_ucc_phys() local 167 np = of_find_node_by_name(NULL, "bcsr"); mpc85xx_mds_reset_ucc_phys() 168 if (!np) mpc85xx_mds_reset_ucc_phys() 171 bcsr_regs = of_iomap(np, 0); mpc85xx_mds_reset_ucc_phys() 172 of_node_put(np); mpc85xx_mds_reset_ucc_phys() 209 for_each_compatible_node(np, "network", "ucc_geth") { mpc85xx_mds_reset_ucc_phys() 213 prop = of_get_property(np, "cell-index", NULL); mpc85xx_mds_reset_ucc_phys() 219 prop = of_get_property(np, "phy-connection-type", NULL); mpc85xx_mds_reset_ucc_phys() 239 struct device_node *np; mpc85xx_mds_qe_init() local 249 np = of_find_node_by_name(NULL, "global-utilities"); mpc85xx_mds_qe_init() 250 if (np) { mpc85xx_mds_qe_init() 251 guts = of_iomap(np, 0); mpc85xx_mds_qe_init() 267 of_node_put(np); mpc85xx_mds_qe_init() 275 struct device_node *np; mpc85xx_mds_qeic_init() local 277 np = of_find_compatible_node(NULL, NULL, "fsl,qe"); mpc85xx_mds_qeic_init() 278 if (!of_device_is_available(np)) { mpc85xx_mds_qeic_init() 279 of_node_put(np); mpc85xx_mds_qeic_init() 283 np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic"); mpc85xx_mds_qeic_init() 284 if (!np) { mpc85xx_mds_qeic_init() 285 np = of_find_node_by_type(NULL, "qeic"); mpc85xx_mds_qeic_init() 286 if (!np) mpc85xx_mds_qeic_init() 291 qe_ic_init(np, 0, qe_ic_cascade_low_mpic, mpc85xx_mds_qeic_init() 294 qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL); mpc85xx_mds_qeic_init() 295 of_node_put(np); mpc85xx_mds_qeic_init()
|
H A D | twr_p102x.c | 39 struct device_node *np; twr_p1025_pic_init() local 50 np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic"); twr_p1025_pic_init() 51 if (np) { twr_p1025_pic_init() 52 qe_ic_init(np, 0, qe_ic_cascade_low_mpic, twr_p1025_pic_init() 54 of_node_put(np); twr_p1025_pic_init() 68 struct device_node *np; twr_p1025_setup_arch() local 86 np = of_find_compatible_node(NULL, NULL, "fsl,p1021-guts"); twr_p1025_setup_arch() 87 if (np) { twr_p1025_setup_arch() 88 guts = of_iomap(np, 0); twr_p1025_setup_arch() 118 of_node_put(np); twr_p1025_setup_arch()
|
H A D | socrates.c | 48 struct device_node *np; socrates_pic_init() local 55 np = of_find_compatible_node(NULL, NULL, "abb,socrates-fpga-pic"); socrates_pic_init() 56 if (!np) { socrates_pic_init() 60 socrates_fpga_pic_init(np); socrates_pic_init() 61 of_node_put(np); socrates_pic_init()
|
H A D | ge_imp3a.c | 48 struct device_node *np; ge_imp3a_pic_init() local 71 for_each_node_by_type(np, "interrupt-controller") ge_imp3a_pic_init() 72 if (of_device_is_compatible(np, "gef,fpga-pic-1.00")) { ge_imp3a_pic_init() 73 cascade_node = np; ge_imp3a_pic_init() 89 struct device_node *np; ge_imp3a_pci_assign_primary() local 92 for_each_node_by_type(np, "pci") { ge_imp3a_pci_assign_primary() 93 if (of_device_is_compatible(np, "fsl,mpc8540-pci") || ge_imp3a_pci_assign_primary() 94 of_device_is_compatible(np, "fsl,mpc8548-pcie") || ge_imp3a_pci_assign_primary() 95 of_device_is_compatible(np, "fsl,p2020-pcie")) { ge_imp3a_pci_assign_primary() 96 of_address_to_resource(np, 0, &rsrc); ge_imp3a_pci_assign_primary() 98 fsl_pci_primary = np; ge_imp3a_pci_assign_primary()
|
H A D | p1023_rdb.c | 46 struct device_node *np; mpc85xx_rdb_setup_arch() local 52 np = of_find_node_by_name(NULL, "bcsr"); mpc85xx_rdb_setup_arch() 53 if (np != NULL) { mpc85xx_rdb_setup_arch() 56 bcsr_regs = of_iomap(np, 0); mpc85xx_rdb_setup_arch() 57 of_node_put(np); mpc85xx_rdb_setup_arch()
|
/linux-4.4.14/drivers/net/ethernet/ |
H A D | fealnx.c | 483 struct netdev_private *np; fealnx_init_one() local 549 np = netdev_priv(dev); fealnx_init_one() 550 np->mem = ioaddr; fealnx_init_one() 551 spin_lock_init(&np->lock); fealnx_init_one() 552 np->pci_dev = pdev; fealnx_init_one() 553 np->flags = skel_netdrv_tbl[chip_id].flags; fealnx_init_one() 555 np->mii.dev = dev; fealnx_init_one() 556 np->mii.mdio_read = mdio_read; fealnx_init_one() 557 np->mii.mdio_write = mdio_write; fealnx_init_one() 558 np->mii.phy_id_mask = 0x1f; fealnx_init_one() 559 np->mii.reg_num_mask = 0x1f; fealnx_init_one() 566 np->rx_ring = ring_space; fealnx_init_one() 567 np->rx_ring_dma = ring_dma; fealnx_init_one() 574 np->tx_ring = ring_space; fealnx_init_one() 575 np->tx_ring_dma = ring_dma; fealnx_init_one() 578 if (np->flags == HAS_MII_XCVR) { fealnx_init_one() 581 for (phy = 1; phy < 32 && phy_idx < ARRAY_SIZE(np->phys); fealnx_init_one() 586 np->phys[phy_idx++] = phy; fealnx_init_one() 594 data = mdio_read(dev, np->phys[0], 2); fealnx_init_one() 596 np->PHYType = SeeqPHY; fealnx_init_one() 598 np->PHYType = AhdocPHY; fealnx_init_one() 600 np->PHYType = MarvellPHY; fealnx_init_one() 602 np->PHYType = Myson981; fealnx_init_one() 604 np->PHYType = LevelOnePHY; fealnx_init_one() 606 np->PHYType = OtherPHY; fealnx_init_one() 611 np->mii_cnt = phy_idx; fealnx_init_one() 617 np->phys[0] = 32; fealnx_init_one() 621 np->PHYType = MysonPHY; fealnx_init_one() 623 np->PHYType = OtherPHY; fealnx_init_one() 625 np->mii.phy_id = np->phys[0]; fealnx_init_one() 633 np->mii.full_duplex = 1; fealnx_init_one() 634 np->default_port = option & 15; fealnx_init_one() 638 np->mii.full_duplex = full_duplex[card_idx]; fealnx_init_one() 640 if (np->mii.full_duplex) { fealnx_init_one() 643 // if (np->PHYType==MarvellPHY) fealnx_init_one() 644 if ((np->PHYType == MarvellPHY) || (np->PHYType == LevelOnePHY)) { fealnx_init_one() 647 data = mdio_read(dev, np->phys[0], 9); fealnx_init_one() 649 mdio_write(dev, np->phys[0], 9, data); fealnx_init_one() 652 if (np->flags == HAS_MII_XCVR) fealnx_init_one() 653 mdio_write(dev, np->phys[0], MII_ADVERTISE, ADVERTISE_FULL); fealnx_init_one() 656 np->mii.force_media = 1; fealnx_init_one() 674 pci_free_consistent(pdev, TX_TOTAL_SIZE, np->tx_ring, np->tx_ring_dma); fealnx_init_one() 676 pci_free_consistent(pdev, RX_TOTAL_SIZE, np->rx_ring, np->rx_ring_dma); fealnx_init_one() 692 struct netdev_private *np = netdev_priv(dev); fealnx_remove_one() local 694 pci_free_consistent(pdev, TX_TOTAL_SIZE, np->tx_ring, fealnx_remove_one() 695 np->tx_ring_dma); fealnx_remove_one() 696 pci_free_consistent(pdev, RX_TOTAL_SIZE, np->rx_ring, fealnx_remove_one() 697 np->rx_ring_dma); fealnx_remove_one() 699 pci_iounmap(pdev, np->mem); fealnx_remove_one() 758 struct netdev_private *np = netdev_priv(dev); mdio_read() local 759 void __iomem *miiport = np->mem + MANAGEMENT; mdio_read() 797 struct netdev_private *np = netdev_priv(dev); mdio_write() local 798 void __iomem *miiport = np->mem + MANAGEMENT; mdio_write() 829 struct netdev_private *np = netdev_priv(dev); netdev_open() local 830 void __iomem *ioaddr = np->mem; netdev_open() 831 const int irq = np->pci_dev->irq; netdev_open() 846 iowrite32(np->rx_ring_dma, ioaddr + RXLBA); netdev_open() 847 iowrite32(np->tx_ring_dma, ioaddr + TXLBA); netdev_open() 866 np->bcrvalue = 0x10; /* little-endian, 8 burst length */ netdev_open() 868 np->bcrvalue |= 0x04; /* big-endian */ netdev_open() 873 np->crvalue = 0xa00; netdev_open() 876 np->crvalue = 0xe00; /* rx 128 burst length */ netdev_open() 881 // np->imrvalue=FBE|TUNF|CNTOVF|RBU|TI|RI; netdev_open() 882 np->imrvalue = TUNF | CNTOVF | RBU | TI | RI; netdev_open() 883 if (np->pci_dev->device == 0x891) { netdev_open() 884 np->bcrvalue |= 0x200; /* set PROG bit */ netdev_open() 885 np->crvalue |= CR_W_ENH; /* set enhanced bit */ netdev_open() 886 np->imrvalue |= ETI; netdev_open() 888 iowrite32(np->bcrvalue, ioaddr + BCR); netdev_open() 891 dev->if_port = np->default_port; netdev_open() 895 // np->crvalue = 0x00e40001; /* tx store and forward, tx/rx enable */ netdev_open() 896 np->crvalue |= 0x00e40001; /* tx store and forward, tx/rx enable */ netdev_open() 897 np->mii.full_duplex = np->mii.force_media; netdev_open() 899 if (np->linkok) netdev_open() 907 iowrite32(np->imrvalue, ioaddr + IMR); netdev_open() 913 init_timer(&np->timer); netdev_open() 914 np->timer.expires = RUN_AT(3 * HZ); netdev_open() 915 np->timer.data = (unsigned long) dev; netdev_open() 916 np->timer.function = netdev_timer; netdev_open() 919 add_timer(&np->timer); netdev_open() 921 init_timer(&np->reset_timer); netdev_open() 922 np->reset_timer.data = (unsigned long) dev; netdev_open() 923 np->reset_timer.function = reset_timer; netdev_open() 924 np->reset_timer_armed = 0; netdev_open() 934 struct netdev_private *np = netdev_priv(dev); getlinkstatus() local 937 np->linkok = 0; getlinkstatus() 939 if (np->PHYType == MysonPHY) { getlinkstatus() 941 if (ioread32(np->mem + BMCRSR) & LinkIsUp2) { getlinkstatus() 942 np->linkok = 1; getlinkstatus() 949 if (mdio_read(dev, np->phys[0], MII_BMSR) & BMSR_LSTATUS) { getlinkstatus() 950 np->linkok = 1; getlinkstatus() 961 struct netdev_private *np = netdev_priv(dev); getlinktype() local 963 if (np->PHYType == MysonPHY) { /* 3-in-1 case */ getlinktype() 964 if (ioread32(np->mem + TCRRCR) & CR_R_FD) getlinktype() 965 np->duplexmode = 2; /* full duplex */ getlinktype() 967 np->duplexmode = 1; /* half duplex */ getlinktype() 968 if (ioread32(np->mem + TCRRCR) & CR_R_PS10) getlinktype() 969 np->line_speed = 1; /* 10M */ getlinktype() 971 np->line_speed = 2; /* 100M */ getlinktype() 973 if (np->PHYType == SeeqPHY) { /* this PHY is SEEQ 80225 */ getlinktype() 976 data = mdio_read(dev, np->phys[0], MIIRegister18); getlinktype() 978 np->line_speed = 2; /* 100M */ getlinktype() 980 np->line_speed = 1; /* 10M */ getlinktype() 982 np->duplexmode = 2; /* full duplex mode */ getlinktype() 984 np->duplexmode = 1; /* half duplex mode */ getlinktype() 985 } else if (np->PHYType == AhdocPHY) { getlinktype() 988 data = mdio_read(dev, np->phys[0], DiagnosticReg); getlinktype() 990 np->line_speed = 2; /* 100M */ getlinktype() 992 np->line_speed = 1; /* 10M */ getlinktype() 994 np->duplexmode = 2; /* full duplex mode */ getlinktype() 996 np->duplexmode = 1; /* half duplex mode */ getlinktype() 999 else if (np->PHYType == MarvellPHY) { getlinktype() 1002 data = mdio_read(dev, np->phys[0], SpecificReg); getlinktype() 1004 np->duplexmode = 2; /* full duplex mode */ getlinktype() 1006 np->duplexmode = 1; /* half duplex mode */ getlinktype() 1009 np->line_speed = 3; /* 1000M */ getlinktype() 1011 np->line_speed = 2; /* 100M */ getlinktype() 1013 np->line_speed = 1; /* 10M */ getlinktype() 1017 else if (np->PHYType == Myson981) { getlinktype() 1020 data = mdio_read(dev, np->phys[0], StatusRegister); getlinktype() 1023 np->line_speed = 2; getlinktype() 1025 np->line_speed = 1; getlinktype() 1028 np->duplexmode = 2; getlinktype() 1030 np->duplexmode = 1; getlinktype() 1034 else if (np->PHYType == LevelOnePHY) { getlinktype() 1037 data = mdio_read(dev, np->phys[0], SpecificReg); getlinktype() 1039 np->duplexmode = 2; /* full duplex mode */ getlinktype() 1041 np->duplexmode = 1; /* half duplex mode */ getlinktype() 1044 np->line_speed = 3; /* 1000M */ getlinktype() 1046 np->line_speed = 2; /* 100M */ getlinktype() 1048 np->line_speed = 1; /* 10M */ getlinktype() 1050 np->crvalue &= (~CR_W_PS10) & (~CR_W_FD) & (~CR_W_PS1000); getlinktype() 1051 if (np->line_speed == 1) getlinktype() 1052 np->crvalue |= CR_W_PS10; getlinktype() 1053 else if (np->line_speed == 3) getlinktype() 1054 np->crvalue |= CR_W_PS1000; getlinktype() 1055 if (np->duplexmode == 2) getlinktype() 1056 np->crvalue |= CR_W_FD; getlinktype() 1064 struct netdev_private *np = netdev_priv(dev); allocate_rx_buffers() local 1067 while (np->really_rx_count != RX_RING_SIZE) { allocate_rx_buffers() 1070 skb = netdev_alloc_skb(dev, np->rx_buf_sz); allocate_rx_buffers() 1074 while (np->lack_rxbuf->skbuff) allocate_rx_buffers() 1075 np->lack_rxbuf = np->lack_rxbuf->next_desc_logical; allocate_rx_buffers() 1077 np->lack_rxbuf->skbuff = skb; allocate_rx_buffers() 1078 np->lack_rxbuf->buffer = pci_map_single(np->pci_dev, skb->data, allocate_rx_buffers() 1079 np->rx_buf_sz, PCI_DMA_FROMDEVICE); allocate_rx_buffers() 1080 np->lack_rxbuf->status = RXOWN; allocate_rx_buffers() 1081 ++np->really_rx_count; allocate_rx_buffers() 1089 struct netdev_private *np = netdev_priv(dev); netdev_timer() local 1090 void __iomem *ioaddr = np->mem; netdev_timer() 1091 int old_crvalue = np->crvalue; netdev_timer() 1092 unsigned int old_linkok = np->linkok; netdev_timer() 1100 spin_lock_irqsave(&np->lock, flags); netdev_timer() 1102 if (np->flags == HAS_MII_XCVR) { netdev_timer() 1104 if ((old_linkok == 0) && (np->linkok == 1)) { /* we need to detect the media type again */ netdev_timer() 1106 if (np->crvalue != old_crvalue) { netdev_timer() 1107 stop_nic_rxtx(ioaddr, np->crvalue); netdev_timer() 1108 iowrite32(np->crvalue, ioaddr + TCRRCR); netdev_timer() 1115 spin_unlock_irqrestore(&np->lock, flags); netdev_timer() 1117 np->timer.expires = RUN_AT(10 * HZ); netdev_timer() 1118 add_timer(&np->timer); netdev_timer() 1126 struct netdev_private *np = netdev_priv(dev); reset_and_disable_rxtx() local 1127 void __iomem *ioaddr = np->mem; reset_and_disable_rxtx() 1152 struct netdev_private *np = netdev_priv(dev); enable_rxtx() local 1153 void __iomem *ioaddr = np->mem; enable_rxtx() 1157 iowrite32(np->tx_ring_dma + ((char*)np->cur_tx - (char*)np->tx_ring), enable_rxtx() 1159 iowrite32(np->rx_ring_dma + ((char*)np->cur_rx - (char*)np->rx_ring), enable_rxtx() 1162 iowrite32(np->bcrvalue, ioaddr + BCR); enable_rxtx() 1165 __set_rx_mode(dev); /* changes np->crvalue, writes it into TCRRCR */ enable_rxtx() 1169 iowrite32(np->imrvalue, ioaddr + IMR); enable_rxtx() 1178 struct netdev_private *np = netdev_priv(dev); reset_timer() local 1183 spin_lock_irqsave(&np->lock, flags); reset_timer() 1184 np->crvalue = np->crvalue_sv; reset_timer() 1185 np->imrvalue = np->imrvalue_sv; reset_timer() 1193 np->reset_timer_armed = 0; reset_timer() 1195 spin_unlock_irqrestore(&np->lock, flags); reset_timer() 1201 struct netdev_private *np = netdev_priv(dev); fealnx_tx_timeout() local 1202 void __iomem *ioaddr = np->mem; fealnx_tx_timeout() 1211 printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); fealnx_tx_timeout() 1214 (unsigned int) np->rx_ring[i].status); fealnx_tx_timeout() 1216 printk(KERN_DEBUG " Tx ring %p: ", np->tx_ring); fealnx_tx_timeout() 1218 printk(KERN_CONT " %4.4x", np->tx_ring[i].status); fealnx_tx_timeout() 1222 spin_lock_irqsave(&np->lock, flags); fealnx_tx_timeout() 1228 spin_unlock_irqrestore(&np->lock, flags); fealnx_tx_timeout() 1239 struct netdev_private *np = netdev_priv(dev); init_ring() local 1243 np->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); init_ring() 1244 np->cur_rx = &np->rx_ring[0]; init_ring() 1245 np->lack_rxbuf = np->rx_ring; init_ring() 1246 np->really_rx_count = 0; init_ring() 1250 np->rx_ring[i].status = 0; init_ring() 1251 np->rx_ring[i].control = np->rx_buf_sz << RBSShift; init_ring() 1252 np->rx_ring[i].next_desc = np->rx_ring_dma + init_ring() 1254 np->rx_ring[i].next_desc_logical = &np->rx_ring[i + 1]; init_ring() 1255 np->rx_ring[i].skbuff = NULL; init_ring() 1259 np->rx_ring[i - 1].next_desc = np->rx_ring_dma; init_ring() 1260 np->rx_ring[i - 1].next_desc_logical = np->rx_ring; init_ring() 1264 struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz); init_ring() 1267 np->lack_rxbuf = &np->rx_ring[i]; init_ring() 1271 ++np->really_rx_count; init_ring() 1272 np->rx_ring[i].skbuff = skb; init_ring() 1273 np->rx_ring[i].buffer = pci_map_single(np->pci_dev, skb->data, init_ring() 1274 np->rx_buf_sz, PCI_DMA_FROMDEVICE); init_ring() 1275 np->rx_ring[i].status = RXOWN; init_ring() 1276 np->rx_ring[i].control |= RXIC; init_ring() 1280 np->cur_tx = &np->tx_ring[0]; init_ring() 1281 np->cur_tx_copy = &np->tx_ring[0]; init_ring() 1282 np->really_tx_count = 0; init_ring() 1283 np->free_tx_count = TX_RING_SIZE; init_ring() 1286 np->tx_ring[i].status = 0; init_ring() 1287 /* do we need np->tx_ring[i].control = XXX; ?? */ init_ring() 1288 np->tx_ring[i].next_desc = np->tx_ring_dma + init_ring() 1290 np->tx_ring[i].next_desc_logical = &np->tx_ring[i + 1]; init_ring() 1291 np->tx_ring[i].skbuff = NULL; init_ring() 1295 np->tx_ring[i - 1].next_desc = np->tx_ring_dma; init_ring() 1296 np->tx_ring[i - 1].next_desc_logical = &np->tx_ring[0]; init_ring() 1302 struct netdev_private *np = netdev_priv(dev); start_tx() local 1305 spin_lock_irqsave(&np->lock, flags); start_tx() 1307 np->cur_tx_copy->skbuff = skb; start_tx() 1312 np->cur_tx_copy->buffer = pci_map_single(np->pci_dev, skb->data, start_tx() 1314 np->cur_tx_copy->control = TXIC | TXLD | TXFD | CRCEnable | PADEnable; start_tx() 1315 np->cur_tx_copy->control |= (skb->len << PKTSShift); /* pkt size */ start_tx() 1316 np->cur_tx_copy->control |= (skb->len << TBSShift); /* buffer size */ start_tx() 1318 if (np->pci_dev->device == 0x891) start_tx() 1319 np->cur_tx_copy->control |= ETIControl | RetryTxLC; start_tx() 1320 np->cur_tx_copy->status = TXOWN; start_tx() 1321 np->cur_tx_copy = np->cur_tx_copy->next_desc_logical; start_tx() 1322 --np->free_tx_count; start_tx() 1328 np->cur_tx_copy->buffer = pci_map_single(np->pci_dev, skb->data, start_tx() 1330 np->cur_tx_copy->control = TXIC | TXFD | CRCEnable | PADEnable; start_tx() 1331 np->cur_tx_copy->control |= (skb->len << PKTSShift); /* pkt size */ start_tx() 1332 np->cur_tx_copy->control |= (BPT << TBSShift); /* buffer size */ start_tx() 1335 next = np->cur_tx_copy->next_desc_logical; start_tx() 1341 if (np->pci_dev->device == 0x891) start_tx() 1342 np->cur_tx_copy->control |= ETIControl | RetryTxLC; start_tx() 1347 np->cur_tx_copy->status = TXOWN; start_tx() 1349 np->cur_tx_copy = next->next_desc_logical; start_tx() 1350 np->free_tx_count -= 2; start_tx() 1352 np->cur_tx_copy->buffer = pci_map_single(np->pci_dev, skb->data, start_tx() 1354 np->cur_tx_copy->control = TXIC | TXLD | TXFD | CRCEnable | PADEnable; start_tx() 1355 np->cur_tx_copy->control |= (skb->len << PKTSShift); /* pkt size */ start_tx() 1356 np->cur_tx_copy->control |= (skb->len << TBSShift); /* buffer size */ start_tx() 1358 if (np->pci_dev->device == 0x891) start_tx() 1359 np->cur_tx_copy->control |= ETIControl | RetryTxLC; start_tx() 1360 np->cur_tx_copy->status = TXOWN; start_tx() 1361 np->cur_tx_copy = np->cur_tx_copy->next_desc_logical; start_tx() 1362 --np->free_tx_count; start_tx() 1366 if (np->free_tx_count < 2) start_tx() 1368 ++np->really_tx_count; start_tx() 1369 iowrite32(0, np->mem + TXPDR); start_tx() 1371 spin_unlock_irqrestore(&np->lock, flags); start_tx() 1380 struct netdev_private *np = netdev_priv(dev); reset_tx_descriptors() local 1385 np->cur_tx = &np->tx_ring[0]; reset_tx_descriptors() 1386 np->cur_tx_copy = &np->tx_ring[0]; reset_tx_descriptors() 1387 np->really_tx_count = 0; reset_tx_descriptors() 1388 np->free_tx_count = TX_RING_SIZE; reset_tx_descriptors() 1391 cur = &np->tx_ring[i]; reset_tx_descriptors() 1393 pci_unmap_single(np->pci_dev, cur->buffer, reset_tx_descriptors() 1401 cur->next_desc = np->tx_ring_dma + reset_tx_descriptors() 1403 cur->next_desc_logical = &np->tx_ring[i + 1]; reset_tx_descriptors() 1406 np->tx_ring[TX_RING_SIZE - 1].next_desc = np->tx_ring_dma; reset_tx_descriptors() 1407 np->tx_ring[TX_RING_SIZE - 1].next_desc_logical = &np->tx_ring[0]; reset_tx_descriptors() 1414 struct netdev_private *np = netdev_priv(dev); reset_rx_descriptors() local 1415 struct fealnx_desc *cur = np->cur_rx; reset_rx_descriptors() 1426 iowrite32(np->rx_ring_dma + ((char*)np->cur_rx - (char*)np->rx_ring), reset_rx_descriptors() 1427 np->mem + RXLBA); reset_rx_descriptors() 1436 struct netdev_private *np = netdev_priv(dev); intr_handler() local 1437 void __iomem *ioaddr = np->mem; intr_handler() 1442 spin_lock(&np->lock); intr_handler() 1456 if (!(intr_status & np->imrvalue)) intr_handler() 1487 stop_nic_rx(ioaddr, np->crvalue); intr_handler() 1489 iowrite32(np->crvalue, ioaddr + TCRRCR); intr_handler() 1493 while (np->really_tx_count) { intr_handler() 1494 long tx_status = np->cur_tx->status; intr_handler() 1495 long tx_control = np->cur_tx->control; intr_handler() 1500 next = np->cur_tx->next_desc_logical; intr_handler() 1508 if (!(np->crvalue & CR_W_ENH)) { intr_handler() 1519 if ((tx_status & HF) && np->mii.full_duplex == 0) intr_handler() 1537 pci_unmap_single(np->pci_dev, np->cur_tx->buffer, intr_handler() 1538 np->cur_tx->skbuff->len, PCI_DMA_TODEVICE); intr_handler() 1539 dev_kfree_skb_irq(np->cur_tx->skbuff); intr_handler() 1540 np->cur_tx->skbuff = NULL; intr_handler() 1541 --np->really_tx_count; intr_handler() 1542 if (np->cur_tx->control & TXLD) { intr_handler() 1543 np->cur_tx = np->cur_tx->next_desc_logical; intr_handler() 1544 ++np->free_tx_count; intr_handler() 1546 np->cur_tx = np->cur_tx->next_desc_logical; intr_handler() 1547 np->cur_tx = np->cur_tx->next_desc_logical; intr_handler() 1548 np->free_tx_count += 2; intr_handler() 1553 if (num_tx && np->free_tx_count >= 2) intr_handler() 1557 if (np->crvalue & CR_W_ENH) { intr_handler() 1572 if (!np->reset_timer_armed) { intr_handler() 1573 np->reset_timer_armed = 1; intr_handler() 1574 np->reset_timer.expires = RUN_AT(HZ/2); intr_handler() 1575 add_timer(&np->reset_timer); intr_handler() 1580 np->crvalue_sv = np->crvalue; intr_handler() 1581 np->imrvalue_sv = np->imrvalue; intr_handler() 1582 np->crvalue &= ~(CR_W_TXEN | CR_W_RXEN); /* or simply = 0? */ intr_handler() 1583 np->imrvalue = 0; intr_handler() 1602 iowrite32(np->imrvalue, ioaddr + IMR); intr_handler() 1604 spin_unlock(&np->lock); intr_handler() 1614 struct netdev_private *np = netdev_priv(dev); netdev_rx() local 1615 void __iomem *ioaddr = np->mem; netdev_rx() 1618 while (!(np->cur_rx->status & RXOWN) && np->cur_rx->skbuff) { netdev_rx() 1619 s32 rx_status = np->cur_rx->status; netdev_rx() 1621 if (np->really_rx_count == 0) netdev_rx() 1650 cur = np->cur_rx; netdev_rx() 1651 while (desno <= np->really_rx_count) { netdev_rx() 1659 if (desno > np->really_rx_count) netdev_rx() 1671 if (!np->cur_rx->skbuff) { netdev_rx() 1676 np->cur_rx->status = RXOWN; netdev_rx() 1677 np->cur_rx = np->cur_rx->next_desc_logical; netdev_rx() 1681 stop_nic_rx(ioaddr, np->crvalue); netdev_rx() 1683 iowrite32(np->crvalue, ioaddr + TCRRCR); netdev_rx() 1704 pci_dma_sync_single_for_cpu(np->pci_dev, netdev_rx() 1705 np->cur_rx->buffer, netdev_rx() 1706 np->rx_buf_sz, netdev_rx() 1712 np->cur_rx->skbuff->data, pkt_len); netdev_rx() 1716 np->cur_rx->skbuff->data, pkt_len); netdev_rx() 1718 pci_dma_sync_single_for_device(np->pci_dev, netdev_rx() 1719 np->cur_rx->buffer, netdev_rx() 1720 np->rx_buf_sz, netdev_rx() 1723 pci_unmap_single(np->pci_dev, netdev_rx() 1724 np->cur_rx->buffer, netdev_rx() 1725 np->rx_buf_sz, netdev_rx() 1727 skb_put(skb = np->cur_rx->skbuff, pkt_len); netdev_rx() 1728 np->cur_rx->skbuff = NULL; netdev_rx() 1729 --np->really_rx_count; netdev_rx() 1737 np->cur_rx = np->cur_rx->next_desc_logical; netdev_rx() 1749 struct netdev_private *np = netdev_priv(dev); get_stats() local 1750 void __iomem *ioaddr = np->mem; get_stats() 1778 struct netdev_private *np = netdev_priv(dev); __set_rx_mode() local 1779 void __iomem *ioaddr = np->mem; __set_rx_mode() 1803 stop_nic_rxtx(ioaddr, np->crvalue); 1807 np->crvalue &= ~CR_W_RXMODEMASK; 1808 np->crvalue |= rx_mode; 1809 iowrite32(np->crvalue, ioaddr + TCRRCR); 1814 struct netdev_private *np = netdev_priv(dev); netdev_get_drvinfo() local 1818 strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); netdev_get_drvinfo() 1823 struct netdev_private *np = netdev_priv(dev); netdev_get_settings() local 1826 spin_lock_irq(&np->lock); netdev_get_settings() 1827 rc = mii_ethtool_gset(&np->mii, cmd); netdev_get_settings() 1828 spin_unlock_irq(&np->lock); netdev_get_settings() 1835 struct netdev_private *np = netdev_priv(dev); netdev_set_settings() local 1838 spin_lock_irq(&np->lock); netdev_set_settings() 1839 rc = mii_ethtool_sset(&np->mii, cmd); netdev_set_settings() 1840 spin_unlock_irq(&np->lock); netdev_set_settings() 1847 struct netdev_private *np = netdev_priv(dev); netdev_nway_reset() local 1848 return mii_nway_restart(&np->mii); netdev_nway_reset() 1853 struct netdev_private *np = netdev_priv(dev); netdev_get_link() local 1854 return mii_link_ok(&np->mii); netdev_get_link() 1879 struct netdev_private *np = netdev_priv(dev); mii_ioctl() local 1885 spin_lock_irq(&np->lock); mii_ioctl() 1886 rc = generic_mii_ioctl(&np->mii, if_mii(rq), cmd, NULL); mii_ioctl() 1887 spin_unlock_irq(&np->lock); mii_ioctl() 1895 struct netdev_private *np = netdev_priv(dev); netdev_close() local 1896 void __iomem *ioaddr = np->mem; netdev_close() 1907 del_timer_sync(&np->timer); netdev_close() 1908 del_timer_sync(&np->reset_timer); netdev_close() 1910 free_irq(np->pci_dev->irq, dev); netdev_close() 1914 struct sk_buff *skb = np->rx_ring[i].skbuff; netdev_close() 1916 np->rx_ring[i].status = 0; netdev_close() 1918 pci_unmap_single(np->pci_dev, np->rx_ring[i].buffer, netdev_close() 1919 np->rx_buf_sz, PCI_DMA_FROMDEVICE); netdev_close() 1921 np->rx_ring[i].skbuff = NULL; netdev_close() 1926 struct sk_buff *skb = np->tx_ring[i].skbuff; netdev_close() 1929 pci_unmap_single(np->pci_dev, np->tx_ring[i].buffer, netdev_close() 1932 np->tx_ring[i].skbuff = NULL; netdev_close()
|
/linux-4.4.14/drivers/clk/at91/ |
H A D | pmc.h | 59 int of_at91_get_clk_range(struct device_node *np, const char *propname, 62 void of_at91sam9260_clk_slow_setup(struct device_node *np, 65 void of_at91rm9200_clk_main_osc_setup(struct device_node *np, 67 void of_at91sam9x5_clk_main_rc_osc_setup(struct device_node *np, 69 void of_at91rm9200_clk_main_setup(struct device_node *np, 71 void of_at91sam9x5_clk_main_setup(struct device_node *np, 74 void of_at91rm9200_clk_pll_setup(struct device_node *np, 76 void of_at91sam9g45_clk_pll_setup(struct device_node *np, 78 void of_at91sam9g20_clk_pllb_setup(struct device_node *np, 80 void of_sama5d3_clk_pll_setup(struct device_node *np, 82 void of_at91sam9x5_clk_plldiv_setup(struct device_node *np, 85 void of_at91rm9200_clk_master_setup(struct device_node *np, 87 void of_at91sam9x5_clk_master_setup(struct device_node *np, 90 void of_at91rm9200_clk_sys_setup(struct device_node *np, 93 void of_at91rm9200_clk_periph_setup(struct device_node *np, 95 void of_at91sam9x5_clk_periph_setup(struct device_node *np, 98 void of_at91rm9200_clk_prog_setup(struct device_node *np, 100 void of_at91sam9g45_clk_prog_setup(struct device_node *np, 102 void of_at91sam9x5_clk_prog_setup(struct device_node *np, 105 void of_at91sam9x5_clk_utmi_setup(struct device_node *np, 108 void of_at91rm9200_clk_usb_setup(struct device_node *np, 110 void of_at91sam9x5_clk_usb_setup(struct device_node *np, 112 void of_at91sam9n12_clk_usb_setup(struct device_node *np, 115 void of_at91sam9x5_clk_smd_setup(struct device_node *np, 118 void of_sama5d4_clk_h32mx_setup(struct device_node *np, 121 void of_sama5d2_clk_generated_setup(struct device_node *np,
|
H A D | sckc.h | 15 extern void __init of_at91sam9x5_clk_slow_osc_setup(struct device_node *np, 17 extern void __init of_at91sam9x5_clk_slow_rc_osc_setup(struct device_node *np, 19 extern void __init of_at91sam9x5_clk_slow_setup(struct device_node *np,
|
H A D | clk-master.c | 195 of_at91_clk_master_get_characteristics(struct device_node *np) of_at91_clk_master_get_characteristics() argument 203 if (of_at91_get_clk_range(np, "atmel,clk-output-range", &characteristics->output)) of_at91_clk_master_get_characteristics() 206 of_property_read_u32_array(np, "atmel,clk-divisors", of_at91_clk_master_get_characteristics() 210 of_property_read_bool(np, "atmel,master-clk-have-div3-pres"); of_at91_clk_master_get_characteristics() 220 of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc, of_at91_clk_master_setup() argument 227 const char *name = np->name; of_at91_clk_master_setup() 230 num_parents = of_clk_get_parent_count(np); of_at91_clk_master_setup() 234 of_clk_parent_fill(np, parent_names, num_parents); of_at91_clk_master_setup() 236 of_property_read_string(np, "clock-output-names", &name); of_at91_clk_master_setup() 238 characteristics = of_at91_clk_master_get_characteristics(np); of_at91_clk_master_setup() 242 irq = irq_of_parse_and_map(np, 0); of_at91_clk_master_setup() 252 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91_clk_master_setup() 259 void __init of_at91rm9200_clk_master_setup(struct device_node *np, of_at91rm9200_clk_master_setup() argument 262 of_at91_clk_master_setup(np, pmc, &at91rm9200_master_layout); of_at91rm9200_clk_master_setup() 265 void __init of_at91sam9x5_clk_master_setup(struct device_node *np, of_at91sam9x5_clk_master_setup() argument 268 of_at91_clk_master_setup(np, pmc, &at91sam9x5_master_layout); of_at91sam9x5_clk_master_setup()
|
H A D | pmc.c | 45 int of_at91_get_clk_range(struct device_node *np, const char *propname, of_at91_get_clk_range() argument 51 ret = of_property_read_u32_index(np, propname, 0, &min); of_at91_get_clk_range() 55 ret = of_property_read_u32_index(np, propname, 1, &max); of_at91_get_clk_range() 225 static struct at91_pmc *__init at91_pmc_init(struct device_node *np, at91_pmc_init() argument 245 pmc->irqdomain = irq_domain_add_linear(np, 32, &pmc_irq_ops, pmc); at91_pmc_init() 389 static void __init of_at91_pmc_setup(struct device_node *np, of_at91_pmc_setup() argument 396 void __iomem *regbase = of_iomap(np, 0); of_at91_pmc_setup() 402 virq = irq_of_parse_and_map(np, 0); of_at91_pmc_setup() 406 pmc = at91_pmc_init(np, regbase, virq, caps); of_at91_pmc_setup() 409 for_each_child_of_node(np, childnp) { for_each_child_of_node() 418 static void __init of_at91rm9200_pmc_setup(struct device_node *np) of_at91rm9200_pmc_setup() argument 420 of_at91_pmc_setup(np, &at91rm9200_caps); of_at91rm9200_pmc_setup() 425 static void __init of_at91sam9260_pmc_setup(struct device_node *np) of_at91sam9260_pmc_setup() argument 427 of_at91_pmc_setup(np, &at91sam9260_caps); of_at91sam9260_pmc_setup() 432 static void __init of_at91sam9g45_pmc_setup(struct device_node *np) of_at91sam9g45_pmc_setup() argument 434 of_at91_pmc_setup(np, &at91sam9g45_caps); of_at91sam9g45_pmc_setup() 439 static void __init of_at91sam9n12_pmc_setup(struct device_node *np) of_at91sam9n12_pmc_setup() argument 441 of_at91_pmc_setup(np, &at91sam9n12_caps); of_at91sam9n12_pmc_setup() 446 static void __init of_at91sam9x5_pmc_setup(struct device_node *np) of_at91sam9x5_pmc_setup() argument 448 of_at91_pmc_setup(np, &at91sam9x5_caps); of_at91sam9x5_pmc_setup() 453 static void __init of_sama5d2_pmc_setup(struct device_node *np) of_sama5d2_pmc_setup() argument 455 of_at91_pmc_setup(np, &sama5d2_caps); of_sama5d2_pmc_setup() 460 static void __init of_sama5d3_pmc_setup(struct device_node *np) of_sama5d3_pmc_setup() argument 462 of_at91_pmc_setup(np, &sama5d3_caps); of_sama5d3_pmc_setup()
|
H A D | clk-slow.c | 162 void __init of_at91sam9x5_clk_slow_osc_setup(struct device_node *np, of_at91sam9x5_clk_slow_osc_setup() argument 167 const char *name = np->name; of_at91sam9x5_clk_slow_osc_setup() 171 parent_name = of_clk_get_parent_name(np, 0); of_at91sam9x5_clk_slow_osc_setup() 172 of_property_read_string(np, "clock-output-names", &name); of_at91sam9x5_clk_slow_osc_setup() 173 of_property_read_u32(np, "atmel,startup-time-usec", &startup); of_at91sam9x5_clk_slow_osc_setup() 174 bypass = of_property_read_bool(np, "atmel,osc-bypass"); of_at91sam9x5_clk_slow_osc_setup() 181 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91sam9x5_clk_slow_osc_setup() 272 void __init of_at91sam9x5_clk_slow_rc_osc_setup(struct device_node *np, of_at91sam9x5_clk_slow_rc_osc_setup() argument 279 const char *name = np->name; of_at91sam9x5_clk_slow_rc_osc_setup() 281 of_property_read_string(np, "clock-output-names", &name); of_at91sam9x5_clk_slow_rc_osc_setup() 282 of_property_read_u32(np, "clock-frequency", &frequency); of_at91sam9x5_clk_slow_rc_osc_setup() 283 of_property_read_u32(np, "clock-accuracy", &accuracy); of_at91sam9x5_clk_slow_rc_osc_setup() 284 of_property_read_u32(np, "atmel,startup-time-usec", &startup); of_at91sam9x5_clk_slow_rc_osc_setup() 291 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91sam9x5_clk_slow_rc_osc_setup() 369 void __init of_at91sam9x5_clk_slow_setup(struct device_node *np, of_at91sam9x5_clk_slow_setup() argument 375 const char *name = np->name; of_at91sam9x5_clk_slow_setup() 377 num_parents = of_clk_get_parent_count(np); of_at91sam9x5_clk_slow_setup() 381 of_clk_parent_fill(np, parent_names, num_parents); of_at91sam9x5_clk_slow_setup() 383 of_property_read_string(np, "clock-output-names", &name); of_at91sam9x5_clk_slow_setup() 390 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91sam9x5_clk_slow_setup() 442 void __init of_at91sam9260_clk_slow_setup(struct device_node *np, of_at91sam9260_clk_slow_setup() argument 448 const char *name = np->name; of_at91sam9260_clk_slow_setup() 450 num_parents = of_clk_get_parent_count(np); of_at91sam9260_clk_slow_setup() 454 of_clk_parent_fill(np, parent_names, num_parents); of_at91sam9260_clk_slow_setup() 456 of_property_read_string(np, "clock-output-names", &name); of_at91sam9260_clk_slow_setup() 463 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91sam9260_clk_slow_setup()
|
H A D | sckc.c | 38 static void __init of_at91sam9x5_sckc_setup(struct device_node *np) of_at91sam9x5_sckc_setup() argument 43 void __iomem *regbase = of_iomap(np, 0); of_at91sam9x5_sckc_setup() 48 for_each_child_of_node(np, childnp) { for_each_child_of_node()
|
H A D | clk-utmi.c | 136 of_at91_clk_utmi_setup(struct device_node *np, struct at91_pmc *pmc) of_at91_clk_utmi_setup() argument 141 const char *name = np->name; of_at91_clk_utmi_setup() 143 parent_name = of_clk_get_parent_name(np, 0); of_at91_clk_utmi_setup() 145 of_property_read_string(np, "clock-output-names", &name); of_at91_clk_utmi_setup() 147 irq = irq_of_parse_and_map(np, 0); of_at91_clk_utmi_setup() 155 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91_clk_utmi_setup() 159 void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np, of_at91sam9x5_clk_utmi_setup() argument 162 of_at91_clk_utmi_setup(np, pmc); of_at91sam9x5_clk_utmi_setup()
|
H A D | clk-usb.c | 372 void __init of_at91sam9x5_clk_usb_setup(struct device_node *np, of_at91sam9x5_clk_usb_setup() argument 378 const char *name = np->name; of_at91sam9x5_clk_usb_setup() 380 num_parents = of_clk_get_parent_count(np); of_at91sam9x5_clk_usb_setup() 384 of_clk_parent_fill(np, parent_names, num_parents); of_at91sam9x5_clk_usb_setup() 386 of_property_read_string(np, "clock-output-names", &name); of_at91sam9x5_clk_usb_setup() 392 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91sam9x5_clk_usb_setup() 395 void __init of_at91sam9n12_clk_usb_setup(struct device_node *np, of_at91sam9n12_clk_usb_setup() argument 400 const char *name = np->name; of_at91sam9n12_clk_usb_setup() 402 parent_name = of_clk_get_parent_name(np, 0); of_at91sam9n12_clk_usb_setup() 406 of_property_read_string(np, "clock-output-names", &name); of_at91sam9n12_clk_usb_setup() 412 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91sam9n12_clk_usb_setup() 415 void __init of_at91rm9200_clk_usb_setup(struct device_node *np, of_at91rm9200_clk_usb_setup() argument 420 const char *name = np->name; of_at91rm9200_clk_usb_setup() 423 parent_name = of_clk_get_parent_name(np, 0); of_at91rm9200_clk_usb_setup() 427 of_property_read_u32_array(np, "atmel,clk-divisors", divisors, 4); of_at91rm9200_clk_usb_setup() 431 of_property_read_string(np, "clock-output-names", &name); of_at91rm9200_clk_usb_setup() 437 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91rm9200_clk_usb_setup()
|
H A D | clk-plldiv.c | 112 of_at91_clk_plldiv_setup(struct device_node *np, struct at91_pmc *pmc) of_at91_clk_plldiv_setup() argument 116 const char *name = np->name; of_at91_clk_plldiv_setup() 118 parent_name = of_clk_get_parent_name(np, 0); of_at91_clk_plldiv_setup() 120 of_property_read_string(np, "clock-output-names", &name); of_at91_clk_plldiv_setup() 127 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91_clk_plldiv_setup() 131 void __init of_at91sam9x5_clk_plldiv_setup(struct device_node *np, of_at91sam9x5_clk_plldiv_setup() argument 134 of_at91_clk_plldiv_setup(np, pmc); of_at91sam9x5_clk_plldiv_setup()
|
H A D | clk-main.c | 194 void __init of_at91rm9200_clk_main_osc_setup(struct device_node *np, of_at91rm9200_clk_main_osc_setup() argument 199 const char *name = np->name; of_at91rm9200_clk_main_osc_setup() 203 of_property_read_string(np, "clock-output-names", &name); of_at91rm9200_clk_main_osc_setup() 204 bypass = of_property_read_bool(np, "atmel,osc-bypass"); of_at91rm9200_clk_main_osc_setup() 205 parent_name = of_clk_get_parent_name(np, 0); of_at91rm9200_clk_main_osc_setup() 207 irq = irq_of_parse_and_map(np, 0); of_at91rm9200_clk_main_osc_setup() 215 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91rm9200_clk_main_osc_setup() 342 void __init of_at91sam9x5_clk_main_rc_osc_setup(struct device_node *np, of_at91sam9x5_clk_main_rc_osc_setup() argument 349 const char *name = np->name; of_at91sam9x5_clk_main_rc_osc_setup() 351 of_property_read_string(np, "clock-output-names", &name); of_at91sam9x5_clk_main_rc_osc_setup() 352 of_property_read_u32(np, "clock-frequency", &frequency); of_at91sam9x5_clk_main_rc_osc_setup() 353 of_property_read_u32(np, "clock-accuracy", &accuracy); of_at91sam9x5_clk_main_rc_osc_setup() 355 irq = irq_of_parse_and_map(np, 0); of_at91sam9x5_clk_main_rc_osc_setup() 364 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91sam9x5_clk_main_rc_osc_setup() 464 void __init of_at91rm9200_clk_main_setup(struct device_node *np, of_at91rm9200_clk_main_setup() argument 469 const char *name = np->name; of_at91rm9200_clk_main_setup() 471 parent_name = of_clk_get_parent_name(np, 0); of_at91rm9200_clk_main_setup() 472 of_property_read_string(np, "clock-output-names", &name); of_at91rm9200_clk_main_setup() 478 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91rm9200_clk_main_setup() 609 void __init of_at91sam9x5_clk_main_setup(struct device_node *np, of_at91sam9x5_clk_main_setup() argument 616 const char *name = np->name; of_at91sam9x5_clk_main_setup() 618 num_parents = of_clk_get_parent_count(np); of_at91sam9x5_clk_main_setup() 622 of_clk_parent_fill(np, parent_names, num_parents); of_at91sam9x5_clk_main_setup() 624 of_property_read_string(np, "clock-output-names", &name); of_at91sam9x5_clk_main_setup() 626 irq = irq_of_parse_and_map(np, 0); of_at91sam9x5_clk_main_setup() 635 of_clk_add_provider(np, of_clk_src_simple_get, clk); of_at91sam9x5_clk_main_setup()
|
/linux-4.4.14/arch/powerpc/platforms/83xx/ |
H A D | misc.c | 76 struct device_node *np; mpc83xx_ipic_init_IRQ() local 79 np = of_find_compatible_node(NULL, NULL, "fsl,ipic"); mpc83xx_ipic_init_IRQ() 80 if (!np) mpc83xx_ipic_init_IRQ() 81 np = of_find_node_by_type(NULL, "ipic"); mpc83xx_ipic_init_IRQ() 82 if (!np) mpc83xx_ipic_init_IRQ() 85 ipic_init(np, 0); mpc83xx_ipic_init_IRQ() 87 of_node_put(np); mpc83xx_ipic_init_IRQ() 98 struct device_node *np; mpc83xx_qe_init_IRQ() local 100 np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic"); mpc83xx_qe_init_IRQ() 101 if (!np) { mpc83xx_qe_init_IRQ() 102 np = of_find_node_by_type(NULL, "qeic"); mpc83xx_qe_init_IRQ() 103 if (!np) mpc83xx_qe_init_IRQ() 106 qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic); mpc83xx_qe_init_IRQ() 107 of_node_put(np); mpc83xx_qe_init_IRQ() 137 struct device_node *np; mpc83xx_setup_pci() local 139 for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") mpc83xx_setup_pci() 140 mpc83xx_add_bridge(np); mpc83xx_setup_pci() 141 for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie") mpc83xx_setup_pci() 142 mpc83xx_add_bridge(np); mpc83xx_setup_pci()
|
H A D | mpc832x_mds.c | 58 struct device_node *np; mpc832x_sys_setup_arch() local 65 np = of_find_node_by_name(NULL, "bcsr"); mpc832x_sys_setup_arch() 66 if (np) { mpc832x_sys_setup_arch() 69 of_address_to_resource(np, 0, &res); mpc832x_sys_setup_arch() 71 of_node_put(np); mpc832x_sys_setup_arch() 79 if ((np = of_find_node_by_name(NULL, "par_io")) != NULL) { mpc832x_sys_setup_arch() 80 par_io_init(np); mpc832x_sys_setup_arch() 81 of_node_put(np); mpc832x_sys_setup_arch() 83 for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;) mpc832x_sys_setup_arch() 84 par_io_of_config(np); mpc832x_sys_setup_arch() 87 if ((np = of_find_compatible_node(NULL, "network", "ucc_geth")) mpc832x_sys_setup_arch() 95 of_node_put(np); mpc832x_sys_setup_arch()
|
H A D | mpc836x_mds.c | 66 struct device_node *np; mpc836x_mds_setup_arch() local 73 np = of_find_node_by_name(NULL, "bcsr"); mpc836x_mds_setup_arch() 74 if (np) { mpc836x_mds_setup_arch() 77 of_address_to_resource(np, 0, &res); mpc836x_mds_setup_arch() 79 of_node_put(np); mpc836x_mds_setup_arch() 87 if ((np = of_find_node_by_name(NULL, "par_io")) != NULL) { mpc836x_mds_setup_arch() 88 par_io_init(np); mpc836x_mds_setup_arch() 89 of_node_put(np); mpc836x_mds_setup_arch() 91 for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;) mpc836x_mds_setup_arch() 92 par_io_of_config(np); mpc836x_mds_setup_arch() 105 if ((np = of_find_compatible_node(NULL, "network", "ucc_geth")) mpc836x_mds_setup_arch() 138 of_node_put(np); mpc836x_mds_setup_arch() 149 struct device_node *np; mpc836x_usb_cfg() local 153 np = of_find_compatible_node(NULL, NULL, "fsl,mpc8360mds-bcsr"); mpc836x_usb_cfg() 154 if (!np) mpc836x_usb_cfg() 157 bcsr = of_iomap(np, 0); mpc836x_usb_cfg() 158 of_node_put(np); mpc836x_usb_cfg() 162 np = of_find_compatible_node(NULL, NULL, "fsl,mpc8323-qe-usb"); mpc836x_usb_cfg() 163 if (!np) { mpc836x_usb_cfg() 187 mode = of_get_property(np, "mode", NULL); mpc836x_usb_cfg() 201 of_node_put(np); mpc836x_usb_cfg()
|
H A D | mpc837x_mds.c | 32 struct device_node *np; mpc837xmds_usb_cfg() local 42 np = of_find_compatible_node(NULL, NULL, "fsl,mpc837xmds-bcsr"); mpc837xmds_usb_cfg() 43 if (np) { mpc837xmds_usb_cfg() 44 bcsr_regs = of_iomap(np, 0); mpc837xmds_usb_cfg() 45 of_node_put(np); mpc837xmds_usb_cfg() 50 np = of_find_node_by_name(NULL, "usb"); mpc837xmds_usb_cfg() 51 if (!np) { mpc837xmds_usb_cfg() 55 phy_type = of_get_property(np, "phy_type", NULL); mpc837xmds_usb_cfg() 59 mode = of_get_property(np, "dr_mode", NULL); mpc837xmds_usb_cfg() 69 of_node_put(np); mpc837xmds_usb_cfg()
|
H A D | usb.c | 31 struct device_node *np = NULL; mpc834x_usb_cfg() local 45 np = of_find_compatible_node(NULL, NULL, "fsl-usb2-dr"); mpc834x_usb_cfg() 46 if (np) { mpc834x_usb_cfg() 49 prop = of_get_property(np, "phy_type", NULL); mpc834x_usb_cfg() 57 dr_mode = of_get_property(np, "dr_mode", NULL); mpc834x_usb_cfg() 69 of_node_put(np); mpc834x_usb_cfg() 71 np = of_find_compatible_node(NULL, NULL, "fsl-usb2-mph"); mpc834x_usb_cfg() 72 if (np) { mpc834x_usb_cfg() 75 prop = of_get_property(np, "port0", NULL); mpc834x_usb_cfg() 82 prop = of_get_property(np, "port1", NULL); mpc834x_usb_cfg() 89 of_node_put(np); mpc834x_usb_cfg() 107 struct device_node *np = NULL; mpc831x_usb_cfg() local 116 np = of_find_compatible_node(NULL, NULL, "fsl-usb2-dr"); mpc831x_usb_cfg() 117 if (!np) mpc831x_usb_cfg() 119 prop = of_get_property(np, "phy_type", NULL); mpc831x_usb_cfg() 124 of_node_put(np); mpc831x_usb_cfg() 129 immr_node = of_get_parent(np); mpc831x_usb_cfg() 168 ret = of_address_to_resource(np, 0, &res); mpc831x_usb_cfg() 170 of_node_put(np); mpc831x_usb_cfg() 197 dr_mode = of_get_property(np, "dr_mode", NULL); mpc831x_usb_cfg() 210 of_node_put(np); mpc831x_usb_cfg() 219 struct device_node *np = NULL; mpc837x_usb_cfg() local 223 np = of_find_compatible_node(NULL, NULL, "fsl-usb2-dr"); mpc837x_usb_cfg() 224 if (!np || !of_device_is_available(np)) mpc837x_usb_cfg() 226 prop = of_get_property(np, "phy_type", NULL); mpc837x_usb_cfg() 230 of_node_put(np); mpc837x_usb_cfg() 237 of_node_put(np); mpc837x_usb_cfg() 250 of_node_put(np); mpc837x_usb_cfg()
|
H A D | mpc832x_rdb.c | 49 struct device_node *np; of_fsl_spi_probe() local 52 for_each_compatible_node(np, type, compatible) { for_each_compatible_node() 66 prop = of_get_property(np, "reg", NULL); for_each_compatible_node() 71 prop = of_get_property(np, "cell-index", NULL); for_each_compatible_node() 75 prop = of_get_property(np, "mode", NULL); for_each_compatible_node() 87 ret = of_address_to_resource(np, 0, &res[0]); for_each_compatible_node() 91 ret = of_irq_to_resource(np, 0, &res[1]); for_each_compatible_node() 116 pr_err("%s: registration failed\n", np->full_name); for_each_compatible_node() 197 struct device_node *np; mpc832x_rdb_setup_arch() local 208 if ((np = of_find_node_by_name(NULL, "par_io")) != NULL) { mpc832x_rdb_setup_arch() 209 par_io_init(np); mpc832x_rdb_setup_arch() 210 of_node_put(np); mpc832x_rdb_setup_arch() 212 for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;) mpc832x_rdb_setup_arch() 213 par_io_of_config(np); mpc832x_rdb_setup_arch()
|
H A D | km83xx.c | 130 struct device_node *np; mpc83xx_km_setup_arch() local 141 np = of_find_node_by_name(NULL, "par_io"); mpc83xx_km_setup_arch() 142 if (np != NULL) { mpc83xx_km_setup_arch() 143 par_io_init(np); mpc83xx_km_setup_arch() 144 of_node_put(np); mpc83xx_km_setup_arch() 146 for_each_node_by_name(np, "spi") mpc83xx_km_setup_arch() 147 par_io_of_config(np); mpc83xx_km_setup_arch() 149 for_each_node_by_name(np, "ucc") mpc83xx_km_setup_arch() 150 par_io_of_config(np); mpc83xx_km_setup_arch() 153 np = of_find_compatible_node(NULL, "network", "ucc_geth"); mpc83xx_km_setup_arch() 154 if (np != NULL) { mpc83xx_km_setup_arch() 156 of_node_put(np); mpc83xx_km_setup_arch()
|
H A D | mpc834x_mds.c | 44 struct device_node *np; mpc834xemds_usb_cfg() local 50 np = of_find_node_by_name(NULL, "bcsr"); mpc834xemds_usb_cfg() 51 if (np) { mpc834xemds_usb_cfg() 54 of_address_to_resource(np, 0, &res); mpc834xemds_usb_cfg() 56 of_node_put(np); mpc834xemds_usb_cfg()
|
/linux-4.4.14/drivers/cpufreq/ |
H A D | arm_big_little_dt.c | 36 struct device_node *np = of_cpu_device_node_get(cpu); get_cpu_node_with_valid_op() local 38 if (!of_get_property(np, "operating-points", NULL)) { get_cpu_node_with_valid_op() 39 of_node_put(np); get_cpu_node_with_valid_op() 40 np = NULL; get_cpu_node_with_valid_op() 43 return np; get_cpu_node_with_valid_op() 48 struct device_node *np; dt_init_opp_table() local 51 np = of_node_get(cpu_dev->of_node); dt_init_opp_table() 52 if (!np) { dt_init_opp_table() 58 of_node_put(np); dt_init_opp_table() 65 struct device_node *np; dt_get_transition_latency() local 68 np = of_node_get(cpu_dev->of_node); dt_get_transition_latency() 69 if (!np) { dt_get_transition_latency() 74 of_property_read_u32(np, "clock-latency", &transition_latency); dt_get_transition_latency() 75 of_node_put(np); dt_get_transition_latency() 90 struct device_node *np; generic_bL_probe() local 92 np = get_cpu_node_with_valid_op(0); generic_bL_probe() 93 if (!np) generic_bL_probe() 96 of_node_put(np); generic_bL_probe()
|
H A D | qoriq-cpufreq.c | 104 struct device_node *np, *clk_np; cpu_to_clk_node() local 109 np = of_get_cpu_node(cpu, NULL); cpu_to_clk_node() 110 if (!np) cpu_to_clk_node() 113 clk_np = of_parse_phandle(np, "clocks", 0); cpu_to_clk_node() 117 of_node_put(np); cpu_to_clk_node() 125 struct device_node *np, *clk_np; set_affected_cpus() local 129 np = cpu_to_clk_node(policy->cpu); set_affected_cpus() 130 if (!np) set_affected_cpus() 138 if (clk_np == np) for_each_present_cpu() 143 of_node_put(np); 199 struct device_node *np, *pnode; qoriq_cpufreq_cpu_init() local 208 np = of_get_cpu_node(cpu, NULL); qoriq_cpufreq_cpu_init() 209 if (!np) qoriq_cpufreq_cpu_init() 216 policy->clk = of_clk_get(np, 0); qoriq_cpufreq_cpu_init() 222 pnode = of_parse_phandle(np, "clocks", 0); qoriq_cpufreq_cpu_init() 282 of_node_put(np); qoriq_cpufreq_cpu_init() 297 of_node_put(np); qoriq_cpufreq_cpu_init() 348 struct device_node *np; qoriq_cpufreq_init() local 352 np = of_find_matching_node(NULL, node_matches); qoriq_cpufreq_init() 353 if (!np) qoriq_cpufreq_init() 356 match = of_match_node(node_matches, np); qoriq_cpufreq_init() 366 of_node_put(np); qoriq_cpufreq_init()
|
/linux-4.4.14/drivers/scsi/sym53c8xx_2/ |
H A D | sym_hipd.c | 54 static void sym_int_ma (struct sym_hcb *np); 56 static struct sym_ccb *sym_alloc_ccb(struct sym_hcb *np); 57 static struct sym_ccb *sym_ccb_from_dsa(struct sym_hcb *np, u32 dsa); 58 static void sym_alloc_lcb_tags (struct sym_hcb *np, u_char tn, u_char ln); 59 static void sym_complete_error (struct sym_hcb *np, struct sym_ccb *cp); 60 static void sym_complete_ok (struct sym_hcb *np, struct sym_ccb *cp); 61 static int sym_compute_residual(struct sym_hcb *np, struct sym_ccb *cp); 81 static void sym_print_nego_msg(struct sym_hcb *np, int target, char *label, u_char *msg) sym_print_nego_msg() argument 83 struct sym_tcb *tp = &np->target[target]; sym_print_nego_msg() 133 static void sym_chip_reset (struct sym_hcb *np) sym_chip_reset() argument 135 OUTB(np, nc_istat, SRST); sym_chip_reset() 136 INB(np, nc_mbox1); sym_chip_reset() 138 OUTB(np, nc_istat, 0); sym_chip_reset() 139 INB(np, nc_mbox1); sym_chip_reset() 152 static void sym_soft_reset (struct sym_hcb *np) sym_soft_reset() argument 157 if (!(np->features & FE_ISTAT1) || !(INB(np, nc_istat1) & SCRUN)) sym_soft_reset() 160 OUTB(np, nc_istat, CABRT); sym_soft_reset() 162 istat = INB(np, nc_istat); sym_soft_reset() 164 INW(np, nc_sist); sym_soft_reset() 167 if (INB(np, nc_dstat) & ABRT) sym_soft_reset() 172 OUTB(np, nc_istat, 0); sym_soft_reset() 175 "ISTAT=0x%02x.\n", sym_name(np), istat); sym_soft_reset() 177 sym_chip_reset(np); sym_soft_reset() 185 static void sym_start_reset(struct sym_hcb *np) sym_start_reset() argument 187 sym_reset_scsi_bus(np, 1); sym_start_reset() 190 int sym_reset_scsi_bus(struct sym_hcb *np, int enab_int) sym_reset_scsi_bus() argument 195 sym_soft_reset(np); /* Soft reset the chip */ sym_reset_scsi_bus() 197 OUTW(np, nc_sien, RST); sym_reset_scsi_bus() 202 OUTB(np, nc_stest3, TE); sym_reset_scsi_bus() 203 OUTB(np, nc_dcntl, (np->rv_dcntl & IRQM)); sym_reset_scsi_bus() 204 OUTB(np, nc_scntl1, CRST); sym_reset_scsi_bus() 205 INB(np, nc_mbox1); sym_reset_scsi_bus() 216 term = INB(np, nc_sstat0); sym_reset_scsi_bus() 218 term |= ((INB(np, nc_sstat2) & 0x01) << 26) | /* sdp1 */ sym_reset_scsi_bus() 219 ((INW(np, nc_sbdl) & 0xff) << 9) | /* d7-0 */ sym_reset_scsi_bus() 220 ((INW(np, nc_sbdl) & 0xff00) << 10) | /* d15-8 */ sym_reset_scsi_bus() 221 INB(np, nc_sbcl); /* req ack bsy sel atn msg cd io */ sym_reset_scsi_bus() 223 if (!np->maxwide) sym_reset_scsi_bus() 228 sym_name(np)); sym_reset_scsi_bus() 231 sym_name(np), sym_reset_scsi_bus() 232 (np->features & FE_WIDE) ? "dp1,d15-8," : "", sym_reset_scsi_bus() 238 OUTB(np, nc_scntl1, 0); sym_reset_scsi_bus() 245 static void sym_selectclock(struct sym_hcb *np, u_char scntl3) sym_selectclock() argument 250 if (np->multiplier <= 1) { sym_selectclock() 251 OUTB(np, nc_scntl3, scntl3); sym_selectclock() 256 printf ("%s: enabling clock multiplier\n", sym_name(np)); sym_selectclock() 258 OUTB(np, nc_stest1, DBLEN); /* Enable clock multiplier */ sym_selectclock() 263 if (np->features & FE_LCKFRQ) { sym_selectclock() 265 while (!(INB(np, nc_stest4) & LCKFRQ) && --i > 0) sym_selectclock() 269 sym_name(np)); sym_selectclock() 271 INB(np, nc_mbox1); sym_selectclock() 274 OUTB(np, nc_stest3, HSC); /* Halt the scsi clock */ sym_selectclock() 275 OUTB(np, nc_scntl3, scntl3); sym_selectclock() 276 OUTB(np, nc_stest1, (DBLEN|DBLSEL));/* Select clock multiplier */ sym_selectclock() 277 OUTB(np, nc_stest3, 0x00); /* Restart scsi clock */ sym_selectclock() 302 static unsigned getfreq (struct sym_hcb *np, int gen) getfreq() argument 322 OUTW(np, nc_sien, 0); /* mask all scsi interrupts */ getfreq() 323 INW(np, nc_sist); /* clear pending scsi interrupt */ getfreq() 324 OUTB(np, nc_dien, 0); /* mask all dma interrupts */ getfreq() 325 INW(np, nc_sist); /* another one, just to be sure :) */ getfreq() 331 if (np->features & FE_C10) { getfreq() 332 OUTW(np, nc_sien, GEN); getfreq() 333 OUTB(np, nc_istat1, SIRQD); getfreq() 335 OUTB(np, nc_scntl3, 4); /* set pre-scaler to divide by 3 */ getfreq() 336 OUTB(np, nc_stime1, 0); /* disable general purpose timer */ getfreq() 337 OUTB(np, nc_stime1, gen); /* set to nominal delay of 1<<gen * 125us */ getfreq() 338 while (!(INW(np, nc_sist) & GEN) && ms++ < 100000) getfreq() 340 OUTB(np, nc_stime1, 0); /* disable general purpose timer */ getfreq() 344 if (np->features & FE_C10) { getfreq() 345 OUTW(np, nc_sien, 0); getfreq() 346 OUTB(np, nc_istat1, 0); getfreq() 353 OUTB(np, nc_scntl3, 0); getfreq() 364 if (np->features & FE_C10) getfreq() 369 sym_name(np), gen, ms/4, f); getfreq() 374 static unsigned sym_getfreq (struct sym_hcb *np) sym_getfreq() argument 379 getfreq (np, gen); /* throw away first result */ sym_getfreq() 380 f1 = getfreq (np, gen); sym_getfreq() 381 f2 = getfreq (np, gen); sym_getfreq() 389 static void sym_getclock (struct sym_hcb *np, int mult) sym_getclock() argument 391 unsigned char scntl3 = np->sv_scntl3; sym_getclock() 392 unsigned char stest1 = np->sv_stest1; sym_getclock() 395 np->multiplier = 1; sym_getclock() 402 printf ("%s: clock multiplier found\n", sym_name(np)); sym_getclock() 403 np->multiplier = mult; sym_getclock() 411 if (np->multiplier != mult || (scntl3 & 7) < 3 || !(scntl3 & 1)) { sym_getclock() 412 OUTB(np, nc_stest1, 0); /* make sure doubler is OFF */ sym_getclock() 413 f1 = sym_getfreq (np); sym_getclock() 416 printf ("%s: chip clock is %uKHz\n", sym_name(np), f1); sym_getclock() 425 sym_name(np)); sym_getclock() 426 np->multiplier = mult; sym_getclock() 433 f1 /= np->multiplier; sym_getclock() 439 f1 *= np->multiplier; sym_getclock() 440 np->clock_khz = f1; sym_getclock() 446 static int sym_getpciclock (struct sym_hcb *np) argument 455 if (np->features & FE_66MHZ) { 459 OUTB(np, nc_stest1, SCLK); /* Use the PCI clock as SCSI clock */ 460 f = sym_getfreq(np); 461 OUTB(np, nc_stest1, 0); 463 np->pciclk_khz = f; 482 sym_getsync(struct sym_hcb *np, u_char dt, u_char sfac, u_char *divp, u_char *fakp) sym_getsync() argument 484 u32 clk = np->clock_khz; /* SCSI clock frequency in kHz */ sym_getsync() 485 int div = np->clock_divn; /* Number of divisors supported */ sym_getsync() 513 if ((np->features & (FE_C10|FE_U3EN)) == FE_C10) { sym_getsync() 526 if (div == np->clock_divn) { /* Are we too fast ? */ sym_getsync() 550 /* ret = ((2+fak)*div_10M[div])/np->clock_khz; */ sym_getsync() 553 /* ret = ((4+fak)*div_10M[div])/np->clock_khz; */ sym_getsync() 602 static inline void sym_init_burst(struct sym_hcb *np, u_char bc) sym_init_burst() argument 604 np->rv_ctest4 &= ~0x80; sym_init_burst() 605 np->rv_dmode &= ~(0x3 << 6); sym_init_burst() 606 np->rv_ctest5 &= ~0x4; sym_init_burst() 609 np->rv_ctest4 |= 0x80; sym_init_burst() 613 np->rv_dmode |= ((bc & 0x3) << 6); sym_init_burst() 614 np->rv_ctest5 |= (bc & 0x4); sym_init_burst() 627 static void sym_save_initial_setting (struct sym_hcb *np) sym_save_initial_setting() argument 629 np->sv_scntl0 = INB(np, nc_scntl0) & 0x0a; sym_save_initial_setting() 630 np->sv_scntl3 = INB(np, nc_scntl3) & 0x07; sym_save_initial_setting() 631 np->sv_dmode = INB(np, nc_dmode) & 0xce; sym_save_initial_setting() 632 np->sv_dcntl = INB(np, nc_dcntl) & 0xa8; sym_save_initial_setting() 633 np->sv_ctest3 = INB(np, nc_ctest3) & 0x01; sym_save_initial_setting() 634 np->sv_ctest4 = INB(np, nc_ctest4) & 0x80; sym_save_initial_setting() 635 np->sv_gpcntl = INB(np, nc_gpcntl); sym_save_initial_setting() 636 np->sv_stest1 = INB(np, nc_stest1); sym_save_initial_setting() 637 np->sv_stest2 = INB(np, nc_stest2) & 0x20; sym_save_initial_setting() 638 np->sv_stest4 = INB(np, nc_stest4); sym_save_initial_setting() 639 if (np->features & FE_C10) { /* Always large DMA fifo + ultra3 */ sym_save_initial_setting() 640 np->sv_scntl4 = INB(np, nc_scntl4); sym_save_initial_setting() 641 np->sv_ctest5 = INB(np, nc_ctest5) & 0x04; sym_save_initial_setting() 644 np->sv_ctest5 = INB(np, nc_ctest5) & 0x24; sym_save_initial_setting() 654 static void sym_set_bus_mode(struct sym_hcb *np, struct sym_nvram *nvram) sym_set_bus_mode() argument 656 if (np->scsi_mode) sym_set_bus_mode() 659 np->scsi_mode = SMODE_SE; sym_set_bus_mode() 660 if (np->features & (FE_ULTRA2|FE_ULTRA3)) sym_set_bus_mode() 661 np->scsi_mode = (np->sv_stest4 & SMODE); sym_set_bus_mode() 662 else if (np->features & FE_DIFF) { sym_set_bus_mode() 664 if (np->sv_scntl3) { sym_set_bus_mode() 665 if (np->sv_stest2 & 0x20) sym_set_bus_mode() 666 np->scsi_mode = SMODE_HVD; sym_set_bus_mode() 668 if (!(INB(np, nc_gpreg) & 0x08)) sym_set_bus_mode() 669 np->scsi_mode = SMODE_HVD; sym_set_bus_mode() 672 np->scsi_mode = SMODE_HVD; sym_set_bus_mode() 674 if (np->scsi_mode == SMODE_HVD) sym_set_bus_mode() 675 np->rv_stest2 |= 0x20; sym_set_bus_mode() 682 static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram) sym_prepare_setting() argument 690 np->maxwide = (np->features & FE_WIDE) ? 1 : 0; sym_prepare_setting() 695 if (np->features & (FE_ULTRA3 | FE_ULTRA2)) sym_prepare_setting() 696 np->clock_khz = 160000; sym_prepare_setting() 697 else if (np->features & FE_ULTRA) sym_prepare_setting() 698 np->clock_khz = 80000; sym_prepare_setting() 700 np->clock_khz = 40000; sym_prepare_setting() 705 if (np->features & FE_QUAD) sym_prepare_setting() 706 np->multiplier = 4; sym_prepare_setting() 707 else if (np->features & FE_DBLR) sym_prepare_setting() 708 np->multiplier = 2; sym_prepare_setting() 710 np->multiplier = 1; sym_prepare_setting() 716 if (np->features & FE_VARCLK) sym_prepare_setting() 717 sym_getclock(np, np->multiplier); sym_prepare_setting() 722 i = np->clock_divn - 1; sym_prepare_setting() 724 if (10ul * SYM_CONF_MIN_ASYNC * np->clock_khz > div_10M[i]) { sym_prepare_setting() 729 np->rv_scntl3 = i+1; sym_prepare_setting() 735 if (np->features & FE_C10) sym_prepare_setting() 736 np->rv_scntl3 = 0; sym_prepare_setting() 742 period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz; sym_prepare_setting() 744 if (period <= 250) np->minsync = 10; sym_prepare_setting() 745 else if (period <= 303) np->minsync = 11; sym_prepare_setting() 746 else if (period <= 500) np->minsync = 12; sym_prepare_setting() 747 else np->minsync = (period + 40 - 1) / 40; sym_prepare_setting() 752 if (np->minsync < 25 && sym_prepare_setting() 753 !(np->features & (FE_ULTRA|FE_ULTRA2|FE_ULTRA3))) sym_prepare_setting() 754 np->minsync = 25; sym_prepare_setting() 755 else if (np->minsync < 12 && sym_prepare_setting() 756 !(np->features & (FE_ULTRA2|FE_ULTRA3))) sym_prepare_setting() 757 np->minsync = 12; sym_prepare_setting() 762 period = (11 * div_10M[np->clock_divn - 1]) / (4 * np->clock_khz); sym_prepare_setting() 763 np->maxsync = period > 2540 ? 254 : period / 10; sym_prepare_setting() 768 if ((np->features & (FE_C10|FE_ULTRA3)) == (FE_C10|FE_ULTRA3)) { sym_prepare_setting() 769 if (np->clock_khz == 160000) { sym_prepare_setting() 770 np->minsync_dt = 9; sym_prepare_setting() 771 np->maxsync_dt = 50; sym_prepare_setting() 772 np->maxoffs_dt = nvram->type ? 62 : 31; sym_prepare_setting() 779 if (np->features & FE_DAC) { sym_prepare_setting() 780 if (!use_dac(np)) sym_prepare_setting() 781 np->rv_ccntl1 |= (DDAC); sym_prepare_setting() 783 np->rv_ccntl1 |= (XTIMOD | EXTIBMV); sym_prepare_setting() 785 np->rv_ccntl1 |= (0 | EXTIBMV); sym_prepare_setting() 791 if (np->features & FE_NOPM) sym_prepare_setting() 792 np->rv_ccntl0 |= (ENPMJ); sym_prepare_setting() 801 np->rv_ccntl0 |= DILS; sym_prepare_setting() 808 burst_max = burst_code(np->sv_dmode, np->sv_ctest4, sym_prepare_setting() 809 np->sv_ctest5); sym_prepare_setting() 812 if (burst_max > np->maxburst) sym_prepare_setting() 813 burst_max = np->maxburst; sym_prepare_setting() 827 np->features &= ~(FE_WRIE|FE_ERL|FE_ERMP); sym_prepare_setting() 835 if (np->features & FE_ERL) sym_prepare_setting() 836 np->rv_dmode |= ERL; /* Enable Read Line */ sym_prepare_setting() 837 if (np->features & FE_BOF) sym_prepare_setting() 838 np->rv_dmode |= BOF; /* Burst Opcode Fetch */ sym_prepare_setting() 839 if (np->features & FE_ERMP) sym_prepare_setting() 840 np->rv_dmode |= ERMP; /* Enable Read Multiple */ sym_prepare_setting() 842 if ((np->features & FE_PFEN) && !np->ram_ba) sym_prepare_setting() 844 if (np->features & FE_PFEN) sym_prepare_setting() 846 np->rv_dcntl |= PFEN; /* Prefetch Enable */ sym_prepare_setting() 847 if (np->features & FE_CLSE) sym_prepare_setting() 848 np->rv_dcntl |= CLSE; /* Cache Line Size Enable */ sym_prepare_setting() 849 if (np->features & FE_WRIE) sym_prepare_setting() 850 np->rv_ctest3 |= WRIE; /* Write and Invalidate */ sym_prepare_setting() 851 if (np->features & FE_DFS) sym_prepare_setting() 852 np->rv_ctest5 |= DFS; /* Dma Fifo Size */ sym_prepare_setting() 857 np->rv_ctest4 |= MPEE; /* Master parity checking */ sym_prepare_setting() 858 np->rv_scntl0 |= 0x0a; /* full arb., ena parity, par->ATN */ sym_prepare_setting() 863 np->myaddr = 255; sym_prepare_setting() 864 np->scsi_mode = 0; sym_prepare_setting() 865 sym_nvram_setup_host(shost, np, nvram); sym_prepare_setting() 870 if (np->myaddr == 255) { sym_prepare_setting() 871 np->myaddr = INB(np, nc_scid) & 0x07; sym_prepare_setting() 872 if (!np->myaddr) sym_prepare_setting() 873 np->myaddr = SYM_SETUP_HOST_ID; sym_prepare_setting() 879 sym_init_burst(np, burst_max); sym_prepare_setting() 881 sym_set_bus_mode(np, nvram); sym_prepare_setting() 893 !(np->features & FE_LEDC) && !(np->sv_gpcntl & 0x01)) sym_prepare_setting() 894 np->features |= FE_LED0; sym_prepare_setting() 901 np->rv_dcntl |= IRQM; sym_prepare_setting() 904 np->rv_dcntl |= (np->sv_dcntl & IRQM); sym_prepare_setting() 915 struct sym_tcb *tp = &np->target[i]; sym_prepare_setting() 919 tp->usr_width = np->maxwide; sym_prepare_setting() 931 printf("%s: %s, ID %d, Fast-%d, %s, %s\n", sym_name(np), sym_prepare_setting() 932 sym_nvram_type(nvram), np->myaddr, sym_prepare_setting() 933 (np->features & FE_ULTRA3) ? 80 : sym_prepare_setting() 934 (np->features & FE_ULTRA2) ? 40 : sym_prepare_setting() 935 (np->features & FE_ULTRA) ? 20 : 10, sym_prepare_setting() 936 sym_scsi_bus_mode(np->scsi_mode), sym_prepare_setting() 937 (np->rv_scntl0 & 0xa) ? "parity checking" : "NO parity"); sym_prepare_setting() 943 sym_name(np), sym_prepare_setting() 944 np->rv_dcntl & IRQM ? "totem pole" : "open drain", sym_prepare_setting() 945 np->ram_ba ? ", using on-chip SRAM" : ""); sym_prepare_setting() 946 printf("%s: using %s firmware.\n", sym_name(np), np->fw_name); sym_prepare_setting() 947 if (np->features & FE_NOPM) sym_prepare_setting() 949 sym_name(np)); sym_prepare_setting() 957 sym_name(np), np->sv_scntl3, np->sv_dmode, np->sv_dcntl, sym_prepare_setting() 958 np->sv_ctest3, np->sv_ctest4, np->sv_ctest5); sym_prepare_setting() 962 sym_name(np), np->rv_scntl3, np->rv_dmode, np->rv_dcntl, sym_prepare_setting() 963 np->rv_ctest3, np->rv_ctest4, np->rv_ctest5); sym_prepare_setting() 975 static int sym_regtest(struct sym_hcb *np) argument 984 OUTL(np, nc_dstat, data); 985 data = INL(np, nc_dstat); 998 static inline int sym_regtest(struct sym_hcb *np) sym_regtest() argument 1004 static int sym_snooptest(struct sym_hcb *np) sym_snooptest() argument 1009 err = sym_regtest(np); sym_snooptest() 1017 OUTB(np, nc_ctest4, (np->rv_ctest4 & MPEE)); sym_snooptest() 1021 pc = SCRIPTZ_BA(np, snooptest); sym_snooptest() 1027 np->scratch = cpu_to_scr(host_wr); sym_snooptest() 1028 OUTL(np, nc_temp, sym_wr); sym_snooptest() 1032 OUTL(np, nc_dsa, np->hcb_ba); sym_snooptest() 1033 OUTL_DSP(np, pc); sym_snooptest() 1038 if (INB(np, nc_istat) & (INTF|SIP|DIP)) sym_snooptest() 1047 dstat = INB(np, nc_dstat); sym_snooptest() 1049 if ((dstat & MDPE) && (np->rv_ctest4 & MPEE)) { sym_snooptest() 1052 sym_name(np)); sym_snooptest() 1053 np->rv_ctest4 &= ~MPEE; sym_snooptest() 1064 pc = INL(np, nc_dsp); sym_snooptest() 1068 host_rd = scr_to_cpu(np->scratch); sym_snooptest() 1069 sym_rd = INL(np, nc_scratcha); sym_snooptest() 1070 sym_bk = INL(np, nc_temp); sym_snooptest() 1074 if (pc != SCRIPTZ_BA(np, snoopend)+8) { sym_snooptest() 1077 (u_long) SCRIPTZ_BA(np, snooptest), (u_long) pc, sym_snooptest() 1078 (u_long) SCRIPTZ_BA(np, snoopend) +8); sym_snooptest() 1132 struct sym_hcb *np = sym_get_hcb(shost); sym_log_hard_error() local 1140 dsp = INL(np, nc_dsp); sym_log_hard_error() 1142 if (dsp > np->scripta_ba && sym_log_hard_error() 1143 dsp <= np->scripta_ba + np->scripta_sz) { sym_log_hard_error() 1144 script_ofs = dsp - np->scripta_ba; sym_log_hard_error() 1145 script_size = np->scripta_sz; sym_log_hard_error() 1146 script_base = (u_char *) np->scripta0; sym_log_hard_error() 1149 else if (np->scriptb_ba < dsp && sym_log_hard_error() 1150 dsp <= np->scriptb_ba + np->scriptb_sz) { sym_log_hard_error() 1151 script_ofs = dsp - np->scriptb_ba; sym_log_hard_error() 1152 script_size = np->scriptb_sz; sym_log_hard_error() 1153 script_base = (u_char *) np->scriptb0; sym_log_hard_error() 1163 sym_name(np), (unsigned)INB(np, nc_sdid)&0x0f, dstat, sist, sym_log_hard_error() 1164 (unsigned)INB(np, nc_socl), (unsigned)INB(np, nc_sbcl), sym_log_hard_error() 1165 (unsigned)INB(np, nc_sbdl), (unsigned)INB(np, nc_sxfer), sym_log_hard_error() 1166 (unsigned)INB(np, nc_scntl3), sym_log_hard_error() 1167 (np->features & FE_C10) ? (unsigned)INB(np, nc_scntl4) : 0, sym_log_hard_error() 1168 script_name, script_ofs, (unsigned)INL(np, nc_dbc)); sym_log_hard_error() 1172 printf ("%s: script cmd = %08x\n", sym_name(np), sym_log_hard_error() 1176 printf("%s: regdump:", sym_name(np)); sym_log_hard_error() 1178 printf(" %02x", (unsigned)INB_OFF(np, i)); sym_log_hard_error() 1190 struct sym_hcb *np = sym_get_hcb(shost); sym_dump_registers() local 1194 sist = INW(np, nc_sist); sym_dump_registers() 1195 dstat = INB(np, nc_dstat); sym_dump_registers() 1315 int sym_lookup_dmap(struct sym_hcb *np, u32 h, int s) sym_lookup_dmap() argument 1319 if (!use_dac(np)) sym_lookup_dmap() 1324 if (h == np->dmap_bah[i]) sym_lookup_dmap() 1328 if (!np->dmap_bah[s]) sym_lookup_dmap() 1332 if (!np->dmap_bah[s]) sym_lookup_dmap() 1339 np->dmap_bah[s] = h; sym_lookup_dmap() 1340 np->dmap_dirty = 1; sym_lookup_dmap() 1348 static void sym_update_dmap_regs(struct sym_hcb *np) sym_update_dmap_regs() argument 1352 if (!np->dmap_dirty) sym_update_dmap_regs() 1356 OUTL_OFF(np, o, np->dmap_bah[i]); sym_update_dmap_regs() 1359 np->dmap_dirty = 0; sym_update_dmap_regs() 1364 static void sym_check_goals(struct sym_hcb *np, struct scsi_target *starget, sym_check_goals() argument 1389 if ((np->scsi_mode != SMODE_LVD) || !(np->features & FE_U3EN)) sym_check_goals() 1395 if (goal->offset > np->maxoffs_dt) sym_check_goals() 1396 goal->offset = np->maxoffs_dt; sym_check_goals() 1397 if (goal->period < np->minsync_dt) sym_check_goals() 1398 goal->period = np->minsync_dt; sym_check_goals() 1399 if (goal->period > np->maxsync_dt) sym_check_goals() 1400 goal->period = np->maxsync_dt; sym_check_goals() 1403 if (goal->offset > np->maxoffs) sym_check_goals() 1404 goal->offset = np->maxoffs; sym_check_goals() 1405 if (goal->period < np->minsync) sym_check_goals() 1406 goal->period = np->minsync; sym_check_goals() 1407 if (goal->period > np->maxsync) sym_check_goals() 1408 goal->period = np->maxsync; sym_check_goals() 1419 static int sym_prepare_nego(struct sym_hcb *np, struct sym_ccb *cp, u_char *msgptr) sym_prepare_nego() argument 1421 struct sym_tcb *tp = &np->target[cp->target]; sym_prepare_nego() 1427 sym_check_goals(np, starget, goal); sym_prepare_nego() 1467 sym_print_nego_msg(np, cp->target, sym_prepare_nego() 1480 void sym_put_start_queue(struct sym_hcb *np, struct sym_ccb *cp) sym_put_start_queue() argument 1493 if (np->last_cp && np->iarb_count < np->iarb_max) { sym_put_start_queue() 1494 np->last_cp->host_flags |= HF_HINT_IARB; sym_put_start_queue() 1495 ++np->iarb_count; sym_put_start_queue() 1498 np->iarb_count = 0; sym_put_start_queue() 1499 np->last_cp = cp; sym_put_start_queue() 1507 if (np->dmap_dirty) sym_put_start_queue() 1515 qidx = np->squeueput + 2; sym_put_start_queue() 1518 np->squeue [qidx] = cpu_to_scr(np->idletask_ba); sym_put_start_queue() 1520 np->squeue [np->squeueput] = cpu_to_scr(cp->ccb_ba); sym_put_start_queue() 1522 np->squeueput = qidx; sym_put_start_queue() 1526 np->squeueput); sym_put_start_queue() 1533 OUTB(np, nc_istat, SIGP|np->istat_sem); sym_put_start_queue() 1540 void sym_start_next_ccbs(struct sym_hcb *np, struct sym_lcb *lp, int maxn) sym_start_next_ccbs() argument 1568 cpu_to_scr(SCRIPTA_BA(np, resel_tag)); sym_start_next_ccbs() 1577 cpu_to_scr(SCRIPTA_BA(np, resel_no_tag)); sym_start_next_ccbs() 1582 sym_put_start_queue(np, cp); sym_start_next_ccbs() 1594 static int sym_wakeup_done (struct sym_hcb *np) sym_wakeup_done() argument 1601 i = np->dqueueget; sym_wakeup_done() 1605 dsa = scr_to_cpu(np->dqueue[i]); sym_wakeup_done() 1608 np->dqueue[i] = 0; sym_wakeup_done() 1612 cp = sym_ccb_from_dsa(np, dsa); sym_wakeup_done() 1615 sym_complete_ok (np, cp); sym_wakeup_done() 1620 sym_name(np), (u_int) dsa); sym_wakeup_done() 1622 np->dqueueget = i; sym_wakeup_done() 1641 static void sym_flush_comp_queue(struct sym_hcb *np, int cam_status) sym_flush_comp_queue() argument 1646 while ((qp = sym_remque_head(&np->comp_ccbq)) != NULL) { sym_flush_comp_queue() 1649 sym_insque_tail(&cp->link_ccbq, &np->busy_ccbq); sym_flush_comp_queue() 1658 struct sym_tcb *tp = &np->target[cp->target]; sym_flush_comp_queue() 1675 sym_free_ccb(np, cp); sym_flush_comp_queue() 1676 sym_xpt_done(np, cmd); sym_flush_comp_queue() 1684 static void sym_flush_busy_queue (struct sym_hcb *np, int cam_status) sym_flush_busy_queue() argument 1690 sym_que_splice(&np->busy_ccbq, &np->comp_ccbq); sym_flush_busy_queue() 1691 sym_que_init(&np->busy_ccbq); sym_flush_busy_queue() 1692 sym_flush_comp_queue(np, cam_status); sym_flush_busy_queue() 1707 struct sym_hcb *np = sym_data->ncb; sym_start_up() local 1715 sym_soft_reset(np); sym_start_up() 1717 OUTB(np, nc_stest3, TE|CSF); sym_start_up() 1718 OUTONB(np, nc_ctest3, CLF); sym_start_up() 1724 phys = np->squeue_ba; sym_start_up() 1726 np->squeue[i] = cpu_to_scr(np->idletask_ba); sym_start_up() 1727 np->squeue[i+1] = cpu_to_scr(phys + (i+2)*4); sym_start_up() 1729 np->squeue[MAX_QUEUE*2-1] = cpu_to_scr(phys); sym_start_up() 1734 np->squeueput = 0; sym_start_up() 1739 phys = np->dqueue_ba; sym_start_up() 1741 np->dqueue[i] = 0; sym_start_up() 1742 np->dqueue[i+1] = cpu_to_scr(phys + (i+2)*4); sym_start_up() 1744 np->dqueue[MAX_QUEUE*2-1] = cpu_to_scr(phys); sym_start_up() 1749 np->dqueueget = 0; sym_start_up() 1756 np->fw_patch(shost); sym_start_up() 1761 sym_flush_busy_queue(np, DID_RESET); sym_start_up() 1766 OUTB(np, nc_istat, 0x00); /* Remove Reset, abort */ sym_start_up() 1767 INB(np, nc_mbox1); sym_start_up() 1770 OUTB(np, nc_scntl0, np->rv_scntl0 | 0xc0); sym_start_up() 1772 OUTB(np, nc_scntl1, 0x00); /* odd parity, and remove CRST!! */ sym_start_up() 1774 sym_selectclock(np, np->rv_scntl3); /* Select SCSI clock */ sym_start_up() 1776 OUTB(np, nc_scid , RRE|np->myaddr); /* Adapter SCSI address */ sym_start_up() 1777 OUTW(np, nc_respid, 1ul<<np->myaddr); /* Id to respond to */ sym_start_up() 1778 OUTB(np, nc_istat , SIGP ); /* Signal Process */ sym_start_up() 1779 OUTB(np, nc_dmode , np->rv_dmode); /* Burst length, dma mode */ sym_start_up() 1780 OUTB(np, nc_ctest5, np->rv_ctest5); /* Large fifo + large burst */ sym_start_up() 1782 OUTB(np, nc_dcntl , NOCOM|np->rv_dcntl); /* Protect SFBR */ sym_start_up() 1783 OUTB(np, nc_ctest3, np->rv_ctest3); /* Write and invalidate */ sym_start_up() 1784 OUTB(np, nc_ctest4, np->rv_ctest4); /* Master parity checking */ sym_start_up() 1787 if (np->features & FE_C10) sym_start_up() 1788 OUTB(np, nc_stest2, np->rv_stest2); sym_start_up() 1790 OUTB(np, nc_stest2, EXT|np->rv_stest2); sym_start_up() 1792 OUTB(np, nc_stest3, TE); /* TolerANT enable */ sym_start_up() 1793 OUTB(np, nc_stime0, 0x0c); /* HTH disabled STO 0.25 sec */ sym_start_up() 1799 OUTB(np, nc_aipcntl1, DISAIP); sym_start_up() 1810 OUTB(np, nc_stest1, INB(np, nc_stest1) | 0x30); sym_start_up() 1818 OUTB(np, nc_ctest0, (1<<5)); sym_start_up() 1820 np->rv_ccntl0 |= DPR; sym_start_up() 1827 if (np->features & (FE_DAC|FE_NOPM)) { sym_start_up() 1828 OUTB(np, nc_ccntl0, np->rv_ccntl0); sym_start_up() 1829 OUTB(np, nc_ccntl1, np->rv_ccntl1); sym_start_up() 1837 if (use_dac(np)) { sym_start_up() 1838 np->dmap_bah[0] = 0; /* ??? */ sym_start_up() 1839 OUTL(np, nc_scrx[0], np->dmap_bah[0]); sym_start_up() 1840 OUTL(np, nc_drs, np->dmap_bah[0]); sym_start_up() 1848 if (np->features & FE_NOPM) { sym_start_up() 1849 OUTL(np, nc_pmjad1, SCRIPTB_BA(np, pm_handle)); sym_start_up() 1850 OUTL(np, nc_pmjad2, SCRIPTB_BA(np, pm_handle)); sym_start_up() 1857 if (np->features & FE_LED0) sym_start_up() 1858 OUTB(np, nc_gpcntl, INB(np, nc_gpcntl) & ~0x01); sym_start_up() 1859 else if (np->features & FE_LEDC) sym_start_up() 1860 OUTB(np, nc_gpcntl, (INB(np, nc_gpcntl) & ~0x41) | 0x20); sym_start_up() 1865 OUTW(np, nc_sien , STO|HTH|MA|SGE|UDC|RST|PAR); sym_start_up() 1866 OUTB(np, nc_dien , MDPE|BF|SSI|SIR|IID); sym_start_up() 1873 if (np->features & (FE_ULTRA2|FE_ULTRA3)) { sym_start_up() 1874 OUTONW(np, nc_sien, SBMC); sym_start_up() 1876 INB(np, nc_mbox1); sym_start_up() 1878 INW(np, nc_sist); sym_start_up() 1880 np->scsi_mode = INB(np, nc_stest4) & SMODE; sym_start_up() 1890 struct sym_tcb *tp = &np->target[i]; sym_start_up() 1894 tp->head.wval = np->rv_scntl3; sym_start_up() 1914 phys = SCRIPTA_BA(np, init); sym_start_up() 1915 if (np->ram_ba) { sym_start_up() 1917 printf("%s: Downloading SCSI SCRIPTS.\n", sym_name(np)); sym_start_up() 1918 memcpy_toio(np->s.ramaddr, np->scripta0, np->scripta_sz); sym_start_up() 1919 if (np->features & FE_RAM8K) { sym_start_up() 1920 memcpy_toio(np->s.ramaddr + 4096, np->scriptb0, np->scriptb_sz); sym_start_up() 1921 phys = scr_to_cpu(np->scr_ram_seg); sym_start_up() 1922 OUTL(np, nc_mmws, phys); sym_start_up() 1923 OUTL(np, nc_mmrs, phys); sym_start_up() 1924 OUTL(np, nc_sfs, phys); sym_start_up() 1925 phys = SCRIPTB_BA(np, start64); sym_start_up() 1929 np->istat_sem = 0; sym_start_up() 1931 OUTL(np, nc_dsa, np->hcb_ba); sym_start_up() 1932 OUTL_DSP(np, phys); sym_start_up() 1938 sym_xpt_async_bus_reset(np); sym_start_up() 1944 static void sym_settrans(struct sym_hcb *np, int target, u_char opts, u_char ofs, sym_settrans() argument 1949 struct sym_tcb *tp = &np->target[target]; sym_settrans() 1951 assert(target == (INB(np, nc_sdid) & 0x0f)); sym_settrans() 1959 sval, wval, uval, np->rv_scntl3); sym_settrans() 1964 if (!(np->features & FE_C10)) sym_settrans() 1974 if (!(np->features & FE_C10)) sym_settrans() 1993 if (np->features & FE_C10) { sym_settrans() 1996 assert(np->features & FE_U3EN); sym_settrans() 2019 if (per < 50 && !(np->features & FE_C10)) sym_settrans() 2020 OUTOFFB(np, nc_stest2, EXT); sym_settrans() 2025 OUTB(np, nc_sxfer, tp->head.sval); sym_settrans() 2026 OUTB(np, nc_scntl3, tp->head.wval); sym_settrans() 2028 if (np->features & FE_C10) { sym_settrans() 2029 OUTB(np, nc_scntl4, tp->head.uval); sym_settrans() 2035 FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { sym_settrans() 2042 if (np->features & FE_C10) { sym_settrans() 2075 static void sym_setwide(struct sym_hcb *np, int target, u_char wide) sym_setwide() argument 2077 struct sym_tcb *tp = &np->target[target]; sym_setwide() 2080 sym_settrans(np, target, 0, 0, 0, wide, 0, 0); sym_setwide() 2104 sym_setsync(struct sym_hcb *np, int target, sym_setsync() argument 2107 struct sym_tcb *tp = &np->target[target]; sym_setsync() 2111 sym_settrans(np, target, 0, ofs, per, wide, div, fak); sym_setsync() 2137 sym_setpprot(struct sym_hcb *np, int target, u_char opts, u_char ofs, sym_setpprot() argument 2140 struct sym_tcb *tp = &np->target[target]; sym_setpprot() 2143 sym_settrans(np, target, opts, ofs, per, wide, div, fak); sym_setpprot() 2186 static void sym_recover_scsi_int (struct sym_hcb *np, u_char hsts) sym_recover_scsi_int() argument 2188 u32 dsp = INL(np, nc_dsp); sym_recover_scsi_int() 2189 u32 dsa = INL(np, nc_dsa); sym_recover_scsi_int() 2190 struct sym_ccb *cp = sym_ccb_from_dsa(np, dsa); sym_recover_scsi_int() 2197 if ((!(dsp > SCRIPTA_BA(np, getjob_begin) && sym_recover_scsi_int() 2198 dsp < SCRIPTA_BA(np, getjob_end) + 1)) && sym_recover_scsi_int() 2199 (!(dsp > SCRIPTA_BA(np, ungetjob) && sym_recover_scsi_int() 2200 dsp < SCRIPTA_BA(np, reselect) + 1)) && sym_recover_scsi_int() 2201 (!(dsp > SCRIPTB_BA(np, sel_for_abort) && sym_recover_scsi_int() 2202 dsp < SCRIPTB_BA(np, sel_for_abort_1) + 1)) && sym_recover_scsi_int() 2203 (!(dsp > SCRIPTA_BA(np, done) && sym_recover_scsi_int() 2204 dsp < SCRIPTA_BA(np, done_end) + 1))) { sym_recover_scsi_int() 2205 OUTB(np, nc_ctest3, np->rv_ctest3 | CLF); /* clear dma fifo */ sym_recover_scsi_int() 2206 OUTB(np, nc_stest3, TE|CSF); /* clear scsi fifo */ sym_recover_scsi_int() 2215 OUTL_DSP(np, SCRIPTA_BA(np, complete_error)); sym_recover_scsi_int() 2221 OUTL(np, nc_dsa, 0xffffff); sym_recover_scsi_int() 2222 OUTL_DSP(np, SCRIPTA_BA(np, start)); sym_recover_scsi_int() 2231 sym_start_reset(np); sym_recover_scsi_int() 2237 static void sym_int_sto (struct sym_hcb *np) sym_int_sto() argument 2239 u32 dsp = INL(np, nc_dsp); sym_int_sto() 2243 if (dsp == SCRIPTA_BA(np, wf_sel_done) + 8) sym_int_sto() 2244 sym_recover_scsi_int(np, HS_SEL_TIMEOUT); sym_int_sto() 2246 sym_start_reset(np); sym_int_sto() 2252 static void sym_int_udc (struct sym_hcb *np) sym_int_udc() argument 2254 printf ("%s: unexpected disconnect\n", sym_name(np)); sym_int_udc() 2255 sym_recover_scsi_int(np, HS_UNEXPECTED); sym_int_udc() 2270 struct sym_hcb *np = sym_get_hcb(shost); sym_int_sbmc() local 2271 u_char scsi_mode = INB(np, nc_stest4) & SMODE; sym_int_sbmc() 2276 printf("%s: SCSI BUS mode change from %s to %s.\n", sym_name(np), sym_int_sbmc() 2277 sym_scsi_bus_mode(np->scsi_mode), sym_scsi_bus_mode(scsi_mode)); sym_int_sbmc() 2310 static void sym_int_par (struct sym_hcb *np, u_short sist) sym_int_par() argument 2312 u_char hsts = INB(np, HS_PRT); sym_int_par() 2313 u32 dsp = INL(np, nc_dsp); sym_int_par() 2314 u32 dbc = INL(np, nc_dbc); sym_int_par() 2315 u32 dsa = INL(np, nc_dsa); sym_int_par() 2316 u_char sbcl = INB(np, nc_sbcl); sym_int_par() 2319 struct sym_ccb *cp = sym_ccb_from_dsa(np, dsa); sym_int_par() 2323 sym_name(np), hsts, dbc, sbcl); sym_int_par() 2328 if (!(INB(np, nc_scntl1) & ISCON)) { sym_int_par() 2329 sym_recover_scsi_int(np, HS_UNEXPECTED); sym_int_par() 2350 OUTONB(np, HF_PRT, HF_EXT_ERR); sym_int_par() 2356 np->msgout[0] = (phase == 7) ? M_PARITY : M_ID_ERROR; sym_int_par() 2367 if (dsp == SCRIPTB_BA(np, pm_handle)) sym_int_par() 2368 OUTL_DSP(np, dsp); sym_int_par() 2371 sym_int_ma (np); sym_int_par() 2374 sym_set_script_dp (np, cp, dsp); sym_int_par() 2375 OUTL_DSP(np, SCRIPTA_BA(np, dispatch)); sym_int_par() 2382 OUTL_DSP(np, SCRIPTA_BA(np, clrack)); sym_int_par() 2385 OUTL_DSP(np, SCRIPTA_BA(np, dispatch)); sym_int_par() 2389 sym_start_reset(np); sym_int_par() 2399 static void sym_int_ma (struct sym_hcb *np) sym_int_ma() argument 2416 dsp = INL(np, nc_dsp); sym_int_ma() 2417 dbc = INL(np, nc_dbc); sym_int_ma() 2418 dsa = INL(np, nc_dsa); sym_int_ma() 2427 cp = sym_ccb_from_dsa(np, dsa); sym_int_ma() 2438 if (np->features & FE_DFBC) sym_int_ma() 2439 delta = INW(np, nc_dfbc); sym_int_ma() 2446 dfifo = INL(np, nc_dfifo); sym_int_ma() 2466 ss0 = INB(np, nc_sstat0); sym_int_ma() 2468 if (!(np->features & FE_C10)) sym_int_ma() 2471 ss2 = INB(np, nc_sstat2); sym_int_ma() 2473 if (!(np->features & FE_C10)) sym_int_ma() 2480 OUTB(np, nc_ctest3, np->rv_ctest3 | CLF); /* dma fifo */ sym_int_ma() 2481 OUTB(np, nc_stest3, TE|CSF); /* scsi fifo */ sym_int_ma() 2488 printf ("P%x%x RL=%d D=%d ", cmd&7, INB(np, nc_sbcl)&7, sym_int_ma() 2497 if (dsp > np->scripta_ba && sym_int_ma() 2498 dsp <= np->scripta_ba + np->scripta_sz) { sym_int_ma() 2499 vdsp = (u32 *)((char*)np->scripta0 + (dsp-np->scripta_ba-8)); sym_int_ma() 2502 else if (dsp > np->scriptb_ba && sym_int_ma() 2503 dsp <= np->scriptb_ba + np->scriptb_sz) { sym_int_ma() 2504 vdsp = (u32 *)((char*)np->scriptb0 + (dsp-np->scriptb_ba-8)); sym_int_ma() 2518 sym_name (np)); sym_int_ma() 2524 sym_name (np)); sym_int_ma() 2569 cmd&7, INB(np, nc_sbcl)&7, (unsigned)olen, sym_int_ma() 2582 hflags0 = INB(np, HF_PRT); sym_int_ma() 2597 newcmd = SCRIPTA_BA(np, pm0_data); sym_int_ma() 2601 newcmd = SCRIPTA_BA(np, pm1_data); sym_int_ma() 2606 OUTB(np, HF_PRT, hflags); sym_int_ma() 2621 nxtdsp = SCRIPTA_BA(np, dispatch); sym_int_ma() 2623 (INB(np, nc_scntl2) & WSR)) { sym_int_ma() 2649 nxtdsp = SCRIPTB_BA(np, wsr_ma_helper); sym_int_ma() 2663 sym_set_script_dp (np, cp, newcmd); sym_int_ma() 2664 OUTL_DSP(np, nxtdsp); sym_int_ma() 2700 nxtdsp = SCRIPTA_BA(np, dispatch); sym_int_ma() 2704 nxtdsp = SCRIPTA_BA(np, dispatch); sym_int_ma() 2714 if (dsp == SCRIPTA_BA(np, send_ident)) { sym_int_ma() 2717 np->msgout[0] = IDENTIFY(0, cp->lun); sym_int_ma() 2718 nxtdsp = SCRIPTB_BA(np, ident_break_atn); sym_int_ma() 2721 nxtdsp = SCRIPTB_BA(np, ident_break); sym_int_ma() 2723 else if (dsp == SCRIPTB_BA(np, send_wdtr) || sym_int_ma() 2724 dsp == SCRIPTB_BA(np, send_sdtr) || sym_int_ma() 2725 dsp == SCRIPTB_BA(np, send_ppr)) { sym_int_ma() 2726 nxtdsp = SCRIPTB_BA(np, nego_bad_phase); sym_int_ma() 2727 if (dsp == SCRIPTB_BA(np, send_ppr)) { sym_int_ma() 2735 nxtdsp = SCRIPTA_BA(np, clrack); sym_int_ma() 2741 OUTL_DSP(np, nxtdsp); sym_int_ma() 2746 sym_start_reset(np); sym_int_ma() 2815 struct sym_hcb *np = sym_data->ncb; sym_interrupt() local 2832 istat = INB(np, nc_istat); sym_interrupt() 2834 OUTB(np, nc_istat, (istat & SIGP) | INTF | np->istat_sem); sym_interrupt() 2835 istat |= INB(np, nc_istat); /* DUMMY READ */ sym_interrupt() 2837 sym_wakeup_done(np); sym_interrupt() 2845 OUTB(np, nc_istat, CABRT); sym_interrupt() 2863 sist |= INW(np, nc_sist); sym_interrupt() 2865 dstat |= INB(np, nc_dstat); sym_interrupt() 2866 istatc = INB(np, nc_istat); sym_interrupt() 2879 (int)INB(np, nc_scr0), sym_interrupt() 2881 (unsigned)INL(np, nc_dsp), sym_interrupt() 2882 (unsigned)INL(np, nc_dbc)); sym_interrupt() 2906 if (sist & PAR) sym_int_par (np, sist); sym_interrupt() 2907 else if (sist & MA) sym_int_ma (np); sym_interrupt() 2908 else if (dstat & SIR) sym_int_sir(np); sym_interrupt() 2926 printf("%s: SCSI BUS reset detected.\n", sym_name(np)); sym_interrupt() 2931 OUTB(np, nc_ctest3, np->rv_ctest3 | CLF); /* clear dma fifo */ sym_interrupt() 2932 OUTB(np, nc_stest3, TE|CSF); /* clear scsi fifo */ sym_interrupt() 2937 else if (sist & STO) sym_int_sto (np); sym_interrupt() 2938 else if (sist & UDC) sym_int_udc (np); sym_interrupt() 2954 sym_start_reset(np); sym_interrupt() 2965 sym_name(np), istat, dstat, sist); sym_interrupt() 2978 sym_dequeue_from_squeue(struct sym_hcb *np, int i, int target, int lun, int task) sym_dequeue_from_squeue() argument 2993 while (i != np->squeueput) { sym_dequeue_from_squeue() 2994 cp = sym_ccb_from_dsa(np, scr_to_cpu(np->squeue[i])); sym_dequeue_from_squeue() 3009 sym_insque_tail(&cp->link_ccbq, &np->comp_ccbq); sym_dequeue_from_squeue() 3013 np->squeue[j] = np->squeue[i]; sym_dequeue_from_squeue() 3019 np->squeue[j] = np->squeue[i]; sym_dequeue_from_squeue() 3020 np->squeueput = j; /* Update our current start queue pointer */ sym_dequeue_from_squeue() 3043 static void sym_sir_bad_scsi_status(struct sym_hcb *np, int num, struct sym_ccb *cp) sym_sir_bad_scsi_status() argument 3054 i = (INL(np, nc_scratcha) - np->squeue_ba) / 4; sym_sir_bad_scsi_status() 3061 if (np->last_cp) sym_sir_bad_scsi_status() 3062 np->last_cp = 0; sym_sir_bad_scsi_status() 3076 sym_complete_error (np, cp); sym_sir_bad_scsi_status() 3084 sym_complete_error (np, cp); sym_sir_bad_scsi_status() 3092 sym_dequeue_from_squeue(np, i, cp->target, cp->lun, -1); sym_sir_bad_scsi_status() 3093 OUTL_DSP(np, SCRIPTA_BA(np, start)); sym_sir_bad_scsi_status() 3101 cp->sv_resid = sym_compute_residual(np, cp); sym_sir_bad_scsi_status() 3122 msglen += sym_prepare_nego(np, cp, &cp->scsi_smsg2[msglen]); sym_sir_bad_scsi_status() 3155 startp = SCRIPTB_BA(np, sdata_in); sym_sir_bad_scsi_status() 3169 cp->phys.head.go.start = cpu_to_scr(SCRIPTA_BA(np, select)); sym_sir_bad_scsi_status() 3174 sym_put_start_queue(np, cp); sym_sir_bad_scsi_status() 3179 sym_flush_comp_queue(np, 0); sym_sir_bad_scsi_status() 3198 int sym_clear_tasks(struct sym_hcb *np, int cam_status, int target, int lun, int task) sym_clear_tasks() argument 3208 sym_que_splice(&np->busy_ccbq, &qtmp); sym_clear_tasks() 3209 sym_que_init(&np->busy_ccbq); sym_clear_tasks() 3225 sym_insque_tail(&cp->link_ccbq, &np->busy_ccbq); sym_clear_tasks() 3228 sym_insque_tail(&cp->link_ccbq, &np->comp_ccbq); sym_clear_tasks() 3281 static void sym_sir_task_recovery(struct sym_hcb *np, int num) sym_sir_task_recovery() argument 3301 tp = &np->target[i]; sym_sir_task_recovery() 3324 FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { sym_sir_task_recovery() 3340 tp = &np->target[target]; sym_sir_task_recovery() 3341 np->abrt_sel.sel_id = target; sym_sir_task_recovery() 3342 np->abrt_sel.sel_scntl3 = tp->head.wval; sym_sir_task_recovery() 3343 np->abrt_sel.sel_sxfer = tp->head.sval; sym_sir_task_recovery() 3344 OUTL(np, nc_dsa, np->hcb_ba); sym_sir_task_recovery() 3345 OUTL_DSP(np, SCRIPTB_BA(np, sel_for_abort)); sym_sir_task_recovery() 3356 FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { sym_sir_task_recovery() 3369 if (cp == np->last_cp) { sym_sir_task_recovery() 3383 np->istat_sem = 0; sym_sir_task_recovery() 3384 OUTB(np, nc_istat, SIGP); sym_sir_task_recovery() 3392 i = (INL(np, nc_scratcha) - np->squeue_ba) / 4; sym_sir_task_recovery() 3393 i = sym_dequeue_from_squeue(np, i, cp->target, cp->lun, -1); sym_sir_task_recovery() 3402 sym_insque_tail(&cp->link_ccbq, &np->comp_ccbq); sym_sir_task_recovery() 3415 sym_flush_comp_queue(np, 0); sym_sir_task_recovery() 3422 target = INB(np, nc_sdid) & 0xf; sym_sir_task_recovery() 3423 tp = &np->target[target]; sym_sir_task_recovery() 3425 np->abrt_tbl.addr = cpu_to_scr(vtobus(np->abrt_msg)); sym_sir_task_recovery() 3433 np->abrt_msg[0] = M_RESET; sym_sir_task_recovery() 3434 np->abrt_tbl.size = 1; sym_sir_task_recovery() 3460 np->abrt_msg[0] = IDENTIFY(0, lun); sym_sir_task_recovery() 3461 np->abrt_msg[1] = M_ABORT; sym_sir_task_recovery() 3462 np->abrt_tbl.size = 2; sym_sir_task_recovery() 3472 FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { sym_sir_task_recovery() 3492 np->abrt_msg[0] = M_ABORT; sym_sir_task_recovery() 3493 np->abrt_tbl.size = 1; sym_sir_task_recovery() 3501 np->abrt_msg[0] = IDENTIFY(0, cp->lun); sym_sir_task_recovery() 3510 np->abrt_msg[1] = M_ABORT; sym_sir_task_recovery() 3511 np->abrt_tbl.size = 2; sym_sir_task_recovery() 3513 np->abrt_msg[1] = cp->scsi_smsg[1]; sym_sir_task_recovery() 3514 np->abrt_msg[2] = cp->scsi_smsg[2]; sym_sir_task_recovery() 3515 np->abrt_msg[3] = M_ABORT_TAG; sym_sir_task_recovery() 3516 np->abrt_tbl.size = 4; sym_sir_task_recovery() 3533 target = INB(np, nc_sdid) & 0xf; sym_sir_task_recovery() 3534 tp = &np->target[target]; sym_sir_task_recovery() 3540 if (np->abrt_msg[0] == M_ABORT) sym_sir_task_recovery() 3553 if (np->abrt_msg[0] == M_RESET) { sym_sir_task_recovery() 3555 tp->head.wval = np->rv_scntl3; sym_sir_task_recovery() 3574 lun = np->abrt_msg[0] & 0x3f; sym_sir_task_recovery() 3575 if (np->abrt_msg[1] == M_ABORT_TAG) sym_sir_task_recovery() 3576 task = np->abrt_msg[2]; sym_sir_task_recovery() 3583 i = (INL(np, nc_scratcha) - np->squeue_ba) / 4; sym_sir_task_recovery() 3584 sym_dequeue_from_squeue(np, i, target, lun, -1); sym_sir_task_recovery() 3585 sym_clear_tasks(np, DID_ABORT, target, lun, task); sym_sir_task_recovery() 3586 sym_flush_comp_queue(np, 0); sym_sir_task_recovery() 3591 if (np->abrt_msg[0] == M_RESET) sym_sir_task_recovery() 3602 sym_printl_hex(np->abrt_msg, np->abrt_tbl.size); sym_sir_task_recovery() 3603 np->abrt_tbl.size = cpu_to_scr(np->abrt_tbl.size); sym_sir_task_recovery() 3639 static int sym_evaluate_dp(struct sym_hcb *np, struct sym_ccb *cp, u32 scr, int *ofs) sym_evaluate_dp() argument 3652 if (dp_scr == SCRIPTA_BA(np, pm0_data)) sym_evaluate_dp() 3654 else if (dp_scr == SCRIPTA_BA(np, pm1_data)) sym_evaluate_dp() 3757 static void sym_modify_dp(struct sym_hcb *np, struct sym_tcb *tp, struct sym_ccb *cp, int ofs) sym_modify_dp() argument 3760 u32 dp_scr = sym_get_script_dp (np, cp); sym_modify_dp() 3777 dp_sg = sym_evaluate_dp(np, cp, dp_scr, &dp_ofs); sym_modify_dp() 3800 hflags = INB(np, HF_PRT); sym_modify_dp() 3807 dp_scr = SCRIPTA_BA(np, pm0_data); sym_modify_dp() 3811 dp_scr = SCRIPTA_BA(np, pm1_data); sym_modify_dp() 3816 OUTB(np, HF_PRT, hflags); sym_modify_dp() 3832 sym_set_script_dp (np, cp, dp_scr); sym_modify_dp() 3833 OUTL_DSP(np, SCRIPTA_BA(np, clrack)); sym_modify_dp() 3837 OUTL_DSP(np, SCRIPTB_BA(np, msg_bad)); sym_modify_dp() 3856 int sym_compute_residual(struct sym_hcb *np, struct sym_ccb *cp) sym_compute_residual() argument 3889 sym_evaluate_dp(np, cp, scr_to_cpu(cp->phys.head.lastp), sym_compute_residual() 3958 sym_sync_nego_check(struct sym_hcb *np, int req, struct sym_ccb *cp) sym_sync_nego_check() argument 3964 sym_print_nego_msg(np, target, "sync msgin", np->msgin); sym_sync_nego_check() 3971 per = np->msgin[3]; sym_sync_nego_check() 3972 ofs = np->msgin[4]; sym_sync_nego_check() 3978 if (ofs > np->maxoffs) sym_sync_nego_check() 3979 {chg = 1; ofs = np->maxoffs;} sym_sync_nego_check() 3983 if (per < np->minsync) sym_sync_nego_check() 3984 {chg = 1; per = np->minsync;} sym_sync_nego_check() 3991 if (ofs && sym_getsync(np, 0, per, &div, &fak) < 0) sym_sync_nego_check() 4010 sym_setsync (np, target, ofs, per, div, fak); sym_sync_nego_check() 4021 spi_populate_sync_msg(np->msgout, per, ofs); sym_sync_nego_check() 4024 sym_print_nego_msg(np, target, "sync msgout", np->msgout); sym_sync_nego_check() 4027 np->msgin [0] = M_NOOP; sym_sync_nego_check() 4032 sym_setsync (np, target, 0, 0, 0, 0); sym_sync_nego_check() 4036 static void sym_sync_nego(struct sym_hcb *np, struct sym_tcb *tp, struct sym_ccb *cp) sym_sync_nego() argument 4044 if (INB(np, HS_PRT) == HS_NEGOTIATE) { sym_sync_nego() 4045 OUTB(np, HS_PRT, HS_BUSY); sym_sync_nego() 4054 result = sym_sync_nego_check(np, req, cp); sym_sync_nego() 4059 OUTL_DSP(np, SCRIPTB_BA(np, sdtr_resp)); sym_sync_nego() 4062 OUTL_DSP(np, SCRIPTA_BA(np, clrack)); sym_sync_nego() 4066 OUTL_DSP(np, SCRIPTB_BA(np, msg_bad)); sym_sync_nego() 4073 sym_ppr_nego_check(struct sym_hcb *np, int req, int target) sym_ppr_nego_check() argument 4075 struct sym_tcb *tp = &np->target[target]; sym_ppr_nego_check() 4079 unsigned char per = np->msgin[3]; sym_ppr_nego_check() 4080 unsigned char ofs = np->msgin[5]; sym_ppr_nego_check() 4081 unsigned char wide = np->msgin[6]; sym_ppr_nego_check() 4082 unsigned char opts = np->msgin[7] & PPR_OPT_MASK; sym_ppr_nego_check() 4085 sym_print_nego_msg(np, target, "ppr msgin", np->msgin); sym_ppr_nego_check() 4091 if (wide > np->maxwide) { sym_ppr_nego_check() 4093 wide = np->maxwide; sym_ppr_nego_check() 4095 if (!wide || !(np->features & FE_U3EN)) sym_ppr_nego_check() 4098 if (opts != (np->msgin[7] & PPR_OPT_MASK)) sym_ppr_nego_check() 4104 unsigned char maxoffs = dt ? np->maxoffs_dt : np->maxoffs; sym_ppr_nego_check() 4112 unsigned char minsync = dt ? np->minsync_dt : np->minsync; sym_ppr_nego_check() 4123 if (ofs && sym_getsync(np, dt, per, &div, &fak) < 0) sym_ppr_nego_check() 4136 sym_setpprot(np, target, opts, ofs, per, wide, div, fak); sym_ppr_nego_check() 4147 spi_populate_ppr_msg(np->msgout, per, ofs, wide, opts); sym_ppr_nego_check() 4150 sym_print_nego_msg(np, target, "ppr msgout", np->msgout); sym_ppr_nego_check() 4153 np->msgin [0] = M_NOOP; sym_ppr_nego_check() 4158 sym_setpprot (np, target, 0, 0, 0, 0, 0, 0); sym_ppr_nego_check() 4173 static void sym_ppr_nego(struct sym_hcb *np, struct sym_tcb *tp, struct sym_ccb *cp) sym_ppr_nego() argument 4181 if (INB(np, HS_PRT) == HS_NEGOTIATE) { sym_ppr_nego() 4182 OUTB(np, HS_PRT, HS_BUSY); sym_ppr_nego() 4191 result = sym_ppr_nego_check(np, req, cp->target); sym_ppr_nego() 4196 OUTL_DSP(np, SCRIPTB_BA(np, ppr_resp)); sym_ppr_nego() 4199 OUTL_DSP(np, SCRIPTA_BA(np, clrack)); sym_ppr_nego() 4203 OUTL_DSP(np, SCRIPTB_BA(np, msg_bad)); sym_ppr_nego() 4210 sym_wide_nego_check(struct sym_hcb *np, int req, struct sym_ccb *cp) sym_wide_nego_check() argument 4216 sym_print_nego_msg(np, target, "wide msgin", np->msgin); sym_wide_nego_check() 4223 wide = np->msgin[3]; sym_wide_nego_check() 4228 if (wide > np->maxwide) { sym_wide_nego_check() 4230 wide = np->maxwide; sym_wide_nego_check() 4248 sym_setwide (np, target, wide); sym_wide_nego_check() 4259 spi_populate_width_msg(np->msgout, wide); sym_wide_nego_check() 4261 np->msgin [0] = M_NOOP; sym_wide_nego_check() 4264 sym_print_nego_msg(np, target, "wide msgout", np->msgout); sym_wide_nego_check() 4273 static void sym_wide_nego(struct sym_hcb *np, struct sym_tcb *tp, struct sym_ccb *cp) sym_wide_nego() argument 4281 if (INB(np, HS_PRT) == HS_NEGOTIATE) { sym_wide_nego() 4282 OUTB(np, HS_PRT, HS_BUSY); sym_wide_nego() 4291 result = sym_wide_nego_check(np, req, cp); sym_wide_nego() 4296 OUTL_DSP(np, SCRIPTB_BA(np, wdtr_resp)); sym_wide_nego() 4304 spi_populate_sync_msg(np->msgout, tp->tgoal.period, sym_wide_nego() 4308 sym_print_nego_msg(np, cp->target, sym_wide_nego() 4309 "sync msgout", np->msgout); sym_wide_nego() 4313 OUTB(np, HS_PRT, HS_NEGOTIATE); sym_wide_nego() 4314 OUTL_DSP(np, SCRIPTB_BA(np, sdtr_resp)); sym_wide_nego() 4317 OUTL_DSP(np, SCRIPTA_BA(np, clrack)); sym_wide_nego() 4323 OUTL_DSP(np, SCRIPTB_BA(np, msg_bad)); sym_wide_nego() 4337 static void sym_nego_default(struct sym_hcb *np, struct sym_tcb *tp, struct sym_ccb *cp) sym_nego_default() argument 4342 sym_setpprot (np, cp->target, 0, 0, 0, 0, 0, 0); sym_nego_default() 4344 if (tp->tgoal.period < np->minsync) sym_nego_default() 4345 tp->tgoal.period = np->minsync; sym_nego_default() 4346 if (tp->tgoal.offset > np->maxoffs) sym_nego_default() 4347 tp->tgoal.offset = np->maxoffs; sym_nego_default() 4353 sym_setsync (np, cp->target, 0, 0, 0, 0); sym_nego_default() 4356 sym_setwide (np, cp->target, 0); sym_nego_default() 4359 np->msgin [0] = M_NOOP; sym_nego_default() 4360 np->msgout[0] = M_NOOP; sym_nego_default() 4368 static void sym_nego_rejected(struct sym_hcb *np, struct sym_tcb *tp, struct sym_ccb *cp) sym_nego_rejected() argument 4370 sym_nego_default(np, tp, cp); sym_nego_rejected() 4371 OUTB(np, HS_PRT, HS_BUSY); sym_nego_rejected() 4377 static void sym_int_sir(struct sym_hcb *np) sym_int_sir() argument 4379 u_char num = INB(np, nc_dsps); sym_int_sir() 4380 u32 dsa = INL(np, nc_dsa); sym_int_sir() 4381 struct sym_ccb *cp = sym_ccb_from_dsa(np, dsa); sym_int_sir() 4382 u_char target = INB(np, nc_sdid) & 0x0f; sym_int_sir() 4383 struct sym_tcb *tp = &np->target[target]; sym_int_sir() 4395 sym_update_dmap_regs(np); sym_int_sir() 4403 sym_complete_error(np, cp); sym_int_sir() 4412 sym_sir_task_recovery(np, num); sym_int_sir() 4442 np->msgout[0] = M_RESET; sym_int_sir() 4449 np->msgout[0] = M_ABORT; sym_int_sir() 4455 np->msgout[0] = M_ABORT_TAG; sym_int_sir() 4462 np->lastmsg = np->msgout[0]; sym_int_sir() 4463 np->msgout[0] = M_NOOP; sym_int_sir() 4465 "message %x sent on bad reselection\n", np->lastmsg); sym_int_sir() 4472 np->lastmsg = np->msgout[0]; sym_int_sir() 4473 np->msgout[0] = M_NOOP; sym_int_sir() 4475 if (np->lastmsg == M_PARITY || np->lastmsg == M_ID_ERROR) { sym_int_sir() 4479 OUTOFFB(np, HF_PRT, HF_EXT_ERR); sym_int_sir() 4491 sym_sir_bad_scsi_status(np, num, cp); sym_int_sir() 4498 sym_print_msg(cp, "M_REJECT to send for ", np->msgin); sym_int_sir() 4499 np->msgout[0] = M_REJECT; sym_int_sir() 4509 OUTONB(np, HF_PRT, HF_EXT_ERR); sym_int_sir() 4520 OUTONB(np, HF_PRT, HF_EXT_ERR); sym_int_sir() 4532 OUTONB(np, HF_PRT, HF_EXT_ERR); sym_int_sir() 4534 cp->extra_bytes += INL(np, nc_scratcha); sym_int_sir() 4542 OUTONB(np, HF_PRT, HF_EXT_ERR); sym_int_sir() 4552 switch (np->msgin [0]) { sym_int_sir() 4559 switch (np->msgin [2]) { sym_int_sir() 4563 np->msgin); sym_int_sir() 4564 tmp = (np->msgin[3]<<24) + (np->msgin[4]<<16) + sym_int_sir() 4565 (np->msgin[5]<<8) + (np->msgin[6]); sym_int_sir() 4566 sym_modify_dp(np, tp, cp, tmp); sym_int_sir() 4569 sym_sync_nego(np, tp, cp); sym_int_sir() 4572 sym_ppr_nego(np, tp, cp); sym_int_sir() 4575 sym_wide_nego(np, tp, cp); sym_int_sir() 4590 sym_print_msg(cp, "1 or 2 byte ", np->msgin); sym_int_sir() 4592 OUTL_DSP(np, SCRIPTA_BA(np, clrack)); sym_int_sir() 4594 sym_modify_dp(np, tp, cp, -1); sym_int_sir() 4597 if (INB(np, HS_PRT) == HS_NEGOTIATE) sym_int_sir() 4598 sym_nego_rejected(np, tp, cp); sym_int_sir() 4602 scr_to_cpu(np->lastmsg), np->msgout[0]); sym_int_sir() 4615 sym_print_msg(cp, "WEIRD message received", np->msgin); sym_int_sir() 4616 OUTL_DSP(np, SCRIPTB_BA(np, msg_weird)); sym_int_sir() 4624 OUTB(np, HS_PRT, HS_BUSY); sym_int_sir() 4630 sym_nego_default(np, tp, cp); sym_int_sir() 4638 OUTL_DSP(np, SCRIPTB_BA(np, msg_bad)); sym_int_sir() 4641 OUTL_DSP(np, SCRIPTA_BA(np, clrack)); sym_int_sir() 4650 struct sym_ccb *sym_get_ccb (struct sym_hcb *np, struct scsi_cmnd *cmd, u_char tag_order) sym_get_ccb() argument 4654 struct sym_tcb *tp = &np->target[tn]; sym_get_ccb() 4663 if (sym_que_empty(&np->free_ccbq)) sym_get_ccb() 4664 sym_alloc_ccb(np); sym_get_ccb() 4665 qp = sym_remque_head(&np->free_ccbq); sym_get_ccb() 4686 sym_alloc_lcb_tags(np, tn, ln); sym_get_ccb() 4704 cpu_to_scr(SCRIPTA_BA(np, resel_tag)); sym_get_ccb() 4738 cpu_to_scr(SCRIPTA_BA(np, resel_no_tag)); sym_get_ccb() 4748 sym_insque_tail(&cp->link_ccbq, &np->busy_ccbq); sym_get_ccb() 4770 sym_insque_head(&cp->link_ccbq, &np->free_ccbq); sym_get_ccb() 4777 void sym_free_ccb (struct sym_hcb *np, struct sym_ccb *cp) sym_free_ccb() argument 4779 struct sym_tcb *tp = &np->target[cp->target]; sym_free_ccb() 4808 lp->itlq_tbl[cp->tag] = cpu_to_scr(np->bad_itlq_ba); sym_free_ccb() 4815 lp->head.itl_task_sa = cpu_to_scr(np->bad_itl_ba); sym_free_ccb() 4823 cpu_to_scr(SCRIPTB_BA(np, resel_bad_lun)); sym_free_ccb() 4839 if (cp == np->last_cp) sym_free_ccb() 4840 np->last_cp = 0; sym_free_ccb() 4849 sym_insque_head(&cp->link_ccbq, &np->free_ccbq); sym_free_ccb() 4854 sym_insque_tail(&cp->link2_ccbq, &np->dummy_ccbq); sym_free_ccb() 4869 static struct sym_ccb *sym_alloc_ccb(struct sym_hcb *np) sym_alloc_ccb() argument 4878 if (np->actccbs >= SYM_CONF_MAX_START) sym_alloc_ccb() 4891 np->actccbs++; sym_alloc_ccb() 4902 cp->link_ccbh = np->ccbh[hcode]; sym_alloc_ccb() 4903 np->ccbh[hcode] = cp; sym_alloc_ccb() 4908 cp->phys.head.go.start = cpu_to_scr(SCRIPTA_BA(np, idle)); sym_alloc_ccb() 4909 cp->phys.head.go.restart = cpu_to_scr(SCRIPTB_BA(np, bad_i_t_l)); sym_alloc_ccb() 4914 cp->phys.smsg_ext.addr = cpu_to_scr(HCB_BA(np, msgin[2])); sym_alloc_ccb() 4919 sym_insque_head(&cp->link_ccbq, &np->free_ccbq); sym_alloc_ccb() 4925 sym_insque_head(&cp->link2_ccbq, &np->dummy_ccbq); sym_alloc_ccb() 4937 static struct sym_ccb *sym_ccb_from_dsa(struct sym_hcb *np, u32 dsa) sym_ccb_from_dsa() argument 4943 cp = np->ccbh[hcode]; sym_ccb_from_dsa() 4957 static void sym_init_tcb (struct sym_hcb *np, u_char tn) sym_init_tcb() argument 4973 struct sym_lcb *sym_alloc_lcb (struct sym_hcb *np, u_char tn, u_char ln) sym_alloc_lcb() argument 4975 struct sym_tcb *tp = &np->target[tn]; sym_alloc_lcb() 4981 sym_init_tcb (np, tn); sym_alloc_lcb() 4994 tp->luntbl[i] = cpu_to_scr(vtobus(&np->badlun_sa)); sym_alloc_lcb() 5028 lp->head.itl_task_sa = cpu_to_scr(np->bad_itl_ba); sym_alloc_lcb() 5033 lp->head.resel_sa = cpu_to_scr(SCRIPTB_BA(np, resel_bad_lun)); sym_alloc_lcb() 5057 static void sym_alloc_lcb_tags (struct sym_hcb *np, u_char tn, u_char ln) sym_alloc_lcb_tags() argument 5059 struct sym_tcb *tp = &np->target[tn]; sym_alloc_lcb_tags() 5081 lp->itlq_tbl[i] = cpu_to_scr(np->notask_ba); sym_alloc_lcb_tags() 5104 int sym_free_lcb(struct sym_hcb *np, u_char tn, u_char ln) sym_free_lcb() argument 5106 struct sym_tcb *tp = &np->target[tn]; sym_free_lcb() 5117 tp->head.luntbl_sa = cpu_to_scr(vtobus(np->badluntbl)); sym_free_lcb() 5119 tp->luntbl[ln] = cpu_to_scr(vtobus(&np->badlun_sa)); sym_free_lcb() 5124 tp->head.lun0_sa = cpu_to_scr(vtobus(&np->badlun_sa)); sym_free_lcb() 5140 int sym_queue_scsiio(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp) sym_queue_scsiio() argument 5157 tp = &np->target[cp->target]; sym_queue_scsiio() 5231 msglen += sym_prepare_nego(np, cp, msgptr + msglen); sym_queue_scsiio() 5237 cp->phys.head.go.start = cpu_to_scr(SCRIPTA_BA(np, select)); sym_queue_scsiio() 5238 cp->phys.head.go.restart = cpu_to_scr(SCRIPTA_BA(np, resel_dsa)); sym_queue_scsiio() 5275 return sym_setup_data_and_start(np, cmd, cp); sym_queue_scsiio() 5281 int sym_reset_scsi_target(struct sym_hcb *np, int target) sym_reset_scsi_target() argument 5285 if (target == np->myaddr || (u_int)target >= SYM_CONF_MAX_TARGET) sym_reset_scsi_target() 5288 tp = &np->target[target]; sym_reset_scsi_target() 5291 np->istat_sem = SEM; sym_reset_scsi_target() 5292 OUTB(np, nc_istat, SIGP|SEM); sym_reset_scsi_target() 5300 static int sym_abort_ccb(struct sym_hcb *np, struct sym_ccb *cp, int timed_out) sym_abort_ccb() argument 5313 sym_reset_scsi_bus(np, 1); sym_abort_ccb() 5325 np->istat_sem = SEM; sym_abort_ccb() 5326 OUTB(np, nc_istat, SIGP|SEM); sym_abort_ccb() 5330 int sym_abort_scsiio(struct sym_hcb *np, struct scsi_cmnd *cmd, int timed_out) sym_abort_scsiio() argument 5339 FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { sym_abort_scsiio() 5347 return sym_abort_ccb(np, cp, timed_out); sym_abort_scsiio() 5360 void sym_complete_error(struct sym_hcb *np, struct sym_ccb *cp) sym_complete_error() argument 5385 tp = &np->target[cp->target]; sym_complete_error() 5401 resid = sym_compute_residual(np, cp); sym_complete_error() 5416 i = (INL(np, nc_scratcha) - np->squeue_ba) / 4; sym_complete_error() 5417 i = sym_dequeue_from_squeue(np, i, cp->target, sdev->lun, -1); sym_complete_error() 5422 OUTL_DSP(np, SCRIPTA_BA(np, start)); sym_complete_error() 5457 sym_set_cam_result_error(np, cp, resid); sym_complete_error() 5466 sym_insque_head(&cp->link_ccbq, &np->comp_ccbq); sym_complete_error() 5472 sym_flush_comp_queue(np, 0); sym_complete_error() 5478 sym_start_next_ccbs(np, lp, 1); sym_complete_error() 5491 void sym_complete_ok (struct sym_hcb *np, struct sym_ccb *cp) sym_complete_ok() argument 5513 tp = &np->target[cp->target]; sym_complete_ok() 5522 resid = sym_compute_residual(np, cp); sym_complete_ok() 5562 sym_free_ccb (np, cp); sym_complete_ok() 5569 sym_start_next_ccbs(np, lp, 2); sym_complete_ok() 5574 sym_xpt_done(np, cmd); sym_complete_ok() 5582 struct sym_hcb *np = sym_get_hcb(shost); sym_hcb_attach() local 5588 np->scripta_sz = fw->a_size; sym_hcb_attach() 5589 np->scriptb_sz = fw->b_size; sym_hcb_attach() 5590 np->scriptz_sz = fw->z_size; sym_hcb_attach() 5591 np->fw_setup = fw->setup; sym_hcb_attach() 5592 np->fw_patch = fw->patch; sym_hcb_attach() 5593 np->fw_name = fw->name; sym_hcb_attach() 5599 sym_save_initial_setting (np); sym_hcb_attach() 5606 sym_chip_reset(np); sym_hcb_attach() 5612 sym_prepare_setting(shost, np, nvram); sym_hcb_attach() 5619 i = sym_getpciclock(np); sym_hcb_attach() 5620 if (i > 37000 && !(np->features & FE_66MHZ)) sym_hcb_attach() 5622 sym_name(np), i); sym_hcb_attach() 5627 np->squeue = sym_calloc_dma(sizeof(u32)*(MAX_QUEUE*2),"SQUEUE"); sym_hcb_attach() 5628 if (!np->squeue) sym_hcb_attach() 5630 np->squeue_ba = vtobus(np->squeue); sym_hcb_attach() 5635 np->dqueue = sym_calloc_dma(sizeof(u32)*(MAX_QUEUE*2),"DQUEUE"); sym_hcb_attach() 5636 if (!np->dqueue) sym_hcb_attach() 5638 np->dqueue_ba = vtobus(np->dqueue); sym_hcb_attach() 5643 np->targtbl = sym_calloc_dma(256, "TARGTBL"); sym_hcb_attach() 5644 if (!np->targtbl) sym_hcb_attach() 5646 np->targtbl_ba = vtobus(np->targtbl); sym_hcb_attach() 5651 np->scripta0 = sym_calloc_dma(np->scripta_sz, "SCRIPTA0"); sym_hcb_attach() 5652 np->scriptb0 = sym_calloc_dma(np->scriptb_sz, "SCRIPTB0"); sym_hcb_attach() 5653 np->scriptz0 = sym_calloc_dma(np->scriptz_sz, "SCRIPTZ0"); sym_hcb_attach() 5654 if (!np->scripta0 || !np->scriptb0 || !np->scriptz0) sym_hcb_attach() 5660 np->ccbh = kcalloc(CCB_HASH_SIZE, sizeof(struct sym_ccb **), GFP_KERNEL); sym_hcb_attach() 5661 if (!np->ccbh) sym_hcb_attach() 5667 sym_que_init(&np->free_ccbq); sym_hcb_attach() 5668 sym_que_init(&np->busy_ccbq); sym_hcb_attach() 5669 sym_que_init(&np->comp_ccbq); sym_hcb_attach() 5676 sym_que_init(&np->dummy_ccbq); sym_hcb_attach() 5681 if (!sym_alloc_ccb(np)) sym_hcb_attach() 5688 np->scripta_ba = vtobus(np->scripta0); sym_hcb_attach() 5689 np->scriptb_ba = vtobus(np->scriptb0); sym_hcb_attach() 5690 np->scriptz_ba = vtobus(np->scriptz0); sym_hcb_attach() 5692 if (np->ram_ba) { sym_hcb_attach() 5693 np->scripta_ba = np->ram_ba; sym_hcb_attach() 5694 if (np->features & FE_RAM8K) { sym_hcb_attach() 5695 np->scriptb_ba = np->scripta_ba + 4096; sym_hcb_attach() 5697 np->scr_ram_seg = cpu_to_scr(np->scripta_ba >> 32); sym_hcb_attach() 5705 memcpy(np->scripta0, fw->a_base, np->scripta_sz); sym_hcb_attach() 5706 memcpy(np->scriptb0, fw->b_base, np->scriptb_sz); sym_hcb_attach() 5707 memcpy(np->scriptz0, fw->z_base, np->scriptz_sz); sym_hcb_attach() 5713 np->fw_setup(np, fw); sym_hcb_attach() 5719 sym_fw_bind_script(np, (u32 *) np->scripta0, np->scripta_sz); sym_hcb_attach() 5720 sym_fw_bind_script(np, (u32 *) np->scriptb0, np->scriptb_sz); sym_hcb_attach() 5721 sym_fw_bind_script(np, (u32 *) np->scriptz0, np->scriptz_sz); sym_hcb_attach() 5731 np->iarb_max = SYM_SETUP_IARB_MAX; sym_hcb_attach() 5733 np->iarb_max = 4; sym_hcb_attach() 5740 np->idletask.start = cpu_to_scr(SCRIPTA_BA(np, idle)); sym_hcb_attach() 5741 np->idletask.restart = cpu_to_scr(SCRIPTB_BA(np, bad_i_t_l)); sym_hcb_attach() 5742 np->idletask_ba = vtobus(&np->idletask); sym_hcb_attach() 5744 np->notask.start = cpu_to_scr(SCRIPTA_BA(np, idle)); sym_hcb_attach() 5745 np->notask.restart = cpu_to_scr(SCRIPTB_BA(np, bad_i_t_l)); sym_hcb_attach() 5746 np->notask_ba = vtobus(&np->notask); sym_hcb_attach() 5748 np->bad_itl.start = cpu_to_scr(SCRIPTA_BA(np, idle)); sym_hcb_attach() 5749 np->bad_itl.restart = cpu_to_scr(SCRIPTB_BA(np, bad_i_t_l)); sym_hcb_attach() 5750 np->bad_itl_ba = vtobus(&np->bad_itl); sym_hcb_attach() 5752 np->bad_itlq.start = cpu_to_scr(SCRIPTA_BA(np, idle)); sym_hcb_attach() 5753 np->bad_itlq.restart = cpu_to_scr(SCRIPTB_BA(np,bad_i_t_l_q)); sym_hcb_attach() 5754 np->bad_itlq_ba = vtobus(&np->bad_itlq); sym_hcb_attach() 5762 np->badluntbl = sym_calloc_dma(256, "BADLUNTBL"); sym_hcb_attach() 5763 if (!np->badluntbl) sym_hcb_attach() 5766 np->badlun_sa = cpu_to_scr(SCRIPTB_BA(np, resel_bad_lun)); sym_hcb_attach() 5768 np->badluntbl[i] = cpu_to_scr(vtobus(&np->badlun_sa)); sym_hcb_attach() 5776 np->targtbl[i] = cpu_to_scr(vtobus(&np->target[i])); sym_hcb_attach() 5777 np->target[i].head.luntbl_sa = sym_hcb_attach() 5778 cpu_to_scr(vtobus(np->badluntbl)); sym_hcb_attach() 5779 np->target[i].head.lun0_sa = sym_hcb_attach() 5780 cpu_to_scr(vtobus(&np->badlun_sa)); sym_hcb_attach() 5786 if (sym_snooptest (np)) { sym_hcb_attach() 5787 printf("%s: CACHE INCORRECTLY CONFIGURED.\n", sym_name(np)); sym_hcb_attach() 5803 void sym_hcb_free(struct sym_hcb *np) sym_hcb_free() argument 5810 if (np->scriptz0) sym_hcb_free() 5811 sym_mfree_dma(np->scriptz0, np->scriptz_sz, "SCRIPTZ0"); sym_hcb_free() 5812 if (np->scriptb0) sym_hcb_free() 5813 sym_mfree_dma(np->scriptb0, np->scriptb_sz, "SCRIPTB0"); sym_hcb_free() 5814 if (np->scripta0) sym_hcb_free() 5815 sym_mfree_dma(np->scripta0, np->scripta_sz, "SCRIPTA0"); sym_hcb_free() 5816 if (np->squeue) sym_hcb_free() 5817 sym_mfree_dma(np->squeue, sizeof(u32)*(MAX_QUEUE*2), "SQUEUE"); sym_hcb_free() 5818 if (np->dqueue) sym_hcb_free() 5819 sym_mfree_dma(np->dqueue, sizeof(u32)*(MAX_QUEUE*2), "DQUEUE"); sym_hcb_free() 5821 if (np->actccbs) { sym_hcb_free() 5822 while ((qp = sym_remque_head(&np->free_ccbq)) != NULL) { sym_hcb_free() 5827 kfree(np->ccbh); sym_hcb_free() 5829 if (np->badluntbl) sym_hcb_free() 5830 sym_mfree_dma(np->badluntbl, 256,"BADLUNTBL"); sym_hcb_free() 5833 tp = &np->target[target]; sym_hcb_free() 5840 if (np->targtbl) sym_hcb_free() 5841 sym_mfree_dma(np->targtbl, 256, "TARGTBL"); sym_hcb_free()
|
H A D | sym_nvram.c | 50 void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram) sym_nvram_setup_host() argument 59 np->rv_scntl0 &= ~0x0a; sym_nvram_setup_host() 60 np->myaddr = nvram->data.Symbios.host_id & 0x0f; sym_nvram_setup_host() 62 np->verbose += 1; sym_nvram_setup_host() 66 np->usrflags |= SYM_AVOID_BUS_RESET; sym_nvram_setup_host() 69 np->myaddr = nvram->data.Tekram.host_id & 0x0f; sym_nvram_setup_host() 74 np->myaddr = nvram->data.parisc.host_id; sym_nvram_setup_host() 76 np->minsync = nvram->data.parisc.factor; sym_nvram_setup_host() 78 np->maxwide = nvram->data.parisc.width; sym_nvram_setup_host() 80 case 0: np->scsi_mode = SMODE_SE; break; sym_nvram_setup_host() 81 case 1: np->scsi_mode = SMODE_HVD; break; sym_nvram_setup_host() 82 case 2: np->scsi_mode = SMODE_LVD; break; sym_nvram_setup_host() 156 static void sym_display_Symbios_nvram(struct sym_device *np, Symbios_nvram *nvram) sym_display_Symbios_nvram() argument 162 sym_name(np), nvram->host_id & 0x0f, sym_display_Symbios_nvram() 174 sym_name(np), i, sym_display_Symbios_nvram() 188 static void sym_display_Tekram_nvram(struct sym_device *np, Tekram_nvram *nvram) sym_display_Tekram_nvram() argument 206 sym_name(np), nvram->host_id & 0x0f, sym_display_Tekram_nvram() 224 sym_name(np), i, sym_display_Tekram_nvram() 235 static void sym_display_Symbios_nvram(struct sym_device *np, Symbios_nvram *nvram) { (void)np; (void)nvram; } sym_display_Tekram_nvram() argument 236 static void sym_display_Tekram_nvram(struct sym_device *np, Tekram_nvram *nvram) { (void)np; (void)nvram; } sym_display_Tekram_nvram() argument 256 static void S24C16_set_bit(struct sym_device *np, u_char write_bit, u_char *gpreg, S24C16_set_bit() argument 275 OUTB(np, nc_gpreg, *gpreg); S24C16_set_bit() 276 INB(np, nc_mbox1); S24C16_set_bit() 283 static void S24C16_start(struct sym_device *np, u_char *gpreg) S24C16_start() argument 285 S24C16_set_bit(np, 1, gpreg, SET_BIT); S24C16_start() 286 S24C16_set_bit(np, 0, gpreg, SET_CLK); S24C16_start() 287 S24C16_set_bit(np, 0, gpreg, CLR_BIT); S24C16_start() 288 S24C16_set_bit(np, 0, gpreg, CLR_CLK); S24C16_start() 294 static void S24C16_stop(struct sym_device *np, u_char *gpreg) S24C16_stop() argument 296 S24C16_set_bit(np, 0, gpreg, SET_CLK); S24C16_stop() 297 S24C16_set_bit(np, 1, gpreg, SET_BIT); S24C16_stop() 304 static void S24C16_do_bit(struct sym_device *np, u_char *read_bit, u_char write_bit, S24C16_do_bit() argument 307 S24C16_set_bit(np, write_bit, gpreg, SET_BIT); S24C16_do_bit() 308 S24C16_set_bit(np, 0, gpreg, SET_CLK); S24C16_do_bit() 310 *read_bit = INB(np, nc_gpreg); S24C16_do_bit() 311 S24C16_set_bit(np, 0, gpreg, CLR_CLK); S24C16_do_bit() 312 S24C16_set_bit(np, 0, gpreg, CLR_BIT); S24C16_do_bit() 319 static void S24C16_write_ack(struct sym_device *np, u_char write_bit, u_char *gpreg, S24C16_write_ack() argument 322 OUTB(np, nc_gpcntl, *gpcntl & 0xfe); S24C16_write_ack() 323 S24C16_do_bit(np, NULL, write_bit, gpreg); S24C16_write_ack() 324 OUTB(np, nc_gpcntl, *gpcntl); S24C16_write_ack() 331 static void S24C16_read_ack(struct sym_device *np, u_char *read_bit, u_char *gpreg, S24C16_read_ack() argument 334 OUTB(np, nc_gpcntl, *gpcntl | 0x01); S24C16_read_ack() 335 S24C16_do_bit(np, read_bit, 1, gpreg); S24C16_read_ack() 336 OUTB(np, nc_gpcntl, *gpcntl); S24C16_read_ack() 343 static void S24C16_write_byte(struct sym_device *np, u_char *ack_data, u_char write_data, S24C16_write_byte() argument 349 S24C16_do_bit(np, NULL, (write_data >> (7 - x)) & 0x01, gpreg); S24C16_write_byte() 351 S24C16_read_ack(np, ack_data, gpreg, gpcntl); S24C16_write_byte() 358 static void S24C16_read_byte(struct sym_device *np, u_char *read_data, u_char ack_data, S24C16_read_byte() argument 366 S24C16_do_bit(np, &read_bit, 1, gpreg); S24C16_read_byte() 370 S24C16_write_ack(np, ack_data, gpreg, gpcntl); S24C16_read_byte() 377 static int sym_write_S24C16_nvram(struct sym_device *np, int offset, sym_write_S24C16_nvram() argument 386 old_gpreg = INB(np, nc_gpreg); sym_write_S24C16_nvram() 387 old_gpcntl = INB(np, nc_gpcntl); sym_write_S24C16_nvram() 391 OUTB(np, nc_gpreg, old_gpreg); sym_write_S24C16_nvram() 392 OUTB(np, nc_gpcntl, gpcntl); sym_write_S24C16_nvram() 396 S24C16_set_bit(np, 0, &gpreg, CLR_CLK); sym_write_S24C16_nvram() 397 S24C16_set_bit(np, 0, &gpreg, CLR_BIT); sym_write_S24C16_nvram() 400 S24C16_stop(np, &gpreg); sym_write_S24C16_nvram() 405 S24C16_start(np, &gpreg); sym_write_S24C16_nvram() 406 S24C16_write_byte(np, &ack_data, sym_write_S24C16_nvram() 411 S24C16_write_byte(np, &ack_data, (offset+x) & 0xff, sym_write_S24C16_nvram() 415 S24C16_write_byte(np, &ack_data, data[x+y], sym_write_S24C16_nvram() 417 S24C16_stop(np, &gpreg); sym_write_S24C16_nvram() 421 OUTB(np, nc_gpcntl, old_gpcntl); sym_write_S24C16_nvram() 422 OUTB(np, nc_gpreg, old_gpreg); sym_write_S24C16_nvram() 431 static int sym_read_S24C16_nvram(struct sym_device *np, int offset, u_char *data, int len) sym_read_S24C16_nvram() argument 440 old_gpreg = INB(np, nc_gpreg); sym_read_S24C16_nvram() 441 old_gpcntl = INB(np, nc_gpcntl); sym_read_S24C16_nvram() 445 OUTB(np, nc_gpreg, old_gpreg); sym_read_S24C16_nvram() 446 OUTB(np, nc_gpcntl, gpcntl); sym_read_S24C16_nvram() 450 S24C16_set_bit(np, 0, &gpreg, CLR_CLK); sym_read_S24C16_nvram() 451 S24C16_set_bit(np, 0, &gpreg, CLR_BIT); sym_read_S24C16_nvram() 454 S24C16_stop(np, &gpreg); sym_read_S24C16_nvram() 457 S24C16_start(np, &gpreg); sym_read_S24C16_nvram() 460 S24C16_write_byte(np, &ack_data, sym_read_S24C16_nvram() 466 S24C16_write_byte(np, &ack_data, sym_read_S24C16_nvram() 472 S24C16_start(np, &gpreg); sym_read_S24C16_nvram() 475 S24C16_write_byte(np, &ack_data, sym_read_S24C16_nvram() 482 OUTB(np, nc_gpcntl, gpcntl); sym_read_S24C16_nvram() 486 S24C16_read_byte(np, &data[x], (x == (len-1)), &gpreg, &gpcntl); sym_read_S24C16_nvram() 490 OUTB(np, nc_gpcntl, gpcntl); sym_read_S24C16_nvram() 491 S24C16_stop(np, &gpreg); sym_read_S24C16_nvram() 495 OUTB(np, nc_gpcntl, old_gpcntl); sym_read_S24C16_nvram() 496 OUTB(np, nc_gpreg, old_gpreg); sym_read_S24C16_nvram() 510 static int sym_read_Symbios_nvram(struct sym_device *np, Symbios_nvram *nvram) sym_read_Symbios_nvram() argument 519 if (sym_read_S24C16_nvram (np, SYMBIOS_NVRAM_ADDRESS, data, len)) sym_read_Symbios_nvram() 551 static void T93C46_Clk(struct sym_device *np, u_char *gpreg) T93C46_Clk() argument 553 OUTB(np, nc_gpreg, *gpreg | 0x04); T93C46_Clk() 554 INB(np, nc_mbox1); T93C46_Clk() 556 OUTB(np, nc_gpreg, *gpreg); T93C46_Clk() 562 static void T93C46_Read_Bit(struct sym_device *np, u_char *read_bit, u_char *gpreg) T93C46_Read_Bit() argument 565 T93C46_Clk(np, gpreg); T93C46_Read_Bit() 566 *read_bit = INB(np, nc_gpreg); T93C46_Read_Bit() 572 static void T93C46_Write_Bit(struct sym_device *np, u_char write_bit, u_char *gpreg) T93C46_Write_Bit() argument 581 OUTB(np, nc_gpreg, *gpreg); T93C46_Write_Bit() 582 INB(np, nc_mbox1); T93C46_Write_Bit() 585 T93C46_Clk(np, gpreg); T93C46_Write_Bit() 591 static void T93C46_Stop(struct sym_device *np, u_char *gpreg) T93C46_Stop() argument 594 OUTB(np, nc_gpreg, *gpreg); T93C46_Stop() 595 INB(np, nc_mbox1); T93C46_Stop() 598 T93C46_Clk(np, gpreg); T93C46_Stop() 604 static void T93C46_Send_Command(struct sym_device *np, u_short write_data, T93C46_Send_Command() argument 611 T93C46_Write_Bit(np, (u_char) (write_data >> (8 - x)), gpreg); T93C46_Send_Command() 613 *read_bit = INB(np, nc_gpreg); T93C46_Send_Command() 619 static void T93C46_Read_Word(struct sym_device *np, T93C46_Read_Word() argument 627 T93C46_Read_Bit(np, &read_bit, gpreg); T93C46_Read_Word() 639 static int T93C46_Read_Data(struct sym_device *np, unsigned short *data, T93C46_Read_Data() argument 647 T93C46_Send_Command(np, 0x180 | x, &read_bit, gpreg); T93C46_Read_Data() 650 T93C46_Read_Word(np, &data[x], gpreg); T93C46_Read_Data() 651 T93C46_Stop(np, gpreg); T93C46_Read_Data() 660 static int sym_read_T93C46_nvram(struct sym_device *np, Tekram_nvram *nvram) sym_read_T93C46_nvram() argument 667 old_gpreg = INB(np, nc_gpreg); sym_read_T93C46_nvram() 668 old_gpcntl = INB(np, nc_gpcntl); sym_read_T93C46_nvram() 673 OUTB(np, nc_gpreg, gpreg); sym_read_T93C46_nvram() 675 OUTB(np, nc_gpcntl, gpcntl); sym_read_T93C46_nvram() 678 retv = T93C46_Read_Data(np, (u_short *) nvram, sym_read_T93C46_nvram() 682 OUTB(np, nc_gpcntl, old_gpcntl); sym_read_T93C46_nvram() 683 OUTB(np, nc_gpreg, old_gpreg); sym_read_T93C46_nvram() 692 static int sym_read_Tekram_nvram (struct sym_device *np, Tekram_nvram *nvram) sym_read_Tekram_nvram() argument 699 switch (np->pdev->device) { sym_read_Tekram_nvram() 703 x = sym_read_S24C16_nvram(np, TEKRAM_24C16_NVRAM_ADDRESS, sym_read_Tekram_nvram() 707 x = sym_read_S24C16_nvram(np, TEKRAM_24C16_NVRAM_ADDRESS, sym_read_Tekram_nvram() 712 x = sym_read_T93C46_nvram(np, nvram); sym_read_Tekram_nvram() 733 static int sym_read_parisc_pdc(struct sym_device *np, struct pdc_initiator *pdc) sym_read_parisc_pdc() argument 736 get_pci_node_path(np->pdev, &hwpath); sym_read_parisc_pdc() 743 static inline int sym_read_parisc_pdc(struct sym_device *np, sym_read_parisc_pdc() argument 753 int sym_read_nvram(struct sym_device *np, struct sym_nvram *nvp) sym_read_nvram() argument 755 if (!sym_read_Symbios_nvram(np, &nvp->data.Symbios)) { sym_read_nvram() 757 sym_display_Symbios_nvram(np, &nvp->data.Symbios); sym_read_nvram() 758 } else if (!sym_read_Tekram_nvram(np, &nvp->data.Tekram)) { sym_read_nvram() 760 sym_display_Tekram_nvram(np, &nvp->data.Tekram); sym_read_nvram() 762 nvp->type = sym_read_parisc_pdc(np, &nvp->data.parisc); sym_read_nvram()
|
H A D | sym_fw.c | 109 struct sym_hcb *np = sym_get_hcb(shost); sym_fw1_patch() local 113 scripta0 = (struct sym_fw1a_scr *) np->scripta0; sym_fw1_patch() 114 scriptb0 = (struct sym_fw1b_scr *) np->scriptb0; sym_fw1_patch() 119 if (!(np->features & FE_LED0)) { sym_fw1_patch() 139 scriptb0->startpos[0] = cpu_to_scr(np->squeue_ba); sym_fw1_patch() 140 scriptb0->done_pos[0] = cpu_to_scr(np->dqueue_ba); sym_fw1_patch() 141 scriptb0->targtbl[0] = cpu_to_scr(np->targtbl_ba); sym_fw1_patch() 153 struct sym_hcb *np = sym_data->ncb; sym_fw2_patch() local 157 scripta0 = (struct sym_fw2a_scr *) np->scripta0; sym_fw2_patch() 158 scriptb0 = (struct sym_fw2b_scr *) np->scriptb0; sym_fw2_patch() 163 if (!(np->features & FE_LED0)) { sym_fw2_patch() 174 if (!use_dac(np)) { sym_fw2_patch() 196 scriptb0->startpos[0] = cpu_to_scr(np->squeue_ba); sym_fw2_patch() 197 scriptb0->done_pos[0] = cpu_to_scr(np->dqueue_ba); sym_fw2_patch() 198 scriptb0->targtbl[0] = cpu_to_scr(np->targtbl_ba); sym_fw2_patch() 203 if (!(np->features & FE_C10)) { sym_fw2_patch() 214 np->pciclk_khz < 60000)) { sym_fw2_patch() 229 cpu_to_scr(np->scripta_ba + sym_fw2_patch() 232 cpu_to_scr(np->scripta_ba + sym_fw2_patch() 258 sym_fw_setup_bus_addresses(struct sym_hcb *np, struct sym_fw *fw) sym_fw_setup_bus_addresses() argument 269 pa = (u32 *) &np->fwa_bas; sym_fw_setup_bus_addresses() 270 for (i = 0 ; i < sizeof(np->fwa_bas)/sizeof(u32) ; i++) sym_fw_setup_bus_addresses() 271 pa[i] = np->scripta_ba + po[i]; sym_fw_setup_bus_addresses() 277 pa = (u32 *) &np->fwb_bas; sym_fw_setup_bus_addresses() 278 for (i = 0 ; i < sizeof(np->fwb_bas)/sizeof(u32) ; i++) sym_fw_setup_bus_addresses() 279 pa[i] = np->scriptb_ba + po[i]; sym_fw_setup_bus_addresses() 285 pa = (u32 *) &np->fwz_bas; sym_fw_setup_bus_addresses() 286 for (i = 0 ; i < sizeof(np->fwz_bas)/sizeof(u32) ; i++) sym_fw_setup_bus_addresses() 287 pa[i] = np->scriptz_ba + po[i]; sym_fw_setup_bus_addresses() 295 sym_fw1_setup(struct sym_hcb *np, struct sym_fw *fw) sym_fw1_setup() argument 300 scripta0 = (struct sym_fw1a_scr *) np->scripta0; sym_fw1_setup() 301 scriptb0 = (struct sym_fw1b_scr *) np->scriptb0; sym_fw1_setup() 311 sym_fw_setup_bus_addresses(np, fw); sym_fw1_setup() 319 sym_fw2_setup(struct sym_hcb *np, struct sym_fw *fw) sym_fw2_setup() argument 324 scripta0 = (struct sym_fw2a_scr *) np->scripta0; sym_fw2_setup() 325 scriptb0 = (struct sym_fw2b_scr *) np->scriptb0; sym_fw2_setup() 335 sym_fw_setup_bus_addresses(np, fw); sym_fw2_setup() 365 void sym_fw_bind_script(struct sym_hcb *np, u32 *start, int len) sym_fw_bind_script() argument 386 sym_name(np), (int) (cur-start)); sym_fw_bind_script() 429 sym_name(np), (int) (cur-start)); sym_fw_bind_script() 436 !(np->features & FE_PFEN)) { sym_fw_bind_script() 444 if (!(np->features & FE_WIDE)) sym_fw_bind_script() 452 if (!(np->features & FE_WIDE)) sym_fw_bind_script() 462 if (!(np->features & FE_WIDE)) sym_fw_bind_script() 471 if (!(np->features & FE_WIDE)) sym_fw_bind_script() 522 new = (old & ~RELOC_MASK) + np->mmio_ba; sym_fw_bind_script() 525 new = (old & ~RELOC_MASK) + np->scripta_ba; sym_fw_bind_script() 528 new = (old & ~RELOC_MASK) + np->scriptb_ba; sym_fw_bind_script() 531 new = (old & ~RELOC_MASK) + np->hcb_ba; sym_fw_bind_script()
|
H A D | sym_glue.c | 140 void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *cmd) sym_xpt_done() argument 155 void sym_xpt_async_bus_reset(struct sym_hcb *np) sym_xpt_async_bus_reset() argument 157 printf_notice("%s: SCSI BUS has been reset.\n", sym_name(np)); sym_xpt_async_bus_reset() 158 np->s.settle_time = jiffies + sym_driver_setup.settle_delay * HZ; sym_xpt_async_bus_reset() 159 np->s.settle_time_valid = 1; sym_xpt_async_bus_reset() 162 sym_name(np), sym_driver_setup.settle_delay); sym_xpt_async_bus_reset() 187 void sym_set_cam_result_error(struct sym_hcb *np, struct sym_ccb *cp, int resid) sym_set_cam_result_error() argument 223 sym_clear_tasks(np, DID_ABORT, sym_set_cam_result_error() 234 sym_reset_scsi_target(np, cmd->device->id); sym_set_cam_result_error() 258 static int sym_scatter(struct sym_hcb *np, struct sym_ccb *cp, struct scsi_cmnd *cmd) sym_scatter() argument 268 struct sym_tcb *tp = &np->target[cp->target]; sym_scatter() 287 sym_build_sge(np, &data[segment], baddr, len); scsi_for_each_sg() 300 static int sym_queue_command(struct sym_hcb *np, struct scsi_cmnd *cmd) sym_queue_command() argument 311 tp = &np->target[sdev->id]; sym_queue_command() 322 cp = sym_get_ccb(np, cmd, order); sym_queue_command() 325 sym_queue_scsiio(np, cmd, cp); sym_queue_command() 332 static inline int sym_setup_cdb(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp) sym_setup_cdb() argument 345 int sym_setup_data_and_start(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp) sym_setup_data_and_start() argument 353 if (sym_setup_cdb(np, cmd, cp)) sym_setup_data_and_start() 361 cp->segments = sym_scatter(np, cp, cmd); sym_setup_data_and_start() 386 goalp = SCRIPTA_BA(np, data_out2) + 8; sym_setup_data_and_start() 391 goalp = SCRIPTA_BA(np, data_in2) + 8; sym_setup_data_and_start() 396 lastp = goalp = SCRIPTB_BA(np, no_data); sym_setup_data_and_start() 427 sym_put_start_queue(np, cp); sym_setup_data_and_start() 431 sym_free_ccb(np, cp); sym_setup_data_and_start() 432 sym_xpt_done(np, cmd); sym_setup_data_and_start() 443 static void sym_timer(struct sym_hcb *np) sym_timer() argument 450 np->s.timer.expires = thistime + SYM_CONF_TIMER_INTERVAL; sym_timer() 451 add_timer(&np->s.timer); sym_timer() 457 if (np->s.settle_time_valid) { sym_timer() 458 if (time_before_eq(np->s.settle_time, thistime)) { sym_timer() 461 sym_name(np)); sym_timer() 462 np->s.settle_time_valid = 0; sym_timer() 470 if (np->s.lasttime + 4*HZ < thistime) { sym_timer() 471 np->s.lasttime = thistime; sym_timer() 483 sym_wakeup_done(np); sym_timer() 511 struct sym_hcb *np = SYM_SOFTC_PTR(cmd); sym53c8xx_queue_command_lck() local 522 if (np->s.settle_time_valid && cmd->request->timeout) { sym53c8xx_queue_command_lck() 525 if (time_after(np->s.settle_time, tlimit)) { sym53c8xx_queue_command_lck() 526 np->s.settle_time = tlimit; sym53c8xx_queue_command_lck() 530 if (np->s.settle_time_valid) sym53c8xx_queue_command_lck() 533 sts = sym_queue_command(np, cmd); sym53c8xx_queue_command_lck() 570 struct sym_hcb *np = (struct sym_hcb *)npref; sym53c8xx_timer() local 573 spin_lock_irqsave(np->s.host->host_lock, flags); sym53c8xx_timer() 574 sym_timer(np); sym53c8xx_timer() 575 spin_unlock_irqrestore(np->s.host->host_lock, flags); sym53c8xx_timer() 597 struct sym_hcb *np = sym_data->ncb; sym_eh_handler() local 637 FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { sym_eh_handler() 649 sts = sym_abort_scsiio(np, cmd, 1); sym_eh_handler() 652 sts = sym_reset_scsi_target(np, cmd->device->id); sym_eh_handler() 655 sym_reset_scsi_bus(np, 1); sym_eh_handler() 659 sym_reset_scsi_bus(np, 0); sym_eh_handler() 739 struct sym_hcb *np = sym_get_hcb(sdev->host); sym53c8xx_slave_alloc() local 740 struct sym_tcb *tp = &np->target[sdev->id]; sym53c8xx_slave_alloc() 748 spin_lock_irqsave(np->s.host->host_lock, flags); sym53c8xx_slave_alloc() 776 lp = sym_alloc_lcb(np, sdev->id, sdev->lun); sym53c8xx_slave_alloc() 789 spin_unlock_irqrestore(np->s.host->host_lock, flags); sym53c8xx_slave_alloc() 799 struct sym_hcb *np = sym_get_hcb(sdev->host); sym53c8xx_slave_configure() local 800 struct sym_tcb *tp = &np->target[sdev->id]; sym53c8xx_slave_configure() 835 struct sym_hcb *np = sym_get_hcb(sdev->host); sym53c8xx_slave_destroy() local 836 struct sym_tcb *tp = &np->target[sdev->id]; sym53c8xx_slave_destroy() 844 spin_lock_irqsave(np->s.host->host_lock, flags); sym53c8xx_slave_destroy() 853 sym_reset_scsi_bus(np, 1); sym53c8xx_slave_destroy() 856 if (sym_free_lcb(np, sdev->id, sdev->lun) == 0) { sym53c8xx_slave_destroy() 861 tp->head.wval = np->rv_scntl3; sym53c8xx_slave_destroy() 867 spin_unlock_irqrestore(np->s.host->host_lock, flags); sym53c8xx_slave_destroy() 907 static void sym_exec_user_command (struct sym_hcb *np, struct sym_usrcmd *uc) sym_exec_user_command() argument 921 np->verbose = uc->data; sym_exec_user_command() 932 tp = &np->target[t]; sym_exec_user_command() 943 } else if (uc->data <= 9 && np->minsync_dt) { sym_exec_user_command() 944 if (uc->data < np->minsync_dt) sym_exec_user_command() 945 uc->data = np->minsync_dt; sym_exec_user_command() 950 tp->tgoal.offset = np->maxoffs_dt; sym_exec_user_command() 952 if (uc->data < np->minsync) sym_exec_user_command() 953 uc->data = np->minsync; sym_exec_user_command() 957 tp->tgoal.offset = np->maxoffs; sym_exec_user_command() 971 np->istat_sem = SEM; sym_exec_user_command() 972 OUTB(np, nc_istat, SIGP|SEM); sym_exec_user_command() 979 np->istat_sem = SEM; sym_exec_user_command() 980 OUTB(np, nc_istat, SIGP|SEM); sym_exec_user_command() 1035 struct sym_hcb *np = sym_get_hcb(shost); sym_user_command() local 1163 sym_exec_user_command(np, uc); sym_user_command() 1180 struct sym_hcb *np = sym_data->ncb; sym_show_info() local 1183 "revision id 0x%x\n", np->s.chip_name, sym_show_info() 1188 (int) (np->minsync_dt ? np->minsync_dt : np->minsync), sym_show_info() 1189 np->maxwide ? "Wide" : "Narrow", sym_show_info() 1190 np->minsync_dt ? ", DT capable" : ""); sym_show_info() 1220 static void sym_free_resources(struct sym_hcb *np, struct pci_dev *pdev, sym_free_resources() argument 1227 free_irq(pdev->irq, np->s.host); sym_free_resources() 1228 if (np->s.ioaddr) sym_free_resources() 1229 pci_iounmap(pdev, np->s.ioaddr); sym_free_resources() 1230 if (np->s.ramaddr) sym_free_resources() 1231 pci_iounmap(pdev, np->s.ramaddr); sym_free_resources() 1235 sym_hcb_free(np); sym_free_resources() 1237 sym_mfree_dma(np, sizeof(*np), "HCB"); sym_free_resources() 1253 struct sym_hcb *np = NULL; sym_attach() local 1282 np = __sym_calloc_dma(&pdev->dev, sizeof(*np), "HCB"); sym_attach() 1283 if (!np) sym_attach() 1285 np->bus_dmat = &pdev->dev; /* Result in 1 DMA pool per HBA */ sym_attach() 1286 sym_data->ncb = np; sym_attach() 1288 np->s.host = shost; sym_attach() 1295 np->hcb_ba = vtobus(np); sym_attach() 1296 np->verbose = sym_driver_setup.verbose; sym_attach() 1297 np->s.unit = unit; sym_attach() 1298 np->features = dev->chip.features; sym_attach() 1299 np->clock_divn = dev->chip.nr_divisor; sym_attach() 1300 np->maxoffs = dev->chip.offset_max; sym_attach() 1301 np->maxburst = dev->chip.burst_max; sym_attach() 1302 np->myaddr = dev->host_id; sym_attach() 1303 np->mmio_ba = (u32)dev->mmio_base; sym_attach() 1304 np->ram_ba = (u32)dev->ram_base; sym_attach() 1305 np->s.ioaddr = dev->s.ioaddr; sym_attach() 1306 np->s.ramaddr = dev->s.ramaddr; sym_attach() 1311 strlcpy(np->s.chip_name, dev->chip.name, sizeof(np->s.chip_name)); sym_attach() 1312 sprintf(np->s.inst_name, "sym%d", np->s.unit); sym_attach() 1314 if ((SYM_CONF_DMA_ADDRESSING_MODE > 0) && (np->features & FE_DAC) && sym_attach() 1316 set_dac(np); sym_attach() 1318 printf_warning("%s: No suitable DMA available\n", sym_name(np)); sym_attach() 1333 sym_name(np), pdev->irq); sym_attach() 1343 if (sym_reset_scsi_bus(np, 0)) sym_attach() 1354 init_timer(&np->s.timer); sym_attach() 1355 np->s.timer.data = (unsigned long) np; sym_attach() 1356 np->s.timer.function = sym53c8xx_timer; sym_attach() 1357 np->s.lasttime=0; sym_attach() 1358 sym_timer (np); sym_attach() 1365 shost->this_id = np->myaddr; sym_attach() 1366 shost->max_id = np->maxwide ? 16 : 8; sym_attach() 1386 "TERMINATION, DEVICE POWER etc.!\n", sym_name(np)); sym_attach() 1390 if (np) sym_attach() 1391 sym_free_resources(np, pdev, do_free_irq); sym_attach() 1627 struct sym_hcb *np = sym_get_hcb(shost); sym_detach() local 1628 printk("%s: detaching ...\n", sym_name(np)); sym_detach() 1630 del_timer_sync(&np->s.timer); sym_detach() 1637 printk("%s: resetting chip\n", sym_name(np)); sym_detach() 1638 OUTB(np, nc_istat, SRST); sym_detach() 1639 INB(np, nc_mbox1); sym_detach() 1641 OUTB(np, nc_istat, 0); sym_detach() 1643 sym_free_resources(np, pdev, 1); sym_detach() 1826 struct sym_hcb *np = sym_get_hcb(shost); sym2_io_slot_reset() local 1829 sym_name(np)); sym2_io_slot_reset() 1833 sym_name(np)); sym2_io_slot_reset() 1841 if (np->features & FE_WRIE) { sym2_io_slot_reset() 1851 if (sym_reset_scsi_bus(np, 0)) { sym2_io_slot_reset() 1853 sym_name(np)); sym2_io_slot_reset() 1883 struct sym_hcb *np = sym_get_hcb(shost); sym2_get_signalling() local 1886 switch (np->scsi_mode) { sym2_get_signalling() 1906 struct sym_hcb *np = sym_get_hcb(shost); sym2_set_offset() local 1907 struct sym_tcb *tp = &np->target[starget->id]; sym2_set_offset() 1916 struct sym_hcb *np = sym_get_hcb(shost); sym2_set_period() local 1917 struct sym_tcb *tp = &np->target[starget->id]; sym2_set_period() 1921 if (period <= np->minsync && spi_width(starget)) sym2_set_period() 1931 struct sym_hcb *np = sym_get_hcb(shost); sym2_set_width() local 1932 struct sym_tcb *tp = &np->target[starget->id]; sym2_set_width() 1946 struct sym_hcb *np = sym_get_hcb(shost); sym2_set_dt() local 1947 struct sym_tcb *tp = &np->target[starget->id]; sym2_set_dt() 1961 struct sym_hcb *np = sym_get_hcb(shost); 1962 struct sym_tcb *tp = &np->target[starget->id]; 1974 struct sym_hcb *np = sym_get_hcb(shost); 1975 struct sym_tcb *tp = &np->target[starget->id];
|
H A D | sym_hipd.h | 88 #define sym_verbose (np->verbose) 197 #define INB_OFF(np, o) ioread8(np->s.ioaddr + (o)) 198 #define INW_OFF(np, o) ioread16(np->s.ioaddr + (o)) 199 #define INL_OFF(np, o) ioread32(np->s.ioaddr + (o)) 201 #define OUTB_OFF(np, o, val) iowrite8((val), np->s.ioaddr + (o)) 202 #define OUTW_OFF(np, o, val) iowrite16((val), np->s.ioaddr + (o)) 203 #define OUTL_OFF(np, o, val) iowrite32((val), np->s.ioaddr + (o)) 205 #define INB(np, r) INB_OFF(np, offsetof(struct sym_reg, r)) 206 #define INW(np, r) INW_OFF(np, offsetof(struct sym_reg, r)) 207 #define INL(np, r) INL_OFF(np, offsetof(struct sym_reg, r)) 209 #define OUTB(np, r, v) OUTB_OFF(np, offsetof(struct sym_reg, r), (v)) 210 #define OUTW(np, r, v) OUTW_OFF(np, offsetof(struct sym_reg, r), (v)) 211 #define OUTL(np, r, v) OUTL_OFF(np, offsetof(struct sym_reg, r), (v)) 213 #define OUTONB(np, r, m) OUTB(np, r, INB(np, r) | (m)) 214 #define OUTOFFB(np, r, m) OUTB(np, r, INB(np, r) & ~(m)) 215 #define OUTONW(np, r, m) OUTW(np, r, INW(np, r) | (m)) 216 #define OUTOFFW(np, r, m) OUTW(np, r, INW(np, r) & ~(m)) 217 #define OUTONL(np, r, m) OUTL(np, r, INL(np, r) | (m)) 218 #define OUTOFFL(np, r, m) OUTL(np, r, INL(np, r) & ~(m)) 225 #define OUTL_DSP(np, v) \ 228 OUTL(np, nc_dsp, (v)); \ 234 OUTONB(np, nc_dcntl, (STD|NOCOM)); \ 677 #define sym_set_script_dp(np, cp, dp) \ 679 if (np->features & FE_LDSTR) \ 682 np->ccb_head.lastp = cpu_to_scr(dp); \ 684 #define sym_get_script_dp(np, cp) \ 685 scr_to_cpu((np->features & FE_LDSTR) ? \ 686 cp->phys.head.lastp : np->ccb_head.lastp) 688 #define sym_set_script_dp(np, cp, dp) \ 693 #define sym_get_script_dp(np, cp) (cp->phys.head.lastp) 916 void (*fw_setup)(struct sym_hcb *np, struct sym_fw *fw); 1035 #define use_dac(np) 0 1036 #define set_dac(np) do { } while (0) 1038 #define use_dac(np) (np)->use_dac 1039 #define set_dac(np) (np)->use_dac = 1 1042 #define HCB_BA(np, lbl) (np->hcb_ba + offsetof(struct sym_hcb, lbl)) 1049 void sym_fw_bind_script(struct sym_hcb *np, u32 *start, int len); 1056 int sym_reset_scsi_bus(struct sym_hcb *np, int enab_int); 1059 void sym_start_next_ccbs(struct sym_hcb *np, struct sym_lcb *lp, int maxn); 1061 void sym_put_start_queue(struct sym_hcb *np, struct sym_ccb *cp); 1065 int sym_clear_tasks(struct sym_hcb *np, int cam_status, int target, int lun, int task); 1066 struct sym_ccb *sym_get_ccb(struct sym_hcb *np, struct scsi_cmnd *cmd, u_char tag_order); 1067 void sym_free_ccb(struct sym_hcb *np, struct sym_ccb *cp); 1068 struct sym_lcb *sym_alloc_lcb(struct sym_hcb *np, u_char tn, u_char ln); 1069 int sym_free_lcb(struct sym_hcb *np, u_char tn, u_char ln); 1070 int sym_queue_scsiio(struct sym_hcb *np, struct scsi_cmnd *csio, struct sym_ccb *cp); 1071 int sym_abort_scsiio(struct sym_hcb *np, struct scsi_cmnd *ccb, int timed_out); 1072 int sym_reset_scsi_target(struct sym_hcb *np, int target); 1073 void sym_hcb_free(struct sym_hcb *np); 1086 #define sym_build_sge(np, data, badd, len) \ 1093 #define sym_build_sge(np, data, badd, len) \ 1100 int sym_lookup_dmap(struct sym_hcb *np, u32 h, int s); 1102 sym_build_sge(struct sym_hcb *np, struct sym_tblmove *data, u64 badd, int len) sym_build_sge() argument 1107 if (h != np->dmap_bah[s]) sym_build_sge() 1114 s = sym_lookup_dmap(np, h, s); sym_build_sge() 1192 #define _sym_calloc_dma(np, l, n) __sym_calloc_dma(np->bus_dmat, l, n) 1193 #define _sym_mfree_dma(np, p, l, n) \ 1194 __sym_mfree_dma(np->bus_dmat, _uvptv_(p), l, n) 1195 #define sym_calloc_dma(l, n) _sym_calloc_dma(np, l, n) 1196 #define sym_mfree_dma(p, l, n) _sym_mfree_dma(np, p, l, n) 1197 #define vtobus(p) __vtobus(np->bus_dmat, _uvptv_(p))
|
/linux-4.4.14/include/video/ |
H A D | of_display_timing.h | 19 int of_get_display_timing(struct device_node *np, const char *name, 21 struct display_timings *of_get_display_timings(struct device_node *np); 22 int of_display_timings_exist(struct device_node *np); 24 static inline int of_get_display_timing(struct device_node *np, const char *name, of_get_display_timing() argument 29 static inline struct display_timings *of_get_display_timings(struct device_node *np) of_get_display_timings() argument 33 static inline int of_display_timings_exist(struct device_node *np) of_display_timings_exist() argument
|
H A D | of_videomode.h | 15 int of_get_videomode(struct device_node *np, struct videomode *vm,
|
/linux-4.4.14/include/linux/usb/ |
H A D | of.h | 15 bool of_usb_host_tpl_support(struct device_node *np); 16 int of_usb_update_otg_caps(struct device_node *np, 19 static inline bool of_usb_host_tpl_support(struct device_node *np) of_usb_host_tpl_support() argument 23 static inline int of_usb_update_otg_caps(struct device_node *np, of_usb_update_otg_caps() argument 31 enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np); 33 static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np) of_usb_get_phy_mode() argument
|
/linux-4.4.14/drivers/memory/ |
H A D | of_memory.c | 22 * @np: pointer to ddr device tree node 30 const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np, of_get_min_tck() argument 40 ret |= of_property_read_u32(np, "tRPab-min-tck", &min->tRPab); of_get_min_tck() 41 ret |= of_property_read_u32(np, "tRCD-min-tck", &min->tRCD); of_get_min_tck() 42 ret |= of_property_read_u32(np, "tWR-min-tck", &min->tWR); of_get_min_tck() 43 ret |= of_property_read_u32(np, "tRASmin-min-tck", &min->tRASmin); of_get_min_tck() 44 ret |= of_property_read_u32(np, "tRRD-min-tck", &min->tRRD); of_get_min_tck() 45 ret |= of_property_read_u32(np, "tWTR-min-tck", &min->tWTR); of_get_min_tck() 46 ret |= of_property_read_u32(np, "tXP-min-tck", &min->tXP); of_get_min_tck() 47 ret |= of_property_read_u32(np, "tRTP-min-tck", &min->tRTP); of_get_min_tck() 48 ret |= of_property_read_u32(np, "tCKE-min-tck", &min->tCKE); of_get_min_tck() 49 ret |= of_property_read_u32(np, "tCKESR-min-tck", &min->tCKESR); of_get_min_tck() 50 ret |= of_property_read_u32(np, "tFAW-min-tck", &min->tFAW); of_get_min_tck() 65 static int of_do_get_timings(struct device_node *np, of_do_get_timings() argument 70 ret = of_property_read_u32(np, "max-freq", &tim->max_freq); of_do_get_timings() 71 ret |= of_property_read_u32(np, "min-freq", &tim->min_freq); of_do_get_timings() 72 ret |= of_property_read_u32(np, "tRPab", &tim->tRPab); of_do_get_timings() 73 ret |= of_property_read_u32(np, "tRCD", &tim->tRCD); of_do_get_timings() 74 ret |= of_property_read_u32(np, "tWR", &tim->tWR); of_do_get_timings() 75 ret |= of_property_read_u32(np, "tRAS-min", &tim->tRAS_min); of_do_get_timings() 76 ret |= of_property_read_u32(np, "tRRD", &tim->tRRD); of_do_get_timings() 77 ret |= of_property_read_u32(np, "tWTR", &tim->tWTR); of_do_get_timings() 78 ret |= of_property_read_u32(np, "tXP", &tim->tXP); of_do_get_timings() 79 ret |= of_property_read_u32(np, "tRTP", &tim->tRTP); of_do_get_timings() 80 ret |= of_property_read_u32(np, "tCKESR", &tim->tCKESR); of_do_get_timings() 81 ret |= of_property_read_u32(np, "tDQSCK-max", &tim->tDQSCK_max); of_do_get_timings() 82 ret |= of_property_read_u32(np, "tFAW", &tim->tFAW); of_do_get_timings() 83 ret |= of_property_read_u32(np, "tZQCS", &tim->tZQCS); of_do_get_timings() 84 ret |= of_property_read_u32(np, "tZQCL", &tim->tZQCL); of_do_get_timings() 85 ret |= of_property_read_u32(np, "tZQinit", &tim->tZQinit); of_do_get_timings() 86 ret |= of_property_read_u32(np, "tRAS-max-ns", &tim->tRAS_max_ns); of_do_get_timings() 87 ret |= of_property_read_u32(np, "tDQSCK-max-derated", of_do_get_timings()
|
H A D | pl172.c | 60 const struct device_node *np, const char *name, pl172_timing_prop() 67 if (!of_property_read_u32(np, name, &val)) { pl172_timing_prop() 86 struct device_node *np, u32 cs) pl172_setup_static() 93 if (!of_property_read_u32(np, "mpmc,memory-width", &cfg)) { pl172_setup_static() 109 if (of_property_read_bool(np, "mpmc,async-page-mode")) pl172_setup_static() 112 if (of_property_read_bool(np, "mpmc,cs-active-high")) pl172_setup_static() 115 if (of_property_read_bool(np, "mpmc,byte-lane-low")) pl172_setup_static() 118 if (of_property_read_bool(np, "mpmc,extended-wait")) pl172_setup_static() 122 of_property_read_bool(np, "mpmc,buffer-enable")) pl172_setup_static() 125 if (of_property_read_bool(np, "mpmc,write-protect")) pl172_setup_static() 132 ret = pl172_timing_prop(adev, np, "mpmc,write-enable-delay", pl172_setup_static() 138 ret = pl172_timing_prop(adev, np, "mpmc,output-enable-delay", pl172_setup_static() 144 ret = pl172_timing_prop(adev, np, "mpmc,read-access-delay", pl172_setup_static() 150 ret = pl172_timing_prop(adev, np, "mpmc,page-mode-read-delay", pl172_setup_static() 156 ret = pl172_timing_prop(adev, np, "mpmc,write-access-delay", pl172_setup_static() 162 ret = pl172_timing_prop(adev, np, "mpmc,turn-round-delay", pl172_setup_static() 175 struct device_node *np) pl172_parse_cs_config() 179 if (!of_property_read_u32(np, "mpmc,cs", &cs)) { pl172_parse_cs_config() 185 return pl172_setup_static(adev, np, cs); pl172_parse_cs_config() 199 struct device_node *child_np, *np = adev->dev.of_node; pl172_probe() local 262 for_each_available_child_of_node(np, child_np) { for_each_available_child_of_node() 59 pl172_timing_prop(struct amba_device *adev, const struct device_node *np, const char *name, u32 reg_offset, u32 max, int start) pl172_timing_prop() argument 85 pl172_setup_static(struct amba_device *adev, struct device_node *np, u32 cs) pl172_setup_static() argument 174 pl172_parse_cs_config(struct amba_device *adev, struct device_node *np) pl172_parse_cs_config() argument
|
/linux-4.4.14/arch/powerpc/sysdev/ |
H A D | mv64x60_dev.c | 34 static int __init mv64x60_mpsc_register_shared_pdev(struct device_node *np) mv64x60_mpsc_register_shared_pdev() argument 43 ph = of_get_property(np, "mpscrouting", NULL); mv64x60_mpsc_register_shared_pdev() 53 ph = of_get_property(np, "mpscintr", NULL); mv64x60_mpsc_register_shared_pdev() 89 static int __init mv64x60_mpsc_device_setup(struct device_node *np, int id) mv64x60_mpsc_device_setup() argument 101 if (id == 0 && (err = mv64x60_mpsc_register_shared_pdev(np))) mv64x60_mpsc_device_setup() 106 err = of_address_to_resource(np, 0, &r[0]); mv64x60_mpsc_device_setup() 110 of_irq_to_resource(np, 0, &r[4]); mv64x60_mpsc_device_setup() 112 ph = of_get_property(np, "sdma", NULL); mv64x60_mpsc_device_setup() 123 ph = of_get_property(np, "brg", NULL); mv64x60_mpsc_device_setup() 133 prop = of_get_property(np, "cell-index", NULL); mv64x60_mpsc_device_setup() 143 prop = of_get_property(np, "max_idle", NULL); mv64x60_mpsc_device_setup() 156 prop = of_get_property(np, "chr_1", NULL); mv64x60_mpsc_device_setup() 160 prop = of_get_property(np, "chr_2", NULL); mv64x60_mpsc_device_setup() 164 prop = of_get_property(np, "chr_10", NULL); mv64x60_mpsc_device_setup() 168 prop = of_get_property(np, "mpcr", NULL); mv64x60_mpsc_device_setup() 214 struct device_node *np, int id) mv64x60_eth_register_shared_pdev() 220 err = of_address_to_resource(np, 0, &r[0]); mv64x60_eth_register_shared_pdev() 241 static int __init mv64x60_eth_device_setup(struct device_node *np, int id, mv64x60_eth_device_setup() argument 254 of_irq_to_resource(np, 0, &r[0]); mv64x60_eth_device_setup() 260 prop = of_get_property(np, "reg", NULL); mv64x60_eth_device_setup() 265 mac_addr = of_get_mac_address(np); mv64x60_eth_device_setup() 269 prop = of_get_property(np, "speed", NULL); mv64x60_eth_device_setup() 273 prop = of_get_property(np, "tx_queue_size", NULL); mv64x60_eth_device_setup() 277 prop = of_get_property(np, "rx_queue_size", NULL); mv64x60_eth_device_setup() 281 prop = of_get_property(np, "tx_sram_addr", NULL); mv64x60_eth_device_setup() 285 prop = of_get_property(np, "tx_sram_size", NULL); mv64x60_eth_device_setup() 289 prop = of_get_property(np, "rx_sram_addr", NULL); mv64x60_eth_device_setup() 293 prop = of_get_property(np, "rx_sram_size", NULL); mv64x60_eth_device_setup() 297 ph = of_get_property(np, "phy", NULL); mv64x60_eth_device_setup() 338 static int __init mv64x60_i2c_device_setup(struct device_node *np, int id) mv64x60_i2c_device_setup() argument 348 err = of_address_to_resource(np, 0, &r[0]); mv64x60_i2c_device_setup() 352 of_irq_to_resource(np, 0, &r[1]); mv64x60_i2c_device_setup() 357 prop = of_get_property(np, "freq_m", NULL); mv64x60_i2c_device_setup() 362 prop = of_get_property(np, "freq_n", NULL); mv64x60_i2c_device_setup() 394 static int __init mv64x60_wdt_device_setup(struct device_node *np, int id) mv64x60_wdt_device_setup() argument 402 err = of_address_to_resource(np, 0, &r); mv64x60_wdt_device_setup() 410 np = of_get_parent(np); mv64x60_wdt_device_setup() 411 if (!np) mv64x60_wdt_device_setup() 414 prop = of_get_property(np, "clock-frequency", NULL); mv64x60_wdt_device_setup() 415 of_node_put(np); mv64x60_wdt_device_setup() 445 struct device_node *np, *np2; mv64x60_device_setup() local 451 for_each_compatible_node(np, NULL, "marvell,mv64360-mpsc") { mv64x60_device_setup() 452 err = mv64x60_mpsc_device_setup(np, id++); mv64x60_device_setup() 456 np->full_name, err); mv64x60_device_setup() 461 for_each_compatible_node(np, NULL, "marvell,mv64360-eth-group") { mv64x60_device_setup() 462 pdev = mv64x60_eth_register_shared_pdev(np, id++); mv64x60_device_setup() 467 np->full_name, err); mv64x60_device_setup() 470 for_each_child_of_node(np, np2) { for_each_child_of_node() 484 for_each_compatible_node(np, "i2c", "marvell,mv64360-i2c") { 485 err = mv64x60_i2c_device_setup(np, id++); 489 np->full_name, err); 493 np = of_find_compatible_node(np, NULL, "marvell,mv64360-wdt"); 494 if (np) { 495 if ((err = mv64x60_wdt_device_setup(np, id))) 498 np->full_name, err); 499 of_node_put(np); 503 for_each_compatible_node(np, NULL, "marvell,mv64360") 504 of_platform_bus_probe(np, of_mv64x60_devices, NULL); 512 struct device_node *np = NULL; mv64x60_add_mpsc_console() local 519 np = of_find_node_by_path(prop); mv64x60_add_mpsc_console() 520 if (!np) mv64x60_add_mpsc_console() 523 if (!of_device_is_compatible(np, "marvell,mv64360-mpsc")) mv64x60_add_mpsc_console() 526 prop = of_get_property(np, "cell-index", NULL); mv64x60_add_mpsc_console() 213 mv64x60_eth_register_shared_pdev( struct device_node *np, int id) mv64x60_eth_register_shared_pdev() argument
|
H A D | rtc_cmos_setup.c | 22 struct device_node *np; add_rtc() local 30 np = of_find_compatible_node(NULL, NULL, "pnpPNP,b00"); add_rtc() 31 if (!np) add_rtc() 34 ret = of_address_to_resource(np, 0, &res[0]); add_rtc() 35 of_node_put(np); add_rtc() 46 np = of_find_compatible_node(NULL, NULL, "chrp,iic"); add_rtc() 47 if (!np) add_rtc() 48 np = of_find_compatible_node(NULL, NULL, "pnpPNP,000"); add_rtc() 49 if (np) { add_rtc() 50 of_node_put(np); add_rtc()
|
H A D | ppc4xx_soc.c | 76 struct device_node *np; ppc4xx_l2c_probe() local 86 np = of_find_compatible_node(NULL, NULL, "ibm,l2-cache"); ppc4xx_l2c_probe() 87 if (!np) ppc4xx_l2c_probe() 91 prop = of_get_property(np, "cache-size", NULL); ppc4xx_l2c_probe() 93 printk(KERN_ERR "%s: Can't get cache-size!\n", np->full_name); ppc4xx_l2c_probe() 94 of_node_put(np); ppc4xx_l2c_probe() 100 dcrreg = of_get_property(np, "dcr-reg", &len); ppc4xx_l2c_probe() 103 np->full_name); ppc4xx_l2c_probe() 104 of_node_put(np); ppc4xx_l2c_probe() 111 irq = irq_of_parse_and_map(np, 0); ppc4xx_l2c_probe() 114 of_node_put(np); ppc4xx_l2c_probe() 122 of_node_put(np); ppc4xx_l2c_probe() 178 if (of_device_is_compatible(np, "ibm,l2-cache-460ex") || ppc4xx_l2c_probe() 179 of_device_is_compatible(np, "ibm,l2-cache-460gt")) ppc4xx_l2c_probe() 189 of_node_put(np); ppc4xx_l2c_probe() 200 struct device_node *np; ppc4xx_reset_system() local 204 np = of_find_node_by_type(NULL, "cpu"); ppc4xx_reset_system() 205 if (np) { ppc4xx_reset_system() 206 prop = of_get_property(np, "reset-type", NULL); ppc4xx_reset_system()
|
H A D | mv64x60_udbg.c | 72 struct device_node *np, *mpscintr, *stdout = NULL; mv64x60_udbg_init() local 88 for_each_compatible_node(np, NULL, "marvell,mv64360-mpsc") { mv64x60_udbg_init() 89 if (np == stdout) mv64x60_udbg_init() 94 if (!np) mv64x60_udbg_init() 97 block_index = of_get_property(np, "cell-index", NULL); mv64x60_udbg_init() 112 err = of_address_to_resource(np, 0, &r[0]); mv64x60_udbg_init() 116 ph = of_get_property(np, "mpscintr", NULL); mv64x60_udbg_init() 126 of_node_put(np); mv64x60_udbg_init() 146 of_node_put(np); mv64x60_udbg_init()
|
H A D | tsi108_dev.c | 68 struct device_node *np; tsi108_eth_of_init() local 74 for_each_compatible_node(np, "network", "tsi108-ethernet") { tsi108_eth_of_init() 85 ret = of_address_to_resource(np, 0, &r[0]); tsi108_eth_of_init() 92 r[1].start = irq_of_parse_and_map(np, 0); tsi108_eth_of_init() 93 r[1].end = irq_of_parse_and_map(np, 0); tsi108_eth_of_init() 107 mac_addr = of_get_mac_address(np); tsi108_eth_of_init() 111 ph = of_get_property(np, "mdio-handle", NULL); tsi108_eth_of_init() 118 ph = of_get_property(np, "phy-handle", NULL); tsi108_eth_of_init() 131 tsi_eth_data.irq_num = irq_of_parse_and_map(np, 0); tsi108_eth_of_init() 155 of_node_put(np); tsi108_eth_of_init()
|
H A D | mpic_msi.c | 36 struct device_node *np; mpic_msi_reserve_u3_hwirqs() local 61 np = NULL; mpic_msi_reserve_u3_hwirqs() 62 while ((np = of_find_all_nodes(np))) { mpic_msi_reserve_u3_hwirqs() 63 pr_debug("mpic: mapping hwirqs for %s\n", np->full_name); mpic_msi_reserve_u3_hwirqs() 66 while (of_irq_parse_one(np, index++, &oirq) == 0) { mpic_msi_reserve_u3_hwirqs()
|
H A D | mpc8xx_pic.c | 131 struct device_node *np; mpc8xx_pic_init() local 134 np = of_find_compatible_node(NULL, NULL, "fsl,pq1-pic"); mpc8xx_pic_init() 135 if (np == NULL) mpc8xx_pic_init() 136 np = of_find_node_by_type(NULL, "mpc8xx-pic"); mpc8xx_pic_init() 137 if (np == NULL) { mpc8xx_pic_init() 142 ret = of_address_to_resource(np, 0, &res); mpc8xx_pic_init() 152 mpc8xx_pic_host = irq_domain_add_linear(np, 64, &mpc8xx_pic_host_ops, NULL); mpc8xx_pic_init() 161 of_node_put(np); mpc8xx_pic_init()
|
H A D | mv64x60_pci.c | 85 struct device_node *np; mv64x60_sysfs_init() local 89 np = of_find_compatible_node(NULL, NULL, "marvell,mv64360"); mv64x60_sysfs_init() 90 if (!np) mv64x60_sysfs_init() 93 prop = of_get_property(np, "hs_reg_valid", NULL); mv64x60_sysfs_init() 94 of_node_put(np); mv64x60_sysfs_init() 167 struct device_node *np; mv64x60_pci_init() local 169 for_each_compatible_node(np, "pci", "marvell,mv64360-pci") mv64x60_pci_init() 170 mv64x60_add_bridge(np); mv64x60_pci_init()
|
H A D | ppc4xx_cpm.c | 248 static int cpm_get_uint_property(struct device_node *np, cpm_get_uint_property() argument 252 const unsigned int *prop = of_get_property(np, name, &len); cpm_get_uint_property() 262 struct device_node *np; cpm_init() local 271 np = of_find_compatible_node(NULL, NULL, "ibm,cpm"); cpm_init() 272 if (!np) { cpm_init() 277 dcr_base = dcr_resource_start(np, 0); cpm_init() 278 dcr_len = dcr_resource_len(np, 0); cpm_init() 282 np->full_name); cpm_init() 287 cpm.dcr_host = dcr_map(np, dcr_base, dcr_len); cpm_init() 291 np->full_name); cpm_init() 302 if (cpm_get_uint_property(np, "er-offset") == 0) { cpm_init() 314 cpm.unused = cpm_get_uint_property(np, "unused-units"); cpm_init() 315 cpm.idle_doze = cpm_get_uint_property(np, "idle-doze"); cpm_init() 316 cpm.standby = cpm_get_uint_property(np, "standby"); cpm_init() 317 cpm.suspend = cpm_get_uint_property(np, "suspend"); cpm_init() 334 of_node_put(np); cpm_init()
|
H A D | simple_gpio.c | 88 static int __init u8_simple_gpiochip_add(struct device_node *np) u8_simple_gpiochip_add() argument 111 ret = of_mm_gpiochip_add(np, mm_gc); u8_simple_gpiochip_add() 122 struct device_node *np; simple_gpiochip_init() local 124 for_each_compatible_node(np, NULL, compatible) { for_each_compatible_node() 128 ret = of_address_to_resource(np, 0, &r); for_each_compatible_node() 134 ret = u8_simple_gpiochip_add(np); for_each_compatible_node() 150 np->full_name, ret); for_each_compatible_node()
|
/linux-4.4.14/drivers/char/hw_random/ |
H A D | n2-drv.c | 146 static unsigned long n2rng_control_settle_v2(struct n2rng *np, int unit) n2rng_control_settle_v2() argument 148 unsigned long ra = __pa(&np->scratch_control[0]); n2rng_control_settle_v2() 153 static unsigned long n2rng_write_ctl_one(struct n2rng *np, int unit, n2rng_write_ctl_one() argument 161 if (np->hvapi_major == 1) { n2rng_write_ctl_one() 168 hv_err = n2rng_control_settle_v2(np, unit); n2rng_write_ctl_one() 200 static unsigned long n2rng_read_diag_data_one(struct n2rng *np, n2rng_read_diag_data_one() argument 208 if (np->hvapi_major == 1) { n2rng_read_diag_data_one() 219 static int n2rng_generic_read_diag_data(struct n2rng *np, n2rng_generic_read_diag_data() argument 228 hv_err = n2rng_read_diag_data_one(np, unit, n2rng_generic_read_diag_data() 248 static int n2rng_generic_write_control(struct n2rng *np, n2rng_generic_write_control() argument 257 hv_err = n2rng_write_ctl_one(np, unit, state, control_ra, n2rng_generic_write_control() 258 np->wd_timeo, &ticks); n2rng_generic_write_control() 278 static int n2rng_try_read_ctl(struct n2rng *np) n2rng_try_read_ctl() argument 283 if (np->hvapi_major == 1) { n2rng_try_read_ctl() 326 static void n2rng_control_swstate_init(struct n2rng *np) n2rng_control_swstate_init() argument 330 np->flags |= N2RNG_FLAG_CONTROL; n2rng_control_swstate_init() 332 np->health_check_sec = N2RNG_HEALTH_CHECK_SEC_DEFAULT; n2rng_control_swstate_init() 333 np->accum_cycles = N2RNG_ACCUM_CYCLES_DEFAULT; n2rng_control_swstate_init() 334 np->wd_timeo = N2RNG_WD_TIMEO_DEFAULT; n2rng_control_swstate_init() 336 for (i = 0; i < np->num_units; i++) { n2rng_control_swstate_init() 337 struct n2rng_unit *up = &np->units[i]; n2rng_control_swstate_init() 345 np->hv_state = HV_RNG_STATE_UNCONFIGURED; n2rng_control_swstate_init() 348 static int n2rng_grab_diag_control(struct n2rng *np) n2rng_grab_diag_control() argument 354 err = n2rng_try_read_ctl(np); n2rng_grab_diag_control() 359 dev_err(&np->op->dev, n2rng_grab_diag_control() 370 static int n2rng_init_control(struct n2rng *np) n2rng_init_control() argument 372 int err = n2rng_grab_diag_control(np); n2rng_init_control() 382 n2rng_control_swstate_init(np); n2rng_init_control() 389 struct n2rng *np = (struct n2rng *) rng->priv; n2rng_data_read() local 390 unsigned long ra = __pa(&np->test_data); n2rng_data_read() 393 if (!(np->flags & N2RNG_FLAG_READY)) { n2rng_data_read() 395 } else if (np->flags & N2RNG_FLAG_BUFFER_VALID) { n2rng_data_read() 396 np->flags &= ~N2RNG_FLAG_BUFFER_VALID; n2rng_data_read() 397 *data = np->buffer; n2rng_data_read() 402 np->buffer = np->test_data >> 32; n2rng_data_read() 403 *data = np->test_data & 0xffffffff; n2rng_data_read() 406 dev_err(&np->op->dev, "RNG error, restesting\n"); n2rng_data_read() 407 np->flags &= ~N2RNG_FLAG_READY; n2rng_data_read() 408 if (!(np->flags & N2RNG_FLAG_SHUTDOWN)) n2rng_data_read() 409 schedule_delayed_work(&np->work, 0); n2rng_data_read() 422 static int n2rng_guest_check(struct n2rng *np) n2rng_guest_check() argument 424 unsigned long ra = __pa(&np->test_data); n2rng_guest_check() 429 static int n2rng_entropy_diag_read(struct n2rng *np, unsigned long unit, n2rng_entropy_diag_read() argument 439 err = n2rng_generic_write_control(np, pre_ctl_ra, unit, pre_state); n2rng_entropy_diag_read() 443 err = n2rng_generic_read_diag_data(np, unit, n2rng_entropy_diag_read() 446 (void) n2rng_generic_write_control(np, post_ctl_ra, unit, n2rng_entropy_diag_read() 467 static int n2rng_test_buffer_find(struct n2rng *np, u64 val) n2rng_test_buffer_find() argument 473 if (np->test_buffer[i] == val) n2rng_test_buffer_find() 479 static void n2rng_dump_test_buffer(struct n2rng *np) n2rng_dump_test_buffer() argument 484 dev_err(&np->op->dev, "Test buffer slot %d [0x%016llx]\n", n2rng_dump_test_buffer() 485 i, np->test_buffer[i]); n2rng_dump_test_buffer() 488 static int n2rng_check_selftest_buffer(struct n2rng *np, unsigned long unit) n2rng_check_selftest_buffer() argument 495 matches += n2rng_test_buffer_find(np, val); n2rng_check_selftest_buffer() 504 dev_err(&np->op->dev, "Selftest failed on unit %lu\n", unit); n2rng_check_selftest_buffer() 505 n2rng_dump_test_buffer(np); n2rng_check_selftest_buffer() 507 dev_info(&np->op->dev, "Selftest passed on unit %lu\n", unit); n2rng_check_selftest_buffer() 512 static int n2rng_control_selftest(struct n2rng *np, unsigned long unit) n2rng_control_selftest() argument 516 np->test_control[0] = (0x2 << RNG_CTL_ASEL_SHIFT); n2rng_control_selftest() 517 np->test_control[1] = (0x2 << RNG_CTL_ASEL_SHIFT); n2rng_control_selftest() 518 np->test_control[2] = (0x2 << RNG_CTL_ASEL_SHIFT); n2rng_control_selftest() 519 np->test_control[3] = ((0x2 << RNG_CTL_ASEL_SHIFT) | n2rng_control_selftest() 524 err = n2rng_entropy_diag_read(np, unit, np->test_control, n2rng_control_selftest() 526 np->test_buffer, n2rng_control_selftest() 527 sizeof(np->test_buffer), n2rng_control_selftest() 528 &np->units[unit].control[0], n2rng_control_selftest() 529 np->hv_state); n2rng_control_selftest() 533 return n2rng_check_selftest_buffer(np, unit); n2rng_control_selftest() 536 static int n2rng_control_check(struct n2rng *np) n2rng_control_check() argument 540 for (i = 0; i < np->num_units; i++) { n2rng_control_check() 541 int err = n2rng_control_selftest(np, i); n2rng_control_check() 551 static int n2rng_control_configure_units(struct n2rng *np) n2rng_control_configure_units() argument 556 for (unit = 0; unit < np->num_units; unit++) { n2rng_control_configure_units() 557 struct n2rng_unit *up = &np->units[unit]; n2rng_control_configure_units() 562 base = ((np->accum_cycles << RNG_CTL_WAIT_SHIFT) | n2rng_control_configure_units() 579 err = n2rng_generic_write_control(np, ctl_ra, unit, n2rng_control_configure_units() 590 struct n2rng *np = container_of(work, struct n2rng, work.work); n2rng_work() local 593 if (!(np->flags & N2RNG_FLAG_CONTROL)) { n2rng_work() 594 err = n2rng_guest_check(np); n2rng_work() 597 err = n2rng_control_check(np); n2rng_work() 601 err = n2rng_control_configure_units(np); n2rng_work() 605 np->flags |= N2RNG_FLAG_READY; n2rng_work() 606 dev_info(&np->op->dev, "RNG ready\n"); n2rng_work() 609 if (err && !(np->flags & N2RNG_FLAG_SHUTDOWN)) n2rng_work() 610 schedule_delayed_work(&np->work, HZ * 2); n2rng_work() 627 struct n2rng *np; n2rng_probe() local 635 np = devm_kzalloc(&op->dev, sizeof(*np), GFP_KERNEL); n2rng_probe() 636 if (!np) n2rng_probe() 638 np->op = op; n2rng_probe() 640 INIT_DELAYED_WORK(&np->work, n2rng_work); n2rng_probe() 643 np->flags |= N2RNG_FLAG_MULTI; n2rng_probe() 646 np->hvapi_major = 2; n2rng_probe() 648 np->hvapi_major, n2rng_probe() 649 &np->hvapi_minor)) { n2rng_probe() 650 np->hvapi_major = 1; n2rng_probe() 652 np->hvapi_major, n2rng_probe() 653 &np->hvapi_minor)) { n2rng_probe() 660 if (np->flags & N2RNG_FLAG_MULTI) { n2rng_probe() 661 if (np->hvapi_major < 2) { n2rng_probe() 664 np->hvapi_major); n2rng_probe() 667 np->num_units = of_getintprop_default(op->dev.of_node, n2rng_probe() 669 if (!np->num_units) { n2rng_probe() 674 np->num_units = 1; n2rng_probe() 677 np->hvapi_major, np->hvapi_minor); n2rng_probe() 679 np->units = devm_kzalloc(&op->dev, n2rng_probe() 680 sizeof(struct n2rng_unit) * np->num_units, n2rng_probe() 683 if (!np->units) n2rng_probe() 686 err = n2rng_init_control(np); n2rng_probe() 691 ((np->flags & N2RNG_FLAG_MULTI) ? n2rng_probe() 693 np->num_units); n2rng_probe() 695 np->hwrng.name = "n2rng"; n2rng_probe() 696 np->hwrng.data_read = n2rng_data_read; n2rng_probe() 697 np->hwrng.priv = (unsigned long) np; n2rng_probe() 699 err = hwrng_register(&np->hwrng); n2rng_probe() 703 platform_set_drvdata(op, np); n2rng_probe() 705 schedule_delayed_work(&np->work, 0); n2rng_probe() 718 struct n2rng *np = platform_get_drvdata(op); n2rng_remove() local 720 np->flags |= N2RNG_FLAG_SHUTDOWN; n2rng_remove() 722 cancel_delayed_work_sync(&np->work); n2rng_remove() 724 hwrng_unregister(&np->hwrng); n2rng_remove()
|
/linux-4.4.14/drivers/video/ |
H A D | of_display_timing.c | 18 * @np: device_node with the property 26 static int parse_timing_property(const struct device_node *np, const char *name, parse_timing_property() argument 32 prop = of_find_property(np, name, &length); parse_timing_property() 35 of_node_full_name(np), name); parse_timing_property() 41 ret = of_property_read_u32(np, name, &result->typ); parse_timing_property() 45 ret = of_property_read_u32_array(np, name, &result->min, cells); parse_timing_property() 48 of_node_full_name(np), name); parse_timing_property() 57 * @np: device_node with the properties 59 static int of_parse_display_timing(const struct device_node *np, of_parse_display_timing() argument 67 ret |= parse_timing_property(np, "hback-porch", &dt->hback_porch); of_parse_display_timing() 68 ret |= parse_timing_property(np, "hfront-porch", &dt->hfront_porch); of_parse_display_timing() 69 ret |= parse_timing_property(np, "hactive", &dt->hactive); of_parse_display_timing() 70 ret |= parse_timing_property(np, "hsync-len", &dt->hsync_len); of_parse_display_timing() 71 ret |= parse_timing_property(np, "vback-porch", &dt->vback_porch); of_parse_display_timing() 72 ret |= parse_timing_property(np, "vfront-porch", &dt->vfront_porch); of_parse_display_timing() 73 ret |= parse_timing_property(np, "vactive", &dt->vactive); of_parse_display_timing() 74 ret |= parse_timing_property(np, "vsync-len", &dt->vsync_len); of_parse_display_timing() 75 ret |= parse_timing_property(np, "clock-frequency", &dt->pixelclock); of_parse_display_timing() 78 if (!of_property_read_u32(np, "vsync-active", &val)) of_parse_display_timing() 81 if (!of_property_read_u32(np, "hsync-active", &val)) of_parse_display_timing() 84 if (!of_property_read_u32(np, "de-active", &val)) of_parse_display_timing() 87 if (!of_property_read_u32(np, "pixelclk-active", &val)) of_parse_display_timing() 91 if (of_property_read_bool(np, "interlaced")) of_parse_display_timing() 93 if (of_property_read_bool(np, "doublescan")) of_parse_display_timing() 95 if (of_property_read_bool(np, "doubleclk")) of_parse_display_timing() 100 of_node_full_name(np)); of_parse_display_timing() 109 * @np: device_node with the timing subnode 113 int of_get_display_timing(struct device_node *np, const char *name, of_get_display_timing() argument 118 if (!np) of_get_display_timing() 121 timing_np = of_get_child_by_name(np, name); of_get_display_timing() 124 of_node_full_name(np), name); of_get_display_timing() 134 * @np: device_node with the subnodes 136 struct display_timings *of_get_display_timings(struct device_node *np) of_get_display_timings() argument 143 if (!np) of_get_display_timings() 146 timings_np = of_get_child_by_name(np, "display-timings"); of_get_display_timings() 149 of_node_full_name(np)); of_get_display_timings() 156 of_node_full_name(np)); of_get_display_timings() 167 of_node_full_name(np)); of_get_display_timings() 172 of_node_full_name(np), entry->name); of_get_display_timings() 179 pr_err("%s: no timings specified\n", of_node_full_name(np)); of_get_display_timings() 187 of_node_full_name(np)); of_get_display_timings() 201 of_node_full_name(np)); for_each_child_of_node() 212 of_node_full_name(np), disp->num_timings + 1); for_each_child_of_node() 231 of_node_full_name(np), disp->num_timings, 250 * @np: device_node with the timing 252 int of_display_timings_exist(struct device_node *np) of_display_timings_exist() argument 256 if (!np) of_display_timings_exist() 259 timings_np = of_parse_phandle(np, "display-timings", 0); of_display_timings_exist()
|
H A D | of_videomode.c | 18 * @np - devicenode with the display_timings 31 int of_get_videomode(struct device_node *np, struct videomode *vm, of_get_videomode() argument 37 disp = of_get_display_timings(np); of_get_videomode() 39 pr_err("%s: no timings specified\n", of_node_full_name(np)); of_get_videomode()
|
/linux-4.4.14/drivers/of/ |
H A D | unittest.c | 49 struct device_node *np; of_unittest_find_node_by_name() local 52 np = of_find_node_by_path("/testcase-data"); of_unittest_find_node_by_name() 53 unittest(np && !strcmp("/testcase-data", np->full_name), of_unittest_find_node_by_name() 55 of_node_put(np); of_unittest_find_node_by_name() 58 np = of_find_node_by_path("/testcase-data/"); of_unittest_find_node_by_name() 59 unittest(!np, "trailing '/' on /testcase-data/ should fail\n"); of_unittest_find_node_by_name() 61 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); of_unittest_find_node_by_name() 62 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", np->full_name), of_unittest_find_node_by_name() 64 of_node_put(np); of_unittest_find_node_by_name() 66 np = of_find_node_by_path("testcase-alias"); of_unittest_find_node_by_name() 67 unittest(np && !strcmp("/testcase-data", np->full_name), of_unittest_find_node_by_name() 69 of_node_put(np); of_unittest_find_node_by_name() 72 np = of_find_node_by_path("testcase-alias/"); of_unittest_find_node_by_name() 73 unittest(!np, "trailing '/' on testcase-alias/ should fail\n"); of_unittest_find_node_by_name() 75 np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a"); of_unittest_find_node_by_name() 76 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", np->full_name), of_unittest_find_node_by_name() 78 of_node_put(np); of_unittest_find_node_by_name() 80 np = of_find_node_by_path("/testcase-data/missing-path"); of_unittest_find_node_by_name() 81 unittest(!np, "non-existent path returned node %s\n", np->full_name); of_unittest_find_node_by_name() 82 of_node_put(np); of_unittest_find_node_by_name() 84 np = of_find_node_by_path("missing-alias"); of_unittest_find_node_by_name() 85 unittest(!np, "non-existent alias returned node %s\n", np->full_name); of_unittest_find_node_by_name() 86 of_node_put(np); of_unittest_find_node_by_name() 88 np = of_find_node_by_path("testcase-alias/missing-path"); of_unittest_find_node_by_name() 89 unittest(!np, "non-existent alias with relative path returned node %s\n", np->full_name); of_unittest_find_node_by_name() 90 of_node_put(np); of_unittest_find_node_by_name() 92 np = of_find_node_opts_by_path("/testcase-data:testoption", &options); of_unittest_find_node_by_name() 93 unittest(np && !strcmp("testoption", options), of_unittest_find_node_by_name() 95 of_node_put(np); of_unittest_find_node_by_name() 97 np = of_find_node_opts_by_path("/testcase-data:test/option", &options); of_unittest_find_node_by_name() 98 unittest(np && !strcmp("test/option", options), of_unittest_find_node_by_name() 100 of_node_put(np); of_unittest_find_node_by_name() 102 np = of_find_node_opts_by_path("/testcase-data/testcase-device1:test/option", &options); of_unittest_find_node_by_name() 103 unittest(np && !strcmp("test/option", options), of_unittest_find_node_by_name() 105 of_node_put(np); of_unittest_find_node_by_name() 107 np = of_find_node_opts_by_path("/testcase-data:testoption", NULL); of_unittest_find_node_by_name() 108 unittest(np, "NULL option path test failed\n"); of_unittest_find_node_by_name() 109 of_node_put(np); of_unittest_find_node_by_name() 111 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", of_unittest_find_node_by_name() 113 unittest(np && !strcmp("testaliasoption", options), of_unittest_find_node_by_name() 115 of_node_put(np); of_unittest_find_node_by_name() 117 np = of_find_node_opts_by_path("testcase-alias:test/alias/option", of_unittest_find_node_by_name() 119 unittest(np && !strcmp("test/alias/option", options), of_unittest_find_node_by_name() 121 of_node_put(np); of_unittest_find_node_by_name() 123 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL); of_unittest_find_node_by_name() 124 unittest(np, "NULL option alias path test failed\n"); of_unittest_find_node_by_name() 125 of_node_put(np); of_unittest_find_node_by_name() 128 np = of_find_node_opts_by_path("testcase-alias", &options); of_unittest_find_node_by_name() 129 unittest(np && !options, "option clearing test failed\n"); of_unittest_find_node_by_name() 130 of_node_put(np); of_unittest_find_node_by_name() 133 np = of_find_node_opts_by_path("/", &options); of_unittest_find_node_by_name() 134 unittest(np && !options, "option clearing root node test failed\n"); of_unittest_find_node_by_name() 135 of_node_put(np); of_unittest_find_node_by_name() 140 struct device_node *np; of_unittest_dynamic() local 143 np = of_find_node_by_path("/testcase-data"); of_unittest_dynamic() 144 if (!np) { of_unittest_dynamic() 160 unittest(of_add_property(np, prop) == 0, "Adding a new property failed\n"); of_unittest_dynamic() 167 unittest(of_add_property(np, prop) != 0, of_unittest_dynamic() 173 unittest(of_update_property(np, prop) == 0, of_unittest_dynamic() 181 unittest(of_update_property(np, prop) == 0, of_unittest_dynamic() 185 unittest(of_remove_property(np, prop) == 0, of_unittest_dynamic() 195 unittest(of_add_property(np, prop) == 0, of_unittest_dynamic() 199 static int __init of_unittest_check_node_linkage(struct device_node *np) of_unittest_check_node_linkage() argument 204 for_each_child_of_node(np, child) { for_each_child_of_node() 205 if (child->parent != np) { for_each_child_of_node() 207 child->name, np->name); for_each_child_of_node() 226 struct device_node *np; of_unittest_check_tree_linkage() local 232 for_each_of_allnodes(np) of_unittest_check_tree_linkage() 245 struct device_node *np; member in struct:node_hash 251 struct device_node *np; of_unittest_check_phandles() local 256 for_each_of_allnodes(np) { for_each_of_allnodes() 257 if (!np->phandle) for_each_of_allnodes() 260 hash_for_each_possible(phandle_ht, nh, node, np->phandle) { for_each_of_allnodes() 261 if (nh->np->phandle == np->phandle) { for_each_of_allnodes() 263 np->phandle, nh->np->full_name, np->full_name); for_each_of_allnodes() 273 nh->np = np; for_each_of_allnodes() 274 hash_add(phandle_ht, &nh->node, np->phandle); for_each_of_allnodes() 289 struct device_node *np; of_unittest_parse_phandle_with_args() local 293 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); of_unittest_parse_phandle_with_args() 294 if (!np) { of_unittest_parse_phandle_with_args() 299 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); of_unittest_parse_phandle_with_args() 305 rc = of_parse_phandle_with_args(np, "phandle-list", of_unittest_parse_phandle_with_args() 354 i, args.np->full_name, rc); of_unittest_parse_phandle_with_args() 358 rc = of_parse_phandle_with_args(np, "phandle-list-missing", of_unittest_parse_phandle_with_args() 361 rc = of_count_phandle_with_args(np, "phandle-list-missing", of_unittest_parse_phandle_with_args() 366 rc = of_parse_phandle_with_args(np, "phandle-list", of_unittest_parse_phandle_with_args() 369 rc = of_count_phandle_with_args(np, "phandle-list", of_unittest_parse_phandle_with_args() 374 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle", of_unittest_parse_phandle_with_args() 377 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle", of_unittest_parse_phandle_with_args() 382 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", of_unittest_parse_phandle_with_args() 385 rc = of_count_phandle_with_args(np, "phandle-list-bad-args", of_unittest_parse_phandle_with_args() 393 struct device_node *np; of_unittest_property_string() local 396 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); of_unittest_property_string() 397 if (!np) { of_unittest_property_string() 402 rc = of_property_match_string(np, "phandle-list-names", "first"); of_unittest_property_string() 404 rc = of_property_match_string(np, "phandle-list-names", "second"); of_unittest_property_string() 406 rc = of_property_match_string(np, "phandle-list-names", "third"); of_unittest_property_string() 408 rc = of_property_match_string(np, "phandle-list-names", "fourth"); of_unittest_property_string() 410 rc = of_property_match_string(np, "missing-property", "blah"); of_unittest_property_string() 412 rc = of_property_match_string(np, "empty-property", "blah"); of_unittest_property_string() 414 rc = of_property_match_string(np, "unterminated-string", "blah"); of_unittest_property_string() 418 rc = of_property_count_strings(np, "string-property"); of_unittest_property_string() 420 rc = of_property_count_strings(np, "phandle-list-names"); of_unittest_property_string() 422 rc = of_property_count_strings(np, "unterminated-string"); of_unittest_property_string() 424 rc = of_property_count_strings(np, "unterminated-string-list"); of_unittest_property_string() 428 rc = of_property_read_string_index(np, "string-property", 0, strings); of_unittest_property_string() 431 rc = of_property_read_string_index(np, "string-property", 1, strings); of_unittest_property_string() 433 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); of_unittest_property_string() 435 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); of_unittest_property_string() 437 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); of_unittest_property_string() 440 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); of_unittest_property_string() 443 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); of_unittest_property_string() 445 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); of_unittest_property_string() 448 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ of_unittest_property_string() 453 rc = of_property_read_string_array(np, "string-property", strings, 4); of_unittest_property_string() 455 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); of_unittest_property_string() 457 rc = of_property_read_string_array(np, "unterminated-string", strings, 4); of_unittest_property_string() 460 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); of_unittest_property_string() 464 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); of_unittest_property_string() 467 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); of_unittest_property_string() 502 struct device_node *n1, *n2, *n21, *nremove, *parent, *np; of_unittest_changeset() local 538 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), of_unittest_changeset() 540 of_node_put(np); of_unittest_changeset() 552 struct device_node *np; of_unittest_parse_interrupts() local 556 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); of_unittest_parse_interrupts() 557 if (!np) { of_unittest_parse_interrupts() 566 rc = of_irq_parse_one(np, i, &args); of_unittest_parse_interrupts() 573 i, args.np->full_name, rc); of_unittest_parse_interrupts() 575 of_node_put(np); of_unittest_parse_interrupts() 577 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); of_unittest_parse_interrupts() 578 if (!np) { of_unittest_parse_interrupts() 587 rc = of_irq_parse_one(np, i, &args); of_unittest_parse_interrupts() 619 i, args.np->full_name, rc); of_unittest_parse_interrupts() 621 of_node_put(np); of_unittest_parse_interrupts() 626 struct device_node *np; of_unittest_parse_interrupts_extended() local 630 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); of_unittest_parse_interrupts_extended() 631 if (!np) { of_unittest_parse_interrupts_extended() 639 rc = of_irq_parse_one(np, i, &args); of_unittest_parse_interrupts_extended() 689 i, args.np->full_name, rc); of_unittest_parse_interrupts_extended() 691 of_node_put(np); of_unittest_parse_interrupts_extended() 731 struct device_node *np; of_unittest_match_node() local 736 np = of_find_node_by_path(match_node_tests[i].path); of_unittest_match_node() 737 if (!np) { of_unittest_match_node() 743 match = of_match_node(match_node_table, np); of_unittest_match_node() 766 struct device_node *np, *child, *grandchild; of_unittest_platform_populate() local 773 np = of_find_node_by_path("/testcase-data"); of_unittest_platform_populate() 774 of_platform_populate(np, of_default_bus_match_table, NULL, NULL); of_unittest_platform_populate() 777 np = of_find_node_by_path("/testcase-data/testcase-device1"); of_unittest_platform_populate() 778 pdev = of_find_device_by_node(np); of_unittest_platform_populate() 785 np = of_find_node_by_path("/testcase-data/testcase-device2"); of_unittest_platform_populate() 786 pdev = of_find_device_by_node(np); of_unittest_platform_populate() 791 np = of_find_node_by_path("/testcase-data/platform-tests"); of_unittest_platform_populate() 792 unittest(np, "No testcase data in device tree\n"); of_unittest_platform_populate() 793 if (!np) of_unittest_platform_populate() 801 test_bus->dev.of_node = np; of_unittest_platform_populate() 803 of_platform_populate(np, match, NULL, &test_bus->dev); for_each_child_of_node() 804 for_each_child_of_node(np, child) { for_each_child_of_node() 812 for_each_child_of_node(np, child) { for_each_child_of_node() 820 of_node_put(np); 825 * of np into dup node (present in live tree) and 826 * updates parent of children of np to dup. 828 * @np: node already present in live tree 831 static void update_node_properties(struct device_node *np, update_node_properties() argument 837 for_each_property_of_node(np, prop) update_node_properties() 840 for_each_child_of_node(np, child) update_node_properties() 848 * @np: Node to attach to live tree 850 static int attach_node_and_children(struct device_node *np) attach_node_and_children() argument 855 dup = of_find_node_by_path(np->full_name); attach_node_and_children() 857 update_node_properties(np, dup); attach_node_and_children() 861 child = np->child; attach_node_and_children() 862 np->child = NULL; attach_node_and_children() 866 np->sibling = np->parent->child; attach_node_and_children() 867 np->parent->child = np; attach_node_and_children() 868 of_node_clear_flag(np, OF_DETACHED); attach_node_and_children() 871 __of_attach_node_sysfs(np); attach_node_and_children() 890 struct device_node *unittest_data_node, *np; unittest_data_add() local 928 for_each_of_allnodes(np) unittest_data_add() 929 __of_attach_node_sysfs(np); unittest_data_add() 936 np = unittest_data_node->child; unittest_data_add() 937 while (np) { unittest_data_add() 938 struct device_node *next = np->sibling; unittest_data_add() 940 np->parent = of_root; unittest_data_add() 941 attach_node_and_children(np); unittest_data_add() 942 np = next; unittest_data_add() 952 struct device_node *np = dev->of_node; unittest_probe() local 954 if (np == NULL) { unittest_probe() 960 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); unittest_probe() 962 of_platform_populate(np, NULL, NULL, &pdev->dev); unittest_probe() 970 struct device_node *np = dev->of_node; unittest_remove() local 972 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); unittest_remove() 993 struct device_node *np; of_path_to_platform_device() local 996 np = of_find_node_by_path(path); of_path_to_platform_device() 997 if (np == NULL) of_path_to_platform_device() 1000 pdev = of_find_device_by_node(np); of_path_to_platform_device() 1001 of_node_put(np); of_path_to_platform_device() 1021 struct device_node *np; of_path_to_i2c_client() local 1024 np = of_find_node_by_path(path); of_path_to_i2c_client() 1025 if (np == NULL) of_path_to_i2c_client() 1028 client = of_find_i2c_device_by_node(np); of_path_to_i2c_client() 1029 of_node_put(np); of_path_to_i2c_client() 1173 struct device_node *np = NULL; of_unittest_apply_overlay() local 1176 np = of_find_node_by_path(overlay_path(overlay_nr)); of_unittest_apply_overlay() 1177 if (np == NULL) { of_unittest_apply_overlay() 1184 ret = of_overlay_create(np); of_unittest_apply_overlay() 1196 of_node_put(np); of_unittest_apply_overlay() 1370 struct device_node *np; of_unittest_overlay_6() local 1391 np = of_find_node_by_path(overlay_path(overlay_nr + i)); of_unittest_overlay_6() 1392 if (np == NULL) { of_unittest_overlay_6() 1398 ret = of_overlay_create(np); of_unittest_overlay_6() 1452 struct device_node *np; of_unittest_overlay_8() local 1461 np = of_find_node_by_path(overlay_path(overlay_nr + i)); of_unittest_overlay_8() 1462 if (np == NULL) { of_unittest_overlay_8() 1468 ret = of_overlay_create(np); of_unittest_overlay_8() 1570 struct device_node *np = dev->of_node; unittest_i2c_bus_probe() local 1575 if (np == NULL) { unittest_i2c_bus_probe() 1581 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); unittest_i2c_bus_probe() 1616 struct device_node *np = dev->of_node; unittest_i2c_bus_remove() local 1619 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); unittest_i2c_bus_remove() 1643 struct device_node *np = client->dev.of_node; unittest_i2c_dev_probe() local 1645 if (!np) { unittest_i2c_dev_probe() 1650 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); unittest_i2c_dev_probe() 1658 struct device_node *np = client->dev.of_node; unittest_i2c_dev_remove() local 1660 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); unittest_i2c_dev_remove() 1697 struct device_node *np = client->dev.of_node, *child; unittest_i2c_mux_probe() local 1701 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); unittest_i2c_mux_probe() 1703 if (!np) { unittest_i2c_mux_probe() 1709 for_each_child_of_node(np, child) { for_each_child_of_node() 1748 struct device_node *np = client->dev.of_node; unittest_i2c_mux_remove() local 1752 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); unittest_i2c_mux_remove() 1931 struct device_node *np; of_unittest() local 1941 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); of_unittest() 1942 if (!np) { of_unittest() 1946 of_node_put(np); of_unittest()
|
H A D | of_private.h | 19 * @np: Pointer to device_node that the alias stands for 29 struct device_node *np; member in struct:alias_prop 45 extern int of_property_notify(int action, struct device_node *np, 49 static inline int of_property_notify(int action, struct device_node *np, of_property_notify() argument 64 __printf(2, 3) struct device_node *__of_node_dup(const struct device_node *np, const char *fmt, ...); 66 extern const void *__of_get_property(const struct device_node *np, 68 extern int __of_add_property(struct device_node *np, struct property *prop); 69 extern int __of_add_property_sysfs(struct device_node *np, 71 extern int __of_remove_property(struct device_node *np, struct property *prop); 72 extern void __of_remove_property_sysfs(struct device_node *np, 74 extern int __of_update_property(struct device_node *np, 76 extern void __of_update_property_sysfs(struct device_node *np, 79 extern void __of_attach_node(struct device_node *np); 80 extern int __of_attach_node_sysfs(struct device_node *np); 81 extern void __of_detach_node(struct device_node *np); 82 extern void __of_detach_node_sysfs(struct device_node *np);
|
H A D | of_mtd.c | 30 * @np: Pointer to the given device_node 35 int of_get_nand_ecc_mode(struct device_node *np) of_get_nand_ecc_mode() argument 40 err = of_property_read_string(np, "nand-ecc-mode", &pm); of_get_nand_ecc_mode() 55 * @np: Pointer to the given device_node 59 int of_get_nand_ecc_step_size(struct device_node *np) of_get_nand_ecc_step_size() argument 64 ret = of_property_read_u32(np, "nand-ecc-step-size", &val); of_get_nand_ecc_step_size() 72 * @np: Pointer to the given device_node 76 int of_get_nand_ecc_strength(struct device_node *np) of_get_nand_ecc_strength() argument 81 ret = of_property_read_u32(np, "nand-ecc-strength", &val); of_get_nand_ecc_strength() 88 * @np: Pointer to the given device_node 92 int of_get_nand_bus_width(struct device_node *np) of_get_nand_bus_width() argument 96 if (of_property_read_u32(np, "nand-bus-width", &val)) of_get_nand_bus_width() 111 * @np: Pointer to the given device_node 115 bool of_get_nand_on_flash_bbt(struct device_node *np) of_get_nand_on_flash_bbt() argument 117 return of_property_read_bool(np, "nand-on-flash-bbt"); of_get_nand_on_flash_bbt()
|
H A D | dynamic.c | 44 void __of_detach_node_sysfs(struct device_node *np) __of_detach_node_sysfs() argument 51 BUG_ON(!of_node_is_initialized(np)); __of_detach_node_sysfs() 56 if (of_node_is_attached(np)) { __of_detach_node_sysfs() 57 for_each_property_of_node(np, pp) __of_detach_node_sysfs() 58 sysfs_remove_bin_file(&np->kobj, &pp->attr); __of_detach_node_sysfs() 59 kobject_del(&np->kobj); __of_detach_node_sysfs() 63 of_node_put(np); __of_detach_node_sysfs() 202 int of_property_notify(int action, struct device_node *np, of_property_notify() argument 208 if (!of_node_is_attached(np)) of_property_notify() 211 pr.dn = np; of_property_notify() 217 void __of_attach_node(struct device_node *np) __of_attach_node() argument 222 np->name = __of_get_property(np, "name", NULL) ? : "<NULL>"; __of_attach_node() 223 np->type = __of_get_property(np, "device_type", NULL) ? : "<NULL>"; __of_attach_node() 225 phandle = __of_get_property(np, "phandle", &sz); __of_attach_node() 227 phandle = __of_get_property(np, "linux,phandle", &sz); __of_attach_node() 229 phandle = __of_get_property(np, "ibm,phandle", &sz); __of_attach_node() 230 np->phandle = (phandle && (sz >= 4)) ? be32_to_cpup(phandle) : 0; __of_attach_node() 232 np->child = NULL; __of_attach_node() 233 np->sibling = np->parent->child; __of_attach_node() 234 np->parent->child = np; __of_attach_node() 235 of_node_clear_flag(np, OF_DETACHED); __of_attach_node() 241 int of_attach_node(struct device_node *np) of_attach_node() argument 247 rd.dn = np; of_attach_node() 251 __of_attach_node(np); of_attach_node() 254 __of_attach_node_sysfs(np); of_attach_node() 262 void __of_detach_node(struct device_node *np) __of_detach_node() argument 266 if (WARN_ON(of_node_check_flag(np, OF_DETACHED))) __of_detach_node() 269 parent = np->parent; __of_detach_node() 273 if (parent->child == np) __of_detach_node() 274 parent->child = np->sibling; __of_detach_node() 277 for (prevsib = np->parent->child; __of_detach_node() 278 prevsib->sibling != np; __of_detach_node() 281 prevsib->sibling = np->sibling; __of_detach_node() 284 of_node_set_flag(np, OF_DETACHED); __of_detach_node() 293 int of_detach_node(struct device_node *np) of_detach_node() argument 300 rd.dn = np; of_detach_node() 304 __of_detach_node(np); of_detach_node() 307 __of_detach_node_sysfs(np); of_detach_node() 406 struct device_node *__of_node_dup(const struct device_node *np, const char *fmt, ...) __of_node_dup() argument 427 if (np) { __of_node_dup() 429 for_each_property_of_node(np, pp) { for_each_property_of_node() 450 of_node_put(ce->np); __of_changeset_entry_destroy() 463 ce->np->full_name, ce->prop->name); __of_changeset_entry_dump() 468 ce->np->full_name); __of_changeset_entry_dump() 519 rd.dn = ce->np; __of_changeset_entry_notify() 525 ret = of_property_notify(ce->action, ce->np, ce->prop, ce->old_prop); __of_changeset_entry_notify() 534 pr_err("%s: notifier error @%s\n", __func__, ce->np->full_name); __of_changeset_entry_notify() 548 __of_attach_node(ce->np); __of_changeset_entry_apply() 551 __of_detach_node(ce->np); __of_changeset_entry_apply() 555 for (propp = &ce->np->deadprops; *propp; propp = &(*propp)->next) { __of_changeset_entry_apply() 563 ret = __of_add_property(ce->np, ce->prop); __of_changeset_entry_apply() 566 __func__, ce->np->full_name, __of_changeset_entry_apply() 572 ret = __of_remove_property(ce->np, ce->prop); __of_changeset_entry_apply() 575 __func__, ce->np->full_name, __of_changeset_entry_apply() 583 for (propp = &ce->np->deadprops; *propp; propp = &(*propp)->next) { __of_changeset_entry_apply() 591 ret = __of_update_property(ce->np, ce->prop, &old_prop); __of_changeset_entry_apply() 594 __func__, ce->np->full_name, __of_changeset_entry_apply() 609 __of_attach_node_sysfs(ce->np); __of_changeset_entry_apply() 612 __of_detach_node_sysfs(ce->np); __of_changeset_entry_apply() 616 __of_add_property_sysfs(ce->np, ce->prop); __of_changeset_entry_apply() 619 __of_remove_property_sysfs(ce->np, ce->prop); __of_changeset_entry_apply() 622 __of_update_property_sysfs(ce->np, ce->prop, ce->old_prop); __of_changeset_entry_apply() 749 * @np: Pointer to device node 761 struct device_node *np, struct property *prop) of_changeset_action() 772 ce->np = of_node_get(np); of_changeset_action() 776 ce->old_prop = of_find_property(np, prop->name, NULL); of_changeset_action() 760 of_changeset_action(struct of_changeset *ocs, unsigned long action, struct device_node *np, struct property *prop) of_changeset_action() argument
|
H A D | of_net.c | 16 * @np: Pointer to the given device_node 22 int of_get_phy_mode(struct device_node *np) of_get_phy_mode() argument 27 err = of_property_read_string(np, "phy-mode", &pm); of_get_phy_mode() 29 err = of_property_read_string(np, "phy-connection-type", &pm); of_get_phy_mode() 41 static const void *of_get_mac_addr(struct device_node *np, const char *name) of_get_mac_addr() argument 43 struct property *pp = of_find_property(np, name, NULL); of_get_mac_addr() 68 const void *of_get_mac_address(struct device_node *np) of_get_mac_address() argument 72 addr = of_get_mac_addr(np, "mac-address"); of_get_mac_address() 76 addr = of_get_mac_addr(np, "local-mac-address"); of_get_mac_address() 80 return of_get_mac_addr(np, "address"); of_get_mac_address()
|
H A D | base.c | 57 int of_n_addr_cells(struct device_node *np) of_n_addr_cells() argument 62 if (np->parent) of_n_addr_cells() 63 np = np->parent; of_n_addr_cells() 64 ip = of_get_property(np, "#address-cells", NULL); of_n_addr_cells() 67 } while (np->parent); of_n_addr_cells() 73 int of_n_size_cells(struct device_node *np) of_n_size_cells() argument 78 if (np->parent) of_n_size_cells() 79 np = np->parent; of_n_size_cells() 80 ip = of_get_property(np, "#size-cells", NULL); of_n_size_cells() 83 } while (np->parent); of_n_size_cells() 90 int __weak of_node_to_nid(struct device_node *np) of_node_to_nid() argument 135 int __of_add_property_sysfs(struct device_node *np, struct property *pp) __of_add_property_sysfs() argument 145 if (!of_kset || !of_node_is_attached(np)) __of_add_property_sysfs() 149 pp->attr.attr.name = safe_name(&np->kobj, pp->name); __of_add_property_sysfs() 154 rc = sysfs_create_bin_file(&np->kobj, &pp->attr); __of_add_property_sysfs() 155 WARN(rc, "error adding attribute %s to node %s\n", pp->name, np->full_name); __of_add_property_sysfs() 159 int __of_attach_node_sysfs(struct device_node *np) __of_attach_node_sysfs() argument 171 np->kobj.kset = of_kset; __of_attach_node_sysfs() 172 if (!np->parent) { __of_attach_node_sysfs() 174 rc = kobject_add(&np->kobj, NULL, "%s", __of_attach_node_sysfs() 177 name = safe_name(&np->parent->kobj, kbasename(np->full_name)); __of_attach_node_sysfs() 181 rc = kobject_add(&np->kobj, &np->parent->kobj, "%s", name); __of_attach_node_sysfs() 186 for_each_property_of_node(np, pp) __of_attach_node_sysfs() 187 __of_add_property_sysfs(np, pp); __of_attach_node_sysfs() 194 struct device_node *np; of_core_init() local 204 for_each_of_allnodes(np) of_core_init() 205 __of_attach_node_sysfs(np); of_core_init() 213 static struct property *__of_find_property(const struct device_node *np, __of_find_property() argument 218 if (!np) __of_find_property() 221 for (pp = np->properties; pp; pp = pp->next) { __of_find_property() 232 struct property *of_find_property(const struct device_node *np, of_find_property() argument 240 pp = __of_find_property(np, name, lenp); of_find_property() 249 struct device_node *np; __of_find_all_nodes() local 251 np = of_root; __of_find_all_nodes() 253 np = prev->child; __of_find_all_nodes() 256 np = prev; __of_find_all_nodes() 257 while (np->parent && !np->sibling) __of_find_all_nodes() 258 np = np->parent; __of_find_all_nodes() 259 np = np->sibling; /* Might be null at the end of the tree */ __of_find_all_nodes() 261 return np; __of_find_all_nodes() 274 struct device_node *np; of_find_all_nodes() local 278 np = __of_find_all_nodes(prev); of_find_all_nodes() 279 of_node_get(np); of_find_all_nodes() 282 return np; of_find_all_nodes() 290 const void *__of_get_property(const struct device_node *np, __of_get_property() argument 293 struct property *pp = __of_find_property(np, name, lenp); __of_get_property() 302 const void *of_get_property(const struct device_node *np, const char *name, of_get_property() argument 305 struct property *pp = of_find_property(np, name, lenp); of_get_property() 597 struct device_node *np; of_get_parent() local 604 np = of_node_get(node->parent); of_get_parent() 606 return np; of_get_parent() 773 struct device_node *np = NULL; of_find_node_opts_by_path() local 799 np = of_find_node_by_path(pp->value); for_each_property_of_node() 803 if (!np) 810 if (!np) 811 np = of_node_get(of_root); 812 while (np && *path == '/') { 814 np = __of_find_node_by_path(np, path); 820 return np; 838 struct device_node *np; of_find_node_by_name() local 842 for_each_of_allnodes_from(from, np) of_find_node_by_name() 843 if (np->name && (of_node_cmp(np->name, name) == 0) of_find_node_by_name() 844 && of_node_get(np)) of_find_node_by_name() 848 return np; of_find_node_by_name() 867 struct device_node *np; of_find_node_by_type() local 871 for_each_of_allnodes_from(from, np) of_find_node_by_type() 872 if (np->type && (of_node_cmp(np->type, type) == 0) of_find_node_by_type() 873 && of_node_get(np)) of_find_node_by_type() 877 return np; of_find_node_by_type() 898 struct device_node *np; of_find_compatible_node() local 902 for_each_of_allnodes_from(from, np) of_find_compatible_node() 903 if (__of_device_is_compatible(np, compatible, type, NULL) && of_find_compatible_node() 904 of_node_get(np)) of_find_compatible_node() 908 return np; of_find_compatible_node() 927 struct device_node *np; of_find_node_with_property() local 932 for_each_of_allnodes_from(from, np) { for_each_of_allnodes_from() 933 for (pp = np->properties; pp; pp = pp->next) { for_each_of_allnodes_from() 935 of_node_get(np); for_each_of_allnodes_from() 943 return np; 1006 struct device_node *np; of_find_matching_node_and_match() local 1014 for_each_of_allnodes_from(from, np) { for_each_of_allnodes_from() 1015 m = __of_match_node(matches, np); for_each_of_allnodes_from() 1016 if (m && of_node_get(np)) { for_each_of_allnodes_from() 1024 return np; 1064 struct device_node *np; of_find_node_by_phandle() local 1071 for_each_of_allnodes(np) of_find_node_by_phandle() 1072 if (np->phandle == handle) of_find_node_by_phandle() 1074 of_node_get(np); of_find_node_by_phandle() 1076 return np; of_find_node_by_phandle() 1083 * @np: device node from which the property value is to be read. 1092 int of_property_count_elems_of_size(const struct device_node *np, of_property_count_elems_of_size() argument 1095 struct property *prop = of_find_property(np, propname, NULL); of_property_count_elems_of_size() 1104 propname, np->full_name, elem_size); of_property_count_elems_of_size() 1115 * @np: device node from which the property value is to be read. 1125 static void *of_find_property_value_of_size(const struct device_node *np, of_find_property_value_of_size() argument 1128 struct property *prop = of_find_property(np, propname, NULL); of_find_property_value_of_size() 1143 * @np: device node from which the property value is to be read. 1155 int of_property_read_u32_index(const struct device_node *np, of_property_read_u32_index() argument 1159 const u32 *val = of_find_property_value_of_size(np, propname, of_property_read_u32_index() 1173 * @np: device node from which the property value is to be read. 1188 int of_property_read_u8_array(const struct device_node *np, of_property_read_u8_array() argument 1191 const u8 *val = of_find_property_value_of_size(np, propname, of_property_read_u8_array() 1206 * @np: device node from which the property value is to be read. 1221 int of_property_read_u16_array(const struct device_node *np, of_property_read_u16_array() argument 1224 const __be16 *val = of_find_property_value_of_size(np, propname, of_property_read_u16_array() 1240 * @np: device node from which the property value is to be read. 1252 int of_property_read_u32_array(const struct device_node *np, of_property_read_u32_array() argument 1256 const __be32 *val = of_find_property_value_of_size(np, propname, of_property_read_u32_array() 1270 * @np: device node from which the property value is to be read. 1281 int of_property_read_u64(const struct device_node *np, const char *propname, of_property_read_u64() argument 1284 const __be32 *val = of_find_property_value_of_size(np, propname, of_property_read_u64() 1299 * @np: device node from which the property value is to be read. 1311 int of_property_read_u64_array(const struct device_node *np, of_property_read_u64_array() argument 1315 const __be32 *val = of_find_property_value_of_size(np, propname, of_property_read_u64_array() 1331 * @np: device node from which the property value is to be read. 1344 int of_property_read_string(struct device_node *np, const char *propname, of_property_read_string() argument 1347 struct property *prop = of_find_property(np, propname, NULL); of_property_read_string() 1361 * @np: pointer to node containing string list property 1368 int of_property_match_string(struct device_node *np, const char *propname, of_property_match_string() argument 1371 struct property *prop = of_find_property(np, propname, NULL); of_property_match_string() 1398 * @np: device node from which the property value is to be read. 1407 int of_property_read_string_helper(struct device_node *np, const char *propname, of_property_read_string_helper() argument 1410 struct property *prop = of_find_property(np, propname, NULL); of_property_read_string_helper() 1436 printk("%s %s", msg, of_node_full_name(args->np)); of_print_phandle_args() 1442 static int __of_parse_phandle_with_args(const struct device_node *np, __of_parse_phandle_with_args() argument 1455 list = of_get_property(np, list_name, &size); __of_parse_phandle_with_args() 1484 np->full_name); __of_parse_phandle_with_args() 1493 np->full_name, cells_name, __of_parse_phandle_with_args() 1507 np->full_name); __of_parse_phandle_with_args() 1527 out_args->np = node; __of_parse_phandle_with_args() 1560 * @np: Pointer to device node holding phandle property 1568 struct device_node *of_parse_phandle(const struct device_node *np, of_parse_phandle() argument 1576 if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, of_parse_phandle() 1580 return args.np; of_parse_phandle() 1586 * @np: pointer to a device tree node containing a list 1596 * Caller is responsible to call of_node_put() on the returned out_args->np 1616 int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, of_parse_phandle_with_args() argument 1622 return __of_parse_phandle_with_args(np, list_name, cells_name, 0, of_parse_phandle_with_args() 1629 * @np: pointer to a device tree node containing a list 1639 * Caller is responsible to call of_node_put() on the returned out_args->np 1657 int of_parse_phandle_with_fixed_args(const struct device_node *np, of_parse_phandle_with_fixed_args() argument 1663 return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, of_parse_phandle_with_fixed_args() 1670 * @np: pointer to a device tree node containing a list 1683 int of_count_phandle_with_args(const struct device_node *np, const char *list_name, of_count_phandle_with_args() argument 1686 return __of_parse_phandle_with_args(np, list_name, cells_name, 0, -1, of_count_phandle_with_args() 1694 int __of_add_property(struct device_node *np, struct property *prop) __of_add_property() argument 1699 next = &np->properties; __of_add_property() 1715 int of_add_property(struct device_node *np, struct property *prop) of_add_property() argument 1723 rc = __of_add_property(np, prop); of_add_property() 1727 __of_add_property_sysfs(np, prop); of_add_property() 1732 of_property_notify(OF_RECONFIG_ADD_PROPERTY, np, prop, NULL); of_add_property() 1737 int __of_remove_property(struct device_node *np, struct property *prop) __of_remove_property() argument 1741 for (next = &np->properties; *next; next = &(*next)->next) { __of_remove_property() 1750 prop->next = np->deadprops; __of_remove_property() 1751 np->deadprops = prop; __of_remove_property() 1756 void __of_remove_property_sysfs(struct device_node *np, struct property *prop) __of_remove_property_sysfs() argument 1762 if (of_kset && of_node_is_attached(np)) __of_remove_property_sysfs() 1763 sysfs_remove_bin_file(&np->kobj, &prop->attr); __of_remove_property_sysfs() 1774 int of_remove_property(struct device_node *np, struct property *prop) of_remove_property() argument 1782 rc = __of_remove_property(np, prop); of_remove_property() 1786 __of_remove_property_sysfs(np, prop); of_remove_property() 1791 of_property_notify(OF_RECONFIG_REMOVE_PROPERTY, np, prop, NULL); of_remove_property() 1796 int __of_update_property(struct device_node *np, struct property *newprop, __of_update_property() argument 1801 for (next = &np->properties; *next; next = &(*next)->next) { __of_update_property() 1811 oldprop->next = np->deadprops; __of_update_property() 1812 np->deadprops = oldprop; __of_update_property() 1822 void __of_update_property_sysfs(struct device_node *np, struct property *newprop, __of_update_property_sysfs() argument 1833 sysfs_remove_bin_file(&np->kobj, &oldprop->attr); __of_update_property_sysfs() 1834 __of_add_property_sysfs(np, newprop); __of_update_property_sysfs() 1846 int of_update_property(struct device_node *np, struct property *newprop) of_update_property() argument 1858 rc = __of_update_property(np, newprop, &oldprop); of_update_property() 1862 __of_update_property_sysfs(np, newprop, oldprop); of_update_property() 1867 of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop, oldprop); of_update_property() 1872 static void of_alias_add(struct alias_prop *ap, struct device_node *np, of_alias_add() argument 1875 ap->np = np; of_alias_add() 1881 ap->alias, ap->stem, ap->id, of_node_full_name(np)); of_alias_add() 1920 struct device_node *np; for_each_property_of_node() local 1930 np = of_find_node_by_path(pp->value); for_each_property_of_node() 1931 if (!np) for_each_property_of_node() 1949 of_alias_add(ap, np, id, start, len); for_each_property_of_node() 1955 * @np: Pointer to the given device_node 1961 int of_alias_get_id(struct device_node *np, const char *stem) of_alias_get_id() argument 1971 if (np == app->np) { of_alias_get_id() 2070 * @np: node of type "cpu" or "cache" 2074 * to np. 2076 struct device_node *of_find_next_cache_node(const struct device_node *np) of_find_next_cache_node() argument 2081 handle = of_get_property(np, "l2-cache", NULL); of_find_next_cache_node() 2083 handle = of_get_property(np, "next-level-cache", NULL); of_find_next_cache_node() 2091 if (!strcmp(np->type, "cpu")) of_find_next_cache_node() 2092 for_each_child_of_node(np, child) of_find_next_cache_node() 2274 struct device_node *np; of_graph_get_remote_port_parent() local 2278 np = of_parse_phandle(node, "remote-endpoint", 0); of_graph_get_remote_port_parent() 2281 for (depth = 3; depth && np; depth--) { of_graph_get_remote_port_parent() 2282 np = of_get_next_parent(np); of_graph_get_remote_port_parent() 2283 if (depth == 2 && of_node_cmp(np->name, "ports")) of_graph_get_remote_port_parent() 2286 return np; of_graph_get_remote_port_parent() 2299 struct device_node *np; of_graph_get_remote_port() local 2302 np = of_parse_phandle(node, "remote-endpoint", 0); of_graph_get_remote_port() 2303 if (!np) of_graph_get_remote_port() 2305 return of_get_next_parent(np); of_graph_get_remote_port()
|
H A D | of_mdio.c | 95 int of_mdio_parse_addr(struct device *dev, const struct device_node *np) of_mdio_parse_addr() argument 100 ret = of_property_read_u32(np, "reg", &addr); of_mdio_parse_addr() 102 dev_err(dev, "%s has invalid PHY address\n", np->full_name); of_mdio_parse_addr() 109 np->full_name, addr); of_mdio_parse_addr() 120 * @np: pointer to device_node of MDIO bus. 123 * for each child node of @np. 125 int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) of_mdiobus_register() argument 141 mdio->dev.of_node = np; of_mdiobus_register() 149 for_each_available_child_of_node(np, child) { for_each_available_child_of_node() 165 for_each_available_child_of_node(np, child) { for_each_available_child_of_node() 286 bool of_phy_is_fixed_link(struct device_node *np) of_phy_is_fixed_link() argument 293 dn = of_get_child_by_name(np, "fixed-link"); of_phy_is_fixed_link() 299 err = of_property_read_string(np, "managed", &managed); of_phy_is_fixed_link() 304 if (of_get_property(np, "fixed-link", &len) && of_phy_is_fixed_link() 312 int of_phy_register_fixed_link(struct device_node *np) of_phy_register_fixed_link() argument 322 err = of_property_read_string(np, "managed", &managed); of_phy_register_fixed_link() 326 phy = fixed_phy_register(PHY_POLL, &status, -1, np); of_phy_register_fixed_link() 332 fixed_link_node = of_get_child_by_name(np, "fixed-link"); of_phy_register_fixed_link() 348 phy = fixed_phy_register(PHY_POLL, &status, link_gpio, np); of_phy_register_fixed_link() 353 fixed_link_prop = of_get_property(np, "fixed-link", &len); of_phy_register_fixed_link() 360 phy = fixed_phy_register(PHY_POLL, &status, -1, np); of_phy_register_fixed_link()
|
/linux-4.4.14/drivers/net/ethernet/dec/tulip/ |
H A D | winbond-840.c | 332 static void free_rxtx_rings(struct netdev_private *np); 336 static void free_ringdesc(struct netdev_private *np); 364 struct netdev_private *np; w840_probe1() local 383 dev = alloc_etherdev(sizeof(*np)); w840_probe1() 402 np = netdev_priv(dev); w840_probe1() 403 np->pci_dev = pdev; w840_probe1() 404 np->chip_id = chip_idx; w840_probe1() 405 np->drv_flags = pci_id_tbl[chip_idx].drv_flags; w840_probe1() 406 spin_lock_init(&np->lock); w840_probe1() 407 np->mii_if.dev = dev; w840_probe1() 408 np->mii_if.mdio_read = mdio_read; w840_probe1() 409 np->mii_if.mdio_write = mdio_write; w840_probe1() 410 np->base_addr = ioaddr; w840_probe1() 420 np->mii_if.full_duplex = 1; w840_probe1() 427 np->mii_if.full_duplex = 1; w840_probe1() 429 if (np->mii_if.full_duplex) w840_probe1() 430 np->mii_if.force_media = 1; w840_probe1() 444 if (np->drv_flags & CanHaveMII) { w840_probe1() 449 np->phys[phy_idx++] = phy; w840_probe1() 450 np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); w840_probe1() 451 np->mii = (mdio_read(dev, phy, MII_PHYSID1) << 16)+ w840_probe1() 455 np->mii, phy, mii_status, w840_probe1() 456 np->mii_if.advertising); w840_probe1() 459 np->mii_cnt = phy_idx; w840_probe1() 460 np->mii_if.phy_id = np->phys[0]; w840_probe1() 569 struct netdev_private *np = netdev_priv(dev); mdio_read() local 570 void __iomem *mdio_addr = np->base_addr + MIICtrl; mdio_read() 599 struct netdev_private *np = netdev_priv(dev); mdio_write() local 600 void __iomem *mdio_addr = np->base_addr + MIICtrl; mdio_write() 604 if (location == 4 && phy_id == np->phys[0]) mdio_write() 605 np->mii_if.advertising = value; mdio_write() 631 struct netdev_private *np = netdev_priv(dev); netdev_open() local 632 void __iomem *ioaddr = np->base_addr; netdev_open() 633 const int irq = np->pci_dev->irq; netdev_open() 649 spin_lock_irq(&np->lock); netdev_open() 652 spin_unlock_irq(&np->lock); netdev_open() 659 init_timer(&np->timer); netdev_open() 660 np->timer.expires = jiffies + 1*HZ; netdev_open() 661 np->timer.data = (unsigned long)dev; netdev_open() 662 np->timer.function = netdev_timer; /* timer handler */ netdev_open() 663 add_timer(&np->timer); netdev_open() 674 struct netdev_private *np = netdev_priv(dev); update_link() local 678 mii_reg = mdio_read(dev, np->phys[0], MII_BMSR); update_link() 681 return np->csr6; update_link() 683 mii_reg = mdio_read(dev, np->phys[0], MII_BMSR); update_link() 689 np->phys[0]); update_link() 692 return np->csr6; update_link() 698 np->phys[0]); update_link() 702 if ((np->mii & ~0xf) == MII_DAVICOM_DM9101) { update_link() 711 mii_reg = mdio_read(dev, np->phys[0], MII_BMCR); update_link() 716 mii_reg = mdio_read(dev, np->phys[0], MII_LPA); update_link() 717 negotiated = mii_reg & np->mii_if.advertising; update_link() 722 duplex |= np->mii_if.force_media; update_link() 724 result = np->csr6 & ~0x20000200; update_link() 729 if (result != np->csr6 && debug) update_link() 733 np->phys[0]); update_link() 740 struct netdev_private *np = netdev_priv(dev); update_csr6() local 741 void __iomem *ioaddr = np->base_addr; update_csr6() 746 if (new==np->csr6) update_csr6() 749 iowrite32(np->csr6 & ~0x2002, ioaddr + NetworkConfig); update_csr6() 771 np->csr6 = new; update_csr6() 773 iowrite32(np->csr6, ioaddr + NetworkConfig); update_csr6() 775 np->mii_if.full_duplex = 1; update_csr6() 781 struct netdev_private *np = netdev_priv(dev); netdev_timer() local 782 void __iomem *ioaddr = np->base_addr; netdev_timer() 788 spin_lock_irq(&np->lock); netdev_timer() 790 spin_unlock_irq(&np->lock); netdev_timer() 791 np->timer.expires = jiffies + 10*HZ; netdev_timer() 792 add_timer(&np->timer); netdev_timer() 797 struct netdev_private *np = netdev_priv(dev); init_rxtx_rings() local 800 np->rx_head_desc = &np->rx_ring[0]; init_rxtx_rings() 801 np->tx_ring = (struct w840_tx_desc*)&np->rx_ring[RX_RING_SIZE]; init_rxtx_rings() 805 np->rx_ring[i].length = np->rx_buf_sz; init_rxtx_rings() 806 np->rx_ring[i].status = 0; init_rxtx_rings() 807 np->rx_skbuff[i] = NULL; init_rxtx_rings() 810 np->rx_ring[i-1].length |= DescEndRing; init_rxtx_rings() 814 struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz); init_rxtx_rings() 815 np->rx_skbuff[i] = skb; init_rxtx_rings() 818 np->rx_addr[i] = pci_map_single(np->pci_dev,skb->data, init_rxtx_rings() 819 np->rx_buf_sz,PCI_DMA_FROMDEVICE); init_rxtx_rings() 821 np->rx_ring[i].buffer1 = np->rx_addr[i]; init_rxtx_rings() 822 np->rx_ring[i].status = DescOwned; init_rxtx_rings() 825 np->cur_rx = 0; init_rxtx_rings() 826 np->dirty_rx = (unsigned int)(i - RX_RING_SIZE); init_rxtx_rings() 830 np->tx_skbuff[i] = NULL; init_rxtx_rings() 831 np->tx_ring[i].status = 0; init_rxtx_rings() 833 np->tx_full = 0; init_rxtx_rings() 834 np->tx_q_bytes = np->dirty_tx = np->cur_tx = 0; init_rxtx_rings() 836 iowrite32(np->ring_dma_addr, np->base_addr + RxRingPtr); init_rxtx_rings() 837 iowrite32(np->ring_dma_addr+sizeof(struct w840_rx_desc)*RX_RING_SIZE, init_rxtx_rings() 838 np->base_addr + TxRingPtr); init_rxtx_rings() 842 static void free_rxtx_rings(struct netdev_private* np) free_rxtx_rings() argument 847 np->rx_ring[i].status = 0; free_rxtx_rings() 848 if (np->rx_skbuff[i]) { free_rxtx_rings() 849 pci_unmap_single(np->pci_dev, free_rxtx_rings() 850 np->rx_addr[i], free_rxtx_rings() 851 np->rx_skbuff[i]->len, free_rxtx_rings() 853 dev_kfree_skb(np->rx_skbuff[i]); free_rxtx_rings() 855 np->rx_skbuff[i] = NULL; free_rxtx_rings() 858 if (np->tx_skbuff[i]) { free_rxtx_rings() 859 pci_unmap_single(np->pci_dev, free_rxtx_rings() 860 np->tx_addr[i], free_rxtx_rings() 861 np->tx_skbuff[i]->len, free_rxtx_rings() 863 dev_kfree_skb(np->tx_skbuff[i]); free_rxtx_rings() 865 np->tx_skbuff[i] = NULL; free_rxtx_rings() 871 struct netdev_private *np = netdev_priv(dev); init_registers() local 872 void __iomem *ioaddr = np->base_addr; init_registers() 915 np->csr6 = 0; init_registers() 929 struct netdev_private *np = netdev_priv(dev); tx_timeout() local 930 void __iomem *ioaddr = np->base_addr; tx_timeout() 931 const int irq = np->pci_dev->irq; tx_timeout() 938 printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); tx_timeout() 940 printk(KERN_CONT " %08x", (unsigned int)np->rx_ring[i].status); tx_timeout() 942 printk(KERN_DEBUG " Tx ring %p: ", np->tx_ring); tx_timeout() 944 printk(KERN_CONT " %08x", np->tx_ring[i].status); tx_timeout() 948 np->cur_tx, np->dirty_tx, np->tx_full, np->tx_q_bytes); tx_timeout() 952 spin_lock_irq(&np->lock); tx_timeout() 959 iowrite32(1, np->base_addr+PCIBusCfg); tx_timeout() 962 free_rxtx_rings(np); tx_timeout() 965 spin_unlock_irq(&np->lock); tx_timeout() 970 np->stats.tx_errors++; tx_timeout() 976 struct netdev_private *np = netdev_priv(dev); alloc_ringdesc() local 978 np->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); alloc_ringdesc() 980 np->rx_ring = pci_alloc_consistent(np->pci_dev, alloc_ringdesc() 983 &np->ring_dma_addr); alloc_ringdesc() 984 if(!np->rx_ring) alloc_ringdesc() 990 static void free_ringdesc(struct netdev_private *np) free_ringdesc() argument 992 pci_free_consistent(np->pci_dev, free_ringdesc() 995 np->rx_ring, np->ring_dma_addr); free_ringdesc() 1001 struct netdev_private *np = netdev_priv(dev); start_tx() local 1008 entry = np->cur_tx % TX_RING_SIZE; start_tx() 1010 np->tx_addr[entry] = pci_map_single(np->pci_dev, start_tx() 1012 np->tx_skbuff[entry] = skb; start_tx() 1014 np->tx_ring[entry].buffer1 = np->tx_addr[entry]; start_tx() 1016 np->tx_ring[entry].length = DescWholePkt | skb->len; start_tx() 1020 np->tx_ring[entry].buffer2 = np->tx_addr[entry]+TX_BUFLIMIT; start_tx() 1021 np->tx_ring[entry].length = DescWholePkt | (len << 11) | TX_BUFLIMIT; start_tx() 1024 np->tx_ring[entry].length |= DescEndRing; start_tx() 1028 * increasing np->cur_tx and setting DescOwned: start_tx() 1029 * - if np->cur_tx is increased first the interrupt start_tx() 1034 * since the np->cur_tx was not yet increased. start_tx() 1036 spin_lock_irq(&np->lock); start_tx() 1037 np->cur_tx++; start_tx() 1040 np->tx_ring[entry].status = DescOwned; start_tx() 1042 iowrite32(0, np->base_addr + TxStartDemand); start_tx() 1043 np->tx_q_bytes += skb->len; start_tx() 1046 if (np->cur_tx - np->dirty_tx > TX_QUEUE_LEN || start_tx() 1047 ((np->drv_flags & HasBrokenTx) && np->tx_q_bytes > TX_BUG_FIFO_LIMIT)) { start_tx() 1050 np->tx_full = 1; start_tx() 1052 spin_unlock_irq(&np->lock); start_tx() 1056 np->cur_tx, entry); start_tx() 1063 struct netdev_private *np = netdev_priv(dev); netdev_tx_done() local 1064 for (; np->cur_tx - np->dirty_tx > 0; np->dirty_tx++) { netdev_tx_done() 1065 int entry = np->dirty_tx % TX_RING_SIZE; netdev_tx_done() 1066 int tx_status = np->tx_ring[entry].status; netdev_tx_done() 1076 np->stats.tx_errors++; netdev_tx_done() 1077 if (tx_status & 0x0104) np->stats.tx_aborted_errors++; netdev_tx_done() 1078 if (tx_status & 0x0C80) np->stats.tx_carrier_errors++; netdev_tx_done() 1079 if (tx_status & 0x0200) np->stats.tx_window_errors++; netdev_tx_done() 1080 if (tx_status & 0x0002) np->stats.tx_fifo_errors++; netdev_tx_done() 1081 if ((tx_status & 0x0080) && np->mii_if.full_duplex == 0) netdev_tx_done() 1082 np->stats.tx_heartbeat_errors++; netdev_tx_done() 1089 np->stats.tx_bytes += np->tx_skbuff[entry]->len; netdev_tx_done() 1090 np->stats.collisions += (tx_status >> 3) & 15; netdev_tx_done() 1091 np->stats.tx_packets++; netdev_tx_done() 1094 pci_unmap_single(np->pci_dev,np->tx_addr[entry], netdev_tx_done() 1095 np->tx_skbuff[entry]->len, netdev_tx_done() 1097 np->tx_q_bytes -= np->tx_skbuff[entry]->len; netdev_tx_done() 1098 dev_kfree_skb_irq(np->tx_skbuff[entry]); netdev_tx_done() 1099 np->tx_skbuff[entry] = NULL; netdev_tx_done() 1101 if (np->tx_full && netdev_tx_done() 1102 np->cur_tx - np->dirty_tx < TX_QUEUE_LEN_RESTART && netdev_tx_done() 1103 np->tx_q_bytes < TX_BUG_FIFO_LIMIT) { netdev_tx_done() 1105 np->tx_full = 0; netdev_tx_done() 1116 struct netdev_private *np = netdev_priv(dev); intr_handler() local 1117 void __iomem *ioaddr = np->base_addr; intr_handler() 1143 np->cur_tx != np->dirty_tx) { intr_handler() 1144 spin_lock(&np->lock); intr_handler() 1146 spin_unlock(&np->lock); intr_handler() 1160 spin_lock(&np->lock); intr_handler() 1165 spin_unlock(&np->lock); intr_handler() 1180 struct netdev_private *np = netdev_priv(dev); netdev_rx() local 1181 int entry = np->cur_rx % RX_RING_SIZE; netdev_rx() 1182 int work_limit = np->dirty_rx + RX_RING_SIZE - np->cur_rx; netdev_rx() 1186 entry, np->rx_ring[entry].status); netdev_rx() 1191 struct w840_rx_desc *desc = np->rx_head_desc; netdev_rx() 1205 np->cur_rx, status); netdev_rx() 1206 np->stats.rx_length_errors++; netdev_rx() 1213 np->stats.rx_errors++; /* end of a packet.*/ netdev_rx() 1214 if (status & 0x0890) np->stats.rx_length_errors++; netdev_rx() 1215 if (status & 0x004C) np->stats.rx_frame_errors++; netdev_rx() 1216 if (status & 0x0002) np->stats.rx_crc_errors++; netdev_rx() 1233 pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry], netdev_rx() 1234 np->rx_skbuff[entry]->len, netdev_rx() 1236 skb_copy_to_linear_data(skb, np->rx_skbuff[entry]->data, pkt_len); netdev_rx() 1238 pci_dma_sync_single_for_device(np->pci_dev,np->rx_addr[entry], netdev_rx() 1239 np->rx_skbuff[entry]->len, netdev_rx() 1242 pci_unmap_single(np->pci_dev,np->rx_addr[entry], netdev_rx() 1243 np->rx_skbuff[entry]->len, netdev_rx() 1245 skb_put(skb = np->rx_skbuff[entry], pkt_len); netdev_rx() 1246 np->rx_skbuff[entry] = NULL; netdev_rx() 1258 np->stats.rx_packets++; netdev_rx() 1259 np->stats.rx_bytes += pkt_len; netdev_rx() 1261 entry = (++np->cur_rx) % RX_RING_SIZE; netdev_rx() 1262 np->rx_head_desc = &np->rx_ring[entry]; netdev_rx() 1266 for (; np->cur_rx - np->dirty_rx > 0; np->dirty_rx++) { netdev_rx() 1268 entry = np->dirty_rx % RX_RING_SIZE; netdev_rx() 1269 if (np->rx_skbuff[entry] == NULL) { netdev_rx() 1270 skb = netdev_alloc_skb(dev, np->rx_buf_sz); netdev_rx() 1271 np->rx_skbuff[entry] = skb; netdev_rx() 1274 np->rx_addr[entry] = pci_map_single(np->pci_dev, netdev_rx() 1276 np->rx_buf_sz, PCI_DMA_FROMDEVICE); netdev_rx() 1277 np->rx_ring[entry].buffer1 = np->rx_addr[entry]; netdev_rx() 1280 np->rx_ring[entry].status = DescOwned; netdev_rx() 1288 struct netdev_private *np = netdev_priv(dev); netdev_error() local 1289 void __iomem *ioaddr = np->base_addr; netdev_error() 1295 spin_lock(&np->lock); netdev_error() 1303 new = np->csr6 + 0x4000; netdev_error() 1305 new = (np->csr6 >> 14)&0x7f; netdev_error() 1310 new = (np->csr6 & ~(0x7F << 14)) | (new<<14); netdev_error() 1316 np->stats.rx_errors++; netdev_error() 1323 np->stats.rx_missed_errors += ioread32(ioaddr + RxMissed) & 0xffff; netdev_error() 1325 spin_unlock(&np->lock); netdev_error() 1330 struct netdev_private *np = netdev_priv(dev); get_stats() local 1331 void __iomem *ioaddr = np->base_addr; get_stats() 1334 spin_lock_irq(&np->lock); get_stats() 1336 np->stats.rx_missed_errors += ioread32(ioaddr + RxMissed) & 0xffff; get_stats() 1337 spin_unlock_irq(&np->lock); get_stats() 1339 return &np->stats; get_stats() 1345 struct netdev_private *np = netdev_priv(dev); __set_rx_mode() local 1346 void __iomem *ioaddr = np->base_addr; __set_rx_mode() 1379 struct netdev_private *np = netdev_priv(dev); set_rx_mode() local 1381 spin_lock_irq(&np->lock); set_rx_mode() 1382 update_csr6(dev, (np->csr6 & ~0x00F8) | rx_mode); set_rx_mode() 1383 spin_unlock_irq(&np->lock); set_rx_mode() 1388 struct netdev_private *np = netdev_priv(dev); netdev_get_drvinfo() local 1392 strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); netdev_get_drvinfo() 1397 struct netdev_private *np = netdev_priv(dev); netdev_get_settings() local 1400 spin_lock_irq(&np->lock); netdev_get_settings() 1401 rc = mii_ethtool_gset(&np->mii_if, cmd); netdev_get_settings() 1402 spin_unlock_irq(&np->lock); netdev_get_settings() 1409 struct netdev_private *np = netdev_priv(dev); netdev_set_settings() local 1412 spin_lock_irq(&np->lock); netdev_set_settings() 1413 rc = mii_ethtool_sset(&np->mii_if, cmd); netdev_set_settings() 1414 spin_unlock_irq(&np->lock); netdev_set_settings() 1421 struct netdev_private *np = netdev_priv(dev); netdev_nway_reset() local 1422 return mii_nway_restart(&np->mii_if); netdev_nway_reset() 1427 struct netdev_private *np = netdev_priv(dev); netdev_get_link() local 1428 return mii_link_ok(&np->mii_if); netdev_get_link() 1454 struct netdev_private *np = netdev_priv(dev); netdev_ioctl() local 1462 spin_lock_irq(&np->lock); netdev_ioctl() 1464 spin_unlock_irq(&np->lock); netdev_ioctl() 1468 spin_lock_irq(&np->lock); netdev_ioctl() 1470 spin_unlock_irq(&np->lock); netdev_ioctl() 1479 struct netdev_private *np = netdev_priv(dev); netdev_close() local 1480 void __iomem *ioaddr = np->base_addr; netdev_close() 1489 np->cur_tx, np->dirty_tx, netdev_close() 1490 np->cur_rx, np->dirty_rx); netdev_close() 1494 spin_lock_irq(&np->lock); netdev_close() 1498 spin_unlock_irq(&np->lock); netdev_close() 1500 free_irq(np->pci_dev->irq, dev); netdev_close() 1505 np->stats.rx_missed_errors += ioread32(ioaddr + RxMissed) & 0xffff; netdev_close() 1511 printk(KERN_DEBUG" Tx ring at %p:\n", np->tx_ring); netdev_close() 1514 i, np->tx_ring[i].length, netdev_close() 1515 np->tx_ring[i].status, np->tx_ring[i].buffer1); netdev_close() 1516 printk(KERN_DEBUG " Rx ring %p:\n", np->rx_ring); netdev_close() 1519 i, np->rx_ring[i].length, netdev_close() 1520 np->rx_ring[i].status, np->rx_ring[i].buffer1); netdev_close() 1525 del_timer_sync(&np->timer); netdev_close() 1527 free_rxtx_rings(np); netdev_close() 1528 free_ringdesc(np); netdev_close() 1538 struct netdev_private *np = netdev_priv(dev); w840_remove1() local 1541 pci_iounmap(pdev, np->base_addr); w840_remove1() 1553 * spin_lock_irq(np->lock), doesn't touch hw if not present 1574 struct netdev_private *np = netdev_priv(dev); w840_suspend() local 1575 void __iomem *ioaddr = np->base_addr; w840_suspend() 1579 del_timer_sync(&np->timer); w840_suspend() 1581 spin_lock_irq(&np->lock); w840_suspend() 1585 spin_unlock_irq(&np->lock); w840_suspend() 1587 synchronize_irq(np->pci_dev->irq); w840_suspend() 1590 np->stats.rx_missed_errors += ioread32(ioaddr + RxMissed) & 0xffff; w840_suspend() 1594 BUG_ON(np->csr6 || ioread32(ioaddr + IntrEnable)); w840_suspend() 1598 free_rxtx_rings(np); w840_suspend() 1609 struct netdev_private *np = netdev_priv(dev); w840_resume() local 1621 spin_lock_irq(&np->lock); w840_resume() 1622 iowrite32(1, np->base_addr+PCIBusCfg); w840_resume() 1623 ioread32(np->base_addr+PCIBusCfg); w840_resume() 1628 spin_unlock_irq(&np->lock); w840_resume() 1632 mod_timer(&np->timer, jiffies + 1*HZ); w840_resume()
|
/linux-4.4.14/drivers/net/ethernet/adaptec/ |
H A D | starfire.c | 600 struct netdev_private *np = netdev_priv(dev); netdev_vlan_rx_add_vid() local 602 spin_lock(&np->lock); netdev_vlan_rx_add_vid() 605 set_bit(vid, np->active_vlans); netdev_vlan_rx_add_vid() 607 spin_unlock(&np->lock); netdev_vlan_rx_add_vid() 615 struct netdev_private *np = netdev_priv(dev); netdev_vlan_rx_kill_vid() local 617 spin_lock(&np->lock); netdev_vlan_rx_kill_vid() 620 clear_bit(vid, np->active_vlans); netdev_vlan_rx_kill_vid() 622 spin_unlock(&np->lock); netdev_vlan_rx_kill_vid() 650 struct netdev_private *np; starfire_init_one() local 675 dev = alloc_etherdev(sizeof(*np)); starfire_init_one() 743 np = netdev_priv(dev); starfire_init_one() 744 np->dev = dev; starfire_init_one() 745 np->base = base; starfire_init_one() 746 spin_lock_init(&np->lock); starfire_init_one() 749 np->pci_dev = pdev; starfire_init_one() 751 np->mii_if.dev = dev; starfire_init_one() 752 np->mii_if.mdio_read = mdio_read; starfire_init_one() 753 np->mii_if.mdio_write = mdio_write; starfire_init_one() 754 np->mii_if.phy_id_mask = 0x1f; starfire_init_one() 755 np->mii_if.reg_num_mask = 0x1f; starfire_init_one() 759 np->speed100 = 1; starfire_init_one() 762 np->intr_timer_ctrl = (((intr_latency * 10) / 1024) & IntrLatencyMask) | starfire_init_one() 766 np->intr_timer_ctrl |= SmallFrameBypass; starfire_init_one() 769 np->intr_timer_ctrl |= SmallFrame64; starfire_init_one() 772 np->intr_timer_ctrl |= SmallFrame128; starfire_init_one() 775 np->intr_timer_ctrl |= SmallFrame256; starfire_init_one() 778 np->intr_timer_ctrl |= SmallFrame512; starfire_init_one() 789 netif_napi_add(dev, &np->napi, netdev_poll, max_interrupt_work); starfire_init_one() 817 np->phys[phy_idx++] = phy; starfire_init_one() 818 np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); starfire_init_one() 821 dev->name, phy, mii_status, np->mii_if.advertising); starfire_init_one() 826 np->phy_cnt = phy_idx; starfire_init_one() 827 if (np->phy_cnt > 0) starfire_init_one() 828 np->mii_if.phy_id = np->phys[0]; starfire_init_one() 830 memset(&np->mii_if, 0, sizeof(np->mii_if)); starfire_init_one() 850 struct netdev_private *np = netdev_priv(dev); mdio_read() local 851 void __iomem *mdio_addr = np->base + MIICtrl + (phy_id<<7) + (location<<2); mdio_read() 867 struct netdev_private *np = netdev_priv(dev); mdio_write() local 868 void __iomem *mdio_addr = np->base + MIICtrl + (phy_id<<7) + (location<<2); mdio_write() 878 struct netdev_private *np = netdev_priv(dev); netdev_open() local 879 void __iomem *ioaddr = np->base; netdev_open() 880 const int irq = np->pci_dev->irq; netdev_open() 899 if (!np->queue_mem) { netdev_open() 904 np->queue_mem_size = tx_done_q_size + rx_done_q_size + tx_ring_size + rx_ring_size; netdev_open() 905 np->queue_mem = pci_alloc_consistent(np->pci_dev, np->queue_mem_size, &np->queue_mem_dma); netdev_open() 906 if (np->queue_mem == NULL) { netdev_open() 911 np->tx_done_q = np->queue_mem; netdev_open() 912 np->tx_done_q_dma = np->queue_mem_dma; netdev_open() 913 np->rx_done_q = (void *) np->tx_done_q + tx_done_q_size; netdev_open() 914 np->rx_done_q_dma = np->tx_done_q_dma + tx_done_q_size; netdev_open() 915 np->tx_ring = (void *) np->rx_done_q + rx_done_q_size; netdev_open() 916 np->tx_ring_dma = np->rx_done_q_dma + rx_done_q_size; netdev_open() 917 np->rx_ring = (void *) np->tx_ring + tx_ring_size; netdev_open() 918 np->rx_ring_dma = np->tx_ring_dma + tx_ring_size; netdev_open() 925 writel((np->rx_buf_sz << RxBufferLenShift) | netdev_open() 948 writel( (np->queue_mem_dma >> 16) >> 16, ioaddr + RxDescQHiAddr); netdev_open() 949 writel( (np->queue_mem_dma >> 16) >> 16, ioaddr + TxRingHiAddr); netdev_open() 950 writel( (np->queue_mem_dma >> 16) >> 16, ioaddr + CompletionHiAddr); netdev_open() 951 writel(np->rx_ring_dma, ioaddr + RxDescQAddr); netdev_open() 952 writel(np->tx_ring_dma, ioaddr + TxRingPtr); netdev_open() 954 writel(np->tx_done_q_dma, ioaddr + TxCompletionAddr); netdev_open() 955 writel(np->rx_done_q_dma | netdev_open() 981 np->tx_mode = TxFlowEnable|RxFlowEnable|PadEnable; /* modified when link is up. */ netdev_open() 982 writel(MiiSoftReset | np->tx_mode, ioaddr + TxMode); netdev_open() 984 writel(np->tx_mode, ioaddr + TxMode); netdev_open() 985 np->tx_threshold = 4; netdev_open() 986 writel(np->tx_threshold, ioaddr + TxThreshold); netdev_open() 988 writel(np->intr_timer_ctrl, ioaddr + IntrTimerCtrl); netdev_open() 990 napi_enable(&np->napi); netdev_open() 998 np->mii_if.advertising = mdio_read(dev, np->phys[0], MII_ADVERTISE); netdev_open() 1018 retval = request_firmware(&fw_rx, FIRMWARE_RX, &np->pci_dev->dev); netdev_open() 1030 retval = request_firmware(&fw_tx, FIRMWARE_TX, &np->pci_dev->dev); netdev_open() 1076 struct netdev_private *np = netdev_priv(dev); check_duplex() local 1080 mdio_write(dev, np->phys[0], MII_ADVERTISE, np->mii_if.advertising); check_duplex() 1081 mdio_write(dev, np->phys[0], MII_BMCR, BMCR_RESET); check_duplex() 1083 while (--silly_count && mdio_read(dev, np->phys[0], MII_BMCR) & BMCR_RESET) check_duplex() 1090 reg0 = mdio_read(dev, np->phys[0], MII_BMCR); check_duplex() 1092 if (!np->mii_if.force_media) { check_duplex() 1096 if (np->speed100) check_duplex() 1098 if (np->mii_if.full_duplex) check_duplex() 1102 np->speed100 ? "100" : "10", check_duplex() 1103 np->mii_if.full_duplex ? "full" : "half"); check_duplex() 1105 mdio_write(dev, np->phys[0], MII_BMCR, reg0); check_duplex() 1111 struct netdev_private *np = netdev_priv(dev); tx_timeout() local 1112 void __iomem *ioaddr = np->base; tx_timeout() 1141 struct netdev_private *np = netdev_priv(dev); init_ring() local 1144 np->cur_rx = np->cur_tx = np->reap_tx = 0; init_ring() 1145 np->dirty_rx = np->dirty_tx = np->rx_done = np->tx_done = 0; init_ring() 1147 np->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); init_ring() 1151 struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz); init_ring() 1152 np->rx_info[i].skb = skb; init_ring() 1155 np->rx_info[i].mapping = pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE); init_ring() 1157 np->rx_ring[i].rxaddr = cpu_to_dma(np->rx_info[i].mapping | RxDescValid); init_ring() 1159 writew(i - 1, np->base + RxDescQIdx); init_ring() 1160 np->dirty_rx = (unsigned int)(i - RX_RING_SIZE); init_ring() 1164 np->rx_ring[i].rxaddr = 0; init_ring() 1165 np->rx_info[i].skb = NULL; init_ring() 1166 np->rx_info[i].mapping = 0; init_ring() 1169 np->rx_ring[RX_RING_SIZE - 1].rxaddr |= cpu_to_dma(RxDescEndRing); init_ring() 1173 np->rx_done_q[i].status = 0; init_ring() 1174 np->tx_done_q[i].status = 0; init_ring() 1178 memset(&np->tx_info[i], 0, sizeof(np->tx_info[i])); init_ring() 1184 struct netdev_private *np = netdev_priv(dev); start_tx() local 1193 if ((np->cur_tx - np->dirty_tx) + skb_num_frags(skb) * 2 > TX_RING_SIZE) { start_tx() 1205 entry = np->cur_tx % TX_RING_SIZE; start_tx() 1211 np->tx_info[entry].skb = skb; start_tx() 1217 if (np->reap_tx) { start_tx() 1219 np->reap_tx = 0; start_tx() 1227 np->tx_info[entry].mapping = start_tx() 1228 pci_map_single(np->pci_dev, skb->data, skb_first_frag_len(skb), PCI_DMA_TODEVICE); start_tx() 1232 np->tx_info[entry].mapping = start_tx() 1233 pci_map_single(np->pci_dev, start_tx() 1239 np->tx_ring[entry].addr = cpu_to_dma(np->tx_info[entry].mapping); start_tx() 1240 np->tx_ring[entry].status = cpu_to_le32(status); start_tx() 1243 dev->name, np->cur_tx, np->dirty_tx, start_tx() 1246 np->tx_info[entry].used_slots = TX_RING_SIZE - entry; start_tx() 1247 np->cur_tx += np->tx_info[entry].used_slots; start_tx() 1250 np->tx_info[entry].used_slots = 1; start_tx() 1251 np->cur_tx += np->tx_info[entry].used_slots; start_tx() 1255 if (np->cur_tx % (TX_RING_SIZE / 2) == 0) start_tx() 1256 np->reap_tx = 1; start_tx() 1265 writel(entry * (sizeof(starfire_tx_desc) / 8), np->base + TxProducerIdx); start_tx() 1268 if ((np->cur_tx - np->dirty_tx) + 4 > TX_RING_SIZE) start_tx() 1280 struct netdev_private *np = netdev_priv(dev); intr_handler() local 1281 void __iomem *ioaddr = np->base; intr_handler() 1302 if (likely(napi_schedule_prep(&np->napi))) { intr_handler() 1303 __napi_schedule(&np->napi); intr_handler() 1330 while ((tx_status = le32_to_cpu(np->tx_done_q[np->tx_done].status)) != 0) { intr_handler() 1333 dev->name, np->dirty_tx, np->tx_done, tx_status); intr_handler() 1338 struct sk_buff *skb = np->tx_info[entry].skb; intr_handler() 1339 np->tx_info[entry].skb = NULL; intr_handler() 1340 pci_unmap_single(np->pci_dev, intr_handler() 1341 np->tx_info[entry].mapping, intr_handler() 1344 np->tx_info[entry].mapping = 0; intr_handler() 1345 np->dirty_tx += np->tx_info[entry].used_slots; intr_handler() 1346 entry = (entry + np->tx_info[entry].used_slots) % TX_RING_SIZE; intr_handler() 1350 pci_unmap_single(np->pci_dev, intr_handler() 1351 np->tx_info[entry].mapping, intr_handler() 1354 np->dirty_tx++; intr_handler() 1361 np->tx_done_q[np->tx_done].status = 0; intr_handler() 1362 np->tx_done = (np->tx_done + 1) % DONE_Q_SIZE; intr_handler() 1364 writew(np->tx_done, ioaddr + CompletionQConsumerIdx + 2); intr_handler() 1367 (np->cur_tx - np->dirty_tx + 4 < TX_RING_SIZE)) { intr_handler() 1406 struct netdev_private *np = netdev_priv(dev); __netdev_rx() local 1411 while ((desc_status = le32_to_cpu(np->rx_done_q[np->rx_done].status)) != 0) { __netdev_rx() 1415 rx_done_desc *desc = &np->rx_done_q[np->rx_done]; __netdev_rx() 1418 printk(KERN_DEBUG " netdev_rx() status of %d was %#8.8x.\n", np->rx_done, desc_status); __netdev_rx() 1445 pci_dma_sync_single_for_cpu(np->pci_dev, __netdev_rx() 1446 np->rx_info[entry].mapping, __netdev_rx() 1448 skb_copy_to_linear_data(skb, np->rx_info[entry].skb->data, pkt_len); __netdev_rx() 1449 pci_dma_sync_single_for_device(np->pci_dev, __netdev_rx() 1450 np->rx_info[entry].mapping, __netdev_rx() 1454 pci_unmap_single(np->pci_dev, np->rx_info[entry].mapping, np->rx_buf_sz, PCI_DMA_FROMDEVICE); __netdev_rx() 1455 skb = np->rx_info[entry].skb; __netdev_rx() 1457 np->rx_info[entry].skb = NULL; __netdev_rx() 1458 np->rx_info[entry].mapping = 0; __netdev_rx() 1472 printk(KERN_DEBUG " netdev_rx() status2 of %d was %#4.4x.\n", np->rx_done, le16_to_cpu(desc->status2)); __netdev_rx() 1507 np->cur_rx++; __netdev_rx() 1509 np->rx_done = (np->rx_done + 1) % DONE_Q_SIZE; __netdev_rx() 1516 writew(np->rx_done, np->base + CompletionQConsumerIdx); __netdev_rx() 1522 retcode, np->rx_done, desc_status); __netdev_rx() 1528 struct netdev_private *np = container_of(napi, struct netdev_private, napi); netdev_poll() local 1529 struct net_device *dev = np->dev; netdev_poll() 1531 void __iomem *ioaddr = np->base; netdev_poll() 1559 struct netdev_private *np = netdev_priv(dev); refill_rx_ring() local 1564 for (; np->cur_rx - np->dirty_rx > 0; np->dirty_rx++) { refill_rx_ring() 1565 entry = np->dirty_rx % RX_RING_SIZE; refill_rx_ring() 1566 if (np->rx_info[entry].skb == NULL) { refill_rx_ring() 1567 skb = netdev_alloc_skb(dev, np->rx_buf_sz); refill_rx_ring() 1568 np->rx_info[entry].skb = skb; refill_rx_ring() 1571 np->rx_info[entry].mapping = refill_rx_ring() 1572 pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE); refill_rx_ring() 1573 np->rx_ring[entry].rxaddr = refill_rx_ring() 1574 cpu_to_dma(np->rx_info[entry].mapping | RxDescValid); refill_rx_ring() 1577 np->rx_ring[entry].rxaddr |= cpu_to_dma(RxDescEndRing); refill_rx_ring() 1580 writew(entry, np->base + RxDescQIdx); refill_rx_ring() 1586 struct netdev_private *np = netdev_priv(dev); netdev_media_change() local 1587 void __iomem *ioaddr = np->base; netdev_media_change() 1593 mdio_read(dev, np->phys[0], MII_BMCR); netdev_media_change() 1594 mdio_read(dev, np->phys[0], MII_BMSR); netdev_media_change() 1596 reg0 = mdio_read(dev, np->phys[0], MII_BMCR); netdev_media_change() 1597 reg1 = mdio_read(dev, np->phys[0], MII_BMSR); netdev_media_change() 1603 reg4 = mdio_read(dev, np->phys[0], MII_ADVERTISE); netdev_media_change() 1604 reg5 = mdio_read(dev, np->phys[0], MII_LPA); netdev_media_change() 1606 np->speed100 = 1; netdev_media_change() 1607 np->mii_if.full_duplex = 1; netdev_media_change() 1609 np->speed100 = 1; netdev_media_change() 1610 np->mii_if.full_duplex = 0; netdev_media_change() 1612 np->speed100 = 0; netdev_media_change() 1613 np->mii_if.full_duplex = 1; netdev_media_change() 1615 np->speed100 = 0; netdev_media_change() 1616 np->mii_if.full_duplex = 0; netdev_media_change() 1621 np->speed100 = 1; netdev_media_change() 1623 np->speed100 = 0; netdev_media_change() 1625 np->mii_if.full_duplex = 1; netdev_media_change() 1627 np->mii_if.full_duplex = 0; netdev_media_change() 1632 np->speed100 ? "100" : "10", netdev_media_change() 1633 np->mii_if.full_duplex ? "full" : "half"); netdev_media_change() 1635 new_tx_mode = np->tx_mode & ~FullDuplex; /* duplex setting */ netdev_media_change() 1636 if (np->mii_if.full_duplex) netdev_media_change() 1638 if (np->tx_mode != new_tx_mode) { netdev_media_change() 1639 np->tx_mode = new_tx_mode; netdev_media_change() 1640 writel(np->tx_mode | MiiSoftReset, ioaddr + TxMode); netdev_media_change() 1642 writel(np->tx_mode, ioaddr + TxMode); netdev_media_change() 1645 new_intr_timer_ctrl = np->intr_timer_ctrl & ~Timer10X; netdev_media_change() 1646 if (np->speed100) netdev_media_change() 1648 if (np->intr_timer_ctrl != new_intr_timer_ctrl) { netdev_media_change() 1649 np->intr_timer_ctrl = new_intr_timer_ctrl; netdev_media_change() 1661 struct netdev_private *np = netdev_priv(dev); netdev_error() local 1665 if (np->tx_threshold <= PKT_BUF_SZ / 16) { netdev_error() 1666 writel(++np->tx_threshold, np->base + TxThreshold); netdev_error() 1668 dev->name, np->tx_threshold * 16); netdev_error() 1688 struct netdev_private *np = netdev_priv(dev); get_stats() local 1689 void __iomem *ioaddr = np->base; get_stats() 1713 static u32 set_vlan_mode(struct netdev_private *np) set_vlan_mode() argument 1717 void __iomem *filter_addr = np->base + HashTable + 8; set_vlan_mode() 1720 for_each_set_bit(vid, np->active_vlans, VLAN_N_VID) { set_vlan_mode() 1741 struct netdev_private *np = netdev_priv(dev); set_rx_mode() local 1742 void __iomem *ioaddr = np->base; set_rx_mode() 1748 rx_mode |= set_vlan_mode(np); set_rx_mode() 1814 struct netdev_private *np = netdev_priv(dev); get_drvinfo() local 1817 strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); get_drvinfo() 1822 struct netdev_private *np = netdev_priv(dev); get_settings() local 1823 spin_lock_irq(&np->lock); get_settings() 1824 mii_ethtool_gset(&np->mii_if, ecmd); get_settings() 1825 spin_unlock_irq(&np->lock); get_settings() 1831 struct netdev_private *np = netdev_priv(dev); set_settings() local 1833 spin_lock_irq(&np->lock); set_settings() 1834 res = mii_ethtool_sset(&np->mii_if, ecmd); set_settings() 1835 spin_unlock_irq(&np->lock); set_settings() 1842 struct netdev_private *np = netdev_priv(dev); nway_reset() local 1843 return mii_nway_restart(&np->mii_if); nway_reset() 1848 struct netdev_private *np = netdev_priv(dev); get_link() local 1849 return mii_link_ok(&np->mii_if); get_link() 1875 struct netdev_private *np = netdev_priv(dev); netdev_ioctl() local 1882 spin_lock_irq(&np->lock); netdev_ioctl() 1883 rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL); netdev_ioctl() 1884 spin_unlock_irq(&np->lock); netdev_ioctl() 1886 if ((cmd == SIOCSMIIREG) && (data->phy_id == np->phys[0])) netdev_ioctl() 1894 struct netdev_private *np = netdev_priv(dev); netdev_close() local 1895 void __iomem *ioaddr = np->base; netdev_close() 1900 napi_disable(&np->napi); netdev_close() 1906 dev->name, np->cur_tx, np->dirty_tx, netdev_close() 1907 np->cur_rx, np->dirty_rx); netdev_close() 1919 (long long) np->tx_ring_dma); netdev_close() 1922 i, le32_to_cpu(np->tx_ring[i].status), netdev_close() 1923 (long long) dma_to_cpu(np->tx_ring[i].addr), netdev_close() 1924 le32_to_cpu(np->tx_done_q[i].status)); netdev_close() 1926 (long long) np->rx_ring_dma, np->rx_done_q); netdev_close() 1927 if (np->rx_done_q) netdev_close() 1930 i, (long long) dma_to_cpu(np->rx_ring[i].rxaddr), le32_to_cpu(np->rx_done_q[i].status)); netdev_close() 1934 free_irq(np->pci_dev->irq, dev); netdev_close() 1938 np->rx_ring[i].rxaddr = cpu_to_dma(0xBADF00D0); /* An invalid address. */ netdev_close() 1939 if (np->rx_info[i].skb != NULL) { netdev_close() 1940 pci_unmap_single(np->pci_dev, np->rx_info[i].mapping, np->rx_buf_sz, PCI_DMA_FROMDEVICE); netdev_close() 1941 dev_kfree_skb(np->rx_info[i].skb); netdev_close() 1943 np->rx_info[i].skb = NULL; netdev_close() 1944 np->rx_info[i].mapping = 0; netdev_close() 1947 struct sk_buff *skb = np->tx_info[i].skb; netdev_close() 1950 pci_unmap_single(np->pci_dev, netdev_close() 1951 np->tx_info[i].mapping, netdev_close() 1953 np->tx_info[i].mapping = 0; netdev_close() 1955 np->tx_info[i].skb = NULL; netdev_close() 1997 struct netdev_private *np = netdev_priv(dev); starfire_remove_one() local 2003 if (np->queue_mem) starfire_remove_one() 2004 pci_free_consistent(pdev, np->queue_mem_size, np->queue_mem, np->queue_mem_dma); starfire_remove_one() 2011 iounmap(np->base); starfire_remove_one() 2014 free_netdev(dev); /* Will also free np!! */ starfire_remove_one()
|
/linux-4.4.14/net/core/ |
H A D | netpoll.c | 65 #define np_info(np, fmt, ...) \ 66 pr_info("%s: " fmt, np->name, ##__VA_ARGS__) 67 #define np_err(np, fmt, ...) \ 68 pr_err("%s: " fmt, np->name, ##__VA_ARGS__) 69 #define np_notice(np, fmt, ...) \ 70 pr_notice("%s: " fmt, np->name, ##__VA_ARGS__) 285 static struct sk_buff *find_skb(struct netpoll *np, int len, int reserve) find_skb() argument 300 netpoll_poll_dev(np->dev); find_skb() 323 void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, netpoll_send_skb_on_dev() argument 333 npinfo = rcu_dereference_bh(np->dev->npinfo); netpoll_send_skb_on_dev() 360 netpoll_poll_dev(np->dev); netpoll_send_skb_on_dev() 378 void netpoll_send_udp(struct netpoll *np, const char *msg, int len) netpoll_send_udp() argument 391 if (np->ipv6) netpoll_send_udp() 396 total_len = ip_len + LL_RESERVED_SPACE(np->dev); netpoll_send_udp() 398 skb = find_skb(np, total_len + np->dev->needed_tailroom, netpoll_send_udp() 409 udph->source = htons(np->local_port); netpoll_send_udp() 410 udph->dest = htons(np->remote_port); netpoll_send_udp() 413 if (np->ipv6) { netpoll_send_udp() 415 udph->check = csum_ipv6_magic(&np->local_ip.in6, netpoll_send_udp() 416 &np->remote_ip.in6, netpoll_send_udp() 435 ip6h->saddr = np->local_ip.in6; netpoll_send_udp() 436 ip6h->daddr = np->remote_ip.in6; netpoll_send_udp() 443 udph->check = csum_tcpudp_magic(np->local_ip.ip, netpoll_send_udp() 444 np->remote_ip.ip, netpoll_send_udp() 463 put_unaligned(np->local_ip.ip, &(iph->saddr)); netpoll_send_udp() 464 put_unaligned(np->remote_ip.ip, &(iph->daddr)); netpoll_send_udp() 472 ether_addr_copy(eth->h_source, np->dev->dev_addr); netpoll_send_udp() 473 ether_addr_copy(eth->h_dest, np->remote_mac); netpoll_send_udp() 475 skb->dev = np->dev; netpoll_send_udp() 477 netpoll_send_skb(np, skb); netpoll_send_udp() 481 void netpoll_print_options(struct netpoll *np) netpoll_print_options() argument 483 np_info(np, "local port %d\n", np->local_port); netpoll_print_options() 484 if (np->ipv6) netpoll_print_options() 485 np_info(np, "local IPv6 address %pI6c\n", &np->local_ip.in6); netpoll_print_options() 487 np_info(np, "local IPv4 address %pI4\n", &np->local_ip.ip); netpoll_print_options() 488 np_info(np, "interface '%s'\n", np->dev_name); netpoll_print_options() 489 np_info(np, "remote port %d\n", np->remote_port); netpoll_print_options() 490 if (np->ipv6) netpoll_print_options() 491 np_info(np, "remote IPv6 address %pI6c\n", &np->remote_ip.in6); netpoll_print_options() 493 np_info(np, "remote IPv4 address %pI4\n", &np->remote_ip.ip); netpoll_print_options() 494 np_info(np, "remote ethernet address %pM\n", np->remote_mac); netpoll_print_options() 518 int netpoll_parse_options(struct netpoll *np, char *opt) netpoll_parse_options() argument 528 if (kstrtou16(cur, 10, &np->local_port)) netpoll_parse_options() 539 ipv6 = netpoll_parse_ip_addr(cur, &np->local_ip); netpoll_parse_options() 543 np->ipv6 = (bool)ipv6; netpoll_parse_options() 553 strlcpy(np->dev_name, cur, sizeof(np->dev_name)); netpoll_parse_options() 564 np_info(np, "warning: whitespace is not allowed\n"); netpoll_parse_options() 565 if (kstrtou16(cur, 10, &np->remote_port)) netpoll_parse_options() 575 ipv6 = netpoll_parse_ip_addr(cur, &np->remote_ip); netpoll_parse_options() 578 else if (ipversion_set && np->ipv6 != (bool)ipv6) netpoll_parse_options() 581 np->ipv6 = (bool)ipv6; netpoll_parse_options() 586 if (!mac_pton(cur, np->remote_mac)) netpoll_parse_options() 590 netpoll_print_options(np); netpoll_parse_options() 595 np_info(np, "couldn't parse config at '%s'!\n", cur); netpoll_parse_options() 600 int __netpoll_setup(struct netpoll *np, struct net_device *ndev) __netpoll_setup() argument 606 np->dev = ndev; __netpoll_setup() 607 strlcpy(np->dev_name, ndev->name, IFNAMSIZ); __netpoll_setup() 608 INIT_WORK(&np->cleanup_work, netpoll_async_cleanup); __netpoll_setup() 612 np_err(np, "%s doesn't support polling, aborting\n", __netpoll_setup() 613 np->dev_name); __netpoll_setup() 631 ops = np->dev->netdev_ops; __netpoll_setup() 642 npinfo->netpoll = np; __netpoll_setup() 656 int netpoll_setup(struct netpoll *np) netpoll_setup() argument 663 if (np->dev_name) { netpoll_setup() 665 ndev = __dev_get_by_name(net, np->dev_name); netpoll_setup() 668 np_err(np, "%s doesn't exist, aborting\n", np->dev_name); netpoll_setup() 675 np_err(np, "%s is a slave device, aborting\n", np->dev_name); netpoll_setup() 683 np_info(np, "device %s not up yet, forcing it\n", np->dev_name); netpoll_setup() 688 np_err(np, "failed to open %s\n", ndev->name); netpoll_setup() 697 np_notice(np, "timeout waiting for carrier\n"); netpoll_setup() 709 np_notice(np, "carrier detect appears untrustworthy, waiting 4 seconds\n"); netpoll_setup() 715 if (!np->local_ip.ip) { netpoll_setup() 716 if (!np->ipv6) { netpoll_setup() 720 np_err(np, "no IP address for %s, aborting\n", netpoll_setup() 721 np->dev_name); netpoll_setup() 726 np->local_ip.ip = in_dev->ifa_list->ifa_local; netpoll_setup() 727 np_info(np, "local IP %pI4\n", &np->local_ip.ip); netpoll_setup() 741 np->local_ip.in6 = ifp->addr; netpoll_setup() 748 np_err(np, "no IPv6 address for %s, aborting\n", netpoll_setup() 749 np->dev_name); netpoll_setup() 752 np_info(np, "local IPv6 %pI6c\n", &np->local_ip.in6); netpoll_setup() 754 np_err(np, "IPv6 is not supported %s, aborting\n", netpoll_setup() 755 np->dev_name); netpoll_setup() 765 err = __netpoll_setup(np, ndev); netpoll_setup() 804 void __netpoll_cleanup(struct netpoll *np) __netpoll_cleanup() argument 812 npinfo = rtnl_dereference(np->dev->npinfo); __netpoll_cleanup() 821 ops = np->dev->netdev_ops; __netpoll_cleanup() 823 ops->ndo_netpoll_cleanup(np->dev); __netpoll_cleanup() 825 RCU_INIT_POINTER(np->dev->npinfo, NULL); __netpoll_cleanup() 828 RCU_INIT_POINTER(np->dev->npinfo, NULL); __netpoll_cleanup() 834 struct netpoll *np = container_of(work, struct netpoll, cleanup_work); netpoll_async_cleanup() local 837 __netpoll_cleanup(np); netpoll_async_cleanup() 839 kfree(np); netpoll_async_cleanup() 842 void __netpoll_free_async(struct netpoll *np) __netpoll_free_async() argument 844 schedule_work(&np->cleanup_work); __netpoll_free_async() 848 void netpoll_cleanup(struct netpoll *np) netpoll_cleanup() argument 851 if (!np->dev) netpoll_cleanup() 853 __netpoll_cleanup(np); netpoll_cleanup() 854 dev_put(np->dev); netpoll_cleanup() 855 np->dev = NULL; netpoll_cleanup()
|
/linux-4.4.14/arch/arm/mach-mvebu/ |
H A D | cpu-reset.c | 42 static int mvebu_cpu_reset_map(struct device_node *np, int res_idx) mvebu_cpu_reset_map() argument 46 if (of_address_to_resource(np, res_idx, &res)) { mvebu_cpu_reset_map() 52 np->full_name)) { mvebu_cpu_reset_map() 71 struct device_node *np; mvebu_cpu_reset_init() local 75 np = of_find_compatible_node(NULL, NULL, mvebu_cpu_reset_init() 77 if (np) { mvebu_cpu_reset_init() 84 np = of_find_compatible_node(NULL, NULL, mvebu_cpu_reset_init() 86 if (np) { mvebu_cpu_reset_init() 93 if (!np) mvebu_cpu_reset_init() 96 ret = mvebu_cpu_reset_map(np, res_idx); mvebu_cpu_reset_init() 97 of_node_put(np); mvebu_cpu_reset_init()
|
H A D | pm.c | 91 struct device_node *np; mvebu_internal_reg_base() local 94 np = of_find_node_by_name(NULL, "internal-regs"); mvebu_internal_reg_base() 95 BUG_ON(!np); mvebu_internal_reg_base() 105 return of_translate_address(np, in_addr); mvebu_internal_reg_base() 238 struct device_node *np; mvebu_pm_suspend_init() local 241 np = of_find_compatible_node(NULL, NULL, mvebu_pm_suspend_init() 243 if (!np) mvebu_pm_suspend_init() 246 if (of_address_to_resource(np, 0, &res)) { mvebu_pm_suspend_init() 247 of_node_put(np); mvebu_pm_suspend_init() 252 np->full_name)) { mvebu_pm_suspend_init() 253 of_node_put(np); mvebu_pm_suspend_init() 260 of_node_put(np); mvebu_pm_suspend_init() 264 of_node_put(np); mvebu_pm_suspend_init()
|
H A D | pm-board.c | 81 struct device_node *np; mvebu_armada_pm_init() local 88 np = of_find_node_by_name(NULL, "pm_pic"); mvebu_armada_pm_init() 89 if (!np) mvebu_armada_pm_init() 96 pic_gpios[i] = of_get_named_gpio(np, "ctrl-gpios", i); mvebu_armada_pm_init() 121 ret = of_parse_phandle_with_fixed_args(np, "ctrl-gpios", 2, mvebu_armada_pm_init() 129 gpio_ctrl_np = args.np; mvebu_armada_pm_init() 140 of_node_put(np); mvebu_armada_pm_init()
|
H A D | coherency.c | 128 static void __init armada_370_coherency_init(struct device_node *np) armada_370_coherency_init() argument 133 of_address_to_resource(np, 0, &res); armada_370_coherency_init() 142 coherency_base = of_iomap(np, 0); armada_370_coherency_init() 143 coherency_cpu_base = of_iomap(np, 1); armada_370_coherency_init() 184 static void __init armada_375_380_coherency_init(struct device_node *np) armada_375_380_coherency_init() argument 188 coherency_cpu_base = of_iomap(np, 0); armada_375_380_coherency_init() 216 struct device_node *np; coherency_type() local 244 np = of_find_matching_node_and_match(NULL, of_coherency_table, &match); coherency_type() 245 if (!np) coherency_type() 250 of_node_put(np); coherency_type() 282 struct device_node *np; coherency_init() local 284 np = of_find_matching_node(NULL, of_coherency_table); coherency_init() 287 armada_370_coherency_init(np); coherency_init() 290 armada_375_380_coherency_init(np); coherency_init() 292 of_node_put(np); coherency_init()
|
H A D | pmsu.c | 164 struct device_node *np; mvebu_v7_pmsu_init() local 168 np = of_find_matching_node(NULL, of_pmsu_table); mvebu_v7_pmsu_init() 169 if (!np) mvebu_v7_pmsu_init() 174 if (of_address_to_resource(np, 0, &res)) { mvebu_v7_pmsu_init() 180 if (of_device_is_compatible(np, "marvell,armada-370-xp-pmsu")) { mvebu_v7_pmsu_init() 187 np->full_name)) { mvebu_v7_pmsu_init() 204 of_node_put(np); mvebu_v7_pmsu_init() 382 static int broken_idle(struct device_node *np) broken_idle() argument 384 if (of_property_read_bool(np, "broken-idle")) { broken_idle() 394 struct device_node *np; armada_370_cpuidle_init() local 397 np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"); armada_370_cpuidle_init() 398 if (!np) armada_370_cpuidle_init() 401 if (broken_idle(np)) armada_370_cpuidle_init() 422 of_node_put(np); armada_370_cpuidle_init() 428 struct device_node *np; armada_38x_cpuidle_init() local 435 np = of_find_compatible_node(NULL, NULL, armada_38x_cpuidle_init() 437 if (!np) armada_38x_cpuidle_init() 440 if (broken_idle(np)) armada_38x_cpuidle_init() 443 of_node_put(np); armada_38x_cpuidle_init() 445 np = of_find_compatible_node(NULL, NULL, armada_38x_cpuidle_init() 447 if (!np) armada_38x_cpuidle_init() 449 mpsoc_base = of_iomap(np, 0); armada_38x_cpuidle_init() 471 of_node_put(np); armada_38x_cpuidle_init() 477 struct device_node *np; armada_xp_cpuidle_init() local 479 np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"); armada_xp_cpuidle_init() 480 if (!np) armada_xp_cpuidle_init() 483 if (broken_idle(np)) armada_xp_cpuidle_init() 491 of_node_put(np); armada_xp_cpuidle_init() 497 struct device_node *np; mvebu_v7_cpu_pm_init() local 500 np = of_find_matching_node(NULL, of_pmsu_table); mvebu_v7_cpu_pm_init() 501 if (!np) mvebu_v7_cpu_pm_init() 503 of_node_put(np); mvebu_v7_cpu_pm_init() 618 struct device_node *np; armada_xp_pmsu_cpufreq_init() local 633 np = of_find_compatible_node(NULL, NULL, "marvell,armada-xp-cpu-clock"); armada_xp_pmsu_cpufreq_init() 634 if (!np) armada_xp_pmsu_cpufreq_init() 637 ret = of_address_to_resource(np, 1, &res); armada_xp_pmsu_cpufreq_init() 640 of_node_put(np); armada_xp_pmsu_cpufreq_init() 644 of_node_put(np); armada_xp_pmsu_cpufreq_init()
|
/linux-4.4.14/drivers/clk/shmobile/ |
H A D | clk-emev2.c | 54 struct device_node *np; emev2_smu_init() local 56 np = of_find_matching_node(NULL, smu_id); emev2_smu_init() 57 BUG_ON(!np); emev2_smu_init() 58 smu_base = of_iomap(np, 0); emev2_smu_init() 60 of_node_put(np); emev2_smu_init() 77 static void __init emev2_smu_clkdiv_init(struct device_node *np) emev2_smu_clkdiv_init() argument 81 const char *parent_name = of_clk_get_parent_name(np, 0); emev2_smu_clkdiv_init() 82 if (WARN_ON(of_property_read_u32_array(np, "reg", reg, 2))) emev2_smu_clkdiv_init() 86 clk = clk_register_divider(NULL, np->name, parent_name, 0, emev2_smu_clkdiv_init() 88 of_clk_add_provider(np, of_clk_src_simple_get, clk); emev2_smu_clkdiv_init() 89 clk_register_clkdev(clk, np->name, NULL); emev2_smu_clkdiv_init() 90 pr_debug("## %s %s %p\n", __func__, np->name, clk); emev2_smu_clkdiv_init() 95 static void __init emev2_smu_gclk_init(struct device_node *np) emev2_smu_gclk_init() argument 99 const char *parent_name = of_clk_get_parent_name(np, 0); emev2_smu_gclk_init() 100 if (WARN_ON(of_property_read_u32_array(np, "reg", reg, 2))) emev2_smu_gclk_init() 104 clk = clk_register_gate(NULL, np->name, parent_name, 0, emev2_smu_gclk_init() 106 of_clk_add_provider(np, of_clk_src_simple_get, clk); emev2_smu_gclk_init() 107 clk_register_clkdev(clk, np->name, NULL); emev2_smu_gclk_init() 108 pr_debug("## %s %s %p\n", __func__, np->name, clk); emev2_smu_gclk_init()
|
H A D | clk-r8a7778.c | 52 r8a7778_cpg_register_clock(struct device_node *np, struct r8a7778_cpg *cpg, r8a7778_cpg_register_clock() argument 57 of_clk_get_parent_name(np, 0), 0, r8a7778_cpg_register_clock() 61 of_clk_get_parent_name(np, 0), 0, r8a7778_cpg_register_clock() 80 static void __init r8a7778_cpg_clocks_init(struct device_node *np) r8a7778_cpg_clocks_init() argument 87 num_clks = of_property_count_strings(np, "clock-output-names"); r8a7778_cpg_clocks_init() 107 cpg->reg = of_iomap(np, 0); r8a7778_cpg_clocks_init() 115 of_property_read_string_index(np, "clock-output-names", i, r8a7778_cpg_clocks_init() 118 clk = r8a7778_cpg_register_clock(np, cpg, name); r8a7778_cpg_clocks_init() 121 __func__, np->name, name, PTR_ERR(clk)); r8a7778_cpg_clocks_init() 126 of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); r8a7778_cpg_clocks_init() 128 cpg_mstp_add_clk_domain(np); r8a7778_cpg_clocks_init()
|
H A D | clk-rz.c | 33 rz_cpg_register_clock(struct device_node *np, struct rz_cpg *cpg, const char *name) rz_cpg_register_clock() argument 42 const char *parent_name = of_clk_get_parent_name(np, cpg_mode); rz_cpg_register_clock() 68 static void __init rz_cpg_clocks_init(struct device_node *np) rz_cpg_clocks_init() argument 75 num_clks = of_property_count_strings(np, "clock-output-names"); rz_cpg_clocks_init() 86 cpg->reg = of_iomap(np, 0); rz_cpg_clocks_init() 92 of_property_read_string_index(np, "clock-output-names", i, &name); rz_cpg_clocks_init() 94 clk = rz_cpg_register_clock(np, cpg, name); rz_cpg_clocks_init() 97 __func__, np->name, name, PTR_ERR(clk)); rz_cpg_clocks_init() 102 of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); rz_cpg_clocks_init() 104 cpg_mstp_add_clk_domain(np); rz_cpg_clocks_init()
|
H A D | clk-r8a7740.c | 65 r8a7740_cpg_register_clock(struct device_node *np, struct r8a7740_cpg *cpg, r8a7740_cpg_register_clock() argument 78 parent_name = of_clk_get_parent_name(np, 0); r8a7740_cpg_register_clock() 83 parent_name = of_clk_get_parent_name(np, 0); r8a7740_cpg_register_clock() 88 parent_name = of_clk_get_parent_name(np, 2); r8a7740_cpg_register_clock() 92 parent_name = of_clk_get_parent_name(np, 0); r8a7740_cpg_register_clock() 117 parent_name = of_clk_get_parent_name(np, 1); r8a7740_cpg_register_clock() 147 static void __init r8a7740_cpg_clocks_init(struct device_node *np) r8a7740_cpg_clocks_init() argument 154 if (of_property_read_u32(np, "renesas,mode", &cpg_mode)) r8a7740_cpg_clocks_init() 157 num_clks = of_property_count_strings(np, "clock-output-names"); r8a7740_cpg_clocks_init() 177 cpg->reg = of_iomap(np, 0); r8a7740_cpg_clocks_init() 185 of_property_read_string_index(np, "clock-output-names", i, r8a7740_cpg_clocks_init() 188 clk = r8a7740_cpg_register_clock(np, cpg, name); r8a7740_cpg_clocks_init() 191 __func__, np->name, name, PTR_ERR(clk)); r8a7740_cpg_clocks_init() 196 of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); r8a7740_cpg_clocks_init()
|
H A D | clk-mstp.c | 162 static void __init cpg_mstp_clocks_init(struct device_node *np) cpg_mstp_clocks_init() argument 181 group->smstpcr = of_iomap(np, 0); cpg_mstp_clocks_init() 182 group->mstpsr = of_iomap(np, 1); cpg_mstp_clocks_init() 194 if (of_find_property(np, "clock-indices", &i)) cpg_mstp_clocks_init() 206 ret = of_property_read_string_index(np, "clock-output-names", cpg_mstp_clocks_init() 211 parent_name = of_clk_get_parent_name(np, i); cpg_mstp_clocks_init() 212 ret = of_property_read_u32_index(np, idxname, i, &clkidx); cpg_mstp_clocks_init() 218 __func__, np->name, name, clkidx); cpg_mstp_clocks_init() 238 __func__, np->name, name, PTR_ERR(clks[clkidx])); cpg_mstp_clocks_init() 242 of_clk_add_provider(np, of_clk_src_onecell_get, &group->data); cpg_mstp_clocks_init() 250 struct device_node *np = dev->of_node; cpg_mstp_attach_dev() local 256 while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i, cpg_mstp_attach_dev() 258 if (of_device_is_compatible(clkspec.np, cpg_mstp_attach_dev() 263 if (!strcmp(clkspec.np->name, "zb_clk")) cpg_mstp_attach_dev() 266 of_node_put(clkspec.np); cpg_mstp_attach_dev() 274 of_node_put(clkspec.np); cpg_mstp_attach_dev() 306 void __init cpg_mstp_add_clk_domain(struct device_node *np) cpg_mstp_add_clk_domain() argument 311 if (of_property_read_u32(np, "#power-domain-cells", &ncells)) { cpg_mstp_add_clk_domain() 312 pr_warn("%s lacks #power-domain-cells\n", np->full_name); cpg_mstp_add_clk_domain() 320 pd->name = np->name; cpg_mstp_add_clk_domain() 327 of_genpd_add_provider_simple(np, pd); cpg_mstp_add_clk_domain()
|
H A D | clk-r8a7779.c | 94 r8a7779_cpg_register_clock(struct device_node *np, struct r8a7779_cpg *cpg, r8a7779_cpg_register_clock() argument 103 parent_name = of_clk_get_parent_name(np, 0); r8a7779_cpg_register_clock() 123 static void __init r8a7779_cpg_clocks_init(struct device_node *np) r8a7779_cpg_clocks_init() argument 131 num_clks = of_property_count_strings(np, "clock-output-names"); r8a7779_cpg_clocks_init() 158 of_property_read_string_index(np, "clock-output-names", i, r8a7779_cpg_clocks_init() 161 clk = r8a7779_cpg_register_clock(np, cpg, config, r8a7779_cpg_clocks_init() 165 __func__, np->name, name, PTR_ERR(clk)); r8a7779_cpg_clocks_init() 170 of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); r8a7779_cpg_clocks_init() 172 cpg_mstp_add_clk_domain(np); r8a7779_cpg_clocks_init()
|
H A D | clk-r8a73a4.c | 63 r8a73a4_cpg_register_clock(struct device_node *np, struct r8a73a4_cpg *cpg, r8a73a4_cpg_register_clock() argument 78 parent_name = of_clk_get_parent_name(np, 0); r8a73a4_cpg_register_clock() 81 parent_name = of_clk_get_parent_name(np, 0); r8a73a4_cpg_register_clock() 85 parent_name = of_clk_get_parent_name(np, 1); r8a73a4_cpg_register_clock() 88 parent_name = of_clk_get_parent_name(np, 1); r8a73a4_cpg_register_clock() 192 static void __init r8a73a4_cpg_clocks_init(struct device_node *np) r8a73a4_cpg_clocks_init() argument 199 num_clks = of_property_count_strings(np, "clock-output-names"); r8a73a4_cpg_clocks_init() 219 cpg->reg = of_iomap(np, 0); r8a73a4_cpg_clocks_init() 227 of_property_read_string_index(np, "clock-output-names", i, r8a73a4_cpg_clocks_init() 230 clk = r8a73a4_cpg_register_clock(np, cpg, name); r8a73a4_cpg_clocks_init() 233 __func__, np->name, name, PTR_ERR(clk)); r8a73a4_cpg_clocks_init() 238 of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); r8a73a4_cpg_clocks_init()
|
/linux-4.4.14/drivers/clocksource/ |
H A D | tango_xtal.c | 35 static void __init tango_clocksource_init(struct device_node *np) tango_clocksource_init() argument 40 xtal_in_cnt = of_iomap(np, 0); tango_clocksource_init() 42 pr_err("%s: invalid address\n", np->full_name); tango_clocksource_init() 46 clk = of_clk_get(np, 0); tango_clocksource_init() 48 pr_err("%s: invalid clock\n", np->full_name); tango_clocksource_init() 58 pr_err("%s: registration failed\n", np->full_name); tango_clocksource_init()
|
H A D | clksrc-probe.c | 29 struct device_node *np; clocksource_probe() local 34 for_each_matching_node_and_match(np, __clksrc_of_table, &match) { clocksource_probe() 35 if (!of_device_is_available(np)) clocksource_probe() 39 init_func(np); clocksource_probe()
|
H A D | dw_apb_timer_of.c | 26 static void __init timer_get_base_and_rate(struct device_node *np, timer_get_base_and_rate() argument 32 *base = of_iomap(np, 0); timer_get_base_and_rate() 35 panic("Unable to map regs for %s", np->name); timer_get_base_and_rate() 41 pclk = of_clk_get_by_name(np, "pclk"); timer_get_base_and_rate() 45 np->name); timer_get_base_and_rate() 47 timer_clk = of_clk_get_by_name(np, "timer"); timer_get_base_and_rate() 57 if (of_property_read_u32(np, "clock-freq", rate) && timer_get_base_and_rate() 58 of_property_read_u32(np, "clock-frequency", rate)) timer_get_base_and_rate() 59 panic("No clock nor clock-frequency property for %s", np->name); timer_get_base_and_rate()
|
H A D | time-orion.c | 107 static void __init orion_timer_init(struct device_node *np) orion_timer_init() argument 113 timer_base = of_iomap(np, 0); orion_timer_init() 115 panic("%s: unable to map resource\n", np->name); orion_timer_init() 117 clk = of_clk_get(np, 0); orion_timer_init() 119 panic("%s: unable to get clk\n", np->name); orion_timer_init() 123 irq = irq_of_parse_and_map(np, 1); orion_timer_init() 125 panic("%s: unable to parse timer1 irq\n", np->name); orion_timer_init() 140 panic("%s: unable to setup irq\n", np->name); orion_timer_init()
|
H A D | timer-stm32.c | 101 static void __init stm32_clockevent_init(struct device_node *np) stm32_clockevent_init() argument 109 clk = of_clk_get(np, 0); stm32_clockevent_init() 125 rstc = of_reset_control_get(np, NULL); stm32_clockevent_init() 131 data->base = of_iomap(np, 0); stm32_clockevent_init() 137 irq = irq_of_parse_and_map(np, 0); stm32_clockevent_init() 139 pr_err("%s: failed to get irq.\n", np->full_name); stm32_clockevent_init() 169 pr_err("%s: failed to request irq.\n", np->full_name); stm32_clockevent_init() 174 np->full_name, bits); stm32_clockevent_init()
|
H A D | armv7m_systick.c | 24 static void __init system_timer_of_register(struct device_node *np) system_timer_of_register() argument 31 base = of_iomap(np, 0); system_timer_of_register() 37 ret = of_property_read_u32(np, "clock-frequency", &rate); system_timer_of_register() 39 clk = of_clk_get(np, 0); system_timer_of_register()
|
H A D | timer-sp804.c | 218 static void __init sp804_of_init(struct device_node *np) sp804_of_init() argument 225 const char *name = of_get_property(np, "compatible", NULL); sp804_of_init() 227 base = of_iomap(np, 0); sp804_of_init() 235 if (initialized || !of_device_is_available(np)) sp804_of_init() 238 clk1 = of_clk_get(np, 0); sp804_of_init() 243 if (of_count_phandle_with_args(np, "clocks", "#clock-cells") == 3) { sp804_of_init() 244 clk2 = of_clk_get(np, 1); sp804_of_init() 246 pr_err("sp804: %s clock not found: %d\n", np->name, sp804_of_init() 253 irq = irq_of_parse_and_map(np, 0); sp804_of_init() 257 of_property_read_u32(np, "arm,sp804-has-irq", &irq_num); sp804_of_init() 274 static void __init integrator_cp_of_init(struct device_node *np) integrator_cp_of_init() argument 279 const char *name = of_get_property(np, "compatible", NULL); integrator_cp_of_init() 282 base = of_iomap(np, 0); integrator_cp_of_init() 285 clk = of_clk_get(np, 0); integrator_cp_of_init() 292 if (init_count == 2 || !of_device_is_available(np)) integrator_cp_of_init() 298 irq = irq_of_parse_and_map(np, 0); integrator_cp_of_init()
|
H A D | time-efm32.c | 132 static int __init efm32_clocksource_init(struct device_node *np) efm32_clocksource_init() argument 139 clk = of_clk_get(np, 0); efm32_clocksource_init() 154 base = of_iomap(np, 0); efm32_clocksource_init() 190 static int __init efm32_clockevent_init(struct device_node *np) efm32_clockevent_init() argument 198 clk = of_clk_get(np, 0); efm32_clockevent_init() 213 base = of_iomap(np, 0); efm32_clockevent_init() 220 irq = irq_of_parse_and_map(np, 0); efm32_clockevent_init() 258 static void __init efm32_timer_init(struct device_node *np) efm32_timer_init() argument 264 ret = efm32_clocksource_init(np); efm32_timer_init() 272 ret = efm32_clockevent_init(np); efm32_timer_init()
|
H A D | clps711x-timer.c | 107 static void __init clps711x_timer_init(struct device_node *np) clps711x_timer_init() argument 109 unsigned int irq = irq_of_parse_and_map(np, 0); clps711x_timer_init() 110 struct clk *clock = of_clk_get(np, 0); clps711x_timer_init() 111 void __iomem *base = of_iomap(np, 0); clps711x_timer_init() 113 switch (of_alias_get_id(np, "timer")) { clps711x_timer_init()
|
/linux-4.4.14/drivers/irqchip/ |
H A D | irq-gic-v3-its-platform-msi.c | 43 if (args.np == irq_domain_get_of_node(domain)) { its_pmsi_prepare() 78 struct device_node *np; its_pmsi_init() local 81 for (np = of_find_matching_node(NULL, its_device_id); np; its_pmsi_init() 82 np = of_find_matching_node(np, its_device_id)) { its_pmsi_init() 83 if (!of_property_read_bool(np, "msi-controller")) its_pmsi_init() 86 parent = irq_find_matching_host(np, DOMAIN_BUS_NEXUS); its_pmsi_init() 89 np->full_name); its_pmsi_init() 93 if (!platform_msi_create_irq_domain(of_node_to_fwnode(np), its_pmsi_init() 97 np->full_name); its_pmsi_init() 101 pr_info("Platform MSI: %s domain created\n", np->full_name); its_pmsi_init()
|
H A D | irq-orion.c | 52 static int __init orion_irq_init(struct device_node *np, orion_irq_init() argument 60 while (of_address_to_resource(np, num_chips, &r) == 0) orion_irq_init() 63 orion_irq_domain = irq_domain_add_linear(np, orion_irq_init() 67 panic("%s: unable to add irq domain\n", np->name); orion_irq_init() 70 ORION_IRQS_PER_CHIP, 1, np->name, orion_irq_init() 74 panic("%s: unable to alloc irq domain gc\n", np->name); orion_irq_init() 80 of_address_to_resource(np, n, &r); orion_irq_init() 82 if (!request_mem_region(r.start, resource_size(&r), np->name)) orion_irq_init() 84 np->name, n); orion_irq_init() 88 panic("%s: unable to map resource %d", np->name, n); orion_irq_init() 138 static int __init orion_bridge_irq_init(struct device_node *np, orion_bridge_irq_init() argument 148 of_property_read_u32(np, "marvell,#interrupts", &nrirqs); orion_bridge_irq_init() 150 domain = irq_domain_add_linear(np, nrirqs, orion_bridge_irq_init() 153 pr_err("%s: unable to add irq domain\n", np->name); orion_bridge_irq_init() 157 ret = irq_alloc_domain_generic_chips(domain, nrirqs, 1, np->name, orion_bridge_irq_init() 160 pr_err("%s: unable to alloc irq domain gc\n", np->name); orion_bridge_irq_init() 164 ret = of_address_to_resource(np, 0, &r); orion_bridge_irq_init() 166 pr_err("%s: unable to get resource\n", np->name); orion_bridge_irq_init() 170 if (!request_mem_region(r.start, resource_size(&r), np->name)) { orion_bridge_irq_init() 171 pr_err("%s: unable to request mem region\n", np->name); orion_bridge_irq_init() 176 irq = irq_of_parse_and_map(np, 0); orion_bridge_irq_init() 178 pr_err("%s: unable to parse irq\n", np->name); orion_bridge_irq_init() 185 pr_err("%s: unable to map resource\n", np->name); orion_bridge_irq_init()
|
H A D | irq-dw-apb-ictl.c | 68 static int __init dw_apb_ictl_init(struct device_node *np, dw_apb_ictl_init() argument 80 irq = irq_of_parse_and_map(np, 0); dw_apb_ictl_init() 82 pr_err("%s: unable to parse irq\n", np->full_name); dw_apb_ictl_init() 86 ret = of_address_to_resource(np, 0, &r); dw_apb_ictl_init() 88 pr_err("%s: unable to get resource\n", np->full_name); dw_apb_ictl_init() 92 if (!request_mem_region(r.start, resource_size(&r), np->full_name)) { dw_apb_ictl_init() 93 pr_err("%s: unable to request mem region\n", np->full_name); dw_apb_ictl_init() 99 pr_err("%s: unable to map resource\n", np->full_name); dw_apb_ictl_init() 123 domain = irq_domain_add_linear(np, nrirqs, dw_apb_ictl_init() 126 pr_err("%s: unable to add irq domain\n", np->full_name); dw_apb_ictl_init() 131 ret = irq_alloc_domain_generic_chips(domain, 32, 1, np->name, dw_apb_ictl_init() 135 pr_err("%s: unable to alloc irq domain gc\n", np->full_name); dw_apb_ictl_init()
|
H A D | irq-gic-v3-its-pci-msi.c | 111 struct device_node *np; its_pci_msi_init() local 114 for (np = of_find_matching_node(NULL, its_device_id); np; its_pci_msi_init() 115 np = of_find_matching_node(np, its_device_id)) { its_pci_msi_init() 116 if (!of_property_read_bool(np, "msi-controller")) its_pci_msi_init() 119 parent = irq_find_matching_host(np, DOMAIN_BUS_NEXUS); its_pci_msi_init() 122 np->full_name); its_pci_msi_init() 126 if (!pci_msi_create_irq_domain(of_node_to_fwnode(np), its_pci_msi_init() 130 np->full_name); its_pci_msi_init() 134 pr_info("PCI/MSI: %s domain created\n", np->full_name); its_pci_msi_init()
|
H A D | irq-atmel-aic-common.c | 148 struct device_node *np; aic_common_rtc_irq_fixup() local 151 np = of_find_compatible_node(root, NULL, "atmel,at91rm9200-rtc"); aic_common_rtc_irq_fixup() 152 if (!np) aic_common_rtc_irq_fixup() 153 np = of_find_compatible_node(root, NULL, aic_common_rtc_irq_fixup() 156 if (!np) aic_common_rtc_irq_fixup() 159 regs = of_iomap(np, 0); aic_common_rtc_irq_fixup() 160 of_node_put(np); aic_common_rtc_irq_fixup() 176 struct device_node *np; aic_common_rtt_irq_fixup() local 183 for_each_compatible_node(np, NULL, "atmel,at91sam9260-rtt") { aic_common_rtt_irq_fixup() 184 regs = of_iomap(np, 0); aic_common_rtt_irq_fixup()
|
/linux-4.4.14/drivers/clk/versatile/ |
H A D | clk-versatile.c | 58 static void __init cm_osc_setup(struct device_node *np, cm_osc_setup() argument 62 const char *clk_name = np->name; cm_osc_setup() 69 parent = of_get_parent(np); cm_osc_setup() 81 parent_name = of_clk_get_parent_name(np, 0); cm_osc_setup() 84 of_clk_add_provider(np, of_clk_src_simple_get, clk); cm_osc_setup() 87 static void __init of_integrator_cm_osc_setup(struct device_node *np) of_integrator_cm_osc_setup() argument 89 cm_osc_setup(np, &cm_auxosc_desc); of_integrator_cm_osc_setup() 94 static void __init of_versatile_cm_osc_setup(struct device_node *np) of_versatile_cm_osc_setup() argument 96 cm_osc_setup(np, &versatile_auxosc_desc); of_versatile_cm_osc_setup()
|
/linux-4.4.14/arch/powerpc/include/asm/ |
H A D | parport.h | 17 struct device_node *np; parport_pc_find_nonpci_ports() local 24 for_each_compatible_node(np, "parallel", "pnpPNP,400") { for_each_compatible_node() 25 prop = of_get_property(np, "reg", &propsize); for_each_compatible_node() 30 virq = irq_of_parse_and_map(np, 0); for_each_compatible_node()
|
/linux-4.4.14/arch/mips/xilfpga/ |
H A D | time.c | 21 struct device_node *np; plat_time_init() local 27 np = of_get_cpu_node(0, NULL); plat_time_init() 28 if (!np) { plat_time_init() 33 clk = of_clk_get(np, 0); plat_time_init()
|
/linux-4.4.14/arch/arm/mach-ux500/ |
H A D | timer.c | 28 struct device_node *np; ux500_timer_init() local 35 np = of_find_matching_node(NULL, prcmu_timer_of_match); ux500_timer_init() 36 if (!np) ux500_timer_init() 39 tmp_base = of_iomap(np, 0); ux500_timer_init()
|
H A D | platsmp.c | 37 struct device_node *np; wakeup_secondary() local 40 np = of_find_compatible_node(NULL, NULL, "ste,dbx500-backupram"); wakeup_secondary() 41 if (!np) { wakeup_secondary() 45 backupram = of_iomap(np, 0); wakeup_secondary() 46 of_node_put(np); wakeup_secondary() 70 struct device_node *np; ux500_smp_prepare_cpus() local 75 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); ux500_smp_prepare_cpus() 76 if (!np) { ux500_smp_prepare_cpus() 80 scu_base = of_iomap(np, 0); ux500_smp_prepare_cpus() 81 of_node_put(np); ux500_smp_prepare_cpus()
|
H A D | cache-l2x0.c | 20 struct device_node *np; ux500_l2x0_unlock() local 23 np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache"); ux500_l2x0_unlock() 24 l2x0_base = of_iomap(np, 0); ux500_l2x0_unlock() 25 of_node_put(np); ux500_l2x0_unlock()
|
H A D | pm_domains.c | 59 struct device_node *np; ux500_pm_domains_init() local 63 np = of_find_matching_node(NULL, ux500_pm_domain_matches); ux500_pm_domains_init() 64 if (!np) ux500_pm_domains_init() 77 of_genpd_add_provider_onecell(np, genpd_data); ux500_pm_domains_init()
|
/linux-4.4.14/drivers/gpio/ |
H A D | gpiolib-of.c | 43 if ((gc->of_node != gg_data->gpiospec.np) || of_gpiochip_find_and_xlate() 65 * @np: device node to get GPIO from 74 struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, of_get_named_gpiod_flags() argument 90 ret = of_parse_phandle_with_args(np, propname, "#gpio-cells", index, of_get_named_gpiod_flags() 94 __func__, propname, np->full_name, index); of_get_named_gpiod_flags() 100 of_node_put(gg_data.gpiospec.np); of_get_named_gpiod_flags() 102 __func__, propname, np->full_name, index, of_get_named_gpiod_flags() 107 int of_get_named_gpio_flags(struct device_node *np, const char *list_name, of_get_named_gpio_flags() argument 112 desc = of_get_named_gpiod_flags(np, list_name, index, flags); of_get_named_gpio_flags() 123 * @np: device node to get GPIO from 132 static struct gpio_desc *of_parse_own_gpio(struct device_node *np, of_parse_own_gpio() argument 145 chip_np = np->parent; of_parse_own_gpio() 161 gg_data.gpiospec.np = chip_np; of_parse_own_gpio() 163 ret = of_property_read_u32_index(np, "gpios", i, of_parse_own_gpio() 171 if (np->parent == np) of_parse_own_gpio() 180 if (of_property_read_bool(np, "input")) of_parse_own_gpio() 182 else if (of_property_read_bool(np, "output-low")) of_parse_own_gpio() 184 else if (of_property_read_bool(np, "output-high")) of_parse_own_gpio() 188 desc_to_gpio(gg_data.out_gpio), np->name); of_parse_own_gpio() 192 if (name && of_property_read_string(np, "line-name", name)) of_parse_own_gpio() 193 *name = np->name; of_parse_own_gpio() 208 struct device_node *np; of_gpiochip_scan_gpios() local 213 for_each_child_of_node(chip->of_node, np) { of_gpiochip_scan_gpios() 214 if (!of_property_read_bool(np, "gpio-hog")) of_gpiochip_scan_gpios() 217 desc = of_parse_own_gpio(np, &name, &lflags, &dflags); of_gpiochip_scan_gpios() 229 * @np: device node of the GPIO chip 266 * @np: device node of the GPIO chip 283 int of_mm_gpiochip_add(struct device_node *np, of_mm_gpiochip_add() argument 289 gc->label = kstrdup(np->full_name, GFP_KERNEL); of_mm_gpiochip_add() 293 mm_gc->regs = of_iomap(np, 0); of_mm_gpiochip_add() 302 mm_gc->gc.of_node = np; of_mm_gpiochip_add() 315 np->full_name, ret); of_mm_gpiochip_add() 340 struct device_node *np = chip->of_node; of_gpiochip_add_pin_range() local 348 if (!np) of_gpiochip_add_pin_range() 351 group_names = of_find_property(np, group_names_propname, NULL); of_gpiochip_add_pin_range() 354 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, of_gpiochip_add_pin_range() 359 pctldev = of_pinctrl_get(pinspec.np); of_gpiochip_add_pin_range() 365 of_property_read_string_index(np, of_gpiochip_add_pin_range() 370 np->full_name); of_gpiochip_add_pin_range() 386 np->full_name); of_gpiochip_add_pin_range() 392 np->full_name, group_names_propname); of_gpiochip_add_pin_range() 396 ret = of_property_read_string_index(np, of_gpiochip_add_pin_range() 404 np->full_name); of_gpiochip_add_pin_range()
|
/linux-4.4.14/drivers/char/tpm/ |
H A D | tpm_of.c | 25 struct device_node *np; read_log() local 34 np = of_find_node_by_name(NULL, "vtpm"); read_log() 35 if (!np) { read_log() 40 sizep = of_get_property(np, "linux,sml-size", NULL); read_log() 50 basep = of_get_property(np, "linux,sml-base", NULL); read_log() 60 of_node_put(np); read_log() 67 of_node_put(np); read_log() 72 of_node_put(np); read_log()
|
/linux-4.4.14/drivers/clk/mmp/ |
H A D | reset.h | 22 void mmp_clk_reset_register(struct device_node *np, 25 static inline void mmp_clk_reset_register(struct device_node *np, mmp_clk_reset_register() argument
|
/linux-4.4.14/arch/powerpc/platforms/82xx/ |
H A D | pq2.c | 47 static void __init pq2_pci_add_bridge(struct device_node *np) pq2_pci_add_bridge() argument 52 if (of_address_to_resource(np, 0, &r) || r.end - r.start < 0x10b) pq2_pci_add_bridge() 57 hose = pcibios_alloc_controller(np); pq2_pci_add_bridge() 61 hose->dn = np; pq2_pci_add_bridge() 64 pci_process_bridge_OF_ranges(hose, np, 1); pq2_pci_add_bridge() 74 struct device_node *np; pq2_init_pci() local 78 for_each_compatible_node(np, NULL, "fsl,pq2-pci") pq2_init_pci() 79 pq2_pci_add_bridge(np); pq2_init_pci()
|
H A D | pq2ads-pci-pic.c | 122 struct device_node *np; pq2ads_pci_init_irq() local 126 np = of_find_compatible_node(NULL, NULL, "fsl,pq2ads-pci-pic"); pq2ads_pci_init_irq() 127 if (!np) { pq2ads_pci_init_irq() 129 of_node_put(np); pq2ads_pci_init_irq() 133 irq = irq_of_parse_and_map(np, 0); pq2ads_pci_init_irq() 136 of_node_put(np); pq2ads_pci_init_irq() 142 of_node_put(np); pq2ads_pci_init_irq() 148 priv->regs = of_iomap(np, 0); pq2ads_pci_init_irq() 158 host = irq_domain_add_linear(np, NUM_IRQS, &pci_pic_host_ops, priv); pq2ads_pci_init_irq() 168 of_node_put(np); pq2ads_pci_init_irq() 175 of_node_put(np); pq2ads_pci_init_irq()
|
H A D | pq2fads.c | 36 struct device_node *np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic"); pq2fads_pic_init() local 37 if (!np) { pq2fads_pic_init() 42 cpm2_pic_init(np); pq2fads_pic_init() 43 of_node_put(np); pq2fads_pic_init() 120 struct device_node *np; pq2fads_setup_arch() local 128 np = of_find_compatible_node(NULL, NULL, "fsl,pq2fads-bcsr"); pq2fads_setup_arch() 129 if (!np) { pq2fads_setup_arch() 134 bcsr = of_iomap(np, 0); pq2fads_setup_arch() 135 of_node_put(np); pq2fads_setup_arch()
|
/linux-4.4.14/arch/powerpc/platforms/cell/ |
H A D | cbe_regs.c | 51 static struct cbe_regs_map *cbe_find_map(struct device_node *np) cbe_find_map() argument 56 if (strcasecmp(np->type, "spe")) { cbe_find_map() 58 if (cbe_regs_maps[i].cpu_node == np || cbe_find_map() 59 cbe_regs_maps[i].be_node == np) cbe_find_map() 64 if (np->data) cbe_find_map() 65 return np->data; cbe_find_map() 68 tmp_np = np; cbe_find_map() 76 np->data = cbe_find_map(tmp_np); cbe_find_map() 78 return np->data; cbe_find_map() 81 struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np) cbe_get_pmd_regs() argument 83 struct cbe_regs_map *map = cbe_find_map(np); cbe_get_pmd_regs() 99 struct cbe_pmd_shadow_regs *cbe_get_pmd_shadow_regs(struct device_node *np) cbe_get_pmd_shadow_regs() argument 101 struct cbe_regs_map *map = cbe_find_map(np); cbe_get_pmd_shadow_regs() 115 struct cbe_iic_regs __iomem *cbe_get_iic_regs(struct device_node *np) cbe_get_iic_regs() argument 117 struct cbe_regs_map *map = cbe_find_map(np); cbe_get_iic_regs() 131 struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np) cbe_get_mic_tm_regs() argument 133 struct cbe_regs_map *map = cbe_find_map(np); cbe_get_mic_tm_regs() 169 struct device_node *np; cbe_get_be_node() local 171 for_each_node_by_type (np, "be") { cbe_get_be_node() 175 cpu_handle = of_get_property(np, "cpus", &len); cbe_get_be_node() 182 return np; cbe_get_be_node() 186 return np; cbe_get_be_node() 195 struct device_node *be, *np; cbe_fill_regs_map() local 199 for_each_node_by_type(np, "pervasive") cbe_fill_regs_map() 200 if (of_get_parent(np) == be) cbe_fill_regs_map() 201 map->pmd_regs = of_iomap(np, 0); cbe_fill_regs_map() 203 for_each_node_by_type(np, "CBEA-Internal-Interrupt-Controller") cbe_fill_regs_map() 204 if (of_get_parent(np) == be) cbe_fill_regs_map() 205 map->iic_regs = of_iomap(np, 2); cbe_fill_regs_map() 207 for_each_node_by_type(np, "mic-tm") cbe_fill_regs_map() 208 if (of_get_parent(np) == be) cbe_fill_regs_map() 209 map->mic_tm_regs = of_iomap(np, 0); cbe_fill_regs_map()
|
H A D | iommu.c | 271 struct device_node *np; cell_iommu_find_ioc() local 277 for_each_node_by_name(np, "ioc") { cell_iommu_find_ioc() 278 if (of_node_to_nid(np) != nid) cell_iommu_find_ioc() 280 if (of_address_to_resource(np, 0, &r)) { cell_iommu_find_ioc() 282 np->full_name); cell_iommu_find_ioc() 286 of_node_put(np); cell_iommu_find_ioc() 291 for_each_node_by_type(np, "cpu") { cell_iommu_find_ioc() 295 nidp = of_get_property(np, "node-id", NULL); cell_iommu_find_ioc() 297 tmp = of_get_property(np, "ioc-translation", NULL); cell_iommu_find_ioc() 300 of_node_put(np); cell_iommu_find_ioc() 455 static inline u32 cell_iommu_get_ioid(struct device_node *np) cell_iommu_get_ioid() argument 459 ioid = of_get_property(np, "ioid", NULL); cell_iommu_get_ioid() 462 np->full_name); cell_iommu_get_ioid() 475 cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np, cell_iommu_setup_window() argument 483 ioid = cell_iommu_get_ioid(np); cell_iommu_setup_window() 706 static int __init cell_iommu_get_window(struct device_node *np, cell_iommu_get_window() argument 714 dma_window = of_get_property(np, "ibm,dma-window", NULL); cell_iommu_get_window() 721 of_parse_dma_window(np, dma_window, &index, base, size); cell_iommu_get_window() 725 static struct cbe_iommu * __init cell_iommu_alloc(struct device_node *np) cell_iommu_alloc() argument 731 nid = of_node_to_nid(np); cell_iommu_alloc() 734 np->full_name); cell_iommu_alloc() 738 nid, np->full_name); cell_iommu_alloc() 750 np->full_name); cell_iommu_alloc() 765 static void __init cell_iommu_init_one(struct device_node *np, cell_iommu_init_one() argument 771 iommu = cell_iommu_alloc(np); cell_iommu_init_one() 776 cell_iommu_get_window(np, &base, &size); cell_iommu_init_one() 785 cell_iommu_setup_window(iommu, np, base, size, cell_iommu_init_one() 819 struct device_node *np = NULL; cell_iommu_init_disabled() local 838 for_each_node_by_name(np, "axon") { cell_iommu_init_disabled() 839 if (np->parent == NULL || np->parent->parent != NULL) cell_iommu_init_disabled() 841 if (cell_iommu_get_window(np, &base, &size) == 0) cell_iommu_init_disabled() 844 if (np == NULL) { cell_iommu_init_disabled() 845 for_each_node_by_name(np, "pci-internal") { cell_iommu_init_disabled() 846 if (np->parent == NULL || np->parent->parent != NULL) cell_iommu_init_disabled() 848 if (cell_iommu_get_window(np, &base, &size) == 0) cell_iommu_init_disabled() 852 of_node_put(np); cell_iommu_init_disabled() 857 if (np && size < memblock_end_of_DRAM()) { cell_iommu_init_disabled() 904 struct device_node *np; cell_iommu_get_fixed_address() local 908 np = of_node_get(dev->of_node); cell_iommu_get_fixed_address() 910 naddr = of_n_addr_cells(np); cell_iommu_get_fixed_address() 911 nsize = of_n_size_cells(np); cell_iommu_get_fixed_address() 912 np = of_get_next_parent(np); cell_iommu_get_fixed_address() 913 if (!np) cell_iommu_get_fixed_address() 916 ranges = of_get_property(np, "dma-ranges", &len); cell_iommu_get_fixed_address() 930 pna = of_n_addr_cells(np); cell_iommu_get_fixed_address() 939 cpu_addr = of_translate_dma_address(np, ranges + i + naddr); cell_iommu_get_fixed_address() 954 of_node_put(np); cell_iommu_get_fixed_address() 1007 struct device_node *np, unsigned long dbase, unsigned long dsize, cell_iommu_setup_fixed_ptab() 1019 (cell_iommu_get_ioid(np) & CBE_IOPTE_IOID_Mask); cell_iommu_setup_fixed_ptab() 1046 struct device_node *np; cell_iommu_fixed_mapping_init() local 1049 np = of_find_node_by_name(NULL, "axon"); cell_iommu_fixed_mapping_init() 1050 of_node_put(np); cell_iommu_fixed_mapping_init() 1052 if (!np) { cell_iommu_fixed_mapping_init() 1058 np = of_find_node_with_property(NULL, "dma-ranges"); cell_iommu_fixed_mapping_init() 1059 of_node_put(np); cell_iommu_fixed_mapping_init() 1061 if (!np) { cell_iommu_fixed_mapping_init() 1072 for_each_node_by_name(np, "axon") { cell_iommu_fixed_mapping_init() 1073 cell_iommu_get_window(np, &dbase, &dsize); cell_iommu_fixed_mapping_init() 1104 for_each_node_by_name(np, "axon") { cell_iommu_fixed_mapping_init() 1105 cell_iommu_get_window(np, &dbase, &dsize); cell_iommu_fixed_mapping_init() 1118 for_each_node_by_name(np, "axon") { cell_iommu_fixed_mapping_init() 1119 iommu = cell_iommu_alloc(np); cell_iommu_fixed_mapping_init() 1123 cell_iommu_get_window(np, &dbase, &dsize); cell_iommu_fixed_mapping_init() 1136 cell_iommu_setup_fixed_ptab(iommu, np, dbase, dsize, cell_iommu_fixed_mapping_init() 1139 cell_iommu_setup_window(iommu, np, dbase, dsize, 0); cell_iommu_fixed_mapping_init() 1195 struct device_node *np; cell_iommu_init() local 1215 for_each_node_by_name(np, "axon") { cell_iommu_init() 1216 if (np->parent == NULL || np->parent->parent != NULL) cell_iommu_init() 1218 cell_iommu_init_one(np, 0); cell_iommu_init() 1224 for_each_node_by_name(np, "pci-internal") { cell_iommu_init() 1225 if (np->parent == NULL || np->parent->parent != NULL) cell_iommu_init() 1227 cell_iommu_init_one(np, SPIDER_DMA_OFFSET); cell_iommu_init() 1006 cell_iommu_setup_fixed_ptab(struct cbe_iommu *iommu, struct device_node *np, unsigned long dbase, unsigned long dsize, unsigned long fbase, unsigned long fsize) cell_iommu_setup_fixed_ptab() argument
|
/linux-4.4.14/lib/mpi/ |
H A D | mpih-div.c | 59 mpi_ptr_t np, mpi_size_t nsize, mpi_ptr_t dp, mpi_size_t dsize) mpihelp_divrem() 80 n1 = np[nsize - 1]; mpihelp_divrem() 89 udiv_qrnnd(qp[i], n1, n1, np[i], d); mpihelp_divrem() 95 np[0] = n1; mpihelp_divrem() 105 np += nsize - 2; mpihelp_divrem() 108 n1 = np[1]; mpihelp_divrem() 109 n0 = np[0]; mpihelp_divrem() 121 np--; mpihelp_divrem() 123 np[0] = 0; mpihelp_divrem() 134 np[0], 0, d0); mpihelp_divrem() 145 n2 = np[0]; mpihelp_divrem() 159 np[1] = n1; mpihelp_divrem() 160 np[0] = n0; mpihelp_divrem() 169 np += nsize - dsize; mpihelp_divrem() 172 n0 = np[dsize - 1]; mpihelp_divrem() 176 || mpihelp_cmp(np, dp, dsize - 1) >= 0) { mpihelp_divrem() 177 mpihelp_sub_n(np, np, dp, dsize); mpihelp_divrem() 178 n0 = np[dsize - 1]; mpihelp_divrem() 189 np--; mpihelp_divrem() 190 n2 = np[dsize]; mpihelp_divrem() 192 n2 = np[dsize - 1]; mpihelp_divrem() 193 MPN_COPY_DECR(np + 1, np, dsize - 1); mpihelp_divrem() 194 np[0] = 0; mpihelp_divrem() 204 udiv_qrnnd(q, r, n0, np[dsize - 1], dX); mpihelp_divrem() 209 && n0 > np[dsize - 2])) { mpihelp_divrem() 222 cy_limb = mpihelp_submul_1(np, dp, dsize, q); mpihelp_divrem() 225 mpihelp_add_n(np, np, dp, dsize); mpihelp_divrem() 230 n0 = np[dsize - 1]; mpihelp_divrem() 58 mpihelp_divrem(mpi_ptr_t qp, mpi_size_t qextra_limbs, mpi_ptr_t np, mpi_size_t nsize, mpi_ptr_t dp, mpi_size_t dsize) mpihelp_divrem() argument
|
/linux-4.4.14/drivers/net/ethernet/natsemi/ |
H A D | natsemi.c | 205 Most operations are synchronized on the np->lock irq spinlock, except the 670 struct netdev_private *np = netdev_priv(to_net_dev(dev)); natsemi_show_dspcfg_workaround() local 672 return sprintf(buf, "%s\n", np->dspcfg_workaround ? "on" : "off"); natsemi_show_dspcfg_workaround() 679 struct netdev_private *np = netdev_priv(to_net_dev(dev)); natsemi_set_dspcfg_workaround() local 692 spin_lock_irqsave(&np->lock, flags); natsemi_set_dspcfg_workaround() 694 np->dspcfg_workaround = new_setting; natsemi_set_dspcfg_workaround() 696 spin_unlock_irqrestore(&np->lock, flags); natsemi_set_dspcfg_workaround() 703 struct netdev_private *np = netdev_priv(dev); ns_ioaddr() local 705 return np->ioaddr; ns_ioaddr() 722 struct netdev_private *np = netdev_priv(dev); move_int_phy() local 738 if (target == np->phy_addr_external) move_int_phy() 747 struct netdev_private *np = netdev_priv(dev); natsemi_init_media() local 750 if (np->ignore_phy) natsemi_init_media() 757 np->speed = (tmp & BMCR_SPEED100)? SPEED_100 : SPEED_10; natsemi_init_media() 758 np->duplex = (tmp & BMCR_FULLDPLX)? DUPLEX_FULL : DUPLEX_HALF; natsemi_init_media() 759 np->autoneg = (tmp & BMCR_ANENABLE)? AUTONEG_ENABLE: AUTONEG_DISABLE; natsemi_init_media() 760 np->advertising= mdio_read(dev, MII_ADVERTISE); natsemi_init_media() 762 if ((np->advertising & ADVERTISE_ALL) != ADVERTISE_ALL && natsemi_init_media() 763 netif_msg_probe(np)) { natsemi_init_media() 766 pci_name(np->pci_dev), natsemi_init_media() 769 (np->advertising & natsemi_init_media() 772 (np->advertising & natsemi_init_media() 776 if (netif_msg_probe(np)) natsemi_init_media() 779 pci_name(np->pci_dev), mdio_read(dev, MII_BMSR), natsemi_init_media() 780 np->advertising); natsemi_init_media() 803 struct netdev_private *np; natsemi_probe1() local 865 np = netdev_priv(dev); natsemi_probe1() 866 np->ioaddr = ioaddr; natsemi_probe1() 868 netif_napi_add(dev, &np->napi, natsemi_poll, 64); natsemi_probe1() 869 np->dev = dev; natsemi_probe1() 871 np->pci_dev = pdev; natsemi_probe1() 873 np->iosize = iosize; natsemi_probe1() 874 spin_lock_init(&np->lock); natsemi_probe1() 875 np->msg_enable = (debug >= 0) ? (1<<debug)-1 : NATSEMI_DEF_MSG; natsemi_probe1() 876 np->hands_off = 0; natsemi_probe1() 877 np->intr_status = 0; natsemi_probe1() 878 np->eeprom_size = natsemi_pci_info[chip_idx].eeprom_size; natsemi_probe1() 880 np->ignore_phy = 1; natsemi_probe1() 882 np->ignore_phy = 0; natsemi_probe1() 883 np->dspcfg_workaround = dspcfg_workaround; natsemi_probe1() 894 if (np->ignore_phy || readl(ioaddr + ChipConfig) & CfgExtPhy) natsemi_probe1() 903 np->phy_addr_external = find_mii(dev); natsemi_probe1() 906 if (!np->ignore_phy && np->phy_addr_external == PHY_ADDR_NONE) { natsemi_probe1() 908 np->phy_addr_external = PHY_ADDR_INTERNAL; natsemi_probe1() 911 np->phy_addr_external = PHY_ADDR_INTERNAL; natsemi_probe1() 918 np->full_duplex = 1; natsemi_probe1() 922 pci_name(np->pci_dev), option & 15); natsemi_probe1() 925 np->full_duplex = 1; natsemi_probe1() 938 np->srr = readl(ioaddr + SiliconRev); natsemi_probe1() 939 if (netif_msg_hw(np)) natsemi_probe1() 941 pci_name(np->pci_dev), np->srr); natsemi_probe1() 950 if (netif_msg_drv(np)) { natsemi_probe1() 954 (unsigned long long)iostart, pci_name(np->pci_dev), natsemi_probe1() 958 else if (np->ignore_phy) natsemi_probe1() 961 printk(", port MII, phy ad %d.\n", np->phy_addr_external); natsemi_probe1() 1115 struct netdev_private *np = netdev_priv(dev); mdio_read() local 1125 return miiport_read(dev, np->phy_addr_external, reg); mdio_read() 1130 struct netdev_private *np = netdev_priv(dev); mdio_write() local 1137 miiport_write(dev, np->phy_addr_external, reg, data); mdio_write() 1142 struct netdev_private *np = netdev_priv(dev); init_phy_fixup() local 1150 if (np->autoneg == AUTONEG_ENABLE) { init_phy_fixup() 1153 np->advertising != mdio_read(dev, MII_ADVERTISE)) init_phy_fixup() 1157 mdio_write(dev, MII_ADVERTISE, np->advertising); init_phy_fixup() 1162 if (np->speed == SPEED_100) init_phy_fixup() 1164 if (np->duplex == DUPLEX_FULL) init_phy_fixup() 1179 np->mii = (mdio_read(dev, MII_PHYSID1) << 16) init_phy_fixup() 1183 switch (np->mii) { init_phy_fixup() 1218 np->dspcfg = (np->srr <= SRR_DP83815_C)? init_phy_fixup() 1220 writew(np->dspcfg, ioaddr + DSPCFG); init_phy_fixup() 1229 if (np->dspcfg == dspcfg) init_phy_fixup() 1233 if (netif_msg_link(np)) { init_phy_fixup() 1255 struct netdev_private *np = netdev_priv(dev); switch_port_external() local 1263 if (netif_msg_link(np)) { switch_port_external() 1280 move_int_phy(dev, np->phy_addr_external); switch_port_external() 1288 struct netdev_private *np = netdev_priv(dev); switch_port_internal() local 1298 if (netif_msg_link(np)) { switch_port_internal() 1319 if (i==NATSEMI_HW_TIMEOUT && netif_msg_link(np)) { switch_port_internal() 1340 struct netdev_private *np = netdev_priv(dev); find_mii() local 1359 np->mii = (mdio_read(dev, MII_PHYSID1) << 16) find_mii() 1361 if (netif_msg_probe(np)) { find_mii() 1363 pci_name(np->pci_dev), np->mii, i); find_mii() 1389 struct netdev_private *np = netdev_priv(dev); natsemi_reset() local 1427 } else if (netif_msg_hw(np)) { natsemi_reset() 1461 struct netdev_private *np = netdev_priv(dev); reset_rx() local 1464 np->intr_status &= ~RxResetDone; reset_rx() 1469 np->intr_status |= readl(ioaddr + IntrStatus); reset_rx() 1470 if (np->intr_status & RxResetDone) reset_rx() 1477 } else if (netif_msg_hw(np)) { reset_rx() 1485 struct netdev_private *np = netdev_priv(dev); natsemi_reload_eeprom() local 1497 pci_name(np->pci_dev), i*50); natsemi_reload_eeprom() 1498 } else if (netif_msg_hw(np)) { natsemi_reload_eeprom() 1500 pci_name(np->pci_dev), i*50); natsemi_reload_eeprom() 1507 struct netdev_private *np = netdev_priv(dev); natsemi_stop_rxtx() local 1519 } else if (netif_msg_hw(np)) { natsemi_stop_rxtx() 1527 struct netdev_private *np = netdev_priv(dev); netdev_open() local 1529 const int irq = np->pci_dev->irq; netdev_open() 1538 if (netif_msg_ifup(np)) netdev_open() 1546 napi_enable(&np->napi); netdev_open() 1549 spin_lock_irq(&np->lock); netdev_open() 1558 writel(np->cur_rx_mode, ioaddr + RxFilterAddr); netdev_open() 1559 spin_unlock_irq(&np->lock); netdev_open() 1563 if (netif_msg_ifup(np)) netdev_open() 1568 init_timer(&np->timer); netdev_open() 1569 np->timer.expires = round_jiffies(jiffies + NATSEMI_TIMER_FREQ); netdev_open() 1570 np->timer.data = (unsigned long)dev; netdev_open() 1571 np->timer.function = netdev_timer; /* timer handler */ netdev_open() 1572 add_timer(&np->timer); netdev_open() 1579 struct netdev_private *np = netdev_priv(dev); do_cable_magic() local 1585 if (np->srr >= SRR_DP83816_A5) do_cable_magic() 1608 np = netdev_priv(dev); do_cable_magic() 1614 np->dspcfg = data | DSPCFG_LOCK; do_cable_magic() 1615 writew(np->dspcfg, ioaddr + DSPCFG); do_cable_magic() 1624 struct netdev_private *np = netdev_priv(dev); undo_cable_magic() local 1630 if (np->srr >= SRR_DP83816_A5) undo_cable_magic() 1636 np->dspcfg = data & ~DSPCFG_LOCK; undo_cable_magic() 1637 writew(np->dspcfg, ioaddr + DSPCFG); undo_cable_magic() 1643 struct netdev_private *np = netdev_priv(dev); check_link() local 1645 int duplex = np->duplex; check_link() 1649 if (np->ignore_phy) check_link() 1661 if (netif_msg_link(np)) check_link() 1670 if (netif_msg_link(np)) check_link() 1676 duplex = np->full_duplex; check_link() 1680 np->advertising & mdio_read(dev, MII_LPA)); check_link() 1689 if (duplex ^ !!(np->rx_config & RxAcceptTx)) { check_link() 1690 if (netif_msg_link(np)) check_link() 1696 np->rx_config |= RxAcceptTx; check_link() 1697 np->tx_config |= TxCarrierIgn | TxHeartIgn; check_link() 1699 np->rx_config &= ~RxAcceptTx; check_link() 1700 np->tx_config &= ~(TxCarrierIgn | TxHeartIgn); check_link() 1702 writel(np->tx_config, ioaddr + TxConfig); check_link() 1703 writel(np->rx_config, ioaddr + RxConfig); check_link() 1709 struct netdev_private *np = netdev_priv(dev); init_registers() local 1717 writel(np->ring_dma, ioaddr + RxRingPtr); init_registers() 1718 writel(np->ring_dma + RX_RING_SIZE * sizeof(struct netdev_desc), init_registers() 1735 np->tx_config = TxAutoPad | TxCollRetry | TxMxdma_256 | init_registers() 1737 writel(np->tx_config, ioaddr + TxConfig); init_registers() 1742 np->rx_config = RxMxdma_256 | RX_DRTH_VAL; init_registers() 1744 if (np->rx_buf_sz > NATSEMI_LONGPKT) init_registers() 1745 np->rx_config |= RxAcceptLong; init_registers() 1747 writel(np->rx_config, ioaddr + RxConfig); init_registers() 1755 np->SavedClkRun = readl(ioaddr + ClkRun); init_registers() 1756 writel(np->SavedClkRun & ~PMEEnable, ioaddr + ClkRun); init_registers() 1757 if (np->SavedClkRun & PMEStatus && netif_msg_wol(np)) { init_registers() 1789 struct netdev_private *np = netdev_priv(dev); netdev_timer() local 1792 const int irq = np->pci_dev->irq; netdev_timer() 1794 if (netif_msg_timer(np)) { netdev_timer() 1805 spin_lock_irq(&np->lock); netdev_timer() 1810 if (np->dspcfg_workaround && dspcfg != np->dspcfg) { netdev_timer() 1812 spin_unlock_irq(&np->lock); netdev_timer() 1813 if (netif_msg_drv(np)) netdev_timer() 1817 spin_lock_irq(&np->lock); netdev_timer() 1822 spin_unlock_irq(&np->lock); netdev_timer() 1827 spin_unlock_irq(&np->lock); netdev_timer() 1832 spin_unlock_irq(&np->lock); netdev_timer() 1835 spin_lock_irq(&np->lock); netdev_timer() 1837 spin_unlock_irq(&np->lock); netdev_timer() 1839 if (np->oom) { netdev_timer() 1841 np->oom = 0; netdev_timer() 1844 if (!np->oom) { netdev_timer() 1852 mod_timer(&np->timer, round_jiffies(jiffies + next_tick)); netdev_timer() 1854 mod_timer(&np->timer, jiffies + next_tick); netdev_timer() 1859 struct netdev_private *np = netdev_priv(dev); dump_ring() local 1861 if (netif_msg_pktdata(np)) { dump_ring() 1863 printk(KERN_DEBUG " Tx ring at %p:\n", np->tx_ring); dump_ring() 1866 i, np->tx_ring[i].next_desc, dump_ring() 1867 np->tx_ring[i].cmd_status, dump_ring() 1868 np->tx_ring[i].addr); dump_ring() 1870 printk(KERN_DEBUG " Rx ring %p:\n", np->rx_ring); dump_ring() 1873 i, np->rx_ring[i].next_desc, dump_ring() 1874 np->rx_ring[i].cmd_status, dump_ring() 1875 np->rx_ring[i].addr); dump_ring() 1882 struct netdev_private *np = netdev_priv(dev); ns_tx_timeout() local 1884 const int irq = np->pci_dev->irq; ns_tx_timeout() 1887 spin_lock_irq(&np->lock); ns_tx_timeout() 1888 if (!np->hands_off) { ns_tx_timeout() 1889 if (netif_msg_tx_err(np)) ns_tx_timeout() 1904 spin_unlock_irq(&np->lock); ns_tx_timeout() 1914 struct netdev_private *np = netdev_priv(dev); alloc_ring() local 1915 np->rx_ring = pci_alloc_consistent(np->pci_dev, alloc_ring() 1917 &np->ring_dma); alloc_ring() 1918 if (!np->rx_ring) alloc_ring() 1920 np->tx_ring = &np->rx_ring[RX_RING_SIZE]; alloc_ring() 1926 struct netdev_private *np = netdev_priv(dev); refill_rx() local 1929 for (; np->cur_rx - np->dirty_rx > 0; np->dirty_rx++) { refill_rx() 1931 int entry = np->dirty_rx % RX_RING_SIZE; refill_rx() 1932 if (np->rx_skbuff[entry] == NULL) { refill_rx() 1933 unsigned int buflen = np->rx_buf_sz+NATSEMI_PADDING; refill_rx() 1935 np->rx_skbuff[entry] = skb; refill_rx() 1938 np->rx_dma[entry] = pci_map_single(np->pci_dev, refill_rx() 1940 if (pci_dma_mapping_error(np->pci_dev, refill_rx() 1941 np->rx_dma[entry])) { refill_rx() 1943 np->rx_skbuff[entry] = NULL; refill_rx() 1946 np->rx_ring[entry].addr = cpu_to_le32(np->rx_dma[entry]); refill_rx() 1948 np->rx_ring[entry].cmd_status = cpu_to_le32(np->rx_buf_sz); refill_rx() 1950 if (np->cur_rx - np->dirty_rx == RX_RING_SIZE) { refill_rx() 1951 if (netif_msg_rx_err(np)) refill_rx() 1953 np->oom = 1; refill_rx() 1959 struct netdev_private *np = netdev_priv(dev); set_bufsize() local 1961 np->rx_buf_sz = ETH_DATA_LEN + NATSEMI_HEADERS; set_bufsize() 1963 np->rx_buf_sz = dev->mtu + NATSEMI_HEADERS; set_bufsize() 1969 struct netdev_private *np = netdev_priv(dev); init_ring() local 1973 np->dirty_tx = np->cur_tx = 0; init_ring() 1975 np->tx_skbuff[i] = NULL; init_ring() 1976 np->tx_ring[i].next_desc = cpu_to_le32(np->ring_dma init_ring() 1979 np->tx_ring[i].cmd_status = 0; init_ring() 1983 np->dirty_rx = 0; init_ring() 1984 np->cur_rx = RX_RING_SIZE; init_ring() 1985 np->oom = 0; init_ring() 1988 np->rx_head_desc = &np->rx_ring[0]; init_ring() 1995 np->rx_ring[i].next_desc = cpu_to_le32(np->ring_dma init_ring() 1998 np->rx_ring[i].cmd_status = cpu_to_le32(DescOwn); init_ring() 1999 np->rx_skbuff[i] = NULL; init_ring() 2007 struct netdev_private *np = netdev_priv(dev); drain_tx() local 2011 if (np->tx_skbuff[i]) { drain_tx() 2012 pci_unmap_single(np->pci_dev, drain_tx() 2013 np->tx_dma[i], np->tx_skbuff[i]->len, drain_tx() 2015 dev_kfree_skb(np->tx_skbuff[i]); drain_tx() 2018 np->tx_skbuff[i] = NULL; drain_tx() 2024 struct netdev_private *np = netdev_priv(dev); drain_rx() local 2025 unsigned int buflen = np->rx_buf_sz; drain_rx() 2030 np->rx_ring[i].cmd_status = 0; drain_rx() 2031 np->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */ drain_rx() 2032 if (np->rx_skbuff[i]) { drain_rx() 2033 pci_unmap_single(np->pci_dev, np->rx_dma[i], drain_rx() 2036 dev_kfree_skb(np->rx_skbuff[i]); drain_rx() 2038 np->rx_skbuff[i] = NULL; drain_rx() 2050 struct netdev_private *np = netdev_priv(dev); free_ring() local 2051 pci_free_consistent(np->pci_dev, free_ring() 2053 np->rx_ring, np->ring_dma); free_ring() 2058 struct netdev_private *np = netdev_priv(dev); reinit_rx() local 2062 np->dirty_rx = 0; reinit_rx() 2063 np->cur_rx = RX_RING_SIZE; reinit_rx() 2064 np->rx_head_desc = &np->rx_ring[0]; reinit_rx() 2067 np->rx_ring[i].cmd_status = cpu_to_le32(DescOwn); reinit_rx() 2074 struct netdev_private *np = netdev_priv(dev); reinit_ring() local 2079 np->dirty_tx = np->cur_tx = 0; reinit_ring() 2081 np->tx_ring[i].cmd_status = 0; reinit_ring() 2088 struct netdev_private *np = netdev_priv(dev); start_tx() local 2097 entry = np->cur_tx % TX_RING_SIZE; start_tx() 2099 np->tx_skbuff[entry] = skb; start_tx() 2100 np->tx_dma[entry] = pci_map_single(np->pci_dev, start_tx() 2102 if (pci_dma_mapping_error(np->pci_dev, np->tx_dma[entry])) { start_tx() 2103 np->tx_skbuff[entry] = NULL; start_tx() 2109 np->tx_ring[entry].addr = cpu_to_le32(np->tx_dma[entry]); start_tx() 2111 spin_lock_irqsave(&np->lock, flags); start_tx() 2113 if (!np->hands_off) { start_tx() 2114 np->tx_ring[entry].cmd_status = cpu_to_le32(DescOwn | skb->len); start_tx() 2115 /* StrongARM: Explicitly cache flush np->tx_ring and start_tx() 2118 np->cur_tx++; start_tx() 2119 if (np->cur_tx - np->dirty_tx >= TX_QUEUE_LEN - 1) { start_tx() 2121 if (np->cur_tx - np->dirty_tx >= TX_QUEUE_LEN - 1) start_tx() 2130 spin_unlock_irqrestore(&np->lock, flags); start_tx() 2132 if (netif_msg_tx_queued(np)) { start_tx() 2134 dev->name, np->cur_tx, entry); start_tx() 2141 struct netdev_private *np = netdev_priv(dev); netdev_tx_done() local 2143 for (; np->cur_tx - np->dirty_tx > 0; np->dirty_tx++) { netdev_tx_done() 2144 int entry = np->dirty_tx % TX_RING_SIZE; netdev_tx_done() 2145 if (np->tx_ring[entry].cmd_status & cpu_to_le32(DescOwn)) netdev_tx_done() 2147 if (netif_msg_tx_done(np)) netdev_tx_done() 2150 dev->name, np->dirty_tx, netdev_tx_done() 2151 le32_to_cpu(np->tx_ring[entry].cmd_status)); netdev_tx_done() 2152 if (np->tx_ring[entry].cmd_status & cpu_to_le32(DescPktOK)) { netdev_tx_done() 2154 dev->stats.tx_bytes += np->tx_skbuff[entry]->len; netdev_tx_done() 2157 le32_to_cpu(np->tx_ring[entry].cmd_status); netdev_tx_done() 2168 pci_unmap_single(np->pci_dev,np->tx_dma[entry], netdev_tx_done() 2169 np->tx_skbuff[entry]->len, netdev_tx_done() 2172 dev_kfree_skb_irq(np->tx_skbuff[entry]); netdev_tx_done() 2173 np->tx_skbuff[entry] = NULL; netdev_tx_done() 2176 np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) { netdev_tx_done() 2187 struct netdev_private *np = netdev_priv(dev); intr_handler() local 2193 if (np->hands_off || !readl(ioaddr + IntrEnable)) intr_handler() 2196 np->intr_status = readl(ioaddr + IntrStatus); intr_handler() 2198 if (!np->intr_status) intr_handler() 2201 if (netif_msg_intr(np)) intr_handler() 2204 dev->name, np->intr_status, intr_handler() 2207 prefetch(&np->rx_skbuff[np->cur_rx % RX_RING_SIZE]); intr_handler() 2209 if (napi_schedule_prep(&np->napi)) { intr_handler() 2212 __napi_schedule(&np->napi); intr_handler() 2216 dev->name, np->intr_status, intr_handler() 2227 struct netdev_private *np = container_of(napi, struct netdev_private, napi); natsemi_poll() local 2228 struct net_device *dev = np->dev; natsemi_poll() 2233 if (netif_msg_intr(np)) natsemi_poll() 2236 dev->name, np->intr_status, natsemi_poll() 2241 if (np->intr_status & natsemi_poll() 2247 if (np->intr_status & natsemi_poll() 2249 spin_lock(&np->lock); natsemi_poll() 2251 spin_unlock(&np->lock); natsemi_poll() 2255 if (np->intr_status & IntrAbnormalSummary) natsemi_poll() 2256 netdev_error(dev, np->intr_status); natsemi_poll() 2261 np->intr_status = readl(ioaddr + IntrStatus); natsemi_poll() 2262 } while (np->intr_status); natsemi_poll() 2268 spin_lock(&np->lock); natsemi_poll() 2269 if (!np->hands_off) natsemi_poll() 2271 spin_unlock(&np->lock); natsemi_poll() 2280 struct netdev_private *np = netdev_priv(dev); netdev_rx() local 2281 int entry = np->cur_rx % RX_RING_SIZE; netdev_rx() 2282 int boguscnt = np->dirty_rx + RX_RING_SIZE - np->cur_rx; netdev_rx() 2283 s32 desc_status = le32_to_cpu(np->rx_head_desc->cmd_status); netdev_rx() 2284 unsigned int buflen = np->rx_buf_sz; netdev_rx() 2290 if (netif_msg_rx_status(np)) netdev_rx() 2307 if (netif_msg_rx_err(np)) netdev_rx() 2313 np->cur_rx, desc_status); netdev_rx() 2321 spin_lock_irqsave(&np->lock, flags); netdev_rx() 2324 writel(np->ring_dma, ioaddr + RxRingPtr); netdev_rx() 2326 spin_unlock_irqrestore(&np->lock, flags); netdev_rx() 2344 } else if (pkt_len > np->rx_buf_sz) { netdev_rx() 2358 pci_dma_sync_single_for_cpu(np->pci_dev, netdev_rx() 2359 np->rx_dma[entry], netdev_rx() 2363 np->rx_skbuff[entry]->data, pkt_len); netdev_rx() 2365 pci_dma_sync_single_for_device(np->pci_dev, netdev_rx() 2366 np->rx_dma[entry], netdev_rx() 2370 pci_unmap_single(np->pci_dev, np->rx_dma[entry], netdev_rx() 2373 skb_put(skb = np->rx_skbuff[entry], pkt_len); netdev_rx() 2374 np->rx_skbuff[entry] = NULL; netdev_rx() 2381 entry = (++np->cur_rx) % RX_RING_SIZE; netdev_rx() 2382 np->rx_head_desc = &np->rx_ring[entry]; netdev_rx() 2383 desc_status = le32_to_cpu(np->rx_head_desc->cmd_status); netdev_rx() 2388 if (np->oom) netdev_rx() 2389 mod_timer(&np->timer, jiffies + 1); netdev_rx() 2396 struct netdev_private *np = netdev_priv(dev); netdev_error() local 2399 spin_lock(&np->lock); netdev_error() 2403 netif_msg_link(np)) { netdev_error() 2407 np->advertising, lpa); netdev_error() 2418 if ((np->tx_config & TxDrthMask) < TX_DRTH_VAL_LIMIT) { netdev_error() 2419 np->tx_config += TX_DRTH_VAL_INC; netdev_error() 2420 if (netif_msg_tx_err(np)) netdev_error() 2423 dev->name, np->tx_config); netdev_error() 2425 if (netif_msg_tx_err(np)) netdev_error() 2428 dev->name, np->tx_config); netdev_error() 2430 writel(np->tx_config, ioaddr + TxConfig); netdev_error() 2432 if (intr_status & WOLPkt && netif_msg_wol(np)) { netdev_error() 2438 if (netif_msg_rx_err(np) && netif_msg_intr(np)) { netdev_error() 2454 spin_unlock(&np->lock); netdev_error() 2468 struct netdev_private *np = netdev_priv(dev); get_stats() local 2471 spin_lock_irq(&np->lock); get_stats() 2472 if (netif_running(dev) && !np->hands_off) get_stats() 2474 spin_unlock_irq(&np->lock); get_stats() 2482 struct netdev_private *np = netdev_priv(dev); natsemi_poll_controller() local 2483 const int irq = np->pci_dev->irq; natsemi_poll_controller() 2495 struct netdev_private *np = netdev_priv(dev); __set_rx_mode() local 2524 np->cur_rx_mode = rx_mode; 2536 struct netdev_private *np = netdev_priv(dev); natsemi_change_mtu() local 2538 const int irq = np->pci_dev->irq; natsemi_change_mtu() 2541 spin_lock(&np->lock); natsemi_change_mtu() 2549 writel(np->ring_dma, ioaddr + RxRingPtr); natsemi_change_mtu() 2552 spin_unlock(&np->lock); natsemi_change_mtu() 2560 struct netdev_private *np = netdev_priv(dev); set_rx_mode() local 2561 spin_lock_irq(&np->lock); set_rx_mode() 2562 if (!np->hands_off) set_rx_mode() 2564 spin_unlock_irq(&np->lock); set_rx_mode() 2569 struct netdev_private *np = netdev_priv(dev); get_drvinfo() local 2572 strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); get_drvinfo() 2582 struct netdev_private *np = netdev_priv(dev); get_eeprom_len() local 2583 return np->eeprom_size; get_eeprom_len() 2588 struct netdev_private *np = netdev_priv(dev); get_settings() local 2589 spin_lock_irq(&np->lock); get_settings() 2591 spin_unlock_irq(&np->lock); get_settings() 2597 struct netdev_private *np = netdev_priv(dev); set_settings() local 2599 spin_lock_irq(&np->lock); set_settings() 2601 spin_unlock_irq(&np->lock); set_settings() 2607 struct netdev_private *np = netdev_priv(dev); get_wol() local 2608 spin_lock_irq(&np->lock); get_wol() 2611 spin_unlock_irq(&np->lock); get_wol() 2616 struct netdev_private *np = netdev_priv(dev); set_wol() local 2618 spin_lock_irq(&np->lock); set_wol() 2621 spin_unlock_irq(&np->lock); set_wol() 2627 struct netdev_private *np = netdev_priv(dev); get_regs() local 2629 spin_lock_irq(&np->lock); get_regs() 2631 spin_unlock_irq(&np->lock); get_regs() 2636 struct netdev_private *np = netdev_priv(dev); get_msglevel() local 2637 return np->msg_enable; get_msglevel() 2642 struct netdev_private *np = netdev_priv(dev); set_msglevel() local 2643 np->msg_enable = val; set_msglevel() 2669 struct netdev_private *np = netdev_priv(dev); get_eeprom() local 2673 eebuf = kmalloc(np->eeprom_size, GFP_KERNEL); get_eeprom() 2678 spin_lock_irq(&np->lock); get_eeprom() 2680 spin_unlock_irq(&np->lock); get_eeprom() 2705 struct netdev_private *np = netdev_priv(dev); netdev_set_wol() local 2722 if (np->srr >= SRR_DP83815_D) { netdev_set_wol() 2735 struct netdev_private *np = netdev_priv(dev); netdev_get_wol() local 2742 if (np->srr >= SRR_DP83815_D) { netdev_get_wol() 2771 struct netdev_private *np = netdev_priv(dev); netdev_set_sopass() local 2776 if (np->srr < SRR_DP83815_D) { netdev_set_sopass() 2803 struct netdev_private *np = netdev_priv(dev); netdev_get_sopass() local 2808 if (np->srr < SRR_DP83815_D) { netdev_get_sopass() 2832 struct netdev_private *np = netdev_priv(dev); netdev_get_ecmd() local 2836 ethtool_cmd_speed_set(ecmd, np->speed); netdev_get_ecmd() 2837 ecmd->duplex = np->duplex; netdev_get_ecmd() 2838 ecmd->autoneg = np->autoneg; netdev_get_ecmd() 2840 if (np->advertising & ADVERTISE_10HALF) netdev_get_ecmd() 2842 if (np->advertising & ADVERTISE_10FULL) netdev_get_ecmd() 2844 if (np->advertising & ADVERTISE_100HALF) netdev_get_ecmd() 2846 if (np->advertising & ADVERTISE_100FULL) netdev_get_ecmd() 2852 ecmd->phy_address = np->phy_addr_external; netdev_get_ecmd() 2892 np->advertising & mdio_read(dev, MII_LPA)); netdev_get_ecmd() 2910 struct netdev_private *np = netdev_priv(dev); netdev_set_ecmd() local 2938 if (np->ignore_phy && (ecmd->autoneg == AUTONEG_ENABLE || netdev_set_ecmd() 2959 np->autoneg = ecmd->autoneg; netdev_set_ecmd() 2960 np->phy_addr_external = ecmd->phy_address & PhyAddrMask; netdev_set_ecmd() 2961 if (np->autoneg == AUTONEG_ENABLE) { netdev_set_ecmd() 2963 np->advertising &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4); netdev_set_ecmd() 2965 np->advertising |= ADVERTISE_10HALF; netdev_set_ecmd() 2967 np->advertising |= ADVERTISE_10FULL; netdev_set_ecmd() 2969 np->advertising |= ADVERTISE_100HALF; netdev_set_ecmd() 2971 np->advertising |= ADVERTISE_100FULL; netdev_set_ecmd() 2973 np->speed = ethtool_cmd_speed(ecmd); netdev_set_ecmd() 2974 np->duplex = ecmd->duplex; netdev_set_ecmd() 2976 if (np->duplex == DUPLEX_HALF) netdev_set_ecmd() 2977 np->full_duplex = 0; netdev_set_ecmd() 3049 struct netdev_private *np = netdev_priv(dev); netdev_get_eeprom() local 3052 for (i = 0; i < np->eeprom_size/2; i++) { netdev_get_eeprom() 3065 struct netdev_private *np = netdev_priv(dev); netdev_ioctl() local 3069 data->phy_id = np->phy_addr_external; netdev_ioctl() 3078 if ((data->phy_id & 0x1f) == np->phy_addr_external) netdev_ioctl() 3092 if ((data->phy_id & 0x1f) == np->phy_addr_external) { netdev_ioctl() 3094 np->advertising = data->val_in; netdev_ioctl() 3099 if ((data->phy_id & 0x1f) == np->phy_addr_external) { netdev_ioctl() 3101 np->advertising = data->val_in; netdev_ioctl() 3117 struct netdev_private *np = netdev_priv(dev); enable_wol_mode() local 3119 if (netif_msg_wol(np)) enable_wol_mode() 3133 writel(np->SavedClkRun | PMEEnable | PMEStatus, ioaddr + ClkRun); enable_wol_mode() 3150 struct netdev_private *np = netdev_priv(dev); netdev_close() local 3151 const int irq = np->pci_dev->irq; netdev_close() 3153 if (netif_msg_ifdown(np)) netdev_close() 3157 if (netif_msg_pktdata(np)) netdev_close() 3160 dev->name, np->cur_tx, np->dirty_tx, netdev_close() 3161 np->cur_rx, np->dirty_rx); netdev_close() 3163 napi_disable(&np->napi); netdev_close() 3172 del_timer_sync(&np->timer); netdev_close() 3174 spin_lock_irq(&np->lock); netdev_close() 3176 np->hands_off = 1; netdev_close() 3177 spin_unlock_irq(&np->lock); netdev_close() 3186 spin_lock_irq(&np->lock); netdev_close() 3187 np->hands_off = 0; netdev_close() 3198 spin_unlock_irq(&np->lock); netdev_close() 3217 writel(np->SavedClkRun, ioaddr + ClkRun); netdev_close() 3248 * No function accesses the hardware without checking np->hands_off. 3249 * the check occurs under spin_lock_irq(&np->lock); 3267 struct netdev_private *np = netdev_priv(dev); natsemi_suspend() local 3272 const int irq = np->pci_dev->irq; natsemi_suspend() 3274 del_timer_sync(&np->timer); natsemi_suspend() 3277 spin_lock_irq(&np->lock); natsemi_suspend() 3280 np->hands_off = 1; natsemi_suspend() 3284 spin_unlock_irq(&np->lock); natsemi_suspend() 3287 napi_disable(&np->napi); natsemi_suspend() 3305 writel(np->SavedClkRun, ioaddr + ClkRun); natsemi_suspend() 3318 struct netdev_private *np = netdev_priv(dev); natsemi_resume() local 3325 const int irq = np->pci_dev->irq; natsemi_resume() 3327 BUG_ON(!np->hands_off); natsemi_resume() 3336 napi_enable(&np->napi); natsemi_resume() 3341 spin_lock_irq(&np->lock); natsemi_resume() 3342 np->hands_off = 0; natsemi_resume() 3345 spin_unlock_irq(&np->lock); natsemi_resume() 3348 mod_timer(&np->timer, round_jiffies(jiffies + 1*HZ)); natsemi_resume()
|
/linux-4.4.14/arch/powerpc/platforms/pseries/ |
H A D | reconfig.c | 29 struct device_node *np; pSeries_reconfig_add_node() local 32 np = kzalloc(sizeof(*np), GFP_KERNEL); pSeries_reconfig_add_node() 33 if (!np) pSeries_reconfig_add_node() 36 np->full_name = kstrdup(path, GFP_KERNEL); pSeries_reconfig_add_node() 37 if (!np->full_name) pSeries_reconfig_add_node() 40 np->properties = proplist; pSeries_reconfig_add_node() 41 of_node_set_flag(np, OF_DYNAMIC); pSeries_reconfig_add_node() 42 of_node_init(np); pSeries_reconfig_add_node() 44 np->parent = pseries_of_derive_parent(path); pSeries_reconfig_add_node() 45 if (IS_ERR(np->parent)) { pSeries_reconfig_add_node() 46 err = PTR_ERR(np->parent); pSeries_reconfig_add_node() 50 err = of_attach_node(np); pSeries_reconfig_add_node() 56 of_node_put(np->parent); pSeries_reconfig_add_node() 61 if (np) { pSeries_reconfig_add_node() 62 of_node_put(np->parent); pSeries_reconfig_add_node() 63 kfree(np->full_name); pSeries_reconfig_add_node() 64 kfree(np); pSeries_reconfig_add_node() 69 static int pSeries_reconfig_remove_node(struct device_node *np) pSeries_reconfig_remove_node() argument 73 parent = of_get_parent(np); pSeries_reconfig_remove_node() 77 if ((child = of_get_next_child(np, NULL))) { pSeries_reconfig_remove_node() 83 of_detach_node(np); pSeries_reconfig_remove_node() 85 of_node_put(np); /* Must decrement the refcount */ pSeries_reconfig_remove_node() 202 struct device_node *np; do_add_node() local 215 if ((np = of_find_node_by_path(path))) { do_add_node() 216 of_node_put(np); do_add_node() 280 struct device_node *np; do_add_property() local 285 buf = parse_node(buf, bufsize, &np); do_add_property() 287 if (!np) do_add_property() 297 of_add_property(np, prop); do_add_property() 304 struct device_node *np; do_remove_property() local 307 buf = parse_node(buf, bufsize, &np); do_remove_property() 309 if (!np) do_remove_property() 319 prop = of_find_property(np, buf, NULL); do_remove_property() 321 return of_remove_property(np, prop); do_remove_property() 326 struct device_node *np; do_update_property() local 331 buf = parse_node(buf, bufsize, &np); do_update_property() 334 if (!np) do_update_property() 351 return of_update_property(np, newprop); do_update_property()
|
H A D | event_sources.c | 23 void request_event_sources_irqs(struct device_node *np, request_event_sources_irqs() argument 37 opicprop = of_get_property(np, "open-pic-interrupt", &opicplen); request_event_sources_irqs() 47 np->full_name); request_event_sources_irqs() 58 for (index = 0; of_irq_parse_one(np, index, &oirq) == 0; request_event_sources_irqs() 66 np->full_name); request_event_sources_irqs() 78 "%d for %s\n", virqs[i], np->full_name); request_event_sources_irqs()
|
/linux-4.4.14/drivers/video/fbdev/omap2/dss/ |
H A D | dss-of.c | 93 struct device_node *np; dss_of_port_get_parent_device() local 99 np = of_get_parent(port); dss_of_port_get_parent_device() 101 for (i = 0; i < 2 && np; ++i) { dss_of_port_get_parent_device() 104 prop = of_find_property(np, "compatible", NULL); dss_of_port_get_parent_device() 107 return np; dss_of_port_get_parent_device() 109 np = of_get_next_parent(np); dss_of_port_get_parent_device() 129 struct device_node *np; omapdss_of_get_remote_port() local 131 np = of_parse_phandle(node, "remote-endpoint", 0); omapdss_of_get_remote_port() 132 if (!np) omapdss_of_get_remote_port() 135 np = of_get_next_parent(np); omapdss_of_get_remote_port() 137 return np; omapdss_of_get_remote_port()
|
/linux-4.4.14/drivers/scsi/ |
H A D | ncr53c8xx.c | 513 #define _m_calloc_dma(np, s, n) __m_calloc_dma(np->dev, s, n) 514 #define _m_free_dma(np, p, s, n) __m_free_dma(np->dev, p, s, n) 515 #define m_calloc_dma(s, n) _m_calloc_dma(np, s, n) 516 #define m_free_dma(p, s, n) _m_free_dma(np, p, s, n) 517 #define _vtobus(np, p) __vtobus(np->dev, p) 518 #define vtobus(p) _vtobus(np, p) 552 #define unmap_scsi_data(np, cmd) __unmap_scsi_data(np->dev, cmd) 553 #define map_scsi_sg_data(np, cmd) __map_scsi_sg_data(np->dev, cmd) 576 #define bootverbose (np->verbose) 1016 #define bootverbose (np->verbose) 1761 #define NCB_SCRIPT_PHYS(np,lbl) (np->p_script + offsetof (struct script, lbl)) 1762 #define NCB_SCRIPTH_PHYS(np,lbl) (np->p_scripth + offsetof (struct scripth,lbl)) 1919 static void ncr_alloc_ccb (struct ncb *np, u_char tn, u_char ln); 1920 static void ncr_complete (struct ncb *np, struct ccb *cp); 1921 static void ncr_exception (struct ncb *np); 1922 static void ncr_free_ccb (struct ncb *np, struct ccb *cp); 1923 static void ncr_init_ccb (struct ncb *np, struct ccb *cp); 1924 static void ncr_init_tcb (struct ncb *np, u_char tn); 1925 static struct lcb * ncr_alloc_lcb (struct ncb *np, u_char tn, u_char ln); 1926 static struct lcb * ncr_setup_lcb (struct ncb *np, struct scsi_device *sdev); 1927 static void ncr_getclock (struct ncb *np, int mult); 1928 static void ncr_selectclock (struct ncb *np, u_char scntl3); 1929 static struct ccb *ncr_get_ccb (struct ncb *np, struct scsi_cmnd *cmd); 1930 static void ncr_chip_reset (struct ncb *np, int delay); 1931 static void ncr_init (struct ncb *np, int reset, char * msg, u_long code); 1932 static int ncr_int_sbmc (struct ncb *np); 1933 static int ncr_int_par (struct ncb *np); 1934 static void ncr_int_ma (struct ncb *np); 1935 static void ncr_int_sir (struct ncb *np); 1936 static void ncr_int_sto (struct ncb *np); 1937 static void ncr_negotiate (struct ncb* np, struct tcb* tp); 1938 static int ncr_prepare_nego(struct ncb *np, struct ccb *cp, u_char *msgptr); 1941 (struct ncb *np, ncrcmd *src, ncrcmd *dst, int len); 1943 static int ncr_scatter (struct ncb *np, struct ccb *cp, struct scsi_cmnd *cmd); 1944 static void ncr_getsync (struct ncb *np, u_char sfac, u_char *fakp, u_char *scntl3p); 1945 static void ncr_setsync (struct ncb *np, struct ccb *cp, u_char scntl3, u_char sxfer); 1946 static void ncr_setup_tags (struct ncb *np, struct scsi_device *sdev); 1947 static void ncr_setwide (struct ncb *np, struct ccb *cp, u_char wide, u_char ack); 1948 static int ncr_snooptest (struct ncb *np); 1949 static void ncr_timeout (struct ncb *np); 1950 static void ncr_wakeup (struct ncb *np, u_long code); 1951 static void ncr_wakeup_done (struct ncb *np); 1952 static void ncr_start_next_ccb (struct ncb *np, struct lcb * lp, int maxn); 1953 static void ncr_put_start_queue(struct ncb *np, struct ccb *cp); 1955 static void insert_into_waiting_list(struct ncb *np, struct scsi_cmnd *cmd); 1956 static struct scsi_cmnd *retrieve_from_waiting_list(int to_remove, struct ncb *np, struct scsi_cmnd *cmd); 1957 static void process_waiting_list(struct ncb *np, int sts); 1959 #define remove_from_waiting_list(np, cmd) \ 1960 retrieve_from_waiting_list(1, (np), (cmd)) 1961 #define requeue_waiting_list(np) process_waiting_list((np), DID_OK) 1962 #define reset_waiting_list(np) process_waiting_list((np), DID_RESET) 1964 static inline char *ncr_name (struct ncb *np) ncr_name() argument 1966 return np->inst_name; ncr_name() 3524 ncr_script_copy_and_bind (struct ncb *np, ncrcmd *src, ncrcmd *dst, int len) ncr_script_copy_and_bind() argument 3548 ncr_name(np), (int) (src-start-1)); ncr_script_copy_and_bind() 3578 ncr_name(np), (int) (src-start-1)); ncr_script_copy_and_bind() 3585 if ((opcode & SCR_NO_FLUSH) && !(np->features & FE_PFEN)) { ncr_script_copy_and_bind() 3627 new = (old & ~RELOC_MASK) + np->paddr; ncr_script_copy_and_bind() 3630 new = (old & ~RELOC_MASK) + np->p_script; ncr_script_copy_and_bind() 3633 new = (old & ~RELOC_MASK) + np->p_scripth; ncr_script_copy_and_bind() 3636 new = (old & ~RELOC_MASK) + np->p_ncb; ncr_script_copy_and_bind() 3728 static inline void ncr_init_burst(struct ncb *np, u_char bc) ncr_init_burst() argument 3730 u_char *be = &np->rv_ctest0; ncr_init_burst() 3732 np->rv_dmode &= ~(0x3 << 6); ncr_init_burst() 3733 np->rv_ctest5 &= ~0x4; ncr_init_burst() 3739 np->rv_dmode |= ((bc & 0x3) << 6); ncr_init_burst() 3740 np->rv_ctest5 |= (bc & 0x4); ncr_init_burst() 3744 static void __init ncr_prepare_setting(struct ncb *np) ncr_prepare_setting() argument 3754 np->sv_scntl0 = INB(nc_scntl0) & 0x0a; ncr_prepare_setting() 3755 np->sv_scntl3 = INB(nc_scntl3) & 0x07; ncr_prepare_setting() 3756 np->sv_dmode = INB(nc_dmode) & 0xce; ncr_prepare_setting() 3757 np->sv_dcntl = INB(nc_dcntl) & 0xa8; ncr_prepare_setting() 3758 np->sv_ctest0 = INB(nc_ctest0) & 0x84; ncr_prepare_setting() 3759 np->sv_ctest3 = INB(nc_ctest3) & 0x01; ncr_prepare_setting() 3760 np->sv_ctest4 = INB(nc_ctest4) & 0x80; ncr_prepare_setting() 3761 np->sv_ctest5 = INB(nc_ctest5) & 0x24; ncr_prepare_setting() 3762 np->sv_gpcntl = INB(nc_gpcntl); ncr_prepare_setting() 3763 np->sv_stest2 = INB(nc_stest2) & 0x20; ncr_prepare_setting() 3764 np->sv_stest4 = INB(nc_stest4); ncr_prepare_setting() 3770 np->maxwide = (np->features & FE_WIDE)? 1 : 0; ncr_prepare_setting() 3775 if (np->features & FE_ULTRA) ncr_prepare_setting() 3776 np->clock_khz = 80000; ncr_prepare_setting() 3778 np->clock_khz = 40000; ncr_prepare_setting() 3783 if (np->features & FE_QUAD) ncr_prepare_setting() 3784 np->multiplier = 4; ncr_prepare_setting() 3785 else if (np->features & FE_DBLR) ncr_prepare_setting() 3786 np->multiplier = 2; ncr_prepare_setting() 3788 np->multiplier = 1; ncr_prepare_setting() 3794 if (np->features & FE_VARCLK) ncr_prepare_setting() 3795 ncr_getclock(np, np->multiplier); ncr_prepare_setting() 3800 i = np->clock_divn - 1; ncr_prepare_setting() 3802 if (10ul * SCSI_NCR_MIN_ASYNC * np->clock_khz > div_10M[i]) { ncr_prepare_setting() 3807 np->rv_scntl3 = i+1; ncr_prepare_setting() 3814 period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz; ncr_prepare_setting() 3815 if (period <= 250) np->minsync = 10; ncr_prepare_setting() 3816 else if (period <= 303) np->minsync = 11; ncr_prepare_setting() 3817 else if (period <= 500) np->minsync = 12; ncr_prepare_setting() 3818 else np->minsync = (period + 40 - 1) / 40; ncr_prepare_setting() 3824 if (np->minsync < 25 && !(np->features & FE_ULTRA)) ncr_prepare_setting() 3825 np->minsync = 25; ncr_prepare_setting() 3831 period = (11 * div_10M[np->clock_divn - 1]) / (4 * np->clock_khz); ncr_prepare_setting() 3832 np->maxsync = period > 2540 ? 254 : period / 10; ncr_prepare_setting() 3838 np->rv_scntl0 = np->sv_scntl0; ncr_prepare_setting() 3839 np->rv_dmode = np->sv_dmode; ncr_prepare_setting() 3840 np->rv_dcntl = np->sv_dcntl; ncr_prepare_setting() 3841 np->rv_ctest0 = np->sv_ctest0; ncr_prepare_setting() 3842 np->rv_ctest3 = np->sv_ctest3; ncr_prepare_setting() 3843 np->rv_ctest4 = np->sv_ctest4; ncr_prepare_setting() 3844 np->rv_ctest5 = np->sv_ctest5; ncr_prepare_setting() 3845 burst_max = burst_code(np->sv_dmode, np->sv_ctest0); ncr_prepare_setting() 3853 burst_max = burst_code(np->sv_dmode, np->sv_ctest0); ncr_prepare_setting() 3856 if (burst_max > np->maxburst) ncr_prepare_setting() 3857 burst_max = np->maxburst; ncr_prepare_setting() 3862 if (np->features & FE_ERL) ncr_prepare_setting() 3863 np->rv_dmode |= ERL; /* Enable Read Line */ ncr_prepare_setting() 3864 if (np->features & FE_BOF) ncr_prepare_setting() 3865 np->rv_dmode |= BOF; /* Burst Opcode Fetch */ ncr_prepare_setting() 3866 if (np->features & FE_ERMP) ncr_prepare_setting() 3867 np->rv_dmode |= ERMP; /* Enable Read Multiple */ ncr_prepare_setting() 3868 if (np->features & FE_PFEN) ncr_prepare_setting() 3869 np->rv_dcntl |= PFEN; /* Prefetch Enable */ ncr_prepare_setting() 3870 if (np->features & FE_CLSE) ncr_prepare_setting() 3871 np->rv_dcntl |= CLSE; /* Cache Line Size Enable */ ncr_prepare_setting() 3872 if (np->features & FE_WRIE) ncr_prepare_setting() 3873 np->rv_ctest3 |= WRIE; /* Write and Invalidate */ ncr_prepare_setting() 3874 if (np->features & FE_DFS) ncr_prepare_setting() 3875 np->rv_ctest5 |= DFS; /* Dma Fifo Size */ ncr_prepare_setting() 3876 if (np->features & FE_MUX) ncr_prepare_setting() 3877 np->rv_ctest4 |= MUX; /* Host bus multiplex mode */ ncr_prepare_setting() 3878 if (np->features & FE_EA) ncr_prepare_setting() 3879 np->rv_dcntl |= EA; /* Enable ACK */ ncr_prepare_setting() 3880 if (np->features & FE_EHP) ncr_prepare_setting() 3881 np->rv_ctest0 |= EHP; /* Even host parity */ ncr_prepare_setting() 3887 np->rv_ctest4 |= MPEE; /* Master parity checking */ ncr_prepare_setting() 3889 np->rv_scntl0 |= 0x0a; /* full arb., ena parity, par->ATN */ ncr_prepare_setting() 3894 if (np->myaddr == 255) { ncr_prepare_setting() 3895 np->myaddr = INB(nc_scid) & 0x07; ncr_prepare_setting() 3896 if (!np->myaddr) ncr_prepare_setting() 3897 np->myaddr = SCSI_NCR_MYADDR; ncr_prepare_setting() 3905 ncr_init_burst(np, burst_max); ncr_prepare_setting() 3916 np->scsi_mode = SMODE_SE; ncr_prepare_setting() 3917 if (np->features & FE_DIFF) { ncr_prepare_setting() 3920 if (np->sv_scntl3) { ncr_prepare_setting() 3921 if (np->sv_stest2 & 0x20) ncr_prepare_setting() 3922 np->scsi_mode = SMODE_HVD; ncr_prepare_setting() 3929 np->scsi_mode = SMODE_HVD; ncr_prepare_setting() 3931 if (np->sv_stest2 & 0x20) ncr_prepare_setting() 3932 np->scsi_mode = SMODE_HVD; ncr_prepare_setting() 3938 if (np->scsi_mode == SMODE_HVD) ncr_prepare_setting() 3939 np->rv_stest2 |= 0x20; ncr_prepare_setting() 3949 !(np->features & FE_LEDC) && !(np->sv_gpcntl & 0x01)) ncr_prepare_setting() 3950 np->features |= FE_LED0; ncr_prepare_setting() 3957 np->rv_dcntl |= IRQM; ncr_prepare_setting() 3960 np->rv_dcntl |= (np->sv_dcntl & IRQM); ncr_prepare_setting() 3972 struct tcb *tp = &np->target[i]; ncr_prepare_setting() 3979 np->target[i].usrflag = UF_NODISC; ncr_prepare_setting() 3986 printk(KERN_INFO "%s: ID %d, Fast-%d%s%s\n", ncr_name(np), ncr_prepare_setting() 3987 np->myaddr, ncr_prepare_setting() 3988 np->minsync < 12 ? 40 : (np->minsync < 25 ? 20 : 10), ncr_prepare_setting() 3989 (np->rv_scntl0 & 0xa) ? ", Parity Checking" : ", NO Parity", ncr_prepare_setting() 3990 (np->rv_stest2 & 0x20) ? ", Differential" : ""); ncr_prepare_setting() 3995 ncr_name(np), np->sv_scntl3, np->sv_dmode, np->sv_dcntl, ncr_prepare_setting() 3996 np->sv_ctest3, np->sv_ctest4, np->sv_ctest5); ncr_prepare_setting() 4000 ncr_name(np), np->rv_scntl3, np->rv_dmode, np->rv_dcntl, ncr_prepare_setting() 4001 np->rv_ctest3, np->rv_ctest4, np->rv_ctest5); ncr_prepare_setting() 4004 if (bootverbose && np->paddr2) ncr_prepare_setting() 4006 ncr_name(np), np->paddr2); ncr_prepare_setting() 4028 static inline void ncr_queue_done_cmd(struct ncb *np, struct scsi_cmnd *cmd) ncr_queue_done_cmd() argument 4030 unmap_scsi_data(np, cmd); ncr_queue_done_cmd() 4031 cmd->host_scribble = (char *) np->done_list; ncr_queue_done_cmd() 4032 np->done_list = cmd; ncr_queue_done_cmd() 4060 static int ncr_prepare_nego(struct ncb *np, struct ccb *cp, u_char *msgptr) ncr_prepare_nego() argument 4062 struct tcb *tp = &np->target[cp->target]; ncr_prepare_nego() 4119 static int ncr_queue_command (struct ncb *np, struct scsi_cmnd *cmd) ncr_queue_command() argument 4122 struct tcb *tp = &np->target[sdev->id]; ncr_queue_command() 4138 if ((sdev->id == np->myaddr ) || ncr_queue_command() 4173 if (np->settle_time && cmd->request->timeout >= HZ) { ncr_queue_command() 4175 if (time_after(np->settle_time, tlimit)) ncr_queue_command() 4176 np->settle_time = tlimit; ncr_queue_command() 4179 if (np->settle_time || !(cp=ncr_get_ccb (np, cmd))) { ncr_queue_command() 4180 insert_into_waiting_list(np, cmd); ncr_queue_command() 4195 (cp != np->ccb && np->disc && !(tp->usrflag & UF_NODISC))) ncr_queue_command() 4203 char order = np->order; ncr_queue_command() 4253 segments = ncr_scatter(np, cp, cp->cmd); ncr_queue_command() 4255 ncr_free_ccb(np, cp); ncr_queue_command() 4276 msglen += ncr_prepare_nego (np, cp, msgptr + msglen); ncr_queue_command() 4297 goalp = NCB_SCRIPT_PHYS (np, data_out2) + 8; ncr_queue_command() 4301 lastp = NCB_SCRIPTH_PHYS (np, hdata_out2); ncr_queue_command() 4310 goalp = NCB_SCRIPT_PHYS (np, data_in2) + 8; ncr_queue_command() 4314 lastp = NCB_SCRIPTH_PHYS (np, hdata_in2); ncr_queue_command() 4320 lastp = goalp = NCB_SCRIPT_PHYS (np, no_data); ncr_queue_command() 4333 cpu_to_scr(NCB_SCRIPTH_PHYS (np, data_io)); ncr_queue_command() 4357 cp->start.schedule.l_paddr = cpu_to_scr(NCB_SCRIPT_PHYS (np, select)); ncr_queue_command() 4358 cp->restart.schedule.l_paddr = cpu_to_scr(NCB_SCRIPT_PHYS (np, resel_dsa)); ncr_queue_command() 4408 ncr_start_next_ccb(np, lp, 2); ncr_queue_command() 4410 ncr_put_start_queue(np, cp); ncr_queue_command() 4428 static void ncr_start_next_ccb(struct ncb *np, struct lcb *lp, int maxn) ncr_start_next_ccb() argument 4445 ncr_put_start_queue(np, cp); ncr_start_next_ccb() 4449 static void ncr_put_start_queue(struct ncb *np, struct ccb *cp) ncr_put_start_queue() argument 4456 if (!np->squeueput) np->squeueput = 1; ncr_put_start_queue() 4457 qidx = np->squeueput + 2; ncr_put_start_queue() 4460 np->scripth->tryloop [qidx] = cpu_to_scr(NCB_SCRIPT_PHYS (np, idle)); ncr_put_start_queue() 4462 np->scripth->tryloop [np->squeueput] = cpu_to_scr(CCB_PHYS (cp, start)); ncr_put_start_queue() 4464 np->squeueput = qidx; ncr_put_start_queue() 4465 ++np->queuedccbs; ncr_put_start_queue() 4469 printk ("%s: queuepos=%d.\n", ncr_name (np), np->squeueput); ncr_put_start_queue() 4480 static int ncr_reset_scsi_bus(struct ncb *np, int enab_int, int settle_delay) ncr_reset_scsi_bus() argument 4485 np->settle_time = jiffies + settle_delay * HZ; ncr_reset_scsi_bus() 4490 ncr_name(np), settle_delay); ncr_reset_scsi_bus() 4492 ncr_chip_reset(np, 100); ncr_reset_scsi_bus() 4520 if (!(np->features & FE_WIDE)) ncr_reset_scsi_bus() 4525 ncr_name(np)); ncr_reset_scsi_bus() 4528 ncr_name(np), ncr_reset_scsi_bus() 4529 (np->features & FE_WIDE) ? "dp1,d15-8," : "", ncr_reset_scsi_bus() 4546 static void ncr_start_reset(struct ncb *np) ncr_start_reset() argument 4548 if (!np->settle_time) { ncr_start_reset() 4549 ncr_reset_scsi_bus(np, 1, driver_setup.settle_delay); ncr_start_reset() 4562 static int ncr_reset_bus (struct ncb *np, struct scsi_cmnd *cmd, int sync_reset) ncr_reset_bus() argument 4571 if (np->settle_time) { ncr_reset_bus() 4580 ncr_start_reset(np); ncr_reset_bus() 4584 for (found=0, cp=np->ccb; cp; cp=cp->link_ccb) { ncr_reset_bus() 4597 if (!found && retrieve_from_waiting_list(0, np, cmd)) ncr_reset_bus() 4602 reset_waiting_list(np); ncr_reset_bus() 4606 ncr_wakeup(np, HS_RESET); ncr_reset_bus() 4613 if (!found && sync_reset && !retrieve_from_waiting_list(0, np, cmd)) { ncr_reset_bus() 4615 ncr_queue_done_cmd(np, cmd); ncr_reset_bus() 4631 static int ncr_abort_command (struct ncb *np, struct scsi_cmnd *cmd) 4641 if (remove_from_waiting_list(np, cmd)) { 4643 ncr_queue_done_cmd(np, cmd); 4650 for (found=0, cp=np->ccb; cp; cp=cp->link_ccb) { 4665 if (np->settle_time) { 4677 printk ("%s: abort ccb=%p (cancel)\n", ncr_name (np), cp); 4679 cpu_to_scr(NCB_SCRIPTH_PHYS (np, cancel)); 4684 cpu_to_scr(NCB_SCRIPTH_PHYS (np, abort)); 4704 static void ncr_detach(struct ncb *np) ncr_detach() argument 4713 /* Local copy so we don't access np after freeing it! */ ncr_detach() 4714 strlcpy(inst_name, ncr_name(np), sizeof(inst_name)); ncr_detach() 4716 printk("%s: releasing host resources\n", ncr_name(np)); ncr_detach() 4724 printk("%s: stopping the timer\n", ncr_name(np)); ncr_detach() 4726 np->release_stage = 1; ncr_detach() 4727 for (i = 50 ; i && np->release_stage != 2 ; i--) ncr_detach() 4729 if (np->release_stage != 2) ncr_detach() 4730 printk("%s: the timer seems to be already stopped\n", ncr_name(np)); ncr_detach() 4731 else np->release_stage = 2; ncr_detach() 4738 printk("%s: disabling chip interrupts\n", ncr_name(np)); ncr_detach() 4748 printk("%s: resetting chip\n", ncr_name(np)); ncr_detach() 4749 ncr_chip_reset(np, 100); ncr_detach() 4751 OUTB(nc_dmode, np->sv_dmode); ncr_detach() 4752 OUTB(nc_dcntl, np->sv_dcntl); ncr_detach() 4753 OUTB(nc_ctest0, np->sv_ctest0); ncr_detach() 4754 OUTB(nc_ctest3, np->sv_ctest3); ncr_detach() 4755 OUTB(nc_ctest4, np->sv_ctest4); ncr_detach() 4756 OUTB(nc_ctest5, np->sv_ctest5); ncr_detach() 4757 OUTB(nc_gpcntl, np->sv_gpcntl); ncr_detach() 4758 OUTB(nc_stest2, np->sv_stest2); ncr_detach() 4760 ncr_selectclock(np, np->sv_scntl3); ncr_detach() 4766 while ((cp=np->ccb->link_ccb) != NULL) { ncr_detach() 4767 np->ccb->link_ccb = cp->link_ccb; ncr_detach() 4770 ncr_name(np), cp->host_status); ncr_detach() 4773 printk("%s: freeing ccb (%lx)\n", ncr_name(np), (u_long) cp); ncr_detach() 4781 tp=&np->target[target]; ncr_detach() 4786 printk("%s: freeing lp (%lx)\n", ncr_name(np), (u_long) lp); ncr_detach() 4795 if (np->scripth0) ncr_detach() 4796 m_free_dma(np->scripth0, sizeof(struct scripth), "SCRIPTH"); ncr_detach() 4797 if (np->script0) ncr_detach() 4798 m_free_dma(np->script0, sizeof(struct script), "SCRIPT"); ncr_detach() 4799 if (np->ccb) ncr_detach() 4800 m_free_dma(np->ccb, sizeof(struct ccb), "CCB"); ncr_detach() 4801 m_free_dma(np, sizeof(struct ncb), "NCB"); ncr_detach() 4816 void ncr_complete (struct ncb *np, struct ccb *cp) ncr_complete() argument 4843 tp = &np->target[cmd->device->id]; ncr_complete() 4938 ncr_alloc_lcb (np, cmd->device->id, cmd->device->lun); ncr_complete() 4952 ncr_setup_tags (np, cmd->device); ncr_complete() 5058 ncr_free_ccb (np, cp); ncr_complete() 5065 ncr_start_next_ccb(np, lp, 2); ncr_complete() 5070 if (np->waiting_list) ncr_complete() 5071 requeue_waiting_list(np); ncr_complete() 5076 ncr_queue_done_cmd(np, cmd); ncr_complete() 5092 static void ncr_ccb_skipped(struct ncb *np, struct ccb *cp) ncr_ccb_skipped() argument 5094 struct tcb *tp = &np->target[cp->target]; ncr_ccb_skipped() 5097 if (lp && cp != np->ccb) { ncr_ccb_skipped() 5100 cpu_to_scr(NCB_SCRIPT_PHYS (np, select)); ncr_ccb_skipped() 5107 --np->queuedccbs; ncr_ccb_skipped() 5116 void ncr_wakeup_done (struct ncb *np) ncr_wakeup_done() argument 5122 i = np->ccb_done_ic; ncr_wakeup_done() 5128 cp = np->ccb_done[j]; ncr_wakeup_done() 5132 np->ccb_done[j] = (struct ccb *)CCB_DONE_EMPTY; ncr_wakeup_done() 5133 np->scripth->done_queue[5*j + 4] = ncr_wakeup_done() 5134 cpu_to_scr(NCB_SCRIPT_PHYS (np, done_plug)); ncr_wakeup_done() 5136 np->scripth->done_queue[5*i + 4] = ncr_wakeup_done() 5137 cpu_to_scr(NCB_SCRIPT_PHYS (np, done_end)); ncr_wakeup_done() 5140 ncr_complete (np, cp); ncr_wakeup_done() 5142 ncr_ccb_skipped (np, cp); ncr_wakeup_done() 5146 np->ccb_done_ic = i; ncr_wakeup_done() 5148 cp = np->ccb; ncr_wakeup_done() 5151 ncr_complete (np, cp); ncr_wakeup_done() 5153 ncr_ccb_skipped (np, cp); ncr_wakeup_done() 5162 void ncr_wakeup (struct ncb *np, u_long code) ncr_wakeup() argument 5164 struct ccb *cp = np->ccb; ncr_wakeup() 5169 ncr_complete (np, cp); ncr_wakeup() 5183 static void ncr_chip_reset(struct ncb *np, int delay) ncr_chip_reset() argument 5189 if (np->features & FE_EHP) ncr_chip_reset() 5191 if (np->features & FE_MUX) ncr_chip_reset() 5205 void ncr_init (struct ncb *np, int reset, char * msg, u_long code) ncr_init() argument 5226 if (msg) printk (KERN_INFO "%s: restart (%s).\n", ncr_name (np), msg); ncr_init() 5231 np->queuedepth = MAX_START - 1; /* 1 entry needed as end marker */ ncr_init() 5233 np->scripth0->tryloop[i] = ncr_init() 5234 cpu_to_scr(NCB_SCRIPT_PHYS (np, idle)); ncr_init() 5239 np->squeueput = 0; ncr_init() 5240 np->script0->startpos[0] = cpu_to_scr(NCB_SCRIPTH_PHYS (np, tryloop)); ncr_init() 5247 np->ccb_done[i] = (struct ccb *)CCB_DONE_EMPTY; ncr_init() 5248 np->scripth0->done_queue[5*i + 4] = ncr_init() 5249 cpu_to_scr(NCB_SCRIPT_PHYS (np, done_end)); ncr_init() 5256 np->script0->done_pos[0] = cpu_to_scr(NCB_SCRIPTH_PHYS (np,done_queue)); ncr_init() 5257 np->ccb_done_ic = MAX_DONE-1; ncr_init() 5258 np->scripth0->done_queue[5*(MAX_DONE-1) + 4] = ncr_init() 5259 cpu_to_scr(NCB_SCRIPT_PHYS (np, done_plug)); ncr_init() 5264 ncr_wakeup (np, code); ncr_init() 5274 ncr_chip_reset(np, 2000); ncr_init() 5276 OUTB (nc_scntl0, np->rv_scntl0 | 0xc0); ncr_init() 5280 ncr_selectclock(np, np->rv_scntl3); /* Select SCSI clock */ ncr_init() 5282 OUTB (nc_scid , RRE|np->myaddr); /* Adapter SCSI address */ ncr_init() 5283 OUTW (nc_respid, 1ul<<np->myaddr); /* Id to respond to */ ncr_init() 5285 OUTB (nc_dmode , np->rv_dmode); /* Burst length, dma mode */ ncr_init() 5286 OUTB (nc_ctest5, np->rv_ctest5); /* Large fifo + large burst */ ncr_init() 5288 OUTB (nc_dcntl , NOCOM|np->rv_dcntl); /* Protect SFBR */ ncr_init() 5289 OUTB (nc_ctest0, np->rv_ctest0); /* 720: CDIS and EHP */ ncr_init() 5290 OUTB (nc_ctest3, np->rv_ctest3); /* Write and invalidate */ ncr_init() 5291 OUTB (nc_ctest4, np->rv_ctest4); /* Master parity checking */ ncr_init() 5293 OUTB (nc_stest2, EXT|np->rv_stest2); /* Extended Sreq/Sack filtering */ ncr_init() 5301 np->disc = 0; ncr_init() 5307 if (np->features & FE_LED0) { ncr_init() 5326 struct tcb *tp = &np->target[i]; ncr_init() 5329 tp->wval = np->rv_scntl3; ncr_init() 5332 if (tp->usrsync <= np->maxsync) { ncr_init() 5333 if (tp->usrsync < np->minsync) { ncr_init() 5334 tp->usrsync = np->minsync; ncr_init() 5341 if (tp->usrwide > np->maxwide) ncr_init() 5342 tp->usrwide = np->maxwide; ncr_init() 5349 if (np->paddr2) { ncr_init() 5352 ncr_name(np)); ncr_init() 5353 OUTL (nc_scratcha, vtobus(np->script0)); ncr_init() 5354 OUTL_DSP (NCB_SCRIPTH_PHYS (np, start_ram)); ncr_init() 5357 OUTL_DSP (NCB_SCRIPT_PHYS (np, start)); ncr_init() 5368 static void ncr_negotiate (struct ncb* np, struct tcb* tp) ncr_negotiate() argument 5380 if (np->scsi_mode && np->scsi_mode == SMODE_SE) { ncr_negotiate() 5388 if (minsync < np->minsync) ncr_negotiate() 5389 minsync = np->minsync; ncr_negotiate() 5395 if (minsync > np->maxsync) ncr_negotiate() 5398 if (tp->maxoffs > np->maxoffs) ncr_negotiate() 5399 tp->maxoffs = np->maxoffs; ncr_negotiate() 5426 static void ncr_getsync(struct ncb *np, u_char sfac, u_char *fakp, u_char *scntl3p) ncr_getsync() argument 5428 u_long clk = np->clock_khz; /* SCSI clock frequency in kHz */ ncr_getsync() 5429 int div = np->clock_divn; /* Number of divisors supported */ ncr_getsync() 5495 static void ncr_set_sync_wide_status (struct ncb *np, u_char target) ncr_set_sync_wide_status() argument 5498 struct tcb *tp = &np->target[target]; ncr_set_sync_wide_status() 5504 np->sync_st = tp->sval; ncr_set_sync_wide_status() 5506 np->wide_st = tp->wval; ncr_set_sync_wide_status() 5511 for (cp = np->ccb; cp; cp = cp->link_ccb) { ncr_set_sync_wide_status() 5530 static void ncr_setsync (struct ncb *np, struct ccb *cp, u_char scntl3, u_char sxfer) ncr_setsync() argument 5539 tp = &np->target[target]; ncr_setsync() 5542 scntl3 = np->rv_scntl3; ncr_setsync() 5543 scntl3 = (scntl3 & 0xf0) | (tp->wval & EWS) | (np->rv_scntl3 & 0x07); ncr_setsync() 5552 tp->period = (((sxfer>>5)+4)*div_10M[idiv-1])/np->clock_khz; ncr_setsync() 5574 ncr_set_sync_wide_status(np, target); ncr_setsync() 5587 static void ncr_setwide (struct ncb *np, struct ccb *cp, u_char wide, u_char ack) ncr_setwide() argument 5597 tp = &np->target[target]; ncr_setwide() 5622 ncr_set_sync_wide_status(np, target); ncr_setwide() 5632 static void ncr_setup_tags (struct ncb *np, struct scsi_device *sdev) ncr_setup_tags() argument 5635 struct tcb *tp = &np->target[tn]; ncr_setup_tags() 5703 cpu_to_scr(NCB_SCRIPT_PHYS(np, resel_tag)) : ncr_setup_tags() 5704 cpu_to_scr(NCB_SCRIPT_PHYS(np, resel_notag)); ncr_setup_tags() 5735 static void ncr_timeout (struct ncb *np) ncr_timeout() argument 5745 if (np->release_stage) { ncr_timeout() 5746 if (np->release_stage == 1) np->release_stage = 2; ncr_timeout() 5750 np->timer.expires = jiffies + SCSI_NCR_TIMER_INTERVAL; ncr_timeout() 5751 add_timer(&np->timer); ncr_timeout() 5757 if (np->settle_time) { ncr_timeout() 5758 if (np->settle_time <= thistime) { ncr_timeout() 5760 printk("%s: command processing resumed\n", ncr_name(np)); ncr_timeout() 5761 np->settle_time = 0; ncr_timeout() 5762 np->disc = 1; ncr_timeout() 5763 requeue_waiting_list(np); ncr_timeout() 5773 if (np->lasttime + 4*HZ < thistime) { ncr_timeout() 5777 np->lasttime = thistime; ncr_timeout() 5787 ncr_exception (np); ncr_timeout() 5823 static void ncr_log_hard_error(struct ncb *np, u16 sist, u_char dstat) ncr_log_hard_error() argument 5834 if (dsp > np->p_script && dsp <= np->p_script + sizeof(struct script)) { ncr_log_hard_error() 5835 script_ofs = dsp - np->p_script; ncr_log_hard_error() 5837 script_base = (u_char *) np->script0; ncr_log_hard_error() 5840 else if (np->p_scripth < dsp && ncr_log_hard_error() 5841 dsp <= np->p_scripth + sizeof(struct scripth)) { ncr_log_hard_error() 5842 script_ofs = dsp - np->p_scripth; ncr_log_hard_error() 5844 script_base = (u_char *) np->scripth0; ncr_log_hard_error() 5854 ncr_name (np), (unsigned)INB (nc_sdid)&0x0f, dstat, sist, ncr_log_hard_error() 5861 printk ("%s: script cmd = %08x\n", ncr_name(np), ncr_log_hard_error() 5865 printk ("%s: regdump:", ncr_name(np)); ncr_log_hard_error() 5903 void ncr_exception (struct ncb *np) ncr_exception() argument 5921 ncr_wakeup_done (np); ncr_exception() 5960 if ((sist & SBMC) && ncr_int_sbmc (np)) ncr_exception() 5962 if ((sist & PAR) && ncr_int_par (np)) ncr_exception() 5965 ncr_int_ma (np); ncr_exception() 5969 ncr_int_sir (np); ncr_exception() 5978 ncr_name(np), istat, dstat, sist); ncr_exception() 6001 ncr_init (np, 1, bootverbose ? "scsi reset" : NULL, HS_RESET); ncr_exception() 6012 ncr_int_sto (np); ncr_exception() 6029 if (time_after(jiffies, np->regtime)) { ncr_exception() 6030 np->regtime = jiffies + 10*HZ; ncr_exception() 6031 for (i = 0; i<sizeof(np->regdump); i++) ncr_exception() 6032 ((char*)&np->regdump)[i] = INB_OFF(i); ncr_exception() 6033 np->regdump.nc_dstat = dstat; ncr_exception() 6034 np->regdump.nc_sist = sist; ncr_exception() 6037 ncr_log_hard_error(np, sist, dstat); ncr_exception() 6039 printk ("%s: have to clear fifos.\n", ncr_name (np)); ncr_exception() 6045 ncr_start_reset(np); ncr_exception() 6050 printk ("%s: handshake timeout\n", ncr_name(np)); ncr_exception() 6051 ncr_start_reset(np); ncr_exception() 6056 printk ("%s: unexpected disconnect\n", ncr_name(np)); ncr_exception() 6058 OUTL_DSP (NCB_SCRIPT_PHYS (np, cleanup)); ncr_exception() 6067 printk ("%s: unknown interrupt\n", ncr_name(np)); ncr_exception() 6086 void ncr_int_sto (struct ncb *np) ncr_int_sto() argument 6097 cp = np->ccb; ncr_int_sto() 6103 ncr_complete (np, cp); ncr_int_sto() 6110 OUTL_DSP (NCB_SCRIPTH_PHYS (np, sto_restart)); ncr_int_sto() 6131 static int ncr_int_sbmc (struct ncb *np) ncr_int_sbmc() argument 6135 if (scsi_mode != np->scsi_mode) { ncr_int_sbmc() 6137 ncr_name(np), np->scsi_mode, scsi_mode); ncr_int_sbmc() 6139 np->scsi_mode = scsi_mode; ncr_int_sbmc() 6146 np->settle_time = jiffies + HZ; ncr_int_sbmc() 6147 ncr_init (np, 0, bootverbose ? "scsi mode change" : NULL, HS_RESET); ncr_int_sbmc() 6163 static int ncr_int_par (struct ncb *np) ncr_int_par() argument 6173 ncr_name(np), hsts, dbc, sstat1); ncr_int_par() 6213 jmp = NCB_SCRIPTH_PHYS (np, par_err_data_in); ncr_int_par() 6215 jmp = NCB_SCRIPTH_PHYS (np, par_err_other); ncr_int_par() 6220 np->msgout[0] = msg; ncr_int_par() 6225 ncr_start_reset(np); ncr_int_par() 6243 static void ncr_int_ma (struct ncb *np) ncr_int_ma() argument 6274 ctest5 = (np->rv_ctest5 & DFS) ? INB (nc_ctest5) : 0; ncr_int_ma() 6319 cp = np->header.cp; ncr_int_ma() 6323 cp = np->ccb; ncr_int_ma() 6334 if (dsp > np->p_script && ncr_int_ma() 6335 dsp <= np->p_script + sizeof(struct script)) { ncr_int_ma() 6336 vdsp = (u32 *)((char*)np->script0 + (dsp-np->p_script-8)); ncr_int_ma() 6339 else if (dsp > np->p_scripth && ncr_int_ma() 6340 dsp <= np->p_scripth + sizeof(struct scripth)) { ncr_int_ma() 6341 vdsp = (u32 *)((char*)np->scripth0 + (dsp-np->p_scripth-8)); ncr_int_ma() 6361 cp, np->header.cp, ncr_int_ma() 6375 ncr_name (np), (u_long) np->header.cp); ncr_int_ma() 6414 ** cp != np->header.cp means that the header of the CCB ncr_int_ma() 6419 if (cp != np->header.cp) { ncr_int_ma() 6422 ncr_name (np), (u_long) cp, (u_long) np->header.cp); ncr_int_ma() 6470 OUTL_DSP (NCB_SCRIPT_PHYS (np, dispatch)); ncr_int_ma() 6506 nxtdsp = NCB_SCRIPT_PHYS (np, dispatch); ncr_int_ma() 6510 nxtdsp = NCB_SCRIPT_PHYS (np, dispatch); ncr_int_ma() 6514 np->scripth->nxtdsp_go_on[0] = cpu_to_scr(dsp + 8); ncr_int_ma() 6515 if (dsp == NCB_SCRIPT_PHYS (np, send_ident)) { ncr_int_ma() 6517 nxtdsp = NCB_SCRIPTH_PHYS (np, clratn_go_on); ncr_int_ma() 6519 else if (dsp == NCB_SCRIPTH_PHYS (np, send_wdtr) || ncr_int_ma() 6520 dsp == NCB_SCRIPTH_PHYS (np, send_sdtr)) { ncr_int_ma() 6521 nxtdsp = NCB_SCRIPTH_PHYS (np, nego_bad_phase); ncr_int_ma() 6526 nxtdsp = NCB_SCRIPT_PHYS (np, clrack); ncr_int_ma() 6537 ncr_start_reset(np); ncr_int_ma() 6541 static void ncr_sir_to_redo(struct ncb *np, int num, struct ccb *cp) ncr_sir_to_redo() argument 6544 struct tcb *tp = &np->target[cmd->device->id]; ncr_sir_to_redo() 6568 cpu_to_scr(NCB_SCRIPTH_PHYS (np, skip)); ncr_sir_to_redo() 6590 ncr_setup_tags (np, cmd->device); ncr_sir_to_redo() 6602 ncr_put_start_queue(np, cp); ncr_sir_to_redo() 6605 OUTL_DSP (NCB_SCRIPT_PHYS (np, reselect)); ncr_sir_to_redo() 6649 startp = cpu_to_scr(NCB_SCRIPTH_PHYS (np, sdata_in)); ncr_sir_to_redo() 6662 cpu_to_scr(NCB_SCRIPT_PHYS (np, select)); ncr_sir_to_redo() 6669 cpu_to_scr(NCB_SCRIPTH_PHYS (np, select_no_atn)); ncr_sir_to_redo() 6671 ncr_put_start_queue(np, cp); ncr_sir_to_redo() 6673 OUTL_DSP (NCB_SCRIPT_PHYS (np, start)); ncr_sir_to_redo() 6692 void ncr_int_sir (struct ncb *np) ncr_int_sir() argument 6700 struct tcb *tp = &np->target[target]; ncr_int_sir() 6711 ncr_wakeup_done(np); ncr_int_sir() 6713 OUTL(nc_dsp, NCB_SCRIPT_PHYS (np, done_end) + 8); ncr_int_sir() 6715 OUTL(nc_dsp, NCB_SCRIPT_PHYS (np, start)); ncr_int_sir() 6735 ncr_name (np), target, num); ncr_int_sir() 6740 ncr_name (np), target, num); ncr_int_sir() 6743 cp = np->header.cp; ncr_int_sir() 6746 ncr_sir_to_redo(np, num, cp); ncr_int_sir() 6752 cp = np->ccb; ncr_int_sir() 6757 BUG_ON(cp != np->header.cp); ncr_int_sir() 6759 if (!cp || cp != np->header.cp) ncr_int_sir() 6861 ncr_setsync (np, cp, 0, 0xe0); ncr_int_sir() 6866 ncr_setwide (np, cp, 0, 0); ncr_int_sir() 6870 np->msgin [0] = NOP; ncr_int_sir() 6871 np->msgout[0] = NOP; ncr_int_sir() 6877 ncr_print_msg(cp, "sync msgin", np->msgin); ncr_int_sir() 6881 per = np->msgin[3]; ncr_int_sir() 6882 ofs = np->msgin[4]; ncr_int_sir() 6897 if (per < np->minsync) ncr_int_sir() 6898 {chg = 1; per = np->minsync;} ncr_int_sir() 6910 ncr_getsync(np, per, &fak, &scntl3); ncr_int_sir() 6938 ncr_setsync(np, cp, 0, 0xe0); ncr_int_sir() 6939 OUTL_DSP(NCB_SCRIPT_PHYS (np, msg_bad)); ncr_int_sir() 6944 ncr_setsync(np, cp, scntl3, (fak<<5)|ofs); ncr_int_sir() 6945 OUTL_DSP(NCB_SCRIPT_PHYS (np, clrack)); ncr_int_sir() 6951 ncr_setwide(np, cp, 0, 0); ncr_int_sir() 6963 ncr_setsync(np, cp, scntl3, (fak<<5)|ofs); ncr_int_sir() 6965 spi_populate_sync_msg(np->msgout, per, ofs); ncr_int_sir() 6969 ncr_print_msg(cp, "sync msgout", np->msgout); ncr_int_sir() 6973 OUTL_DSP (NCB_SCRIPT_PHYS (np, msg_bad)); ncr_int_sir() 6976 np->msgin [0] = NOP; ncr_int_sir() 6985 ncr_print_msg(cp, "wide msgin", np->msgin); ncr_int_sir() 6993 wide = np->msgin[3]; ncr_int_sir() 7026 ncr_setwide(np, cp, 0, 1); ncr_int_sir() 7027 OUTL_DSP (NCB_SCRIPT_PHYS (np, msg_bad)); ncr_int_sir() 7031 ncr_setwide(np, cp, wide, 1); ncr_int_sir() 7032 OUTL_DSP (NCB_SCRIPT_PHYS (np, clrack)); ncr_int_sir() 7039 ncr_setsync(np, cp, 0, 0xe0); ncr_int_sir() 7050 ncr_setwide(np, cp, wide, 1); ncr_int_sir() 7051 spi_populate_width_msg(np->msgout, wide); ncr_int_sir() 7053 np->msgin [0] = NOP; ncr_int_sir() 7058 ncr_print_msg(cp, "wide msgout", np->msgin); ncr_int_sir() 7078 (unsigned)scr_to_cpu(np->lastmsg), np->msgout[0]); ncr_int_sir() 7089 ncr_print_msg(cp, "MESSAGE_REJECT sent for", np->msgin); ncr_int_sir() 7124 (unsigned) scr_to_cpu(np->header.savep), ncr_int_sir() 7125 (unsigned) scr_to_cpu(np->header.goalp)); ncr_int_sir() 7143 static struct ccb *ncr_get_ccb(struct ncb *np, struct scsi_cmnd *cmd) ncr_get_ccb() argument 7147 struct tcb *tp = &np->target[tn]; ncr_get_ccb() 7167 ncr_alloc_ccb(np, tn, ln); ncr_get_ccb() 7201 cp = np->ccb; ncr_get_ccb() 7254 static void ncr_free_ccb (struct ncb *np, struct ccb *cp) ncr_free_ccb() argument 7256 struct tcb *tp = &np->target[cp->target]; ncr_free_ccb() 7276 cpu_to_scr(NCB_SCRIPTH_PHYS(np, bad_i_t_l_q)); ncr_free_ccb() 7279 cpu_to_scr(NCB_SCRIPTH_PHYS(np, bad_i_t_l)); ncr_free_ccb() 7288 if (cp != np->ccb) ncr_free_ccb() 7298 --np->queuedccbs; ncr_free_ccb() 7303 if (cp == np->ccb) ncr_free_ccb() 7309 #define ncr_reg_bus_addr(r) (np->paddr + offsetof (struct ncr_reg, r)) 7316 static void ncr_init_ccb(struct ncb *np, struct ccb *cp) ncr_init_ccb() argument 7318 ncrcmd copy_4 = np->features & FE_PFEN ? SCR_COPY(4) : SCR_COPY_F(4); ncr_init_ccb() 7345 cp->start.schedule.l_paddr = cpu_to_scr(NCB_SCRIPT_PHYS (np, idle)); ncr_init_ccb() 7346 cp->restart.schedule.l_paddr = cpu_to_scr(NCB_SCRIPTH_PHYS (np, abort)); ncr_init_ccb() 7355 static void ncr_alloc_ccb(struct ncb *np, u_char tn, u_char ln) ncr_alloc_ccb() argument 7357 struct tcb *tp = &np->target[tn]; ncr_alloc_ccb() 7372 np->actccbs++; ncr_alloc_ccb() 7374 ncr_init_ccb(np, cp); ncr_alloc_ccb() 7380 cp->link_ccb = np->ccb->link_ccb; ncr_alloc_ccb() 7381 np->ccb->link_ccb = cp; ncr_alloc_ccb() 7404 static void ncr_init_tcb (struct ncb *np, u_char tn) ncr_init_tcb() argument 7406 struct tcb *tp = &np->target[tn]; ncr_init_tcb() 7407 ncrcmd copy_1 = np->features & FE_PFEN ? SCR_COPY(1) : SCR_COPY_F(1); ncr_init_tcb() 7417 tp->jump_tcb.l_paddr = np->jump_tcb[th].l_paddr; ncr_init_tcb() 7448 tp->call_lun.l_paddr = cpu_to_scr(NCB_SCRIPT_PHYS (np, resel_lun)); ncr_init_tcb() 7459 cpu_to_scr(NCB_SCRIPTH_PHYS (np, bad_identify)); ncr_init_tcb() 7465 np->jump_tcb[th].l_paddr = cpu_to_scr(vtobus (&tp->jump_tcb)); ncr_init_tcb() 7491 static struct lcb *ncr_alloc_lcb (struct ncb *np, u_char tn, u_char ln) ncr_alloc_lcb() argument 7493 struct tcb *tp = &np->target[tn]; ncr_alloc_lcb() 7495 ncrcmd copy_4 = np->features & FE_PFEN ? SCR_COPY(4) : SCR_COPY_F(4); ncr_alloc_lcb() 7517 ncr_init_tcb(np, tn); ncr_alloc_lcb() 7555 lp->jump_tag.l_paddr = cpu_to_scr(NCB_SCRIPT_PHYS (np, resel_notag)); ncr_alloc_lcb() 7581 static struct lcb *ncr_setup_lcb (struct ncb *np, struct scsi_device *sdev) ncr_setup_lcb() argument 7584 struct tcb *tp = &np->target[tn]; ncr_setup_lcb() 7588 if (!lp && !(lp = ncr_alloc_lcb(np, tn, ln))) ncr_setup_lcb() 7605 cpu_to_scr(NCB_SCRIPTH_PHYS (np, bad_i_t_l_q)); ncr_setup_lcb() 7610 ncr_setup_tags (np, sdev); ncr_setup_lcb() 7647 static int ncr_scatter(struct ncb *np, struct ccb *cp, struct scsi_cmnd *cmd) ncr_scatter() argument 7654 use_sg = map_scsi_sg_data(np, cmd); ncr_scatter() 7660 unmap_scsi_data(np, cmd); ncr_scatter() 7670 ncr_build_sge(np, &data[segment], baddr, len); scsi_for_each_sg() 7690 static int __init ncr_regtest (struct ncb* np) argument 7713 static int __init ncr_snooptest (struct ncb* np) ncr_snooptest() argument 7717 if (np->reg) { ncr_snooptest() 7718 err |= ncr_regtest (np); ncr_snooptest() 7724 pc = NCB_SCRIPTH_PHYS (np, snooptest); ncr_snooptest() 7730 np->ncr_cache = cpu_to_scr(host_wr); ncr_snooptest() 7749 host_rd = scr_to_cpu(np->ncr_cache); ncr_snooptest() 7755 ncr_chip_reset(np, 100); ncr_snooptest() 7766 if (pc != NCB_SCRIPTH_PHYS (np, snoopend)+8) { ncr_snooptest() 7769 (u_long) NCB_SCRIPTH_PHYS (np, snooptest), (u_long) pc, ncr_snooptest() 7770 (u_long) NCB_SCRIPTH_PHYS (np, snoopend) +8); ncr_snooptest() 7820 static void ncr_selectclock(struct ncb *np, u_char scntl3) ncr_selectclock() argument 7822 if (np->multiplier < 2) { ncr_selectclock() 7828 printk ("%s: enabling clock multiplier\n", ncr_name(np)); ncr_selectclock() 7831 if (np->multiplier > 2) { /* Poll bit 5 of stest4 for quadrupler */ ncr_selectclock() 7836 printk("%s: the chip cannot lock the frequency\n", ncr_name(np)); ncr_selectclock() 7849 static unsigned __init ncrgetfreq (struct ncb *np, int gen) ncrgetfreq() argument 7890 printk ("%s: Delay (GEN=%d): %u msec\n", ncr_name(np), gen, ms); ncrgetfreq() 7900 static void __init ncr_getclock (struct ncb *np, int mult) ncr_getclock() argument 7906 np->multiplier = 1; ncr_getclock() 7914 printk ("%s: clock multiplier found\n", ncr_name(np)); ncr_getclock() 7915 np->multiplier = mult; ncr_getclock() 7923 if (np->multiplier != mult || (scntl3 & 7) < 3 || !(scntl3 & 1)) { ncr_getclock() 7926 ncr_chip_reset(np, 5); ncr_getclock() 7928 (void) ncrgetfreq (np, 11); /* throw away first result */ ncr_getclock() 7929 f1 = ncrgetfreq (np, 11); ncr_getclock() 7930 f2 = ncrgetfreq (np, 11); ncr_getclock() 7933 printk ("%s: NCR clock is %uKHz, %uKHz\n", ncr_name(np), f1, f2); ncr_getclock() 7943 printk ("%s: clock multiplier assumed\n", ncr_name(np)); ncr_getclock() 7944 np->multiplier = mult; ncr_getclock() 7951 f1 /= np->multiplier; ncr_getclock() 7957 f1 *= np->multiplier; ncr_getclock() 7958 np->clock_khz = f1; ncr_getclock() 7966 struct ncb *np = ((struct host_data *) host->hostdata)->ncb; ncr53c8xx_slave_alloc() local 7967 struct tcb *tp = &np->target[device->id]; ncr53c8xx_slave_alloc() 7976 struct ncb *np = ((struct host_data *) host->hostdata)->ncb; ncr53c8xx_slave_configure() local 7977 struct tcb *tp = &np->target[device->id]; ncr53c8xx_slave_configure() 7981 ncr_setup_lcb(np, device); ncr53c8xx_slave_configure() 7989 numtags = device_queue_depth(np->unit, device->id, device->lun); ncr53c8xx_slave_configure() 8015 ncr_setup_tags (np, device); ncr53c8xx_slave_configure() 8019 np->unit, device->id, device->lun, depth_to_use); ncr53c8xx_slave_configure() 8030 struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb; ncr53c8xx_queue_command_lck() local 8043 spin_lock_irqsave(&np->smp_lock, flags); ncr53c8xx_queue_command_lck() 8045 if ((sts = ncr_queue_command(np, cmd)) != DID_OK) { ncr53c8xx_queue_command_lck() 8056 spin_unlock_irqrestore(&np->smp_lock, flags); ncr53c8xx_queue_command_lck() 8059 unmap_scsi_data(np, cmd); ncr53c8xx_queue_command_lck() 8074 struct ncb *np = host_data->ncb; DEF_SCSI_QCMD() local 8083 spin_lock_irqsave(&np->smp_lock, flags); DEF_SCSI_QCMD() 8084 ncr_exception(np); DEF_SCSI_QCMD() 8085 done_list = np->done_list; DEF_SCSI_QCMD() 8086 np->done_list = NULL; DEF_SCSI_QCMD() 8087 spin_unlock_irqrestore(&np->smp_lock, flags); DEF_SCSI_QCMD() 8098 struct ncb *np = (struct ncb *) npref; ncr53c8xx_timeout() local 8102 spin_lock_irqsave(&np->smp_lock, flags); ncr53c8xx_timeout() 8103 ncr_timeout(np); ncr53c8xx_timeout() 8104 done_list = np->done_list; ncr53c8xx_timeout() 8105 np->done_list = NULL; ncr53c8xx_timeout() 8106 spin_unlock_irqrestore(&np->smp_lock, flags); ncr53c8xx_timeout() 8114 struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb; ncr53c8xx_bus_reset() local 8126 spin_lock_irqsave(&np->smp_lock, flags); ncr53c8xx_bus_reset() 8127 sts = ncr_reset_bus(np, cmd, 1); ncr53c8xx_bus_reset() 8129 done_list = np->done_list; ncr53c8xx_bus_reset() 8130 np->done_list = NULL; ncr53c8xx_bus_reset() 8131 spin_unlock_irqrestore(&np->smp_lock, flags); ncr53c8xx_bus_reset() 8141 struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb; 8148 NCR_LOCK_NCB(np, flags); 8150 sts = ncr_abort_command(np, cmd); 8152 done_list = np->done_list; 8153 np->done_list = NULL; 8154 NCR_UNLOCK_NCB(np, flags); 8178 static void insert_into_waiting_list(struct ncb *np, struct scsi_cmnd *cmd) insert_into_waiting_list() argument 8183 printk("%s: cmd %lx inserted into waiting list\n", ncr_name(np), (u_long) cmd); insert_into_waiting_list() 8186 if (!(wcmd = np->waiting_list)) np->waiting_list = cmd; insert_into_waiting_list() 8194 static struct scsi_cmnd *retrieve_from_waiting_list(int to_remove, struct ncb *np, struct scsi_cmnd *cmd) retrieve_from_waiting_list() argument 8196 struct scsi_cmnd **pcmd = &np->waiting_list; retrieve_from_waiting_list() 8205 printk("%s: cmd %lx retrieved from waiting list\n", ncr_name(np), (u_long) cmd); retrieve_from_waiting_list() 8214 static void process_waiting_list(struct ncb *np, int sts) process_waiting_list() argument 8218 waiting_list = np->waiting_list; process_waiting_list() 8219 np->waiting_list = NULL; process_waiting_list() 8222 if (waiting_list) printk("%s: waiting_list=%lx processing sts=%d\n", ncr_name(np), (u_long) waiting_list, sts); process_waiting_list() 8229 printk("%s: cmd %lx trying to requeue\n", ncr_name(np), (u_long) wcmd); process_waiting_list() 8231 sts = ncr_queue_command(np, wcmd); process_waiting_list() 8235 printk("%s: cmd %lx done forced sts=%d\n", ncr_name(np), (u_long) wcmd, sts); process_waiting_list() 8238 ncr_queue_done_cmd(np, wcmd); process_waiting_list() 8298 struct ncb *np = NULL; ncr_attach() local 8329 np = __m_calloc_dma(device->dev, sizeof(struct ncb), "NCB"); ncr_attach() 8330 if (!np) ncr_attach() 8332 spin_lock_init(&np->smp_lock); ncr_attach() 8333 np->dev = device->dev; ncr_attach() 8334 np->p_ncb = vtobus(np); ncr_attach() 8335 host_data->ncb = np; ncr_attach() 8337 np->ccb = m_calloc_dma(sizeof(struct ccb), "CCB"); ncr_attach() 8338 if (!np->ccb) ncr_attach() 8342 np->unit = unit; ncr_attach() 8343 np->verbose = driver_setup.verbose; ncr_attach() 8344 sprintf(np->inst_name, "ncr53c720-%d", np->unit); ncr_attach() 8345 np->revision_id = device->chip.revision_id; ncr_attach() 8346 np->features = device->chip.features; ncr_attach() 8347 np->clock_divn = device->chip.nr_divisor; ncr_attach() 8348 np->maxoffs = device->chip.offset_max; ncr_attach() 8349 np->maxburst = device->chip.burst_max; ncr_attach() 8350 np->myaddr = device->host_id; ncr_attach() 8353 np->script0 = m_calloc_dma(sizeof(struct script), "SCRIPT"); ncr_attach() 8354 if (!np->script0) ncr_attach() 8356 np->scripth0 = m_calloc_dma(sizeof(struct scripth), "SCRIPTH"); ncr_attach() 8357 if (!np->scripth0) ncr_attach() 8360 init_timer(&np->timer); ncr_attach() 8361 np->timer.data = (unsigned long) np; ncr_attach() 8362 np->timer.function = ncr53c8xx_timeout; ncr_attach() 8366 np->paddr = device->slot.base; ncr_attach() 8367 np->paddr2 = (np->features & FE_RAM) ? device->slot.base_2 : 0; ncr_attach() 8370 np->vaddr = device->slot.base_v; ncr_attach() 8372 np->vaddr = ioremap(device->slot.base_c, 128); ncr_attach() 8374 if (!np->vaddr) { ncr_attach() 8376 "%s: can't map memory mapped IO region\n",ncr_name(np)); ncr_attach() 8381 "%s: using memory mapped IO at virtual address 0x%lx\n", ncr_name(np), (u_long) np->vaddr); ncr_attach() 8388 np->reg = (struct ncr_reg __iomem *)np->vaddr; ncr_attach() 8391 ncr_prepare_setting(np); ncr_attach() 8393 if (np->paddr2 && sizeof(struct script) > 4096) { ncr_attach() 8394 np->paddr2 = 0; ncr_attach() 8396 ncr_name(np)); ncr_attach() 8400 instance->this_id = np->myaddr; ncr_attach() 8401 instance->max_id = np->maxwide ? 16 : 8; ncr_attach() 8403 instance->base = (unsigned long) np->reg; ncr_attach() 8417 np->scripth = np->scripth0; ncr_attach() 8418 np->p_scripth = vtobus(np->scripth); ncr_attach() 8419 np->p_script = (np->paddr2) ? np->paddr2 : vtobus(np->script0); ncr_attach() 8421 ncr_script_copy_and_bind(np, (ncrcmd *) &script0, ncr_attach() 8422 (ncrcmd *) np->script0, sizeof(struct script)); ncr_attach() 8423 ncr_script_copy_and_bind(np, (ncrcmd *) &scripth0, ncr_attach() 8424 (ncrcmd *) np->scripth0, sizeof(struct scripth)); ncr_attach() 8425 np->ccb->p_ccb = vtobus (np->ccb); ncr_attach() 8429 if (np->features & FE_LED0) { ncr_attach() 8430 np->script0->idle[0] = ncr_attach() 8432 np->script0->reselected[0] = ncr_attach() 8434 np->script0->start[0] = ncr_attach() 8444 np->jump_tcb[i].l_cmd = ncr_attach() 8446 np->jump_tcb[i].l_paddr = ncr_attach() 8447 cpu_to_scr(NCB_SCRIPTH_PHYS (np, bad_target)); ncr_attach() 8450 ncr_chip_reset(np, 100); ncr_attach() 8454 if (ncr_snooptest(np)) { ncr_attach() 8460 np->irq = device->slot.irq; ncr_attach() 8463 ncr_init_ccb(np, np->ccb); ncr_attach() 8471 spin_lock_irqsave(&np->smp_lock, flags); ncr_attach() 8472 if (ncr_reset_scsi_bus(np, 0, driver_setup.settle_delay) != 0) { ncr_attach() 8473 printk(KERN_ERR "%s: FATAL ERROR: CHECK SCSI BUS - CABLES, TERMINATION, DEVICE POWER etc.!\n", ncr_name(np)); ncr_attach() 8475 spin_unlock_irqrestore(&np->smp_lock, flags); ncr_attach() 8478 ncr_exception(np); ncr_attach() 8480 np->disc = 1; ncr_attach() 8488 ncr_name(np), driver_setup.settle_delay); ncr_attach() 8493 np->lasttime=0; ncr_attach() 8494 ncr_timeout (np); ncr_attach() 8498 np->order = SIMPLE_QUEUE_TAG; ncr_attach() 8501 spin_unlock_irqrestore(&np->smp_lock, flags); ncr_attach() 8508 printk(KERN_INFO "%s: detaching...\n", ncr_name(np)); ncr_attach() 8509 if (!np) ncr_attach() 8511 if (np->scripth0) ncr_attach() 8512 m_free_dma(np->scripth0, sizeof(struct scripth), "SCRIPTH"); ncr_attach() 8513 if (np->script0) ncr_attach() 8514 m_free_dma(np->script0, sizeof(struct script), "SCRIPT"); ncr_attach() 8515 if (np->ccb) ncr_attach() 8516 m_free_dma(np->ccb, sizeof(struct ccb), "CCB"); ncr_attach() 8517 m_free_dma(np, sizeof(struct ncb), "NCB"); ncr_attach() 8541 struct ncb *np = ((struct host_data *)shost->hostdata)->ncb; ncr53c8xx_set_period() local 8542 struct tcb *tp = &np->target[starget->id]; ncr53c8xx_set_period() 8544 if (period > np->maxsync) ncr53c8xx_set_period() 8545 period = np->maxsync; ncr53c8xx_set_period() 8546 else if (period < np->minsync) ncr53c8xx_set_period() 8547 period = np->minsync; ncr53c8xx_set_period() 8551 ncr_negotiate(np, tp); ncr53c8xx_set_period() 8557 struct ncb *np = ((struct host_data *)shost->hostdata)->ncb; ncr53c8xx_set_offset() local 8558 struct tcb *tp = &np->target[starget->id]; ncr53c8xx_set_offset() 8560 if (offset > np->maxoffs) ncr53c8xx_set_offset() 8561 offset = np->maxoffs; ncr53c8xx_set_offset() 8567 ncr_negotiate(np, tp); ncr53c8xx_set_offset() 8573 struct ncb *np = ((struct host_data *)shost->hostdata)->ncb; ncr53c8xx_set_width() local 8574 struct tcb *tp = &np->target[starget->id]; ncr53c8xx_set_width() 8576 if (width > np->maxwide) ncr53c8xx_set_width() 8577 width = np->maxwide; ncr53c8xx_set_width() 8583 ncr_negotiate(np, tp); ncr53c8xx_set_width() 8588 struct ncb *np = ((struct host_data *)shost->hostdata)->ncb; ncr53c8xx_get_signalling() local 8591 switch (np->scsi_mode) { ncr53c8xx_get_signalling()
|
/linux-4.4.14/drivers/net/fddi/skfp/ |
H A D | pcmplc.c | 207 static void sm_ph_lem_start(struct s_smc *smc, int np, int threshold); 208 static void sm_ph_lem_stop(struct s_smc *smc, int np); 221 EV_TOKEN(EVENT_PCM+phy->np,event)) ; start_pcm_timer0() 240 int np ; pcm_init() local 244 for (np = 0,phy = smc->y ; np < NUMPHYS ; np++,phy++) { pcm_init() 248 phy->np = np ; pcm_init() 252 mib->fddiPORTMy_Type = (np == PS) ? TS : TM ; pcm_init() 255 mib->fddiPORTMy_Type = (np == PA) ? TA : pcm_init() 256 (np == PB) ? TB : TM ; pcm_init() 263 mib->fddiPORTMy_Type = (np == PS) ? TS : TNONE ; pcm_init() 264 mib->fddiPORTHardwarePresent = (np == PS) ? TRUE : pcm_init() 273 mib->fddiPORTMy_Type = (np == PB) ? TB : TA ; pcm_init() 385 if (np >= PM) pcm_init() 386 phy->phy_name = '0' + np - PM ; pcm_init() 388 phy->phy_name = 'A' + np ; pcm_init() 536 int np = phy->np ; /* PHY index */ plc_send_bits() local 546 if (inpw(PLC(np,PL_STATUS_B)) & PL_PCM_SIGNAL) { plc_send_bits() 553 outpw(PLC(np,PL_VECTOR_LEN),len-1) ; /* len=nr-1 */ plc_send_bits() 554 outpw(PLC(np,PL_XMIT_VECTOR),n) ; plc_send_bits() 595 void pcm(struct s_smc *smc, const int np, int event) pcm() argument 606 if ((np != PS) && (smc->s.sas == SMT_SAS)) pcm() 609 phy = &smc->y[np] ; pcm() 641 (int) (INDEX_PORT+ phy->np),0) ; pcm() 668 pcm_state_change(smc,np,state) ; pcm() 677 int np = phy->np ; /* PHY index */ pcm_fsm() local 715 CLEAR(PLC(np,PL_CNTRL_B),PL_LONG) ; pcm_fsm() 723 outpw(PLC(np,PL_CNTRL_A),0) ; pcm_fsm() 724 CLEAR(PLC(np,PL_CNTRL_B),PL_PC_JOIN) ; pcm_fsm() 725 CLEAR(PLC(np,PL_CNTRL_B),PL_LONG) ; pcm_fsm() 726 sm_ph_lem_stop(smc,np) ; /* disable LEM */ pcm_fsm() 729 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; pcm_fsm() 730 plc_go_state(smc,np,PL_PCM_STOP) ; pcm_fsm() 745 plc_go_state(smc,np,0) ; pcm_fsm() 746 CLEAR(PLC(np,PL_CNTRL_B),PL_PC_JOIN) ; pcm_fsm() 747 CLEAR(PLC(np,PL_CNTRL_B),PL_LONG) ; pcm_fsm() 748 sm_ph_lem_stop(smc,np) ; /* disable LEM */ pcm_fsm() 753 if (inpw(PLC(np,PL_STATUS_B)) & PL_PCM_SIGNAL) { pcm_fsm() 754 plc_go_state(smc,np,PL_PCM_STOP) ; pcm_fsm() 761 plc_go_state(smc,np,PL_PCM_STOP) ; pcm_fsm() 767 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; pcm_fsm() 775 outpw(PLC(np,PL_INTR_MASK),plc_imsk_na) ; pcm_fsm() 782 (void)inpw(PLC(np,PL_INTR_EVENT)) ; pcm_fsm() 785 plc_rev = inpw(PLC(np,PL_STATUS_A)) & PLC_REV_MASK ; pcm_fsm() 814 plc_go_state(smc,np,PL_PCM_START) ; pcm_fsm() 820 if (!(inpw(PLC(np,PL_STATUS_B)) & PL_PCM_SIGNAL)) pcm_fsm() 822 if (((inpw(PLC(np,PL_STATUS_A)) & PLC_REV_MASK) != pcm_fsm() 824 !(inpw(PLC(np,PL_STATUS_B)) & PL_PCM_SIGNAL)) pcm_fsm() 846 plc_go_state(smc,np,PL_PCM_TRACE) ; pcm_fsm() 893 sm_ph_lem_start(smc,np,(int)smc->s.lct_short) ; /* enable LEM */ pcm_fsm() 895 i = inpw(PLC(np,PL_CNTRL_B)) & ~PL_PC_LOOP ; pcm_fsm() 896 outpw(PLC(np,PL_CNTRL_B),i) ; /* must be cleared */ pcm_fsm() 897 outpw(PLC(np,PL_CNTRL_B),i | PL_RLBP) ; pcm_fsm() 917 plc_go_state(smc,np,PL_PCM_STOP) ; pcm_fsm() 944 if (smc->s.sas == SMT_DAS && np == PB && ACTIONS() 947 SETMASK(PLC(np,PL_CNTRL_A), ACTIONS() 949 SETMASK(PLC(np,PL_CNTRL_B), ACTIONS() 952 SETMASK(PLC(np,PL_CNTRL_B),PL_PC_JOIN,PL_PC_JOIN) ; 953 SETMASK(PLC(np,PL_CNTRL_B),PL_PC_JOIN,PL_PC_JOIN) ; 963 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; 983 sm_ph_lem_start(smc,(int)phy->np,LCT_LEM_MAX) ; 989 outpw(PLC(np,PL_INTR_MASK),plc_imsk_act) ; 1005 CLEAR(PLC(np,PL_CNTRL_B),PL_PC_JOIN) ; 1006 CLEAR(PLC(np,PL_CNTRL_B),PL_LONG) ; 1007 CLEAR(PLC(np,PL_INTR_MASK),PL_LE_CTR) ; /* disable LEM int. */ 1008 sm_ph_lem_stop(smc,np) ; /* disable LEM */ 1011 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; 1012 plc_go_state(smc,np,PL_PCM_STOP) ; 1014 SETMASK(PLC(np,PL_CNTRL_B),PL_MAINT,PL_MAINT) ; 1015 sm_ph_linestate(smc,np,(int) MIB2LS(mib->fddiPORTMaint_LS)) ; 1016 outpw(PLC(np,PL_CNTRL_A),PL_SC_BYPASS) ; 1090 errors = inpw(PLC(((int) phy->np),PL_LINK_ERR_CTR)) ; lem_evaluate() 1129 DB_PCMN(1,"LEM %c :\n",phy->np == PB? 'B' : 'A',0) ; lem_evaluate() 1148 (int) (INDEX_PORT+ phy->np) ,cond) ; lem_evaluate() 1164 phy->np, mib->fddiPORTLer_Cutoff) ; lem_evaluate() 1167 smt_port_off_event(smc,phy->np); lem_evaluate() 1169 queue_event(smc,(int)(EVENT_PCM+phy->np),PC_START) ; lem_evaluate() 1179 int np ; sm_lem_evaluate() local 1181 for (np = 0 ; np < NUMPHYS ; np++) sm_lem_evaluate() 1182 lem_evaluate(smc,&smc->y[np]) ; sm_lem_evaluate() 1194 errors = inpw(PLC(((int)phy->np),PL_LINK_ERR_CTR)) ; lem_check_lct() 1229 static void sm_ph_lem_start(struct s_smc *smc, int np, int threshold) sm_ph_lem_start() argument 1231 struct lem_counter *lem = &smc->y[np].lem ; sm_ph_lem_start() 1240 outpw(PLC(np,PL_LE_THRESHOLD),threshold) ; sm_ph_lem_start() 1241 (void)inpw(PLC(np,PL_LINK_ERR_CTR)) ; /* clear error counter */ sm_ph_lem_start() 1244 SETMASK(PLC(np,PL_INTR_MASK),PL_LE_CTR,PL_LE_CTR) ; sm_ph_lem_start() 1247 static void sm_ph_lem_stop(struct s_smc *smc, int np) sm_ph_lem_stop() argument 1249 struct lem_counter *lem = &smc->y[np].lem ; sm_ph_lem_stop() 1252 CLEAR(PLC(np,PL_INTR_MASK),PL_LE_CTR) ; sm_ph_lem_stop() 1352 outpw(PLC((int)phy->np,PL_LC_LENGTH), TP_LC_LENGTH ) ; pc_rcode_actions() 1356 outpw(PLC((int)phy->np,PL_LC_LENGTH), TP_LC_LONGLN ) ; pc_rcode_actions() 1360 SETMASK(PLC((int)phy->np,PL_CNTRL_B),PL_LONG,PL_LONG) ; pc_rcode_actions() 1364 SETMASK(PLC((int)phy->np,PL_CNTRL_B),PL_LONG,PL_LONG) ; pc_rcode_actions() 1384 queue_event(smc,(int)(EVENT_PCM+phy->np),PC_START) ; pc_rcode_actions() 1412 int np = phy->np ; pc_tcode_actions() local 1488 (int) (INDEX_PORT+ phy->np) ,0) ; pc_tcode_actions() 1546 queue_event(smc,EVENT_PCM+np,PC_START) ; pc_tcode_actions() 1556 if ((np == PB) || ((np == PA) && pc_tcode_actions() 1562 if (np == PB) pc_tcode_actions() 1567 if (np == PS) pc_tcode_actions() 1575 if (np == PB) pc_tcode_actions() 1608 void pcm_status_state(struct s_smc *smc, int np, int *type, int *state, pcm_status_state() argument 1611 struct s_phy *phy = &smc->y[np] ; pcm_status_state() 1647 void plc_irq(struct s_smc *smc, int np, unsigned int cmd) plc_irq() argument 1648 /* int np; PHY index */ plc_irq() 1650 struct s_phy *phy = &smc->y[np] ; plc_irq() 1658 if (np >= smc->s.numphys) { plc_irq() 1688 ((inpw(PLC(np,PL_STATUS_A)) & PLC_REV_MASK) == plc_irq() 1700 outpw(PLC(np,PL_INTR_MASK),corr_mask); plc_irq() 1738 j = inpw(PLC(np,PL_LE_THRESHOLD)) ; plc_irq() 1739 i = inpw(PLC(np,PL_LINK_ERR_CTR)) ; plc_irq() 1764 switch (inpw(PLC(np,PL_CNTRL_B)) & PL_MATCH_LS) { plc_irq() 1774 reason = inpw(PLC(np,PL_STATUS_B)) & PL_BREAK_REASON ; plc_irq() 1786 DB_PCMN(1,"PLC %d: MDcF = %x\n", np, smc->e.DisconnectFlag); plc_irq() 1788 DB_PCMN(1,"PLC %d: restart (reason %x)\n", np, reason); plc_irq() 1789 queue_event(smc,EVENT_PCM+np,PC_START) ; plc_irq() 1792 DB_PCMN(1,"PLC %d: NO!! restart (reason %x)\n", np, reason); plc_irq() 1800 queue_event(smc,EVENT_PCM+np,PC_SIGNAL) ; plc_irq() 1801 n = inpw(PLC(np,PL_RCV_VECTOR)) ; plc_irq() 1808 queue_event(smc,EVENT_PCM+np,PC_JOIN) ; plc_irq() 1814 np,smc->mib.fddiSMTECMState) ; plc_irq() 1816 smc->e.trace_prop |= ENTITY_BIT(ENTITY_PHY(np)) ; plc_irq() 1827 DB_PCMN(1,"PCM : state = %s %d\n", get_pcmstate(smc,np), plc_irq() 1839 queue_event(smc,EVENT_PCM+np,PC_START) ; plc_irq() 1899 int get_pcm_state(struct s_smc *smc, int np) get_pcm_state() argument 1905 switch (inpw(PLC(np,PL_STATUS_B)) & PL_PCM_STATE) { get_pcm_state() 1921 char *get_linestate(struct s_smc *smc, int np) get_linestate() argument 1927 switch (inpw(PLC(np,PL_STATUS_A)) & PL_LINE_ST) { get_linestate() 1943 char *get_pcmstate(struct s_smc *smc, int np) get_pcmstate() argument 1949 switch (inpw(PLC(np,PL_STATUS_B)) & PL_PCM_STATE) { get_pcmstate() 1968 int np ; list_phy() local 1970 for (np = 0 ; np < NUMPHYS ; np++) { list_phy() 1971 plc = &smc->y[np].plc ; list_phy() 1972 printf("PHY %d:\tERRORS\t\t\tBREAK_REASONS\t\tSTATES:\n",np) ; list_phy() 1976 plc->parity_err,plc->b_tpc,get_linestate(smc,np)) ; list_phy() 1980 plc->phyinv,plc->b_qls,get_pcmstate(smc,np)) ; list_phy() 1987 printf("\tLEM_err : %ld\n",smc->y[np].lem.lem_errors) ; list_phy()
|
/linux-4.4.14/drivers/usb/host/ |
H A D | fsl-mph-dr-of.c | 45 static struct fsl_usb2_dev_data *get_dr_mode_data(struct device_node *np) get_dr_mode_data() argument 50 prop = of_get_property(np, "dr_mode", NULL); get_dr_mode_data() 58 np->full_name); get_dr_mode_data() 124 static enum fsl_usb2_controller_ver usb_get_ver_info(struct device_node *np) usb_get_ver_info() argument 135 if (of_device_is_compatible(np, "fsl-usb2-dr")) { usb_get_ver_info() 136 if (of_device_is_compatible(np, "fsl-usb2-dr-v1.6")) usb_get_ver_info() 138 else if (of_device_is_compatible(np, "fsl-usb2-dr-v2.2")) usb_get_ver_info() 140 else if (of_device_is_compatible(np, "fsl-usb2-dr-v2.4")) usb_get_ver_info() 142 else if (of_device_is_compatible(np, "fsl-usb2-dr-v2.5")) usb_get_ver_info() 151 if (of_device_is_compatible(np, "fsl,mpc5121-usb2-dr")) usb_get_ver_info() 154 if (of_device_is_compatible(np, "fsl-usb2-mph")) { usb_get_ver_info() 155 if (of_device_is_compatible(np, "fsl-usb2-mph-v1.6")) usb_get_ver_info() 157 else if (of_device_is_compatible(np, "fsl-usb2-mph-v2.2")) usb_get_ver_info() 159 else if (of_device_is_compatible(np, "fsl-usb2-mph-v2.4")) usb_get_ver_info() 161 else if (of_device_is_compatible(np, "fsl-usb2-mph-v2.5")) usb_get_ver_info() 172 struct device_node *np = ofdev->dev.of_node; fsl_usb2_mph_dr_of_probe() local 181 if (!of_device_is_available(np)) fsl_usb2_mph_dr_of_probe() 194 dev_data = get_dr_mode_data(np); fsl_usb2_mph_dr_of_probe() 196 if (of_device_is_compatible(np, "fsl-usb2-mph")) { fsl_usb2_mph_dr_of_probe() 197 if (of_get_property(np, "port0", NULL)) fsl_usb2_mph_dr_of_probe() 200 if (of_get_property(np, "port1", NULL)) fsl_usb2_mph_dr_of_probe() 205 if (of_get_property(np, "fsl,invert-drvvbus", NULL)) fsl_usb2_mph_dr_of_probe() 208 if (of_get_property(np, "fsl,invert-pwr-fault", NULL)) fsl_usb2_mph_dr_of_probe() 215 prop = of_get_property(np, "phy_type", NULL); fsl_usb2_mph_dr_of_probe() 217 pdata->controller_ver = usb_get_ver_info(np); fsl_usb2_mph_dr_of_probe() 220 if (of_get_property(np, "fsl,usb-erratum-a007792", NULL)) fsl_usb2_mph_dr_of_probe() 224 if (of_get_property(np, "fsl,usb-erratum-a005275", NULL)) fsl_usb2_mph_dr_of_probe() 233 if (of_get_property(np, "phy-clk-valid", NULL)) fsl_usb2_mph_dr_of_probe()
|
H A D | ehci-ppc-of.c | 102 struct device_node *np; ehci_hcd_ppc_of_probe() local 135 np = of_find_compatible_node(NULL, NULL, "ibm,usb-ohci-440epx"); ehci_hcd_ppc_of_probe() 136 if (np != NULL) { ehci_hcd_ppc_of_probe() 138 if (!of_address_to_resource(np, 0, &res)) ehci_hcd_ppc_of_probe() 190 struct device_node *np; ehci_hcd_ppc_of_remove() local 203 np = of_find_compatible_node(NULL, NULL, "ibm,usb-ohci-440epx"); ehci_hcd_ppc_of_remove() 204 if (np != NULL) { ehci_hcd_ppc_of_remove() 205 if (!of_address_to_resource(np, 0, &res)) ehci_hcd_ppc_of_remove() 213 of_node_put(np); ehci_hcd_ppc_of_remove()
|
/linux-4.4.14/arch/arm/mach-shmobile/ |
H A D | timer.c | 40 struct device_node *np, *cpus; shmobile_init_delay() local 50 for_each_child_of_node(cpus, np) { for_each_child_of_node() 53 if (!of_property_read_u32(np, "clock-frequency", &freq)) for_each_child_of_node() 56 if (of_device_is_compatible(np, "arm,cortex-a8") || for_each_child_of_node() 57 of_device_is_compatible(np, "arm,cortex-a9")) { for_each_child_of_node() 59 } else if (of_device_is_compatible(np, "arm,cortex-a7")) { for_each_child_of_node() 62 } else if (of_device_is_compatible(np, "arm,cortex-a15")) { for_each_child_of_node()
|
H A D | pm-rmobile.c | 185 static void __init add_special_pd(struct device_node *np, enum pd_types type) add_special_pd() argument 190 pd = of_parse_phandle(np, "power-domains", 0); add_special_pd() 207 np->full_name); add_special_pd() 216 struct device_node *np; get_special_pds() local 220 for_each_node_by_type(np, "cpu") get_special_pds() 221 add_special_pd(np, PD_CPU); get_special_pds() 228 for_each_matching_node_and_match(np, special_ids, &id) get_special_pds() 229 add_special_pd(np, (enum pd_types)id->data); get_special_pds() 251 static void __init rmobile_setup_pm_domain(struct device_node *np, rmobile_setup_pm_domain() argument 256 switch (pd_type(np)) { rmobile_setup_pm_domain() 305 struct device_node *np; rmobile_add_pm_domains() local 307 for_each_child_of_node(parent, np) { for_each_child_of_node() 311 if (of_property_read_u32(np, "reg", &idx)) { for_each_child_of_node() 317 of_node_put(np); for_each_child_of_node() 321 pd->genpd.name = np->name; for_each_child_of_node() 325 rmobile_setup_pm_domain(np, pd); for_each_child_of_node() 328 of_genpd_add_provider_simple(np, &pd->genpd); for_each_child_of_node() 330 rmobile_add_pm_domains(base, np, &pd->genpd); for_each_child_of_node() 337 struct device_node *np, *pmd; rmobile_init_pm_domains() local 342 for_each_compatible_node(np, NULL, "renesas,sysc-rmobile") { rmobile_init_pm_domains() 343 base = of_iomap(np, 0); rmobile_init_pm_domains() 345 pr_warn("%s cannot map reg 0\n", np->full_name); rmobile_init_pm_domains() 349 pmd = of_get_child_by_name(np, "pm-domains"); rmobile_init_pm_domains() 351 pr_warn("%s lacks pm-domains node\n", np->full_name); rmobile_init_pm_domains() 364 of_node_put(np); rmobile_init_pm_domains()
|
/linux-4.4.14/arch/arm/mach-zx/ |
H A D | platsmp.c | 46 struct device_node *np; zx_smp_prepare_cpus() local 60 np = of_find_compatible_node(NULL, NULL, "zte,sysctrl"); zx_smp_prepare_cpus() 61 if (!np) { zx_smp_prepare_cpus() 66 aonsysctrl_base = of_iomap(np, 0); zx_smp_prepare_cpus() 69 of_node_put(np); zx_smp_prepare_cpus() 83 of_node_put(np); zx_smp_prepare_cpus() 85 np = of_find_compatible_node(NULL, NULL, "zte,zx296702-pcu"); zx_smp_prepare_cpus() 86 pcu_base = of_iomap(np, 0); zx_smp_prepare_cpus() 87 of_node_put(np); zx_smp_prepare_cpus() 90 np = of_find_compatible_node(NULL, NULL, "zte,zx-bus-matrix"); zx_smp_prepare_cpus() 91 matrix_base = of_iomap(np, 0); zx_smp_prepare_cpus() 92 of_node_put(np); zx_smp_prepare_cpus()
|
/linux-4.4.14/arch/powerpc/kernel/ |
H A D | legacy_serial.c | 31 struct device_node *np; member in struct:legacy_serial_info 72 static int __init add_legacy_port(struct device_node *np, int want_index, add_legacy_port() argument 83 clk = of_get_property(np, "clock-frequency", NULL); add_legacy_port() 88 spd = of_get_property(np, "current-speed", NULL); add_legacy_port() 91 rs = of_get_property(np, "reg-shift", NULL); add_legacy_port() 111 if (legacy_serial_infos[index].np != NULL) { add_legacy_port() 140 legacy_serial_infos[index].np = of_node_get(np); add_legacy_port() 151 index, np->full_name); add_legacy_port() 161 static int __init add_legacy_soc_port(struct device_node *np, add_legacy_soc_port() argument 166 struct device_node *tsi = of_get_parent(np); add_legacy_soc_port() 171 if (of_get_property(np, "clock-frequency", NULL) == NULL) add_legacy_soc_port() 175 if ((of_get_property(np, "reg-offset", NULL) != NULL)) add_legacy_soc_port() 179 if (of_get_property(np, "used-by-rtas", NULL) != NULL) add_legacy_soc_port() 195 return add_legacy_port(np, -1, UPIO_TSI, addr, addr, add_legacy_soc_port() 198 return add_legacy_port(np, -1, UPIO_MEM, addr, addr, add_legacy_soc_port() 202 static int __init add_legacy_isa_port(struct device_node *np, add_legacy_isa_port() argument 210 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); add_legacy_isa_port() 213 reg = of_get_property(np, "reg", NULL); add_legacy_isa_port() 224 typep = of_get_property(np, "ibm,aix-loc", NULL); add_legacy_isa_port() 237 taddr = of_translate_address(np, reg); add_legacy_isa_port() 244 return add_legacy_port(np, index, UPIO_PORT, be32_to_cpu(reg[1]), add_legacy_isa_port() 250 static int __init add_legacy_pci_port(struct device_node *np, add_legacy_pci_port() argument 258 DBG(" -> add_legacy_pci_port(%s)\n", np->full_name); add_legacy_pci_port() 267 if (of_get_property(np, "clock-frequency", NULL) == NULL) add_legacy_pci_port() 292 if (np != pci_dev) { add_legacy_pci_port() 293 const __be32 *reg = of_get_property(np, "reg", NULL); add_legacy_pci_port() 317 return add_legacy_port(np, index, iotype, base, addr, NO_IRQ, add_legacy_pci_port() 318 legacy_port_flags, np != pci_dev); add_legacy_pci_port() 365 struct device_node *np, *stdout = NULL; find_legacy_serial_ports() local 382 for_each_compatible_node(np, "serial", "ns16550") { find_legacy_serial_ports() 383 struct device_node *parent = of_get_parent(np); find_legacy_serial_ports() 387 if (of_device_is_available(np)) { find_legacy_serial_ports() 388 index = add_legacy_soc_port(np, np); find_legacy_serial_ports() 389 if (index >= 0 && np == stdout) find_legacy_serial_ports() 397 for_each_node_by_type(np, "serial") { find_legacy_serial_ports() 398 struct device_node *isa = of_get_parent(np); find_legacy_serial_ports() 401 if (of_device_is_available(np)) { find_legacy_serial_ports() 402 index = add_legacy_isa_port(np, isa); find_legacy_serial_ports() 403 if (index >= 0 && np == stdout) find_legacy_serial_ports() 412 for (np = NULL; (np = of_find_all_nodes(np));) { find_legacy_serial_ports() 413 struct device_node *pci, *parent = of_get_parent(np); find_legacy_serial_ports() 418 if (strcmp(np->name, "serial") && strcmp(np->type, "serial")) { find_legacy_serial_ports() 425 if (of_device_is_compatible(np, "pciclass,0700") || find_legacy_serial_ports() 426 of_device_is_compatible(np, "pciclass,070002")) find_legacy_serial_ports() 427 pci = np; find_legacy_serial_ports() 435 index = add_legacy_pci_port(np, pci); find_legacy_serial_ports() 436 if (index >= 0 && np == stdout) find_legacy_serial_ports() 457 struct device_node *np, fixup_port_irq() 464 virq = irq_of_parse_and_map(np, 0); fixup_port_irq() 466 np = of_get_parent(np); fixup_port_irq() 467 if (np == NULL) fixup_port_irq() 469 virq = irq_of_parse_and_map(np, 0); fixup_port_irq() 470 of_node_put(np); fixup_port_irq() 478 if (of_device_is_compatible(np, "fsl,ns16550")) fixup_port_irq() 484 struct device_node *np, fixup_port_pio() 492 hose = pci_find_hose_for_OF_device(np); fixup_port_pio() 508 struct device_node *np, fixup_port_mmio() 544 struct device_node *np = legacy_serial_infos[i].np; serial_dev_init() local 547 fixup_port_irq(i, np, port); serial_dev_init() 549 fixup_port_pio(i, np, port); serial_dev_init() 551 fixup_port_mmio(i, np, port); serial_dev_init() 621 if (prom_stdout != legacy_serial_infos[i].np) check_legacy_serial_console() 456 fixup_port_irq(int index, struct device_node *np, struct plat_serial8250_port *port) fixup_port_irq() argument 483 fixup_port_pio(int index, struct device_node *np, struct plat_serial8250_port *port) fixup_port_pio() argument 507 fixup_port_mmio(int index, struct device_node *np, struct plat_serial8250_port *port) fixup_port_mmio() argument
|
/linux-4.4.14/drivers/iommu/ |
H A D | of_iommu.c | 100 struct device_node *np; member in struct:of_iommu_node 106 void of_iommu_set_ops(struct device_node *np, struct iommu_ops *ops) of_iommu_set_ops() argument 114 iommu->np = np; of_iommu_set_ops() 121 struct iommu_ops *of_iommu_get_ops(struct device_node *np) of_iommu_get_ops() argument 128 if (node->np == np) { of_iommu_get_ops() 140 struct device_node *np; of_iommu_configure() local 159 np = iommu_spec.np; of_iommu_configure() 160 ops = of_iommu_get_ops(np); of_iommu_configure() 165 of_node_put(np); of_iommu_configure() 172 of_node_put(np); of_iommu_configure() 178 struct device_node *np; of_iommu_init() local 181 for_each_matching_node_and_match(np, matches, &match) { of_iommu_init() 184 if (init_fn(np)) of_iommu_init() 186 of_node_full_name(np)); of_iommu_init()
|
/linux-4.4.14/drivers/target/iscsi/ |
H A D | iscsi_target_login.c | 695 struct iscsi_np *np, iscsi_post_login_handler() 823 struct iscsi_np *np = (struct iscsi_np *) data; iscsi_handle_login_thread_timeout() local 825 spin_lock_bh(&np->np_thread_lock); iscsi_handle_login_thread_timeout() 827 &np->np_sockaddr); iscsi_handle_login_thread_timeout() 829 if (np->np_login_timer_flags & ISCSI_TF_STOP) { iscsi_handle_login_thread_timeout() 830 spin_unlock_bh(&np->np_thread_lock); iscsi_handle_login_thread_timeout() 834 if (np->np_thread) iscsi_handle_login_thread_timeout() 835 send_sig(SIGINT, np->np_thread, 1); iscsi_handle_login_thread_timeout() 837 np->np_login_timer_flags &= ~ISCSI_TF_RUNNING; iscsi_handle_login_thread_timeout() 838 spin_unlock_bh(&np->np_thread_lock); iscsi_handle_login_thread_timeout() 841 static void iscsi_start_login_thread_timer(struct iscsi_np *np) iscsi_start_login_thread_timer() argument 847 spin_lock_bh(&np->np_thread_lock); iscsi_start_login_thread_timer() 848 init_timer(&np->np_login_timer); iscsi_start_login_thread_timer() 849 np->np_login_timer.expires = (get_jiffies_64() + TA_LOGIN_TIMEOUT * HZ); iscsi_start_login_thread_timer() 850 np->np_login_timer.data = (unsigned long)np; iscsi_start_login_thread_timer() 851 np->np_login_timer.function = iscsi_handle_login_thread_timeout; iscsi_start_login_thread_timer() 852 np->np_login_timer_flags &= ~ISCSI_TF_STOP; iscsi_start_login_thread_timer() 853 np->np_login_timer_flags |= ISCSI_TF_RUNNING; iscsi_start_login_thread_timer() 854 add_timer(&np->np_login_timer); iscsi_start_login_thread_timer() 858 spin_unlock_bh(&np->np_thread_lock); iscsi_start_login_thread_timer() 861 static void iscsi_stop_login_thread_timer(struct iscsi_np *np) iscsi_stop_login_thread_timer() argument 863 spin_lock_bh(&np->np_thread_lock); iscsi_stop_login_thread_timer() 864 if (!(np->np_login_timer_flags & ISCSI_TF_RUNNING)) { iscsi_stop_login_thread_timer() 865 spin_unlock_bh(&np->np_thread_lock); iscsi_stop_login_thread_timer() 868 np->np_login_timer_flags |= ISCSI_TF_STOP; iscsi_stop_login_thread_timer() 869 spin_unlock_bh(&np->np_thread_lock); iscsi_stop_login_thread_timer() 871 del_timer_sync(&np->np_login_timer); iscsi_stop_login_thread_timer() 873 spin_lock_bh(&np->np_thread_lock); iscsi_stop_login_thread_timer() 874 np->np_login_timer_flags &= ~ISCSI_TF_RUNNING; iscsi_stop_login_thread_timer() 875 spin_unlock_bh(&np->np_thread_lock); iscsi_stop_login_thread_timer() 879 struct iscsi_np *np, iscsit_setup_np() 885 switch (np->np_network_transport) { iscsit_setup_np() 887 np->np_ip_proto = IPPROTO_TCP; iscsit_setup_np() 888 np->np_sock_type = SOCK_STREAM; iscsit_setup_np() 891 np->np_ip_proto = IPPROTO_SCTP; iscsit_setup_np() 892 np->np_sock_type = SOCK_STREAM; iscsit_setup_np() 895 np->np_ip_proto = IPPROTO_SCTP; iscsit_setup_np() 896 np->np_sock_type = SOCK_SEQPACKET; iscsit_setup_np() 900 np->np_network_transport); iscsit_setup_np() 904 np->np_ip_proto = IPPROTO_TCP; iscsit_setup_np() 905 np->np_sock_type = SOCK_STREAM; iscsit_setup_np() 907 ret = sock_create(sockaddr->ss_family, np->np_sock_type, iscsit_setup_np() 908 np->np_ip_proto, &sock); iscsit_setup_np() 913 np->np_socket = sock; iscsit_setup_np() 915 * Setup the np->np_sockaddr from the passed sockaddr setup iscsit_setup_np() 918 memcpy(&np->np_sockaddr, sockaddr, iscsit_setup_np() 930 if (np->np_network_transport == ISCSI_TCP) { iscsit_setup_np() 957 ret = kernel_bind(sock, (struct sockaddr *)&np->np_sockaddr, len); iscsit_setup_np() 971 np->np_socket = NULL; iscsit_setup_np() 977 struct iscsi_np *np, iscsi_target_setup_login_socket() 983 t = iscsit_get_transport(np->np_network_transport); iscsi_target_setup_login_socket() 987 rc = t->iscsit_setup_np(np, sockaddr); iscsi_target_setup_login_socket() 993 np->np_transport = t; iscsi_target_setup_login_socket() 994 np->enabled = true; iscsi_target_setup_login_socket() 998 int iscsit_accept_np(struct iscsi_np *np, struct iscsi_conn *conn) iscsit_accept_np() argument 1000 struct socket *new_sock, *sock = np->np_socket; iscsit_accept_np() 1010 conn->login_family = np->np_sockaddr.ss_family; iscsit_accept_np() 1012 if (np->np_sockaddr.ss_family == AF_INET6) { iscsit_accept_np() 1134 struct iscsi_np *np, bool zero_tsih, bool new_sess) iscsi_target_login_sess_out() 1156 iscsi_stop_login_thread_timer(np); iscsi_target_login_sess_out() 1207 static int __iscsi_target_login_thread(struct iscsi_np *np) __iscsi_target_login_thread() argument 1220 spin_lock_bh(&np->np_thread_lock); __iscsi_target_login_thread() 1221 if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { __iscsi_target_login_thread() 1222 np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; __iscsi_target_login_thread() 1223 complete(&np->np_restart_comp); __iscsi_target_login_thread() 1224 } else if (np->np_thread_state == ISCSI_NP_THREAD_SHUTDOWN) { __iscsi_target_login_thread() 1225 spin_unlock_bh(&np->np_thread_lock); __iscsi_target_login_thread() 1228 np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; __iscsi_target_login_thread() 1230 spin_unlock_bh(&np->np_thread_lock); __iscsi_target_login_thread() 1242 if (iscsit_conn_set_transport(conn, np->np_transport) < 0) { __iscsi_target_login_thread() 1247 rc = np->np_transport->iscsit_accept_np(np, conn); __iscsi_target_login_thread() 1249 complete(&np->np_restart_comp); __iscsi_target_login_thread() 1255 spin_lock_bh(&np->np_thread_lock); __iscsi_target_login_thread() 1256 if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { __iscsi_target_login_thread() 1257 spin_unlock_bh(&np->np_thread_lock); __iscsi_target_login_thread() 1258 complete(&np->np_restart_comp); __iscsi_target_login_thread() 1265 spin_unlock_bh(&np->np_thread_lock); __iscsi_target_login_thread() 1279 iscsi_start_login_thread_timer(np); __iscsi_target_login_thread() 1286 rc = np->np_transport->iscsit_get_login_rx(conn, login); __iscsi_target_login_thread() 1300 spin_lock_bh(&np->np_thread_lock); __iscsi_target_login_thread() 1301 if (np->np_thread_state != ISCSI_NP_THREAD_ACTIVE) { __iscsi_target_login_thread() 1302 spin_unlock_bh(&np->np_thread_lock); __iscsi_target_login_thread() 1304 " active.\n", &np->np_sockaddr); __iscsi_target_login_thread() 1309 spin_unlock_bh(&np->np_thread_lock); __iscsi_target_login_thread() 1311 conn->network_transport = np->np_network_transport; __iscsi_target_login_thread() 1314 " Portal %pISpc\n", &conn->login_sockaddr, np->np_transport->name, __iscsi_target_login_thread() 1353 rc = iscsi_target_locate_portal(np, conn, login); __iscsi_target_login_thread() 1381 iscsi_stop_login_thread_timer(np); __iscsi_target_login_thread() 1386 iscsi_post_login_handler(np, conn, zero_tsih); __iscsi_target_login_thread() 1387 iscsit_deaccess_np(np, tpg, tpg_np); __iscsi_target_login_thread() 1399 iscsi_target_login_sess_out(conn, np, zero_tsih, new_sess); __iscsi_target_login_thread() 1403 iscsit_deaccess_np(np, tpg, tpg_np); __iscsi_target_login_thread() 1412 iscsi_stop_login_thread_timer(np); __iscsi_target_login_thread() 1413 spin_lock_bh(&np->np_thread_lock); __iscsi_target_login_thread() 1414 np->np_thread_state = ISCSI_NP_THREAD_EXIT; __iscsi_target_login_thread() 1415 spin_unlock_bh(&np->np_thread_lock); __iscsi_target_login_thread() 1422 struct iscsi_np *np = arg; iscsi_target_login_thread() local 1428 ret = __iscsi_target_login_thread(np); iscsi_target_login_thread() 694 iscsi_post_login_handler( struct iscsi_np *np, struct iscsi_conn *conn, u8 zero_tsih) iscsi_post_login_handler() argument 878 iscsit_setup_np( struct iscsi_np *np, struct sockaddr_storage *sockaddr) iscsit_setup_np() argument 976 iscsi_target_setup_login_socket( struct iscsi_np *np, struct sockaddr_storage *sockaddr) iscsi_target_setup_login_socket() argument 1133 iscsi_target_login_sess_out(struct iscsi_conn *conn, struct iscsi_np *np, bool zero_tsih, bool new_sess) iscsi_target_login_sess_out() argument
|
/linux-4.4.14/drivers/macintosh/ |
H A D | macio_asic.c | 179 * @np: pointer to the device node 186 static int macio_resource_quirks(struct device_node *np, struct resource *res, macio_resource_quirks() argument 194 if (index == 0 && !strcmp(np->name, "gc")) macio_resource_quirks() 198 if (index >= 2 && !strcmp(np->name, "radio")) macio_resource_quirks() 211 if (!strcmp(np->name, "escc")) macio_resource_quirks() 215 if (index >= 3 && !(strcmp(np->name, "ch-a") && macio_resource_quirks() 216 strcmp(np->name, "ch-b"))) macio_resource_quirks() 220 if (index > 0 && !strcmp(np->name, "media-bay")) macio_resource_quirks() 224 if (!(strcmp(np->name, "IDE") && strcmp(np->name, "ATA") && macio_resource_quirks() 225 strcmp(np->type, "ide") && strcmp(np->type, "ata"))) { macio_resource_quirks() 251 struct device_node *np = dev->ofdev.dev.of_node; macio_add_missing_resources() local 264 if (strcmp(np->name, "ch-a") == 0) { macio_add_missing_resources() 272 if (strcmp(np->name, "media-bay") == 0) { macio_add_missing_resources() 278 if (dev->media_bay != NULL && strcmp(np->name, "floppy") == 0) { macio_add_missing_resources() 283 if (dev->media_bay != NULL && strcasecmp(np->name, "ata4") == 0) { macio_add_missing_resources() 292 struct device_node *np = dev->ofdev.dev.of_node; macio_setup_interrupts() local 302 irq = irq_of_parse_and_map(np, i++); macio_setup_interrupts() 308 if (macio_resource_quirks(np, res, i - 1)) { macio_setup_interrupts() 320 struct device_node *np = dev->ofdev.dev.of_node; macio_setup_resources() local 324 for (index = 0; of_address_to_resource(np, index, &r) == 0; index++) { macio_setup_resources() 332 if (macio_resource_quirks(np, res, index)) { macio_setup_resources() 352 * @np: pointer to the device node in the OF tree 360 struct device_node *np, macio_add_one_device() 367 if (np == NULL) macio_add_one_device() 376 dev->ofdev.dev.of_node = np; macio_add_one_device() 404 if (np == chip->of_node) { macio_add_one_device() 412 MAX_NODE_NAME_SIZE, np->name); macio_add_one_device() 414 reg = of_get_property(np, "reg", NULL); macio_add_one_device() 417 reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); macio_add_one_device() 436 static int macio_skip_device(struct device_node *np) macio_skip_device() argument 438 if (strncmp(np->name, "battery", 7) == 0) macio_skip_device() 440 if (strncmp(np->name, "escc-legacy", 11) == 0) macio_skip_device() 458 struct device_node *np, *pnode; macio_pci_add_devices() local 481 for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) { macio_pci_add_devices() 482 if (macio_skip_device(np)) macio_pci_add_devices() 484 of_node_get(np); macio_pci_add_devices() 485 mdev = macio_add_one_device(chip, &rdev->ofdev.dev, np, NULL, macio_pci_add_devices() 488 of_node_put(np); macio_pci_add_devices() 489 else if (strncmp(np->name, "media-bay", 9) == 0) macio_pci_add_devices() 491 else if (strncmp(np->name, "escc", 4) == 0) macio_pci_add_devices() 498 for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) { macio_pci_add_devices() 499 if (macio_skip_device(np)) macio_pci_add_devices() 501 of_node_get(np); macio_pci_add_devices() 502 if (macio_add_one_device(chip, &mbdev->ofdev.dev, np, macio_pci_add_devices() 504 of_node_put(np); macio_pci_add_devices() 511 for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) { macio_pci_add_devices() 512 if (macio_skip_device(np)) macio_pci_add_devices() 514 of_node_get(np); macio_pci_add_devices() 515 if (macio_add_one_device(chip, &sdev->ofdev.dev, np, macio_pci_add_devices() 517 of_node_put(np); macio_pci_add_devices() 686 struct device_node* np; macio_pci_probe() local 695 np = pci_device_to_OF_node(pdev); macio_pci_probe() 696 if (np == NULL) macio_pci_probe() 702 of_node_get(np); macio_pci_probe() 707 chip = macio_find(np, macio_unknown); macio_pci_probe() 708 of_node_put(np); macio_pci_probe() 358 macio_add_one_device(struct macio_chip *chip, struct device *parent, struct device_node *np, struct macio_dev *in_bay, struct resource *parent_res) macio_add_one_device() argument
|
/linux-4.4.14/arch/mips/pistachio/ |
H A D | time.c | 38 struct device_node *np; plat_time_init() local 44 np = of_get_cpu_node(0, NULL); plat_time_init() 45 if (!np) { plat_time_init() 50 clk = of_clk_get(np, 0); plat_time_init()
|
/linux-4.4.14/include/linux/mfd/ |
H A D | syscon.h | 23 extern struct regmap *syscon_node_to_regmap(struct device_node *np); 27 struct device_node *np, 30 static inline struct regmap *syscon_node_to_regmap(struct device_node *np) syscon_node_to_regmap() argument 46 struct device_node *np, syscon_regmap_lookup_by_phandle() 45 syscon_regmap_lookup_by_phandle( struct device_node *np, const char *property) syscon_regmap_lookup_by_phandle() argument
|
/linux-4.4.14/drivers/mmc/core/ |
H A D | pwrseq.c | 35 static struct mmc_pwrseq_match *mmc_pwrseq_find(struct device_node *np) mmc_pwrseq_find() argument 41 if (of_device_is_compatible(np, pwrseq_match[i].compatible)) { mmc_pwrseq_find() 53 struct device_node *np; mmc_pwrseq_alloc() local 58 np = of_parse_phandle(host->parent->of_node, "mmc-pwrseq", 0); mmc_pwrseq_alloc() 59 if (!np) mmc_pwrseq_alloc() 62 pdev = of_find_device_by_node(np); mmc_pwrseq_alloc() 68 match = mmc_pwrseq_find(np); mmc_pwrseq_alloc() 84 of_node_put(np); mmc_pwrseq_alloc()
|
H A D | host.c | 159 struct device_node *np; mmc_of_parse() local 168 np = host->parent->of_node; mmc_of_parse() 171 if (of_property_read_u32(np, "bus-width", &bus_width) < 0) { mmc_of_parse() 193 of_property_read_u32(np, "max-frequency", &host->f_max); mmc_of_parse() 208 if (of_property_read_bool(np, "non-removable")) { mmc_of_parse() 211 cd_cap_invert = of_property_read_bool(np, "cd-inverted"); mmc_of_parse() 213 if (of_property_read_bool(np, "broken-cd")) mmc_of_parse() 239 ro_cap_invert = of_property_read_bool(np, "wp-inverted"); mmc_of_parse() 247 if (of_property_read_bool(np, "disable-wp")) mmc_of_parse() 254 if (of_property_read_bool(np, "cap-sd-highspeed")) mmc_of_parse() 256 if (of_property_read_bool(np, "cap-mmc-highspeed")) mmc_of_parse() 258 if (of_property_read_bool(np, "sd-uhs-sdr12")) mmc_of_parse() 260 if (of_property_read_bool(np, "sd-uhs-sdr25")) mmc_of_parse() 262 if (of_property_read_bool(np, "sd-uhs-sdr50")) mmc_of_parse() 264 if (of_property_read_bool(np, "sd-uhs-sdr104")) mmc_of_parse() 266 if (of_property_read_bool(np, "sd-uhs-ddr50")) mmc_of_parse() 268 if (of_property_read_bool(np, "cap-power-off-card")) mmc_of_parse() 270 if (of_property_read_bool(np, "cap-mmc-hw-reset")) mmc_of_parse() 272 if (of_property_read_bool(np, "cap-sdio-irq")) mmc_of_parse() 274 if (of_property_read_bool(np, "full-pwr-cycle")) mmc_of_parse() 276 if (of_property_read_bool(np, "keep-power-in-suspend")) mmc_of_parse() 278 if (of_property_read_bool(np, "enable-sdio-wakeup")) mmc_of_parse() 280 if (of_property_read_bool(np, "mmc-ddr-1_8v")) mmc_of_parse() 282 if (of_property_read_bool(np, "mmc-ddr-1_2v")) mmc_of_parse() 284 if (of_property_read_bool(np, "mmc-hs200-1_8v")) mmc_of_parse() 286 if (of_property_read_bool(np, "mmc-hs200-1_2v")) mmc_of_parse() 288 if (of_property_read_bool(np, "mmc-hs400-1_8v")) mmc_of_parse() 290 if (of_property_read_bool(np, "mmc-hs400-1_2v")) mmc_of_parse() 293 host->dsr_req = !of_property_read_u32(np, "dsr", &host->dsr); mmc_of_parse()
|
/linux-4.4.14/arch/arm/mach-socfpga/ |
H A D | socfpga.c | 37 struct device_node *np; socfpga_sysmgr_init() local 39 np = of_find_compatible_node(NULL, NULL, "altr,sys-mgr"); socfpga_sysmgr_init() 41 if (of_property_read_u32(np, "cpu1-start-addr", socfpga_sysmgr_init() 49 sys_manager_base_addr = of_iomap(np, 0); socfpga_sysmgr_init() 51 np = of_find_compatible_node(NULL, NULL, "altr,rst-mgr"); socfpga_sysmgr_init() 52 rst_manager_base_addr = of_iomap(np, 0); socfpga_sysmgr_init() 54 np = of_find_compatible_node(NULL, NULL, "altr,sdr-ctl"); socfpga_sysmgr_init() 55 sdr_ctl_base_addr = of_iomap(np, 0); socfpga_sysmgr_init()
|
/linux-4.4.14/drivers/regulator/ |
H A D | of_regulator.c | 27 static void of_get_regulation_constraints(struct device_node *np, of_get_regulation_constraints() argument 38 constraints->name = of_get_property(np, "regulator-name", NULL); of_get_regulation_constraints() 40 min_uV = of_get_property(np, "regulator-min-microvolt", NULL); of_get_regulation_constraints() 43 max_uV = of_get_property(np, "regulator-max-microvolt", NULL); of_get_regulation_constraints() 54 if (!of_property_read_u32(np, "regulator-microvolt-offset", &pval)) of_get_regulation_constraints() 56 if (!of_property_read_u32(np, "regulator-min-microamp", &pval)) of_get_regulation_constraints() 58 if (!of_property_read_u32(np, "regulator-max-microamp", &pval)) of_get_regulation_constraints() 61 if (!of_property_read_u32(np, "regulator-input-current-limit-microamp", of_get_regulation_constraints() 69 constraints->boot_on = of_property_read_bool(np, "regulator-boot-on"); of_get_regulation_constraints() 70 constraints->always_on = of_property_read_bool(np, "regulator-always-on"); of_get_regulation_constraints() 74 constraints->pull_down = of_property_read_bool(np, "regulator-pull-down"); of_get_regulation_constraints() 76 if (of_property_read_bool(np, "regulator-allow-bypass")) of_get_regulation_constraints() 79 if (of_property_read_bool(np, "regulator-allow-set-load")) of_get_regulation_constraints() 82 ret = of_property_read_u32(np, "regulator-ramp-delay", &pval); of_get_regulation_constraints() 90 ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval); of_get_regulation_constraints() 94 constraints->soft_start = of_property_read_bool(np, of_get_regulation_constraints() 97 if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) { of_get_regulation_constraints() 101 pr_err("%s: invalid mode %u\n", np->name, pval); of_get_regulation_constraints() 106 np->name, pval); of_get_regulation_constraints() 110 if (!of_property_read_u32(np, "regulator-system-load", &pval)) of_get_regulation_constraints() 113 constraints->over_current_protection = of_property_read_bool(np, of_get_regulation_constraints() 131 suspend_np = of_get_child_by_name(np, regulator_states[i]); of_get_regulation_constraints() 141 np->name, pval); of_get_regulation_constraints() 146 np->name, pval); of_get_regulation_constraints()
|
/linux-4.4.14/drivers/net/wireless/brcm80211/brcmfmac/ |
H A D | of.c | 30 struct device_node *np = dev->of_node; brcmf_of_probe() local 35 if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac")) brcmf_of_probe() 42 if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0) brcmf_of_probe() 46 if (!of_find_property(np, "interrupts", NULL)) brcmf_of_probe() 49 irq = irq_of_parse_and_map(np, 0); brcmf_of_probe()
|
/linux-4.4.14/drivers/gpu/drm/exynos/ |
H A D | exynos_drm_dpi.c | 179 struct device_node *np; of_get_child_by_name_reg() local 181 for_each_child_of_node(parent, np) { for_each_child_of_node() 184 if (!np->name || of_node_cmp(np->name, name)) for_each_child_of_node() 187 if (of_property_read_u32(np, "reg", &r) < 0) for_each_child_of_node() 194 return np; 222 struct device_node *np; of_graph_get_remote_port_parent() local 225 np = of_parse_phandle(node, "remote-endpoint", 0); of_graph_get_remote_port_parent() 228 for (depth = 3; depth && np; depth--) { of_graph_get_remote_port_parent() 229 np = of_get_next_parent(np); of_graph_get_remote_port_parent() 230 if (depth == 2 && of_node_cmp(np->name, "ports")) of_graph_get_remote_port_parent() 233 return np; of_graph_get_remote_port_parent() 246 struct device_node *np, *ep; exynos_dpi_of_find_panel_node() local 248 np = of_graph_get_port_by_reg(dev->of_node, FIMD_PORT_RGB); exynos_dpi_of_find_panel_node() 249 if (!np) exynos_dpi_of_find_panel_node() 252 ep = of_graph_get_endpoint_by_reg(np, 0); exynos_dpi_of_find_panel_node() 253 of_node_put(np); exynos_dpi_of_find_panel_node() 257 np = of_graph_get_remote_port_parent(ep); exynos_dpi_of_find_panel_node() 260 return np; exynos_dpi_of_find_panel_node() 267 struct device_node *np; exynos_dpi_parse_dt() local 271 np = of_get_child_by_name(dn, "display-timings"); exynos_dpi_parse_dt() 272 if (np) { exynos_dpi_parse_dt() 276 of_node_put(np); exynos_dpi_parse_dt()
|
/linux-4.4.14/arch/powerpc/platforms/44x/ |
H A D | warp.c | 71 struct device_node *np; warp_post_info() local 76 np = of_find_compatible_node(NULL, NULL, "pika,fpga-sd"); warp_post_info() 77 if (np == NULL) warp_post_info() 80 fpga = of_iomap(np, 0); warp_post_info() 81 of_node_put(np); warp_post_info() 175 struct device_node *np, *child; pika_setup_leds() local 177 np = of_find_compatible_node(NULL, NULL, "gpio-leds"); pika_setup_leds() 178 if (!np) { pika_setup_leds() 183 for_each_child_of_node(np, child) pika_setup_leds() 189 of_node_put(np); pika_setup_leds() 194 static void pika_setup_critical_temp(struct device_node *np, pika_setup_critical_temp() argument 208 irq = irq_of_parse_and_map(np, 0); pika_setup_critical_temp() 237 struct device_node *np; pika_dtm_thread() local 240 np = of_find_compatible_node(NULL, NULL, "adi,ad7414"); pika_dtm_thread() 241 if (np == NULL) pika_dtm_thread() 244 client = of_find_i2c_device_by_node(np); pika_dtm_thread() 246 of_node_put(np); pika_dtm_thread() 250 pika_setup_critical_temp(np, client); pika_dtm_thread() 252 of_node_put(np); pika_dtm_thread() 279 struct device_node *np; pika_dtm_start() local 281 np = of_find_compatible_node(NULL, NULL, "pika,fpga"); pika_dtm_start() 282 if (np == NULL) pika_dtm_start() 285 dtm_fpga = of_iomap(np, 0); pika_dtm_start() 286 of_node_put(np); pika_dtm_start()
|
H A D | canyonlands.c | 70 struct device_node *np; ppc460ex_canyonlands_fixup() local 73 np = of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-bcsr"); ppc460ex_canyonlands_fixup() 74 if (!np) { ppc460ex_canyonlands_fixup() 79 bcsr = of_iomap(np, 0); ppc460ex_canyonlands_fixup() 80 of_node_put(np); ppc460ex_canyonlands_fixup() 88 np = of_find_compatible_node(NULL, NULL, "ibm,ppc4xx-gpio"); ppc460ex_canyonlands_fixup() 89 if (!np) { ppc460ex_canyonlands_fixup() 94 vaddr = of_iomap(np, 0); ppc460ex_canyonlands_fixup() 95 of_node_put(np); ppc460ex_canyonlands_fixup()
|
/linux-4.4.14/arch/powerpc/platforms/powernv/ |
H A D | opal-nvram.c | 77 struct device_node *np; opal_nvram_init() local 80 np = of_find_compatible_node(NULL, NULL, "ibm,opal-nvram"); opal_nvram_init() 81 if (np == NULL) opal_nvram_init() 84 nbytes_p = of_get_property(np, "#bytes", NULL); opal_nvram_init() 86 of_node_put(np); opal_nvram_init() 92 of_node_put(np); opal_nvram_init()
|
/linux-4.4.14/arch/mips/ralink/ |
H A D | ill_acc.c | 52 struct device_node *np; ill_acc_of_setup() local 59 np = of_find_compatible_node(NULL, NULL, "ralink,rt3050-memc"); ill_acc_of_setup() 60 if (!np) ill_acc_of_setup() 63 pdev = of_find_device_by_node(np); ill_acc_of_setup() 65 pr_err("%s: failed to lookup pdev\n", np->name); ill_acc_of_setup() 69 irq = irq_of_parse_and_map(np, 0); ill_acc_of_setup()
|
H A D | cevt-rt3352.c | 120 static void __init ralink_systick_init(struct device_node *np) ralink_systick_init() argument 122 systick.membase = of_iomap(np, 0); ralink_systick_init() 126 systick_irqaction.name = np->name; ralink_systick_init() 127 systick.dev.name = np->name; ralink_systick_init() 131 systick.dev.irq = irq_of_parse_and_map(np, 0); ralink_systick_init() 133 pr_err("%s: request_irq failed", np->name); ralink_systick_init() 137 clocksource_mmio_init(systick.membase + SYSTICK_COUNT, np->name, ralink_systick_init() 143 np->name, systick.dev.mult, systick.dev.shift); ralink_systick_init()
|
/linux-4.4.14/drivers/mfd/ |
H A D | syscon.c | 34 struct device_node *np; member in struct:syscon 45 static struct syscon *of_syscon_register(struct device_node *np) of_syscon_register() argument 53 if (!of_device_is_compatible(np, "syscon")) of_syscon_register() 60 base = of_iomap(np, 0); of_syscon_register() 67 if (of_property_read_bool(np, "big-endian")) of_syscon_register() 69 else if (of_property_read_bool(np, "little-endian")) of_syscon_register() 80 syscon->np = np; of_syscon_register() 95 struct regmap *syscon_node_to_regmap(struct device_node *np) syscon_node_to_regmap() argument 102 if (entry->np == np) { syscon_node_to_regmap() 110 syscon = of_syscon_register(np); syscon_node_to_regmap() 156 struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np, syscon_regmap_lookup_by_phandle() argument 163 syscon_np = of_parse_phandle(np, property, 0); syscon_regmap_lookup_by_phandle() 165 syscon_np = np; syscon_regmap_lookup_by_phandle()
|
/linux-4.4.14/arch/arm/mach-vt8500/ |
H A D | vt8500.c | 77 struct device_node *np; vt8500_init() local 86 np = of_find_compatible_node(NULL, NULL, "via,vt8500-gpio"); vt8500_init() 87 if (np) { vt8500_init() 88 gpio_base = of_iomap(np, 0); vt8500_init() 94 of_node_put(np); vt8500_init() 115 np = of_find_compatible_node(NULL, NULL, "wm,wm8505-gpio"); vt8500_init() 116 if (!np) vt8500_init() 117 np = of_find_compatible_node(NULL, NULL, vt8500_init() 119 if (np) { vt8500_init() 120 gpio_base = of_iomap(np, 0); vt8500_init() 126 of_node_put(np); vt8500_init() 144 np = of_find_compatible_node(NULL, NULL, "via,vt8500-pmc"); vt8500_init() 145 if (np) { vt8500_init() 146 pmc_base = of_iomap(np, 0); vt8500_init() 151 of_node_put(np); vt8500_init()
|
/linux-4.4.14/arch/powerpc/platforms/powermac/ |
H A D | setup.c | 107 struct device_node *np; pmac_show_cpuinfo() local 124 np = of_find_node_by_path("/"); pmac_show_cpuinfo() 125 if (np != NULL) { pmac_show_cpuinfo() 126 pp = of_get_property(np, "model", NULL); pmac_show_cpuinfo() 131 pp = of_get_property(np, "compatible", &plen); pmac_show_cpuinfo() 142 of_node_put(np); pmac_show_cpuinfo() 151 np = of_find_node_by_name(NULL, "l2-cache"); pmac_show_cpuinfo() 152 if (np == NULL) pmac_show_cpuinfo() 153 np = of_find_node_by_type(NULL, "cache"); pmac_show_cpuinfo() 154 if (np != NULL) { pmac_show_cpuinfo() 156 of_get_property(np, "i-cache-size", NULL); pmac_show_cpuinfo() 158 of_get_property(np, "d-cache-size", NULL); pmac_show_cpuinfo() 161 if (of_get_property(np, "cache-unified", NULL) != 0 && dc) { pmac_show_cpuinfo() 170 pp = of_get_property(np, "ram-type", NULL); pmac_show_cpuinfo() 174 of_node_put(np); pmac_show_cpuinfo() 252 struct device_node *np = of_find_node_by_name(NULL, "cpus"); l2cr_init() local 253 if (np == 0) l2cr_init() 254 np = of_find_node_by_type(NULL, "cpu"); l2cr_init() 255 if (np != 0) { l2cr_init() 257 of_get_property(np, "l2cr-value", NULL); l2cr_init() 264 of_node_put(np); l2cr_init() 490 struct device_node *np; pmac_declare_of_platform_devices() local 495 np = of_find_node_by_name(NULL, "valkyrie"); pmac_declare_of_platform_devices() 496 if (np) { pmac_declare_of_platform_devices() 497 of_platform_device_create(np, "valkyrie", NULL); pmac_declare_of_platform_devices() 498 of_node_put(np); pmac_declare_of_platform_devices() 500 np = of_find_node_by_name(NULL, "platinum"); pmac_declare_of_platform_devices() 501 if (np) { pmac_declare_of_platform_devices() 502 of_platform_device_create(np, "platinum", NULL); pmac_declare_of_platform_devices() 503 of_node_put(np); pmac_declare_of_platform_devices() 505 np = of_find_node_by_type(NULL, "smu"); pmac_declare_of_platform_devices() 506 if (np) { pmac_declare_of_platform_devices() 507 of_platform_device_create(np, "smu", NULL); pmac_declare_of_platform_devices() 508 of_node_put(np); pmac_declare_of_platform_devices() 510 np = of_find_node_by_type(NULL, "fcu"); pmac_declare_of_platform_devices() 511 if (np == NULL) { pmac_declare_of_platform_devices() 513 np = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/fan@15e"); pmac_declare_of_platform_devices() 515 if (np) { pmac_declare_of_platform_devices() 516 of_platform_device_create(np, "temperature", NULL); pmac_declare_of_platform_devices() 517 of_node_put(np); pmac_declare_of_platform_devices()
|
/linux-4.4.14/net/ipv6/ |
H A D | ipv6_sockglue.c | 143 struct ipv6_pinfo *np = inet6_sk(sk); do_ipv6_setsockopt() local 235 opt = xchg((__force struct ipv6_txoptions **)&np->opt, do_ipv6_setsockopt() 241 pktopt = xchg(&np->pktoptions, NULL); do_ipv6_setsockopt() 267 np->rxopt.bits.rxinfo = valbool; do_ipv6_setsockopt() 274 np->rxopt.bits.rxoinfo = valbool; do_ipv6_setsockopt() 281 np->rxopt.bits.rxhlim = valbool; do_ipv6_setsockopt() 288 np->rxopt.bits.rxohlim = valbool; do_ipv6_setsockopt() 295 np->rxopt.bits.srcrt = valbool; do_ipv6_setsockopt() 302 np->rxopt.bits.osrcrt = valbool; do_ipv6_setsockopt() 309 np->rxopt.bits.hopopts = valbool; do_ipv6_setsockopt() 316 np->rxopt.bits.ohopopts = valbool; do_ipv6_setsockopt() 323 np->rxopt.bits.dstopts = valbool; do_ipv6_setsockopt() 330 np->rxopt.bits.odstopts = valbool; do_ipv6_setsockopt() 342 np->tclass = val; do_ipv6_setsockopt() 349 np->rxopt.bits.rxtclass = valbool; do_ipv6_setsockopt() 356 np->rxopt.bits.rxflow = valbool; do_ipv6_setsockopt() 363 np->rxopt.bits.rxpmtu = valbool; do_ipv6_setsockopt() 383 np->rxopt.bits.rxorigdstaddr = valbool; do_ipv6_setsockopt() 410 opt = rcu_dereference_protected(np->opt, sock_owned_by_user(sk)); do_ipv6_setsockopt() 463 np->sticky_pktinfo.ipi6_ifindex = pkt.ipi6_ifindex; do_ipv6_setsockopt() 464 np->sticky_pktinfo.ipi6_addr = pkt.ipi6_addr; do_ipv6_setsockopt() 524 np->hop_limit = val; do_ipv6_setsockopt() 535 np->mcast_hops = (val == -1 ? IPV6_DEFAULT_MCASTHOPS : val); do_ipv6_setsockopt() 544 np->mc_loop = valbool; do_ipv6_setsockopt() 558 np->ucast_oif = 0; do_ipv6_setsockopt() 573 np->ucast_oif = ifindex; do_ipv6_setsockopt() 597 np->mcast_oif = val; do_ipv6_setsockopt() 755 np->pmtudisc = val; do_ipv6_setsockopt() 763 np->frag_size = val; do_ipv6_setsockopt() 769 np->recverr = valbool; do_ipv6_setsockopt() 777 np->sndflow = valbool; do_ipv6_setsockopt() 848 np->srcprefs = (np->srcprefs & prefmask) | pref; do_ipv6_setsockopt() 858 np->min_hopcount = val; do_ipv6_setsockopt() 862 np->dontfrag = valbool; do_ipv6_setsockopt() 866 np->autoflowlabel = valbool; do_ipv6_setsockopt() 983 struct ipv6_pinfo *np = inet6_sk(sk); do_ipv6_getsockopt() local 1033 skb = np->pktoptions; do_ipv6_getsockopt() 1038 if (np->rxopt.bits.rxinfo) { do_ipv6_getsockopt() 1040 src_info.ipi6_ifindex = np->mcast_oif ? np->mcast_oif : do_ipv6_getsockopt() 1041 np->sticky_pktinfo.ipi6_ifindex; do_ipv6_getsockopt() 1042 src_info.ipi6_addr = np->mcast_oif ? sk->sk_v6_daddr : np->sticky_pktinfo.ipi6_addr; do_ipv6_getsockopt() 1045 if (np->rxopt.bits.rxhlim) { do_ipv6_getsockopt() 1046 int hlim = np->mcast_hops; do_ipv6_getsockopt() 1049 if (np->rxopt.bits.rxtclass) { do_ipv6_getsockopt() 1050 int tclass = (int)ip6_tclass(np->rcv_flowinfo); do_ipv6_getsockopt() 1054 if (np->rxopt.bits.rxoinfo) { do_ipv6_getsockopt() 1056 src_info.ipi6_ifindex = np->mcast_oif ? np->mcast_oif : do_ipv6_getsockopt() 1057 np->sticky_pktinfo.ipi6_ifindex; do_ipv6_getsockopt() 1058 src_info.ipi6_addr = np->mcast_oif ? sk->sk_v6_daddr : do_ipv6_getsockopt() 1059 np->sticky_pktinfo.ipi6_addr; do_ipv6_getsockopt() 1062 if (np->rxopt.bits.rxohlim) { do_ipv6_getsockopt() 1063 int hlim = np->mcast_hops; do_ipv6_getsockopt() 1066 if (np->rxopt.bits.rxflow) { do_ipv6_getsockopt() 1067 __be32 flowinfo = np->rcv_flowinfo; do_ipv6_getsockopt() 1095 val = np->rxopt.bits.rxinfo; do_ipv6_getsockopt() 1099 val = np->rxopt.bits.rxoinfo; do_ipv6_getsockopt() 1103 val = np->rxopt.bits.rxhlim; do_ipv6_getsockopt() 1107 val = np->rxopt.bits.rxohlim; do_ipv6_getsockopt() 1111 val = np->rxopt.bits.srcrt; do_ipv6_getsockopt() 1115 val = np->rxopt.bits.osrcrt; do_ipv6_getsockopt() 1126 opt = rcu_dereference_protected(np->opt, sock_owned_by_user(sk)); do_ipv6_getsockopt() 1136 val = np->rxopt.bits.hopopts; do_ipv6_getsockopt() 1140 val = np->rxopt.bits.ohopopts; do_ipv6_getsockopt() 1144 val = np->rxopt.bits.dstopts; do_ipv6_getsockopt() 1148 val = np->rxopt.bits.odstopts; do_ipv6_getsockopt() 1152 val = np->tclass; do_ipv6_getsockopt() 1156 val = np->rxopt.bits.rxtclass; do_ipv6_getsockopt() 1160 val = np->rxopt.bits.rxflow; do_ipv6_getsockopt() 1164 val = np->rxopt.bits.rxpmtu; do_ipv6_getsockopt() 1199 val = np->rxopt.bits.rxorigdstaddr; do_ipv6_getsockopt() 1208 val = np->hop_limit; do_ipv6_getsockopt() 1210 val = np->mcast_hops; do_ipv6_getsockopt() 1226 val = np->mc_loop; do_ipv6_getsockopt() 1230 val = np->mcast_oif; do_ipv6_getsockopt() 1234 val = (__force int)htonl((__u32) np->ucast_oif); do_ipv6_getsockopt() 1238 val = np->pmtudisc; do_ipv6_getsockopt() 1242 val = np->recverr; do_ipv6_getsockopt() 1246 val = np->sndflow; do_ipv6_getsockopt() 1283 if (np->srcprefs & IPV6_PREFER_SRC_TMP) do_ipv6_getsockopt() 1285 else if (np->srcprefs & IPV6_PREFER_SRC_PUBLIC) do_ipv6_getsockopt() 1292 if (np->srcprefs & IPV6_PREFER_SRC_COA) do_ipv6_getsockopt() 1299 val = np->min_hopcount; do_ipv6_getsockopt() 1303 val = np->dontfrag; do_ipv6_getsockopt() 1307 val = np->autoflowlabel; do_ipv6_getsockopt()
|
H A D | datagram.c | 47 struct ipv6_pinfo *np = inet6_sk(sk); __ip6_datagram_connect() local 70 if (np->sndflow) { __ip6_datagram_connect() 111 if (ipv6_addr_any(&np->saddr) || __ip6_datagram_connect() 112 ipv6_mapped_addr_any(&np->saddr)) __ip6_datagram_connect() 113 ipv6_addr_set_v4mapped(inet->inet_saddr, &np->saddr); __ip6_datagram_connect() 138 sk->sk_bound_dev_if = np->mcast_oif; __ip6_datagram_connect() 148 np->flow_label = fl6.flowlabel; __ip6_datagram_connect() 159 fl6.saddr = np->saddr; __ip6_datagram_connect() 166 fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; __ip6_datagram_connect() 169 fl6.flowi6_oif = np->mcast_oif; __ip6_datagram_connect() 174 opt = flowlabel ? flowlabel->opt : rcu_dereference(np->opt); __ip6_datagram_connect() 187 if (ipv6_addr_any(&np->saddr)) __ip6_datagram_connect() 188 np->saddr = fl6.saddr; __ip6_datagram_connect() 201 ipv6_addr_equal(&fl6.saddr, &np->saddr) ? __ip6_datagram_connect() 202 &np->saddr : __ip6_datagram_connect() 237 struct ipv6_pinfo *np = inet6_sk(sk); ipv6_icmp_error() local 241 if (!np->recverr) ipv6_icmp_error() 271 const struct ipv6_pinfo *np = inet6_sk(sk); ipv6_local_error() local 276 if (!np->recverr) ipv6_local_error() 310 struct ipv6_pinfo *np = inet6_sk(sk); ipv6_local_rxpmtu() local 315 if (!np->rxopt.bits.rxpmtu) ipv6_local_rxpmtu() 339 skb = xchg(&np->rxpmtu, skb); ipv6_local_rxpmtu() 388 struct ipv6_pinfo *np = inet6_sk(sk); ipv6_recv_error() local 426 if (np->sndflow) ipv6_recv_error() 445 if (np->rxopt.all) ipv6_recv_error() 449 if (np->rxopt.all) ipv6_recv_error() 482 struct ipv6_pinfo *np = inet6_sk(sk); ipv6_recv_rxpmtu() local 490 skb = xchg(&np->rxpmtu, NULL); ipv6_recv_rxpmtu() 530 struct ipv6_pinfo *np = inet6_sk(sk); ip6_datagram_recv_common_ctl() local 533 if (np->rxopt.bits.rxinfo) { ip6_datagram_recv_common_ctl() 555 struct ipv6_pinfo *np = inet6_sk(sk); ip6_datagram_recv_specific_ctl() local 559 if (np->rxopt.bits.rxhlim) { ip6_datagram_recv_specific_ctl() 564 if (np->rxopt.bits.rxtclass) { ip6_datagram_recv_specific_ctl() 569 if (np->rxopt.bits.rxflow) { ip6_datagram_recv_specific_ctl() 576 if (np->rxopt.bits.hopopts && (opt->flags & IP6SKB_HOPBYHOP)) { ip6_datagram_recv_specific_ctl() 582 (np->rxopt.bits.dstopts || np->rxopt.bits.srcrt)) { ip6_datagram_recv_specific_ctl() 603 if (np->rxopt.bits.dstopts) ip6_datagram_recv_specific_ctl() 609 if (np->rxopt.bits.srcrt) ip6_datagram_recv_specific_ctl() 627 if (np->rxopt.bits.rxoinfo) { ip6_datagram_recv_specific_ctl() 634 if (np->rxopt.bits.rxohlim) { ip6_datagram_recv_specific_ctl() 638 if (np->rxopt.bits.ohopopts && (opt->flags & IP6SKB_HOPBYHOP)) { ip6_datagram_recv_specific_ctl() 642 if (np->rxopt.bits.odstopts && opt->dst0) { ip6_datagram_recv_specific_ctl() 646 if (np->rxopt.bits.osrcrt && opt->srcrt) { ip6_datagram_recv_specific_ctl() 650 if (np->rxopt.bits.odstopts && opt->dst1) { ip6_datagram_recv_specific_ctl() 654 if (np->rxopt.bits.rxorigdstaddr) { ip6_datagram_recv_specific_ctl()
|
H A D | inet6_connection_sock.c | 74 const struct ipv6_pinfo *np = inet6_sk(sk); inet6_csk_route_req() local 82 final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final); inet6_csk_route_req() 123 struct ipv6_pinfo *np = inet6_sk(sk); inet6_csk_route_socket() local 130 fl6->saddr = np->saddr; inet6_csk_route_socket() 131 fl6->flowlabel = np->flow_label; inet6_csk_route_socket() 140 final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final); inet6_csk_route_socket() 143 dst = __inet6_csk_dst_check(sk, np->dst_cookie); inet6_csk_route_socket() 155 struct ipv6_pinfo *np = inet6_sk(sk); inet6_csk_xmit() local 174 res = ip6_xmit(sk, skb, &fl6, rcu_dereference(np->opt), inet6_csk_xmit() 175 np->tclass); inet6_csk_xmit()
|
/linux-4.4.14/arch/arm/mach-exynos/ |
H A D | pm_domains.c | 124 struct device_node *np; exynos4_pm_init_power_domain() local 126 for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") { exynos4_pm_init_power_domain() 134 of_node_put(np); exynos4_pm_init_power_domain() 137 pd->pd.name = kstrdup_const(strrchr(np->full_name, '/') + 1, exynos4_pm_init_power_domain() 141 of_node_put(np); exynos4_pm_init_power_domain() 146 pd->base = of_iomap(np, 0); exynos4_pm_init_power_domain() 161 pd->asb_clk[i] = of_clk_get_by_name(np, clk_name); exynos4_pm_init_power_domain() 166 pd->oscclk = of_clk_get_by_name(np, "oscclk"); exynos4_pm_init_power_domain() 174 pd->clk[i] = of_clk_get_by_name(np, clk_name); exynos4_pm_init_power_domain() 191 of_genpd_add_provider_simple(np, &pd->pd); exynos4_pm_init_power_domain() 195 for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") { exynos4_pm_init_power_domain() 199 args.np = np; exynos4_pm_init_power_domain() 205 if (of_parse_phandle_with_args(np, "power-domains", exynos4_pm_init_power_domain()
|
/linux-4.4.14/drivers/net/ethernet/stmicro/stmmac/ |
H A D | stmmac_platform.c | 110 struct device_node *np = pdev->dev.of_node; stmmac_probe_config_dt() local 118 *mac = of_get_mac_address(np); stmmac_probe_config_dt() 119 plat->interface = of_get_phy_mode(np); stmmac_probe_config_dt() 122 if (of_property_read_u32(np, "max-speed", &plat->max_speed)) stmmac_probe_config_dt() 125 plat->bus_id = of_alias_get_id(np, "ethernet"); stmmac_probe_config_dt() 133 plat->phy_node = of_parse_phandle(np, "phy-handle", 0); stmmac_probe_config_dt() 136 if (!plat->phy_node && of_phy_is_fixed_link(np)) { stmmac_probe_config_dt() 137 if ((of_phy_register_fixed_link(np) < 0)) stmmac_probe_config_dt() 140 plat->phy_node = of_node_get(np); stmmac_probe_config_dt() 146 if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0) stmmac_probe_config_dt() 157 of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); stmmac_probe_config_dt() 159 of_property_read_u32(np, "rx-fifo-depth", &plat->rx_fifo_size); stmmac_probe_config_dt() 162 of_property_read_bool(np, "snps,force_sf_dma_mode"); stmmac_probe_config_dt() 180 if (of_device_is_compatible(np, "st,spear600-gmac") || stmmac_probe_config_dt() 181 of_device_is_compatible(np, "snps,dwmac-3.70a") || stmmac_probe_config_dt() 182 of_device_is_compatible(np, "snps,dwmac")) { stmmac_probe_config_dt() 190 of_property_read_u32(np, "max-frame-size", &plat->maxmtu); stmmac_probe_config_dt() 191 of_property_read_u32(np, "snps,multicast-filter-bins", stmmac_probe_config_dt() 193 of_property_read_u32(np, "snps,perfect-filter-entries", stmmac_probe_config_dt() 203 if (of_device_is_compatible(np, "snps,dwmac-3.610") || stmmac_probe_config_dt() 204 of_device_is_compatible(np, "snps,dwmac-3.710")) { stmmac_probe_config_dt() 210 if (of_find_property(np, "snps,pbl", NULL)) { stmmac_probe_config_dt() 214 of_node_put(np); stmmac_probe_config_dt() 218 of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl); stmmac_probe_config_dt() 220 of_property_read_bool(np, "snps,fixed-burst"); stmmac_probe_config_dt() 222 of_property_read_bool(np, "snps,mixed-burst"); stmmac_probe_config_dt() 223 of_property_read_u32(np, "snps,burst_len", &dma_cfg->burst_len); stmmac_probe_config_dt() 227 plat->force_thresh_dma_mode = of_property_read_bool(np, "snps,force_thresh_dma_mode"); stmmac_probe_config_dt()
|
/linux-4.4.14/arch/arm/mach-prima2/ |
H A D | pm.c | 98 struct device_node *np; sirfsoc_of_pwrc_init() local 100 np = of_find_matching_node(NULL, pwrc_ids); sirfsoc_of_pwrc_init() 101 if (!np) { sirfsoc_of_pwrc_init() 111 if (of_property_read_u32(np, "reg", &sirfsoc_pwrc_base)) sirfsoc_of_pwrc_init() 114 of_node_put(np); sirfsoc_of_pwrc_init() 126 struct device_node *np = op->dev.of_node; sirfsoc_memc_probe() local 128 sirfsoc_memc_base = of_iomap(np, 0); sirfsoc_memc_probe()
|
/linux-4.4.14/arch/arm/mach-at91/ |
H A D | soc.c | 35 struct device_node *np; at91_soc_init() local 39 np = of_find_compatible_node(NULL, NULL, "atmel,at91rm9200-dbgu"); at91_soc_init() 40 if (!np) at91_soc_init() 41 np = of_find_compatible_node(NULL, NULL, at91_soc_init() 44 if (!np) { at91_soc_init() 49 regs = of_iomap(np, 0); at91_soc_init() 50 of_node_put(np); at91_soc_init()
|
/linux-4.4.14/arch/arm/mach-berlin/ |
H A D | platsmp.c | 62 struct device_node *np; berlin_smp_prepare_cpus() local 66 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); berlin_smp_prepare_cpus() 67 scu_base = of_iomap(np, 0); berlin_smp_prepare_cpus() 68 of_node_put(np); berlin_smp_prepare_cpus() 72 np = of_find_compatible_node(NULL, NULL, "marvell,berlin-cpu-ctrl"); berlin_smp_prepare_cpus() 73 cpu_ctrl = of_iomap(np, 0); berlin_smp_prepare_cpus() 74 of_node_put(np); berlin_smp_prepare_cpus()
|
/linux-4.4.14/arch/c6x/platforms/ |
H A D | timer64.c | 181 struct device_node *np, *first = NULL; timer64_init() local 185 for_each_compatible_node(np, NULL, "ti,c64x+timer64") { timer64_init() 186 err = of_property_read_u32(np, "ti,core-mask", &val); timer64_init() 193 first = np; timer64_init() 198 np = of_node_get(first); timer64_init() 205 timer = of_iomap(np, 0); timer64_init() 207 pr_debug("%s: Cannot map timer registers.\n", np->full_name); timer64_init() 210 pr_debug("%s: Timer registers=%p.\n", np->full_name, timer); timer64_init() 212 cd->irq = irq_of_parse_and_map(np, 0); timer64_init() 214 pr_debug("%s: Cannot find interrupt.\n", np->full_name); timer64_init() 220 err = of_property_read_u32(np, "ti,dscr-dev-enable", &val); timer64_init() 232 pr_debug("%s: Timer irq=%d.\n", np->full_name, cd->irq); timer64_init() 245 of_node_put(np); timer64_init()
|
H A D | megamod-pic.c | 181 struct device_node *np = irq_domain_get_of_node(pic->irqhost); parse_priority_map() local 186 map = of_get_property(np, "ti,c64x+megamod-pic-mux", &maplen); parse_priority_map() 201 static struct megamod_pic * __init init_megamod_pic(struct device_node *np) init_megamod_pic() argument 211 pr_err("%s: Could not alloc PIC structure.\n", np->full_name); init_megamod_pic() 215 pic->irqhost = irq_domain_add_linear(np, NR_COMBINERS * 32, init_megamod_pic() 218 pr_err("%s: Could not alloc host.\n", np->full_name); init_megamod_pic() 226 pic->regs = of_iomap(np, 0); init_megamod_pic() 228 pr_err("%s: Could not map registers.\n", np->full_name); init_megamod_pic() 250 irq = irq_of_parse_and_map(np, i); init_megamod_pic() 257 np->full_name, i, irq); init_megamod_pic() 269 np->full_name, i, hwirq); init_megamod_pic() 277 np->full_name, i, hwirq); init_megamod_pic() 294 np->full_name, mapping[i], i + 4); init_megamod_pic() 334 struct device_node *np; megamod_pic_init() local 336 np = of_find_compatible_node(NULL, NULL, "ti,c64x+megamod-pic"); megamod_pic_init() 337 if (!np) megamod_pic_init() 340 mm_pic = init_megamod_pic(np); megamod_pic_init() 341 of_node_put(np); megamod_pic_init()
|
/linux-4.4.14/arch/powerpc/platforms/embedded6xx/ |
H A D | c2k.c | 44 struct device_node *np; c2k_setup_arch() local 52 np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-mpp"); c2k_setup_arch() 53 reg = of_get_property(np, "reg", NULL); c2k_setup_arch() 54 paddr = of_translate_address(np, reg); c2k_setup_arch() 55 of_node_put(np); c2k_setup_arch() 58 np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-gpp"); c2k_setup_arch() 59 reg = of_get_property(np, "reg", NULL); c2k_setup_arch() 60 paddr = of_translate_address(np, reg); c2k_setup_arch() 61 of_node_put(np); c2k_setup_arch()
|
H A D | mvme5100.c | 59 struct device_node *np; mvme5100_pic_init() local 65 np = of_find_node_by_type(NULL, "open-pic"); mvme5100_pic_init() 66 if (!np) { mvme5100_pic_init() 71 mpic = mpic_alloc(np, pci_membase, 0, 16, 256, " OpenPIC "); mvme5100_pic_init() 74 of_node_put(np); mvme5100_pic_init() 92 np = of_find_compatible_node(NULL, "pci", "mpc10x-pci"); mvme5100_pic_init() 93 if (np) { mvme5100_pic_init() 94 prop = of_get_property(np, "8259-interrupt-acknowledge", NULL); mvme5100_pic_init() 99 of_node_put(np); mvme5100_pic_init() 162 struct device_node *np; mvme5100_setup_arch() local 167 for_each_compatible_node(np, "pci", "hawk-pci") mvme5100_setup_arch() 168 mvme5100_add_bridge(np); mvme5100_setup_arch()
|
/linux-4.4.14/drivers/media/v4l2-core/ |
H A D | v4l2-of.c | 276 struct device_node *np; v4l2_of_parse_link() local 280 np = of_get_parent(node); v4l2_of_parse_link() 281 of_property_read_u32(np, "reg", &link->local_port); v4l2_of_parse_link() 282 np = of_get_next_parent(np); v4l2_of_parse_link() 283 if (of_node_cmp(np->name, "ports") == 0) v4l2_of_parse_link() 284 np = of_get_next_parent(np); v4l2_of_parse_link() 285 link->local_node = np; v4l2_of_parse_link() 287 np = of_parse_phandle(node, "remote-endpoint", 0); v4l2_of_parse_link() 288 if (!np) { v4l2_of_parse_link() 293 np = of_get_parent(np); v4l2_of_parse_link() 294 of_property_read_u32(np, "reg", &link->remote_port); v4l2_of_parse_link() 295 np = of_get_next_parent(np); v4l2_of_parse_link() 296 if (of_node_cmp(np->name, "ports") == 0) v4l2_of_parse_link() 297 np = of_get_next_parent(np); v4l2_of_parse_link() 298 link->remote_node = np; v4l2_of_parse_link()
|
/linux-4.4.14/drivers/clk/sunxi/ |
H A D | clk-sun6i-apb0.c | 33 struct device_node *np = pdev->dev.of_node; sun6i_a31_apb0_clk_probe() local 34 const char *clk_name = np->name; sun6i_a31_apb0_clk_probe() 45 clk_parent = of_clk_get_parent_name(np, 0); sun6i_a31_apb0_clk_probe() 49 of_property_read_string(np, "clock-output-names", &clk_name); sun6i_a31_apb0_clk_probe() 57 return of_clk_add_provider(np, of_clk_src_simple_get, clk); sun6i_a31_apb0_clk_probe()
|
H A D | clk-sun8i-apb0.c | 24 struct device_node *np = pdev->dev.of_node; sun8i_a23_apb0_clk_probe() local 25 const char *clk_name = np->name; sun8i_a23_apb0_clk_probe() 36 clk_parent = of_clk_get_parent_name(np, 0); sun8i_a23_apb0_clk_probe() 40 of_property_read_string(np, "clock-output-names", &clk_name); sun8i_a23_apb0_clk_probe() 48 return of_clk_add_provider(np, of_clk_src_simple_get, clk); sun8i_a23_apb0_clk_probe()
|
H A D | clk-sun6i-apb0-gates.c | 41 struct device_node *np = pdev->dev.of_node; sun6i_a31_apb0_gates_clk_probe() local 53 if (!np) sun6i_a31_apb0_gates_clk_probe() 66 clk_parent = of_clk_get_parent_name(np, 0); sun6i_a31_apb0_gates_clk_probe() 83 of_property_read_string_index(np, "clock-output-names", sun6i_a31_apb0_gates_clk_probe() 97 return of_clk_add_provider(np, of_clk_src_onecell_get, clk_data); sun6i_a31_apb0_gates_clk_probe()
|
/linux-4.4.14/arch/arm/plat-samsung/ |
H A D | watchdog-reset.c | 75 struct device_node *np; samsung_wdt_reset_of_init() local 77 np = of_find_matching_node(NULL, s3c2410_wdt_match); samsung_wdt_reset_of_init() 78 if (!np) { samsung_wdt_reset_of_init() 83 wdt_base = of_iomap(np, 0); samsung_wdt_reset_of_init() 89 wdt_clock = of_clk_get(np, 0); samsung_wdt_reset_of_init()
|
/linux-4.4.14/drivers/dma/ |
H A D | of-dma.c | 38 if (ofdma->of_node == dma_spec->np) of_dma_find_controller() 42 dma_spec->np->full_name); of_dma_find_controller() 87 of_node_put(dma_spec_target.np); of_dma_router_xlate() 93 * @np: device node of DMA controller 104 int of_dma_controller_register(struct device_node *np, of_dma_controller_register() argument 111 if (!np || !of_dma_xlate) { of_dma_controller_register() 120 ofdma->of_node = np; of_dma_controller_register() 135 * @np: device node of DMA controller 139 void of_dma_controller_free(struct device_node *np) of_dma_controller_free() argument 146 if (ofdma->of_node == np) { of_dma_controller_free() 159 * @np: device node of DMA router 171 int of_dma_router_register(struct device_node *np, of_dma_router_register() argument 178 if (!np || !of_dma_route_allocate || !dma_router) { of_dma_router_register() 187 ofdma->of_node = np; of_dma_router_register() 203 * @np: device node to look for DMA channels 212 static int of_dma_match_channel(struct device_node *np, const char *name, of_dma_match_channel() argument 217 if (of_property_read_string_index(np, "dma-names", index, &s)) of_dma_match_channel() 223 if (of_parse_phandle_with_args(np, "dmas", "#dma-cells", index, of_dma_match_channel() 232 * @np: device node to get DMA request from 237 struct dma_chan *of_dma_request_slave_channel(struct device_node *np, of_dma_request_slave_channel() argument 246 if (!np || !name) { of_dma_request_slave_channel() 252 if (!of_find_property(np, "dmas", NULL)) of_dma_request_slave_channel() 255 count = of_property_count_strings(np, "dma-names"); of_dma_request_slave_channel() 258 __func__, np->full_name); of_dma_request_slave_channel() 263 if (of_dma_match_channel(np, name, i, &dma_spec)) of_dma_request_slave_channel() 278 of_node_put(dma_spec.np); of_dma_request_slave_channel()
|
/linux-4.4.14/arch/powerpc/platforms/512x/ |
H A D | mpc512x_shared.c | 38 struct device_node *np; mpc512x_restart_init() local 42 np = of_find_compatible_node(NULL, NULL, reset_compat); mpc512x_restart_init() 43 if (!np) mpc512x_restart_init() 46 reset_module_base = of_iomap(np, 0); mpc512x_restart_init() 47 of_node_put(np); mpc512x_restart_init() 75 struct device_node *np; mpc512x_set_pixel_clock() local 81 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-diu"); mpc512x_set_pixel_clock() 82 if (!np) { mpc512x_set_pixel_clock() 86 clk_diu = of_clk_get(np, 0); mpc512x_set_pixel_clock() 89 clk_diu = clk_get_sys(np->name, "ipg"); mpc512x_set_pixel_clock() 91 of_node_put(np); mpc512x_set_pixel_clock() 223 struct device_node *np; mpc512x_init_diu() local 230 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-diu"); mpc512x_init_diu() 231 if (!np) { mpc512x_init_diu() 236 diu_reg = of_iomap(np, 0); mpc512x_init_diu() 237 of_node_put(np); mpc512x_init_diu() 320 struct device_node *np; mpc512x_init_IRQ() local 322 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-ipic"); mpc512x_init_IRQ() 323 if (!np) mpc512x_init_IRQ() 326 ipic_init(np, 0); mpc512x_init_IRQ() 327 of_node_put(np); mpc512x_init_IRQ() 381 static unsigned int __init get_fifo_size(struct device_node *np, get_fifo_size() argument 386 fp = of_get_property(np, prop_name, NULL); get_fifo_size() 391 prop_name, np->full_name, DEFAULT_FIFO_SIZE); get_fifo_size() 402 struct device_node *np; mpc512x_psc_fifo_init() local 415 for_each_compatible_node(np, NULL, psc_compat) { for_each_compatible_node() 416 tx_fifo_size = get_fifo_size(np, "fsl,tx-fifo-size"); for_each_compatible_node() 417 rx_fifo_size = get_fifo_size(np, "fsl,rx-fifo-size"); for_each_compatible_node() 427 psc = of_iomap(np, 0); for_each_compatible_node() 430 __func__, np->full_name); for_each_compatible_node() 437 __func__, np->full_name); for_each_compatible_node() 494 struct device_node *np; mpc512x_cs_config() local 500 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-lpc"); mpc512x_cs_config() 501 lpc = of_iomap(np, 0); mpc512x_cs_config() 502 of_node_put(np); mpc512x_cs_config()
|
H A D | mpc5121_ads_cpld.c | 150 struct device_node *np = NULL; mpc5121_ads_cpld_map() local 152 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121ads-cpld-pic"); mpc5121_ads_cpld_map() 153 if (!np) { mpc5121_ads_cpld_map() 158 cpld_regs = of_iomap(np, 0); mpc5121_ads_cpld_map() 159 of_node_put(np); mpc5121_ads_cpld_map() 166 struct device_node *np = NULL; mpc5121_ads_cpld_pic_init() local 170 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121ads-cpld-pic"); mpc5121_ads_cpld_pic_init() 171 if (!np) { mpc5121_ads_cpld_pic_init() 179 cascade_irq = irq_of_parse_and_map(np, 0); mpc5121_ads_cpld_pic_init() 193 cpld_pic_node = of_node_get(np); mpc5121_ads_cpld_pic_init() 195 cpld_pic_host = irq_domain_add_linear(np, 16, &cpld_pic_host_ops, NULL); mpc5121_ads_cpld_pic_init() 203 of_node_put(np); mpc5121_ads_cpld_pic_init()
|
H A D | pdm360ng.c | 57 struct device_node *np; pdm360ng_penirq_init() local 59 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-gpio"); pdm360ng_penirq_init() 60 if (!np) { pdm360ng_penirq_init() 65 pdm360ng_gpio_base = of_iomap(np, 0); pdm360ng_penirq_init() 66 of_node_put(np); pdm360ng_penirq_init()
|
/linux-4.4.14/arch/powerpc/platforms/52xx/ |
H A D | mpc52xx_common.c | 59 struct device_node *np; mpc5200_setup_xlb_arbiter() local 62 np = of_find_matching_node(NULL, mpc52xx_xlb_ids); mpc5200_setup_xlb_arbiter() 63 xlb = of_iomap(np, 0); mpc5200_setup_xlb_arbiter() 64 of_node_put(np); mpc5200_setup_xlb_arbiter() 137 struct device_node *np; mpc52xx_map_common_devices() local 143 for_each_matching_node(np, mpc52xx_gpt_ids) { for_each_matching_node() 144 if (of_get_property(np, "fsl,has-wdt", NULL) || for_each_matching_node() 145 of_get_property(np, "has-wdt", NULL)) { for_each_matching_node() 146 mpc52xx_wdt = of_iomap(np, 0); for_each_matching_node() 147 of_node_put(np); for_each_matching_node() 153 np = of_find_matching_node(NULL, mpc52xx_cdm_ids); 154 mpc52xx_cdm = of_iomap(np, 0); 155 of_node_put(np); 158 np = of_find_matching_node(NULL, mpc52xx_gpio_simple); 159 simple_gpio = of_iomap(np, 0); 160 of_node_put(np); 163 np = of_find_matching_node(NULL, mpc52xx_gpio_wkup); 164 wkup_gpio = of_iomap(np, 0); 165 of_node_put(np);
|
/linux-4.4.14/drivers/usb/phy/ |
H A D | of.c | 27 * @np: Pointer to the given device_node 32 enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np) of_usb_get_phy_mode() argument 37 err = of_property_read_string(np, "phy_type", &phy_type); of_usb_get_phy_mode()
|
/linux-4.4.14/drivers/bus/ |
H A D | simple-pm-bus.c | 19 struct device_node *np = pdev->dev.of_node; simple_pm_bus_probe() local 25 if (np) simple_pm_bus_probe() 26 of_platform_populate(np, NULL, NULL, &pdev->dev); simple_pm_bus_probe()
|
/linux-4.4.14/arch/arm/mach-imx/ |
H A D | cpu-imx25.c | 26 struct device_node *np; mx25_read_cpu_rev() local 28 np = of_find_compatible_node(NULL, NULL, "fsl,imx25-iim"); mx25_read_cpu_rev() 29 iim_base = of_iomap(np, 0); mx25_read_cpu_rev()
|
H A D | mach-imx25.c | 28 struct device_node *np; mx25_init_irq() local 31 np = of_find_compatible_node(NULL, NULL, "fsl,avic"); mx25_init_irq() 32 avic_base = of_iomap(np, 0); mx25_init_irq()
|
H A D | src.c | 120 struct device_node *np; imx_src_init() local 123 np = of_find_compatible_node(NULL, NULL, "fsl,imx51-src"); imx_src_init() 124 if (!np) imx_src_init() 126 src_base = of_iomap(np, 0); imx_src_init() 129 imx_reset_controller.of_node = np; imx_src_init()
|
/linux-4.4.14/arch/arm/mach-keystone/ |
H A D | pm_domain.c | 39 struct device_node *np; keystone_pm_runtime_init() local 41 np = of_find_matching_node(NULL, of_keystone_table); keystone_pm_runtime_init() 42 if (!np) keystone_pm_runtime_init()
|
/linux-4.4.14/drivers/soc/brcmstb/ |
H A D | biuctrl.c | 54 struct device_node *np; setup_hifcpubiuctrl_regs() local 57 np = of_find_compatible_node(NULL, NULL, "brcm,brcmstb-cpu-biu-ctrl"); setup_hifcpubiuctrl_regs() 58 if (!np) { setup_hifcpubiuctrl_regs() 63 cpubiuctrl_base = of_iomap(np, 0); setup_hifcpubiuctrl_regs() 70 mcp_wr_pairing_en = of_property_read_bool(np, "brcm,write-pairing"); setup_hifcpubiuctrl_regs() 72 of_node_put(np); setup_hifcpubiuctrl_regs()
|
/linux-4.4.14/drivers/mmc/host/ |
H A D | sdhci-pltfm.c | 55 static bool sdhci_of_wp_inverted(struct device_node *np) sdhci_of_wp_inverted() argument 57 if (of_get_property(np, "sdhci,wp-inverted", NULL) || sdhci_of_wp_inverted() 58 of_get_property(np, "wp-inverted", NULL)) sdhci_of_wp_inverted() 71 struct device_node *np = pdev->dev.of_node; sdhci_get_of_property() local 76 if (of_get_property(np, "sdhci,auto-cmd12", NULL)) sdhci_get_of_property() 79 if (of_get_property(np, "sdhci,1-bit-only", NULL) || sdhci_get_of_property() 80 (of_property_read_u32(np, "bus-width", &bus_width) == 0 && sdhci_get_of_property() 84 if (sdhci_of_wp_inverted(np)) sdhci_get_of_property() 87 if (of_get_property(np, "broken-cd", NULL)) sdhci_get_of_property() 90 if (of_get_property(np, "no-1-8-v", NULL)) sdhci_get_of_property() 93 if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc")) sdhci_get_of_property() 96 if (of_device_is_compatible(np, "fsl,p2020-esdhc") || sdhci_get_of_property() 97 of_device_is_compatible(np, "fsl,p1010-esdhc") || sdhci_get_of_property() 98 of_device_is_compatible(np, "fsl,t4240-esdhc") || sdhci_get_of_property() 99 of_device_is_compatible(np, "fsl,mpc8536-esdhc")) sdhci_get_of_property() 102 of_property_read_u32(np, "clock-frequency", &pltfm_host->clock); sdhci_get_of_property() 104 if (of_find_property(np, "keep-power-in-suspend", NULL)) sdhci_get_of_property() 107 if (of_find_property(np, "enable-sdio-wakeup", NULL)) sdhci_get_of_property()
|
H A D | of_mmc_spi.c | 72 struct device_node *np = dev->of_node; mmc_spi_get_pdata() local 79 if (dev->platform_data || !np) mmc_spi_get_pdata() 86 voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges); mmc_spi_get_pdata() 110 oms->gpios[i] = of_get_gpio_flags(np, i, &gpio_flags); mmc_spi_get_pdata() 131 oms->detect_irq = irq_of_parse_and_map(np, 0); mmc_spi_get_pdata() 150 struct device_node *np = dev->of_node; mmc_spi_put_pdata() local 153 if (!dev->platform_data || !np) mmc_spi_put_pdata()
|
/linux-4.4.14/drivers/gpu/drm/rcar-du/ |
H A D | rcar_du_hdmienc.h | 25 struct rcar_du_encoder *renc, struct device_node *np); 29 struct device_node *np) rcar_du_hdmienc_init() 27 rcar_du_hdmienc_init(struct rcar_du_device *rcdu, struct rcar_du_encoder *renc, struct device_node *np) rcar_du_hdmienc_init() argument
|
/linux-4.4.14/drivers/pinctrl/ |
H A D | pinctrl-lantiq.c | 69 struct device_node *np, ltq_pinctrl_dt_subnode_to_map() 73 struct property *pins = of_find_property(np, "lantiq,pins", NULL); ltq_pinctrl_dt_subnode_to_map() 74 struct property *groups = of_find_property(np, "lantiq,groups", NULL); ltq_pinctrl_dt_subnode_to_map() 84 np->name); ltq_pinctrl_dt_subnode_to_map() 90 np->name); ltq_pinctrl_dt_subnode_to_map() 94 ret = of_property_read_string(np, "lantiq,function", &function); ltq_pinctrl_dt_subnode_to_map() 96 of_property_for_each_string(np, "lantiq,groups", prop, group) { ltq_pinctrl_dt_subnode_to_map() 107 int ret = of_property_read_u32(np, ltq_pinctrl_dt_subnode_to_map() 118 of_property_for_each_string(np, "lantiq,pins", prop, pin) { ltq_pinctrl_dt_subnode_to_map() 128 of_property_for_each_string(np, "lantiq,groups", prop, group) { ltq_pinctrl_dt_subnode_to_map() 140 static int ltq_pinctrl_dt_subnode_size(struct device_node *np) ltq_pinctrl_dt_subnode_size() argument 144 ret = of_property_count_strings(np, "lantiq,groups"); ltq_pinctrl_dt_subnode_size() 146 ret = of_property_count_strings(np, "lantiq,pins"); ltq_pinctrl_dt_subnode_size() 156 struct device_node *np; ltq_pinctrl_dt_node_to_map() local 159 for_each_child_of_node(np_config, np) ltq_pinctrl_dt_node_to_map() 160 max_maps += ltq_pinctrl_dt_subnode_size(np); ltq_pinctrl_dt_node_to_map() 166 for_each_child_of_node(np_config, np) ltq_pinctrl_dt_node_to_map() 167 ltq_pinctrl_dt_subnode_to_map(pctldev, np, &tmp); ltq_pinctrl_dt_node_to_map() 68 ltq_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, struct device_node *np, struct pinctrl_map **map) ltq_pinctrl_dt_subnode_to_map() argument
|
H A D | pinconf-generic.c | 179 * @np: DT node 185 * Parse the config options described in @params from @np and puts the result 190 static void parse_dt_cfg(struct device_node *np, parse_dt_cfg() argument 202 ret = of_property_read_u32(np, par->property, &val); parse_dt_cfg() 221 * @np: node containing the pinconfig properties 225 int pinconf_generic_parse_dt_config(struct device_node *np, pinconf_generic_parse_dt_config() argument 234 if (!np) pinconf_generic_parse_dt_config() 245 parse_dt_cfg(np, dt_params, ARRAY_SIZE(dt_params), cfg, &ncfg); pinconf_generic_parse_dt_config() 248 parse_dt_cfg(np, pctldev->desc->custom_params, pinconf_generic_parse_dt_config() 278 struct device_node *np, struct pinctrl_map **map, pinconf_generic_dt_subnode_to_map() 292 ret = of_property_count_strings(np, "pins"); pinconf_generic_dt_subnode_to_map() 294 ret = of_property_count_strings(np, "groups"); pinconf_generic_dt_subnode_to_map() 307 ret = of_property_read_string(np, "function", &function); pinconf_generic_dt_subnode_to_map() 312 of_node_full_name(np)); pinconf_generic_dt_subnode_to_map() 316 ret = pinconf_generic_parse_dt_config(np, pctldev, &configs, pinconf_generic_dt_subnode_to_map() 320 of_node_full_name(np)); pinconf_generic_dt_subnode_to_map() 337 of_property_for_each_string(np, subnode_target_type, prop, group) { of_property_for_each_string() 367 struct device_node *np; pinconf_generic_dt_node_to_map() local 379 for_each_child_of_node(np_config, np) { for_each_child_of_node() 380 ret = pinconf_generic_dt_subnode_to_map(pctldev, np, map, for_each_child_of_node() 277 pinconf_generic_dt_subnode_to_map(struct pinctrl_dev *pctldev, struct device_node *np, struct pinctrl_map **map, unsigned *reserved_maps, unsigned *num_maps, enum pinctrl_map_type type) pinconf_generic_dt_subnode_to_map() argument
|
/linux-4.4.14/drivers/power/reset/ |
H A D | keystone-reset.c | 87 struct device_node *np = dev->of_node; rsctrl_probe() local 89 if (!np) rsctrl_probe() 93 pllctrl_regs = syscon_regmap_lookup_by_phandle(np, "ti,syscon-pll"); rsctrl_probe() 97 devctrl_regs = syscon_regmap_lookup_by_phandle(np, "ti,syscon-dev"); rsctrl_probe() 101 ret = of_property_read_u32_index(np, "ti,syscon-pll", 1, &rspll_offset); rsctrl_probe() 107 ret = of_property_read_u32_index(np, "ti,syscon-dev", 1, &rsmux_offset); rsctrl_probe() 114 val = of_property_read_bool(np, "ti,soft-reset"); rsctrl_probe() 132 ret = of_property_read_u32_index(np, "ti,wdt-list", i, &val); rsctrl_probe()
|
H A D | zx-reboot.c | 43 struct device_node *np = pdev->dev.of_node; zx_reboot_probe() local 46 base = of_iomap(np, 0); zx_reboot_probe() 52 np = of_find_compatible_node(NULL, NULL, "zte,zx296702-pcu"); zx_reboot_probe() 53 pcu_base = of_iomap(np, 0); zx_reboot_probe()
|
/linux-4.4.14/arch/arm/mach-sti/ |
H A D | platsmp.c | 101 struct device_node *np; sti_smp_prepare_cpus() local 108 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); sti_smp_prepare_cpus() 110 if (np) { sti_smp_prepare_cpus() 111 scu_base = of_iomap(np, 0); sti_smp_prepare_cpus() 113 of_node_put(np); sti_smp_prepare_cpus() 121 np = of_get_cpu_node(cpu, NULL); for_each_possible_cpu() 123 if (!np) for_each_possible_cpu() 126 if (of_property_read_u32(np, "cpu-release-addr", for_each_possible_cpu()
|
/linux-4.4.14/drivers/net/cris/ |
H A D | eth_v10.c | 200 static void e100_hardware_send_packet(struct net_local* np, char *buf, int length); 288 struct net_local* np; etrax_ethernet_init() local 303 np = netdev_priv(dev); etrax_ethernet_init() 320 spin_lock_init(&np->lock); etrax_ethernet_init() 321 spin_lock_init(&np->led_lock); etrax_ethernet_init() 322 spin_lock_init(&np->transceiver_lock); etrax_ethernet_init() 400 np->mii_if.phy_id_mask = 0x1f; etrax_ethernet_init() 401 np->mii_if.reg_num_mask = 0x1f; etrax_ethernet_init() 402 np->mii_if.dev = dev; etrax_ethernet_init() 403 np->mii_if.mdio_read = e100_get_mdio_reg; etrax_ethernet_init() 404 np->mii_if.mdio_write = e100_set_mdio_reg; etrax_ethernet_init() 423 struct net_local *np = netdev_priv(dev); e100_set_mac_address() local 426 spin_lock(&np->lock); /* preemption protection */ e100_set_mac_address() 447 spin_unlock(&np->lock); e100_set_mac_address() 641 struct net_local *np = netdev_priv(dev); generic_check_speed() local 643 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE); generic_check_speed() 655 struct net_local *np = netdev_priv(dev); tdk_check_speed() local 657 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, tdk_check_speed() 666 struct net_local *np = netdev_priv(dev); broadcom_check_speed() local 668 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, broadcom_check_speed() 677 struct net_local *np = netdev_priv(dev); intel_check_speed() local 679 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, intel_check_speed() 688 struct net_local *np = netdev_priv(dev); e100_check_speed() local 693 spin_lock(&np->transceiver_lock); e100_check_speed() 695 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMSR); e100_check_speed() 702 spin_lock(&np->led_lock); e100_check_speed() 711 spin_unlock(&np->led_lock); e100_check_speed() 717 spin_unlock(&np->transceiver_lock); e100_check_speed() 723 struct net_local *np = netdev_priv(dev); e100_negotiate() local 724 unsigned short data = e100_get_mdio_reg(dev, np->mii_if.phy_id, e100_negotiate() 766 e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE, data); e100_negotiate() 768 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR); e100_negotiate() 787 e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR, data); e100_negotiate() 793 struct net_local *np = netdev_priv(dev); e100_set_speed() local 795 spin_lock(&np->transceiver_lock); e100_set_speed() 800 spin_unlock(&np->transceiver_lock); e100_set_speed() 807 struct net_local *np = netdev_priv(dev); e100_check_duplex() local 810 spin_lock(&np->transceiver_lock); e100_check_duplex() 822 np->mii_if.full_duplex = full_duplex; e100_check_duplex() 823 spin_unlock(&np->transceiver_lock); e100_check_duplex() 836 struct net_local *np = netdev_priv(dev); generic_check_duplex() local 838 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE); generic_check_duplex() 850 struct net_local *np = netdev_priv(dev); tdk_check_duplex() local 852 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, tdk_check_duplex() 861 struct net_local *np = netdev_priv(dev); broadcom_check_duplex() local 863 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, broadcom_check_duplex() 872 struct net_local *np = netdev_priv(dev); intel_check_duplex() local 874 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, intel_check_duplex() 882 struct net_local *np = netdev_priv(dev); e100_set_duplex() local 884 spin_lock(&np->transceiver_lock); e100_set_duplex() 889 spin_unlock(&np->transceiver_lock); e100_set_duplex() 902 struct net_local *np = netdev_priv(dev); e100_probe_transceiver() local 904 spin_lock(&np->transceiver_lock); e100_probe_transceiver() 907 for (np->mii_if.phy_id = 0; np->mii_if.phy_id <= 31; e100_probe_transceiver() 908 np->mii_if.phy_id++) { e100_probe_transceiver() 910 np->mii_if.phy_id, MII_BMSR) != 0xffff) e100_probe_transceiver() 913 if (np->mii_if.phy_id == 32) { e100_probe_transceiver() 919 phyid_high = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_PHYSID1); e100_probe_transceiver() 920 phyid_low = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_PHYSID2); e100_probe_transceiver() 929 spin_unlock(&np->transceiver_lock); e100_probe_transceiver() 1025 struct net_local *np = netdev_priv(dev); e100_reset_transceiver() local 1030 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR); e100_reset_transceiver() 1032 cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (np->mii_if.phy_id << 7) | (MII_BMCR << 2); e100_reset_transceiver() 1050 struct net_local *np = netdev_priv(dev); e100_tx_timeout() local 1053 spin_lock_irqsave(&np->lock, flags); e100_tx_timeout() 1085 spin_unlock_irqrestore(&np->lock, flags); e100_tx_timeout() 1098 struct net_local *np = netdev_priv(dev); e100_send_packet() local 1105 spin_lock_irqsave(&np->lock, flags); /* protect from tx_interrupt and ourself */ e100_send_packet() 1111 e100_hardware_send_packet(np, buf, skb->len); e100_send_packet() 1120 spin_unlock_irqrestore(&np->lock, flags); e100_send_packet() 1230 struct net_local *np = netdev_priv(dev); e100_rx() local 1236 spin_lock(&np->led_lock); e100_rx() 1246 spin_unlock(&np->led_lock); e100_rx() 1377 struct net_local *np = netdev_priv(dev); e100_ioctl() local 1381 spin_lock(&np->lock); /* Preempt protection */ e100_ioctl() 1410 rc = generic_mii_ioctl(&np->mii_if, if_mii(ifr), e100_ioctl() 1414 spin_unlock(&np->lock); e100_ioctl() 1421 struct net_local *np = netdev_priv(dev); e100_get_settings() local 1424 spin_lock_irq(&np->lock); e100_get_settings() 1425 err = mii_ethtool_gset(&np->mii_if, cmd); e100_get_settings() 1426 spin_unlock_irq(&np->lock); e100_get_settings() 1475 struct net_local *np = netdev_priv(dev); e100_set_config() local 1477 spin_lock(&np->lock); /* Preempt protection */ e100_set_config() 1497 spin_unlock(&np->lock); e100_set_config() 1501 spin_unlock(&np->lock); e100_set_config() 1504 spin_unlock(&np->lock); e100_set_config() 1637 e100_hardware_send_packet(struct net_local *np, char *buf, int length) e100_hardware_send_packet() argument 1641 spin_lock(&np->led_lock); e100_hardware_send_packet() 1651 spin_unlock(&np->led_lock); e100_hardware_send_packet() 1670 struct net_local *np = netdev_priv(dev); e100_clear_network_leds() local 1672 spin_lock(&np->led_lock); e100_clear_network_leds() 1682 spin_unlock(&np->led_lock); e100_clear_network_leds()
|
/linux-4.4.14/arch/powerpc/platforms/8xx/ |
H A D | mpc885ads_setup.c | 131 struct device_node *np; mpc885ads_setup_arch() local 136 np = of_find_compatible_node(NULL, NULL, "fsl,mpc885ads-bcsr"); mpc885ads_setup_arch() 137 if (!np) { mpc885ads_setup_arch() 142 bcsr = of_iomap(np, 0); mpc885ads_setup_arch() 143 bcsr5 = of_iomap(np, 1); mpc885ads_setup_arch() 144 of_node_put(np); mpc885ads_setup_arch() 179 np = of_find_node_by_path("/soc@ff000000/cpm@9c0/serial@a80"); mpc885ads_setup_arch() 181 np = of_find_node_by_path("/soc@ff000000/cpm@9c0/ethernet@a40"); mpc885ads_setup_arch() 188 if (np) { mpc885ads_setup_arch() 189 of_detach_node(np); mpc885ads_setup_arch() 190 of_node_put(np); mpc885ads_setup_arch()
|
/linux-4.4.14/sound/soc/sh/rcar/ |
H A D | rsrc-card.c | 151 struct device_node *np, rsrc_card_parse_daifmt() 158 struct device_node *codec = is_fe ? NULL : np; rsrc_card_parse_daifmt() 183 static int rsrc_card_parse_links(struct device_node *np, rsrc_card_parse_links() argument 196 ret = of_parse_phandle_with_args(np, "sound-dai", rsrc_card_parse_links() 210 dai_link->cpu_of_node = args.np; rsrc_card_parse_links() 211 snd_soc_of_get_dai_name(np, &dai_link->cpu_dai_name); rsrc_card_parse_links() 242 dai_link->codec_of_node = args.np; rsrc_card_parse_links() 243 snd_soc_of_get_dai_name(np, &dai_link->codec_dai_name); rsrc_card_parse_links() 273 static int rsrc_card_parse_clk(struct device_node *np, rsrc_card_parse_clk() argument 290 if (of_property_read_bool(np, "clocks")) { rsrc_card_parse_clk() 291 clk = of_clk_get(np, 0); rsrc_card_parse_clk() 297 } else if (!of_property_read_u32(np, "system-clock-frequency", &val)) { rsrc_card_parse_clk() 309 struct device_node *np, rsrc_card_dai_link_of() 318 if (0 == strcmp(np->name, "cpu")) rsrc_card_dai_link_of() 321 ret = rsrc_card_parse_daifmt(node, np, priv, idx, is_fe); rsrc_card_dai_link_of() 325 ret = rsrc_card_parse_links(np, priv, idx, is_fe); rsrc_card_dai_link_of() 329 ret = rsrc_card_parse_clk(np, priv, idx, is_fe); rsrc_card_dai_link_of() 348 struct device_node *np; rsrc_card_parse_of() local 392 for_each_child_of_node(node, np) { for_each_child_of_node() 393 ret = rsrc_card_dai_link_of(node, np, priv, i); for_each_child_of_node() 423 struct device_node *np = pdev->dev.of_node; rsrc_card_probe() local 432 ret = rsrc_card_parse_of(np, priv, dev); rsrc_card_probe() 150 rsrc_card_parse_daifmt(struct device_node *node, struct device_node *np, struct rsrc_card_priv *priv, int idx, bool is_fe) rsrc_card_parse_daifmt() argument 308 rsrc_card_dai_link_of(struct device_node *node, struct device_node *np, struct rsrc_card_priv *priv, int idx) rsrc_card_dai_link_of() argument
|
/linux-4.4.14/drivers/clk/ |
H A D | clk-xgene.c | 163 static void xgene_pllclk_init(struct device_node *np, enum xgene_pll_type pll_type) xgene_pllclk_init() argument 165 const char *clk_name = np->full_name; xgene_pllclk_init() 169 reg = of_iomap(np, 0); xgene_pllclk_init() 171 pr_err("Unable to map CSR register for %s\n", np->full_name); xgene_pllclk_init() 174 of_property_read_string(np, "clock-output-names", &clk_name); xgene_pllclk_init() 176 clk_name, of_clk_get_parent_name(np, 0), xgene_pllclk_init() 179 of_clk_add_provider(np, of_clk_src_simple_get, clk); xgene_pllclk_init() 185 static void xgene_socpllclk_init(struct device_node *np) xgene_socpllclk_init() argument 187 xgene_pllclk_init(np, PLL_TYPE_SOC); xgene_socpllclk_init() 190 static void xgene_pcppllclk_init(struct device_node *np) xgene_pcppllclk_init() argument 192 xgene_pllclk_init(np, PLL_TYPE_PCP); xgene_pcppllclk_init() 441 static void __init xgene_devclk_init(struct device_node *np) xgene_devclk_init() argument 443 const char *clk_name = np->full_name; xgene_devclk_init() 451 if (!of_device_is_available(np)) xgene_devclk_init() 459 rc = of_address_to_resource(np, i, &res); xgene_devclk_init() 463 np->full_name); xgene_devclk_init() 468 map_res = of_iomap(np, i); xgene_devclk_init() 471 i, np->full_name); xgene_devclk_init() 479 if (of_property_read_u32(np, "csr-offset", ¶meters.reg_csr_offset)) xgene_devclk_init() 481 if (of_property_read_u32(np, "csr-mask", ¶meters.reg_csr_mask)) xgene_devclk_init() 483 if (of_property_read_u32(np, "enable-offset", xgene_devclk_init() 486 if (of_property_read_u32(np, "enable-mask", ¶meters.reg_clk_mask)) xgene_devclk_init() 488 if (of_property_read_u32(np, "divider-offset", xgene_devclk_init() 491 if (of_property_read_u32(np, "divider-width", xgene_devclk_init() 494 if (of_property_read_u32(np, "divider-shift", xgene_devclk_init() 497 of_property_read_string(np, "clock-output-names", &clk_name); xgene_devclk_init() 500 of_clk_get_parent_name(np, 0), ¶meters, &clk_lock); xgene_devclk_init() 504 rc = of_clk_add_provider(np, of_clk_src_simple_get, clk); xgene_devclk_init() 507 np->full_name); xgene_devclk_init()
|
H A D | clkdev.c | 31 static struct clk *__of_clk_get(struct device_node *np, int index, __of_clk_get() argument 41 rc = of_parse_phandle_with_args(np, "clocks", "#clock-cells", index, __of_clk_get() 47 of_node_put(clkspec.np); __of_clk_get() 52 struct clk *of_clk_get(struct device_node *np, int index) of_clk_get() argument 54 return __of_clk_get(np, index, np->full_name, NULL); of_clk_get() 58 static struct clk *__of_clk_get_by_name(struct device_node *np, __of_clk_get_by_name() argument 65 while (np) { __of_clk_get_by_name() 74 index = of_property_match_string(np, "clock-names", name); __of_clk_get_by_name() 75 clk = __of_clk_get(np, index, dev_id, name); __of_clk_get_by_name() 81 np->full_name, name ? name : "", index); __of_clk_get_by_name() 90 np = np->parent; __of_clk_get_by_name() 91 if (np && !of_get_property(np, "clock-ranges", NULL)) __of_clk_get_by_name() 100 * @np: pointer to clock consumer node 107 struct clk *of_clk_get_by_name(struct device_node *np, const char *name) of_clk_get_by_name() argument 109 if (!np) of_clk_get_by_name() 112 return __of_clk_get_by_name(np, np->full_name, name); of_clk_get_by_name() 118 static struct clk *__of_clk_get_by_name(struct device_node *np, __of_clk_get_by_name() argument
|
/linux-4.4.14/arch/arm/mach-mxs/ |
H A D | mach-mxs.c | 92 struct device_node *np; mxs_get_ocotp() local 101 np = of_find_compatible_node(NULL, NULL, "fsl,ocotp"); mxs_get_ocotp() 102 ocotp_base = of_iomap(np, 0); mxs_get_ocotp() 166 struct device_node *np, *from = NULL; update_fec_mac_prop() local 174 np = of_find_compatible_node(from, NULL, "fsl,imx28-fec"); update_fec_mac_prop() 175 if (!np) update_fec_mac_prop() 178 from = np; update_fec_mac_prop() 180 if (of_get_property(np, "local-mac-address", NULL)) update_fec_mac_prop() 232 of_update_property(np, newmac); update_fec_mac_prop() 302 struct device_node *np; tx28_post_init() local 309 np = of_find_compatible_node(NULL, NULL, "fsl,imx28-fec"); tx28_post_init() 310 pdev = of_find_device_by_node(np); tx28_post_init() 362 struct device_node *np; mxs_get_soc_id() local 365 np = of_find_compatible_node(NULL, NULL, "fsl,imx23-digctl"); mxs_get_soc_id() 366 digctl_base = of_iomap(np, 0); mxs_get_soc_id() 373 of_node_put(np); mxs_get_soc_id() 435 struct device_node *np; mxs_restart_init() local 437 np = of_find_compatible_node(NULL, NULL, "fsl,clkctrl"); mxs_restart_init() 438 reset_addr = of_iomap(np, 0); mxs_restart_init() 442 if (of_device_is_compatible(np, "fsl,imx23-clkctrl")) mxs_restart_init() 446 of_node_put(np); mxs_restart_init()
|
/linux-4.4.14/arch/powerpc/platforms/86xx/ |
H A D | pic.c | 35 struct device_node *np; mpc86xx_init_irq() local 49 for_each_node_by_type(np, "interrupt-controller") mpc86xx_init_irq() 50 if (of_device_is_compatible(np, "chrp,iic")) { mpc86xx_init_irq() 51 cascade_node = np; mpc86xx_init_irq()
|
/linux-4.4.14/arch/arm/mach-axxia/ |
H A D | platsmp.c | 66 struct device_node *np; for_each_possible_cpu() local 69 np = of_get_cpu_node(cpu, NULL); for_each_possible_cpu() 70 if (!np) for_each_possible_cpu() 72 if (of_property_read_u32(np, "cpu-release-addr", &release_phys)) for_each_possible_cpu()
|
/linux-4.4.14/drivers/net/phy/ |
H A D | mdio-mux-mmioreg.c | 71 struct device_node *np2, *np = pdev->dev.of_node; mdio_mux_mmioreg_probe() local 77 dev_dbg(&pdev->dev, "probing node %s\n", np->full_name); mdio_mux_mmioreg_probe() 83 ret = of_address_to_resource(np, 0, &res); mdio_mux_mmioreg_probe() 86 np->full_name); mdio_mux_mmioreg_probe() 96 iprop = of_get_property(np, "mux-mask", &len); mdio_mux_mmioreg_probe() 111 for_each_available_child_of_node(np, np2) { for_each_available_child_of_node() 132 np->full_name);
|
/linux-4.4.14/drivers/pci/host/ |
H A D | pcie-iproc-platform.c | 32 struct device_node *np = pdev->dev.of_node; iproc_pcie_pltfm_probe() local 45 ret = of_address_to_resource(np, 0, ®); iproc_pcie_pltfm_probe() 57 if (of_property_read_bool(np, "brcm,pcie-ob")) { iproc_pcie_pltfm_probe() 60 ret = of_property_read_u32(np, "brcm,pcie-ob-axi-offset", iproc_pcie_pltfm_probe() 69 ret = of_property_read_u32(np, "brcm,pcie-ob-window-size", iproc_pcie_pltfm_probe() 78 if (of_property_read_bool(np, "brcm,pcie-ob-oarr-size")) iproc_pcie_pltfm_probe() 92 ret = of_pci_get_host_bridge_resources(np, 0, 0xff, &res, &iobase); iproc_pcie_pltfm_probe()
|
/linux-4.4.14/sound/soc/ux500/ |
H A D | mop500.c | 72 struct device_node *np) mop500_of_probe() 77 msp_np[0] = of_parse_phandle(np, "stericsson,cpu-dai", 0); mop500_of_probe() 78 msp_np[1] = of_parse_phandle(np, "stericsson,cpu-dai", 1); mop500_of_probe() 79 codec_np = of_parse_phandle(np, "stericsson,audio-codec", 0); mop500_of_probe() 103 struct device_node *np = pdev->dev.of_node; mop500_probe() local 110 if (np) { mop500_probe() 111 ret = mop500_of_probe(pdev, np); mop500_probe() 71 mop500_of_probe(struct platform_device *pdev, struct device_node *np) mop500_of_probe() argument
|
/linux-4.4.14/drivers/usb/common/ |
H A D | common.c | 130 * @np: Pointer to the given device_node 134 bool of_usb_host_tpl_support(struct device_node *np) of_usb_host_tpl_support() argument 136 if (of_find_property(np, "tpl-support", NULL)) of_usb_host_tpl_support() 146 * @np: Pointer to the given device_node 151 int of_usb_update_otg_caps(struct device_node *np, of_usb_update_otg_caps() argument 159 if (!of_property_read_u32(np, "otg-rev", &otg_rev)) { of_usb_update_otg_caps() 174 np->full_name, otg_rev); of_usb_update_otg_caps() 186 if (of_find_property(np, "hnp-disable", NULL)) of_usb_update_otg_caps() 188 if (of_find_property(np, "srp-disable", NULL)) of_usb_update_otg_caps() 190 if (of_find_property(np, "adp-disable", NULL) || of_usb_update_otg_caps()
|
/linux-4.4.14/arch/mips/bmips/ |
H A D | setup.c | 127 struct device_node *np; plat_time_init() local 130 np = of_find_node_by_name(NULL, "cpus"); plat_time_init() 131 if (!np) plat_time_init() 133 if (of_property_read_u32(np, "mips-hpt-frequency", &freq) < 0) plat_time_init() 135 of_node_put(np); plat_time_init() 171 struct device_node *np; device_tree_init() local 176 np = of_find_node_by_name(NULL, "cpus"); device_tree_init() 177 if (np && of_get_available_child_count(np) <= 1) device_tree_init() 179 of_node_put(np); device_tree_init()
|
H A D | dma.c | 79 struct device_node *np = bmips_init_dma_ranges() local 85 if (!np) bmips_init_dma_ranges() 88 data = of_get_property(np, "dma-ranges", &len); bmips_init_dma_ranges() 109 of_node_put(np); bmips_init_dma_ranges() 114 of_node_put(np); bmips_init_dma_ranges()
|
/linux-4.4.14/arch/arm/mach-zynq/ |
H A D | pm.c | 46 struct device_node *np; zynq_pm_ioremap() local 49 np = of_find_compatible_node(NULL, NULL, comp); zynq_pm_ioremap() 50 if (np) { zynq_pm_ioremap() 51 base = of_iomap(np, 0); zynq_pm_ioremap() 52 of_node_put(np); zynq_pm_ioremap()
|
/linux-4.4.14/drivers/pinctrl/freescale/ |
H A D | pinctrl-mxs.c | 69 struct device_node *np, mxs_dt_node_to_map() 77 int length = strlen(np->name) + SUFFIX_LEN; mxs_dt_node_to_map() 83 if (of_property_read_u32(np, "reg", ®)) mxs_dt_node_to_map() 86 ret = of_property_read_u32(np, "fsl,drive-strength", &val); mxs_dt_node_to_map() 89 ret = of_property_read_u32(np, "fsl,voltage", &val); mxs_dt_node_to_map() 92 ret = of_property_read_u32(np, "fsl,pull-up", &val); mxs_dt_node_to_map() 106 new_map[i].data.mux.function = np->name; mxs_dt_node_to_map() 114 snprintf(group, length, "%s.%d", np->name, reg); mxs_dt_node_to_map() 127 new_map[i].data.configs.group_or_pin = purecfg ? np->name : mxs_dt_node_to_map() 348 struct device_node *np, int idx, mxs_pinctrl_parse_group() 356 int length = strlen(np->name) + SUFFIX_LEN; mxs_pinctrl_parse_group() 362 if (of_property_read_u32(np, "reg", &val)) mxs_pinctrl_parse_group() 363 snprintf(group, length, "%s", np->name); mxs_pinctrl_parse_group() 365 snprintf(group, length, "%s.%d", np->name, val); mxs_pinctrl_parse_group() 368 prop = of_find_property(np, propname, &length); mxs_pinctrl_parse_group() 383 of_property_read_u32_array(np, propname, g->pins, g->npins); mxs_pinctrl_parse_group() 399 struct device_node *np = pdev->dev.of_node; mxs_pinctrl_probe_dt() local 408 child = of_get_next_child(np, NULL); mxs_pinctrl_probe_dt() 416 for_each_child_of_node(np, child) { for_each_child_of_node() 442 for_each_child_of_node(np, child) { for_each_child_of_node() 452 * of_get_next_child(np, * child) for_each_child_of_node() 464 for (child2 = of_get_next_child(np, child); for_each_child_of_node() 466 child2 = of_get_next_child(np, child2)) { for_each_child_of_node() 482 for_each_child_of_node(np, child) { for_each_child_of_node() 515 struct device_node *np = pdev->dev.of_node; mxs_pinctrl_probe() local 526 d->base = of_iomap(np, 0); mxs_pinctrl_probe() 68 mxs_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node *np, struct pinctrl_map **map, unsigned *num_maps) mxs_dt_node_to_map() argument 347 mxs_pinctrl_parse_group(struct platform_device *pdev, struct device_node *np, int idx, const char **out_name) mxs_pinctrl_parse_group() argument
|
/linux-4.4.14/drivers/iio/frequency/ |
H A D | adf4350.c | 383 struct device_node *np = dev->of_node; adf4350_parse_dt() local 392 strncpy(&pdata->name[0], np->name, SPI_NAME_SIZE - 1); adf4350_parse_dt() 395 of_property_read_u32(np, "adi,channel-spacing", &tmp); adf4350_parse_dt() 399 of_property_read_u32(np, "adi,power-up-frequency", &tmp); adf4350_parse_dt() 403 of_property_read_u32(np, "adi,reference-div-factor", &tmp); adf4350_parse_dt() 406 ret = of_get_gpio(np, 0); adf4350_parse_dt() 412 pdata->ref_doubler_en = of_property_read_bool(np, adf4350_parse_dt() 414 pdata->ref_div2_en = of_property_read_bool(np, adf4350_parse_dt() 418 pdata->r2_user_settings = of_property_read_bool(np, adf4350_parse_dt() 421 pdata->r2_user_settings |= of_property_read_bool(np, adf4350_parse_dt() 424 pdata->r2_user_settings |= of_property_read_bool(np, adf4350_parse_dt() 429 of_property_read_u32(np, "adi,charge-pump-current", &tmp); adf4350_parse_dt() 433 of_property_read_u32(np, "adi,muxout-select", &tmp); adf4350_parse_dt() 436 pdata->r2_user_settings |= of_property_read_bool(np, adf4350_parse_dt() 442 pdata->r3_user_settings = of_property_read_bool(np, adf4350_parse_dt() 445 pdata->r3_user_settings |= of_property_read_bool(np, adf4350_parse_dt() 449 pdata->r3_user_settings |= of_property_read_bool(np, adf4350_parse_dt() 452 pdata->r3_user_settings |= of_property_read_bool(np, adf4350_parse_dt() 457 of_property_read_u32(np, "adi,12bit-clk-divider", &tmp); adf4350_parse_dt() 461 of_property_read_u32(np, "adi,clk-divider-mode", &tmp); adf4350_parse_dt() 466 pdata->r4_user_settings = of_property_read_bool(np, adf4350_parse_dt() 469 pdata->r4_user_settings |= of_property_read_bool(np, adf4350_parse_dt() 472 pdata->r4_user_settings |= of_property_read_bool(np, adf4350_parse_dt() 477 of_property_read_u32(np, "adi,output-power", &tmp); adf4350_parse_dt() 481 of_property_read_u32(np, "adi,aux-output-power", &tmp); adf4350_parse_dt()
|