diff mbox series

[2/2] dt-bindings: hwinfo: Add Qualcomm's board-id types

Message ID 1705749649-4708-3-git-send-email-quic_amrianan@quicinc.com
State New
Headers show
Series Add board-id support for multiple DT selection | expand

Commit Message

Amrit Anand Jan. 20, 2024, 11:20 a.m. UTC
Qualcomm based DT uses two or three different identifiers. The SoC
based idenfier which signifies chipset and the revision for those
chipsets. The board based identifier is used to distinguish different
boards (e.g. IDP, MTP) along with the different types of same boards.
The PMIC attached to the board can also be used as a identifier for
device tree.

Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Signed-off-by: Amrit Anand <quic_amrianan@quicinc.com>
---
 .../devicetree/bindings/hwinfo/qcom,board-id.yaml  | 86 ++++++++++++++++++++++
 include/dt-bindings/arm/qcom,ids.h                 | 68 +++++++++++++++--
 2 files changed, 146 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml

Comments

Konrad Dybcio Jan. 20, 2024, 1:32 p.m. UTC | #1
On 20.01.2024 12:20, Amrit Anand wrote:
> Qualcomm based DT uses two or three different identifiers. The SoC
> based idenfier which signifies chipset and the revision for those
> chipsets. The board based identifier is used to distinguish different
> boards (e.g. IDP, MTP) along with the different types of same boards.
> The PMIC attached to the board can also be used as a identifier for
> device tree.
> 
> Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
> Signed-off-by: Amrit Anand <quic_amrianan@quicinc.com>
> ---
>  .../devicetree/bindings/hwinfo/qcom,board-id.yaml  | 86 ++++++++++++++++++++++
>  include/dt-bindings/arm/qcom,ids.h                 | 68 +++++++++++++++--
>  2 files changed, 146 insertions(+), 8 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml
> 
> diff --git a/Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml b/Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml
> new file mode 100644
> index 0000000..807f134
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml
> @@ -0,0 +1,86 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/hwinfo/qcom,board-id.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: QCOM Board Identifier for Devicetree Selection
> +
> +maintainers:
> +  - Amrit Anand <quic_amrianan@quicinc.com>
> +  - Elliot Berman <quic_eberman@quicinc.com>
> +
> +description: |

The '|'s are unnecessary in both commits, IIRC they're used for
preserving formatting which we don't really need for non-styled
plaintext

> +  Qualcomm uses two and sometimes three hardware identifiers to describe
> +  its boards
> +      - a SoC identifier is used to match chipsets (e.g. sm8550 vs sm8450)
> +      - a board identifier is used to match board form factor (e.g. MTP, QRD,
> +        ADP, CRD)
> +      - a PMIC identifier is occasionally used when different PMICs are used
> +        for a given board/SoC combination.
> +  Each field and helper macros are defined at::
> +      - include/dt-bindings/arm/qcom,ids.h
> +
> +  For example,
> +    / {
> +        #board-id-cells = <2>;
> +        board-id = <456 0>, <457 0>, <10 0>;
> +        board-id-types = "qcom,soc-id", "qcom,soc-id", "qcom,board-id";
> +     }
> +
> +allOf:
> +  - $ref: board-id.yaml#
> +
> +properties:
> +  board-id:
> +    minItems: 2

I believe some older platforms match exclusively based on socid, so
perhaps 1 would be okay as well.

[...]

> +examples:
> +   - |
> +     #include <dt-bindings/arm/qcom,ids.h>
> +     / {
> +         model = "Qualcomm Technologies, Inc. sc7280 IDP SKU1 platform";
> +         compatible = "qcom,sc7280-idp", "google,senor", "qcom,sc7280";
> +
> +         #board-id-cells = <2>;
> +         board-id = <QCOM_SOC_ID(SC7280) QCOM_SOC_REVISION(1)>,
> +                    <QCOM_SOC_ID(SC7280) QCOM_SOC_REVISION(2)>,
> +                    <QCOM_BOARD_ID(IDP, 1, 0) QCOM_BOARD_SUBTYPE(UFS, ANY, 1)>;
> +         board-id-types = "qcom,soc-id",
> +                          "qcom,soc-id",
> +                          "qcom,board-id";

So, would the matching here would be:

loop over disctinct board-id-types
	check if there's at least 1 match for all of them
		use this dtb if that's the case

stop booting / "best guess match"

?

[...]

> +#define QCOM_BOARD_ID_MTP		0x8
> +#define QCOM_BOARD_ID_DRAGONBOARD	0x10
> +#define QCOM_BOARD_ID_QRD		0x11
> +#define QCOM_BOARD_ID_HDK		0x1F
> +#define QCOM_BOARD_ID_ATP		0x21
> +#define QCOM_BOARD_ID_IDP		0x22
> +#define QCOM_BOARD_ID_SBC		0x24
> +#define QCOM_BOARD_ID_QXR		0x26
> +#define QCOM_BOARD_ID_CRD		0x28

Missing ADP/QCP/Ride (if they're separate)

Konrad
kernel test robot Jan. 21, 2024, 2:05 a.m. UTC | #2
Hi Amrit,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v6.7 next-20240119]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Amrit-Anand/dt-bindings-hwinfo-Introduce-board-id/20240120-192358
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/1705749649-4708-3-git-send-email-quic_amrianan%40quicinc.com
patch subject: [PATCH 2/2] dt-bindings: hwinfo: Add Qualcomm's board-id types
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240121/202401210920.aPy2DJwj-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401210920.aPy2DJwj-lkp@intel.com/

dtcheck warnings: (new ones prefixed by >>)
>> Documentation/devicetree/bindings/hwinfo/board-id.yaml:23:11: [error] string value is redundantly quoted with any quotes (quoted-strings)
   Documentation/devicetree/bindings/hwinfo/board-id.yaml:25:11: [error] string value is redundantly quoted with any quotes (quoted-strings)
>> Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml:70:4: [warning] wrong indentation: expected 2 but found 3 (indentation)

vim +70 Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml

    68	
    69	examples:
  > 70	   - |
Elliot Berman Jan. 22, 2024, 6:12 p.m. UTC | #3
On 1/20/2024 3:20 AM, Amrit Anand wrote:
> Qualcomm based DT uses two or three different identifiers. The SoC
> based idenfier which signifies chipset and the revision for those
> chipsets. The board based identifier is used to distinguish different
> boards (e.g. IDP, MTP) along with the different types of same boards.
> The PMIC attached to the board can also be used as a identifier for
> device tree.
> 
> Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
> Signed-off-by: Amrit Anand <quic_amrianan@quicinc.com>
> ---
>  .../devicetree/bindings/hwinfo/qcom,board-id.yaml  | 86 ++++++++++++++++++++++
>  include/dt-bindings/arm/qcom,ids.h                 | 68 +++++++++++++++--
>  2 files changed, 146 insertions(+), 8 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml
> 
> diff --git a/Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml b/Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml
> new file mode 100644
> index 0000000..807f134
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml
> @@ -0,0 +1,86 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/hwinfo/qcom,board-id.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: QCOM Board Identifier for Devicetree Selection
> +
> +maintainers:
> +  - Amrit Anand <quic_amrianan@quicinc.com>
> +  - Elliot Berman <quic_eberman@quicinc.com>
> +
> +description: |
> +  Qualcomm uses two and sometimes three hardware identifiers to describe
> +  its boards
> +      - a SoC identifier is used to match chipsets (e.g. sm8550 vs sm8450)
> +      - a board identifier is used to match board form factor (e.g. MTP, QRD,
> +        ADP, CRD)
> +      - a PMIC identifier is occasionally used when different PMICs are used
> +        for a given board/SoC combination.
> +  Each field and helper macros are defined at::
> +      - include/dt-bindings/arm/qcom,ids.h
> +
> +  For example,
> +    / {
> +        #board-id-cells = <2>;
> +        board-id = <456 0>, <457 0>, <10 0>;
> +        board-id-types = "qcom,soc-id", "qcom,soc-id", "qcom,board-id";
> +     }
> +
> +allOf:
> +  - $ref: board-id.yaml#
> +

There's nothing to cause this binding to be selected.

Please add a select clause. I guess we can make it based off
whether the board's compatible contains "qcom,".

> +properties:
> +  board-id:
> +    minItems: 2
> +
> +  board-id-types:
> +    minItems: 2
> +    items:
> +      oneOf:
> +        - const: qcom,soc-id
> +          description: |
> +            Matches Qualcomm Technologies, Inc. boards with the specified SoC.
> +            2 integers are needed to describe a soc-id. The first integer is the
> +            SoC ID and the second integer is the SoC revision.
> +            qcom,soc-id = <soc-id  soc-revision>
> +        - const: qcom,board-id
> +          description: |
> +            Matches Qualcomm Technologies, Inc. boards with the specified board.
> +            2 integers are needed to describe a board-id. The first integer is the
> +            board ID. The second integer is the board-subtype.
> +            qcom,board-id = <board-id  board-subtype>
> +        - const: qcom,pmic-id
> +          description: |
> +            QUALCOMM boards can be atached to mutliple PMICs where slave-id (SID)
> +            indicates the address of the bus on which the PMIC is attached. It can be
> +            any number. The model for a PMIC indicates the PMIC name attached to bus
> +            described by SID along with  major and minor version. 2 integers are needed
> +            to describe qcom,pmic-id. The first integer is the slave-id and the second integer
> +            is the pmic model.
> +            qcom,pmic-id = <pmic-sid pmic-model>
> +
> +  '#board-id-cells':
> +    minimum: 2
> +
> +additionalProperties: true
> +
> +examples:
> +   - |
> +     #include <dt-bindings/arm/qcom,ids.h>
> +     / {
> +         model = "Qualcomm Technologies, Inc. sc7280 IDP SKU1 platform";
> +         compatible = "qcom,sc7280-idp", "google,senor", "qcom,sc7280";
> +
> +         #board-id-cells = <2>;
> +         board-id = <QCOM_SOC_ID(SC7280) QCOM_SOC_REVISION(1)>,
> +                    <QCOM_SOC_ID(SC7280) QCOM_SOC_REVISION(2)>,
> +                    <QCOM_BOARD_ID(IDP, 1, 0) QCOM_BOARD_SUBTYPE(UFS, ANY, 1)>;
> +         board-id-types = "qcom,soc-id",
> +                          "qcom,soc-id",
> +                          "qcom,board-id";
> +
> +         #address-cells = <2>;
> +         #size-cells = <2>;
> +      };
> diff --git a/include/dt-bindings/arm/qcom,ids.h b/include/dt-bindings/arm/qcom,ids.h
> index f724834..c4cd440 100644
> --- a/include/dt-bindings/arm/qcom,ids.h
> +++ b/include/dt-bindings/arm/qcom,ids.h
> @@ -8,9 +8,12 @@
>  #define _DT_BINDINGS_ARM_QCOM_IDS_H
>  
>  /*
> - * The MSM chipset and hardware revision used by Qualcomm bootloaders, DTS for
> - * older chipsets (qcom,msm-id) and in socinfo driver:
> + * The MSM chipset ID used by Qualcomm bootloaders, DTS for
> + * older chipsets (soc-id) and in socinfo driver:
>   */
> +
> +#define QCOM_SOC_ID(a)  ((QCOM_ID_##a) && 0xffff)
> +
>  #define QCOM_ID_MSM8260			70
>  #define QCOM_ID_MSM8660			71
>  #define QCOM_ID_APQ8060			86
> @@ -266,16 +269,65 @@
>  #define QCOM_ID_IPQ5302			595
>  #define QCOM_ID_IPQ5300			624
>  
> + /* The SOC revision used by Qualcomm bootloaders (soc-revision) */
> +
> +#define QCOM_SOC_REVISION(a)		(a & 0xff)
> +
>  /*
>   * The board type and revision information, used by Qualcomm bootloaders and
> - * DTS for older chipsets (qcom,board-id):
> + * DTS for older chipsets (board-id)
>   */
> +
>  #define QCOM_BOARD_ID(a, major, minor) \
> -	(((major & 0xff) << 16) | ((minor & 0xff) << 8) | QCOM_BOARD_ID_##a)
> +	(((major & 0xff) << 16) | ((minor & 0xff) << 8) | ((QCOM_BOARD_ID_##a) & 0xff))
> +
> +#define QCOM_BOARD_ID_MTP		0x8
> +#define QCOM_BOARD_ID_DRAGONBOARD	0x10
> +#define QCOM_BOARD_ID_QRD		0x11
> +#define QCOM_BOARD_ID_HDK		0x1F
> +#define QCOM_BOARD_ID_ATP		0x21
> +#define QCOM_BOARD_ID_IDP		0x22
> +#define QCOM_BOARD_ID_SBC		0x24
> +#define QCOM_BOARD_ID_QXR		0x26
> +#define QCOM_BOARD_ID_CRD		0x28
> +
> +/*
> + * The platform subtype is used by Qualcomm bootloaders and
> + * DTS (board-subtype)
> + */
> +#define QCOM_BOARD_SUBTYPE(a, b, SUBTYPE) \
> +	(((QCOM_BOARD_BOOT_##a & 0xf) << 16) | ((QCOM_BOARD_DDRTYPE_##b & 0x7) << 8) | \
> +	(SUBTYPE & 0xff))
> +
> +/* Board DDR Type where each value indicates higher limit */
> +#define QCOM_BOARD_DDRTYPE_ANY		0x0
> +#define QCOM_BOARD_DDRTYPE_128M		0x1
> +#define QCOM_BOARD_DDRTYPE_256M		0x2
> +#define QCOM_BOARD_DDRTYPE_512M		0x3
> +#define QCOM_BOARD_DDRTYPE_1024M	0x4
> +#define QCOM_BOARD_DDRTYPE_2048M	0x5
> +#define QCOM_BOARD_DDRTYPE_3072M	0x6
> +#define QCOM_BOARD_DDRTYPE_4096M	0x7
> +
> +/* Board Boot Device Type */
> +#define QCOM_BOARD_BOOT_EMMC		0x0
> +#define QCOM_BOARD_BOOT_UFS		0x1
> +#define QCOM_BOARD_BOOT_NAND		0x2
> +#define QCOM_BOARD_BOOT_OTHER		0x3
> +
> +/*
> + * The PMIC slave id is used by Qualcomm bootloaders to
> + * indicates which PMIC is attached (pmic-sid)
> + */
> +
> +#define QCOM_PMIC_SID(a)		(a & 0xff)
> +
> +/*
> + * The PMIC ID is used by Qualcomm bootloaders to describe the ID
> + * of PMIC attached to bus described by SID (pmic-model)
> + */
>  
> -#define QCOM_BOARD_ID_MTP			8
> -#define QCOM_BOARD_ID_DRAGONBOARD		10
> -#define QCOM_BOARD_ID_QRD			11
> -#define QCOM_BOARD_ID_SBC			24
> +#define QCOM_PMIC_MODEL(ID, major, minor) \
> +	(((major & 0xff) << 16) | ((minor & 0xff) << 8) | (ID & 0xff))
>  
>  #endif /* _DT_BINDINGS_ARM_QCOM_IDS_H */
Amrit Anand Jan. 24, 2024, 12:47 p.m. UTC | #4
On 1/22/2024 11:40 PM, Elliot Berman wrote:
>
> On 1/22/2024 2:07 AM, Amrit Anand wrote:
>> On 1/20/2024 7:02 PM, Konrad Dybcio wrote:
>>> On 20.01.2024 12:20, Amrit Anand wrote:
>>>> Qualcomm based DT uses two or three different identifiers. The SoC
>>>> based idenfier which signifies chipset and the revision for those
>>>> chipsets. The board based identifier is used to distinguish different
>>>> boards (e.g. IDP, MTP) along with the different types of same boards.
>>>> The PMIC attached to the board can also be used as a identifier for
>>>> device tree.
>>>>
>>>> Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
>>>> Signed-off-by: Amrit Anand <quic_amrianan@quicinc.com>
>>>> ---
>>>>    .../devicetree/bindings/hwinfo/qcom,board-id.yaml  | 86 ++++++++++++++++++++++
>>>>    include/dt-bindings/arm/qcom,ids.h                 | 68 +++++++++++++++--
>>>>    2 files changed, 146 insertions(+), 8 deletions(-)
>>>>    create mode 100644 Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml b/Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml
>>>> new file mode 100644
>>>> index 0000000..807f134
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml
>>>> @@ -0,0 +1,86 @@
>>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>>> +%YAML 1.2
>>>> +---
>>>> +$id: http://devicetree.org/schemas/hwinfo/qcom,board-id.yaml#
>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>> +
>>>> +title: QCOM Board Identifier for Devicetree Selection
>>>> +
>>>> +maintainers:
>>>> +  - Amrit Anand <quic_amrianan@quicinc.com>
>>>> +  - Elliot Berman <quic_eberman@quicinc.com>
>>>> +
>>>> +description: |
>>> The '|'s are unnecessary in both commits, IIRC they're used for
>>> preserving formatting which we don't really need for non-styled
>>> plaintext
>> Sure, will do.
>>>> +  Qualcomm uses two and sometimes three hardware identifiers to describe
>>>> +  its boards
>>>> +      - a SoC identifier is used to match chipsets (e.g. sm8550 vs sm8450)
>>>> +      - a board identifier is used to match board form factor (e.g. MTP, QRD,
>>>> +        ADP, CRD)
>>>> +      - a PMIC identifier is occasionally used when different PMICs are used
>>>> +        for a given board/SoC combination.
>>>> +  Each field and helper macros are defined at::
>>>> +      - include/dt-bindings/arm/qcom,ids.h
>>>> +
>>>> +  For example,
>>>> +    / {
>>>> +        #board-id-cells = <2>;
>>>> +        board-id = <456 0>, <457 0>, <10 0>;
>>>> +        board-id-types = "qcom,soc-id", "qcom,soc-id", "qcom,board-id";
>>>> +     }
>>>> +
>>>> +allOf:
>>>> +  - $ref: board-id.yaml#
>>>> +
>>>> +properties:
>>>> +  board-id:
>>>> +    minItems: 2
>>> I believe some older platforms match exclusively based on socid, so
>>> perhaps 1 would be okay as well.
>>>
>>> [...]
>> Ok, considering legacy targets we can make it 1.
>>
>> But i think ideally it should always be recommended to have a board ID associated with a SoC ID, correct me if my understanding is wrong.
>>
> There is no "legacy" support needed here: Qualcomm's bootloaders
> need to be updated to adhere to the new proposed spec. I suppose
> we need to consider whether we have targets that only need SoC to
> differentiate?
>
>>>> +examples:
>>>> +   - |
>>>> +     #include <dt-bindings/arm/qcom,ids.h>
>>>> +     / {
>>>> +         model = "Qualcomm Technologies, Inc. sc7280 IDP SKU1 platform";
>>>> +         compatible = "qcom,sc7280-idp", "google,senor", "qcom,sc7280";
>>>> +
>>>> +         #board-id-cells = <2>;
>>>> +         board-id = <QCOM_SOC_ID(SC7280) QCOM_SOC_REVISION(1)>,
>>>> +                    <QCOM_SOC_ID(SC7280) QCOM_SOC_REVISION(2)>,
>>>> +                    <QCOM_BOARD_ID(IDP, 1, 0) QCOM_BOARD_SUBTYPE(UFS, ANY, 1)>;
>>>> +         board-id-types = "qcom,soc-id",
>>>> +                          "qcom,soc-id",
>>>> +                          "qcom,board-id";
>>> So, would the matching here would be:
>>>
>>> loop over disctinct board-id-types
>>>      check if there's at least 1 match for all of them
>>>          use this dtb if that's the case
>>>
>>> stop booting / "best guess match"
>>>
>>> ?
>>>
>>> [...]
>> Yes, But the "if" checking would have preference in place.
>> The preference logic would look something like this,
>>
>> First will check for SoC-ID, if we have an exact match for SoC-ID then will proceed for board-ID match. Otherwise the DT would be discarded.
>> Once (exact) board-ID found, will proceed for subtype , pmic and so on.
>> Exact match and best match logic is used. Parameters like SoC-ID, board-ID are required to be best matched. Other few fields follow best match logic and best of the DT can be picked.
>>
>>>> +#define QCOM_BOARD_ID_MTP        0x8
>>>> +#define QCOM_BOARD_ID_DRAGONBOARD    0x10
>>>> +#define QCOM_BOARD_ID_QRD        0x11
>>>> +#define QCOM_BOARD_ID_HDK        0x1F
>>>> +#define QCOM_BOARD_ID_ATP        0x21
>>>> +#define QCOM_BOARD_ID_IDP        0x22
>>>> +#define QCOM_BOARD_ID_SBC        0x24
>>>> +#define QCOM_BOARD_ID_QXR        0x26
>>>> +#define QCOM_BOARD_ID_CRD        0x28
>>> Missing ADP/QCP/Ride (if they're separate)
>> Sure, will update. Would need to work with teams.
> There are probably more boards that we aren't aware of.
>
> Amrit, please add board IDs for all the boards that are
> in kernel.org.

Sure, will do that.

Thanks,
Amrit
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml b/Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml
new file mode 100644
index 0000000..807f134
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwinfo/qcom,board-id.yaml
@@ -0,0 +1,86 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwinfo/qcom,board-id.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: QCOM Board Identifier for Devicetree Selection
+
+maintainers:
+  - Amrit Anand <quic_amrianan@quicinc.com>
+  - Elliot Berman <quic_eberman@quicinc.com>
+
+description: |
+  Qualcomm uses two and sometimes three hardware identifiers to describe
+  its boards
+      - a SoC identifier is used to match chipsets (e.g. sm8550 vs sm8450)
+      - a board identifier is used to match board form factor (e.g. MTP, QRD,
+        ADP, CRD)
+      - a PMIC identifier is occasionally used when different PMICs are used
+        for a given board/SoC combination.
+  Each field and helper macros are defined at::
+      - include/dt-bindings/arm/qcom,ids.h
+
+  For example,
+    / {
+        #board-id-cells = <2>;
+        board-id = <456 0>, <457 0>, <10 0>;
+        board-id-types = "qcom,soc-id", "qcom,soc-id", "qcom,board-id";
+     }
+
+allOf:
+  - $ref: board-id.yaml#
+
+properties:
+  board-id:
+    minItems: 2
+
+  board-id-types:
+    minItems: 2
+    items:
+      oneOf:
+        - const: qcom,soc-id
+          description: |
+            Matches Qualcomm Technologies, Inc. boards with the specified SoC.
+            2 integers are needed to describe a soc-id. The first integer is the
+            SoC ID and the second integer is the SoC revision.
+            qcom,soc-id = <soc-id  soc-revision>
+        - const: qcom,board-id
+          description: |
+            Matches Qualcomm Technologies, Inc. boards with the specified board.
+            2 integers are needed to describe a board-id. The first integer is the
+            board ID. The second integer is the board-subtype.
+            qcom,board-id = <board-id  board-subtype>
+        - const: qcom,pmic-id
+          description: |
+            QUALCOMM boards can be atached to mutliple PMICs where slave-id (SID)
+            indicates the address of the bus on which the PMIC is attached. It can be
+            any number. The model for a PMIC indicates the PMIC name attached to bus
+            described by SID along with  major and minor version. 2 integers are needed
+            to describe qcom,pmic-id. The first integer is the slave-id and the second integer
+            is the pmic model.
+            qcom,pmic-id = <pmic-sid pmic-model>
+
+  '#board-id-cells':
+    minimum: 2
+
+additionalProperties: true
+
+examples:
+   - |
+     #include <dt-bindings/arm/qcom,ids.h>
+     / {
+         model = "Qualcomm Technologies, Inc. sc7280 IDP SKU1 platform";
+         compatible = "qcom,sc7280-idp", "google,senor", "qcom,sc7280";
+
+         #board-id-cells = <2>;
+         board-id = <QCOM_SOC_ID(SC7280) QCOM_SOC_REVISION(1)>,
+                    <QCOM_SOC_ID(SC7280) QCOM_SOC_REVISION(2)>,
+                    <QCOM_BOARD_ID(IDP, 1, 0) QCOM_BOARD_SUBTYPE(UFS, ANY, 1)>;
+         board-id-types = "qcom,soc-id",
+                          "qcom,soc-id",
+                          "qcom,board-id";
+
+         #address-cells = <2>;
+         #size-cells = <2>;
+      };
diff --git a/include/dt-bindings/arm/qcom,ids.h b/include/dt-bindings/arm/qcom,ids.h
index f724834..c4cd440 100644
--- a/include/dt-bindings/arm/qcom,ids.h
+++ b/include/dt-bindings/arm/qcom,ids.h
@@ -8,9 +8,12 @@ 
 #define _DT_BINDINGS_ARM_QCOM_IDS_H
 
 /*
- * The MSM chipset and hardware revision used by Qualcomm bootloaders, DTS for
- * older chipsets (qcom,msm-id) and in socinfo driver:
+ * The MSM chipset ID used by Qualcomm bootloaders, DTS for
+ * older chipsets (soc-id) and in socinfo driver:
  */
+
+#define QCOM_SOC_ID(a)  ((QCOM_ID_##a) && 0xffff)
+
 #define QCOM_ID_MSM8260			70
 #define QCOM_ID_MSM8660			71
 #define QCOM_ID_APQ8060			86
@@ -266,16 +269,65 @@ 
 #define QCOM_ID_IPQ5302			595
 #define QCOM_ID_IPQ5300			624
 
+ /* The SOC revision used by Qualcomm bootloaders (soc-revision) */
+
+#define QCOM_SOC_REVISION(a)		(a & 0xff)
+
 /*
  * The board type and revision information, used by Qualcomm bootloaders and
- * DTS for older chipsets (qcom,board-id):
+ * DTS for older chipsets (board-id)
  */
+
 #define QCOM_BOARD_ID(a, major, minor) \
-	(((major & 0xff) << 16) | ((minor & 0xff) << 8) | QCOM_BOARD_ID_##a)
+	(((major & 0xff) << 16) | ((minor & 0xff) << 8) | ((QCOM_BOARD_ID_##a) & 0xff))
+
+#define QCOM_BOARD_ID_MTP		0x8
+#define QCOM_BOARD_ID_DRAGONBOARD	0x10
+#define QCOM_BOARD_ID_QRD		0x11
+#define QCOM_BOARD_ID_HDK		0x1F
+#define QCOM_BOARD_ID_ATP		0x21
+#define QCOM_BOARD_ID_IDP		0x22
+#define QCOM_BOARD_ID_SBC		0x24
+#define QCOM_BOARD_ID_QXR		0x26
+#define QCOM_BOARD_ID_CRD		0x28
+
+/*
+ * The platform subtype is used by Qualcomm bootloaders and
+ * DTS (board-subtype)
+ */
+#define QCOM_BOARD_SUBTYPE(a, b, SUBTYPE) \
+	(((QCOM_BOARD_BOOT_##a & 0xf) << 16) | ((QCOM_BOARD_DDRTYPE_##b & 0x7) << 8) | \
+	(SUBTYPE & 0xff))
+
+/* Board DDR Type where each value indicates higher limit */
+#define QCOM_BOARD_DDRTYPE_ANY		0x0
+#define QCOM_BOARD_DDRTYPE_128M		0x1
+#define QCOM_BOARD_DDRTYPE_256M		0x2
+#define QCOM_BOARD_DDRTYPE_512M		0x3
+#define QCOM_BOARD_DDRTYPE_1024M	0x4
+#define QCOM_BOARD_DDRTYPE_2048M	0x5
+#define QCOM_BOARD_DDRTYPE_3072M	0x6
+#define QCOM_BOARD_DDRTYPE_4096M	0x7
+
+/* Board Boot Device Type */
+#define QCOM_BOARD_BOOT_EMMC		0x0
+#define QCOM_BOARD_BOOT_UFS		0x1
+#define QCOM_BOARD_BOOT_NAND		0x2
+#define QCOM_BOARD_BOOT_OTHER		0x3
+
+/*
+ * The PMIC slave id is used by Qualcomm bootloaders to
+ * indicates which PMIC is attached (pmic-sid)
+ */
+
+#define QCOM_PMIC_SID(a)		(a & 0xff)
+
+/*
+ * The PMIC ID is used by Qualcomm bootloaders to describe the ID
+ * of PMIC attached to bus described by SID (pmic-model)
+ */
 
-#define QCOM_BOARD_ID_MTP			8
-#define QCOM_BOARD_ID_DRAGONBOARD		10
-#define QCOM_BOARD_ID_QRD			11
-#define QCOM_BOARD_ID_SBC			24
+#define QCOM_PMIC_MODEL(ID, major, minor) \
+	(((major & 0xff) << 16) | ((minor & 0xff) << 8) | (ID & 0xff))
 
 #endif /* _DT_BINDINGS_ARM_QCOM_IDS_H */