Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented May 3, 2017

Basic board support for the TI SensorTag, with minimal drivers.

  • Switch from Gerrit to Github for this changeset
  • Split linker script modification and minimal SoC support into 2 commits
  • Move uart.h, gpio.h and trng.h to corresponding drivers

Basic board support for the TI SensorTag, with minimal drivers.
Questions remain to be answered, like Stellaris / CC3200 UART driver reuse
and how to accomodate HW-specific flash header / footer needs by modifying
the Cortex generic linker script.

@galak galak self-assigned this May 3, 2017
@galak galak self-requested a review May 3, 2017 14:40
Copy link
Contributor

@galak galak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the patch series should be re-ordered slightly, the linker script should come first, than SoC (merge the cc2650: Add basic support for Device Tree. patch with SoC patch).

Let's also see about the UART driver.

@ghost
Copy link
Author

ghost commented May 3, 2017

Sorry about that, commit dates mixed up the order when pushing.
Squashed SoC + Device Tree support accordingly.

@galak galak force-pushed the arm branch 2 times, most recently from 78c0221 to a1c74b7 Compare May 4, 2017 14:02
@ghost
Copy link
Author

ghost commented May 5, 2017

  • Had to move gpio.h to arch/ again, because it is also needed by pinmux driver
    (hardware awkardness).
  • Tried to use both the stellaris and the CC32xx UART drivers.
    • With CC32xx UART: TI provides a HAL for CC26xx SoC, "cc26xxware". It is
      different than the HAL used for CC3200 port ("cc32xxware"). Not surprisingly, the CC32xx
      UART driver does not work for the CC2650 (probably power management issues, but see below).
    • With Stellaris UART: Polling interface works, interrupts do not. Pushed code is a quick hack
      to show what's needed to make it work; most importantly, powering on the UART HW module
      used to be done in CC2650 UART driver and was copy-pasted here.

I have the following questions:

  • What's the policy regarding HALs for Zephyr? I could not find any. If that's preferred,
    I could import TI's cc26xxware HAL along cc32xxware and use it everywhere.
  • Regarding SoC power management, should I power on everything that may be needed
    in SoC's init() (in arch/) and not in each individual driver?
  • There is still a problem when using Device Tree generated macros: the address is
    baked in their names. Here, a quick hack in the board's .fixup file does the job; but
    why not using generic names? We could generate names using port numbers, for example.

@GAnthony
Copy link

GAnthony commented May 5, 2017

Regarding policy on HALs, my understanding is that they are initially being encouraged as a way to expand board support in Zephyr, though I've heard some comments against HALs if they bring in too much extra code. In the case of CC32xx, I was able to save ~2K in code space by using the ROM versions of the cc32xx driverlib functions: MAP_*.

I wonder if there is a SimpleLink SDK for cc26xx? The following link seems to suggest that is the case:
http://dev.ti.com/tirex/content/simplelink_cc13x0_sdk_1_30_00_06/docs/simplelink_mcu_sdk/Users_Guide.html#directory-structure
In which case, cc26xx device files could go under the new ext/ti/hal/simplelink/ directory structure, if you choose to use them.

@GAnthony
Copy link

GAnthony commented May 5, 2017

Regarding power management, the cc32xx UART driver does not currently support power management, so is not a good example. I would think it's best for the device driver to provide the power management hooks, and initialization.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be done in soc.c for cc2650?

@galak
Copy link
Contributor

galak commented May 5, 2017

With regards to DT generated, we intend to generate the code bits so the #defines go away, the problem with names is its hard to come up with a generic solution that works for everyone. Some people start at 0, some want it to be the name the board uses, and not the SoC, etc.

So for now the fixup file exists until we can generate the bits instead that are in the driver code.

@ghost
Copy link
Author

ghost commented May 9, 2017

  • Move inline register manipulations functions to soc.c.
  • Move power/clock setup of HW modules to soc.c, and remove such code from device drivers, where it was previously located.
  • Document the Stellaris UART driver to explain use for CC2650 SoC.

@galak
Copy link
Contributor

galak commented May 23, 2017

Sorry for taking so long on this, headed on vacation for a few days, but will focus on getting this reviewed and merged next week. Thanks.

@ghost
Copy link
Author

ghost commented May 23, 2017

No problem, I tried to keep conflicts minimal to avoid headaches upon merging.

@galak galak force-pushed the arm branch 3 times, most recently from 1d365cc to 0a8ad73 Compare June 9, 2017 14:38
Copy link
Contributor

@galak galak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A number of changes needed. Lets have the 'uart' patch be the first patch, since its just cleaning / commenting on support for CC2650. Also, lets pull the random # patch from this PR so we can get SoC/Board support in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is CCFG_SIZE not just hard coded value here? Does the size change device to device?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I thought initially that other TI devices shared a similar CCFG concept with different options, but I only find this for the CC13xx / CC26xx SoCs. I can remove CONFIG_TI_CCFG_SIZE and hardcode it here, if that's okay.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ROM_ADDR is defined on line 43, 45, and 52. Lets remove lines 45 & 52.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add a comment here about:

