aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/platform_data
ModeNameSize
-rw-r--r--ad5449.h1184logstatsplainblame
-rw-r--r--ad5755.h2801logstatsplainblame
-rw-r--r--ad7266.h1490logstatsplainblame
-rw-r--r--ad7291.h257logstatsplainblame
-rw-r--r--ad7298.h410logstatsplainblame
-rw-r--r--ad7303.h458logstatsplainblame
-rw-r--r--ad7791.h491logstatsplainblame
-rw-r--r--ad7793.h3834logstatsplainblame
-rw-r--r--ad7887.h749logstatsplainblame
-rw-r--r--adau17x1.h3590logstatsplainblame
-rw-r--r--adau1977.h1283logstatsplainblame
-rw-r--r--ads7828.h832logstatsplainblame
-rw-r--r--arm-ux500-pm.h586logstatsplainblame
-rw-r--r--asoc-imx-ssi.h647logstatsplainblame
-rw-r--r--asoc-kirkwood.h106logstatsplainblame
-rw-r--r--asoc-mx27vis.h246logstatsplainblame
-rw-r--r--asoc-palm27x.h113logstatsplainblame
-rw-r--r--asoc-s3c.h1328logstatsplainblame
-rw-r--r--asoc-s3c24xx_simtec.h892logstatsplainblame
-rw-r--r--asoc-ti-mcbsp.h1669logstatsplainblame
-rw-r--r--asoc-ux500-msp.h452logstatsplainblame
-rw-r--r--at24.h1856logstatsplainblame
-rw-r--r--at91_adc.h1411logstatsplainblame
-rw-r--r--ata-pxa.h1057logstatsplainblame
-rw-r--r--ata-samsung_cf.h962logstatsplainblame
-rw-r--r--atmel.h2675logstatsplainblame
-rw-r--r--bd6107.h414logstatsplainblame
-rw-r--r--brcmfmac-sdio.h5243logstatsplainblame
-rw-r--r--bt-nokia-h4p.h1162logstatsplainblame
-rw-r--r--camera-mx2.h1556logstatsplainblame
-rw-r--r--camera-mx3.h1677logstatsplainblame
-rw-r--r--camera-pxa.h1472logstatsplainblame
-rw-r--r--camera-rcar.h746logstatsplainblame
-rw-r--r--clk-integrator.h118logstatsplainblame
-rw-r--r--clk-lpss.h565logstatsplainblame
-rw-r--r--clk-realview.h63logstatsplainblame
-rw-r--r--clk-u300.h47logstatsplainblame
-rw-r--r--clk-ux500.h749logstatsplainblame
-rw-r--r--coda.h441logstatsplainblame
-rw-r--r--crypto-atmel.h506logstatsplainblame
-rw-r--r--crypto-ux500.h543logstatsplainblame
-rw-r--r--cyttsp4.h2266logstatsplainblame
-rw-r--r--davinci_asp.h3303logstatsplainblame
-rw-r--r--db8500_thermal.h1093logstatsplainblame
-rw-r--r--dma-atmel.h2512logstatsplainblame
-rw-r--r--dma-coh901318.h2039logstatsplainblame
-rw-r--r--dma-dw.h2016logstatsplainblame
-rw-r--r--dma-ep93xx.h2701logstatsplainblame
-rw-r--r--dma-imx-sdma.h1449logstatsplainblame
-rw-r--r--dma-imx.h1993logstatsplainblame
-rw-r--r--dma-mmp_tdma.h682logstatsplainblame
-rw-r--r--dma-mv_xor.h336logstatsplainblame
-rw-r--r--dma-rcar-audmapp.h826logstatsplainblame
-rw-r--r--dma-rcar-hpbdma.h2938logstatsplainblame
-rw-r--r--dma-s3c24xx.h1370logstatsplainblame
-rw-r--r--dma-ste-dma40.h6193logstatsplainblame
-rw-r--r--dmtimer-omap.h1095logstatsplainblame
-rw-r--r--drv260x-pdata.h784logstatsplainblame
-rw-r--r--dwc3-exynos.h712logstatsplainblame
-rw-r--r--dwc3-omap.h2012logstatsplainblame
-rw-r--r--edma.h5467logstatsplainblame
-rw-r--r--efm32-spi.h336logstatsplainblame
-rw-r--r--efm32-uart.h354logstatsplainblame
-rw-r--r--ehci-sh.h995logstatsplainblame
-rw-r--r--elm.h1778logstatsplainblame
-rw-r--r--emif_plat.h4156logstatsplainblame
-rw-r--r--eth-netx.h884logstatsplainblame
-rw-r--r--fsa9480.h656logstatsplainblame
-rw-r--r--g762.h1366logstatsplainblame
-rw-r--r--gpio-davinci.h1365logstatsplainblame
-rw-r--r--gpio-dwapb.h829logstatsplainblame
-rw-r--r--gpio-em.h203logstatsplainblame
-rw-r--r--gpio-lpc32xx.h1730logstatsplainblame
-rw-r--r--gpio-omap.h6627logstatsplainblame
-rw-r--r--gpio-rcar.h831logstatsplainblame
-rw-r--r--gpio-ts5500.h838logstatsplainblame
-rw-r--r--gpio_backlight.h463logstatsplainblame
-rw-r--r--hwmon-s3c.h1358logstatsplainblame
-rw-r--r--i2c-cbus-gpio.h790logstatsplainblame
-rw-r--r--i2c-davinci.h862logstatsplainblame
-rw-r--r--i2c-designware.h619logstatsplainblame
-rw-r--r--i2c-imx.h420logstatsplainblame
-rw-r--r--i2c-nuc900.h177logstatsplainblame
-rw-r--r--i2c-s3c2410.h3075logstatsplainblame
-rw-r--r--ina2xx.h546logstatsplainblame
-rw-r--r--intel-mid_wdt.h620logstatsplainblame
-rw-r--r--invensense_mpu6050.h1126logstatsplainblame
-rw-r--r--iommu-omap.h1343logstatsplainblame
-rw-r--r--ipmmu-vmsa.h557logstatsplainblame
-rw-r--r--irda-pxaficp.h665logstatsplainblame
-rw-r--r--irq-renesas-intc-irqpin.h1001logstatsplainblame
-rw-r--r--irq-renesas-irqc.h898logstatsplainblame
-rw-r--r--isl9305.h700logstatsplainblame
-rw-r--r--keyboard-pxa930_rotary.h603logstatsplainblame
-rw-r--r--keyboard-spear.h3892logstatsplainblame
-rw-r--r--keypad-ep93xx.h1032logstatsplainblame
-rw-r--r--keypad-nomadik-ske.h1200logstatsplainblame
-rw-r--r--keypad-omap.h1478logstatsplainblame
-rw-r--r--keypad-pxa27x.h2174logstatsplainblame
-rw-r--r--keypad-w90p910.h341logstatsplainblame
-rw-r--r--keyscan-davinci.h1182logstatsplainblame
-rw-r--r--lcd-mipid.h547logstatsplainblame
-rw-r--r--leds-kirkwood-netxbig.h1084logstatsplainblame
-rw-r--r--leds-kirkwood-ns2.h529logstatsplainblame
-rw-r--r--leds-lm355x.h1461logstatsplainblame
-rw-r--r--leds-lm3642.h823logstatsplainblame
-rw-r--r--leds-lp55xx.h2090logstatsplainblame
-rw-r--r--leds-omap.h498logstatsplainblame
-rw-r--r--leds-pca963x.h1160logstatsplainblame
-rw-r--r--leds-s3c24xx.h669logstatsplainblame
-rw-r--r--lm3630a_bl.h1683logstatsplainblame
-rw-r--r--lm3639_bl.h1545logstatsplainblame
-rw-r--r--lp855x.h4171logstatsplainblame
-rw-r--r--lp8727.h1623logstatsplainblame
-rw-r--r--lp8755.h1654logstatsplainblame
-rw-r--r--lv5207lp.h419logstatsplainblame
-rw-r--r--macb.h507logstatsplainblame
-rw-r--r--mailbox-omap.h1751logstatsplainblame
-rw-r--r--max197.h757logstatsplainblame
-rw-r--r--max3421-hcd.h769logstatsplainblame
-rw-r--r--max6697.h1058logstatsplainblame
-rw-r--r--mfd-mcp-sa11x0.h418logstatsplainblame
-rw-r--r--microread.h1094logstatsplainblame
-rw-r--r--mmc-davinci.h697logstatsplainblame
-rw-r--r--mmc-esdhc-imx.h1448logstatsplainblame
-rw-r--r--mmc-msm_sdcc.h635logstatsplainblame
-rw-r--r--mmc-mvsdio.h378logstatsplainblame
-rw-r--r--mmc-mxcmmc.h1031logstatsplainblame
-rw-r--r--mmc-omap.h4713logstatsplainblame
-rw-r--r--mmc-pxamci.h997logstatsplainblame
-rw-r--r--mmc-s3cmci.h2045logstatsplainblame
-rw-r--r--mmc-sdhci-s3c.h2239logstatsplainblame
-rw-r--r--mmp_audio.h492logstatsplainblame
-rw-r--r--mmp_dma.h399logstatsplainblame
-rw-r--r--mouse-pxa930_trkball.h187logstatsplainblame
-rw-r--r--msm_serial_hs.h1949logstatsplainblame
-rw-r--r--mtd-davinci-aemif.h769logstatsplainblame
-rw-r--r--mtd-davinci.h2709logstatsplainblame
-rw-r--r--mtd-mxc_nand.h1275logstatsplainblame
-rw-r--r--mtd-nand-omap2.h2559logstatsplainblame
-rw-r--r--mtd-nand-pxa3xx.h2330logstatsplainblame
-rw-r--r--mtd-nand-s3c2410.h2260logstatsplainblame
-rw-r--r--mtd-onenand-omap2.h829logstatsplainblame
-rw-r--r--mtd-orion_nand.h561logstatsplainblame
-rw-r--r--mv_usb.h1352logstatsplainblame
-rw-r--r--net-cw1200.h2781logstatsplainblame
-rw-r--r--ntc_thermistor.h1901logstatsplainblame
-rw-r--r--omap-twl4030.h1675logstatsplainblame
-rw-r--r--omap-wd-timer.h1108logstatsplainblame
-rw-r--r--omap1_bl.h190logstatsplainblame
-rw-r--r--omap_drm.h1706logstatsplainblame
-rw-r--r--pca953x.h651logstatsplainblame
-rw-r--r--pcmcia-pxa2xx_viper.h161logstatsplainblame
-rw-r--r--pinctrl-adi2.h1091logstatsplainblame
-rw-r--r--pinctrl-single.h300logstatsplainblame
-rw-r--r--pn544.h1172logstatsplainblame
-rw-r--r--pxa2xx_udc.h944logstatsplainblame
-rw-r--r--pxa_sdhci.h1853logstatsplainblame
-rw-r--r--rcar-du.h1847logstatsplainblame
-rw-r--r--remoteproc-omap.h1749logstatsplainblame
-rw-r--r--s3c-hsotg.h1204logstatsplainblame
-rw-r--r--s3c-hsudc.h1161logstatsplainblame
-rw-r--r--sa11x0-serial.h806logstatsplainblame
-rw-r--r--sc18is602.h539logstatsplainblame
-rw-r--r--serial-imx.h1107logstatsplainblame
-rw-r--r--serial-omap.h1277logstatsplainblame
-rw-r--r--serial-sccnxp.h2149logstatsplainblame
-rw-r--r--sh_ipmmu.h443logstatsplainblame
-rw-r--r--shmob_drm.h2943logstatsplainblame
-rw-r--r--sht15.h1116logstatsplainblame
-rw-r--r--shtc1.h720logstatsplainblame
-rw-r--r--si5351.h3589logstatsplainblame
-rw-r--r--simplefb.h2312logstatsplainblame
-rw-r--r--spi-clps711x.h628logstatsplainblame
-rw-r--r--spi-davinci.h3141logstatsplainblame
-rw-r--r--spi-ep93xx.h780logstatsplainblame
-rw-r--r--spi-imx.h1118logstatsplainblame
-rw-r--r--spi-nuc900.h730logstatsplainblame
-rw-r--r--spi-omap2-mcspi.h559logstatsplainblame
-rw-r--r--spi-s3c64xx.h2217logstatsplainblame
-rw-r--r--ssm2518.h489logstatsplainblame
-rw-r--r--st1232_pdata.h206logstatsplainblame
-rw-r--r--st21nfca.h993logstatsplainblame
-rw-r--r--st21nfcb.h995logstatsplainblame
-rw-r--r--st_sensors_pdata.h588logstatsplainblame
-rw-r--r--syscon.h124logstatsplainblame
-rw-r--r--touchscreen-s3c2410.h673logstatsplainblame
-rw-r--r--tsl2563.h141logstatsplainblame
-rw-r--r--uio_dmem_genirq.h800logstatsplainblame
-rw-r--r--uio_pruss.h827logstatsplainblame
-rw-r--r--usb-davinci.h1997logstatsplainblame
-rw-r--r--usb-ehci-mxc.h293logstatsplainblame
-rw-r--r--usb-ehci-orion.h440logstatsplainblame
-rw-r--r--usb-musb-ux500.h575logstatsplainblame
-rw-r--r--usb-mx2.h1320logstatsplainblame
-rw-r--r--usb-ohci-pxa27x.h886logstatsplainblame
-rw-r--r--usb-ohci-s3c2410.h1087logstatsplainblame
-rw-r--r--usb-omap.h2880logstatsplainblame
-rw-r--r--usb-omap1.h1505logstatsplainblame
-rw-r--r--usb-pxa3xx-ulpi.h821logstatsplainblame
-rw-r--r--usb-rcar-gen2-phy.h613logstatsplainblame
-rw-r--r--usb-rcar-phy.h948logstatsplainblame
-rw-r--r--usb-s3c2410_udc.h1221logstatsplainblame
-rw-r--r--usb3503.h422logstatsplainblame
-rw-r--r--ux500_wdt.h320logstatsplainblame
-rw-r--r--video-clcd-versatile.h719logstatsplainblame
-rw-r--r--video-ep93xx.h1657logstatsplainblame
-rw-r--r--video-imxfb.h1844logstatsplainblame
-rw-r--r--video-msm_fb.h4520logstatsplainblame
-rw-r--r--video-mx3fb.h1573logstatsplainblame
-rw-r--r--video-nuc900fb.h1935logstatsplainblame
-rw-r--r--video-pxafb.h5503logstatsplainblame
-rw-r--r--video_s3c.h1717logstatsplainblame
-rw-r--r--voltage-omap.h1326logstatsplainblame
-rw-r--r--vsp1.h730logstatsplainblame
-rw-r--r--wiznet.h504logstatsplainblame
-rw-r--r--zforce_ts.h758logstatsplainblame
pan class="hl opt">(err_mask) { rc = -EIO; reason = "failed to write Sil3726 Private Register"; goto fail; } } if (print_info) { ata_dev_info(dev, "Port Multiplier %s, " "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n", sata_pmp_spec_rev_str(gscr), vendor, devid, sata_pmp_gscr_rev(gscr), nr_ports, gscr[SATA_PMP_GSCR_FEAT_EN], gscr[SATA_PMP_GSCR_FEAT]); if (!(dev->flags & ATA_DFLAG_AN)) ata_dev_info(dev, "Asynchronous notification not supported, " "hotplug won't work on fan-out ports. Use warm-plug instead.\n"); } return 0; fail: ata_dev_err(dev, "failed to configure Port Multiplier (%s, Emask=0x%x)\n", reason, err_mask); return rc; } static int sata_pmp_init_links (struct ata_port *ap, int nr_ports) { struct ata_link *pmp_link = ap->pmp_link; int i, err; if (!pmp_link) { pmp_link = kzalloc(sizeof(pmp_link[0]) * SATA_PMP_MAX_PORTS, GFP_NOIO); if (!pmp_link) return -ENOMEM; for (i = 0; i < SATA_PMP_MAX_PORTS; i++) ata_link_init(ap, &pmp_link[i], i); ap->pmp_link = pmp_link; for (i = 0; i < SATA_PMP_MAX_PORTS; i++) { err = ata_tlink_add(&pmp_link[i]); if (err) { goto err_tlink; } } } for (i = 0; i < nr_ports; i++) { struct ata_link *link = &pmp_link[i]; struct ata_eh_context *ehc = &link->eh_context; link->flags = 0; ehc->i.probe_mask |= ATA_ALL_DEVICES; ehc->i.action |= ATA_EH_RESET; } return 0; err_tlink: while (--i >= 0) ata_tlink_delete(&pmp_link[i]); kfree(pmp_link); ap->pmp_link = NULL; return err; } static void sata_pmp_quirks(struct ata_port *ap) { u32 *gscr = ap->link.device->gscr; u16 vendor = sata_pmp_gscr_vendor(gscr); u16 devid = sata_pmp_gscr_devid(gscr); struct ata_link *link; if (vendor == 0x1095 && devid == 0x3726) { /* sil3726 quirks */ ata_for_each_link(link, ap, EDGE) { /* link reports offline after LPM */ link->flags |= ATA_LFLAG_NO_LPM; /* Class code report is unreliable. */ if (link->pmp < 5) link->flags |= ATA_LFLAG_ASSUME_ATA; /* port 5 is for SEMB device and it doesn't like SRST */ if (link->pmp == 5) link->flags |= ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_SEMB; } } else if (vendor == 0x1095 && devid == 0x4723) { /* sil4723 quirks */ ata_for_each_link(link, ap, EDGE) { /* link reports offline after LPM */ link->flags |= ATA_LFLAG_NO_LPM; /* class code report is unreliable */ if (link->pmp < 2) link->flags |= ATA_LFLAG_ASSUME_ATA; /* the config device at port 2 locks up on SRST */ if (link->pmp == 2) link->flags |= ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_ATA; } } else if (vendor == 0x1095 && devid == 0x4726) { /* sil4726 quirks */ ata_for_each_link(link, ap, EDGE) { /* link reports offline after LPM */ link->flags |= ATA_LFLAG_NO_LPM; /* Class code report is unreliable and SRST * times out under certain configurations. * Config device can be at port 0 or 5 and * locks up on SRST. */ if (link->pmp <= 5) link->flags |= ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_ATA; /* Port 6 is for SEMB device which doesn't * like SRST either. */ if (link->pmp == 6) link->flags |= ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_SEMB; } } else if (vendor == 0x1095 && (devid == 0x5723 || devid == 0x5733 || devid == 0x5734 || devid == 0x5744)) { /* sil5723/5744 quirks */ /* sil5723/5744 has either two or three downstream * ports depending on operation mode. The last port * is empty if any actual IO device is available or * occupied by a pseudo configuration device * otherwise. Don't try hard to recover it. */ ap->pmp_link[ap->nr_pmp_links - 1].flags |= ATA_LFLAG_NO_RETRY; } else if (vendor == 0x197b && devid == 0x2352) { /* chip found in Thermaltake BlackX Duet, jmicron JMB350? */ ata_for_each_link(link, ap, EDGE) { /* SRST breaks detection and disks get misclassified * LPM disabled to avoid potential problems */ link->flags |= ATA_LFLAG_NO_LPM | ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_ATA; } } } /** * sata_pmp_attach - attach a SATA PMP device * @dev: SATA PMP device to attach * * Configure and attach SATA PMP device @dev. This function is * also responsible for allocating and initializing PMP links. * * LOCKING: * Kernel thread context (may sleep). * * RETURNS: * 0 on success, -errno on failure. */ int sata_pmp_attach(struct ata_device *dev) { struct ata_link *link = dev->link; struct ata_port *ap = link->ap; unsigned long flags; struct ata_link *tlink; int rc; /* is it hanging off the right place? */ if (!sata_pmp_supported(ap)) { ata_dev_err(dev, "host does not support Port Multiplier\n"); return -EINVAL; } if (!ata_is_host_link(link)) { ata_dev_err(dev, "Port Multipliers cannot be nested\n"); return -EINVAL; } if (dev->devno) { ata_dev_err(dev, "Port Multiplier must be the first device\n"); return -EINVAL; } WARN_ON(link->pmp != 0); link->pmp = SATA_PMP_CTRL_PORT; /* read GSCR block */ rc = sata_pmp_read_gscr(dev, dev->gscr); if (rc) goto fail; /* config PMP */ rc = sata_pmp_configure(dev, 1); if (rc) goto fail; rc = sata_pmp_init_links(ap, sata_pmp_gscr_ports(dev->gscr)); if (rc) { ata_dev_info(dev, "failed to initialize PMP links\n"); goto fail; } /* attach it */ spin_lock_irqsave(ap->lock, flags); WARN_ON(ap->nr_pmp_links); ap->nr_pmp_links = sata_pmp_gscr_ports(dev->gscr); spin_unlock_irqrestore(ap->lock, flags); sata_pmp_quirks(ap); if (ap->ops->pmp_attach) ap->ops->pmp_attach(ap); ata_for_each_link(tlink, ap, EDGE) sata_link_init_spd(tlink); return 0; fail: link->pmp = 0; return rc; } /** * sata_pmp_detach - detach a SATA PMP device * @dev: SATA PMP device to detach * * Detach SATA PMP device @dev. This function is also * responsible for deconfiguring PMP links. * * LOCKING: * Kernel thread context (may sleep). */ static void sata_pmp_detach(struct ata_device *dev) { struct ata_link *link = dev->link; struct ata_port *ap = link->ap; struct ata_link *tlink; unsigned long flags; ata_dev_info(dev, "Port Multiplier detaching\n"); WARN_ON(!ata_is_host_link(link) || dev->devno || link->pmp != SATA_PMP_CTRL_PORT); if (ap->ops->pmp_detach) ap->ops->pmp_detach(ap); ata_for_each_link(tlink, ap, EDGE) ata_eh_detach_dev(tlink->device); spin_lock_irqsave(ap->lock, flags); ap->nr_pmp_links = 0; link->pmp = 0; spin_unlock_irqrestore(ap->lock, flags); } /** * sata_pmp_same_pmp - does new GSCR matches the configured PMP? * @dev: PMP device to compare against * @new_gscr: GSCR block of the new device * * Compare @new_gscr against @dev and determine whether @dev is * the PMP described by @new_gscr. * * LOCKING: * None. * * RETURNS: * 1 if @dev matches @new_gscr, 0 otherwise. */ static int sata_pmp_same_pmp(struct ata_device *dev, const u32 *new_gscr) { const u32 *old_gscr = dev->gscr; u16 old_vendor, new_vendor, old_devid, new_devid; int old_nr_ports, new_nr_ports; old_vendor = sata_pmp_gscr_vendor(old_gscr); new_vendor = sata_pmp_gscr_vendor(new_gscr); old_devid = sata_pmp_gscr_devid(old_gscr); new_devid = sata_pmp_gscr_devid(new_gscr); old_nr_ports = sata_pmp_gscr_ports(old_gscr); new_nr_ports = sata_pmp_gscr_ports(new_gscr); if (old_vendor != new_vendor) { ata_dev_info(dev, "Port Multiplier vendor mismatch '0x%x' != '0x%x'\n", old_vendor, new_vendor); return 0; } if (old_devid != new_devid) { ata_dev_info(dev, "Port Multiplier device ID mismatch '0x%x' != '0x%x'\n", old_devid, new_devid); return 0; } if (old_nr_ports != new_nr_ports) { ata_dev_info(dev, "Port Multiplier nr_ports mismatch '0x%x' != '0x%x'\n", old_nr_ports, new_nr_ports); return 0; } return 1; } /** * sata_pmp_revalidate - revalidate SATA PMP * @dev: PMP device to revalidate * @new_class: new class code * * Re-read GSCR block and make sure @dev is still attached to the * port and properly configured. * * LOCKING: * Kernel thread context (may sleep). * * RETURNS: * 0 on success, -errno otherwise. */ static int sata_pmp_revalidate(struct ata_device *dev, unsigned int new_class) { struct ata_link *link = dev->link; struct ata_port *ap = link->ap; u32 *gscr = (void *)ap->sector_buf; int rc; DPRINTK("ENTER\n"); ata_eh_about_to_do(link, NULL, ATA_EH_REVALIDATE); if (!ata_dev_enabled(dev)) { rc = -ENODEV; goto fail; } /* wrong class? */ if (ata_class_enabled(new_class) && new_class != ATA_DEV_PMP) { rc = -ENODEV; goto fail; } /* read GSCR */ rc = sata_pmp_read_gscr(dev, gscr); if (rc) goto fail; /* is the pmp still there? */ if (!sata_pmp_same_pmp(dev, gscr)) { rc = -ENODEV; goto fail; } memcpy(dev->gscr, gscr, sizeof(gscr[0]) * SATA_PMP_GSCR_DWORDS); rc = sata_pmp_configure(dev, 0); if (rc) goto fail; ata_eh_done(link, NULL, ATA_EH_REVALIDATE); DPRINTK("EXIT, rc=0\n"); return 0; fail: ata_dev_err(dev, "PMP revalidation failed (errno=%d)\n", rc); DPRINTK("EXIT, rc=%d\n", rc); return rc; } /** * sata_pmp_revalidate_quick - revalidate SATA PMP quickly * @dev: PMP device to revalidate * * Make sure the attached PMP is accessible. * * LOCKING: * Kernel thread context (may sleep). * * RETURNS: * 0 on success, -errno otherwise. */ static int sata_pmp_revalidate_quick(struct ata_device *dev) { unsigned int err_mask; u32 prod_id; err_mask = sata_pmp_read(dev->link, SATA_PMP_GSCR_PROD_ID, &prod_id); if (err_mask) { ata_dev_err(dev, "failed to read PMP product ID (Emask=0x%x)\n", err_mask); return -EIO; } if (prod_id != dev->gscr[SATA_PMP_GSCR_PROD_ID]) { ata_dev_err(dev, "PMP product ID mismatch\n"); /* something weird is going on, request full PMP recovery */ return -EIO; } return 0; } /** * sata_pmp_eh_recover_pmp - recover PMP * @ap: ATA port PMP is attached to * @prereset: prereset method (can be NULL) * @softreset: softreset method * @hardreset: hardreset method * @postreset: postreset method (can be NULL) * * Recover PMP attached to @ap. Recovery procedure is somewhat * similar to that of ata_eh_recover() except that reset should * always be performed in hard->soft sequence and recovery * failure results in PMP detachment. * * LOCKING: * Kernel thread context (may sleep). * * RETURNS: * 0 on success, -errno on failure. */ static int sata_pmp_eh_recover_pmp(struct ata_port *ap, ata_prereset_fn_t prereset, ata_reset_fn_t softreset, ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) { struct ata_link *link = &ap->link; struct ata_eh_context *ehc = &link->eh_context; struct ata_device *dev = link->device; int tries = ATA_EH_PMP_TRIES; int detach = 0, rc = 0; int reval_failed = 0; DPRINTK("ENTER\n"); if (dev->flags & ATA_DFLAG_DETACH) { detach = 1; goto fail; } retry: ehc->classes[0] = ATA_DEV_UNKNOWN; if (ehc->i.action & ATA_EH_RESET) { struct ata_link *tlink; /* reset */ rc = ata_eh_reset(link, 0, prereset, softreset, hardreset, postreset); if (rc) { ata_link_err(link, "failed to reset PMP, giving up\n"); goto fail; } /* PMP is reset, SErrors cannot be trusted, scan all */ ata_for_each_link(tlink, ap, EDGE) { struct ata_eh_context *ehc = &tlink->eh_context; ehc->i.probe_mask |= ATA_ALL_DEVICES; ehc->i.action |= ATA_EH_RESET; } } /* If revalidation is requested, revalidate and reconfigure; * otherwise, do quick revalidation. */ if (ehc->i.action & ATA_EH_REVALIDATE) rc = sata_pmp_revalidate(dev, ehc->classes[0]); else rc = sata_pmp_revalidate_quick(dev); if (rc) { tries--; if (rc == -ENODEV) { ehc->i.probe_mask |= ATA_ALL_DEVICES; detach = 1; /* give it just two more chances */ tries = min(tries, 2); } if (tries) { /* consecutive revalidation failures? speed down */ if (reval_failed) sata_down_spd_limit(link, 0); else reval_failed = 1; ehc->i.action |= ATA_EH_RESET; goto retry; } else { ata_dev_err(dev, "failed to recover PMP after %d tries, giving up\n", ATA_EH_PMP_TRIES); goto fail; } } /* okay, PMP resurrected */ ehc->i.flags = 0; DPRINTK("EXIT, rc=0\n"); return 0; fail: sata_pmp_detach(dev); if (detach) ata_eh_detach_dev(dev); else ata_dev_disable(dev); DPRINTK("EXIT, rc=%d\n", rc); return rc; } static int sata_pmp_eh_handle_disabled_links(struct ata_port *ap) { struct ata_link *link; unsigned long flags; int rc; spin_lock_irqsave(ap->lock, flags); ata_for_each_link(link, ap, EDGE) { if (!(link->flags & ATA_LFLAG_DISABLED)) continue; spin_unlock_irqrestore(ap->lock, flags); /* Some PMPs require hardreset sequence to get * SError.N working. */ sata_link_hardreset(link, sata_deb_timing_normal, ata_deadline(jiffies, ATA_TMOUT_INTERNAL_QUICK), NULL, NULL); /* unconditionally clear SError.N */ rc = sata_scr_write(link, SCR_ERROR, SERR_PHYRDY_CHG); if (rc) { ata_link_err(link, "failed to clear SError.N (errno=%d)\n", rc); return rc; } spin_lock_irqsave(ap->lock, flags); } spin_unlock_irqrestore(ap->lock, flags); return 0; } static int sata_pmp_handle_link_fail(struct ata_link *link, int *link_tries) { struct ata_port *ap = link->ap; unsigned long flags; if (link_tries[link->pmp] && --link_tries[link->pmp]) return 1; /* disable this link */ if (!(link->flags & ATA_LFLAG_DISABLED)) { ata_link_warn(link, "failed to recover link after %d tries, disabling\n", ATA_EH_PMP_LINK_TRIES); spin_lock_irqsave(ap->lock, flags); link->flags |= ATA_LFLAG_DISABLED; spin_unlock_irqrestore(ap->lock, flags); } ata_dev_disable(link->device); link->eh_context.i.action = 0; return 0; } /** * sata_pmp_eh_recover - recover PMP-enabled port * @ap: ATA port to recover * * Drive EH recovery operation for PMP enabled port @ap. This * function recovers host and PMP ports with proper retrials and * fallbacks. Actual recovery operations are performed using * ata_eh_recover() and sata_pmp_eh_recover_pmp(). * * LOCKING: * Kernel thread context (may sleep). * * RETURNS: * 0 on success, -errno on failure. */ static int sata_pmp_eh_recover(struct ata_port *ap) { struct ata_port_operations *ops = ap->ops; int pmp_tries, link_tries[SATA_PMP_MAX_PORTS]; struct ata_link *pmp_link = &ap->link; struct ata_device *pmp_dev = pmp_link->device; struct ata_eh_context *pmp_ehc = &pmp_link->eh_context; u32 *gscr = pmp_dev->gscr; struct ata_link *link; struct ata_device *dev; unsigned int err_mask; u32 gscr_error, sntf; int cnt, rc; pmp_tries = ATA_EH_PMP_TRIES; ata_for_each_link(link, ap, EDGE) link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES; retry: /* PMP attached? */ if (!sata_pmp_attached(ap)) { rc = ata_eh_recover(ap, ops->prereset, ops->softreset, ops->hardreset, ops->postreset, NULL); if (rc) { ata_for_each_dev(dev, &ap->link, ALL) ata_dev_disable(dev); return rc; } if (pmp_dev->class != ATA_DEV_PMP) return 0; /* new PMP online */ ata_for_each_link(link, ap, EDGE) link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES; /* fall through */ } /* recover pmp */ rc = sata_pmp_eh_recover_pmp(ap, ops->prereset, ops->softreset, ops->hardreset, ops->postreset); if (rc) goto pmp_fail; /* PHY event notification can disturb reset and other recovery * operations. Turn it off. */ if (gscr[SATA_PMP_GSCR_FEAT_EN] & SATA_PMP_FEAT_NOTIFY) { gscr[SATA_PMP_GSCR_FEAT_EN] &= ~SATA_PMP_FEAT_NOTIFY; err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN, gscr[SATA_PMP_GSCR_FEAT_EN]); if (err_mask) { ata_link_warn(pmp_link, "failed to disable NOTIFY (err_mask=0x%x)\n", err_mask); goto pmp_fail; } } /* handle disabled links */ rc = sata_pmp_eh_handle_disabled_links(ap); if (rc) goto pmp_fail; /* recover links */ rc = ata_eh_recover(ap, ops->pmp_prereset, ops->pmp_softreset, ops->pmp_hardreset, ops->pmp_postreset, &link); if (rc) goto link_fail; /* clear SNotification */ rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf); if (rc == 0) sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf); /* * If LPM is active on any fan-out port, hotplug wouldn't * work. Return w/ PHY event notification disabled. */ ata_for_each_link(link, ap, EDGE) if (link->lpm_policy > ATA_LPM_MAX_POWER) return 0; /* * Connection status might have changed while resetting other * links, enable notification and check SATA_PMP_GSCR_ERROR * before returning. */ /* enable notification */ if (pmp_dev->flags & ATA_DFLAG_AN) { gscr[SATA_PMP_GSCR_FEAT_EN] |= SATA_PMP_FEAT_NOTIFY; err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN, gscr[SATA_PMP_GSCR_FEAT_EN]); if (err_mask) { ata_dev_err(pmp_dev, "failed to write PMP_FEAT_EN (Emask=0x%x)\n", err_mask); rc = -EIO; goto pmp_fail; } } /* check GSCR_ERROR */ err_mask = sata_pmp_read(pmp_link, SATA_PMP_GSCR_ERROR, &gscr_error); if (err_mask) { ata_dev_err(pmp_dev, "failed to read PMP_GSCR_ERROR (Emask=0x%x)\n", err_mask); rc = -EIO; goto pmp_fail; } cnt = 0; ata_for_each_link(link, ap, EDGE) { if (!(gscr_error & (1 << link->pmp))) continue; if (sata_pmp_handle_link_fail(link, link_tries)) { ata_ehi_hotplugged(&link->eh_context.i); cnt++; } else { ata_link_warn(link, "PHY status changed but maxed out on retries, giving up\n"); ata_link_warn(link, "Manually issue scan to resume this link\n"); } } if (cnt) { ata_port_info(ap, "PMP SError.N set for some ports, repeating recovery\n"); goto retry; } return 0; link_fail: if (sata_pmp_handle_link_fail(link, link_tries)) { pmp_ehc->i.action |= ATA_EH_RESET; goto retry; } /* fall through */ pmp_fail: /* Control always ends up here after detaching PMP. Shut up * and return if we're unloading. */ if (ap->pflags & ATA_PFLAG_UNLOADING) return rc; if (!sata_pmp_attached(ap)) goto retry; if (--pmp_tries) { pmp_ehc->i.action |= ATA_EH_RESET; goto retry; } ata_port_err(ap, "failed to recover PMP after %d tries, giving up\n", ATA_EH_PMP_TRIES); sata_pmp_detach(pmp_dev); ata_dev_disable(pmp_dev); return rc; } /** * sata_pmp_error_handler - do standard error handling for PMP-enabled host * @ap: host port to handle error for * * Perform standard error handling sequence for PMP-enabled host * @ap. * * LOCKING: * Kernel thread context (may sleep). */ void sata_pmp_error_handler(struct ata_port *ap) { ata_eh_autopsy(ap); ata_eh_report(ap); sata_pmp_eh_recover(ap); ata_eh_finish(ap); } EXPORT_SYMBOL_GPL(sata_pmp_port_ops); EXPORT_SYMBOL_GPL(sata_pmp_qc_defer_cmd_switch); EXPORT_SYMBOL_GPL(sata_pmp_error_handler);