Commit b8c32872 authored by Martin K. Petersen's avatar Martin K. Petersen

Merge patch series "Add support for Unisoc UFS host controller"

Zhe Wang <zhe.wang1@unisoc.com> says:

Add support for Unisoc UFS host controller.

Link: https://lore.kernel.org/r/20221209124121.20306-1-zhe.wang1@unisoc.comSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parents 2d95c6de df7320ba
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/ufs/sprd,ums9620-ufs.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Unisoc Universal Flash Storage (UFS) Controller
maintainers:
- Zhe Wang <zhe.wang1@unisoc.com>
allOf:
- $ref: ufs-common.yaml
properties:
compatible:
const: sprd,ums9620-ufs
reg:
maxItems: 1
clocks:
maxItems: 3
clock-names:
items:
- const: controller_eb
- const: cfg_eb
- const: core
resets:
maxItems: 2
reset-names:
items:
- const: controller
- const: device
vdd-mphy-supply:
description:
Phandle to vdd-mphy supply regulator node.
sprd,ufs-anlg-syscon:
$ref: /schemas/types.yaml#/definitions/phandle
description: phandle of syscon used to control ufs analog regs.
sprd,aon-apb-syscon:
$ref: /schemas/types.yaml#/definitions/phandle
description: phandle of syscon used to control always-on regs.
required:
- compatible
- reg
- clocks
- clock-names
- resets
- reset-names
unevaluatedProperties: false
examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
ufs: ufs@22000000 {
compatible = "sprd,ums9620-ufs";
reg = <0x22000000 0x3000>;
interrupts = <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>;
vcc-supply = <&vddemmccore>;
vdd-mphy-supply = <&vddufs1v2>;
clocks = <&apahb_gate 5>, <&apahb_gate 22>, <&aonapb_clk 52>;
clock-names = "controller_eb", "cfg_eb", "core";
assigned-clocks = <&aonapb_clk 52>;
assigned-clock-parents = <&g5l_pll 12>;
resets = <&apahb_gate 4>, <&aonapb_gate 69>;
reset-names = "controller", "device";
sprd,ufs-anlg-syscon = <&anlg_phy_g12_regs>;
sprd,aon-apb-syscon = <&aon_apb_regs>;
};
......@@ -128,3 +128,15 @@ config SCSI_UFS_EXYNOS
config SCSI_UFS_VARIABLE_SG_ENTRY_SIZE
bool
default y if SCSI_UFS_EXYNOS && SCSI_UFS_CRYPTO
config SCSI_UFS_SPRD
tristate "Unisoc specific hooks to UFS controller platform driver"
depends on SCSI_UFSHCD_PLATFORM && (ARCH_SPRD || COMPILE_TEST)
help
This selects the Unisoc specific additions to UFSHCD platform driver.
UFS host on Unisoc needs some vendor specific configuration before
accessing the hardware which includes PHY configuration and vendor
specific registers.
Select this if you have UFS controller on Unisoc chipset.
If unsure, say N.
......@@ -12,4 +12,5 @@ obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o
obj-$(CONFIG_SCSI_UFS_HISI) += ufs-hisi.o
obj-$(CONFIG_SCSI_UFS_MEDIATEK) += ufs-mediatek.o
obj-$(CONFIG_SCSI_UFS_RENESAS) += ufs-renesas.o
obj-$(CONFIG_SCSI_UFS_SPRD) += ufs-sprd.o
obj-$(CONFIG_SCSI_UFS_TI_J721E) += ti-j721e-ufs.o
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* UNISOC UFS Host Controller driver
*
* Copyright (C) 2022 Unisoc, Inc.
* Author: Zhe Wang <zhe.wang1@unisoc.com>
*/
#ifndef _UFS_SPRD_H_
#define _UFS_SPRD_H_
/* Vendor specific attributes */
#define RXSQCONTROL 0x8009
#define CBRATESEL 0x8114
#define CBCREGADDRLSB 0x8116
#define CBCREGADDRMSB 0x8117
#define CBCREGWRLSB 0x8118
#define CBCREGWRMSB 0x8119
#define CBCREGRDWRSEL 0x811C
#define CBCRCTRL 0x811F
#define CBREFCLKCTRL2 0x8132
#define VS_MPHYDISABLE 0xD0C1
#define APB_UFSDEV_REG 0xCE8
#define APB_UFSDEV_REFCLK_EN 0x2
#define APB_USB31PLL_CTRL 0xCFC
#define APB_USB31PLLV_REF2MPHY 0x1
#define SPRD_SIP_SVC_STORAGE_UFS_CRYPTO_ENABLE \
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
ARM_SMCCC_SMC_32, \
ARM_SMCCC_OWNER_SIP, \
0x0301)
enum SPRD_UFS_RST_INDEX {
SPRD_UFSHCI_SOFT_RST,
SPRD_UFS_DEV_RST,
SPRD_UFS_RST_MAX
};
enum SPRD_UFS_SYSCON_INDEX {
SPRD_UFS_ANLG,
SPRD_UFS_AON_APB,
SPRD_UFS_SYSCON_MAX
};
enum SPRD_UFS_VREG_INDEX {
SPRD_UFS_VDD_MPHY,
SPRD_UFS_VREG_MAX
};
struct ufs_sprd_rst {
const char *name;
struct reset_control *rc;
};
struct ufs_sprd_syscon {
const char *name;
struct regmap *regmap;
};
struct ufs_sprd_vreg {
const char *name;
struct regulator *vreg;
};
struct ufs_sprd_priv {
struct ufs_sprd_rst rci[SPRD_UFS_RST_MAX];
struct ufs_sprd_syscon sysci[SPRD_UFS_SYSCON_MAX];
struct ufs_sprd_vreg vregi[SPRD_UFS_VREG_MAX];
const struct ufs_hba_variant_ops ufs_hba_sprd_vops;
};
struct ufs_sprd_host {
struct ufs_hba *hba;
struct ufs_sprd_priv *priv;
void __iomem *ufs_dbg_mmio;
enum ufs_unipro_ver unipro_ver;
};
#endif /* _UFS_SPRD_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment