History log of /linux-master/drivers/staging/greybus/arche-apb-ctrl.c
Revision Date Author Comments
# 9b19a31c 03-Apr-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

staging: greybus: arche-apb-ctrl: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230403154014.2564054-5-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5a9bdd6f 12-Apr-2022 Jaehee Park <jhpark1013@gmail.com>

staging: greybus: correct typo in comment

Correct a spelling typo from 'Atleast' to 'At least' in comment.
Issue found by checkpatch.

Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
Link: https://lore.kernel.org/r/2feb03de97ca4dbd27c22cf40f8e185f7dfaae29.1649824370.git.jhpark1013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# fbacec8f 14-Jan-2019 Nishad Kamdar <nishadkamdar@gmail.com>

staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

Use the gpiod interface instead of the deprecated old non-descriptor
interface while continuing to ignore gpio flags from device tree in
functions "deassert_reset()" and "assert_reset()" for now.

Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# fea06c0b 09-Nov-2018 Ioannis Valasakis <code@wizofe.uk>

staging: greybus: remove multiple blank lines

Remove continuous multiple blank lines.
Reported by checkpatch.

Signed-off-by: Ioannis Valasakis <code@wizofe.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 339744e2 17-Dec-2017 Kamal Heib <kamalheib1@gmail.com>

staging: greybus: arche-apb-ctrl.c: Fix alignment should match open parenthesis

Fix "alignment should match open parenthesis" checkpatch.pl error.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 863dbc52 07-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: greybus: Remove redundant license text

Now that the SPDX tag is in all greybus files, that identifies the
license in a specific and legally-defined manner. So the extra GPL text
wording can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text. And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Acked-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Acked-by: David Lin <dtwlin@gmail.com>
Acked-by: Johan Hovold <johan@kernel.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Mark Greer <mgreer@animalcreek.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# eb50fd3a 07-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: greybus: add SPDX identifiers to all greybus driver files

It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/staging/greybus files files with the correct SPDX
license identifier based on the license text in the file itself. The
SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com>
Cc: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Acked-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Acked-by: David Lin <dtwlin@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Acked-by: Johan Hovold <johan@kernel.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Mark Greer <mgreer@animalcreek.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1e029b83 16-May-2017 Johan Hovold <johan@kernel.org>

staging: greybus: arche: remove timesync remains

Remove the remaining timesync bits that were left in the arche platform
driver and which prevented the driver from being compiled.

Fixes: bdfb95c4baab ("staging: greybus: remove timesync protocol support")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 461ab807 09-Feb-2017 Gioh Kim <gi-oh.kim@profitbricks.com>

staging: greybus: fix "line over 80 characters" coding style issues

This patch fixes only obvious lines.
There are still more issues.

Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6da80863 16-Dec-2016 Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>

staging: greybus: arche-apb-ctrl: fix unused warnings on resume/suspend

When CONFIG_PM_SLEEP is disabled, SIMPLE_DEV_PM_OPS does not use
arche_apb_ctrl_resume and arche_apb_ctrl_suspend functions:

drivers/staging/greybus/arche-apb-ctrl.c:478:12: warning:
‘arche_apb_ctrl_resume’ defined but not used [-Wunused-function]
static int arche_apb_ctrl_resume(struct device *dev)
^~~~~~~~~~~~~~~~~~~~~
drivers/staging/greybus/arche-apb-ctrl.c:464:12: warning:
‘arche_apb_ctrl_suspend’ defined but not used [-Wunused-function]
static int arche_apb_ctrl_suspend(struct device *dev)
^~~~~~~~~~~~~~~~~~~~~~

Adding __maybe_unused to the declaration of these functions removes the
warnings.

Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1047cc13 03-Oct-2016 Hisao Tanabe <xtanabe@gmail.com>

staging: greybus: fix block comment

This patch fix the coding style problem of block comment detected by the
checkpatch.pl.

WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: Hisao Tanabe <xtanabe@gmail.com>
Acked-by: Johan Hovold <johan@kernel.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cb026e39 03-Oct-2016 Sidhant Gupta <guptasidhant004@gmail.com>

staging: greybus: Fix a commit coding style issue.

Fixes a comment coding style warning by adding 2 blank lines. Issue
found by checkpatch.

Signed-off-by: Sidhant Gupta <guptasidhant004@gmail.com>
Acked-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5c925fe2 22-Sep-2016 Eva Rachel Retuya <eraretuya@gmail.com>

staging: greybus: arche-apb-ctrl: declare struct of_device_id as const

Declare the 'arche_apb_ctrl_of_match' array as const. This array is only stored
in the .of_match_table field of a device_driver structure, which is declared as
const. This addresses the checkpatch warning:

WARNING: struct of_device_id should be normally const

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 921dbe52 28-Jul-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-platform: Add support for SPI bus sharing for Mihi

In case of Mihi, SPI bus is shared between APB1 and APB2
SPI ROMs, so their FW flashing must be sequential and
arche-platform driver should make sure that they are mutual
exclusive in nature.

So this patch adds certain restrictions to the user of the
arche-platform driver,

- User can no longer flash APB1 and APB2 SPI ROM in parallel
- SPI bus becomes an resource, so user must claim it by moving
respective APB device into FW_FLASHING mode and release it
by exiting FW_FLASHING mode. User can exit FW_FLASHING mode by
switching to any other modes (ACTIVE, OFF, STANDBY).
- If APB1 is in FW_FLASHING mode, APB2 can no longer enter into
FW_FLASHING mode. User will get -EBUSY.

Having said that, while APB1 is into FW_FLASHING mode,
APB2 can independently boot from its own SPI ROM.

Testing Done: Tested by simulating usecase on EVT2.
- Made sure that APB1 and APB2 FW_FLASHING mode is mutual exclusive
in nature. Confirmed that an attempt on second device return -EBUSY.
- Added simulating code, where printed state of dummy gpio for
spi-en and verified that it shows right pin status for both APBs

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 20de72f5 28-Jul-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Rename ara,init-disable => arche,init-disable

Inline with other properties used for arche-platform driver,
rename ara,init-disable => arche,init-disable.

Testing Done: Boot tested on EVT2 platform

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 1f77b363 12-Jul-2016 David Lin <dtwlin@google.com>

greybus: hd: arche-platform: implement greybus shutdown

Implement platform driver shutdown callback to perform proper greybus
shutdown so that the userspace unipro_shutdown service that shuts down
the APB/SVC abruptly can be removed. The shutdown callback in
arche-platform will first remove SVC so that all the Interface can be
Deactivated in a sequence according to the spec before powering off the
APB:

Before:
-> Arche/APB power off
-> SoC power off

After this patch:
-> HD shutdown
-> SVC shutdown
-> Module shutdown
-> Interface shutdown
-> Bundle shutdown
-> Arche/APB power off
-> SoC power off

Testing Done:
- Observe all Interfaces are deactivated in the log during shutdown
- Measure power off current and make sure no regression

Signed-off-by: David Lin <dtwlin@google.com>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 970dc85b 05-Jun-2016 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

greybus: timesync: Add timesync core driver

This patch adds the core timesync functionality.

0. arche-platform.c/arche-apb-ctrl.c
Modifies the platform layer to hook the incoming TIME_SYNC signal up to
the timesync strobe IRQ handler. If the arche-platform driver can't
satisfy the request for the wake-detect line, it will return -EAGAIN and
the calling work-queue must reschedule the attempt to get exclusive
access to the wake-detect pin logic. A private data field is added to
the arche-platform driver to enable passing of a timesync pointer to the
ISR responsible for synchronizing time.

1. timesync.c
A new file added which contains all of the logic associated with sending
greybus commands to SVC, APBx or Interfaces to enable, disable and
disseminate timing information.

2. timesync_platform.c
Any platform/arch specific code goes into timesync_platform.c.
Originally the idea was to keep the x86 and ARM arch dependencies in a
timesync_platform_arch.c file - however with further refinement that's
currently not necessary however just-in-case it becomes necessary to
resuscitate arch or platform specific methods for accessing timer
resources that access shouldn't be part of the core timesync.c logic and
so for the moment we access these timer resources through a thin access
layer in timesync_platform.c. Expect this to go away long term ideally.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 7b62b61c 20-Apr-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: arche-ctrl: Don't expose driver internals to arche-platform driver

We have chosen the *ugly* way of registering two platform drivers from
the module_init() of only one of them, so that we can avoid having two
separate modules for them.

But we should still be doing this in a sane way. There is no need to
expose internals of arche-ctrl to arche-platform, like PM-ops, probe,
resume, id-table, etc. Just expose an init and a exit callback.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 7fe93014 07-Mar-2016 David Lin <dtwlin@google.com>

greybus: arche-platform: fix incorrect gpio variable type

GPIO number obtained from of_get_named_gpio() should be signed to allow
error handling.

Testing Done:
Built & booted on EVT1.5

Signed-off-by: David Lin <dtwlin@google.com>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 037a4028 24-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Remove extra delay in APB reset

With synchronization between SVC <=> AP over wake/detect line to
bring APB's out of reset, we do not need any extra delays now.
So remove it.

Testing Done: Tested for DB3.5 and EVT1.2 platform.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Reviewed-by: Michael Scott <michael.scott@linaro.org>
Tested-by: Michael Scott <michael.scott@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# c5e7cbaf 22-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Return immediately if in same state from state change fns

Have a check inside all individual operational state change functions
to check whether device is in same state, and if yes, then return
immediately.

Testing Done: Tested on DB3.5 platform.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# ee97e24a 16-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Do not coldboot APBs in probe

Since parent driver (SVC) is controlling APBs directly, we do not
need to bringup APBs in its own probe.

Testing Done: Tested on EVT1.2.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Reviewed-by: Michael Scott <michael.scott@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# bc8eadd4 12-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Do not export any gpios

With addition of operational state in driver, user/developer
can switch to FW flashing state through sysfs. So no need to
export any gpios to userspace now.

Testing Done: Tested on EVT1.2 and DB3.5 platform

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 65fd5a50 12-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Export operational fns from driver

In order to use single wake/detect line for both APB's we need to have
access to APB operational functions to parent/SVC driver.
So export coldboot, standby_boot, fw_flashing and poweroff operation
functions from the driver.

Testing Done: Tested on EVT1.2 and DB3.5 platform

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 80a057aa 12-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Rename internal operational state fns

This is preparation for enabling export set of operational fns
to parent driver.
So it is important to differentiate internal ops function against
externally accessed (from parent).

Testing Done: Tested on EVT1.2 and DB3.5 platform.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# af3aae10 12-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Introduce ara,init-disable property for APB

New DT property "ara,init-disable" will allow user to disable
APB1 or APB2 during boot and enable it only when needed through
command prompt via sysfs interface.

- To disable APB2 during boot, specify "ara,init-disable" property in
respective APB node.

- How to check the state
# cat /sys/devices/arche_platform.*/apb*/state

It should be 'off', if 'ara,init-disable' enabled in DT.

- During runtime if user/developer desired to enable APB2 (strictly and
only for development purpose) then respective APB can be enabled
through,

# echo active > /sys/devices/arche_platform.*/apb*/state

Note:
- If APB device is in 'off,disabled' state, then no state transitions
are permitted.
- User/developer must first activate APB device

# echo active > /sys/devices/arche_platform.*/apb*/state

This will clear the 'init-disable' flag and allow state transition
from here onwards.
Note that, 'off,disabled' is only indicative state and is only
applicable during init/boot.

Testing Done: Tested on EVT1.2 and DB3.5 platform

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 33d76291 12-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Add sysfs to allow user to change state

This patch introduces sysfs interface for the user space to enable
state change of the driver. Driver supports below operational
states,

- off
- active
- standby
- fw_flashing

To see the current state

i # cat /sys/devices/arche_platform.*/apb*/state

And to change the state
# echo [off/active/standby/fw_flashing] > /sys/devices/arche_platform.*/apb*/state

Testing Done: Tested on EVT1.2 and DB3.5 platform

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 6961e046 12-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Pass only platform_device to _seq fns

Pass only pointer to platform_device to _seq fns and fetch handle to
arche_apb_ctrl_drvdata from platform_device.

This is preparation for support for dynamic switching between operational
states for the device, where these functions will be called from parent
driver.

Testing Done: Tested on EVT1.2 and DB3.5 platform.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# f2222a41 12-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Set default state value to OFF

Explicitly set default apb->state value to ARCHE_PLATFORM_STATE_OFF
in probe() fn.

Testing Done: Tested on EVT1.2 and DB3.5 platform

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 5667ab17 12-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Rename init_seq and cleanup fn

apb_ctrl_coldboot_seq() and apb_ctrl_poweroff_seq()
is appropriate name as per spec and implementation, so rename it.
Also move apb_ctrl_poweroff_seq() fn above, to group it with
other _seq functions.

Testing Done: Tested on EVT1.2 and DB3.5 platform.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 6ceed512 12-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Re-arrange init sequence

In order to allow APB2 disable by default on boot/init, and also
provide interface to user to enable it later on, re-arrange the init_seq
fn.
The idea here is, the apb_ctrl_init_seq() fn will be renamed to
apb_ctrl_coldboot_seq(), and should not try to claim any resources.
All the resource claim should happen in apb_ctrl_get_devtree_data() fn.

And also uses devm_gpio_request_one() fn wherever possible.

Testing Done: Tested on EVT1.2 and DB3.5 platform.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# a821adb4 12-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-platform: make apb_state common to both platform drivers

Make 'enum apb_state' common to both platform drivers, so that
both drivers can make use of same state and user will have
unified control configuration across devices (SVC, APB1 and APB2)

Testing Done: Tested on EVT1.2 and DB3.5 platform.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# f6d6f5bd 09-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: Revert "arche-apb-ctrl: Remove extra delay in APB reset"

We are seeing failures on DB3.1 board, and Axel root-caused it to this
commit, so revert it as of now.

This reverts commit 942627227684c187b727ba5fb581bc2d886b6708.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 60846535 04-Feb-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Remove extra delay in APB reset

With synchronization between SVC <=> AP over wake/detect line to
bring APB's out of reset, we do not need any extra delays now.
So remove it.

Testing Done: Tested for 10 iterations on EVT1

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Reviewed-by: Michael Scott <michael.scott@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# d8b16338 25-Jan-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-platform: Disable clock as part of driver remove

As part of driver remove (cleanup) function, disable the clock for both
SVC, APB1 & APB2.

Testing Done:
Tested on EVT1 platform with Connect=>disconnect=>connect
iteration, almost close to 100 iterations have passed (demo branch).
And also tested with kernel-only build.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# aa187d33 13-Jan-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Enable the clocks after regulator enable

It makes more sense to enable the clock after power is enabled
to the device, so move clock enable code after regulator_enable
and setting up BOOT_RET pin.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Tested-by: Michael Scott <michael.scott@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Tested-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# f1e9cbd5 11-Jan-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: deassert reset at the end of probe

Now the complete handshaking between AP<=>SVC would be
offloaded to parent driver (arche-platform) who is
responsible for SVC control, so the apb-ctrl driver can
just simply bring APB's out of reset during probe itself.

Along with deasserting reset, this patch renames the local fn
to exclusively use it for reset purpose.

Note that, driver is exporting reset gpio to
user, so user can still flash FW from prompt.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Tested-by: Michael Scott <michael.scott@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 33036178 11-Jan-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Remove wake_detect gpio and related code

With TIME_SYNC functionality, assignment of wake/detect pin
will change,
WD_8A => to bring APB's out of reset
WD_8B => TIME_SYNC operation

So in order to support this, we can no longer keep wake_detect
gpio in apb-ctrl driver. So remove it.
In the subsequent patches, wake_detect support will be added
to parent SVC driver (arche-platform) who is responsible for SVC control.

Note that, this patch also removes ISR related code.
The APB state still is maintained, for future use.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Tested-by: Michael Scott <michael.scott@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 3b858df0 10-Jan-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: arche: Remove unwanted headers and rearrange others

This removes few unwanted headers related to irq, interrupt, regulator,
spinlock, etc.

Also arrange the rest in alphabetical order to make it more readable.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 40989cf3 10-Jan-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: arche-apb: Drop unnecessary checks

wake_detect_gpio and resetn_gpio are guaranteed to be valid in
apb_ctrl_cleanup() and irq-handler, no need to check for their validity.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# d258432f 10-Jan-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: arche-apb: Do cleanup within apb_ctrl_init_seq() for error cases

Relying on apb_ctrl_cleanup() to do the cleanup for errors that occurred
within apb_ctrl_init_seq() isn't a very clean idea. Handle that
separately within apb_ctrl_init_seq().

This will clean apb_ctrl_cleanup() in later patches.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# a7a794ec 10-Jan-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: arche-apb: Don't use gpio after failing to request it

If devm_gpio_request() returns an error, we shouldn't try to set the
direction of the same gpio.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# db0cff55 10-Jan-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: arche-apb: Properly use dev_err/info/warn

Use dev_err for errors after which we need to abort the currently
running routine and dev_warn for resource allocation failure, with which
we can continue to work.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# dcf77c39 10-Jan-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: arche-apb: NULL is a valid regulator

Since NULL could in theory be a valid regulator we ought to check for
IS_ERR() rather than for NULL. In practice this is unlikely to be an
issue but it's better for neatness.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# bd62fa5e 10-Jan-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: arche-apb: devm_regulator_get() doesn't return NULL

And so we don't need to check for it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 7541c1a1 10-Jan-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: arche-apb: Replace gpio_is_valid() with gpio < 0 checks

There can be no invalid values in the DTS. The actual pin numbers are
assigned by gpiolib when the gpio controller is registered.

And so a simple 'gpio < 0' is enough instead of gpio_is_valid() which
also checks for 'gpio < ARCH_NR_GPIOS'.

This will make the usage of of_get_named_gpio() similar with how it is
done in arche-platform driver.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 977ff250 10-Jan-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: arche-apb: platform data 'apb' is guaranteed to be valid

Platform data 'apb' is guaranteed to be valid in arche_apb_ctrl_remove()
and so no need to check it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 3b538c39 10-Jan-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: arche-apb: Spelling and whitespace fixes

- s/premits/permits
- Remove blank lines at the end of the file

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# e49268cc 06-Jan-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Do not bring APB out of reset in probe

With addition of handshaking between AP <=> SVC, driver
brings out APB out of reset only on reception of WAKE_MOD
signal from SVC. So remove the deassertion from probe.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# ae0bf3a6 06-Jan-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Set wake_detect gpio to low initially

This patch enables handshaking of AP and SVC using wake_detect
gpio (WD_8A and WD_8B).
Note that WAKE_DETECT polarity is active-high, so in order to
enable handshaking between AP <=> SVC, we need to set wake_detect
gpio to low initially, so that driver can send WAKE_DET signal
(active-high) to SVC and then SVC can send back WAKE_MOD signal
(active-low).
And on reception of WAKE_MOD signal, driver would bring respective
APB out of reset.

WD_8A => APB1
WD_8B => APB2

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 6da86df3 05-Jan-2016 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-platform: Export gpio (reset & sys_boot) to user

In order to allow user to flash the firmware to,

SVC:
user need to assert the reset first, set sysboot pin and
deassert reset. And then issue a flashing command.

And APB:
User need to assert the reset first, and then issue flashing
command.

So this patch exports the gpio's to user.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 1e5dd1f8 30-Dec-2015 Greg Kroah-Hartman <gregkh@google.com>

greybus: arche-platform: merge arche-apb-ctrl and arche-platform

No need to have two separate arche platform drivers, that's just crazy,
so merge them both together to be only one kernel module.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Tested-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>


# 166f0aed 16-Dec-2015 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Assert reset to APB at the end of probe

Until we have proper handshake mechanism implemented with SVC
assert reset to APB at the end of probe.
We are safe here to do that, as SVC always enables clock to APB's
currently.
And also from EVT1 perspective, we should be good, as clock control
signals are now moved to AP.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# 5a781787 16-Dec-2015 Vaibhav Hiremath <vaibhav.hiremath@linaro.org>

greybus: arche-apb-ctrl: Add APB control driver

It was messy to integrate both SVC, APB (and any other arche
platform specific control) into one single driver. Especially
due to cross-dependency.

AP first needs to bringup SVC, as SVC should enable clock to APB.
APB should come up before HUB, as due to some reason HUB wouldn't
enumerate APB's is APB comes up later.
And on top of that we should have clean picture of hardware description
in DT file.

So this patch introduces APB control driver. Mostly copied from original
arche-platform driver + fixed boot sequence.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>