Skip to content

Commit 1f4c7df

Browse files
committed
Merge: ahci: driver update
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/730 JIRA: https://issues.redhat.com/browse/RHEL-72617 A driver update. Signed-off-by: Tomas Henzl <thenzl@redhat.com> Approved-by: Chris Leech <cleech@redhat.com> Approved-by: Ewan D. Milne <emilne@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Julio Faracco <jfaracco@redhat.com>
2 parents 69c5733 + ba06677 commit 1f4c7df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+534
-333
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3033,6 +3033,8 @@
30333033
* max_sec_lba48: Set or clear transfer size limit to
30343034
65535 sectors.
30353035

3036+
* external: Mark port as external (hotplug-capable).
3037+
30363038
* [no]lpm: Enable or disable link power management.
30373039

30383040
* [no]setxfer: Indicate if transfer speed mode setting

drivers/ata/ahci.c

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ enum board_ids {
6363
board_ahci_pcs_quirk_no_devslp,
6464
board_ahci_pcs_quirk_no_sntf,
6565
board_ahci_yes_fbs,
66+
board_ahci_yes_fbs_atapi_dma,
6667

6768
/* board IDs for specific chipsets in alphabetical order */
6869
board_ahci_al,
@@ -188,6 +189,14 @@ static const struct ata_port_info ahci_port_info[] = {
188189
.udma_mask = ATA_UDMA6,
189190
.port_ops = &ahci_ops,
190191
},
192+
[board_ahci_yes_fbs_atapi_dma] = {
193+
AHCI_HFLAGS (AHCI_HFLAG_YES_FBS |
194+
AHCI_HFLAG_ATAPI_DMA_QUIRK),
195+
.flags = AHCI_FLAG_COMMON,
196+
.pio_mask = ATA_PIO4,
197+
.udma_mask = ATA_UDMA6,
198+
.port_ops = &ahci_ops,
199+
},
191200
/* by chipsets */
192201
[board_ahci_al] = {
193202
AHCI_HFLAGS (AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_MSI),
@@ -589,6 +598,8 @@ static const struct pci_device_id ahci_pci_tbl[] = {
589598
.driver_data = board_ahci_yes_fbs },
590599
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3),
591600
.driver_data = board_ahci_yes_fbs },
601+
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9215),
602+
.driver_data = board_ahci_yes_fbs_atapi_dma },
592603
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230),
593604
.driver_data = board_ahci_yes_fbs },
594605
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9235),
@@ -1665,18 +1676,20 @@ static int ahci_get_irq_vector(struct ata_host *host, int port)
16651676
return pci_irq_vector(to_pci_dev(host->dev), port);
16661677
}
16671678

1668-
static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
1679+
static void ahci_init_irq(struct pci_dev *pdev, unsigned int n_ports,
16691680
struct ahci_host_priv *hpriv)
16701681
{
16711682
int nvec;
16721683

1673-
if (hpriv->flags & AHCI_HFLAG_NO_MSI)
1674-
return -ENODEV;
1684+
if (hpriv->flags & AHCI_HFLAG_NO_MSI) {
1685+
pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_INTX);
1686+
return;
1687+
}
16751688

16761689
/*
16771690
* If number of MSIs is less than number of ports then Sharing Last
16781691
* Message mode could be enforced. In this case assume that advantage
1679-
* of multipe MSIs is negated and use single MSI mode instead.
1692+
* of multiple MSIs is negated and use single MSI mode instead.
16801693
*/
16811694
if (n_ports > 1) {
16821695
nvec = pci_alloc_irq_vectors(pdev, n_ports, INT_MAX,
@@ -1685,7 +1698,7 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
16851698
if (!(readl(hpriv->mmio + HOST_CTL) & HOST_MRSM)) {
16861699
hpriv->get_irq_vector = ahci_get_irq_vector;
16871700
hpriv->flags |= AHCI_HFLAG_MULTI_MSI;
1688-
return nvec;
1701+
return;
16891702
}
16901703

16911704
/*
@@ -1700,12 +1713,13 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
17001713

17011714
/*
17021715
* If the host is not capable of supporting per-port vectors, fall
1703-
* back to single MSI before finally attempting single MSI-X.
1716+
* back to single MSI before finally attempting single MSI-X or
1717+
* a legacy INTx.
17041718
*/
17051719
nvec = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI);
17061720
if (nvec == 1)
1707-
return nvec;
1708-
return pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX);
1721+
return;
1722+
pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX | PCI_IRQ_INTX);
17091723
}
17101724

17111725
static void ahci_mark_external_port(struct ata_port *ap)
@@ -1985,10 +1999,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
19851999
}
19862000
host->private_data = hpriv;
19872001

1988-
if (ahci_init_msi(pdev, n_ports, hpriv) < 0) {
1989-
/* legacy intx interrupts */
1990-
pcim_intx(pdev, 1);
1991-
}
2002+
ahci_init_irq(pdev, n_ports, hpriv);
2003+
19922004
hpriv->irq = pci_irq_vector(pdev, 0);
19932005

19942006
if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss)

drivers/ata/ahci.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ enum {
246246
AHCI_HFLAG_NO_SXS = BIT(26), /* SXS not supported */
247247
AHCI_HFLAG_43BIT_ONLY = BIT(27), /* 43bit DMA addr limit */
248248
AHCI_HFLAG_INTEL_PCS_QUIRK = BIT(28), /* apply Intel PCS quirk */
249+
AHCI_HFLAG_ATAPI_DMA_QUIRK = BIT(29), /* force ATAPI to use DMA */
249250

250251
/* ap->flags bits */
251252

@@ -328,7 +329,7 @@ struct ahci_port_priv {
328329
struct ahci_host_priv {
329330
/* Input fields */
330331
unsigned int flags; /* AHCI_HFLAG_* */
331-
u32 mask_port_map; /* mask out particular bits */
332+
u32 mask_port_map; /* Mask of valid ports */
332333

333334
void __iomem * mmio; /* bus-independent mem map */
334335
u32 cap; /* cap to use */
@@ -379,6 +380,21 @@ struct ahci_host_priv {
379380
int port);
380381
};
381382

383+
/*
384+
* Return true if a port should be ignored because it is excluded from
385+
* the host port map.
386+
*/
387+
static inline bool ahci_ignore_port(struct ahci_host_priv *hpriv,
388+
unsigned int portid)
389+
{
390+
if (portid >= hpriv->nports)
391+
return true;
392+
/* mask_port_map not set means that all ports are available */
393+
if (!hpriv->mask_port_map)
394+
return false;
395+
return !(hpriv->mask_port_map & (1 << portid));
396+
}
397+
382398
extern int ahci_ignore_sss;
383399

384400
extern const struct attribute_group *ahci_shost_groups[];

drivers/ata/ahci_brcm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ static unsigned int brcm_ahci_read_id(struct ata_device *dev,
288288

289289
/* Re-initialize and calibrate the PHY */
290290
for (i = 0; i < hpriv->nports; i++) {
291+
if (ahci_ignore_port(hpriv, i))
292+
continue;
293+
291294
rc = phy_init(hpriv->phys[i]);
292295
if (rc)
293296
goto disable_phys;
@@ -571,7 +574,7 @@ static SIMPLE_DEV_PM_OPS(ahci_brcm_pm_ops, brcm_ahci_suspend, brcm_ahci_resume);
571574

572575
static struct platform_driver brcm_ahci_driver = {
573576
.probe = brcm_ahci_probe,
574-
.remove_new = brcm_ahci_remove,
577+
.remove = brcm_ahci_remove,
575578
.shutdown = brcm_ahci_shutdown,
576579
.driver = {
577580
.name = DRV_NAME,

drivers/ata/ahci_ceva.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ static int ceva_ahci_platform_enable_resources(struct ahci_host_priv *hpriv)
206206
goto disable_clks;
207207

208208
for (i = 0; i < hpriv->nports; i++) {
209+
if (ahci_ignore_port(hpriv, i))
210+
continue;
211+
209212
rc = phy_init(hpriv->phys[i]);
210213
if (rc)
211214
goto disable_rsts;
@@ -215,6 +218,9 @@ static int ceva_ahci_platform_enable_resources(struct ahci_host_priv *hpriv)
215218
ahci_platform_deassert_rsts(hpriv);
216219

217220
for (i = 0; i < hpriv->nports; i++) {
221+
if (ahci_ignore_port(hpriv, i))
222+
continue;
223+
218224
rc = phy_power_on(hpriv->phys[i]);
219225
if (rc) {
220226
phy_exit(hpriv->phys[i]);
@@ -402,7 +408,7 @@ MODULE_DEVICE_TABLE(of, ceva_ahci_of_match);
402408

403409
static struct platform_driver ceva_ahci_driver = {
404410
.probe = ceva_ahci_probe,
405-
.remove_new = ata_platform_remove_one,
411+
.remove = ata_platform_remove_one,
406412
.driver = {
407413
.name = DRV_NAME,
408414
.of_match_table = ceva_ahci_of_match,

drivers/ata/ahci_da850.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ MODULE_DEVICE_TABLE(of, ahci_da850_of_match);
238238

239239
static struct platform_driver ahci_da850_driver = {
240240
.probe = ahci_da850_probe,
241-
.remove_new = ata_platform_remove_one,
241+
.remove = ata_platform_remove_one,
242242
.driver = {
243243
.name = DRV_NAME,
244244
.of_match_table = ahci_da850_of_match,

drivers/ata/ahci_dm816.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ MODULE_DEVICE_TABLE(of, ahci_dm816_of_match);
182182

183183
static struct platform_driver ahci_dm816_driver = {
184184
.probe = ahci_dm816_probe,
185-
.remove_new = ata_platform_remove_one,
185+
.remove = ata_platform_remove_one,
186186
.driver = {
187187
.name = AHCI_DM816_DRV_NAME,
188188
.of_match_table = ahci_dm816_of_match,

drivers/ata/ahci_dwc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ MODULE_DEVICE_TABLE(of, ahci_dwc_of_match);
478478

479479
static struct platform_driver ahci_dwc_driver = {
480480
.probe = ahci_dwc_probe,
481-
.remove_new = ata_platform_remove_one,
481+
.remove = ata_platform_remove_one,
482482
.shutdown = ahci_platform_shutdown,
483483
.driver = {
484484
.name = DRV_NAME,

drivers/ata/ahci_imx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv)
511511

512512
if (imxpriv->type == AHCI_IMX6Q || imxpriv->type == AHCI_IMX6QP) {
513513
/*
514-
* set PHY Paremeters, two steps to configure the GPR13,
514+
* set PHY Parameters, two steps to configure the GPR13,
515515
* one write for rest of parameters, mask of first write
516516
* is 0x07ffffff, and the other one write for setting
517517
* the mpll_clk_en.
@@ -1027,7 +1027,7 @@ static SIMPLE_DEV_PM_OPS(ahci_imx_pm_ops, imx_ahci_suspend, imx_ahci_resume);
10271027

10281028
static struct platform_driver imx_ahci_driver = {
10291029
.probe = imx_ahci_probe,
1030-
.remove_new = ata_platform_remove_one,
1030+
.remove = ata_platform_remove_one,
10311031
.driver = {
10321032
.name = DRV_NAME,
10331033
.of_match_table = imx_ahci_of_match,

drivers/ata/ahci_mtk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ MODULE_DEVICE_TABLE(of, ahci_of_match);
174174

175175
static struct platform_driver mtk_ahci_driver = {
176176
.probe = mtk_ahci_probe,
177-
.remove_new = ata_platform_remove_one,
177+
.remove = ata_platform_remove_one,
178178
.driver = {
179179
.name = DRV_NAME,
180180
.of_match_table = ahci_of_match,

0 commit comments

Comments
 (0)