/* Some TI SoCs have a cfg footer at the end of flash for device configuration */

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would this value ever be something other than 88?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__ti_ccfg_section instead of _GENERIC_SECTION()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we need from soc.h?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets just remove usage of UART_IRQ_FLAGS, just change the function to pass a 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since pin mux depends on GPIO driver, the GPIO driver should be first in the sequence of commits.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldn't need these prototypes, re-order the code in the file if needed so they can be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this, just call function with 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need toolchain/gcc.h?, trim headres down to what's needed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just using the ARG_UNUSED() macro.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should look like:

  • SPDX-License-Identifier: Apache-2.0

Copy link
Contributor

@galak galak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor comments on random driver.

@ghost
Copy link
Author

ghost commented Jun 15, 2017

  • Reorganized commits so that GPIO driver comes before pinmux driver,
  • Removed random number generator driver, for another pull request,
  • Removed CCFG_SIZE config variable, now hard-coded in linker script,
  • Various small fixes,
  • Fixed license to "SPDX-License-Identifier: Apache-2.0"

@galak
Copy link
Contributor

galak commented Jun 15, 2017

Can you rebase the patch set on latest 'arm' branch. Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit picking, but we should probably just have bit_is_set as a static inline in the header.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Points of view seem to differ on this. I was asked exactly the opposite (implement functions in soc.c separately from soc.h) some weeks ago.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be: compatible = "ti,stellaris-uart";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right, the number of bits should probably be 3? Guessing 8 priority levels.

Copy link
Author

@ghost ghost Jun 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, it looks like I mixed up the Cortex M3's user guide number of prio levels (256) with the ones available for the CC2650 SoC (8 indeed).

Copy link
Contributor

@galak galak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some dts related changes need to be made.

@galak
Copy link
Contributor

galak commented Jun 15, 2017

I'm going to pull in the linker script and modify the uart driver patch into the arm branch so we can close out on those bits.

@ghost
Copy link
Author

ghost commented Jun 15, 2017

  • Fixed number of priority bits for interrupts (DTSI file)
  • Fixed UART driver used (my fault, don't know where I changed the configuration again)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change, we should keep things as they are and use label in device tree like other uarts are using.

Copy link
Contributor

@galak galak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uart patch still needs work, in theory we should be able to remove it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned before, merge this change into the board patch.

@galak galak force-pushed the arm branch 2 times, most recently from 8176617 to 49326ad Compare June 15, 2017 21:15
@ghost
Copy link
Author

ghost commented Jun 16, 2017

  • Changed Stellaris driver to use DTS-provided labels. Moved this patch upfront so it can be moved out quickly.
  • CC2650 related work: Moved .fixup changes to board patch.

Copy link
Contributor

@galak galak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the uart: Use DTS labels... commit, should be first, and should also remove the defines from dts/arm/qemu_cortex_m3.fixup.

#define CONFIG_UART_STELLARIS_PORT_0_NAME TI_STELLARIS_UART_4000C000_LABEL
#define CONFIG_UART_STELLARIS_PORT_1_NAME TI_STELLARIS_UART_4000D000_LABEL
#define CONFIG_UART_STELLARIS_PORT_2_NAME TI_STELLARIS_UART_4000E000_LABEL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect this in the SOC commit.

Copy link
Contributor

@galak galak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove GPIO_INT_PIN_EXTRAFLAGS, doesn't seem to add anything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there really a need to introduce GPIO_INT_PIN_EXTRAFLAGS since its only used in the CC2650 ifdef case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just replace GPIO_INT_PIN_EXTRAFLAGS with GPIO_PUD_PULL_UP, not sure what the #define is getting us.

Copy link
Author

@ghost ghost Jun 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the Sensortag, I needed an extra GPIO_PUD_PULL_UP flag.
As this is probably not the only board needing to pass some extra flags for now, I added a little bit of flexibility, so other boards in the future can define (or not) more flags as needed while keeping code readable.
So yes, for now it's only used for the CC2650 but it may prove useful as the test code becomes used for more boards.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to do such things once we see the need for them.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I'll just use GPIO_PUD_PULL_UP then.

Geoffrey Le Gourriérec added 6 commits June 16, 2017 17:42
Update driver to use DTS-generated #defines for port names,
and not obsolete Kconfig variables.

Signed-off-by: Geoffrey Le Gourriérec <[email protected]>
Add support in arch/arm/soc/ti_simplelink, along with support
for CC32xx SoC.

Signed-off-by: Geoffrey Le Gourriérec <[email protected]>
Add support for TI's SensorTag board, which uses a CC2650 SoC.

Signed-off-by: Geoffrey Le Gourriérec <[email protected]>
Signed-off-by: Geoffrey Le Gourriérec <[email protected]>
Signed-off-by: Geoffrey Le Gourriérec <[email protected]>
Add extra #defines in samples/drivers/gpio to test
TI SensorTag board.

Signed-off-by: Geoffrey Le Gourriérec <[email protected]>
@ghost
Copy link
Author

ghost commented Jun 16, 2017

  • Moved Stellaris UART driver update commit as first commit.
  • Simplify GPIO driver sample code.

@galak galak merged this pull request into zephyrproject-rtos:arm Jun 16, 2017
@ghost
Copy link
Author

ghost commented Jun 16, 2017

Thanks a lot Kumar for your work and patience! I'm happy to make my first steps in the Zephyr project. :)

@galak
Copy link
Contributor

galak commented Jun 16, 2017

Thanks for your patience as well. Hope to see some more development from you in the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants