aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-14 20:29:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-14 20:29:55 -0400
commitf0c1bc95a108b36677dde6c9d96a5bb810a05b75 (patch)
tree335c33469407d0ebda5670dabb49c6ecad64263e
parent1dcf58d6e6e6eb7ec10e9abc56887b040205b06f (diff)
parente554a99ee8d09132e80dc467433c9a4df9054645 (diff)
Merge tag 'mfd-for-linus-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones: "Changes to existing drivers: - Rename child driver [axp288_battery => axp288_fuel_gauge]; axp20x - Rename child driver [max77693-flash => max77693-led]; max77693 - Error handling fixes; intel_soc_pmic - GPIO tweaking; intel_soc_pmic - Remove non-DT code; vexpress-sysreg, tc3589x - Remove unused/legacy code; ti_am335x_tscadc, rts5249, rtsx_gops, rtsx_pcr, rtc-s5m, sec-core, max77693, menelaus, wm5102-tables - Trivial fixups; rtsx_pci, da9150-core, sec-core, max7769, max77693, mc13xxx-core, dln2, hi6421-pmic-core, rk808, twl4030-power, lpc_ich, menelaus, twl6040 - Update register/address values; rts5227, rts5249 - DT and/or binding document fixups; arizona, da9150, mt6397, axp20x, qcom-rpm, qcom-spmi-pmic - Couple of trivial core Kconfig fixups - Remove use of seq_printf return value; ab8500-debugfs - Remove __exit markups; menelaus, tps65010 - Fix platform-device name collisions; mfd-core New drivers/supported devices: - Add support for wm8280/wm8281 into arizona - Add support for COMe-cBL6 into kempld-core - Add support for rts524a and rts525a into rts5249 - Add support for ipq8064 into qcom_rpm - Add support for extcon into axp20x - New MediaTek MT6397 PMIC driver - New Maxim MAX77843 PMIC dirver - New Intel Quark X1000 I2C-GPIO driver - New Skyworks SKY81452 driver" * tag 'mfd-for-linus-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (76 commits) mfd: sec: Fix RTC alarm interrupt number on S2MPS11 mfd: wm5102: Remove registers for output 3R from readable list mfd: tps65010: Remove incorrect __exit markups mfd: devicetree: bindings: Add Qualcomm RPM regulator subnodes mfd: axp20x: Add support for extcon cell mfd: lpc_ich: Sort IDs mfd: twl6040: Remove wrong and unneeded "platform:twl6040" modalias mfd: qcom-spmi-pmic: Add specific compatible strings for Qualcomm's SPMI PMIC's mfd: axp20x: Fix duplicate const for model names mfd: menelaus: Use macro for magic number mfd: menelaus: Drop support for SW controller VCORE mfd: menelaus: Delete omap_has_menelaus mfd: arizona: Correct type of gpio_defaults mfd: lpc_ich: Sort IDs mfd: Fix a typo in Kconfig mfd: qcom_rpm: Add support for IPQ8064 mfd: devicetree: qcom_rpm: Document IPQ8064 resources mfd: core: Fix platform-device name collisions mfd: intel_quark_i2c_gpio: Don't crash if !DMI dt-bindings: Add vendor-prefix for X-Powers ...
-rw-r--r--Documentation/devicetree/bindings/i2c/trivial-devices.txt1
-rw-r--r--Documentation/devicetree/bindings/mfd/arizona.txt41
-rw-r--r--Documentation/devicetree/bindings/mfd/axp20x.txt96
-rw-r--r--Documentation/devicetree/bindings/mfd/da9150.txt43
-rw-r--r--Documentation/devicetree/bindings/mfd/mt6397.txt70
-rw-r--r--Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt19
-rw-r--r--Documentation/devicetree/bindings/mfd/qcom-rpm.txt218
-rw-r--r--Documentation/devicetree/bindings/mfd/sky81452.txt35
-rw-r--r--Documentation/devicetree/bindings/vendor-prefixes.txt2
-rw-r--r--Documentation/devicetree/bindings/video/backlight/sky81452-backlight.txt29
-rw-r--r--drivers/extcon/extcon-arizona.c1
-rw-r--r--drivers/gpio/Kconfig1
-rw-r--r--drivers/gpio/gpio-arizona.c1
-rw-r--r--drivers/gpio/gpio-tc3589x.c3
-rw-r--r--drivers/input/keyboard/tc3589x-keypad.c9
-rw-r--r--drivers/mfd/Kconfig58
-rw-r--r--drivers/mfd/Makefile6
-rw-r--r--drivers/mfd/ab8500-debugfs.c196
-rw-r--r--drivers/mfd/arizona-core.c25
-rw-r--r--drivers/mfd/arizona-i2c.c2
-rw-r--r--drivers/mfd/arizona-irq.c1
-rw-r--r--drivers/mfd/arizona-spi.c2
-rw-r--r--drivers/mfd/axp20x.c30
-rw-r--r--drivers/mfd/da9052-irq.c2
-rw-r--r--drivers/mfd/da9052-spi.c6
-rw-r--r--drivers/mfd/da9150-core.c2
-rw-r--r--drivers/mfd/dln2.c2
-rw-r--r--drivers/mfd/hi6421-pmic-core.c2
-rw-r--r--drivers/mfd/intel_quark_i2c_gpio.c282
-rw-r--r--drivers/mfd/intel_soc_pmic_core.c14
-rw-r--r--drivers/mfd/kempld-core.c11
-rw-r--r--drivers/mfd/lpc_ich.c174
-rw-r--r--drivers/mfd/max77693.c4
-rw-r--r--drivers/mfd/max77843.c243
-rw-r--r--drivers/mfd/mc13xxx-core.c6
-rw-r--r--drivers/mfd/menelaus.c29
-rw-r--r--drivers/mfd/mfd-core.c2
-rw-r--r--drivers/mfd/mt6397-core.c227
-rw-r--r--drivers/mfd/qcom-spmi-pmic.c103
-rw-r--r--drivers/mfd/qcom_rpm.c41
-rw-r--r--drivers/mfd/rk808.c3
-rw-r--r--drivers/mfd/rtl8411.c11
-rw-r--r--drivers/mfd/rts5209.c4
-rw-r--r--drivers/mfd/rts5227.c12
-rw-r--r--drivers/mfd/rts5229.c4
-rw-r--r--drivers/mfd/rts5249.c343
-rw-r--r--drivers/mfd/rtsx_gops.c37
-rw-r--r--drivers/mfd/rtsx_pcr.c109
-rw-r--r--drivers/mfd/rtsx_pcr.h8
-rw-r--r--drivers/mfd/sec-core.c7
-rw-r--r--drivers/mfd/sec-irq.c14
-rw-r--r--drivers/mfd/sky81452.c108
-rw-r--r--drivers/mfd/tc3589x.c9
-rw-r--r--drivers/mfd/ti_am335x_tscadc.c13
-rw-r--r--drivers/mfd/tps65010.c4
-rw-r--r--drivers/mfd/twl4030-power.c2
-rw-r--r--drivers/mfd/twl6040.c1
-rw-r--r--drivers/mfd/vexpress-sysreg.c71
-rw-r--r--drivers/mfd/wm5102-tables.c3
-rw-r--r--drivers/regulator/arizona-micsupp.c1
-rw-r--r--drivers/rtc/rtc-s5m.c60
-rw-r--r--drivers/video/backlight/Kconfig10
-rw-r--r--drivers/video/backlight/Makefile1
-rw-r--r--drivers/video/backlight/sky81452-backlight.c353
-rw-r--r--include/dt-bindings/mfd/arizona.h (renamed from include/linux/mfd/arizona/gpio.h)67
-rw-r--r--include/dt-bindings/mfd/qcom-rpm.h6
-rw-r--r--include/linux/mfd/arizona/core.h1
-rw-r--r--include/linux/mfd/arizona/pdata.h24
-rw-r--r--include/linux/mfd/max77693-private.h5
-rw-r--r--include/linux/mfd/max77693.h13
-rw-r--r--include/linux/mfd/max77843-private.h454
-rw-r--r--include/linux/mfd/menelaus.h7
-rw-r--r--include/linux/mfd/mt6397/core.h64
-rw-r--r--include/linux/mfd/mt6397/registers.h362
-rw-r--r--include/linux/mfd/rk808.h3
-rw-r--r--include/linux/mfd/rtsx_pci.h1116
-rw-r--r--include/linux/mfd/samsung/core.h9
-rw-r--r--include/linux/mfd/samsung/irq.h2
-rw-r--r--include/linux/mfd/sky81452.h31
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h1
-rw-r--r--include/linux/platform_data/sky81452-backlight.h46
-rw-r--r--sound/soc/codecs/arizona.c3
82 files changed, 4256 insertions, 1185 deletions
diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
index aaa8325004d2..003bd77b4595 100644
--- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
@@ -89,6 +89,7 @@ ricoh,rv5c386 I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
89ricoh,rv5c387a I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC 89ricoh,rv5c387a I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
90samsung,24ad0xd1 S524AD0XF1 (128K/256K-bit Serial EEPROM for Low Power) 90samsung,24ad0xd1 S524AD0XF1 (128K/256K-bit Serial EEPROM for Low Power)
91sii,s35390a 2-wire CMOS real-time clock 91sii,s35390a 2-wire CMOS real-time clock
92skyworks,sky81452 Skyworks SKY81452: Six-Channel White LED Driver with Touch Panel Bias Supply
92st-micro,24c256 i2c serial eeprom (24cxx) 93st-micro,24c256 i2c serial eeprom (24cxx)
93stm,m41t00 Serial Access TIMEKEEPER 94stm,m41t00 Serial Access TIMEKEEPER
94stm,m41t62 Serial real-time clock (RTC) with alarm 95stm,m41t62 Serial real-time clock (RTC) with alarm
diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt
index 7bd1273f571a..7665aa95979f 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -8,6 +8,7 @@ Required properties:
8 - compatible : One of the following chip-specific strings: 8 - compatible : One of the following chip-specific strings:
9 "wlf,wm5102" 9 "wlf,wm5102"
10 "wlf,wm5110" 10 "wlf,wm5110"
11 "wlf,wm8280"
11 "wlf,wm8997" 12 "wlf,wm8997"
12 - reg : I2C slave address when connected using I2C, chip select number when 13 - reg : I2C slave address when connected using I2C, chip select number when
13 using SPI. 14 using SPI.
@@ -26,21 +27,27 @@ Required properties:
26 - #gpio-cells : Must be 2. The first cell is the pin number and the 27 - #gpio-cells : Must be 2. The first cell is the pin number and the
27 second cell is used to specify optional parameters (currently unused). 28 second cell is used to specify optional parameters (currently unused).
28 29
29 - AVDD-supply, DBVDD1-supply, DBVDD2-supply, DBVDD3-supply (wm5102, wm5110), 30 - AVDD-supply, DBVDD1-supply, CPVDD-supply : Power supplies for the device,
30 CPVDD-supply, SPKVDDL-supply (wm5102, wm5110), SPKVDDR-supply (wm5102, 31 as covered in Documentation/devicetree/bindings/regulator/regulator.txt
31 wm5110), SPKVDD-supply (wm8997) : Power supplies for the device, as covered 32
32 in Documentation/devicetree/bindings/regulator/regulator.txt 33 - DBVDD2-supply, DBVDD3-supply : Additional databus power supplies (wm5102,
34 wm5110, wm8280)
35
36 - SPKVDDL-supply, SPKVDDR-supply : Speaker driver power supplies (wm5102,
37 wm5110, wm8280)
38
39 - SPKVDD-supply : Speaker driver power supply (wm8997)
33 40
34Optional properties: 41Optional properties:
35 42
36 - wlf,reset : GPIO specifier for the GPIO controlling /RESET 43 - wlf,reset : GPIO specifier for the GPIO controlling /RESET
37 - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA 44 - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA
38 45
39 - wlf,gpio-defaults : A list of GPIO configuration register values. If 46 - wlf,gpio-defaults : A list of GPIO configuration register values. Defines
40 absent, no configuration of these registers is performed. If any 47 for the appropriate values can found in <dt-bindings/mfd/arizona.txt>. If
41 entry has a value that is out of range for a 16 bit register then 48 absent, no configuration of these registers is performed. If any entry has
42 the chip default will be used. If present exactly five values must 49 a value that is out of range for a 16 bit register then the chip default
43 be specified. 50 will be used. If present exactly five values must be specified.
44 51
45 - wlf,inmode : A list of INn_MODE register values, where n is the number 52 - wlf,inmode : A list of INn_MODE register values, where n is the number
46 of input signals. Valid values are 0 (Differential), 1 (Single-ended) and 53 of input signals. Valid values are 0 (Differential), 1 (Single-ended) and
@@ -49,6 +56,12 @@ Optional properties:
49 input singals. If values less than the number of input signals, elements 56 input singals. If values less than the number of input signals, elements
50 that has not been specifed are set to 0 by default. 57 that has not been specifed are set to 0 by default.
51 58
59 - wlf,dmic-ref : DMIC reference voltage source for each input, can be
60 selected from either MICVDD or one of the MICBIAS's, defines
61 (ARIZONA_DMIC_xxxx) are provided in <dt-bindings/mfd/arizona.txt>. If
62 present, the number of values should be less than or equal to the
63 number of inputs, unspecified inputs will use the chip default.
64
52 - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if 65 - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if
53 they are being externally supplied. As covered in 66 they are being externally supplied. As covered in
54 Documentation/devicetree/bindings/regulator/regulator.txt 67 Documentation/devicetree/bindings/regulator/regulator.txt
@@ -73,10 +86,10 @@ codec: wm5102@1a {
73 #gpio-cells = <2>; 86 #gpio-cells = <2>;
74 87
75 wlf,gpio-defaults = < 88 wlf,gpio-defaults = <
76 0x00000000 /* AIF1TXLRCLK */ 89 ARIZONA_GP_FN_TXLRCLK
77 0xffffffff 90 ARIZONA_GP_DEFAULT
78 0xffffffff 91 ARIZONA_GP_DEFAULT
79 0xffffffff 92 ARIZONA_GP_DEFAULT
80 0xffffffff 93 ARIZONA_GP_DEFAULT
81 >; 94 >;
82}; 95};
diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
new file mode 100644
index 000000000000..98685f291a72
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -0,0 +1,96 @@
1AXP202/AXP209 device tree bindings
2
3The axp20x family current members :
4axp202 (X-Powers)
5axp209 (X-Powers)
6
7Required properties:
8- compatible: "x-powers,axp202" or "x-powers,axp209"
9- reg: The I2C slave address for the AXP chip
10- interrupt-parent: The parent interrupt controller
11- interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
12- interrupt-controller: axp20x has its own internal IRQs
13- #interrupt-cells: Should be set to 1
14
15Optional properties:
16- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
17 (range: 750-1875). Default: 1.5MHz
18- <input>-supply: a phandle to the regulator supply node. May be omitted if
19 inputs are unregulated, such as using the IPSOUT output
20 from the PMIC.
21
22- regulators: A node that houses a sub-node for each regulator. Regulators
23 not used but preferred to be managed by the OS should be
24 listed as well.
25 See Documentation/devicetree/bindings/regulator/regulator.txt
26 for more information on standard regulator bindings.
27
28Optional properties for DCDC regulators:
29- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO (PWM/PFM) mode
30 Default: Current hardware setting
31 The DCDC regulators work in a mixed PWM/PFM mode,
32 using PFM under light loads and switching to PWM
33 for heavier loads. Forcing PWM mode trades efficiency
34 under light loads for lower output noise. This
35 probably makes sense for HiFi audio related
36 applications that aren't battery constrained.
37
38
39AXP202/AXP209 regulators, type, and corresponding input supply names:
40
41Regulator Type Supply Name Notes
42--------- ---- ----------- -----
43DCDC2 : DC-DC buck : vin2-supply
44DCDC3 : DC-DC buck : vin3-supply
45LDO1 : LDO : acin-supply : always on
46LDO2 : LDO : ldo24in-supply : shared supply
47LDO3 : LDO : ldo3in-supply
48LDO4 : LDO : ldo24in-supply : shared supply
49LDO5 : LDO : ldo5in-supply
50
51Example:
52
53axp209: pmic@34 {
54 compatible = "x-powers,axp209";
55 reg = <0x34>;
56 interrupt-parent = <&nmi_intc>;
57 interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
58 interrupt-controller;
59 #interrupt-cells = <1>;
60
61 regulators {
62 x-powers,dcdc-freq = <1500>;
63
64 vdd_cpu: dcdc2 {
65 regulator-always-on;
66 regulator-min-microvolt = <1000000>;
67 regulator-max-microvolt = <1450000>;
68 regulator-name = "vdd-cpu";
69 };
70
71 vdd_int_dll: dcdc3 {
72 regulator-always-on;
73 regulator-min-microvolt = <1000000>;
74 regulator-max-microvolt = <1400000>;
75 regulator-name = "vdd-int-dll";
76 };
77
78 vdd_rtc: ldo1 {
79 regulator-always-on;
80 regulator-min-microvolt = <1200000>;
81 regulator-max-microvolt = <1400000>;
82 regulator-name = "vdd-rtc";
83 };
84
85 avcc: ldo2 {
86 regulator-always-on;
87 regulator-min-microvolt = <2700000>;
88 regulator-max-microvolt = <3300000>;
89 regulator-name = "avcc";
90 };
91
92 ldo3 {
93 /* unused but preferred to be managed by OS */
94 };
95 };
96};
diff --git a/Documentation/devicetree/bindings/mfd/da9150.txt b/Documentation/devicetree/bindings/mfd/da9150.txt
new file mode 100644
index 000000000000..d0588eaa0d71
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/da9150.txt
@@ -0,0 +1,43 @@
1Dialog Semiconductor DA9150 Combined Charger/Fuel-Gauge MFD bindings
2
3DA9150 consists of a group of sub-devices:
4
5Device Description
6------ -----------
7da9150-gpadc : General Purpose ADC
8da9150-charger : Battery Charger
9
10======
11
12Required properties:
13- compatible : Should be "dlg,da9150"
14- reg: Specifies the I2C slave address
15- interrupt-parent: Specifies the phandle of the interrupt controller to which
16 the IRQs from da9150 are delivered to.
17- interrupts: IRQ line info for da9150 chip.
18- interrupt-controller: da9150 has internal IRQs (own IRQ domain).
19 (See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for
20 further information relating to interrupt properties)
21
22Sub-devices:
23- da9150-gpadc: See Documentation/devicetree/bindings/iio/adc/da9150-gpadc.txt
24- da9150-charger: See Documentation/devicetree/bindings/power/da9150-charger.txt
25
26
27Example:
28
29 charger_fg: da9150@58 {
30 compatible = "dlg,da9150";
31 reg = <0x58>;
32 interrupt-parent = <&gpio6>;
33 interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
34 interrupt-controller;
35
36 gpadc: da9150-gpadc {
37 ...
38 };
39
40 da9150-charger {
41 ...
42 };
43 };
diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt
new file mode 100644
index 000000000000..15043e652699
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/mt6397.txt
@@ -0,0 +1,70 @@
1MediaTek MT6397 Multifunction Device Driver
2
3MT6397 is a multifunction device with the following sub modules:
4- Regulator
5- RTC
6- Audio codec
7- GPIO
8- Clock
9
10It is interfaced to host controller using SPI interface by a proprietary hardware
11called PMIC wrapper or pwrap. MT6397 MFD is a child device of pwrap.
12See the following for pwarp node definitions:
13Documentation/devicetree/bindings/soc/pwrap.txt
14
15This document describes the binding for MFD device and its sub module.
16
17Required properties:
18compatible: "mediatek,mt6397"
19
20Optional subnodes:
21
22- rtc
23 Required properties:
24 - compatible: "mediatek,mt6397-rtc"
25- regulators
26 Required properties:
27 - compatible: "mediatek,mt6397-regulator"
28 see Documentation/devicetree/bindings/regulator/mt6397-regulator.txt
29- codec
30 Required properties:
31 - compatible: "mediatek,mt6397-codec"
32- clk
33 Required properties:
34 - compatible: "mediatek,mt6397-clk"
35
36Example:
37 pwrap: pwrap@1000f000 {
38 compatible = "mediatek,mt8135-pwrap";
39
40 ...
41
42 pmic {
43 compatible = "mediatek,mt6397";
44
45 codec: mt6397codec {
46 compatible = "mediatek,mt6397-codec";
47 };
48
49 regulators {
50 compatible = "mediatek,mt6397-regulator";
51
52 mt6397_vpca15_reg: buck_vpca15 {
53 regulator-compatible = "buck_vpca15";
54 regulator-name = "vpca15";
55 regulator-min-microvolt = <850000>;
56 regulator-max-microvolt = <1400000>;
57 regulator-ramp-delay = <12500>;
58 regulator-always-on;
59 };
60
61 mt6397_vgp4_reg: ldo_vgp4 {
62 regulator-compatible = "ldo_vgp4";
63 regulator-name = "vgp4";
64 regulator-min-microvolt = <1200000>;
65 regulator-max-microvolt = <3300000>;
66 regulator-enable-ramp-delay = <218>;
67 };
68 };
69 };
70 };
diff --git a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt
index 7182b8857f57..6ac06c1b9aec 100644
--- a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt
+++ b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.txt
@@ -15,10 +15,21 @@ each. A function can consume one or more of these fixed-size register regions.
15 15
16Required properties: 16Required properties:
17- compatible: Should contain one of: 17- compatible: Should contain one of:
18 "qcom,pm8941" 18 "qcom,pm8941",
19 "qcom,pm8841" 19 "qcom,pm8841",
20 "qcom,pma8084" 20 "qcom,pma8084",
21 or generalized "qcom,spmi-pmic". 21 "qcom,pm8019",
22 "qcom,pm8226",
23 "qcom,pm8110",
24 "qcom,pma8084",
25 "qcom,pmi8962",
26 "qcom,pmd9635",
27 "qcom,pm8994",
28 "qcom,pmi8994",
29 "qcom,pm8916",
30 "qcom,pm8004",
31 "qcom,pm8909",
32 or generalized "qcom,spmi-pmic".
22- reg: Specifies the SPMI USID slave address for this device. 33- reg: Specifies the SPMI USID slave address for this device.
23 For more information see: 34 For more information see:
24 Documentation/devicetree/bindings/spmi/spmi.txt 35 Documentation/devicetree/bindings/spmi/spmi.txt
diff --git a/Documentation/devicetree/bindings/mfd/qcom-rpm.txt b/Documentation/devicetree/bindings/mfd/qcom-rpm.txt
index 85e31980017a..5e97a9593ad7 100644
--- a/Documentation/devicetree/bindings/mfd/qcom-rpm.txt
+++ b/Documentation/devicetree/bindings/mfd/qcom-rpm.txt
@@ -12,6 +12,7 @@ frequencies.
12 "qcom,rpm-apq8064" 12 "qcom,rpm-apq8064"
13 "qcom,rpm-msm8660" 13 "qcom,rpm-msm8660"
14 "qcom,rpm-msm8960" 14 "qcom,rpm-msm8960"
15 "qcom,rpm-ipq8064"
15 16
16- reg: 17- reg:
17 Usage: required 18 Usage: required
@@ -31,16 +32,6 @@ frequencies.
31 Value type: <string-array> 32 Value type: <string-array>
32 Definition: must be the three strings "ack", "err" and "wakeup", in order 33 Definition: must be the three strings "ack", "err" and "wakeup", in order
33 34
34- #address-cells:
35 Usage: required
36 Value type: <u32>
37 Definition: must be 1
38
39- #size-cells:
40 Usage: required
41 Value type: <u32>
42 Definition: must be 0
43
44- qcom,ipc: 35- qcom,ipc:
45 Usage: required 36 Usage: required
46 Value type: <prop-encoded-array> 37 Value type: <prop-encoded-array>
@@ -52,6 +43,188 @@ frequencies.
52 - u32 representing the ipc bit within the register 43 - u32 representing the ipc bit within the register
53 44
54 45
46= SUBNODES
47
48The RPM exposes resources to its subnodes. The below bindings specify the set
49of valid subnodes that can operate on these resources.
50
51== Regulators
52
53Regulator nodes are identified by their compatible:
54
55- compatible:
56 Usage: required
57 Value type: <string>
58 Definition: must be one of:
59 "qcom,rpm-pm8058-regulators"
60 "qcom,rpm-pm8901-regulators"
61 "qcom,rpm-pm8921-regulators"
62
63- vdd_l0_l1_lvs-supply:
64- vdd_l2_l11_l12-supply:
65- vdd_l3_l4_l5-supply:
66- vdd_l6_l7-supply:
67- vdd_l8-supply:
68- vdd_l9-supply:
69- vdd_l10-supply:
70- vdd_l13_l16-supply:
71- vdd_l14_l15-supply:
72- vdd_l17_l18-supply:
73- vdd_l19_l20-supply:
74- vdd_l21-supply:
75- vdd_l22-supply:
76- vdd_l23_l24_l25-supply:
77- vdd_ncp-supply:
78- vdd_s0-supply:
79- vdd_s1-supply:
80- vdd_s2-supply:
81- vdd_s3-supply:
82- vdd_s4-supply:
83 Usage: optional (pm8058 only)
84 Value type: <phandle>
85 Definition: reference to regulator supplying the input pin, as
86 described in the data sheet
87
88- lvs0_in-supply:
89- lvs1_in-supply:
90- lvs2_in-supply:
91- lvs3_in-supply:
92- mvs_in-supply:
93- vdd_l0-supply:
94- vdd_l1-supply:
95- vdd_l2-supply:
96- vdd_l3-supply:
97- vdd_l4-supply:
98- vdd_l5-supply:
99- vdd_l6-supply:
100- vdd_s0-supply:
101- vdd_s1-supply:
102- vdd_s2-supply:
103- vdd_s3-supply:
104- vdd_s4-supply:
105 Usage: optional (pm8901 only)
106 Value type: <phandle>
107 Definition: reference to regulator supplying the input pin, as
108 described in the data sheet
109
110- vdd_l1_l2_l12_l18-supply:
111- vdd_l3_l15_l17-supply:
112- vdd_l4_l14-supply:
113- vdd_l5_l8_l16-supply:
114- vdd_l6_l7-supply:
115- vdd_l9_l11-supply:
116- vdd_l10_l22-supply:
117- vdd_l21_l23_l29-supply:
118- vdd_l24-supply:
119- vdd_l25-supply:
120- vdd_l26-supply:
121- vdd_l27-supply:
122- vdd_l28-supply:
123- vdd_ncp-supply:
124- vdd_s1-supply:
125- vdd_s2-supply:
126- vdd_s4-supply:
127- vdd_s5-supply:
128- vdd_s6-supply:
129- vdd_s7-supply:
130- vdd_s8-supply:
131- vin_5vs-supply:
132- vin_lvs1_3_6-supply:
133- vin_lvs2-supply:
134- vin_lvs4_5_7-supply:
135 Usage: optional (pm8921 only)
136 Value type: <phandle>
137 Definition: reference to regulator supplying the input pin, as
138 described in the data sheet
139
140The regulator node houses sub-nodes for each regulator within the device. Each
141sub-node is identified using the node's name, with valid values listed for each
142of the pmics below.
143
144pm8058:
145 l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15,
146 l16, l17, l18, l19, l20, l21, l22, l23, l24, l25, s0, s1, s2, s3, s4,
147 lvs0, lvs1, ncp
148
149pm8901:
150 l0, l1, l2, l3, l4, l5, l6, s0, s1, s2, s3, s4, lvs0, lvs1, lvs2, lvs3,
151 mvs
152
153pm8921:
154 s1, s2, s3, s4, s7, s8, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
155 l12, l14, l15, l16, l17, l18, l21, l22, l23, l24, l25, l26, l27, l28,
156 l29, lvs1, lvs2, lvs3, lvs4, lvs5, lvs6, lvs7, usb-switch, hdmi-switch,
157 ncp
158
159The content of each sub-node is defined by the standard binding for regulators -
160see regulator.txt - with additional custom properties described below:
161
162=== Switch-mode Power Supply regulator custom properties
163
164- bias-pull-down:
165 Usage: optional
166 Value type: <empty>
167 Definition: enable pull down of the regulator when inactive
168
169- qcom,switch-mode-frequency:
170 Usage: required
171 Value type: <u32>
172 Definition: Frequency (Hz) of the switch-mode power supply;
173 must be one of:
174 19200000, 9600000, 6400000, 4800000, 3840000, 3200000,
175 2740000, 2400000, 2130000, 1920000, 1750000, 1600000,
176 1480000, 1370000, 1280000, 1200000
177
178- qcom,force-mode:
179 Usage: optional (default if no other qcom,force-mode is specified)
180 Value type: <u32>
181 Defintion: indicates that the regulator should be forced to a
182 particular mode, valid values are:
183 QCOM_RPM_FORCE_MODE_NONE - do not force any mode
184 QCOM_RPM_FORCE_MODE_LPM - force into low power mode
185 QCOM_RPM_FORCE_MODE_HPM - force into high power mode
186 QCOM_RPM_FORCE_MODE_AUTO - allow regulator to automatically
187 select its own mode based on
188 realtime current draw, only for:
189 pm8921 smps and ftsmps
190
191- qcom,power-mode-hysteretic:
192 Usage: optional
193 Value type: <empty>
194 Definition: select that the power supply should operate in hysteretic
195 mode, instead of the default pwm mode
196
197=== Low-dropout regulator custom properties
198
199- bias-pull-down:
200 Usage: optional
201 Value type: <empty>
202 Definition: enable pull down of the regulator when inactive
203
204- qcom,force-mode:
205 Usage: optional
206 Value type: <u32>
207 Defintion: indicates that the regulator should not be forced to any
208 particular mode, valid values are:
209 QCOM_RPM_FORCE_MODE_NONE - do not force any mode
210 QCOM_RPM_FORCE_MODE_LPM - force into low power mode
211 QCOM_RPM_FORCE_MODE_HPM - force into high power mode
212 QCOM_RPM_FORCE_MODE_BYPASS - set regulator to use bypass
213 mode, i.e. to act as a switch
214 and not regulate, only for:
215 pm8921 pldo, nldo and nldo1200
216
217=== Negative Charge Pump custom properties
218
219- qcom,switch-mode-frequency:
220 Usage: required
221 Value type: <u32>
222 Definition: Frequency (Hz) of the swith mode power supply;
223 must be one of:
224 19200000, 9600000, 6400000, 4800000, 3840000, 3200000,
225 2740000, 2400000, 2130000, 1920000, 1750000, 1600000,
226 1480000, 1370000, 1280000, 1200000
227
55= EXAMPLE 228= EXAMPLE
56 229
57 #include <dt-bindings/mfd/qcom-rpm.h> 230 #include <dt-bindings/mfd/qcom-rpm.h>
@@ -64,7 +237,28 @@ frequencies.
64 interrupts = <0 19 0>, <0 21 0>, <0 22 0>; 237 interrupts = <0 19 0>, <0 21 0>, <0 22 0>;
65 interrupt-names = "ack", "err", "wakeup"; 238 interrupt-names = "ack", "err", "wakeup";
66 239
67 #address-cells = <1>; 240 regulators {
68 #size-cells = <0>; 241 compatible = "qcom,rpm-pm8921-regulators";
242 vdd_l1_l2_l12_l18-supply = <&pm8921_s4>;
243
244 s1 {
245 regulator-min-microvolt = <1225000>;
246 regulator-max-microvolt = <1225000>;
247
248 bias-pull-down;
249
250 qcom,switch-mode-frequency = <3200000>;
251 };
252
253 pm8921_s4: s4 {
254 regulator-min-microvolt = <1800000>;
255 regulator-max-microvolt = <1800000>;
256
257 qcom,switch-mode-frequency = <1600000>;
258 bias-pull-down;
259
260 qcom,force-mode = <QCOM_RPM_FORCE_MODE_AUTO>;
261 };
262 };
69 }; 263 };
70 264
diff --git a/Documentation/devicetree/bindings/mfd/sky81452.txt b/Documentation/devicetree/bindings/mfd/sky81452.txt
new file mode 100644
index 000000000000..35181794aa24
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/sky81452.txt
@@ -0,0 +1,35 @@
1SKY81452 bindings
2
3Required properties:
4- compatible : Must be "skyworks,sky81452"
5- reg : I2C slave address
6
7Required child nodes:
8- backlight : container node for backlight following the binding
9 in video/backlight/sky81452-backlight.txt
10- regulator : container node for regulators following the binding
11 in regulator/sky81452-regulator.txt
12
13Example:
14
15 sky81452@2c {
16 compatible = "skyworks,sky81452";
17 reg = <0x2c>;
18
19 backlight {
20 compatible = "skyworks,sky81452-backlight";
21 name = "pwm-backlight";
22 led-sources = <0 1 2 3 6>;
23 skyworks,ignore-pwm;
24 skyworks,phase-shift;
25 skyworks,current-limit = <2300>;
26 };
27
28 regulator {
29 lout {
30 regulator-name = "sky81452-lout";
31 regulator-min-microvolt = <4500000>;
32 regulator-max-microvolt = <8000000>;
33 };
34 };
35 };
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index fae26d014aaf..9b98bd89cfe2 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -167,6 +167,7 @@ sii Seiko Instruments, Inc.
167silergy Silergy Corp. 167silergy Silergy Corp.
168sirf SiRF Technology, Inc. 168sirf SiRF Technology, Inc.
169sitronix Sitronix Technology Corporation 169sitronix Sitronix Technology Corporation
170skyworks Skyworks Solutions, Inc.
170smsc Standard Microsystems Corporation 171smsc Standard Microsystems Corporation
171snps Synopsys, Inc. 172snps Synopsys, Inc.
172solidrun SolidRun 173solidrun SolidRun
@@ -194,6 +195,7 @@ voipac Voipac Technologies s.r.o.
194winbond Winbond Electronics corp. 195winbond Winbond Electronics corp.
195wlf Wolfson Microelectronics 196wlf Wolfson Microelectronics
196wm Wondermedia Technologies, Inc. 197wm Wondermedia Technologies, Inc.
198x-powers X-Powers
197xes Extreme Engineering Solutions (X-ES) 199xes Extreme Engineering Solutions (X-ES)
198xillybus Xillybus Ltd. 200xillybus Xillybus Ltd.
199xlnx Xilinx 201xlnx Xilinx
diff --git a/Documentation/devicetree/bindings/video/backlight/sky81452-backlight.txt b/Documentation/devicetree/bindings/video/backlight/sky81452-backlight.txt
new file mode 100644
index 000000000000..8bf2940f54bc
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/sky81452-backlight.txt
@@ -0,0 +1,29 @@
1SKY81452-backlight bindings
2
3Required properties:
4- compatible : Must be "skyworks,sky81452-backlight"
5
6Optional properties:
7- name : Name of backlight device. Default is 'lcd-backlight'.
8- gpios : GPIO to use to EN pin.
9 See Documentation/devicetree/bindings/gpio/gpio.txt
10- led-sources : List of enabled channels from 0 to 5.
11 See Documentation/devicetree/bindings/leds/common.txt
12- skyworks,ignore-pwm : Ignore both PWM input
13- skyworks,dpwm-mode : Enable DPWM dimming mode, otherwise Analog dimming.
14- skyworks,phase-shift : Enable phase shift mode
15- skyworks,short-detection-threshold-volt
16 : It should be one of 4, 5, 6 and 7V.
17- skyworks,current-limit-mA
18 : It should be 2300mA or 2750mA.
19
20Example:
21
22 backlight {
23 compatible = "skyworks,sky81452-backlight";
24 name = "pwm-backlight";
25 led-sources = <0 1 2 5>;
26 skyworks,ignore-pwm;
27 skyworks,phase-shift;
28 skyworks,current-limit-mA = <2300>;
29 };
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 63f01c42aed4..6b5e795f3fe2 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1149,6 +1149,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
1149 } 1149 }
1150 break; 1150 break;
1151 case WM5110: 1151 case WM5110:
1152 case WM8280:
1152 switch (arizona->rev) { 1153 switch (arizona->rev) {
1153 case 0 ... 2: 1154 case 0 ... 2:
1154 break; 1155 break;
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index c1e2ca3d9a51..dc1aaa83a347 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -669,6 +669,7 @@ config GPIO_STP_XWAY
669config GPIO_TC3589X 669config GPIO_TC3589X
670 bool "TC3589X GPIOs" 670 bool "TC3589X GPIOs"
671 depends on MFD_TC3589X 671 depends on MFD_TC3589X
672 depends on OF_GPIO
672 select GPIOLIB_IRQCHIP 673 select GPIOLIB_IRQCHIP
673 help 674 help
674 This enables support for the GPIOs found on the TC3589X 675 This enables support for the GPIOs found on the TC3589X
diff --git a/drivers/gpio/gpio-arizona.c b/drivers/gpio/gpio-arizona.c
index fe369f5c7fa6..9665d0aa4ebb 100644
--- a/drivers/gpio/gpio-arizona.c
+++ b/drivers/gpio/gpio-arizona.c
@@ -116,6 +116,7 @@ static int arizona_gpio_probe(struct platform_device *pdev)
116 switch (arizona->type) { 116 switch (arizona->type) {
117 case WM5102: 117 case WM5102:
118 case WM5110: 118 case WM5110:
119 case WM8280:
119 case WM8997: 120 case WM8997:
120 arizona_gpio->gpio_chip.ngpio = 5; 121 arizona_gpio->gpio_chip.ngpio = 5;
121 break; 122 break;
diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
index 11aed2671065..31b244cffabb 100644
--- a/drivers/gpio/gpio-tc3589x.c
+++ b/drivers/gpio/gpio-tc3589x.c
@@ -260,10 +260,7 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
260 tc3589x_gpio->chip.ngpio = tc3589x->num_gpio; 260 tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
261 tc3589x_gpio->chip.dev = &pdev->dev; 261 tc3589x_gpio->chip.dev = &pdev->dev;
262 tc3589x_gpio->chip.base = -1; 262 tc3589x_gpio->chip.base = -1;
263
264#ifdef CONFIG_OF_GPIO
265 tc3589x_gpio->chip.of_node = np; 263 tc3589x_gpio->chip.of_node = np;
266#endif
267 264
268 /* Bring the GPIO module out of reset */ 265 /* Bring the GPIO module out of reset */
269 ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL, 266 ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 563932500ff1..32522176b0bd 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -296,7 +296,6 @@ static void tc3589x_keypad_close(struct input_dev *input)
296 tc3589x_keypad_disable(keypad); 296 tc3589x_keypad_disable(keypad);
297} 297}
298 298
299#ifdef CONFIG_OF
300static const struct tc3589x_keypad_platform_data * 299static const struct tc3589x_keypad_platform_data *
301tc3589x_keypad_of_probe(struct device *dev) 300tc3589x_keypad_of_probe(struct device *dev)
302{ 301{
@@ -346,14 +345,6 @@ tc3589x_keypad_of_probe(struct device *dev)
346 345
347 return plat; 346 return plat;
348} 347}
349#else
350static inline const struct tc3589x_keypad_platform_data *
351tc3589x_keypad_of_probe(struct device *dev)
352{
353 return ERR_PTR(-ENODEV);
354}
355#endif
356
357 348
358static int tc3589x_keypad_probe(struct platform_device *pdev) 349static int tc3589x_keypad_probe(struct platform_device *pdev)
359{ 350{
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 38356e39adba..d5ad04dad081 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -283,6 +283,18 @@ config HTC_I2CPLD
283 This device provides input and output GPIOs through an I2C 283 This device provides input and output GPIOs through an I2C
284 interface to one or more sub-chips. 284 interface to one or more sub-chips.
285 285
286config MFD_INTEL_QUARK_I2C_GPIO
287 tristate "Intel Quark MFD I2C GPIO"
288 depends on PCI
289 depends on X86
290 depends on COMMON_CLK
291 select MFD_CORE
292 help
293 This MFD provides support for I2C and GPIO that exist only
294 in a single PCI device. It splits the 2 IO devices to
295 their respective IO driver.
296 The GPIO exports a total amount of 8 interrupt-capable GPIOs.
297
286config LPC_ICH 298config LPC_ICH
287 tristate "Intel ICH LPC" 299 tristate "Intel ICH LPC"
288 depends on PCI 300 depends on PCI
@@ -364,6 +376,7 @@ config MFD_KEMPLD
364 * COMe-bIP# 376 * COMe-bIP#
365 * COMe-bPC2 (ETXexpress-PC) 377 * COMe-bPC2 (ETXexpress-PC)
366 * COMe-bSC# (ETXexpress-SC T#) 378 * COMe-bSC# (ETXexpress-SC T#)
379 * COMe-cBL6
367 * COMe-cBT6 380 * COMe-cBT6
368 * COMe-cCT6 381 * COMe-cCT6
369 * COMe-cDC2 (microETXexpress-DC) 382 * COMe-cDC2 (microETXexpress-DC)
@@ -455,6 +468,20 @@ config MFD_MAX77693
455 additional drivers must be enabled in order to use the functionality 468 additional drivers must be enabled in order to use the functionality
456 of the device. 469 of the device.
457 470
471config MFD_MAX77843
472 bool "Maxim Semiconductor MAX77843 PMIC Support"
473 depends on I2C=y
474 select MFD_CORE
475 select REGMAP_I2C
476 select REGMAP_IRQ
477 help
478 Say yes here to add support for Maxim Semiconductor MAX77843.
479 This is companion Power Management IC with LEDs, Haptic, Charger,
480 Fuel Gauge, MUIC(Micro USB Interface Controller) controls on chip.
481 This driver provides common support for accessing the device;
482 additional drivers must be enabled in order to use the functionality
483 of the device.
484
458config MFD_MAX8907 485config MFD_MAX8907
459 tristate "Maxim Semiconductor MAX8907 PMIC Support" 486 tristate "Maxim Semiconductor MAX8907 PMIC Support"
460 select MFD_CORE 487 select MFD_CORE
@@ -502,6 +529,16 @@ config MFD_MAX8998
502 additional drivers must be enabled in order to use the functionality 529 additional drivers must be enabled in order to use the functionality
503 of the device. 530 of the device.
504 531
532config MFD_MT6397
533 tristate "MediaTek MT6397 PMIC Support"
534 select MFD_CORE
535 select IRQ_DOMAIN
536 help
537 Say yes here to add support for MediaTek MT6397 PMIC. This is
538 a Power Management IC. This driver provides common support for
539 accessing the device; additional drivers must be enabled in order
540 to use the functionality of the device.
541
505config MFD_MENF21BMC 542config MFD_MENF21BMC
506 tristate "MEN 14F021P00 Board Management Controller Support" 543 tristate "MEN 14F021P00 Board Management Controller Support"
507 depends on I2C 544 depends on I2C
@@ -655,6 +692,7 @@ config MFD_RT5033
655 depends on I2C=y 692 depends on I2C=y
656 select MFD_CORE 693 select MFD_CORE
657 select REGMAP_I2C 694 select REGMAP_I2C
695 select REGMAP_IRQ
658 help 696 help
659 This driver provides for the Richtek RT5033 Power Management IC, 697 This driver provides for the Richtek RT5033 Power Management IC,
660 which includes the I2C driver and the Core APIs. This driver provides 698 which includes the I2C driver and the Core APIs. This driver provides
@@ -753,6 +791,18 @@ config MFD_SM501_GPIO
753 lines on the SM501. The platform data is used to supply the 791 lines on the SM501. The platform data is used to supply the
754 base number for the first GPIO line to register. 792 base number for the first GPIO line to register.
755 793
794config MFD_SKY81452
795 tristate "Skyworks Solutions SKY81452"
796 select MFD_CORE
797 select REGMAP_I2C
798 depends on I2C
799 help
800 This is the core driver for the Skyworks SKY81452 backlight and
801 voltage regulator device.
802
803 This driver can also be built as a module. If so, the module
804 will be called sky81452.
805
756config MFD_SMSC 806config MFD_SMSC
757 bool "SMSC ECE1099 series chips" 807 bool "SMSC ECE1099 series chips"
758 depends on I2C=y 808 depends on I2C=y
@@ -1210,6 +1260,7 @@ config MFD_TIMBERDALE
1210config MFD_TC3589X 1260config MFD_TC3589X
1211 bool "Toshiba TC35892 and variants" 1261 bool "Toshiba TC35892 and variants"
1212 depends on I2C=y 1262 depends on I2C=y
1263 depends on OF
1213 select MFD_CORE 1264 select MFD_CORE
1214 help 1265 help
1215 Support for the Toshiba TC35892 and variants I/O Expander. 1266 Support for the Toshiba TC35892 and variants I/O Expander.
@@ -1289,10 +1340,11 @@ config MFD_WM5102
1289 Support for Wolfson Microelectronics WM5102 low power audio SoC 1340 Support for Wolfson Microelectronics WM5102 low power audio SoC
1290 1341
1291config MFD_WM5110 1342config MFD_WM5110
1292 bool "Wolfson Microelectronics WM5110" 1343 bool "Wolfson Microelectronics WM5110 and WM8280/WM8281"
1293 depends on MFD_ARIZONA 1344 depends on MFD_ARIZONA
1294 help 1345 help
1295 Support for Wolfson Microelectronics WM5110 low power audio SoC 1346 Support for Wolfson Microelectronics WM5110 and WM8280/WM8281
1347 low power audio SoC
1296 1348
1297config MFD_WM8997 1349config MFD_WM8997
1298 bool "Wolfson Microelectronics WM8997" 1350 bool "Wolfson Microelectronics WM8997"
@@ -1362,7 +1414,7 @@ config MFD_WM8994
1362 depends on I2C 1414 depends on I2C
1363 help 1415 help
1364 The WM8994 is a highly integrated hi-fi CODEC designed for 1416 The WM8994 is a highly integrated hi-fi CODEC designed for
1365 smartphone applicatiosn. As well as audio functionality it 1417 smartphone applications. As well as audio functionality it
1366 has on board GPIO and regulator functionality which is 1418 has on board GPIO and regulator functionality which is
1367 supported via the relevant subsystems. This driver provides 1419 supported via the relevant subsystems. This driver provides
1368 core support for the WM8994, in order to use the actual 1420 core support for the WM8994, in order to use the actual
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 19f3d744e3bd..0e5cfeba107c 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -13,7 +13,7 @@ obj-$(CONFIG_MFD_CROS_EC) += cros_ec.o
13obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o 13obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o
14obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o 14obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
15 15
16rtsx_pci-objs := rtsx_pcr.o rtsx_gops.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.o 16rtsx_pci-objs := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.o
17obj-$(CONFIG_MFD_RTSX_PCI) += rtsx_pci.o 17obj-$(CONFIG_MFD_RTSX_PCI) += rtsx_pci.o
18obj-$(CONFIG_MFD_RTSX_USB) += rtsx_usb.o 18obj-$(CONFIG_MFD_RTSX_USB) += rtsx_usb.o
19 19
@@ -117,6 +117,7 @@ obj-$(CONFIG_MFD_DA9150) += da9150-core.o
117obj-$(CONFIG_MFD_MAX14577) += max14577.o 117obj-$(CONFIG_MFD_MAX14577) += max14577.o
118obj-$(CONFIG_MFD_MAX77686) += max77686.o 118obj-$(CONFIG_MFD_MAX77686) += max77686.o
119obj-$(CONFIG_MFD_MAX77693) += max77693.o 119obj-$(CONFIG_MFD_MAX77693) += max77693.o
120obj-$(CONFIG_MFD_MAX77843) += max77843.o
120obj-$(CONFIG_MFD_MAX8907) += max8907.o 121obj-$(CONFIG_MFD_MAX8907) += max8907.o
121max8925-objs := max8925-core.o max8925-i2c.o 122max8925-objs := max8925-core.o max8925-i2c.o
122obj-$(CONFIG_MFD_MAX8925) += max8925.o 123obj-$(CONFIG_MFD_MAX8925) += max8925.o
@@ -138,6 +139,7 @@ obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-sysctrl.o
138obj-$(CONFIG_MFD_TIMBERDALE) += timberdale.o 139obj-$(CONFIG_MFD_TIMBERDALE) += timberdale.o
139obj-$(CONFIG_PMIC_ADP5520) += adp5520.o 140obj-$(CONFIG_PMIC_ADP5520) += adp5520.o
140obj-$(CONFIG_MFD_KEMPLD) += kempld-core.o 141obj-$(CONFIG_MFD_KEMPLD) += kempld-core.o
142obj-$(CONFIG_MFD_INTEL_QUARK_I2C_GPIO) += intel_quark_i2c_gpio.o
141obj-$(CONFIG_LPC_SCH) += lpc_sch.o 143obj-$(CONFIG_LPC_SCH) += lpc_sch.o
142obj-$(CONFIG_LPC_ICH) += lpc_ich.o 144obj-$(CONFIG_LPC_ICH) += lpc_ich.o
143obj-$(CONFIG_MFD_RDC321X) += rdc321x-southbridge.o 145obj-$(CONFIG_MFD_RDC321X) += rdc321x-southbridge.o
@@ -178,6 +180,8 @@ obj-$(CONFIG_MFD_MENF21BMC) += menf21bmc.o
178obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o 180obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o
179obj-$(CONFIG_MFD_DLN2) += dln2.o 181obj-$(CONFIG_MFD_DLN2) += dln2.o
180obj-$(CONFIG_MFD_RT5033) += rt5033.o 182obj-$(CONFIG_MFD_RT5033) += rt5033.o
183obj-$(CONFIG_MFD_SKY81452) += sky81452.o
181 184
182intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o 185intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o
183obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o 186obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o
187obj-$(CONFIG_MFD_MT6397) += mt6397-core.o
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c
index 9a8e185f11df..cdd6f3d63314 100644
--- a/drivers/mfd/ab8500-debugfs.c
+++ b/drivers/mfd/ab8500-debugfs.c
@@ -1283,7 +1283,7 @@ static irqreturn_t ab8500_debug_handler(int irq, void *data)
1283 1283
1284/* Prints to seq_file or log_buf */ 1284/* Prints to seq_file or log_buf */
1285static int ab8500_registers_print(struct device *dev, u32 bank, 1285static int ab8500_registers_print(struct device *dev, u32 bank,
1286 struct seq_file *s) 1286 struct seq_file *s)
1287{ 1287{
1288 unsigned int i; 1288 unsigned int i;
1289 1289
@@ -1304,20 +1304,19 @@ static int ab8500_registers_print(struct device *dev, u32 bank,
1304 } 1304 }
1305 1305
1306 if (s) { 1306 if (s) {
1307 err = seq_printf(s, 1307 seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
1308 " [0x%02X/0x%02X]: 0x%02X\n", 1308 bank, reg, value);
1309 bank, reg, value); 1309 /* Error is not returned here since
1310 if (err < 0) { 1310 * the output is wanted in any case */
1311 /* Error is not returned here since 1311 if (seq_has_overflowed(s))
1312 * the output is wanted in any case */
1313 return 0; 1312 return 0;
1314 }
1315 } else { 1313 } else {
1316 dev_info(dev, " [0x%02X/0x%02X]: 0x%02X\n", 1314 dev_info(dev, " [0x%02X/0x%02X]: 0x%02X\n",
1317 bank, reg, value); 1315 bank, reg, value);
1318 } 1316 }
1319 } 1317 }
1320 } 1318 }
1319
1321 return 0; 1320 return 0;
1322} 1321}
1323 1322
@@ -1330,8 +1329,7 @@ static int ab8500_print_bank_registers(struct seq_file *s, void *p)
1330 1329
1331 seq_printf(s, " bank 0x%02X:\n", bank); 1330 seq_printf(s, " bank 0x%02X:\n", bank);
1332 1331
1333 ab8500_registers_print(dev, bank, s); 1332 return ab8500_registers_print(dev, bank, s);
1334 return 0;
1335} 1333}
1336 1334
1337static int ab8500_registers_open(struct inode *inode, struct file *file) 1335static int ab8500_registers_open(struct inode *inode, struct file *file)
@@ -1355,9 +1353,12 @@ static int ab8500_print_all_banks(struct seq_file *s, void *p)
1355 seq_puts(s, AB8500_NAME_STRING " register values:\n"); 1353 seq_puts(s, AB8500_NAME_STRING " register values:\n");
1356 1354
1357 for (i = 0; i < AB8500_NUM_BANKS; i++) { 1355 for (i = 0; i < AB8500_NUM_BANKS; i++) {
1358 seq_printf(s, " bank 0x%02X:\n", i); 1356 int err;
1359 1357
1360 ab8500_registers_print(dev, i, s); 1358 seq_printf(s, " bank 0x%02X:\n", i);
1359 err = ab8500_registers_print(dev, i, s);
1360 if (err)
1361 return err;
1361 } 1362 }
1362 return 0; 1363 return 0;
1363} 1364}
@@ -1458,7 +1459,8 @@ static const struct file_operations ab8500_all_banks_fops = {
1458 1459
1459static int ab8500_bank_print(struct seq_file *s, void *p) 1460static int ab8500_bank_print(struct seq_file *s, void *p)
1460{ 1461{
1461 return seq_printf(s, "0x%02X\n", debug_bank); 1462 seq_printf(s, "0x%02X\n", debug_bank);
1463 return 0;
1462} 1464}
1463 1465
1464static int ab8500_bank_open(struct inode *inode, struct file *file) 1466static int ab8500_bank_open(struct inode *inode, struct file *file)
@@ -1490,7 +1492,8 @@ static ssize_t ab8500_bank_write(struct file *file,
1490 1492
1491static int ab8500_address_print(struct seq_file *s, void *p) 1493static int ab8500_address_print(struct seq_file *s, void *p)
1492{ 1494{
1493 return seq_printf(s, "0x%02X\n", debug_address); 1495 seq_printf(s, "0x%02X\n", debug_address);
1496 return 0;
1494} 1497}
1495 1498
1496static int ab8500_address_open(struct inode *inode, struct file *file) 1499static int ab8500_address_open(struct inode *inode, struct file *file)
@@ -1598,7 +1601,8 @@ static int ab8500_interrupts_print(struct seq_file *s, void *p)
1598 for (line = 0; line < num_interrupt_lines; line++) { 1601 for (line = 0; line < num_interrupt_lines; line++) {
1599 struct irq_desc *desc = irq_to_desc(line + irq_first); 1602 struct irq_desc *desc = irq_to_desc(line + irq_first);
1600 1603
1601 seq_printf(s, "%3i: %6i %4i", line, 1604 seq_printf(s, "%3i: %6i %4i",
1605 line,
1602 num_interrupts[line], 1606 num_interrupts[line],
1603 num_wake_interrupts[line]); 1607 num_wake_interrupts[line]);
1604 1608
@@ -1705,8 +1709,7 @@ static int ab8500_print_modem_registers(struct seq_file *s, void *p)
1705 dev_err(dev, "ab->read fail %d\n", err); 1709 dev_err(dev, "ab->read fail %d\n", err);
1706 return err; 1710 return err;
1707 } 1711 }
1708 err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n", 1712 seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n", bank, reg, value);
1709 bank, reg, value);
1710 } 1713 }
1711 err = abx500_set_register_interruptible(dev, 1714 err = abx500_set_register_interruptible(dev,
1712 AB8500_REGU_CTRL1, AB8500_SUPPLY_CONTROL_REG, orig_value); 1715 AB8500_REGU_CTRL1, AB8500_SUPPLY_CONTROL_REG, orig_value);
@@ -1743,8 +1746,9 @@ static int ab8500_gpadc_bat_ctrl_print(struct seq_file *s, void *p)
1743 bat_ctrl_convert = ab8500_gpadc_ad_to_voltage(gpadc, 1746 bat_ctrl_convert = ab8500_gpadc_ad_to_voltage(gpadc,
1744 BAT_CTRL, bat_ctrl_raw); 1747 BAT_CTRL, bat_ctrl_raw);
1745 1748
1746 return seq_printf(s, "%d,0x%X\n", 1749 seq_printf(s, "%d,0x%X\n", bat_ctrl_convert, bat_ctrl_raw);
1747 bat_ctrl_convert, bat_ctrl_raw); 1750
1751 return 0;
1748} 1752}
1749 1753
1750static int ab8500_gpadc_bat_ctrl_open(struct inode *inode, struct file *file) 1754static int ab8500_gpadc_bat_ctrl_open(struct inode *inode, struct file *file)
@@ -1773,8 +1777,9 @@ static int ab8500_gpadc_btemp_ball_print(struct seq_file *s, void *p)
1773 btemp_ball_convert = ab8500_gpadc_ad_to_voltage(gpadc, BTEMP_BALL, 1777 btemp_ball_convert = ab8500_gpadc_ad_to_voltage(gpadc, BTEMP_BALL,
1774 btemp_ball_raw); 1778 btemp_ball_raw);
1775 1779
1776 return seq_printf(s, 1780 seq_printf(s, "%d,0x%X\n", btemp_ball_convert, btemp_ball_raw);
1777 "%d,0x%X\n", btemp_ball_convert, btemp_ball_raw); 1781
1782 return 0;
1778} 1783}
1779 1784
1780static int ab8500_gpadc_btemp_ball_open(struct inode *inode, 1785static int ab8500_gpadc_btemp_ball_open(struct inode *inode,
@@ -1804,8 +1809,9 @@ static int ab8500_gpadc_main_charger_v_print(struct seq_file *s, void *p)
1804 main_charger_v_convert = ab8500_gpadc_ad_to_voltage(gpadc, 1809 main_charger_v_convert = ab8500_gpadc_ad_to_voltage(gpadc,
1805 MAIN_CHARGER_V, main_charger_v_raw); 1810 MAIN_CHARGER_V, main_charger_v_raw);
1806 1811
1807 return seq_printf(s, "%d,0x%X\n", 1812 seq_printf(s, "%d,0x%X\n", main_charger_v_convert, main_charger_v_raw);
1808 main_charger_v_convert, main_charger_v_raw); 1813
1814 return 0;
1809} 1815}
1810 1816
1811static int ab8500_gpadc_main_charger_v_open(struct inode *inode, 1817static int ab8500_gpadc_main_charger_v_open(struct inode *inode,
@@ -1835,8 +1841,9 @@ static int ab8500_gpadc_acc_detect1_print(struct seq_file *s, void *p)
1835 acc_detect1_convert = ab8500_gpadc_ad_to_voltage(gpadc, ACC_DETECT1, 1841 acc_detect1_convert = ab8500_gpadc_ad_to_voltage(gpadc, ACC_DETECT1,
1836 acc_detect1_raw); 1842 acc_detect1_raw);
1837 1843
1838 return seq_printf(s, "%d,0x%X\n", 1844 seq_printf(s, "%d,0x%X\n", acc_detect1_convert, acc_detect1_raw);
1839 acc_detect1_convert, acc_detect1_raw); 1845
1846 return 0;
1840} 1847}
1841 1848
1842static int ab8500_gpadc_acc_detect1_open(struct inode *inode, 1849static int ab8500_gpadc_acc_detect1_open(struct inode *inode,
@@ -1866,8 +1873,9 @@ static int ab8500_gpadc_acc_detect2_print(struct seq_file *s, void *p)
1866 acc_detect2_convert = ab8500_gpadc_ad_to_voltage(gpadc, 1873 acc_detect2_convert = ab8500_gpadc_ad_to_voltage(gpadc,
1867 ACC_DETECT2, acc_detect2_raw); 1874 ACC_DETECT2, acc_detect2_raw);
1868 1875
1869 return seq_printf(s, "%d,0x%X\n", 1876 seq_printf(s, "%d,0x%X\n", acc_detect2_convert, acc_detect2_raw);
1870 acc_detect2_convert, acc_detect2_raw); 1877
1878 return 0;
1871} 1879}
1872 1880
1873static int ab8500_gpadc_acc_detect2_open(struct inode *inode, 1881static int ab8500_gpadc_acc_detect2_open(struct inode *inode,
@@ -1897,8 +1905,9 @@ static int ab8500_gpadc_aux1_print(struct seq_file *s, void *p)
1897 aux1_convert = ab8500_gpadc_ad_to_voltage(gpadc, ADC_AUX1, 1905 aux1_convert = ab8500_gpadc_ad_to_voltage(gpadc, ADC_AUX1,
1898 aux1_raw); 1906 aux1_raw);
1899 1907
1900 return seq_printf(s, "%d,0x%X\n", 1908 seq_printf(s, "%d,0x%X\n", aux1_convert, aux1_raw);
1901 aux1_convert, aux1_raw); 1909
1910 return 0;
1902} 1911}
1903 1912
1904static int ab8500_gpadc_aux1_open(struct inode *inode, struct file *file) 1913static int ab8500_gpadc_aux1_open(struct inode *inode, struct file *file)
@@ -1926,8 +1935,9 @@ static int ab8500_gpadc_aux2_print(struct seq_file *s, void *p)
1926 aux2_convert = ab8500_gpadc_ad_to_voltage(gpadc, ADC_AUX2, 1935 aux2_convert = ab8500_gpadc_ad_to_voltage(gpadc, ADC_AUX2,
1927 aux2_raw); 1936 aux2_raw);
1928 1937
1929 return seq_printf(s, "%d,0x%X\n", 1938 seq_printf(s, "%d,0x%X\n", aux2_convert, aux2_raw);
1930 aux2_convert, aux2_raw); 1939
1940 return 0;
1931} 1941}
1932 1942
1933static int ab8500_gpadc_aux2_open(struct inode *inode, struct file *file) 1943static int ab8500_gpadc_aux2_open(struct inode *inode, struct file *file)
@@ -1955,8 +1965,9 @@ static int ab8500_gpadc_main_bat_v_print(struct seq_file *s, void *p)
1955 main_bat_v_convert = ab8500_gpadc_ad_to_voltage(gpadc, MAIN_BAT_V, 1965 main_bat_v_convert = ab8500_gpadc_ad_to_voltage(gpadc, MAIN_BAT_V,
1956 main_bat_v_raw); 1966 main_bat_v_raw);
1957 1967
1958 return seq_printf(s, "%d,0x%X\n", 1968 seq_printf(s, "%d,0x%X\n", main_bat_v_convert, main_bat_v_raw);
1959 main_bat_v_convert, main_bat_v_raw); 1969
1970 return 0;
1960} 1971}
1961 1972
1962static int ab8500_gpadc_main_bat_v_open(struct inode *inode, 1973static int ab8500_gpadc_main_bat_v_open(struct inode *inode,
@@ -1986,8 +1997,9 @@ static int ab8500_gpadc_vbus_v_print(struct seq_file *s, void *p)
1986 vbus_v_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBUS_V, 1997 vbus_v_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBUS_V,
1987 vbus_v_raw); 1998 vbus_v_raw);
1988 1999
1989 return seq_printf(s, "%d,0x%X\n", 2000 seq_printf(s, "%d,0x%X\n", vbus_v_convert, vbus_v_raw);
1990 vbus_v_convert, vbus_v_raw); 2001
2002 return 0;
1991} 2003}
1992 2004
1993static int ab8500_gpadc_vbus_v_open(struct inode *inode, struct file *file) 2005static int ab8500_gpadc_vbus_v_open(struct inode *inode, struct file *file)
@@ -2015,8 +2027,9 @@ static int ab8500_gpadc_main_charger_c_print(struct seq_file *s, void *p)
2015 main_charger_c_convert = ab8500_gpadc_ad_to_voltage(gpadc, 2027 main_charger_c_convert = ab8500_gpadc_ad_to_voltage(gpadc,
2016 MAIN_CHARGER_C, main_charger_c_raw); 2028 MAIN_CHARGER_C, main_charger_c_raw);
2017 2029
2018 return seq_printf(s, "%d,0x%X\n", 2030 seq_printf(s, "%d,0x%X\n", main_charger_c_convert, main_charger_c_raw);
2019 main_charger_c_convert, main_charger_c_raw); 2031
2032 return 0;
2020} 2033}
2021 2034
2022static int ab8500_gpadc_main_charger_c_open(struct inode *inode, 2035static int ab8500_gpadc_main_charger_c_open(struct inode *inode,
@@ -2046,8 +2059,9 @@ static int ab8500_gpadc_usb_charger_c_print(struct seq_file *s, void *p)
2046 usb_charger_c_convert = ab8500_gpadc_ad_to_voltage(gpadc, 2059 usb_charger_c_convert = ab8500_gpadc_ad_to_voltage(gpadc,
2047 USB_CHARGER_C, usb_charger_c_raw); 2060 USB_CHARGER_C, usb_charger_c_raw);
2048 2061
2049 return seq_printf(s, "%d,0x%X\n", 2062 seq_printf(s, "%d,0x%X\n", usb_charger_c_convert, usb_charger_c_raw);
2050 usb_charger_c_convert, usb_charger_c_raw); 2063
2064 return 0;
2051} 2065}
2052 2066
2053static int ab8500_gpadc_usb_charger_c_open(struct inode *inode, 2067static int ab8500_gpadc_usb_charger_c_open(struct inode *inode,
@@ -2077,8 +2091,9 @@ static int ab8500_gpadc_bk_bat_v_print(struct seq_file *s, void *p)
2077 bk_bat_v_convert = ab8500_gpadc_ad_to_voltage(gpadc, 2091 bk_bat_v_convert = ab8500_gpadc_ad_to_voltage(gpadc,
2078 BK_BAT_V, bk_bat_v_raw); 2092 BK_BAT_V, bk_bat_v_raw);
2079 2093
2080 return seq_printf(s, "%d,0x%X\n", 2094 seq_printf(s, "%d,0x%X\n", bk_bat_v_convert, bk_bat_v_raw);
2081 bk_bat_v_convert, bk_bat_v_raw); 2095
2096 return 0;
2082} 2097}
2083 2098
2084static int ab8500_gpadc_bk_bat_v_open(struct inode *inode, struct file *file) 2099static int ab8500_gpadc_bk_bat_v_open(struct inode *inode, struct file *file)
@@ -2107,8 +2122,9 @@ static int ab8500_gpadc_die_temp_print(struct seq_file *s, void *p)
2107 die_temp_convert = ab8500_gpadc_ad_to_voltage(gpadc, DIE_TEMP, 2122 die_temp_convert = ab8500_gpadc_ad_to_voltage(gpadc, DIE_TEMP,
2108 die_temp_raw); 2123 die_temp_raw);
2109 2124
2110 return seq_printf(s, "%d,0x%X\n", 2125 seq_printf(s, "%d,0x%X\n", die_temp_convert, die_temp_raw);
2111 die_temp_convert, die_temp_raw); 2126
2127 return 0;
2112} 2128}
2113 2129
2114static int ab8500_gpadc_die_temp_open(struct inode *inode, struct file *file) 2130static int ab8500_gpadc_die_temp_open(struct inode *inode, struct file *file)
@@ -2137,8 +2153,9 @@ static int ab8500_gpadc_usb_id_print(struct seq_file *s, void *p)
2137 usb_id_convert = ab8500_gpadc_ad_to_voltage(gpadc, USB_ID, 2153 usb_id_convert = ab8500_gpadc_ad_to_voltage(gpadc, USB_ID,
2138 usb_id_raw); 2154 usb_id_raw);
2139 2155
2140 return seq_printf(s, "%d,0x%X\n", 2156 seq_printf(s, "%d,0x%X\n", usb_id_convert, usb_id_raw);
2141 usb_id_convert, usb_id_raw); 2157
2158 return 0;
2142} 2159}
2143 2160
2144static int ab8500_gpadc_usb_id_open(struct inode *inode, struct file *file) 2161static int ab8500_gpadc_usb_id_open(struct inode *inode, struct file *file)
@@ -2166,8 +2183,9 @@ static int ab8540_gpadc_xtal_temp_print(struct seq_file *s, void *p)
2166 xtal_temp_convert = ab8500_gpadc_ad_to_voltage(gpadc, XTAL_TEMP, 2183 xtal_temp_convert = ab8500_gpadc_ad_to_voltage(gpadc, XTAL_TEMP,
2167 xtal_temp_raw); 2184 xtal_temp_raw);
2168 2185
2169 return seq_printf(s, "%d,0x%X\n", 2186 seq_printf(s, "%d,0x%X\n", xtal_temp_convert, xtal_temp_raw);
2170 xtal_temp_convert, xtal_temp_raw); 2187
2188 return 0;
2171} 2189}
2172 2190
2173static int ab8540_gpadc_xtal_temp_open(struct inode *inode, struct file *file) 2191static int ab8540_gpadc_xtal_temp_open(struct inode *inode, struct file *file)
@@ -2197,8 +2215,9 @@ static int ab8540_gpadc_vbat_true_meas_print(struct seq_file *s, void *p)
2197 ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS, 2215 ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
2198 vbat_true_meas_raw); 2216 vbat_true_meas_raw);
2199 2217
2200 return seq_printf(s, "%d,0x%X\n", 2218 seq_printf(s, "%d,0x%X\n", vbat_true_meas_convert, vbat_true_meas_raw);
2201 vbat_true_meas_convert, vbat_true_meas_raw); 2219
2220 return 0;
2202} 2221}
2203 2222
2204static int ab8540_gpadc_vbat_true_meas_open(struct inode *inode, 2223static int ab8540_gpadc_vbat_true_meas_open(struct inode *inode,
@@ -2233,9 +2252,13 @@ static int ab8540_gpadc_bat_ctrl_and_ibat_print(struct seq_file *s, void *p)
2233 ibat_convert = ab8500_gpadc_ad_to_voltage(gpadc, IBAT_VIRTUAL_CHANNEL, 2252 ibat_convert = ab8500_gpadc_ad_to_voltage(gpadc, IBAT_VIRTUAL_CHANNEL,
2234 ibat_raw); 2253 ibat_raw);
2235 2254
2236 return seq_printf(s, "%d,0x%X\n" "%d,0x%X\n", 2255 seq_printf(s,
2237 bat_ctrl_convert, bat_ctrl_raw, 2256 "%d,0x%X\n"
2238 ibat_convert, ibat_raw); 2257 "%d,0x%X\n",
2258 bat_ctrl_convert, bat_ctrl_raw,
2259 ibat_convert, ibat_raw);
2260
2261 return 0;
2239} 2262}
2240 2263
2241static int ab8540_gpadc_bat_ctrl_and_ibat_open(struct inode *inode, 2264static int ab8540_gpadc_bat_ctrl_and_ibat_open(struct inode *inode,
@@ -2269,9 +2292,13 @@ static int ab8540_gpadc_vbat_meas_and_ibat_print(struct seq_file *s, void *p)
2269 ibat_convert = ab8500_gpadc_ad_to_voltage(gpadc, IBAT_VIRTUAL_CHANNEL, 2292 ibat_convert = ab8500_gpadc_ad_to_voltage(gpadc, IBAT_VIRTUAL_CHANNEL,
2270 ibat_raw); 2293 ibat_raw);
2271 2294
2272 return seq_printf(s, "%d,0x%X\n" "%d,0x%X\n", 2295 seq_printf(s,
2273 vbat_meas_convert, vbat_meas_raw, 2296 "%d,0x%X\n"
2274 ibat_convert, ibat_raw); 2297 "%d,0x%X\n",
2298 vbat_meas_convert, vbat_meas_raw,
2299 ibat_convert, ibat_raw);
2300
2301 return 0;
2275} 2302}
2276 2303
2277static int ab8540_gpadc_vbat_meas_and_ibat_open(struct inode *inode, 2304static int ab8540_gpadc_vbat_meas_and_ibat_open(struct inode *inode,
@@ -2307,9 +2334,13 @@ static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s,
2307 ibat_convert = ab8500_gpadc_ad_to_voltage(gpadc, IBAT_VIRTUAL_CHANNEL, 2334 ibat_convert = ab8500_gpadc_ad_to_voltage(gpadc, IBAT_VIRTUAL_CHANNEL,
2308 ibat_raw); 2335 ibat_raw);
2309 2336
2310 return seq_printf(s, "%d,0x%X\n" "%d,0x%X\n", 2337 seq_printf(s,
2311 vbat_true_meas_convert, vbat_true_meas_raw, 2338 "%d,0x%X\n"
2312 ibat_convert, ibat_raw); 2339 "%d,0x%X\n",
2340 vbat_true_meas_convert, vbat_true_meas_raw,
2341 ibat_convert, ibat_raw);
2342
2343 return 0;
2313} 2344}
2314 2345
2315static int ab8540_gpadc_vbat_true_meas_and_ibat_open(struct inode *inode, 2346static int ab8540_gpadc_vbat_true_meas_and_ibat_open(struct inode *inode,
@@ -2344,9 +2375,13 @@ static int ab8540_gpadc_bat_temp_and_ibat_print(struct seq_file *s, void *p)
2344 ibat_convert = ab8500_gpadc_ad_to_voltage(gpadc, IBAT_VIRTUAL_CHANNEL, 2375 ibat_convert = ab8500_gpadc_ad_to_voltage(gpadc, IBAT_VIRTUAL_CHANNEL,
2345 ibat_raw); 2376 ibat_raw);
2346 2377
2347 return seq_printf(s, "%d,0x%X\n" "%d,0x%X\n", 2378 seq_printf(s,
2348 bat_temp_convert, bat_temp_raw, 2379 "%d,0x%X\n"
2349 ibat_convert, ibat_raw); 2380 "%d,0x%X\n",
2381 bat_temp_convert, bat_temp_raw,
2382 ibat_convert, ibat_raw);
2383
2384 return 0;
2350} 2385}
2351 2386
2352static int ab8540_gpadc_bat_temp_and_ibat_open(struct inode *inode, 2387static int ab8540_gpadc_bat_temp_and_ibat_open(struct inode *inode,
@@ -2373,16 +2408,19 @@ static int ab8540_gpadc_otp_cal_print(struct seq_file *s, void *p)
2373 gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); 2408 gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
2374 ab8540_gpadc_get_otp(gpadc, &vmain_l, &vmain_h, &btemp_l, &btemp_h, 2409 ab8540_gpadc_get_otp(gpadc, &vmain_l, &vmain_h, &btemp_l, &btemp_h,
2375 &vbat_l, &vbat_h, &ibat_l, &ibat_h); 2410 &vbat_l, &vbat_h, &ibat_l, &ibat_h);
2376 return seq_printf(s, "VMAIN_L:0x%X\n" 2411 seq_printf(s,
2377 "VMAIN_H:0x%X\n" 2412 "VMAIN_L:0x%X\n"
2378 "BTEMP_L:0x%X\n" 2413 "VMAIN_H:0x%X\n"
2379 "BTEMP_H:0x%X\n" 2414 "BTEMP_L:0x%X\n"
2380 "VBAT_L:0x%X\n" 2415 "BTEMP_H:0x%X\n"
2381 "VBAT_H:0x%X\n" 2416 "VBAT_L:0x%X\n"
2382 "IBAT_L:0x%X\n" 2417 "VBAT_H:0x%X\n"
2383 "IBAT_H:0x%X\n", 2418 "IBAT_L:0x%X\n"
2384 vmain_l, vmain_h, btemp_l, btemp_h, 2419 "IBAT_H:0x%X\n",
2385 vbat_l, vbat_h, ibat_l, ibat_h); 2420 vmain_l, vmain_h, btemp_l, btemp_h,
2421 vbat_l, vbat_h, ibat_l, ibat_h);
2422
2423 return 0;
2386} 2424}
2387 2425
2388static int ab8540_gpadc_otp_cal_open(struct inode *inode, struct file *file) 2426static int ab8540_gpadc_otp_cal_open(struct inode *inode, struct file *file)
@@ -2400,7 +2438,9 @@ static const struct file_operations ab8540_gpadc_otp_calib_fops = {
2400 2438
2401static int ab8500_gpadc_avg_sample_print(struct seq_file *s, void *p) 2439static int ab8500_gpadc_avg_sample_print(struct seq_file *s, void *p)
2402{ 2440{
2403 return seq_printf(s, "%d\n", avg_sample); 2441 seq_printf(s, "%d\n", avg_sample);
2442
2443 return 0;
2404} 2444}
2405 2445
2406static int ab8500_gpadc_avg_sample_open(struct inode *inode, struct file *file) 2446static int ab8500_gpadc_avg_sample_open(struct inode *inode, struct file *file)
@@ -2445,7 +2485,9 @@ static const struct file_operations ab8500_gpadc_avg_sample_fops = {
2445 2485
2446static int ab8500_gpadc_trig_edge_print(struct seq_file *s, void *p) 2486static int ab8500_gpadc_trig_edge_print(struct seq_file *s, void *p)
2447{ 2487{
2448 return seq_printf(s, "%d\n", trig_edge); 2488 seq_printf(s, "%d\n", trig_edge);
2489
2490 return 0;
2449} 2491}
2450 2492
2451static int ab8500_gpadc_trig_edge_open(struct inode *inode, struct file *file) 2493static int ab8500_gpadc_trig_edge_open(struct inode *inode, struct file *file)
@@ -2490,7 +2532,9 @@ static const struct file_operations ab8500_gpadc_trig_edge_fops = {
2490 2532
2491static int ab8500_gpadc_trig_timer_print(struct seq_file *s, void *p) 2533static int ab8500_gpadc_trig_timer_print(struct seq_file *s, void *p)
2492{ 2534{
2493 return seq_printf(s, "%d\n", trig_timer); 2535 seq_printf(s, "%d\n", trig_timer);
2536
2537 return 0;
2494} 2538}
2495 2539
2496static int ab8500_gpadc_trig_timer_open(struct inode *inode, struct file *file) 2540static int ab8500_gpadc_trig_timer_open(struct inode *inode, struct file *file)
@@ -2533,7 +2577,9 @@ static const struct file_operations ab8500_gpadc_trig_timer_fops = {
2533 2577
2534static int ab8500_gpadc_conv_type_print(struct seq_file *s, void *p) 2578static int ab8500_gpadc_conv_type_print(struct seq_file *s, void *p)
2535{ 2579{
2536 return seq_printf(s, "%d\n", conv_type); 2580 seq_printf(s, "%d\n", conv_type);
2581
2582 return 0;
2537} 2583}
2538 2584
2539static int ab8500_gpadc_conv_type_open(struct inode *inode, struct file *file) 2585static int ab8500_gpadc_conv_type_open(struct inode *inode, struct file *file)
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index 09ba8f186e6a..6ca6dfab50eb 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -561,12 +561,23 @@ static int arizona_of_get_core_pdata(struct arizona *arizona)
561 count++; 561 count++;
562 } 562 }
563 563
564 count = 0;
565 of_property_for_each_u32(arizona->dev->of_node, "wlf,dmic-ref", prop,
566 cur, val) {
567 if (count == ARRAY_SIZE(arizona->pdata.dmic_ref))
568 break;
569
570 arizona->pdata.dmic_ref[count] = val;
571 count++;
572 }
573
564 return 0; 574 return 0;
565} 575}
566 576
567const struct of_device_id arizona_of_match[] = { 577const struct of_device_id arizona_of_match[] = {
568 { .compatible = "wlf,wm5102", .data = (void *)WM5102 }, 578 { .compatible = "wlf,wm5102", .data = (void *)WM5102 },
569 { .compatible = "wlf,wm5110", .data = (void *)WM5110 }, 579 { .compatible = "wlf,wm5110", .data = (void *)WM5110 },
580 { .compatible = "wlf,wm8280", .data = (void *)WM8280 },
570 { .compatible = "wlf,wm8997", .data = (void *)WM8997 }, 581 { .compatible = "wlf,wm8997", .data = (void *)WM8997 },
571 {}, 582 {},
572}; 583};
@@ -671,6 +682,7 @@ int arizona_dev_init(struct arizona *arizona)
671 switch (arizona->type) { 682 switch (arizona->type) {
672 case WM5102: 683 case WM5102:
673 case WM5110: 684 case WM5110:
685 case WM8280:
674 case WM8997: 686 case WM8997:
675 for (i = 0; i < ARRAY_SIZE(wm5102_core_supplies); i++) 687 for (i = 0; i < ARRAY_SIZE(wm5102_core_supplies); i++)
676 arizona->core_supplies[i].supply 688 arizona->core_supplies[i].supply
@@ -834,11 +846,19 @@ int arizona_dev_init(struct arizona *arizona)
834#endif 846#endif
835#ifdef CONFIG_MFD_WM5110 847#ifdef CONFIG_MFD_WM5110
836 case 0x5110: 848 case 0x5110:
837 type_name = "WM5110"; 849 switch (arizona->type) {
838 if (arizona->type != WM5110) { 850 case WM5110:
851 type_name = "WM5110";
852 break;
853 case WM8280:
854 type_name = "WM8280";
855 break;
856 default:
857 type_name = "WM5110";
839 dev_err(arizona->dev, "WM5110 registered as %d\n", 858 dev_err(arizona->dev, "WM5110 registered as %d\n",
840 arizona->type); 859 arizona->type);
841 arizona->type = WM5110; 860 arizona->type = WM5110;
861 break;
842 } 862 }
843 apply_patch = wm5110_patch; 863 apply_patch = wm5110_patch;
844 break; 864 break;
@@ -1010,6 +1030,7 @@ int arizona_dev_init(struct arizona *arizona)
1010 ARRAY_SIZE(wm5102_devs), NULL, 0, NULL); 1030 ARRAY_SIZE(wm5102_devs), NULL, 0, NULL);
1011 break; 1031 break;
1012 case WM5110: 1032 case WM5110:
1033 case WM8280:
1013 ret = mfd_add_devices(arizona->dev, -1, wm5110_devs, 1034 ret = mfd_add_devices(arizona->dev, -1, wm5110_devs,
1014 ARRAY_SIZE(wm5110_devs), NULL, 0, NULL); 1035 ARRAY_SIZE(wm5110_devs), NULL, 0, NULL);
1015 break; 1036 break;
diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c
index 9d4156fb082a..ff782a5de235 100644
--- a/drivers/mfd/arizona-i2c.c
+++ b/drivers/mfd/arizona-i2c.c
@@ -44,6 +44,7 @@ static int arizona_i2c_probe(struct i2c_client *i2c,
44#endif 44#endif
45#ifdef CONFIG_MFD_WM5110 45#ifdef CONFIG_MFD_WM5110
46 case WM5110: 46 case WM5110:
47 case WM8280:
47 regmap_config = &wm5110_i2c_regmap; 48 regmap_config = &wm5110_i2c_regmap;
48 break; 49 break;
49#endif 50#endif
@@ -87,6 +88,7 @@ static int arizona_i2c_remove(struct i2c_client *i2c)
87static const struct i2c_device_id arizona_i2c_id[] = { 88static const struct i2c_device_id arizona_i2c_id[] = {
88 { "wm5102", WM5102 }, 89 { "wm5102", WM5102 },
89 { "wm5110", WM5110 }, 90 { "wm5110", WM5110 },
91 { "wm8280", WM8280 },
90 { "wm8997", WM8997 }, 92 { "wm8997", WM8997 },
91 { } 93 { }
92}; 94};
diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c
index 3a3fe7cc6d61..d063b94b94b5 100644
--- a/drivers/mfd/arizona-irq.c
+++ b/drivers/mfd/arizona-irq.c
@@ -211,6 +211,7 @@ int arizona_irq_init(struct arizona *arizona)
211#endif 211#endif
212#ifdef CONFIG_MFD_WM5110 212#ifdef CONFIG_MFD_WM5110
213 case WM5110: 213 case WM5110:
214 case WM8280:
214 aod = &wm5110_aod; 215 aod = &wm5110_aod;
215 216
216 switch (arizona->rev) { 217 switch (arizona->rev) {
diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c
index 8ef58bcff193..1e845f6d407b 100644
--- a/drivers/mfd/arizona-spi.c
+++ b/drivers/mfd/arizona-spi.c
@@ -44,6 +44,7 @@ static int arizona_spi_probe(struct spi_device *spi)
44#endif 44#endif
45#ifdef CONFIG_MFD_WM5110 45#ifdef CONFIG_MFD_WM5110
46 case WM5110: 46 case WM5110:
47 case WM8280:
47 regmap_config = &wm5110_spi_regmap; 48 regmap_config = &wm5110_spi_regmap;
48 break; 49 break;
49#endif 50#endif
@@ -84,6 +85,7 @@ static int arizona_spi_remove(struct spi_device *spi)
84static const struct spi_device_id arizona_spi_ids[] = { 85static const struct spi_device_id arizona_spi_ids[] = {
85 { "wm5102", WM5102 }, 86 { "wm5102", WM5102 },
86 { "wm5110", WM5110 }, 87 { "wm5110", WM5110 },
88 { "wm8280", WM8280 },
87 { }, 89 { },
88}; 90};
89MODULE_DEVICE_TABLE(spi, arizona_spi_ids); 91MODULE_DEVICE_TABLE(spi, arizona_spi_ids);
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 0acbe52b2411..d18029be6a78 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -29,7 +29,7 @@
29 29
30#define AXP20X_OFF 0x80 30#define AXP20X_OFF 0x80
31 31
32static const char const *axp20x_model_names[] = { 32static const char * const axp20x_model_names[] = {
33 "AXP202", 33 "AXP202",
34 "AXP209", 34 "AXP209",
35 "AXP288", 35 "AXP288",
@@ -290,6 +290,29 @@ static struct resource axp288_adc_resources[] = {
290 }, 290 },
291}; 291};
292 292
293static struct resource axp288_extcon_resources[] = {
294 {
295 .start = AXP288_IRQ_VBUS_FALL,
296 .end = AXP288_IRQ_VBUS_FALL,
297 .flags = IORESOURCE_IRQ,
298 },
299 {
300 .start = AXP288_IRQ_VBUS_RISE,
301 .end = AXP288_IRQ_VBUS_RISE,
302 .flags = IORESOURCE_IRQ,
303 },
304 {
305 .start = AXP288_IRQ_MV_CHNG,
306 .end = AXP288_IRQ_MV_CHNG,
307 .flags = IORESOURCE_IRQ,
308 },
309 {
310 .start = AXP288_IRQ_BC_USB_CHNG,
311 .end = AXP288_IRQ_BC_USB_CHNG,
312 .flags = IORESOURCE_IRQ,
313 },
314};
315
293static struct resource axp288_charger_resources[] = { 316static struct resource axp288_charger_resources[] = {
294 { 317 {
295 .start = AXP288_IRQ_OV, 318 .start = AXP288_IRQ_OV,
@@ -345,6 +368,11 @@ static struct mfd_cell axp288_cells[] = {
345 .resources = axp288_adc_resources, 368 .resources = axp288_adc_resources,
346 }, 369 },
347 { 370 {
371 .name = "axp288_extcon",
372 .num_resources = ARRAY_SIZE(axp288_extcon_resources),
373 .resources = axp288_extcon_resources,
374 },
375 {
348 .name = "axp288_charger", 376 .name = "axp288_charger",
349 .num_resources = ARRAY_SIZE(axp288_charger_resources), 377 .num_resources = ARRAY_SIZE(axp288_charger_resources),
350 .resources = axp288_charger_resources, 378 .resources = axp288_charger_resources,
diff --git a/drivers/mfd/da9052-irq.c b/drivers/mfd/da9052-irq.c
index 57ae7841f536..e65ca194fa98 100644
--- a/drivers/mfd/da9052-irq.c
+++ b/drivers/mfd/da9052-irq.c
@@ -262,6 +262,8 @@ int da9052_irq_init(struct da9052 *da9052)
262 goto regmap_err; 262 goto regmap_err;
263 } 263 }
264 264
265 enable_irq_wake(da9052->chip_irq);
266
265 ret = da9052_request_irq(da9052, DA9052_IRQ_ADC_EOM, "adc-irq", 267 ret = da9052_request_irq(da9052, DA9052_IRQ_ADC_EOM, "adc-irq",
266 da9052_auxadc_irq, da9052); 268 da9052_auxadc_irq, da9052);
267 269
diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
index 45ae0b7d13ef..b5de8a6856c0 100644
--- a/drivers/mfd/da9052-spi.c
+++ b/drivers/mfd/da9052-spi.c
@@ -32,7 +32,7 @@ static int da9052_spi_probe(struct spi_device *spi)
32 if (!da9052) 32 if (!da9052)
33 return -ENOMEM; 33 return -ENOMEM;
34 34
35 spi->mode = SPI_MODE_0 | SPI_CPOL; 35 spi->mode = SPI_MODE_0;
36 spi->bits_per_word = 8; 36 spi->bits_per_word = 8;
37 spi_setup(spi); 37 spi_setup(spi);
38 38
@@ -43,6 +43,10 @@ static int da9052_spi_probe(struct spi_device *spi)
43 43
44 config = da9052_regmap_config; 44 config = da9052_regmap_config;
45 config.read_flag_mask = 1; 45 config.read_flag_mask = 1;
46 config.reg_bits = 7;
47 config.pad_bits = 1;
48 config.val_bits = 8;
49 config.use_single_rw = 1;
46 50
47 da9052->regmap = devm_regmap_init_spi(spi, &config); 51 da9052->regmap = devm_regmap_init_spi(spi, &config);
48 if (IS_ERR(da9052->regmap)) { 52 if (IS_ERR(da9052->regmap)) {
diff --git a/drivers/mfd/da9150-core.c b/drivers/mfd/da9150-core.c
index 4d757b97ef9a..5549817df32e 100644
--- a/drivers/mfd/da9150-core.c
+++ b/drivers/mfd/da9150-core.c
@@ -95,7 +95,7 @@ static const struct regmap_range_cfg da9150_range_cfg[] = {
95 }, 95 },
96}; 96};
97 97
98static struct regmap_config da9150_regmap_config = { 98static const struct regmap_config da9150_regmap_config = {
99 .reg_bits = 8, 99 .reg_bits = 8,
100 .val_bits = 8, 100 .val_bits = 8,
101 .ranges = da9150_range_cfg, 101 .ranges = da9150_range_cfg,
diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
index 1be9bd1c046d..704e189ca162 100644
--- a/drivers/mfd/dln2.c
+++ b/drivers/mfd/dln2.c
@@ -435,7 +435,7 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
435 struct dln2_response *rsp; 435 struct dln2_response *rsp;
436 struct dln2_rx_context *rxc; 436 struct dln2_rx_context *rxc;
437 struct device *dev = &dln2->interface->dev; 437 struct device *dev = &dln2->interface->dev;
438 const unsigned long timeout = DLN2_USB_TIMEOUT * HZ / 1000; 438 const unsigned long timeout = msecs_to_jiffies(DLN2_USB_TIMEOUT);
439 struct dln2_mod_rx_slots *rxs = &dln2->mod_rx_slots[handle]; 439 struct dln2_mod_rx_slots *rxs = &dln2->mod_rx_slots[handle];
440 int size; 440 int size;
441 441
diff --git a/drivers/mfd/hi6421-pmic-core.c b/drivers/mfd/hi6421-pmic-core.c
index 7210ae28bf81..95b2ff8f223a 100644
--- a/drivers/mfd/hi6421-pmic-core.c
+++ b/drivers/mfd/hi6421-pmic-core.c
@@ -93,7 +93,7 @@ static int hi6421_pmic_remove(struct platform_device *pdev)
93 return 0; 93 return 0;
94} 94}
95 95
96static struct of_device_id of_hi6421_pmic_match_tbl[] = { 96static const struct of_device_id of_hi6421_pmic_match_tbl[] = {
97 { .compatible = "hisilicon,hi6421-pmic", }, 97 { .compatible = "hisilicon,hi6421-pmic", },
98 { }, 98 { },
99}; 99};
diff --git a/drivers/mfd/intel_quark_i2c_gpio.c b/drivers/mfd/intel_quark_i2c_gpio.c
new file mode 100644
index 000000000000..1ce16037d043
--- /dev/null
+++ b/drivers/mfd/intel_quark_i2c_gpio.c
@@ -0,0 +1,282 @@
1/*
2 * Intel Quark MFD PCI driver for I2C & GPIO
3 *
4 * Copyright(c) 2014 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * Intel Quark PCI device for I2C and GPIO controller sharing the same
16 * PCI function. This PCI driver will split the 2 devices into their
17 * respective drivers.
18 */
19
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/pci.h>
23#include <linux/mfd/core.h>
24#include <linux/clkdev.h>
25#include <linux/clk-provider.h>
26#include <linux/dmi.h>
27#include <linux/platform_data/gpio-dwapb.h>
28#include <linux/platform_data/i2c-designware.h>
29
30/* PCI BAR for register base address */
31#define MFD_I2C_BAR 0
32#define MFD_GPIO_BAR 1
33
34/* The base GPIO number under GPIOLIB framework */
35#define INTEL_QUARK_MFD_GPIO_BASE 8
36
37/* The default number of South-Cluster GPIO on Quark. */
38#define INTEL_QUARK_MFD_NGPIO 8
39
40/* The DesignWare GPIO ports on Quark. */
41#define INTEL_QUARK_GPIO_NPORTS 1
42
43#define INTEL_QUARK_IORES_MEM 0
44#define INTEL_QUARK_IORES_IRQ 1
45
46#define INTEL_QUARK_I2C_CONTROLLER_CLK "i2c_designware.0"
47
48/* The Quark I2C controller source clock */
49#define INTEL_QUARK_I2C_CLK_HZ 33000000
50
51#define INTEL_QUARK_I2C_NCLK 1
52
53struct intel_quark_mfd {
54 struct pci_dev *pdev;
55 struct clk *i2c_clk;
56 struct clk_lookup *i2c_clk_lookup;
57};
58
59struct i2c_mode_info {
60 const char *name;
61 unsigned int i2c_scl_freq;
62};
63
64static const struct i2c_mode_info platform_i2c_mode_info[] = {
65 {
66 .name = "Galileo",
67 .i2c_scl_freq = 100000,
68 },
69 {
70 .name = "GalileoGen2",
71 .i2c_scl_freq = 400000,
72 },
73 {}
74};
75
76static struct resource intel_quark_i2c_res[] = {
77 [INTEL_QUARK_IORES_MEM] = {
78 .flags = IORESOURCE_MEM,
79 },
80 [INTEL_QUARK_IORES_IRQ] = {
81 .flags = IORESOURCE_IRQ,
82 },
83};
84
85static struct resource intel_quark_gpio_res[] = {
86 [INTEL_QUARK_IORES_MEM] = {
87 .flags = IORESOURCE_MEM,
88 },
89};
90
91static struct mfd_cell intel_quark_mfd_cells[] = {
92 {
93 .id = MFD_I2C_BAR,
94 .name = "i2c_designware",
95 .num_resources = ARRAY_SIZE(intel_quark_i2c_res),
96 .resources = intel_quark_i2c_res,
97 .ignore_resource_conflicts = true,
98 },
99 {
100 .id = MFD_GPIO_BAR,
101 .name = "gpio-dwapb",
102 .num_resources = ARRAY_SIZE(intel_quark_gpio_res),
103 .resources = intel_quark_gpio_res,
104 .ignore_resource_conflicts = true,
105 },
106};
107
108static const struct pci_device_id intel_quark_mfd_ids[] = {
109 { PCI_VDEVICE(INTEL, 0x0934), },
110 {},
111};
112MODULE_DEVICE_TABLE(pci, intel_quark_mfd_ids);
113
114static int intel_quark_register_i2c_clk(struct intel_quark_mfd *quark_mfd)
115{
116 struct pci_dev *pdev = quark_mfd->pdev;
117 struct clk_lookup *i2c_clk_lookup;
118 struct clk *i2c_clk;
119 int ret;
120
121 i2c_clk_lookup = devm_kcalloc(&pdev->dev, INTEL_QUARK_I2C_NCLK,
122 sizeof(*i2c_clk_lookup), GFP_KERNEL);
123 if (!i2c_clk_lookup)
124 return -ENOMEM;
125
126 i2c_clk_lookup[0].dev_id = INTEL_QUARK_I2C_CONTROLLER_CLK;
127
128 i2c_clk = clk_register_fixed_rate(&pdev->dev,
129 INTEL_QUARK_I2C_CONTROLLER_CLK, NULL,
130 CLK_IS_ROOT, INTEL_QUARK_I2C_CLK_HZ);
131
132 quark_mfd->i2c_clk_lookup = i2c_clk_lookup;
133 quark_mfd->i2c_clk = i2c_clk;
134
135 ret = clk_register_clkdevs(i2c_clk, i2c_clk_lookup,
136 INTEL_QUARK_I2C_NCLK);
137 if (ret)
138 dev_err(&pdev->dev, "Fixed clk register failed: %d\n", ret);
139
140 return ret;
141}
142
143static void intel_quark_unregister_i2c_clk(struct pci_dev *pdev)
144{
145 struct intel_quark_mfd *quark_mfd = dev_get_drvdata(&pdev->dev);
146
147 if (!quark_mfd->i2c_clk || !quark_mfd->i2c_clk_lookup)
148 return;
149
150 clkdev_drop(quark_mfd->i2c_clk_lookup);
151 clk_unregister(quark_mfd->i2c_clk);
152}
153
154static int intel_quark_i2c_setup(struct pci_dev *pdev, struct mfd_cell *cell)
155{
156 const char *board_name = dmi_get_system_info(DMI_BOARD_NAME);
157 const struct i2c_mode_info *info;
158 struct dw_i2c_platform_data *pdata;
159 struct resource *res = (struct resource *)cell->resources;
160 struct device *dev = &pdev->dev;
161
162 res[INTEL_QUARK_IORES_MEM].start =
163 pci_resource_start(pdev, MFD_I2C_BAR);
164 res[INTEL_QUARK_IORES_MEM].end =
165 pci_resource_end(pdev, MFD_I2C_BAR);
166
167 res[INTEL_QUARK_IORES_IRQ].start = pdev->irq;
168 res[INTEL_QUARK_IORES_IRQ].end = pdev->irq;
169
170 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
171 if (!pdata)
172 return -ENOMEM;
173
174 /* Normal mode by default */
175 pdata->i2c_scl_freq = 100000;
176
177 if (board_name) {
178 for (info = platform_i2c_mode_info; info->name; info++) {
179 if (!strcmp(board_name, info->name)) {
180 pdata->i2c_scl_freq = info->i2c_scl_freq;
181 break;
182 }
183 }
184 }
185
186 cell->platform_data = pdata;
187 cell->pdata_size = sizeof(*pdata);
188
189 return 0;
190}
191
192static int intel_quark_gpio_setup(struct pci_dev *pdev, struct mfd_cell *cell)
193{
194 struct dwapb_platform_data *pdata;
195 struct resource *res = (struct resource *)cell->resources;
196 struct device *dev = &pdev->dev;
197
198 res[INTEL_QUARK_IORES_MEM].start =
199 pci_resource_start(pdev, MFD_GPIO_BAR);
200 res[INTEL_QUARK_IORES_MEM].end =
201 pci_resource_end(pdev, MFD_GPIO_BAR);
202
203 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
204 if (!pdata)
205 return -ENOMEM;
206
207 /* For intel quark x1000, it has only one port: portA */
208 pdata->nports = INTEL_QUARK_GPIO_NPORTS;
209 pdata->properties = devm_kcalloc(dev, pdata->nports,
210 sizeof(*pdata->properties),
211 GFP_KERNEL);
212 if (!pdata->properties)
213 return -ENOMEM;
214
215 /* Set the properties for portA */
216 pdata->properties->node = NULL;
217 pdata->properties->name = "intel-quark-x1000-gpio-portA";
218 pdata->properties->idx = 0;
219 pdata->properties->ngpio = INTEL_QUARK_MFD_NGPIO;
220 pdata->properties->gpio_base = INTEL_QUARK_MFD_GPIO_BASE;
221 pdata->properties->irq = pdev->irq;
222 pdata->properties->irq_shared = true;
223
224 cell->platform_data = pdata;
225 cell->pdata_size = sizeof(*pdata);
226
227 return 0;
228}
229
230static int intel_quark_mfd_probe(struct pci_dev *pdev,
231 const struct pci_device_id *id)
232{
233 struct intel_quark_mfd *quark_mfd;
234 int ret;
235
236 ret = pcim_enable_device(pdev);
237 if (ret)
238 return ret;
239
240 quark_mfd = devm_kzalloc(&pdev->dev, sizeof(*quark_mfd), GFP_KERNEL);
241 if (!quark_mfd)
242 return -ENOMEM;
243 quark_mfd->pdev = pdev;
244
245 ret = intel_quark_register_i2c_clk(quark_mfd);
246 if (ret)
247 return ret;
248
249 dev_set_drvdata(&pdev->dev, quark_mfd);
250
251 ret = intel_quark_i2c_setup(pdev, &intel_quark_mfd_cells[MFD_I2C_BAR]);
252 if (ret)
253 return ret;
254
255 ret = intel_quark_gpio_setup(pdev,
256 &intel_quark_mfd_cells[MFD_GPIO_BAR]);
257 if (ret)
258 return ret;
259
260 return mfd_add_devices(&pdev->dev, 0, intel_quark_mfd_cells,
261 ARRAY_SIZE(intel_quark_mfd_cells), NULL, 0,
262 NULL);
263}
264
265static void intel_quark_mfd_remove(struct pci_dev *pdev)
266{
267 intel_quark_unregister_i2c_clk(pdev);
268 mfd_remove_devices(&pdev->dev);
269}
270
271static struct pci_driver intel_quark_mfd_driver = {
272 .name = "intel_quark_mfd_i2c_gpio",
273 .id_table = intel_quark_mfd_ids,
274 .probe = intel_quark_mfd_probe,
275 .remove = intel_quark_mfd_remove,
276};
277
278module_pci_driver(intel_quark_mfd_driver);
279
280MODULE_AUTHOR("Raymond Tan <raymond.tan@intel.com>");
281MODULE_DESCRIPTION("Intel Quark MFD PCI driver for I2C & GPIO");
282MODULE_LICENSE("GPL v2");
diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
index 80cef048b904..7b50b6b208a5 100644
--- a/drivers/mfd/intel_soc_pmic_core.c
+++ b/drivers/mfd/intel_soc_pmic_core.c
@@ -26,19 +26,14 @@
26#include <linux/mfd/intel_soc_pmic.h> 26#include <linux/mfd/intel_soc_pmic.h>
27#include "intel_soc_pmic_core.h" 27#include "intel_soc_pmic_core.h"
28 28
29/*
30 * On some boards the PMIC interrupt may come from a GPIO line.
31 * Try to lookup the ACPI table and see if such connection exists. If not,
32 * return -ENOENT and use the IRQ provided by I2C.
33 */
34static int intel_soc_pmic_find_gpio_irq(struct device *dev) 29static int intel_soc_pmic_find_gpio_irq(struct device *dev)
35{ 30{
36 struct gpio_desc *desc; 31 struct gpio_desc *desc;
37 int irq; 32 int irq;
38 33
39 desc = devm_gpiod_get_index(dev, "intel_soc_pmic", 0); 34 desc = devm_gpiod_get_index(dev, "intel_soc_pmic", 0, GPIOD_IN);
40 if (IS_ERR(desc)) 35 if (IS_ERR(desc))
41 return -ENOENT; 36 return PTR_ERR(desc);
42 37
43 irq = gpiod_to_irq(desc); 38 irq = gpiod_to_irq(desc);
44 if (irq < 0) 39 if (irq < 0)
@@ -71,6 +66,11 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
71 66
72 pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config); 67 pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config);
73 68
69 /*
70 * On some boards the PMIC interrupt may come from a GPIO line. Try to
71 * lookup the ACPI table for a such connection and setup a GPIO
72 * interrupt if it exists. Otherwise use the IRQ provided by I2C
73 */
74 irq = intel_soc_pmic_find_gpio_irq(dev); 74 irq = intel_soc_pmic_find_gpio_irq(dev);
75 pmic->irq = (irq < 0) ? i2c->irq : irq; 75 pmic->irq = (irq < 0) ? i2c->irq : irq;
76 76
diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c
index 5615522f8d62..8057849d51ac 100644
--- a/drivers/mfd/kempld-core.c
+++ b/drivers/mfd/kempld-core.c
@@ -508,8 +508,15 @@ static struct dmi_system_id kempld_dmi_table[] __initdata = {
508 }, 508 },
509 .driver_data = (void *)&kempld_platform_data_generic, 509 .driver_data = (void *)&kempld_platform_data_generic,
510 .callback = kempld_create_platform_device, 510 .callback = kempld_create_platform_device,
511 }, 511 }, {
512 { 512 .ident = "CBL6",
513 .matches = {
514 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
515 DMI_MATCH(DMI_BOARD_NAME, "COMe-cBL6"),
516 },
517 .driver_data = (void *)&kempld_platform_data_generic,
518 .callback = kempld_create_platform_device,
519 }, {
513 .ident = "CCR2", 520 .ident = "CCR2",
514 .matches = { 521 .matches = {
515 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"), 522 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c
index f35d4280b2f7..12d960a60ec4 100644
--- a/drivers/mfd/lpc_ich.c
+++ b/drivers/mfd/lpc_ich.c
@@ -539,72 +539,7 @@ static struct lpc_ich_info lpc_chipset_info[] = {
539 * functions that probably will be registered by other drivers. 539 * functions that probably will be registered by other drivers.
540 */ 540 */
541static const struct pci_device_id lpc_ich_ids[] = { 541static const struct pci_device_id lpc_ich_ids[] = {
542 { PCI_VDEVICE(INTEL, 0x2410), LPC_ICH}, 542 { PCI_VDEVICE(INTEL, 0x0f1c), LPC_BAYTRAIL},
543 { PCI_VDEVICE(INTEL, 0x2420), LPC_ICH0},
544 { PCI_VDEVICE(INTEL, 0x2440), LPC_ICH2},
545 { PCI_VDEVICE(INTEL, 0x244c), LPC_ICH2M},
546 { PCI_VDEVICE(INTEL, 0x2480), LPC_ICH3},
547 { PCI_VDEVICE(INTEL, 0x248c), LPC_ICH3M},
548 { PCI_VDEVICE(INTEL, 0x24c0), LPC_ICH4},
549 { PCI_VDEVICE(INTEL, 0x24cc), LPC_ICH4M},
550 { PCI_VDEVICE(INTEL, 0x2450), LPC_CICH},
551 { PCI_VDEVICE(INTEL, 0x24d0), LPC_ICH5},
552 { PCI_VDEVICE(INTEL, 0x25a1), LPC_6300ESB},
553 { PCI_VDEVICE(INTEL, 0x2640), LPC_ICH6},
554 { PCI_VDEVICE(INTEL, 0x2641), LPC_ICH6M},
555 { PCI_VDEVICE(INTEL, 0x2642), LPC_ICH6W},
556 { PCI_VDEVICE(INTEL, 0x2670), LPC_631XESB},
557 { PCI_VDEVICE(INTEL, 0x2671), LPC_631XESB},
558 { PCI_VDEVICE(INTEL, 0x2672), LPC_631XESB},
559 { PCI_VDEVICE(INTEL, 0x2673), LPC_631XESB},
560 { PCI_VDEVICE(INTEL, 0x2674), LPC_631XESB},
561 { PCI_VDEVICE(INTEL, 0x2675), LPC_631XESB},
562 { PCI_VDEVICE(INTEL, 0x2676), LPC_631XESB},
563 { PCI_VDEVICE(INTEL, 0x2677), LPC_631XESB},
564 { PCI_VDEVICE(INTEL, 0x2678), LPC_631XESB},
565 { PCI_VDEVICE(INTEL, 0x2679), LPC_631XESB},
566 { PCI_VDEVICE(INTEL, 0x267a), LPC_631XESB},
567 { PCI_VDEVICE(INTEL, 0x267b), LPC_631XESB},
568 { PCI_VDEVICE(INTEL, 0x267c), LPC_631XESB},
569 { PCI_VDEVICE(INTEL, 0x267d), LPC_631XESB},
570 { PCI_VDEVICE(INTEL, 0x267e), LPC_631XESB},
571 { PCI_VDEVICE(INTEL, 0x267f), LPC_631XESB},
572 { PCI_VDEVICE(INTEL, 0x27b8), LPC_ICH7},
573 { PCI_VDEVICE(INTEL, 0x27b0), LPC_ICH7DH},
574 { PCI_VDEVICE(INTEL, 0x27b9), LPC_ICH7M},
575 { PCI_VDEVICE(INTEL, 0x27bd), LPC_ICH7MDH},
576 { PCI_VDEVICE(INTEL, 0x27bc), LPC_NM10},
577 { PCI_VDEVICE(INTEL, 0x2810), LPC_ICH8},
578 { PCI_VDEVICE(INTEL, 0x2812), LPC_ICH8DH},
579 { PCI_VDEVICE(INTEL, 0x2814), LPC_ICH8DO},
580 { PCI_VDEVICE(INTEL, 0x2815), LPC_ICH8M},
581 { PCI_VDEVICE(INTEL, 0x2811), LPC_ICH8ME},
582 { PCI_VDEVICE(INTEL, 0x2918), LPC_ICH9},
583 { PCI_VDEVICE(INTEL, 0x2916), LPC_ICH9R},
584 { PCI_VDEVICE(INTEL, 0x2912), LPC_ICH9DH},
585 { PCI_VDEVICE(INTEL, 0x2914), LPC_ICH9DO},
586 { PCI_VDEVICE(INTEL, 0x2919), LPC_ICH9M},
587 { PCI_VDEVICE(INTEL, 0x2917), LPC_ICH9ME},
588 { PCI_VDEVICE(INTEL, 0x3a18), LPC_ICH10},
589 { PCI_VDEVICE(INTEL, 0x3a16), LPC_ICH10R},
590 { PCI_VDEVICE(INTEL, 0x3a1a), LPC_ICH10D},
591 { PCI_VDEVICE(INTEL, 0x3a14), LPC_ICH10DO},
592 { PCI_VDEVICE(INTEL, 0x3b00), LPC_PCH},
593 { PCI_VDEVICE(INTEL, 0x3b01), LPC_PCHM},
594 { PCI_VDEVICE(INTEL, 0x3b02), LPC_P55},
595 { PCI_VDEVICE(INTEL, 0x3b03), LPC_PM55},
596 { PCI_VDEVICE(INTEL, 0x3b06), LPC_H55},
597 { PCI_VDEVICE(INTEL, 0x3b07), LPC_QM57},
598 { PCI_VDEVICE(INTEL, 0x3b08), LPC_H57},
599 { PCI_VDEVICE(INTEL, 0x3b09), LPC_HM55},
600 { PCI_VDEVICE(INTEL, 0x3b0a), LPC_Q57},
601 { PCI_VDEVICE(INTEL, 0x3b0b), LPC_HM57},
602 { PCI_VDEVICE(INTEL, 0x3b0d), LPC_PCHMSFF},
603 { PCI_VDEVICE(INTEL, 0x3b0f), LPC_QS57},
604 { PCI_VDEVICE(INTEL, 0x3b12), LPC_3400},
605 { PCI_VDEVICE(INTEL, 0x3b14), LPC_3420},
606 { PCI_VDEVICE(INTEL, 0x3b16), LPC_3450},
607 { PCI_VDEVICE(INTEL, 0x5031), LPC_EP80579},
608 { PCI_VDEVICE(INTEL, 0x1c41), LPC_CPT}, 543 { PCI_VDEVICE(INTEL, 0x1c41), LPC_CPT},
609 { PCI_VDEVICE(INTEL, 0x1c42), LPC_CPTD}, 544 { PCI_VDEVICE(INTEL, 0x1c42), LPC_CPTD},
610 { PCI_VDEVICE(INTEL, 0x1c43), LPC_CPTM}, 545 { PCI_VDEVICE(INTEL, 0x1c43), LPC_CPTM},
@@ -638,7 +573,6 @@ static const struct pci_device_id lpc_ich_ids[] = {
638 { PCI_VDEVICE(INTEL, 0x1c5f), LPC_CPT}, 573 { PCI_VDEVICE(INTEL, 0x1c5f), LPC_CPT},
639 { PCI_VDEVICE(INTEL, 0x1d40), LPC_PBG}, 574 { PCI_VDEVICE(INTEL, 0x1d40), LPC_PBG},
640 { PCI_VDEVICE(INTEL, 0x1d41), LPC_PBG}, 575 { PCI_VDEVICE(INTEL, 0x1d41), LPC_PBG},
641 { PCI_VDEVICE(INTEL, 0x2310), LPC_DH89XXCC},
642 { PCI_VDEVICE(INTEL, 0x1e40), LPC_PPT}, 576 { PCI_VDEVICE(INTEL, 0x1e40), LPC_PPT},
643 { PCI_VDEVICE(INTEL, 0x1e41), LPC_PPT}, 577 { PCI_VDEVICE(INTEL, 0x1e41), LPC_PPT},
644 { PCI_VDEVICE(INTEL, 0x1e42), LPC_PPT}, 578 { PCI_VDEVICE(INTEL, 0x1e42), LPC_PPT},
@@ -671,6 +605,79 @@ static const struct pci_device_id lpc_ich_ids[] = {
671 { PCI_VDEVICE(INTEL, 0x1e5d), LPC_PPT}, 605 { PCI_VDEVICE(INTEL, 0x1e5d), LPC_PPT},
672 { PCI_VDEVICE(INTEL, 0x1e5e), LPC_PPT}, 606 { PCI_VDEVICE(INTEL, 0x1e5e), LPC_PPT},
673 { PCI_VDEVICE(INTEL, 0x1e5f), LPC_PPT}, 607 { PCI_VDEVICE(INTEL, 0x1e5f), LPC_PPT},
608 { PCI_VDEVICE(INTEL, 0x1f38), LPC_AVN},
609 { PCI_VDEVICE(INTEL, 0x1f39), LPC_AVN},
610 { PCI_VDEVICE(INTEL, 0x1f3a), LPC_AVN},
611 { PCI_VDEVICE(INTEL, 0x1f3b), LPC_AVN},
612 { PCI_VDEVICE(INTEL, 0x229c), LPC_BRASWELL},
613 { PCI_VDEVICE(INTEL, 0x2310), LPC_DH89XXCC},
614 { PCI_VDEVICE(INTEL, 0x2390), LPC_COLETO},
615 { PCI_VDEVICE(INTEL, 0x2410), LPC_ICH},
616 { PCI_VDEVICE(INTEL, 0x2420), LPC_ICH0},
617 { PCI_VDEVICE(INTEL, 0x2440), LPC_ICH2},
618 { PCI_VDEVICE(INTEL, 0x244c), LPC_ICH2M},
619 { PCI_VDEVICE(INTEL, 0x2450), LPC_CICH},
620 { PCI_VDEVICE(INTEL, 0x2480), LPC_ICH3},
621 { PCI_VDEVICE(INTEL, 0x248c), LPC_ICH3M},
622 { PCI_VDEVICE(INTEL, 0x24c0), LPC_ICH4},
623 { PCI_VDEVICE(INTEL, 0x24cc), LPC_ICH4M},
624 { PCI_VDEVICE(INTEL, 0x24d0), LPC_ICH5},
625 { PCI_VDEVICE(INTEL, 0x25a1), LPC_6300ESB},
626 { PCI_VDEVICE(INTEL, 0x2640), LPC_ICH6},
627 { PCI_VDEVICE(INTEL, 0x2641), LPC_ICH6M},
628 { PCI_VDEVICE(INTEL, 0x2642), LPC_ICH6W},
629 { PCI_VDEVICE(INTEL, 0x2670), LPC_631XESB},
630 { PCI_VDEVICE(INTEL, 0x2671), LPC_631XESB},
631 { PCI_VDEVICE(INTEL, 0x2672), LPC_631XESB},
632 { PCI_VDEVICE(INTEL, 0x2673), LPC_631XESB},
633 { PCI_VDEVICE(INTEL, 0x2674), LPC_631XESB},
634 { PCI_VDEVICE(INTEL, 0x2675), LPC_631XESB},
635 { PCI_VDEVICE(INTEL, 0x2676), LPC_631XESB},
636 { PCI_VDEVICE(INTEL, 0x2677), LPC_631XESB},
637 { PCI_VDEVICE(INTEL, 0x2678), LPC_631XESB},
638 { PCI_VDEVICE(INTEL, 0x2679), LPC_631XESB},
639 { PCI_VDEVICE(INTEL, 0x267a), LPC_631XESB},
640 { PCI_VDEVICE(INTEL, 0x267b), LPC_631XESB},
641 { PCI_VDEVICE(INTEL, 0x267c), LPC_631XESB},
642 { PCI_VDEVICE(INTEL, 0x267d), LPC_631XESB},
643 { PCI_VDEVICE(INTEL, 0x267e), LPC_631XESB},
644 { PCI_VDEVICE(INTEL, 0x267f), LPC_631XESB},
645 { PCI_VDEVICE(INTEL, 0x27b0), LPC_ICH7DH},
646 { PCI_VDEVICE(INTEL, 0x27b8), LPC_ICH7},
647 { PCI_VDEVICE(INTEL, 0x27b9), LPC_ICH7M},
648 { PCI_VDEVICE(INTEL, 0x27bc), LPC_NM10},
649 { PCI_VDEVICE(INTEL, 0x27bd), LPC_ICH7MDH},
650 { PCI_VDEVICE(INTEL, 0x2810), LPC_ICH8},
651 { PCI_VDEVICE(INTEL, 0x2811), LPC_ICH8ME},
652 { PCI_VDEVICE(INTEL, 0x2812), LPC_ICH8DH},
653 { PCI_VDEVICE(INTEL, 0x2814), LPC_ICH8DO},
654 { PCI_VDEVICE(INTEL, 0x2815), LPC_ICH8M},
655 { PCI_VDEVICE(INTEL, 0x2912), LPC_ICH9DH},
656 { PCI_VDEVICE(INTEL, 0x2914), LPC_ICH9DO},
657 { PCI_VDEVICE(INTEL, 0x2916), LPC_ICH9R},
658 { PCI_VDEVICE(INTEL, 0x2917), LPC_ICH9ME},
659 { PCI_VDEVICE(INTEL, 0x2918), LPC_ICH9},
660 { PCI_VDEVICE(INTEL, 0x2919), LPC_ICH9M},
661 { PCI_VDEVICE(INTEL, 0x3a14), LPC_ICH10DO},
662 { PCI_VDEVICE(INTEL, 0x3a16), LPC_ICH10R},
663 { PCI_VDEVICE(INTEL, 0x3a18), LPC_ICH10},
664 { PCI_VDEVICE(INTEL, 0x3a1a), LPC_ICH10D},
665 { PCI_VDEVICE(INTEL, 0x3b00), LPC_PCH},
666 { PCI_VDEVICE(INTEL, 0x3b01), LPC_PCHM},
667 { PCI_VDEVICE(INTEL, 0x3b02), LPC_P55},
668 { PCI_VDEVICE(INTEL, 0x3b03), LPC_PM55},
669 { PCI_VDEVICE(INTEL, 0x3b06), LPC_H55},
670 { PCI_VDEVICE(INTEL, 0x3b07), LPC_QM57},
671 { PCI_VDEVICE(INTEL, 0x3b08), LPC_H57},
672 { PCI_VDEVICE(INTEL, 0x3b09), LPC_HM55},
673 { PCI_VDEVICE(INTEL, 0x3b0a), LPC_Q57},
674 { PCI_VDEVICE(INTEL, 0x3b0b), LPC_HM57},
675 { PCI_VDEVICE(INTEL, 0x3b0d), LPC_PCHMSFF},
676 { PCI_VDEVICE(INTEL, 0x3b0f), LPC_QS57},
677 { PCI_VDEVICE(INTEL, 0x3b12), LPC_3400},
678 { PCI_VDEVICE(INTEL, 0x3b14), LPC_3420},
679 { PCI_VDEVICE(INTEL, 0x3b16), LPC_3450},
680 { PCI_VDEVICE(INTEL, 0x5031), LPC_EP80579},
674 { PCI_VDEVICE(INTEL, 0x8c40), LPC_LPT}, 681 { PCI_VDEVICE(INTEL, 0x8c40), LPC_LPT},
675 { PCI_VDEVICE(INTEL, 0x8c41), LPC_LPT}, 682 { PCI_VDEVICE(INTEL, 0x8c41), LPC_LPT},
676 { PCI_VDEVICE(INTEL, 0x8c42), LPC_LPT}, 683 { PCI_VDEVICE(INTEL, 0x8c42), LPC_LPT},
@@ -703,14 +710,11 @@ static const struct pci_device_id lpc_ich_ids[] = {
703 { PCI_VDEVICE(INTEL, 0x8c5d), LPC_LPT}, 710 { PCI_VDEVICE(INTEL, 0x8c5d), LPC_LPT},
704 { PCI_VDEVICE(INTEL, 0x8c5e), LPC_LPT}, 711 { PCI_VDEVICE(INTEL, 0x8c5e), LPC_LPT},
705 { PCI_VDEVICE(INTEL, 0x8c5f), LPC_LPT}, 712 { PCI_VDEVICE(INTEL, 0x8c5f), LPC_LPT},
706 { PCI_VDEVICE(INTEL, 0x9c40), LPC_LPT_LP}, 713 { PCI_VDEVICE(INTEL, 0x8cc1), LPC_9S},
707 { PCI_VDEVICE(INTEL, 0x9c41), LPC_LPT_LP}, 714 { PCI_VDEVICE(INTEL, 0x8cc2), LPC_9S},
708 { PCI_VDEVICE(INTEL, 0x9c42), LPC_LPT_LP}, 715 { PCI_VDEVICE(INTEL, 0x8cc3), LPC_9S},
709 { PCI_VDEVICE(INTEL, 0x9c43), LPC_LPT_LP}, 716 { PCI_VDEVICE(INTEL, 0x8cc4), LPC_9S},
710 { PCI_VDEVICE(INTEL, 0x9c44), LPC_LPT_LP}, 717 { PCI_VDEVICE(INTEL, 0x8cc6), LPC_9S},
711 { PCI_VDEVICE(INTEL, 0x9c45), LPC_LPT_LP},
712 { PCI_VDEVICE(INTEL, 0x9c46), LPC_LPT_LP},
713 { PCI_VDEVICE(INTEL, 0x9c47), LPC_LPT_LP},
714 { PCI_VDEVICE(INTEL, 0x8d40), LPC_WBG}, 718 { PCI_VDEVICE(INTEL, 0x8d40), LPC_WBG},
715 { PCI_VDEVICE(INTEL, 0x8d41), LPC_WBG}, 719 { PCI_VDEVICE(INTEL, 0x8d41), LPC_WBG},
716 { PCI_VDEVICE(INTEL, 0x8d42), LPC_WBG}, 720 { PCI_VDEVICE(INTEL, 0x8d42), LPC_WBG},
@@ -743,12 +747,14 @@ static const struct pci_device_id lpc_ich_ids[] = {
743 { PCI_VDEVICE(INTEL, 0x8d5d), LPC_WBG}, 747 { PCI_VDEVICE(INTEL, 0x8d5d), LPC_WBG},
744 { PCI_VDEVICE(INTEL, 0x8d5e), LPC_WBG}, 748 { PCI_VDEVICE(INTEL, 0x8d5e), LPC_WBG},
745 { PCI_VDEVICE(INTEL, 0x8d5f), LPC_WBG}, 749 { PCI_VDEVICE(INTEL, 0x8d5f), LPC_WBG},
746 { PCI_VDEVICE(INTEL, 0x1f38), LPC_AVN}, 750 { PCI_VDEVICE(INTEL, 0x9c40), LPC_LPT_LP},
747 { PCI_VDEVICE(INTEL, 0x1f39), LPC_AVN}, 751 { PCI_VDEVICE(INTEL, 0x9c41), LPC_LPT_LP},
748 { PCI_VDEVICE(INTEL, 0x1f3a), LPC_AVN}, 752 { PCI_VDEVICE(INTEL, 0x9c42), LPC_LPT_LP},
749 { PCI_VDEVICE(INTEL, 0x1f3b), LPC_AVN}, 753 { PCI_VDEVICE(INTEL, 0x9c43), LPC_LPT_LP},
750 { PCI_VDEVICE(INTEL, 0x0f1c), LPC_BAYTRAIL}, 754 { PCI_VDEVICE(INTEL, 0x9c44), LPC_LPT_LP},
751 { PCI_VDEVICE(INTEL, 0x2390), LPC_COLETO}, 755 { PCI_VDEVICE(INTEL, 0x9c45), LPC_LPT_LP},
756 { PCI_VDEVICE(INTEL, 0x9c46), LPC_LPT_LP},
757 { PCI_VDEVICE(INTEL, 0x9c47), LPC_LPT_LP},
752 { PCI_VDEVICE(INTEL, 0x9cc1), LPC_WPT_LP}, 758 { PCI_VDEVICE(INTEL, 0x9cc1), LPC_WPT_LP},
753 { PCI_VDEVICE(INTEL, 0x9cc2), LPC_WPT_LP}, 759 { PCI_VDEVICE(INTEL, 0x9cc2), LPC_WPT_LP},
754 { PCI_VDEVICE(INTEL, 0x9cc3), LPC_WPT_LP}, 760 { PCI_VDEVICE(INTEL, 0x9cc3), LPC_WPT_LP},
@@ -756,12 +762,6 @@ static const struct pci_device_id lpc_ich_ids[] = {
756 { PCI_VDEVICE(INTEL, 0x9cc6), LPC_WPT_LP}, 762 { PCI_VDEVICE(INTEL, 0x9cc6), LPC_WPT_LP},
757 { PCI_VDEVICE(INTEL, 0x9cc7), LPC_WPT_LP}, 763 { PCI_VDEVICE(INTEL, 0x9cc7), LPC_WPT_LP},
758 { PCI_VDEVICE(INTEL, 0x9cc9), LPC_WPT_LP}, 764 { PCI_VDEVICE(INTEL, 0x9cc9), LPC_WPT_LP},
759 { PCI_VDEVICE(INTEL, 0x229c), LPC_BRASWELL},
760 { PCI_VDEVICE(INTEL, 0x8cc1), LPC_9S},
761 { PCI_VDEVICE(INTEL, 0x8cc2), LPC_9S},
762 { PCI_VDEVICE(INTEL, 0x8cc3), LPC_9S},
763 { PCI_VDEVICE(INTEL, 0x8cc4), LPC_9S},
764 { PCI_VDEVICE(INTEL, 0x8cc6), LPC_9S},
765 { 0, }, /* End of list */ 765 { 0, }, /* End of list */
766}; 766};
767MODULE_DEVICE_TABLE(pci, lpc_ich_ids); 767MODULE_DEVICE_TABLE(pci, lpc_ich_ids);
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index a159593e27a0..cb14afa97e6f 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -53,8 +53,8 @@ static const struct mfd_cell max77693_devs[] = {
53 .of_compatible = "maxim,max77693-haptic", 53 .of_compatible = "maxim,max77693-haptic",
54 }, 54 },
55 { 55 {
56 .name = "max77693-flash", 56 .name = "max77693-led",
57 .of_compatible = "maxim,max77693-flash", 57 .of_compatible = "maxim,max77693-led",
58 }, 58 },
59}; 59};
60 60
diff --git a/drivers/mfd/max77843.c b/drivers/mfd/max77843.c
new file mode 100644
index 000000000000..a354ac677ec7
--- /dev/null
+++ b/drivers/mfd/max77843.c
@@ -0,0 +1,243 @@
1/*
2 * MFD core driver for the Maxim MAX77843
3 *
4 * Copyright (C) 2015 Samsung Electronics
5 * Author: Jaewon Kim <jaewon02.kim@samsung.com>
6 * Author: Beomho Seo <beomho.seo@samsung.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#include <linux/err.h>
15#include <linux/i2c.h>
16#include <linux/init.h>
17#include <linux/interrupt.h>
18#include <linux/module.h>
19#include <linux/mfd/core.h>
20#include <linux/mfd/max77843-private.h>
21#include <linux/of_device.h>
22#include <linux/platform_device.h>
23
24static const struct mfd_cell max77843_devs[] = {
25 {
26 .name = "max77843-muic",
27 .of_compatible = "maxim,max77843-muic",
28 }, {
29 .name = "max77843-regulator",
30 .of_compatible = "maxim,max77843-regulator",
31 }, {
32 .name = "max77843-charger",
33 .of_compatible = "maxim,max77843-charger"
34 }, {
35 .name = "max77843-fuelgauge",
36 .of_compatible = "maxim,max77843-fuelgauge",
37 }, {
38 .name = "max77843-haptic",
39 .of_compatible = "maxim,max77843-haptic",
40 },
41};
42
43static const struct regmap_config max77843_charger_regmap_config = {
44 .reg_bits = 8,
45 .val_bits = 8,
46 .max_register = MAX77843_CHG_REG_END,
47};
48
49static const struct regmap_config max77843_regmap_config = {
50 .reg_bits = 8,
51 .val_bits = 8,
52 .max_register = MAX77843_SYS_REG_END,
53};
54
55static const struct regmap_irq max77843_irqs[] = {
56 /* TOPSYS interrupts */
57 { .reg_offset = 0, .mask = MAX77843_SYS_IRQ_SYSUVLO_INT, },
58 { .reg_offset = 0, .mask = MAX77843_SYS_IRQ_SYSOVLO_INT, },
59 { .reg_offset = 0, .mask = MAX77843_SYS_IRQ_TSHDN_INT, },
60 { .reg_offset = 0, .mask = MAX77843_SYS_IRQ_TM_INT, },
61};
62
63static const struct regmap_irq_chip max77843_irq_chip = {
64 .name = "max77843",
65 .status_base = MAX77843_SYS_REG_SYSINTSRC,
66 .mask_base = MAX77843_SYS_REG_SYSINTMASK,
67 .mask_invert = false,
68 .num_regs = 1,
69 .irqs = max77843_irqs,
70 .num_irqs = ARRAY_SIZE(max77843_irqs),
71};
72
73/* Charger and Charger regulator use same regmap. */
74static int max77843_chg_init(struct max77843 *max77843)
75{
76 int ret;
77
78 max77843->i2c_chg = i2c_new_dummy(max77843->i2c->adapter, I2C_ADDR_CHG);
79 if (!max77843->i2c_chg) {
80 dev_err(&max77843->i2c->dev,
81 "Cannot allocate I2C device for Charger\n");
82 return PTR_ERR(max77843->i2c_chg);
83 }
84 i2c_set_clientdata(max77843->i2c_chg, max77843);
85
86 max77843->regmap_chg = devm_regmap_init_i2c(max77843->i2c_chg,
87 &max77843_charger_regmap_config);
88 if (IS_ERR(max77843->regmap_chg)) {
89 ret = PTR_ERR(max77843->regmap_chg);
90 goto err_chg_i2c;
91 }
92
93 return 0;
94
95err_chg_i2c:
96 i2c_unregister_device(max77843->i2c_chg);
97
98 return ret;
99}
100
101static int max77843_probe(struct i2c_client *i2c,
102 const struct i2c_device_id *id)
103{
104 struct max77843 *max77843;
105 unsigned int reg_data;
106 int ret;
107
108 max77843 = devm_kzalloc(&i2c->dev, sizeof(*max77843), GFP_KERNEL);
109 if (!max77843)
110 return -ENOMEM;
111
112 i2c_set_clientdata(i2c, max77843);
113 max77843->dev = &i2c->dev;
114 max77843->i2c = i2c;
115 max77843->irq = i2c->irq;
116
117 max77843->regmap = devm_regmap_init_i2c(i2c,
118 &max77843_regmap_config);
119 if (IS_ERR(max77843->regmap)) {
120 dev_err(&i2c->dev, "Failed to allocate topsys register map\n");
121 return PTR_ERR(max77843->regmap);
122 }
123
124 ret = regmap_add_irq_chip(max77843->regmap, max77843->irq,
125 IRQF_TRIGGER_LOW | IRQF_ONESHOT | IRQF_SHARED,
126 0, &max77843_irq_chip, &max77843->irq_data);
127 if (ret) {
128 dev_err(&i2c->dev, "Failed to add TOPSYS IRQ chip\n");
129 return ret;
130 }
131
132 ret = regmap_read(max77843->regmap,
133 MAX77843_SYS_REG_PMICID, &reg_data);
134 if (ret < 0) {
135 dev_err(&i2c->dev, "Failed to read PMIC ID\n");
136 goto err_pmic_id;
137 }
138 dev_info(&i2c->dev, "device ID: 0x%x\n", reg_data);
139
140 ret = max77843_chg_init(max77843);
141 if (ret) {
142 dev_err(&i2c->dev, "Failed to init Charger\n");
143 goto err_pmic_id;
144 }
145
146 ret = regmap_update_bits(max77843->regmap,
147 MAX77843_SYS_REG_INTSRCMASK,
148 MAX77843_INTSRC_MASK_MASK,
149 (unsigned int)~MAX77843_INTSRC_MASK_MASK);
150 if (ret < 0) {
151 dev_err(&i2c->dev, "Failed to unmask interrupt source\n");
152 goto err_pmic_id;
153 }
154
155 ret = mfd_add_devices(max77843->dev, -1, max77843_devs,
156 ARRAY_SIZE(max77843_devs), NULL, 0, NULL);
157 if (ret < 0) {
158 dev_err(&i2c->dev, "Failed to add mfd device\n");
159 goto err_pmic_id;
160 }
161
162 device_init_wakeup(max77843->dev, true);
163
164 return 0;
165
166err_pmic_id:
167 regmap_del_irq_chip(max77843->irq, max77843->irq_data);
168
169 return ret;
170}
171
172static int max77843_remove(struct i2c_client *i2c)
173{
174 struct max77843 *max77843 = i2c_get_clientdata(i2c);
175
176 mfd_remove_devices(max77843->dev);
177
178 regmap_del_irq_chip(max77843->irq, max77843->irq_data);
179
180 i2c_unregister_device(max77843->i2c_chg);
181
182 return 0;
183}
184
185static const struct of_device_id max77843_dt_match[] = {
186 { .compatible = "maxim,max77843", },
187 { },
188};
189
190static const struct i2c_device_id max77843_id[] = {
191 { "max77843", },
192 { },
193};
194MODULE_DEVICE_TABLE(i2c, max77843_id);
195
196static int __maybe_unused max77843_suspend(struct device *dev)
197{
198 struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
199 struct max77843 *max77843 = i2c_get_clientdata(i2c);
200
201 disable_irq(max77843->irq);
202 if (device_may_wakeup(dev))
203 enable_irq_wake(max77843->irq);
204
205 return 0;
206}
207
208static int __maybe_unused max77843_resume(struct device *dev)
209{
210 struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
211 struct max77843 *max77843 = i2c_get_clientdata(i2c);
212
213 if (device_may_wakeup(dev))
214 disable_irq_wake(max77843->irq);
215 enable_irq(max77843->irq);
216
217 return 0;
218}
219
220static SIMPLE_DEV_PM_OPS(max77843_pm, max77843_suspend, max77843_resume);
221
222static struct i2c_driver max77843_i2c_driver = {
223 .driver = {
224 .name = "max77843",
225 .pm = &max77843_pm,
226 .of_match_table = max77843_dt_match,
227 },
228 .probe = max77843_probe,
229 .remove = max77843_remove,
230 .id_table = max77843_id,
231};
232
233static int __init max77843_i2c_init(void)
234{
235 return i2c_add_driver(&max77843_i2c_driver);
236}
237subsys_initcall(max77843_i2c_init);
238
239static void __exit max77843_i2c_exit(void)
240{
241 i2c_del_driver(&max77843_i2c_driver);
242}
243module_exit(max77843_i2c_exit);
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 64dde5d24b32..25fd7116493a 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -51,19 +51,19 @@
51void mc13xxx_lock(struct mc13xxx *mc13xxx) 51void mc13xxx_lock(struct mc13xxx *mc13xxx)
52{ 52{
53 if (!mutex_trylock(&mc13xxx->lock)) { 53 if (!mutex_trylock(&mc13xxx->lock)) {
54 dev_dbg(mc13xxx->dev, "wait for %s from %pf\n", 54 dev_dbg(mc13xxx->dev, "wait for %s from %ps\n",
55 __func__, __builtin_return_address(0)); 55 __func__, __builtin_return_address(0));
56 56
57 mutex_lock(&mc13xxx->lock); 57 mutex_lock(&mc13xxx->lock);
58 } 58 }
59 dev_dbg(mc13xxx->dev, "%s from %pf\n", 59 dev_dbg(mc13xxx->dev, "%s from %ps\n",
60 __func__, __builtin_return_address(0)); 60 __func__, __builtin_return_address(0));
61} 61}
62EXPORT_SYMBOL(mc13xxx_lock); 62EXPORT_SYMBOL(mc13xxx_lock);
63 63
64void mc13xxx_unlock(struct mc13xxx *mc13xxx) 64void mc13xxx_unlock(struct mc13xxx *mc13xxx)
65{ 65{
66 dev_dbg(mc13xxx->dev, "%s from %pf\n", 66 dev_dbg(mc13xxx->dev, "%s from %ps\n",
67 __func__, __builtin_return_address(0)); 67 __func__, __builtin_return_address(0));
68 mutex_unlock(&mc13xxx->lock); 68 mutex_unlock(&mc13xxx->lock);
69} 69}
diff --git a/drivers/mfd/menelaus.c b/drivers/mfd/menelaus.c
index 9f01aef539dd..3ac36f5ccd3e 100644
--- a/drivers/mfd/menelaus.c
+++ b/drivers/mfd/menelaus.c
@@ -532,29 +532,6 @@ static const struct menelaus_vtg_value vcore_values[] = {
532 { 1450, 18 }, 532 { 1450, 18 },
533}; 533};
534 534
535int menelaus_set_vcore_sw(unsigned int mV)
536{
537 int val, ret;
538 struct i2c_client *c = the_menelaus->client;
539
540 val = menelaus_get_vtg_value(mV, vcore_values,
541 ARRAY_SIZE(vcore_values));
542 if (val < 0)
543 return -EINVAL;
544
545 dev_dbg(&c->dev, "Setting VCORE to %d mV (val 0x%02x)\n", mV, val);
546
547 /* Set SW mode and the voltage in one go. */
548 mutex_lock(&the_menelaus->lock);
549 ret = menelaus_write_reg(MENELAUS_VCORE_CTRL1, val);
550 if (ret == 0)
551 the_menelaus->vcore_hw_mode = 0;
552 mutex_unlock(&the_menelaus->lock);
553 msleep(1);
554
555 return ret;
556}
557
558int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV) 535int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV)
559{ 536{
560 int fval, rval, val, ret; 537 int fval, rval, val, ret;
@@ -1239,7 +1216,7 @@ static int menelaus_probe(struct i2c_client *client,
1239 err = menelaus_read_reg(MENELAUS_VCORE_CTRL1); 1216 err = menelaus_read_reg(MENELAUS_VCORE_CTRL1);
1240 if (err < 0) 1217 if (err < 0)
1241 goto fail; 1218 goto fail;
1242 if (err & BIT(7)) 1219 if (err & VCORE_CTRL1_HW_NSW)
1243 menelaus->vcore_hw_mode = 1; 1220 menelaus->vcore_hw_mode = 1;
1244 else 1221 else
1245 menelaus->vcore_hw_mode = 0; 1222 menelaus->vcore_hw_mode = 0;
@@ -1259,7 +1236,7 @@ fail:
1259 return err; 1236 return err;
1260} 1237}
1261 1238
1262static int __exit menelaus_remove(struct i2c_client *client) 1239static int menelaus_remove(struct i2c_client *client)
1263{ 1240{
1264 struct menelaus_chip *menelaus = i2c_get_clientdata(client); 1241 struct menelaus_chip *menelaus = i2c_get_clientdata(client);
1265 1242
@@ -1280,7 +1257,7 @@ static struct i2c_driver menelaus_i2c_driver = {
1280 .name = DRIVER_NAME, 1257 .name = DRIVER_NAME,
1281 }, 1258 },
1282 .probe = menelaus_probe, 1259 .probe = menelaus_probe,
1283 .remove = __exit_p(menelaus_remove), 1260 .remove = menelaus_remove,
1284 .id_table = menelaus_id, 1261 .id_table = menelaus_id,
1285}; 1262};
1286 1263
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 2a87f69be53d..1aed3b7b8d9b 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -128,7 +128,7 @@ static int mfd_add_device(struct device *parent, int id,
128 int platform_id; 128 int platform_id;
129 int r; 129 int r;
130 130
131 if (id < 0) 131 if (id == PLATFORM_DEVID_AUTO)
132 platform_id = id; 132 platform_id = id;
133 else 133 else
134 platform_id = id + cell->id; 134 platform_id = id + cell->id;
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
new file mode 100644
index 000000000000..09bc7804952a
--- /dev/null
+++ b/drivers/mfd/mt6397-core.c
@@ -0,0 +1,227 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Flora Fu, MediaTek
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <linux/interrupt.h>
16#include <linux/module.h>
17#include <linux/of_device.h>
18#include <linux/of_irq.h>
19#include <linux/regmap.h>
20#include <linux/mfd/core.h>
21#include <linux/mfd/mt6397/core.h>
22#include <linux/mfd/mt6397/registers.h>
23
24static const struct mfd_cell mt6397_devs[] = {
25 {
26 .name = "mt6397-rtc",
27 .of_compatible = "mediatek,mt6397-rtc",
28 }, {
29 .name = "mt6397-regulator",
30 .of_compatible = "mediatek,mt6397-regulator",
31 }, {
32 .name = "mt6397-codec",
33 .of_compatible = "mediatek,mt6397-codec",
34 }, {
35 .name = "mt6397-clk",
36 .of_compatible = "mediatek,mt6397-clk",
37 },
38};
39
40static void mt6397_irq_lock(struct irq_data *data)
41{
42 struct mt6397_chip *mt6397 = irq_get_chip_data(data->irq);
43
44 mutex_lock(&mt6397->irqlock);
45}
46
47static void mt6397_irq_sync_unlock(struct irq_data *data)
48{
49 struct mt6397_chip *mt6397 = irq_get_chip_data(data->irq);
50
51 regmap_write(mt6397->regmap, MT6397_INT_CON0, mt6397->irq_masks_cur[0]);
52 regmap_write(mt6397->regmap, MT6397_INT_CON1, mt6397->irq_masks_cur[1]);
53
54 mutex_unlock(&mt6397->irqlock);
55}
56
57static void mt6397_irq_disable(struct irq_data *data)
58{
59 struct mt6397_chip *mt6397 = irq_get_chip_data(data->irq);
60 int shift = data->hwirq & 0xf;
61 int reg = data->hwirq >> 4;
62
63 mt6397->irq_masks_cur[reg] &= ~BIT(shift);
64}
65
66static void mt6397_irq_enable(struct irq_data *data)
67{
68 struct mt6397_chip *mt6397 = irq_get_chip_data(data->irq);
69 int shift = data->hwirq & 0xf;
70 int reg = data->hwirq >> 4;
71
72 mt6397->irq_masks_cur[reg] |= BIT(shift);
73}
74
75static struct irq_chip mt6397_irq_chip = {
76 .name = "mt6397-irq",
77 .irq_bus_lock = mt6397_irq_lock,
78 .irq_bus_sync_unlock = mt6397_irq_sync_unlock,
79 .irq_enable = mt6397_irq_enable,
80 .irq_disable = mt6397_irq_disable,
81};
82
83static void mt6397_irq_handle_reg(struct mt6397_chip *mt6397, int reg,
84 int irqbase)
85{
86 unsigned int status;
87 int i, irq, ret;
88
89 ret = regmap_read(mt6397->regmap, reg, &status);
90 if (ret) {
91 dev_err(mt6397->dev, "Failed to read irq status: %d\n", ret);
92 return;
93 }
94
95 for (i = 0; i < 16; i++) {
96 if (status & BIT(i)) {
97 irq = irq_find_mapping(mt6397->irq_domain, irqbase + i);
98 if (irq)
99 handle_nested_irq(irq);
100 }
101 }
102
103 regmap_write(mt6397->regmap, reg, status);
104}
105
106static irqreturn_t mt6397_irq_thread(int irq, void *data)
107{
108 struct mt6397_chip *mt6397 = data;
109
110 mt6397_irq_handle_reg(mt6397, MT6397_INT_STATUS0, 0);
111 mt6397_irq_handle_reg(mt6397, MT6397_INT_STATUS1, 16);
112
113 return IRQ_HANDLED;
114}
115
116static int mt6397_irq_domain_map(struct irq_domain *d, unsigned int irq,
117 irq_hw_number_t hw)
118{
119 struct mt6397_chip *mt6397 = d->host_data;
120
121 irq_set_chip_data(irq, mt6397);
122 irq_set_chip_and_handler(irq, &mt6397_irq_chip, handle_level_irq);
123 irq_set_nested_thread(irq, 1);
124#ifdef CONFIG_ARM
125 set_irq_flags(irq, IRQF_VALID);
126#else
127 irq_set_noprobe(irq);
128#endif
129
130 return 0;
131}
132
133static struct irq_domain_ops mt6397_irq_domain_ops = {
134 .map = mt6397_irq_domain_map,
135};
136
137static int mt6397_irq_init(struct mt6397_chip *mt6397)
138{
139 int ret;
140
141 mutex_init(&mt6397->irqlock);
142
143 /* Mask all interrupt sources */
144 regmap_write(mt6397->regmap, MT6397_INT_CON0, 0x0);
145 regmap_write(mt6397->regmap, MT6397_INT_CON1, 0x0);
146
147 mt6397->irq_domain = irq_domain_add_linear(mt6397->dev->of_node,
148 MT6397_IRQ_NR, &mt6397_irq_domain_ops, mt6397);
149 if (!mt6397->irq_domain) {
150 dev_err(mt6397->dev, "could not create irq domain\n");
151 return -ENOMEM;
152 }
153
154 ret = devm_request_threaded_irq(mt6397->dev, mt6397->irq, NULL,
155 mt6397_irq_thread, IRQF_ONESHOT, "mt6397-pmic", mt6397);
156 if (ret) {
157 dev_err(mt6397->dev, "failed to register irq=%d; err: %d\n",
158 mt6397->irq, ret);
159 return ret;
160 }
161
162 return 0;
163}
164
165static int mt6397_probe(struct platform_device *pdev)
166{
167 int ret;
168 struct mt6397_chip *mt6397;
169
170 mt6397 = devm_kzalloc(&pdev->dev, sizeof(*mt6397), GFP_KERNEL);
171 if (!mt6397)
172 return -ENOMEM;
173
174 mt6397->dev = &pdev->dev;
175 /*
176 * mt6397 MFD is child device of soc pmic wrapper.
177 * Regmap is set from its parent.
178 */
179 mt6397->regmap = dev_get_regmap(pdev->dev.parent, NULL);
180 if (!mt6397->regmap)
181 return -ENODEV;
182
183 platform_set_drvdata(pdev, mt6397);
184
185 mt6397->irq = platform_get_irq(pdev, 0);
186 if (mt6397->irq > 0) {
187 ret = mt6397_irq_init(mt6397);
188 if (ret)
189 return ret;
190 }
191
192 ret = mfd_add_devices(&pdev->dev, -1, mt6397_devs,
193 ARRAY_SIZE(mt6397_devs), NULL, 0, NULL);
194 if (ret)
195 dev_err(&pdev->dev, "failed to add child devices: %d\n", ret);
196
197 return ret;
198}
199
200static int mt6397_remove(struct platform_device *pdev)
201{
202 mfd_remove_devices(&pdev->dev);
203
204 return 0;
205}
206
207static const struct of_device_id mt6397_of_match[] = {
208 { .compatible = "mediatek,mt6397" },
209 { }
210};
211MODULE_DEVICE_TABLE(of, mt6397_of_match);
212
213static struct platform_driver mt6397_driver = {
214 .probe = mt6397_probe,
215 .remove = mt6397_remove,
216 .driver = {
217 .name = "mt6397",
218 .of_match_table = of_match_ptr(mt6397_of_match),
219 },
220};
221
222module_platform_driver(mt6397_driver);
223
224MODULE_AUTHOR("Flora Fu, MediaTek");
225MODULE_DESCRIPTION("Driver for MediaTek MT6397 PMIC");
226MODULE_LICENSE("GPL");
227MODULE_ALIAS("platform:mt6397");
diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c
index 4b8beb2a1579..af6ac1c4b45c 100644
--- a/drivers/mfd/qcom-spmi-pmic.c
+++ b/drivers/mfd/qcom-spmi-pmic.c
@@ -17,6 +17,100 @@
17#include <linux/regmap.h> 17#include <linux/regmap.h>
18#include <linux/of_platform.h> 18#include <linux/of_platform.h>
19 19
20#define PMIC_REV2 0x101
21#define PMIC_REV3 0x102
22#define PMIC_REV4 0x103
23#define PMIC_TYPE 0x104
24#define PMIC_SUBTYPE 0x105
25
26#define PMIC_TYPE_VALUE 0x51
27
28#define COMMON_SUBTYPE 0x00
29#define PM8941_SUBTYPE 0x01
30#define PM8841_SUBTYPE 0x02
31#define PM8019_SUBTYPE 0x03
32#define PM8226_SUBTYPE 0x04
33#define PM8110_SUBTYPE 0x05
34#define PMA8084_SUBTYPE 0x06
35#define PMI8962_SUBTYPE 0x07
36#define PMD9635_SUBTYPE 0x08
37#define PM8994_SUBTYPE 0x09
38#define PMI8994_SUBTYPE 0x0a
39#define PM8916_SUBTYPE 0x0b
40#define PM8004_SUBTYPE 0x0c
41#define PM8909_SUBTYPE 0x0d
42
43static const struct of_device_id pmic_spmi_id_table[] = {
44 { .compatible = "qcom,spmi-pmic", .data = (void *)COMMON_SUBTYPE },
45 { .compatible = "qcom,pm8941", .data = (void *)PM8941_SUBTYPE },
46 { .compatible = "qcom,pm8841", .data = (void *)PM8841_SUBTYPE },
47 { .compatible = "qcom,pm8019", .data = (void *)PM8019_SUBTYPE },
48 { .compatible = "qcom,pm8226", .data = (void *)PM8226_SUBTYPE },
49 { .compatible = "qcom,pm8110", .data = (void *)PM8110_SUBTYPE },
50 { .compatible = "qcom,pma8084", .data = (void *)PMA8084_SUBTYPE },
51 { .compatible = "qcom,pmi8962", .data = (void *)PMI8962_SUBTYPE },
52 { .compatible = "qcom,pmd9635", .data = (void *)PMD9635_SUBTYPE },
53 { .compatible = "qcom,pm8994", .data = (void *)PM8994_SUBTYPE },
54 { .compatible = "qcom,pmi8994", .data = (void *)PMI8994_SUBTYPE },
55 { .compatible = "qcom,pm8916", .data = (void *)PM8916_SUBTYPE },
56 { .compatible = "qcom,pm8004", .data = (void *)PM8004_SUBTYPE },
57 { .compatible = "qcom,pm8909", .data = (void *)PM8909_SUBTYPE },
58 { }
59};
60
61static void pmic_spmi_show_revid(struct regmap *map, struct device *dev)
62{
63 unsigned int rev2, minor, major, type, subtype;
64 const char *name = "unknown";
65 int ret, i;
66
67 ret = regmap_read(map, PMIC_TYPE, &type);
68 if (ret < 0)
69 return;
70
71 if (type != PMIC_TYPE_VALUE)
72 return;
73
74 ret = regmap_read(map, PMIC_SUBTYPE, &subtype);
75 if (ret < 0)
76 return;
77
78 for (i = 0; i < ARRAY_SIZE(pmic_spmi_id_table); i++) {
79 if (subtype == (unsigned long)pmic_spmi_id_table[i].data)
80 break;
81 }
82
83 if (i != ARRAY_SIZE(pmic_spmi_id_table))
84 name = pmic_spmi_id_table[i].compatible;
85
86 ret = regmap_read(map, PMIC_REV2, &rev2);
87 if (ret < 0)
88 return;
89
90 ret = regmap_read(map, PMIC_REV3, &minor);
91 if (ret < 0)
92 return;
93
94 ret = regmap_read(map, PMIC_REV4, &major);
95 if (ret < 0)
96 return;
97
98 /*
99 * In early versions of PM8941 and PM8226, the major revision number
100 * started incrementing from 0 (eg 0 = v1.0, 1 = v2.0).
101 * Increment the major revision number here if the chip is an early
102 * version of PM8941 or PM8226.
103 */
104 if ((subtype == PM8941_SUBTYPE || subtype == PM8226_SUBTYPE) &&
105 major < 0x02)
106 major++;
107
108 if (subtype == PM8110_SUBTYPE)
109 minor = rev2;
110
111 dev_dbg(dev, "%x: %s v%d.%d\n", subtype, name, major, minor);
112}
113
20static const struct regmap_config spmi_regmap_config = { 114static const struct regmap_config spmi_regmap_config = {
21 .reg_bits = 16, 115 .reg_bits = 16,
22 .val_bits = 8, 116 .val_bits = 8,
@@ -33,6 +127,8 @@ static int pmic_spmi_probe(struct spmi_device *sdev)
33 if (IS_ERR(regmap)) 127 if (IS_ERR(regmap))
34 return PTR_ERR(regmap); 128 return PTR_ERR(regmap);
35 129
130 pmic_spmi_show_revid(regmap, &sdev->dev);
131
36 return of_platform_populate(root, NULL, NULL, &sdev->dev); 132 return of_platform_populate(root, NULL, NULL, &sdev->dev);
37} 133}
38 134
@@ -41,13 +137,6 @@ static void pmic_spmi_remove(struct spmi_device *sdev)
41 of_platform_depopulate(&sdev->dev); 137 of_platform_depopulate(&sdev->dev);
42} 138}
43 139
44static const struct of_device_id pmic_spmi_id_table[] = {
45 { .compatible = "qcom,spmi-pmic" },
46 { .compatible = "qcom,pm8941" },
47 { .compatible = "qcom,pm8841" },
48 { .compatible = "qcom,pma8084" },
49 { }
50};
51MODULE_DEVICE_TABLE(of, pmic_spmi_id_table); 140MODULE_DEVICE_TABLE(of, pmic_spmi_id_table);
52 141
53static struct spmi_driver pmic_spmi_driver = { 142static struct spmi_driver pmic_spmi_driver = {
diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c
index f696328c2933..12e324319573 100644
--- a/drivers/mfd/qcom_rpm.c
+++ b/drivers/mfd/qcom_rpm.c
@@ -323,10 +323,51 @@ static const struct qcom_rpm_data msm8960_template = {
323 .n_resources = ARRAY_SIZE(msm8960_rpm_resource_table), 323 .n_resources = ARRAY_SIZE(msm8960_rpm_resource_table),
324}; 324};
325 325
326static const struct qcom_rpm_resource ipq806x_rpm_resource_table[] = {
327 [QCOM_RPM_CXO_CLK] = { 25, 9, 5, 1 },
328 [QCOM_RPM_PXO_CLK] = { 26, 10, 6, 1 },
329 [QCOM_RPM_APPS_FABRIC_CLK] = { 27, 11, 8, 1 },
330 [QCOM_RPM_SYS_FABRIC_CLK] = { 28, 12, 9, 1 },
331 [QCOM_RPM_NSS_FABRIC_0_CLK] = { 29, 13, 10, 1 },
332 [QCOM_RPM_DAYTONA_FABRIC_CLK] = { 30, 14, 11, 1 },
333 [QCOM_RPM_SFPB_CLK] = { 31, 15, 12, 1 },
334 [QCOM_RPM_CFPB_CLK] = { 32, 16, 13, 1 },
335 [QCOM_RPM_NSS_FABRIC_1_CLK] = { 33, 17, 14, 1 },
336 [QCOM_RPM_EBI1_CLK] = { 34, 18, 16, 1 },
337 [QCOM_RPM_APPS_FABRIC_HALT] = { 35, 19, 18, 2 },
338 [QCOM_RPM_APPS_FABRIC_MODE] = { 37, 20, 19, 3 },
339 [QCOM_RPM_APPS_FABRIC_IOCTL] = { 40, 21, 20, 1 },
340 [QCOM_RPM_APPS_FABRIC_ARB] = { 41, 22, 21, 12 },
341 [QCOM_RPM_SYS_FABRIC_HALT] = { 53, 23, 22, 2 },
342 [QCOM_RPM_SYS_FABRIC_MODE] = { 55, 24, 23, 3 },
343 [QCOM_RPM_SYS_FABRIC_IOCTL] = { 58, 25, 24, 1 },
344 [QCOM_RPM_SYS_FABRIC_ARB] = { 59, 26, 25, 30 },
345 [QCOM_RPM_MM_FABRIC_HALT] = { 89, 27, 26, 2 },
346 [QCOM_RPM_MM_FABRIC_MODE] = { 91, 28, 27, 3 },
347 [QCOM_RPM_MM_FABRIC_IOCTL] = { 94, 29, 28, 1 },
348 [QCOM_RPM_MM_FABRIC_ARB] = { 95, 30, 29, 2 },
349 [QCOM_RPM_CXO_BUFFERS] = { 209, 33, 31, 1 },
350 [QCOM_RPM_USB_OTG_SWITCH] = { 210, 34, 32, 1 },
351 [QCOM_RPM_HDMI_SWITCH] = { 211, 35, 33, 1 },
352 [QCOM_RPM_DDR_DMM] = { 212, 36, 34, 2 },
353 [QCOM_RPM_VDDMIN_GPIO] = { 215, 40, 39, 1 },
354 [QCOM_RPM_SMB208_S1a] = { 216, 41, 90, 2 },
355 [QCOM_RPM_SMB208_S1b] = { 218, 43, 91, 2 },
356 [QCOM_RPM_SMB208_S2a] = { 220, 45, 92, 2 },
357 [QCOM_RPM_SMB208_S2b] = { 222, 47, 93, 2 },
358};
359
360static const struct qcom_rpm_data ipq806x_template = {
361 .version = 3,
362 .resource_table = ipq806x_rpm_resource_table,
363 .n_resources = ARRAY_SIZE(ipq806x_rpm_resource_table),
364};
365
326static const struct of_device_id qcom_rpm_of_match[] = { 366static const struct of_device_id qcom_rpm_of_match[] = {
327 { .compatible = "qcom,rpm-apq8064", .data = &apq8064_template }, 367 { .compatible = "qcom,rpm-apq8064", .data = &apq8064_template },
328 { .compatible = "qcom,rpm-msm8660", .data = &msm8660_template }, 368 { .compatible = "qcom,rpm-msm8660", .data = &msm8660_template },
329 { .compatible = "qcom,rpm-msm8960", .data = &msm8960_template }, 369 { .compatible = "qcom,rpm-msm8960", .data = &msm8960_template },
370 { .compatible = "qcom,rpm-ipq8064", .data = &ipq806x_template },
330 { } 371 { }
331}; 372};
332MODULE_DEVICE_TABLE(of, qcom_rpm_of_match); 373MODULE_DEVICE_TABLE(of, qcom_rpm_of_match);
diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index bd0215069875..4b1e4399754b 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -89,6 +89,7 @@ static const struct rk808_reg_data pre_init_reg[] = {
89 { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA }, 89 { RK808_BOOST_CONFIG_REG, BOOST_ILMIN_MASK, BOOST_ILMIN_100MA },
90 { RK808_BUCK1_CONFIG_REG, BUCK1_RATE_MASK, BUCK_ILMIN_200MA }, 90 { RK808_BUCK1_CONFIG_REG, BUCK1_RATE_MASK, BUCK_ILMIN_200MA },
91 { RK808_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_200MA }, 91 { RK808_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_200MA },
92 { RK808_DCDC_UV_ACT_REG, BUCK_UV_ACT_MASK, BUCK_UV_ACT_DISABLE},
92 { RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT | 93 { RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT |
93 VB_LO_SEL_3500MV }, 94 VB_LO_SEL_3500MV },
94}; 95};
@@ -245,7 +246,7 @@ static int rk808_remove(struct i2c_client *client)
245 return 0; 246 return 0;
246} 247}
247 248
248static struct of_device_id rk808_of_match[] = { 249static const struct of_device_id rk808_of_match[] = {
249 { .compatible = "rockchip,rk808" }, 250 { .compatible = "rockchip,rk808" },
250 { }, 251 { },
251}; 252};
diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c
index fdd34c883d86..b3ae6592014a 100644
--- a/drivers/mfd/rtl8411.c
+++ b/drivers/mfd/rtl8411.c
@@ -53,7 +53,7 @@ static void rtl8411_fetch_vendor_settings(struct rtsx_pcr *pcr)
53 u8 reg3 = 0; 53 u8 reg3 = 0;
54 54
55 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg1); 55 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg1);
56 dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg1); 56 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg1);
57 57
58 if (!rtsx_vendor_setting_valid(reg1)) 58 if (!rtsx_vendor_setting_valid(reg1))
59 return; 59 return;
@@ -65,7 +65,7 @@ static void rtl8411_fetch_vendor_settings(struct rtsx_pcr *pcr)
65 pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg1); 65 pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg1);
66 66
67 rtsx_pci_read_config_byte(pcr, PCR_SETTING_REG3, &reg3); 67 rtsx_pci_read_config_byte(pcr, PCR_SETTING_REG3, &reg3);
68 dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG3, reg3); 68 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG3, reg3);
69 pcr->sd30_drive_sel_3v3 = rtl8411_reg_to_sd30_drive_sel_3v3(reg3); 69 pcr->sd30_drive_sel_3v3 = rtl8411_reg_to_sd30_drive_sel_3v3(reg3);
70} 70}
71 71
@@ -74,7 +74,7 @@ static void rtl8411b_fetch_vendor_settings(struct rtsx_pcr *pcr)
74 u32 reg = 0; 74 u32 reg = 0;
75 75
76 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg); 76 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg);
77 dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg); 77 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
78 78
79 if (!rtsx_vendor_setting_valid(reg)) 79 if (!rtsx_vendor_setting_valid(reg))
80 return; 80 return;
@@ -260,9 +260,8 @@ static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr)
260 rtsx_pci_write_register(pcr, CARD_PWR_CTL, 260 rtsx_pci_write_register(pcr, CARD_PWR_CTL,
261 BPP_POWER_MASK, BPP_POWER_OFF); 261 BPP_POWER_MASK, BPP_POWER_OFF);
262 262
263 dev_dbg(&(pcr->pci->dev), 263 pcr_dbg(pcr, "After CD deglitch, card_exist = 0x%x\n",
264 "After CD deglitch, card_exist = 0x%x\n", 264 card_exist);
265 card_exist);
266 } 265 }
267 266
268 if (card_exist & MS_EXIST) { 267 if (card_exist & MS_EXIST) {
diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c
index cb04174a8924..373e253c33df 100644
--- a/drivers/mfd/rts5209.c
+++ b/drivers/mfd/rts5209.c
@@ -38,7 +38,7 @@ static void rts5209_fetch_vendor_settings(struct rtsx_pcr *pcr)
38 u32 reg; 38 u32 reg;
39 39
40 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg); 40 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg);
41 dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg); 41 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
42 42
43 if (rts5209_vendor_setting1_valid(reg)) { 43 if (rts5209_vendor_setting1_valid(reg)) {
44 if (rts5209_reg_check_ms_pmos(reg)) 44 if (rts5209_reg_check_ms_pmos(reg))
@@ -47,7 +47,7 @@ static void rts5209_fetch_vendor_settings(struct rtsx_pcr *pcr)
47 } 47 }
48 48
49 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, &reg); 49 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, &reg);
50 dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg); 50 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
51 51
52 if (rts5209_vendor_setting2_valid(reg)) { 52 if (rts5209_vendor_setting2_valid(reg)) {
53 pcr->sd30_drive_sel_1v8 = 53 pcr->sd30_drive_sel_1v8 =
diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c
index 32407404d838..ce012d78ce2a 100644
--- a/drivers/mfd/rts5227.c
+++ b/drivers/mfd/rts5227.c
@@ -63,7 +63,7 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr *pcr)
63 u32 reg; 63 u32 reg;
64 64
65 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg); 65 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg);
66 dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg); 66 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
67 67
68 if (!rtsx_vendor_setting_valid(reg)) 68 if (!rtsx_vendor_setting_valid(reg))
69 return; 69 return;
@@ -74,7 +74,7 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr *pcr)
74 pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg); 74 pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg);
75 75
76 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, &reg); 76 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, &reg);
77 dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg); 77 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
78 pcr->sd30_drive_sel_3v3 = rtsx_reg_to_sd30_drive_sel_3v3(reg); 78 pcr->sd30_drive_sel_3v3 = rtsx_reg_to_sd30_drive_sel_3v3(reg);
79 if (rtsx_reg_check_reverse_socket(reg)) 79 if (rtsx_reg_check_reverse_socket(reg))
80 pcr->flags |= PCR_REVERSE_SOCKET; 80 pcr->flags |= PCR_REVERSE_SOCKET;
@@ -118,11 +118,9 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
118 rts5227_fill_driving(pcr, OUTPUT_3V3); 118 rts5227_fill_driving(pcr, OUTPUT_3V3);
119 /* Configure force_clock_req */ 119 /* Configure force_clock_req */
120 if (pcr->flags & PCR_REVERSE_SOCKET) 120 if (pcr->flags & PCR_REVERSE_SOCKET)
121 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, 121 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB8, 0xB8);
122 AUTOLOAD_CFG_BASE + 3, 0xB8, 0xB8);
123 else 122 else
124 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, 123 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB8, 0x88);
125 AUTOLOAD_CFG_BASE + 3, 0xB8, 0x88);
126 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00); 124 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00);
127 125
128 return rtsx_pci_send_cmd(pcr, 100); 126 return rtsx_pci_send_cmd(pcr, 100);
@@ -132,7 +130,7 @@ static int rts5227_optimize_phy(struct rtsx_pcr *pcr)
132{ 130{
133 int err; 131 int err;
134 132
135 err = rtsx_gops_pm_reset(pcr); 133 err = rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00);
136 if (err < 0) 134 if (err < 0)
137 return err; 135 return err;
138 136
diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c
index 6353f5df087a..ace45384ec8b 100644
--- a/drivers/mfd/rts5229.c
+++ b/drivers/mfd/rts5229.c
@@ -38,7 +38,7 @@ static void rts5229_fetch_vendor_settings(struct rtsx_pcr *pcr)
38 u32 reg; 38 u32 reg;
39 39
40 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg); 40 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg);
41 dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg); 41 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
42 42
43 if (!rtsx_vendor_setting_valid(reg)) 43 if (!rtsx_vendor_setting_valid(reg))
44 return; 44 return;
@@ -50,7 +50,7 @@ static void rts5229_fetch_vendor_settings(struct rtsx_pcr *pcr)
50 pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg); 50 pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg);
51 51
52 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, &reg); 52 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, &reg);
53 dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg); 53 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
54 pcr->sd30_drive_sel_3v3 = 54 pcr->sd30_drive_sel_3v3 =
55 map_sd_drive(rtsx_reg_to_sd30_drive_sel_3v3(reg)); 55 map_sd_drive(rtsx_reg_to_sd30_drive_sel_3v3(reg));
56} 56}
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index cf425cc959d5..eb2d5866f719 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -36,16 +36,16 @@ static u8 rts5249_get_ic_version(struct rtsx_pcr *pcr)
36static void rts5249_fill_driving(struct rtsx_pcr *pcr, u8 voltage) 36static void rts5249_fill_driving(struct rtsx_pcr *pcr, u8 voltage)
37{ 37{
38 u8 driving_3v3[4][3] = { 38 u8 driving_3v3[4][3] = {
39 {0x11, 0x11, 0x11}, 39 {0x11, 0x11, 0x18},
40 {0x55, 0x55, 0x5C}, 40 {0x55, 0x55, 0x5C},
41 {0x99, 0x99, 0x92}, 41 {0xFF, 0xFF, 0xFF},
42 {0x99, 0x99, 0x92}, 42 {0x96, 0x96, 0x96},
43 }; 43 };
44 u8 driving_1v8[4][3] = { 44 u8 driving_1v8[4][3] = {
45 {0xC4, 0xC4, 0xC4},
45 {0x3C, 0x3C, 0x3C}, 46 {0x3C, 0x3C, 0x3C},
46 {0xB3, 0xB3, 0xB3},
47 {0xFE, 0xFE, 0xFE}, 47 {0xFE, 0xFE, 0xFE},
48 {0xC4, 0xC4, 0xC4}, 48 {0xB3, 0xB3, 0xB3},
49 }; 49 };
50 u8 (*driving)[3], drive_sel; 50 u8 (*driving)[3], drive_sel;
51 51
@@ -65,15 +65,17 @@ static void rts5249_fill_driving(struct rtsx_pcr *pcr, u8 voltage)
65 0xFF, driving[drive_sel][2]); 65 0xFF, driving[drive_sel][2]);
66} 66}
67 67
68static void rts5249_fetch_vendor_settings(struct rtsx_pcr *pcr) 68static void rtsx_base_fetch_vendor_settings(struct rtsx_pcr *pcr)
69{ 69{
70 u32 reg; 70 u32 reg;
71 71
72 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg); 72 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg);
73 dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg); 73 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
74 74
75 if (!rtsx_vendor_setting_valid(reg)) 75 if (!rtsx_vendor_setting_valid(reg)) {
76 pcr_dbg(pcr, "skip fetch vendor setting\n");
76 return; 77 return;
78 }
77 79
78 pcr->aspm_en = rtsx_reg_to_aspm(reg); 80 pcr->aspm_en = rtsx_reg_to_aspm(reg);
79 pcr->sd30_drive_sel_1v8 = rtsx_reg_to_sd30_drive_sel_1v8(reg); 81 pcr->sd30_drive_sel_1v8 = rtsx_reg_to_sd30_drive_sel_1v8(reg);
@@ -81,13 +83,13 @@ static void rts5249_fetch_vendor_settings(struct rtsx_pcr *pcr)
81 pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg); 83 pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg);
82 84
83 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, &reg); 85 rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, &reg);
84 dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg); 86 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
85 pcr->sd30_drive_sel_3v3 = rtsx_reg_to_sd30_drive_sel_3v3(reg); 87 pcr->sd30_drive_sel_3v3 = rtsx_reg_to_sd30_drive_sel_3v3(reg);
86 if (rtsx_reg_check_reverse_socket(reg)) 88 if (rtsx_reg_check_reverse_socket(reg))
87 pcr->flags |= PCR_REVERSE_SOCKET; 89 pcr->flags |= PCR_REVERSE_SOCKET;
88} 90}
89 91
90static void rts5249_force_power_down(struct rtsx_pcr *pcr, u8 pm_state) 92static void rtsx_base_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
91{ 93{
92 /* Set relink_time to 0 */ 94 /* Set relink_time to 0 */
93 rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 1, 0xFF, 0); 95 rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 1, 0xFF, 0);
@@ -95,7 +97,8 @@ static void rts5249_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
95 rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0); 97 rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE + 3, 0x01, 0);
96 98
97 if (pm_state == HOST_ENTER_S3) 99 if (pm_state == HOST_ENTER_S3)
98 rtsx_pci_write_register(pcr, PM_CTRL3, 0x10, 0x10); 100 rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3,
101 D3_DELINK_MODE_EN, D3_DELINK_MODE_EN);
99 102
100 rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03); 103 rtsx_pci_write_register(pcr, FPDCTL, 0x03, 0x03);
101} 104}
@@ -104,6 +107,8 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
104{ 107{
105 rtsx_pci_init_cmd(pcr); 108 rtsx_pci_init_cmd(pcr);
106 109
110 /* Rest L1SUB Config */
111 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, L1SUB_CONFIG3, 0xFF, 0x00);
107 /* Configure GPIO as output */ 112 /* Configure GPIO as output */
108 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, GPIO_CTL, 0x02, 0x02); 113 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, GPIO_CTL, 0x02, 0x02);
109 /* Reset ASPM state to default value */ 114 /* Reset ASPM state to default value */
@@ -116,12 +121,9 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
116 /* Configure driving */ 121 /* Configure driving */
117 rts5249_fill_driving(pcr, OUTPUT_3V3); 122 rts5249_fill_driving(pcr, OUTPUT_3V3);
118 if (pcr->flags & PCR_REVERSE_SOCKET) 123 if (pcr->flags & PCR_REVERSE_SOCKET)
119 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, 124 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB0, 0xB0);
120 AUTOLOAD_CFG_BASE + 3, 0xB0, 0xB0);
121 else 125 else
122 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, 126 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, 0xB0, 0x80);
123 AUTOLOAD_CFG_BASE + 3, 0xB0, 0x80);
124 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PM_CTRL3, 0x10, 0x00);
125 127
126 return rtsx_pci_send_cmd(pcr, 100); 128 return rtsx_pci_send_cmd(pcr, 100);
127} 129}
@@ -130,15 +132,16 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
130{ 132{
131 int err; 133 int err;
132 134
133 err = rtsx_gops_pm_reset(pcr); 135 err = rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00);
134 if (err < 0) 136 if (err < 0)
135 return err; 137 return err;
136 138
137 err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV, 139 err = rtsx_pci_write_phy_register(pcr, PHY_REV,
138 PHY_REG_REV_RESV | PHY_REG_REV_RXIDLE_LATCHED | 140 PHY_REV_RESV | PHY_REV_RXIDLE_LATCHED |
139 PHY_REG_REV_P1_EN | PHY_REG_REV_RXIDLE_EN | 141 PHY_REV_P1_EN | PHY_REV_RXIDLE_EN |
140 PHY_REG_REV_RX_PWST | PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 | 142 PHY_REV_CLKREQ_TX_EN | PHY_REV_RX_PWST |
141 PHY_REG_REV_STOP_CLKRD | PHY_REG_REV_STOP_CLKWR); 143 PHY_REV_CLKREQ_DT_1_0 | PHY_REV_STOP_CLKRD |
144 PHY_REV_STOP_CLKWR);
142 if (err < 0) 145 if (err < 0)
143 return err; 146 return err;
144 147
@@ -149,19 +152,21 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
149 PHY_BPCR_IB_FILTER | PHY_BPCR_CMIRROR_EN); 152 PHY_BPCR_IB_FILTER | PHY_BPCR_CMIRROR_EN);
150 if (err < 0) 153 if (err < 0)
151 return err; 154 return err;
155
152 err = rtsx_pci_write_phy_register(pcr, PHY_PCR, 156 err = rtsx_pci_write_phy_register(pcr, PHY_PCR,
153 PHY_PCR_FORCE_CODE | PHY_PCR_OOBS_CALI_50 | 157 PHY_PCR_FORCE_CODE | PHY_PCR_OOBS_CALI_50 |
154 PHY_PCR_OOBS_VCM_08 | PHY_PCR_OOBS_SEN_90 | 158 PHY_PCR_OOBS_VCM_08 | PHY_PCR_OOBS_SEN_90 |
155 PHY_PCR_RSSI_EN); 159 PHY_PCR_RSSI_EN | PHY_PCR_RX10K);
156 if (err < 0) 160 if (err < 0)
157 return err; 161 return err;
162
158 err = rtsx_pci_write_phy_register(pcr, PHY_RCR2, 163 err = rtsx_pci_write_phy_register(pcr, PHY_RCR2,
159 PHY_RCR2_EMPHASE_EN | PHY_RCR2_NADJR | 164 PHY_RCR2_EMPHASE_EN | PHY_RCR2_NADJR |
160 PHY_RCR2_CDR_CP_10 | PHY_RCR2_CDR_SR_2 | 165 PHY_RCR2_CDR_SR_2 | PHY_RCR2_FREQSEL_12 |
161 PHY_RCR2_FREQSEL_12 | PHY_RCR2_CPADJEN | 166 PHY_RCR2_CDR_SC_12P | PHY_RCR2_CALIB_LATE);
162 PHY_RCR2_CDR_SC_8 | PHY_RCR2_CALIB_LATE);
163 if (err < 0) 167 if (err < 0)
164 return err; 168 return err;
169
165 err = rtsx_pci_write_phy_register(pcr, PHY_FLD4, 170 err = rtsx_pci_write_phy_register(pcr, PHY_FLD4,
166 PHY_FLD4_FLDEN_SEL | PHY_FLD4_REQ_REF | 171 PHY_FLD4_FLDEN_SEL | PHY_FLD4_REQ_REF |
167 PHY_FLD4_RXAMP_OFF | PHY_FLD4_REQ_ADDA | 172 PHY_FLD4_RXAMP_OFF | PHY_FLD4_REQ_ADDA |
@@ -169,11 +174,12 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
169 PHY_FLD4_BER_CHK_EN); 174 PHY_FLD4_BER_CHK_EN);
170 if (err < 0) 175 if (err < 0)
171 return err; 176 return err;
172 err = rtsx_pci_write_phy_register(pcr, PHY_RDR, PHY_RDR_RXDSEL_1_9); 177 err = rtsx_pci_write_phy_register(pcr, PHY_RDR,
178 PHY_RDR_RXDSEL_1_9 | PHY_SSC_AUTO_PWD);
173 if (err < 0) 179 if (err < 0)
174 return err; 180 return err;
175 err = rtsx_pci_write_phy_register(pcr, PHY_RCR1, 181 err = rtsx_pci_write_phy_register(pcr, PHY_RCR1,
176 PHY_RCR1_ADP_TIME | PHY_RCR1_VCO_COARSE); 182 PHY_RCR1_ADP_TIME_4 | PHY_RCR1_VCO_COARSE);
177 if (err < 0) 183 if (err < 0)
178 return err; 184 return err;
179 err = rtsx_pci_write_phy_register(pcr, PHY_FLD3, 185 err = rtsx_pci_write_phy_register(pcr, PHY_FLD3,
@@ -181,33 +187,34 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
181 PHY_FLD3_RXDELINK); 187 PHY_FLD3_RXDELINK);
182 if (err < 0) 188 if (err < 0)
183 return err; 189 return err;
190
184 return rtsx_pci_write_phy_register(pcr, PHY_TUNE, 191 return rtsx_pci_write_phy_register(pcr, PHY_TUNE,
185 PHY_TUNE_TUNEREF_1_0 | PHY_TUNE_VBGSEL_1252 | 192 PHY_TUNE_TUNEREF_1_0 | PHY_TUNE_VBGSEL_1252 |
186 PHY_TUNE_SDBUS_33 | PHY_TUNE_TUNED18 | 193 PHY_TUNE_SDBUS_33 | PHY_TUNE_TUNED18 |
187 PHY_TUNE_TUNED12); 194 PHY_TUNE_TUNED12 | PHY_TUNE_TUNEA12);
188} 195}
189 196
190static int rts5249_turn_on_led(struct rtsx_pcr *pcr) 197static int rtsx_base_turn_on_led(struct rtsx_pcr *pcr)
191{ 198{
192 return rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x02); 199 return rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x02);
193} 200}
194 201
195static int rts5249_turn_off_led(struct rtsx_pcr *pcr) 202static int rtsx_base_turn_off_led(struct rtsx_pcr *pcr)
196{ 203{
197 return rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x00); 204 return rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x00);
198} 205}
199 206
200static int rts5249_enable_auto_blink(struct rtsx_pcr *pcr) 207static int rtsx_base_enable_auto_blink(struct rtsx_pcr *pcr)
201{ 208{
202 return rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x08, 0x08); 209 return rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x08, 0x08);
203} 210}
204 211
205static int rts5249_disable_auto_blink(struct rtsx_pcr *pcr) 212static int rtsx_base_disable_auto_blink(struct rtsx_pcr *pcr)
206{ 213{
207 return rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x08, 0x00); 214 return rtsx_pci_write_register(pcr, OLT_LED_CTL, 0x08, 0x00);
208} 215}
209 216
210static int rts5249_card_power_on(struct rtsx_pcr *pcr, int card) 217static int rtsx_base_card_power_on(struct rtsx_pcr *pcr, int card)
211{ 218{
212 int err; 219 int err;
213 220
@@ -234,7 +241,7 @@ static int rts5249_card_power_on(struct rtsx_pcr *pcr, int card)
234 return 0; 241 return 0;
235} 242}
236 243
237static int rts5249_card_power_off(struct rtsx_pcr *pcr, int card) 244static int rtsx_base_card_power_off(struct rtsx_pcr *pcr, int card)
238{ 245{
239 rtsx_pci_init_cmd(pcr); 246 rtsx_pci_init_cmd(pcr);
240 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL, 247 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL,
@@ -244,22 +251,35 @@ static int rts5249_card_power_off(struct rtsx_pcr *pcr, int card)
244 return rtsx_pci_send_cmd(pcr, 100); 251 return rtsx_pci_send_cmd(pcr, 100);
245} 252}
246 253
247static int rts5249_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) 254static int rtsx_base_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
248{ 255{
249 int err; 256 int err;
257 u16 append;
250 258
251 if (voltage == OUTPUT_3V3) { 259 switch (voltage) {
252 err = rtsx_pci_write_phy_register(pcr, PHY_TUNE, 0x4FC0 | 0x24); 260 case OUTPUT_3V3:
261 err = rtsx_pci_update_phy(pcr, PHY_TUNE, PHY_TUNE_VOLTAGE_MASK,
262 PHY_TUNE_VOLTAGE_3V3);
253 if (err < 0) 263 if (err < 0)
254 return err; 264 return err;
255 } else if (voltage == OUTPUT_1V8) { 265 break;
256 err = rtsx_pci_write_phy_register(pcr, PHY_BACR, 0x3C02); 266 case OUTPUT_1V8:
267 append = PHY_TUNE_D18_1V8;
268 if (CHK_PCI_PID(pcr, 0x5249)) {
269 err = rtsx_pci_update_phy(pcr, PHY_BACR,
270 PHY_BACR_BASIC_MASK, 0);
271 if (err < 0)
272 return err;
273 append = PHY_TUNE_D18_1V7;
274 }
275
276 err = rtsx_pci_update_phy(pcr, PHY_TUNE, PHY_TUNE_VOLTAGE_MASK,
277 append);
257 if (err < 0) 278 if (err < 0)
258 return err; 279 return err;
259 err = rtsx_pci_write_phy_register(pcr, PHY_TUNE, 0x4C40 | 0x24); 280 break;
260 if (err < 0) 281 default:
261 return err; 282 pcr_dbg(pcr, "unknown output voltage %d\n", voltage);
262 } else {
263 return -EINVAL; 283 return -EINVAL;
264 } 284 }
265 285
@@ -270,17 +290,17 @@ static int rts5249_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
270} 290}
271 291
272static const struct pcr_ops rts5249_pcr_ops = { 292static const struct pcr_ops rts5249_pcr_ops = {
273 .fetch_vendor_settings = rts5249_fetch_vendor_settings, 293 .fetch_vendor_settings = rtsx_base_fetch_vendor_settings,
274 .extra_init_hw = rts5249_extra_init_hw, 294 .extra_init_hw = rts5249_extra_init_hw,
275 .optimize_phy = rts5249_optimize_phy, 295 .optimize_phy = rts5249_optimize_phy,
276 .turn_on_led = rts5249_turn_on_led, 296 .turn_on_led = rtsx_base_turn_on_led,
277 .turn_off_led = rts5249_turn_off_led, 297 .turn_off_led = rtsx_base_turn_off_led,
278 .enable_auto_blink = rts5249_enable_auto_blink, 298 .enable_auto_blink = rtsx_base_enable_auto_blink,
279 .disable_auto_blink = rts5249_disable_auto_blink, 299 .disable_auto_blink = rtsx_base_disable_auto_blink,
280 .card_power_on = rts5249_card_power_on, 300 .card_power_on = rtsx_base_card_power_on,
281 .card_power_off = rts5249_card_power_off, 301 .card_power_off = rtsx_base_card_power_off,
282 .switch_output_voltage = rts5249_switch_output_voltage, 302 .switch_output_voltage = rtsx_base_switch_output_voltage,
283 .force_power_down = rts5249_force_power_down, 303 .force_power_down = rtsx_base_force_power_down,
284}; 304};
285 305
286/* SD Pull Control Enable: 306/* SD Pull Control Enable:
@@ -343,7 +363,7 @@ void rts5249_init_params(struct rtsx_pcr *pcr)
343 363
344 pcr->flags = 0; 364 pcr->flags = 0;
345 pcr->card_drive_sel = RTSX_CARD_DRIVE_DEFAULT; 365 pcr->card_drive_sel = RTSX_CARD_DRIVE_DEFAULT;
346 pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_C; 366 pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
347 pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B; 367 pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
348 pcr->aspm_en = ASPM_L1_EN; 368 pcr->aspm_en = ASPM_L1_EN;
349 pcr->tx_initial_phase = SET_CLOCK_PHASE(1, 29, 16); 369 pcr->tx_initial_phase = SET_CLOCK_PHASE(1, 29, 16);
@@ -354,4 +374,219 @@ void rts5249_init_params(struct rtsx_pcr *pcr)
354 pcr->sd_pull_ctl_disable_tbl = rts5249_sd_pull_ctl_disable_tbl; 374 pcr->sd_pull_ctl_disable_tbl = rts5249_sd_pull_ctl_disable_tbl;
355 pcr->ms_pull_ctl_enable_tbl = rts5249_ms_pull_ctl_enable_tbl; 375 pcr->ms_pull_ctl_enable_tbl = rts5249_ms_pull_ctl_enable_tbl;
356 pcr->ms_pull_ctl_disable_tbl = rts5249_ms_pull_ctl_disable_tbl; 376 pcr->ms_pull_ctl_disable_tbl = rts5249_ms_pull_ctl_disable_tbl;
377
378 pcr->reg_pm_ctrl3 = PM_CTRL3;
379}
380
381static int rts524a_write_phy(struct rtsx_pcr *pcr, u8 addr, u16 val)
382{
383 addr = addr & 0x80 ? (addr & 0x7F) | 0x40 : addr;
384
385 return __rtsx_pci_write_phy_register(pcr, addr, val);
386}
387
388static int rts524a_read_phy(struct rtsx_pcr *pcr, u8 addr, u16 *val)
389{
390 addr = addr & 0x80 ? (addr & 0x7F) | 0x40 : addr;
391
392 return __rtsx_pci_read_phy_register(pcr, addr, val);
357} 393}
394
395static int rts524a_optimize_phy(struct rtsx_pcr *pcr)
396{
397 int err;
398
399 err = rtsx_pci_write_register(pcr, RTS524A_PM_CTRL3,
400 D3_DELINK_MODE_EN, 0x00);
401 if (err < 0)
402 return err;
403
404 rtsx_pci_write_phy_register(pcr, PHY_PCR,
405 PHY_PCR_FORCE_CODE | PHY_PCR_OOBS_CALI_50 |
406 PHY_PCR_OOBS_VCM_08 | PHY_PCR_OOBS_SEN_90 | PHY_PCR_RSSI_EN);
407 rtsx_pci_write_phy_register(pcr, PHY_SSCCR3,
408 PHY_SSCCR3_STEP_IN | PHY_SSCCR3_CHECK_DELAY);
409
410 if (is_version(pcr, 0x524A, IC_VER_A)) {
411 rtsx_pci_write_phy_register(pcr, PHY_SSCCR3,
412 PHY_SSCCR3_STEP_IN | PHY_SSCCR3_CHECK_DELAY);
413 rtsx_pci_write_phy_register(pcr, PHY_SSCCR2,
414 PHY_SSCCR2_PLL_NCODE | PHY_SSCCR2_TIME0 |
415 PHY_SSCCR2_TIME2_WIDTH);
416 rtsx_pci_write_phy_register(pcr, PHY_ANA1A,
417 PHY_ANA1A_TXR_LOOPBACK | PHY_ANA1A_RXT_BIST |
418 PHY_ANA1A_TXR_BIST | PHY_ANA1A_REV);
419 rtsx_pci_write_phy_register(pcr, PHY_ANA1D,
420 PHY_ANA1D_DEBUG_ADDR);
421 rtsx_pci_write_phy_register(pcr, PHY_DIG1E,
422 PHY_DIG1E_REV | PHY_DIG1E_D0_X_D1 |
423 PHY_DIG1E_RX_ON_HOST | PHY_DIG1E_RCLK_REF_HOST |
424 PHY_DIG1E_RCLK_TX_EN_KEEP |
425 PHY_DIG1E_RCLK_TX_TERM_KEEP |
426 PHY_DIG1E_RCLK_RX_EIDLE_ON | PHY_DIG1E_TX_TERM_KEEP |
427 PHY_DIG1E_RX_TERM_KEEP | PHY_DIG1E_TX_EN_KEEP |
428 PHY_DIG1E_RX_EN_KEEP);
429 }
430
431 rtsx_pci_write_phy_register(pcr, PHY_ANA08,
432 PHY_ANA08_RX_EQ_DCGAIN | PHY_ANA08_SEL_RX_EN |
433 PHY_ANA08_RX_EQ_VAL | PHY_ANA08_SCP | PHY_ANA08_SEL_IPI);
434
435 return 0;
436}
437
438static int rts524a_extra_init_hw(struct rtsx_pcr *pcr)
439{
440 rts5249_extra_init_hw(pcr);
441
442 rtsx_pci_write_register(pcr, FUNC_FORCE_CTL,
443 FORCE_ASPM_L1_EN, FORCE_ASPM_L1_EN);
444 rtsx_pci_write_register(pcr, PM_EVENT_DEBUG, PME_DEBUG_0, PME_DEBUG_0);
445 rtsx_pci_write_register(pcr, LDO_VCC_CFG1, LDO_VCC_LMT_EN,
446 LDO_VCC_LMT_EN);
447 rtsx_pci_write_register(pcr, PCLK_CTL, PCLK_MODE_SEL, PCLK_MODE_SEL);
448 if (is_version(pcr, 0x524A, IC_VER_A)) {
449 rtsx_pci_write_register(pcr, LDO_DV18_CFG,
450 LDO_DV18_SR_MASK, LDO_DV18_SR_DF);
451 rtsx_pci_write_register(pcr, LDO_VCC_CFG1,
452 LDO_VCC_REF_TUNE_MASK, LDO_VCC_REF_1V2);
453 rtsx_pci_write_register(pcr, LDO_VIO_CFG,
454 LDO_VIO_REF_TUNE_MASK, LDO_VIO_REF_1V2);
455 rtsx_pci_write_register(pcr, LDO_VIO_CFG,
456 LDO_VIO_SR_MASK, LDO_VIO_SR_DF);
457 rtsx_pci_write_register(pcr, LDO_DV12S_CFG,
458 LDO_REF12_TUNE_MASK, LDO_REF12_TUNE_DF);
459 rtsx_pci_write_register(pcr, SD40_LDO_CTL1,
460 SD40_VIO_TUNE_MASK, SD40_VIO_TUNE_1V7);
461 }
462
463 return 0;
464}
465
466static const struct pcr_ops rts524a_pcr_ops = {
467 .write_phy = rts524a_write_phy,
468 .read_phy = rts524a_read_phy,
469 .fetch_vendor_settings = rtsx_base_fetch_vendor_settings,
470 .extra_init_hw = rts524a_extra_init_hw,
471 .optimize_phy = rts524a_optimize_phy,
472 .turn_on_led = rtsx_base_turn_on_led,
473 .turn_off_led = rtsx_base_turn_off_led,
474 .enable_auto_blink = rtsx_base_enable_auto_blink,
475 .disable_auto_blink = rtsx_base_disable_auto_blink,
476 .card_power_on = rtsx_base_card_power_on,
477 .card_power_off = rtsx_base_card_power_off,
478 .switch_output_voltage = rtsx_base_switch_output_voltage,
479 .force_power_down = rtsx_base_force_power_down,
480};
481
482void rts524a_init_params(struct rtsx_pcr *pcr)
483{
484 rts5249_init_params(pcr);
485
486 pcr->reg_pm_ctrl3 = RTS524A_PM_CTRL3;
487 pcr->ops = &rts524a_pcr_ops;
488}
489
490static int rts525a_card_power_on(struct rtsx_pcr *pcr, int card)
491{
492 rtsx_pci_write_register(pcr, LDO_VCC_CFG1,
493 LDO_VCC_TUNE_MASK, LDO_VCC_3V3);
494 return rtsx_base_card_power_on(pcr, card);
495}
496
497static int rts525a_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
498{
499 switch (voltage) {
500 case OUTPUT_3V3:
501 rtsx_pci_write_register(pcr, LDO_CONFIG2,
502 LDO_D3318_MASK, LDO_D3318_33V);
503 rtsx_pci_write_register(pcr, SD_PAD_CTL, SD_IO_USING_1V8, 0);
504 break;
505 case OUTPUT_1V8:
506 rtsx_pci_write_register(pcr, LDO_CONFIG2,
507 LDO_D3318_MASK, LDO_D3318_18V);
508 rtsx_pci_write_register(pcr, SD_PAD_CTL, SD_IO_USING_1V8,
509 SD_IO_USING_1V8);
510 break;
511 default:
512 return -EINVAL;
513 }
514
515 rtsx_pci_init_cmd(pcr);
516 rts5249_fill_driving(pcr, voltage);
517 return rtsx_pci_send_cmd(pcr, 100);
518}
519
520static int rts525a_optimize_phy(struct rtsx_pcr *pcr)
521{
522 int err;
523
524 err = rtsx_pci_write_register(pcr, RTS524A_PM_CTRL3,
525 D3_DELINK_MODE_EN, 0x00);
526 if (err < 0)
527 return err;
528
529 rtsx_pci_write_phy_register(pcr, _PHY_FLD0,
530 _PHY_FLD0_CLK_REQ_20C | _PHY_FLD0_RX_IDLE_EN |
531 _PHY_FLD0_BIT_ERR_RSTN | _PHY_FLD0_BER_COUNT |
532 _PHY_FLD0_BER_TIMER | _PHY_FLD0_CHECK_EN);
533
534 rtsx_pci_write_phy_register(pcr, _PHY_ANA03,
535 _PHY_ANA03_TIMER_MAX | _PHY_ANA03_OOBS_DEB_EN |
536 _PHY_CMU_DEBUG_EN);
537
538 if (is_version(pcr, 0x525A, IC_VER_A))
539 rtsx_pci_write_phy_register(pcr, _PHY_REV0,
540 _PHY_REV0_FILTER_OUT | _PHY_REV0_CDR_BYPASS_PFD |
541 _PHY_REV0_CDR_RX_IDLE_BYPASS);
542
543 return 0;
544}
545
546static int rts525a_extra_init_hw(struct rtsx_pcr *pcr)
547{
548 rts5249_extra_init_hw(pcr);
549
550 rtsx_pci_write_register(pcr, PCLK_CTL, PCLK_MODE_SEL, PCLK_MODE_SEL);
551 if (is_version(pcr, 0x525A, IC_VER_A)) {
552 rtsx_pci_write_register(pcr, L1SUB_CONFIG2,
553 L1SUB_AUTO_CFG, L1SUB_AUTO_CFG);
554 rtsx_pci_write_register(pcr, RREF_CFG,
555 RREF_VBGSEL_MASK, RREF_VBGSEL_1V25);
556 rtsx_pci_write_register(pcr, LDO_VIO_CFG,
557 LDO_VIO_TUNE_MASK, LDO_VIO_1V7);
558 rtsx_pci_write_register(pcr, LDO_DV12S_CFG,
559 LDO_D12_TUNE_MASK, LDO_D12_TUNE_DF);
560 rtsx_pci_write_register(pcr, LDO_AV12S_CFG,
561 LDO_AV12S_TUNE_MASK, LDO_AV12S_TUNE_DF);
562 rtsx_pci_write_register(pcr, LDO_VCC_CFG0,
563 LDO_VCC_LMTVTH_MASK, LDO_VCC_LMTVTH_2A);
564 rtsx_pci_write_register(pcr, OOBS_CONFIG,
565 OOBS_AUTOK_DIS | OOBS_VAL_MASK, 0x89);
566 }
567
568 return 0;
569}
570
571static const struct pcr_ops rts525a_pcr_ops = {
572 .fetch_vendor_settings = rtsx_base_fetch_vendor_settings,
573 .extra_init_hw = rts525a_extra_init_hw,
574 .optimize_phy = rts525a_optimize_phy,
575 .turn_on_led = rtsx_base_turn_on_led,
576 .turn_off_led = rtsx_base_turn_off_led,
577 .enable_auto_blink = rtsx_base_enable_auto_blink,
578 .disable_auto_blink = rtsx_base_disable_auto_blink,
579 .card_power_on = rts525a_card_power_on,
580 .card_power_off = rtsx_base_card_power_off,
581 .switch_output_voltage = rts525a_switch_output_voltage,
582 .force_power_down = rtsx_base_force_power_down,
583};
584
585void rts525a_init_params(struct rtsx_pcr *pcr)
586{
587 rts5249_init_params(pcr);
588
589 pcr->reg_pm_ctrl3 = RTS524A_PM_CTRL3;
590 pcr->ops = &rts525a_pcr_ops;
591}
592
diff --git a/drivers/mfd/rtsx_gops.c b/drivers/mfd/rtsx_gops.c
deleted file mode 100644
index b1a98c678593..000000000000
--- a/drivers/mfd/rtsx_gops.c
+++ /dev/null
@@ -1,37 +0,0 @@
1/* Driver for Realtek PCI-Express card reader
2 *
3 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2, or (at your option) any
8 * later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author:
19 * Micky Ching <micky_ching@realsil.com.cn>
20 */
21
22#include <linux/mfd/rtsx_pci.h>
23#include "rtsx_pcr.h"
24
25int rtsx_gops_pm_reset(struct rtsx_pcr *pcr)
26{
27 int err;
28
29 /* init aspm */
30 rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0x00);
31 err = rtsx_pci_update_cfg_byte(pcr, LCTLR, ~LCTLR_ASPM_CTL_MASK, 0x00);
32 if (err < 0)
33 return err;
34
35 /* reset PM_CTRL3 before send buffer cmd */
36 return rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00);
37}
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 30f7ca89a0e6..a66540a49079 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -58,11 +58,25 @@ static const struct pci_device_id rtsx_pci_ids[] = {
58 { PCI_DEVICE(0x10EC, 0x5249), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 58 { PCI_DEVICE(0x10EC, 0x5249), PCI_CLASS_OTHERS << 16, 0xFF0000 },
59 { PCI_DEVICE(0x10EC, 0x5287), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 59 { PCI_DEVICE(0x10EC, 0x5287), PCI_CLASS_OTHERS << 16, 0xFF0000 },
60 { PCI_DEVICE(0x10EC, 0x5286), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 60 { PCI_DEVICE(0x10EC, 0x5286), PCI_CLASS_OTHERS << 16, 0xFF0000 },
61 { PCI_DEVICE(0x10EC, 0x524A), PCI_CLASS_OTHERS << 16, 0xFF0000 },
62 { PCI_DEVICE(0x10EC, 0x525A), PCI_CLASS_OTHERS << 16, 0xFF0000 },
61 { 0, } 63 { 0, }
62}; 64};
63 65
64MODULE_DEVICE_TABLE(pci, rtsx_pci_ids); 66MODULE_DEVICE_TABLE(pci, rtsx_pci_ids);
65 67
68static inline void rtsx_pci_enable_aspm(struct rtsx_pcr *pcr)
69{
70 rtsx_pci_update_cfg_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL,
71 0xFC, pcr->aspm_en);
72}
73
74static inline void rtsx_pci_disable_aspm(struct rtsx_pcr *pcr)
75{
76 rtsx_pci_update_cfg_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL,
77 0xFC, 0);
78}
79
66void rtsx_pci_start_run(struct rtsx_pcr *pcr) 80void rtsx_pci_start_run(struct rtsx_pcr *pcr)
67{ 81{
68 /* If pci device removed, don't queue idle work any more */ 82 /* If pci device removed, don't queue idle work any more */
@@ -75,7 +89,7 @@ void rtsx_pci_start_run(struct rtsx_pcr *pcr)
75 pcr->ops->enable_auto_blink(pcr); 89 pcr->ops->enable_auto_blink(pcr);
76 90
77 if (pcr->aspm_en) 91 if (pcr->aspm_en)
78 rtsx_pci_write_config_byte(pcr, LCTLR, 0); 92 rtsx_pci_disable_aspm(pcr);
79 } 93 }
80 94
81 mod_delayed_work(system_wq, &pcr->idle_work, msecs_to_jiffies(200)); 95 mod_delayed_work(system_wq, &pcr->idle_work, msecs_to_jiffies(200));
@@ -130,7 +144,7 @@ int rtsx_pci_read_register(struct rtsx_pcr *pcr, u16 addr, u8 *data)
130} 144}
131EXPORT_SYMBOL_GPL(rtsx_pci_read_register); 145EXPORT_SYMBOL_GPL(rtsx_pci_read_register);
132 146
133int rtsx_pci_write_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 val) 147int __rtsx_pci_write_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 val)
134{ 148{
135 int err, i, finished = 0; 149 int err, i, finished = 0;
136 u8 tmp; 150 u8 tmp;
@@ -162,9 +176,17 @@ int rtsx_pci_write_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 val)
162 176
163 return 0; 177 return 0;
164} 178}
179
180int rtsx_pci_write_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 val)
181{
182 if (pcr->ops->write_phy)
183 return pcr->ops->write_phy(pcr, addr, val);
184
185 return __rtsx_pci_write_phy_register(pcr, addr, val);
186}
165EXPORT_SYMBOL_GPL(rtsx_pci_write_phy_register); 187EXPORT_SYMBOL_GPL(rtsx_pci_write_phy_register);
166 188
167int rtsx_pci_read_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 *val) 189int __rtsx_pci_read_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 *val)
168{ 190{
169 int err, i, finished = 0; 191 int err, i, finished = 0;
170 u16 data; 192 u16 data;
@@ -210,6 +232,14 @@ int rtsx_pci_read_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 *val)
210 232
211 return 0; 233 return 0;
212} 234}
235
236int rtsx_pci_read_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 *val)
237{
238 if (pcr->ops->read_phy)
239 return pcr->ops->read_phy(pcr, addr, val);
240
241 return __rtsx_pci_read_phy_register(pcr, addr, val);
242}
213EXPORT_SYMBOL_GPL(rtsx_pci_read_phy_register); 243EXPORT_SYMBOL_GPL(rtsx_pci_read_phy_register);
214 244
215void rtsx_pci_stop_cmd(struct rtsx_pcr *pcr) 245void rtsx_pci_stop_cmd(struct rtsx_pcr *pcr)
@@ -286,8 +316,7 @@ int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout)
286 timeleft = wait_for_completion_interruptible_timeout( 316 timeleft = wait_for_completion_interruptible_timeout(
287 &trans_done, msecs_to_jiffies(timeout)); 317 &trans_done, msecs_to_jiffies(timeout));
288 if (timeleft <= 0) { 318 if (timeleft <= 0) {
289 dev_dbg(&(pcr->pci->dev), "Timeout (%s %d)\n", 319 pcr_dbg(pcr, "Timeout (%s %d)\n", __func__, __LINE__);
290 __func__, __LINE__);
291 err = -ETIMEDOUT; 320 err = -ETIMEDOUT;
292 goto finish_send_cmd; 321 goto finish_send_cmd;
293 } 322 }
@@ -323,8 +352,7 @@ static void rtsx_pci_add_sg_tbl(struct rtsx_pcr *pcr,
323 u64 val; 352 u64 val;
324 u8 option = SG_VALID | SG_TRANS_DATA; 353 u8 option = SG_VALID | SG_TRANS_DATA;
325 354
326 dev_dbg(&(pcr->pci->dev), "DMA addr: 0x%x, Len: 0x%x\n", 355 pcr_dbg(pcr, "DMA addr: 0x%x, Len: 0x%x\n", (unsigned int)addr, len);
327 (unsigned int)addr, len);
328 356
329 if (end) 357 if (end)
330 option |= SG_END; 358 option |= SG_END;
@@ -339,11 +367,11 @@ int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist,
339{ 367{
340 int err = 0, count; 368 int err = 0, count;
341 369
342 dev_dbg(&(pcr->pci->dev), "--> %s: num_sg = %d\n", __func__, num_sg); 370 pcr_dbg(pcr, "--> %s: num_sg = %d\n", __func__, num_sg);
343 count = rtsx_pci_dma_map_sg(pcr, sglist, num_sg, read); 371 count = rtsx_pci_dma_map_sg(pcr, sglist, num_sg, read);
344 if (count < 1) 372 if (count < 1)
345 return -EINVAL; 373 return -EINVAL;
346 dev_dbg(&(pcr->pci->dev), "DMA mapping count: %d\n", count); 374 pcr_dbg(pcr, "DMA mapping count: %d\n", count);
347 375
348 err = rtsx_pci_dma_transfer(pcr, sglist, count, read, timeout); 376 err = rtsx_pci_dma_transfer(pcr, sglist, count, read, timeout);
349 377
@@ -417,8 +445,7 @@ int rtsx_pci_dma_transfer(struct rtsx_pcr *pcr, struct scatterlist *sglist,
417 timeleft = wait_for_completion_interruptible_timeout( 445 timeleft = wait_for_completion_interruptible_timeout(
418 &trans_done, msecs_to_jiffies(timeout)); 446 &trans_done, msecs_to_jiffies(timeout));
419 if (timeleft <= 0) { 447 if (timeleft <= 0) {
420 dev_dbg(&(pcr->pci->dev), "Timeout (%s %d)\n", 448 pcr_dbg(pcr, "Timeout (%s %d)\n", __func__, __LINE__);
421 __func__, __LINE__);
422 err = -ETIMEDOUT; 449 err = -ETIMEDOUT;
423 goto out; 450 goto out;
424 } 451 }
@@ -592,7 +619,7 @@ static void rtsx_pci_enable_bus_int(struct rtsx_pcr *pcr)
592 /* Enable Bus Interrupt */ 619 /* Enable Bus Interrupt */
593 rtsx_pci_writel(pcr, RTSX_BIER, pcr->bier); 620 rtsx_pci_writel(pcr, RTSX_BIER, pcr->bier);
594 621
595 dev_dbg(&(pcr->pci->dev), "RTSX_BIER: 0x%08x\n", pcr->bier); 622 pcr_dbg(pcr, "RTSX_BIER: 0x%08x\n", pcr->bier);
596} 623}
597 624
598static inline u8 double_ssc_depth(u8 depth) 625static inline u8 double_ssc_depth(u8 depth)
@@ -638,14 +665,13 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
638 return err; 665 return err;
639 666
640 card_clock /= 1000000; 667 card_clock /= 1000000;
641 dev_dbg(&(pcr->pci->dev), "Switch card clock to %dMHz\n", card_clock); 668 pcr_dbg(pcr, "Switch card clock to %dMHz\n", card_clock);
642 669
643 clk = card_clock; 670 clk = card_clock;
644 if (!initial_mode && double_clk) 671 if (!initial_mode && double_clk)
645 clk = card_clock * 2; 672 clk = card_clock * 2;
646 dev_dbg(&(pcr->pci->dev), 673 pcr_dbg(pcr, "Internal SSC clock: %dMHz (cur_clock = %d)\n",
647 "Internal SSC clock: %dMHz (cur_clock = %d)\n", 674 clk, pcr->cur_clock);
648 clk, pcr->cur_clock);
649 675
650 if (clk == pcr->cur_clock) 676 if (clk == pcr->cur_clock)
651 return 0; 677 return 0;
@@ -674,14 +700,14 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
674 } 700 }
675 div++; 701 div++;
676 } 702 }
677 dev_dbg(&(pcr->pci->dev), "n = %d, div = %d\n", n, div); 703 pcr_dbg(pcr, "n = %d, div = %d\n", n, div);
678 704
679 ssc_depth = depth[ssc_depth]; 705 ssc_depth = depth[ssc_depth];
680 if (double_clk) 706 if (double_clk)
681 ssc_depth = double_ssc_depth(ssc_depth); 707 ssc_depth = double_ssc_depth(ssc_depth);
682 708
683 ssc_depth = revise_ssc_depth(ssc_depth, div); 709 ssc_depth = revise_ssc_depth(ssc_depth, div);
684 dev_dbg(&(pcr->pci->dev), "ssc_depth = %d\n", ssc_depth); 710 pcr_dbg(pcr, "ssc_depth = %d\n", ssc_depth);
685 711
686 rtsx_pci_init_cmd(pcr); 712 rtsx_pci_init_cmd(pcr);
687 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CLK_CTL, 713 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CLK_CTL,
@@ -803,13 +829,13 @@ static void rtsx_pci_card_detect(struct work_struct *work)
803 dwork = to_delayed_work(work); 829 dwork = to_delayed_work(work);
804 pcr = container_of(dwork, struct rtsx_pcr, carddet_work); 830 pcr = container_of(dwork, struct rtsx_pcr, carddet_work);
805 831
806 dev_dbg(&(pcr->pci->dev), "--> %s\n", __func__); 832 pcr_dbg(pcr, "--> %s\n", __func__);
807 833
808 mutex_lock(&pcr->pcr_mutex); 834 mutex_lock(&pcr->pcr_mutex);
809 spin_lock_irqsave(&pcr->lock, flags); 835 spin_lock_irqsave(&pcr->lock, flags);
810 836
811 irq_status = rtsx_pci_readl(pcr, RTSX_BIPR); 837 irq_status = rtsx_pci_readl(pcr, RTSX_BIPR);
812 dev_dbg(&(pcr->pci->dev), "irq_status: 0x%08x\n", irq_status); 838 pcr_dbg(pcr, "irq_status: 0x%08x\n", irq_status);
813 839
814 irq_status &= CARD_EXIST; 840 irq_status &= CARD_EXIST;
815 card_inserted = pcr->card_inserted & irq_status; 841 card_inserted = pcr->card_inserted & irq_status;
@@ -820,9 +846,8 @@ static void rtsx_pci_card_detect(struct work_struct *work)
820 spin_unlock_irqrestore(&pcr->lock, flags); 846 spin_unlock_irqrestore(&pcr->lock, flags);
821 847
822 if (card_inserted || card_removed) { 848 if (card_inserted || card_removed) {
823 dev_dbg(&(pcr->pci->dev), 849 pcr_dbg(pcr, "card_inserted: 0x%x, card_removed: 0x%x\n",
824 "card_inserted: 0x%x, card_removed: 0x%x\n", 850 card_inserted, card_removed);
825 card_inserted, card_removed);
826 851
827 if (pcr->ops->cd_deglitch) 852 if (pcr->ops->cd_deglitch)
828 card_inserted = pcr->ops->cd_deglitch(pcr); 853 card_inserted = pcr->ops->cd_deglitch(pcr);
@@ -930,7 +955,7 @@ static void rtsx_pci_idle_work(struct work_struct *work)
930 struct delayed_work *dwork = to_delayed_work(work); 955 struct delayed_work *dwork = to_delayed_work(work);
931 struct rtsx_pcr *pcr = container_of(dwork, struct rtsx_pcr, idle_work); 956 struct rtsx_pcr *pcr = container_of(dwork, struct rtsx_pcr, idle_work);
932 957
933 dev_dbg(&(pcr->pci->dev), "--> %s\n", __func__); 958 pcr_dbg(pcr, "--> %s\n", __func__);
934 959
935 mutex_lock(&pcr->pcr_mutex); 960 mutex_lock(&pcr->pcr_mutex);
936 961
@@ -942,7 +967,7 @@ static void rtsx_pci_idle_work(struct work_struct *work)
942 pcr->ops->turn_off_led(pcr); 967 pcr->ops->turn_off_led(pcr);
943 968
944 if (pcr->aspm_en) 969 if (pcr->aspm_en)
945 rtsx_pci_write_config_byte(pcr, LCTLR, pcr->aspm_en); 970 rtsx_pci_enable_aspm(pcr);
946 971
947 mutex_unlock(&pcr->pcr_mutex); 972 mutex_unlock(&pcr->pcr_mutex);
948} 973}
@@ -968,6 +993,7 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
968{ 993{
969 int err; 994 int err;
970 995
996 pcr->pcie_cap = pci_find_capability(pcr->pci, PCI_CAP_ID_EXP);
971 rtsx_pci_writel(pcr, RTSX_HCBAR, pcr->host_cmds_addr); 997 rtsx_pci_writel(pcr, RTSX_HCBAR, pcr->host_cmds_addr);
972 998
973 rtsx_pci_enable_bus_int(pcr); 999 rtsx_pci_enable_bus_int(pcr);
@@ -980,6 +1006,7 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
980 /* Wait SSC power stable */ 1006 /* Wait SSC power stable */
981 udelay(200); 1007 udelay(200);
982 1008
1009 rtsx_pci_disable_aspm(pcr);
983 if (pcr->ops->optimize_phy) { 1010 if (pcr->ops->optimize_phy) {
984 err = pcr->ops->optimize_phy(pcr); 1011 err = pcr->ops->optimize_phy(pcr);
985 if (err < 0) 1012 if (err < 0)
@@ -1028,10 +1055,8 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
1028 if (err < 0) 1055 if (err < 0)
1029 return err; 1056 return err;
1030 1057
1031 rtsx_pci_write_config_byte(pcr, LCTLR, 0);
1032
1033 /* Enable clk_request_n to enable clock power management */ 1058 /* Enable clk_request_n to enable clock power management */
1034 rtsx_pci_write_config_byte(pcr, 0x81, 1); 1059 rtsx_pci_write_config_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL + 1, 1);
1035 /* Enter L1 when host tx idle */ 1060 /* Enter L1 when host tx idle */
1036 rtsx_pci_write_config_byte(pcr, 0x70F, 0x5B); 1061 rtsx_pci_write_config_byte(pcr, 0x70F, 0x5B);
1037 1062
@@ -1081,6 +1106,14 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr)
1081 rts5249_init_params(pcr); 1106 rts5249_init_params(pcr);
1082 break; 1107 break;
1083 1108
1109 case 0x524A:
1110 rts524a_init_params(pcr);
1111 break;
1112
1113 case 0x525A:
1114 rts525a_init_params(pcr);
1115 break;
1116
1084 case 0x5287: 1117 case 0x5287:
1085 rtl8411b_init_params(pcr); 1118 rtl8411b_init_params(pcr);
1086 break; 1119 break;
@@ -1090,7 +1123,7 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr)
1090 break; 1123 break;
1091 } 1124 }
1092 1125
1093 dev_dbg(&(pcr->pci->dev), "PID: 0x%04x, IC version: 0x%02x\n", 1126 pcr_dbg(pcr, "PID: 0x%04x, IC version: 0x%02x\n",
1094 PCI_PID(pcr), pcr->ic_version); 1127 PCI_PID(pcr), pcr->ic_version);
1095 1128
1096 pcr->slots = kcalloc(pcr->num_slots, sizeof(struct rtsx_slot), 1129 pcr->slots = kcalloc(pcr->num_slots, sizeof(struct rtsx_slot),
@@ -1101,14 +1134,14 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr)
1101 if (pcr->ops->fetch_vendor_settings) 1134 if (pcr->ops->fetch_vendor_settings)
1102 pcr->ops->fetch_vendor_settings(pcr); 1135 pcr->ops->fetch_vendor_settings(pcr);
1103 1136
1104 dev_dbg(&(pcr->pci->dev), "pcr->aspm_en = 0x%x\n", pcr->aspm_en); 1137 pcr_dbg(pcr, "pcr->aspm_en = 0x%x\n", pcr->aspm_en);
1105 dev_dbg(&(pcr->pci->dev), "pcr->sd30_drive_sel_1v8 = 0x%x\n", 1138 pcr_dbg(pcr, "pcr->sd30_drive_sel_1v8 = 0x%x\n",
1106 pcr->sd30_drive_sel_1v8); 1139 pcr->sd30_drive_sel_1v8);
1107 dev_dbg(&(pcr->pci->dev), "pcr->sd30_drive_sel_3v3 = 0x%x\n", 1140 pcr_dbg(pcr, "pcr->sd30_drive_sel_3v3 = 0x%x\n",
1108 pcr->sd30_drive_sel_3v3); 1141 pcr->sd30_drive_sel_3v3);
1109 dev_dbg(&(pcr->pci->dev), "pcr->card_drive_sel = 0x%x\n", 1142 pcr_dbg(pcr, "pcr->card_drive_sel = 0x%x\n",
1110 pcr->card_drive_sel); 1143 pcr->card_drive_sel);
1111 dev_dbg(&(pcr->pci->dev), "pcr->flags = 0x%x\n", pcr->flags); 1144 pcr_dbg(pcr, "pcr->flags = 0x%x\n", pcr->flags);
1112 1145
1113 pcr->state = PDEV_STAT_IDLE; 1146 pcr->state = PDEV_STAT_IDLE;
1114 err = rtsx_pci_init_hw(pcr); 1147 err = rtsx_pci_init_hw(pcr);
@@ -1126,7 +1159,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev,
1126 struct rtsx_pcr *pcr; 1159 struct rtsx_pcr *pcr;
1127 struct pcr_handle *handle; 1160 struct pcr_handle *handle;
1128 u32 base, len; 1161 u32 base, len;
1129 int ret, i; 1162 int ret, i, bar = 0;
1130 1163
1131 dev_dbg(&(pcidev->dev), 1164 dev_dbg(&(pcidev->dev),
1132 ": Realtek PCI-E Card Reader found at %s [%04x:%04x] (rev %x)\n", 1165 ": Realtek PCI-E Card Reader found at %s [%04x:%04x] (rev %x)\n",
@@ -1171,8 +1204,10 @@ static int rtsx_pci_probe(struct pci_dev *pcidev,
1171 pcr->pci = pcidev; 1204 pcr->pci = pcidev;
1172 dev_set_drvdata(&pcidev->dev, handle); 1205 dev_set_drvdata(&pcidev->dev, handle);
1173 1206
1174 len = pci_resource_len(pcidev, 0); 1207 if (CHK_PCI_PID(pcr, 0x525A))
1175 base = pci_resource_start(pcidev, 0); 1208 bar = 1;
1209 len = pci_resource_len(pcidev, bar);
1210 base = pci_resource_start(pcidev, bar);
1176 pcr->remap_addr = ioremap_nocache(base, len); 1211 pcr->remap_addr = ioremap_nocache(base, len);
1177 if (!pcr->remap_addr) { 1212 if (!pcr->remap_addr) {
1178 ret = -ENOMEM; 1213 ret = -ENOMEM;
diff --git a/drivers/mfd/rtsx_pcr.h b/drivers/mfd/rtsx_pcr.h
index fe2bbb67defc..ce48842570d7 100644
--- a/drivers/mfd/rtsx_pcr.h
+++ b/drivers/mfd/rtsx_pcr.h
@@ -27,12 +27,20 @@
27#define MIN_DIV_N_PCR 80 27#define MIN_DIV_N_PCR 80
28#define MAX_DIV_N_PCR 208 28#define MAX_DIV_N_PCR 208
29 29
30#define RTS524A_PME_FORCE_CTL 0xFF78
31#define RTS524A_PM_CTRL3 0xFF7E
32
33int __rtsx_pci_write_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 val);
34int __rtsx_pci_read_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 *val);
35
30void rts5209_init_params(struct rtsx_pcr *pcr); 36void rts5209_init_params(struct rtsx_pcr *pcr);
31void rts5229_init_params(struct rtsx_pcr *pcr); 37void rts5229_init_params(struct rtsx_pcr *pcr);
32void rtl8411_init_params(struct rtsx_pcr *pcr); 38void rtl8411_init_params(struct rtsx_pcr *pcr);
33void rtl8402_init_params(struct rtsx_pcr *pcr); 39void rtl8402_init_params(struct rtsx_pcr *pcr);
34void rts5227_init_params(struct rtsx_pcr *pcr); 40void rts5227_init_params(struct rtsx_pcr *pcr);
35void rts5249_init_params(struct rtsx_pcr *pcr); 41void rts5249_init_params(struct rtsx_pcr *pcr);
42void rts524a_init_params(struct rtsx_pcr *pcr);
43void rts525a_init_params(struct rtsx_pcr *pcr);
36void rtl8411b_init_params(struct rtsx_pcr *pcr); 44void rtl8411b_init_params(struct rtsx_pcr *pcr);
37 45
38static inline u8 map_sd_drive(int idx) 46static inline u8 map_sd_drive(int idx)
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 0a7bc43db4e4..4a69afb425ad 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -69,6 +69,8 @@ static const struct mfd_cell s2mps11_devs[] = {
69 { 69 {
70 .name = "s2mps11-pmic", 70 .name = "s2mps11-pmic",
71 }, { 71 }, {
72 .name = "s2mps14-rtc",
73 }, {
72 .name = "s2mps11-clk", 74 .name = "s2mps11-clk",
73 .of_compatible = "samsung,s2mps11-clk", 75 .of_compatible = "samsung,s2mps11-clk",
74 } 76 }
@@ -267,10 +269,8 @@ static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata(
267 struct sec_platform_data *pd; 269 struct sec_platform_data *pd;
268 270
269 pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); 271 pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
270 if (!pd) { 272 if (!pd)
271 dev_err(dev, "could not allocate memory for pdata\n");
272 return ERR_PTR(-ENOMEM); 273 return ERR_PTR(-ENOMEM);
273 }
274 274
275 /* 275 /*
276 * ToDo: the 'wakeup' member in the platform data is more of a linux 276 * ToDo: the 'wakeup' member in the platform data is more of a linux
@@ -333,7 +333,6 @@ static int sec_pmic_probe(struct i2c_client *i2c,
333 } 333 }
334 if (pdata) { 334 if (pdata) {
335 sec_pmic->device_type = pdata->device_type; 335 sec_pmic->device_type = pdata->device_type;
336 sec_pmic->ono = pdata->ono;
337 sec_pmic->irq_base = pdata->irq_base; 336 sec_pmic->irq_base = pdata->irq_base;
338 sec_pmic->wakeup = pdata->wakeup; 337 sec_pmic->wakeup = pdata->wakeup;
339 sec_pmic->pdata = pdata; 338 sec_pmic->pdata = pdata;
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c
index ba86a918c2da..806fa8dbb22d 100644
--- a/drivers/mfd/sec-irq.c
+++ b/drivers/mfd/sec-irq.c
@@ -61,14 +61,14 @@ static const struct regmap_irq s2mps11_irqs[] = {
61 .reg_offset = 1, 61 .reg_offset = 1,
62 .mask = S2MPS11_IRQ_RTC60S_MASK, 62 .mask = S2MPS11_IRQ_RTC60S_MASK,
63 }, 63 },
64 [S2MPS11_IRQ_RTCA0] = {
65 .reg_offset = 1,
66 .mask = S2MPS11_IRQ_RTCA0_MASK,
67 },
68 [S2MPS11_IRQ_RTCA1] = { 64 [S2MPS11_IRQ_RTCA1] = {
69 .reg_offset = 1, 65 .reg_offset = 1,
70 .mask = S2MPS11_IRQ_RTCA1_MASK, 66 .mask = S2MPS11_IRQ_RTCA1_MASK,
71 }, 67 },
68 [S2MPS11_IRQ_RTCA0] = {
69 .reg_offset = 1,
70 .mask = S2MPS11_IRQ_RTCA0_MASK,
71 },
72 [S2MPS11_IRQ_SMPL] = { 72 [S2MPS11_IRQ_SMPL] = {
73 .reg_offset = 1, 73 .reg_offset = 1,
74 .mask = S2MPS11_IRQ_SMPL_MASK, 74 .mask = S2MPS11_IRQ_SMPL_MASK,
@@ -484,6 +484,12 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
484 return ret; 484 return ret;
485 } 485 }
486 486
487 /*
488 * The rtc-s5m driver requests S2MPS14_IRQ_RTCA0 also for S2MPS11
489 * so the interrupt number must be consistent.
490 */
491 BUILD_BUG_ON(((enum s2mps14_irq)S2MPS11_IRQ_RTCA0) != S2MPS14_IRQ_RTCA0);
492
487 return 0; 493 return 0;
488} 494}
489 495
diff --git a/drivers/mfd/sky81452.c b/drivers/mfd/sky81452.c
new file mode 100644
index 000000000000..b0c9b0415650
--- /dev/null
+++ b/drivers/mfd/sky81452.c
@@ -0,0 +1,108 @@
1/*
2 * sky81452.c SKY81452 MFD driver
3 *
4 * Copyright 2014 Skyworks Solutions Inc.
5 * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/init.h>
23#include <linux/err.h>
24#include <linux/slab.h>
25#include <linux/i2c.h>
26#include <linux/regmap.h>
27#include <linux/mfd/core.h>
28#include <linux/mfd/sky81452.h>
29
30static const struct regmap_config sky81452_config = {
31 .reg_bits = 8,
32 .val_bits = 8,
33};
34
35static int sky81452_probe(struct i2c_client *client,
36 const struct i2c_device_id *id)
37{
38 struct device *dev = &client->dev;
39 const struct sky81452_platform_data *pdata = dev_get_platdata(dev);
40 struct mfd_cell cells[2];
41 struct regmap *regmap;
42 int ret;
43
44 if (!pdata) {
45 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
46 if (!pdata)
47 return -ENOMEM;
48 }
49
50 regmap = devm_regmap_init_i2c(client, &sky81452_config);
51 if (IS_ERR(regmap)) {
52 dev_err(dev, "failed to initialize.err=%ld\n", PTR_ERR(regmap));
53 return PTR_ERR(regmap);
54 }
55
56 i2c_set_clientdata(client, regmap);
57
58 memset(cells, 0, sizeof(cells));
59 cells[0].name = "sky81452-backlight";
60 cells[0].of_compatible = "skyworks,sky81452-backlight";
61 cells[0].platform_data = pdata->bl_pdata;
62 cells[0].pdata_size = sizeof(*pdata->bl_pdata);
63 cells[1].name = "sky81452-regulator";
64 cells[1].platform_data = pdata->regulator_init_data;
65 cells[1].pdata_size = sizeof(*pdata->regulator_init_data);
66
67 ret = mfd_add_devices(dev, -1, cells, ARRAY_SIZE(cells), NULL, 0, NULL);
68 if (ret)
69 dev_err(dev, "failed to add child devices. err=%d\n", ret);
70
71 return ret;
72}
73
74static int sky81452_remove(struct i2c_client *client)
75{
76 mfd_remove_devices(&client->dev);
77 return 0;
78}
79
80static const struct i2c_device_id sky81452_ids[] = {
81 { "sky81452" },
82 { }
83};
84MODULE_DEVICE_TABLE(i2c, sky81452_ids);
85
86#ifdef CONFIG_OF
87static const struct of_device_id sky81452_of_match[] = {
88 { .compatible = "skyworks,sky81452", },
89 { }
90};
91MODULE_DEVICE_TABLE(of, sky81452_of_match);
92#endif
93
94static struct i2c_driver sky81452_driver = {
95 .driver = {
96 .name = "sky81452",
97 .of_match_table = of_match_ptr(sky81452_of_match),
98 },
99 .probe = sky81452_probe,
100 .remove = sky81452_remove,
101 .id_table = sky81452_ids,
102};
103
104module_i2c_driver(sky81452_driver);
105
106MODULE_DESCRIPTION("Skyworks SKY81452 MFD driver");
107MODULE_AUTHOR("Gyungoh Yoo <jack.yoo@skyworksinc.com>");
108MODULE_LICENSE("GPL v2");
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
index aacb3720065c..cf356395c9e9 100644
--- a/drivers/mfd/tc3589x.c
+++ b/drivers/mfd/tc3589x.c
@@ -318,7 +318,6 @@ static int tc3589x_device_init(struct tc3589x *tc3589x)
318 return ret; 318 return ret;
319} 319}
320 320
321#ifdef CONFIG_OF
322static const struct of_device_id tc3589x_match[] = { 321static const struct of_device_id tc3589x_match[] = {
323 /* Legacy compatible string */ 322 /* Legacy compatible string */
324 { .compatible = "tc3589x", .data = (void *) TC3589X_UNKNOWN }, 323 { .compatible = "tc3589x", .data = (void *) TC3589X_UNKNOWN },
@@ -359,14 +358,6 @@ tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
359 358
360 return pdata; 359 return pdata;
361} 360}
362#else
363static inline struct tc3589x_platform_data *
364tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
365{
366 dev_err(dev, "no device tree support\n");
367 return ERR_PTR(-ENODEV);
368}
369#endif
370 361
371static int tc3589x_probe(struct i2c_client *i2c, 362static int tc3589x_probe(struct i2c_client *i2c,
372 const struct i2c_device_id *id) 363 const struct i2c_device_id *id)
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 467c80e1c4ae..e4e4b22eebc9 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -68,12 +68,6 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
68 DEFINE_WAIT(wait); 68 DEFINE_WAIT(wait);
69 u32 reg; 69 u32 reg;
70 70
71 /*
72 * disable TSC steps so it does not run while the ADC is using it. If
73 * write 0 while it is running (it just started or was already running)
74 * then it completes all steps that were enabled and stops then.
75 */
76 tscadc_writel(tsadc, REG_SE, 0);
77 reg = tscadc_readl(tsadc, REG_ADCFSM); 71 reg = tscadc_readl(tsadc, REG_ADCFSM);
78 if (reg & SEQ_STATUS) { 72 if (reg & SEQ_STATUS) {
79 tsadc->adc_waiting = true; 73 tsadc->adc_waiting = true;
@@ -86,8 +80,12 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
86 spin_lock_irq(&tsadc->reg_lock); 80 spin_lock_irq(&tsadc->reg_lock);
87 finish_wait(&tsadc->reg_se_wait, &wait); 81 finish_wait(&tsadc->reg_se_wait, &wait);
88 82
83 /*
84 * Sequencer should either be idle or
85 * busy applying the charge step.
86 */
89 reg = tscadc_readl(tsadc, REG_ADCFSM); 87 reg = tscadc_readl(tsadc, REG_ADCFSM);
90 WARN_ON(reg & SEQ_STATUS); 88 WARN_ON((reg & SEQ_STATUS) && !(reg & CHARGE_STEP));
91 tsadc->adc_waiting = false; 89 tsadc->adc_waiting = false;
92 } 90 }
93 tsadc->adc_in_use = true; 91 tsadc->adc_in_use = true;
@@ -96,7 +94,6 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
96void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val) 94void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val)
97{ 95{
98 spin_lock_irq(&tsadc->reg_lock); 96 spin_lock_irq(&tsadc->reg_lock);
99 tsadc->reg_se_cache |= val;
100 am335x_tscadc_need_adc(tsadc); 97 am335x_tscadc_need_adc(tsadc);
101 98
102 tscadc_writel(tsadc, REG_SE, val); 99 tscadc_writel(tsadc, REG_SE, val);
diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
index 743fb524fc8a..448f0a182dc4 100644
--- a/drivers/mfd/tps65010.c
+++ b/drivers/mfd/tps65010.c
@@ -515,7 +515,7 @@ static int tps65010_gpio_get(struct gpio_chip *chip, unsigned offset)
515 515
516static struct tps65010 *the_tps; 516static struct tps65010 *the_tps;
517 517
518static int __exit tps65010_remove(struct i2c_client *client) 518static int tps65010_remove(struct i2c_client *client)
519{ 519{
520 struct tps65010 *tps = i2c_get_clientdata(client); 520 struct tps65010 *tps = i2c_get_clientdata(client);
521 struct tps65010_board *board = dev_get_platdata(&client->dev); 521 struct tps65010_board *board = dev_get_platdata(&client->dev);
@@ -684,7 +684,7 @@ static struct i2c_driver tps65010_driver = {
684 .name = "tps65010", 684 .name = "tps65010",
685 }, 685 },
686 .probe = tps65010_probe, 686 .probe = tps65010_probe,
687 .remove = __exit_p(tps65010_remove), 687 .remove = tps65010_remove,
688 .id_table = tps65010_id, 688 .id_table = tps65010_id,
689}; 689};
690 690
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 393509246037..f440aed61305 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -829,7 +829,7 @@ static struct twl4030_power_data osc_off_idle = {
829 .board_config = osc_off_rconfig, 829 .board_config = osc_off_rconfig,
830}; 830};
831 831
832static struct of_device_id twl4030_power_of_match[] = { 832static const struct of_device_id twl4030_power_of_match[] = {
833 { 833 {
834 .compatible = "ti,twl4030-power", 834 .compatible = "ti,twl4030-power",
835 }, 835 },
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index f71ee3dbc2a2..c5265c1262c5 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -814,4 +814,3 @@ MODULE_DESCRIPTION("TWL6040 MFD");
814MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); 814MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>");
815MODULE_AUTHOR("Jorge Eduardo Candelaria <jorge.candelaria@ti.com>"); 815MODULE_AUTHOR("Jorge Eduardo Candelaria <jorge.candelaria@ti.com>");
816MODULE_LICENSE("GPL"); 816MODULE_LICENSE("GPL");
817MODULE_ALIAS("platform:twl6040");
diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
index 8f43ab8fd2d6..3e628df9280c 100644
--- a/drivers/mfd/vexpress-sysreg.c
+++ b/drivers/mfd/vexpress-sysreg.c
@@ -47,71 +47,26 @@
47#define SYS_HBI_MASK 0xfff 47#define SYS_HBI_MASK 0xfff
48#define SYS_PROCIDx_HBI_SHIFT 0 48#define SYS_PROCIDx_HBI_SHIFT 0
49 49
50#define SYS_MCI_CARDIN (1 << 0)
51#define SYS_MCI_WPROT (1 << 1)
52
53#define SYS_MISC_MASTERSITE (1 << 14) 50#define SYS_MISC_MASTERSITE (1 << 14)
54 51
55 52void vexpress_flags_set(u32 data)
56static void __iomem *__vexpress_sysreg_base;
57
58static void __iomem *vexpress_sysreg_base(void)
59{ 53{
60 if (!__vexpress_sysreg_base) { 54 static void __iomem *base;
55
56 if (!base) {
61 struct device_node *node = of_find_compatible_node(NULL, NULL, 57 struct device_node *node = of_find_compatible_node(NULL, NULL,
62 "arm,vexpress-sysreg"); 58 "arm,vexpress-sysreg");
63 59
64 __vexpress_sysreg_base = of_iomap(node, 0); 60 base = of_iomap(node, 0);
65 } 61 }
66 62
67 WARN_ON(!__vexpress_sysreg_base); 63 if (WARN_ON(!base))
68 64 return;
69 return __vexpress_sysreg_base;
70}
71
72
73static int vexpress_sysreg_get_master(void)
74{
75 if (readl(vexpress_sysreg_base() + SYS_MISC) & SYS_MISC_MASTERSITE)
76 return VEXPRESS_SITE_DB2;
77
78 return VEXPRESS_SITE_DB1;
79}
80
81void vexpress_flags_set(u32 data)
82{
83 writel(~0, vexpress_sysreg_base() + SYS_FLAGSCLR);
84 writel(data, vexpress_sysreg_base() + SYS_FLAGSSET);
85}
86
87unsigned int vexpress_get_mci_cardin(struct device *dev)
88{
89 return readl(vexpress_sysreg_base() + SYS_MCI) & SYS_MCI_CARDIN;
90}
91
92u32 vexpress_get_procid(int site)
93{
94 if (site == VEXPRESS_SITE_MASTER)
95 site = vexpress_sysreg_get_master();
96 65
97 return readl(vexpress_sysreg_base() + (site == VEXPRESS_SITE_DB1 ? 66 writel(~0, base + SYS_FLAGSCLR);
98 SYS_PROCID0 : SYS_PROCID1)); 67 writel(data, base + SYS_FLAGSSET);
99} 68}
100 69
101void __iomem *vexpress_get_24mhz_clock_base(void)
102{
103 return vexpress_sysreg_base() + SYS_24MHZ;
104}
105
106
107void __init vexpress_sysreg_early_init(void __iomem *base)
108{
109 __vexpress_sysreg_base = base;
110
111 vexpress_config_set_master(vexpress_sysreg_get_master());
112}
113
114
115/* The sysreg block is just a random collection of various functions... */ 70/* The sysreg block is just a random collection of various functions... */
116 71
117static struct syscon_platform_data vexpress_sysreg_sys_id_pdata = { 72static struct syscon_platform_data vexpress_sysreg_sys_id_pdata = {
@@ -210,6 +165,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
210 struct resource *mem; 165 struct resource *mem;
211 void __iomem *base; 166 void __iomem *base;
212 struct bgpio_chip *mmc_gpio_chip; 167 struct bgpio_chip *mmc_gpio_chip;
168 int master;
213 u32 dt_hbi; 169 u32 dt_hbi;
214 170
215 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 171 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -220,11 +176,14 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
220 if (!base) 176 if (!base)
221 return -ENOMEM; 177 return -ENOMEM;
222 178
223 vexpress_config_set_master(vexpress_sysreg_get_master()); 179 master = readl(base + SYS_MISC) & SYS_MISC_MASTERSITE ?
180 VEXPRESS_SITE_DB2 : VEXPRESS_SITE_DB1;
181 vexpress_config_set_master(master);
224 182
225 /* Confirm board type against DT property, if available */ 183 /* Confirm board type against DT property, if available */
226 if (of_property_read_u32(of_root, "arm,hbi", &dt_hbi) == 0) { 184 if (of_property_read_u32(of_root, "arm,hbi", &dt_hbi) == 0) {
227 u32 id = vexpress_get_procid(VEXPRESS_SITE_MASTER); 185 u32 id = readl(base + (master == VEXPRESS_SITE_DB1 ?
186 SYS_PROCID0 : SYS_PROCID1));
228 u32 hbi = (id >> SYS_PROCIDx_HBI_SHIFT) & SYS_HBI_MASK; 187 u32 hbi = (id >> SYS_PROCIDx_HBI_SHIFT) & SYS_HBI_MASK;
229 188
230 if (WARN_ON(dt_hbi != hbi)) 189 if (WARN_ON(dt_hbi != hbi))
diff --git a/drivers/mfd/wm5102-tables.c b/drivers/mfd/wm5102-tables.c
index b326a82017ee..aeae6ec123b3 100644
--- a/drivers/mfd/wm5102-tables.c
+++ b/drivers/mfd/wm5102-tables.c
@@ -1172,9 +1172,6 @@ static bool wm5102_readable_register(struct device *dev, unsigned int reg)
1172 case ARIZONA_DAC_DIGITAL_VOLUME_3L: 1172 case ARIZONA_DAC_DIGITAL_VOLUME_3L:
1173 case ARIZONA_DAC_VOLUME_LIMIT_3L: 1173 case ARIZONA_DAC_VOLUME_LIMIT_3L:
1174 case ARIZONA_NOISE_GATE_SELECT_3L: 1174 case ARIZONA_NOISE_GATE_SELECT_3L:
1175 case ARIZONA_OUTPUT_PATH_CONFIG_3R:
1176 case ARIZONA_DAC_DIGITAL_VOLUME_3R:
1177 case ARIZONA_DAC_VOLUME_LIMIT_3R:
1178 case ARIZONA_OUTPUT_PATH_CONFIG_4L: 1175 case ARIZONA_OUTPUT_PATH_CONFIG_4L:
1179 case ARIZONA_DAC_DIGITAL_VOLUME_4L: 1176 case ARIZONA_DAC_DIGITAL_VOLUME_4L:
1180 case ARIZONA_OUT_VOLUME_4L: 1177 case ARIZONA_OUT_VOLUME_4L:
diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c
index 4116e74effa4..fcb98dbda837 100644
--- a/drivers/regulator/arizona-micsupp.c
+++ b/drivers/regulator/arizona-micsupp.c
@@ -246,6 +246,7 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
246 */ 246 */
247 switch (arizona->type) { 247 switch (arizona->type) {
248 case WM5110: 248 case WM5110:
249 case WM8280:
249 desc = &arizona_micsupp_ext; 250 desc = &arizona_micsupp_ext;
250 micsupp->init_data = arizona_micsupp_ext_default; 251 micsupp->init_data = arizona_micsupp_ext_default;
251 break; 252 break;
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 89ac1d5083c6..4008b84246ca 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -48,8 +48,6 @@ struct s5m_rtc_reg_config {
48 unsigned int alarm0; 48 unsigned int alarm0;
49 /* First register for alarm 1, seconds */ 49 /* First register for alarm 1, seconds */
50 unsigned int alarm1; 50 unsigned int alarm1;
51 /* SMPL/WTSR register */
52 unsigned int smpl_wtsr;
53 /* 51 /*
54 * Register for update flag (UDR). Typically setting UDR field to 1 52 * Register for update flag (UDR). Typically setting UDR field to 1
55 * will enable update of time or alarm register. Then it will be 53 * will enable update of time or alarm register. Then it will be
@@ -67,7 +65,6 @@ static const struct s5m_rtc_reg_config s5m_rtc_regs = {
67 .ctrl = S5M_ALARM1_CONF, 65 .ctrl = S5M_ALARM1_CONF,
68 .alarm0 = S5M_ALARM0_SEC, 66 .alarm0 = S5M_ALARM0_SEC,
69 .alarm1 = S5M_ALARM1_SEC, 67 .alarm1 = S5M_ALARM1_SEC,
70 .smpl_wtsr = S5M_WTSR_SMPL_CNTL,
71 .rtc_udr_update = S5M_RTC_UDR_CON, 68 .rtc_udr_update = S5M_RTC_UDR_CON,
72 .rtc_udr_mask = S5M_RTC_UDR_MASK, 69 .rtc_udr_mask = S5M_RTC_UDR_MASK,
73}; 70};
@@ -82,7 +79,6 @@ static const struct s5m_rtc_reg_config s2mps_rtc_regs = {
82 .ctrl = S2MPS_RTC_CTRL, 79 .ctrl = S2MPS_RTC_CTRL,
83 .alarm0 = S2MPS_ALARM0_SEC, 80 .alarm0 = S2MPS_ALARM0_SEC,
84 .alarm1 = S2MPS_ALARM1_SEC, 81 .alarm1 = S2MPS_ALARM1_SEC,
85 .smpl_wtsr = S2MPS_WTSR_SMPL_CNTL,
86 .rtc_udr_update = S2MPS_RTC_UDR_CON, 82 .rtc_udr_update = S2MPS_RTC_UDR_CON,
87 .rtc_udr_mask = S2MPS_RTC_WUDR_MASK, 83 .rtc_udr_mask = S2MPS_RTC_WUDR_MASK,
88}; 84};
@@ -96,7 +92,6 @@ struct s5m_rtc_info {
96 int irq; 92 int irq;
97 int device_type; 93 int device_type;
98 int rtc_24hr_mode; 94 int rtc_24hr_mode;
99 bool wtsr_smpl;
100 const struct s5m_rtc_reg_config *regs; 95 const struct s5m_rtc_reg_config *regs;
101}; 96};
102 97
@@ -597,28 +592,6 @@ static const struct rtc_class_ops s5m_rtc_ops = {
597 .alarm_irq_enable = s5m_rtc_alarm_irq_enable, 592 .alarm_irq_enable = s5m_rtc_alarm_irq_enable,
598}; 593};
599 594
600static void s5m_rtc_enable_wtsr(struct s5m_rtc_info *info, bool enable)
601{
602 int ret;
603 ret = regmap_update_bits(info->regmap, info->regs->smpl_wtsr,
604 WTSR_ENABLE_MASK,
605 enable ? WTSR_ENABLE_MASK : 0);
606 if (ret < 0)
607 dev_err(info->dev, "%s: fail to update WTSR reg(%d)\n",
608 __func__, ret);
609}
610
611static void s5m_rtc_enable_smpl(struct s5m_rtc_info *info, bool enable)
612{
613 int ret;
614 ret = regmap_update_bits(info->regmap, info->regs->smpl_wtsr,
615 SMPL_ENABLE_MASK,
616 enable ? SMPL_ENABLE_MASK : 0);
617 if (ret < 0)
618 dev_err(info->dev, "%s: fail to update SMPL reg(%d)\n",
619 __func__, ret);
620}
621
622static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) 595static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info)
623{ 596{
624 u8 data[2]; 597 u8 data[2];
@@ -715,7 +688,6 @@ static int s5m_rtc_probe(struct platform_device *pdev)
715 info->dev = &pdev->dev; 688 info->dev = &pdev->dev;
716 info->s5m87xx = s5m87xx; 689 info->s5m87xx = s5m87xx;
717 info->device_type = s5m87xx->device_type; 690 info->device_type = s5m87xx->device_type;
718 info->wtsr_smpl = s5m87xx->wtsr_smpl;
719 691
720 if (s5m87xx->irq_data) { 692 if (s5m87xx->irq_data) {
721 info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq); 693 info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq);
@@ -731,11 +703,6 @@ static int s5m_rtc_probe(struct platform_device *pdev)
731 703
732 ret = s5m8767_rtc_init_reg(info); 704 ret = s5m8767_rtc_init_reg(info);
733 705
734 if (info->wtsr_smpl) {
735 s5m_rtc_enable_wtsr(info, true);
736 s5m_rtc_enable_smpl(info, true);
737 }
738
739 device_init_wakeup(&pdev->dev, 1); 706 device_init_wakeup(&pdev->dev, 1);
740 707
741 info->rtc_dev = devm_rtc_device_register(&pdev->dev, "s5m-rtc", 708 info->rtc_dev = devm_rtc_device_register(&pdev->dev, "s5m-rtc",
@@ -768,36 +735,10 @@ err:
768 return ret; 735 return ret;
769} 736}
770 737
771static void s5m_rtc_shutdown(struct platform_device *pdev)
772{
773 struct s5m_rtc_info *info = platform_get_drvdata(pdev);
774 int i;
775 unsigned int val = 0;
776 if (info->wtsr_smpl) {
777 for (i = 0; i < 3; i++) {
778 s5m_rtc_enable_wtsr(info, false);
779 regmap_read(info->regmap, info->regs->smpl_wtsr, &val);
780 pr_debug("%s: WTSR_SMPL reg(0x%02x)\n", __func__, val);
781 if (val & WTSR_ENABLE_MASK)
782 pr_emerg("%s: fail to disable WTSR\n",
783 __func__);
784 else {
785 pr_info("%s: success to disable WTSR\n",
786 __func__);
787 break;
788 }
789 }
790 }
791 /* Disable SMPL when power off */
792 s5m_rtc_enable_smpl(info, false);
793}
794
795static int s5m_rtc_remove(struct platform_device *pdev) 738static int s5m_rtc_remove(struct platform_device *pdev)
796{ 739{
797 struct s5m_rtc_info *info = platform_get_drvdata(pdev); 740 struct s5m_rtc_info *info = platform_get_drvdata(pdev);
798 741
799 /* Perform also all shutdown steps when removing */
800 s5m_rtc_shutdown(pdev);
801 i2c_unregister_device(info->i2c); 742 i2c_unregister_device(info->i2c);
802 743
803 return 0; 744 return 0;
@@ -842,7 +783,6 @@ static struct platform_driver s5m_rtc_driver = {
842 }, 783 },
843 .probe = s5m_rtc_probe, 784 .probe = s5m_rtc_probe,
844 .remove = s5m_rtc_remove, 785 .remove = s5m_rtc_remove,
845 .shutdown = s5m_rtc_shutdown,
846 .id_table = s5m_rtc_id, 786 .id_table = s5m_rtc_id,
847}; 787};
848 788
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index efb09046a8cf..2d9923a60076 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -408,6 +408,16 @@ config BACKLIGHT_PANDORA
408 If you have a Pandora console, say Y to enable the 408 If you have a Pandora console, say Y to enable the
409 backlight driver. 409 backlight driver.
410 410
411config BACKLIGHT_SKY81452
412 tristate "Backlight driver for SKY81452"
413 depends on BACKLIGHT_CLASS_DEVICE && MFD_SKY81452
414 help
415 If you have a Skyworks SKY81452, say Y to enable the
416 backlight driver.
417
418 To compile this driver as a module, choose M here: the module will
419 be called sky81452-backlight
420
411config BACKLIGHT_TPS65217 421config BACKLIGHT_TPS65217
412 tristate "TPS65217 Backlight" 422 tristate "TPS65217 Backlight"
413 depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217 423 depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b732165..d67073f9d421 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o
50obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o 50obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
51obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o 51obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o
52obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o 52obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
53obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o
53obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o 54obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
54obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o 55obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o
55obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o 56obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/sky81452-backlight.c b/drivers/video/backlight/sky81452-backlight.c
new file mode 100644
index 000000000000..052fa1bac03d
--- /dev/null
+++ b/drivers/video/backlight/sky81452-backlight.c
@@ -0,0 +1,353 @@
1/*
2 * sky81452-backlight.c SKY81452 backlight driver
3 *
4 * Copyright 2014 Skyworks Solutions Inc.
5 * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/backlight.h>
21#include <linux/err.h>
22#include <linux/gpio.h>
23#include <linux/init.h>
24#include <linux/kernel.h>
25#include <linux/module.h>
26#include <linux/of.h>
27#include <linux/of_gpio.h>
28#include <linux/platform_device.h>
29#include <linux/regmap.h>
30#include <linux/platform_data/sky81452-backlight.h>
31#include <linux/slab.h>
32
33/* registers */
34#define SKY81452_REG0 0x00
35#define SKY81452_REG1 0x01
36#define SKY81452_REG2 0x02
37#define SKY81452_REG4 0x04
38#define SKY81452_REG5 0x05
39
40/* bit mask */
41#define SKY81452_CS 0xFF
42#define SKY81452_EN 0x3F
43#define SKY81452_IGPW 0x20
44#define SKY81452_PWMMD 0x10
45#define SKY81452_PHASE 0x08
46#define SKY81452_ILIM 0x04
47#define SKY81452_VSHRT 0x03
48#define SKY81452_OCP 0x80
49#define SKY81452_OTMP 0x40
50#define SKY81452_SHRT 0x3F
51#define SKY81452_OPN 0x3F
52
53#define SKY81452_DEFAULT_NAME "lcd-backlight"
54#define SKY81452_MAX_BRIGHTNESS (SKY81452_CS + 1)
55
56#define CTZ(b) __builtin_ctz(b)
57
58static int sky81452_bl_update_status(struct backlight_device *bd)
59{
60 const struct sky81452_bl_platform_data *pdata =
61 dev_get_platdata(bd->dev.parent);
62 const unsigned int brightness = (unsigned int)bd->props.brightness;
63 struct regmap *regmap = bl_get_data(bd);
64 int ret;
65
66 if (brightness > 0) {
67 ret = regmap_write(regmap, SKY81452_REG0, brightness - 1);
68 if (IS_ERR_VALUE(ret))
69 return ret;
70
71 return regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
72 pdata->enable << CTZ(SKY81452_EN));
73 }
74
75 return regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN, 0);
76}
77
78static const struct backlight_ops sky81452_bl_ops = {
79 .update_status = sky81452_bl_update_status,
80};
81
82static ssize_t sky81452_bl_store_enable(struct device *dev,
83 struct device_attribute *attr, const char *buf, size_t count)
84{
85 struct regmap *regmap = bl_get_data(to_backlight_device(dev));
86 unsigned long value;
87 int ret;
88
89 ret = kstrtoul(buf, 16, &value);
90 if (IS_ERR_VALUE(ret))
91 return ret;
92
93 ret = regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
94 value << CTZ(SKY81452_EN));
95 if (IS_ERR_VALUE(ret))
96 return ret;
97
98 return count;
99}
100
101static ssize_t sky81452_bl_show_open_short(struct device *dev,
102 struct device_attribute *attr, char *buf)
103{
104 struct regmap *regmap = bl_get_data(to_backlight_device(dev));
105 unsigned int reg, value = 0;
106 char tmp[3];
107 int i, ret;
108
109 reg = !strcmp(attr->attr.name, "open") ? SKY81452_REG5 : SKY81452_REG4;
110 ret = regmap_read(regmap, reg, &value);
111 if (IS_ERR_VALUE(ret))
112 return ret;
113
114 if (value & SKY81452_SHRT) {
115 *buf = 0;
116 for (i = 0; i < 6; i++) {
117 if (value & 0x01) {
118 sprintf(tmp, "%d ", i + 1);
119 strcat(buf, tmp);
120 }
121 value >>= 1;
122 }
123 strcat(buf, "\n");
124 } else {
125 strcpy(buf, "none\n");
126 }
127
128 return strlen(buf);
129}
130
131static ssize_t sky81452_bl_show_fault(struct device *dev,
132 struct device_attribute *attr, char *buf)
133{
134 struct regmap *regmap = bl_get_data(to_backlight_device(dev));
135 unsigned int value = 0;
136 int ret;
137
138 ret = regmap_read(regmap, SKY81452_REG4, &value);
139 if (IS_ERR_VALUE(ret))
140 return ret;
141
142 *buf = 0;
143
144 if (value & SKY81452_OCP)
145 strcat(buf, "over-current ");
146
147 if (value & SKY81452_OTMP)
148 strcat(buf, "over-temperature");
149
150 strcat(buf, "\n");
151 return strlen(buf);
152}
153
154static DEVICE_ATTR(enable, S_IWGRP | S_IWUSR, NULL, sky81452_bl_store_enable);
155static DEVICE_ATTR(open, S_IRUGO, sky81452_bl_show_open_short, NULL);
156static DEVICE_ATTR(short, S_IRUGO, sky81452_bl_show_open_short, NULL);
157static DEVICE_ATTR(fault, S_IRUGO, sky81452_bl_show_fault, NULL);
158
159static struct attribute *sky81452_bl_attribute[] = {
160 &dev_attr_enable.attr,
161 &dev_attr_open.attr,
162 &dev_attr_short.attr,
163 &dev_attr_fault.attr,
164 NULL
165};
166
167static const struct attribute_group sky81452_bl_attr_group = {
168 .attrs = sky81452_bl_attribute,
169};
170
171#ifdef CONFIG_OF
172static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
173 struct device *dev)
174{
175 struct device_node *np = of_node_get(dev->of_node);
176 struct sky81452_bl_platform_data *pdata;
177 int num_entry;
178 unsigned int sources[6];
179 int ret;
180
181 if (!np) {
182 dev_err(dev, "backlight node not found.\n");
183 return ERR_PTR(-ENODATA);
184 }
185
186 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
187 if (!pdata) {
188 of_node_put(np);
189 return ERR_PTR(-ENOMEM);
190 }
191
192 of_property_read_string(np, "name", &pdata->name);
193 pdata->ignore_pwm = of_property_read_bool(np, "skyworks,ignore-pwm");
194 pdata->dpwm_mode = of_property_read_bool(np, "skyworks,dpwm-mode");
195 pdata->phase_shift = of_property_read_bool(np, "skyworks,phase-shift");
196 pdata->gpio_enable = of_get_gpio(np, 0);
197
198 ret = of_property_count_u32_elems(np, "led-sources");
199 if (IS_ERR_VALUE(ret)) {
200 pdata->enable = SKY81452_EN >> CTZ(SKY81452_EN);
201 } else {
202 num_entry = ret;
203 if (num_entry > 6)
204 num_entry = 6;
205
206 ret = of_property_read_u32_array(np, "led-sources", sources,
207 num_entry);
208 if (IS_ERR_VALUE(ret)) {
209 dev_err(dev, "led-sources node is invalid.\n");
210 return ERR_PTR(-EINVAL);
211 }
212
213 pdata->enable = 0;
214 while (--num_entry)
215 pdata->enable |= (1 << sources[num_entry]);
216 }
217
218 ret = of_property_read_u32(np,
219 "skyworks,short-detection-threshold-volt",
220 &pdata->short_detection_threshold);
221 if (IS_ERR_VALUE(ret))
222 pdata->short_detection_threshold = 7;
223
224 ret = of_property_read_u32(np, "skyworks,current-limit-mA",
225 &pdata->boost_current_limit);
226 if (IS_ERR_VALUE(ret))
227 pdata->boost_current_limit = 2750;
228
229 of_node_put(np);
230 return pdata;
231}
232#else
233static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
234 struct device *dev)
235{
236 return ERR_PTR(-EINVAL);
237}
238#endif
239
240static int sky81452_bl_init_device(struct regmap *regmap,
241 struct sky81452_bl_platform_data *pdata)
242{
243 unsigned int value;
244
245 value = pdata->ignore_pwm ? SKY81452_IGPW : 0;
246 value |= pdata->dpwm_mode ? SKY81452_PWMMD : 0;
247 value |= pdata->phase_shift ? 0 : SKY81452_PHASE;
248
249 if (pdata->boost_current_limit == 2300)
250 value |= SKY81452_ILIM;
251 else if (pdata->boost_current_limit != 2750)
252 return -EINVAL;
253
254 if (pdata->short_detection_threshold < 4 ||
255 pdata->short_detection_threshold > 7)
256 return -EINVAL;
257 value |= (7 - pdata->short_detection_threshold) << CTZ(SKY81452_VSHRT);
258
259 return regmap_write(regmap, SKY81452_REG2, value);
260}
261
262static int sky81452_bl_probe(struct platform_device *pdev)
263{
264 struct device *dev = &pdev->dev;
265 struct regmap *regmap = dev_get_drvdata(dev->parent);
266 struct sky81452_bl_platform_data *pdata = dev_get_platdata(dev);
267 struct backlight_device *bd;
268 struct backlight_properties props;
269 const char *name;
270 int ret;
271
272 if (!pdata) {
273 pdata = sky81452_bl_parse_dt(dev);
274 if (IS_ERR(pdata))
275 return PTR_ERR(pdata);
276 }
277
278 if (gpio_is_valid(pdata->gpio_enable)) {
279 ret = devm_gpio_request_one(dev, pdata->gpio_enable,
280 GPIOF_OUT_INIT_HIGH, "sky81452-en");
281 if (IS_ERR_VALUE(ret)) {
282 dev_err(dev, "failed to request GPIO. err=%d\n", ret);
283 return ret;
284 }
285 }
286
287 ret = sky81452_bl_init_device(regmap, pdata);
288 if (IS_ERR_VALUE(ret)) {
289 dev_err(dev, "failed to initialize. err=%d\n", ret);
290 return ret;
291 }
292
293 memset(&props, 0, sizeof(props));
294 props.max_brightness = SKY81452_MAX_BRIGHTNESS,
295 name = pdata->name ? pdata->name : SKY81452_DEFAULT_NAME;
296 bd = devm_backlight_device_register(dev, name, dev, regmap,
297 &sky81452_bl_ops, &props);
298 if (IS_ERR(bd)) {
299 dev_err(dev, "failed to register. err=%ld\n", PTR_ERR(bd));
300 return PTR_ERR(bd);
301 }
302
303 platform_set_drvdata(pdev, bd);
304
305 ret = sysfs_create_group(&bd->dev.kobj, &sky81452_bl_attr_group);
306 if (IS_ERR_VALUE(ret)) {
307 dev_err(dev, "failed to create attribute. err=%d\n", ret);
308 return ret;
309 }
310
311 return ret;
312}
313
314static int sky81452_bl_remove(struct platform_device *pdev)
315{
316 const struct sky81452_bl_platform_data *pdata =
317 dev_get_platdata(&pdev->dev);
318 struct backlight_device *bd = platform_get_drvdata(pdev);
319
320 sysfs_remove_group(&bd->dev.kobj, &sky81452_bl_attr_group);
321
322 bd->props.power = FB_BLANK_UNBLANK;
323 bd->props.brightness = 0;
324 backlight_update_status(bd);
325
326 if (gpio_is_valid(pdata->gpio_enable))
327 gpio_set_value_cansleep(pdata->gpio_enable, 0);
328
329 return 0;
330}
331
332#ifdef CONFIG_OF
333static const struct of_device_id sky81452_bl_of_match[] = {
334 { .compatible = "skyworks,sky81452-backlight", },
335 { }
336};
337MODULE_DEVICE_TABLE(of, sky81452_bl_of_match);
338#endif
339
340static struct platform_driver sky81452_bl_driver = {
341 .driver = {
342 .name = "sky81452-backlight",
343 .of_match_table = of_match_ptr(sky81452_bl_of_match),
344 },
345 .probe = sky81452_bl_probe,
346 .remove = sky81452_bl_remove,
347};
348
349module_platform_driver(sky81452_bl_driver);
350
351MODULE_DESCRIPTION("Skyworks SKY81452 backlight driver");
352MODULE_AUTHOR("Gyungoh Yoo <jack.yoo@skyworksinc.com>");
353MODULE_LICENSE("GPL v2");
diff --git a/include/linux/mfd/arizona/gpio.h b/include/dt-bindings/mfd/arizona.h
index d2146bb74f89..c7af7c7ef793 100644
--- a/include/linux/mfd/arizona/gpio.h
+++ b/include/dt-bindings/mfd/arizona.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * GPIO configuration for Arizona devices 2 * Device Tree defines for Arizona devices
3 * 3 *
4 * Copyright 2013 Wolfson Microelectronics. PLC. 4 * Copyright 2015 Cirrus Logic Inc.
5 * 5 *
6 * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> 6 * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
7 * 7 *
@@ -10,9 +10,10 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13#ifndef _ARIZONA_GPIO_H 13#ifndef _DT_BINDINGS_MFD_ARIZONA_H
14#define _ARIZONA_GPIO_H 14#define _DT_BINDINGS_MFD_ARIZONA_H
15 15
16/* GPIO Function Definitions */
16#define ARIZONA_GP_FN_TXLRCLK 0x00 17#define ARIZONA_GP_FN_TXLRCLK 0x00
17#define ARIZONA_GP_FN_GPIO 0x01 18#define ARIZONA_GP_FN_GPIO 0x01
18#define ARIZONA_GP_FN_IRQ1 0x02 19#define ARIZONA_GP_FN_IRQ1 0x02
@@ -61,36 +62,32 @@
61#define ARIZONA_GP_FN_SYSCLK_ENA_STATUS 0x4B 62#define ARIZONA_GP_FN_SYSCLK_ENA_STATUS 0x4B
62#define ARIZONA_GP_FN_ASYNCCLK_ENA_STATUS 0x4C 63#define ARIZONA_GP_FN_ASYNCCLK_ENA_STATUS 0x4C
63 64
64#define ARIZONA_GPN_DIR 0x8000 /* GPN_DIR */ 65/* GPIO Configuration Bits */
65#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */ 66#define ARIZONA_GPN_DIR 0x8000
66#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */ 67#define ARIZONA_GPN_PU 0x4000
67#define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */ 68#define ARIZONA_GPN_PD 0x2000
68#define ARIZONA_GPN_PU 0x4000 /* GPN_PU */ 69#define ARIZONA_GPN_LVL 0x0800
69#define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */ 70#define ARIZONA_GPN_POL 0x0400
70#define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */ 71#define ARIZONA_GPN_OP_CFG 0x0200
71#define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */ 72#define ARIZONA_GPN_DB 0x0100
72#define ARIZONA_GPN_PD 0x2000 /* GPN_PD */ 73
73#define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */ 74/* Provide some defines for the most common configs */
74#define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */ 75#define ARIZONA_GP_DEFAULT 0xffffffff
75#define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */ 76#define ARIZONA_GP_OUTPUT (ARIZONA_GP_FN_GPIO)
76#define ARIZONA_GPN_LVL 0x0800 /* GPN_LVL */ 77#define ARIZONA_GP_INPUT (ARIZONA_GP_FN_GPIO | \
77#define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */ 78 ARIZONA_GPN_DIR)
78#define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */ 79
79#define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */ 80#define ARIZONA_32KZ_MCLK1 1
80#define ARIZONA_GPN_POL 0x0400 /* GPN_POL */ 81#define ARIZONA_32KZ_MCLK2 2
81#define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */ 82#define ARIZONA_32KZ_NONE 3
82#define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */ 83
83#define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */ 84#define ARIZONA_DMIC_MICVDD 0
84#define ARIZONA_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */ 85#define ARIZONA_DMIC_MICBIAS1 1
85#define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */ 86#define ARIZONA_DMIC_MICBIAS2 2
86#define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */ 87#define ARIZONA_DMIC_MICBIAS3 3
87#define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */ 88
88#define ARIZONA_GPN_DB 0x0100 /* GPN_DB */ 89#define ARIZONA_INMODE_DIFF 0
89#define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */ 90#define ARIZONA_INMODE_SE 1
90#define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */ 91#define ARIZONA_INMODE_DMIC 2
91#define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */
92#define ARIZONA_GPN_FN_MASK 0x007F /* GPN_DB */
93#define ARIZONA_GPN_FN_SHIFT 0 /* GPN_DB */
94#define ARIZONA_GPN_FN_WIDTH 7 /* GPN_DB */
95 92
96#endif 93#endif
diff --git a/include/dt-bindings/mfd/qcom-rpm.h b/include/dt-bindings/mfd/qcom-rpm.h
index 388a6f3d6165..13a9d4bf2662 100644
--- a/include/dt-bindings/mfd/qcom-rpm.h
+++ b/include/dt-bindings/mfd/qcom-rpm.h
@@ -141,6 +141,12 @@
141#define QCOM_RPM_SYS_FABRIC_MODE 131 141#define QCOM_RPM_SYS_FABRIC_MODE 131
142#define QCOM_RPM_USB_OTG_SWITCH 132 142#define QCOM_RPM_USB_OTG_SWITCH 132
143#define QCOM_RPM_VDDMIN_GPIO 133 143#define QCOM_RPM_VDDMIN_GPIO 133
144#define QCOM_RPM_NSS_FABRIC_0_CLK 134
145#define QCOM_RPM_NSS_FABRIC_1_CLK 135
146#define QCOM_RPM_SMB208_S1a 136
147#define QCOM_RPM_SMB208_S1b 137
148#define QCOM_RPM_SMB208_S2a 138
149#define QCOM_RPM_SMB208_S2b 139
144 150
145/* 151/*
146 * Constants used to select force mode for regulators. 152 * Constants used to select force mode for regulators.
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index 910e3aa1e965..f97010576f56 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -24,6 +24,7 @@ enum arizona_type {
24 WM5102 = 1, 24 WM5102 = 1,
25 WM5110 = 2, 25 WM5110 = 2,
26 WM8997 = 3, 26 WM8997 = 3,
27 WM8280 = 4,
27}; 28};
28 29
29#define ARIZONA_IRQ_GP1 0 30#define ARIZONA_IRQ_GP1 0
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 4578c72c9b86..1789cb0f4f17 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -11,31 +11,26 @@
11#ifndef _ARIZONA_PDATA_H 11#ifndef _ARIZONA_PDATA_H
12#define _ARIZONA_PDATA_H 12#define _ARIZONA_PDATA_H
13 13
14#define ARIZONA_GPN_DIR 0x8000 /* GPN_DIR */ 14#include <dt-bindings/mfd/arizona.h>
15
15#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */ 16#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */
16#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */ 17#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */
17#define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */ 18#define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */
18#define ARIZONA_GPN_PU 0x4000 /* GPN_PU */
19#define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */ 19#define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */
20#define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */ 20#define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */
21#define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */ 21#define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */
22#define ARIZONA_GPN_PD 0x2000 /* GPN_PD */
23#define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */ 22#define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */
24#define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */ 23#define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */
25#define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */ 24#define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */
26#define ARIZONA_GPN_LVL 0x0800 /* GPN_LVL */
27#define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */ 25#define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */
28#define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */ 26#define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */
29#define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */ 27#define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */
30#define ARIZONA_GPN_POL 0x0400 /* GPN_POL */
31#define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */ 28#define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */
32#define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */ 29#define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */
33#define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */ 30#define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */
34#define ARIZONA_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */
35#define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */ 31#define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */
36#define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */ 32#define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */
37#define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */ 33#define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */
38#define ARIZONA_GPN_DB 0x0100 /* GPN_DB */
39#define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */ 34#define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */
40#define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */ 35#define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */
41#define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */ 36#define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */
@@ -45,23 +40,10 @@
45 40
46#define ARIZONA_MAX_GPIO 5 41#define ARIZONA_MAX_GPIO 5
47 42
48#define ARIZONA_32KZ_MCLK1 1
49#define ARIZONA_32KZ_MCLK2 2
50#define ARIZONA_32KZ_NONE 3
51
52#define ARIZONA_MAX_INPUT 4 43#define ARIZONA_MAX_INPUT 4
53 44
54#define ARIZONA_DMIC_MICVDD 0
55#define ARIZONA_DMIC_MICBIAS1 1
56#define ARIZONA_DMIC_MICBIAS2 2
57#define ARIZONA_DMIC_MICBIAS3 3
58
59#define ARIZONA_MAX_MICBIAS 3 45#define ARIZONA_MAX_MICBIAS 3
60 46
61#define ARIZONA_INMODE_DIFF 0
62#define ARIZONA_INMODE_SE 1
63#define ARIZONA_INMODE_DMIC 2
64
65#define ARIZONA_MAX_OUTPUT 6 47#define ARIZONA_MAX_OUTPUT 6
66 48
67#define ARIZONA_MAX_AIF 3 49#define ARIZONA_MAX_AIF 3
@@ -112,7 +94,7 @@ struct arizona_pdata {
112 int gpio_base; 94 int gpio_base;
113 95
114 /** Pin state for GPIO pins */ 96 /** Pin state for GPIO pins */
115 int gpio_defaults[ARIZONA_MAX_GPIO]; 97 unsigned int gpio_defaults[ARIZONA_MAX_GPIO];
116 98
117 /** 99 /**
118 * Maximum number of channels clocks will be generated for, 100 * Maximum number of channels clocks will be generated for,
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 955dd990beaf..51633ea6f910 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -87,6 +87,7 @@ enum max77693_pmic_reg {
87/* MAX77693 ITORCH register */ 87/* MAX77693 ITORCH register */
88#define TORCH_IOUT1_SHIFT 0 88#define TORCH_IOUT1_SHIFT 0
89#define TORCH_IOUT2_SHIFT 4 89#define TORCH_IOUT2_SHIFT 4
90#define TORCH_IOUT_MASK(x) (0xf << (x))
90#define TORCH_IOUT_MIN 15625 91#define TORCH_IOUT_MIN 15625
91#define TORCH_IOUT_MAX 250000 92#define TORCH_IOUT_MAX 250000
92#define TORCH_IOUT_STEP 15625 93#define TORCH_IOUT_STEP 15625
@@ -113,8 +114,8 @@ enum max77693_pmic_reg {
113#define FLASH_EN_FLASH 0x1 114#define FLASH_EN_FLASH 0x1
114#define FLASH_EN_TORCH 0x2 115#define FLASH_EN_TORCH 0x2
115#define FLASH_EN_ON 0x3 116#define FLASH_EN_ON 0x3
116#define FLASH_EN_SHIFT(x) (6 - ((x) - 1) * 2) 117#define FLASH_EN_SHIFT(x) (6 - (x) * 2)
117#define TORCH_EN_SHIFT(x) (2 - ((x) - 1) * 2) 118#define TORCH_EN_SHIFT(x) (2 - (x) * 2)
118 119
119/* MAX77693 MAX_FLASH1 register */ 120/* MAX77693 MAX_FLASH1 register */
120#define MAX_FLASH1_MAX_FL_EN 0x80 121#define MAX_FLASH1_MAX_FL_EN 0x80
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index 09a4dedaeea8..d450f687301b 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -81,19 +81,6 @@ enum max77693_led_boost_mode {
81 MAX77693_LED_BOOST_FIXED, 81 MAX77693_LED_BOOST_FIXED,
82}; 82};
83 83
84struct max77693_led_platform_data {
85 u32 fleds[2];
86 u32 iout_torch[2];
87 u32 iout_flash[2];
88 u32 trigger[2];
89 u32 trigger_type[2];
90 u32 num_leds;
91 u32 boost_mode;
92 u32 flash_timeout;
93 u32 boost_vout;
94 u32 low_vsys;
95};
96
97/* MAX77693 */ 84/* MAX77693 */
98 85
99struct max77693_platform_data { 86struct max77693_platform_data {
diff --git a/include/linux/mfd/max77843-private.h b/include/linux/mfd/max77843-private.h
new file mode 100644
index 000000000000..7178ace8379e
--- /dev/null
+++ b/include/linux/mfd/max77843-private.h
@@ -0,0 +1,454 @@
1/*
2 * Common variables for the Maxim MAX77843 driver
3 *
4 * Copyright (C) 2015 Samsung Electronics
5 * Author: Jaewon Kim <jaewon02.kim@samsung.com>
6 * Author: Beomho Seo <beomho.seo@samsung.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __MAX77843_PRIVATE_H_
15#define __MAX77843_PRIVATE_H_
16
17#include <linux/i2c.h>
18#include <linux/regmap.h>
19
20#define I2C_ADDR_TOPSYS (0xCC >> 1)
21#define I2C_ADDR_CHG (0xD2 >> 1)
22#define I2C_ADDR_FG (0x6C >> 1)
23#define I2C_ADDR_MUIC (0x4A >> 1)
24
25/* Topsys, Haptic and LED registers */
26enum max77843_sys_reg {
27 MAX77843_SYS_REG_PMICID = 0x00,
28 MAX77843_SYS_REG_PMICREV = 0x01,
29 MAX77843_SYS_REG_MAINCTRL1 = 0x02,
30 MAX77843_SYS_REG_INTSRC = 0x22,
31 MAX77843_SYS_REG_INTSRCMASK = 0x23,
32 MAX77843_SYS_REG_SYSINTSRC = 0x24,
33 MAX77843_SYS_REG_SYSINTMASK = 0x26,
34 MAX77843_SYS_REG_TOPSYS_STAT = 0x28,
35 MAX77843_SYS_REG_SAFEOUTCTRL = 0xC6,
36
37 MAX77843_SYS_REG_END,
38};
39
40enum max77843_haptic_reg {
41 MAX77843_HAP_REG_MCONFIG = 0x10,
42
43 MAX77843_HAP_REG_END,
44};
45
46enum max77843_led_reg {
47 MAX77843_LED_REG_LEDEN = 0x30,
48 MAX77843_LED_REG_LED0BRT = 0x31,
49 MAX77843_LED_REG_LED1BRT = 0x32,
50 MAX77843_LED_REG_LED2BRT = 0x33,
51 MAX77843_LED_REG_LED3BRT = 0x34,
52 MAX77843_LED_REG_LEDBLNK = 0x38,
53 MAX77843_LED_REG_LEDRAMP = 0x36,
54
55 MAX77843_LED_REG_END,
56};
57
58/* Charger registers */
59enum max77843_charger_reg {
60 MAX77843_CHG_REG_CHG_INT = 0xB0,
61 MAX77843_CHG_REG_CHG_INT_MASK = 0xB1,
62 MAX77843_CHG_REG_CHG_INT_OK = 0xB2,
63 MAX77843_CHG_REG_CHG_DTLS_00 = 0xB3,
64 MAX77843_CHG_REG_CHG_DTLS_01 = 0xB4,
65 MAX77843_CHG_REG_CHG_DTLS_02 = 0xB5,
66 MAX77843_CHG_REG_CHG_CNFG_00 = 0xB7,
67 MAX77843_CHG_REG_CHG_CNFG_01 = 0xB8,
68 MAX77843_CHG_REG_CHG_CNFG_02 = 0xB9,
69 MAX77843_CHG_REG_CHG_CNFG_03 = 0xBA,
70 MAX77843_CHG_REG_CHG_CNFG_04 = 0xBB,
71 MAX77843_CHG_REG_CHG_CNFG_06 = 0xBD,
72 MAX77843_CHG_REG_CHG_CNFG_07 = 0xBE,
73 MAX77843_CHG_REG_CHG_CNFG_09 = 0xC0,
74 MAX77843_CHG_REG_CHG_CNFG_10 = 0xC1,
75 MAX77843_CHG_REG_CHG_CNFG_11 = 0xC2,
76 MAX77843_CHG_REG_CHG_CNFG_12 = 0xC3,
77
78 MAX77843_CHG_REG_END,
79};
80
81/* Fuel gauge registers */
82enum max77843_fuelgauge {
83 MAX77843_FG_REG_STATUS = 0x00,
84 MAX77843_FG_REG_VALRT_TH = 0x01,
85 MAX77843_FG_REG_TALRT_TH = 0x02,
86 MAX77843_FG_REG_SALRT_TH = 0x03,
87 MAX77843_FG_RATE_AT_RATE = 0x04,
88 MAX77843_FG_REG_REMCAP_REP = 0x05,
89 MAX77843_FG_REG_SOCREP = 0x06,
90 MAX77843_FG_REG_AGE = 0x07,
91 MAX77843_FG_REG_TEMP = 0x08,
92 MAX77843_FG_REG_VCELL = 0x09,
93 MAX77843_FG_REG_CURRENT = 0x0A,
94 MAX77843_FG_REG_AVG_CURRENT = 0x0B,
95 MAX77843_FG_REG_SOCMIX = 0x0D,
96 MAX77843_FG_REG_SOCAV = 0x0E,
97 MAX77843_FG_REG_REMCAP_MIX = 0x0F,
98 MAX77843_FG_REG_FULLCAP = 0x10,
99 MAX77843_FG_REG_AVG_TEMP = 0x16,
100 MAX77843_FG_REG_CYCLES = 0x17,
101 MAX77843_FG_REG_AVG_VCELL = 0x19,
102 MAX77843_FG_REG_CONFIG = 0x1D,
103 MAX77843_FG_REG_REMCAP_AV = 0x1F,
104 MAX77843_FG_REG_FULLCAP_NOM = 0x23,
105 MAX77843_FG_REG_MISCCFG = 0x2B,
106 MAX77843_FG_REG_RCOMP = 0x38,
107 MAX77843_FG_REG_FSTAT = 0x3D,
108 MAX77843_FG_REG_DQACC = 0x45,
109 MAX77843_FG_REG_DPACC = 0x46,
110 MAX77843_FG_REG_OCV = 0xEE,
111 MAX77843_FG_REG_VFOCV = 0xFB,
112 MAX77843_FG_SOCVF = 0xFF,
113
114 MAX77843_FG_END,
115};
116
117/* MUIC registers */
118enum max77843_muic_reg {
119 MAX77843_MUIC_REG_ID = 0x00,
120 MAX77843_MUIC_REG_INT1 = 0x01,
121 MAX77843_MUIC_REG_INT2 = 0x02,
122 MAX77843_MUIC_REG_INT3 = 0x03,
123 MAX77843_MUIC_REG_STATUS1 = 0x04,
124 MAX77843_MUIC_REG_STATUS2 = 0x05,
125 MAX77843_MUIC_REG_STATUS3 = 0x06,
126 MAX77843_MUIC_REG_INTMASK1 = 0x07,
127 MAX77843_MUIC_REG_INTMASK2 = 0x08,
128 MAX77843_MUIC_REG_INTMASK3 = 0x09,
129 MAX77843_MUIC_REG_CDETCTRL1 = 0x0A,
130 MAX77843_MUIC_REG_CDETCTRL2 = 0x0B,
131 MAX77843_MUIC_REG_CONTROL1 = 0x0C,
132 MAX77843_MUIC_REG_CONTROL2 = 0x0D,
133 MAX77843_MUIC_REG_CONTROL3 = 0x0E,
134 MAX77843_MUIC_REG_CONTROL4 = 0x16,
135 MAX77843_MUIC_REG_HVCONTROL1 = 0x17,
136 MAX77843_MUIC_REG_HVCONTROL2 = 0x18,
137
138 MAX77843_MUIC_REG_END,
139};
140
141enum max77843_irq {
142 /* Topsys: SYSTEM */
143 MAX77843_SYS_IRQ_SYSINTSRC_SYSUVLO_INT,
144 MAX77843_SYS_IRQ_SYSINTSRC_SYSOVLO_INT,
145 MAX77843_SYS_IRQ_SYSINTSRC_TSHDN_INT,
146 MAX77843_SYS_IRQ_SYSINTSRC_TM_INT,
147
148 /* Charger: CHG_INT */
149 MAX77843_CHG_IRQ_CHG_INT_BYP_I,
150 MAX77843_CHG_IRQ_CHG_INT_BATP_I,
151 MAX77843_CHG_IRQ_CHG_INT_BAT_I,
152 MAX77843_CHG_IRQ_CHG_INT_CHG_I,
153 MAX77843_CHG_IRQ_CHG_INT_WCIN_I,
154 MAX77843_CHG_IRQ_CHG_INT_CHGIN_I,
155 MAX77843_CHG_IRQ_CHG_INT_AICL_I,
156
157 MAX77843_IRQ_NUM,
158};
159
160enum max77843_irq_muic {
161 /* MUIC: INT1 */
162 MAX77843_MUIC_IRQ_INT1_ADC,
163 MAX77843_MUIC_IRQ_INT1_ADCERROR,
164 MAX77843_MUIC_IRQ_INT1_ADC1K,
165
166 /* MUIC: INT2 */
167 MAX77843_MUIC_IRQ_INT2_CHGTYP,
168 MAX77843_MUIC_IRQ_INT2_CHGDETRUN,
169 MAX77843_MUIC_IRQ_INT2_DCDTMR,
170 MAX77843_MUIC_IRQ_INT2_DXOVP,
171 MAX77843_MUIC_IRQ_INT2_VBVOLT,
172
173 /* MUIC: INT3 */
174 MAX77843_MUIC_IRQ_INT3_VBADC,
175 MAX77843_MUIC_IRQ_INT3_VDNMON,
176 MAX77843_MUIC_IRQ_INT3_DNRES,
177 MAX77843_MUIC_IRQ_INT3_MPNACK,
178 MAX77843_MUIC_IRQ_INT3_MRXBUFOW,
179 MAX77843_MUIC_IRQ_INT3_MRXTRF,
180 MAX77843_MUIC_IRQ_INT3_MRXPERR,
181 MAX77843_MUIC_IRQ_INT3_MRXRDY,
182
183 MAX77843_MUIC_IRQ_NUM,
184};
185
186/* MAX77843 interrupts */
187#define MAX77843_SYS_IRQ_SYSUVLO_INT BIT(0)
188#define MAX77843_SYS_IRQ_SYSOVLO_INT BIT(1)
189#define MAX77843_SYS_IRQ_TSHDN_INT BIT(2)
190#define MAX77843_SYS_IRQ_TM_INT BIT(3)
191
192/* MAX77843 MAINCTRL1 register */
193#define MAINCTRL1_BIASEN_SHIFT 7
194#define MAX77843_MAINCTRL1_BIASEN_MASK BIT(MAINCTRL1_BIASEN_SHIFT)
195
196/* MAX77843 MCONFIG register */
197#define MCONFIG_MODE_SHIFT 7
198#define MCONFIG_MEN_SHIFT 6
199#define MCONFIG_PDIV_SHIFT 0
200
201#define MAX77843_MCONFIG_MODE_MASK BIT(MCONFIG_MODE_SHIFT)
202#define MAX77843_MCONFIG_MEN_MASK BIT(MCONFIG_MEN_SHIFT)
203#define MAX77843_MCONFIG_PDIV_MASK (0x3 << MCONFIG_PDIV_SHIFT)
204
205/* Max77843 charger insterrupts */
206#define MAX77843_CHG_BYP_I BIT(0)
207#define MAX77843_CHG_BATP_I BIT(2)
208#define MAX77843_CHG_BAT_I BIT(3)
209#define MAX77843_CHG_CHG_I BIT(4)
210#define MAX77843_CHG_WCIN_I BIT(5)
211#define MAX77843_CHG_CHGIN_I BIT(6)
212#define MAX77843_CHG_AICL_I BIT(7)
213
214/* MAX77843 CHG_INT_OK register */
215#define MAX77843_CHG_BYP_OK BIT(0)
216#define MAX77843_CHG_BATP_OK BIT(2)
217#define MAX77843_CHG_BAT_OK BIT(3)
218#define MAX77843_CHG_CHG_OK BIT(4)
219#define MAX77843_CHG_WCIN_OK BIT(5)
220#define MAX77843_CHG_CHGIN_OK BIT(6)
221#define MAX77843_CHG_AICL_OK BIT(7)
222
223/* MAX77843 CHG_DETAILS_00 register */
224#define MAX77843_CHG_BAT_DTLS BIT(0)
225
226/* MAX77843 CHG_DETAILS_01 register */
227#define MAX77843_CHG_DTLS_MASK 0x0f
228#define MAX77843_CHG_PQ_MODE 0x00
229#define MAX77843_CHG_CC_MODE 0x01
230#define MAX77843_CHG_CV_MODE 0x02
231#define MAX77843_CHG_TO_MODE 0x03
232#define MAX77843_CHG_DO_MODE 0x04
233#define MAX77843_CHG_HT_MODE 0x05
234#define MAX77843_CHG_TF_MODE 0x06
235#define MAX77843_CHG_TS_MODE 0x07
236#define MAX77843_CHG_OFF_MODE 0x08
237
238#define MAX77843_CHG_BAT_DTLS_MASK 0xf0
239#define MAX77843_CHG_NO_BAT (0x00 << 4)
240#define MAX77843_CHG_LOW_VOLT_BAT (0x01 << 4)
241#define MAX77843_CHG_LONG_BAT_TIME (0x02 << 4)
242#define MAX77843_CHG_OK_BAT (0x03 << 4)
243#define MAX77843_CHG_OK_LOW_VOLT_BAT (0x04 << 4)
244#define MAX77843_CHG_OVER_VOLT_BAT (0x05 << 4)
245#define MAX77843_CHG_OVER_CURRENT_BAT (0x06 << 4)
246
247/* MAX77843 CHG_CNFG_00 register */
248#define MAX77843_CHG_DISABLE 0x00
249#define MAX77843_CHG_ENABLE 0x05
250#define MAX77843_CHG_MASK 0x01
251#define MAX77843_CHG_BUCK_MASK 0x04
252
253/* MAX77843 CHG_CNFG_01 register */
254#define MAX77843_CHG_RESTART_THRESHOLD_100 0x00
255#define MAX77843_CHG_RESTART_THRESHOLD_150 0x10
256#define MAX77843_CHG_RESTART_THRESHOLD_200 0x20
257#define MAX77843_CHG_RESTART_THRESHOLD_DISABLE 0x30
258
259/* MAX77843 CHG_CNFG_02 register */
260#define MAX77843_CHG_FAST_CHG_CURRENT_MIN 100000
261#define MAX77843_CHG_FAST_CHG_CURRENT_MAX 3150000
262#define MAX77843_CHG_FAST_CHG_CURRENT_STEP 50000
263#define MAX77843_CHG_FAST_CHG_CURRENT_MASK 0x3f
264#define MAX77843_CHG_OTG_ILIMIT_500 (0x00 << 6)
265#define MAX77843_CHG_OTG_ILIMIT_900 (0x01 << 6)
266#define MAX77843_CHG_OTG_ILIMIT_1200 (0x02 << 6)
267#define MAX77843_CHG_OTG_ILIMIT_1500 (0x03 << 6)
268#define MAX77843_CHG_OTG_ILIMIT_MASK 0xc0
269
270/* MAX77843 CHG_CNFG_03 register */
271#define MAX77843_CHG_TOP_OFF_CURRENT_MIN 125000
272#define MAX77843_CHG_TOP_OFF_CURRENT_MAX 650000
273#define MAX77843_CHG_TOP_OFF_CURRENT_STEP 75000
274#define MAX77843_CHG_TOP_OFF_CURRENT_MASK 0x07
275
276/* MAX77843 CHG_CNFG_06 register */
277#define MAX77843_CHG_WRITE_CAP_BLOCK 0x10
278#define MAX77843_CHG_WRITE_CAP_UNBLOCK 0x0C
279
280/* MAX77843_CHG_CNFG_09_register */
281#define MAX77843_CHG_INPUT_CURRENT_LIMIT_MIN 100000
282#define MAX77843_CHG_INPUT_CURRENT_LIMIT_MAX 4000000
283#define MAX77843_CHG_INPUT_CURRENT_LIMIT_REF 3367000
284#define MAX77843_CHG_INPUT_CURRENT_LIMIT_STEP 33000
285
286#define MAX77843_MUIC_ADC BIT(0)
287#define MAX77843_MUIC_ADCERROR BIT(2)
288#define MAX77843_MUIC_ADC1K BIT(3)
289
290#define MAX77843_MUIC_CHGTYP BIT(0)
291#define MAX77843_MUIC_CHGDETRUN BIT(1)
292#define MAX77843_MUIC_DCDTMR BIT(2)
293#define MAX77843_MUIC_DXOVP BIT(3)
294#define MAX77843_MUIC_VBVOLT BIT(4)
295
296#define MAX77843_MUIC_VBADC BIT(0)
297#define MAX77843_MUIC_VDNMON BIT(1)
298#define MAX77843_MUIC_DNRES BIT(2)
299#define MAX77843_MUIC_MPNACK BIT(3)
300#define MAX77843_MUIC_MRXBUFOW BIT(4)
301#define MAX77843_MUIC_MRXTRF BIT(5)
302#define MAX77843_MUIC_MRXPERR BIT(6)
303#define MAX77843_MUIC_MRXRDY BIT(7)
304
305/* MAX77843 INTSRCMASK register */
306#define MAX77843_INTSRCMASK_CHGR 0
307#define MAX77843_INTSRCMASK_SYS 1
308#define MAX77843_INTSRCMASK_FG 2
309#define MAX77843_INTSRCMASK_MUIC 3
310
311#define MAX77843_INTSRCMASK_CHGR_MASK BIT(MAX77843_INTSRCMASK_CHGR)
312#define MAX77843_INTSRCMASK_SYS_MASK BIT(MAX77843_INTSRCMASK_SYS)
313#define MAX77843_INTSRCMASK_FG_MASK BIT(MAX77843_INTSRCMASK_FG)
314#define MAX77843_INTSRCMASK_MUIC_MASK BIT(MAX77843_INTSRCMASK_MUIC)
315
316#define MAX77843_INTSRC_MASK_MASK \
317 (MAX77843_INTSRCMASK_MUIC_MASK | MAX77843_INTSRCMASK_FG_MASK | \
318 MAX77843_INTSRCMASK_SYS_MASK | MAX77843_INTSRCMASK_CHGR_MASK)
319
320/* MAX77843 STATUS register*/
321#define STATUS1_ADC_SHIFT 0
322#define STATUS1_ADCERROR_SHIFT 6
323#define STATUS1_ADC1K_SHIFT 7
324#define STATUS2_CHGTYP_SHIFT 0
325#define STATUS2_CHGDETRUN_SHIFT 3
326#define STATUS2_DCDTMR_SHIFT 4
327#define STATUS2_DXOVP_SHIFT 5
328#define STATUS2_VBVOLT_SHIFT 6
329#define STATUS3_VBADC_SHIFT 0
330#define STATUS3_VDNMON_SHIFT 4
331#define STATUS3_DNRES_SHIFT 5
332#define STATUS3_MPNACK_SHIFT 6
333
334#define MAX77843_MUIC_STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT)
335#define MAX77843_MUIC_STATUS1_ADCERROR_MASK BIT(STATUS1_ADCERROR_SHIFT)
336#define MAX77843_MUIC_STATUS1_ADC1K_MASK BIT(STATUS1_ADC1K_SHIFT)
337#define MAX77843_MUIC_STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
338#define MAX77843_MUIC_STATUS2_CHGDETRUN_MASK BIT(STATUS2_CHGDETRUN_SHIFT)
339#define MAX77843_MUIC_STATUS2_DCDTMR_MASK BIT(STATUS2_DCDTMR_SHIFT)
340#define MAX77843_MUIC_STATUS2_DXOVP_MASK BIT(STATUS2_DXOVP_SHIFT)
341#define MAX77843_MUIC_STATUS2_VBVOLT_MASK BIT(STATUS2_VBVOLT_SHIFT)
342#define MAX77843_MUIC_STATUS3_VBADC_MASK (0xf << STATUS3_VBADC_SHIFT)
343#define MAX77843_MUIC_STATUS3_VDNMON_MASK BIT(STATUS3_VDNMON_SHIFT)
344#define MAX77843_MUIC_STATUS3_DNRES_MASK BIT(STATUS3_DNRES_SHIFT)
345#define MAX77843_MUIC_STATUS3_MPNACK_MASK BIT(STATUS3_MPNACK_SHIFT)
346
347/* MAX77843 CONTROL register */
348#define CONTROL1_COMP1SW_SHIFT 0
349#define CONTROL1_COMP2SW_SHIFT 3
350#define CONTROL1_IDBEN_SHIFT 7
351#define CONTROL2_LOWPWR_SHIFT 0
352#define CONTROL2_ADCEN_SHIFT 1
353#define CONTROL2_CPEN_SHIFT 2
354#define CONTROL2_ACC_DET_SHIFT 5
355#define CONTROL2_USBCPINT_SHIFT 6
356#define CONTROL2_RCPS_SHIFT 7
357#define CONTROL3_JIGSET_SHIFT 0
358#define CONTROL4_ADCDBSET_SHIFT 0
359#define CONTROL4_USBAUTO_SHIFT 4
360#define CONTROL4_FCTAUTO_SHIFT 5
361#define CONTROL4_ADCMODE_SHIFT 6
362
363#define MAX77843_MUIC_CONTROL1_COMP1SW_MASK (0x7 << CONTROL1_COMP1SW_SHIFT)
364#define MAX77843_MUIC_CONTROL1_COMP2SW_MASK (0x7 << CONTROL1_COMP2SW_SHIFT)
365#define MAX77843_MUIC_CONTROL1_IDBEN_MASK BIT(CONTROL1_IDBEN_SHIFT)
366#define MAX77843_MUIC_CONTROL2_LOWPWR_MASK BIT(CONTROL2_LOWPWR_SHIFT)
367#define MAX77843_MUIC_CONTROL2_ADCEN_MASK BIT(CONTROL2_ADCEN_SHIFT)
368#define MAX77843_MUIC_CONTROL2_CPEN_MASK BIT(CONTROL2_CPEN_SHIFT)
369#define MAX77843_MUIC_CONTROL2_ACC_DET_MASK BIT(CONTROL2_ACC_DET_SHIFT)
370#define MAX77843_MUIC_CONTROL2_USBCPINT_MASK BIT(CONTROL2_USBCPINT_SHIFT)
371#define MAX77843_MUIC_CONTROL2_RCPS_MASK BIT(CONTROL2_RCPS_SHIFT)
372#define MAX77843_MUIC_CONTROL3_JIGSET_MASK (0x3 << CONTROL3_JIGSET_SHIFT)
373#define MAX77843_MUIC_CONTROL4_ADCDBSET_MASK (0x3 << CONTROL4_ADCDBSET_SHIFT)
374#define MAX77843_MUIC_CONTROL4_USBAUTO_MASK BIT(CONTROL4_USBAUTO_SHIFT)
375#define MAX77843_MUIC_CONTROL4_FCTAUTO_MASK BIT(CONTROL4_FCTAUTO_SHIFT)
376#define MAX77843_MUIC_CONTROL4_ADCMODE_MASK (0x3 << CONTROL4_ADCMODE_SHIFT)
377
378/* MAX77843 switch port */
379#define COM_OPEN 0
380#define COM_USB 1
381#define COM_AUDIO 2
382#define COM_UART 3
383#define COM_AUX_USB 4
384#define COM_AUX_UART 5
385
386#define CONTROL1_COM_SW \
387 ((MAX77843_MUIC_CONTROL1_COMP1SW_MASK | \
388 MAX77843_MUIC_CONTROL1_COMP2SW_MASK))
389
390#define CONTROL1_SW_OPEN \
391 ((COM_OPEN << CONTROL1_COMP1SW_SHIFT | \
392 COM_OPEN << CONTROL1_COMP2SW_SHIFT))
393#define CONTROL1_SW_USB \
394 ((COM_USB << CONTROL1_COMP1SW_SHIFT | \
395 COM_USB << CONTROL1_COMP2SW_SHIFT))
396#define CONTROL1_SW_AUDIO \
397 ((COM_AUDIO << CONTROL1_COMP1SW_SHIFT | \
398 COM_AUDIO << CONTROL1_COMP2SW_SHIFT))
399#define CONTROL1_SW_UART \
400 ((COM_UART << CONTROL1_COMP1SW_SHIFT | \
401 COM_UART << CONTROL1_COMP2SW_SHIFT))
402#define CONTROL1_SW_AUX_USB \
403 ((COM_AUX_USB << CONTROL1_COMP1SW_SHIFT | \
404 COM_AUX_USB << CONTROL1_COMP2SW_SHIFT))
405#define CONTROL1_SW_AUX_UART \
406 ((COM_AUX_UART << CONTROL1_COMP1SW_SHIFT | \
407 COM_AUX_UART << CONTROL1_COMP2SW_SHIFT))
408
409#define MAX77843_DISABLE 0
410#define MAX77843_ENABLE 1
411
412#define CONTROL4_AUTO_DISABLE \
413 ((MAX77843_DISABLE << CONTROL4_USBAUTO_SHIFT) | \
414 (MAX77843_DISABLE << CONTROL4_FCTAUTO_SHIFT))
415#define CONTROL4_AUTO_ENABLE \
416 ((MAX77843_ENABLE << CONTROL4_USBAUTO_SHIFT) | \
417 (MAX77843_ENABLE << CONTROL4_FCTAUTO_SHIFT))
418
419/* MAX77843 SAFEOUT LDO Control register */
420#define SAFEOUTCTRL_SAFEOUT1_SHIFT 0
421#define SAFEOUTCTRL_SAFEOUT2_SHIFT 2
422#define SAFEOUTCTRL_ENSAFEOUT1_SHIFT 6
423#define SAFEOUTCTRL_ENSAFEOUT2_SHIFT 7
424
425#define MAX77843_REG_SAFEOUTCTRL_ENSAFEOUT1 \
426 BIT(SAFEOUTCTRL_ENSAFEOUT1_SHIFT)
427#define MAX77843_REG_SAFEOUTCTRL_ENSAFEOUT2 \
428 BIT(SAFEOUTCTRL_ENSAFEOUT2_SHIFT)
429#define MAX77843_REG_SAFEOUTCTRL_SAFEOUT1_MASK \
430 (0x3 << SAFEOUTCTRL_SAFEOUT1_SHIFT)
431#define MAX77843_REG_SAFEOUTCTRL_SAFEOUT2_MASK \
432 (0x3 << SAFEOUTCTRL_SAFEOUT2_SHIFT)
433
434struct max77843 {
435 struct device *dev;
436
437 struct i2c_client *i2c;
438 struct i2c_client *i2c_chg;
439 struct i2c_client *i2c_fuel;
440 struct i2c_client *i2c_muic;
441
442 struct regmap *regmap;
443 struct regmap *regmap_chg;
444 struct regmap *regmap_fuel;
445 struct regmap *regmap_muic;
446
447 struct regmap_irq_chip_data *irq_data;
448 struct regmap_irq_chip_data *irq_data_chg;
449 struct regmap_irq_chip_data *irq_data_fuel;
450 struct regmap_irq_chip_data *irq_data_muic;
451
452 int irq;
453};
454#endif /* __MAX77843_H__ */
diff --git a/include/linux/mfd/menelaus.h b/include/linux/mfd/menelaus.h
index f097e89134cb..9e85ac06da89 100644
--- a/include/linux/mfd/menelaus.h
+++ b/include/linux/mfd/menelaus.h
@@ -24,7 +24,6 @@ extern int menelaus_set_vaux(unsigned int mV);
24extern int menelaus_set_vdcdc(int dcdc, unsigned int mV); 24extern int menelaus_set_vdcdc(int dcdc, unsigned int mV);
25extern int menelaus_set_slot_sel(int enable); 25extern int menelaus_set_slot_sel(int enable);
26extern int menelaus_get_slot_pin_states(void); 26extern int menelaus_get_slot_pin_states(void);
27extern int menelaus_set_vcore_sw(unsigned int mV);
28extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV); 27extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
29 28
30#define EN_VPLL_SLEEP (1 << 7) 29#define EN_VPLL_SLEEP (1 << 7)
@@ -38,10 +37,4 @@ extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
38 37
39extern int menelaus_set_regulator_sleep(int enable, u32 val); 38extern int menelaus_set_regulator_sleep(int enable, u32 val);
40 39
41#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_MENELAUS)
42#define omap_has_menelaus() 1
43#else
44#define omap_has_menelaus() 0
45#endif
46
47#endif 40#endif
diff --git a/include/linux/mfd/mt6397/core.h b/include/linux/mfd/mt6397/core.h
new file mode 100644
index 000000000000..cf5265b0d1c1
--- /dev/null
+++ b/include/linux/mfd/mt6397/core.h
@@ -0,0 +1,64 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Flora Fu, MediaTek
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MFD_MT6397_CORE_H__
16#define __MFD_MT6397_CORE_H__
17
18enum mt6397_irq_numbers {
19 MT6397_IRQ_SPKL_AB = 0,
20 MT6397_IRQ_SPKR_AB,
21 MT6397_IRQ_SPKL,
22 MT6397_IRQ_SPKR,
23 MT6397_IRQ_BAT_L,
24 MT6397_IRQ_BAT_H,
25 MT6397_IRQ_FG_BAT_L,
26 MT6397_IRQ_FG_BAT_H,
27 MT6397_IRQ_WATCHDOG,
28 MT6397_IRQ_PWRKEY,
29 MT6397_IRQ_THR_L,
30 MT6397_IRQ_THR_H,
31 MT6397_IRQ_VBATON_UNDET,
32 MT6397_IRQ_BVALID_DET,
33 MT6397_IRQ_CHRDET,
34 MT6397_IRQ_OV,
35 MT6397_IRQ_LDO,
36 MT6397_IRQ_HOMEKEY,
37 MT6397_IRQ_ACCDET,
38 MT6397_IRQ_AUDIO,
39 MT6397_IRQ_RTC,
40 MT6397_IRQ_PWRKEY_RSTB,
41 MT6397_IRQ_HDMI_SIFM,
42 MT6397_IRQ_HDMI_CEC,
43 MT6397_IRQ_VCA15,
44 MT6397_IRQ_VSRMCA15,
45 MT6397_IRQ_VCORE,
46 MT6397_IRQ_VGPU,
47 MT6397_IRQ_VIO18,
48 MT6397_IRQ_VPCA7,
49 MT6397_IRQ_VSRMCA7,
50 MT6397_IRQ_VDRM,
51 MT6397_IRQ_NR,
52};
53
54struct mt6397_chip {
55 struct device *dev;
56 struct regmap *regmap;
57 int irq;
58 struct irq_domain *irq_domain;
59 struct mutex irqlock;
60 u16 irq_masks_cur[2];
61 u16 irq_masks_cache[2];
62};
63
64#endif /* __MFD_MT6397_CORE_H__ */
diff --git a/include/linux/mfd/mt6397/registers.h b/include/linux/mfd/mt6397/registers.h
new file mode 100644
index 000000000000..f23a0a60a877
--- /dev/null
+++ b/include/linux/mfd/mt6397/registers.h
@@ -0,0 +1,362 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Flora Fu, MediaTek
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MFD_MT6397_REGISTERS_H__
16#define __MFD_MT6397_REGISTERS_H__
17
18/* PMIC Registers */
19#define MT6397_CID 0x0100
20#define MT6397_TOP_CKPDN 0x0102
21#define MT6397_TOP_CKPDN_SET 0x0104
22#define MT6397_TOP_CKPDN_CLR 0x0106
23#define MT6397_TOP_CKPDN2 0x0108
24#define MT6397_TOP_CKPDN2_SET 0x010A
25#define MT6397_TOP_CKPDN2_CLR 0x010C
26#define MT6397_TOP_GPIO_CKPDN 0x010E
27#define MT6397_TOP_RST_CON 0x0114
28#define MT6397_WRP_CKPDN 0x011A
29#define MT6397_WRP_RST_CON 0x0120
30#define MT6397_TOP_RST_MISC 0x0126
31#define MT6397_TOP_CKCON1 0x0128
32#define MT6397_TOP_CKCON2 0x012A
33#define MT6397_TOP_CKTST1 0x012C
34#define MT6397_TOP_CKTST2 0x012E
35#define MT6397_OC_DEG_EN 0x0130
36#define MT6397_OC_CTL0 0x0132
37#define MT6397_OC_CTL1 0x0134
38#define MT6397_OC_CTL2 0x0136
39#define MT6397_INT_RSV 0x0138
40#define MT6397_TEST_CON0 0x013A
41#define MT6397_TEST_CON1 0x013C
42#define MT6397_STATUS0 0x013E
43#define MT6397_STATUS1 0x0140
44#define MT6397_PGSTATUS 0x0142
45#define MT6397_CHRSTATUS 0x0144
46#define MT6397_OCSTATUS0 0x0146
47#define MT6397_OCSTATUS1 0x0148
48#define MT6397_OCSTATUS2 0x014A
49#define MT6397_HDMI_PAD_IE 0x014C
50#define MT6397_TEST_OUT_L 0x014E
51#define MT6397_TEST_OUT_H 0x0150
52#define MT6397_TDSEL_CON 0x0152
53#define MT6397_RDSEL_CON 0x0154
54#define MT6397_GPIO_SMT_CON0 0x0156
55#define MT6397_GPIO_SMT_CON1 0x0158
56#define MT6397_GPIO_SMT_CON2 0x015A
57#define MT6397_GPIO_SMT_CON3 0x015C
58#define MT6397_DRV_CON0 0x015E
59#define MT6397_DRV_CON1 0x0160
60#define MT6397_DRV_CON2 0x0162
61#define MT6397_DRV_CON3 0x0164
62#define MT6397_DRV_CON4 0x0166
63#define MT6397_DRV_CON5 0x0168
64#define MT6397_DRV_CON6 0x016A
65#define MT6397_DRV_CON7 0x016C
66#define MT6397_DRV_CON8 0x016E
67#define MT6397_DRV_CON9 0x0170
68#define MT6397_DRV_CON10 0x0172
69#define MT6397_DRV_CON11 0x0174
70#define MT6397_DRV_CON12 0x0176
71#define MT6397_INT_CON0 0x0178
72#define MT6397_INT_CON1 0x017E
73#define MT6397_INT_STATUS0 0x0184
74#define MT6397_INT_STATUS1 0x0186
75#define MT6397_FQMTR_CON0 0x0188
76#define MT6397_FQMTR_CON1 0x018A
77#define MT6397_FQMTR_CON2 0x018C
78#define MT6397_EFUSE_DOUT_0_15 0x01C4
79#define MT6397_EFUSE_DOUT_16_31 0x01C6
80#define MT6397_EFUSE_DOUT_32_47 0x01C8
81#define MT6397_EFUSE_DOUT_48_63 0x01CA
82#define MT6397_SPI_CON 0x01CC
83#define MT6397_TOP_CKPDN3 0x01CE
84#define MT6397_TOP_CKCON3 0x01D4
85#define MT6397_EFUSE_DOUT_64_79 0x01D6
86#define MT6397_EFUSE_DOUT_80_95 0x01D8
87#define MT6397_EFUSE_DOUT_96_111 0x01DA
88#define MT6397_EFUSE_DOUT_112_127 0x01DC
89#define MT6397_EFUSE_DOUT_128_143 0x01DE
90#define MT6397_EFUSE_DOUT_144_159 0x01E0
91#define MT6397_EFUSE_DOUT_160_175 0x01E2
92#define MT6397_EFUSE_DOUT_176_191 0x01E4
93#define MT6397_EFUSE_DOUT_192_207 0x01E6
94#define MT6397_EFUSE_DOUT_208_223 0x01E8
95#define MT6397_EFUSE_DOUT_224_239 0x01EA
96#define MT6397_EFUSE_DOUT_240_255 0x01EC
97#define MT6397_EFUSE_DOUT_256_271 0x01EE
98#define MT6397_EFUSE_DOUT_272_287 0x01F0
99#define MT6397_EFUSE_DOUT_288_300 0x01F2
100#define MT6397_EFUSE_DOUT_304_319 0x01F4
101#define MT6397_BUCK_CON0 0x0200
102#define MT6397_BUCK_CON1 0x0202
103#define MT6397_BUCK_CON2 0x0204
104#define MT6397_BUCK_CON3 0x0206
105#define MT6397_BUCK_CON4 0x0208
106#define MT6397_BUCK_CON5 0x020A
107#define MT6397_BUCK_CON6 0x020C
108#define MT6397_BUCK_CON7 0x020E
109#define MT6397_BUCK_CON8 0x0210
110#define MT6397_BUCK_CON9 0x0212
111#define MT6397_VCA15_CON0 0x0214
112#define MT6397_VCA15_CON1 0x0216
113#define MT6397_VCA15_CON2 0x0218
114#define MT6397_VCA15_CON3 0x021A
115#define MT6397_VCA15_CON4 0x021C
116#define MT6397_VCA15_CON5 0x021E
117#define MT6397_VCA15_CON6 0x0220
118#define MT6397_VCA15_CON7 0x0222
119#define MT6397_VCA15_CON8 0x0224
120#define MT6397_VCA15_CON9 0x0226
121#define MT6397_VCA15_CON10 0x0228
122#define MT6397_VCA15_CON11 0x022A
123#define MT6397_VCA15_CON12 0x022C
124#define MT6397_VCA15_CON13 0x022E
125#define MT6397_VCA15_CON14 0x0230
126#define MT6397_VCA15_CON15 0x0232
127#define MT6397_VCA15_CON16 0x0234
128#define MT6397_VCA15_CON17 0x0236
129#define MT6397_VCA15_CON18 0x0238
130#define MT6397_VSRMCA15_CON0 0x023A
131#define MT6397_VSRMCA15_CON1 0x023C
132#define MT6397_VSRMCA15_CON2 0x023E
133#define MT6397_VSRMCA15_CON3 0x0240
134#define MT6397_VSRMCA15_CON4 0x0242
135#define MT6397_VSRMCA15_CON5 0x0244
136#define MT6397_VSRMCA15_CON6 0x0246
137#define MT6397_VSRMCA15_CON7 0x0248
138#define MT6397_VSRMCA15_CON8 0x024A
139#define MT6397_VSRMCA15_CON9 0x024C
140#define MT6397_VSRMCA15_CON10 0x024E
141#define MT6397_VSRMCA15_CON11 0x0250
142#define MT6397_VSRMCA15_CON12 0x0252
143#define MT6397_VSRMCA15_CON13 0x0254
144#define MT6397_VSRMCA15_CON14 0x0256
145#define MT6397_VSRMCA15_CON15 0x0258
146#define MT6397_VSRMCA15_CON16 0x025A
147#define MT6397_VSRMCA15_CON17 0x025C
148#define MT6397_VSRMCA15_CON18 0x025E
149#define MT6397_VSRMCA15_CON19 0x0260
150#define MT6397_VSRMCA15_CON20 0x0262
151#define MT6397_VSRMCA15_CON21 0x0264
152#define MT6397_VCORE_CON0 0x0266
153#define MT6397_VCORE_CON1 0x0268
154#define MT6397_VCORE_CON2 0x026A
155#define MT6397_VCORE_CON3 0x026C
156#define MT6397_VCORE_CON4 0x026E
157#define MT6397_VCORE_CON5 0x0270
158#define MT6397_VCORE_CON6 0x0272
159#define MT6397_VCORE_CON7 0x0274
160#define MT6397_VCORE_CON8 0x0276
161#define MT6397_VCORE_CON9 0x0278
162#define MT6397_VCORE_CON10 0x027A
163#define MT6397_VCORE_CON11 0x027C
164#define MT6397_VCORE_CON12 0x027E
165#define MT6397_VCORE_CON13 0x0280
166#define MT6397_VCORE_CON14 0x0282
167#define MT6397_VCORE_CON15 0x0284
168#define MT6397_VCORE_CON16 0x0286
169#define MT6397_VCORE_CON17 0x0288
170#define MT6397_VCORE_CON18 0x028A
171#define MT6397_VGPU_CON0 0x028C
172#define MT6397_VGPU_CON1 0x028E
173#define MT6397_VGPU_CON2 0x0290
174#define MT6397_VGPU_CON3 0x0292
175#define MT6397_VGPU_CON4 0x0294
176#define MT6397_VGPU_CON5 0x0296
177#define MT6397_VGPU_CON6 0x0298
178#define MT6397_VGPU_CON7 0x029A
179#define MT6397_VGPU_CON8 0x029C
180#define MT6397_VGPU_CON9 0x029E
181#define MT6397_VGPU_CON10 0x02A0
182#define MT6397_VGPU_CON11 0x02A2
183#define MT6397_VGPU_CON12 0x02A4
184#define MT6397_VGPU_CON13 0x02A6
185#define MT6397_VGPU_CON14 0x02A8
186#define MT6397_VGPU_CON15 0x02AA
187#define MT6397_VGPU_CON16 0x02AC
188#define MT6397_VGPU_CON17 0x02AE
189#define MT6397_VGPU_CON18 0x02B0
190#define MT6397_VIO18_CON0 0x0300
191#define MT6397_VIO18_CON1 0x0302
192#define MT6397_VIO18_CON2 0x0304
193#define MT6397_VIO18_CON3 0x0306
194#define MT6397_VIO18_CON4 0x0308
195#define MT6397_VIO18_CON5 0x030A
196#define MT6397_VIO18_CON6 0x030C
197#define MT6397_VIO18_CON7 0x030E
198#define MT6397_VIO18_CON8 0x0310
199#define MT6397_VIO18_CON9 0x0312
200#define MT6397_VIO18_CON10 0x0314
201#define MT6397_VIO18_CON11 0x0316
202#define MT6397_VIO18_CON12 0x0318
203#define MT6397_VIO18_CON13 0x031A
204#define MT6397_VIO18_CON14 0x031C
205#define MT6397_VIO18_CON15 0x031E
206#define MT6397_VIO18_CON16 0x0320
207#define MT6397_VIO18_CON17 0x0322
208#define MT6397_VIO18_CON18 0x0324
209#define MT6397_VPCA7_CON0 0x0326
210#define MT6397_VPCA7_CON1 0x0328
211#define MT6397_VPCA7_CON2 0x032A
212#define MT6397_VPCA7_CON3 0x032C
213#define MT6397_VPCA7_CON4 0x032E
214#define MT6397_VPCA7_CON5 0x0330
215#define MT6397_VPCA7_CON6 0x0332
216#define MT6397_VPCA7_CON7 0x0334
217#define MT6397_VPCA7_CON8 0x0336
218#define MT6397_VPCA7_CON9 0x0338
219#define MT6397_VPCA7_CON10 0x033A
220#define MT6397_VPCA7_CON11 0x033C
221#define MT6397_VPCA7_CON12 0x033E
222#define MT6397_VPCA7_CON13 0x0340
223#define MT6397_VPCA7_CON14 0x0342
224#define MT6397_VPCA7_CON15 0x0344
225#define MT6397_VPCA7_CON16 0x0346
226#define MT6397_VPCA7_CON17 0x0348
227#define MT6397_VPCA7_CON18 0x034A
228#define MT6397_VSRMCA7_CON0 0x034C
229#define MT6397_VSRMCA7_CON1 0x034E
230#define MT6397_VSRMCA7_CON2 0x0350
231#define MT6397_VSRMCA7_CON3 0x0352
232#define MT6397_VSRMCA7_CON4 0x0354
233#define MT6397_VSRMCA7_CON5 0x0356
234#define MT6397_VSRMCA7_CON6 0x0358
235#define MT6397_VSRMCA7_CON7 0x035A
236#define MT6397_VSRMCA7_CON8 0x035C
237#define MT6397_VSRMCA7_CON9 0x035E
238#define MT6397_VSRMCA7_CON10 0x0360
239#define MT6397_VSRMCA7_CON11 0x0362
240#define MT6397_VSRMCA7_CON12 0x0364
241#define MT6397_VSRMCA7_CON13 0x0366
242#define MT6397_VSRMCA7_CON14 0x0368
243#define MT6397_VSRMCA7_CON15 0x036A
244#define MT6397_VSRMCA7_CON16 0x036C
245#define MT6397_VSRMCA7_CON17 0x036E
246#define MT6397_VSRMCA7_CON18 0x0370
247#define MT6397_VSRMCA7_CON19 0x0372
248#define MT6397_VSRMCA7_CON20 0x0374
249#define MT6397_VSRMCA7_CON21 0x0376
250#define MT6397_VDRM_CON0 0x0378
251#define MT6397_VDRM_CON1 0x037A
252#define MT6397_VDRM_CON2 0x037C
253#define MT6397_VDRM_CON3 0x037E
254#define MT6397_VDRM_CON4 0x0380
255#define MT6397_VDRM_CON5 0x0382
256#define MT6397_VDRM_CON6 0x0384
257#define MT6397_VDRM_CON7 0x0386
258#define MT6397_VDRM_CON8 0x0388
259#define MT6397_VDRM_CON9 0x038A
260#define MT6397_VDRM_CON10 0x038C
261#define MT6397_VDRM_CON11 0x038E
262#define MT6397_VDRM_CON12 0x0390
263#define MT6397_VDRM_CON13 0x0392
264#define MT6397_VDRM_CON14 0x0394
265#define MT6397_VDRM_CON15 0x0396
266#define MT6397_VDRM_CON16 0x0398
267#define MT6397_VDRM_CON17 0x039A
268#define MT6397_VDRM_CON18 0x039C
269#define MT6397_BUCK_K_CON0 0x039E
270#define MT6397_BUCK_K_CON1 0x03A0
271#define MT6397_ANALDO_CON0 0x0400
272#define MT6397_ANALDO_CON1 0x0402
273#define MT6397_ANALDO_CON2 0x0404
274#define MT6397_ANALDO_CON3 0x0406
275#define MT6397_ANALDO_CON4 0x0408
276#define MT6397_ANALDO_CON5 0x040A
277#define MT6397_ANALDO_CON6 0x040C
278#define MT6397_ANALDO_CON7 0x040E
279#define MT6397_DIGLDO_CON0 0x0410
280#define MT6397_DIGLDO_CON1 0x0412
281#define MT6397_DIGLDO_CON2 0x0414
282#define MT6397_DIGLDO_CON3 0x0416
283#define MT6397_DIGLDO_CON4 0x0418
284#define MT6397_DIGLDO_CON5 0x041A
285#define MT6397_DIGLDO_CON6 0x041C
286#define MT6397_DIGLDO_CON7 0x041E
287#define MT6397_DIGLDO_CON8 0x0420
288#define MT6397_DIGLDO_CON9 0x0422
289#define MT6397_DIGLDO_CON10 0x0424
290#define MT6397_DIGLDO_CON11 0x0426
291#define MT6397_DIGLDO_CON12 0x0428
292#define MT6397_DIGLDO_CON13 0x042A
293#define MT6397_DIGLDO_CON14 0x042C
294#define MT6397_DIGLDO_CON15 0x042E
295#define MT6397_DIGLDO_CON16 0x0430
296#define MT6397_DIGLDO_CON17 0x0432
297#define MT6397_DIGLDO_CON18 0x0434
298#define MT6397_DIGLDO_CON19 0x0436
299#define MT6397_DIGLDO_CON20 0x0438
300#define MT6397_DIGLDO_CON21 0x043A
301#define MT6397_DIGLDO_CON22 0x043C
302#define MT6397_DIGLDO_CON23 0x043E
303#define MT6397_DIGLDO_CON24 0x0440
304#define MT6397_DIGLDO_CON25 0x0442
305#define MT6397_DIGLDO_CON26 0x0444
306#define MT6397_DIGLDO_CON27 0x0446
307#define MT6397_DIGLDO_CON28 0x0448
308#define MT6397_DIGLDO_CON29 0x044A
309#define MT6397_DIGLDO_CON30 0x044C
310#define MT6397_DIGLDO_CON31 0x044E
311#define MT6397_DIGLDO_CON32 0x0450
312#define MT6397_DIGLDO_CON33 0x045A
313#define MT6397_SPK_CON0 0x0600
314#define MT6397_SPK_CON1 0x0602
315#define MT6397_SPK_CON2 0x0604
316#define MT6397_SPK_CON3 0x0606
317#define MT6397_SPK_CON4 0x0608
318#define MT6397_SPK_CON5 0x060A
319#define MT6397_SPK_CON6 0x060C
320#define MT6397_SPK_CON7 0x060E
321#define MT6397_SPK_CON8 0x0610
322#define MT6397_SPK_CON9 0x0612
323#define MT6397_SPK_CON10 0x0614
324#define MT6397_SPK_CON11 0x0616
325#define MT6397_AUDDAC_CON0 0x0700
326#define MT6397_AUDBUF_CFG0 0x0702
327#define MT6397_AUDBUF_CFG1 0x0704
328#define MT6397_AUDBUF_CFG2 0x0706
329#define MT6397_AUDBUF_CFG3 0x0708
330#define MT6397_AUDBUF_CFG4 0x070A
331#define MT6397_IBIASDIST_CFG0 0x070C
332#define MT6397_AUDACCDEPOP_CFG0 0x070E
333#define MT6397_AUD_IV_CFG0 0x0710
334#define MT6397_AUDCLKGEN_CFG0 0x0712
335#define MT6397_AUDLDO_CFG0 0x0714
336#define MT6397_AUDLDO_CFG1 0x0716
337#define MT6397_AUDNVREGGLB_CFG0 0x0718
338#define MT6397_AUD_NCP0 0x071A
339#define MT6397_AUDPREAMP_CON0 0x071C
340#define MT6397_AUDADC_CON0 0x071E
341#define MT6397_AUDADC_CON1 0x0720
342#define MT6397_AUDADC_CON2 0x0722
343#define MT6397_AUDADC_CON3 0x0724
344#define MT6397_AUDADC_CON4 0x0726
345#define MT6397_AUDADC_CON5 0x0728
346#define MT6397_AUDADC_CON6 0x072A
347#define MT6397_AUDDIGMI_CON0 0x072C
348#define MT6397_AUDLSBUF_CON0 0x072E
349#define MT6397_AUDLSBUF_CON1 0x0730
350#define MT6397_AUDENCSPARE_CON0 0x0732
351#define MT6397_AUDENCCLKSQ_CON0 0x0734
352#define MT6397_AUDPREAMPGAIN_CON0 0x0736
353#define MT6397_ZCD_CON0 0x0738
354#define MT6397_ZCD_CON1 0x073A
355#define MT6397_ZCD_CON2 0x073C
356#define MT6397_ZCD_CON3 0x073E
357#define MT6397_ZCD_CON4 0x0740
358#define MT6397_ZCD_CON5 0x0742
359#define MT6397_NCP_CLKDIV_CON0 0x0744
360#define MT6397_NCP_CLKDIV_CON1 0x0746
361
362#endif /* __MFD_MT6397_REGISTERS_H__ */
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index fb09312d854b..441b6ee72691 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -156,6 +156,9 @@ enum rk808_reg {
156#define BUCK2_RATE_MASK (3 << 3) 156#define BUCK2_RATE_MASK (3 << 3)
157#define MASK_ALL 0xff 157#define MASK_ALL 0xff
158 158
159#define BUCK_UV_ACT_MASK 0x0f
160#define BUCK_UV_ACT_DISABLE 0
161
159#define SWITCH2_EN BIT(6) 162#define SWITCH2_EN BIT(6)
160#define SWITCH1_EN BIT(5) 163#define SWITCH1_EN BIT(5)
161#define DEV_OFF_RST BIT(3) 164#define DEV_OFF_RST BIT(3)
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 0c12628e91c6..ff843e7ca23d 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -28,74 +28,72 @@
28 28
29#define MAX_RW_REG_CNT 1024 29#define MAX_RW_REG_CNT 1024
30 30
31/* PCI Operation Register Address */
32#define RTSX_HCBAR 0x00 31#define RTSX_HCBAR 0x00
33#define RTSX_HCBCTLR 0x04 32#define RTSX_HCBCTLR 0x04
33#define STOP_CMD (0x01 << 28)
34#define READ_REG_CMD 0
35#define WRITE_REG_CMD 1
36#define CHECK_REG_CMD 2
37
34#define RTSX_HDBAR 0x08 38#define RTSX_HDBAR 0x08
39#define SG_INT 0x04
40#define SG_END 0x02
41#define SG_VALID 0x01
42#define SG_NO_OP 0x00
43#define SG_TRANS_DATA (0x02 << 4)
44#define SG_LINK_DESC (0x03 << 4)
35#define RTSX_HDBCTLR 0x0C 45#define RTSX_HDBCTLR 0x0C
46#define SDMA_MODE 0x00
47#define ADMA_MODE (0x02 << 26)
48#define STOP_DMA (0x01 << 28)
49#define TRIG_DMA (0x01 << 31)
50
36#define RTSX_HAIMR 0x10 51#define RTSX_HAIMR 0x10
37#define RTSX_BIPR 0x14 52#define HAIMR_TRANS_START (0x01 << 31)
38#define RTSX_BIER 0x18 53#define HAIMR_READ 0x00
54#define HAIMR_WRITE (0x01 << 30)
55#define HAIMR_READ_START (HAIMR_TRANS_START | HAIMR_READ)
56#define HAIMR_WRITE_START (HAIMR_TRANS_START | HAIMR_WRITE)
57#define HAIMR_TRANS_END (HAIMR_TRANS_START)
39 58
40/* Host command buffer control register */ 59#define RTSX_BIPR 0x14
41#define STOP_CMD (0x01 << 28) 60#define CMD_DONE_INT (1 << 31)
42 61#define DATA_DONE_INT (1 << 30)
43/* Host data buffer control register */ 62#define TRANS_OK_INT (1 << 29)
44#define SDMA_MODE 0x00 63#define TRANS_FAIL_INT (1 << 28)
45#define ADMA_MODE (0x02 << 26) 64#define XD_INT (1 << 27)
46#define STOP_DMA (0x01 << 28) 65#define MS_INT (1 << 26)
47#define TRIG_DMA (0x01 << 31) 66#define SD_INT (1 << 25)
48 67#define GPIO0_INT (1 << 24)
49/* Host access internal memory register */ 68#define OC_INT (1 << 23)
50#define HAIMR_TRANS_START (0x01 << 31) 69#define SD_WRITE_PROTECT (1 << 19)
51#define HAIMR_READ 0x00 70#define XD_EXIST (1 << 18)
52#define HAIMR_WRITE (0x01 << 30) 71#define MS_EXIST (1 << 17)
53#define HAIMR_READ_START (HAIMR_TRANS_START | HAIMR_READ) 72#define SD_EXIST (1 << 16)
54#define HAIMR_WRITE_START (HAIMR_TRANS_START | HAIMR_WRITE) 73#define DELINK_INT GPIO0_INT
55#define HAIMR_TRANS_END (HAIMR_TRANS_START) 74#define MS_OC_INT (1 << 23)
56 75#define SD_OC_INT (1 << 22)
57/* Bus interrupt pending register */
58#define CMD_DONE_INT (1 << 31)
59#define DATA_DONE_INT (1 << 30)
60#define TRANS_OK_INT (1 << 29)
61#define TRANS_FAIL_INT (1 << 28)
62#define XD_INT (1 << 27)
63#define MS_INT (1 << 26)
64#define SD_INT (1 << 25)
65#define GPIO0_INT (1 << 24)
66#define OC_INT (1 << 23)
67#define SD_WRITE_PROTECT (1 << 19)
68#define XD_EXIST (1 << 18)
69#define MS_EXIST (1 << 17)
70#define SD_EXIST (1 << 16)
71#define DELINK_INT GPIO0_INT
72#define MS_OC_INT (1 << 23)
73#define SD_OC_INT (1 << 22)
74 76
75#define CARD_INT (XD_INT | MS_INT | SD_INT) 77#define CARD_INT (XD_INT | MS_INT | SD_INT)
76#define NEED_COMPLETE_INT (DATA_DONE_INT | TRANS_OK_INT | TRANS_FAIL_INT) 78#define NEED_COMPLETE_INT (DATA_DONE_INT | TRANS_OK_INT | TRANS_FAIL_INT)
77#define RTSX_INT (CMD_DONE_INT | NEED_COMPLETE_INT | \ 79#define RTSX_INT (CMD_DONE_INT | NEED_COMPLETE_INT | \
78 CARD_INT | GPIO0_INT | OC_INT) 80 CARD_INT | GPIO0_INT | OC_INT)
79
80#define CARD_EXIST (XD_EXIST | MS_EXIST | SD_EXIST) 81#define CARD_EXIST (XD_EXIST | MS_EXIST | SD_EXIST)
81 82
82/* Bus interrupt enable register */ 83#define RTSX_BIER 0x18
83#define CMD_DONE_INT_EN (1 << 31) 84#define CMD_DONE_INT_EN (1 << 31)
84#define DATA_DONE_INT_EN (1 << 30) 85#define DATA_DONE_INT_EN (1 << 30)
85#define TRANS_OK_INT_EN (1 << 29) 86#define TRANS_OK_INT_EN (1 << 29)
86#define TRANS_FAIL_INT_EN (1 << 28) 87#define TRANS_FAIL_INT_EN (1 << 28)
87#define XD_INT_EN (1 << 27) 88#define XD_INT_EN (1 << 27)
88#define MS_INT_EN (1 << 26) 89#define MS_INT_EN (1 << 26)
89#define SD_INT_EN (1 << 25) 90#define SD_INT_EN (1 << 25)
90#define GPIO0_INT_EN (1 << 24) 91#define GPIO0_INT_EN (1 << 24)
91#define OC_INT_EN (1 << 23) 92#define OC_INT_EN (1 << 23)
92#define DELINK_INT_EN GPIO0_INT_EN 93#define DELINK_INT_EN GPIO0_INT_EN
93#define MS_OC_INT_EN (1 << 23) 94#define MS_OC_INT_EN (1 << 23)
94#define SD_OC_INT_EN (1 << 22) 95#define SD_OC_INT_EN (1 << 22)
95 96
96#define READ_REG_CMD 0
97#define WRITE_REG_CMD 1
98#define CHECK_REG_CMD 2
99 97
100/* 98/*
101 * macros for easy use 99 * macros for easy use
@@ -125,423 +123,68 @@
125#define rtsx_pci_write_config_dword(pcr, where, val) \ 123#define rtsx_pci_write_config_dword(pcr, where, val) \
126 pci_write_config_dword((pcr)->pci, where, val) 124 pci_write_config_dword((pcr)->pci, where, val)
127 125
128#define STATE_TRANS_NONE 0 126#define STATE_TRANS_NONE 0
129#define STATE_TRANS_CMD 1 127#define STATE_TRANS_CMD 1
130#define STATE_TRANS_BUF 2 128#define STATE_TRANS_BUF 2
131#define STATE_TRANS_SG 3 129#define STATE_TRANS_SG 3
132
133#define TRANS_NOT_READY 0
134#define TRANS_RESULT_OK 1
135#define TRANS_RESULT_FAIL 2
136#define TRANS_NO_DEVICE 3
137
138#define RTSX_RESV_BUF_LEN 4096
139#define HOST_CMDS_BUF_LEN 1024
140#define HOST_SG_TBL_BUF_LEN (RTSX_RESV_BUF_LEN - HOST_CMDS_BUF_LEN)
141#define HOST_SG_TBL_ITEMS (HOST_SG_TBL_BUF_LEN / 8)
142#define MAX_SG_ITEM_LEN 0x80000
143
144#define HOST_TO_DEVICE 0
145#define DEVICE_TO_HOST 1
146
147#define RTSX_PHASE_MAX 32
148#define RX_TUNING_CNT 3
149
150/* SG descriptor */
151#define SG_INT 0x04
152#define SG_END 0x02
153#define SG_VALID 0x01
154
155#define SG_NO_OP 0x00
156#define SG_TRANS_DATA (0x02 << 4)
157#define SG_LINK_DESC (0x03 << 4)
158
159/* Output voltage */
160#define OUTPUT_3V3 0
161#define OUTPUT_1V8 1
162
163/* Card Clock Enable Register */
164#define SD_CLK_EN 0x04
165#define MS_CLK_EN 0x08
166
167/* Card Select Register */
168#define SD_MOD_SEL 2
169#define MS_MOD_SEL 3
170
171/* Card Output Enable Register */
172#define SD_OUTPUT_EN 0x04
173#define MS_OUTPUT_EN 0x08
174
175/* CARD_SHARE_MODE */
176#define CARD_SHARE_MASK 0x0F
177#define CARD_SHARE_MULTI_LUN 0x00
178#define CARD_SHARE_NORMAL 0x00
179#define CARD_SHARE_48_SD 0x04
180#define CARD_SHARE_48_MS 0x08
181/* CARD_SHARE_MODE for barossa */
182#define CARD_SHARE_BAROSSA_SD 0x01
183#define CARD_SHARE_BAROSSA_MS 0x02
184
185/* CARD_DRIVE_SEL */
186#define MS_DRIVE_8mA (0x01 << 6)
187#define MMC_DRIVE_8mA (0x01 << 4)
188#define XD_DRIVE_8mA (0x01 << 2)
189#define GPIO_DRIVE_8mA 0x01
190#define RTS5209_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
191 XD_DRIVE_8mA | GPIO_DRIVE_8mA)
192#define RTL8411_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
193 XD_DRIVE_8mA)
194#define RTSX_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | GPIO_DRIVE_8mA)
195 130
196/* SD30_DRIVE_SEL */ 131#define TRANS_NOT_READY 0
197#define DRIVER_TYPE_A 0x05 132#define TRANS_RESULT_OK 1
198#define DRIVER_TYPE_B 0x03 133#define TRANS_RESULT_FAIL 2
199#define DRIVER_TYPE_C 0x02 134#define TRANS_NO_DEVICE 3
200#define DRIVER_TYPE_D 0x01
201#define CFG_DRIVER_TYPE_A 0x02
202#define CFG_DRIVER_TYPE_B 0x03
203#define CFG_DRIVER_TYPE_C 0x01
204#define CFG_DRIVER_TYPE_D 0x00
205
206/* FPDCTL */
207#define SSC_POWER_DOWN 0x01
208#define SD_OC_POWER_DOWN 0x02
209#define ALL_POWER_DOWN 0x07
210#define OC_POWER_DOWN 0x06
211
212/* CLK_CTL */
213#define CHANGE_CLK 0x01
214
215/* LDO_CTL */
216#define BPP_ASIC_1V7 0x00
217#define BPP_ASIC_1V8 0x01
218#define BPP_ASIC_1V9 0x02
219#define BPP_ASIC_2V0 0x03
220#define BPP_ASIC_2V7 0x04
221#define BPP_ASIC_2V8 0x05
222#define BPP_ASIC_3V2 0x06
223#define BPP_ASIC_3V3 0x07
224#define BPP_REG_TUNED18 0x07
225#define BPP_TUNED18_SHIFT_8402 5
226#define BPP_TUNED18_SHIFT_8411 4
227#define BPP_PAD_MASK 0x04
228#define BPP_PAD_3V3 0x04
229#define BPP_PAD_1V8 0x00
230#define BPP_LDO_POWB 0x03
231#define BPP_LDO_ON 0x00
232#define BPP_LDO_SUSPEND 0x02
233#define BPP_LDO_OFF 0x03
234
235/* CD_PAD_CTL */
236#define CD_DISABLE_MASK 0x07
237#define MS_CD_DISABLE 0x04
238#define SD_CD_DISABLE 0x02
239#define XD_CD_DISABLE 0x01
240#define CD_DISABLE 0x07
241#define CD_ENABLE 0x00
242#define MS_CD_EN_ONLY 0x03
243#define SD_CD_EN_ONLY 0x05
244#define XD_CD_EN_ONLY 0x06
245#define FORCE_CD_LOW_MASK 0x38
246#define FORCE_CD_XD_LOW 0x08
247#define FORCE_CD_SD_LOW 0x10
248#define FORCE_CD_MS_LOW 0x20
249#define CD_AUTO_DISABLE 0x40
250
251/* SD_STAT1 */
252#define SD_CRC7_ERR 0x80
253#define SD_CRC16_ERR 0x40
254#define SD_CRC_WRITE_ERR 0x20
255#define SD_CRC_WRITE_ERR_MASK 0x1C
256#define GET_CRC_TIME_OUT 0x02
257#define SD_TUNING_COMPARE_ERR 0x01
258
259/* SD_STAT2 */
260#define SD_RSP_80CLK_TIMEOUT 0x01
261
262/* SD_BUS_STAT */
263#define SD_CLK_TOGGLE_EN 0x80
264#define SD_CLK_FORCE_STOP 0x40
265#define SD_DAT3_STATUS 0x10
266#define SD_DAT2_STATUS 0x08
267#define SD_DAT1_STATUS 0x04
268#define SD_DAT0_STATUS 0x02
269#define SD_CMD_STATUS 0x01
270
271/* SD_PAD_CTL */
272#define SD_IO_USING_1V8 0x80
273#define SD_IO_USING_3V3 0x7F
274#define TYPE_A_DRIVING 0x00
275#define TYPE_B_DRIVING 0x01
276#define TYPE_C_DRIVING 0x02
277#define TYPE_D_DRIVING 0x03
278
279/* SD_SAMPLE_POINT_CTL */
280#define DDR_FIX_RX_DAT 0x00
281#define DDR_VAR_RX_DAT 0x80
282#define DDR_FIX_RX_DAT_EDGE 0x00
283#define DDR_FIX_RX_DAT_14_DELAY 0x40
284#define DDR_FIX_RX_CMD 0x00
285#define DDR_VAR_RX_CMD 0x20
286#define DDR_FIX_RX_CMD_POS_EDGE 0x00
287#define DDR_FIX_RX_CMD_14_DELAY 0x10
288#define SD20_RX_POS_EDGE 0x00
289#define SD20_RX_14_DELAY 0x08
290#define SD20_RX_SEL_MASK 0x08
291 135
292/* SD_PUSH_POINT_CTL */ 136#define RTSX_RESV_BUF_LEN 4096
293#define DDR_FIX_TX_CMD_DAT 0x00 137#define HOST_CMDS_BUF_LEN 1024
294#define DDR_VAR_TX_CMD_DAT 0x80 138#define HOST_SG_TBL_BUF_LEN (RTSX_RESV_BUF_LEN - HOST_CMDS_BUF_LEN)
295#define DDR_FIX_TX_DAT_14_TSU 0x00 139#define HOST_SG_TBL_ITEMS (HOST_SG_TBL_BUF_LEN / 8)
296#define DDR_FIX_TX_DAT_12_TSU 0x40 140#define MAX_SG_ITEM_LEN 0x80000
297#define DDR_FIX_TX_CMD_NEG_EDGE 0x00 141#define HOST_TO_DEVICE 0
298#define DDR_FIX_TX_CMD_14_AHEAD 0x20 142#define DEVICE_TO_HOST 1
299#define SD20_TX_NEG_EDGE 0x00
300#define SD20_TX_14_AHEAD 0x10
301#define SD20_TX_SEL_MASK 0x10
302#define DDR_VAR_SDCLK_POL_SWAP 0x01
303
304/* SD_TRANSFER */
305#define SD_TRANSFER_START 0x80
306#define SD_TRANSFER_END 0x40
307#define SD_STAT_IDLE 0x20
308#define SD_TRANSFER_ERR 0x10
309/* SD Transfer Mode definition */
310#define SD_TM_NORMAL_WRITE 0x00
311#define SD_TM_AUTO_WRITE_3 0x01
312#define SD_TM_AUTO_WRITE_4 0x02
313#define SD_TM_AUTO_READ_3 0x05
314#define SD_TM_AUTO_READ_4 0x06
315#define SD_TM_CMD_RSP 0x08
316#define SD_TM_AUTO_WRITE_1 0x09
317#define SD_TM_AUTO_WRITE_2 0x0A
318#define SD_TM_NORMAL_READ 0x0C
319#define SD_TM_AUTO_READ_1 0x0D
320#define SD_TM_AUTO_READ_2 0x0E
321#define SD_TM_AUTO_TUNING 0x0F
322
323/* SD_VPTX_CTL / SD_VPRX_CTL */
324#define PHASE_CHANGE 0x80
325#define PHASE_NOT_RESET 0x40
326
327/* SD_DCMPS_TX_CTL / SD_DCMPS_RX_CTL */
328#define DCMPS_CHANGE 0x80
329#define DCMPS_CHANGE_DONE 0x40
330#define DCMPS_ERROR 0x20
331#define DCMPS_CURRENT_PHASE 0x1F
332
333/* SD Configure 1 Register */
334#define SD_CLK_DIVIDE_0 0x00
335#define SD_CLK_DIVIDE_256 0xC0
336#define SD_CLK_DIVIDE_128 0x80
337#define SD_BUS_WIDTH_1BIT 0x00
338#define SD_BUS_WIDTH_4BIT 0x01
339#define SD_BUS_WIDTH_8BIT 0x02
340#define SD_ASYNC_FIFO_NOT_RST 0x10
341#define SD_20_MODE 0x00
342#define SD_DDR_MODE 0x04
343#define SD_30_MODE 0x08
344
345#define SD_CLK_DIVIDE_MASK 0xC0
346
347/* SD_CMD_STATE */
348#define SD_CMD_IDLE 0x80
349
350/* SD_DATA_STATE */
351#define SD_DATA_IDLE 0x80
352
353/* DCM_DRP_CTL */
354#define DCM_RESET 0x08
355#define DCM_LOCKED 0x04
356#define DCM_208M 0x00
357#define DCM_TX 0x01
358#define DCM_RX 0x02
359
360/* DCM_DRP_TRIG */
361#define DRP_START 0x80
362#define DRP_DONE 0x40
363
364/* DCM_DRP_CFG */
365#define DRP_WRITE 0x80
366#define DRP_READ 0x00
367#define DCM_WRITE_ADDRESS_50 0x50
368#define DCM_WRITE_ADDRESS_51 0x51
369#define DCM_READ_ADDRESS_00 0x00
370#define DCM_READ_ADDRESS_51 0x51
371
372/* IRQSTAT0 */
373#define DMA_DONE_INT 0x80
374#define SUSPEND_INT 0x40
375#define LINK_RDY_INT 0x20
376#define LINK_DOWN_INT 0x10
377
378/* DMACTL */
379#define DMA_RST 0x80
380#define DMA_BUSY 0x04
381#define DMA_DIR_TO_CARD 0x00
382#define DMA_DIR_FROM_CARD 0x02
383#define DMA_EN 0x01
384#define DMA_128 (0 << 4)
385#define DMA_256 (1 << 4)
386#define DMA_512 (2 << 4)
387#define DMA_1024 (3 << 4)
388#define DMA_PACK_SIZE_MASK 0x30
389
390/* SSC_CTL1 */
391#define SSC_RSTB 0x80
392#define SSC_8X_EN 0x40
393#define SSC_FIX_FRAC 0x20
394#define SSC_SEL_1M 0x00
395#define SSC_SEL_2M 0x08
396#define SSC_SEL_4M 0x10
397#define SSC_SEL_8M 0x18
398
399/* SSC_CTL2 */
400#define SSC_DEPTH_MASK 0x07
401#define SSC_DEPTH_DISALBE 0x00
402#define SSC_DEPTH_4M 0x01
403#define SSC_DEPTH_2M 0x02
404#define SSC_DEPTH_1M 0x03
405#define SSC_DEPTH_500K 0x04
406#define SSC_DEPTH_250K 0x05
407
408/* System Clock Control Register */
409#define CLK_LOW_FREQ 0x01
410
411/* System Clock Divider Register */
412#define CLK_DIV_1 0x01
413#define CLK_DIV_2 0x02
414#define CLK_DIV_4 0x03
415#define CLK_DIV_8 0x04
416
417/* MS_CFG */
418#define SAMPLE_TIME_RISING 0x00
419#define SAMPLE_TIME_FALLING 0x80
420#define PUSH_TIME_DEFAULT 0x00
421#define PUSH_TIME_ODD 0x40
422#define NO_EXTEND_TOGGLE 0x00
423#define EXTEND_TOGGLE_CHK 0x20
424#define MS_BUS_WIDTH_1 0x00
425#define MS_BUS_WIDTH_4 0x10
426#define MS_BUS_WIDTH_8 0x18
427#define MS_2K_SECTOR_MODE 0x04
428#define MS_512_SECTOR_MODE 0x00
429#define MS_TOGGLE_TIMEOUT_EN 0x00
430#define MS_TOGGLE_TIMEOUT_DISEN 0x01
431#define MS_NO_CHECK_INT 0x02
432 143
433/* MS_TRANS_CFG */ 144#define OUTPUT_3V3 0
434#define WAIT_INT 0x80 145#define OUTPUT_1V8 1
435#define NO_WAIT_INT 0x00 146
436#define NO_AUTO_READ_INT_REG 0x00 147#define RTSX_PHASE_MAX 32
437#define AUTO_READ_INT_REG 0x40 148#define RX_TUNING_CNT 3
438#define MS_CRC16_ERR 0x20
439#define MS_RDY_TIMEOUT 0x10
440#define MS_INT_CMDNK 0x08
441#define MS_INT_BREQ 0x04
442#define MS_INT_ERR 0x02
443#define MS_INT_CED 0x01
444
445/* MS_TRANSFER */
446#define MS_TRANSFER_START 0x80
447#define MS_TRANSFER_END 0x40
448#define MS_TRANSFER_ERR 0x20
449#define MS_BS_STATE 0x10
450#define MS_TM_READ_BYTES 0x00
451#define MS_TM_NORMAL_READ 0x01
452#define MS_TM_WRITE_BYTES 0x04
453#define MS_TM_NORMAL_WRITE 0x05
454#define MS_TM_AUTO_READ 0x08
455#define MS_TM_AUTO_WRITE 0x0C
456
457/* SD Configure 2 Register */
458#define SD_CALCULATE_CRC7 0x00
459#define SD_NO_CALCULATE_CRC7 0x80
460#define SD_CHECK_CRC16 0x00
461#define SD_NO_CHECK_CRC16 0x40
462#define SD_NO_CHECK_WAIT_CRC_TO 0x20
463#define SD_WAIT_BUSY_END 0x08
464#define SD_NO_WAIT_BUSY_END 0x00
465#define SD_CHECK_CRC7 0x00
466#define SD_NO_CHECK_CRC7 0x04
467#define SD_RSP_LEN_0 0x00
468#define SD_RSP_LEN_6 0x01
469#define SD_RSP_LEN_17 0x02
470/* SD/MMC Response Type Definition */
471#define SD_RSP_TYPE_R0 0x04
472#define SD_RSP_TYPE_R1 0x01
473#define SD_RSP_TYPE_R1b 0x09
474#define SD_RSP_TYPE_R2 0x02
475#define SD_RSP_TYPE_R3 0x05
476#define SD_RSP_TYPE_R4 0x05
477#define SD_RSP_TYPE_R5 0x01
478#define SD_RSP_TYPE_R6 0x01
479#define SD_RSP_TYPE_R7 0x01
480
481/* SD_CONFIGURE3 */
482#define SD_RSP_80CLK_TIMEOUT_EN 0x01
483
484/* Card Transfer Reset Register */
485#define SPI_STOP 0x01
486#define XD_STOP 0x02
487#define SD_STOP 0x04
488#define MS_STOP 0x08
489#define SPI_CLR_ERR 0x10
490#define XD_CLR_ERR 0x20
491#define SD_CLR_ERR 0x40
492#define MS_CLR_ERR 0x80
493
494/* Card Data Source Register */
495#define PINGPONG_BUFFER 0x01
496#define RING_BUFFER 0x00
497
498/* Card Power Control Register */
499#define PMOS_STRG_MASK 0x10
500#define PMOS_STRG_800mA 0x10
501#define PMOS_STRG_400mA 0x00
502#define SD_POWER_OFF 0x03
503#define SD_PARTIAL_POWER_ON 0x01
504#define SD_POWER_ON 0x00
505#define SD_POWER_MASK 0x03
506#define MS_POWER_OFF 0x0C
507#define MS_PARTIAL_POWER_ON 0x04
508#define MS_POWER_ON 0x00
509#define MS_POWER_MASK 0x0C
510#define BPP_POWER_OFF 0x0F
511#define BPP_POWER_5_PERCENT_ON 0x0E
512#define BPP_POWER_10_PERCENT_ON 0x0C
513#define BPP_POWER_15_PERCENT_ON 0x08
514#define BPP_POWER_ON 0x00
515#define BPP_POWER_MASK 0x0F
516#define SD_VCC_PARTIAL_POWER_ON 0x02
517#define SD_VCC_POWER_ON 0x00
518
519/* PWR_GATE_CTRL */
520#define PWR_GATE_EN 0x01
521#define LDO3318_PWR_MASK 0x06
522#define LDO_ON 0x00
523#define LDO_SUSPEND 0x04
524#define LDO_OFF 0x06
525
526/* CARD_CLK_SOURCE */
527#define CRC_FIX_CLK (0x00 << 0)
528#define CRC_VAR_CLK0 (0x01 << 0)
529#define CRC_VAR_CLK1 (0x02 << 0)
530#define SD30_FIX_CLK (0x00 << 2)
531#define SD30_VAR_CLK0 (0x01 << 2)
532#define SD30_VAR_CLK1 (0x02 << 2)
533#define SAMPLE_FIX_CLK (0x00 << 4)
534#define SAMPLE_VAR_CLK0 (0x01 << 4)
535#define SAMPLE_VAR_CLK1 (0x02 << 4)
536
537/* HOST_SLEEP_STATE */
538#define HOST_ENTER_S1 1
539#define HOST_ENTER_S3 2
540 149
541#define MS_CFG 0xFD40 150#define MS_CFG 0xFD40
151#define SAMPLE_TIME_RISING 0x00
152#define SAMPLE_TIME_FALLING 0x80
153#define PUSH_TIME_DEFAULT 0x00
154#define PUSH_TIME_ODD 0x40
155#define NO_EXTEND_TOGGLE 0x00
156#define EXTEND_TOGGLE_CHK 0x20
157#define MS_BUS_WIDTH_1 0x00
158#define MS_BUS_WIDTH_4 0x10
159#define MS_BUS_WIDTH_8 0x18
160#define MS_2K_SECTOR_MODE 0x04
161#define MS_512_SECTOR_MODE 0x00
162#define MS_TOGGLE_TIMEOUT_EN 0x00
163#define MS_TOGGLE_TIMEOUT_DISEN 0x01
164#define MS_NO_CHECK_INT 0x02
542#define MS_TPC 0xFD41 165#define MS_TPC 0xFD41
543#define MS_TRANS_CFG 0xFD42 166#define MS_TRANS_CFG 0xFD42
167#define WAIT_INT 0x80
168#define NO_WAIT_INT 0x00
169#define NO_AUTO_READ_INT_REG 0x00
170#define AUTO_READ_INT_REG 0x40
171#define MS_CRC16_ERR 0x20
172#define MS_RDY_TIMEOUT 0x10
173#define MS_INT_CMDNK 0x08
174#define MS_INT_BREQ 0x04
175#define MS_INT_ERR 0x02
176#define MS_INT_CED 0x01
544#define MS_TRANSFER 0xFD43 177#define MS_TRANSFER 0xFD43
178#define MS_TRANSFER_START 0x80
179#define MS_TRANSFER_END 0x40
180#define MS_TRANSFER_ERR 0x20
181#define MS_BS_STATE 0x10
182#define MS_TM_READ_BYTES 0x00
183#define MS_TM_NORMAL_READ 0x01
184#define MS_TM_WRITE_BYTES 0x04
185#define MS_TM_NORMAL_WRITE 0x05
186#define MS_TM_AUTO_READ 0x08
187#define MS_TM_AUTO_WRITE 0x0C
545#define MS_INT_REG 0xFD44 188#define MS_INT_REG 0xFD44
546#define MS_BYTE_CNT 0xFD45 189#define MS_BYTE_CNT 0xFD45
547#define MS_SECTOR_CNT_L 0xFD46 190#define MS_SECTOR_CNT_L 0xFD46
@@ -549,14 +192,90 @@
549#define MS_DBUS_H 0xFD48 192#define MS_DBUS_H 0xFD48
550 193
551#define SD_CFG1 0xFDA0 194#define SD_CFG1 0xFDA0
195#define SD_CLK_DIVIDE_0 0x00
196#define SD_CLK_DIVIDE_256 0xC0
197#define SD_CLK_DIVIDE_128 0x80
198#define SD_BUS_WIDTH_1BIT 0x00
199#define SD_BUS_WIDTH_4BIT 0x01
200#define SD_BUS_WIDTH_8BIT 0x02
201#define SD_ASYNC_FIFO_NOT_RST 0x10
202#define SD_20_MODE 0x00
203#define SD_DDR_MODE 0x04
204#define SD_30_MODE 0x08
205#define SD_CLK_DIVIDE_MASK 0xC0
552#define SD_CFG2 0xFDA1 206#define SD_CFG2 0xFDA1
207#define SD_CALCULATE_CRC7 0x00
208#define SD_NO_CALCULATE_CRC7 0x80
209#define SD_CHECK_CRC16 0x00
210#define SD_NO_CHECK_CRC16 0x40
211#define SD_NO_CHECK_WAIT_CRC_TO 0x20
212#define SD_WAIT_BUSY_END 0x08
213#define SD_NO_WAIT_BUSY_END 0x00
214#define SD_CHECK_CRC7 0x00
215#define SD_NO_CHECK_CRC7 0x04
216#define SD_RSP_LEN_0 0x00
217#define SD_RSP_LEN_6 0x01
218#define SD_RSP_LEN_17 0x02
219#define SD_RSP_TYPE_R0 0x04
220#define SD_RSP_TYPE_R1 0x01
221#define SD_RSP_TYPE_R1b 0x09
222#define SD_RSP_TYPE_R2 0x02
223#define SD_RSP_TYPE_R3 0x05
224#define SD_RSP_TYPE_R4 0x05
225#define SD_RSP_TYPE_R5 0x01
226#define SD_RSP_TYPE_R6 0x01
227#define SD_RSP_TYPE_R7 0x01
553#define SD_CFG3 0xFDA2 228#define SD_CFG3 0xFDA2
229#define SD_RSP_80CLK_TIMEOUT_EN 0x01
230
554#define SD_STAT1 0xFDA3 231#define SD_STAT1 0xFDA3
232#define SD_CRC7_ERR 0x80
233#define SD_CRC16_ERR 0x40
234#define SD_CRC_WRITE_ERR 0x20
235#define SD_CRC_WRITE_ERR_MASK 0x1C
236#define GET_CRC_TIME_OUT 0x02
237#define SD_TUNING_COMPARE_ERR 0x01
555#define SD_STAT2 0xFDA4 238#define SD_STAT2 0xFDA4
239#define SD_RSP_80CLK_TIMEOUT 0x01
240
556#define SD_BUS_STAT 0xFDA5 241#define SD_BUS_STAT 0xFDA5
242#define SD_CLK_TOGGLE_EN 0x80
243#define SD_CLK_FORCE_STOP 0x40
244#define SD_DAT3_STATUS 0x10
245#define SD_DAT2_STATUS 0x08
246#define SD_DAT1_STATUS 0x04
247#define SD_DAT0_STATUS 0x02
248#define SD_CMD_STATUS 0x01
557#define SD_PAD_CTL 0xFDA6 249#define SD_PAD_CTL 0xFDA6
250#define SD_IO_USING_1V8 0x80
251#define SD_IO_USING_3V3 0x7F
252#define TYPE_A_DRIVING 0x00
253#define TYPE_B_DRIVING 0x01
254#define TYPE_C_DRIVING 0x02
255#define TYPE_D_DRIVING 0x03
558#define SD_SAMPLE_POINT_CTL 0xFDA7 256#define SD_SAMPLE_POINT_CTL 0xFDA7
257#define DDR_FIX_RX_DAT 0x00
258#define DDR_VAR_RX_DAT 0x80
259#define DDR_FIX_RX_DAT_EDGE 0x00
260#define DDR_FIX_RX_DAT_14_DELAY 0x40
261#define DDR_FIX_RX_CMD 0x00
262#define DDR_VAR_RX_CMD 0x20
263#define DDR_FIX_RX_CMD_POS_EDGE 0x00
264#define DDR_FIX_RX_CMD_14_DELAY 0x10
265#define SD20_RX_POS_EDGE 0x00
266#define SD20_RX_14_DELAY 0x08
267#define SD20_RX_SEL_MASK 0x08
559#define SD_PUSH_POINT_CTL 0xFDA8 268#define SD_PUSH_POINT_CTL 0xFDA8
269#define DDR_FIX_TX_CMD_DAT 0x00
270#define DDR_VAR_TX_CMD_DAT 0x80
271#define DDR_FIX_TX_DAT_14_TSU 0x00
272#define DDR_FIX_TX_DAT_12_TSU 0x40
273#define DDR_FIX_TX_CMD_NEG_EDGE 0x00
274#define DDR_FIX_TX_CMD_14_AHEAD 0x20
275#define SD20_TX_NEG_EDGE 0x00
276#define SD20_TX_14_AHEAD 0x10
277#define SD20_TX_SEL_MASK 0x10
278#define DDR_VAR_SDCLK_POL_SWAP 0x01
560#define SD_CMD0 0xFDA9 279#define SD_CMD0 0xFDA9
561#define SD_CMD_START 0x40 280#define SD_CMD_START 0x40
562#define SD_CMD1 0xFDAA 281#define SD_CMD1 0xFDAA
@@ -569,60 +288,203 @@
569#define SD_BLOCK_CNT_L 0xFDB1 288#define SD_BLOCK_CNT_L 0xFDB1
570#define SD_BLOCK_CNT_H 0xFDB2 289#define SD_BLOCK_CNT_H 0xFDB2
571#define SD_TRANSFER 0xFDB3 290#define SD_TRANSFER 0xFDB3
291#define SD_TRANSFER_START 0x80
292#define SD_TRANSFER_END 0x40
293#define SD_STAT_IDLE 0x20
294#define SD_TRANSFER_ERR 0x10
295#define SD_TM_NORMAL_WRITE 0x00
296#define SD_TM_AUTO_WRITE_3 0x01
297#define SD_TM_AUTO_WRITE_4 0x02
298#define SD_TM_AUTO_READ_3 0x05
299#define SD_TM_AUTO_READ_4 0x06
300#define SD_TM_CMD_RSP 0x08
301#define SD_TM_AUTO_WRITE_1 0x09
302#define SD_TM_AUTO_WRITE_2 0x0A
303#define SD_TM_NORMAL_READ 0x0C
304#define SD_TM_AUTO_READ_1 0x0D
305#define SD_TM_AUTO_READ_2 0x0E
306#define SD_TM_AUTO_TUNING 0x0F
572#define SD_CMD_STATE 0xFDB5 307#define SD_CMD_STATE 0xFDB5
308#define SD_CMD_IDLE 0x80
309
573#define SD_DATA_STATE 0xFDB6 310#define SD_DATA_STATE 0xFDB6
311#define SD_DATA_IDLE 0x80
574 312
575#define SRCTL 0xFC13 313#define SRCTL 0xFC13
576 314
577#define DCM_DRP_CTL 0xFC23 315#define DCM_DRP_CTL 0xFC23
578#define DCM_DRP_TRIG 0xFC24 316#define DCM_RESET 0x08
579#define DCM_DRP_CFG 0xFC25 317#define DCM_LOCKED 0x04
580#define DCM_DRP_WR_DATA_L 0xFC26 318#define DCM_208M 0x00
581#define DCM_DRP_WR_DATA_H 0xFC27 319#define DCM_TX 0x01
582#define DCM_DRP_RD_DATA_L 0xFC28 320#define DCM_RX 0x02
583#define DCM_DRP_RD_DATA_H 0xFC29 321#define DCM_DRP_TRIG 0xFC24
322#define DRP_START 0x80
323#define DRP_DONE 0x40
324#define DCM_DRP_CFG 0xFC25
325#define DRP_WRITE 0x80
326#define DRP_READ 0x00
327#define DCM_WRITE_ADDRESS_50 0x50
328#define DCM_WRITE_ADDRESS_51 0x51
329#define DCM_READ_ADDRESS_00 0x00
330#define DCM_READ_ADDRESS_51 0x51
331#define DCM_DRP_WR_DATA_L 0xFC26
332#define DCM_DRP_WR_DATA_H 0xFC27
333#define DCM_DRP_RD_DATA_L 0xFC28
334#define DCM_DRP_RD_DATA_H 0xFC29
584#define SD_VPCLK0_CTL 0xFC2A 335#define SD_VPCLK0_CTL 0xFC2A
585#define SD_VPCLK1_CTL 0xFC2B 336#define SD_VPCLK1_CTL 0xFC2B
586#define SD_DCMPS0_CTL 0xFC2C 337#define SD_DCMPS0_CTL 0xFC2C
587#define SD_DCMPS1_CTL 0xFC2D 338#define SD_DCMPS1_CTL 0xFC2D
588#define SD_VPTX_CTL SD_VPCLK0_CTL 339#define SD_VPTX_CTL SD_VPCLK0_CTL
589#define SD_VPRX_CTL SD_VPCLK1_CTL 340#define SD_VPRX_CTL SD_VPCLK1_CTL
341#define PHASE_CHANGE 0x80
342#define PHASE_NOT_RESET 0x40
590#define SD_DCMPS_TX_CTL SD_DCMPS0_CTL 343#define SD_DCMPS_TX_CTL SD_DCMPS0_CTL
591#define SD_DCMPS_RX_CTL SD_DCMPS1_CTL 344#define SD_DCMPS_RX_CTL SD_DCMPS1_CTL
345#define DCMPS_CHANGE 0x80
346#define DCMPS_CHANGE_DONE 0x40
347#define DCMPS_ERROR 0x20
348#define DCMPS_CURRENT_PHASE 0x1F
592#define CARD_CLK_SOURCE 0xFC2E 349#define CARD_CLK_SOURCE 0xFC2E
593 350#define CRC_FIX_CLK (0x00 << 0)
351#define CRC_VAR_CLK0 (0x01 << 0)
352#define CRC_VAR_CLK1 (0x02 << 0)
353#define SD30_FIX_CLK (0x00 << 2)
354#define SD30_VAR_CLK0 (0x01 << 2)
355#define SD30_VAR_CLK1 (0x02 << 2)
356#define SAMPLE_FIX_CLK (0x00 << 4)
357#define SAMPLE_VAR_CLK0 (0x01 << 4)
358#define SAMPLE_VAR_CLK1 (0x02 << 4)
594#define CARD_PWR_CTL 0xFD50 359#define CARD_PWR_CTL 0xFD50
360#define PMOS_STRG_MASK 0x10
361#define PMOS_STRG_800mA 0x10
362#define PMOS_STRG_400mA 0x00
363#define SD_POWER_OFF 0x03
364#define SD_PARTIAL_POWER_ON 0x01
365#define SD_POWER_ON 0x00
366#define SD_POWER_MASK 0x03
367#define MS_POWER_OFF 0x0C
368#define MS_PARTIAL_POWER_ON 0x04
369#define MS_POWER_ON 0x00
370#define MS_POWER_MASK 0x0C
371#define BPP_POWER_OFF 0x0F
372#define BPP_POWER_5_PERCENT_ON 0x0E
373#define BPP_POWER_10_PERCENT_ON 0x0C
374#define BPP_POWER_15_PERCENT_ON 0x08
375#define BPP_POWER_ON 0x00
376#define BPP_POWER_MASK 0x0F
377#define SD_VCC_PARTIAL_POWER_ON 0x02
378#define SD_VCC_POWER_ON 0x00
595#define CARD_CLK_SWITCH 0xFD51 379#define CARD_CLK_SWITCH 0xFD51
596#define RTL8411B_PACKAGE_MODE 0xFD51 380#define RTL8411B_PACKAGE_MODE 0xFD51
597#define CARD_SHARE_MODE 0xFD52 381#define CARD_SHARE_MODE 0xFD52
382#define CARD_SHARE_MASK 0x0F
383#define CARD_SHARE_MULTI_LUN 0x00
384#define CARD_SHARE_NORMAL 0x00
385#define CARD_SHARE_48_SD 0x04
386#define CARD_SHARE_48_MS 0x08
387#define CARD_SHARE_BAROSSA_SD 0x01
388#define CARD_SHARE_BAROSSA_MS 0x02
598#define CARD_DRIVE_SEL 0xFD53 389#define CARD_DRIVE_SEL 0xFD53
390#define MS_DRIVE_8mA (0x01 << 6)
391#define MMC_DRIVE_8mA (0x01 << 4)
392#define XD_DRIVE_8mA (0x01 << 2)
393#define GPIO_DRIVE_8mA 0x01
394#define RTS5209_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
395 XD_DRIVE_8mA | GPIO_DRIVE_8mA)
396#define RTL8411_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
397 XD_DRIVE_8mA)
398#define RTSX_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | GPIO_DRIVE_8mA)
399
599#define CARD_STOP 0xFD54 400#define CARD_STOP 0xFD54
401#define SPI_STOP 0x01
402#define XD_STOP 0x02
403#define SD_STOP 0x04
404#define MS_STOP 0x08
405#define SPI_CLR_ERR 0x10
406#define XD_CLR_ERR 0x20
407#define SD_CLR_ERR 0x40
408#define MS_CLR_ERR 0x80
600#define CARD_OE 0xFD55 409#define CARD_OE 0xFD55
410#define SD_OUTPUT_EN 0x04
411#define MS_OUTPUT_EN 0x08
601#define CARD_AUTO_BLINK 0xFD56 412#define CARD_AUTO_BLINK 0xFD56
602#define CARD_GPIO_DIR 0xFD57 413#define CARD_GPIO_DIR 0xFD57
603#define CARD_GPIO 0xFD58 414#define CARD_GPIO 0xFD58
604#define CARD_DATA_SOURCE 0xFD5B 415#define CARD_DATA_SOURCE 0xFD5B
416#define PINGPONG_BUFFER 0x01
417#define RING_BUFFER 0x00
605#define SD30_CLK_DRIVE_SEL 0xFD5A 418#define SD30_CLK_DRIVE_SEL 0xFD5A
419#define DRIVER_TYPE_A 0x05
420#define DRIVER_TYPE_B 0x03
421#define DRIVER_TYPE_C 0x02
422#define DRIVER_TYPE_D 0x01
606#define CARD_SELECT 0xFD5C 423#define CARD_SELECT 0xFD5C
424#define SD_MOD_SEL 2
425#define MS_MOD_SEL 3
607#define SD30_DRIVE_SEL 0xFD5E 426#define SD30_DRIVE_SEL 0xFD5E
427#define CFG_DRIVER_TYPE_A 0x02
428#define CFG_DRIVER_TYPE_B 0x03
429#define CFG_DRIVER_TYPE_C 0x01
430#define CFG_DRIVER_TYPE_D 0x00
608#define SD30_CMD_DRIVE_SEL 0xFD5E 431#define SD30_CMD_DRIVE_SEL 0xFD5E
609#define SD30_DAT_DRIVE_SEL 0xFD5F 432#define SD30_DAT_DRIVE_SEL 0xFD5F
610#define CARD_CLK_EN 0xFD69 433#define CARD_CLK_EN 0xFD69
434#define SD_CLK_EN 0x04
435#define MS_CLK_EN 0x08
611#define SDIO_CTRL 0xFD6B 436#define SDIO_CTRL 0xFD6B
612#define CD_PAD_CTL 0xFD73 437#define CD_PAD_CTL 0xFD73
613 438#define CD_DISABLE_MASK 0x07
439#define MS_CD_DISABLE 0x04
440#define SD_CD_DISABLE 0x02
441#define XD_CD_DISABLE 0x01
442#define CD_DISABLE 0x07
443#define CD_ENABLE 0x00
444#define MS_CD_EN_ONLY 0x03
445#define SD_CD_EN_ONLY 0x05
446#define XD_CD_EN_ONLY 0x06
447#define FORCE_CD_LOW_MASK 0x38
448#define FORCE_CD_XD_LOW 0x08
449#define FORCE_CD_SD_LOW 0x10
450#define FORCE_CD_MS_LOW 0x20
451#define CD_AUTO_DISABLE 0x40
614#define FPDCTL 0xFC00 452#define FPDCTL 0xFC00
453#define SSC_POWER_DOWN 0x01
454#define SD_OC_POWER_DOWN 0x02
455#define ALL_POWER_DOWN 0x07
456#define OC_POWER_DOWN 0x06
615#define PDINFO 0xFC01 457#define PDINFO 0xFC01
616 458
617#define CLK_CTL 0xFC02 459#define CLK_CTL 0xFC02
460#define CHANGE_CLK 0x01
461#define CLK_LOW_FREQ 0x01
462
618#define CLK_DIV 0xFC03 463#define CLK_DIV 0xFC03
464#define CLK_DIV_1 0x01
465#define CLK_DIV_2 0x02
466#define CLK_DIV_4 0x03
467#define CLK_DIV_8 0x04
619#define CLK_SEL 0xFC04 468#define CLK_SEL 0xFC04
620 469
621#define SSC_DIV_N_0 0xFC0F 470#define SSC_DIV_N_0 0xFC0F
622#define SSC_DIV_N_1 0xFC10 471#define SSC_DIV_N_1 0xFC10
623#define SSC_CTL1 0xFC11 472#define SSC_CTL1 0xFC11
473#define SSC_RSTB 0x80
474#define SSC_8X_EN 0x40
475#define SSC_FIX_FRAC 0x20
476#define SSC_SEL_1M 0x00
477#define SSC_SEL_2M 0x08
478#define SSC_SEL_4M 0x10
479#define SSC_SEL_8M 0x18
624#define SSC_CTL2 0xFC12 480#define SSC_CTL2 0xFC12
625 481#define SSC_DEPTH_MASK 0x07
482#define SSC_DEPTH_DISALBE 0x00
483#define SSC_DEPTH_4M 0x01
484#define SSC_DEPTH_2M 0x02
485#define SSC_DEPTH_1M 0x03
486#define SSC_DEPTH_500K 0x04
487#define SSC_DEPTH_250K 0x05
626#define RCCTL 0xFC14 488#define RCCTL 0xFC14
627 489
628#define FPGA_PULL_CTL 0xFC1D 490#define FPGA_PULL_CTL 0xFC1D
@@ -630,6 +492,24 @@
630#define GPIO_CTL 0xFC1F 492#define GPIO_CTL 0xFC1F
631 493
632#define LDO_CTL 0xFC1E 494#define LDO_CTL 0xFC1E
495#define BPP_ASIC_1V7 0x00
496#define BPP_ASIC_1V8 0x01
497#define BPP_ASIC_1V9 0x02
498#define BPP_ASIC_2V0 0x03
499#define BPP_ASIC_2V7 0x04
500#define BPP_ASIC_2V8 0x05
501#define BPP_ASIC_3V2 0x06
502#define BPP_ASIC_3V3 0x07
503#define BPP_REG_TUNED18 0x07
504#define BPP_TUNED18_SHIFT_8402 5
505#define BPP_TUNED18_SHIFT_8411 4
506#define BPP_PAD_MASK 0x04
507#define BPP_PAD_3V3 0x04
508#define BPP_PAD_1V8 0x00
509#define BPP_LDO_POWB 0x03
510#define BPP_LDO_ON 0x00
511#define BPP_LDO_SUSPEND 0x02
512#define BPP_LDO_OFF 0x03
633#define SYS_VER 0xFC32 513#define SYS_VER 0xFC32
634 514
635#define CARD_PULL_CTL1 0xFD60 515#define CARD_PULL_CTL1 0xFD60
@@ -642,6 +522,10 @@
642/* PCI Express Related Registers */ 522/* PCI Express Related Registers */
643#define IRQEN0 0xFE20 523#define IRQEN0 0xFE20
644#define IRQSTAT0 0xFE21 524#define IRQSTAT0 0xFE21
525#define DMA_DONE_INT 0x80
526#define SUSPEND_INT 0x40
527#define LINK_RDY_INT 0x20
528#define LINK_DOWN_INT 0x10
645#define IRQEN1 0xFE22 529#define IRQEN1 0xFE22
646#define IRQSTAT1 0xFE23 530#define IRQSTAT1 0xFE23
647#define TLPRIEN 0xFE24 531#define TLPRIEN 0xFE24
@@ -653,6 +537,16 @@
653#define DMATC2 0xFE2A 537#define DMATC2 0xFE2A
654#define DMATC3 0xFE2B 538#define DMATC3 0xFE2B
655#define DMACTL 0xFE2C 539#define DMACTL 0xFE2C
540#define DMA_RST 0x80
541#define DMA_BUSY 0x04
542#define DMA_DIR_TO_CARD 0x00
543#define DMA_DIR_FROM_CARD 0x02
544#define DMA_EN 0x01
545#define DMA_128 (0 << 4)
546#define DMA_256 (1 << 4)
547#define DMA_512 (2 << 4)
548#define DMA_1024 (3 << 4)
549#define DMA_PACK_SIZE_MASK 0x30
656#define BCTL 0xFE2D 550#define BCTL 0xFE2D
657#define RBBC0 0xFE2E 551#define RBBC0 0xFE2E
658#define RBBC1 0xFE2F 552#define RBBC1 0xFE2F
@@ -678,14 +572,21 @@
678#define MSGTXDATA2 0xFE46 572#define MSGTXDATA2 0xFE46
679#define MSGTXDATA3 0xFE47 573#define MSGTXDATA3 0xFE47
680#define MSGTXCTL 0xFE48 574#define MSGTXCTL 0xFE48
681#define PETXCFG 0xFE49
682#define LTR_CTL 0xFE4A 575#define LTR_CTL 0xFE4A
683#define OBFF_CFG 0xFE4C 576#define OBFF_CFG 0xFE4C
684 577
685#define CDRESUMECTL 0xFE52 578#define CDRESUMECTL 0xFE52
686#define WAKE_SEL_CTL 0xFE54 579#define WAKE_SEL_CTL 0xFE54
580#define PCLK_CTL 0xFE55
581#define PCLK_MODE_SEL 0x20
687#define PME_FORCE_CTL 0xFE56 582#define PME_FORCE_CTL 0xFE56
583
688#define ASPM_FORCE_CTL 0xFE57 584#define ASPM_FORCE_CTL 0xFE57
585#define FORCE_ASPM_CTL0 0x10
586#define FORCE_ASPM_VAL_MASK 0x03
587#define FORCE_ASPM_L1_EN 0x02
588#define FORCE_ASPM_L0_EN 0x01
589#define FORCE_ASPM_NO_ASPM 0x00
689#define PM_CLK_FORCE_CTL 0xFE58 590#define PM_CLK_FORCE_CTL 0xFE58
690#define FUNC_FORCE_CTL 0xFE59 591#define FUNC_FORCE_CTL 0xFE59
691#define PERST_GLITCH_WIDTH 0xFE5C 592#define PERST_GLITCH_WIDTH 0xFE5C
@@ -693,19 +594,36 @@
693#define RESET_LOAD_REG 0xFE5E 594#define RESET_LOAD_REG 0xFE5E
694#define EFUSE_CONTENT 0xFE5F 595#define EFUSE_CONTENT 0xFE5F
695#define HOST_SLEEP_STATE 0xFE60 596#define HOST_SLEEP_STATE 0xFE60
696#define SDIO_CFG 0xFE70 597#define HOST_ENTER_S1 1
598#define HOST_ENTER_S3 2
697 599
600#define SDIO_CFG 0xFE70
601#define PM_EVENT_DEBUG 0xFE71
602#define PME_DEBUG_0 0x08
698#define NFTS_TX_CTRL 0xFE72 603#define NFTS_TX_CTRL 0xFE72
699 604
700#define PWR_GATE_CTRL 0xFE75 605#define PWR_GATE_CTRL 0xFE75
606#define PWR_GATE_EN 0x01
607#define LDO3318_PWR_MASK 0x06
608#define LDO_ON 0x00
609#define LDO_SUSPEND 0x04
610#define LDO_OFF 0x06
701#define PWD_SUSPEND_EN 0xFE76 611#define PWD_SUSPEND_EN 0xFE76
702#define LDO_PWR_SEL 0xFE78 612#define LDO_PWR_SEL 0xFE78
703 613
614#define L1SUB_CONFIG1 0xFE8D
615#define L1SUB_CONFIG2 0xFE8E
616#define L1SUB_AUTO_CFG 0x02
617#define L1SUB_CONFIG3 0xFE8F
618
704#define DUMMY_REG_RESET_0 0xFE90 619#define DUMMY_REG_RESET_0 0xFE90
705 620
706#define AUTOLOAD_CFG_BASE 0xFF00 621#define AUTOLOAD_CFG_BASE 0xFF00
622#define PETXCFG 0xFF03
707 623
708#define PM_CTRL1 0xFF44 624#define PM_CTRL1 0xFF44
625#define CD_RESUME_EN_MASK 0xF0
626
709#define PM_CTRL2 0xFF45 627#define PM_CTRL2 0xFF45
710#define PM_CTRL3 0xFF46 628#define PM_CTRL3 0xFF46
711#define SDIO_SEND_PME_EN 0x80 629#define SDIO_SEND_PME_EN 0x80
@@ -726,18 +644,125 @@
726#define IMAGE_FLAG_ADDR0 0xCE80 644#define IMAGE_FLAG_ADDR0 0xCE80
727#define IMAGE_FLAG_ADDR1 0xCE81 645#define IMAGE_FLAG_ADDR1 0xCE81
728 646
647#define RREF_CFG 0xFF6C
648#define RREF_VBGSEL_MASK 0x38
649#define RREF_VBGSEL_1V25 0x28
650
651#define OOBS_CONFIG 0xFF6E
652#define OOBS_AUTOK_DIS 0x80
653#define OOBS_VAL_MASK 0x1F
654
655#define LDO_DV18_CFG 0xFF70
656#define LDO_DV18_SR_MASK 0xC0
657#define LDO_DV18_SR_DF 0x40
658
659#define LDO_CONFIG2 0xFF71
660#define LDO_D3318_MASK 0x07
661#define LDO_D3318_33V 0x07
662#define LDO_D3318_18V 0x02
663
664#define LDO_VCC_CFG0 0xFF72
665#define LDO_VCC_LMTVTH_MASK 0x30
666#define LDO_VCC_LMTVTH_2A 0x10
667
668#define LDO_VCC_CFG1 0xFF73
669#define LDO_VCC_REF_TUNE_MASK 0x30
670#define LDO_VCC_REF_1V2 0x20
671#define LDO_VCC_TUNE_MASK 0x07
672#define LDO_VCC_1V8 0x04
673#define LDO_VCC_3V3 0x07
674#define LDO_VCC_LMT_EN 0x08
675
676#define LDO_VIO_CFG 0xFF75
677#define LDO_VIO_SR_MASK 0xC0
678#define LDO_VIO_SR_DF 0x40
679#define LDO_VIO_REF_TUNE_MASK 0x30
680#define LDO_VIO_REF_1V2 0x20
681#define LDO_VIO_TUNE_MASK 0x07
682#define LDO_VIO_1V7 0x03
683#define LDO_VIO_1V8 0x04
684#define LDO_VIO_3V3 0x07
685
686#define LDO_DV12S_CFG 0xFF76
687#define LDO_REF12_TUNE_MASK 0x18
688#define LDO_REF12_TUNE_DF 0x10
689#define LDO_D12_TUNE_MASK 0x07
690#define LDO_D12_TUNE_DF 0x04
691
692#define LDO_AV12S_CFG 0xFF77
693#define LDO_AV12S_TUNE_MASK 0x07
694#define LDO_AV12S_TUNE_DF 0x04
695
696#define SD40_LDO_CTL1 0xFE7D
697#define SD40_VIO_TUNE_MASK 0x70
698#define SD40_VIO_TUNE_1V7 0x30
699#define SD_VIO_LDO_1V8 0x40
700#define SD_VIO_LDO_3V3 0x70
701
729/* Phy register */ 702/* Phy register */
730#define PHY_PCR 0x00 703#define PHY_PCR 0x00
704#define PHY_PCR_FORCE_CODE 0xB000
705#define PHY_PCR_OOBS_CALI_50 0x0800
706#define PHY_PCR_OOBS_VCM_08 0x0200
707#define PHY_PCR_OOBS_SEN_90 0x0040
708#define PHY_PCR_RSSI_EN 0x0002
709#define PHY_PCR_RX10K 0x0001
710
731#define PHY_RCR0 0x01 711#define PHY_RCR0 0x01
732#define PHY_RCR1 0x02 712#define PHY_RCR1 0x02
713#define PHY_RCR1_ADP_TIME_4 0x0400
714#define PHY_RCR1_VCO_COARSE 0x001F
715#define PHY_SSCCR2 0x02
716#define PHY_SSCCR2_PLL_NCODE 0x0A00
717#define PHY_SSCCR2_TIME0 0x001C
718#define PHY_SSCCR2_TIME2_WIDTH 0x0003
719
733#define PHY_RCR2 0x03 720#define PHY_RCR2 0x03
721#define PHY_RCR2_EMPHASE_EN 0x8000
722#define PHY_RCR2_NADJR 0x4000
723#define PHY_RCR2_CDR_SR_2 0x0100
724#define PHY_RCR2_FREQSEL_12 0x0040
725#define PHY_RCR2_CDR_SC_12P 0x0010
726#define PHY_RCR2_CALIB_LATE 0x0002
727#define PHY_SSCCR3 0x03
728#define PHY_SSCCR3_STEP_IN 0x2740
729#define PHY_SSCCR3_CHECK_DELAY 0x0008
730#define _PHY_ANA03 0x03
731#define _PHY_ANA03_TIMER_MAX 0x2700
732#define _PHY_ANA03_OOBS_DEB_EN 0x0040
733#define _PHY_CMU_DEBUG_EN 0x0008
734
734#define PHY_RTCR 0x04 735#define PHY_RTCR 0x04
735#define PHY_RDR 0x05 736#define PHY_RDR 0x05
737#define PHY_RDR_RXDSEL_1_9 0x4000
738#define PHY_SSC_AUTO_PWD 0x0600
736#define PHY_TCR0 0x06 739#define PHY_TCR0 0x06
737#define PHY_TCR1 0x07 740#define PHY_TCR1 0x07
738#define PHY_TUNE 0x08 741#define PHY_TUNE 0x08
742#define PHY_TUNE_TUNEREF_1_0 0x4000
743#define PHY_TUNE_VBGSEL_1252 0x0C00
744#define PHY_TUNE_SDBUS_33 0x0200
745#define PHY_TUNE_TUNED18 0x01C0
746#define PHY_TUNE_TUNED12 0X0020
747#define PHY_TUNE_TUNEA12 0x0004
748#define PHY_TUNE_VOLTAGE_MASK 0xFC3F
749#define PHY_TUNE_VOLTAGE_3V3 0x03C0
750#define PHY_TUNE_D18_1V8 0x0100
751#define PHY_TUNE_D18_1V7 0x0080
752#define PHY_ANA08 0x08
753#define PHY_ANA08_RX_EQ_DCGAIN 0x5000
754#define PHY_ANA08_SEL_RX_EN 0x0400
755#define PHY_ANA08_RX_EQ_VAL 0x03C0
756#define PHY_ANA08_SCP 0x0020
757#define PHY_ANA08_SEL_IPI 0x0004
758
739#define PHY_IMR 0x09 759#define PHY_IMR 0x09
740#define PHY_BPCR 0x0A 760#define PHY_BPCR 0x0A
761#define PHY_BPCR_IBRXSEL 0x0400
762#define PHY_BPCR_IBTXSEL 0x0100
763#define PHY_BPCR_IB_FILTER 0x0080
764#define PHY_BPCR_CMIRROR_EN 0x0040
765
741#define PHY_BIST 0x0B 766#define PHY_BIST 0x0B
742#define PHY_RAW_L 0x0C 767#define PHY_RAW_L 0x0C
743#define PHY_RAW_H 0x0D 768#define PHY_RAW_H 0x0D
@@ -745,6 +770,7 @@
745#define PHY_HOST_CLK_CTRL 0x0F 770#define PHY_HOST_CLK_CTRL 0x0F
746#define PHY_DMR 0x10 771#define PHY_DMR 0x10
747#define PHY_BACR 0x11 772#define PHY_BACR 0x11
773#define PHY_BACR_BASIC_MASK 0xFFF3
748#define PHY_IER 0x12 774#define PHY_IER 0x12
749#define PHY_BCSR 0x13 775#define PHY_BCSR 0x13
750#define PHY_BPR 0x14 776#define PHY_BPR 0x14
@@ -752,80 +778,70 @@
752#define PHY_BPNR 0x16 778#define PHY_BPNR 0x16
753#define PHY_BRNR2 0x17 779#define PHY_BRNR2 0x17
754#define PHY_BENR 0x18 780#define PHY_BENR 0x18
755#define PHY_REG_REV 0x19 781#define PHY_REV 0x19
782#define PHY_REV_RESV 0xE000
783#define PHY_REV_RXIDLE_LATCHED 0x1000
784#define PHY_REV_P1_EN 0x0800
785#define PHY_REV_RXIDLE_EN 0x0400
786#define PHY_REV_CLKREQ_TX_EN 0x0200
787#define PHY_REV_CLKREQ_RX_EN 0x0100
788#define PHY_REV_CLKREQ_DT_1_0 0x0040
789#define PHY_REV_STOP_CLKRD 0x0020
790#define PHY_REV_RX_PWST 0x0008
791#define PHY_REV_STOP_CLKWR 0x0004
792#define _PHY_REV0 0x19
793#define _PHY_REV0_FILTER_OUT 0x3800
794#define _PHY_REV0_CDR_BYPASS_PFD 0x0100
795#define _PHY_REV0_CDR_RX_IDLE_BYPASS 0x0002
796
756#define PHY_FLD0 0x1A 797#define PHY_FLD0 0x1A
798#define PHY_ANA1A 0x1A
799#define PHY_ANA1A_TXR_LOOPBACK 0x2000
800#define PHY_ANA1A_RXT_BIST 0x0500
801#define PHY_ANA1A_TXR_BIST 0x0040
802#define PHY_ANA1A_REV 0x0006
757#define PHY_FLD1 0x1B 803#define PHY_FLD1 0x1B
758#define PHY_FLD2 0x1C 804#define PHY_FLD2 0x1C
759#define PHY_FLD3 0x1D 805#define PHY_FLD3 0x1D
806#define PHY_FLD3_TIMER_4 0x0800
807#define PHY_FLD3_TIMER_6 0x0020
808#define PHY_FLD3_RXDELINK 0x0004
809#define PHY_ANA1D 0x1D
810#define PHY_ANA1D_DEBUG_ADDR 0x0004
811#define _PHY_FLD0 0x1D
812#define _PHY_FLD0_CLK_REQ_20C 0x8000
813#define _PHY_FLD0_RX_IDLE_EN 0x1000
814#define _PHY_FLD0_BIT_ERR_RSTN 0x0800
815#define _PHY_FLD0_BER_COUNT 0x01E0
816#define _PHY_FLD0_BER_TIMER 0x001E
817#define _PHY_FLD0_CHECK_EN 0x0001
818
760#define PHY_FLD4 0x1E 819#define PHY_FLD4 0x1E
820#define PHY_FLD4_FLDEN_SEL 0x4000
821#define PHY_FLD4_REQ_REF 0x2000
822#define PHY_FLD4_RXAMP_OFF 0x1000
823#define PHY_FLD4_REQ_ADDA 0x0800
824#define PHY_FLD4_BER_COUNT 0x00E0
825#define PHY_FLD4_BER_TIMER 0x000A
826#define PHY_FLD4_BER_CHK_EN 0x0001
827#define PHY_DIG1E 0x1E
828#define PHY_DIG1E_REV 0x4000
829#define PHY_DIG1E_D0_X_D1 0x1000
830#define PHY_DIG1E_RX_ON_HOST 0x0800
831#define PHY_DIG1E_RCLK_REF_HOST 0x0400
832#define PHY_DIG1E_RCLK_TX_EN_KEEP 0x0040
833#define PHY_DIG1E_RCLK_TX_TERM_KEEP 0x0020
834#define PHY_DIG1E_RCLK_RX_EIDLE_ON 0x0010
835#define PHY_DIG1E_TX_TERM_KEEP 0x0008
836#define PHY_DIG1E_RX_TERM_KEEP 0x0004
837#define PHY_DIG1E_TX_EN_KEEP 0x0002
838#define PHY_DIG1E_RX_EN_KEEP 0x0001
761#define PHY_DUM_REG 0x1F 839#define PHY_DUM_REG 0x1F
762 840
763#define LCTLR 0x80
764#define LCTLR_EXT_SYNC 0x80
765#define LCTLR_COMMON_CLOCK_CFG 0x40
766#define LCTLR_RETRAIN_LINK 0x20
767#define LCTLR_LINK_DISABLE 0x10
768#define LCTLR_RCB 0x08
769#define LCTLR_RESERVED 0x04
770#define LCTLR_ASPM_CTL_MASK 0x03
771
772#define PCR_SETTING_REG1 0x724 841#define PCR_SETTING_REG1 0x724
773#define PCR_SETTING_REG2 0x814 842#define PCR_SETTING_REG2 0x814
774#define PCR_SETTING_REG3 0x747 843#define PCR_SETTING_REG3 0x747
775 844
776/* Phy bits */
777#define PHY_PCR_FORCE_CODE 0xB000
778#define PHY_PCR_OOBS_CALI_50 0x0800
779#define PHY_PCR_OOBS_VCM_08 0x0200
780#define PHY_PCR_OOBS_SEN_90 0x0040
781#define PHY_PCR_RSSI_EN 0x0002
782
783#define PHY_RCR1_ADP_TIME 0x0100
784#define PHY_RCR1_VCO_COARSE 0x001F
785
786#define PHY_RCR2_EMPHASE_EN 0x8000
787#define PHY_RCR2_NADJR 0x4000
788#define PHY_RCR2_CDR_CP_10 0x0400
789#define PHY_RCR2_CDR_SR_2 0x0100
790#define PHY_RCR2_FREQSEL_12 0x0040
791#define PHY_RCR2_CPADJEN 0x0020
792#define PHY_RCR2_CDR_SC_8 0x0008
793#define PHY_RCR2_CALIB_LATE 0x0002
794
795#define PHY_RDR_RXDSEL_1_9 0x4000
796
797#define PHY_TUNE_TUNEREF_1_0 0x4000
798#define PHY_TUNE_VBGSEL_1252 0x0C00
799#define PHY_TUNE_SDBUS_33 0x0200
800#define PHY_TUNE_TUNED18 0x01C0
801#define PHY_TUNE_TUNED12 0X0020
802
803#define PHY_BPCR_IBRXSEL 0x0400
804#define PHY_BPCR_IBTXSEL 0x0100
805#define PHY_BPCR_IB_FILTER 0x0080
806#define PHY_BPCR_CMIRROR_EN 0x0040
807
808#define PHY_REG_REV_RESV 0xE000
809#define PHY_REG_REV_RXIDLE_LATCHED 0x1000
810#define PHY_REG_REV_P1_EN 0x0800
811#define PHY_REG_REV_RXIDLE_EN 0x0400
812#define PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 0x0040
813#define PHY_REG_REV_STOP_CLKRD 0x0020
814#define PHY_REG_REV_RX_PWST 0x0008
815#define PHY_REG_REV_STOP_CLKWR 0x0004
816
817#define PHY_FLD3_TIMER_4 0x7800
818#define PHY_FLD3_TIMER_6 0x00E0
819#define PHY_FLD3_RXDELINK 0x0004
820
821#define PHY_FLD4_FLDEN_SEL 0x4000
822#define PHY_FLD4_REQ_REF 0x2000
823#define PHY_FLD4_RXAMP_OFF 0x1000
824#define PHY_FLD4_REQ_ADDA 0x0800
825#define PHY_FLD4_BER_COUNT 0x00E0
826#define PHY_FLD4_BER_TIMER 0x000A
827#define PHY_FLD4_BER_CHK_EN 0x0001
828
829#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) 845#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
830 846
831struct rtsx_pcr; 847struct rtsx_pcr;
@@ -835,6 +851,8 @@ struct pcr_handle {
835}; 851};
836 852
837struct pcr_ops { 853struct pcr_ops {
854 int (*write_phy)(struct rtsx_pcr *pcr, u8 addr, u16 val);
855 int (*read_phy)(struct rtsx_pcr *pcr, u8 addr, u16 *val);
838 int (*extra_init_hw)(struct rtsx_pcr *pcr); 856 int (*extra_init_hw)(struct rtsx_pcr *pcr);
839 int (*optimize_phy)(struct rtsx_pcr *pcr); 857 int (*optimize_phy)(struct rtsx_pcr *pcr);
840 int (*turn_on_led)(struct rtsx_pcr *pcr); 858 int (*turn_on_led)(struct rtsx_pcr *pcr);
@@ -856,6 +874,7 @@ enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
856struct rtsx_pcr { 874struct rtsx_pcr {
857 struct pci_dev *pci; 875 struct pci_dev *pci;
858 unsigned int id; 876 unsigned int id;
877 int pcie_cap;
859 878
860 /* pci resources */ 879 /* pci resources */
861 unsigned long addr; 880 unsigned long addr;
@@ -928,6 +947,8 @@ struct rtsx_pcr {
928 const struct pcr_ops *ops; 947 const struct pcr_ops *ops;
929 enum PDEV_STAT state; 948 enum PDEV_STAT state;
930 949
950 u16 reg_pm_ctrl3;
951
931 int num_slots; 952 int num_slots;
932 struct rtsx_slot *slots; 953 struct rtsx_slot *slots;
933}; 954};
@@ -935,6 +956,10 @@ struct rtsx_pcr {
935#define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid)) 956#define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid))
936#define PCI_VID(pcr) ((pcr)->pci->vendor) 957#define PCI_VID(pcr) ((pcr)->pci->vendor)
937#define PCI_PID(pcr) ((pcr)->pci->device) 958#define PCI_PID(pcr) ((pcr)->pci->device)
959#define is_version(pcr, pid, ver) \
960 (CHK_PCI_PID(pcr, pid) && (pcr)->ic_version == (ver))
961#define pcr_dbg(pcr, fmt, arg...) \
962 dev_dbg(&(pcr)->pci->dev, fmt, ##arg)
938 963
939#define SDR104_PHASE(val) ((val) & 0xFF) 964#define SDR104_PHASE(val) ((val) & 0xFF)
940#define SDR50_PHASE(val) (((val) >> 8) & 0xFF) 965#define SDR50_PHASE(val) (((val) >> 8) & 0xFF)
@@ -1004,4 +1029,17 @@ static inline void rtsx_pci_write_be32(struct rtsx_pcr *pcr, u16 reg, u32 val)
1004 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 3, 0xFF, val); 1029 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 3, 0xFF, val);
1005} 1030}
1006 1031
1032static inline int rtsx_pci_update_phy(struct rtsx_pcr *pcr, u8 addr,
1033 u16 mask, u16 append)
1034{
1035 int err;
1036 u16 val;
1037
1038 err = rtsx_pci_read_phy_register(pcr, addr, &val);
1039 if (err < 0)
1040 return err;
1041
1042 return rtsx_pci_write_phy_register(pcr, addr, (val & mask) | append);
1043}
1044
1007#endif 1045#endif
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 3fdb7cfbffb3..75115384f3fc 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -58,13 +58,7 @@ enum sec_device_type {
58 * @irq_base: Base IRQ number for device, required for IRQs 58 * @irq_base: Base IRQ number for device, required for IRQs
59 * @irq: Generic IRQ number for device 59 * @irq: Generic IRQ number for device
60 * @irq_data: Runtime data structure for IRQ controller 60 * @irq_data: Runtime data structure for IRQ controller
61 * @ono: Power onoff IRQ number for s5m87xx
62 * @wakeup: Whether or not this is a wakeup device 61 * @wakeup: Whether or not this is a wakeup device
63 * @wtsr_smpl: Whether or not to enable in RTC driver the Watchdog
64 * Timer Software Reset (registers set to default value
65 * after PWRHOLD falling) and Sudden Momentary Power Loss
66 * (PMIC will enter power on sequence after short drop in
67 * VBATT voltage).
68 */ 62 */
69struct sec_pmic_dev { 63struct sec_pmic_dev {
70 struct device *dev; 64 struct device *dev;
@@ -77,9 +71,7 @@ struct sec_pmic_dev {
77 int irq; 71 int irq;
78 struct regmap_irq_chip_data *irq_data; 72 struct regmap_irq_chip_data *irq_data;
79 73
80 int ono;
81 bool wakeup; 74 bool wakeup;
82 bool wtsr_smpl;
83}; 75};
84 76
85int sec_irq_init(struct sec_pmic_dev *sec_pmic); 77int sec_irq_init(struct sec_pmic_dev *sec_pmic);
@@ -95,7 +87,6 @@ struct sec_platform_data {
95 int irq_base; 87 int irq_base;
96 int (*cfg_pmic_irq)(void); 88 int (*cfg_pmic_irq)(void);
97 89
98 int ono;
99 bool wakeup; 90 bool wakeup;
100 bool buck_voltage_lock; 91 bool buck_voltage_lock;
101 92
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h
index f35af7361b60..667aa40486dd 100644
--- a/include/linux/mfd/samsung/irq.h
+++ b/include/linux/mfd/samsung/irq.h
@@ -74,8 +74,8 @@ enum s2mps11_irq {
74 S2MPS11_IRQ_MRB, 74 S2MPS11_IRQ_MRB,
75 75
76 S2MPS11_IRQ_RTC60S, 76 S2MPS11_IRQ_RTC60S,
77 S2MPS11_IRQ_RTCA0,
78 S2MPS11_IRQ_RTCA1, 77 S2MPS11_IRQ_RTCA1,
78 S2MPS11_IRQ_RTCA0,
79 S2MPS11_IRQ_SMPL, 79 S2MPS11_IRQ_SMPL,
80 S2MPS11_IRQ_RTC1S, 80 S2MPS11_IRQ_RTC1S,
81 S2MPS11_IRQ_WTSR, 81 S2MPS11_IRQ_WTSR,
diff --git a/include/linux/mfd/sky81452.h b/include/linux/mfd/sky81452.h
new file mode 100644
index 000000000000..b0925fa3e9ef
--- /dev/null
+++ b/include/linux/mfd/sky81452.h
@@ -0,0 +1,31 @@
1/*
2 * sky81452.h SKY81452 MFD driver
3 *
4 * Copyright 2014 Skyworks Solutions Inc.
5 * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _SKY81452_H
21#define _SKY81452_H
22
23#include <linux/platform_data/sky81452-backlight.h>
24#include <linux/regulator/machine.h>
25
26struct sky81452_platform_data {
27 struct sky81452_bl_platform_data *bl_pdata;
28 struct regulator_init_data *regulator_init_data;
29};
30
31#endif
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 3f4e994ace2b..1fd50dcfe47c 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -128,6 +128,7 @@
128 128
129/* Sequencer Status */ 129/* Sequencer Status */
130#define SEQ_STATUS BIT(5) 130#define SEQ_STATUS BIT(5)
131#define CHARGE_STEP 0x11
131 132
132#define ADC_CLK 3000000 133#define ADC_CLK 3000000
133#define TOTAL_STEPS 16 134#define TOTAL_STEPS 16
diff --git a/include/linux/platform_data/sky81452-backlight.h b/include/linux/platform_data/sky81452-backlight.h
new file mode 100644
index 000000000000..1231e9bb00f1
--- /dev/null
+++ b/include/linux/platform_data/sky81452-backlight.h
@@ -0,0 +1,46 @@
1/*
2 * sky81452.h SKY81452 backlight driver
3 *
4 * Copyright 2014 Skyworks Solutions Inc.
5 * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _SKY81452_BACKLIGHT_H
21#define _SKY81452_BACKLIGHT_H
22
23/**
24 * struct sky81452_platform_data
25 * @name: backlight driver name.
26 If it is not defined, default name is lcd-backlight.
27 * @gpio_enable:GPIO number which control EN pin
28 * @enable: Enable mask for current sink channel 1, 2, 3, 4, 5 and 6.
29 * @ignore_pwm: true if DPWMI should be ignored.
30 * @dpwm_mode: true is DPWM dimming mode, otherwise Analog dimming mode.
31 * @phase_shift:true is phase shift mode.
32 * @short_detecion_threshold: It should be one of 4, 5, 6 and 7V.
33 * @boost_current_limit: It should be one of 2300, 2750mA.
34 */
35struct sky81452_bl_platform_data {
36 const char *name;
37 int gpio_enable;
38 unsigned int enable;
39 bool ignore_pwm;
40 bool dpwm_mode;
41 bool phase_shift;
42 unsigned int short_detection_threshold;
43 unsigned int boost_current_limit;
44};
45
46#endif
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 29202610dd0d..95d31d6291ac 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -19,7 +19,6 @@
19#include <sound/tlv.h> 19#include <sound/tlv.h>
20 20
21#include <linux/mfd/arizona/core.h> 21#include <linux/mfd/arizona/core.h>
22#include <linux/mfd/arizona/gpio.h>
23#include <linux/mfd/arizona/registers.h> 22#include <linux/mfd/arizona/registers.h>
24 23
25#include "arizona.h" 24#include "arizona.h"
@@ -281,6 +280,7 @@ int arizona_init_gpio(struct snd_soc_codec *codec)
281 280
282 switch (arizona->type) { 281 switch (arizona->type) {
283 case WM5110: 282 case WM5110:
283 case WM8280:
284 snd_soc_dapm_disable_pin(&codec->dapm, "DRC2 Signal Activity"); 284 snd_soc_dapm_disable_pin(&codec->dapm, "DRC2 Signal Activity");
285 break; 285 break;
286 default: 286 default:
@@ -1729,6 +1729,7 @@ static int arizona_calc_fratio(struct arizona_fll *fll,
1729 1729
1730 switch (fll->arizona->type) { 1730 switch (fll->arizona->type) {
1731 case WM5110: 1731 case WM5110:
1732 case WM8280:
1732 if (fll->arizona->rev < 3 || sync) 1733 if (fll->arizona->rev < 3 || sync)
1733 return init_ratio; 1734 return init_ratio;
1734 break; 1735 break;