public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi
@ 2014-10-04 17:29 Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 01/23] dm: sunxi: dts: Add sun7i device tree files Simon Glass
                   ` (23 more replies)
  0 siblings, 24 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

This series adds driver model support for serial and GPIO for sunxi. Since
I only have a sun7i board to test with, I have added a new config for the
pcDuino3, which uses device tree and driver model. This should make it
fairly easy to enable for the other boards at some point.

Now that we have about 5 GPIO drivers it is clear that the request()/free()
logic should be in the uclass rather than the driver. So far drivers don't
have to do anything in those methods except adjust pin configuration.
Patches are included to make this change, including removing the redundant
code in the various GPIO drivers. The sunxi driver works the same way.

So far at least GPIO drivers don't tend to have anything special to report
for the 'gpio status' command. Partly this is because we only support a
simple concept of GPIOs so far (no drive strength, function selection,
etc.) but even if this were to be supported it would be better to handle
it generically where possible. So the get_state() call can be replaced with
a generic one in the uclass. This can be implemented with the existing
uclass interface: get_function() to find out if the pin is set as an input,
output or not a GPIO, and get_value() to find its value.

As a result, it is safe to remove the get_state() method, and this series
does that also.

This series is available at u-boot-dm/sunix-working.


Simon Glass (23):
  dm: sunxi: dts: Add sun7i device tree files
  dm: sunxi: Add a new config for an FDT-based pcDuino3
  dm: core: Add support for simple-bus
  dm: sunxi: Add pinmux functions which take a bank parameter
  dm: sunxi: Make sure that GPIOs are requested
  dm: sunxi: Modify the GPIO driver to support driver model
  dm: sunxi: Add support for serial using driver model
  dm: gpio: Implement GPIO reservation in the uclass
  dm: gpio: Add gpio_get_function() and friends
  dm: Move the function for getting GPIO status into the uclass
  dm: gpio: sandbox: Implement the get_function() method
  dm: gpio: sandbox: Implement the remove() method
  dm: gpio: sandbox: Drop request()/free() in the driver
  test: dm: Update GPIO tests for new gpio_request() method
  dm: gpio: Add gpio_requestf() helper for printf() strings
  test: dm: Support memory leak checking as a core feature
  test: dm: Add additional GPIO tests
  dm: gpio: tegra: Drop request()/free() in the driver
  dm: gpio: omap3: Drop request()/free() in the driver
  dm: gpio: rpi_b: Drop request()/free() in the driver
  dm: gpio: exynos: Drop request()/free() in the driver
  dm: gpio: imx: Drop request()/free() in the driver
  dm: gpio: Remove unused get_state() uclass method

 Makefile                                  |   3 +-
 arch/arm/cpu/armv7/sunxi/pinmux.c         |  32 +-
 arch/arm/dts/Makefile                     |   1 +
 arch/arm/dts/sun7i-a20-pcduino3.dts       | 177 ++++++
 arch/arm/dts/sun7i-a20.dtsi               | 988 ++++++++++++++++++++++++++++++
 arch/arm/dts/sunxi-common-regulators.dtsi |  89 +++
 arch/arm/include/asm/arch-sunxi/gpio.h    |   4 +-
 board/sunxi/MAINTAINERS                   |   1 +
 board/sunxi/ahci.c                        |   1 +
 common/cmd_gpio.c                         |  57 +-
 configs/Linksprite_pcDuino3_fdt_defconfig |   8 +
 doc/driver-model/README.txt               |  29 +-
 drivers/core/Makefile                     |   1 +
 drivers/core/simple-bus.c                 |  33 +
 drivers/gpio/bcm2835_gpio.c               |  89 ---
 drivers/gpio/gpio-uclass.c                | 199 +++++-
 drivers/gpio/mxc_gpio.c                   | 116 ----
 drivers/gpio/omap_gpio.c                  | 116 +---
 drivers/gpio/s5p_gpio.c                   | 101 ---
 drivers/gpio/sandbox.c                    |  93 +--
 drivers/gpio/sunxi_gpio.c                 | 170 +++++
 drivers/gpio/tegra_gpio.c                 | 110 ----
 drivers/serial/Makefile                   |   1 +
 drivers/serial/serial_dw.c                |  39 ++
 include/asm-generic/gpio.h                |  70 ++-
 include/configs/sun7i.h                   |   8 +
 include/configs/sunxi-common.h            |  12 +-
 include/dm/test.h                         |  23 +
 include/dm/uclass-id.h                    |   1 +
 include/dt-bindings/input/input.h         | 525 ++++++++++++++++
 test/dm/core.c                            |  46 +-
 test/dm/gpio.c                            | 111 +++-
 test/dm/test-main.c                       |   2 +
 33 files changed, 2534 insertions(+), 722 deletions(-)
 create mode 100644 arch/arm/dts/sun7i-a20-pcduino3.dts
 create mode 100644 arch/arm/dts/sun7i-a20.dtsi
 create mode 100644 arch/arm/dts/sunxi-common-regulators.dtsi
 create mode 100644 configs/Linksprite_pcDuino3_fdt_defconfig
 create mode 100644 drivers/core/simple-bus.c
 create mode 100644 drivers/serial/serial_dw.c
 create mode 100644 include/dt-bindings/input/input.h

-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 01/23] dm: sunxi: dts: Add sun7i device tree files
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 02/23] dm: sunxi: Add a new config for an FDT-based pcDuino3 Simon Glass
                   ` (22 subsequent siblings)
  23 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

These are from Linux 3.17-rc7 (commit fe82dcec). U-Boot only uses a small
portion of these, but we may as well have something to look forward to.

The total compiled size is about 25KB.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/arm/dts/sun7i-a20-pcduino3.dts       | 173 ++++++
 arch/arm/dts/sun7i-a20.dtsi               | 988 ++++++++++++++++++++++++++++++
 arch/arm/dts/sunxi-common-regulators.dtsi |  89 +++
 include/dt-bindings/input/input.h         | 525 ++++++++++++++++
 4 files changed, 1775 insertions(+)
 create mode 100644 arch/arm/dts/sun7i-a20-pcduino3.dts
 create mode 100644 arch/arm/dts/sun7i-a20.dtsi
 create mode 100644 arch/arm/dts/sunxi-common-regulators.dtsi
 create mode 100644 include/dt-bindings/input/input.h

diff --git a/arch/arm/dts/sun7i-a20-pcduino3.dts b/arch/arm/dts/sun7i-a20-pcduino3.dts
new file mode 100644
index 0000000..046dfc0
--- /dev/null
+++ b/arch/arm/dts/sun7i-a20-pcduino3.dts
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2014 Zoltan HERPAI
+ * Zoltan HERPAI <wigyori@uid0.hu>
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ "sun7i-a20.dtsi"
+/include/ "sunxi-common-regulators.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "LinkSprite pcDuino3";
+	compatible = "linksprite,pcduino3", "allwinner,sun7i-a20";
+
+	soc at 01c00000 {
+		mmc0: mmc at 01c0f000 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;
+			vmmc-supply = <&reg_vcc3v3>;
+			bus-width = <4>;
+			cd-gpios = <&pio 7 1 0>; /* PH1 */
+			cd-inverted;
+			status = "okay";
+		};
+
+		usbphy: phy at 01c13400 {
+			usb1_vbus-supply = <&reg_usb1_vbus>;
+			usb2_vbus-supply = <&reg_usb2_vbus>;
+			status = "okay";
+		};
+
+		ehci0: usb at 01c14000 {
+			status = "okay";
+		};
+
+		ohci0: usb at 01c14400 {
+			status = "okay";
+		};
+
+		ahci: sata at 01c18000 {
+			target-supply = <&reg_ahci_5v>;
+			status = "okay";
+		};
+
+		ehci1: usb at 01c1c000 {
+			status = "okay";
+		};
+
+		ohci1: usb at 01c1c400 {
+			status = "okay";
+		};
+
+		pinctrl at 01c20800 {
+			ahci_pwr_pin_a: ahci_pwr_pin at 0 {
+				allwinner,pins = "PH2";
+			};
+
+			led_pins_pcduino3: led_pins at 0 {
+				allwinner,pins = "PH15", "PH16";
+				allwinner,function = "gpio_out";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			key_pins_pcduino3: key_pins at 0 {
+				allwinner,pins = "PH17", "PH18", "PH19";
+				allwinner,function = "gpio_in";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+		};
+
+		ir0: ir at 01c21800 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&ir0_pins_a>;
+			status = "okay";
+		};
+
+		uart0: serial at 01c28000 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&uart0_pins_a>;
+			status = "okay";
+		};
+
+		i2c0: i2c at 01c2ac00 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&i2c0_pins_a>;
+			status = "okay";
+
+			axp209: pmic at 34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupt-parent = <&nmi_intc>;
+				interrupts = <0 8>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+			};
+		};
+
+		gmac: ethernet at 01c50000 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&gmac_pins_mii_a>;
+			phy = <&phy1>;
+			phy-mode = "mii";
+			status = "okay";
+
+			phy1: ethernet-phy at 1 {
+				reg = <1>;
+			};
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&led_pins_pcduino3>;
+
+		tx {
+			label = "pcduino3:green:tx";
+			gpios = <&pio 7 15 GPIO_ACTIVE_LOW>;
+		};
+
+		rx {
+			label = "pcduino3:green:rx";
+			gpios = <&pio 7 16 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	gpio_keys {
+		compatible = "gpio-keys";
+		pinctrl-names = "default";
+		pinctrl-0 = <&key_pins_pcduino3>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		button at 0 {
+			label = "Key Back";
+			linux,code = <KEY_BACK>;
+			gpios = <&pio 7 17 GPIO_ACTIVE_LOW>;
+		};
+		button at 1 {
+			label = "Key Home";
+			linux,code = <KEY_HOME>;
+			gpios = <&pio 7 18 GPIO_ACTIVE_LOW>;
+		};
+		button at 2 {
+			label = "Key Menu";
+			linux,code = <KEY_MENU>;
+			gpios = <&pio 7 19 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	reg_usb1_vbus: usb1-vbus {
+		status = "okay";
+	};
+
+	reg_usb2_vbus: usb2-vbus {
+		status = "okay";
+	};
+
+	reg_ahci_5v: ahci-5v {
+		gpio = <&pio 7 2 0>;
+		status = "okay";
+	};
+};
diff --git a/arch/arm/dts/sun7i-a20.dtsi b/arch/arm/dts/sun7i-a20.dtsi
new file mode 100644
index 0000000..4011628
--- /dev/null
+++ b/arch/arm/dts/sun7i-a20.dtsi
@@ -0,0 +1,988 @@
+/*
+ * Copyright 2013 Maxime Ripard
+ *
+ * Maxime Ripard <maxime.ripard@free-electrons.com>
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+	interrupt-parent = <&gic>;
+
+	aliases {
+		ethernet0 = &gmac;
+		serial0 = &uart0;
+		serial1 = &uart1;
+		serial2 = &uart2;
+		serial3 = &uart3;
+		serial4 = &uart4;
+		serial5 = &uart5;
+		serial6 = &uart6;
+		serial7 = &uart7;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			compatible = "arm,cortex-a7";
+			device_type = "cpu";
+			reg = <0>;
+		};
+
+		cpu at 1 {
+			compatible = "arm,cortex-a7";
+			device_type = "cpu";
+			reg = <1>;
+		};
+	};
+
+	memory {
+		reg = <0x40000000 0x80000000>;
+	};
+
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupts = <1 13 0xf08>,
+			     <1 14 0xf08>,
+			     <1 11 0xf08>,
+			     <1 10 0xf08>;
+	};
+
+	pmu {
+		compatible = "arm,cortex-a7-pmu", "arm,cortex-a15-pmu";
+		interrupts = <0 120 4>,
+			     <0 121 4>;
+	};
+
+	clocks {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		osc24M: clk at 01c20050 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-osc-clk";
+			reg = <0x01c20050 0x4>;
+			clock-frequency = <24000000>;
+			clock-output-names = "osc24M";
+		};
+
+		osc32k: clk at 0 {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <32768>;
+			clock-output-names = "osc32k";
+		};
+
+		pll1: clk at 01c20000 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-pll1-clk";
+			reg = <0x01c20000 0x4>;
+			clocks = <&osc24M>;
+			clock-output-names = "pll1";
+		};
+
+		pll4: clk at 01c20018 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun7i-a20-pll4-clk";
+			reg = <0x01c20018 0x4>;
+			clocks = <&osc24M>;
+			clock-output-names = "pll4";
+		};
+
+		pll5: clk at 01c20020 {
+			#clock-cells = <1>;
+			compatible = "allwinner,sun4i-a10-pll5-clk";
+			reg = <0x01c20020 0x4>;
+			clocks = <&osc24M>;
+			clock-output-names = "pll5_ddr", "pll5_other";
+		};
+
+		pll6: clk at 01c20028 {
+			#clock-cells = <1>;
+			compatible = "allwinner,sun4i-a10-pll6-clk";
+			reg = <0x01c20028 0x4>;
+			clocks = <&osc24M>;
+			clock-output-names = "pll6_sata", "pll6_other", "pll6";
+		};
+
+		pll8: clk at 01c20040 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun7i-a20-pll4-clk";
+			reg = <0x01c20040 0x4>;
+			clocks = <&osc24M>;
+			clock-output-names = "pll8";
+		};
+
+		cpu: cpu at 01c20054 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-cpu-clk";
+			reg = <0x01c20054 0x4>;
+			clocks = <&osc32k>, <&osc24M>, <&pll1>, <&pll6 1>;
+			clock-output-names = "cpu";
+		};
+
+		axi: axi at 01c20054 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-axi-clk";
+			reg = <0x01c20054 0x4>;
+			clocks = <&cpu>;
+			clock-output-names = "axi";
+		};
+
+		ahb: ahb at 01c20054 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-ahb-clk";
+			reg = <0x01c20054 0x4>;
+			clocks = <&axi>;
+			clock-output-names = "ahb";
+		};
+
+		ahb_gates: clk at 01c20060 {
+			#clock-cells = <1>;
+			compatible = "allwinner,sun7i-a20-ahb-gates-clk";
+			reg = <0x01c20060 0x8>;
+			clocks = <&ahb>;
+			clock-output-names = "ahb_usb0", "ahb_ehci0",
+				"ahb_ohci0", "ahb_ehci1", "ahb_ohci1",
+				"ahb_ss", "ahb_dma", "ahb_bist", "ahb_mmc0",
+				"ahb_mmc1", "ahb_mmc2", "ahb_mmc3", "ahb_ms",
+				"ahb_nand", "ahb_sdram", "ahb_ace",
+				"ahb_emac", "ahb_ts", "ahb_spi0", "ahb_spi1",
+				"ahb_spi2", "ahb_spi3", "ahb_sata",
+				"ahb_hstimer", "ahb_ve", "ahb_tvd", "ahb_tve0",
+				"ahb_tve1", "ahb_lcd0", "ahb_lcd1", "ahb_csi0",
+				"ahb_csi1", "ahb_hdmi1", "ahb_hdmi0",
+				"ahb_de_be0", "ahb_de_be1", "ahb_de_fe0",
+				"ahb_de_fe1", "ahb_gmac", "ahb_mp",
+				"ahb_mali";
+		};
+
+		apb0: apb0 at 01c20054 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-apb0-clk";
+			reg = <0x01c20054 0x4>;
+			clocks = <&ahb>;
+			clock-output-names = "apb0";
+		};
+
+		apb0_gates: clk at 01c20068 {
+			#clock-cells = <1>;
+			compatible = "allwinner,sun7i-a20-apb0-gates-clk";
+			reg = <0x01c20068 0x4>;
+			clocks = <&apb0>;
+			clock-output-names = "apb0_codec", "apb0_spdif",
+				"apb0_ac97", "apb0_iis0", "apb0_iis1",
+				"apb0_pio", "apb0_ir0", "apb0_ir1",
+				"apb0_iis2", "apb0_keypad";
+		};
+
+		apb1_mux: apb1_mux at 01c20058 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-apb1-mux-clk";
+			reg = <0x01c20058 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
+			clock-output-names = "apb1_mux";
+		};
+
+		apb1: apb1 at 01c20058 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-apb1-clk";
+			reg = <0x01c20058 0x4>;
+			clocks = <&apb1_mux>;
+			clock-output-names = "apb1";
+		};
+
+		apb1_gates: clk at 01c2006c {
+			#clock-cells = <1>;
+			compatible = "allwinner,sun7i-a20-apb1-gates-clk";
+			reg = <0x01c2006c 0x4>;
+			clocks = <&apb1>;
+			clock-output-names = "apb1_i2c0", "apb1_i2c1",
+				"apb1_i2c2", "apb1_i2c3", "apb1_can",
+				"apb1_scr", "apb1_ps20", "apb1_ps21",
+				"apb1_i2c4", "apb1_uart0", "apb1_uart1",
+				"apb1_uart2", "apb1_uart3", "apb1_uart4",
+				"apb1_uart5", "apb1_uart6", "apb1_uart7";
+		};
+
+		nand_clk: clk at 01c20080 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c20080 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "nand";
+		};
+
+		ms_clk: clk at 01c20084 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c20084 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "ms";
+		};
+
+		mmc0_clk: clk at 01c20088 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c20088 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "mmc0";
+		};
+
+		mmc1_clk: clk at 01c2008c {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c2008c 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "mmc1";
+		};
+
+		mmc2_clk: clk at 01c20090 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c20090 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "mmc2";
+		};
+
+		mmc3_clk: clk at 01c20094 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c20094 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "mmc3";
+		};
+
+		ts_clk: clk at 01c20098 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c20098 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "ts";
+		};
+
+		ss_clk: clk at 01c2009c {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c2009c 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "ss";
+		};
+
+		spi0_clk: clk at 01c200a0 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c200a0 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "spi0";
+		};
+
+		spi1_clk: clk at 01c200a4 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c200a4 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "spi1";
+		};
+
+		spi2_clk: clk at 01c200a8 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c200a8 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "spi2";
+		};
+
+		pata_clk: clk at 01c200ac {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c200ac 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "pata";
+		};
+
+		ir0_clk: clk at 01c200b0 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c200b0 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "ir0";
+		};
+
+		ir1_clk: clk at 01c200b4 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c200b4 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "ir1";
+		};
+
+		usb_clk: clk at 01c200cc {
+			#clock-cells = <1>;
+		        #reset-cells = <1>;
+			compatible = "allwinner,sun4i-a10-usb-clk";
+			reg = <0x01c200cc 0x4>;
+			clocks = <&pll6 1>;
+			clock-output-names = "usb_ohci0", "usb_ohci1", "usb_phy";
+		};
+
+		spi3_clk: clk at 01c200d4 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c200d4 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+			clock-output-names = "spi3";
+		};
+
+		mbus_clk: clk at 01c2015c {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod0-clk";
+			reg = <0x01c2015c 0x4>;
+			clocks = <&osc24M>, <&pll6 2>, <&pll5 1>;
+			clock-output-names = "mbus";
+		};
+
+		/*
+		 * The following two are dummy clocks, placeholders used in the gmac_tx
+		 * clock. The gmac driver will choose one parent depending on the PHY
+		 * interface mode, using clk_set_rate auto-reparenting.
+		 * The actual TX clock rate is not controlled by the gmac_tx clock.
+		 */
+		mii_phy_tx_clk: clk at 2 {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <25000000>;
+			clock-output-names = "mii_phy_tx";
+		};
+
+		gmac_int_tx_clk: clk at 3 {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <125000000>;
+			clock-output-names = "gmac_int_tx";
+		};
+
+		gmac_tx_clk: clk at 01c20164 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun7i-a20-gmac-clk";
+			reg = <0x01c20164 0x4>;
+			clocks = <&mii_phy_tx_clk>, <&gmac_int_tx_clk>;
+			clock-output-names = "gmac_tx";
+		};
+
+		/*
+		 * Dummy clock used by output clocks
+		 */
+		osc24M_32k: clk at 1 {
+			#clock-cells = <0>;
+			compatible = "fixed-factor-clock";
+			clock-div = <750>;
+			clock-mult = <1>;
+			clocks = <&osc24M>;
+			clock-output-names = "osc24M_32k";
+		};
+
+		clk_out_a: clk at 01c201f0 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun7i-a20-out-clk";
+			reg = <0x01c201f0 0x4>;
+			clocks = <&osc24M_32k>, <&osc32k>, <&osc24M>;
+			clock-output-names = "clk_out_a";
+		};
+
+		clk_out_b: clk at 01c201f4 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun7i-a20-out-clk";
+			reg = <0x01c201f4 0x4>;
+			clocks = <&osc24M_32k>, <&osc32k>, <&osc24M>;
+			clock-output-names = "clk_out_b";
+		};
+	};
+
+	soc at 01c00000 {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		nmi_intc: interrupt-controller at 01c00030 {
+			compatible = "allwinner,sun7i-a20-sc-nmi";
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			reg = <0x01c00030 0x0c>;
+			interrupts = <0 0 4>;
+		};
+
+		spi0: spi at 01c05000 {
+			compatible = "allwinner,sun4i-a10-spi";
+			reg = <0x01c05000 0x1000>;
+			interrupts = <0 10 4>;
+			clocks = <&ahb_gates 20>, <&spi0_clk>;
+			clock-names = "ahb", "mod";
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		spi1: spi at 01c06000 {
+			compatible = "allwinner,sun4i-a10-spi";
+			reg = <0x01c06000 0x1000>;
+			interrupts = <0 11 4>;
+			clocks = <&ahb_gates 21>, <&spi1_clk>;
+			clock-names = "ahb", "mod";
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		emac: ethernet at 01c0b000 {
+			compatible = "allwinner,sun4i-a10-emac";
+			reg = <0x01c0b000 0x1000>;
+			interrupts = <0 55 4>;
+			clocks = <&ahb_gates 17>;
+			status = "disabled";
+		};
+
+		mdio at 01c0b080 {
+			compatible = "allwinner,sun4i-a10-mdio";
+			reg = <0x01c0b080 0x14>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		mmc0: mmc at 01c0f000 {
+			compatible = "allwinner,sun5i-a13-mmc";
+			reg = <0x01c0f000 0x1000>;
+			clocks = <&ahb_gates 8>, <&mmc0_clk>;
+			clock-names = "ahb", "mmc";
+			interrupts = <0 32 4>;
+			status = "disabled";
+		};
+
+		mmc1: mmc at 01c10000 {
+			compatible = "allwinner,sun5i-a13-mmc";
+			reg = <0x01c10000 0x1000>;
+			clocks = <&ahb_gates 9>, <&mmc1_clk>;
+			clock-names = "ahb", "mmc";
+			interrupts = <0 33 4>;
+			status = "disabled";
+		};
+
+		mmc2: mmc at 01c11000 {
+			compatible = "allwinner,sun5i-a13-mmc";
+			reg = <0x01c11000 0x1000>;
+			clocks = <&ahb_gates 10>, <&mmc2_clk>;
+			clock-names = "ahb", "mmc";
+			interrupts = <0 34 4>;
+			status = "disabled";
+		};
+
+		mmc3: mmc at 01c12000 {
+			compatible = "allwinner,sun5i-a13-mmc";
+			reg = <0x01c12000 0x1000>;
+			clocks = <&ahb_gates 11>, <&mmc3_clk>;
+			clock-names = "ahb", "mmc";
+			interrupts = <0 35 4>;
+			status = "disabled";
+		};
+
+		usbphy: phy at 01c13400 {
+			#phy-cells = <1>;
+			compatible = "allwinner,sun7i-a20-usb-phy";
+			reg = <0x01c13400 0x10 0x01c14800 0x4 0x01c1c800 0x4>;
+			reg-names = "phy_ctrl", "pmu1", "pmu2";
+			clocks = <&usb_clk 8>;
+			clock-names = "usb_phy";
+			resets = <&usb_clk 1>, <&usb_clk 2>;
+			reset-names = "usb1_reset", "usb2_reset";
+			status = "disabled";
+		};
+
+		ehci0: usb at 01c14000 {
+			compatible = "allwinner,sun7i-a20-ehci", "generic-ehci";
+			reg = <0x01c14000 0x100>;
+			interrupts = <0 39 4>;
+			clocks = <&ahb_gates 1>;
+			phys = <&usbphy 1>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ohci0: usb at 01c14400 {
+			compatible = "allwinner,sun7i-a20-ohci", "generic-ohci";
+			reg = <0x01c14400 0x100>;
+			interrupts = <0 64 4>;
+			clocks = <&usb_clk 6>, <&ahb_gates 2>;
+			phys = <&usbphy 1>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		spi2: spi at 01c17000 {
+			compatible = "allwinner,sun4i-a10-spi";
+			reg = <0x01c17000 0x1000>;
+			interrupts = <0 12 4>;
+			clocks = <&ahb_gates 22>, <&spi2_clk>;
+			clock-names = "ahb", "mod";
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		ahci: sata at 01c18000 {
+			compatible = "allwinner,sun4i-a10-ahci";
+			reg = <0x01c18000 0x1000>;
+			interrupts = <0 56 4>;
+			clocks = <&pll6 0>, <&ahb_gates 25>;
+			status = "disabled";
+		};
+
+		ehci1: usb at 01c1c000 {
+			compatible = "allwinner,sun7i-a20-ehci", "generic-ehci";
+			reg = <0x01c1c000 0x100>;
+			interrupts = <0 40 4>;
+			clocks = <&ahb_gates 3>;
+			phys = <&usbphy 2>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ohci1: usb at 01c1c400 {
+			compatible = "allwinner,sun7i-a20-ohci", "generic-ohci";
+			reg = <0x01c1c400 0x100>;
+			interrupts = <0 65 4>;
+			clocks = <&usb_clk 7>, <&ahb_gates 4>;
+			phys = <&usbphy 2>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		spi3: spi at 01c1f000 {
+			compatible = "allwinner,sun4i-a10-spi";
+			reg = <0x01c1f000 0x1000>;
+			interrupts = <0 50 4>;
+			clocks = <&ahb_gates 23>, <&spi3_clk>;
+			clock-names = "ahb", "mod";
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		pio: pinctrl at 01c20800 {
+			compatible = "allwinner,sun7i-a20-pinctrl";
+			reg = <0x01c20800 0x400>;
+			interrupts = <0 28 4>;
+			clocks = <&apb0_gates 5>;
+			gpio-controller;
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			#size-cells = <0>;
+			#gpio-cells = <3>;
+
+			pwm0_pins_a: pwm0 at 0 {
+				allwinner,pins = "PB2";
+				allwinner,function = "pwm";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			pwm1_pins_a: pwm1 at 0 {
+				allwinner,pins = "PI3";
+				allwinner,function = "pwm";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			uart0_pins_a: uart0 at 0 {
+				allwinner,pins = "PB22", "PB23";
+				allwinner,function = "uart0";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			uart2_pins_a: uart2 at 0 {
+				allwinner,pins = "PI16", "PI17", "PI18", "PI19";
+				allwinner,function = "uart2";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			uart6_pins_a: uart6 at 0 {
+				allwinner,pins = "PI12", "PI13";
+				allwinner,function = "uart6";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			uart7_pins_a: uart7 at 0 {
+				allwinner,pins = "PI20", "PI21";
+				allwinner,function = "uart7";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			i2c0_pins_a: i2c0 at 0 {
+				allwinner,pins = "PB0", "PB1";
+				allwinner,function = "i2c0";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			i2c1_pins_a: i2c1 at 0 {
+				allwinner,pins = "PB18", "PB19";
+				allwinner,function = "i2c1";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			i2c2_pins_a: i2c2 at 0 {
+				allwinner,pins = "PB20", "PB21";
+				allwinner,function = "i2c2";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			emac_pins_a: emac0 at 0 {
+				allwinner,pins = "PA0", "PA1", "PA2",
+						"PA3", "PA4", "PA5", "PA6",
+						"PA7", "PA8", "PA9", "PA10",
+						"PA11", "PA12", "PA13", "PA14",
+						"PA15", "PA16";
+				allwinner,function = "emac";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			clk_out_a_pins_a: clk_out_a at 0 {
+				allwinner,pins = "PI12";
+				allwinner,function = "clk_out_a";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			clk_out_b_pins_a: clk_out_b at 0 {
+				allwinner,pins = "PI13";
+				allwinner,function = "clk_out_b";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			gmac_pins_mii_a: gmac_mii at 0 {
+				allwinner,pins = "PA0", "PA1", "PA2",
+						"PA3", "PA4", "PA5", "PA6",
+						"PA7", "PA8", "PA9", "PA10",
+						"PA11", "PA12", "PA13", "PA14",
+						"PA15", "PA16";
+				allwinner,function = "gmac";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			gmac_pins_rgmii_a: gmac_rgmii at 0 {
+				allwinner,pins = "PA0", "PA1", "PA2",
+						"PA3", "PA4", "PA5", "PA6",
+						"PA7", "PA8", "PA10",
+						"PA11", "PA12", "PA13",
+						"PA15", "PA16";
+				allwinner,function = "gmac";
+				/*
+				 * data lines in RGMII mode use DDR mode
+				 * and need a higher signal drive strength
+				 */
+				allwinner,drive = <3>;
+				allwinner,pull = <0>;
+			};
+
+			spi1_pins_a: spi1 at 0 {
+				allwinner,pins = "PI16", "PI17", "PI18", "PI19";
+				allwinner,function = "spi1";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			spi2_pins_a: spi2 at 0 {
+				allwinner,pins = "PC19", "PC20", "PC21", "PC22";
+				allwinner,function = "spi2";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			mmc0_pins_a: mmc0 at 0 {
+				allwinner,pins = "PF0","PF1","PF2","PF3","PF4","PF5";
+				allwinner,function = "mmc0";
+				allwinner,drive = <2>;
+				allwinner,pull = <0>;
+			};
+
+			mmc0_cd_pin_reference_design: mmc0_cd_pin at 0 {
+				allwinner,pins = "PH1";
+				allwinner,function = "gpio_in";
+				allwinner,drive = <0>;
+				allwinner,pull = <1>;
+			};
+
+			mmc3_pins_a: mmc3 at 0 {
+				allwinner,pins = "PI4","PI5","PI6","PI7","PI8","PI9";
+				allwinner,function = "mmc3";
+				allwinner,drive = <2>;
+				allwinner,pull = <0>;
+			};
+
+			ir0_pins_a: ir0 at 0 {
+				    allwinner,pins = "PB3","PB4";
+				    allwinner,function = "ir0";
+				    allwinner,drive = <0>;
+				    allwinner,pull = <0>;
+			};
+
+			ir1_pins_a: ir1 at 0 {
+				    allwinner,pins = "PB22","PB23";
+				    allwinner,function = "ir1";
+				    allwinner,drive = <0>;
+				    allwinner,pull = <0>;
+			};
+		};
+
+		timer at 01c20c00 {
+			compatible = "allwinner,sun4i-a10-timer";
+			reg = <0x01c20c00 0x90>;
+			interrupts = <0 22 4>,
+				     <0 23 4>,
+				     <0 24 4>,
+				     <0 25 4>,
+				     <0 67 4>,
+				     <0 68 4>;
+			clocks = <&osc24M>;
+		};
+
+		wdt: watchdog at 01c20c90 {
+			compatible = "allwinner,sun4i-a10-wdt";
+			reg = <0x01c20c90 0x10>;
+		};
+
+		rtc: rtc at 01c20d00 {
+			compatible = "allwinner,sun7i-a20-rtc";
+			reg = <0x01c20d00 0x20>;
+			interrupts = <0 24 4>;
+		};
+
+		pwm: pwm at 01c20e00 {
+			compatible = "allwinner,sun7i-a20-pwm";
+			reg = <0x01c20e00 0xc>;
+			clocks = <&osc24M>;
+			#pwm-cells = <3>;
+			status = "disabled";
+		};
+
+		ir0: ir at 01c21800 {
+			compatible = "allwinner,sun4i-a10-ir";
+			clocks = <&apb0_gates 6>, <&ir0_clk>;
+			clock-names = "apb", "ir";
+			interrupts = <0 5 4>;
+			reg = <0x01c21800 0x40>;
+			status = "disabled";
+		};
+
+		ir1: ir at 01c21c00 {
+			compatible = "allwinner,sun4i-a10-ir";
+			clocks = <&apb0_gates 7>, <&ir1_clk>;
+			clock-names = "apb", "ir";
+			interrupts = <0 6 4>;
+			reg = <0x01c21c00 0x40>;
+			status = "disabled";
+		};
+
+		sid: eeprom at 01c23800 {
+			compatible = "allwinner,sun7i-a20-sid";
+			reg = <0x01c23800 0x200>;
+		};
+
+		rtp: rtp at 01c25000 {
+			compatible = "allwinner,sun4i-a10-ts";
+			reg = <0x01c25000 0x100>;
+			interrupts = <0 29 4>;
+		};
+
+		uart0: serial at 01c28000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c28000 0x400>;
+			interrupts = <0 1 4>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&apb1_gates 16>;
+			status = "disabled";
+		};
+
+		uart1: serial at 01c28400 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c28400 0x400>;
+			interrupts = <0 2 4>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&apb1_gates 17>;
+			status = "disabled";
+		};
+
+		uart2: serial at 01c28800 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c28800 0x400>;
+			interrupts = <0 3 4>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&apb1_gates 18>;
+			status = "disabled";
+		};
+
+		uart3: serial at 01c28c00 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c28c00 0x400>;
+			interrupts = <0 4 4>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&apb1_gates 19>;
+			status = "disabled";
+		};
+
+		uart4: serial at 01c29000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c29000 0x400>;
+			interrupts = <0 17 4>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&apb1_gates 20>;
+			status = "disabled";
+		};
+
+		uart5: serial at 01c29400 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c29400 0x400>;
+			interrupts = <0 18 4>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&apb1_gates 21>;
+			status = "disabled";
+		};
+
+		uart6: serial at 01c29800 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c29800 0x400>;
+			interrupts = <0 19 4>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&apb1_gates 22>;
+			status = "disabled";
+		};
+
+		uart7: serial at 01c29c00 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c29c00 0x400>;
+			interrupts = <0 20 4>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&apb1_gates 23>;
+			status = "disabled";
+		};
+
+		i2c0: i2c at 01c2ac00 {
+			compatible = "allwinner,sun7i-a20-i2c", "allwinner,sun4i-a10-i2c";
+			reg = <0x01c2ac00 0x400>;
+			interrupts = <0 7 4>;
+			clocks = <&apb1_gates 0>;
+			clock-frequency = <100000>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		i2c1: i2c at 01c2b000 {
+			compatible = "allwinner,sun7i-a20-i2c", "allwinner,sun4i-a10-i2c";
+			reg = <0x01c2b000 0x400>;
+			interrupts = <0 8 4>;
+			clocks = <&apb1_gates 1>;
+			clock-frequency = <100000>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		i2c2: i2c at 01c2b400 {
+			compatible = "allwinner,sun7i-a20-i2c", "allwinner,sun4i-a10-i2c";
+			reg = <0x01c2b400 0x400>;
+			interrupts = <0 9 4>;
+			clocks = <&apb1_gates 2>;
+			clock-frequency = <100000>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		i2c3: i2c at 01c2b800 {
+			compatible = "allwinner,sun7i-a20-i2c", "allwinner,sun4i-a10-i2c";
+			reg = <0x01c2b800 0x400>;
+			interrupts = <0 88 4>;
+			clocks = <&apb1_gates 3>;
+			clock-frequency = <100000>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		i2c4: i2c at 01c2c000 {
+			compatible = "allwinner,sun7i-a20-i2c", "allwinner,sun4i-a10-i2c";
+			reg = <0x01c2c000 0x400>;
+			interrupts = <0 89 4>;
+			clocks = <&apb1_gates 15>;
+			clock-frequency = <100000>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		gmac: ethernet at 01c50000 {
+			compatible = "allwinner,sun7i-a20-gmac";
+			reg = <0x01c50000 0x10000>;
+			interrupts = <0 85 4>;
+			interrupt-names = "macirq";
+			clocks = <&ahb_gates 49>, <&gmac_tx_clk>;
+			clock-names = "stmmaceth", "allwinner_gmac_tx";
+			snps,pbl = <2>;
+			snps,fixed-burst;
+			snps,force_sf_dma_mode;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		hstimer at 01c60000 {
+			compatible = "allwinner,sun7i-a20-hstimer";
+			reg = <0x01c60000 0x1000>;
+			interrupts = <0 81 4>,
+				     <0 82 4>,
+				     <0 83 4>,
+				     <0 84 4>;
+			clocks = <&ahb_gates 28>;
+		};
+
+		gic: interrupt-controller at 01c81000 {
+			compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
+			reg = <0x01c81000 0x1000>,
+			      <0x01c82000 0x1000>,
+			      <0x01c84000 0x2000>,
+			      <0x01c86000 0x2000>;
+			interrupt-controller;
+			#interrupt-cells = <3>;
+			interrupts = <1 9 0xf04>;
+		};
+	};
+};
diff --git a/arch/arm/dts/sunxi-common-regulators.dtsi b/arch/arm/dts/sunxi-common-regulators.dtsi
new file mode 100644
index 0000000..3d021ef
--- /dev/null
+++ b/arch/arm/dts/sunxi-common-regulators.dtsi
@@ -0,0 +1,89 @@
+/*
+ * sunxi boards common regulator (ahci target power supply, usb-vbus) code
+ *
+ * Copyright 2014 - Hans de Goede <hdegoede@redhat.com>
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/ {
+	soc at 01c00000 {
+		pio: pinctrl at 01c20800 {
+			ahci_pwr_pin_a: ahci_pwr_pin at 0 {
+				allwinner,pins = "PB8";
+				allwinner,function = "gpio_out";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			usb1_vbus_pin_a: usb1_vbus_pin at 0 {
+				allwinner,pins = "PH6";
+				allwinner,function = "gpio_out";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+
+			usb2_vbus_pin_a: usb2_vbus_pin at 0 {
+				allwinner,pins = "PH3";
+				allwinner,function = "gpio_out";
+				allwinner,drive = <0>;
+				allwinner,pull = <0>;
+			};
+		};
+	};
+
+	reg_ahci_5v: ahci-5v {
+		compatible = "regulator-fixed";
+		pinctrl-names = "default";
+		pinctrl-0 = <&ahci_pwr_pin_a>;
+		regulator-name = "ahci-5v";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		enable-active-high;
+		gpio = <&pio 1 8 0>;
+		status = "disabled";
+	};
+
+	reg_usb1_vbus: usb1-vbus {
+		compatible = "regulator-fixed";
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb1_vbus_pin_a>;
+		regulator-name = "usb1-vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		enable-active-high;
+		gpio = <&pio 7 6 0>;
+		status = "disabled";
+	};
+
+	reg_usb2_vbus: usb2-vbus {
+		compatible = "regulator-fixed";
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb2_vbus_pin_a>;
+		regulator-name = "usb2-vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		enable-active-high;
+		gpio = <&pio 7 3 0>;
+		status = "disabled";
+	};
+
+	reg_vcc3v0: vcc3v0 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v0";
+		regulator-min-microvolt = <3000000>;
+		regulator-max-microvolt = <3000000>;
+	};
+
+	reg_vcc3v3: vcc3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
+};
diff --git a/include/dt-bindings/input/input.h b/include/dt-bindings/input/input.h
new file mode 100644
index 0000000..042e7b3
--- /dev/null
+++ b/include/dt-bindings/input/input.h
@@ -0,0 +1,525 @@
+/*
+ * This header provides constants for most input bindings.
+ *
+ * Most input bindings include key code, matrix key code format.
+ * In most cases, key code and matrix key code format uses
+ * the standard values/macro defined in this header.
+ */
+
+#ifndef _DT_BINDINGS_INPUT_INPUT_H
+#define _DT_BINDINGS_INPUT_INPUT_H
+
+#define KEY_RESERVED		0
+#define KEY_ESC			1
+#define KEY_1			2
+#define KEY_2			3
+#define KEY_3			4
+#define KEY_4			5
+#define KEY_5			6
+#define KEY_6			7
+#define KEY_7			8
+#define KEY_8			9
+#define KEY_9			10
+#define KEY_0			11
+#define KEY_MINUS		12
+#define KEY_EQUAL		13
+#define KEY_BACKSPACE		14
+#define KEY_TAB			15
+#define KEY_Q			16
+#define KEY_W			17
+#define KEY_E			18
+#define KEY_R			19
+#define KEY_T			20
+#define KEY_Y			21
+#define KEY_U			22
+#define KEY_I			23
+#define KEY_O			24
+#define KEY_P			25
+#define KEY_LEFTBRACE		26
+#define KEY_RIGHTBRACE		27
+#define KEY_ENTER		28
+#define KEY_LEFTCTRL		29
+#define KEY_A			30
+#define KEY_S			31
+#define KEY_D			32
+#define KEY_F			33
+#define KEY_G			34
+#define KEY_H			35
+#define KEY_J			36
+#define KEY_K			37
+#define KEY_L			38
+#define KEY_SEMICOLON		39
+#define KEY_APOSTROPHE		40
+#define KEY_GRAVE		41
+#define KEY_LEFTSHIFT		42
+#define KEY_BACKSLASH		43
+#define KEY_Z			44
+#define KEY_X			45
+#define KEY_C			46
+#define KEY_V			47
+#define KEY_B			48
+#define KEY_N			49
+#define KEY_M			50
+#define KEY_COMMA		51
+#define KEY_DOT			52
+#define KEY_SLASH		53
+#define KEY_RIGHTSHIFT		54
+#define KEY_KPASTERISK		55
+#define KEY_LEFTALT		56
+#define KEY_SPACE		57
+#define KEY_CAPSLOCK		58
+#define KEY_F1			59
+#define KEY_F2			60
+#define KEY_F3			61
+#define KEY_F4			62
+#define KEY_F5			63
+#define KEY_F6			64
+#define KEY_F7			65
+#define KEY_F8			66
+#define KEY_F9			67
+#define KEY_F10			68
+#define KEY_NUMLOCK		69
+#define KEY_SCROLLLOCK		70
+#define KEY_KP7			71
+#define KEY_KP8			72
+#define KEY_KP9			73
+#define KEY_KPMINUS		74
+#define KEY_KP4			75
+#define KEY_KP5			76
+#define KEY_KP6			77
+#define KEY_KPPLUS		78
+#define KEY_KP1			79
+#define KEY_KP2			80
+#define KEY_KP3			81
+#define KEY_KP0			82
+#define KEY_KPDOT		83
+
+#define KEY_ZENKAKUHANKAKU	85
+#define KEY_102ND		86
+#define KEY_F11			87
+#define KEY_F12			88
+#define KEY_RO			89
+#define KEY_KATAKANA		90
+#define KEY_HIRAGANA		91
+#define KEY_HENKAN		92
+#define KEY_KATAKANAHIRAGANA	93
+#define KEY_MUHENKAN		94
+#define KEY_KPJPCOMMA		95
+#define KEY_KPENTER		96
+#define KEY_RIGHTCTRL		97
+#define KEY_KPSLASH		98
+#define KEY_SYSRQ		99
+#define KEY_RIGHTALT		100
+#define KEY_LINEFEED		101
+#define KEY_HOME		102
+#define KEY_UP			103
+#define KEY_PAGEUP		104
+#define KEY_LEFT		105
+#define KEY_RIGHT		106
+#define KEY_END			107
+#define KEY_DOWN		108
+#define KEY_PAGEDOWN		109
+#define KEY_INSERT		110
+#define KEY_DELETE		111
+#define KEY_MACRO		112
+#define KEY_MUTE		113
+#define KEY_VOLUMEDOWN		114
+#define KEY_VOLUMEUP		115
+#define KEY_POWER		116	/* SC System Power Down */
+#define KEY_KPEQUAL		117
+#define KEY_KPPLUSMINUS		118
+#define KEY_PAUSE		119
+#define KEY_SCALE		120	/* AL Compiz Scale (Expose) */
+
+#define KEY_KPCOMMA		121
+#define KEY_HANGEUL		122
+#define KEY_HANGUEL		KEY_HANGEUL
+#define KEY_HANJA		123
+#define KEY_YEN			124
+#define KEY_LEFTMETA		125
+#define KEY_RIGHTMETA		126
+#define KEY_COMPOSE		127
+
+#define KEY_STOP		128	/* AC Stop */
+#define KEY_AGAIN		129
+#define KEY_PROPS		130	/* AC Properties */
+#define KEY_UNDO		131	/* AC Undo */
+#define KEY_FRONT		132
+#define KEY_COPY		133	/* AC Copy */
+#define KEY_OPEN		134	/* AC Open */
+#define KEY_PASTE		135	/* AC Paste */
+#define KEY_FIND		136	/* AC Search */
+#define KEY_CUT			137	/* AC Cut */
+#define KEY_HELP		138	/* AL Integrated Help Center */
+#define KEY_MENU		139	/* Menu (show menu) */
+#define KEY_CALC		140	/* AL Calculator */
+#define KEY_SETUP		141
+#define KEY_SLEEP		142	/* SC System Sleep */
+#define KEY_WAKEUP		143	/* System Wake Up */
+#define KEY_FILE		144	/* AL Local Machine Browser */
+#define KEY_SENDFILE		145
+#define KEY_DELETEFILE		146
+#define KEY_XFER		147
+#define KEY_PROG1		148
+#define KEY_PROG2		149
+#define KEY_WWW			150	/* AL Internet Browser */
+#define KEY_MSDOS		151
+#define KEY_COFFEE		152	/* AL Terminal Lock/Screensaver */
+#define KEY_SCREENLOCK		KEY_COFFEE
+#define KEY_DIRECTION		153
+#define KEY_CYCLEWINDOWS	154
+#define KEY_MAIL		155
+#define KEY_BOOKMARKS		156	/* AC Bookmarks */
+#define KEY_COMPUTER		157
+#define KEY_BACK		158	/* AC Back */
+#define KEY_FORWARD		159	/* AC Forward */
+#define KEY_CLOSECD		160
+#define KEY_EJECTCD		161
+#define KEY_EJECTCLOSECD	162
+#define KEY_NEXTSONG		163
+#define KEY_PLAYPAUSE		164
+#define KEY_PREVIOUSSONG	165
+#define KEY_STOPCD		166
+#define KEY_RECORD		167
+#define KEY_REWIND		168
+#define KEY_PHONE		169	/* Media Select Telephone */
+#define KEY_ISO			170
+#define KEY_CONFIG		171	/* AL Consumer Control Configuration */
+#define KEY_HOMEPAGE		172	/* AC Home */
+#define KEY_REFRESH		173	/* AC Refresh */
+#define KEY_EXIT		174	/* AC Exit */
+#define KEY_MOVE		175
+#define KEY_EDIT		176
+#define KEY_SCROLLUP		177
+#define KEY_SCROLLDOWN		178
+#define KEY_KPLEFTPAREN		179
+#define KEY_KPRIGHTPAREN	180
+#define KEY_NEW			181	/* AC New */
+#define KEY_REDO		182	/* AC Redo/Repeat */
+
+#define KEY_F13			183
+#define KEY_F14			184
+#define KEY_F15			185
+#define KEY_F16			186
+#define KEY_F17			187
+#define KEY_F18			188
+#define KEY_F19			189
+#define KEY_F20			190
+#define KEY_F21			191
+#define KEY_F22			192
+#define KEY_F23			193
+#define KEY_F24			194
+
+#define KEY_PLAYCD		200
+#define KEY_PAUSECD		201
+#define KEY_PROG3		202
+#define KEY_PROG4		203
+#define KEY_DASHBOARD		204	/* AL Dashboard */
+#define KEY_SUSPEND		205
+#define KEY_CLOSE		206	/* AC Close */
+#define KEY_PLAY		207
+#define KEY_FASTFORWARD		208
+#define KEY_BASSBOOST		209
+#define KEY_PRINT		210	/* AC Print */
+#define KEY_HP			211
+#define KEY_CAMERA		212
+#define KEY_SOUND		213
+#define KEY_QUESTION		214
+#define KEY_EMAIL		215
+#define KEY_CHAT		216
+#define KEY_SEARCH		217
+#define KEY_CONNECT		218
+#define KEY_FINANCE		219	/* AL Checkbook/Finance */
+#define KEY_SPORT		220
+#define KEY_SHOP		221
+#define KEY_ALTERASE		222
+#define KEY_CANCEL		223	/* AC Cancel */
+#define KEY_BRIGHTNESSDOWN	224
+#define KEY_BRIGHTNESSUP	225
+#define KEY_MEDIA		226
+
+#define KEY_SWITCHVIDEOMODE	227	/* Cycle between available video
+					   outputs (Monitor/LCD/TV-out/etc) */
+#define KEY_KBDILLUMTOGGLE	228
+#define KEY_KBDILLUMDOWN	229
+#define KEY_KBDILLUMUP		230
+
+#define KEY_SEND		231	/* AC Send */
+#define KEY_REPLY		232	/* AC Reply */
+#define KEY_FORWARDMAIL		233	/* AC Forward Msg */
+#define KEY_SAVE		234	/* AC Save */
+#define KEY_DOCUMENTS		235
+
+#define KEY_BATTERY		236
+
+#define KEY_BLUETOOTH		237
+#define KEY_WLAN		238
+#define KEY_UWB			239
+
+#define KEY_UNKNOWN		240
+
+#define KEY_VIDEO_NEXT		241	/* drive next video source */
+#define KEY_VIDEO_PREV		242	/* drive previous video source */
+#define KEY_BRIGHTNESS_CYCLE	243	/* brightness up, after max is min */
+#define KEY_BRIGHTNESS_ZERO	244	/* brightness off, use ambient */
+#define KEY_DISPLAY_OFF		245	/* display device to off state */
+
+#define KEY_WIMAX		246
+#define KEY_RFKILL		247	/* Key that controls all radios */
+
+#define KEY_MICMUTE		248	/* Mute / unmute the microphone */
+
+/* Code 255 is reserved for special needs of AT keyboard driver */
+
+#define BTN_MISC		0x100
+#define BTN_0			0x100
+#define BTN_1			0x101
+#define BTN_2			0x102
+#define BTN_3			0x103
+#define BTN_4			0x104
+#define BTN_5			0x105
+#define BTN_6			0x106
+#define BTN_7			0x107
+#define BTN_8			0x108
+#define BTN_9			0x109
+
+#define BTN_MOUSE		0x110
+#define BTN_LEFT		0x110
+#define BTN_RIGHT		0x111
+#define BTN_MIDDLE		0x112
+#define BTN_SIDE		0x113
+#define BTN_EXTRA		0x114
+#define BTN_FORWARD		0x115
+#define BTN_BACK		0x116
+#define BTN_TASK		0x117
+
+#define BTN_JOYSTICK		0x120
+#define BTN_TRIGGER		0x120
+#define BTN_THUMB		0x121
+#define BTN_THUMB2		0x122
+#define BTN_TOP			0x123
+#define BTN_TOP2		0x124
+#define BTN_PINKIE		0x125
+#define BTN_BASE		0x126
+#define BTN_BASE2		0x127
+#define BTN_BASE3		0x128
+#define BTN_BASE4		0x129
+#define BTN_BASE5		0x12a
+#define BTN_BASE6		0x12b
+#define BTN_DEAD		0x12f
+
+#define BTN_GAMEPAD		0x130
+#define BTN_SOUTH		0x130
+#define BTN_A			BTN_SOUTH
+#define BTN_EAST		0x131
+#define BTN_B			BTN_EAST
+#define BTN_C			0x132
+#define BTN_NORTH		0x133
+#define BTN_X			BTN_NORTH
+#define BTN_WEST		0x134
+#define BTN_Y			BTN_WEST
+#define BTN_Z			0x135
+#define BTN_TL			0x136
+#define BTN_TR			0x137
+#define BTN_TL2			0x138
+#define BTN_TR2			0x139
+#define BTN_SELECT		0x13a
+#define BTN_START		0x13b
+#define BTN_MODE		0x13c
+#define BTN_THUMBL		0x13d
+#define BTN_THUMBR		0x13e
+
+#define BTN_DIGI		0x140
+#define BTN_TOOL_PEN		0x140
+#define BTN_TOOL_RUBBER		0x141
+#define BTN_TOOL_BRUSH		0x142
+#define BTN_TOOL_PENCIL		0x143
+#define BTN_TOOL_AIRBRUSH	0x144
+#define BTN_TOOL_FINGER		0x145
+#define BTN_TOOL_MOUSE		0x146
+#define BTN_TOOL_LENS		0x147
+#define BTN_TOOL_QUINTTAP	0x148	/* Five fingers on trackpad */
+#define BTN_TOUCH		0x14a
+#define BTN_STYLUS		0x14b
+#define BTN_STYLUS2		0x14c
+#define BTN_TOOL_DOUBLETAP	0x14d
+#define BTN_TOOL_TRIPLETAP	0x14e
+#define BTN_TOOL_QUADTAP	0x14f	/* Four fingers on trackpad */
+
+#define BTN_WHEEL		0x150
+#define BTN_GEAR_DOWN		0x150
+#define BTN_GEAR_UP		0x151
+
+#define KEY_OK			0x160
+#define KEY_SELECT		0x161
+#define KEY_GOTO		0x162
+#define KEY_CLEAR		0x163
+#define KEY_POWER2		0x164
+#define KEY_OPTION		0x165
+#define KEY_INFO		0x166	/* AL OEM Features/Tips/Tutorial */
+#define KEY_TIME		0x167
+#define KEY_VENDOR		0x168
+#define KEY_ARCHIVE		0x169
+#define KEY_PROGRAM		0x16a	/* Media Select Program Guide */
+#define KEY_CHANNEL		0x16b
+#define KEY_FAVORITES		0x16c
+#define KEY_EPG			0x16d
+#define KEY_PVR			0x16e	/* Media Select Home */
+#define KEY_MHP			0x16f
+#define KEY_LANGUAGE		0x170
+#define KEY_TITLE		0x171
+#define KEY_SUBTITLE		0x172
+#define KEY_ANGLE		0x173
+#define KEY_ZOOM		0x174
+#define KEY_MODE		0x175
+#define KEY_KEYBOARD		0x176
+#define KEY_SCREEN		0x177
+#define KEY_PC			0x178	/* Media Select Computer */
+#define KEY_TV			0x179	/* Media Select TV */
+#define KEY_TV2			0x17a	/* Media Select Cable */
+#define KEY_VCR			0x17b	/* Media Select VCR */
+#define KEY_VCR2		0x17c	/* VCR Plus */
+#define KEY_SAT			0x17d	/* Media Select Satellite */
+#define KEY_SAT2		0x17e
+#define KEY_CD			0x17f	/* Media Select CD */
+#define KEY_TAPE		0x180	/* Media Select Tape */
+#define KEY_RADIO		0x181
+#define KEY_TUNER		0x182	/* Media Select Tuner */
+#define KEY_PLAYER		0x183
+#define KEY_TEXT		0x184
+#define KEY_DVD			0x185	/* Media Select DVD */
+#define KEY_AUX			0x186
+#define KEY_MP3			0x187
+#define KEY_AUDIO		0x188	/* AL Audio Browser */
+#define KEY_VIDEO		0x189	/* AL Movie Browser */
+#define KEY_DIRECTORY		0x18a
+#define KEY_LIST		0x18b
+#define KEY_MEMO		0x18c	/* Media Select Messages */
+#define KEY_CALENDAR		0x18d
+#define KEY_RED			0x18e
+#define KEY_GREEN		0x18f
+#define KEY_YELLOW		0x190
+#define KEY_BLUE		0x191
+#define KEY_CHANNELUP		0x192	/* Channel Increment */
+#define KEY_CHANNELDOWN		0x193	/* Channel Decrement */
+#define KEY_FIRST		0x194
+#define KEY_LAST		0x195	/* Recall Last */
+#define KEY_AB			0x196
+#define KEY_NEXT		0x197
+#define KEY_RESTART		0x198
+#define KEY_SLOW		0x199
+#define KEY_SHUFFLE		0x19a
+#define KEY_BREAK		0x19b
+#define KEY_PREVIOUS		0x19c
+#define KEY_DIGITS		0x19d
+#define KEY_TEEN		0x19e
+#define KEY_TWEN		0x19f
+#define KEY_VIDEOPHONE		0x1a0	/* Media Select Video Phone */
+#define KEY_GAMES		0x1a1	/* Media Select Games */
+#define KEY_ZOOMIN		0x1a2	/* AC Zoom In */
+#define KEY_ZOOMOUT		0x1a3	/* AC Zoom Out */
+#define KEY_ZOOMRESET		0x1a4	/* AC Zoom */
+#define KEY_WORDPROCESSOR	0x1a5	/* AL Word Processor */
+#define KEY_EDITOR		0x1a6	/* AL Text Editor */
+#define KEY_SPREADSHEET		0x1a7	/* AL Spreadsheet */
+#define KEY_GRAPHICSEDITOR	0x1a8	/* AL Graphics Editor */
+#define KEY_PRESENTATION	0x1a9	/* AL Presentation App */
+#define KEY_DATABASE		0x1aa	/* AL Database App */
+#define KEY_NEWS		0x1ab	/* AL Newsreader */
+#define KEY_VOICEMAIL		0x1ac	/* AL Voicemail */
+#define KEY_ADDRESSBOOK		0x1ad	/* AL Contacts/Address Book */
+#define KEY_MESSENGER		0x1ae	/* AL Instant Messaging */
+#define KEY_DISPLAYTOGGLE	0x1af	/* Turn display (LCD) on and off */
+#define KEY_SPELLCHECK		0x1b0   /* AL Spell Check */
+#define KEY_LOGOFF		0x1b1   /* AL Logoff */
+
+#define KEY_DOLLAR		0x1b2
+#define KEY_EURO		0x1b3
+
+#define KEY_FRAMEBACK		0x1b4	/* Consumer - transport controls */
+#define KEY_FRAMEFORWARD	0x1b5
+#define KEY_CONTEXT_MENU	0x1b6	/* GenDesc - system context menu */
+#define KEY_MEDIA_REPEAT	0x1b7	/* Consumer - transport control */
+#define KEY_10CHANNELSUP	0x1b8	/* 10 channels up (10+) */
+#define KEY_10CHANNELSDOWN	0x1b9	/* 10 channels down (10-) */
+#define KEY_IMAGES		0x1ba	/* AL Image Browser */
+
+#define KEY_DEL_EOL		0x1c0
+#define KEY_DEL_EOS		0x1c1
+#define KEY_INS_LINE		0x1c2
+#define KEY_DEL_LINE		0x1c3
+
+#define KEY_FN			0x1d0
+#define KEY_FN_ESC		0x1d1
+#define KEY_FN_F1		0x1d2
+#define KEY_FN_F2		0x1d3
+#define KEY_FN_F3		0x1d4
+#define KEY_FN_F4		0x1d5
+#define KEY_FN_F5		0x1d6
+#define KEY_FN_F6		0x1d7
+#define KEY_FN_F7		0x1d8
+#define KEY_FN_F8		0x1d9
+#define KEY_FN_F9		0x1da
+#define KEY_FN_F10		0x1db
+#define KEY_FN_F11		0x1dc
+#define KEY_FN_F12		0x1dd
+#define KEY_FN_1		0x1de
+#define KEY_FN_2		0x1df
+#define KEY_FN_D		0x1e0
+#define KEY_FN_E		0x1e1
+#define KEY_FN_F		0x1e2
+#define KEY_FN_S		0x1e3
+#define KEY_FN_B		0x1e4
+
+#define KEY_BRL_DOT1		0x1f1
+#define KEY_BRL_DOT2		0x1f2
+#define KEY_BRL_DOT3		0x1f3
+#define KEY_BRL_DOT4		0x1f4
+#define KEY_BRL_DOT5		0x1f5
+#define KEY_BRL_DOT6		0x1f6
+#define KEY_BRL_DOT7		0x1f7
+#define KEY_BRL_DOT8		0x1f8
+#define KEY_BRL_DOT9		0x1f9
+#define KEY_BRL_DOT10		0x1fa
+
+#define KEY_NUMERIC_0		0x200	/* used by phones, remote controls, */
+#define KEY_NUMERIC_1		0x201	/* and other keypads */
+#define KEY_NUMERIC_2		0x202
+#define KEY_NUMERIC_3		0x203
+#define KEY_NUMERIC_4		0x204
+#define KEY_NUMERIC_5		0x205
+#define KEY_NUMERIC_6		0x206
+#define KEY_NUMERIC_7		0x207
+#define KEY_NUMERIC_8		0x208
+#define KEY_NUMERIC_9		0x209
+#define KEY_NUMERIC_STAR	0x20a
+#define KEY_NUMERIC_POUND	0x20b
+
+#define KEY_CAMERA_FOCUS	0x210
+#define KEY_WPS_BUTTON		0x211	/* WiFi Protected Setup key */
+
+#define KEY_TOUCHPAD_TOGGLE	0x212	/* Request switch touchpad on or off */
+#define KEY_TOUCHPAD_ON		0x213
+#define KEY_TOUCHPAD_OFF	0x214
+
+#define KEY_CAMERA_ZOOMIN	0x215
+#define KEY_CAMERA_ZOOMOUT	0x216
+#define KEY_CAMERA_UP		0x217
+#define KEY_CAMERA_DOWN		0x218
+#define KEY_CAMERA_LEFT		0x219
+#define KEY_CAMERA_RIGHT	0x21a
+
+#define KEY_ATTENDANT_ON	0x21b
+#define KEY_ATTENDANT_OFF	0x21c
+#define KEY_ATTENDANT_TOGGLE	0x21d	/* Attendant call on or off */
+#define KEY_LIGHTS_TOGGLE	0x21e	/* Reading light on or off */
+
+#define BTN_DPAD_UP		0x220
+#define BTN_DPAD_DOWN		0x221
+#define BTN_DPAD_LEFT		0x222
+#define BTN_DPAD_RIGHT		0x223
+
+#define MATRIX_KEY(row, col, code)	\
+	((((row) & 0xFF) << 24) | (((col) & 0xFF) << 16) | ((code) & 0xFFFF))
+
+#endif /* _DT_BINDINGS_INPUT_INPUT_H */
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 02/23] dm: sunxi: Add a new config for an FDT-based pcDuino3
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 01/23] dm: sunxi: dts: Add sun7i device tree files Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 03/23] dm: core: Add support for simple-bus Simon Glass
                   ` (21 subsequent siblings)
  23 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

For now we won't want to mess with the existing configurations. Create a
new one which will enable device tree and driver model. Note that this
brings the device tree binary into u-boot-sunxi-with-spl.bin.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 Makefile                                  | 3 ++-
 arch/arm/dts/Makefile                     | 1 +
 board/sunxi/MAINTAINERS                   | 1 +
 configs/Linksprite_pcDuino3_fdt_defconfig | 8 ++++++++
 include/configs/sun7i.h                   | 4 ++++
 5 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 configs/Linksprite_pcDuino3_fdt_defconfig

diff --git a/Makefile b/Makefile
index 6221113..85b90b7 100644
--- a/Makefile
+++ b/Makefile
@@ -941,7 +941,8 @@ u-boot-nand.gph: u-boot.bin FORCE
 ifneq ($(CONFIG_SUNXI),)
 OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \
 				   --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
-u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img FORCE
+u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin \
+			u-boot$(if $(CONFIG_OF_CONTROL),-dtb,).img FORCE
 	$(call if_changed,pad_cat)
 endif
 
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 3299817..564eb76 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1,3 +1,4 @@
+dtb-$(CONFIG_SUN7I) +=  sun7i-a20-pcduino3.dtb
 dtb-$(CONFIG_S5PC100) += s5pc1xx-smdkc100.dtb
 dtb-$(CONFIG_S5PC110) += s5pc1xx-goni.dtb
 dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \
diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS
index 4f32195..3dbfe15 100644
--- a/board/sunxi/MAINTAINERS
+++ b/board/sunxi/MAINTAINERS
@@ -21,6 +21,7 @@ F:	configs/A20-OLinuXino_MICRO_defconfig
 F:	configs/Bananapi_defconfig
 F:	configs/i12-tvbox_defconfig
 F:	configs/Linksprite_pcDuino3_defconfig
+F:	configs/Linksprite_pcDuino3_fdt_defconfig
 F:	configs/qt840a_defconfig
 
 CUBIEBOARD2 BOARD
diff --git a/configs/Linksprite_pcDuino3_fdt_defconfig b/configs/Linksprite_pcDuino3_fdt_defconfig
new file mode 100644
index 0000000..e5f6236
--- /dev/null
+++ b/configs/Linksprite_pcDuino3_fdt_defconfig
@@ -0,0 +1,8 @@
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="PCDUINO3,AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2),USB_EHCI,DM"
+CONFIG_FDTFILE="sun7i-a20-pcduino3.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-pcduino3"
+CONFIG_OF_CONTROL=y
+CONFIG_OF_SEPARATE=y
++S:CONFIG_ARM=y
++S:CONFIG_TARGET_SUN7I=y
diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h
index a902b84..500d0e3 100644
--- a/include/configs/sun7i.h
+++ b/include/configs/sun7i.h
@@ -36,6 +36,10 @@
 #define CONFIG_ARMV7_SECURE_BASE	SUNXI_SRAM_B_BASE
 #define CONFIG_SYS_CLK_FREQ		24000000
 
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM)
+# define CONFIG_CMD_DM
+#endif
+
 /*
  * Include common sunxi configuration where most the settings are
  */
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 03/23] dm: core: Add support for simple-bus
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 01/23] dm: sunxi: dts: Add sun7i device tree files Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 02/23] dm: sunxi: Add a new config for an FDT-based pcDuino3 Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-23  3:06   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 04/23] dm: sunxi: Add pinmux functions which take a bank parameter Simon Glass
                   ` (20 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Add a driver for the simple-bus nodes, which allows devices within these
nodes to be bound.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/Makefile     |  1 +
 drivers/core/simple-bus.c | 33 +++++++++++++++++++++++++++++++++
 include/dm/uclass-id.h    |  1 +
 3 files changed, 35 insertions(+)
 create mode 100644 drivers/core/simple-bus.c

diff --git a/drivers/core/Makefile b/drivers/core/Makefile
index c7905b1..151c239 100644
--- a/drivers/core/Makefile
+++ b/drivers/core/Makefile
@@ -5,3 +5,4 @@
 #
 
 obj-y := device.o lists.o root.o uclass.o util.o
+obj-$(CONFIG_OF_CONTROL) += simple-bus.o
diff --git a/drivers/core/simple-bus.c b/drivers/core/simple-bus.c
new file mode 100644
index 0000000..3ea4d82
--- /dev/null
+++ b/drivers/core/simple-bus.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014 Google, Inc
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/root.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static int simple_bus_post_bind(struct udevice *dev)
+{
+	return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+}
+
+UCLASS_DRIVER(simple_bus) = {
+	.id		= UCLASS_SIMPLE_BUS,
+	.name		= "simple_bus",
+	.post_bind	= simple_bus_post_bind,
+};
+
+static const struct udevice_id generic_simple_bus_ids[] = {
+	{ .compatible = "simple-bus" },
+	{ }
+};
+
+U_BOOT_DRIVER(simple_bus_drv) = {
+	.name	= "generic_simple_bus",
+	.id	= UCLASS_SIMPLE_BUS,
+	.of_match = generic_simple_bus_ids,
+};
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index 9800777..e3e9296 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -19,6 +19,7 @@ enum uclass_id {
 	UCLASS_TEST_FDT,
 	UCLASS_TEST_BUS,
 	UCLASS_SPI_EMUL,	/* sandbox SPI device emulator */
+	UCLASS_SIMPLE_BUS,
 
 	/* U-Boot uclasses start here */
 	UCLASS_GPIO,		/* Bank of general-purpose I/O pins */
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 04/23] dm: sunxi: Add pinmux functions which take a bank parameter
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (2 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 03/23] dm: core: Add support for simple-bus Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 05/23] dm: sunxi: Make sure that GPIOs are requested Simon Glass
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

With driver model we will have access to a bank pointer, so we want to
use it rather than converting back to a number, and then back to a
bank pointer. Add functions to provide this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/arm/cpu/armv7/sunxi/pinmux.c      | 32 +++++++++++++++++++++-----------
 arch/arm/include/asm/arch-sunxi/gpio.h |  4 +++-
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/arch/arm/cpu/armv7/sunxi/pinmux.c b/arch/arm/cpu/armv7/sunxi/pinmux.c
index 1f2843f..b026f78 100644
--- a/arch/arm/cpu/armv7/sunxi/pinmux.c
+++ b/arch/arm/cpu/armv7/sunxi/pinmux.c
@@ -10,32 +10,42 @@
 #include <asm/io.h>
 #include <asm/arch/gpio.h>
 
-int sunxi_gpio_set_cfgpin(u32 pin, u32 val)
+void sunxi_gpio_set_cfgbank(struct sunxi_gpio *pio, int bank_offset, u32 val)
 {
-	u32 bank = GPIO_BANK(pin);
-	u32 index = GPIO_CFG_INDEX(pin);
-	u32 offset = GPIO_CFG_OFFSET(pin);
-	struct sunxi_gpio *pio = BANK_TO_GPIO(bank);
+	u32 index = GPIO_CFG_INDEX(bank_offset);
+	u32 offset = GPIO_CFG_OFFSET(bank_offset);
 
 	clrsetbits_le32(&pio->cfg[0] + index, 0xf << offset, val << offset);
-
-	return 0;
 }
 
-int sunxi_gpio_get_cfgpin(u32 pin)
+void sunxi_gpio_set_cfgpin(u32 pin, u32 val)
 {
-	u32 cfg;
 	u32 bank = GPIO_BANK(pin);
-	u32 index = GPIO_CFG_INDEX(pin);
-	u32 offset = GPIO_CFG_OFFSET(pin);
 	struct sunxi_gpio *pio = BANK_TO_GPIO(bank);
 
+	sunxi_gpio_set_cfgbank(pio, pin, val);
+}
+
+int sunxi_gpio_get_cfgbank(struct sunxi_gpio *pio, int bank_offset)
+{
+	u32 index = GPIO_CFG_INDEX(bank_offset);
+	u32 offset = GPIO_CFG_OFFSET(bank_offset);
+	u32 cfg;
+
 	cfg = readl(&pio->cfg[0] + index);
 	cfg >>= offset;
 
 	return cfg & 0xf;
 }
 
+int sunxi_gpio_get_cfgpin(u32 pin)
+{
+	u32 bank = GPIO_BANK(pin);
+	struct sunxi_gpio *pio = BANK_TO_GPIO(bank);
+
+	return sunxi_gpio_get_cfgbank(pio, pin);
+}
+
 int sunxi_gpio_set_drv(u32 pin, u32 val)
 {
 	u32 bank = GPIO_BANK(pin);
diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
index f7f3d8c..f72e2fd 100644
--- a/arch/arm/include/asm/arch-sunxi/gpio.h
+++ b/arch/arm/include/asm/arch-sunxi/gpio.h
@@ -139,7 +139,9 @@ enum sunxi_gpio_number {
 #define SUNXI_GPIO_PULL_UP	1
 #define SUNXI_GPIO_PULL_DOWN	2
 
-int sunxi_gpio_set_cfgpin(u32 pin, u32 val);
+void sunxi_gpio_set_cfgbank(struct sunxi_gpio *pio, int bank_offset, u32 val);
+void sunxi_gpio_set_cfgpin(u32 pin, u32 val);
+int sunxi_gpio_get_cfgbank(struct sunxi_gpio *pio, int bank_offset);
 int sunxi_gpio_get_cfgpin(u32 pin);
 int sunxi_gpio_set_drv(u32 pin, u32 val);
 int sunxi_gpio_set_pull(u32 pin, u32 val);
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 05/23] dm: sunxi: Make sure that GPIOs are requested
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (3 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 04/23] dm: sunxi: Add pinmux functions which take a bank parameter Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 06/23] dm: sunxi: Modify the GPIO driver to support driver model Simon Glass
                   ` (18 subsequent siblings)
  23 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

The scsi_init() function uses a GPIO so should request it. There is no
way to return an error here, and the request may be made multiple times,
so just ignore errors for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 board/sunxi/ahci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/sunxi/ahci.c b/board/sunxi/ahci.c
index 0c262ea..5e12328 100644
--- a/board/sunxi/ahci.c
+++ b/board/sunxi/ahci.c
@@ -74,6 +74,7 @@ void scsi_init(void)
 {
 	printf("SUNXI SCSI INIT\n");
 #ifdef CONFIG_SATAPWR
+	gpio_request(CONFIG_SATAPWR, "satapwr");
 	gpio_direction_output(CONFIG_SATAPWR, 1);
 #endif
 
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 06/23] dm: sunxi: Modify the GPIO driver to support driver model
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (4 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 05/23] dm: sunxi: Make sure that GPIOs are requested Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-05  2:07   ` Chen-Yu Tsai
  2014-10-04 17:29 ` [U-Boot] [PATCH 07/23] dm: sunxi: Add support for serial using " Simon Glass
                   ` (17 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

This adds driver model support to the sunxi GPIO driver, using the device
tree to trigger binding of the driver. The driver will still operate
without driver model too.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/sunxi_gpio.c | 170 ++++++++++++++++++++++++++++++++++++++++++++++
 include/configs/sun7i.h   |   1 +
 2 files changed, 171 insertions(+)

diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c
index 0c50a8f..f633c04 100644
--- a/drivers/gpio/sunxi_gpio.c
+++ b/drivers/gpio/sunxi_gpio.c
@@ -11,9 +11,25 @@
  */
 
 #include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <malloc.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
+#include <dm/device-internal.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
+#define SUNXI_GPIOS_PER_PORT	SUNXI_GPIO_A_NR
+
+struct sunxi_gpio_platdata {
+	struct sunxi_gpio *regs;
+	const char *bank_name;	/* Name of port, e.g. "B" */
+	int gpio_count;
+};
+
+#ifndef CONFIG_DM_GPIO
 static int sunxi_gpio_output(u32 pin, u32 val)
 {
 	u32 dat;
@@ -100,3 +116,157 @@ int sunxi_name_to_gpio(const char *name)
 		return -1;
 	return group * 32 + pin;
 }
+#endif
+
+#ifdef CONFIG_DM_GPIO
+static int sunxi_gpio_direction_input(struct udevice *dev, unsigned offset)
+{
+	struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
+
+	sunxi_gpio_set_cfgbank(plat->regs, offset, SUNXI_GPIO_INPUT);
+
+	return 0;
+}
+
+static int sunxi_gpio_direction_output(struct udevice *dev, unsigned offset,
+				       int value)
+{
+	struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
+	u32 num = GPIO_NUM(offset);
+
+	sunxi_gpio_set_cfgbank(plat->regs, offset, SUNXI_GPIO_OUTPUT);
+	clrsetbits_le32(&plat->regs->dat, 1 << num, value ? (1 << num) : 0);
+
+	return 0;
+}
+
+static int sunxi_gpio_get_value(struct udevice *dev, unsigned offset)
+{
+	struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
+	u32 num = GPIO_NUM(offset);
+	unsigned dat;
+
+	dat = readl(&plat->regs->dat);
+	dat >>= num;
+
+	return dat & 0x1;
+}
+
+static int sunxi_gpio_set_value(struct udevice *dev, unsigned offset,
+				int value)
+{
+	struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
+	u32 num = GPIO_NUM(offset);
+
+	clrsetbits_le32(&plat->regs->dat, 1 << num, value ? (1 << num) : 0);
+	return 0;
+}
+
+static int sunxi_gpio_get_function(struct udevice *dev, unsigned offset)
+{
+	struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
+	int func;
+
+	func = sunxi_gpio_get_cfgbank(plat->regs, offset);
+	if (func == SUNXI_GPIO_OUTPUT)
+		return GPIOF_OUTPUT;
+	else if (func == SUNXI_GPIO_INPUT)
+		return GPIOF_INPUT;
+	else
+		return GPIOF_FUNC;
+}
+
+static const struct dm_gpio_ops gpio_sunxi_ops = {
+	.direction_input	= sunxi_gpio_direction_input,
+	.direction_output	= sunxi_gpio_direction_output,
+	.get_value		= sunxi_gpio_get_value,
+	.set_value		= sunxi_gpio_set_value,
+	.get_function		= sunxi_gpio_get_function,
+};
+
+/**
+ * Returns the name of a GPIO bank
+ *
+ * GPIO banks are named A, B, C, ...
+ *
+ * @bank:	Bank number (0, 1..n-1)
+ * @return allocated string containing the name
+ */
+static char *gpio_bank_name(int bank)
+{
+	char *name;
+
+	name = malloc(2);
+	if (name) {
+		name[0] = 'A' + bank;
+		name[1] = '\0';
+	}
+
+	return name;
+}
+
+static int gpio_sunxi_probe(struct udevice *dev)
+{
+	struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
+	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
+
+	/* Tell the uclass how many GPIOs we have */
+	if (plat) {
+		uc_priv->gpio_count = plat->gpio_count;
+		uc_priv->bank_name = plat->bank_name;
+	}
+
+	return 0;
+}
+/**
+ * We have a top-level GPIO device with no actual GPIOs. It has a child
+ * device for each Tegra port.
+ */
+static int gpio_sunxi_bind(struct udevice *parent)
+{
+	struct sunxi_gpio_platdata *plat = parent->platdata;
+	struct sunxi_gpio_reg *ctlr;
+	int bank;
+	int ret;
+
+	/* If this is a child device, there is nothing to do here */
+	if (plat)
+		return 0;
+
+	ctlr = (struct sunxi_gpio_reg *)fdtdec_get_addr(gd->fdt_blob,
+						   parent->of_offset, "reg");
+	for (bank = 0; bank < SUNXI_GPIO_BANKS; bank++) {
+		struct sunxi_gpio_platdata *plat;
+		struct udevice *dev;
+
+		plat = calloc(1, sizeof(*plat));
+		if (!plat)
+			return -ENOMEM;
+		plat->regs = &ctlr->gpio_bank[bank];
+		plat->bank_name = gpio_bank_name(bank);
+		plat->gpio_count = SUNXI_GPIOS_PER_PORT;
+
+		ret = device_bind(parent, parent->driver,
+					plat->bank_name, plat, -1, &dev);
+		if (ret)
+			return ret;
+		dev->of_offset = parent->of_offset;
+	}
+
+	return 0;
+}
+
+static const struct udevice_id exynos_gpio_ids[] = {
+	{ .compatible = "allwinner,sun7i-a20-pinctrl" },
+	{ }
+};
+
+U_BOOT_DRIVER(gpio_sunxi) = {
+	.name	= "gpio_sunxi",
+	.id	= UCLASS_GPIO,
+	.ops	= &gpio_sunxi_ops,
+	.of_match = exynos_gpio_ids,
+	.bind	= gpio_sunxi_bind,
+	.probe	= gpio_sunxi_probe,
+};
+#endif
diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h
index 500d0e3..2314e97 100644
--- a/include/configs/sun7i.h
+++ b/include/configs/sun7i.h
@@ -38,6 +38,7 @@
 
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM)
 # define CONFIG_CMD_DM
+# define CONFIG_DM_GPIO
 #endif
 
 /*
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 07/23] dm: sunxi: Add support for serial using driver model
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (5 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 06/23] dm: sunxi: Modify the GPIO driver to support driver model Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-05 14:50   ` Chen-Yu Tsai
  2014-10-04 17:29 ` [U-Boot] [PATCH 08/23] dm: gpio: Implement GPIO reservation in the uclass Simon Glass
                   ` (16 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Add a driver for the designware serial UART used on sunxi. This just
redirects to the normal ns16550 driver.

Add a stdout-path to the device tree so that the correct UART is chosen.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/arm/dts/sun7i-a20-pcduino3.dts |  4 ++++
 drivers/serial/Makefile             |  1 +
 drivers/serial/serial_dw.c          | 39 +++++++++++++++++++++++++++++++++++++
 include/configs/sun7i.h             |  3 +++
 include/configs/sunxi-common.h      | 12 +++++++-----
 5 files changed, 54 insertions(+), 5 deletions(-)
 create mode 100644 drivers/serial/serial_dw.c

diff --git a/arch/arm/dts/sun7i-a20-pcduino3.dts b/arch/arm/dts/sun7i-a20-pcduino3.dts
index 046dfc0..f7cc8e7 100644
--- a/arch/arm/dts/sun7i-a20-pcduino3.dts
+++ b/arch/arm/dts/sun7i-a20-pcduino3.dts
@@ -20,6 +20,10 @@
 	model = "LinkSprite pcDuino3";
 	compatible = "linksprite,pcduino3", "allwinner,sun7i-a20";
 
+	chosen {
+		stdout-path = &uart0;
+	};
+
 	soc at 01c00000 {
 		mmc0: mmc at 01c0f000 {
 			pinctrl-names = "default";
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index edf6936..f57a664 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_ALTERA_UART) += altera_uart.o
 obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o
 obj-$(CONFIG_ARM_DCC) += arm_dcc.o
 obj-$(CONFIG_ATMEL_USART) += atmel_usart.o
+obj-$(CONFIG_DW_SERIAL) += serial_dw.o
 obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o
 obj-$(CONFIG_MCFUART) += mcfuart.o
 obj-$(CONFIG_OPENCORES_YANU) += opencores_yanu.o
diff --git a/drivers/serial/serial_dw.c b/drivers/serial/serial_dw.c
new file mode 100644
index 0000000..a348f29
--- /dev/null
+++ b/drivers/serial/serial_dw.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014 Google, Inc
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <ns16550.h>
+#include <serial.h>
+
+static const struct udevice_id dw_serial_ids[] = {
+	{ .compatible = "snps,dw-apb-uart" },
+	{ }
+};
+
+static int dw_serial_ofdata_to_platdata(struct udevice *dev)
+{
+	struct ns16550_platdata *plat = dev_get_platdata(dev);
+	int ret;
+
+	ret = ns16550_serial_ofdata_to_platdata(dev);
+	if (ret)
+		return ret;
+	plat->clock = CONFIG_SYS_NS16550_CLK;
+
+	return 0;
+}
+
+U_BOOT_DRIVER(serial_ns16550) = {
+	.name	= "serial_dw",
+	.id	= UCLASS_SERIAL,
+	.of_match = dw_serial_ids,
+	.ofdata_to_platdata = dw_serial_ofdata_to_platdata,
+	.platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
+	.priv_auto_alloc_size = sizeof(struct NS16550),
+	.probe = ns16550_serial_probe,
+	.ops	= &ns16550_serial_ops,
+};
diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h
index 2314e97..108694a 100644
--- a/include/configs/sun7i.h
+++ b/include/configs/sun7i.h
@@ -39,6 +39,9 @@
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM)
 # define CONFIG_CMD_DM
 # define CONFIG_DM_GPIO
+# define CONFIG_DM_SERIAL
+# define CONFIG_SYS_MALLOC_F_LEN	(1 << 10)
+# define CONFIG_DW_SERIAL
 #endif
 
 /*
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 1d947d7..e26bdf9 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -36,12 +36,14 @@
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
 /* ns16550 reg in the low bits of cpu reg */
-#define CONFIG_SYS_NS16550_REG_SIZE	-4
 #define CONFIG_SYS_NS16550_CLK		24000000
-#define CONFIG_SYS_NS16550_COM1		SUNXI_UART0_BASE
-#define CONFIG_SYS_NS16550_COM2		SUNXI_UART1_BASE
-#define CONFIG_SYS_NS16550_COM3		SUNXI_UART2_BASE
-#define CONFIG_SYS_NS16550_COM4		SUNXI_UART3_BASE
+#ifndef CONFIG_DM_SERIAL
+# define CONFIG_SYS_NS16550_REG_SIZE	-4
+# define CONFIG_SYS_NS16550_COM1		SUNXI_UART0_BASE
+# define CONFIG_SYS_NS16550_COM2		SUNXI_UART1_BASE
+# define CONFIG_SYS_NS16550_COM3		SUNXI_UART2_BASE
+# define CONFIG_SYS_NS16550_COM4		SUNXI_UART3_BASE
+#endif
 
 /* DRAM Base */
 #define CONFIG_SYS_SDRAM_BASE		0x40000000
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 08/23] dm: gpio: Implement GPIO reservation in the uclass
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (6 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 07/23] dm: sunxi: Add support for serial using " Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:52   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 09/23] dm: gpio: Add gpio_get_function() and friends Simon Glass
                   ` (15 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

We have several GPIO drivers now and all are doing similar things to record
which GPIOs are reserved.

Move this logic into the uclass to make the drivers similar.

We retain the request()/free() methods since currently one driver does use
these for setting up the pin.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/gpio-uclass.c | 92 +++++++++++++++++++++++++++++++++++++++-------
 include/asm-generic/gpio.h |  6 +++
 2 files changed, 84 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index a5ffd85..e11c5a6 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <malloc.h>
 #include <asm/gpio.h>
 #include <linux/ctype.h>
 
@@ -92,24 +93,41 @@ int gpio_lookup_name(const char *name, struct udevice **devp,
  * gpio:	GPIO number
  * label:	Name for the requested GPIO
  *
+ * The label is copied and allocated so the caller does not need to keep
+ * the pointer around.
+ *
  * This function implements the API that's compatible with current
  * GPIO API used in U-Boot. The request is forwarded to particular
  * GPIO driver. Returns 0 on success, negative value on error.
  */
 int gpio_request(unsigned gpio, const char *label)
 {
+	struct gpio_dev_priv *uc_priv;
 	unsigned int offset;
 	struct udevice *dev;
+	char *str;
 	int ret;
 
 	ret = gpio_to_device(gpio, &dev, &offset);
 	if (ret)
 		return ret;
 
-	if (!gpio_get_ops(dev)->request)
-		return 0;
+	uc_priv = dev->uclass_priv;
+	if (uc_priv->name[offset])
+		return -EBUSY;
+	str = strdup(label);
+	if (!str)
+		return -ENOMEM;
+	if (gpio_get_ops(dev)->request) {
+		ret = gpio_get_ops(dev)->request(dev, offset, label);
+		if (ret) {
+			free(str);
+			return ret;
+		}
+	}
+	uc_priv->name[offset] = str;
 
-	return gpio_get_ops(dev)->request(dev, offset, label);
+	return 0;
 }
 
 /**
@@ -122,6 +140,7 @@ int gpio_request(unsigned gpio, const char *label)
  */
 int gpio_free(unsigned gpio)
 {
+	struct gpio_dev_priv *uc_priv;
 	unsigned int offset;
 	struct udevice *dev;
 	int ret;
@@ -130,9 +149,34 @@ int gpio_free(unsigned gpio)
 	if (ret)
 		return ret;
 
-	if (!gpio_get_ops(dev)->free)
-		return 0;
-	return gpio_get_ops(dev)->free(dev, offset);
+	uc_priv = dev->uclass_priv;
+	if (!uc_priv->name[offset])
+		return -ENXIO;
+	if (gpio_get_ops(dev)->free) {
+		ret = gpio_get_ops(dev)->free(dev, offset);
+		if (ret)
+			return ret;
+	}
+
+	free(uc_priv->name[offset]);
+	uc_priv->name[offset] = NULL;
+
+	return 0;
+}
+
+static int check_reserved(struct udevice *dev, unsigned offset,
+			  const char *func)
+{
+	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
+
+	if (!uc_priv->name[offset]) {
+		printf("%s: %s: error: gpio %s%d not reserved\n",
+		       dev->name, func,
+		       uc_priv->bank_name ? uc_priv->bank_name : "", offset);
+		return -EBUSY;
+	}
+
+	return 0;
 }
 
 /**
@@ -152,8 +196,9 @@ int gpio_direction_input(unsigned gpio)
 	ret = gpio_to_device(gpio, &dev, &offset);
 	if (ret)
 		return ret;
+	ret = check_reserved(dev, offset, "dir_input");
 
-	return gpio_get_ops(dev)->direction_input(dev, offset);
+	return ret ? ret : gpio_get_ops(dev)->direction_input(dev, offset);
 }
 
 /**
@@ -174,8 +219,10 @@ int gpio_direction_output(unsigned gpio, int value)
 	ret = gpio_to_device(gpio, &dev, &offset);
 	if (ret)
 		return ret;
+	ret = check_reserved(dev, offset, "dir_output");
 
-	return gpio_get_ops(dev)->direction_output(dev, offset, value);
+	return ret ? ret :
+		gpio_get_ops(dev)->direction_output(dev, offset, value);
 }
 
 /**
@@ -196,8 +243,9 @@ int gpio_get_value(unsigned gpio)
 	ret = gpio_to_device(gpio, &dev, &offset);
 	if (ret)
 		return ret;
+	ret = check_reserved(dev, offset, "get_value");
 
-	return gpio_get_ops(dev)->get_value(dev, offset);
+	return ret ? ret : gpio_get_ops(dev)->get_value(dev, offset);
 }
 
 /**
@@ -218,8 +266,9 @@ int gpio_set_value(unsigned gpio, int value)
 	ret = gpio_to_device(gpio, &dev, &offset);
 	if (ret)
 		return ret;
+	ret = check_reserved(dev, offset, "set_value");
 
-	return gpio_get_ops(dev)->set_value(dev, offset, value);
+	return ret ? ret : gpio_get_ops(dev)->set_value(dev, offset, value);
 }
 
 const char *gpio_get_bank_info(struct udevice *dev, int *bit_count)
@@ -235,7 +284,7 @@ const char *gpio_get_bank_info(struct udevice *dev, int *bit_count)
 }
 
 /* We need to renumber the GPIOs when any driver is probed/removed */
-static int gpio_renumber(void)
+static int gpio_renumber(struct udevice *removed_dev)
 {
 	struct gpio_dev_priv *uc_priv;
 	struct udevice *dev;
@@ -250,7 +299,7 @@ static int gpio_renumber(void)
 	/* Ensure that we have a base for each bank */
 	base = 0;
 	uclass_foreach_dev(dev, uc) {
-		if (device_active(dev)) {
+		if (device_active(dev) && dev != removed_dev) {
 			uc_priv = dev->uclass_priv;
 			uc_priv->gpio_base = base;
 			base += uc_priv->gpio_count;
@@ -262,12 +311,27 @@ static int gpio_renumber(void)
 
 static int gpio_post_probe(struct udevice *dev)
 {
-	return gpio_renumber();
+	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
+
+	uc_priv->name = calloc(uc_priv->gpio_count, sizeof(char *));
+	if (!uc_priv->name)
+		return -ENOMEM;
+
+	return gpio_renumber(NULL);
 }
 
 static int gpio_pre_remove(struct udevice *dev)
 {
-	return gpio_renumber();
+	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
+	int i;
+
+	for (i = 0; i < uc_priv->gpio_count; i++) {
+		if (uc_priv->name[i])
+			free(uc_priv->name[i]);
+	}
+	free(uc_priv->name);
+
+	return gpio_renumber(dev);
 }
 
 UCLASS_DRIVER(gpio) = {
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 60539d8..cdacc75 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -29,6 +29,9 @@
  * Request a gpio. This should be called before any of the other functions
  * are used on this gpio.
  *
+ * Note: With driver model, the label is allocated so there is no need for
+ * the caller to preserve it.
+ *
  * @param gp	GPIO number
  * @param label	User label for this GPIO
  * @return 0 if ok, -1 on error
@@ -157,11 +160,14 @@ struct dm_gpio_ops {
  * @gpio_base: Base GPIO number for this device. For the first active device
  * this will be 0; the numbering for others will follow sequentially so that
  * @gpio_base for device 1 will equal the number of GPIOs in device 0.
+ * @name: Array of pointers to the name for each GPIO in this bank. The
+ * value of the pointer will be NULL if the GPIO has not been claimed.
  */
 struct gpio_dev_priv {
 	const char *bank_name;
 	unsigned gpio_count;
 	unsigned gpio_base;
+	char **name;
 };
 
 /* Access the GPIO operations for a device */
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 09/23] dm: gpio: Add gpio_get_function() and friends
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (7 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 08/23] dm: gpio: Implement GPIO reservation in the uclass Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:52   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 10/23] dm: Move the function for getting GPIO status into the uclass Simon Glass
                   ` (14 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Add helpers to the uclass to allow finding out the pin function.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/gpio-uclass.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++
 include/asm-generic/gpio.h | 34 ++++++++++++++++++++++++++++++++-
 2 files changed, 80 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index e11c5a6..04b7b16 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -283,6 +283,53 @@ const char *gpio_get_bank_info(struct udevice *dev, int *bit_count)
 	return priv->bank_name;
 }
 
+static const char * const gpio_function[GPIOF_COUNT] = {
+	"input",
+	"output",
+	"unused",
+	"unknown",
+	"func",
+};
+
+int get_function(struct udevice *dev, int offset, bool skip_unused,
+		 const char **namep)
+{
+	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
+	struct dm_gpio_ops *ops = gpio_get_ops(dev);
+
+	BUILD_BUG_ON(GPIOF_COUNT != ARRAY_SIZE(gpio_function));
+	if (!device_active(dev))
+		return -ENODEV;
+	if (offset < 0 || offset >= uc_priv->gpio_count)
+		return -EINVAL;
+	if (namep)
+		*namep = uc_priv->name[offset];
+	if (skip_unused && !uc_priv->name[offset])
+		return GPIOF_UNUSED;
+	if (ops->get_function) {
+		int ret;
+
+		ret = ops->get_function(dev, offset);
+		if (ret < 0)
+			return ret;
+		if (ret >= ARRAY_SIZE(gpio_function))
+			return -ENODATA;
+		return ret;
+	}
+
+	return GPIOF_UNKNOWN;
+}
+
+int gpio_get_function(struct udevice *dev, int offset, const char **namep)
+{
+	return get_function(dev, offset, true, namep);
+}
+
+int gpio_get_raw_function(struct udevice *dev, int offset, const char **namep)
+{
+	return get_function(dev, offset, false, namep);
+}
+
 /* We need to renumber the GPIOs when any driver is probed/removed */
 static int gpio_renumber(struct udevice *removed_dev)
 {
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index cdacc75..86b9747 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -83,7 +83,7 @@ int gpio_get_value(unsigned gpio);
 int gpio_set_value(unsigned gpio, int value);
 
 /* State of a GPIO, as reported by get_function() */
-enum {
+enum gpio_func_t {
 	GPIOF_INPUT = 0,
 	GPIOF_OUTPUT,
 	GPIOF_UNUSED,		/* Not claimed */
@@ -96,6 +96,38 @@ enum {
 struct udevice;
 
 /**
+ * gpio_get_function() - get the current function for a GPIO pin
+ *
+ * Note this returns GPIOF_UNUSED if the GPIO is not requested.
+ *
+ * @dev:	Device to check
+ * @offset:	Offset of device GPIO to check
+ * @namep:	If non-NULL, this is set to the nane given when the GPIO
+ *		was requested, or -1 if it has not been requested
+ * @return  -ENODATA if the driver returned an unknown function,
+ * -ENODEV if the device is not active, -EINVAL if the offset is invalid.
+ * GPIOF_UNUSED if the GPIO has not been requested. Otherwise returns the
+ * function from enum gpio_func_t.
+ */
+int gpio_get_function(struct udevice *dev, int offset, const char **namep);
+
+/**
+ * gpio_get_raw_function() - get the current raw function for a GPIO pin
+ *
+ * Note this does not return GPIOF_UNUSED - it will always return the GPIO
+ * driver's view of a pin function, even if it is not correctly set up.
+ *
+ * @dev:	Device to check
+ * @offset:	Offset of device GPIO to check
+ * @namep:	If non-NULL, this is set to the nane given when the GPIO
+ *		was requested, or -1 if it has not been requested
+ * @return  -ENODATA if the driver returned an unknown function,
+ * -ENODEV if the device is not active, -EINVAL if the offset is invalid.
+ * Otherwise returns the function from enum gpio_func_t.
+ */
+int gpio_get_raw_function(struct udevice *dev, int offset, const char **namep);
+
+/**
  * struct struct dm_gpio_ops - Driver model GPIO operations
  *
  * Refer to functions above for description. These function largely copy
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 10/23] dm: Move the function for getting GPIO status into the uclass
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (8 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 09/23] dm: gpio: Add gpio_get_function() and friends Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:52   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 11/23] dm: gpio: sandbox: Implement the get_function() method Simon Glass
                   ` (13 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

This function can be more easily tested if it is in the uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/cmd_gpio.c          | 57 +++++++++++++++++-----------------------------
 drivers/gpio/gpio-uclass.c | 39 +++++++++++++++++++++++++++++++
 include/asm-generic/gpio.h | 18 +++++++++++++++
 3 files changed, 78 insertions(+), 36 deletions(-)

diff --git a/common/cmd_gpio.c b/common/cmd_gpio.c
index 11f4e40..c0cdc5f 100644
--- a/common/cmd_gpio.c
+++ b/common/cmd_gpio.c
@@ -25,13 +25,6 @@ enum gpio_cmd {
 };
 
 #if defined(CONFIG_DM_GPIO) && !defined(gpio_status)
-static const char * const gpio_function[GPIOF_COUNT] = {
-	"input",
-	"output",
-	"unused",
-	"unknown",
-	"func",
-};
 
 /* A few flags used by show_gpio() */
 enum {
@@ -40,22 +33,16 @@ enum {
 	FLAG_SHOW_NEWLINE	= 1 << 2,
 };
 
-static void show_gpio(struct udevice *dev, const char *bank_name, int offset,
-		      int *flagsp)
+static void gpio_get_description(struct udevice *dev, const char *bank_name,
+				 int offset, int *flagsp)
 {
-	struct dm_gpio_ops *ops = gpio_get_ops(dev);
-	int func = GPIOF_UNKNOWN;
 	char buf[80];
 	int ret;
 
-	BUILD_BUG_ON(GPIOF_COUNT != ARRAY_SIZE(gpio_function));
-
-	if (ops->get_function) {
-		ret = ops->get_function(dev, offset);
-		if (ret >= 0 && ret < ARRAY_SIZE(gpio_function))
-			func = ret;
-	}
-	if (!(*flagsp & FLAG_SHOW_ALL) && func == GPIOF_UNUSED)
+	ret = gpio_get_function(dev, offset, NULL);
+	if (ret < 0)
+		goto err;
+	if (!(*flagsp & FLAG_SHOW_ALL) && ret == GPIOF_UNUSED)
 		return;
 	if ((*flagsp & FLAG_SHOW_BANK) && bank_name) {
 		if (*flagsp & FLAG_SHOW_NEWLINE) {
@@ -65,20 +52,15 @@ static void show_gpio(struct udevice *dev, const char *bank_name, int offset,
 		printf("Bank %s:\n", bank_name);
 		*flagsp &= ~FLAG_SHOW_BANK;
 	}
-	*buf = '\0';
-	if (ops->get_state) {
-		ret = ops->get_state(dev, offset, buf, sizeof(buf));
-		if (ret) {
-			puts("<unknown>");
-			return;
-		}
-	} else {
-		sprintf(buf, "%s%u: %8s %d", bank_name, offset,
-			gpio_function[func], ops->get_value(dev, offset));
-	}
 
-	puts(buf);
-	puts("\n");
+	ret = gpio_get_status(dev, offset, buf, sizeof(buf));
+	if (ret)
+		goto err;
+
+	printf("%s\n", buf);
+	return;
+err:
+	printf("Error %d\n", ret);
 }
 
 static int do_gpio_status(bool all, const char *gpio_name)
@@ -101,8 +83,10 @@ static int do_gpio_status(bool all, const char *gpio_name)
 		if (all)
 			flags |= FLAG_SHOW_ALL;
 		bank_name = gpio_get_bank_info(dev, &num_bits);
-		if (!num_bits)
+		if (!num_bits) {
+			debug("GPIO device %s has no bits\n", dev->name);
 			continue;
+		}
 		banklen = bank_name ? strlen(bank_name) : 0;
 
 		if (!gpio_name || !bank_name ||
@@ -113,11 +97,12 @@ static int do_gpio_status(bool all, const char *gpio_name)
 			p = gpio_name + banklen;
 			if (gpio_name && *p) {
 				offset = simple_strtoul(p, NULL, 10);
-				show_gpio(dev, bank_name, offset, &flags);
+				gpio_get_description(dev, bank_name, offset,
+						     &flags);
 			} else {
 				for (offset = 0; offset < num_bits; offset++) {
-					show_gpio(dev, bank_name, offset,
-						  &flags);
+					gpio_get_description(dev, bank_name,
+							     offset, &flags);
 				}
 			}
 		}
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 04b7b16..6367093 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -330,6 +330,45 @@ int gpio_get_raw_function(struct udevice *dev, int offset, const char **namep)
 	return get_function(dev, offset, false, namep);
 }
 
+int gpio_get_status(struct udevice *dev, int offset, char *buf, int buffsize)
+{
+	struct dm_gpio_ops *ops = gpio_get_ops(dev);
+	struct gpio_dev_priv *priv;
+	char *str = buf;
+	int func;
+	int ret;
+	int len;
+
+	BUILD_BUG_ON(GPIOF_COUNT != ARRAY_SIZE(gpio_function));
+
+	*buf = 0;
+	priv = dev->uclass_priv;
+	ret = gpio_get_raw_function(dev, offset, NULL);
+	if (ret < 0)
+		return ret;
+	func = ret;
+	len = snprintf(str, buffsize, "%s%d: %s",
+		       priv->bank_name ? priv->bank_name : "",
+		       offset, gpio_function[func]);
+	if (func == GPIOF_INPUT || func == GPIOF_OUTPUT ||
+	    func == GPIOF_UNUSED) {
+		const char *label;
+		bool used;
+
+		ret = ops->get_value(dev, offset);
+		if (ret < 0)
+			return ret;
+		used = gpio_get_function(dev, offset, &label) != GPIOF_UNUSED;
+		snprintf(str + len, buffsize - len, ": %d [%c]%s%s",
+			 ret,
+			 used ? 'x' : ' ',
+			 used ? " " : "",
+			 label ? label : "");
+	}
+
+	return 0;
+}
+
 /* We need to renumber the GPIOs when any driver is probed/removed */
 static int gpio_renumber(struct udevice *removed_dev)
 {
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 86b9747..5c9bd5f 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -96,6 +96,24 @@ enum gpio_func_t {
 struct udevice;
 
 /**
+ * gpio_get_status() - get the current GPIO status as a string
+ *
+ * Obtain the current GPIO status as a string which can be presented to the
+ * user. A typical string is:
+ *
+ * "b4:  in: 1 [x] sdmmc_cd"
+ *
+ * which means this is GPIO bank b, offset 4, currently set to input, current
+ * value 1, [x] means that it is requested and the owner is 'sdmmc_cd'
+ *
+ * @dev:	Device to check
+ * @offset:	Offset of device GPIO to check
+ * @buf:	Place to put string
+ * @buffsize:	Size of string including \0
+ */
+int gpio_get_status(struct udevice *dev, int offset, char *buf, int buffsize);
+
+/**
  * gpio_get_function() - get the current function for a GPIO pin
  *
  * Note this returns GPIOF_UNUSED if the GPIO is not requested.
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 11/23] dm: gpio: sandbox: Implement the get_function() method
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (9 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 10/23] dm: Move the function for getting GPIO status into the uclass Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:52   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 12/23] dm: gpio: sandbox: Implement the remove() method Simon Glass
                   ` (12 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Implement this method so that the 'gpio' command can do its job correctly.
For sandbox we only support input and output states for a gpio.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/sandbox.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c
index 75ada5d..7aa8b1f 100644
--- a/drivers/gpio/sandbox.c
+++ b/drivers/gpio/sandbox.c
@@ -203,6 +203,13 @@ static int sb_gpio_get_state(struct udevice *dev, unsigned int offset,
 	return 0;
 }
 
+static int sb_gpio_get_function(struct udevice *dev, unsigned offset)
+{
+	if (get_gpio_flag(dev, offset, GPIOF_OUTPUT))
+		return GPIOF_OUTPUT;
+	return GPIOF_INPUT;
+}
+
 static const struct dm_gpio_ops gpio_sandbox_ops = {
 	.request		= sb_gpio_request,
 	.free			= sb_gpio_free,
@@ -210,7 +217,7 @@ static const struct dm_gpio_ops gpio_sandbox_ops = {
 	.direction_output	= sb_gpio_direction_output,
 	.get_value		= sb_gpio_get_value,
 	.set_value		= sb_gpio_set_value,
-	.get_state		= sb_gpio_get_state,
+	.get_function		= sb_gpio_get_function,
 };
 
 static int sandbox_gpio_ofdata_to_platdata(struct udevice *dev)
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 12/23] dm: gpio: sandbox: Implement the remove() method
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (10 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 11/23] dm: gpio: sandbox: Implement the get_function() method Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:52   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 13/23] dm: gpio: sandbox: Drop request()/free() in the driver Simon Glass
                   ` (11 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

This method frees memory so we must make sure to implement it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/sandbox.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c
index 7aa8b1f..13b3253 100644
--- a/drivers/gpio/sandbox.c
+++ b/drivers/gpio/sandbox.c
@@ -246,6 +246,13 @@ static int gpio_sandbox_probe(struct udevice *dev)
 	return 0;
 }
 
+static int gpio_sandbox_remove(struct udevice *dev)
+{
+	free(dev->priv);
+
+	return 0;
+}
+
 static const struct udevice_id sandbox_gpio_ids[] = {
 	{ .compatible = "sandbox,gpio" },
 	{ }
@@ -257,5 +264,6 @@ U_BOOT_DRIVER(gpio_sandbox) = {
 	.of_match = sandbox_gpio_ids,
 	.ofdata_to_platdata = sandbox_gpio_ofdata_to_platdata,
 	.probe	= gpio_sandbox_probe,
+	.remove	= gpio_sandbox_remove,
 	.ops	= &gpio_sandbox_ops,
 };
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 13/23] dm: gpio: sandbox: Drop request()/free() in the driver
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (11 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 12/23] dm: gpio: sandbox: Implement the remove() method Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:53   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 14/23] test: dm: Update GPIO tests for new gpio_request() method Simon Glass
                   ` (10 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Now that the uclass supports gpio_request/free() there is no need for the
driver to implement it too. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/sandbox.c | 82 --------------------------------------------------
 1 file changed, 82 deletions(-)

diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c
index 13b3253..53c80d5 100644
--- a/drivers/gpio/sandbox.c
+++ b/drivers/gpio/sandbox.c
@@ -14,7 +14,6 @@ DECLARE_GLOBAL_DATA_PTR;
 /* Flags for each GPIO */
 #define GPIOF_OUTPUT	(1 << 0)	/* Currently set as an output */
 #define GPIOF_HIGH	(1 << 1)	/* Currently set high */
-#define GPIOF_RESERVED	(1 << 2)	/* Is in use / requested */
 
 struct gpio_state {
 	const char *label;	/* label given by requester */
@@ -54,18 +53,6 @@ static int set_gpio_flag(struct udevice *dev, unsigned offset, int flag,
 	return 0;
 }
 
-static int check_reserved(struct udevice *dev, unsigned offset,
-			  const char *func)
-{
-	if (!get_gpio_flag(dev, offset, GPIOF_RESERVED)) {
-		printf("sandbox_gpio: %s: error: offset %u not reserved\n",
-		       func, offset);
-		return -1;
-	}
-
-	return 0;
-}
-
 /*
  * Back-channel sandbox-internal-only access to GPIO state
  */
@@ -101,9 +88,6 @@ static int sb_gpio_direction_input(struct udevice *dev, unsigned offset)
 {
 	debug("%s: offset:%u\n", __func__, offset);
 
-	if (check_reserved(dev, offset, __func__))
-		return -1;
-
 	return sandbox_gpio_set_direction(dev, offset, 0);
 }
 
@@ -113,9 +97,6 @@ static int sb_gpio_direction_output(struct udevice *dev, unsigned offset,
 {
 	debug("%s: offset:%u, value = %d\n", __func__, offset, value);
 
-	if (check_reserved(dev, offset, __func__))
-		return -1;
-
 	return sandbox_gpio_set_direction(dev, offset, 1) |
 		sandbox_gpio_set_value(dev, offset, value);
 }
@@ -125,9 +106,6 @@ static int sb_gpio_get_value(struct udevice *dev, unsigned offset)
 {
 	debug("%s: offset:%u\n", __func__, offset);
 
-	if (check_reserved(dev, offset, __func__))
-		return -1;
-
 	return sandbox_gpio_get_value(dev, offset);
 }
 
@@ -136,9 +114,6 @@ static int sb_gpio_set_value(struct udevice *dev, unsigned offset, int value)
 {
 	debug("%s: offset:%u, value = %d\n", __func__, offset, value);
 
-	if (check_reserved(dev, offset, __func__))
-		return -1;
-
 	if (!sandbox_gpio_get_direction(dev, offset)) {
 		printf("sandbox_gpio: error: set_value on input gpio %u\n",
 		       offset);
@@ -148,61 +123,6 @@ static int sb_gpio_set_value(struct udevice *dev, unsigned offset, int value)
 	return sandbox_gpio_set_value(dev, offset, value);
 }
 
-static int sb_gpio_request(struct udevice *dev, unsigned offset,
-			   const char *label)
-{
-	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
-	struct gpio_state *state = dev_get_priv(dev);
-
-	debug("%s: offset:%u, label:%s\n", __func__, offset, label);
-
-	if (offset >= uc_priv->gpio_count) {
-		printf("sandbox_gpio: error: invalid gpio %u\n", offset);
-		return -1;
-	}
-
-	if (get_gpio_flag(dev, offset, GPIOF_RESERVED)) {
-		printf("sandbox_gpio: error: gpio %u already reserved\n",
-		       offset);
-		return -1;
-	}
-
-	state[offset].label = label;
-	return set_gpio_flag(dev, offset, GPIOF_RESERVED, 1);
-}
-
-static int sb_gpio_free(struct udevice *dev, unsigned offset)
-{
-	struct gpio_state *state = dev_get_priv(dev);
-
-	debug("%s: offset:%u\n", __func__, offset);
-
-	if (check_reserved(dev, offset, __func__))
-		return -1;
-
-	state[offset].label = NULL;
-	return set_gpio_flag(dev, offset, GPIOF_RESERVED, 0);
-}
-
-static int sb_gpio_get_state(struct udevice *dev, unsigned int offset,
-			     char *buf, int bufsize)
-{
-	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
-	struct gpio_state *state = dev_get_priv(dev);
-	const char *label;
-
-	label = state[offset].label;
-	snprintf(buf, bufsize, "%s%d: %s: %d [%c]%s%s",
-		 uc_priv->bank_name ? uc_priv->bank_name : "", offset,
-		 sandbox_gpio_get_direction(dev, offset) ? "out" : " in",
-		 sandbox_gpio_get_value(dev, offset),
-		 get_gpio_flag(dev, offset, GPIOF_RESERVED) ? 'x' : ' ',
-		 label ? " " : "",
-		 label ? label : "");
-
-	return 0;
-}
-
 static int sb_gpio_get_function(struct udevice *dev, unsigned offset)
 {
 	if (get_gpio_flag(dev, offset, GPIOF_OUTPUT))
@@ -211,8 +131,6 @@ static int sb_gpio_get_function(struct udevice *dev, unsigned offset)
 }
 
 static const struct dm_gpio_ops gpio_sandbox_ops = {
-	.request		= sb_gpio_request,
-	.free			= sb_gpio_free,
 	.direction_input	= sb_gpio_direction_input,
 	.direction_output	= sb_gpio_direction_output,
 	.get_value		= sb_gpio_get_value,
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 14/23] test: dm: Update GPIO tests for new gpio_request() method
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (12 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 13/23] dm: gpio: sandbox: Drop request()/free() in the driver Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:53   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 15/23] dm: gpio: Add gpio_requestf() helper for printf() strings Simon Glass
                   ` (9 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Now that gpio_request() is handled by the uclass, updates the tests
accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 doc/driver-model/README.txt | 25 +++++++++++++++++++--
 test/dm/gpio.c              | 55 +++++++++++++++++++++++++++------------------
 2 files changed, 56 insertions(+), 24 deletions(-)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index 8dfcf75..1ff454a 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -95,7 +95,7 @@ are provided in test/dm. To run them, try:
 You should see something like this:
 
     <...U-Boot banner...>
-    Running 22 driver model tests
+    Running 26 driver model tests
     Test: dm_test_autobind
     Test: dm_test_autoprobe
     Test: dm_test_bus_children
@@ -115,7 +115,8 @@ You should see something like this:
     Device 'd-test': seq 3 is in use by 'b-test'
     Device 'a-test': seq 0 is in use by 'd-test'
     Test: dm_test_gpio
-    sandbox_gpio: sb_gpio_get_value: error: offset 4 not reserved
+    extra-gpios: get_value: error: gpio b5 not reserved
+    Test: dm_test_gpio_anon
     Test: dm_test_leak
     Test: dm_test_lifecycle
     Test: dm_test_operations
@@ -123,6 +124,26 @@ You should see something like this:
     Test: dm_test_platdata
     Test: dm_test_pre_reloc
     Test: dm_test_remove
+    Test: dm_test_spi_find
+    Invalid chip select 0:0 (err=-19)
+    SF: Failed to get idcodes
+    Device 'name-emul': seq 0 is in use by 'name-emul'
+    SF: Detected M25P16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB
+    Test: dm_test_spi_flash
+    2097152 bytes written in 0 ms
+    SF: Detected M25P16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB
+    SPI flash test:
+    0 erase: 0 ticks, 65536000 KiB/s 524288.000 Mbps
+    1 check: 0 ticks, 65536000 KiB/s 524288.000 Mbps
+    2 write: 0 ticks, 65536000 KiB/s 524288.000 Mbps
+    3 read: 0 ticks, 65536000 KiB/s 524288.000 Mbps
+    Test passed
+    0 erase: 0 ticks, 65536000 KiB/s 524288.000 Mbps
+    1 check: 0 ticks, 65536000 KiB/s 524288.000 Mbps
+    2 write: 0 ticks, 65536000 KiB/s 524288.000 Mbps
+    3 read: 0 ticks, 65536000 KiB/s 524288.000 Mbps
+    Test: dm_test_spi_xfer
+    SF: Detected M25P16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB
     Test: dm_test_uclass
     Test: dm_test_uclass_before_ready
     Failures: 0
diff --git a/test/dm/gpio.c b/test/dm/gpio.c
index 2b2b0b5..ad56ca5 100644
--- a/test/dm/gpio.c
+++ b/test/dm/gpio.c
@@ -39,52 +39,51 @@ static int dm_test_gpio(struct dm_test_state *dms)
 
 	/* Get the operations for this device */
 	ops = gpio_get_ops(dev);
-	ut_assert(ops->get_state);
+	ut_assert(ops->get_function);
 
 	/* Cannot get a value until it is reserved */
-	ut_asserteq(-1, ops->get_value(dev, offset));
-
+	ut_asserteq(-EBUSY, gpio_get_value(gpio + 1));
 	/*
 	 * Now some tests that use the 'sandbox' back door. All GPIOs
 	 * should default to input, include b4 that we are using here.
 	 */
-	ut_assertok(ops->get_state(dev, offset, buf, sizeof(buf)));
-	ut_asserteq_str("b4:  in: 0 [ ]", buf);
+	ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
+	ut_asserteq_str("b4: input: 0 [ ]", buf);
 
 	/* Change it to an output */
 	sandbox_gpio_set_direction(dev, offset, 1);
-	ut_assertok(ops->get_state(dev, offset, buf, sizeof(buf)));
-	ut_asserteq_str("b4: out: 0 [ ]", buf);
+	ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
+	ut_asserteq_str("b4: output: 0 [ ]", buf);
 
 	sandbox_gpio_set_value(dev, offset, 1);
-	ut_assertok(ops->get_state(dev, offset, buf, sizeof(buf)));
-	ut_asserteq_str("b4: out: 1 [ ]", buf);
+	ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
+	ut_asserteq_str("b4: output: 1 [ ]", buf);
 
-	ut_assertok(ops->request(dev, offset, "testing"));
-	ut_assertok(ops->get_state(dev, offset, buf, sizeof(buf)));
-	ut_asserteq_str("b4: out: 1 [x] testing", buf);
+	ut_assertok(gpio_request(gpio, "testing"));
+	ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
+	ut_asserteq_str("b4: output: 1 [x] testing", buf);
 
 	/* Change the value a bit */
 	ut_asserteq(1, ops->get_value(dev, offset));
 	ut_assertok(ops->set_value(dev, offset, 0));
 	ut_asserteq(0, ops->get_value(dev, offset));
-	ut_assertok(ops->get_state(dev, offset, buf, sizeof(buf)));
-	ut_asserteq_str("b4: out: 0 [x] testing", buf);
+	ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
+	ut_asserteq_str("b4: output: 0 [x] testing", buf);
 	ut_assertok(ops->set_value(dev, offset, 1));
 	ut_asserteq(1, ops->get_value(dev, offset));
 
 	/* Make it an input */
 	ut_assertok(ops->direction_input(dev, offset));
-	ut_assertok(ops->get_state(dev, offset, buf, sizeof(buf)));
-	ut_asserteq_str("b4:  in: 1 [x] testing", buf);
+	ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
+	ut_asserteq_str("b4: input: 1 [x] testing", buf);
 	sandbox_gpio_set_value(dev, offset, 0);
 	ut_asserteq(0, sandbox_gpio_get_value(dev, offset));
-	ut_assertok(ops->get_state(dev, offset, buf, sizeof(buf)));
-	ut_asserteq_str("b4:  in: 0 [x] testing", buf);
+	ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
+	ut_asserteq_str("b4: input: 0 [x] testing", buf);
 
-	ut_assertok(ops->free(dev, offset));
-	ut_assertok(ops->get_state(dev, offset, buf, sizeof(buf)));
-	ut_asserteq_str("b4:  in: 0 [ ]", buf);
+	ut_assertok(gpio_free(gpio));
+	ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
+	ut_asserteq_str("b4: input: 0 [ ]", buf);
 
 	/* Check the 'a' bank also */
 	ut_assertok(gpio_lookup_name("a15", &dev, &offset, &gpio));
@@ -96,6 +95,18 @@ static int dm_test_gpio(struct dm_test_state *dms)
 	ut_asserteq_str("a", name);
 	ut_asserteq(20, offset_count);
 
+	return 0;
+}
+DM_TEST(dm_test_gpio, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test that sandbox anonymous GPIOs work correctly */
+static int dm_test_gpio_anon(struct dm_test_state *dms)
+{
+	unsigned int offset, gpio;
+	struct udevice *dev;
+	const char *name;
+	int offset_count;
+
 	/* And the anonymous bank */
 	ut_assertok(gpio_lookup_name("14", &dev, &offset, &gpio));
 	ut_asserteq_str(dev->name, "gpio_sandbox");
@@ -108,4 +119,4 @@ static int dm_test_gpio(struct dm_test_state *dms)
 
 	return 0;
 }
-DM_TEST(dm_test_gpio, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+DM_TEST(dm_test_gpio_anon, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 15/23] dm: gpio: Add gpio_requestf() helper for printf() strings
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (13 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 14/23] test: dm: Update GPIO tests for new gpio_request() method Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:53   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 16/23] test: dm: Support memory leak checking as a core feature Simon Glass
                   ` (8 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Add a helper which permits a printf()-style format string for the requester
string.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 doc/driver-model/README.txt |  3 ++-
 drivers/gpio/gpio-uclass.c  | 21 +++++++++++++++++++++
 include/asm-generic/gpio.h  | 10 ++++++++++
 test/dm/gpio.c              | 18 ++++++++++++++++++
 4 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index 1ff454a..f4395c1 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -95,7 +95,7 @@ are provided in test/dm. To run them, try:
 You should see something like this:
 
     <...U-Boot banner...>
-    Running 26 driver model tests
+    Running 27 driver model tests
     Test: dm_test_autobind
     Test: dm_test_autoprobe
     Test: dm_test_bus_children
@@ -117,6 +117,7 @@ You should see something like this:
     Test: dm_test_gpio
     extra-gpios: get_value: error: gpio b5 not reserved
     Test: dm_test_gpio_anon
+    Test: dm_test_gpio_requestf
     Test: dm_test_leak
     Test: dm_test_lifecycle
     Test: dm_test_operations
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 6367093..45e9a5a 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -131,6 +131,27 @@ int gpio_request(unsigned gpio, const char *label)
 }
 
 /**
+ * gpio_requestf() - [COMPAT] Request GPIO
+ * @gpio:	GPIO number
+ * @fmt:	Format string for the requested GPIO
+ * @...:	Arguments for the printf() format string
+ *
+ * This function implements the API that's compatible with current
+ * GPIO API used in U-Boot. The request is forwarded to particular
+ * GPIO driver. Returns 0 on success, negative value on error.
+ */
+int gpio_requestf(unsigned gpio, const char *fmt, ...)
+{
+	va_list args;
+	char buf[40];
+
+	va_start(args, fmt);
+	vscnprintf(buf, sizeof(buf), fmt, args);
+	va_end(args);
+	return gpio_request(gpio, buf);
+}
+
+/**
  * gpio_free() - [COMPAT] Relinquish GPIO
  * gpio:	GPIO number
  *
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 5c9bd5f..2a32c93 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -146,6 +146,16 @@ int gpio_get_function(struct udevice *dev, int offset, const char **namep);
 int gpio_get_raw_function(struct udevice *dev, int offset, const char **namep);
 
 /**
+ * gpio_requestf() - request a GPIO using a format string for the owner
+ *
+ * This is a helper function for gpio_request(). It allows you to provide
+ * a printf()-format string for the GPIO owner. It calls gpio_request() with
+ * the string that is created
+ */
+int gpio_requestf(unsigned gpio, const char *fmt, ...)
+		__attribute__ ((format (__printf__, 2, 3)));
+
+/**
  * struct struct dm_gpio_ops - Driver model GPIO operations
  *
  * Refer to functions above for description. These function largely copy
diff --git a/test/dm/gpio.c b/test/dm/gpio.c
index ad56ca5..5174ced 100644
--- a/test/dm/gpio.c
+++ b/test/dm/gpio.c
@@ -120,3 +120,21 @@ static int dm_test_gpio_anon(struct dm_test_state *dms)
 	return 0;
 }
 DM_TEST(dm_test_gpio_anon, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test that gpio_requestf() works as expected */
+static int dm_test_gpio_requestf(struct dm_test_state *dms)
+{
+	unsigned int offset, gpio;
+	struct udevice *dev;
+	char buf[80];
+
+	ut_assertok(gpio_lookup_name("b5", &dev, &offset, &gpio));
+	ut_assertok(gpio_requestf(gpio, "testing %d %s", 1, "hi"));
+	sandbox_gpio_set_direction(dev, offset, 1);
+	sandbox_gpio_set_value(dev, offset, 1);
+	ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
+	ut_asserteq_str("b5: output: 1 [x] testing 1 hi", buf);
+
+	return 0;
+}
+DM_TEST(dm_test_gpio_requestf, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 16/23] test: dm: Support memory leak checking as a core feature
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (14 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 15/23] dm: gpio: Add gpio_requestf() helper for printf() strings Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:53   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 17/23] test: dm: Add additional GPIO tests Simon Glass
                   ` (7 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Check the state of the malloc() heap before each test is run, so that tests
can verify that all is well at the end. Provide helper functions to mark
the heap and to check that it returns to its initial state.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 include/dm/test.h   | 23 +++++++++++++++++++++++
 test/dm/core.c      | 46 ++++++++++++++++++++++++++++++----------------
 test/dm/test-main.c |  2 ++
 3 files changed, 55 insertions(+), 16 deletions(-)

diff --git a/include/dm/test.h b/include/dm/test.h
index 235d728..f08c05d 100644
--- a/include/dm/test.h
+++ b/include/dm/test.h
@@ -8,6 +8,7 @@
 #define __DM_TEST_H
 
 #include <dm.h>
+#include <malloc.h>
 
 /**
  * struct dm_test_cdata - configuration data for test instance
@@ -120,6 +121,7 @@ struct dm_test_state {
 	int force_fail_alloc;
 	int skip_post_probe;
 	struct udevice *removed;
+	struct mallinfo start;
 };
 
 /* Test flags for each test */
@@ -178,6 +180,27 @@ int dm_check_operations(struct dm_test_state *dms, struct udevice *dev,
 int dm_check_devices(struct dm_test_state *dms, int num_devices);
 
 /**
+ * dm_leak_check_start() - Prepare to check for a memory leak
+ *
+ * Call this before allocating memory to record the amount of memory being
+ * used.
+ *
+ * @dms: Overall test state
+ */
+void dm_leak_check_start(struct dm_test_state *dms);
+
+/**
+ * dm_leak_check_end() - Check that no memory has leaked
+ *
+ * Call this after dm_leak_check_start() and after you have hopefuilly freed
+ * all the memory that was allocated. This function will print an error if
+ * it sees a different amount of total memory allocated than before.
+ *
+ * @dms: Overall test state
+ */int dm_leak_check_end(struct dm_test_state *dms);
+
+
+/**
  * dm_test_main() - Run all the tests
  *
  * This runs all available driver model tests
diff --git a/test/dm/core.c b/test/dm/core.c
index b0cfb42..ff5c2a7 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -67,6 +67,34 @@ static struct driver_info driver_info_pre_reloc = {
 	.platdata = &test_pdata_manual,
 };
 
+void dm_leak_check_start(struct dm_test_state *dms)
+{
+	dms->start = mallinfo();
+	if (!dms->start.uordblks)
+		puts("Warning: Please add '#define DEBUG' to the top of common/dlmalloc.c\n");
+}
+
+int dm_leak_check_end(struct dm_test_state *dms)
+{
+	struct mallinfo end;
+	int id;
+
+	/* Don't delete the root class, since we started with that */
+	for (id = UCLASS_ROOT + 1; id < UCLASS_COUNT; id++) {
+		struct uclass *uc;
+
+		uc = uclass_find(id);
+		if (!uc)
+			continue;
+		ut_assertok(uclass_destroy(uc));
+	}
+
+	end = mallinfo();
+	ut_asserteq(dms->start.uordblks, end.uordblks);
+
+	return 0;
+}
+
 /* Test that binding with platdata occurs correctly */
 static int dm_test_autobind(struct dm_test_state *dms)
 {
@@ -377,14 +405,11 @@ static int dm_test_leak(struct dm_test_state *dms)
 	int i;
 
 	for (i = 0; i < 2; i++) {
-		struct mallinfo start, end;
 		struct udevice *dev;
 		int ret;
 		int id;
 
-		start = mallinfo();
-		if (!start.uordblks)
-			puts("Warning: Please add '#define DEBUG' to the top of common/dlmalloc.c\n");
+		dm_leak_check_start(dms);
 
 		ut_assertok(dm_scan_platdata(false));
 		ut_assertok(dm_scan_fdt(gd->fdt_blob, false));
@@ -398,18 +423,7 @@ static int dm_test_leak(struct dm_test_state *dms)
 			ut_assertok(ret);
 		}
 
-		/* Don't delete the root class, since we started with that */
-		for (id = UCLASS_ROOT + 1; id < UCLASS_COUNT; id++) {
-			struct uclass *uc;
-
-			uc = uclass_find(id);
-			if (!uc)
-				continue;
-			ut_assertok(uclass_destroy(uc));
-		}
-
-		end = mallinfo();
-		ut_asserteq(start.uordblks, end.uordblks);
+		ut_assertok(dm_leak_check_end(dms));
 	}
 
 	return 0;
diff --git a/test/dm/test-main.c b/test/dm/test-main.c
index 94ce72a..90ca810 100644
--- a/test/dm/test-main.c
+++ b/test/dm/test-main.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <malloc.h>
 #include <dm/test.h>
 #include <dm/root.h>
 #include <dm/uclass-internal.h>
@@ -88,6 +89,7 @@ int dm_test_main(void)
 		printf("Test: %s\n", test->name);
 		ut_assertok(dm_test_init(dms));
 
+		dms->start = mallinfo();
 		if (test->flags & DM_TESTF_SCAN_PDATA)
 			ut_assertok(dm_scan_platdata(false));
 		if (test->flags & DM_TESTF_PROBE_TEST)
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 17/23] test: dm: Add additional GPIO tests
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (15 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 16/23] test: dm: Support memory leak checking as a core feature Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:53   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 18/23] dm: gpio: tegra: Drop request()/free() in the driver Simon Glass
                   ` (6 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Add tests for gpio_requestf() and for memory leaks.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 doc/driver-model/README.txt |  5 ++++-
 test/dm/gpio.c              | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index f4395c1..0278dda 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -95,7 +95,7 @@ are provided in test/dm. To run them, try:
 You should see something like this:
 
     <...U-Boot banner...>
-    Running 27 driver model tests
+    Running 29 driver model tests
     Test: dm_test_autobind
     Test: dm_test_autoprobe
     Test: dm_test_bus_children
@@ -117,6 +117,9 @@ You should see something like this:
     Test: dm_test_gpio
     extra-gpios: get_value: error: gpio b5 not reserved
     Test: dm_test_gpio_anon
+    Test: dm_test_gpio_copy
+    Test: dm_test_gpio_leak
+    extra-gpios: get_value: error: gpio b5 not reserved
     Test: dm_test_gpio_requestf
     Test: dm_test_leak
     Test: dm_test_lifecycle
diff --git a/test/dm/gpio.c b/test/dm/gpio.c
index 5174ced..94bd0d9 100644
--- a/test/dm/gpio.c
+++ b/test/dm/gpio.c
@@ -7,11 +7,14 @@
 #include <common.h>
 #include <fdtdec.h>
 #include <dm.h>
+#include <dm/root.h>
 #include <dm/ut.h>
 #include <dm/test.h>
 #include <dm/util.h>
 #include <asm/gpio.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /* Test that sandbox GPIOs work correctly */
 static int dm_test_gpio(struct dm_test_state *dms)
 {
@@ -138,3 +141,38 @@ static int dm_test_gpio_requestf(struct dm_test_state *dms)
 	return 0;
 }
 DM_TEST(dm_test_gpio_requestf, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test that gpio_request() copies its string */
+static int dm_test_gpio_copy(struct dm_test_state *dms)
+{
+	unsigned int offset, gpio;
+	struct udevice *dev;
+	char buf[80], name[10];
+
+	ut_assertok(gpio_lookup_name("b6", &dev, &offset, &gpio));
+	strcpy(name, "odd_name");
+	ut_assertok(gpio_request(gpio, name));
+	sandbox_gpio_set_direction(dev, offset, 1);
+	sandbox_gpio_set_value(dev, offset, 1);
+	ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
+	ut_asserteq_str("b6: output: 1 [x] odd_name", buf);
+	strcpy(name, "nothing");
+	ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
+	ut_asserteq_str("b6: output: 1 [x] odd_name", buf);
+
+	return 0;
+}
+DM_TEST(dm_test_gpio_copy, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test that we don't leak memory with GPIOs */
+static int dm_test_gpio_leak(struct dm_test_state *dms)
+{
+	ut_assertok(dm_test_gpio(dms));
+	ut_assertok(dm_test_gpio_anon(dms));
+	ut_assertok(dm_test_gpio_requestf(dms));
+	ut_assertok(dm_leak_check_end(dms));
+
+	return 0;
+}
+
+DM_TEST(dm_test_gpio_leak, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 18/23] dm: gpio: tegra: Drop request()/free() in the driver
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (16 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 17/23] test: dm: Add additional GPIO tests Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:53   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 19/23] dm: gpio: omap3: " Simon Glass
                   ` (5 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Now that the uclass supports gpio_request/free() there is no need for the
driver to implement it too. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/tegra_gpio.c | 110 ----------------------------------------------
 1 file changed, 110 deletions(-)

diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c
index 1cc4abb..88f7ef5 100644
--- a/drivers/gpio/tegra_gpio.c
+++ b/drivers/gpio/tegra_gpio.c
@@ -39,7 +39,6 @@ struct tegra_gpio_platdata {
 
 /* Information about each port at run-time */
 struct tegra_port_info {
-	char label[TEGRA_GPIOS_PER_PORT][GPIO_NAME_SIZE];
 	struct gpio_ctlr_bank *bank;
 	int base_gpio;		/* Port number for this port (0, 1,.., n-1) */
 };
@@ -132,21 +131,6 @@ static void set_level(unsigned gpio, int high)
 	writel(u, &bank->gpio_out[GPIO_PORT(gpio)]);
 }
 
-static int check_reserved(struct udevice *dev, unsigned offset,
-			  const char *func)
-{
-	struct tegra_port_info *state = dev_get_priv(dev);
-	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
-
-	if (!*state->label[offset]) {
-		printf("tegra_gpio: %s: error: gpio %s%d not reserved\n",
-		       func, uc_priv->bank_name, offset);
-		return -EBUSY;
-	}
-
-	return 0;
-}
-
 /* set GPIO pin 'gpio' as an output, with polarity 'value' */
 int tegra_spl_gpio_direction_output(int gpio, int value)
 {
@@ -171,56 +155,16 @@ static int tegra_gpio_request(struct udevice *dev, unsigned offset,
 {
 	struct tegra_port_info *state = dev_get_priv(dev);
 
-	if (*state->label[offset])
-		return -EBUSY;
-
-	strncpy(state->label[offset], label, GPIO_NAME_SIZE);
-	state->label[offset][GPIO_NAME_SIZE - 1] = '\0';
-
 	/* Configure as a GPIO */
 	set_config(state->base_gpio + offset, 1);
 
 	return 0;
 }
 
-static int tegra_gpio_free(struct udevice *dev, unsigned offset)
-{
-	struct tegra_port_info *state = dev_get_priv(dev);
-	int ret;
-
-	ret = check_reserved(dev, offset, __func__);
-	if (ret)
-		return ret;
-	state->label[offset][0] = '\0';
-
-	return 0;
-}
-
-/* read GPIO OUT value of pin 'gpio' */
-static int tegra_gpio_get_output_value(unsigned gpio)
-{
-	struct gpio_ctlr *ctlr = (struct gpio_ctlr *)NV_PA_GPIO_BASE;
-	struct gpio_ctlr_bank *bank = &ctlr->gpio_bank[GPIO_BANK(gpio)];
-	int val;
-
-	debug("gpio_get_output_value: pin = %d (port %d:bit %d)\n",
-		gpio, GPIO_FULLPORT(gpio), GPIO_BIT(gpio));
-
-	val = readl(&bank->gpio_out[GPIO_PORT(gpio)]);
-
-	return (val >> GPIO_BIT(gpio)) & 1;
-}
-
-
 /* set GPIO pin 'gpio' as an input */
 static int tegra_gpio_direction_input(struct udevice *dev, unsigned offset)
 {
 	struct tegra_port_info *state = dev_get_priv(dev);
-	int ret;
-
-	ret = check_reserved(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	/* Configure GPIO direction as input. */
 	set_direction(state->base_gpio + offset, 0);
@@ -234,11 +178,6 @@ static int tegra_gpio_direction_output(struct udevice *dev, unsigned offset,
 {
 	struct tegra_port_info *state = dev_get_priv(dev);
 	int gpio = state->base_gpio + offset;
-	int ret;
-
-	ret = check_reserved(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	/* Configure GPIO output value. */
 	set_level(gpio, value);
@@ -254,13 +193,8 @@ static int tegra_gpio_get_value(struct udevice *dev, unsigned offset)
 {
 	struct tegra_port_info *state = dev_get_priv(dev);
 	int gpio = state->base_gpio + offset;
-	int ret;
 	int val;
 
-	ret = check_reserved(dev, offset, __func__);
-	if (ret)
-		return ret;
-
 	debug("%s: pin = %d (port %d:bit %d)\n", __func__,
 	      gpio, GPIO_FULLPORT(gpio), GPIO_BIT(gpio));
 
@@ -274,11 +208,6 @@ static int tegra_gpio_set_value(struct udevice *dev, unsigned offset, int value)
 {
 	struct tegra_port_info *state = dev_get_priv(dev);
 	int gpio = state->base_gpio + offset;
-	int ret;
-
-	ret = check_reserved(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	debug("gpio_set_value: pin = %d (port %d:bit %d), value = %d\n",
 	      gpio, GPIO_FULLPORT(gpio), GPIO_BIT(gpio), value);
@@ -314,8 +243,6 @@ static int tegra_gpio_get_function(struct udevice *dev, unsigned offset)
 	struct tegra_port_info *state = dev_get_priv(dev);
 	int gpio = state->base_gpio + offset;
 
-	if (!*state->label[offset])
-		return GPIOF_UNUSED;
 	if (!get_config(gpio))
 		return GPIOF_FUNC;
 	else if (get_direction(gpio))
@@ -324,50 +251,13 @@ static int tegra_gpio_get_function(struct udevice *dev, unsigned offset)
 		return GPIOF_INPUT;
 }
 
-static int tegra_gpio_get_state(struct udevice *dev, unsigned int offset,
-				char *buf, int bufsize)
-{
-	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
-	struct tegra_port_info *state = dev_get_priv(dev);
-	int gpio = state->base_gpio + offset;
-	const char *label;
-	int is_output;
-	int is_gpio;
-	int size;
-
-	label = state->label[offset];
-	is_gpio = get_config(gpio); /* GPIO, not SFPIO */
-	size = snprintf(buf, bufsize, "%s%d: ",
-			uc_priv->bank_name ? uc_priv->bank_name : "", offset);
-	buf += size;
-	bufsize -= size;
-	if (is_gpio) {
-		is_output = get_direction(gpio);
-
-		snprintf(buf, bufsize, "%s: %d [%c]%s%s",
-			 is_output ? "out" : " in",
-			 is_output ?
-				tegra_gpio_get_output_value(gpio) :
-				tegra_gpio_get_value(dev, offset),
-			 *label ? 'x' : ' ',
-			 *label ? " " : "",
-			 label);
-	} else {
-		snprintf(buf, bufsize, "sfpio");
-	}
-
-	return 0;
-}
-
 static const struct dm_gpio_ops gpio_tegra_ops = {
 	.request		= tegra_gpio_request,
-	.free			= tegra_gpio_free,
 	.direction_input	= tegra_gpio_direction_input,
 	.direction_output	= tegra_gpio_direction_output,
 	.get_value		= tegra_gpio_get_value,
 	.set_value		= tegra_gpio_set_value,
 	.get_function		= tegra_gpio_get_function,
-	.get_state		= tegra_gpio_get_state,
 };
 
 /**
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 19/23] dm: gpio: omap3: Drop request()/free() in the driver
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (17 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 18/23] dm: gpio: tegra: Drop request()/free() in the driver Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:53   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 20/23] dm: gpio: rpi_b: " Simon Glass
                   ` (4 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Now that the uclass supports gpio_request/free() there is no need for the
driver to implement it too. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/omap_gpio.c | 116 +----------------------------------------------
 1 file changed, 1 insertion(+), 115 deletions(-)

diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
index a4651bc..f3a7ccb 100644
--- a/drivers/gpio/omap_gpio.c
+++ b/drivers/gpio/omap_gpio.c
@@ -29,11 +29,9 @@
 
 #ifdef CONFIG_DM_GPIO
 
-#define GPIO_NAME_SIZE			20
 #define GPIO_PER_BANK			32
 
 struct gpio_bank {
-	char label[GPIO_PER_BANK][GPIO_NAME_SIZE];
 	/* TODO(sjg at chromium.org): Can we use a struct here? */
 	void *base;	/* address of registers in physical memory */
 	enum gpio_method method;
@@ -246,47 +244,10 @@ int gpio_free(unsigned gpio)
 
 #else /* new driver model interface CONFIG_DM_GPIO */
 
-/**
- * gpio_is_requested() - check if a GPIO has been requested
- *
- * @bank:	Bank to check
- * @offset:	GPIO offset within bank to check
- * @return true if marked as requested, false if not
- */
-static inline bool gpio_is_requested(struct gpio_bank *bank, int offset)
-{
-	return *bank->label[offset] != '\0';
-}
-
-static int omap_gpio_is_output(struct gpio_bank *bank, int offset)
-{
-	return _get_gpio_direction(bank, offset) == OMAP_GPIO_DIR_OUT;
-}
-
-static int check_requested(struct udevice *dev, unsigned offset,
-			   const char *func)
-{
-	struct gpio_bank *bank = dev_get_priv(dev);
-	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
-
-	if (!gpio_is_requested(bank, offset)) {
-		printf("omap_gpio: %s: error: gpio %s%d not requested\n",
-		       func, uc_priv->bank_name, offset);
-		return -EPERM;
-	}
-
-	return 0;
-}
-
 /* set GPIO pin 'gpio' as an input */
 static int omap_gpio_direction_input(struct udevice *dev, unsigned offset)
 {
 	struct gpio_bank *bank = dev_get_priv(dev);
-	int ret;
-
-	ret = check_requested(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	/* Configure GPIO direction as input. */
 	_set_gpio_direction(bank, offset, 1);
@@ -299,11 +260,6 @@ static int omap_gpio_direction_output(struct udevice *dev, unsigned offset,
 				       int value)
 {
 	struct gpio_bank *bank = dev_get_priv(dev);
-	int ret;
-
-	ret = check_requested(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	_set_gpio_dataout(bank, offset, value);
 	_set_gpio_direction(bank, offset, 0);
@@ -315,11 +271,6 @@ static int omap_gpio_direction_output(struct udevice *dev, unsigned offset,
 static int omap_gpio_get_value(struct udevice *dev, unsigned offset)
 {
 	struct gpio_bank *bank = dev_get_priv(dev);
-	int ret;
-
-	ret = check_requested(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	return _get_gpio_value(bank, offset);
 }
@@ -329,94 +280,29 @@ static int omap_gpio_set_value(struct udevice *dev, unsigned offset,
 				 int value)
 {
 	struct gpio_bank *bank = dev_get_priv(dev);
-	int ret;
-
-	ret = check_requested(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	_set_gpio_dataout(bank, offset, value);
 
 	return 0;
 }
 
-static int omap_gpio_get_state(struct udevice *dev, unsigned int offset,
-			      char *buf, int bufsize)
-{
-	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
-	struct gpio_bank *bank = dev_get_priv(dev);
-	const char *label;
-	bool requested;
-	bool is_output;
-	int size;
-
-	label = bank->label[offset];
-	is_output = omap_gpio_is_output(bank->base, offset);
-	size = snprintf(buf, bufsize, "%s%d: ",
-			uc_priv->bank_name ? uc_priv->bank_name : "", offset);
-	buf += size;
-	bufsize -= size;
-	requested = gpio_is_requested(bank, offset);
-	snprintf(buf, bufsize, "%s: %d [%c]%s%s",
-		 is_output ? "out" : " in",
-		 _get_gpio_value(bank, offset),
-		 requested ? 'x' : ' ',
-		 requested ? " " : "",
-		 label);
-
-	return 0;
-}
-
-static int omap_gpio_request(struct udevice *dev, unsigned offset,
-			      const char *label)
-{
-	struct gpio_bank *bank = dev_get_priv(dev);
-
-	if (gpio_is_requested(bank, offset))
-		return -EBUSY;
-
-	strncpy(bank->label[offset], label, GPIO_NAME_SIZE);
-	bank->label[offset][GPIO_NAME_SIZE - 1] = '\0';
-
-	return 0;
-}
-
-static int omap_gpio_free(struct udevice *dev, unsigned offset)
-{
-	struct gpio_bank *bank = dev_get_priv(dev);
-	int ret;
-
-	ret = check_requested(dev, offset, __func__);
-	if (ret)
-		return ret;
-	bank->label[offset][0] = '\0';
-
-	return 0;
-}
-
 static int omap_gpio_get_function(struct udevice *dev, unsigned offset)
 {
 	struct gpio_bank *bank = dev_get_priv(dev);
 
-	if (!gpio_is_requested(bank, offset))
-		return GPIOF_UNUSED;
-
 	/* GPIOF_FUNC is not implemented yet */
-	if (_get_gpio_direction(bank->base, offset))
+	if (_get_gpio_direction(bank->base, offset) == OMAP_GPIO_DIR_OUT)
 		return GPIOF_OUTPUT;
 	else
 		return GPIOF_INPUT;
 }
 
 static const struct dm_gpio_ops gpio_omap_ops = {
-	.request		= omap_gpio_request,
-	.free			= omap_gpio_free,
 	.direction_input	= omap_gpio_direction_input,
 	.direction_output	= omap_gpio_direction_output,
 	.get_value		= omap_gpio_get_value,
 	.set_value		= omap_gpio_set_value,
 	.get_function		= omap_gpio_get_function,
-	.get_state		= omap_gpio_get_state,
 };
 
 static int omap_gpio_probe(struct udevice *dev)
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 20/23] dm: gpio: rpi_b: Drop request()/free() in the driver
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (18 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 19/23] dm: gpio: omap3: " Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:53   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 21/23] dm: gpio: exynos: " Simon Glass
                   ` (3 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Now that the uclass supports gpio_request/free() there is no need for the
driver to implement it too. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/bcm2835_gpio.c | 89 ---------------------------------------------
 1 file changed, 89 deletions(-)

diff --git a/drivers/gpio/bcm2835_gpio.c b/drivers/gpio/bcm2835_gpio.c
index 332cfc2..0244c01 100644
--- a/drivers/gpio/bcm2835_gpio.c
+++ b/drivers/gpio/bcm2835_gpio.c
@@ -11,67 +11,10 @@
 #include <asm/gpio.h>
 #include <asm/io.h>
 
-#define GPIO_NAME_SIZE		20
-
 struct bcm2835_gpios {
-	char label[BCM2835_GPIO_COUNT][GPIO_NAME_SIZE];
 	struct bcm2835_gpio_regs *reg;
 };
 
-/**
- * gpio_is_requested() - check if a GPIO has been requested
- *
- * @bank:	Bank to check
- * @offset:	GPIO offset within bank to check
- * @return true if marked as requested, false if not
- */
-static inline bool gpio_is_requested(struct bcm2835_gpios *gpios, int offset)
-{
-	return *gpios->label[offset] != '\0';
-}
-
-static int check_requested(struct udevice *dev, unsigned offset,
-			   const char *func)
-{
-	struct bcm2835_gpios *gpios = dev_get_priv(dev);
-	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
-
-	if (!gpio_is_requested(gpios, offset)) {
-		printf("omap_gpio: %s: error: gpio %s%d not requested\n",
-		       func, uc_priv->bank_name, offset);
-		return -EPERM;
-	}
-
-	return 0;
-}
-
-static int bcm2835_gpio_request(struct udevice *dev, unsigned offset,
-				const char *label)
-{
-	struct bcm2835_gpios *gpios = dev_get_priv(dev);
-
-	if (gpio_is_requested(gpios, offset))
-		return -EBUSY;
-
-	strncpy(gpios->label[offset], label, GPIO_NAME_SIZE);
-	gpios->label[offset][GPIO_NAME_SIZE - 1] = '\0';
-
-	return 0;
-}
-
-static int bcm2835_gpio_free(struct udevice *dev, unsigned offset)
-{
-	struct bcm2835_gpios *gpios = dev_get_priv(dev);
-	int ret;
-
-	ret = check_requested(dev, offset, __func__);
-	if (ret)
-		return ret;
-	gpios->label[offset][0] = '\0';
-
-	return 0;
-}
-
 static int bcm2835_gpio_direction_input(struct udevice *dev, unsigned gpio)
 {
 	struct bcm2835_gpios *gpios = dev_get_priv(dev);
@@ -142,9 +85,6 @@ static int bcm2835_gpio_get_function(struct udevice *dev, unsigned offset)
 {
 	struct bcm2835_gpios *gpios = dev_get_priv(dev);
 
-	if (!gpio_is_requested(gpios, offset))
-		return GPIOF_UNUSED;
-
 	/* GPIOF_FUNC is not implemented yet */
 	if (bcm2835_gpio_is_output(gpios, offset))
 		return GPIOF_OUTPUT;
@@ -152,42 +92,13 @@ static int bcm2835_gpio_get_function(struct udevice *dev, unsigned offset)
 		return GPIOF_INPUT;
 }
 
-static int bcm2835_gpio_get_state(struct udevice *dev, unsigned int offset,
-				  char *buf, int bufsize)
-{
-	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
-	struct bcm2835_gpios *gpios = dev_get_priv(dev);
-	const char *label;
-	bool requested;
-	bool is_output;
-	int size;
-
-	label = gpios->label[offset];
-	is_output = bcm2835_gpio_is_output(gpios, offset);
-	size = snprintf(buf, bufsize, "%s%d: ",
-			uc_priv->bank_name ? uc_priv->bank_name : "", offset);
-	buf += size;
-	bufsize -= size;
-	requested = gpio_is_requested(gpios, offset);
-	snprintf(buf, bufsize, "%s: %d [%c]%s%s",
-		 is_output ? "out" : " in",
-		 bcm2835_get_value(gpios, offset),
-		 requested ? 'x' : ' ',
-		 requested ? " " : "",
-		 label);
-
-	return 0;
-}
 
 static const struct dm_gpio_ops gpio_bcm2835_ops = {
-	.request		= bcm2835_gpio_request,
-	.free			= bcm2835_gpio_free,
 	.direction_input	= bcm2835_gpio_direction_input,
 	.direction_output	= bcm2835_gpio_direction_output,
 	.get_value		= bcm2835_gpio_get_value,
 	.set_value		= bcm2835_gpio_set_value,
 	.get_function		= bcm2835_gpio_get_function,
-	.get_state		= bcm2835_gpio_get_state,
 };
 
 static int bcm2835_gpio_probe(struct udevice *dev)
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 21/23] dm: gpio: exynos: Drop request()/free() in the driver
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (19 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 20/23] dm: gpio: rpi_b: " Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:53   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 22/23] dm: gpio: imx: " Simon Glass
                   ` (2 subsequent siblings)
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Now that the uclass supports gpio_request/free() there is no need for the
driver to implement it too. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/s5p_gpio.c | 101 ------------------------------------------------
 1 file changed, 101 deletions(-)

diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index 13d74eb..6c41a42 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -33,8 +33,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define RATE_MASK(gpio)		(0x1 << (gpio + 16))
 #define RATE_SET(gpio)			(0x1 << (gpio + 16))
 
-#define GPIO_NAME_SIZE			20
-
 /* Platform data for each bank */
 struct exynos_gpio_platdata {
 	struct s5p_gpio_bank *bank;
@@ -43,7 +41,6 @@ struct exynos_gpio_platdata {
 
 /* Information about each bank@run-time */
 struct exynos_bank_info {
-	char label[GPIO_PER_BANK][GPIO_NAME_SIZE];
 	struct s5p_gpio_bank *bank;
 };
 
@@ -189,61 +186,10 @@ int s5p_gpio_get_pin(unsigned gpio)
 
 /* Driver model interface */
 #ifndef CONFIG_SPL_BUILD
-static int exynos_gpio_get_state(struct udevice *dev, unsigned int offset,
-				char *buf, int bufsize)
-{
-	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
-	struct exynos_bank_info *state = dev_get_priv(dev);
-	const char *label;
-	bool is_output;
-	int size;
-	int cfg;
-
-	label = state->label[offset];
-	cfg = s5p_gpio_get_cfg_pin(state->bank, offset);
-	is_output = cfg == S5P_GPIO_OUTPUT;
-	size = snprintf(buf, bufsize, "%s%d: ",
-			uc_priv->bank_name ? uc_priv->bank_name : "", offset);
-	buf += size;
-	bufsize -= size;
-	if (is_output || cfg == S5P_GPIO_INPUT) {
-		snprintf(buf, bufsize, "%s: %d [%c]%s%s",
-			 is_output ? "out" : " in",
-			 s5p_gpio_get_value(state->bank, offset),
-			 *label ? 'x' : ' ',
-			 *label ? " " : "",
-			 label);
-	} else {
-		snprintf(buf, bufsize, "sfpio");
-	}
-
-	return 0;
-}
-
-static int check_reserved(struct udevice *dev, unsigned offset,
-			  const char *func)
-{
-	struct exynos_bank_info *state = dev_get_priv(dev);
-	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
-
-	if (!*state->label[offset]) {
-		printf("exynos_gpio: %s: error: gpio %s%d not reserved\n",
-		       func, uc_priv->bank_name, offset);
-		return -EPERM;
-	}
-
-	return 0;
-}
-
 /* set GPIO pin 'gpio' as an input */
 static int exynos_gpio_direction_input(struct udevice *dev, unsigned offset)
 {
 	struct exynos_bank_info *state = dev_get_priv(dev);
-	int ret;
-
-	ret = check_reserved(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	/* Configure GPIO direction as input. */
 	s5p_gpio_cfg_pin(state->bank, offset, S5P_GPIO_INPUT);
@@ -256,11 +202,6 @@ static int exynos_gpio_direction_output(struct udevice *dev, unsigned offset,
 				       int value)
 {
 	struct exynos_bank_info *state = dev_get_priv(dev);
-	int ret;
-
-	ret = check_reserved(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	/* Configure GPIO output value. */
 	s5p_gpio_set_value(state->bank, offset, value);
@@ -275,11 +216,6 @@ static int exynos_gpio_direction_output(struct udevice *dev, unsigned offset,
 static int exynos_gpio_get_value(struct udevice *dev, unsigned offset)
 {
 	struct exynos_bank_info *state = dev_get_priv(dev);
-	int ret;
-
-	ret = check_reserved(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	return s5p_gpio_get_value(state->bank, offset);
 }
@@ -289,43 +225,11 @@ static int exynos_gpio_set_value(struct udevice *dev, unsigned offset,
 				 int value)
 {
 	struct exynos_bank_info *state = dev_get_priv(dev);
-	int ret;
-
-	ret = check_reserved(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	s5p_gpio_set_value(state->bank, offset, value);
 
 	return 0;
 }
-
-static int exynos_gpio_request(struct udevice *dev, unsigned offset,
-			      const char *label)
-{
-	struct exynos_bank_info *state = dev_get_priv(dev);
-
-	if (*state->label[offset])
-		return -EBUSY;
-
-	strncpy(state->label[offset], label, GPIO_NAME_SIZE);
-	state->label[offset][GPIO_NAME_SIZE - 1] = '\0';
-
-	return 0;
-}
-
-static int exynos_gpio_free(struct udevice *dev, unsigned offset)
-{
-	struct exynos_bank_info *state = dev_get_priv(dev);
-	int ret;
-
-	ret = check_reserved(dev, offset, __func__);
-	if (ret)
-		return ret;
-	state->label[offset][0] = '\0';
-
-	return 0;
-}
 #endif /* nCONFIG_SPL_BUILD */
 
 /*
@@ -362,8 +266,6 @@ static int exynos_gpio_get_function(struct udevice *dev, unsigned offset)
 	struct exynos_bank_info *state = dev_get_priv(dev);
 	int cfg;
 
-	if (!*state->label[offset])
-		return GPIOF_UNUSED;
 	cfg = s5p_gpio_get_cfg_pin(state->bank, offset);
 	if (cfg == S5P_GPIO_OUTPUT)
 		return GPIOF_OUTPUT;
@@ -374,14 +276,11 @@ static int exynos_gpio_get_function(struct udevice *dev, unsigned offset)
 }
 
 static const struct dm_gpio_ops gpio_exynos_ops = {
-	.request		= exynos_gpio_request,
-	.free			= exynos_gpio_free,
 	.direction_input	= exynos_gpio_direction_input,
 	.direction_output	= exynos_gpio_direction_output,
 	.get_value		= exynos_gpio_get_value,
 	.set_value		= exynos_gpio_set_value,
 	.get_function		= exynos_gpio_get_function,
-	.get_state		= exynos_gpio_get_state,
 };
 
 static int gpio_exynos_probe(struct udevice *dev)
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 22/23] dm: gpio: imx: Drop request()/free() in the driver
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (20 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 21/23] dm: gpio: exynos: " Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:53   ` Simon Glass
  2014-10-04 17:29 ` [U-Boot] [PATCH 23/23] dm: gpio: Remove unused get_state() uclass method Simon Glass
  2014-10-08 19:27 ` [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

Now that the uclass supports gpio_request/free() there is no need for the
driver to implement it too. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/mxc_gpio.c | 116 ------------------------------------------------
 1 file changed, 116 deletions(-)

diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index 3f7b7d2..8bb9e39 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -20,7 +20,6 @@ enum mxc_gpio_direction {
 	MXC_GPIO_DIRECTION_OUT,
 };
 
-#define GPIO_NAME_SIZE			20
 #define GPIO_PER_BANK			32
 
 struct mxc_gpio_plat {
@@ -28,7 +27,6 @@ struct mxc_gpio_plat {
 };
 
 struct mxc_bank_info {
-	char label[GPIO_PER_BANK][GPIO_NAME_SIZE];
 	struct gpio_regs *regs;
 };
 
@@ -152,18 +150,6 @@ int gpio_direction_output(unsigned gpio, int value)
 #endif
 
 #ifdef CONFIG_DM_GPIO
-/**
- * gpio_is_requested() - check if a GPIO has been requested
- *
- * @bank:	Bank to check
- * @offset:	GPIO offset within bank to check
- * @return true if marked as requested, false if not
- */
-static inline bool gpio_is_requested(struct mxc_bank_info *bank, int offset)
-{
-	return *bank->label[offset] != '\0';
-}
-
 static int mxc_gpio_is_output(struct gpio_regs *regs, int offset)
 {
 	u32 val;
@@ -208,35 +194,10 @@ static int mxc_gpio_bank_get_value(struct gpio_regs *regs, int offset)
 	return (readl(&regs->gpio_psr) >> offset) & 0x01;
 }
 
-static int mxc_gpio_bank_get_output_value(struct gpio_regs *regs, int offset)
-{
-	return (readl(&regs->gpio_dr) >> offset) & 0x01;
-}
-
-static int check_requested(struct udevice *dev, unsigned offset,
-			   const char *func)
-{
-	struct mxc_bank_info *bank = dev_get_priv(dev);
-	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
-
-	if (!gpio_is_requested(bank, offset)) {
-		printf("mxc_gpio: %s: error: gpio %s%d not requested\n",
-		       func, uc_priv->bank_name, offset);
-		return -EPERM;
-	}
-
-	return 0;
-}
-
 /* set GPIO pin 'gpio' as an input */
 static int mxc_gpio_direction_input(struct udevice *dev, unsigned offset)
 {
 	struct mxc_bank_info *bank = dev_get_priv(dev);
-	int ret;
-
-	ret = check_requested(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	/* Configure GPIO direction as input. */
 	mxc_gpio_bank_direction(bank->regs, offset, MXC_GPIO_DIRECTION_IN);
@@ -249,11 +210,6 @@ static int mxc_gpio_direction_output(struct udevice *dev, unsigned offset,
 				       int value)
 {
 	struct mxc_bank_info *bank = dev_get_priv(dev);
-	int ret;
-
-	ret = check_requested(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	/* Configure GPIO output value. */
 	mxc_gpio_bank_set_value(bank->regs, offset, value);
@@ -268,11 +224,6 @@ static int mxc_gpio_direction_output(struct udevice *dev, unsigned offset,
 static int mxc_gpio_get_value(struct udevice *dev, unsigned offset)
 {
 	struct mxc_bank_info *bank = dev_get_priv(dev);
-	int ret;
-
-	ret = check_requested(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	return mxc_gpio_bank_get_value(bank->regs, offset);
 }
@@ -282,80 +233,16 @@ static int mxc_gpio_set_value(struct udevice *dev, unsigned offset,
 				 int value)
 {
 	struct mxc_bank_info *bank = dev_get_priv(dev);
-	int ret;
-
-	ret = check_requested(dev, offset, __func__);
-	if (ret)
-		return ret;
 
 	mxc_gpio_bank_set_value(bank->regs, offset, value);
 
 	return 0;
 }
 
-static int mxc_gpio_get_state(struct udevice *dev, unsigned int offset,
-			      char *buf, int bufsize)
-{
-	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
-	struct mxc_bank_info *bank = dev_get_priv(dev);
-	const char *label;
-	bool requested;
-	bool is_output;
-	int size;
-
-	label = bank->label[offset];
-	is_output = mxc_gpio_is_output(bank->regs, offset);
-	size = snprintf(buf, bufsize, "%s%d: ",
-			uc_priv->bank_name ? uc_priv->bank_name : "", offset);
-	buf += size;
-	bufsize -= size;
-	requested = gpio_is_requested(bank, offset);
-	snprintf(buf, bufsize, "%s: %d [%c]%s%s",
-		 is_output ? "out" : " in",
-		 is_output ?
-			mxc_gpio_bank_get_output_value(bank->regs, offset) :
-			mxc_gpio_bank_get_value(bank->regs, offset),
-		 requested ? 'x' : ' ',
-		 requested ? " " : "",
-		 label);
-
-	return 0;
-}
-
-static int mxc_gpio_request(struct udevice *dev, unsigned offset,
-			      const char *label)
-{
-	struct mxc_bank_info *bank = dev_get_priv(dev);
-
-	if (gpio_is_requested(bank, offset))
-		return -EBUSY;
-
-	strncpy(bank->label[offset], label, GPIO_NAME_SIZE);
-	bank->label[offset][GPIO_NAME_SIZE - 1] = '\0';
-
-	return 0;
-}
-
-static int mxc_gpio_free(struct udevice *dev, unsigned offset)
-{
-	struct mxc_bank_info *bank = dev_get_priv(dev);
-	int ret;
-
-	ret = check_requested(dev, offset, __func__);
-	if (ret)
-		return ret;
-	bank->label[offset][0] = '\0';
-
-	return 0;
-}
-
 static int mxc_gpio_get_function(struct udevice *dev, unsigned offset)
 {
 	struct mxc_bank_info *bank = dev_get_priv(dev);
 
-	if (!gpio_is_requested(bank, offset))
-		return GPIOF_UNUSED;
-
 	/* GPIOF_FUNC is not implemented yet */
 	if (mxc_gpio_is_output(bank->regs, offset))
 		return GPIOF_OUTPUT;
@@ -364,14 +251,11 @@ static int mxc_gpio_get_function(struct udevice *dev, unsigned offset)
 }
 
 static const struct dm_gpio_ops gpio_mxc_ops = {
-	.request		= mxc_gpio_request,
-	.free			= mxc_gpio_free,
 	.direction_input	= mxc_gpio_direction_input,
 	.direction_output	= mxc_gpio_direction_output,
 	.get_value		= mxc_gpio_get_value,
 	.set_value		= mxc_gpio_set_value,
 	.get_function		= mxc_gpio_get_function,
-	.get_state		= mxc_gpio_get_state,
 };
 
 static const struct mxc_gpio_plat mxc_plat[] = {
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 23/23] dm: gpio: Remove unused get_state() uclass method
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (21 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 22/23] dm: gpio: imx: " Simon Glass
@ 2014-10-04 17:29 ` Simon Glass
  2014-10-24  3:53   ` Simon Glass
  2014-10-08 19:27 ` [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-04 17:29 UTC (permalink / raw)
  To: u-boot

This is no longer used so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 include/asm-generic/gpio.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 2a32c93..0cfbd46 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -198,8 +198,6 @@ struct dm_gpio_ops {
 	 * @return current function - GPIOF_...
 	 */
 	int (*get_function)(struct udevice *dev, unsigned offset);
-	int (*get_state)(struct udevice *dev, unsigned offset, char *state,
-			 int maxlen);
 };
 
 /**
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 06/23] dm: sunxi: Modify the GPIO driver to support driver model
  2014-10-04 17:29 ` [U-Boot] [PATCH 06/23] dm: sunxi: Modify the GPIO driver to support driver model Simon Glass
@ 2014-10-05  2:07   ` Chen-Yu Tsai
  0 siblings, 0 replies; 48+ messages in thread
From: Chen-Yu Tsai @ 2014-10-05  2:07 UTC (permalink / raw)
  To: u-boot

Hi,

On Sun, Oct 5, 2014 at 1:29 AM, Simon Glass <sjg@chromium.org> wrote:
> This adds driver model support to the sunxi GPIO driver, using the device
> tree to trigger binding of the driver. The driver will still operate
> without driver model too.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/gpio/sunxi_gpio.c | 170 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/configs/sun7i.h   |   1 +
>  2 files changed, 171 insertions(+)
>
> diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c
> index 0c50a8f..f633c04 100644
> --- a/drivers/gpio/sunxi_gpio.c
> +++ b/drivers/gpio/sunxi_gpio.c
> @@ -11,9 +11,25 @@
>   */
>
>  #include <common.h>
> +#include <dm.h>
> +#include <errno.h>
> +#include <fdtdec.h>
> +#include <malloc.h>
>  #include <asm/io.h>
>  #include <asm/gpio.h>
> +#include <dm/device-internal.h>
>
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +#define SUNXI_GPIOS_PER_PORT   SUNXI_GPIO_A_NR
> +
> +struct sunxi_gpio_platdata {
> +       struct sunxi_gpio *regs;
> +       const char *bank_name;  /* Name of port, e.g. "B" */
> +       int gpio_count;
> +};
> +
> +#ifndef CONFIG_DM_GPIO
>  static int sunxi_gpio_output(u32 pin, u32 val)
>  {
>         u32 dat;
> @@ -100,3 +116,157 @@ int sunxi_name_to_gpio(const char *name)
>                 return -1;
>         return group * 32 + pin;
>  }
> +#endif
> +
> +#ifdef CONFIG_DM_GPIO
> +static int sunxi_gpio_direction_input(struct udevice *dev, unsigned offset)
> +{
> +       struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
> +
> +       sunxi_gpio_set_cfgbank(plat->regs, offset, SUNXI_GPIO_INPUT);
> +
> +       return 0;
> +}
> +
> +static int sunxi_gpio_direction_output(struct udevice *dev, unsigned offset,
> +                                      int value)
> +{
> +       struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
> +       u32 num = GPIO_NUM(offset);
> +
> +       sunxi_gpio_set_cfgbank(plat->regs, offset, SUNXI_GPIO_OUTPUT);
> +       clrsetbits_le32(&plat->regs->dat, 1 << num, value ? (1 << num) : 0);
> +
> +       return 0;
> +}
> +
> +static int sunxi_gpio_get_value(struct udevice *dev, unsigned offset)
> +{
> +       struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
> +       u32 num = GPIO_NUM(offset);
> +       unsigned dat;
> +
> +       dat = readl(&plat->regs->dat);
> +       dat >>= num;
> +
> +       return dat & 0x1;
> +}
> +
> +static int sunxi_gpio_set_value(struct udevice *dev, unsigned offset,
> +                               int value)
> +{
> +       struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
> +       u32 num = GPIO_NUM(offset);
> +
> +       clrsetbits_le32(&plat->regs->dat, 1 << num, value ? (1 << num) : 0);
> +       return 0;
> +}
> +
> +static int sunxi_gpio_get_function(struct udevice *dev, unsigned offset)
> +{
> +       struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
> +       int func;
> +
> +       func = sunxi_gpio_get_cfgbank(plat->regs, offset);
> +       if (func == SUNXI_GPIO_OUTPUT)
> +               return GPIOF_OUTPUT;
> +       else if (func == SUNXI_GPIO_INPUT)
> +               return GPIOF_INPUT;
> +       else
> +               return GPIOF_FUNC;
> +}
> +
> +static const struct dm_gpio_ops gpio_sunxi_ops = {
> +       .direction_input        = sunxi_gpio_direction_input,
> +       .direction_output       = sunxi_gpio_direction_output,
> +       .get_value              = sunxi_gpio_get_value,
> +       .set_value              = sunxi_gpio_set_value,
> +       .get_function           = sunxi_gpio_get_function,
> +};
> +
> +/**
> + * Returns the name of a GPIO bank
> + *
> + * GPIO banks are named A, B, C, ...
> + *
> + * @bank:      Bank number (0, 1..n-1)
> + * @return allocated string containing the name
> + */
> +static char *gpio_bank_name(int bank)
> +{
> +       char *name;
> +
> +       name = malloc(2);
> +       if (name) {
> +               name[0] = 'A' + bank;
> +               name[1] = '\0';
> +       }
> +
> +       return name;
> +}
> +
> +static int gpio_sunxi_probe(struct udevice *dev)
> +{
> +       struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
> +       struct gpio_dev_priv *uc_priv = dev->uclass_priv;
> +
> +       /* Tell the uclass how many GPIOs we have */
> +       if (plat) {
> +               uc_priv->gpio_count = plat->gpio_count;
> +               uc_priv->bank_name = plat->bank_name;
> +       }
> +
> +       return 0;
> +}
> +/**
> + * We have a top-level GPIO device with no actual GPIOs. It has a child
> + * device for each Tegra port.

Might we get rid of references to Tegra?

> + */
> +static int gpio_sunxi_bind(struct udevice *parent)
> +{
> +       struct sunxi_gpio_platdata *plat = parent->platdata;
> +       struct sunxi_gpio_reg *ctlr;
> +       int bank;
> +       int ret;
> +
> +       /* If this is a child device, there is nothing to do here */
> +       if (plat)
> +               return 0;
> +
> +       ctlr = (struct sunxi_gpio_reg *)fdtdec_get_addr(gd->fdt_blob,
> +                                                  parent->of_offset, "reg");
> +       for (bank = 0; bank < SUNXI_GPIO_BANKS; bank++) {
> +               struct sunxi_gpio_platdata *plat;
> +               struct udevice *dev;
> +
> +               plat = calloc(1, sizeof(*plat));
> +               if (!plat)
> +                       return -ENOMEM;
> +               plat->regs = &ctlr->gpio_bank[bank];
> +               plat->bank_name = gpio_bank_name(bank);
> +               plat->gpio_count = SUNXI_GPIOS_PER_PORT;
> +
> +               ret = device_bind(parent, parent->driver,
> +                                       plat->bank_name, plat, -1, &dev);
> +               if (ret)
> +                       return ret;
> +               dev->of_offset = parent->of_offset;
> +       }
> +
> +       return 0;
> +}
> +
> +static const struct udevice_id exynos_gpio_ids[] = {

And Exynos?

> +       { .compatible = "allwinner,sun7i-a20-pinctrl" },
> +       { }
> +};
> +
> +U_BOOT_DRIVER(gpio_sunxi) = {
> +       .name   = "gpio_sunxi",
> +       .id     = UCLASS_GPIO,
> +       .ops    = &gpio_sunxi_ops,
> +       .of_match = exynos_gpio_ids,
> +       .bind   = gpio_sunxi_bind,
> +       .probe  = gpio_sunxi_probe,
> +};
> +#endif
> diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h
> index 500d0e3..2314e97 100644
> --- a/include/configs/sun7i.h
> +++ b/include/configs/sun7i.h
> @@ -38,6 +38,7 @@
>
>  #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM)
>  # define CONFIG_CMD_DM
> +# define CONFIG_DM_GPIO
>  #endif
>
>  /*
> --


ChenYu

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 07/23] dm: sunxi: Add support for serial using driver model
  2014-10-04 17:29 ` [U-Boot] [PATCH 07/23] dm: sunxi: Add support for serial using " Simon Glass
@ 2014-10-05 14:50   ` Chen-Yu Tsai
  0 siblings, 0 replies; 48+ messages in thread
From: Chen-Yu Tsai @ 2014-10-05 14:50 UTC (permalink / raw)
  To: u-boot

Hi,

On Sun, Oct 5, 2014 at 1:29 AM, Simon Glass <sjg@chromium.org> wrote:
> Add a driver for the designware serial UART used on sunxi. This just
> redirects to the normal ns16550 driver.
>
> Add a stdout-path to the device tree so that the correct UART is chosen.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/arm/dts/sun7i-a20-pcduino3.dts |  4 ++++
>  drivers/serial/Makefile             |  1 +
>  drivers/serial/serial_dw.c          | 39 +++++++++++++++++++++++++++++++++++++

This should probably be 2 or more patches.
The first one adds the serial driver.
The second one adds a user.
And maybe a third to add "stdout-path"?

ChenYu

>  include/configs/sun7i.h             |  3 +++
>  include/configs/sunxi-common.h      | 12 +++++++-----
>  5 files changed, 54 insertions(+), 5 deletions(-)
>  create mode 100644 drivers/serial/serial_dw.c
>
> diff --git a/arch/arm/dts/sun7i-a20-pcduino3.dts b/arch/arm/dts/sun7i-a20-pcduino3.dts
> index 046dfc0..f7cc8e7 100644
> --- a/arch/arm/dts/sun7i-a20-pcduino3.dts
> +++ b/arch/arm/dts/sun7i-a20-pcduino3.dts
> @@ -20,6 +20,10 @@
>         model = "LinkSprite pcDuino3";
>         compatible = "linksprite,pcduino3", "allwinner,sun7i-a20";
>
> +       chosen {
> +               stdout-path = &uart0;
> +       };
> +
>         soc at 01c00000 {
>                 mmc0: mmc at 01c0f000 {
>                         pinctrl-names = "default";
> diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
> index edf6936..f57a664 100644
> --- a/drivers/serial/Makefile
> +++ b/drivers/serial/Makefile
> @@ -19,6 +19,7 @@ obj-$(CONFIG_ALTERA_UART) += altera_uart.o
>  obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o
>  obj-$(CONFIG_ARM_DCC) += arm_dcc.o
>  obj-$(CONFIG_ATMEL_USART) += atmel_usart.o
> +obj-$(CONFIG_DW_SERIAL) += serial_dw.o
>  obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o
>  obj-$(CONFIG_MCFUART) += mcfuart.o
>  obj-$(CONFIG_OPENCORES_YANU) += opencores_yanu.o
> diff --git a/drivers/serial/serial_dw.c b/drivers/serial/serial_dw.c
> new file mode 100644
> index 0000000..a348f29
> --- /dev/null
> +++ b/drivers/serial/serial_dw.c
> @@ -0,0 +1,39 @@
> +/*
> + * Copyright (c) 2014 Google, Inc
> + *
> + * SPDX-License-Identifier:    GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <dm.h>
> +#include <ns16550.h>
> +#include <serial.h>
> +
> +static const struct udevice_id dw_serial_ids[] = {
> +       { .compatible = "snps,dw-apb-uart" },
> +       { }
> +};
> +
> +static int dw_serial_ofdata_to_platdata(struct udevice *dev)
> +{
> +       struct ns16550_platdata *plat = dev_get_platdata(dev);
> +       int ret;
> +
> +       ret = ns16550_serial_ofdata_to_platdata(dev);
> +       if (ret)
> +               return ret;
> +       plat->clock = CONFIG_SYS_NS16550_CLK;
> +
> +       return 0;
> +}
> +
> +U_BOOT_DRIVER(serial_ns16550) = {
> +       .name   = "serial_dw",
> +       .id     = UCLASS_SERIAL,
> +       .of_match = dw_serial_ids,
> +       .ofdata_to_platdata = dw_serial_ofdata_to_platdata,
> +       .platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
> +       .priv_auto_alloc_size = sizeof(struct NS16550),
> +       .probe = ns16550_serial_probe,
> +       .ops    = &ns16550_serial_ops,
> +};
> diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h
> index 2314e97..108694a 100644
> --- a/include/configs/sun7i.h
> +++ b/include/configs/sun7i.h
> @@ -39,6 +39,9 @@
>  #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM)
>  # define CONFIG_CMD_DM
>  # define CONFIG_DM_GPIO
> +# define CONFIG_DM_SERIAL
> +# define CONFIG_SYS_MALLOC_F_LEN       (1 << 10)
> +# define CONFIG_DW_SERIAL
>  #endif
>
>  /*
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index 1d947d7..e26bdf9 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -36,12 +36,14 @@
>  #define CONFIG_SYS_NS16550
>  #define CONFIG_SYS_NS16550_SERIAL
>  /* ns16550 reg in the low bits of cpu reg */
> -#define CONFIG_SYS_NS16550_REG_SIZE    -4
>  #define CONFIG_SYS_NS16550_CLK         24000000
> -#define CONFIG_SYS_NS16550_COM1                SUNXI_UART0_BASE
> -#define CONFIG_SYS_NS16550_COM2                SUNXI_UART1_BASE
> -#define CONFIG_SYS_NS16550_COM3                SUNXI_UART2_BASE
> -#define CONFIG_SYS_NS16550_COM4                SUNXI_UART3_BASE
> +#ifndef CONFIG_DM_SERIAL
> +# define CONFIG_SYS_NS16550_REG_SIZE   -4
> +# define CONFIG_SYS_NS16550_COM1               SUNXI_UART0_BASE
> +# define CONFIG_SYS_NS16550_COM2               SUNXI_UART1_BASE
> +# define CONFIG_SYS_NS16550_COM3               SUNXI_UART2_BASE
> +# define CONFIG_SYS_NS16550_COM4               SUNXI_UART3_BASE
> +#endif
>
>  /* DRAM Base */
>  #define CONFIG_SYS_SDRAM_BASE          0x40000000
> --
> 2.1.0.rc2.206.gedb03e5
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi
  2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
                   ` (22 preceding siblings ...)
  2014-10-04 17:29 ` [U-Boot] [PATCH 23/23] dm: gpio: Remove unused get_state() uclass method Simon Glass
@ 2014-10-08 19:27 ` Simon Glass
  2014-10-09  7:59   ` Ian Campbell
  23 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-08 19:27 UTC (permalink / raw)
  To: u-boot

Hi,

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:

> This series adds driver model support for serial and GPIO for sunxi. Since
> I only have a sun7i board to test with, I have added a new config for the
> pcDuino3, which uses device tree and driver model. This should make it
> fairly easy to enable for the other boards at some point.
>
> Now that we have about 5 GPIO drivers it is clear that the request()/free()
> logic should be in the uclass rather than the driver. So far drivers don't
> have to do anything in those methods except adjust pin configuration.
> Patches are included to make this change, including removing the redundant
> code in the various GPIO drivers. The sunxi driver works the same way.
>
> So far at least GPIO drivers don't tend to have anything special to report
> for the 'gpio status' command. Partly this is because we only support a
> simple concept of GPIOs so far (no drive strength, function selection,
> etc.) but even if this were to be supported it would be better to handle
> it generically where possible. So the get_state() call can be replaced with
> a generic one in the uclass. This can be implemented with the existing
> uclass interface: get_function() to find out if the pin is set as an input,
> output or not a GPIO, and get_value() to find its value.
>
> As a result, it is safe to remove the get_state() method, and this series
> does that also.
>
> This series is available at u-boot-dm/sunix-working.
>

Any more comments on this series please? I have a few nits so could respin.

Regards,
Simon

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi
  2014-10-08 19:27 ` [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
@ 2014-10-09  7:59   ` Ian Campbell
  2014-10-09  8:13     ` Hans de Goede
  0 siblings, 1 reply; 48+ messages in thread
From: Ian Campbell @ 2014-10-09  7:59 UTC (permalink / raw)
  To: u-boot

On Wed, 2014-10-08 at 13:27 -0600, Simon Glass wrote:

> Any more comments on this series please? I have a few nits so could
> respin.

I'm afraid I'm unlikely to get to look at this before the w/e. It looks
like the majority of the series isn't actually about sunxi though?

Without having looked at the specifics I can say I'm broadly in favour
of moving towards Device Model / Device Tree.

Ian.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi
  2014-10-09  7:59   ` Ian Campbell
@ 2014-10-09  8:13     ` Hans de Goede
  2014-10-10  3:44       ` Simon Glass
  0 siblings, 1 reply; 48+ messages in thread
From: Hans de Goede @ 2014-10-09  8:13 UTC (permalink / raw)
  To: u-boot

Hi,

On 10/09/2014 09:59 AM, Ian Campbell wrote:
> On Wed, 2014-10-08 at 13:27 -0600, Simon Glass wrote:
> 
>> Any more comments on this series please? I have a few nits so could
>> respin.
> 
> I'm afraid I'm unlikely to get to look at this before the w/e. It looks
> like the majority of the series isn't actually about sunxi though?

Right, could v2 please be split into a generic series and a sunxi series
on top of that, so that Ian and I can focus on reviewing the sunxi bits,
and the wider community can hopefully review the generic bits ?

> Without having looked at the specifics I can say I'm broadly in favour
> of moving towards Device Model / Device Tree.

Ack.

Regards,

Hans

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi
  2014-10-09  8:13     ` Hans de Goede
@ 2014-10-10  3:44       ` Simon Glass
  2014-10-23 19:20         ` Simon Glass
  0 siblings, 1 reply; 48+ messages in thread
From: Simon Glass @ 2014-10-10  3:44 UTC (permalink / raw)
  To: u-boot

HI Hans,

On 9 October 2014 02:13, Hans de Goede <hdegoede@redhat.com> wrote:
> Hi,
>
> On 10/09/2014 09:59 AM, Ian Campbell wrote:
>> On Wed, 2014-10-08 at 13:27 -0600, Simon Glass wrote:
>>
>>> Any more comments on this series please? I have a few nits so could
>>> respin.
>>
>> I'm afraid I'm unlikely to get to look at this before the w/e. It looks
>> like the majority of the series isn't actually about sunxi though?
>
> Right, could v2 please be split into a generic series and a sunxi series
> on top of that, so that Ian and I can focus on reviewing the sunxi bits,
> and the wider community can hopefully review the generic bits ?

Yes I can split it - there are an unusual number of additional patches
as sunxi was the point at which I finally decided to change the
uclass.

>
>> Without having looked at the specifics I can say I'm broadly in favour
>> of moving towards Device Model / Device Tree.
>
> Ack.

OK good. I think there will be benefits, even if they are thin on the
ground with just these two drivers.

Regards,
Simon

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 03/23] dm: core: Add support for simple-bus
  2014-10-04 17:29 ` [U-Boot] [PATCH 03/23] dm: core: Add support for simple-bus Simon Glass
@ 2014-10-23  3:06   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-23  3:06 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Add a driver for the simple-bus nodes, which allows devices within these
> nodes to be bound.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/core/Makefile     |  1 +
>  drivers/core/simple-bus.c | 33 +++++++++++++++++++++++++++++++++
>  include/dm/uclass-id.h    |  1 +
>  3 files changed, 35 insertions(+)
>  create mode 100644 drivers/core/simple-bus.c
>

Applied to u-boot-dm/master.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi
  2014-10-10  3:44       ` Simon Glass
@ 2014-10-23 19:20         ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-23 19:20 UTC (permalink / raw)
  To: u-boot

Hi,

On 9 October 2014 21:44, Simon Glass <sjg@chromium.org> wrote:
> HI Hans,
>
> On 9 October 2014 02:13, Hans de Goede <hdegoede@redhat.com> wrote:
>> Hi,
>>
>> On 10/09/2014 09:59 AM, Ian Campbell wrote:
>>> On Wed, 2014-10-08 at 13:27 -0600, Simon Glass wrote:
>>>
>>>> Any more comments on this series please? I have a few nits so could
>>>> respin.
>>>
>>> I'm afraid I'm unlikely to get to look at this before the w/e. It looks
>>> like the majority of the series isn't actually about sunxi though?
>>
>> Right, could v2 please be split into a generic series and a sunxi series
>> on top of that, so that Ian and I can focus on reviewing the sunxi bits,
>> and the wider community can hopefully review the generic bits ?
>
> Yes I can split it - there are an unusual number of additional patches
> as sunxi was the point at which I finally decided to change the
> uclass.
>
>>
>>> Without having looked at the specifics I can say I'm broadly in favour
>>> of moving towards Device Model / Device Tree.
>>
>> Ack.
>
> OK good. I think there will be benefits, even if they are thin on the
> ground with just these two drivers.

I'm going to apply the non-sunxi patches to dm/master soon - please
let me know if there are any comments. For sunxi I have sent v2 for
review.

Regards,
Simon

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 08/23] dm: gpio: Implement GPIO reservation in the uclass
  2014-10-04 17:29 ` [U-Boot] [PATCH 08/23] dm: gpio: Implement GPIO reservation in the uclass Simon Glass
@ 2014-10-24  3:52   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:52 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> We have several GPIO drivers now and all are doing similar things to record
> which GPIOs are reserved.
>
> Move this logic into the uclass to make the drivers similar.
>
> We retain the request()/free() methods since currently one driver does use
> these for setting up the pin.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/gpio/gpio-uclass.c | 92 +++++++++++++++++++++++++++++++++++++++-------
>  include/asm-generic/gpio.h |  6 +++
>  2 files changed, 84 insertions(+), 14 deletions(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 09/23] dm: gpio: Add gpio_get_function() and friends
  2014-10-04 17:29 ` [U-Boot] [PATCH 09/23] dm: gpio: Add gpio_get_function() and friends Simon Glass
@ 2014-10-24  3:52   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:52 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Add helpers to the uclass to allow finding out the pin function.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/gpio/gpio-uclass.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/asm-generic/gpio.h | 34 ++++++++++++++++++++++++++++++++-
>  2 files changed, 80 insertions(+), 1 deletion(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 10/23] dm: Move the function for getting GPIO status into the uclass
  2014-10-04 17:29 ` [U-Boot] [PATCH 10/23] dm: Move the function for getting GPIO status into the uclass Simon Glass
@ 2014-10-24  3:52   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:52 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> This function can be more easily tested if it is in the uclass.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  common/cmd_gpio.c          | 57 +++++++++++++++++-----------------------------
>  drivers/gpio/gpio-uclass.c | 39 +++++++++++++++++++++++++++++++
>  include/asm-generic/gpio.h | 18 +++++++++++++++
>  3 files changed, 78 insertions(+), 36 deletions(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 11/23] dm: gpio: sandbox: Implement the get_function() method
  2014-10-04 17:29 ` [U-Boot] [PATCH 11/23] dm: gpio: sandbox: Implement the get_function() method Simon Glass
@ 2014-10-24  3:52   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:52 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Implement this method so that the 'gpio' command can do its job correctly.
> For sandbox we only support input and output states for a gpio.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/gpio/sandbox.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 12/23] dm: gpio: sandbox: Implement the remove() method
  2014-10-04 17:29 ` [U-Boot] [PATCH 12/23] dm: gpio: sandbox: Implement the remove() method Simon Glass
@ 2014-10-24  3:52   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:52 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> This method frees memory so we must make sure to implement it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/gpio/sandbox.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 13/23] dm: gpio: sandbox: Drop request()/free() in the driver
  2014-10-04 17:29 ` [U-Boot] [PATCH 13/23] dm: gpio: sandbox: Drop request()/free() in the driver Simon Glass
@ 2014-10-24  3:53   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:53 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Now that the uclass supports gpio_request/free() there is no need for the
> driver to implement it too. Drop this unnecessary code.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/gpio/sandbox.c | 82 --------------------------------------------------
>  1 file changed, 82 deletions(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 14/23] test: dm: Update GPIO tests for new gpio_request() method
  2014-10-04 17:29 ` [U-Boot] [PATCH 14/23] test: dm: Update GPIO tests for new gpio_request() method Simon Glass
@ 2014-10-24  3:53   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:53 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Now that gpio_request() is handled by the uclass, updates the tests
> accordingly.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  doc/driver-model/README.txt | 25 +++++++++++++++++++--
>  test/dm/gpio.c              | 55 +++++++++++++++++++++++++++------------------
>  2 files changed, 56 insertions(+), 24 deletions(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 15/23] dm: gpio: Add gpio_requestf() helper for printf() strings
  2014-10-04 17:29 ` [U-Boot] [PATCH 15/23] dm: gpio: Add gpio_requestf() helper for printf() strings Simon Glass
@ 2014-10-24  3:53   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:53 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Add a helper which permits a printf()-style format string for the requester
> string.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  doc/driver-model/README.txt |  3 ++-
>  drivers/gpio/gpio-uclass.c  | 21 +++++++++++++++++++++
>  include/asm-generic/gpio.h  | 10 ++++++++++
>  test/dm/gpio.c              | 18 ++++++++++++++++++
>  4 files changed, 51 insertions(+), 1 deletion(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 16/23] test: dm: Support memory leak checking as a core feature
  2014-10-04 17:29 ` [U-Boot] [PATCH 16/23] test: dm: Support memory leak checking as a core feature Simon Glass
@ 2014-10-24  3:53   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:53 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Check the state of the malloc() heap before each test is run, so that tests
> can verify that all is well at the end. Provide helper functions to mark
> the heap and to check that it returns to its initial state.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  include/dm/test.h   | 23 +++++++++++++++++++++++
>  test/dm/core.c      | 46 ++++++++++++++++++++++++++++++----------------
>  test/dm/test-main.c |  2 ++
>  3 files changed, 55 insertions(+), 16 deletions(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 17/23] test: dm: Add additional GPIO tests
  2014-10-04 17:29 ` [U-Boot] [PATCH 17/23] test: dm: Add additional GPIO tests Simon Glass
@ 2014-10-24  3:53   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:53 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Add tests for gpio_requestf() and for memory leaks.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  doc/driver-model/README.txt |  5 ++++-
>  test/dm/gpio.c              | 38 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 42 insertions(+), 1 deletion(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 18/23] dm: gpio: tegra: Drop request()/free() in the driver
  2014-10-04 17:29 ` [U-Boot] [PATCH 18/23] dm: gpio: tegra: Drop request()/free() in the driver Simon Glass
@ 2014-10-24  3:53   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:53 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Now that the uclass supports gpio_request/free() there is no need for the
> driver to implement it too. Drop this unnecessary code.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/gpio/tegra_gpio.c | 110 ----------------------------------------------
>  1 file changed, 110 deletions(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 19/23] dm: gpio: omap3: Drop request()/free() in the driver
  2014-10-04 17:29 ` [U-Boot] [PATCH 19/23] dm: gpio: omap3: " Simon Glass
@ 2014-10-24  3:53   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:53 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Now that the uclass supports gpio_request/free() there is no need for the
> driver to implement it too. Drop this unnecessary code.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/gpio/omap_gpio.c | 116 +----------------------------------------------
>  1 file changed, 1 insertion(+), 115 deletions(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 20/23] dm: gpio: rpi_b: Drop request()/free() in the driver
  2014-10-04 17:29 ` [U-Boot] [PATCH 20/23] dm: gpio: rpi_b: " Simon Glass
@ 2014-10-24  3:53   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:53 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Now that the uclass supports gpio_request/free() there is no need for the
> driver to implement it too. Drop this unnecessary code.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/gpio/bcm2835_gpio.c | 89 ---------------------------------------------
>  1 file changed, 89 deletions(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 21/23] dm: gpio: exynos: Drop request()/free() in the driver
  2014-10-04 17:29 ` [U-Boot] [PATCH 21/23] dm: gpio: exynos: " Simon Glass
@ 2014-10-24  3:53   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:53 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Now that the uclass supports gpio_request/free() there is no need for the
> driver to implement it too. Drop this unnecessary code.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/gpio/s5p_gpio.c | 101 ------------------------------------------------
>  1 file changed, 101 deletions(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 22/23] dm: gpio: imx: Drop request()/free() in the driver
  2014-10-04 17:29 ` [U-Boot] [PATCH 22/23] dm: gpio: imx: " Simon Glass
@ 2014-10-24  3:53   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:53 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> Now that the uclass supports gpio_request/free() there is no need for the
> driver to implement it too. Drop this unnecessary code.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/gpio/mxc_gpio.c | 116 ------------------------------------------------
>  1 file changed, 116 deletions(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [U-Boot] [PATCH 23/23] dm: gpio: Remove unused get_state() uclass method
  2014-10-04 17:29 ` [U-Boot] [PATCH 23/23] dm: gpio: Remove unused get_state() uclass method Simon Glass
@ 2014-10-24  3:53   ` Simon Glass
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Glass @ 2014-10-24  3:53 UTC (permalink / raw)
  To: u-boot

On 4 October 2014 11:29, Simon Glass <sjg@chromium.org> wrote:
> This is no longer used so drop it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  include/asm-generic/gpio.h | 2 --
>  1 file changed, 2 deletions(-)

Applied to u-boot-dm/master

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2014-10-24  3:53 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-04 17:29 [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 01/23] dm: sunxi: dts: Add sun7i device tree files Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 02/23] dm: sunxi: Add a new config for an FDT-based pcDuino3 Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 03/23] dm: core: Add support for simple-bus Simon Glass
2014-10-23  3:06   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 04/23] dm: sunxi: Add pinmux functions which take a bank parameter Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 05/23] dm: sunxi: Make sure that GPIOs are requested Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 06/23] dm: sunxi: Modify the GPIO driver to support driver model Simon Glass
2014-10-05  2:07   ` Chen-Yu Tsai
2014-10-04 17:29 ` [U-Boot] [PATCH 07/23] dm: sunxi: Add support for serial using " Simon Glass
2014-10-05 14:50   ` Chen-Yu Tsai
2014-10-04 17:29 ` [U-Boot] [PATCH 08/23] dm: gpio: Implement GPIO reservation in the uclass Simon Glass
2014-10-24  3:52   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 09/23] dm: gpio: Add gpio_get_function() and friends Simon Glass
2014-10-24  3:52   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 10/23] dm: Move the function for getting GPIO status into the uclass Simon Glass
2014-10-24  3:52   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 11/23] dm: gpio: sandbox: Implement the get_function() method Simon Glass
2014-10-24  3:52   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 12/23] dm: gpio: sandbox: Implement the remove() method Simon Glass
2014-10-24  3:52   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 13/23] dm: gpio: sandbox: Drop request()/free() in the driver Simon Glass
2014-10-24  3:53   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 14/23] test: dm: Update GPIO tests for new gpio_request() method Simon Glass
2014-10-24  3:53   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 15/23] dm: gpio: Add gpio_requestf() helper for printf() strings Simon Glass
2014-10-24  3:53   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 16/23] test: dm: Support memory leak checking as a core feature Simon Glass
2014-10-24  3:53   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 17/23] test: dm: Add additional GPIO tests Simon Glass
2014-10-24  3:53   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 18/23] dm: gpio: tegra: Drop request()/free() in the driver Simon Glass
2014-10-24  3:53   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 19/23] dm: gpio: omap3: " Simon Glass
2014-10-24  3:53   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 20/23] dm: gpio: rpi_b: " Simon Glass
2014-10-24  3:53   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 21/23] dm: gpio: exynos: " Simon Glass
2014-10-24  3:53   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 22/23] dm: gpio: imx: " Simon Glass
2014-10-24  3:53   ` Simon Glass
2014-10-04 17:29 ` [U-Boot] [PATCH 23/23] dm: gpio: Remove unused get_state() uclass method Simon Glass
2014-10-24  3:53   ` Simon Glass
2014-10-08 19:27 ` [U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi Simon Glass
2014-10-09  7:59   ` Ian Campbell
2014-10-09  8:13     ` Hans de Goede
2014-10-10  3:44       ` Simon Glass
2014-10-23 19:20         ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox