mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
scsi: ufs: core: Make DMA mask configuration more flexible
[ Upstream commit 78bc671bd1501e2f6c571e063301a4fdc5db53b2 ] Replace UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS with ufs_hba_variant_ops::set_dma_mask. Update the Renesas driver accordingly. This patch enables supporting other configurations than 32-bit or 64-bit DMA addresses, e.g. 36-bit DMA addresses. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20241018194753.775074-1-bvanassche@acm.org Reviewed-by: Avri Altman <Avri.Altman@wdc.com> Reviewed-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2991a02389
commit
6e8a13f27e
@@ -2230,8 +2230,6 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
|
|||||||
int err;
|
int err;
|
||||||
|
|
||||||
hba->capabilities = ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES);
|
hba->capabilities = ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES);
|
||||||
if (hba->quirks & UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS)
|
|
||||||
hba->capabilities &= ~MASK_64_ADDRESSING_SUPPORT;
|
|
||||||
|
|
||||||
/* nutrs and nutmrs are 0 based values */
|
/* nutrs and nutmrs are 0 based values */
|
||||||
hba->nutrs = (hba->capabilities & MASK_TRANSFER_REQUESTS_SLOTS) + 1;
|
hba->nutrs = (hba->capabilities & MASK_TRANSFER_REQUESTS_SLOTS) + 1;
|
||||||
@@ -9649,6 +9647,8 @@ EXPORT_SYMBOL_GPL(ufshcd_dealloc_host);
|
|||||||
*/
|
*/
|
||||||
static int ufshcd_set_dma_mask(struct ufs_hba *hba)
|
static int ufshcd_set_dma_mask(struct ufs_hba *hba)
|
||||||
{
|
{
|
||||||
|
if (hba->vops && hba->vops->set_dma_mask)
|
||||||
|
return hba->vops->set_dma_mask(hba);
|
||||||
if (hba->capabilities & MASK_64_ADDRESSING_SUPPORT) {
|
if (hba->capabilities & MASK_64_ADDRESSING_SUPPORT) {
|
||||||
if (!dma_set_mask_and_coherent(hba->dev, DMA_BIT_MASK(64)))
|
if (!dma_set_mask_and_coherent(hba->dev, DMA_BIT_MASK(64)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/iopoll.h>
|
#include <linux/iopoll.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
@@ -364,14 +365,20 @@ static int ufs_renesas_init(struct ufs_hba *hba)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
ufshcd_set_variant(hba, priv);
|
ufshcd_set_variant(hba, priv);
|
||||||
|
|
||||||
hba->quirks |= UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS | UFSHCD_QUIRK_HIBERN_FASTAUTO;
|
hba->quirks |= UFSHCD_QUIRK_HIBERN_FASTAUTO;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ufs_renesas_set_dma_mask(struct ufs_hba *hba)
|
||||||
|
{
|
||||||
|
return dma_set_mask_and_coherent(hba->dev, DMA_BIT_MASK(32));
|
||||||
|
}
|
||||||
|
|
||||||
static const struct ufs_hba_variant_ops ufs_renesas_vops = {
|
static const struct ufs_hba_variant_ops ufs_renesas_vops = {
|
||||||
.name = "renesas",
|
.name = "renesas",
|
||||||
.init = ufs_renesas_init,
|
.init = ufs_renesas_init,
|
||||||
|
.set_dma_mask = ufs_renesas_set_dma_mask,
|
||||||
.setup_clocks = ufs_renesas_setup_clocks,
|
.setup_clocks = ufs_renesas_setup_clocks,
|
||||||
.hce_enable_notify = ufs_renesas_hce_enable_notify,
|
.hce_enable_notify = ufs_renesas_hce_enable_notify,
|
||||||
.dbg_register_dump = ufs_renesas_dbg_register_dump,
|
.dbg_register_dump = ufs_renesas_dbg_register_dump,
|
||||||
|
|||||||
@@ -272,6 +272,8 @@ struct ufs_pwr_mode_info {
|
|||||||
* @name: variant name
|
* @name: variant name
|
||||||
* @init: called when the driver is initialized
|
* @init: called when the driver is initialized
|
||||||
* @exit: called to cleanup everything done in init
|
* @exit: called to cleanup everything done in init
|
||||||
|
* @set_dma_mask: For setting another DMA mask than indicated by the 64AS
|
||||||
|
* capability bit.
|
||||||
* @get_ufs_hci_version: called to get UFS HCI version
|
* @get_ufs_hci_version: called to get UFS HCI version
|
||||||
* @clk_scale_notify: notifies that clks are scaled up/down
|
* @clk_scale_notify: notifies that clks are scaled up/down
|
||||||
* @setup_clocks: called before touching any of the controller registers
|
* @setup_clocks: called before touching any of the controller registers
|
||||||
@@ -305,6 +307,7 @@ struct ufs_hba_variant_ops {
|
|||||||
int (*init)(struct ufs_hba *);
|
int (*init)(struct ufs_hba *);
|
||||||
void (*exit)(struct ufs_hba *);
|
void (*exit)(struct ufs_hba *);
|
||||||
u32 (*get_ufs_hci_version)(struct ufs_hba *);
|
u32 (*get_ufs_hci_version)(struct ufs_hba *);
|
||||||
|
int (*set_dma_mask)(struct ufs_hba *);
|
||||||
int (*clk_scale_notify)(struct ufs_hba *, bool,
|
int (*clk_scale_notify)(struct ufs_hba *, bool,
|
||||||
enum ufs_notify_change_status);
|
enum ufs_notify_change_status);
|
||||||
int (*setup_clocks)(struct ufs_hba *, bool,
|
int (*setup_clocks)(struct ufs_hba *, bool,
|
||||||
@@ -584,12 +587,6 @@ enum ufshcd_quirks {
|
|||||||
*/
|
*/
|
||||||
UFSHCD_QUIRK_SKIP_PH_CONFIGURATION = 1 << 16,
|
UFSHCD_QUIRK_SKIP_PH_CONFIGURATION = 1 << 16,
|
||||||
|
|
||||||
/*
|
|
||||||
* This quirk needs to be enabled if the host controller has
|
|
||||||
* 64-bit addressing supported capability but it doesn't work.
|
|
||||||
*/
|
|
||||||
UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS = 1 << 17,
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This quirk needs to be enabled if the host controller has
|
* This quirk needs to be enabled if the host controller has
|
||||||
* auto-hibernate capability but it's FASTAUTO only.
|
* auto-hibernate capability but it's FASTAUTO only.
|
||||||
|
|||||||
Reference in New Issue
Block a user