Home | History | Annotate | Download | only in samsung
History log of /src/sys/arch/arm/samsung/exynos_gpio.c
RevisionDateAuthorComments
 1.33  11-Feb-2022  riastradh arm/samsung: Don't abuse child's dv_private for the parent's uses.

dv_private belongs to the device itself, i.e., the child here.

This overwrote the child's softc pointer, causing all kinds of havoc;
if this worked it was by an amazing accident.
 1.32  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.31  24-Apr-2021  thorpej branches: 1.31.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.30  18-Jan-2021  thorpej branches: 1.30.2;
Remove "struct of_compat_data" and replace its usage with
"struct device_compatible_entry"; they are ABI-compatible.

Fix several "loses const qualifier" bugs encountered during
this conversion.
 1.29  20-Mar-2020  skrll branches: 1.29.4;
Support Exynos 5410 GPIO
 1.28  20-Mar-2020  skrll G/C
 1.27  20-Mar-2020  skrll Use __BIT/__SHIFTOUT some more. NFCI.
 1.26  17-Mar-2020  skrll Traiing whitespace
 1.25  04-Jul-2018  jmcneill branches: 1.25.4;
Remove some duplicate code
 1.24  02-Jul-2018  jmcneill Make the pinctrl driver actually work.
 1.23  31-Dec-2015  marty branches: 1.23.16; 1.23.18;
XU4 gpio - get rid of annoying printf
 1.22  30-Dec-2015  marty XU4 i2c, gpio & pinctrl changes

modify exynos_gpio.c to support the new pinctrl model.
set up the new pinctrl model in exynos_pinctrl.c

Flesh out exynos_i2c.c and set it up to use the new pinctrl model. NOTE:
exynos_i2c.c is still incomplete. I need to figure out what to set the
prescaler and scaler to.
 1.21  27-Dec-2015  jmcneill make exynos_gpio_fdt_acquire actually work, now dwcmmc properly does card detect for micro SD slot
 1.20  27-Dec-2015  jmcneill handle active low flag, simplify bank / pin name parsing, no need to panic if bank lookup fails
 1.19  27-Dec-2015  marty XU4 gpio clean up acquire code

properly locate the bank in the acquire code. This may even work.
 1.18  24-Dec-2015  marty XU4 GPIO Review Changes

Implement suggestions from Jared.
 1.17  22-Dec-2015  jmcneill Add fdtbus_gpio_{read,write}_raw, which tells the controller not to take
polarity into account. Tegra GPIO pin data includes pin polarity, but so
does a regulator-fixed node, so the end result was that the enable value
was being swapped twice. Change fregulator to use the raw APIs, and adapt
Tegra and Exynos GPIO drivers to support this flag.
 1.16  22-Dec-2015  marty XU4 GPIO Driver

This is a moderately tested working gpio driver for the Exynos based ODROID
XU4. To use this you have to edit the dtd file exynos54422-pinctrl.dtsi
and change the two occurances of 'gpz' to 'gpz0'. Otherewise it will crash
on a lookup failure.

It certainly could use a code review.
 1.15  21-Dec-2015  marty XU4 FDT final checkpoint

step N of N: get rid of baggage by removing whole files. What's left is in
approximately the same shape as when the FDT update started, that is mostly
broken. What's missing is most of the 76 devices recognized in the dtd. In
other words, This is barely the start of a port.

Next up, gpio then i2c, followed either by straightening out usb or getting
the sdhc driver to work -- both probably require getting the interrupt
combiner to work first. A large chunk of work is left to do on the clocks.
I barely got them attaching to fdt and didn't do anything to take advantage
of the information in the dtd.

None of the other existing drivers, such as they are, properly request gpios,
i2c or clocks, and, of course power domains are off the table.
 1.14  19-Dec-2015  marty XU4 GPIO FDT broken snapshot

This is broken. exynos_gpio_bank_config and the call to it are wrong, and
the acquire function doesn't work.

But I'm in over my head and I need to discuss this:

There is a problem with the dtd: it doesn't have addresses for the individual
gpios. Do I add the addresses to it, or go back to the old version where I
have them hard coded in the driver.

