850-soc-add-qualcomm-syscon.patch 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. From: Christian Lamparter <[email protected]>
  2. Subject: SoC: add qualcomm syscon
  3. --- a/drivers/soc/qcom/Makefile
  4. +++ b/drivers/soc/qcom/Makefile
  5. @@ -26,6 +26,7 @@ obj-$(CONFIG_QCOM_SOCINFO) += socinfo.o
  6. obj-$(CONFIG_QCOM_SPM) += spm.o
  7. obj-$(CONFIG_QCOM_STATS) += qcom_stats.o
  8. obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o
  9. +obj-$(CONFIG_QCOM_TCSR) += qcom_tcsr.o
  10. obj-$(CONFIG_QCOM_APR) += apr.o
  11. obj-$(CONFIG_QCOM_LLCC) += llcc-qcom.o
  12. obj-$(CONFIG_QCOM_KRYO_L2_ACCESSORS) += kryo-l2-accessors.o
  13. --- a/drivers/soc/qcom/Kconfig
  14. +++ b/drivers/soc/qcom/Kconfig
  15. @@ -252,6 +252,13 @@ config QCOM_STATS
  16. various SoC level low power modes statistics and export to debugfs
  17. interface.
  18. +config QCOM_TCSR
  19. + tristate "QCOM Top Control and Status Registers"
  20. + depends on ARCH_QCOM
  21. + help
  22. + Say y here to enable TCSR support. The TCSR provides control
  23. + functions for various peripherals.
  24. +
  25. config QCOM_WCNSS_CTRL
  26. tristate "Qualcomm WCNSS control driver"
  27. depends on ARCH_QCOM || COMPILE_TEST
  28. --- /dev/null
  29. +++ b/drivers/soc/qcom/qcom_tcsr.c
  30. @@ -0,0 +1,61 @@
  31. +/*
  32. + * Copyright (c) 2014, The Linux foundation. All rights reserved.
  33. + *
  34. + * This program is free software; you can redistribute it and/or modify
  35. + * it under the terms of the GNU General Public License rev 2 and
  36. + * only rev 2 as published by the free Software foundation.
  37. + *
  38. + * This program is distributed in the hope that it will be useful,
  39. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  40. + * MERCHANTABILITY or fITNESS fOR A PARTICULAR PURPOSE. See the
  41. + * GNU General Public License for more details.
  42. + */
  43. +
  44. +#include <linux/clk.h>
  45. +#include <linux/err.h>
  46. +#include <linux/io.h>
  47. +#include <linux/module.h>
  48. +#include <linux/of.h>
  49. +#include <linux/of_platform.h>
  50. +#include <linux/platform_device.h>
  51. +
  52. +#define TCSR_USB_PORT_SEL 0xb0
  53. +
  54. +static int tcsr_probe(struct platform_device *pdev)
  55. +{
  56. + const struct device_node *node = pdev->dev.of_node;
  57. + void __iomem *base;
  58. + u32 val;
  59. +
  60. + base = devm_platform_ioremap_resource(pdev, 0);
  61. + if (IS_ERR(base))
  62. + return PTR_ERR(base);
  63. +
  64. + if (!of_property_read_u32(node, "qcom,usb-ctrl-select", &val)) {
  65. + dev_err(&pdev->dev, "setting usb port select = %d\n", val);
  66. + writel(val, base + TCSR_USB_PORT_SEL);
  67. + }
  68. +
  69. + return 0;
  70. +}
  71. +
  72. +static const struct of_device_id tcsr_dt_match[] = {
  73. + { .compatible = "qcom,tcsr", },
  74. + { },
  75. +};
  76. +
  77. +MODULE_DEVICE_TABLE(of, tcsr_dt_match);
  78. +
  79. +static struct platform_driver tcsr_driver = {
  80. + .driver = {
  81. + .name = "tcsr",
  82. + .of_match_table = tcsr_dt_match,
  83. + },
  84. + .probe = tcsr_probe,
  85. +};
  86. +
  87. +module_platform_driver(tcsr_driver);
  88. +
  89. +MODULE_AUTHOR("Andy Gross <[email protected]>");
  90. +MODULE_DESCRIPTION("QCOM TCSR driver");
  91. +MODULE_LICENSE("GPL v2");
  92. --- /dev/null
  93. +++ b/include/dt-bindings/soc/qcom,tcsr.h
  94. @@ -0,0 +1,23 @@
  95. +/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
  96. + *
  97. + * This program is free software; you can redistribute it and/or modify
  98. + * it under the terms of the GNU General Public License version 2 and
  99. + * only version 2 as published by the Free Software Foundation.
  100. + *
  101. + * This program is distributed in the hope that it will be useful,
  102. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  103. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  104. + * GNU General Public License for more details.
  105. + */
  106. +#ifndef __DT_BINDINGS_QCOM_TCSR_H
  107. +#define __DT_BINDINGS_QCOM_TCSR_H
  108. +
  109. +#define TCSR_USB_SELECT_USB3_P0 0x1
  110. +#define TCSR_USB_SELECT_USB3_P1 0x2
  111. +#define TCSR_USB_SELECT_USB3_DUAL 0x3
  112. +
  113. +/* TCSR A/B REG */
  114. +#define IPQ806X_TCSR_REG_A_ADM_CRCI_MUX_SEL 0
  115. +#define IPQ806X_TCSR_REG_B_ADM_CRCI_MUX_SEL 1
  116. +
  117. +#endif