summaryrefslogtreecommitdiff
path: root/board/cr50/rdd.c
Commit message (Collapse)AuthorAgeFilesLines
...
* cleanup: DECLARE_CONSOLE_COMMAND only needs 4 argsBill Richardson2016-08-241-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since pretty much always, we've declared console commands to take a "longhelp" argument with detailed explanations of what the command does. But since almost as long, we've never actually used that argument for anything - we just silently throw it away in the macro. There's only one command (usbchargemode) that even thinks it defines that argument. We're never going to use this, let's just get rid of it. BUG=none BRANCH=none CQ-DEPEND=CL:*279060 CQ-DEPEND=CL:*279158 CQ-DEPEND=CL:*279037 TEST=make buildall; tested on Cr50 hardware Everything builds. Since we never used this arg anyway, there had better not be any difference in the result. Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/374163 Reviewed-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Cr50: Use parse_bool() for boolean argsBill Richardson2016-08-221-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The parse_bool() function exists so we don't have to litter our console commands with stuff like this: if (!strncasecmp(argv[1], "on") || !strncasecmp(argv[1], "enable" || !strncasecmp(argv[1], "true" || [...] This CL uses parse_bool instead of that kind of thing so I don't have to remember which commands use "enable" and which use "on" and so forth. I only changed the commands that Cr50 uses. BUG=none BRANCH=none TEST=make buildall; test on Cr50 hardware I tested all the affected commands to ensure that they still work correctly: usb, ccd, flashwp (which doesn't do anything anyway). Change-Id: I7d875ab22934fb4b500e3d0f62ebe3e04101272d Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/373658 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* g: disable usb wakeup when debug accessory is disconnectedMary Ruthven2016-07-191-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | USB is only used for CCD. USB should not be enabled as a wakeup source unless a debug accessory is detected, because that is the only USB traffic we care about. The rest may be from other sources like the HID interface or something else using those signals. This change disables the utmi wake source when the debug accessory is attached and enables it when it is connected. BUG=chrome-os-partner:54796 BRANCH=none TEST=manual The SPI_CS_L pin still gets triggered and will wake up cr50 before usb so disable wake up pins as a wakeup source. Verify Cr50 goes to sleep and plugging in a SuzyQ will wake it up and after removing it Cr50 will go back to sleep. Change-Id: Ib97244016b0af244c340259915def9f4d8f97569 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/360693 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* cr50: disable device monitoring when not in ccdMary Ruthven2016-07-121-5/+21
| | | | | | | | | | | | | | | When cr50 is not trying to do ccd, we dont need to monitor the devices. Disable device state detection interrupts and the AP and EC UARTs. BUG=none BRANCH=none TEST=gru and kevin monitor devices correctly when ccd is enabled, and dont monitor anything when it is disabled. Change-Id: Ic3f5974320486ff6dd0147c490a1c294cc2f6a76 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/356770 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* cr50: Dont switch from PHY 1 to 0 when disabling CCDMary Ruthven2016-07-111-8/+2
| | | | | | | | | | | | | | | | | The AP no longer uses PHY0 to to interact with Cr50. Cr50 only uses PHY1 so dont switch the PHY when disabling CCD just release the usb. BUG=none BRANCH=none TEST=After running 'ccd disable' the command 'usb' still returns PHY B, but 'lsusb | grep 5014' on the host doesn't show any devices. When CCD is enabled 'lsusb | grep 5014' shows a device on the host. Change-Id: Icec0acc7a0d00f7eb56c6feef3ff4cf5a3f99735 Reviewed-on: https://chromium-review.googlesource.com/359931 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: enable case closed debugMary Ruthven2016-06-031-19/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds a ccd console command to control the usb endpoints. The uart console command is moved into this command so 'ccd uart [enable|disable]' controls the AP and EC TX signals instead of the 'uart' console command. CCD can be enabled using 'ccd enable'. This switches the PHY used by the USB controller to be the external PHY. Changing the PHY exposes the cr50, AP, and EC consoles as well as the upgrading mechanisms for the AP, EC and cr50. The AP and EC consoles will be read only until 'ccd uart enable' is called. Cr50 can be updated using the usb upgrade endpoint. The EC and AP can be updated using the USB SPI endpoint. When CCD is disabled the usb controller will switch to using the AP PHY. None of the endpoints will be visible to the host. The USB SPI endpoint can be used to flash the EC or AP using 'flashrom -p raiden_debug_spi:target=[AP|EC]'. If CCD is not enabled running flashrom using the raiden_debug_spi programmer will fail. Cr50 will not forward the commands to the external AP or EC ROM, so flashrom will not be able to find the chip. The UART TX signals are now controlled by the 'ccd uart' console command instead of the 'uart' console command. The UART TX is enabled separately from CCD, because we want to be able to enable CCD while servo is connected, and having the cr50 UART TX pins wired directly to the Servo TX lines could damage both devices. The AP and EC consoles are be read only until 'ccd uart enable' is called. 'ccd uart disable' disconnects the AP and EC TX pins from the UART peripheral. When RDD becomes reliable on cr50, ccd_set_mode will select the PHY being used by the g chip USB controller. BUG=chrome-os-partner:49960,chrome-os-partner:52281 BRANCH=none TEST=manual TEST SERVO power cycle the DUT connect servo and check that the AP and EC consoles still work check that both the AP and EC can be flashed using servo. TEST SUZY Q Attach Suzy Q Connect to the all three consoles. Check that the cr50 console is in read-write mode and the EC and AP consoles are read only. Attach Servo. Verify all of the servo functionality described above still works with suzy q attached and ccd enabled. Disconnect Servo. run 'ccd uart enable' on the cr50 console and check both the AP and EC consoles can be written to. Check that the AP and EC can be programmed using the raiden_debug_spi programmer. Change-Id: I96db2a72fc95086871c9e4c778c19ebd01efb851 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342563
* cr50: dont drive UART output if servo is connectedMary Ruthven2016-05-271-12/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the power and servo connection states to enable and disable the EC and AP UART output. Contention between the cr50 and servo can prevent either uart from working, and possibly damage kevin or servo. If both UARTs are enabled, then cr50 cant know if servo is connected, so it is best if the UARTs are disabled before connecting servo. If servo is connected or if a device is not powered on then the UART output wont be enabled. The two UARTs are enabled separately and one can be enabled without the other. Any disabled UART will be monitored for a servo connection. If servo is detected, then all UARTs will be disabled. BUG=chrome-os-partner:52056,chrome-os-partner:52322 BRANCH=none TEST=manual Power on the EC only. Check only the EC UART is enabled. Without disabling the uarts power on the AP and verify both are now enabled. Turn of the AP. run 'uart enable. Verify only the EC UART is enabled. Then attach servo and check that the AP and EC UART are disabled. Change-Id: Ife27c9360e91b07f86ff8bfcec7f4fd423c31d25 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342828
* cr50: monitor the state of Servo, the EC, and APMary Ruthven2016-05-271-6/+13
| | | | | | | | | | | | | | | | | There are a couple of issues that cr50 has when it cannot know the state of servo, the EC, and the AP. This change adds support so we can detect when the AP or EC has been powered on and when servo has been connected. It uses the UART RX signals to monitor the power state of the AP and EC. The TX signals are used to monitor the state of servo. BUG=chrome-os-partner:52056,chrome-os-partner:52322 BRANCH=none TEST=verify device states are correct when the AP and EC are powered on or off and when Servo is attached or detached Change-Id: Id0a2281b65cb367ecc8d0ca2f9a576672318a5fb Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/344019
* Cr50: Move board-specific rdd stuff out of chip/g/Bill Richardson2016-04-291-6/+7
| | | | | | | | | | | | | Poking GPIOs is something that belongs in board/ not chip/ BUG=none BRANCH=none TEST=make buildall; test on Kevin Change-Id: I798053c3760415ed787800d37eb81c765b826399 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/341065 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* cr50: enable AP and EC UART in CCD MODEMary Ruthven2016-04-151-0/+64
When the debug cable is plugged in enable the EC and AP UART output. Disable the output when the cable is disconnected so servo can use the UARTs. BUG=chrome-os-partner:52322 BRANCH=none TEST=Verify commands can be sent to the EC UART through usb when suzy q is connected. Verify servo can interact with the EC UART when suzy q is not connected. Change-Id: I2ce0e9da464b24e295e732aa638bfc32323cc72d Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/338858 Reviewed-by: Bill Richardson <wfrichar@chromium.org>