Lines Matching +full:reg +full:- +full:names
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 1996-2001 Paul Mackerras (paulus@cs.anu.edu.au)
8 * - Replace mdelay with some schedule loop if possible
9 * - Shorten some obfuscated delays on some routines (like modem
11 * - Refcount some clocks (see darwin)
12 * - Split split split...
38 #include <asm/pci-bridge.h>
80 child = child->parent; in macio_find()
137 int reg, u32 mask, int value) in simple_feature_tweak() argument
144 return -ENODEV; in simple_feature_tweak()
147 MACIO_BIS(reg, mask); in simple_feature_tweak()
149 MACIO_BIC(reg, mask); in simple_feature_tweak()
150 (void)MACIO_IN32(reg); in simple_feature_tweak()
170 return -ENODEV; in ohare_htw_scc_enable()
171 if (of_node_name_eq(node, "ch-a")) in ohare_htw_scc_enable()
173 else if (of_node_name_eq(node, "ch-b")) in ohare_htw_scc_enable()
176 return -ENODEV; in ohare_htw_scc_enable()
178 htw = (macio->type == macio_heathrow || macio->type == macio_paddington in ohare_htw_scc_enable()
179 || macio->type == macio_gatwick); in ohare_htw_scc_enable()
220 macio->flags |= chan_mask; in ohare_htw_scc_enable()
223 macio->flags |= MACIO_FLAG_SCC_LOCKED; in ohare_htw_scc_enable()
225 if (macio->flags & MACIO_FLAG_SCC_LOCKED) in ohare_htw_scc_enable()
226 return -EPERM; in ohare_htw_scc_enable()
240 macio->flags &= ~(chan_mask); in ohare_htw_scc_enable()
269 * doesn't stick. I'm still investigating... --BenH. in ohare_ide_enable()
280 return -ENODEV; in ohare_ide_enable()
294 return -ENODEV; in ohare_ide_reset()
303 return -EPERM; in ohare_sleep_state()
322 return -ENODEV; in heathrow_modem_enable()
374 return -ENODEV; in heathrow_mesh_enable()
406 return -ENODEV; in heathrow_ide_enable()
421 return -ENODEV; in heathrow_ide_reset()
433 return -ENODEV; in heathrow_bmac_enable()
469 return -ENODEV; in heathrow_sound_enable()
497 (macio->base + ((0x8000+i*0x100)>>2)); in dbdma_save()
498 save[i].cmdptr_hi = in_le32(&chan->cmdptr_hi); in dbdma_save()
499 save[i].cmdptr = in_le32(&chan->cmdptr); in dbdma_save()
500 save[i].intr_sel = in_le32(&chan->intr_sel); in dbdma_save()
501 save[i].br_sel = in_le32(&chan->br_sel); in dbdma_save()
502 save[i].wait_sel = in_le32(&chan->wait_sel); in dbdma_save()
513 (macio->base + ((0x8000+i*0x100)>>2)); in dbdma_restore()
514 out_le32(&chan->control, (ACTIVE|DEAD|WAKE|FLUSH|PAUSE|RUN)<<16); in dbdma_restore()
515 while (in_le32(&chan->status) & ACTIVE) in dbdma_restore()
517 out_le32(&chan->cmdptr_hi, save[i].cmdptr_hi); in dbdma_restore()
518 out_le32(&chan->cmdptr, save[i].cmdptr); in dbdma_restore()
519 out_le32(&chan->intr_sel, save[i].intr_sel); in dbdma_restore()
520 out_le32(&chan->br_sel, save[i].br_sel); in dbdma_restore()
521 out_le32(&chan->wait_sel, save[i].wait_sel); in dbdma_restore()
585 return -EPERM; in heathrow_sleep_state()
607 return -ENODEV; in core99_scc_enable()
608 if (of_node_name_eq(node, "ch-a")) in core99_scc_enable()
610 else if (of_node_name_eq(node, "ch-b")) in core99_scc_enable()
613 return -ENODEV; in core99_scc_enable()
649 macio->flags |= chan_mask; in core99_scc_enable()
668 macio->flags |= MACIO_FLAG_SCC_LOCKED; in core99_scc_enable()
670 if (macio->flags & MACIO_FLAG_SCC_LOCKED) in core99_scc_enable()
671 return -EPERM; in core99_scc_enable()
691 macio->flags &= ~(chan_mask); in core99_scc_enable()
708 return -ENODEV; in core99_modem_enable()
713 return -ENODEV; in core99_modem_enable()
761 return -ENODEV; in pangea_modem_enable()
766 return -ENODEV; in pangea_modem_enable()
814 return -ENODEV; in core99_ata100_enable()
844 * based ata-100 in core99_ide_enable()
859 return -ENODEV; in core99_ide_enable()
877 return -ENODEV; in core99_ide_reset()
905 if (macio->type != macio_keylargo && macio->type != macio_pangea && in core99_gmac_phy_reset()
906 macio->type != macio_intrepid) in core99_gmac_phy_reset()
907 return -ENODEV; in core99_gmac_phy_reset()
931 return -ENODEV; in core99_sound_chip_enable()
962 return -ENODEV; in core99_airport_enable()
967 if (node != macio->of_node && in core99_airport_enable()
968 (!node->parent || node->parent != macio->of_node)) in core99_airport_enable()
969 return -ENODEV; in core99_airport_enable()
970 state = (macio->flags & MACIO_FLAG_AIRPORT_ON) != 0; in core99_airport_enable()
974 /* This code is a reproduction of OF enable-cardslot in core99_airport_enable()
975 * and init-wireless methods, slightly hacked until in core99_airport_enable()
1021 macio->flags |= MACIO_FLAG_AIRPORT_ON; in core99_airport_enable()
1034 macio->flags &= ~MACIO_FLAG_AIRPORT_ON; in core99_airport_enable()
1053 if (macio->type != macio_keylargo) in core99_reset_cpu()
1054 return -ENODEV; in core99_reset_cpu()
1057 const u32 *num = of_get_property(np, "reg", NULL); in core99_reset_cpu()
1058 const u32 *rst = of_get_property(np, "soft-reset", NULL); in core99_reset_cpu()
1088 u32 reg; in core99_usb_enable() local
1091 if (macio->type != macio_keylargo && macio->type != macio_pangea && in core99_usb_enable()
1092 macio->type != macio_intrepid) in core99_usb_enable()
1093 return -ENODEV; in core99_usb_enable()
1095 prop = of_get_property(node, "AAPL,clock-id", NULL); in core99_usb_enable()
1097 return -ENODEV; in core99_usb_enable()
1105 return -ENODEV; in core99_usb_enable()
1107 /* Sorry for the brute-force locking, but this is only used during in core99_usb_enable()
1136 reg = MACIO_IN32(KEYLARGO_FCR4); in core99_usb_enable()
1137 reg &= ~(KL4_PORT_WAKEUP_ENABLE(number) | KL4_PORT_RESUME_WAKE_EN(number) | in core99_usb_enable()
1139 reg &= ~(KL4_PORT_WAKEUP_ENABLE(number+1) | KL4_PORT_RESUME_WAKE_EN(number+1) | in core99_usb_enable()
1141 MACIO_OUT32(KEYLARGO_FCR4, reg); in core99_usb_enable()
1145 reg = MACIO_IN32(KEYLARGO_FCR3); in core99_usb_enable()
1146 reg &= ~(KL3_IT_PORT_WAKEUP_ENABLE(0) | KL3_IT_PORT_RESUME_WAKE_EN(0) | in core99_usb_enable()
1148 reg &= ~(KL3_IT_PORT_WAKEUP_ENABLE(1) | KL3_IT_PORT_RESUME_WAKE_EN(1) | in core99_usb_enable()
1150 MACIO_OUT32(KEYLARGO_FCR3, reg); in core99_usb_enable()
1154 if (macio->type == macio_intrepid) { in core99_usb_enable()
1176 if (--timeout <= 0) { in core99_usb_enable()
1190 reg = MACIO_IN32(KEYLARGO_FCR4); in core99_usb_enable()
1191 reg |= KL4_PORT_WAKEUP_ENABLE(number) | KL4_PORT_RESUME_WAKE_EN(number) | in core99_usb_enable()
1193 reg |= KL4_PORT_WAKEUP_ENABLE(number+1) | KL4_PORT_RESUME_WAKE_EN(number+1) | in core99_usb_enable()
1195 MACIO_OUT32(KEYLARGO_FCR4, reg); in core99_usb_enable()
1199 reg = MACIO_IN32(KEYLARGO_FCR3); in core99_usb_enable()
1200 reg |= KL3_IT_PORT_WAKEUP_ENABLE(0) | KL3_IT_PORT_RESUME_WAKE_EN(0) | in core99_usb_enable()
1202 reg |= KL3_IT_PORT_WAKEUP_ENABLE(1) | KL3_IT_PORT_RESUME_WAKE_EN(1) | in core99_usb_enable()
1204 MACIO_OUT32(KEYLARGO_FCR3, reg); in core99_usb_enable()
1209 if (macio->type != macio_intrepid) in core99_usb_enable()
1216 if (macio->type != macio_intrepid) in core99_usb_enable()
1241 if (macio->type != macio_keylargo && macio->type != macio_pangea && in core99_firewire_enable()
1242 macio->type != macio_intrepid) in core99_firewire_enable()
1243 return -ENODEV; in core99_firewire_enable()
1244 if (!(macio->flags & MACIO_FLAG_FW_SUPPORTED)) in core99_firewire_enable()
1245 return -ENODEV; in core99_firewire_enable()
1269 return -ENODEV; in core99_firewire_cable_power()
1271 if (macio->type != macio_keylargo && macio->type != macio_pangea && in core99_firewire_cable_power()
1272 macio->type != macio_intrepid) in core99_firewire_cable_power()
1273 return -ENODEV; in core99_firewire_cable_power()
1274 if (!(macio->flags & MACIO_FLAG_FW_SUPPORTED)) in core99_firewire_cable_power()
1275 return -ENODEV; in core99_firewire_cable_power()
1298 return -ENODEV; in intrepid_aack_delay_enable()
1338 return -ENODEV; in g5_gmac_enable()
1363 return -ENODEV; in g5_fw_enable()
1414 return -ENODEV; in g5_eth_phy_reset()
1420 /* PHY reset is GPIO 29, not in device-tree unfortunately */ in g5_eth_phy_reset()
1456 if (macio->type != macio_keylargo2 && macio->type != macio_shasta) in g5_i2s_enable()
1457 return -ENODEV; in g5_i2s_enable()
1458 if (strncmp(node->name, "i2s-", 4)) in g5_i2s_enable()
1459 return -ENODEV; in g5_i2s_enable()
1460 cell = node->name[4] - 'a'; in g5_i2s_enable()
1466 if (macio->type == macio_shasta) in g5_i2s_enable()
1470 return -ENODEV; in g5_i2s_enable()
1499 if (macio->type != macio_keylargo2 && macio->type != macio_shasta) in g5_reset_cpu()
1500 return -ENODEV; in g5_reset_cpu()
1503 const u32 *num = of_get_property(np, "reg", NULL); in g5_reset_cpu()
1504 const u32 *rst = of_get_property(np, "soft-reset", NULL); in g5_reset_cpu()
1513 return -ENODEV; in g5_reset_cpu()
1582 if (macio->rev >= 2) { in keylargo_shutdown()
1670 if (macio->type != macio_keylargo && macio->type != macio_pangea && in core99_sleep()
1671 macio->type != macio_intrepid) in core99_sleep()
1672 return -ENODEV; in core99_sleep()
1677 if (macio->flags & MACIO_FLAG_AIRPORT_ON) in core99_sleep()
1678 core99_airport_enable(macio->of_node, 0, 0); in core99_sleep()
1681 if (macio->flags & MACIO_FLAG_FW_SUPPORTED) { in core99_sleep()
1687 if (macio->type == macio_keylargo) in core99_sleep()
1688 core99_modem_enable(macio->of_node, 0, 0); in core99_sleep()
1690 pangea_modem_enable(macio->of_node, 0, 0); in core99_sleep()
1693 core99_sound_chip_enable(macio->of_node, 0, 0); in core99_sleep()
1708 if (macio->type == macio_keylargo) in core99_sleep()
1715 if (macio->type == macio_pangea || macio->type == macio_intrepid) in core99_sleep()
1724 if (macio->type == macio_pangea) in core99_sleep()
1726 else if (macio->type == macio_intrepid) in core99_sleep()
1728 else if (macio->type == macio_keylargo) in core99_sleep()
1763 if (macio->type != macio_keylargo && macio->type != macio_pangea && in core99_wake_up()
1764 macio->type != macio_intrepid) in core99_wake_up()
1765 return -ENODEV; in core99_wake_up()
1779 if (macio->type == macio_keylargo) { in core99_wake_up()
1793 if (macio->type == macio_pangea || macio->type == macio_intrepid) { in core99_wake_up()
1840 return -EPERM; in core99_sleep_state()
1857 /* Todo: eventually check we are really dealing with on-board in generic_dev_can_wake()
1878 return -EINVAL; in generic_get_mb_info()
2388 return -ENODEV; in pmac_do_feature_call()
2407 /* Lookup known motherboard type in device-tree. First try an in probe_motherboard()
2411 dt = of_find_node_by_name(NULL, "device-tree"); in probe_motherboard()
2427 /* Fallback to selection depending on mac-io chip type */ in probe_motherboard()
2428 switch(macio->type) { in probe_motherboard()
2436 pmac_mb.model_name = "Unknown OHare-based"; in probe_motherboard()
2440 pmac_mb.model_name = "Unknown Heathrow-based"; in probe_motherboard()
2445 pmac_mb.model_name = "Unknown Paddington-based"; in probe_motherboard()
2450 pmac_mb.model_name = "Unknown Keylargo-based"; in probe_motherboard()
2455 pmac_mb.model_name = "Unknown Pangea-based"; in probe_motherboard()
2460 pmac_mb.model_name = "Unknown Intrepid-based"; in probe_motherboard()
2466 pmac_mb.model_name = "Unknown K2-based"; in probe_motherboard()
2471 pmac_mb.model_name = "Unknown Shasta-based"; in probe_motherboard()
2476 ret = -ENODEV; in probe_motherboard()
2485 ret = -ENODEV; in probe_motherboard()
2488 /* Here, I used to disable the media-bay on comet. It in probe_motherboard()
2490 * a kind of media-bay and works with the current driver. in probe_motherboard()
2499 * enable it on those. In theory, the flush-on-lock property is in probe_motherboard()
2510 if (of_get_property(np, "flush-on-lock", NULL) || in probe_motherboard()
2553 /* Locate core99 Uni-N */ in probe_uninorth()
2554 uninorth_node = of_find_node_by_name(NULL, "uni-n"); in probe_uninorth()
2572 addrp = of_get_property(uninorth_node, "reg", NULL); in probe_uninorth()
2658 printk(KERN_ERR "pmac_feature: %pOF, can't map mac-io chip !\n", in probe_one_macio()
2663 const u32 *did = of_get_property(node, "device-id", NULL); in probe_one_macio()
2676 revp = of_get_property(node, "revision-id", NULL); in probe_one_macio()
2679 printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n", in probe_one_macio()
2690 probe_one_macio("mac-io", "keylargo", macio_keylargo); in probe_macios()
2691 probe_one_macio("mac-io", "paddington", macio_paddington); in probe_macios()
2692 probe_one_macio("mac-io", "gatwick", macio_gatwick); in probe_macios()
2693 probe_one_macio("mac-io", "heathrow", macio_heathrow); in probe_macios()
2694 probe_one_macio("mac-io", "K2-Keylargo", macio_keylargo2); in probe_macios()
2712 return (macio_chips[0].of_node == NULL) ? -ENODEV : 0; in probe_macios()
2727 slots = of_get_property(np, "slot-names", &len); in initial_serial_shutdown()
2733 else if (slots && slots->count > 0) { in initial_serial_shutdown()
2734 if (strcmp(slots->name, "IrDA") == 0) in initial_serial_shutdown()
2736 else if (strcmp(slots->name, "Modem") == 0) in initial_serial_shutdown()
2750 * but I'm not too sure it was audited for side-effects on other in set_initial_features()
2758 np = of_find_node_by_name(NULL, "via-pmu"); in set_initial_features()
2789 if (of_device_is_compatible(np, "K2-GMAC")) in set_initial_features()
2813 if (np->parent in set_initial_features()
2814 && of_device_is_compatible(np->parent, "uni-north") in set_initial_features()
2825 if (np->parent in set_initial_features()
2826 && of_device_is_compatible(np->parent, "uni-north") in set_initial_features()
2835 /* Enable ATA-100 before PCI probe. */ in set_initial_features()
2836 for_each_node_by_name(np, "ata-6") { in set_initial_features()
2837 if (np->parent in set_initial_features()
2838 && of_device_is_compatible(np->parent, "uni-north") in set_initial_features()
2839 && of_device_is_compatible(np, "kauai-ata")) { in set_initial_features()
2846 if (np->parent == macio_chips[0].of_node) { in set_initial_features()
2870 for_each_node_by_name(np, "ch-a") in set_initial_features()
2872 for_each_node_by_name(np, "ch-b") in set_initial_features()
2882 /* Probe mac-io controllers */ in pmac_feature_init()
2884 printk(KERN_WARNING "No mac-io chip found\n"); in pmac_feature_init()
2925 pcix_node = of_find_compatible_node(NULL, "pci", "pci-x");
2927 printk("No PCI-X bridge found\n");
2931 printk("PCI-X bridge found but not matched to pci\n");
2936 printk("PCI-X bridge found but not matched to host\n");
2941 dump_HT_speeds("PCI-X HT Uplink", cfg, freq);
2944 dump_HT_speeds("PCI-X HT Downlink", cfg, freq);
3001 if (pmac_agp_bridge->bus != dev->bus) in pmac_suspend_agp_for_card()
3011 if (pmac_agp_bridge->bus != dev->bus) in pmac_resume_agp_for_card()