There is a problem with creating the gpio device entries: I suspect I really
need to treat the pinctrl devices as busses and create the gpios as attached
to those busses, but I'm not familiar with how to do that in NetBSD. At the
minimum, a pointer to a similar situation would give me code to follow.
This is different than the usual bus attachment in that the gpios aren't
devices in the dtd (they don't have "compatible" properties) so they don't
get an attach routine called. An alternative to generating the bus
attachments might be to add "compatible" properties to the GPIO entries
in the dtd. so that they do get attached in the normal way.

If I'm going to modify the DTD, then it should be checked in, so a decision
on where to check them in would be nice, even if it does mean spreading them
all over because of license issues. (This DTD is GPL v2)
 1.13  11-Dec-2015  marty EXYNOS Rewrite step 2 of N: New exynos_gpio.c

I can't bring myself to fully nuke from orbit, so there are really two
things in this checkin:

1) A major rewrite of exynos_gpio.c, based mostly on the Nvidia
tegra_gpio.c file. This is missing a major function that will be
added the first time a customer for it is integrated, which is meant to
select pins based on aliases, rather than pin bank names.

2) A small number of changes to other files that keep the tree compiling
and progressing as far as ever; except it is now 5422 specific and
will not boot on the other exynos socs, which I don't have hardware to
test.

The choice to remove functionality is always controversial, but since
we are doing a significant rewrite and I don't have either
documentation or hardware *and* none of the code really works now
anyway, I'm taking the stance that only tested functionality should be
added, and that we'll layer the other exynos socs on this once it
fully boots.
 1.12  29-Dec-2014  skrll Trailing whitespace.
 1.11  24-Sep-2014  reinoud branches: 1.11.2;
Add extra GPIO chunk for 5410
 1.10  09-Sep-2014  reinoud Xuhost bits for Exynos5 are located in the two top bits
 1.9  05-Sep-2014  skrll RCSId police
 1.8  26-Aug-2014  reinoud Make it compile without DIAGNOSTIC
 1.7  14-Aug-2014  reinoud branches: 1.7.2;
Add GPIO definitions for Exynos5 series (taken from 5250)
 1.6  21-May-2014  reinoud branches: 1.6.2; 1.6.4; 1.6.6;
Don't panic if the pin is not available in pin_reserve() but return false
instead.
 1.5  16-May-2014  reinoud branches: 1.5.2;
Fix issues with the gpio controller:
* the func get/put shift is 4 bits, not 16!
* redo available and inuse bits
* create a function to get a pindata from a pinset
 1.4  14-May-2014  reinoud Revisit gpio and revisit register file mapping. The additional register files
are now mapped behind the origional register file.

The gpio channel GPZ is mapped over I2S0 in the separate audio register file
and were both abusively mapped over I2C0 in the main register file!

While here, delay the gpio bootstrap till on attachment. We could hasten it in
the odroid_machdep.c if needed. Also make the gpio code more resilliant and
allow booting correctly without any GPIO bits defined/available.
 1.3  10-May-2014  reinoud Fix typo
 1.2  10-May-2014  reinoud Add the missing ETC0, ETC6, ETC7, ETC8 `gpio' registers. They are special in
that they can't be set/unset nor configured. The only changeable parameters
are the pullups PUD and the DRV driving strength. They however fit the same
structure as the rest of the GPIOs and are used as such.
 1.1  09-May-2014  reinoud Implement gpio framework for the Samsung Exynos series.

Note that only the Exynos4 gpio registers are defined now and provision is
taken to allow for seamlessness adding of Exynos5 values.
 1.5.2.2  18-May-2014  rmind sync with head
 1.5.2.1  16-May-2014  rmind file exynos_gpio.c was added on branch rmind-smpnet on 2014-05-18 17:44:59 +0000
 1.6.6.1  04-Jan-2015  martin Pull up the following revisions, requested by skrll in #373:

sys/arch/arm/samsung/exynos4_loc.c 1.10-1.11
sys/arch/arm/samsung/exynos4_reg.h 1.8-1.13
sys/arch/arm/samsung/exynos5_loc.c 1.8-1.12
sys/arch/arm/samsung/exynos5_reg.h 1.11-1.20
sys/arch/arm/samsung/exynos_gpio.c 1.7-1.12
sys/arch/arm/samsung/exynos_i2c.c 1.2-1.3
sys/arch/arm/samsung/exynos_intr.h 1.2
sys/arch/arm/samsung/exynos_io.c 1.7-1.8
sys/arch/arm/samsung/exynos_io.h 1.5-1.6
sys/arch/arm/samsung/exynos_reg.h 1.8-1.13
sys/arch/arm/samsung/exynos_smc.S 1.2-1.3
sys/arch/arm/samsung/exynos_soc.c 1.15-1.27
sys/arch/arm/samsung/exynos_usb.c 1.8-1.13
sys/arch/arm/samsung/exynos_var.h 1.13-1.18
sys/arch/arm/samsung/exynos_wdt.c 1.5
sys/arch/arm/samsung/mct.c 1.4-1.5
sys/arch/arm/samsung/mct_reg.h 1.2
sys/arch/arm/samsung/mct_var.h 1.3
sys/arch/arm/samsung/smc.h 1.2
sys/arch/arm/samsung/sscom.c 1.7
sys/arch/evbarm/odroid/odroid_machdep.c 1.25-1.39
sys/arch/evbarm/odroid/odroid_start.S 1.4-1.6
sys/arch/evbarm/conf/std.odroid 1.3-1.5
sys/arch/evbarm/conf/ODROID delete
sys/arch/evbarm/conf/ODROID-U 1.10-1.17
sys/arch/evbarm/conf/ODROID_INSTALL delete
sys/arch/evbarm/conf/ODROID-XU 1.1-1.4

Improve ODROID support.
 1.6.4.2  10-Aug-2014  tls Rebase.
 1.6.4.1  21-May-2014  tls file exynos_gpio.c was added on branch tls-earlyentropy on 2014-08-10 06:53:52 +0000
 1.6.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.2.1  21-May-2014  yamt file exynos_gpio.c was added on branch yamt-pagecache on 2014-05-22 11:39:34 +0000
 1.7.2.3  03-Dec-2017  jdolecek update from HEAD
 1.7.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.2.1  14-Aug-2014  tls file exynos_gpio.c was added on branch tls-maxphys on 2014-08-20 00:02:47 +0000
 1.11.2.3  19-Mar-2016  skrll Sync with HEAD
 1.11.2.2  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.11.2.1  06-Apr-2015  skrll Sync with HEAD
 1.23.18.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.23.18.1  10-Jun-2019  christos Sync with HEAD
 1.23.16.1  28-Jul-2018  pgoyette Sync with HEAD
 1.25.4.2  21-Mar-2020  martin Pull up following revision(s) (requested by skrll in ticket #798):

sys/arch/arm/samsung/exynos_pinctrl.c: revision 1.17
sys/arch/arm/samsung/exynos_pinctrl.h: revision 1.3
sys/arch/arm/samsung/exynos_gpio.c: revision 1.27
sys/arch/arm/samsung/exynos_gpio.c: revision 1.28
sys/arch/arm/samsung/exynos_gpio.c: revision 1.29
sys/arch/arm/samsung/exynos_var.h: revision 1.28

Use __BIT/__SHIFTOUT some more. NFCI.

G/C

Support Exynos 5410 GPIO
 1.25.4.1  21-Mar-2020  martin Pull up following revision(s) (requested by skrll in ticket #796):

sys/arch/arm/samsung/exynos_pinctrl.c: revision 1.16
sys/arch/arm/samsung/exynos5410_clock.c: revision 1.6
sys/arch/arm/samsung/exynos_gpio.c: revision 1.26
sys/arch/arm/samsung/exynos_uart.c: revision 1.3
sys/arch/arm/samsung/exynos5422_clock.c: revision 1.15

Trailing whitespace
 1.29.4.1  03-Apr-2021  thorpej Sync with HEAD.
 1.30.2.1  23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.31.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed