Enable driver model for GPIOs on Tegra and Exynos
Subsystems (4)
v8 cover Enable driver model for GPIOs on Tegra and Exynos
(Note: Tegra patches have been applied, I am resending with exynos only)
Now that driver model is part of U-Boot, the task of converting drivers over to it begins. GPIO is one of the easiest to convert, since it already has a sandbox driver and a uclass driver.
The Tegra GPIO driver is relatively simple since it has a linear numbering and already uses the generic GPIO framework. Each GPIO bank has a separate device. Some arguments have been made that a single device should support all the GPIO banks, but currently the driver model uclass does not work that way and it would require a second-level data structure to handle the bank feature.
This driver has been tested on:
- Seaboard (Tegra 20)
- Beaver (Tegra 30)
- Jetson-TK1 (Tegra 124).
I don't have a Tegra 114 board (Dalmore seems to be the only one with U-Boot support) but I am quite confident that it works.
For exynos, the pinctrl device tree files are brought in from the kernel and cut down to remove the groupings which we don't yet use. Very small additions are made to avoid replicating the awful tables that Linux has for every exynos SoC. This series sits on top of the exynos refactors.
The 'gpio' command is updated to support display of only the allocated GPIOs. This is much more friendly than displaying a large table.
A few related clean-ups are provided as well.
This series is available at u-boot-dm.git, branch working.
Changes in v8:
- Adjust odroid device tree file to use #include instead of /include/
- Add missing special case reg property for exynos5420 GPX0
- Add patch containing pinctrl settings for s5p_goni
- Add patch containing pinctrl settings for s5p_goni
- Add new patch to move smdkc100 to generic board
- Add new patch to move s5p_goni to generic board
- Enable driver model for smdkc100 and s5p_goni separately
Changes in v7:
- Bring in patches from the SPI series to move post-reloc DM init earlier
Changes in v6:
- Fix typo in compatible string
- Remove exynos5420.dtsi which is not used in U-Boot
- Move U-Boot changes into their own file
- Use exynos54xx everywhere instead of exynos5420
Changes in v5:
- Put this patch before the others to avoid breaking bisectability
- Add additional gpio_request() calls for other samsung boards
- Use a mask instead of division in gpio_request() naming call
- Remove RFC label now that build errors are fixed
- Tidy up and update cover letter message
- Avoid reordering functions
Changes in v4:
- Add patches for exynos GPIO support
Simon Glass (12):
dm: exynos: dts: Convert /include/ to #include
dm: exynos: Bring in pinctrl dts files from Linux kernel
dm: exynos: dts: Remove unused pinctrl information to save space
dm: exynos: dts: Adjust device tree files for U-Boot
dm: exynos: Add pinctrl settings for smdkc100
dm: exynos: Add pinctrl settings for s5p_goni
dm: exynos: Move smdkc100 to generic board
dm: exynos: Move s5p_goni to generic board
dm: exynos: Tidy up GPIO headers
dm: exynos: Tidy up GPIO defines
dm: exynos: Make sure that GPIOs are requested
dm: exynos: gpio: Convert to driver model
arch/arm/cpu/armv7/exynos/pinmux.c | 5 +- arch/arm/dts/exynos4.dtsi | 9 +- arch/arm/dts/exynos4210-origen.dts | 4 +- arch/arm/dts/exynos4210-pinctrl-uboot.dtsi | 27 ++ arch/arm/dts/exynos4210-pinctrl.dtsi | 306 ++++++++++++++++++++ arch/arm/dts/exynos4210-smdkv310.dts | 2 +- arch/arm/dts/exynos4210-trats.dts | 2 +- arch/arm/dts/exynos4210-universal_c210.dts | 2 +- arch/arm/dts/exynos4210.dtsi | 155 ++++++++++ arch/arm/dts/exynos4412-odroid.dts | 2 +- arch/arm/dts/exynos4412-trats2.dts | 2 +- arch/arm/dts/exynos4412.dtsi | 38 +++ arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi | 46 +++ arch/arm/dts/exynos4x12-pinctrl.dtsi | 346 ++++++++++++++++++++++ arch/arm/dts/exynos4x12.dtsi | 114 ++++++++ arch/arm/dts/exynos5.dtsi | 56 +++- arch/arm/dts/exynos5250-pinctrl-uboot.dtsi | 40 +++ arch/arm/dts/exynos5250-pinctrl.dtsi | 333 ++++++++++++++++++++++ arch/arm/dts/exynos5250-smdk5250.dts | 2 +- arch/arm/dts/exynos5250-snow.dts | 2 +- arch/arm/dts/exynos5250.dtsi | 40 ++- arch/arm/dts/exynos5420-peach-pit.dts | 2 +- arch/arm/dts/exynos5420-smdk5420.dts | 2 +- arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi | 40 +++ arch/arm/dts/exynos54xx-pinctrl.dtsi | 305 ++++++++++++++++++++ arch/arm/dts/exynos54xx.dtsi | 44 ++- arch/arm/dts/s5pc100-pinctrl.dtsi | 180 ++++++++++++ arch/arm/dts/s5pc110-pinctrl.dtsi | 273 ++++++++++++++++++ arch/arm/dts/s5pc1xx-goni.dts | 7 + arch/arm/dts/s5pc1xx-smdkc100.dts | 7 + arch/arm/include/asm/arch-exynos/gpio.h | 5 - arch/arm/include/asm/arch-s5pc1xx/gpio.h | 4 - board/samsung/arndale/arndale.c | 4 +- board/samsung/common/board.c | 2 +- board/samsung/common/misc.c | 3 +- board/samsung/goni/goni.c | 4 +- board/samsung/origen/origen.c | 2 +- board/samsung/smdk5250/exynos5-dt.c | 7 + board/samsung/smdk5420/smdk5420.c | 6 +- board/samsung/smdkc100/smdkc100.c | 2 +- board/samsung/smdkv310/smdkv310.c | 2 +- board/samsung/trats/trats.c | 17 +- board/samsung/trats2/trats2.c | 27 +- board/samsung/universal_c210/universal.c | 4 +- drivers/gpio/s5p_gpio.c | 444 +++++++++++++++++++---------- drivers/mmc/s5p_sdhci.c | 7 +- include/configs/exynos-common.h | 4 + include/configs/s5p_goni.h | 5 + include/configs/smdkc100.h | 5 + 49 files changed, 2756 insertions(+), 191 deletions(-) create mode 100644 arch/arm/dts/exynos4210-pinctrl-uboot.dtsi create mode 100644 arch/arm/dts/exynos4210-pinctrl.dtsi create mode 100644 arch/arm/dts/exynos4210.dtsi create mode 100644 arch/arm/dts/exynos4412.dtsi create mode 100644 arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi create mode 100644 arch/arm/dts/exynos4x12-pinctrl.dtsi create mode 100644 arch/arm/dts/exynos4x12.dtsi create mode 100644 arch/arm/dts/exynos5250-pinctrl-uboot.dtsi create mode 100644 arch/arm/dts/exynos5250-pinctrl.dtsi create mode 100644 arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi create mode 100644 arch/arm/dts/exynos54xx-pinctrl.dtsi create mode 100644 arch/arm/dts/s5pc100-pinctrl.dtsi create mode 100644 arch/arm/dts/s5pc110-pinctrl.dtsi
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v8 1/12 dm: exynos: dts: Convert /include/ to #include
We should be consistent about this. The kernel has moved to #include which breaks error reporting to some extent but does allow us to include binding files.
---
Changes in v8:
- Adjust odroid device tree file to use #include instead of /include/
Changes in v7: None
Changes in v6: None
Changes in v5:
- Put this patch before the others to avoid breaking bisectability
Changes in v4: None
arch/arm/dts/exynos4.dtsi | 2 +- arch/arm/dts/exynos4210-origen.dts | 4 ++-- arch/arm/dts/exynos4210-smdkv310.dts | 2 +- arch/arm/dts/exynos4210-trats.dts | 2 +- arch/arm/dts/exynos4210-universal_c210.dts | 2 +- arch/arm/dts/exynos4412-odroid.dts | 2 +- arch/arm/dts/exynos4412-trats2.dts | 2 +- arch/arm/dts/exynos5.dtsi | 2 +- arch/arm/dts/exynos5250-smdk5250.dts | 2 +- arch/arm/dts/exynos5250-snow.dts | 2 +- arch/arm/dts/exynos5250.dtsi | 2 +- arch/arm/dts/exynos5420-peach-pit.dts | 2 +- arch/arm/dts/exynos5420-smdk5420.dts | 2 +- arch/arm/dts/exynos54xx.dtsi | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-)
arch/arm/dts/exynos4.dtsi +1 -1
@@ -7,7 +7,7 @@ * SPDX-License-Identifier: GPL-2.0+ */ -/include/ "skeleton.dtsi" +#include "skeleton.dtsi" / { serial at 13800000 {
arch/arm/dts/exynos4210-origen.dts +2 -2
@@ -8,8 +8,8 @@ */ /dts-v1/; -/include/ "skeleton.dtsi" -/include/ "exynos4.dtsi" +#include "skeleton.dtsi" +#include "exynos4.dtsi" / { model = "Insignal Origen evaluation board based on Exynos4210";
arch/arm/dts/exynos4210-smdkv310.dts +1 -1
@@ -7,7 +7,7 @@ */ /dts-v1/; -/include/ "exynos4.dtsi" +#include "exynos4.dtsi" / { model = "Samsung SMDKV310 on Exynos4210";
arch/arm/dts/exynos4210-trats.dts +1 -1
@@ -8,7 +8,7 @@ */ /dts-v1/; -/include/ "exynos4.dtsi" +#include "exynos4.dtsi" / { model = "Samsung Trats based on Exynos4210";
arch/arm/dts/exynos4210-universal_c210.dts +1 -1
@@ -8,7 +8,7 @@ */ /dts-v1/; -/include/ "exynos4.dtsi" +#include "exynos4.dtsi" / { model = "Samsung Universal C210 based on Exynos4210 rev0";
arch/arm/dts/exynos4412-odroid.dts +1 -1
@@ -8,7 +8,7 @@ */ /dts-v1/; -/include/ "exynos4.dtsi" +#include "exynos4.dtsi" / { model = "Odroid based on Exynos4412";
arch/arm/dts/exynos4412-trats2.dts +1 -1
@@ -8,7 +8,7 @@ */ /dts-v1/; -/include/ "exynos4.dtsi" +#include "exynos4.dtsi" / { model = "Samsung Trats2 based on Exynos4412";
arch/arm/dts/exynos5.dtsi +1 -1
@@ -5,7 +5,7 @@ * SPDX-License-Identifier: GPL-2.0+ */ -/include/ "skeleton.dtsi" +#include "skeleton.dtsi" / { compatible = "samsung,exynos5";
arch/arm/dts/exynos5250-smdk5250.dts +1 -1
@@ -10,7 +10,7 @@ */ /dts-v1/; -/include/ "exynos5250.dtsi" +#include "exynos5250.dtsi" / { model = "SAMSUNG SMDK5250 board based on EXYNOS5250";
arch/arm/dts/exynos5250-snow.dts +1 -1
@@ -10,7 +10,7 @@ */ /dts-v1/; -/include/ "exynos5250.dtsi" +#include "exynos5250.dtsi" / { model = "Google Snow";
arch/arm/dts/exynos5250.dtsi +1 -1
@@ -5,7 +5,7 @@ * SPDX-License-Identifier: GPL-2.0+ */ -/include/ "exynos5.dtsi" +#include "exynos5.dtsi" / { i2c at 12ca0000 {
arch/arm/dts/exynos5420-peach-pit.dts +1 -1
@@ -8,7 +8,7 @@ */ /dts-v1/; -/include/ "exynos54xx.dtsi" +#include "exynos54xx.dtsi" / { model = "Samsung/Google Peach Pit board based on Exynos5420";
arch/arm/dts/exynos5420-smdk5420.dts +1 -1
@@ -8,7 +8,7 @@ */ /dts-v1/; -/include/ "exynos54xx.dtsi" +#include "exynos54xx.dtsi" / { model = "SAMSUNG SMDK5420 board based on EXYNOS5420";
arch/arm/dts/exynos54xx.dtsi +1 -1
@@ -5,7 +5,7 @@ * SPDX-License-Identifier: GPL-2.0+ */ -/include/ "exynos5.dtsi" +#include "exynos5.dtsi" / { config {
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v8 2/12 dm: exynos: Bring in pinctrl dts files from Linux kernel
In reply to Simon GlassBring in required device tree files for pinctrl from Linux v3.14. These are initially unchanged and have a number of pieces not needed by U-Boot.
Note that exynos5420 is renamed to exynos54xx here since we want to support exynos5422 also.
---
Changes in v8: None
Changes in v7: None
Changes in v6:
- Fix typo in compatible string
- Remove exynos5420.dtsi which is not used in U-Boot
Changes in v5: None
Changes in v4: None
arch/arm/dts/exynos4.dtsi | 7 + arch/arm/dts/exynos4210-origen.dts | 2 +- arch/arm/dts/exynos4210-pinctrl.dtsi | 847 +++++++++++++++++++++++++ arch/arm/dts/exynos4210-trats.dts | 2 +- arch/arm/dts/exynos4210-universal_c210.dts | 2 +- arch/arm/dts/exynos4210.dtsi | 155 +++++ arch/arm/dts/exynos4412-trats2.dts | 2 +- arch/arm/dts/exynos4412.dtsi | 38 ++ arch/arm/dts/exynos4x12-pinctrl.dtsi | 956 +++++++++++++++++++++++++++++ arch/arm/dts/exynos4x12.dtsi | 214 +++++++ arch/arm/dts/exynos5.dtsi | 54 ++ arch/arm/dts/exynos5250-pinctrl.dtsi | 790 ++++++++++++++++++++++++ arch/arm/dts/exynos5250.dtsi | 38 ++ arch/arm/dts/exynos54xx-pinctrl.dtsi | 687 +++++++++++++++++++++ arch/arm/dts/exynos54xx.dtsi | 41 ++ 15 files changed, 3831 insertions(+), 4 deletions(-) create mode 100644 arch/arm/dts/exynos4210-pinctrl.dtsi create mode 100644 arch/arm/dts/exynos4210.dtsi create mode 100644 arch/arm/dts/exynos4412.dtsi create mode 100644 arch/arm/dts/exynos4x12-pinctrl.dtsi create mode 100644 arch/arm/dts/exynos4x12.dtsi create mode 100644 arch/arm/dts/exynos5250-pinctrl.dtsi create mode 100644 arch/arm/dts/exynos54xx-pinctrl.dtsi
arch/arm/dts/exynos4.dtsi +7 -0
@@ -10,6 +10,13 @@ #include "skeleton.dtsi" / { + combiner: interrupt-controller at 10440000 { + compatible = "samsung,exynos4210-combiner"; + #interrupt-cells = <2>; + interrupt-controller; + reg = <0x10440000 0x1000>; + }; + serial at 13800000 { compatible = "samsung,exynos4210-uart"; reg = <0x13800000 0x3c>;
arch/arm/dts/exynos4210-origen.dts +1 -1
@@ -9,7 +9,7 @@ /dts-v1/; #include "skeleton.dtsi" -#include "exynos4.dtsi" +#include "exynos4210.dtsi" / { model = "Insignal Origen evaluation board based on Exynos4210";
arch/arm/dts/exynos4210-pinctrl.dtsi new file +847 -0
847 lines not on this page · raw message
arch/arm/dts/exynos4210-trats.dts +1 -1
@@ -8,7 +8,7 @@ */ /dts-v1/; -#include "exynos4.dtsi" +#include "exynos4210.dtsi" / { model = "Samsung Trats based on Exynos4210";
arch/arm/dts/exynos4210-universal_c210.dts +1 -1
@@ -8,7 +8,7 @@ */ /dts-v1/; -#include "exynos4.dtsi" +#include "exynos4210.dtsi" / { model = "Samsung Universal C210 based on Exynos4210 rev0";
arch/arm/dts/exynos4210.dtsi new file +155 -0
155 lines not on this page · raw message
arch/arm/dts/exynos4412-trats2.dts +1 -1
@@ -8,7 +8,7 @@ */ /dts-v1/; -#include "exynos4.dtsi" +#include "exynos4412.dtsi" / { model = "Samsung Trats2 based on Exynos4412";
arch/arm/dts/exynos4412.dtsi new file +38 -0
@@ -0,0 +1,38 @@ +/* + * Samsung's Exynos4412 SoC device tree source + * + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * Samsung's Exynos4412 SoC device nodes are listed in this file. Exynos4412 + * based board files can include this file and provide values for board specfic + * bindings. + * + * Note: This file does not include device nodes for all the controllers in + * Exynos4412 SoC. As device tree coverage for Exynos4412 increases, additional + * nodes can be added to this file. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#include "exynos4x12.dtsi" + +/ { + compatible = "samsung,exynos4412"; + + gic: interrupt-controller at 10490000 { + cpu-offset = <0x4000>; + }; + + interrupt-controller at 10440000 { + samsung,combiner-nr = <20>; + interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>, + <0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>, + <0 8 0>, <0 9 0>, <0 10 0>, <0 11 0>, + <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>, + <0 107 0>, <0 108 0>, <0 48 0>, <0 42 0>; + }; + +};
arch/arm/dts/exynos4x12-pinctrl.dtsi new file +956 -0
956 lines not on this page · raw message
arch/arm/dts/exynos4x12.dtsi new file +214 -0
214 lines not on this page · raw message
arch/arm/dts/exynos5.dtsi +54 -0
66 lines not on this page · raw message
arch/arm/dts/exynos5250-pinctrl.dtsi new file +790 -0
679 lines not on this page · raw message
arch/arm/dts/exynos54xx-pinctrl.dtsi new file +687 -0
687 lines not on this page · raw message
arch/arm/dts/exynos54xx.dtsi +41 -0
41 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.0.rc2.206.gedb03e5
Part of the diff is not shown here. View the raw message.
PATCH v8 3/12 dm: exynos: dts: Remove unused pinctrl information to save space
In reply to Simon GlassWe don't include the pinctrl functions for U-Boot as they use up quite a bit of space and are not used.
We could instead perhaps eliminate this material with fdtgrep, but so far this tool has not made it to upstream.
---
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
arch/arm/dts/exynos4210-pinctrl.dtsi | 543 ------------------------------- arch/arm/dts/exynos4x12-pinctrl.dtsi | 612 ----------------------------------- arch/arm/dts/exynos4x12.dtsi | 100 ------ arch/arm/dts/exynos5250-pinctrl.dtsi | 459 -------------------------- arch/arm/dts/exynos54xx-pinctrl.dtsi | 384 ---------------------- 5 files changed, 2098 deletions(-)
arch/arm/dts/exynos4210-pinctrl.dtsi +0 -543
@@ -144,281 +144,6 @@ #interrupt-cells = <2>; }; - uart0_data: uart0-data { - samsung,pins = "gpa0-0", "gpa0-1"; - samsung,pin-function = <0x2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - uart0_fctl: uart0-fctl { - samsung,pins = "gpa0-2", "gpa0-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - uart1_data: uart1-data { - samsung,pins = "gpa0-4", "gpa0-5"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - uart1_fctl: uart1-fctl { - samsung,pins = "gpa0-6", "gpa0-7"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - i2c2_bus: i2c2-bus { - samsung,pins = "gpa0-6", "gpa0-7"; - samsung,pin-function = <3>; - samsung,pin-pud = <3>; - samsung,pin-drv = <0>; - }; - - uart2_data: uart2-data { - samsung,pins = "gpa1-0", "gpa1-1"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - uart2_fctl: uart2-fctl { - samsung,pins = "gpa1-2", "gpa1-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - uart_audio_a: uart-audio-a { - samsung,pins = "gpa1-0", "gpa1-1"; - samsung,pin-function = <4>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - i2c3_bus: i2c3-bus { - samsung,pins = "gpa1-2", "gpa1-3"; - samsung,pin-function = <3>; - samsung,pin-pud = <3>; - samsung,pin-drv = <0>; - }; - - uart3_data: uart3-data { - samsung,pins = "gpa1-4", "gpa1-5"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - uart_audio_b: uart-audio-b { - samsung,pins = "gpa1-4", "gpa1-5"; - samsung,pin-function = <4>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - spi0_bus: spi0-bus { - samsung,pins = "gpb-0", "gpb-2", "gpb-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <0>; - }; - - i2c4_bus: i2c4-bus { - samsung,pins = "gpb-2", "gpb-3"; - samsung,pin-function = <3>; - samsung,pin-pud = <3>; - samsung,pin-drv = <0>; - }; - - spi1_bus: spi1-bus { - samsung,pins = "gpb-4", "gpb-6", "gpb-7"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <0>; - }; - - i2c5_bus: i2c5-bus { - samsung,pins = "gpb-6", "gpb-7"; - samsung,pin-function = <3>; - samsung,pin-pud = <3>; - samsung,pin-drv = <0>; - }; - - i2s1_bus: i2s1-bus { - samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3", - "gpc0-4"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - pcm1_bus: pcm1-bus { - samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3", - "gpc0-4"; - samsung,pin-function = <3>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - ac97_bus: ac97-bus { - samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3", - "gpc0-4"; - samsung,pin-function = <4>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - i2s2_bus: i2s2-bus { - samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3", - "gpc1-4"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - pcm2_bus: pcm2-bus { - samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3", - "gpc1-4"; - samsung,pin-function = <3>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - spdif_bus: spdif-bus { - samsung,pins = "gpc1-0", "gpc1-1"; - samsung,pin-function = <4>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - i2c6_bus: i2c6-bus { - samsung,pins = "gpc1-3", "gpc1-4"; - samsung,pin-function = <4>; - samsung,pin-pud = <3>; - samsung,pin-drv = <0>; - }; - - spi2_bus: spi2-bus { - samsung,pins = "gpc1-1", "gpc1-2", "gpc1-3", "gpc1-4"; - samsung,pin-function = <5>; - samsung,pin-pud = <3>; - samsung,pin-drv = <0>; - }; - - i2c7_bus: i2c7-bus { - samsung,pins = "gpd0-2", "gpd0-3"; - samsung,pin-function = <3>; - samsung,pin-pud = <3>; - samsung,pin-drv = <0>; - }; - - i2c0_bus: i2c0-bus { - samsung,pins = "gpd1-0", "gpd1-1"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <0>; - }; - - i2c1_bus: i2c1-bus { - samsung,pins = "gpd1-2", "gpd1-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <0>; - }; - - pwm0_out: pwm0-out { - samsung,pins = "gpd0-0"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - pwm1_out: pwm1-out { - samsung,pins = "gpd0-1"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - pwm2_out: pwm2-out { - samsung,pins = "gpd0-2"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - pwm3_out: pwm3-out { - samsung,pins = "gpd0-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - lcd_ctrl: lcd-ctrl { - samsung,pins = "gpd0-0", "gpd0-1"; - samsung,pin-function = <3>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - lcd_sync: lcd-sync { - samsung,pins = "gpf0-0", "gpf0-1"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - lcd_en: lcd-en { - samsung,pins = "gpe3-4"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - lcd_clk: lcd-clk { - samsung,pins = "gpf0-0", "gpf0-1", "gpf0-2", "gpf0-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - lcd_data16: lcd-data-width16 { - samsung,pins = "gpf0-7", "gpf1-0", "gpf1-1", "gpf1-2", - "gpf1-3", "gpf1-6", "gpf1-7", "gpf2-0", - "gpf2-1", "gpf2-2", "gpf2-3", "gpf2-7", - "gpf3-0", "gpf3-1", "gpf3-2", "gpf3-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - lcd_data18: lcd-data-width18 { - samsung,pins = "gpf0-6", "gpf0-7", "gpf1-0", "gpf1-1", - "gpf1-2", "gpf1-3", "gpf1-6", "gpf1-7", - "gpf2-0", "gpf2-1", "gpf2-2", "gpf2-3", - "gpf2-6", "gpf2-7", "gpf3-0", "gpf3-1", - "gpf3-2", "gpf3-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - lcd_data24: lcd-data-width24 { - samsung,pins = "gpf0-4", "gpf0-5", "gpf0-6", "gpf0-7", - "gpf1-0", "gpf1-1", "gpf1-2", "gpf1-3", - "gpf1-4", "gpf1-5", "gpf1-6", "gpf1-7", - "gpf2-0", "gpf2-1", "gpf2-2", "gpf2-3", - "gpf2-4", "gpf2-5", "gpf2-6", "gpf2-7", - "gpf3-0", "gpf3-1", "gpf3-2", "gpf3-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; }; pinctrl at 11000000 {
@@ -567,259 +292,6 @@ #interrupt-cells = <2>; }; - sd0_clk: sd0-clk { - samsung,pins = "gpk0-0"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <3>; - }; - - sd0_cmd: sd0-cmd { - samsung,pins = "gpk0-1"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <3>; - }; - - sd0_cd: sd0-cd { - samsung,pins = "gpk0-2"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd0_bus1: sd0-bus-width1 { - samsung,pins = "gpk0-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd0_bus4: sd0-bus-width4 { - samsung,pins = "gpk0-3", "gpk0-4", "gpk0-5", "gpk0-6"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd0_bus8: sd0-bus-width8 { - samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6"; - samsung,pin-function = <3>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd4_clk: sd4-clk { - samsung,pins = "gpk0-0"; - samsung,pin-function = <3>; - samsung,pin-pud = <0>; - samsung,pin-drv = <3>; - }; - - sd4_cmd: sd4-cmd { - samsung,pins = "gpk0-1"; - samsung,pin-function = <3>; - samsung,pin-pud = <0>; - samsung,pin-drv = <3>; - }; - - sd4_cd: sd4-cd { - samsung,pins = "gpk0-2"; - samsung,pin-function = <3>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd4_bus1: sd4-bus-width1 { - samsung,pins = "gpk0-3"; - samsung,pin-function = <3>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd4_bus4: sd4-bus-width4 { - samsung,pins = "gpk0-3", "gpk0-4", "gpk0-5", "gpk0-6"; - samsung,pin-function = <3>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd4_bus8: sd4-bus-width8 { - samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6"; - samsung,pin-function = <3>; - samsung,pin-pud = <4>; - samsung,pin-drv = <3>; - }; - - sd1_clk: sd1-clk { - samsung,pins = "gpk1-0"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <3>; - }; - - sd1_cmd: sd1-cmd { - samsung,pins = "gpk1-1"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <3>; - }; - - sd1_cd: sd1-cd { - samsung,pins = "gpk1-2"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd1_bus1: sd1-bus-width1 { - samsung,pins = "gpk1-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd1_bus4: sd1-bus-width4 { - samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd2_clk: sd2-clk { - samsung,pins = "gpk2-0"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <3>; - }; - - sd2_cmd: sd2-cmd { - samsung,pins = "gpk2-1"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <3>; - }; - - sd2_cd: sd2-cd { - samsung,pins = "gpk2-2"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd2_bus1: sd2-bus-width1 { - samsung,pins = "gpk2-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd2_bus4: sd2-bus-width4 { - samsung,pins = "gpk2-3", "gpk2-4", "gpk2-5", "gpk2-6"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd2_bus8: sd2-bus-width8 { - samsung,pins = "gpk3-3", "gpk3-4", "gpk3-5", "gpk3-6"; - samsung,pin-function = <3>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd3_clk: sd3-clk { - samsung,pins = "gpk3-0"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <3>; - }; - - sd3_cmd: sd3-cmd { - samsung,pins = "gpk3-1"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <3>; - }; - - sd3_cd: sd3-cd { - samsung,pins = "gpk3-2"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd3_bus1: sd3-bus-width1 { - samsung,pins = "gpk3-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - sd3_bus4: sd3-bus-width4 { - samsung,pins = "gpk3-3", "gpk3-4", "gpk3-5", "gpk3-6"; - samsung,pin-function = <2>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; - - eint0: ext-int0 { - samsung,pins = "gpx0-0"; - samsung,pin-function = <0xf>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - eint8: ext-int8 { - samsung,pins = "gpx1-0"; - samsung,pin-function = <0xf>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - eint15: ext-int15 { - samsung,pins = "gpx1-7"; - samsung,pin-function = <0xf>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - eint16: ext-int16 { - samsung,pins = "gpx2-0"; - samsung,pin-function = <0xf>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - eint31: ext-int31 { - samsung,pins = "gpx3-7"; - samsung,pin-function = <0xf>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - cam_port_a_io: cam-port-a-io { - samsung,pins = "gpj0-0", "gpj0-1", "gpj0-2", "gpj0-3", - "gpj0-4", "gpj0-5", "gpj0-6", "gpj0-7", - "gpj1-0", "gpj1-1", "gpj1-2", "gpj1-4"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - cam_port_a_clk_active: cam-port-a-clk-active { - samsung,pins = "gpj1-3"; - samsung,pin-function = <2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <3>; - }; - - cam_port_a_clk_idle: cam-port-a-clk-idle { - samsung,pins = "gpj1-3"; - samsung,pin-function = <0>; - samsung,pin-pud = <1>; - samsung,pin-drv = <0>; - }; }; pinctrl at 03860000 {
@@ -828,20 +300,5 @@ #gpio-cells = <2>; }; - i2s0_bus: i2s0-bus { - samsung,pins = "gpz-0", "gpz-1", "gpz-2", "gpz-3", - "gpz-4", "gpz-5", "gpz-6"; - samsung,pin-function = <0x2>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; - - pcm0_bus: pcm0-bus { - samsung,pins = "gpz-0", "gpz-1", "gpz-2", "gpz-3", - "gpz-4"; - samsung,pin-function = <0x3>; - samsung,pin-pud = <0>; - samsung,pin-drv = <0>; - }; }; };
arch/arm/dts/exynos4x12-pinctrl.dtsi +0 -612
635 lines not on this page · raw message
arch/arm/dts/exynos4x12.dtsi +0 -100
112 lines not on this page · raw message
arch/arm/dts/exynos5250-pinctrl.dtsi +0 -459
482 lines not on this page · raw message
arch/arm/dts/exynos54xx-pinctrl.dtsi +0 -384
413 lines not on this page · raw message
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v8 4/12 dm: exynos: dts: Adjust device tree files for U-Boot
In reply to Simon GlassThe pinctrl bindings used by Linux are an incomplete description of the hardware. It is possible in most cases to determine the register address of each, but not in all cases. By adding an additional property we can fix this, and avoid adding a table to U-Boot for every single Exynos SOC.
---
Changes in v8:
- Add missing special case reg property for exynos5420 GPX0
Changes in v7: None
Changes in v6:
- Move U-Boot changes into their own file
- Use exynos54xx everywhere instead of exynos5420
Changes in v5: None
Changes in v4: None
arch/arm/dts/exynos4210-pinctrl-uboot.dtsi | 27 ++++++++++++++++++ arch/arm/dts/exynos4210-pinctrl.dtsi | 2 ++ arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi | 46 ++++++++++++++++++++++++++++++ arch/arm/dts/exynos4x12-pinctrl.dtsi | 2 ++ arch/arm/dts/exynos5250-pinctrl-uboot.dtsi | 40 ++++++++++++++++++++++++++ arch/arm/dts/exynos5250-pinctrl.dtsi | 2 ++ arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi | 40 ++++++++++++++++++++++++++ arch/arm/dts/exynos54xx-pinctrl.dtsi | 2 ++ arch/arm/dts/exynos54xx.dtsi | 1 + 9 files changed, 162 insertions(+) create mode 100644 arch/arm/dts/exynos4210-pinctrl-uboot.dtsi create mode 100644 arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi create mode 100644 arch/arm/dts/exynos5250-pinctrl-uboot.dtsi create mode 100644 arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi
arch/arm/dts/exynos4210-pinctrl-uboot.dtsi new file +27 -0
@@ -0,0 +1,27 @@ +/* + * U-Boot additions to enable a generic Exynos GPIO driver + * + * Copyright (c) 2014 Google, Inc + */ + +/{ + pinctrl_0: pinctrl at 11400000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "samsung,exynos4210-pinctrl"; + }; + + pinctrl_1: pinctrl at 11000000 { + #address-cells = <1>; + #size-cells = <0>; + gpy0: gpy0 { + reg = <0xc00>; + }; + }; + + pinctrl_2: pinctrl at 03860000 { + #address-cells = <1>; + #size-cells = <0>; + }; + +};
arch/arm/dts/exynos4210-pinctrl.dtsi +2 -0
@@ -14,6 +14,8 @@ * published by the Free Software Foundation. */ +#include "exynos4210-pinctrl-uboot.dtsi" + / { pinctrl at 11400000 { gpa0: gpa0 {
arch/arm/dts/exynos4x12-pinctrl-uboot.dtsi new file +46 -0
46 lines not on this page · raw message
arch/arm/dts/exynos4x12-pinctrl.dtsi +2 -0
@@ -12,6 +12,8 @@ * published by the Free Software Foundation. */ +#include "exynos4x12-pinctrl-uboot.dtsi" + / { pinctrl at 11400000 { gpa0: gpa0 {
arch/arm/dts/exynos5250-pinctrl-uboot.dtsi new file +40 -0
@@ -0,0 +1,40 @@ +/* + * U-Boot additions to enable a generic Exynos GPIO driver + * + * Copyright (c) 2014 Google, Inc + */ + +/{ + pinctrl_0: pinctrl at 11400000 { + #address-cells = <1>; + #size-cells = <0>; + gpc4: gpc4 { + reg = <0x2e0>; + }; + gpx0: gpx0 { + reg = <0xc00>; + }; + }; + + pinctrl_1: pinctrl at 13400000 { + #address-cells = <1>; + #size-cells = <0>; + }; + + pinctrl_2: pinctrl at 10d10000 { + #address-cells = <1>; + #size-cells = <0>; + gpv2: gpv2 { + reg = <0x060>; + }; + gpv4: gpv4 { + reg = <0xc0>; + }; + }; + + pinctrl_3: pinctrl at 03860000 { + #address-cells = <1>; + #size-cells = <0>; + }; + +};
arch/arm/dts/exynos5250-pinctrl.dtsi +2 -0
@@ -12,6 +12,8 @@ * published by the Free Software Foundation. */ +#include "exynos5250-pinctrl-uboot.dtsi" + / { pinctrl at 11400000 { gpa0: gpa0 {
arch/arm/dts/exynos54xx-pinctrl-uboot.dtsi new file +40 -0
@@ -0,0 +1,40 @@ +/* + * U-Boot additions to enable a generic Exynos GPIO driver + * + * Copyright (c) 2014 Google, Inc + */ + +/{ + /* + * Replicate the ordering of arch/arm/include/asm/arch-exynos/gpio.h + * TODO(sjg at chromium.org): This ordering ceases to matter once GPIO + * numbers are not needed in U-Boot for exynos. + */ + pinctrl at 14010000 { + #address-cells = <1>; + #size-cells = <0>; + }; + pinctrl at 13400000 { + #address-cells = <1>; + #size-cells = <0>; + gpy7 { + }; + + gpx0 { + reg = <0xc00>; + }; + }; + pinctrl at 13410000 { + #address-cells = <1>; + #size-cells = <0>; + }; + pinctrl at 14000000 { + #address-cells = <1>; + #size-cells = <0>; + }; + pinctrl at 03860000 { + #address-cells = <1>; + #size-cells = <0>; + }; + +};
arch/arm/dts/exynos54xx-pinctrl.dtsi +2 -0
@@ -12,6 +12,8 @@ * published by the Free Software Foundation. */ +#include "exynos54xx-pinctrl-uboot.dtsi" + / { pinctrl at 13400000 { gpy7: gpy7 {
arch/arm/dts/exynos54xx.dtsi +1 -0
@@ -6,6 +6,7 @@ */ #include "exynos5.dtsi" +#include "exynos54xx-pinctrl.dtsi" / { config {
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v8 5/12 dm: exynos: Add pinctrl settings for smdkc100
In reply to Simon GlassThese describe the GPIOs in enough detail for U-Boot's GPIO driver to operate.
---
Changes in v8:
- Add patch containing pinctrl settings for s5p_goni
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
arch/arm/dts/s5pc100-pinctrl.dtsi | 180 ++++++++++++++++++++++++++++++++++++++ arch/arm/dts/s5pc1xx-smdkc100.dts | 7 ++ 2 files changed, 187 insertions(+) create mode 100644 arch/arm/dts/s5pc100-pinctrl.dtsi
arch/arm/dts/s5pc100-pinctrl.dtsi new file +180 -0
@@ -0,0 +1,180 @@ +/* + * U-Boot additions to enable a generic Exynos GPIO driver + * + * Copyright (c) 2014 Google, Inc + */ + +/ { + pinctrl at e0300000 { + gpa0: gpa0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpa1: gpa1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpb: gpb { + gpio-controller; + #gpio-cells = <2>; + }; + + gpc: gpc { + gpio-controller; + #gpio-cells = <2>; + }; + + gpd: gpd { + gpio-controller; + #gpio-cells = <2>; + }; + + gpe0: gpe0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpe1: gpe1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpf0: gpf0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpf1: gpf1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpf2: gpf2 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpf3: gpf3 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpg0: gpg0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpg1: gpg1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpg2: gpg2 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpg3: gpg3 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpi: gpi { + gpio-controller; + #gpio-cells = <2>; + }; + + gpj0: gpj0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpj1: gpj1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpj2: gpj2 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpj3: gpj3 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpj4: gpj4 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpk0: gpk0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpk1: gpk1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpk2: gpk2 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpk3: gpk3 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpl0: gpl0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpl1: gpl1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpl2: gpl2 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpl3: gpl3 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpl4: gpl4 { + gpio-controller; + #gpio-cells = <2>; + }; + + gph0: gph0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gph1: gph1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gph2: gph2 { + gpio-controller; + #gpio-cells = <2>; + }; + + gph3: gph3 { + gpio-controller; + #gpio-cells = <2>; + }; + + }; +};
arch/arm/dts/s5pc1xx-smdkc100.dts +7 -0
@@ -9,6 +9,7 @@ /dts-v1/; #include "skeleton.dtsi" +#include "s5pc100-pinctrl.dtsi" / { model = "Samsung SMDKC100 based on S5PC100";
@@ -17,6 +18,12 @@ aliases { serial0 = "/serial at ec000000"; console = "/serial at ec000000"; + pinctrl0 = &pinctrl0; + }; + + pinctrl0: pinctrl at e0300000 { + compatible = "samsung,s5pc100-pinctrl"; + reg = <0xe0200000 0x1000>; }; serial at ec000000 {
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v8 6/12 dm: exynos: Add pinctrl settings for s5p_goni
In reply to Simon GlassThese describe the GPIOs in enough detail for U-Boot's GPIO driver to operate.
---
Changes in v8:
- Add patch containing pinctrl settings for s5p_goni
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
arch/arm/dts/s5pc110-pinctrl.dtsi | 273 ++++++++++++++++++++++++++++++++++++++ arch/arm/dts/s5pc1xx-goni.dts | 7 + 2 files changed, 280 insertions(+) create mode 100644 arch/arm/dts/s5pc110-pinctrl.dtsi
arch/arm/dts/s5pc110-pinctrl.dtsi new file +273 -0
@@ -0,0 +1,273 @@ +/* + * U-Boot additions to enable a generic Exynos GPIO driver + * + * Copyright (c) 2014 Google, Inc + */ + +/ { + pinctrl at e0200000 { + #address-cells = <1>; + #size-cells = <0>; + gpa0: gpa0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpa1: gpa1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpb: gpb { + gpio-controller; + #gpio-cells = <2>; + }; + + gpc0: gpc0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpc1: gpc1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpd0: gpd0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpd1: gpd1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpe0: gpe0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpe1: gpe1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpf0: gpf0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpf1: gpf1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpf2: gpf2 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpf3: gpf3 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpg0: gpg0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpg1: gpg1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpg2: gpg2 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpg3: gpg3 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpi: gpi { + gpio-controller; + #gpio-cells = <2>; + }; + + gpj0: gpj0 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpj1: gpj1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpj2: gpj2 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpj3: gpj3 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpj4: gpj4 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp01: gpmp01 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp02: gpmp02 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp03: gpmp03 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp04: gpmp04 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp05: gpmp05 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp06: gpmp06 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp07: gpmp07 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp10: gpmp10 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp11: gpmp11 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp12: gpmp12 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp13: gpmp13 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp14: gpmp14 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp15: gpmp15 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp16: gpmp16 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp17: gpmp17 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp18: gpmp18 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp20: gpmp20 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp21: gpmp21 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp22: gpmp22 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp23: gpmp23 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp24: gpmp24 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp25: gpmp25 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp26: gpmp26 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp27: gpmp27 { + gpio-controller; + #gpio-cells = <2>; + }; + + gpmp28: gpmp28 { + gpio-controller; + #gpio-cells = <2>; + }; + + gph0: gph0 { + reg = <0xc00>; + gpio-controller; + #gpio-cells = <2>; + }; + + gph1: gph1 { + gpio-controller; + #gpio-cells = <2>; + }; + + gph2: gph2 { + gpio-controller; + #gpio-cells = <2>; + }; + + gph3: gph3 { + gpio-controller; + #gpio-cells = <2>; + }; + + }; +};
arch/arm/dts/s5pc1xx-goni.dts +7 -0
@@ -9,6 +9,7 @@ /dts-v1/; #include "skeleton.dtsi" +#include "s5pc110-pinctrl.dtsi" / { model = "Samsung Goni based on S5PC110";
@@ -17,6 +18,12 @@ aliases { serial0 = "/serial at e2900000"; console = "/serial at e2900000"; + pinctrl0 = &pinctrl0; + }; + + pinctrl0: pinctrl at e0200000 { + compatible = "samsung,s5pc100-pinctrl"; + reg = <0xe0200000 0x1000>; }; serial at e2900000 {
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v8 7/12 dm: exynos: Move smdkc100 to generic board
In reply to Simon GlassThe generic board deadline is approaching, and we need this feature to enable driver model. Enable CONFIG_SYS_GENERIC_BOARD for smdkc100.
---
Changes in v8:
- Add new patch to move smdkc100 to generic board
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
include/configs/smdkc100.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/smdkc100.h +2 -0
@@ -226,4 +226,6 @@#define CONFIG_OF_SEPARATE #define CONFIG_OF_LIBFDT +#define CONFIG_SYS_GENERIC_BOARD +#endif /* __CONFIG_H */
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v8 8/12 dm: exynos: Move s5p_goni to generic board
In reply to Simon GlassThe generic board deadline is approaching, and we need this feature to enable driver model. Enable CONFIG_SYS_GENERIC_BOARD for s5p_goni.
---
Changes in v8:
- Add new patch to move s5p_goni to generic board
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
include/configs/s5p_goni.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/s5p_goni.h +2 -0
@@ -289,4 +289,6 @@#define CONFIG_OF_SEPARATE #define CONFIG_OF_LIBFDT +#define CONFIG_SYS_GENERIC_BOARD +#endif /* __CONFIG_H */
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v8 8/12 dm: exynos: Move s5p_goni to generic board
Quoted 23 lines · Simon Glass
The generic board deadline is approaching, and we need this feature to enable driver model. Enable
CONFIG_SYS_GENERIC_BOARDfors5p_goni.Signed-off-by Simon Glass <[email protected]>---
Changes in v8:
- Add new patch to moves5p_gonito generic boardChanges in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: Noneinclude/configs/s5p_goni.h | 2 ++ 1 file changed, 2 insertions(+)include/configs/s5p_goni.h +0
-0
include/configs/s5p_goni.h line 294
Quoted 6 lines
include/configs/s5p_goni.h +2
-0@@ -289,4 +289,6 @@#define CONFIG_OF_SEPARATE #define CONFIG_OF_LIBFDT +#define CONFIG_SYS_GENERIC_BOARD +#endif /* __CONFIG_H */
Thanks,
Robert Baldyga
PATCH v8 8/12 dm: exynos: Move s5p_goni to generic board
Dear Robert Baldyga,
Quoted 26 lines · Robert Baldyga
Quoted 25 lines · Simon Glass
The generic board deadline is approaching, and we need this feature to enable driver model. Enable
CONFIG_SYS_GENERIC_BOARDfors5p_goni.Signed-off-by Simon Glass <[email protected]>---
Changes in v8:
- Add new patch to moves5p_gonito generic boardChanges in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: Noneinclude/configs/s5p_goni.h | 2 ++ 1 file changed, 2 insertions(+)include/configs/s5p_goni.h +0
-0@@ -289,4 +289,6 @@#define CONFIG_OF_SEPARATE #define CONFIG_OF_LIBFDT
Quoted 7 lines
include/configs/s5p_goni.h line 294
Quoted 4 lines
include/configs/s5p_goni.h +2
-0+#define CONFIG_SYS_GENERIC_BOARD +#endif /* __CONFIG_H */ Acked-by Robert Baldyga <[email protected]>
Then how's your patch?
http://patchwork.ozlabs.org/patch/390306/
Thanks,
Minkyu Kang.
PATCH v8 8/12 dm: exynos: Move s5p_goni to generic board
Quoted 37 lines · Minkyu Kang
Dear Robert Baldyga,
Quoted 26 lines · Robert Baldyga
Quoted 25 lines · Simon Glass
The generic board deadline is approaching, and we need this feature to enable driver model. Enable
CONFIG_SYS_GENERIC_BOARDfors5p_goni.Signed-off-by Simon Glass <[email protected]>---
Changes in v8:
- Add new patch to moves5p_gonito generic boardChanges in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: Noneinclude/configs/s5p_goni.h | 2 ++ 1 file changed, 2 insertions(+)include/configs/s5p_goni.h +0
-0@@ -289,4 +289,6 @@#define CONFIG_OF_SEPARATE #define CONFIG_OF_LIBFDT Quoted 7 lines
include/configs/s5p_goni.h line 294
Quoted 4 lines
include/configs/s5p_goni.h +2
-0+#define CONFIG_SYS_GENERIC_BOARD +#endif /* __CONFIG_H */ Acked-by Robert Baldyga <[email protected]>
Quoted 6 lines
Then how's your patch?
http://patchwork.ozlabs.org/patch/390306/Thanks,
Minkyu Kang.
Please discard my patch. Simon's patch should be applied.
Thanks,
Robert Baldyga.
PATCH v8 9/12 dm: exynos: Tidy up GPIO headers
In reply to Simon GlassThe wrong header is being included, thus requiring the code to re-declare the generic GPIO interface in each GPIO header.
Fix this.
---
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
arch/arm/cpu/armv7/exynos/pinmux.c | 2 +- arch/arm/include/asm/arch-exynos/gpio.h | 5 ----- arch/arm/include/asm/arch-s5pc1xx/gpio.h | 4 ---- board/samsung/arndale/arndale.c | 2 +- board/samsung/common/board.c | 2 +- board/samsung/common/misc.c | 1 - board/samsung/goni/goni.c | 2 +- board/samsung/origen/origen.c | 2 +- board/samsung/smdk5420/smdk5420.c | 2 +- board/samsung/smdkc100/smdkc100.c | 2 +- board/samsung/smdkv310/smdkv310.c | 2 +- board/samsung/trats/trats.c | 2 +- board/samsung/trats2/trats2.c | 1 + board/samsung/universal_c210/universal.c | 1 - drivers/gpio/s5p_gpio.c | 3 +-- 15 files changed, 11 insertions(+), 22 deletions(-)
arch/arm/cpu/armv7/exynos/pinmux.c +1 -1
@@ -7,7 +7,7 @@#include <common.h> #include <fdtdec.h> -#include <asm/arch/gpio.h> +#include <asm/gpio.h> #include <asm/arch/pinmux.h> #include <asm/arch/sromc.h>
arch/arm/include/asm/arch-exynos/gpio.h +0 -5
@@ -1504,12 +1504,7 @@ static const struct gpio_name_num_table exynos5420_gpio_table[] = {void gpio_cfg_pin (int gpio,int cfg);void gpio_set_pull (int gpio,int mode);void gpio_set_drv (int gpio,int mode); -int gpio_direction_input (unsigned gpio); -int gpio_direction_output (unsigned gpio,int value); -int gpio_set_value (unsigned gpio,int value); -int gpio_get_value (unsigned gpio);void gpio_set_rate (int gpio,int mode); -struct s5p_gpio_bank *s5p_gpio_get_bank (unsigned gpio);int s5p_gpio_get_pin (unsigned gpio);#endif
arch/arm/include/asm/arch-s5pc1xx/gpio.h +0 -4
@@ -815,11 +815,7 @@ static const struct gpio_name_num_table s5pc110_gpio_table[] = {void gpio_cfg_pin (int gpio,int cfg);void gpio_set_pull (int gpio,int mode);void gpio_set_drv (int gpio,int mode); -int gpio_direction_output (unsigned gpio,int value); -int gpio_set_value (unsigned gpio,int value); -int gpio_get_value (unsigned gpio);void gpio_set_rate (int gpio,int mode); -struct s5p_gpio_bank *s5p_gpio_get_bank (unsigned gpio);int s5p_gpio_get_pin (unsigned gpio);/* GPIO pins per bank */
board/samsung/arndale/arndale.c +1 -1
@@ -6,9 +6,9 @@#include <common.h> #include <usb.h> +#include <asm/gpio.h> #include <asm/arch/pinmux.h> #include <asm/arch/dwmmc.h> -#include <asm/arch/gpio.h> #include <asm/arch/power.h> DECLARE_GLOBAL_DATA_PTR ;
board/samsung/common/board.c +1 -1
@@ -13,10 +13,10 @@#include <tmu.h> #include <netdev.h> #include <asm/io.h> +#include <asm/gpio.h> #include <asm/arch/board.h> #include <asm/arch/cpu.h> #include <asm/arch/dwmmc.h> -#include <asm/arch/gpio.h> #include <asm/arch/mmc.h> #include <asm/arch/pinmux.h> #include <asm/arch/power.h>
board/samsung/common/misc.c +0 -1
@@ -14,7 +14,6 @@#include <malloc.h> #include <linux/sizes.h> #include <asm/arch/cpu.h> -#include <asm/arch/gpio.h> #include <asm/gpio.h> #include <linux/input.h> #include <power/pmic.h>
board/samsung/goni/goni.c +1 -1
@@ -7,7 +7,7 @@*/ #include <common.h> -#include <asm/arch/gpio.h> +#include <asm/gpio.h> #include <asm/arch/mmc.h> #include <power/pmic.h> #include <usb/s3c_udc.h>
board/samsung/origen/origen.c +1 -1
@@ -6,8 +6,8 @@#include <common.h> #include <asm/io.h> +#include <asm/gpio.h> #include <asm/arch/cpu.h> -#include <asm/arch/gpio.h> #include <asm/arch/mmc.h> #include <asm/arch/periph.h> #include <asm/arch/pinmux.h>
board/samsung/smdk5420/smdk5420.c +1 -1
@@ -11,9 +11,9 @@#include <lcd.h> #include <spi.h> #include <errno.h> +#include <asm/gpio.h> #include <asm/arch/board.h> #include <asm/arch/cpu.h> -#include <asm/arch/gpio.h> #include <asm/arch/pinmux.h> #include <asm/arch/system.h> #include <asm/arch/dp_info.h>
board/samsung/smdkc100/smdkc100.c +1 -1
@@ -7,9 +7,9 @@*/ #include <common.h> +#include <asm/gpio.h> #include <asm/io.h> #include <asm/arch/sromc.h> -#include <asm/arch/gpio.h> #include <netdev.h> DECLARE_GLOBAL_DATA_PTR ;
board/samsung/smdkv310/smdkv310.c +1 -1
@@ -5,10 +5,10 @@*/ #include <common.h> +#include <asm/gpio.h> #include <asm/io.h> #include <netdev.h> #include <asm/arch/cpu.h> -#include <asm/arch/gpio.h> #include <asm/arch/mmc.h> #include <asm/arch/periph.h> #include <asm/arch/pinmux.h>
board/samsung/trats/trats.c +1 -1
@@ -10,8 +10,8 @@#include <common.h> #include <lcd.h> #include <asm/io.h> +#include <asm/gpio.h> #include <asm/arch/cpu.h> -#include <asm/arch/gpio.h> #include <asm/arch/pinmux.h> #include <asm/arch/clock.h> #include <asm/arch/mipi_dsim.h>
board/samsung/trats2/trats2.c +1 -0
@@ -8,6 +8,7 @@#include <common.h> #include <lcd.h> +#include <asm/gpio.h> #include <asm/arch/pinmux.h> #include <asm/arch/power.h> #include <asm/arch/mipi_dsim.h>
board/samsung/universal_c210/universal.c +0 -1
@@ -12,7 +12,6 @@#include <asm/io.h> #include <asm/gpio.h> #include <asm/arch/adc.h> -#include <asm/arch/gpio.h> #include <asm/arch/pinmux.h> #include <asm/arch/watchdog.h> #include <ld9040.h>
drivers/gpio/s5p_gpio.c +1 -2
@@ -8,7 +8,6 @@#include <common.h> #include <asm/io.h> #include <asm/gpio.h> -#include <asm/arch/gpio.h> #define S5P_GPIO_GET_PIN (x) (x % GPIO_PER_BANK)
@@ -222,7 +221,7 @@ static void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)writel (value, &bank->drv); } -struct s5p_gpio_bank *s5p_gpio_get_bank (unsigned int gpio) +static struct s5p_gpio_bank *s5p_gpio_get_bank (unsigned int gpio) {const struct gpio_info *data;unsigned int upto;
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v8 10/12 dm: exynos: Tidy up GPIO defines
In reply to Simon GlassThe defines at the top of the GPIO driver use single-character names for parameters which are not very descriptive.
Improve these to use descriptive parameter names.
---
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
drivers/gpio/s5p_gpio.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/gpio/s5p_gpio.c +11 -10
@@ -11,19 +11,20 @@#define S5P_GPIO_GET_PIN (x) (x % GPIO_PER_BANK) -#define CON_MASK (x) (0xf << ((x) << 2)) -#define CON_SFR (x, v) ((v) << ((x) << 2)) +#define CON_MASK (val) (0xf << ((val) << 2)) +#define CON_SFR (gpio, cfg) ((cfg) << ((gpio) << 2)) +#define CON_SFR_UNSHIFT (val, gpio) ((val) >> ((gpio) << 2)) -#define DAT_MASK (x) (0x1 << (x)) -#define DAT_SET (x) (0x1 << (x)) +#define DAT_MASK (gpio) (0x1 << (gpio)) +#define DAT_SET (gpio) (0x1 << (gpio)) -#define PULL_MASK (x) (0x3 << ((x) << 1)) -#define PULL_MODE (x, v) ((v) << ((x) << 1)) +#define PULL_MASK (gpio) (0x3 << ((gpio) << 1)) +#define PULL_MODE (gpio, pull) ((pull) << ((gpio) << 1)) -#define DRV_MASK (x) (0x3 << ((x) << 1)) -#define DRV_SET (x, m) ((m) << ((x) << 1)) -#define RATE_MASK (x) (0x1 << (x + 16)) -#define RATE_SET (x) (0x1 << (x + 16)) +#define DRV_MASK (gpio) (0x3 << ((gpio) << 1)) +#define DRV_SET (gpio, mode) ((mode) << ((gpio) << 1)) +#define RATE_MASK (gpio) (0x1 << (gpio + 16)) +#define RATE_SET (gpio) (0x1 << (gpio + 16))#define name_to_gpio (n) s5p_name_to_gpio(n)static inline int s5p_name_to_gpio (const char *name)
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v8 11/12 dm: exynos: Make sure that GPIOs are requested
In reply to Simon GlassWith driver model GPIOs must be requested before use. Make sure this is done correctly.
(Note that the soft SPI part of universal is omitted, since this driver is about to be replaced with a driver-model-aware version)
---
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5:
- Add additional gpio_request() calls for other samsung boards
- Use a mask instead of division in gpio_request() naming call
Changes in v4: None
arch/arm/cpu/armv7/exynos/pinmux.c | 3 +++ board/samsung/arndale/arndale.c | 2 ++ board/samsung/common/misc.c | 2 ++ board/samsung/goni/goni.c | 2 ++ board/samsung/smdk5250/exynos5-dt.c | 7 +++++++ board/samsung/smdk5420/smdk5420.c | 4 ++++ board/samsung/trats/trats.c | 15 ++++++++++++--- board/samsung/trats2/trats2.c | 26 +++++++++++++++++++++----- board/samsung/universal_c210/universal.c | 3 +++ drivers/mmc/s5p_sdhci.c | 7 ++++++- 10 files changed, 62 insertions(+), 9 deletions(-)
arch/arm/cpu/armv7/exynos/pinmux.c +3 -0
@@ -172,6 +172,9 @@ static int exynos5420_mmc_config(int peripheral, int flags)* this same assumption. */ if ((peripheral ==PERIPH_ID_SDMMC0 ) && (i == (start +2 ))) { +#ifndef CONFIG_SPL_BUILD +gpio_request (i,"sdmmc0_vdden" ); +#endif gpio_set_value (i,1 );gpio_cfg_pin (i,S5P_GPIO_OUTPUT ); }else {
board/samsung/arndale/arndale.c +2 -0
@@ -19,6 +19,8 @@ int board_usb_init(int index, enum usb_init_type init)/* Configure gpios for usb 3503 hub: * disconnect, toggle reset and connect */ +gpio_request (EXYNOS5_GPIO_D17 ,"usb_connect" ); +gpio_request (EXYNOS5_GPIO_X35 ,"usb_reset" );gpio_direction_output (EXYNOS5_GPIO_D17 ,0 );gpio_direction_output (EXYNOS5_GPIO_X35 ,0 );
board/samsung/common/misc.c +2 -0
@@ -411,6 +411,8 @@ void check_boot_mode(void)void keys_init (void ) {/* Set direction to input */ +gpio_request (KEY_VOL_UP_GPIO ,"volume-up" ); +gpio_request (KEY_VOL_DOWN_GPIO ,"volume-down" );gpio_direction_input (KEY_VOL_UP_GPIO );gpio_direction_input (KEY_VOL_DOWN_GPIO ); }
board/samsung/goni/goni.c +2 -0
@@ -80,6 +80,7 @@ int board_mmc_init(bd_t *bis)int i, ret, ret_sd =0 ;/* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */ +gpio_request (S5PC110_GPIO_J27 ,"massmemory_en" );gpio_direction_output (S5PC110_GPIO_J27 ,1 );/*
@@ -108,6 +109,7 @@ int board_mmc_init(bd_t *bis)* SD card (T_FLASH) detect and init * T_FLASH_DETECT: EINT28: GPH3[4] input mode */ +gpio_request (S5PC110_GPIO_H34 ,"t_flash_detect" );gpio_cfg_pin (S5PC110_GPIO_H34 ,S5P_GPIO_INPUT );gpio_set_pull (S5PC110_GPIO_H34 ,S5P_GPIO_PULL_UP );
board/samsung/smdk5250/exynos5-dt.c +7 -0
@@ -29,6 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;static void board_enable_audio_codec (void ) {/* Enable MAX98095 Codec */ +gpio_request (EXYNOS5_GPIO_X17 ,"max98095_enable" );gpio_direction_output (EXYNOS5_GPIO_X17 ,1 );gpio_set_pull (EXYNOS5_GPIO_X17 ,S5P_GPIO_PULL_NONE ); }
@@ -199,16 +200,19 @@ static int board_dp_bridge_setup(void)/* Setup the GPIOs */ /* PD is ACTIVE_LOW, and initially de-asserted */ +gpio_request (EXYNOS5_GPIO_Y25 ,"dp_bridge_pd" );gpio_set_pull (EXYNOS5_GPIO_Y25 ,S5P_GPIO_PULL_NONE );gpio_direction_output (EXYNOS5_GPIO_Y25 ,1 );/* Reset is ACTIVE_LOW */ +gpio_request (EXYNOS5_GPIO_X15 ,"dp_bridge_reset" );gpio_set_pull (EXYNOS5_GPIO_X15 ,S5P_GPIO_PULL_NONE );gpio_direction_output (EXYNOS5_GPIO_X15 ,0 );udelay (10 );gpio_set_value (EXYNOS5_GPIO_X15 ,1 ); +gpio_request (EXYNOS5_GPIO_X07 ,"dp_bridge_hpd" );gpio_direction_input (EXYNOS5_GPIO_X07 );/*
@@ -236,10 +240,12 @@ static int board_dp_bridge_setup(void)void exynos_cfg_lcd_gpio (void ) {/* For Backlight */ +gpio_request (EXYNOS5_GPIO_B20 ,"lcd_backlight" );gpio_cfg_pin (EXYNOS5_GPIO_B20 ,S5P_GPIO_OUTPUT );gpio_set_value (EXYNOS5_GPIO_B20 ,1 );/* LCD power on */ +gpio_request (EXYNOS5_GPIO_X15 ,"lcd_power" );gpio_cfg_pin (EXYNOS5_GPIO_X15 ,S5P_GPIO_OUTPUT );gpio_set_value (EXYNOS5_GPIO_X15 ,1 );
@@ -276,6 +282,7 @@ void exynos_backlight_on(unsigned int on)mdelay (10 );/* board_dp_backlight_en */ +gpio_request (EXYNOS5_GPIO_X30 ,"board_dp_backlight_en" );gpio_direction_output (EXYNOS5_GPIO_X30 ,1 );#endif }
board/samsung/smdk5420/smdk5420.c +4 -0
@@ -74,9 +74,12 @@ void exynos_lcd_power_on(void)mdelay (5 );/* TODO(ajaykumar.rs at samsung.com): Use device tree */ +gpio_request (EXYNOS5420_GPIO_X35 ,"edp_slp#" );gpio_direction_output (EXYNOS5420_GPIO_X35 ,1 );/* EDP_SLP# */ mdelay (10 ); +gpio_request (EXYNOS5420_GPIO_Y77 ,"edp_rst#" );gpio_direction_output (EXYNOS5420_GPIO_Y77 ,1 );/* EDP_RST# */ +gpio_request (EXYNOS5420_GPIO_X26 ,"edp_hpd" );gpio_direction_input (EXYNOS5420_GPIO_X26 );/* EDP_HPD */ gpio_set_pull (EXYNOS5420_GPIO_X26 ,S5P_GPIO_PULL_NONE );
@@ -88,6 +91,7 @@ void exynos_lcd_power_on(void)void exynos_backlight_on (unsigned int onoff) {/* For PWM */ +gpio_request (EXYNOS5420_GPIO_B20 ,"backlight_on" );gpio_cfg_pin (EXYNOS5420_GPIO_B20 ,S5P_GPIO_FUNC (0x1 ));gpio_set_value (EXYNOS5420_GPIO_B20 ,1 );
board/samsung/trats/trats.c +12 -3
@@ -63,6 +63,8 @@ void i2c_init_board(void) }/* I2C_8 -> FG */ +gpio_request (EXYNOS4_GPIO_Y40 ,"i2c_clk" ); +gpio_request (EXYNOS4_GPIO_Y41 ,"i2c_data" );gpio_direction_output (EXYNOS4_GPIO_Y40 ,1 );gpio_direction_output (EXYNOS4_GPIO_Y41 ,1 ); }
@@ -346,12 +348,17 @@ int exynos_power_init(void)static unsigned int get_hw_revision (void ) {int hwrev =0 ; +char str[10 ];int i;/* hw_rev[3:0] == GPE1[3:0] */ -for (i =EXYNOS4_GPIO_E10 ; i <EXYNOS4_GPIO_E14 ; i++) { -gpio_cfg_pin (i,S5P_GPIO_INPUT ); -gpio_set_pull (i,S5P_GPIO_PULL_NONE ); +for (i =0 ; i <4 ; i++) { +int pin = i +EXYNOS4_GPIO_E10 ; + +sprintf (str,"hw_rev%d" , i); +gpio_request (pin, str); +gpio_cfg_pin (pin,S5P_GPIO_INPUT ); +gpio_set_pull (pin,S5P_GPIO_PULL_NONE ); }udelay (1 );
@@ -517,6 +524,7 @@ static void board_power_init(void)static void exynos_uart_init (void ) {/* UART_SEL GPY4[7] (part2)@EXYNOS4 */ +gpio_request (EXYNOS4_GPIO_Y47 ,"uart_sel" );gpio_set_pull (EXYNOS4_GPIO_Y47 ,S5P_GPIO_PULL_UP );gpio_direction_output (EXYNOS4_GPIO_Y47 ,1 ); }
@@ -534,6 +542,7 @@ int exynos_early_init_f(void)void exynos_reset_lcd (void ) { +gpio_request (EXYNOS4_GPIO_Y45 ,"lcd_reset" );gpio_direction_output (EXYNOS4_GPIO_Y45 ,1 );udelay (10000 );gpio_direction_output (EXYNOS4_GPIO_Y45 ,0 );
board/samsung/trats2/trats2.c +21 -5
@@ -33,6 +33,7 @@ static inline u32 get_model_rev(void);static void check_hw_revision (void ) {int modelrev =0 ; +char str[12 ];int i;/*
@@ -41,13 +42,22 @@ static void check_hw_revision(void)* TRM say that it may cause unexcepted state and leakage current. * and pull-none is only for output function. */ -for (i =EXYNOS4X12_GPIO_M10 ; i <EXYNOS4X12_GPIO_M12 ; i++) -gpio_cfg_pin (i,S5P_GPIO_INPUT ); +for (i =0 ; i <2 ; i++) { +int pin = i +EXYNOS4X12_GPIO_M10 ; + +sprintf (str,"model_rev%d" , i); +gpio_request (pin, str); +gpio_cfg_pin (pin,S5P_GPIO_INPUT ); + }/* GPM1[5:2]: HW_REV[3:0] */ -for (i =EXYNOS4X12_GPIO_M12 ; i <EXYNOS4X12_GPIO_M16 ; i++) { -gpio_cfg_pin (i,S5P_GPIO_INPUT ); -gpio_set_pull (i,S5P_GPIO_PULL_NONE ); +for (i =0 ; i <4 ; i++) { +int pin = i +EXYNOS4X12_GPIO_M12 ; + +sprintf (str,"hw_rev%d" , i); +gpio_request (pin, str); +gpio_cfg_pin (pin,S5P_GPIO_INPUT ); +gpio_set_pull (pin,S5P_GPIO_PULL_NONE ); }/* GPM1[1:0]: MODEL_REV[1:0] */
@@ -103,10 +113,14 @@ static void board_init_i2c(void) }/* I2C_8 */ +gpio_request (EXYNOS4X12_GPIO_F14 ,"i2c8_clk" ); +gpio_request (EXYNOS4X12_GPIO_F15 ,"i2c8_data" );gpio_direction_output (EXYNOS4X12_GPIO_F14 ,1 );gpio_direction_output (EXYNOS4X12_GPIO_F15 ,1 );/* I2C_9 */ +gpio_request (EXYNOS4X12_GPIO_M21 ,"i2c9_clk" ); +gpio_request (EXYNOS4X12_GPIO_M20 ,"i2c9_data" );gpio_direction_output (EXYNOS4X12_GPIO_M21 ,1 );gpio_direction_output (EXYNOS4X12_GPIO_M20 ,1 ); }
@@ -388,6 +402,7 @@ void exynos_lcd_power_on(void)struct pmic *p =pmic_get ("MAX77686_PMIC" );/* LCD_2.2V_EN: GPC0[1] */ +gpio_request (EXYNOS4X12_GPIO_C01 ,"lcd_2v2_en" );gpio_set_pull (EXYNOS4X12_GPIO_C01 ,S5P_GPIO_PULL_UP );gpio_direction_output (EXYNOS4X12_GPIO_C01 ,1 );
@@ -400,6 +415,7 @@ void exynos_lcd_power_on(void)void exynos_reset_lcd (void ) {/* reset lcd */ +gpio_request (EXYNOS4X12_GPIO_F21 ,"lcd_reset" );gpio_direction_output (EXYNOS4X12_GPIO_F21 ,0 );udelay (10 );gpio_set_value (EXYNOS4X12_GPIO_F21 ,1 );
board/samsung/universal_c210/universal.c +3 -0
@@ -330,6 +330,7 @@ void exynos_cfg_lcd_gpio(void) }/* gpio pad configuration for LCD reset. */ +gpio_request (EXYNOS4_GPIO_Y45 ,"lcd_reset" );gpio_cfg_pin (EXYNOS4_GPIO_Y45 ,S5P_GPIO_OUTPUT );spi_init ();
@@ -386,6 +387,7 @@ int exynos_init(void)* you should set it HIGH since it removes the inverter */ /* MASSMEMORY_EN: XMDMDATA_6: GPE3[6] */ +gpio_request (EXYNOS4_GPIO_E36 ,"ldo_en" );gpio_direction_output (EXYNOS4_GPIO_E36 ,0 );break ;default :
@@ -394,6 +396,7 @@ int exynos_init(void)* But set it as HIGH to ensure */ /* MASSMEMORY_EN: XMDMADDR_3: GPE1[3] */ +gpio_request (EXYNOS4_GPIO_E13 ,"massmemory_en" );gpio_direction_output (EXYNOS4_GPIO_E13 ,1 );break ; }
drivers/mmc/s5p_sdhci.c +6 -1
@@ -102,6 +102,7 @@ struct sdhci_host sdhci_host[SDHCI_MAX_HOSTS];static int do_sdhci_init (struct sdhci_host *host) { +char str[20 ];int dev_id, flag;int err =0 ;
@@ -109,6 +110,8 @@ static int do_sdhci_init(struct sdhci_host *host) dev_id = host->index +PERIPH_ID_SDMMC0 ;if (fdt_gpio_isvalid (&host->pwr_gpio)) { +sprintf (str,"sdhci%d_power" , host->index &0xf ); +gpio_request (host->pwr_gpio.gpio, str);gpio_direction_output (host->pwr_gpio.gpio,1 ); err =exynos_pinmux_config (dev_id, flag);if (err) {
@@ -118,7 +121,9 @@ static int do_sdhci_init(struct sdhci_host *host) }if (fdt_gpio_isvalid (&host->cd_gpio)) { -gpio_direction_output (host->cd_gpio.gpio,0xf ); +sprintf (str,"sdhci%d_cd" , host->index &0xf ); +gpio_request (host->cd_gpio.gpio, str); +gpio_direction_output (host->cd_gpio.gpio,1 );if (gpio_get_value (host->cd_gpio.gpio))return -ENODEV ;
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v8 12/12 dm: exynos: gpio: Convert to driver model
In reply to Simon GlassConvert the exynos GPIO driver to driver model. This implements the generic GPIO interface but not the extra Exynos-specific functions.
---
Changes in v8:
- Enable driver model for smdkc100 and s5p_goni separately
Changes in v7:
- Bring in patches from the SPI series to move post-reloc DM init earlier
Changes in v6: None
Changes in v5:
- Remove RFC label now that build errors are fixed
- Tidy up and update cover letter message
- Avoid reordering functions
Changes in v4:
- Add patches for exynos GPIO support
drivers/gpio/s5p_gpio.c | 422 +++++++++++++++++++++++++++------------- include/configs/exynos-common.h | 4 + include/configs/s5p_goni.h | 3 + include/configs/smdkc100.h | 3 + 4 files changed, 296 insertions(+), 136 deletions(-)
drivers/gpio/s5p_gpio.c +286 -136
@@ -6,8 +6,15 @@*/ #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 S5P_GPIO_GET_PIN (x) (x % GPIO_PER_BANK)
@@ -26,100 +33,45 @@#define RATE_MASK (gpio) (0x1 << (gpio + 16))#define RATE_SET (gpio) (0x1 << (gpio + 16)) -#define name_to_gpio (n) s5p_name_to_gpio(n) -static inline int s5p_name_to_gpio (const char *name) +#define GPIO_NAME_SIZE 20 + +/* Platform data for each bank */ +struct exynos_gpio_platdata { +struct s5p_gpio_bank *bank; +const char *bank_name;/* Name of port, e.g. 'gpa0" */ +}; + +/* Information about each bank@run-time */ +struct exynos_bank_info { +char label[GPIO_PER_BANK ][GPIO_NAME_SIZE ]; +struct s5p_gpio_bank *bank; +}; + +static struct s5p_gpio_bank *s5p_gpio_get_bank (unsigned int gpio) { -unsigned num, irregular_set_number, irregular_bank_base; -const struct gpio_name_num_table *tabp; -char this_bank, bank_name, irregular_bank_name; -char *endp; - -/* -* The gpio name starts with either 'g' or 'gp' followed by the bank -* name character. Skip one or two characters depending on the prefix. -*/ -if (name[0 ] =='g' && name[1 ] =='p' ) - name +=2 ; -else if (name[0 ] =='g' ) - name++; -else -return -1 ;/* Name must start with 'g' */ - - bank_name = *name++; -if (!*name) -return -1 ;/* At least one digit is required/expected. */ - -/* -* On both exynos5 and exynos5420 architectures there is a bank of -* GPIOs which does not fall into the regular address pattern. Those -* banks are c4 on Exynos5 and y7 on Exynos5420. The rest of the below -* assignments help to handle these irregularities. -*/ -#if defined(CONFIG_EXYNOS4 ) || defined(CONFIG_EXYNOS5 ) -if (cpu_is_exynos5 ()) { -if (proid_is_exynos5420 ()) { - tabp = exynos5420_gpio_table; - irregular_bank_name ='y' ; - irregular_set_number ='7' ; - irregular_bank_base =EXYNOS5420_GPIO_Y70 ; - }else { - tabp = exynos5_gpio_table; - irregular_bank_name ='c' ; - irregular_set_number ='4' ; - irregular_bank_base =EXYNOS5_GPIO_C40 ; - } - }else { -if (proid_is_exynos4412 ()) - tabp = exynos4x12_gpio_table; -else - tabp = exynos4_gpio_table; - irregular_bank_name =0 ; - irregular_set_number =0 ; - irregular_bank_base =0 ; - } -#else -if (cpu_is_s5pc110 ()) - tabp = s5pc110_gpio_table; -else - tabp = s5pc100_gpio_table; - irregular_bank_name =0 ; - irregular_set_number =0 ; - irregular_bank_base =0 ; -#endif +const struct gpio_info *data; +unsigned int upto; +int i, count; - this_bank = tabp->bank; -do { -if (bank_name == this_bank) { -unsigned pin_index;/* pin number within the bank */ -if ((bank_name == irregular_bank_name) && - (name[0 ] == irregular_set_number)) { - pin_index = name[1 ] -'0' ; -/* Irregular sets have 8 pins. */ -if (pin_index >=GPIO_PER_BANK ) -return -1 ; - num = irregular_bank_base + pin_index; - }else { - pin_index =simple_strtoul (name, &endp,8 ); - pin_index -= tabp->bank_offset; -/* -* Sanity check: bunk 'z' has no set number, -* for all other banks there must be exactly -* two octal digits, and the resulting number -* should not exceed the number of pins in the -* bank. -*/ -if (((bank_name !='z' ) && !name[1 ]) || - *endp || - (pin_index >= tabp->bank_size)) -return -1 ; - num = tabp->base + pin_index; - } -return num; + data =get_gpio_data (); + count =get_bank_num (); + upto =0 ; + +for (i =0 ; i < count; i++) { +debug ("i=%d, upto=%d\n" , i, upto); +if (gpio < data->max_gpio) { +struct s5p_gpio_bank *bank; + bank = (struct s5p_gpio_bank *)data->reg_addr; + bank += (gpio - upto) /GPIO_PER_BANK ; +debug ("gpio=%d, bank=%p\n" , gpio, bank); +return bank; } - this_bank = (++tabp)->bank; - }while (this_bank); -return -1 ; + upto = data->max_gpio; + data++; + } + +return NULL ; }static void s5p_gpio_cfg_pin (struct s5p_gpio_bank *bank,int gpio,int cfg)
@@ -143,16 +95,23 @@ static void s5p_gpio_set_value(struct s5p_gpio_bank *bank, int gpio, int en)writel (value, &bank->dat); } -static void s5p_gpio_direction_output (struct s5p_gpio_bank *bank, -int gpio,int en) +#ifdef CONFIG_SPL_BUILD +/* Common GPIO API - SPL does not support driver model yet */ +int gpio_set_value (unsigned gpio,int value) { -s5p_gpio_cfg_pin (bank, gpio,S5P_GPIO_OUTPUT ); -s5p_gpio_set_value (bank, gpio, en); -} +s5p_gpio_set_value (s5p_gpio_get_bank (gpio), +s5p_gpio_get_pin (gpio), value); -static void s5p_gpio_direction_input (struct s5p_gpio_bank *bank,int gpio) +return 0 ; +} +#else +static int s5p_gpio_get_cfg_pin (struct s5p_gpio_bank *bank,int gpio) { -s5p_gpio_cfg_pin (bank, gpio,S5P_GPIO_INPUT ); +unsigned int value; + + value =readl (&bank->con); + value &=CON_MASK (gpio); +return CON_SFR_UNSHIFT (value, gpio); }static unsigned int s5p_gpio_get_value (struct s5p_gpio_bank *bank,int gpio)
@@ -162,6 +121,7 @@ static unsigned int s5p_gpio_get_value(struct s5p_gpio_bank *bank, int gpio) value =readl (&bank->dat); return !!(value & DAT_MASK(gpio)); } +#endif /* CONFIG_SPL_BUILD */ static void s5p_gpio_set_pull (struct s5p_gpio_bank *bank,int gpio,int mode) {
@@ -222,78 +182,156 @@ static void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)writel (value, &bank->drv); } -static struct s5p_gpio_bank *s5p_gpio_get_bank (unsigned int gpio) +int s5p_gpio_get_pin (unsigned gpio) { -const struct gpio_info *data; -unsigned int upto; -int i, count; +return S5P_GPIO_GET_PIN (gpio); +} - data =get_gpio_data (); - count =get_bank_num (); - upto =0 ; +/* 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" ); + } -for (i =0 ; i < count; i++) { -debug ("i=%d, upto=%d\n" , i, upto); -if (gpio < data->max_gpio) { -struct s5p_gpio_bank *bank; - bank = (struct s5p_gpio_bank *)data->reg_addr; - bank += (gpio - upto) /GPIO_PER_BANK ; -debug ("gpio=%d, bank=%p\n" , gpio, bank); -return bank; - } +return 0 ; +} - upto = data->max_gpio; - data++; +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 NULL ; +return 0 ; } -int s5p_gpio_get_pin (unsigned gpio) +/* set GPIO pin 'gpio' as an input */ +static int exynos_gpio_direction_input (struct udevice *dev,unsigned offset) { -return S5P_GPIO_GET_PIN (gpio); -} +struct exynos_bank_info *state =dev_get_priv (dev); +int ret; -/* Common GPIO API */ + 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 ); -int gpio_request (unsigned gpio,const char *label) -{return 0 ; } -int gpio_free (unsigned gpio) +/* set GPIO pin 'gpio' as an output, with polarity 'value' */ +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); + +/* Configure GPIO direction as output. */ +s5p_gpio_cfg_pin (state->bank, offset,S5P_GPIO_OUTPUT ); +return 0 ; } -int gpio_direction_input (unsigned gpio) +/* read GPIO IN value of pin 'gpio' */ +static int exynos_gpio_get_value (struct udevice *dev,unsigned offset) { -s5p_gpio_direction_input (s5p_gpio_get_bank (gpio), -s5p_gpio_get_pin (gpio)); -return 0 ; +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); } -int gpio_direction_output (unsigned gpio,int value) +/* write GPIO OUT value to pin 'gpio' */ +static int exynos_gpio_set_value (struct udevice *dev,unsigned offset, +int value) { -s5p_gpio_direction_output (s5p_gpio_get_bank (gpio), -s5p_gpio_get_pin (gpio), 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 ; } -int gpio_get_value (unsigned gpio) +static int exynos_gpio_request (struct udevice *dev,unsigned offset, +const char *label) { -return (int )s5p_gpio_get_value (s5p_gpio_get_bank (gpio), -s5p_gpio_get_pin (gpio)); +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 ; } -int gpio_set_value (unsigned gpio,int value) +static int exynos_gpio_free (struct udevice *dev,unsigned offset) { -s5p_gpio_set_value (s5p_gpio_get_bank (gpio), -s5p_gpio_get_pin (gpio), value); +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 */ +/* +* There is no common GPIO API for pull, drv, pin, rate (yet). These +* functions are kept here to preserve function ordering for review. +*/ void gpio_set_pull (int gpio,int mode) { s5p_gpio_set_pull(s5p_gpio_get_bank(gpio),
@@ -317,3 +355,115 @@ void gpio_set_rate(int gpio, int mode)s5p_gpio_set_rate (s5p_gpio_get_bank (gpio),s5p_gpio_get_pin (gpio), mode); } + +#ifndef CONFIG_SPL_BUILD +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 ; +else if (cfg ==S5P_GPIO_INPUT ) +return GPIOF_INPUT ; +else +return GPIOF_FUNC ; +} + +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) +{ +struct gpio_dev_priv *uc_priv = dev->uclass_priv; +struct exynos_bank_info *priv = dev->priv; +struct exynos_gpio_platdata *plat = dev->platdata; + +/* Only child devices have ports */ +if (!plat) +return 0 ; + + priv->bank = plat->bank; + + uc_priv->gpio_count =GPIO_PER_BANK ; + 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 Exynos GPIO bank. +*/ +static int gpio_exynos_bind (struct udevice *parent) +{ +struct exynos_gpio_platdata *plat = parent->platdata; +struct s5p_gpio_bank *bank, *base; +const void *blob = gd->fdt_blob; +int node; + +/* If this is a child device, there is nothing to do here */ +if (plat) +return 0 ; + + base = (struct s5p_gpio_bank *)fdtdec_get_addr (gd->fdt_blob, + parent->of_offset,"reg" ); +for (node =fdt_first_subnode (blob, parent->of_offset), bank = base; + node >0 ; + node =fdt_next_subnode (blob, node), bank++) { +struct exynos_gpio_platdata *plat; +struct udevice *dev; +fdt_addr_t reg; +int ret; + +if (!fdtdec_get_bool (blob, node,"gpio-controller" )) +continue ; + plat =calloc (1 ,sizeof (*plat)); +if (!plat) +return -ENOMEM ; + reg =fdtdec_get_addr (blob, node,"reg" ); +if (reg !=FDT_ADDR_T_NONE ) + bank = (struct s5p_gpio_bank *)((ulong )base + reg); + plat->bank = bank; + plat->bank_name =fdt_get_name (blob, node,NULL ); +debug ("dev at %p: %s\n" , bank, plat->bank_name); + + 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 ="samsung,exynos4210-pinctrl" }, + { .compatible ="samsung,exynos4x12-pinctrl" }, + { .compatible ="samsung,exynos5250-pinctrl" }, + { .compatible ="samsung,exynos5420-pinctrl" }, + { } +}; + +U_BOOT_DRIVER (gpio_exynos) = { + .name ="gpio_exynos" , + .id =UCLASS_GPIO , + .of_match = exynos_gpio_ids, + .bind = gpio_exynos_bind, + .probe = gpio_exynos_probe, + .priv_auto_alloc_size =sizeof (struct exynos_bank_info ), + .ops = &gpio_exynos_ops, +}; +#endif
include/configs/exynos-common.h +4 -0
@@ -17,6 +17,10 @@#include <linux/sizes.h> #define CONFIG_SYS_GENERIC_BOARD +#define CONFIG_DM +#define CONFIG_CMD_DM +#define CONFIG_DM_GPIO +#define CONFIG_ARCH_CPU_INIT #define CONFIG_DISPLAY_CPUINFO #define CONFIG_DISPLAY_BOARDINFO
include/configs/s5p_goni.h +3 -0
@@ -290,5 +290,8 @@#define CONFIG_OF_LIBFDT #define CONFIG_SYS_GENERIC_BOARD +#define CONFIG_DM +#define CONFIG_CMD_DM +#define CONFIG_DM_GPIO #endif /* __CONFIG_H */
include/configs/smdkc100.h +3 -0
@@ -227,5 +227,8 @@#define CONFIG_OF_LIBFDT #define CONFIG_SYS_GENERIC_BOARD +#define CONFIG_DM +#define CONFIG_CMD_DM +#define CONFIG_DM_GPIO #endif /* __CONFIG_H */
Signature · 1 line
2.1.0.rc2.206.gedb03e5
v8 cover Enable driver model for GPIOs on Tegra and Exynos
In reply to Simon GlassHi Minkyu,
Quoted 34 lines · Simon Glass
(Note: Tegra patches have been applied, I am resending with exynos only)
Now that driver model is part of U-Boot, the task of converting drivers over to it begins. GPIO is one of the easiest to convert, since it already has a sandbox driver and a uclass driver.
The Tegra GPIO driver is relatively simple since it has a linear numbering and already uses the generic GPIO framework. Each GPIO bank has a separate device. Some arguments have been made that a single device should support all the GPIO banks, but currently the driver model uclass does not work that way and it would require a second-level data structure to handle the bank feature.
This driver has been tested on:
- Seaboard (Tegra 20)
- Beaver (Tegra 30)
- Jetson-TK1 (Tegra 124).I don't have a Tegra 114 board (Dalmore seems to be the only one with U-Boot support) but I am quite confident that it works.
For exynos, the pinctrl device tree files are brought in from the kernel and cut down to remove the groupings which we don't yet use. Very small additions are made to avoid replicating the awful tables that Linux has for every exynos SoC. This series sits on top of the exynos refactors.
The 'gpio' command is updated to support display of only the allocated GPIOs. This is much more friendly than displaying a large table.
A few related clean-ups are provided as well.
This series is available at u-boot-dm.git, branch working.
Quoted 8 lines
Changes in v8:
- Adjust odroid device tree file to use #include instead of /include/
- Add missing special case reg property for exynos5420 GPX0
- Add patch containing pinctrl settings fors5p_goni
- Add patch containing pinctrl settings fors5p_goni
- Add new patch to move smdkc100 to generic board
- Add new patch to moves5p_gonito generic board
- Enable driver model for smdkc100 ands5p_goniseparately
Are you comfortable with me applying this series and the serial and SPI ones to dm/next (along with the contributed goni patch)? It is too late for this release and that will give us lots of testing time for 2015.01. I'd like to pull together all the driver model stuff over the next few days.
Regards,
Simon
v8 cover Enable driver model for GPIOs on Tegra and Exynos
Hi Minkyu,
Quoted 46 lines · Simon Glass
Hi Minkyu,
Quoted 34 lines · Simon Glass
(Note: Tegra patches have been applied, I am resending with exynos only)
Now that driver model is part of U-Boot, the task of converting drivers over to it begins. GPIO is one of the easiest to convert, since it already has a sandbox driver and a uclass driver.
The Tegra GPIO driver is relatively simple since it has a linear numbering and already uses the generic GPIO framework. Each GPIO bank has a separate device. Some arguments have been made that a single device should support all the GPIO banks, but currently the driver model uclass does not work that way and it would require a second-level data structure to handle the bank feature.
This driver has been tested on:
- Seaboard (Tegra 20)
- Beaver (Tegra 30)
- Jetson-TK1 (Tegra 124).I don't have a Tegra 114 board (Dalmore seems to be the only one with U-Boot support) but I am quite confident that it works.
For exynos, the pinctrl device tree files are brought in from the kernel and cut down to remove the groupings which we don't yet use. Very small additions are made to avoid replicating the awful tables that Linux has for every exynos SoC. This series sits on top of the exynos refactors.
The 'gpio' command is updated to support display of only the allocated GPIOs. This is much more friendly than displaying a large table.
A few related clean-ups are provided as well.
This series is available at u-boot-dm.git, branch working.
Quoted 8 lines
Changes in v8:
- Adjust odroid device tree file to use #include instead of /include/
- Add missing special case reg property for exynos5420 GPX0
- Add patch containing pinctrl settings fors5p_goni
- Add patch containing pinctrl settings fors5p_goni
- Add new patch to move smdkc100 to generic board
- Add new patch to moves5p_gonito generic board
- Enable driver model for smdkc100 ands5p_goniseparately
Quoted 5 lines
Are you comfortable with me applying this series and the serial and SPI ones to dm/next (along with the contributed goni patch)? It is too late for this release and that will give us lots of testing time for 2015.01. I'd like to pull together all the driver model stuff over the next few days.
Any comments on this please? I have >100 patches to get through in this merge window so I would like to start soon. If you have time to review / ACK the patches that would help also.
Thanks,
Simon