summaryrefslogtreecommitdiff
path: root/board/snow
Commit message (Collapse)AuthorAgeFilesLines
* CHERRY-PICK:Put knowledge of task-config dependency in config.hRandall Spangler2013-08-091-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | Rather than have every board check for tasks before declaring their config macros, have config.h know what configs are invalid without their corresponding tasks. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms and pass unit tests Original-Change-Id: Iecf6eb44782e15565eaaf6d69c6288ee8d2e4c4c Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/65010 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Conflicts: board/kirby/board.h Change-Id: I2d2fe2e0080ec5483a840ebc51f61f9f9f515e67 Reviewed-on: https://gerrit.chromium.org/gerrit/65450 Commit-Queue: Dave Parker <dparker@chromium.org> Reviewed-by: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* CHERRY-PICK:Clean up configuring GPIO alternate functionsRandall Spangler2013-08-092-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GPIO alternate functions used to be configured throughout the code, which made it hard to tell which ones you needed to configure yourself in board.c. It also sometimes (chip/lm4/i2c.c) led to GPIOs being configured as alternate functions even if they weren't used on a given board. With this change, every board has a table in board.c which lists ALL GPIOs which have alternate functions. This is now the only place where alternate functions are configured. Each module then calls gpio_init_module() to set up its GPIOs. This also fixes a bug where gpio_set_flags() ignored most of the flags passed to it (only direction and level were actually used). On stm32f, gpio_set_alternate() does not exist, and pins are configured via direct register writes from board.c. Rather than attempt to change that in the same CL, I've stubbed out gpio_set_alternate() for stm32f, and will fix the register writes in a follow-up CL. BUG=chrome-os-partner:21618 BRANCH=peppy (fixes I2C1 being initialized even though those pins are used for other things) TEST=boot link, falco, pit, spring Original-Change-Id: I40f47025d8f767e0723c6b40c80413af9ba8deba Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/64400 Conflicts: board/kirby/board.c board/kirby/board.h board/pit/board.c chip/stm32/gpio-stm32f.c Change-Id: I7518eb447b58500e3146fee44cb770567bc15ed3 Reviewed-on: https://gerrit.chromium.org/gerrit/65446 Commit-Queue: Dave Parker <dparker@chromium.org> Reviewed-by: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Add build-time checks on board-specific array sizes.Duncan Laurie2013-08-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've been declaring a bunch of statically-sized arrays: extern struct foo_t foo[FOO_COUNT]; And then initializing them like so: struct foo_t foo[FOO_COUNT] = { /* blah */ }; That only catches cases where we initialize with too many entries. It doesn't catch cases where we haven't initialized enough. This change tests for both cases like so: extern struct foo_t foo[]; struct foo_t foo[] = { /* blah */ }; BUILD_ASSERT(ARRAY_SIZE(foo) == FOO_COUNT); The affected arrays are: adc_channels[ADC_CH_COUNT] gpio_list[GPIO_COUNT] temp_sensors[TEMP_SENSOR_COUNT] x86_signal_list[X86_SIGNAL_COUNT] i2c_ports[I2C_PORTS_USED] BUG=chrome-os-partner:18343 BRANCH=falco,peppy TEST=build all platforms All platforms should still build, all tests should still pass. Original-Change-Id: Ibb16dc3201f32df7cdc875648e89ba4ffb09f733 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63833 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit af777297370e971bd4ae64e0e947cb5a1774dbfe) Change-Id: If8df7c902687c9a004c43128282300a6d0b2230c Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/64217
* Clean up more config optionsRandall Spangler2013-07-301-1/+0
| | | | | | | | | | | | | | | | | | | No functional changes, just renaming config options. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63248 (cherry picked from commit ba3733e49267897249a25f26d054a7af63c2c527) Change-Id: I6fbe5a2427a86a58449d8428aea51f96ca1c5d6d Reviewed-on: https://gerrit.chromium.org/gerrit/63730 Commit-Queue: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
* Clean up and document UART config optionsRandall Spangler2013-07-301-3/+0
| | | | | | | | | | | | | | | | | | | No functional changes, just renaming config options. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63244 (cherry picked from commit e6f0c272a02d03a15f826b8c7282d0084c125b6b) Change-Id: I6c3ade8d17b721d53241eac57283f9fa444e381e Reviewed-on: https://gerrit.chromium.org/gerrit/63729 Commit-Queue: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
* Collect board X specific files into build.mk common-$(BOARD_X)Rong Chang2013-07-301-1/+0
| | | | | | | | | | | | | | | | | | | | This change removes all CONFIG_module_FOO from board/foo/board.h . BRANCH=None BUG=chrome-os-partner:21302 TEST=util/ecmakeall.sh Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63211 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 5afcb815d60ed16c6bfe48ea9103223acb2e0e0d) Change-Id: I7570694e9277a5713d65e8cba358a8ca13d073fe Reviewed-on: https://gerrit.chromium.org/gerrit/63726 Commit-Queue: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
* Move TPSChrome charging temperature range to battery packRong Chang2013-07-301-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | This change moves vendor specific temperature ranges to battery pack files or board setup files. And added a host test case to verify that does not change x86 smart battery charging state machine behavior. BUG=chrome-os-partner:21181 BRANCH=None TEST=manual build test: util/ecmakeall.sh hosttests: make hosttests && make runtests Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62978 Reviewed-by: Vic Yang <victoryang@chromium.org> (cherry picked from commit 6c280b1b324d56416732ff532f0d8d69d2dbdfad) Change-Id: I1e94739265ce0978ca3f517ee5498a1e74c137cb Reviewed-on: https://gerrit.chromium.org/gerrit/63723 Commit-Queue: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
* Clean up and document more config optionsRandall Spangler2013-07-302-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | No functional changes, just renaming config options. Remove README, now that all options described in it have been moved to config.h, and the remaining information is out of date. (Yes, we should have a README which describes the organization of the EC repository, but that's a matter for another CL; this one's about cleaning up config options.) BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63145 Reviewed-by: Vic Yang <victoryang@chromium.org> (cherry picked from commit 8cd69cfe53b1243e76d2054f7682b32b675bae9c) Change-Id: I8d4f5ae72caa1dd48b6f10e985badd6cb06fe12f Reviewed-on: https://gerrit.chromium.org/gerrit/63720 Commit-Queue: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
* Clean up debug config optionsRandall Spangler2013-07-301-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | All of these were defined on all but a few platforms, and those explicitly #undef them. So define them as enabled by default in config.h so the board.h files are cleaner. No functional changes; just rearranging/renaming config constants. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms; FEATURES=test emerge-falco chromeos-ec Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63102 Reviewed-by: Vic Yang <victoryang@chromium.org> (cherry picked from commit cb1f7306b34507b3d9481cd4327271b2227747b8) Change-Id: I9cd8d20c61f1851cf79b973b21a90db395f34fe3 Reviewed-on: https://gerrit.chromium.org/gerrit/63717 Commit-Queue: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
* Clean up and document PMU config optionsDuncan Laurie2013-07-232-3/+0
| | | | | | | | | | | | | | | | | | | | | | | No functional changes, just documenting and renaming. All boards which use the PMU must provide pmu_board_init(). This was already true - except that Daisy's pmu_board_init() was implemented as part of pmu_init() instead of its code living in board.c; I've moved the code there now. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Original-Change-Id: I85ad06dc3b6287ad917fe13acf83182f24a8f23d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62906 Reviewed-by: Vic Yang <victoryang@chromium.org> (cherry picked from commit 64e38af781a42a346f59ef27c352f4818bfa1516) Change-Id: I5fd860f7147dbcb1320ea7a0b56e138eaf0e43d8 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63138
* Clean up and document battery config optionsDuncan Laurie2013-07-231-1/+1
| | | | | | | | | | | | | | | | | No functional changes, just documenting and renaming. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Original-Change-Id: I0b0d3cdce535d90ce437e82e96346fc3ca9be7b0 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62673 (cherry picked from commit 4288e45815d8677147d582a46eb625a185f49162) Change-Id: Id1cb63590e8449fa1a49f4b4a0cc371c837c00f8 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63137
* stm32: Add CHIP_FAMILY definesRandall Spangler2013-07-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, code which needed to work on all STM32F platforms needed to specify them by name (CHIP_VARIANT_stm32f100 || CHIP_VARIANT_stm32f10x), and we needed extra symlinks in the chip/stm32/ directory to allow the build system to find family-specific files. Add a CHIP_FAMILY level of abstraction, so that things which are common across all STM32F platforms don't need to specify every STM32F variant. Make the chip build look for family-specific filenames instead of variant-specific filenames (except for config*.h, which is actually variant specific). In the few places where things actually are variant-specific, keep using the existing CHIP_VARIANT defines. Code refactoring only; no functional changes. BUG=chrome-os-partner:20567 BRANCH=none TEST=build all platforms Change-Id: I1da831aadabf8b8dd9dfde423cac13c9f43eb953 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60247 Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* pit: Clean up timer init codeRandall Spangler2013-06-261-0/+1
| | | | | | | | | | | | Power LED PWM now uses the same functions as the hardware timer. BUG=chrome-os-partner:20414 BRANCH=none TEST=Suspend system. Power button LED pulses smoothly still. Change-Id: Ib5ca6655d815462baaf68600ad14c4c0c680a6af Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59838
* pit: Fix watchdog help for STM32LRandall Spangler2013-06-241-0/+1
| | | | | | | | | | | | | | | | | Clean up timer initialization code to be more general, so that we can use timer 9 for the LSB on STM32L. Then use timer 4 for the watchdog helper. BUG=chrome-os-partner:18781 BRANCH=none TEST=From EC console: timerinfo -> current time still counts up properly waitms 2000 -> prints watchdog info before rebooting Change-Id: Ib0ba496b0eadb93756dcd1841857546910baf2a9 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59612 Reviewed-by: Simon Glass <sjg@chromium.org>
* Rename GPIO_HI_Z macros to more descriptive GPIO_ODR_HIGH/LOWBill Richardson2013-06-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | GPIO_HI_Z was a bit misleading (it's high impedance by default, but it's actually an output not an input), but when we added GPIO_HI_Z_OPEN to mean "open-drain output, pulled low by default", it got too confusing. This renames those macros to: #define GPIO_ODR_HIGH (GPIO_OUTPUT | GPIO_OPEN_DRAIN | GPIO_HIGH) #define GPIO_ODR_LOW (GPIO_OUTPUT | GPIO_OPEN_DRAIN | GPIO_LOW) BUG=chrome-os-partner:18788 BRANCH=none TEST=none No functional change, just renaming some macros. If it compiles, it should be unchanged in behavior. Change-Id: Ic84d7be8531f2b240a8eca4f6cfe5291ebd2d5ef Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58596 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Move write protect GPIO handling to flash moduleRandall Spangler2013-05-231-1/+1
| | | | | | | | | | | | | | | | | Write protect signal naming is now consistent across boards. New CONFIG_WP_ACTIVE_HIGH is present on systems where the write protect signal is active-high (e.g. Link). This will be used in the next CL, which moves flash_get_protect() to flash_common.c BUG=chrome-os-partner:15613 BRANCH=none TEST=flashinfo properly reports WP signal status Change-Id: I502ab033c3eb36661cc3ee97320874b3fbf6fc0d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/56087 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Move i2cread and i2cwrite functions to i2c_commonRandall Spangler2013-04-302-0/+6
| | | | | | | | | | | | | | | | | | | | Also moves the handy i2cscan command to i2c_common. The platform-dependent interface is now i2c_xfer(). Still more to do in follow-up CLs; for example, i2c_read_string() has platform-dependent implementation, and the i2c/i2cread console commands aren't common yet. BUG=chrome-os-partner:18969 BRANCH=none TEST=i2cscan on link, spring Change-Id: Ia53d57beaa157bece293a4262257e20b4107589e Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49492 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Daniel Erat <derat@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* Allow disabling PMU charger task, and do so on pitRandall Spangler2013-04-261-0/+1
| | | | | | | | | | | | | | | | I2C communication doesn't work on pit yet, so the charger task is spewing errors to the console. This change allows the task to be disabled cleanly on pit, and has no effect on other platforms. BUG=chrome-os-partner:18657 BRANCH=none TEST=build all platforms and see that charger task is still compiled everywhere but pit Change-Id: I788e817d5630fb1a28694819f4ef9948a503a744 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49344 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Replace generated CONFIG_TASK_ macros with HAS_TASK_Bill Richardson2013-04-241-1/+1
| | | | | | | | | | | | | | | CONFIG_ macros should be set directly. Expanding the task names in the same way made it difficult to tell what was a configuration choice and what was due to changes in ec.tasklist BUG=chrome-os-partner:18343 TEST=build all, run link BRANCH=none Change-Id: Ib82e34f974238ee2dd216f33b701b6f4c6a4f1f1 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49098 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Unify lid switch processingRandall Spangler2013-04-242-1/+3
| | | | | | | | | | | | | | | | | | | STM32-based platforms now use the same lid debouncing code as LM4-based platforms, generate lid-open / lid-closed events, and trigger lid-change hooks. This is needed for disabling keyboard scanning when the lid is closed, as well as future changes to mask off wake events when the lid is closed. BUG=chrome-os-partner:18896 BRANCH=spring TEST=build all platforms; check that spring boots when lid is opened Change-Id: I09a6e91119c3739297fe49b7eacac6efda988284 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48924 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Remove _OFF from GPIO register macrosRandall Spangler2013-04-161-10/+10
| | | | | | | | | | | | | | | | | | | This is left over from when we had a pair of macros for each GPIO register, one which concatenated its base address name and one which took a base address. Only the latter has survived, but its naming is longer than it needs to be and isn't consistent with other register banks (USART, TIM, etc.). No code changes, just renaming macros. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I15a282fd01db2a25219970e28ce551d8dc80193f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48226 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Refactor gpio_set_level() and gpio_pre_init()Randall Spangler2013-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | gpio_set_level() now allows setting the pin level if GPIO_LOW or GPIO_HIGH is specified. Previously, stm32 platforms did this even though the definition of gpio_set_level() said it wouldn't work. Fixed gpio_set_level() not setting level after warm reboot on stm32 because it was checking the GPIO_DEFAULT flag in the wrong place. Fixed LM4 still mucking with alternate function settings and levels even if GPIO_DEFAULT was specified. And checked gpio_list[] and all of the calls to gpio_set_flags() to make sure everything still behaves the same way it did before (or better, in the case of actual bugs). BUG=chrome-os-partner:18718 BRANCH=none TEST=build all platforms; boot spring and link Change-Id: I4b84815f76060252df235ff9a37da52c54a8eac5 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48058 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Exclude chipset task from test binariesVic Yang2013-04-112-1/+3
| | | | | | | | | | | | | | | For most tests, we don't need to power the AP. Let's exclude chipset task to save memory space. BUG=chrome-os-partner:18598 TEST=Run pingpong test on Spring BRANCH=none Change-Id: I545c5b3e1c27b0067d4ffe09a7971d32b75d6039 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47833 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Remove unneeded USB_CHARGE_PORT_COUNTRandall Spangler2013-04-101-2/+0
| | | | | | | | | | | | | | | | | | This only needs to be defined if CONFIG_USB_CHARGE is defined (that is, if the board has a USB charge controller. (Note the difference between providing power over USB vs. receiving power over USB; the names are confusing and I'll rename one of the two imminently.) BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I7355b4248bb2d4f5f71cc9f8d9d8f9d6c0069f2b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47658 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Only includes necessary tasks for test binariesVic Yang2013-04-101-9/+11
| | | | | | | | | | | | | | | | | | | | This changes current TASK() syntax to TASK_BASE() and TASK_NORMAL(), where TASK_BASE is necessary for the EC to boot on a board and TASK_NORMAL represents the task that can be removed in a test binary. Tasks introduced by a test should be listed as TASK_TEST(). Note that this CL breaks current tests (many of them are broken anyway), which will be fixed in up coming CLs. BUG=chrome-os-partner:18598 TEST=Build link/bds/spring/snow/daisy/mccroskey. (mccroskey failed for unrelated issue) BRANCH=none Change-Id: Ic645cdae0906ed21dc473553f1f43c2537ec4bb9 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47531
* Clean up daisy GPIO and SPI initRandall Spangler2013-04-081-3/+0
| | | | | | | | | | | | | | | Much of the board init duplicated stuff already done in gpio init, so remove it. Powering the SPI module should be done in spi.c, not board.c. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms; boot EC on daisy Change-Id: I9a99eeeb971ebbf7de5b9c0548153684fbb7fff6 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47469 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move power LED GPIO code from snow board.c into power_led.cRandall Spangler2013-04-081-29/+0
| | | | | | | | | | | | | | | And remove the daisy power button LED task for now. Since daisy didn't have a board.c implementation (or a power button LED), its power LED task did nothing. BUG=chrome-os-partner:18343 BRANCH=none TEST=build daisy, snow, spring Change-Id: I1eb3d0bd038d88685e7caad087eb1a1d1495ef9a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47442 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Clean up board configurationRandall Spangler2013-04-052-8/+6
| | | | | | | | | | | | | | | | | Board configuration interfaces are now defined in board_config.h, not in every board.h file. Tidied /alphabetized CONFIG defines. No functional changes, just rearranging code. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all targets Change-Id: I6196591784f8fa9ce6dfccd31891b679fb200063 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47419
* Move board hard reset code into tpschrome driverRandall Spangler2013-04-052-18/+1
| | | | | | | | | | | | | | | | | Hard reset is done by shorting 3.3V to ground. This is only really necessary to work around the PMU's I2C engine getting into a weird / uncommunicative state. This should not make any functional changes; the code is behaving the same way it did before. BUG=chrome-os-partner:18343 BRANCH=none TEST=build daisy, snow, spring Change-Id: I0edbdfc11bd5f6643075ffc83f4df3e11fc14675 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47199
* Add common implementation for daisy/snow extpower_is_presentRandall Spangler2013-04-032-33/+1
| | | | | | | | | | | | | | The implementations are identical for daisy and snow, so move to a common file instead of having duplicate code in board.c BUG=chrome-os-partner:18343 BRANCH=none TEST=build daisy, snow Change-Id: I63597885607fd03b3bf87bcebf2146190b301f22 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47183 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Trigger dma_init() via HOOK_INITRandall Spangler2013-04-031-3/+0
| | | | | | | | | | | | | | There's no need for it to be initalized in board_init(); it just needs to be done before ADC / I2C / SPI initialize. BUG=chrome-os-partner:18343 BRANCH=none TEST=boot spring; verify EC communication and 'adc' console command still work Change-Id: I6039848fe031222d5ca59b459adfe18fc3e8ef08 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47182 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Clean up board.c filesRandall Spangler2013-04-032-24/+8
| | | | | | | | | | | | | Just renaming functions and reordering #defines; no functional changes. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all EC boards Change-Id: I90e9ea860110625012cd5fb99de966283ec82880 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47179 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Rename charging task to CHARGER, charger_taskRandall Spangler2013-03-291-1/+1
| | | | | | | | | | | | | | | This makes the charging task name consistent across platform. No functional changes, just renaming. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all EC boards Change-Id: I348b31313f6604df2a05b474bdf6e0be7450c8c9 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/46891 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move files in preparation for merging keyboard_scan modulesRandall Spangler2013-03-272-1/+3
| | | | | | | | | | | | | | | | | | This is part one of a series to merge the keyboard scan interface to be common across all platforms. This change just moves and renames files and APIs and removes some read code, and sets up protocol-specific CONFIG options. It makes the next CL which actually merges keyboard scanning easier to parse. BUG=chrome-os-partner:18360 BRANCH=none TEST=compile all boards; test keyboard on spring and link Change-Id: I815a40aae4e5d5f333b8501aff9656080533d913 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/46549 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move keyboard dimension and key constants to keyboard_config.hRandall Spangler2013-03-221-3/+1
| | | | | | | | | | | | | | These were previously duplicated between multiple keyboard_scan.c and board.c files, and there were a bunch of different constants #defined to be 13. BUG=chrome-os-partner:18360 BRANCH=none TEST=compile all boards; test keyboard on spring and link Change-Id: I91bf9d56d2a56ff25ff307ff10883ca87b6937e5 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/46165
* Add keyboard_raw interfaceRandall Spangler2013-03-221-9/+9
| | | | | | | | | | | | | | | | | | | | This is the low-level platform-dependent interface to drive keyboard columns, read rows, and handle keyboard interrupts. Both lm4 and stm32 had something like this before, but the interfaces weren't fully explicit or compatible. BUG=chrome-os-partner:18360 BRANCH=none TEST=manual - Build all platforms. - Boot system and test typing on keyboard. - Hold power+refresh+esc to test boot key detection; should go to recovery. Change-Id: Ie3bcc1d066a4da5204f0e236daeb52c4064a6213 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/46156
* Move asserting host keyboard interrupt signal to keyboard_scanRandall Spangler2013-03-202-9/+0
| | | | | | | | | | | | | | | | The implementation is identical on all stm32 hardware, so remove all the duplicate copies from board.c files. mccrosskey doesn't have GPIO_EC_INT so stub it out like we do on bds. No functional change, just moving code. BUG=none BRANCH=none TEST=build mccrosskey,daisy,snow,spring Change-Id: I7d4378650d7b4c640c15180c41459a41620f5bd3 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/45920
* Move gaia event handler declarations to gaia_power.hRandall Spangler2013-03-201-11/+1
| | | | | | | | | | | | | | This removes duplicated code in 3 different board.c files. No functional changes, just moving declarations. BUG=chrome-os-partner:18343 BRANCH=none TEST=build daisy,spring,snow Change-Id: Ie6266dca7d7d160e154fce1a09452e5cc9a1095c Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/45898
* Move I2C arbitration to its own fileRandall Spangler2013-03-202-97/+1
| | | | | | | | | | | | | | | | | It's only board-specific in that we've only needed it on snow so far. But by that logic, x86_power would be board specific because we've only needed it on link. No functionality change, just moving code between files and renaming the interface to indicate it's not board-specific. BUG=chrome-os-partner:18343 BRANCH=none TEST=build daisy,snow,spring Change-Id: I35debdaa71829d55a2fbc5d3c62b2aaf6e467633 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/45879
* Use common declaration of keyboard_scan_interrupt()Randall Spangler2013-03-192-14/+17
| | | | | | | | | | | | | | | | Code cleanup: declare keyboard_scan_interrupt() once, not per board; the implementation is common anyway. No functional changes; just renaming. BUG=none BRANCH=none TEST=build daisy,snow,spring,mccrosskey Change-Id: I1e33cbe2c868bc47b641d36d26f07c3b5a7ba3c7 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/45874 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Rename board_get_ac() to extpower_is_present()Randall Spangler2013-03-191-1/+2
| | | | | | | | | | | | | | | Code cleanup; use the same function names to mean the same thing across boards. No functional changes; just renaming. BUG=none BRANCH=none TEST=build daisy,snow,spring Change-Id: Icbb4cfda5f5f9ba0cbbc07fee622e9c21af3f8cd Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/45867 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: David James <davidjames@chromium.org>
* Rename tasks to HOOKS and CHIPSETRandall Spangler2013-03-193-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | Rename tasks TICK -> HOOKS The hooks task handles more than just the TICK hook now. X86POWER -> CHIPSET GAIAPOWER -> CHIPSET Kinda kludgy that the name of the task controls which chipset source gets included. Change this to a CONFIG_CHIPSET_{X86,GAIA} #define to make it easier to support future chipsets. Also, rename the task function to chipset_task() so ec.tasklist is chipset-agnostic. No code changes, just renaming constants and functions. BUG=none BRANCH=none TEST=build bds,link,daisy,snow,spring Change-Id: I163ce1cd27b2d8d030d42bb1f7eb46b880c244fb Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/45805
* stm32: list keyboard output ports on a per-board basisDavid Hendricks2013-03-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | This CL moves the keyboard port listing to board.h for each mainboard to reduce board-specific clutter in keyboard_scan.c. Since the info is now exposed outside of keyboard_scan.c, a more descriptive name was chosen. Note: GPIO_D does not need to be included in this list for any current platform. BUG=none BRANCH=none Test=tested on Snow by pressing all number and letter keys Signed-off-by: David Hendricks <dhendrix@chromium.org> Change-Id: I1ce924a41cafae557467997ecba9c5abeed86211 Reviewed-on: https://gerrit.chromium.org/gerrit/45284 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org>
* stm32: Move KB_INPUTS to board.hDavid Hendricks2013-03-111-1/+2
| | | | | | | | | | | | | | | | This moves KB_INPUTS from keyboard_scan.c to board.h where KB_OUTPUTS is #defined. Although we use the same 13x8 keyboard matrix on all platforms, KB_OUTPUTS is defined on a per-board basis due to its usage in keyboard_test. BUG=none BRANCH=none TEST=locally compiled Change-Id: I0d66705d2959c7824b96cc8aae55368eca39a21a Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44970 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: Add option to select timer for hardware clockVic Yang2012-12-121-0/+4
| | | | | | | | | | | | | | Hardware clock uses two timers, currently TIM3 and TIM4. This CL adds an option to select between TIM2, TIM3, and TIM4, so that we can use any one the three timer as a PWM source. BUG=chrome-os-partner:14319, chrome-os-partner:7463 TEST=Build and run on snow/spring. Build success on daisy. BRANCH=none Change-Id: I1a00b3d491ee3e131708b573f6ea70e6b56c96dd Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39584
* stm32: Implement keyscan test infrastructureSimon Glass2012-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Support the keyscan test functionality on stm32. Note: This is enabled by default so that it continues to build. But it is unlikely that we will want this in a shipping image. I suggest we add the facility for a dev build. Secondly, the stack has to be larger due to a printf (which admittedly I could just remove). Should we make the stack size conditional on the CONFIG? Seems a bit ugly, on the other hand we don't want to waste IRAM. BUG=chrome-os-partner:12179 BRANCH=none TEST=manual for now: On snow: ./ectool keyscan 20000 key_sequence.txt See that the test passes. Change-Id: Ic441ca0bde1be9589a924374605e2f146d16f423 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35118
* Watchdog is reloaded by HOOK_TICK, not its own taskRandall Spangler2012-10-301-1/+0
| | | | | | | | | | | | | This reduces memory footprint. BUG=chrome-os-partner:15714 BRANCH=none TEST=system still boots; 'waitms 1500' prints watchdog error dump Change-Id: Ieb0248a34655514b03d919cc36c2b369691da716 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36937 Reviewed-by: Simon Glass <sjg@chromium.org>
* Add tick taskRandall Spangler2012-10-301-0/+1
| | | | | | | | | | | | | | | | | | | Adds a new HOOK_TICK event which is called every 250ms (LM4) or 500ms (STM32). This will be used to consolidate a number of tasks which do small amounts of work infrequently, and previously needed their own task functions. This CL adds the tick task; subsequent CLs will consolidate watchdog and other tasks into tick hooks. BUG=chrome-os-partner:15714 BRANCH=none TEST=taskinfo shows TICK task as lowest priority Change-Id: I9068ee99d56a5bf5c12afd86ad51998c013f4954 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36908 Reviewed-by: Simon Glass <sjg@chromium.org>
* Use CONFIG_TASK_VBOOTHASH instead of CONFIG_VBOOTRandall Spangler2012-10-231-3/+0
| | | | | | | | | | | | | | | This fixes build breaks in 'make tests'. BUG=none BRANCH=none TEST=make tests (note that this still fails due to other problems; will fix those in a followup CL) Change-Id: I5b5ce52ed6e44ade6051e0a091a6699c0454d61a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36353 Reviewed-by: Simon Glass <sjg@chromium.org>
* Hook functions no longer return valuesRandall Spangler2012-10-231-8/+3
| | | | | | | | | | | | | | | Previously, all hook functions returned EC_SUCCESS, which was meaningless because nothing ever looked at the return value. Changing the return value to void saves ~100 bytes of code size and an equal amount of source code size. BUG=none BRANCH=none TEST=code still builds; link still boots Change-Id: I2a636339894e5a804831244967a9c9d134df7d13 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36372