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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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,64 @@
  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. + struct resource *res;
  57. + const struct device_node *node = pdev->dev.of_node;
  58. + void __iomem *base;
  59. + u32 val;
  60. +
  61. + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  62. + base = devm_ioremap_resource(&pdev->dev, res);
  63. + if (IS_ERR(base))
  64. + return PTR_ERR(base);
  65. +
  66. + if (!of_property_read_u32(node, "qcom,usb-ctrl-select", &val)) {
  67. + dev_err(&pdev->dev, "setting usb port select = %d\n", val);
  68. + writel(val, base + TCSR_USB_PORT_SEL);
  69. + }
  70. +
  71. + return 0;
  72. +}
  73. +
  74. +static const struct of_device_id tcsr_dt_match[] = {
  75. + { .compatible = "qcom,tcsr", },
  76. + { },
  77. +};
  78. +
  79. +MODULE_DEVICE_TABLE(of, tcsr_dt_match);
  80. +
  81. +static struct platform_driver tcsr_driver = {
  82. + .driver = {
  83. + .name = "tcsr",
  84. + .owner = THIS_MODULE,
  85. + .of_match_table = tcsr_dt_match,
  86. + },
  87. + .probe = tcsr_probe,
  88. +};
  89. +
  90. +module_platform_driver(tcsr_driver);
  91. +
  92. +MODULE_AUTHOR("Andy Gross <[email protected]>");
  93. +MODULE_DESCRIPTION("QCOM TCSR driver");
  94. +MODULE_LICENSE("GPL v2");
  95. --- /dev/null
  96. +++ b/include/dt-bindings/soc/qcom,tcsr.h
  97. @@ -0,0 +1,23 @@
  98. +/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
  99. + *
  100. + * This program is free software; you can redistribute it and/or modify
  101. + * it under the terms of the GNU General Public License version 2 and
  102. + * only version 2 as published by the Free Software Foundation.
  103. + *
  104. + * This program is distributed in the hope that it will be useful,
  105. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  106. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  107. + * GNU General Public License for more details.
  108. + */
  109. +#ifndef __DT_BINDINGS_QCOM_TCSR_H
  110. +#define __DT_BINDINGS_QCOM_TCSR_H
  111. +
  112. +#define TCSR_USB_SELECT_USB3_P0 0x1
  113. +#define TCSR_USB_SELECT_USB3_P1 0x2
  114. +#define TCSR_USB_SELECT_USB3_DUAL 0x3
  115. +
  116. +/* TCSR A/B REG */
  117. +#define IPQ806X_TCSR_REG_A_ADM_CRCI_MUX_SEL 0
  118. +#define IPQ806X_TCSR_REG_B_ADM_CRCI_MUX_SEL 1
  119. +
  120. +#endif