processor-firmware/ti-amx3-cm3-pm-firmware.git
7 years agoCM3: AM43XX: Add Tamper swakeup settings master
ankur [Tue, 4 Mar 2014 09:32:41 +0000 (15:02 +0530)]
CM3: AM43XX: Add Tamper swakeup settings

Provision of swakeup from Tamper source is a new addition for
AM43XX lineup SOCs.

So, below things are implemented :-

1. Tamper entry is made into list of swakeup sources.
2. Settings inside Configure/Clear wake-up source APIs.
3. Modified handlers(specific to AM43xx) to add Tamper swakeup.

Signed-off-by: ankur <a-kishore@ti.com>
7 years agoCM3: Bump firmware release version to 0x186
Russ Dill [Thu, 13 Feb 2014 22:52:06 +0000 (14:52 -0800)]
CM3: Bump firmware release version to 0x186

This includes fixes in I2C clock rate calculation for both
AM335x and AM437x. On all platforms, incorrect
calculations led to a frequency of around 520kHz
being used. The duty cycle is also corrected from 35%
to 50%.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: I2C: Fix duty cycle calculations
Russ Dill [Thu, 13 Feb 2014 22:45:43 +0000 (14:45 -0800)]
CM3: I2C: Fix duty cycle calculations

The duty cycle calculations were incorrect leading to a 35%
duty cycle. Rework the calculations to get a 50% duty cycle.

Tested on AM335x (BBB) and AM437x (ePOS EVM)

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: I2C: Fix PER CLKOUTM2 frequency calculation
Russ Dill [Thu, 13 Feb 2014 22:43:47 +0000 (14:43 -0800)]
CM3: I2C: Fix PER CLKOUTM2 frequency calculation

Based on experimental readings of the output I2C frequency,
the method used to calculate the PER CLKOUTM2 frequency
while the PER LL is in bypass was found to be incorrect. The
TRM for both AM437x and AM335x indicate that a divisor is
applied. This was found to not be the case.

Having this divisor in the code bottoms out the SCLL and SCLH
registers and causes the I2C controller to run at the highest
possible frequency possible given the input clock. This turns
out to be ~500kHz, which isn't a problem on most platforms.
However, with the AM437x ePOS EVM, the bus is not stable at
this frequency.

Removing the assumption that this divisor is applied corrects
the calculations of the SCLL and SCLH registers leading to a
correct output frequency.

Tested on AM335x (BBB) and AM437x (ePOS EVM)

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: AM437x: Add XTAL calculation code and support am437x
Russ Dill [Thu, 13 Feb 2014 22:39:07 +0000 (14:39 -0800)]
CM3: AM437x: Add XTAL calculation code and support am437x

The AM437x CONFIG_STATUS register has two places where
the master xtal frequency can be indicated, and a bit showing
where software should read the value from.  Make a function
that works for both instead of open coding it in i2c.c. This
function works for both because the bit that indicates where
to read the value from is always 0 on am335x.

This was causing issues with a miscalculation of i2c fclk
frequency on AM437x.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Update the pre-build binary to support am43xx IO isolation v05.00.00.02
Russ Dill [Sat, 1 Feb 2014 01:22:24 +0000 (17:22 -0800)]
CM3: Update the pre-build binary to support am43xx IO isolation

Firmware version 0x185

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: ddr: Only clear DDR reset line for AM335x
Dave Gerlach [Fri, 31 Jan 2014 21:57:30 +0000 (15:57 -0600)]
CM3: ddr: Only clear DDR reset line for AM335x

DDR reset line on am335x does not behave the same way as that on am43xx
so only clear it for am335x DDR3 boards.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
7 years agoCM3: AM43XX Add support for IO Isolation
Dave Gerlach [Fri, 31 Jan 2014 21:57:29 +0000 (15:57 -0600)]
CM3: AM43XX Add support for IO Isolation

Allow configuration of PRCM IO Isolation control in order to put IOs
into isolation and use DS0 states of pins. Implementation based on VTT
toggle control for GPIO0. The setting of isolation is controllable from
the A9 and will only be set if bit 10 in the IPC register has been set
from the A9 processor.

This is used to control VTT regulator on AM43xx when it is not connected
to a GPIO other than GPIO0 but can be used to control other things based
on the configuration of the DS_PAD_CONFIG bits inside the CTRL_CONF_*
register corresponding to the desired pin.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
7 years agocm3: bug-fix for cm3 version generator script
Tero Kristo [Mon, 27 Jan 2014 13:50:17 +0000 (15:50 +0200)]
cm3: bug-fix for cm3 version generator script

Script was incorrectly using logical OR instead of a binary one, which
resulted in the version being always 0x1 and being rejected by kernel.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
7 years agocm3: License.txt: break lines at 80-characters
Felipe Balbi [Mon, 23 Dec 2013 20:18:50 +0000 (14:18 -0600)]
cm3: License.txt: break lines at 80-characters

It makes it a lot easier to read through the file.

Signed-off-by: Felipe Balbi <balbi@ti.com>
7 years agocm3: utf8-ify License.txt agreement
Felipe Balbi [Mon, 23 Dec 2013 20:18:27 +0000 (14:18 -0600)]
cm3: utf8-ify License.txt agreement

Original file was in some weird character-set,
by converting it to UTF-8, we make sure more
readers are able to read it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
7 years agocm3: improve Makefile a little more
Felipe Balbi [Mon, 23 Dec 2013 20:17:01 +0000 (14:17 -0600)]
cm3: improve Makefile a little more

after this patch, with a simple make command
we will build both new binaries and output
looks very clean, as below:

$ make
     CC       src/foundation/cm3.o
     CC       src/foundation/exception_handlers.o
     CC       src/foundation/ext_intr_handlers.o
     CC       src/foundation/rtc.o
     CC       src/foundation/startup.o
     CC       src/lib/debug.o
     CC       src/lib/printf.o
     CC       src/lib/puts.o
     CC       src/lib/string.o
     CC       src/pm_services/clockdomain.o
     CC       src/pm_services/clockdomain_335x.o
     CC       src/pm_services/clockdomain_43xx.o
     CC       src/pm_services/ddr.o
     CC       src/pm_services/dpll.o
     CC       src/pm_services/dpll_335x.o
     CC       src/pm_services/dpll_43xx.o
     CC       src/pm_services/hwmod.o
     CC       src/pm_services/hwmod_335x.o
     CC       src/pm_services/hwmod_43xx.o
     CC       src/pm_services/i2c.o
     CC       src/pm_services/ldo.o
     CC       src/pm_services/ldo_335x.o
     CC       src/pm_services/ldo_43xx.o
     CC       src/pm_services/pm_handlers.o
     CC       src/pm_services/powerdomain.o
     CC       src/pm_services/powerdomain_335x.o
     CC       src/pm_services/pm_state_data.o
     CC       src/pm_services/powerdomain_43xx.o
     CC       src/pm_services/prcm_core.o
     CC       src/sys_exec/msg.o
     CC       src/sys_exec/sync.o
     CC       src/sys_exec/sys_init.o
     CC       src/sys_exec/trace.o
     LINK     am335x-pm-firmware.elf
     GEN      am335x-pm-firmware.bin

Signed-off-by: Felipe Balbi <balbi@ti.com>
7 years agocm3: generate version number from Makefile
Felipe Balbi [Mon, 23 Dec 2013 20:17:00 +0000 (14:17 -0600)]
cm3: generate version number from Makefile

This will make it a lot easier to make releases
out of this source code.

In order to make sure we're using the same version
number, this patch also changes Makefile to use
version 0x184.

Signed-off-by: Felipe Balbi <balbi@ti.com>
7 years agocm3: add a script to generate version number
Felipe Balbi [Mon, 23 Dec 2013 20:16:59 +0000 (14:16 -0600)]
cm3: add a script to generate version number

This way we can fix version number in Makefile
only.

Signed-off-by: Felipe Balbi <balbi@ti.com>
7 years agocm3: add tags and *.diff to .gitignore
Felipe Balbi [Mon, 23 Dec 2013 20:16:58 +0000 (14:16 -0600)]
cm3: add tags and *.diff to .gitignore

few extra files which should be ignored.

Signed-off-by: Felipe Balbi <balbi@ti.com>
7 years agocm3: pretty print build sequence
Felipe Balbi [Mon, 23 Dec 2013 20:16:57 +0000 (14:16 -0600)]
cm3: pretty print build sequence

This will make it a lot cleaner to look at
build output.

sample output:

$ make
     CC       src/foundation/cm3.o
     CC       src/foundation/exception_handlers.o
     CC       src/foundation/ext_intr_handlers.o
     CC       src/foundation/rtc.o
     CC       src/foundation/startup.o
     CC       src/lib/debug.o
     CC       src/lib/printf.o
     CC       src/lib/puts.o
     CC       src/lib/string.o
     CC       src/pm_services/clockdomain.o
     CC       src/pm_services/clockdomain_335x.o
     CC       src/pm_services/clockdomain_43xx.o
     CC       src/pm_services/ddr.o
     CC       src/pm_services/dpll.o
     CC       src/pm_services/dpll_335x.o
     CC       src/pm_services/dpll_43xx.o
     CC       src/pm_services/hwmod.o
     CC       src/pm_services/hwmod_335x.o
     CC       src/pm_services/hwmod_43xx.o
     CC       src/pm_services/i2c.o
     CC       src/pm_services/ldo.o
     CC       src/pm_services/ldo_335x.o
     CC       src/pm_services/ldo_43xx.o
     CC       src/pm_services/pm_handlers.o
     CC       src/pm_services/pm_state_data.o
     CC       src/pm_services/powerdomain.o
     CC       src/pm_services/powerdomain_335x.o
     CC       src/pm_services/powerdomain_43xx.o
     CC       src/pm_services/prcm_core.o
     CC       src/sys_exec/msg.o
     CC       src/sys_exec/sync.o
     CC       src/sys_exec/sys_init.o
     CC       src/sys_exec/trace.o
     LINK     am335x-pm-firmware.elf

Signed-off-by: Felipe Balbi <balbi@ti.com>
7 years agocm3: Makefile doesn't need execute permission
Felipe Balbi [Mon, 23 Dec 2013 20:16:56 +0000 (14:16 -0600)]
cm3: Makefile doesn't need execute permission

No functional changes, just a chmod.

Signed-off-by: Felipe Balbi <balbi@ti.com>
7 years agoCM3: Version 0x184 - Additional am43xx support ti2013.12.00 v05.00.00.01
Russ Dill [Wed, 11 Dec 2013 16:14:50 +0000 (08:14 -0800)]
CM3: Version 0x184 - Additional am43xx support

Firmware version 0x184

This adds several fixes and improvements for am43xx.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: AM43XX: Add missing hwmods
Dave Gerlach [Fri, 6 Dec 2013 21:10:04 +0000 (15:10 -0600)]
CM3: AM43XX: Add missing hwmods

IEEE5000 and OCPWP added to list of essential hwmods to idle before
attempting DS0 entry.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
7 years agoCM3: AM43XX: Add state data to shut off upper OCMC during DS0
Dave Gerlach [Fri, 6 Dec 2013 21:10:03 +0000 (15:10 -0600)]
CM3: AM43XX: Add state data to shut off upper OCMC during DS0

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
7 years agoCM3: AM43XX: powerdomain: Add ability to shut off upper OCMC
Dave Gerlach [Fri, 6 Dec 2013 21:10:02 +0000 (15:10 -0600)]
CM3: AM43XX: powerdomain: Add ability to shut off upper OCMC

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
7 years agoCM3: AM43XX: Allow CORE_SRAM_LDO to be put in retention
Dave Gerlach [Fri, 6 Dec 2013 21:10:01 +0000 (15:10 -0600)]
CM3: AM43XX: Allow CORE_SRAM_LDO to be put in retention

Same core_sram_ldo code will work for am43xx as well so add it to check
before running code.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
7 years agoCM3: AM43XX: Update ds save and restore functions
Dave Gerlach [Fri, 6 Dec 2013 21:10:00 +0000 (15:10 -0600)]
CM3: AM43XX: Update ds save and restore functions

ds_save and ds_restore do not need to be only run for am33xx, same
functions will work for am43xx as well.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
7 years agoCM3: AM43XX: Add DDR ioconfig for LPDDR2
Dave Gerlach [Fri, 6 Dec 2013 21:09:59 +0000 (15:09 -0600)]
CM3: AM43XX: Add DDR ioconfig for LPDDR2

Add adjusted values to configure DDR IOs for LPDDR2 on AM43xx.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
7 years agoCM3: AM43XX: Add PLL registers and bits
Dave Gerlach [Fri, 6 Dec 2013 21:09:58 +0000 (15:09 -0600)]
CM3: AM43XX: Add PLL registers and bits

Add proper data to allow for power down and bypass of AM43xx plls.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
7 years agoCM3: AM43XX: Cleanup AM43XX clockdomains
Dave Gerlach [Fri, 6 Dec 2013 21:09:57 +0000 (15:09 -0600)]
CM3: AM43XX: Cleanup AM43XX clockdomains

Some clockdomains did not apply to AM43XX that were present on AM33XX

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
7 years agoCM3: Add timeouts for hwmod enable and disable
Dave Gerlach [Fri, 6 Dec 2013 21:09:56 +0000 (15:09 -0600)]
CM3: Add timeouts for hwmod enable and disable

If a hwmod cannot be enabled or disabled, timeout eventually and
continue. Timeout will be reflected in kernel error message due to
powerdomain not transitioning.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
7 years agoCM3: Fix A8 Parameter Mask
Hebbar, Gururaja [Fri, 6 Dec 2013 21:09:53 +0000 (15:09 -0600)]
CM3: Fix A8 Parameter Mask

VTT GPIO PIN parameter is 6 bits and so the mask should be 0x3f & not
0x2f.

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
7 years agoCM3: Bump version and update the pre-built binary for I2C fixes
Russ Dill [Mon, 9 Dec 2013 20:36:09 +0000 (12:36 -0800)]
CM3: Bump version and update the pre-built binary for I2C fixes

Firmware version 0x183

The I2C suspend/resume write code had a couple bugs. One could cause a crash
on resume in the kernel, the other could cause a failure to resume due to the
resume sequence being sent out too fast.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: I2C: Move wake_handler to before the re-enabling of DPLLs
Russ Dill [Thu, 5 Dec 2013 23:08:14 +0000 (15:08 -0800)]
CM3: I2C: Move wake_handler to before the re-enabling of DPLLs

The wake handler calculates frequencies assuming the DPLL is in
bypass.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: I2C: Restore SCLH register properly
Russ Dill [Thu, 5 Dec 2013 23:07:28 +0000 (15:07 -0800)]
CM3: I2C: Restore SCLH register properly

7 years agoAdd debug support
Russ Dill [Thu, 5 Dec 2013 23:06:51 +0000 (15:06 -0800)]
Add debug support

7 years agoCM3: Leave I2C IP block the way we found it
Russ Dill [Mon, 25 Nov 2013 15:49:02 +0000 (07:49 -0800)]
CM3: Leave I2C IP block the way we found it

If we forcibly disable the HWMOD and the kernel expects it to be active, a
crash will occur. Save the original state and put it back properly. Additionally,
don't muck with the state at all if we don't need to.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Add hwmod_is_enabled check
Russ Dill [Mon, 25 Nov 2013 15:47:09 +0000 (07:47 -0800)]
CM3: Add hwmod_is_enabled check

This is needed so that if a IP block (such as I2C) is needed by the CM3 firmware,
it can be put back to its original state.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Update the pre-built binary with V2 command support v05.00.00.00
Russ Dill [Fri, 23 Aug 2013 11:20:39 +0000 (04:20 -0700)]
CM3: Update the pre-built binary with V2 command support

Firmware version 0x182

- V2 command support
- AM437X - Basic DS0 support
- I2C sleep/wake sequence support
- Return wakeup reason

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoAM335X: CM3: Add CPU idle handlers.
Russ Dill [Thu, 22 Aug 2013 21:39:38 +0000 (14:39 -0700)]
AM335X: CM3: Add CPU idle handlers.

This commit adds support for CPU idle modes. The wake source used during
CPU idle is MPU_WAKE so more of the SoC needs to be running as compared
to deep sleep modes.

Signed-off-by: Russ Dill <russ.dill@ti.com>
7 years agoCM3: Remove redundant rtc_timeout_val range check.
Russ Dill [Thu, 22 Aug 2013 07:58:25 +0000 (00:58 -0700)]
CM3: Remove redundant rtc_timeout_val range check.

The rtc_timeout_val field is 4 bits long. The RTC_TIMEOUT_MAX
val is 0xf. The field can never contain a value larger than 0xf.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Only re-enable master oscillator if it was disabled.
Russ Dill [Tue, 20 Aug 2013 10:09:39 +0000 (03:09 -0700)]
CM3: Only re-enable master oscillator if it was disabled.

This prepares the generic_wake_handler function to be shared by
cpu idle.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Reset IPC param registers at firmware boot
Russ Dill [Tue, 20 Aug 2013 10:02:30 +0000 (03:02 -0700)]
CM3: Reset IPC param registers at firmware boot

This prevents stale or uninitialized values from causing the I2C
code to think something is there.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move memory config globals to msg.c
Russ Dill [Tue, 20 Aug 2013 09:36:36 +0000 (02:36 -0700)]
CM3: Move memory config globals to msg.c

There should really only be one declaration for globals.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Remove unnecessary include statements.
Russ Dill [Tue, 20 Aug 2013 12:35:29 +0000 (05:35 -0700)]
CM3: Remove unnecessary include statements.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Remove now unused bits from prm335x.h
Russ Dill [Tue, 20 Aug 2013 09:16:26 +0000 (02:16 -0700)]
CM3: Remove now unused bits from prm335x.h

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Add functionality to powerdomain to read current state.
Russ Dill [Tue, 20 Aug 2013 09:15:45 +0000 (02:15 -0700)]
CM3: Add functionality to powerdomain to read current state.

This allows pm_handlers to not include any am335x headers.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move LDO register bits from prm335x.h to ldo.c
Russ Dill [Tue, 20 Aug 2013 09:07:25 +0000 (02:07 -0700)]
CM3: Move LDO register bits from prm335x.h to ldo.c

This allows ldo.c to not include any am335x or am43xx
specific headers.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoAM335x: CM3: Rename prmam335x.h to prm335x.h for consistency.
Russ Dill [Tue, 20 Aug 2013 09:04:58 +0000 (02:04 -0700)]
AM335x: CM3: Rename prmam335x.h to prm335x.h for consistency.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Break apart prcm.h
Russ Dill [Tue, 20 Aug 2013 09:00:31 +0000 (02:00 -0700)]
CM3: Break apart prcm.h

This breaks prcm.h into cm335x.h and cm43xx.h. This matches more closely
with the linux kernel and keeps am335x and am43xx defines separated.

Move the DPLL defines from prcm.h into dpll.c.
Move the DDR defines into ddr.c.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Get div for I2C from dpll helper functions.
Russ Dill [Tue, 20 Aug 2013 08:58:27 +0000 (01:58 -0700)]
CM3: Get div for I2C from dpll helper functions.

This eliminates the need for i2c.c to know the DPLL_PERIPH
address.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Remove unused system_am335.c
Russ Dill [Tue, 20 Aug 2013 08:34:30 +0000 (01:34 -0700)]
CM3: Remove unused system_am335.c

This code has been sitting as a skeleton since initial checkin,
if someone wants to fill it in, it'll still be in the git history.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Rename device_am335x.h device_common.h
Russ Dill [Tue, 20 Aug 2013 14:09:38 +0000 (07:09 -0700)]
CM3: Rename device_am335x.h device_common.h

Now that device_am335x only contains macros that are common
between am335x and am43xx, rename it to reflect such.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Rename constants that are CM3 specific to a CM3 namespace.
Russ Dill [Tue, 20 Aug 2013 14:07:02 +0000 (07:07 -0700)]
CM3: Rename constants that are CM3 specific to a CM3 namespace.

The interrupt numbers and internal memory areas are the same on
both am43xx and am335x. Name them as CM3_ and not AM335X_
and put them in a device_cm3.h header.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move RTC regs from device_am335x.h to rtc.h
Russ Dill [Tue, 20 Aug 2013 08:01:22 +0000 (01:01 -0700)]
CM3: Move RTC regs from device_am335x.h to rtc.h

These aren't SoC specific, so move them into rtc.h

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move I2C reg offsets from device_am335x to i2c.c
Russ Dill [Tue, 20 Aug 2013 08:00:52 +0000 (01:00 -0700)]
CM3: Move I2C reg offsets from device_am335x to i2c.c

These aren't SoC specific, so move them into i2c.c

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move usage of RTCSS_BASE into rtc.c
Russ Dill [Tue, 20 Aug 2013 07:53:23 +0000 (00:53 -0700)]
CM3: Move usage of RTCSS_BASE into rtc.c

This will make it easier to support an rtc with a different
address, as may be the case we am43xx.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Breakout IO functions into separate header.
Russ Dill [Tue, 20 Aug 2013 07:47:38 +0000 (00:47 -0700)]
CM3: Breakout IO functions into separate header.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Rename GPIO_BASE to GPIO0_BASE.
Russ Dill [Tue, 20 Aug 2013 07:40:20 +0000 (00:40 -0700)]
CM3: Rename GPIO_BASE to GPIO0_BASE.

Reflect properly that this is just the first GPIO bank.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Remove un-required includes of system_am335.h
Russ Dill [Tue, 20 Aug 2013 07:36:13 +0000 (00:36 -0700)]
CM3: Remove un-required includes of system_am335.h

Now that system_am335 just has stuff specific to system_am335.c,
we can remove a bunch of includes to it from the codebase.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move prototypes from system_am335 to i2c.h
Russ Dill [Tue, 20 Aug 2013 07:33:24 +0000 (00:33 -0700)]
CM3: Move prototypes from system_am335 to i2c.h

Move i2c.c prototypes from system_am335.h to i2c.h.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move prototypes from system_am335 to rtc.h
Russ Dill [Tue, 20 Aug 2013 07:31:56 +0000 (00:31 -0700)]
CM3: Move prototypes from system_am335 to rtc.h

Move rtc.c prototypes from system_am335.h to rtc.h.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move prototypes from system_am335 to sync.h
Russ Dill [Tue, 20 Aug 2013 07:29:58 +0000 (00:29 -0700)]
CM3: Move prototypes from system_am335 to sync.h

Move sync.c prototypes from system_am335 to sync.h.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move prototypes from system_am335 to trace.h
Russ Dill [Tue, 20 Aug 2013 07:26:53 +0000 (00:26 -0700)]
CM3: Move prototypes from system_am335 to trace.h

Move prototypes specific to trace.c from system_am335.h
to trace.h.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move things from system_am335 to pm_handlers.h
Russ Dill [Tue, 20 Aug 2013 07:24:08 +0000 (00:24 -0700)]
CM3: Move things from system_am335 to pm_handlers.h

Move prototypes and macros related to pm_handlers.c from
system_am335x.h into pm_handlers.h

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move relevant prototypes from system_am335 to prcm_core.h
Russ Dill [Tue, 20 Aug 2013 14:00:37 +0000 (07:00 -0700)]
CM3: Move relevant prototypes from system_am335 to prcm_core.h

Move prototypes and variables that are relevant for prcm_core.c from
system_am335.h to prcm_core.h.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move BITBAND defines for WAKE into prcm_core.c
Russ Dill [Tue, 20 Aug 2013 13:59:23 +0000 (06:59 -0700)]
CM3: Move BITBAND defines for WAKE into prcm_core.c

They are only used in prcm_core.c, so move them there.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Remove unused variables and macros from system_am335x.h
Russ Dill [Tue, 20 Aug 2013 13:56:31 +0000 (06:56 -0700)]
CM3: Remove unused variables and macros from system_am335x.h

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Create msg.h header for msg.c
Russ Dill [Tue, 20 Aug 2013 13:55:12 +0000 (06:55 -0700)]
CM3: Create msg.h header  for msg.c

Collect together the function prototypes, structs, and macros associated with
msg.c into an msg.h header.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Rename low_power.h to prcm_core.h to match c file.
Russ Dill [Tue, 20 Aug 2013 13:51:54 +0000 (06:51 -0700)]
CM3: Rename low_power.h to prcm_core.h to match c file.

This makes the codebase easier to follow.
Also, remove the header from places it isn't needed.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move state_data into it's own file
Russ Dill [Tue, 20 Aug 2013 05:58:58 +0000 (22:58 -0700)]
CM3: Move state_data into it's own file

This reduces clutter in prcm_core.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Breakout LDO data for am335x/am43xx.
Russ Dill [Tue, 20 Aug 2013 05:48:17 +0000 (22:48 -0700)]
CM3: Breakout LDO data for am335x/am43xx.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Make LDO interface generic and separate am335x/am43xx
Russ Dill [Tue, 20 Aug 2013 05:42:25 +0000 (22:42 -0700)]
CM3: Make LDO interface generic and separate am335x/am43xx

This makes the LDO interface generic and prepares for a
am335x/am43xx split. The removal of the ES1_0 check is
ok because the code that calls it already checks for that.

Future work might include a flag indicating that an LDO can
or cannot be put into retention.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Breakout LDO control from prcm_core.
Russ Dill [Tue, 20 Aug 2013 05:17:31 +0000 (22:17 -0700)]
CM3: Breakout LDO control from prcm_core.

PRCM core is getting too big to be easily readable, break out the pieces.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Replace empty wrapper functions in hwmod.c with simple calls.
Russ Dill [Tue, 20 Aug 2013 11:02:34 +0000 (04:02 -0700)]
CM3: Replace empty wrapper functions in hwmod.c with simple calls.

This increases consistency, as some hwmods have their own special
function call, and some use the hwmod_state_change interface.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Replace empty wrapper functions in clockdomain.c for simple calls.
Russ Dill [Tue, 20 Aug 2013 04:59:07 +0000 (21:59 -0700)]
CM3: Replace empty wrapper functions in clockdomain.c for simple calls.

This introduces some consistency, as it be a bit weird to have
customized function calls for some clockdomains, but not others.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Rename pm_init to pm_reset to better match it's functionality.
Russ Dill [Tue, 20 Aug 2013 04:58:29 +0000 (21:58 -0700)]
CM3: Rename pm_init to pm_reset to better match it's functionality.

This function is called to reset all the state values to their default.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Breakout dpll data for am335x/am43xx.
Russ Dill [Tue, 20 Aug 2013 04:46:10 +0000 (21:46 -0700)]
CM3: Breakout dpll data for am335x/am43xx.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Rename am33xx_power_up/down_plls to be more generic.
Russ Dill [Tue, 20 Aug 2013 04:38:42 +0000 (21:38 -0700)]
CM3: Rename am33xx_power_up/down_plls to be more generic.

Once am43xx support is more complete, this will be supported on both platforms.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Break out separate am335x/am43xx DPLL functionality further.
Russ Dill [Tue, 20 Aug 2013 04:35:22 +0000 (21:35 -0700)]
CM3: Break out separate am335x/am43xx DPLL functionality further.

The am43xx support is a bit of a skeleton right now.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Add missing DPLL reset function.
Russ Dill [Tue, 20 Aug 2013 04:26:24 +0000 (21:26 -0700)]
CM3: Add missing DPLL reset function.

We store state, but don't reset that state on firmware reset, fix that.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Rework dpll struct to prepare for am335x/am43xx split.
Russ Dill [Tue, 20 Aug 2013 04:24:44 +0000 (21:24 -0700)]
CM3: Rework dpll struct to prepare for am335x/am43xx split.

Combine the information on the different parts of the DPLLs into
one struct. This will make the am335x/am43xx split easier.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Use enumeration for DPLL index
Russ Dill [Tue, 20 Aug 2013 04:10:02 +0000 (21:10 -0700)]
CM3: Use enumeration for DPLL index

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Use clockdomain active check in rtc_enable_check.
Russ Dill [Tue, 20 Aug 2013 02:48:34 +0000 (19:48 -0700)]
CM3: Use clockdomain active check in rtc_enable_check.

This utilizes the new clkdm framework, keeping the IP register
addresses and accesses isolated.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Add check for if a clockdomain is active.
Russ Dill [Tue, 20 Aug 2013 02:48:01 +0000 (19:48 -0700)]
CM3: Add check for if a clockdomain is active.

This will be used by the RTC code to check if it's clock domain
is active.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoAM335X: CM3: Add RTC clockdomain for am335x.
Russ Dill [Tue, 20 Aug 2013 02:47:44 +0000 (19:47 -0700)]
AM335X: CM3: Add RTC clockdomain for am335x.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Breakout DDR functions from prcm_core.
Russ Dill [Tue, 20 Aug 2013 02:38:30 +0000 (19:38 -0700)]
CM3: Breakout DDR functions from prcm_core.

PRCM core is getting too big to be easily readable, break out the pieces.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Breakout dpll from prcm_core.
Russ Dill [Tue, 20 Aug 2013 02:33:30 +0000 (19:33 -0700)]
CM3: Breakout dpll from prcm_core.

PRCM core is getting too big to be easily readable, break out the pieces.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Breakout powerdomain data for am335x/am43xx.
Russ Dill [Tue, 20 Aug 2013 02:23:40 +0000 (19:23 -0700)]
CM3: Breakout powerdomain data for am335x/am43xx.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Use powerdomain_id enumeration for PD_MPU/PD_PER
Russ Dill [Tue, 20 Aug 2013 02:14:00 +0000 (19:14 -0700)]
CM3: Use powerdomain_id enumeration for PD_MPU/PD_PER

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Formalize register contents bitfields as unsigned int
Russ Dill [Tue, 20 Aug 2013 02:10:30 +0000 (19:10 -0700)]
CM3: Formalize register contents bitfields as unsigned int

This avoids any ambiguities with right shifts of the contents of registers.
Also fix the ordering rtc_reg_write to match raw_write.

GCC can also do some "interesting" optimizations with bitfields:

struct foo { int a:2; };
struct bar { unsigned int a:2; };

int test(struct foo *foo, struct bar *bar)
{
        if (foo->a == 0x3)
                return 1;
        if (bar->a == 0x3)
                return 2;
         return 0;
}

Compiles to:

   0:   e5d10000        ldrb    r0, [r1]
   4:   e2000003        and     r0, r0, #3
   8:   e3500003        cmp     r0, #3
   c:   03a00002        moveq   r0, #2
  10:   13a00000        movne   r0, #0
  14:   e12fff1e        bx      lr

GCC assumed that a 2 bit signed bitfield can never equal 0x3 and
compiled it out. Since none of the bitfields are intended to hold
signed values, make them unsigned.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Breakout powerdomains from prcm_core.
Russ Dill [Tue, 20 Aug 2013 01:50:42 +0000 (18:50 -0700)]
CM3: Breakout powerdomains from prcm_core.

PRCM core is getting too big to be easily readable, break out the pieces.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Create consistent naming s/module/hwmod
Russ Dill [Fri, 23 Aug 2013 09:22:54 +0000 (02:22 -0700)]
CM3: Create consistent naming s/module/hwmod

In kernel speak, the SoC modules are know as hwmods. Use this name
throughout as it is much less generic than module.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Breakout hwmod data for am335x/am43xx.
Russ Dill [Tue, 20 Aug 2013 00:23:49 +0000 (17:23 -0700)]
CM3: Breakout hwmod data for am335x/am43xx.

This splits out the am335x and am43xx specific code from the
hwmod core.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Breakout hwmod from prcm_core.
Russ Dill [Fri, 23 Aug 2013 09:25:06 +0000 (02:25 -0700)]
CM3: Breakout hwmod from prcm_core.

PRCM core is getting too big to be easily readable, break out the pieces.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Breakout clockdomain data for am335x/am43xx.
Russ Dill [Tue, 20 Aug 2013 00:07:30 +0000 (17:07 -0700)]
CM3: Breakout clockdomain data for am335x/am43xx.

This splits out the am335x and am43xx specific code from the
clockdomain core.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Breakout clockdomains from prcm_core.
Russ Dill [Mon, 19 Aug 2013 23:55:30 +0000 (16:55 -0700)]
CM3: Breakout clockdomains from prcm_core.

PRCM core is getting too big to be easily readable, break out the pieces.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Move var_mod to device_am335x.h
Russ Dill [Mon, 19 Aug 2013 23:51:33 +0000 (16:51 -0700)]
CM3: Move var_mod to device_am335x.h

This is the first step in breaking up prcm_core.c

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Enable/disable clkdms by ID.
Russ Dill [Mon, 19 Aug 2013 23:13:06 +0000 (16:13 -0700)]
CM3: Enable/disable clkdms by ID.

This simplifies the am335x/am43xx split.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Enable/disable hwmods by ID.
Russ Dill [Fri, 23 Aug 2013 10:57:35 +0000 (03:57 -0700)]
CM3: Enable/disable hwmods by ID.

This simplifies the am335x/am43xx split.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Track CLKCTRL by hwmod to abstract am43xx/am33xx
Russ Dill [Tue, 20 Aug 2013 13:42:29 +0000 (06:42 -0700)]
CM3: Track CLKCTRL by hwmod to abstract am43xx/am33xx

This moves towards abstracting out the differences between am335x
and am43xx. The caller can specify a 'HWMOD_I2C0' instead of the
register address.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Reorganize PWRSTST and PWRSTCTRL registers under structs for am335x/am43xx
Russ Dill [Fri, 23 Aug 2013 01:02:14 +0000 (18:02 -0700)]
CM3: Reorganize PWRSTST and PWRSTCTRL registers under structs for am335x/am43xx

This works towards allowing the am335x and am43xx specific portions to be
contained in separate files.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Add clkdms_state_change to make a am335x/am43xx split easier.
Russ Dill [Mon, 19 Aug 2013 21:32:04 +0000 (14:32 -0700)]
CM3: Add clkdms_state_change to make a am335x/am43xx split easier.

Rather than open coding the enabling and disabling of a list of
registers, have a loop do it. In the future, the register lists
can be assigned based on SoC type.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
7 years agoCM3: Add modules_state_change to make a am335x/am43xx split easier.
Russ Dill [Mon, 19 Aug 2013 08:49:28 +0000 (01:49 -0700)]
CM3: Add modules_state_change to make a am335x/am43xx split easier.

Rather than open coding the enabling and disabling of a list of
registers, have a loop do it. In the future, the register lists
can be assigned based on SoC type.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>