Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'ata-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux

Pull ata updates from Damien Le Moal:

- Constify struct pci_device_id (Christophe)

- Remove unused code in the sata_gemini driver (David)

- Improve libahci_platform to allow supporting non consecutive port
numbers as specified in device trees (Josua)

- Cleanup ahci driver code handling of port numbers with the new helper
ahci_ignore_port() (me)

- Use pm_sleep_ptr() to remove CONFIG_PM_SLEEP ifdefs in the ahci_st
driver (Raphael). More of these changes will be included in the next
cycle

* tag 'ata-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux:
ahci: st: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
ahci: Introduce ahci_ignore_port() helper
ata: libahci_platform: support non-consecutive port numbers
ata: sata_gemini: Remove remaining reset glue
ata: sata_gemini: Remove unused gemini_sata_reset_bridge()
ata: Constify struct pci_device_id

+60 -47
+12 -1
drivers/ata/ahci.h
··· 328 328 struct ahci_host_priv { 329 329 /* Input fields */ 330 330 unsigned int flags; /* AHCI_HFLAG_* */ 331 - u32 mask_port_map; /* mask out particular bits */ 331 + u32 mask_port_map; /* Mask of valid ports */ 332 332 333 333 void __iomem * mmio; /* bus-independent mem map */ 334 334 u32 cap; /* cap to use */ ··· 378 378 int (*get_irq_vector)(struct ata_host *host, 379 379 int port); 380 380 }; 381 + 382 + /* 383 + * Return true if a port should be ignored because it is excluded from 384 + * the host port map. 385 + */ 386 + static inline bool ahci_ignore_port(struct ahci_host_priv *hpriv, 387 + unsigned int portid) 388 + { 389 + return portid >= hpriv->nports || 390 + !(hpriv->mask_port_map & (1 << portid)); 391 + } 381 392 382 393 extern int ahci_ignore_sss; 383 394
+3
drivers/ata/ahci_brcm.c
··· 288 288 289 289 /* Re-initialize and calibrate the PHY */ 290 290 for (i = 0; i < hpriv->nports; i++) { 291 + if (ahci_ignore_port(hpriv, i)) 292 + continue; 293 + 291 294 rc = phy_init(hpriv->phys[i]); 292 295 if (rc) 293 296 goto disable_phys;
+6
drivers/ata/ahci_ceva.c
··· 206 206 goto disable_clks; 207 207 208 208 for (i = 0; i < hpriv->nports; i++) { 209 + if (ahci_ignore_port(hpriv, i)) 210 + continue; 211 + 209 212 rc = phy_init(hpriv->phys[i]); 210 213 if (rc) 211 214 goto disable_rsts; ··· 218 215 ahci_platform_deassert_rsts(hpriv); 219 216 220 217 for (i = 0; i < hpriv->nports; i++) { 218 + if (ahci_ignore_port(hpriv, i)) 219 + continue; 220 + 221 221 rc = phy_power_on(hpriv->phys[i]); 222 222 if (rc) { 223 223 phy_exit(hpriv->phys[i]);
+2 -4
drivers/ata/ahci_st.c
··· 176 176 return 0; 177 177 } 178 178 179 - #ifdef CONFIG_PM_SLEEP 180 179 static int st_ahci_suspend(struct device *dev) 181 180 { 182 181 struct ata_host *host = dev_get_drvdata(dev); ··· 220 221 221 222 return ahci_platform_resume_host(dev); 222 223 } 223 - #endif 224 224 225 - static SIMPLE_DEV_PM_OPS(st_ahci_pm_ops, st_ahci_suspend, st_ahci_resume); 225 + static DEFINE_SIMPLE_DEV_PM_OPS(st_ahci_pm_ops, st_ahci_suspend, st_ahci_resume); 226 226 227 227 static const struct of_device_id st_ahci_match[] = { 228 228 { .compatible = "st,ahci", }, ··· 232 234 static struct platform_driver st_ahci_driver = { 233 235 .driver = { 234 236 .name = DRV_NAME, 235 - .pm = &st_ahci_pm_ops, 237 + .pm = pm_sleep_ptr(&st_ahci_pm_ops), 236 238 .of_match_table = st_ahci_match, 237 239 }, 238 240 .probe = st_ahci_probe,
+1 -1
drivers/ata/ata_generic.c
··· 209 209 return ata_pci_bmdma_init_one(dev, ppi, &generic_sht, (void *)id, 0); 210 210 } 211 211 212 - static struct pci_device_id ata_generic[] = { 212 + static const struct pci_device_id ata_generic[] = { 213 213 { PCI_DEVICE(PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE), }, 214 214 { PCI_DEVICE(PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565), }, 215 215 { PCI_DEVICE(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8673F), },
+34 -6
drivers/ata/libahci_platform.c
··· 49 49 int rc, i; 50 50 51 51 for (i = 0; i < hpriv->nports; i++) { 52 + if (ahci_ignore_port(hpriv, i)) 53 + continue; 54 + 52 55 rc = phy_init(hpriv->phys[i]); 53 56 if (rc) 54 57 goto disable_phys; ··· 73 70 74 71 disable_phys: 75 72 while (--i >= 0) { 73 + if (ahci_ignore_port(hpriv, i)) 74 + continue; 75 + 76 76 phy_power_off(hpriv->phys[i]); 77 77 phy_exit(hpriv->phys[i]); 78 78 } ··· 94 88 int i; 95 89 96 90 for (i = 0; i < hpriv->nports; i++) { 91 + if (ahci_ignore_port(hpriv, i)) 92 + continue; 93 + 97 94 phy_power_off(hpriv->phys[i]); 98 95 phy_exit(hpriv->phys[i]); 99 96 } ··· 441 432 return 0; 442 433 } 443 434 435 + static u32 ahci_platform_find_max_port_id(struct device *dev) 436 + { 437 + u32 max_port = 0; 438 + 439 + for_each_child_of_node_scoped(dev->of_node, child) { 440 + u32 port; 441 + 442 + if (!of_property_read_u32(child, "reg", &port)) 443 + max_port = max(max_port, port); 444 + } 445 + 446 + return max_port; 447 + } 448 + 444 449 /** 445 450 * ahci_platform_get_resources - Get platform resources 446 451 * @pdev: platform device to get resources for ··· 481 458 struct device *dev = &pdev->dev; 482 459 struct ahci_host_priv *hpriv; 483 460 u32 mask_port_map = 0; 461 + u32 max_port; 484 462 485 463 if (!devres_open_group(dev, NULL, GFP_KERNEL)) 486 464 return ERR_PTR(-ENOMEM); ··· 573 549 goto err_out; 574 550 } 575 551 552 + /* find maximum port id for allocating structures */ 553 + max_port = ahci_platform_find_max_port_id(dev); 576 554 /* 577 - * If no sub-node was found, we still need to set nports to 578 - * one in order to be able to use the 555 + * Set nports according to maximum port id. Clamp at 556 + * AHCI_MAX_PORTS, warning message for invalid port id 557 + * is generated later. 558 + * When DT has no sub-nodes max_port is 0, nports is 1, 559 + * in order to be able to use the 579 560 * ahci_platform_[en|dis]able_[phys|regulators] functions. 580 561 */ 581 - if (child_nodes) 582 - hpriv->nports = child_nodes; 583 - else 584 - hpriv->nports = 1; 562 + hpriv->nports = min(AHCI_MAX_PORTS, max_port + 1); 585 563 586 564 hpriv->phys = devm_kcalloc(dev, hpriv->nports, sizeof(*hpriv->phys), GFP_KERNEL); 587 565 if (!hpriv->phys) { ··· 651 625 * If no sub-node was found, keep this for device tree 652 626 * compatibility 653 627 */ 628 + hpriv->mask_port_map |= BIT(0); 629 + 654 630 rc = ahci_platform_get_phy(hpriv, 0, dev, dev->of_node); 655 631 if (rc) 656 632 goto err_out;
+1 -1
drivers/ata/pata_atp867x.c
··· 525 525 } 526 526 #endif 527 527 528 - static struct pci_device_id atp867x_pci_tbl[] = { 528 + static const struct pci_device_id atp867x_pci_tbl[] = { 529 529 { PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867A), 0 }, 530 530 { PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867B), 0 }, 531 531 { },
+1 -1
drivers/ata/pata_piccolo.c
··· 97 97 return ata_pci_bmdma_init_one(dev, ppi, &tosh_sht, NULL, 0); 98 98 } 99 99 100 - static struct pci_device_id ata_tosh[] = { 100 + static const struct pci_device_id ata_tosh[] = { 101 101 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), }, 102 102 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), }, 103 103 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_3), },
-32
drivers/ata/sata_gemini.c
··· 11 11 #include <linux/mfd/syscon.h> 12 12 #include <linux/regmap.h> 13 13 #include <linux/delay.h> 14 - #include <linux/reset.h> 15 14 #include <linux/of.h> 16 15 #include <linux/clk.h> 17 16 #include <linux/io.h> ··· 26 27 * @muxmode: the current muxing mode 27 28 * @ide_pins: if the device is using the plain IDE interface pins 28 29 * @sata_bridge: if the device enables the SATA bridge 29 - * @sata0_reset: SATA0 reset handler 30 - * @sata1_reset: SATA1 reset handler 31 30 * @sata0_pclk: SATA0 PCLK handler 32 31 * @sata1_pclk: SATA1 PCLK handler 33 32 */ ··· 35 38 enum gemini_muxmode muxmode; 36 39 bool ide_pins; 37 40 bool sata_bridge; 38 - struct reset_control *sata0_reset; 39 - struct reset_control *sata1_reset; 40 41 struct clk *sata0_pclk; 41 42 struct clk *sata1_pclk; 42 43 }; ··· 219 224 } 220 225 EXPORT_SYMBOL(gemini_sata_stop_bridge); 221 226 222 - int gemini_sata_reset_bridge(struct sata_gemini *sg, 223 - unsigned int bridge) 224 - { 225 - if (bridge == 0) 226 - reset_control_reset(sg->sata0_reset); 227 - else 228 - reset_control_reset(sg->sata1_reset); 229 - msleep(10); 230 - return gemini_sata_setup_bridge(sg, bridge); 231 - } 232 - EXPORT_SYMBOL(gemini_sata_reset_bridge); 233 - 234 227 static int gemini_sata_bridge_init(struct sata_gemini *sg) 235 228 { 236 229 struct device *dev = sg->dev; ··· 246 263 dev_err(dev, "failed to enable SATA1 PCLK\n"); 247 264 clk_disable_unprepare(sg->sata0_pclk); 248 265 return ret; 249 - } 250 - 251 - sg->sata0_reset = devm_reset_control_get_exclusive(dev, "sata0"); 252 - if (IS_ERR(sg->sata0_reset)) { 253 - dev_err(dev, "no SATA0 reset controller\n"); 254 - clk_disable_unprepare(sg->sata1_pclk); 255 - clk_disable_unprepare(sg->sata0_pclk); 256 - return PTR_ERR(sg->sata0_reset); 257 - } 258 - sg->sata1_reset = devm_reset_control_get_exclusive(dev, "sata1"); 259 - if (IS_ERR(sg->sata1_reset)) { 260 - dev_err(dev, "no SATA1 reset controller\n"); 261 - clk_disable_unprepare(sg->sata1_pclk); 262 - clk_disable_unprepare(sg->sata0_pclk); 263 - return PTR_ERR(sg->sata1_reset); 264 266 } 265 267 266 268 sata_id = readl(sg->base + GEMINI_SATA_ID);
-1
drivers/ata/sata_gemini.h
··· 17 17 enum gemini_muxmode gemini_sata_get_muxmode(struct sata_gemini *sg); 18 18 int gemini_sata_start_bridge(struct sata_gemini *sg, unsigned int bridge); 19 19 void gemini_sata_stop_bridge(struct sata_gemini *sg, unsigned int bridge); 20 - int gemini_sata_reset_bridge(struct sata_gemini *sg, unsigned int bridge); 21 20 22 21 #endif