summaryrefslogtreecommitdiff
path: root/drivers
Commit message (Collapse)AuthorAgeFilesLines
* cfi_flash: Always define cfi_flash_num_flash_banksMario Six2018-01-291-0/+2
| | | | | | | | | | | | | The variable cfi_flash_num_flash_banks is defined iff CONFIG_SYS_MAX_FLASH_BANKS_DETECT is defined, but it is used unconditionally in the function cfi_flash_init_dm. This leads to a undefined variable compile error when CONFIG_SYS_MAX_FLASH_BANKS_DETECT is not defined, but DM is enabled. Fix this by always defining the cfi_flash_num_flash_banks variable. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix indentionMario Six2018-01-291-120/+118
| | | | | | | | | When long expressions surrounded by parentheses are split into multiple lines, each consecutive line should be aligned with the corresponding parenthesis. Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix long linesMario Six2018-01-291-12/+19
| | | | | | | | Long lines (>80 characters) should be avoided where possible. Break up some long lines where it's not detrimental to readability. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Bound-check index before array accessMario Six2018-01-291-2/+2
| | | | | | | | | | | | In a while loop in cfi_flash.c the array "start" is accessed at the index "sector" before the index variable "sector" is bounds-checked, which might lead to accesses beyond the bounds of the array. Swap the order of the checks in the "&&" expression, so that the short-circuit evaluation prevents out-of-bounds array accesses. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* flash: Fix spelling of "ERR_TIMOUT"Mario Six2018-01-292-5/+5
| | | | | | | | | checkpatch.pl complains about the spelling of ERR_TIMOUT. Since the error is only used in a handful of files, we rename the error to ERR_TIMEOUT. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Rename camel-case variablesMario Six2018-01-291-8/+8
| | | | | | | | Camel-case naming should be avoided. Rename two camel-case variables, and fix their usage accordingly. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix strings split across linesMario Six2018-01-291-9/+8
| | | | | | | | Strings should not be split accross multiple lines. Where possible and not detrimental to readability, fix the instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Use u8 pointers instead of void pointersMario Six2018-01-291-4/+4
| | | | | | | | | | | According to the C standard, pointer arithmetic for pointers of type void is undefined behavior (the assumption that they're 8-bit wide is a GCC-specific assumption). In the interest of keeping the code standards-compliant, and also better communicate intent, switch all void* variables where pointer arithmetic is used to u8* variables. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Remove assignments from if conditionsMario Six2018-01-291-7/+11
| | | | | | | | | The condition in if statements should not be used for variable assignment. Instead, the assignment should be done in a separate step beforehand. Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Remove return from void functionMario Six2018-01-291-1/+0
| | | | | | | void functions don't need an explicit return at the end. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix placement of braceMario Six2018-01-291-2/+1
| | | | | | | | The opening brace of block statements should be attached to the statement itself, and not be on a separate line. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix else after breakMario Six2018-01-291-3/+3
| | | | | | | | | If in a loop, the if block in a if/else statement ends in a break, the statements in the else blockcan be extracted, since the break stops the execution. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix spelling of "Unknown"Mario Six2018-01-291-1/+1
| | | | | | | "Unkown" should be spelled "Unknown". Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Add missing braces in blocksMario Six2018-01-291-1/+3
| | | | | | | | | In if/else statements, either both blocks (if and else) should have braces or both blocks should not have braces, but mixed configurations are discouraged. Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Remove unnecessary bracesMario Six2018-01-291-24/+24
| | | | | | | | | "==" and "!=" bind tighter than the boolean operators, so parentheses around them in compound logical statements are unnecessary. Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix comment styleMario Six2018-01-291-2/+4
| | | | | | | | | Comment blocks should end with a "*/" on a separate line, not with the "*/" attached to the end of the last line of text. Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Use __func__ macro instead of function nameMario Six2018-01-291-1/+1
| | | | | | | | | printf/debug statements should not include the file name as a hardcoded string, but instead use the __func__ macro. Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix logical continuationsMario Six2018-01-291-13/+13
| | | | | | | | | When splitting long logical statements across multiple lines, the logical operators should be at the end of the lines. Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Remove braces for single-statement blocksMario Six2018-01-291-10/+5
| | | | | | | | Blocks with a single statement should not be enclosed in braces. Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix missing/superfluous linesMario Six2018-01-291-7/+4
| | | | | | | | | There should be no consecutive blank lines, and no blank lines at the end of blocks. But there should be blank lines between variable declarations and code. Fix all instances where either occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix spacing around casts/operatorsMario Six2018-01-291-9/+9
| | | | | | | | | There should be spaces around operators, and no spaces between a cast and the variable its being applied to. Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix indent of case statementsMario Six2018-01-291-100/+100
| | | | | | | | case statements should be at the same level of indent as the switch keyword. Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix whitespace with castingMario Six2018-01-291-2/+2
| | | | | | | | | When casting to a pointer type, the asterisk should be attached to the type name, not separated by a space. Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix Parenthesis spacingMario Six2018-01-291-11/+11
| | | | | | | | There should not be additional spaces when nesting parentheses ("( (...) )"). Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix style of pointer declarationsMario Six2018-01-291-24/+24
| | | | | | | | In a pointer declaration there should not be a space between the asterisk and the pointer name. Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: Fix space between function name and parenthesisMario Six2018-01-291-214/+214
| | | | | | | | There should not be a space between a function name and a parenthesis ("func (...)"). Fix all instances where this occurs. Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
* Merge git://git.denx.de/u-boot-rockchipTom Rini2018-01-2811-25/+2374
|\
| * rockchip: clk: guard set_parent implementations against OF_PLATDATAPhilipp Tomsich2018-01-283-6/+12
| | | | | | | | | | | | | | | | The set_parent implementations do not make sense when OF_PLATDATA is enabled. We guard these against OF_PLATDATA and don't populate the set_parent-op when this is the case. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * clk: rockchip: clk_rk3368: Implement "assign-clock-parent"David Wu2018-01-281-7/+84
| | | | | | | | | | | | | | | | | | Implement the setting parent for gmac clock, and add internal pll div set for mac clk. Signed-off-by: David Wu <david.wu@rock-chips.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * clk: rockchip: clk_rk3288: Implement "assign-clock-parent" and ↵David Wu2018-01-281-8/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | "assign-clock-rate" The RK3288 CRU-node assigns rates to a number of clocks that are not implemented in the RK3288 clock-driver (but which have been sufficiently initialised from rkclk_init()): for these clocks, we implement the gmac clock set parent, but simply ignore the others' set_rate() operation and return 0 to signal success. Signed-off-by: David Wu <david.wu@rock-chips.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * net: gmac_rockchip: Add support for the RK3228 GMACDavid Wu2018-01-281-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | The GMAC in the RK3228 once again is identical to the incarnation in the RK3288 and the RK3399, except for where some of the configuration and control registers are located in the GRF. This adds the RK3368-specific logic necessary to reuse this driver. Signed-off-by: David Wu <david.wu@rock-chips.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * clk: rockchip: Add rk322x gamc clock supportDavid Wu2018-01-281-0/+107
| | | | | | | | | | | | | | | | | | Assuming mac_clk is fed by an external clock, set clk_rmii_src clock select control register from IO for rgmii interface. Signed-off-by: David Wu <david.wu@rock-chips.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * rockchip: pinctrl: Add rk322x gmac pinctrl supportDavid Wu2018-01-281-0/+148
| | | | | | | | | | | | | | | | | | Set gmac pins iomux and rgmii tx pins to 12ma drive-strength, clean others to 2ma. Signed-off-by: David Wu <david.wu@rock-chips.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * rockchip: pinctrl: rk322x: Move the iomux definitions into pinctrl-driverDavid Wu2018-01-281-0/+453
| | | | | | | | | | | | | | | | | | | | Clean the iomux definitions at grf_rk322x.h, and move them into pinctrl-driver for resolving the compiling error of redefinition. After that, define the uart2 iomux at rk322x-board file. Signed-off-by: David Wu <david.wu@rock-chips.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * net: gmac_rockchip: Add rk3328 gmac supportDavid Wu2018-01-281-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | The GMAC2IO in the RK3328 once again is identical to the incarnation in the RK3288 and the RK3399, except for where some of the configuration and control registers are located in the GRF. This adds the RK3328-specific logic necessary to reuse this driver. Signed-off-by: David Wu <david.wu@rock-chips.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * clk: rockchip: Add rk3328 gamc clock supportDavid Wu2018-01-281-0/+178
| | | | | | | | | | | | | | | | | | | | The rk3328 soc has two gmac controllers, one is gmac2io, the other is gmac2phy. We use the gmac2io rgmii interface for 1000M phy here. Signed-off-by: David Wu <david.wu@rock-chips.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * rockchip: pinctrl: Add rk3328 gmac pinctrl supportDavid Wu2018-01-281-0/+275
| | | | | | | | | | | | | | | | | | | | Need to set gmac m1 pins iomux, gmac m0 tx pins, select bit2 and bit10 at com iomux register. After that, set rgmii m1 tx pins to 12ma drive-strength, and clean others to 2ma. Signed-off-by: David Wu <david.wu@rock-chips.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * rockchip: pinctrl: rk3328: Move the iomux definitions into pinctrl-driverDavid Wu2018-01-281-0/+113
| | | | | | | | | | | | | | | | | | Clean the iomux definitions at grf_rk3328.h, and move them into pinctrl-driver for resolving the compiling error of redefinition. Signed-off-by: David Wu <david.wu@rock-chips.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * net: gmac_rockchip: Add support for the RV1108 GMACDavid Wu2018-01-281-6/+109
| | | | | | | | | | | | | | | | | | | | | | The rv1108 GMAC only support rmii interface, so need to add the set_rmii() ops. Use the phy current interface to set rmii or rgmii ops. At the same time, need to set the mac clock rate of rmii with 50M, the clock rate of rgmii with 125M. Signed-off-by: David Wu <david.wu@rock-chips.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * rockchip: pinctrl: rv1108: Move the iomux definitions into pinctrl-driverDavid Wu2018-01-281-0/+399
| | | | | | | | | | | | | | | | | | | | | | If we include both the rk3288_grf.h and rv1108_grf.h, it will cause the conflicts of redefinition. Clean the iomux definitions at grf_rv1108.h, and move them into pinctrl-driver. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
| * rockchip: clk: rk3399: accept all assigned-clocks from the 'cru'-nodePhilipp Tomsich2018-01-281-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | The RK3399 CRU-node assigns rates to a number of clocks that are not implemented in the RK3399 clock-driver (but which have been sufficiently initialised from rkclk_init()): for these clocks, we simply ignore the set_rate() operation and return 0 to signal success. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: David Wu <david.wu@rock-chips.com> Series-changes: 2 - Fixed David's email address.
| * clk: implement clk_set_defaults()Philipp Tomsich2018-01-282-0/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux uses the properties 'assigned-clocks', 'assigned-clock-parents' and 'assigned-clock-rates' to configure the clock subsystem for use with various peripheral nodes. This implements clk_set_defaults() and hooks it up with the general device probibin in drivers/core/device.c: when a new device is probed, clk_set_defaults() will be called for it and will process the properties mentioned above. Note that this functionality is designed to fail gracefully (i.e. if a clock-driver does not implement set_parent(), we simply accept this and ignore the error) as not to break existing board-support. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: David Wu <david.wu@rock-chips.com> Series-changes: 2 - Fixed David's email address. Series-version: 2 Cover-letter: clk: support assigned-clock, assigned-clock-parents, assigned-clock-rates For various peripherals on Rockchip SoCs (e.g. for the Ethernet GMAC), the parent-clock needs to be set via the DTS. This adds the required plumbing and implements the GMAC case for the RK3399. END
| * rockchip: clk: rk3399: implement set_parent() operationPhilipp Tomsich2018-01-281-2/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements the (newly added) set_parent() operation for the RK3399 with a focus on allowing the RGMII clock parent to be configured via the assigned-clock-parents property of the GMAC node. This implementation supports only the GMAC (in fact only the RGMII clock parent) and allows to set this clock's parent either to the internal SCLK_GMAC or to an external clock input (identifiable by it providing a 'clock-output-name' of "gmac_clkin"). Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: David Wu <david.wu@rock-chips.com> Series-changes: 2 - Fixed David's email address.
| * clk: refactor clk_get_by_index() into clk_get_by_indexed_prop()Philipp Tomsich2018-01-281-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The logic in clk_get_by_index() may be useful for other properties than 'clocks': e.g. 'assigned-clocks' and 'assigned-clock-parents' follows the same model. This commit refactors clk_get_by_index() by introducing an internal function clk_get_by_indexed_prop() that allows to specify the name of the property to process. The original clk_get_by_index() call is simply directed through this helper function with the property name fixed to "clocks". Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: David Wu <david.wu@rock-chips.com> Series-changes: 2 - Fixed David's email address.
| * clk: add clk_set_parent()Philipp Tomsich2018-01-281-0/+12
| | | | | | | | | | | | | | | | | | | | | | Clocks may support multiple parents: this change introduces an optional operation on the clk-uclass to set a clock's parent. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: David Wu <david.wu@rock-chips.com> Series-changes: 2 - Fixed David's email address.
* | bcm2835_pinctrl: Probe pre-relocAlexander Graf2018-01-281-1/+2
| | | | | | | | | | | | | | | | | | | | The serial drivers now depend on the pinctrl driver to determine whether they are enabled. That means if a serial device wants to be used pre-reloc, we also need the pinctrl device pre-reloc. Adapt the pinctrl driver as well as dts overlay accordingly. Signed-off-by: Alexander Graf <agraf@suse.de>
* | bcm2835_pl011_serial: Add BCM2835 specific serial driverAlexander Graf2018-01-285-9/+100
| | | | | | | | | | | | | | | | | | On bcm2835 we need to ensure we only access serial devices that are muxed to the serial output pins of the pin header. To achieve this for the pl011 device, add a bcm2835 specific pl011 wrapper device that does this check but otherwise behaves like a pl011 device. Signed-off-by: Alexander Graf <agraf@suse.de>
* | bcm2835_mu_serial: Convert to KconfigAlexander Graf2018-01-281-0/+7
| | | | | | | | | | | | | | Setting config options using headers is deprecated. This patch converts the BCM2835 Mini-UART to Kconfig. Signed-off-by: Alexander Graf <agraf@suse.de>
* | pl01x: Convert CONFIG_PL01X_SERIAL to KconfigAlexander Graf2018-01-281-0/+6
| | | | | | | | | | | | | | | | | | We want to use Kconfig logic to depend on whether pl01x devices are built in, so let's convert their inclusion selection to Kconfig. This round goes to pl01x. Signed-off-by: Alexander Graf <agraf@suse.de>
* | pl011: Convert CONFIG_PL011_SERIAL to KconfigAlexander Graf2018-01-281-0/+6
| | | | | | | | | | | | | | | | | | We want to use Kconfig logic to depend on whether pl01x devices are built in, so let's convert their inclusion selection to Kconfig. This round goes to pl011. Signed-off-by: Alexander Graf <agraf@suse.de>