arm: add basic support for Rockchip Cortex-A9 SoCs
Subsystems (8)
Heiko Stübner
maintainerv2 cover arm: add basic support for Rockchip Cortex-A9 SoCs
Second version of basic Rockchip A9 support.
Changes since v1:
- addressed Linus Walleij's comments to the pinctrl driver, including the move to generic pinconfig (hopefully I did catch all)
- renamed the clocks to use the SoC name of the initial user as suggested by Olof Johansson
- fixed the uart address, found by Arnd Bergmann
- address Arnd's comments on the board file (use of_clk_init and friends, remove map_io, use real soc names)
- removed Makefile.boot as suggested by Thomas Petazzoni
Dependencies:
- the irqdomain support for the generic_irq from Thomas Gleixner is required by the pinctrl driver, which is strangely not in linux-next, only in tip.git
- "mmc: dw_mmc: Add support DW SD/MMC driver on SOCFPGA" moves the SDMMC_CMD_USE_HOLD_REG constant into the common header, which is required on these Rockchip SoCs
- the db_apb_timer enhancements sent separately
- the pinctrl-generic option for pin-default pulls, sent today
Heiko Stuebner (8):
clk: flag to use upper half of the register as change indicator
clk: divider: add flag to limit possible dividers to even numbers
mmc: dw_mmc-pltfm: remove static from dw_mci_pltfm_remove
mmc: dw_mmc-pltfm: add Rockchip variant
pinctrl: add pinctrl driver for Rockchip SoCs
clk: add basic Rockchip rk3066a clock support
arm: add debug uarts for rockchip rk29xx and rk3xxx series
arm: add basic support for Rockchip RK3066a boards
.../bindings/pinctrl/rockchip,pinctrl.txt | 97 ++ arch/arm/Kconfig | 2 + arch/arm/Kconfig.debug | 34 + arch/arm/Makefile | 1 + arch/arm/boot/dts/rk3066a-clocks.dtsi | 460 +++++++ arch/arm/boot/dts/rk3066a.dtsi | 359 +++++ arch/arm/include/debug/rockchip.S | 42 + arch/arm/mach-rockchip/Kconfig | 17 + arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/rockchip.c | 54 + drivers/clk/Makefile | 1 + drivers/clk/clk-divider.c | 29 +- drivers/clk/clk-gate.c | 24 +- drivers/clk/clk-mux.c | 15 +- drivers/clk/rockchip/Makefile | 6 + drivers/clk/rockchip/clk-rockchip-pll.c | 131 ++ drivers/clk/rockchip/clk-rockchip-pll.h | 19 + drivers/clk/rockchip/clk-rockchip.c | 313 +++++ drivers/mmc/host/dw_mmc-pltfm.c | 48 +- drivers/pinctrl/Kconfig | 6 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-rockchip.c | 1364 ++++++++++++++++++++ include/dt-bindings/pinctrl/rockchip.h | 37 + include/linux/clk-provider.h | 18 + 24 files changed, 3053 insertions(+), 26 deletions(-) create mode 100644 Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt create mode 100644 arch/arm/boot/dts/rk3066a-clocks.dtsi create mode 100644 arch/arm/boot/dts/rk3066a.dtsi create mode 100644 arch/arm/include/debug/rockchip.S create mode 100644 arch/arm/mach-rockchip/Kconfig create mode 100644 arch/arm/mach-rockchip/Makefile create mode 100644 arch/arm/mach-rockchip/rockchip.c create mode 100644 drivers/clk/rockchip/Makefile create mode 100644 drivers/clk/rockchip/clk-rockchip-pll.c create mode 100644 drivers/clk/rockchip/clk-rockchip-pll.h create mode 100644 drivers/clk/rockchip/clk-rockchip.c create mode 100644 drivers/pinctrl/pinctrl-rockchip.c create mode 100644 include/dt-bindings/pinctrl/rockchip.h
Signature · 1 line
1.7.2.3
Heiko Stübner
maintainerPATCH v2 1/8 clk: flag to use upper half of the register as change indicator
There exist platforms, namely at least all Rockchip Cortex-A9 based ones, that don't use the paradigm of reading-changing-writing the register contents, but instead only write the changes to the register with a mask that indicates the changed bits.
This patch adds flags and code to support the case where the lower 16 bit of hold the information and the upper 16 bit are used as mask to indicate the written changes.
As hardware-specific flags should not be added to the common clk flags, the flags are added to gate, mux and divider clocks individually.
--- drivers/clk/clk-divider.c | 15 +++++++++++++-- drivers/clk/clk-gate.c | 24 ++++++++++++++++++------ drivers/clk/clk-mux.c | 15 +++++++++++++-- include/linux/clk-provider.h | 16 ++++++++++++++++ 4 files changed, 60 insertions(+), 10 deletions(-)
drivers/clk/clk-divider.c +13 -2
@@ -217,8 +217,12 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,if (divider->lock)spin_lock_irqsave (divider->lock, flags); - val =readl (divider->reg); - val &= ~(div_mask (divider) << divider->shift); +if (divider->flags &CLK_DIVIDER_MASK_UPPER_HALF ) { + val =div_mask (divider) << (divider->shift +16 ); + }else { + val =readl (divider->reg); + val &= ~(div_mask (divider) << divider->shift); + } val |= value << divider->shift;writel (val, divider->reg);
@@ -245,6 +249,13 @@ static struct clk *_register_divider(struct device *dev, const char *name,struct clk *clk;struct clk_init_data init; +if ((clk_divider_flags &CLK_DIVIDER_MASK_UPPER_HALF ) && + (shift + width >15 )) { +pr_err ("%s: shift %d + width %d invalid\n" , __func__, + shift, width); +return ERR_PTR (-EINVAL ); + } +/* allocate the divider */ div =kzalloc (sizeof (struct clk_divider ),GFP_KERNEL );if (!div) {
drivers/clk/clk-gate.c +18 -6
@@ -53,12 +53,19 @@ static void clk_gate_endisable(struct clk_hw *hw, int enable)if (gate->lock)spin_lock_irqsave (gate->lock, flags); - reg =readl (gate->reg); - -if (set) - reg |=BIT (gate->bit_idx); -else - reg &= ~BIT (gate->bit_idx); +if (gate->flags &CLK_GATE_MASK_UPPER_HALF ) { + reg =BIT (gate->bit_idx +16 ); + +if (set) + reg |=BIT (gate->bit_idx); + }else { + reg =readl (gate->reg); + +if (set) + reg |=BIT (gate->bit_idx); +else + reg &= ~BIT (gate->bit_idx); + }writel (reg, gate->reg);
@@ -121,6 +128,11 @@ struct clk *clk_register_gate(struct device *dev, const char *name,struct clk *clk;struct clk_init_data init; +if ((clk_gate_flags &CLK_GATE_MASK_UPPER_HALF ) && bit_idx >15 ) { +pr_err ("%s: bit_idx %d invalid\n" , __func__, bit_idx); +return ERR_PTR (-EINVAL ); + } +/* allocate the gate */ gate =kzalloc (sizeof (struct clk_gate ),GFP_KERNEL );if (!gate) {
drivers/clk/clk-mux.c +13 -2
@@ -86,8 +86,12 @@ static int clk_mux_set_parent(struct clk_hw *hw, u8 index)if (mux->lock)spin_lock_irqsave (mux->lock, flags); - val =readl (mux->reg); - val &= ~(mux->mask << mux->shift); +if (mux->flags &CLK_MUX_MASK_UPPER_HALF ) { + val = mux->mask << (mux->shift +16 ); + }else { + val =readl (mux->reg); + val &= ~(mux->mask << mux->shift); + } val |= index << mux->shift;writel (val, mux->reg);
@@ -112,6 +116,13 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name,struct clk *clk;struct clk_init_data init; +if (!mask || ((clk_mux_flags &CLK_MUX_MASK_UPPER_HALF ) && + (__fls (mask << shift) >15 ))) { +pr_err ("%s: shift %d + mask %d invalid\n" , __func__, + shift, mask); +return ERR_PTR (-EINVAL ); + } +/* allocate the mux */ mux =kzalloc (sizeof (struct clk_mux ),GFP_KERNEL );if (!mux) {
include/linux/clk-provider.h +16 -0
@@ -210,6 +210,11 @@ void of_fixed_clk_setup(struct device_node *np);* CLK_GATE_SET_TO_DISABLE - by default this clock sets the bit at bit_idx to * enable the clock. Setting this flag does the opposite: setting the bit * disable the clock and clearing it enables the clock +* CLK_GATE_MASK_UPPER_HALF - this clock only uses the lower 16 bit of the +* register to hold the gate bits, while using the upper 16 bit to +* indicate the bits that get changed during a write. So gating the +* clock in bit 2 would write BIT(18) | BIT(2) to the register, while +* ungating this clock would write only BIT(18) to the register. */ struct clk_gate {struct clk_hw hw;
@@ -220,6 +225,7 @@ struct clk_gate { };#define CLK_GATE_SET_TO_DISABLE BIT(0) +#define CLK_GATE_MASK_UPPER_HALF BIT(1)extern const struct clk_ops clk_gate_ops; struct clk *clk_register_gate(struct device *dev, const char *name,
@@ -257,6 +263,11 @@ struct clk_div_table {* Some hardware implementations gracefully handle this case and allow a * zero divisor by not modifying their input clock * (divide by one / bypass). +* CLK_DIVIDER_MASK_UPPER_HALF - this clock only uses the lower 16 bit of the +* register to hold the divider bits, while using the upper 16 bit to +* indicate the bits that get changed during a write. So for a clock with +* shift 0 and width 2, setting the divider to 2 would result in a write +* of (3 << 16) | (2 << 0). */ struct clk_divider {struct clk_hw hw;
@@ -271,6 +282,7 @@ struct clk_divider {#define CLK_DIVIDER_ONE_BASED BIT(0)#define CLK_DIVIDER_POWER_OF_TWO BIT(1)#define CLK_DIVIDER_ALLOW_ZERO BIT(2) +#define CLK_DIVIDER_MASK_UPPER_HALF BIT(3)extern const struct clk_ops clk_divider_ops; struct clk *clk_register_divider(struct device *dev, const char *name,
@@ -299,6 +311,9 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name,* Flags: * CLK_MUX_INDEX_ONE - register index starts@1, not 0 * CLK_MUX_INDEX_BIT - register index is a single bit (power of two) +* CLK_MUX_MASK_UPPER_HALF - this clock only uses the lower 16 bit of the +* register to hold the mux bits, while using the upper 16 bit to +* indicate the bits that get changed during a write. */ struct clk_mux {struct clk_hw hw;
@@ -312,6 +327,7 @@ struct clk_mux {#define CLK_MUX_INDEX_ONE BIT(0)#define CLK_MUX_INDEX_BIT BIT(1) +#define CLK_MUX_MASK_UPPER_HALF BIT(3)extern const struct clk_ops clk_mux_ops;
Signature · 1 line
1.7.2.3
Re: [PATCH v2 1/8] clk: flag to use upper half of the register as change indicator
Quoted 13 lines · Heiko St?bner
There exist platforms, namely at least all Rockchip Cortex-A9 based ones, that don't use the paradigm of reading-changing-writing the register contents, but instead only write the changes to the register with a mask that indicates the changed bits.
This patch adds flags and code to support the case where the lower 16 bit of hold the information and the upper 16 bit are used as mask to indicate the written changes.
As hardware-specific flags should not be added to the common clk flags, the flags are added to gate, mux and divider clocks individually.
Signed-off-by Heiko Stuebner <[email protected]>
(...)
drivers/clk/clk-gate.c struct clk *clk_register_gate(struct device *dev, const char *name, · line 134
Quoted 4 lines
drivers/clk/clk-gate.c +4
-0+if ((clk_gate_flags &CLK_GATE_MASK_UPPER_HALF ) && bit_idx >15 ) { +pr_err ("%s: bit_idx %d invalid\n" , __func__, bit_idx); +return ERR_PTR (-EINVAL ); + }
Now this looks *EXTREMELY* familiar to a patch just sent by Haojian for HiSilicon.
"[PATCH v2 3/6] clk: divider: add CLK_DIVIDER_HIWORD_MASK flag"
http://marc.info/?l=linux-arm-kernel&m=137035873916777&w=2
What kind of coincidence is this? Are Rockchip and HiSilicon using the same silicon IP or are they of a common origin? (It is a small world after all.)
I think you two guys need to read each others patch sets closely here. I'd like Haojian to look at Heiko's patches and Heiko to look at Haojian's patches, just to make sure you're not actually writing two drivers for the same hardware in the end.
Yours,
Linus Walleij
Heiko Stübner
maintainerRe: [PATCH v2 1/8] clk: flag to use upper half of the register as change indicator
Am Freitag, 7. Juni 2013, 13:46:32 schrieb Linus Walleij:
Quoted 25 lines · Heiko St?bner
Quoted 13 lines
There exist platforms, namely at least all Rockchip Cortex-A9 based ones, that don't use the paradigm of reading-changing-writing the register contents, but instead only write the changes to the register with a mask that indicates the changed bits.
This patch adds flags and code to support the case where the lower 16 bit of hold the information and the upper 16 bit are used as mask to indicate the written changes.
As hardware-specific flags should not be added to the common clk flags, the flags are added to gate, mux and divider clocks individually.
Signed-off-by Heiko Stuebner <[email protected]>(...)
Review
Quoted 4 lines
+ if ((
clk_gate_flags&CLK_GATE_MASK_UPPER_HALF) &&bit_idx> 15)
{ +pr_err("%s: bit_idx %d invalid\n", __func__, bit_idx);(quoted diff) +2
-0+ return ERR_PTR(-EINVAL); + }Now this looks *EXTREMELY* familiar to a patch just sent by Haojian for HiSilicon.
Quoted 6 lines
"[PATCH v2 3/6] clk: divider: add
CLK_DIVIDER_HIWORD_MASKflag"
http://marc.info/?l=linux-arm-kernel&m=137035873916777&w=2What kind of coincidence is this? Are Rockchip and HiSilicon using the same silicon IP or are they of a common origin? (It is a small world after all.)
Now this is really interesting :-) and the handling really seems to follow the same pattern.
Quoted 4 lines
I think you two guys need to read each others patch sets closely here. I'd like Haojian to look at Heiko's patches and Heiko to look at Haojian's patches, just to make sure you're not actually writing two drivers for the same hardware in the end.
I'll take a look
Heiko
Re: [PATCH v2 1/8] clk: flag to use upper half of the register as change indicator
Quoted 42 lines · Heiko St?bner
Am Freitag, 7. Juni 2013, 13:46:32 schrieb Linus Walleij:
Quoted 25 lines · Heiko St?bner
Quoted 13 lines
There exist platforms, namely at least all Rockchip Cortex-A9 based ones, that don't use the paradigm of reading-changing-writing the register contents, but instead only write the changes to the register with a mask that indicates the changed bits.
This patch adds flags and code to support the case where the lower 16 bit of hold the information and the upper 16 bit are used as mask to indicate the written changes.
As hardware-specific flags should not be added to the common clk flags, the flags are added to gate, mux and divider clocks individually.
Signed-off-by Heiko Stuebner <[email protected]>(...)
Review
Quoted 4 lines
+ if ((
clk_gate_flags&CLK_GATE_MASK_UPPER_HALF) &&bit_idx> 15)
{ +pr_err("%s: bit_idx %d invalid\n", __func__, bit_idx);(quoted diff) +2
-0+ return ERR_PTR(-EINVAL); + }Now this looks *EXTREMELY* familiar to a patch just sent by Haojian for HiSilicon.
Quoted 6 lines
"[PATCH v2 3/6] clk: divider: add
CLK_DIVIDER_HIWORD_MASKflag"
http://marc.info/?l=linux-arm-kernel&m=137035873916777&w=2What kind of coincidence is this? Are Rockchip and HiSilicon using the same silicon IP or are they of a common origin? (It is a small world after all.)
Now this is really interesting :-) and the handling really seems to follow the same pattern.
Quoted 4 lines
I think you two guys need to read each others patch sets closely here. I'd like Haojian to look at Heiko's patches and Heiko to look at Haojian's patches, just to make sure you're not actually writing two drivers for the same hardware in the end.
Quoted 4 lines
I'll take a look
Heiko
Me too :)
Regards
Haojian
Heiko Stübner
maintainerPATCH v2 2/8 clk: divider: add flag to limit possible dividers to even numbers
In reply to Heiko StübnerSoCs like the Rockchip Cortex-A9 ones contain divider some clocks that use the regular mechanisms for storage but allow only even dividers and 1 to be used.
Therefore add a flag that lets _is_valid_div limit the valid dividers to these values. _get_maxdiv is also adapted to return even values for the CLK_DIVIDER_ONE_BASED case.
--- drivers/clk/clk-divider.c | 14 ++++++++++++-- include/linux/clk-provider.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/clk/clk-divider.c +12 -2
@@ -45,8 +45,16 @@ static unsigned int _get_table_maxdiv(const struct clk_div_table *table)static unsigned int _get_maxdiv (struct clk_divider *divider) { -if (divider->flags &CLK_DIVIDER_ONE_BASED ) -return div_mask (divider); +if (divider->flags &CLK_DIVIDER_ONE_BASED ) { +unsigned int div =div_mask (divider); + +/* decrease to even number */ +if (divider->flags &CLK_DIVIDER_EVEN ) + div--; + +return div; + } +if (divider->flags &CLK_DIVIDER_POWER_OF_TWO )return 1 <<div_mask (divider);if (divider->table)
@@ -141,6 +149,8 @@ static bool _is_valid_div(struct clk_divider *divider, unsigned int div)return is_power_of_2 (div);if (divider->table)return _is_valid_table_div (divider->table, div); +if (divider->flags &CLK_DIVIDER_EVEN && div !=1 && (div %2 ) !=0 ) +return false;return true; }
include/linux/clk-provider.h +2 -0
@@ -268,6 +268,7 @@ struct clk_div_table {* indicate the bits that get changed during a write. So for a clock with * shift 0 and width 2, setting the divider to 2 would result in a write * of (3 << 16) | (2 << 0). +* CLK_DIVIDER_EVEN - only allow even divider values */ struct clk_divider {struct clk_hw hw;
@@ -283,6 +284,7 @@ struct clk_divider {#define CLK_DIVIDER_POWER_OF_TWO BIT(1)#define CLK_DIVIDER_ALLOW_ZERO BIT(2)#define CLK_DIVIDER_MASK_UPPER_HALF BIT(3) +#define CLK_DIVIDER_EVEN BIT(4)extern const struct clk_ops clk_divider_ops; struct clk *clk_register_divider(struct device *dev, const char *name,
Signature · 1 line
1.7.2.3
Heiko Stübner
maintainerPATCH v2 3/8 mmc: dw_mmc-pltfm: remove static from dw_mci_pltfm_remove
In reply to Heiko Stübnerdw_mci_pltfm_remove gets exported and used by dw_mmc-exynos, so should not be static.
--- drivers/mmc/host/dw_mmc-pltfm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/host/dw_mmc-pltfm.c +1 -1
@@ -68,7 +68,7 @@ static int dw_mci_pltfm_probe(struct platform_device *pdev)return dw_mci_pltfm_register (pdev,NULL ); } -static int dw_mci_pltfm_remove (struct platform_device *pdev) +int dw_mci_pltfm_remove (struct platform_device *pdev) {struct dw_mci *host =platform_get_drvdata (pdev);
Signature · 1 line
1.7.2.3
Heiko Stübner
maintainerPATCH v2 4/8 mmc: dw_mmc-pltfm: add Rockchip variant
In reply to Heiko StübnerCortex-A9 SoCs from Rockchip use a slightly modified variant of dw_mmc controllers that seems to require the SDMMC_CMD_USE_HOLD_REG bit to always be set.
There also seem to be no other modifications (additional register etc) present, so to keep the footprint low, add this small variant to the pltfm driver.
--- drivers/mmc/host/dw_mmc-pltfm.c | 48 +++++++++++++++++++++++++++----------- 1 files changed, 34 insertions(+), 14 deletions(-)
drivers/mmc/host/dw_mmc-pltfm.c +34 -14
@@ -24,6 +24,16 @@#include "dw_mmc.h" + +static void dw_mci_rockchip_prepare_command (struct dw_mci *host,u32 *cmdr) +{ + *cmdr |=SDMMC_CMD_USE_HOLD_REG ; +} + +static const struct dw_mci_drv_data rockchip_drv_data = { + .prepare_command = dw_mci_rockchip_prepare_command, +}; +int dw_mci_pltfm_register (struct platform_device *pdev,const struct dw_mci_drv_data *drv_data) {
@@ -63,20 +73,6 @@ int dw_mci_pltfm_register(struct platform_device *pdev, }EXPORT_SYMBOL_GPL (dw_mci_pltfm_register); -static int dw_mci_pltfm_probe (struct platform_device *pdev) -{ -return dw_mci_pltfm_register (pdev,NULL ); -} - -int dw_mci_pltfm_remove (struct platform_device *pdev) -{ -struct dw_mci *host =platform_get_drvdata (pdev); - -dw_mci_remove (host); -return 0 ; -} -EXPORT_SYMBOL_GPL (dw_mci_pltfm_remove); -#ifdef CONFIG_PM_SLEEP /* * TODO: we should probably disable the clock to the card in the suspend path.
@@ -114,10 +110,34 @@ EXPORT_SYMBOL_GPL(dw_mci_pltfm_pmops);static const struct of_device_id dw_mci_pltfm_match[] = { { .compatible ="snps,dw-mshc" , }, + { .compatible ="rockchip,cortex-a9-dw-mshc" , + .data = &rockchip_drv_data }, {}, };MODULE_DEVICE_TABLE (of, dw_mci_pltfm_match); +static int dw_mci_pltfm_probe (struct platform_device *pdev) +{ +const struct dw_mci_drv_data *drv_data =NULL ; +const struct of_device_id *match; + +if (pdev->dev.of_node) { + match =of_match_node (dw_mci_pltfm_match, pdev->dev.of_node); + drv_data = match->data; + } + +return dw_mci_pltfm_register (pdev, drv_data); +} + +int dw_mci_pltfm_remove (struct platform_device *pdev) +{ +struct dw_mci *host =platform_get_drvdata (pdev); + +dw_mci_remove (host); +return 0 ; +} +EXPORT_SYMBOL_GPL (dw_mci_pltfm_remove); +static struct platform_driver dw_mci_pltfm_driver = { .probe = dw_mci_pltfm_probe, .remove = dw_mci_pltfm_remove,
Signature · 1 line
1.7.2.3
Re: [PATCH v2 4/8] mmc: dw_mmc-pltfm: add Rockchip variant
Quoted 7 lines · Heiko St?bner
Cortex-A9 SoCs from Rockchip use a slightly modified variant of
dw_mmccontrollers that seems to require theSDMMC_CMD_USE_HOLD_REGbit to always be set.There also seem to be no other modifications (additional register etc) present, so to keep the footprint low, add this small variant to the pltfm driver.
My comments against v1 of this patch are still valid.
--
With Best Regards,
Andy Shevchenko
Heiko Stübner
maintainerPATCH v2 5/8 pinctrl: add pinctrl driver for Rockchip SoCs
In reply to Heiko StübnerThis driver adds support the Cortex-A9 based SoCs from Rockchip, so at least the RK2928, RK3066 (a and b) and RK3188. Earlier Rockchip SoCs seem to use similar mechanics for gpio handling so should be supportable with relative small changes. Pull handling on the rk3188 is currently a stub, due to it being a bit different to the earlier SoCs.
Pinmuxing as well as gpio (and interrupt-) handling tested on a rk3066a based machine.
--- .../bindings/pinctrl/rockchip,pinctrl.txt | 97 ++ drivers/pinctrl/Kconfig | 6 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-rockchip.c | 1364 ++++++++++++++++++++ include/dt-bindings/pinctrl/rockchip.h | 37 + 5 files changed, 1505 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt create mode 100644 drivers/pinctrl/pinctrl-rockchip.c create mode 100644 include/dt-bindings/pinctrl/rockchip.h
Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt new file +97 -0
@@ -0,0 +1,97 @@ +* Rockchip Pinmux Controller + +The Rockchip Pinmux Controller, enables the IC +to share one PAD to several functional blocks. The sharing is done by +multiplexing the PAD input/output signals. For each PAD there are up to +4 muxing options with option 0 being the use as a GPIO. + +Please refer to pinctrl-bindings.txt in this directory for details of the +common pinctrl bindings used by client devices, including the meaning of the +phrase "pin configuration node". + +The Rockchip pin configuration node is a node of a group of pins which can be +used for a specific device or function. This node represents both mux and +config of the pins in that group. The 'pins' selects the function mode(also +named pin mode) this pin can work on and the 'config' configures various pad +settings such as pull-up, etc. + +The pins are grouped into up to 5 individual pin banks which need to be +defined as gpio sub-nodes of the pinmux controller. + +Required properties for iomux controller: + - compatible: one of "rockchip,rk2928-pinctrl", "rockchip,rk3066a-pinctrl" + "rockchip,rk3066b-pinctrl", "rockchip,rk3188-pinctrl" + +Required properties for gpio sub nodes: + - compatible: "rockchip,gpio-bank" + - reg: register of the gpio bank (different than the iomux registerset) + - interrupts: base interrupt of the gpio bank in the interrupt controller + - clocks: clock that drives this bank + - gpio-controller: identifies the node as a gpio controller and pin bank. + - #gpio-cells: number of cells in GPIO specifier. Since the generic GPIO + binding is used, the amount of cells must be specified as 2. See generic + GPIO binding documentation for description of particular cells. + - interrupt-controller: identifies the controller node as interrupt-parent. + - #interrupt-cells: the value of this property should be 2 and the interrupt + cells should use the standard two-cell scheme described in + bindings/interrupt-controller/interrupts.txt + +Required properties for pin configuration node: + - rockchip,pins: 4 integers array, represents a group of pins mux and config + setting. The format is rockchip,pins = <PIN_BANK PIN_BANK_NUM MUX CONFIG>. + The MUX 0 means gpio and MUX 1 to 3 mean the specific device function + +Bits used for CONFIG: +PULL_AUTO (1 << 0): indicate this pin needs a pull setting for SoCs + that determine the pull up or down themselfs +PULL_UP (1 << 1): indicate this pin needs a pull up +PULL_DOWN (1 << 2): indicate this pin needs a pull down + +Examples: + +#include <dt-bindings/pinctrl/rockchip.h> + +... + +pinctrl at 20008000 { + compatible = "rockchip,rk3066a-pinctrl"; + reg = <0x20008000 0x150>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + gpio0: gpio0 at 20034000 { + compatible = "rockchip,gpio-bank"; + reg = <0x20034000 0x100>; + interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk_gates8 9>; + + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + ... + + uart2 { + uart2_xfer: uart2-xfer { + rockchip,pins = <RK_GPIO1 8 1 RK_PINCTRL_PULL_AUTO>, + <RK_GPIO1 9 1 RK_PINCTRL_PULL_AUTO>; + }; + }; +}; + +uart2: serial at 20064000 { + compatible = "snps,dw-apb-uart"; + reg = <0x20064000 0x400>; + interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; + reg-shift = <2>; + reg-io-width = <1>; + clocks = <&mux_uart2>; + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&uart2_xfer>; +};
drivers/pinctrl/Kconfig +6 -0
@@ -158,6 +158,12 @@ config PINCTRL_DB8540 bool "DB8540 pin controller driver" depends on PINCTRL_NOMADIK && ARCH_U8500 +config PINCTRL_ROCKCHIP + bool + select PINMUX + select GENERIC_PINCONF + select GENERIC_IRQ_CHIP + config PINCTRL_SINGLE tristate "One-register-per-pin type device tree based pinctrl driver" depends on OF
drivers/pinctrl/Makefile +1 -0
@@ -31,6 +31,7 @@ obj-$(CONFIG_PINCTRL_NOMADIK) += pinctrl-nomadik.o obj-$(CONFIG_PINCTRL_STN8815) += pinctrl-nomadik-stn8815.o obj-$(CONFIG_PINCTRL_DB8500) += pinctrl-nomadik-db8500.o obj-$(CONFIG_PINCTRL_DB8540) += pinctrl-nomadik-db8540.o +obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o obj-$(CONFIG_PINCTRL_SIRF) += sirf/ obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sunxi.o
drivers/pinctrl/pinctrl-rockchip.c new file +1364 -0
1,364 lines not on this page · raw message
include/dt-bindings/pinctrl/rockchip.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Header providing constants for Rockchip pinctrl bindings. +* +* Copyright (c) 2013 MundoReader S.L. +* Author: Heiko Stuebner <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __DT_BINDINGS_ROCKCHIP_PINCTRL_H__ +#define __DT_BINDINGS_ROCKCHIP_PINCTRL_H__ + +#define RK_GPIO0 0 +#define RK_GPIO1 1 +#define RK_GPIO2 2 +#define RK_GPIO3 3 +#define RK_GPIO4 4 +#define RK_GPIO6 6 + +#define RK_FUNC_GPIO 0 +#define RK_FUNC_1 1 +#define RK_FUNC_2 2 + +#define RK_PINCTRL_NONE 0 +#define RK_PINCTRL_PULL_PIN_DEFAULT (1 << 0) +#define RK_PINCTRL_PULL_UP (1 << 1) +#define RK_PINCTRL_PULL_DOWN (1 << 2) + +#endif
Signature · 1 line
1.7.2.3
Re: [PATCH v2 5/8] pinctrl: add pinctrl driver for Rockchip SoCs
Quoted 11 lines · Heiko St?bner
This driver adds support the Cortex-A9 based SoCs from Rockchip, so at least the RK2928, RK3066 (a and b) and RK3188. Earlier Rockchip SoCs seem to use similar mechanics for gpio handling so should be supportable with relative small changes. Pull handling on the rk3188 is currently a stub, due to it being a bit different to the earlier SoCs.
Pinmuxing as well as gpio (and interrupt-) handling tested on a rk3066a based machine.
Signed-off-by Heiko Stuebner <[email protected]>
This basically looks fine.
(...)
Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt line 48
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt new file +10
-0+Required properties for pin configuration node: + - rockchip,pins: 4 integers array, represents a group of pins mux and config + setting. The format is rockchip,pins = <PIN_BANK PIN_BANK_NUM MUX CONFIG>. + The MUX 0 means gpio and MUX 1 to 3 mean the specific device function + +Bits used for CONFIG: +PULL_AUTO (1 << 0): indicate this pin needs a pull setting for SoCs + that determine the pull up or down themselfs +PULL_UP (1 << 1): indicate this pin needs a pull up +PULL_DOWN (1 << 2): indicate this pin needs a pull down
So I would rather have these (as a separate patch) in <dt-bindings/pinctrl/pinconfig.h>
The documentation in Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt and the same bindings to be used for as many systems as possible utilizing generic pin config.
I will be liberal in accepting patches creating this infrastructure.
We need to realize that we will be setting example for everyone else, and everyone else will be following that example.
Quoted 20 lines
drivers/pinctrl/pinctrl-rockchip.c new file +20
-0+for (i =0 , j =0 ; i < size; i +=4 , j++) { +unsigned long pinconf; + + num =be32_to_cpu (*list++); + bank =bank_num_to_bank (info, num); +if (IS_ERR (bank)) +return PTR_ERR (bank); + + pin =be32_to_cpu (*list++); + grp->pins[j] = bank->pin_base + pin; + grp->func[j] =be32_to_cpu (*list++); + + pinconf =be32_to_cpu (*list++); +switch (pinconf) { +case RK_PINCTRL_NONE : + bias =PIN_CONFIG_BIAS_DISABLE ; +break ; +case RK_PINCTRL_PULL_PIN_DEFAULT : + bias =PIN_CONFIG_BIAS_PULL_PIN_DEFAULT ; +break ;
drivers/pinctrl/pinctrl-rockchip.c line 702
Quoted 10 lines
drivers/pinctrl/pinctrl-rockchip.c new file +10
-0+case RK_PINCTRL_PULL_UP : + bias =PIN_CONFIG_BIAS_PULL_UP ; +break ; +case RK_PINCTRL_PULL_DOWN : + bias =PIN_CONFIG_BIAS_PULL_DOWN ; +break ; + } + + grp->configs[j] =pinconf_to_config_packed (bias,0 ); + }
I would like this to be added todrivers/pinctrl/pinconf-generic.c
as a utility function, with the header indrivers/pinctrl/pinconf.h
Also in a separate patch.
Quoted 1 line
+++
b/include/dt-bindings/pinctrl/rockchip.h
(...)
include/dt-bindings/pinctrl/rockchip.h line 35
Quoted 4 lines
include/dt-bindings/pinctrl/rockchip.h new file +4
-0+#define RK_PINCTRL_NONE 0 +#define RK_PINCTRL_PULL_PIN_DEFAULT (1 << 0) +#define RK_PINCTRL_PULL_UP (1 << 1) +#define RK_PINCTRL_PULL_DOWN (1 << 2)
So I'd like these moved to /include/dt-bindings/pinctrl/pinconfig.h and used as a separete include. Drop the RK_* prefix as it will be universal and use a PINCONFIG_* prefix instead of PINCTRL_*.
I think that is the route we need to take.
Bonus if you implement more config options from pinconf-generic.h but otherwise me and others will have to do it.
Yours,
Linus Walleij
Heiko Stübner
maintainerRe: [PATCH v2 5/8] pinctrl: add pinctrl driver for Rockchip SoCs
Am Freitag, 7. Juni 2013, 14:53:51 schrieb Linus Walleij:
Quoted 53 lines · Heiko St?bner
Quoted 20 lines
(quoted diff) +20
-0+ for (i = 0, j = 0; i < size; i += 4, j++) { + unsigned long pinconf; + + num = be32_to_cpu(*list++); + bank = bank_num_to_bank(info, num); + if (IS_ERR(bank)) + return PTR_ERR(bank); + + pin = be32_to_cpu(*list++); + grp->pins[j] = bank->pin_base + pin; + grp->func[j] = be32_to_cpu(*list++); + + pinconf = be32_to_cpu(*list++); + switch(pinconf) { + case RK_PINCTRL_NONE: + bias = PIN_CONFIG_BIAS_DISABLE; + break; + case RK_PINCTRL_PULL_PIN_DEFAULT: + bias = PIN_CONFIG_BIAS_PULL_PIN_DEFAULT; + break;Review
Quoted 10 lines
(quoted diff) +10
-0+ case RK_PINCTRL_PULL_UP: + bias = PIN_CONFIG_BIAS_PULL_UP; + break; + case RK_PINCTRL_PULL_DOWN: + bias = PIN_CONFIG_BIAS_PULL_DOWN; + break; + } + + grp->configs[j] = pinconf_to_config_packed(bias, 0); + }I would like this to be added to
drivers/pinctrl/pinconf-generic.c
as a utility function, with the header indrivers/pinctrl/pinconf.hAlso in a separate patch.
Quoted 1 line
+++
b/include/dt-bindings/pinctrl/rockchip.h(...)
Review
Quoted 4 lines
(quoted diff) +4
-0+#define RK_PINCTRL_NONE 0 +#define RK_PINCTRL_PULL_PIN_DEFAULT (1 << 0) +#define RK_PINCTRL_PULL_UP (1 << 1) +#define RK_PINCTRL_PULL_DOWN (1 << 2)So I'd like these moved to /include/dt-bindings/pinctrl/pinconfig.h and used as a separete include. Drop the RK_* prefix as it will be universal and use a PINCONFIG_* prefix instead of PINCTRL_*.
Quoted 5 lines
I think that is the route we need to take.
Bonus if you implement more config options from
pinconf-generic.hbut otherwise me and others will have to do it.
Gah, damn me for always wanting to get bonus points ;-),
I did play around a bit with the idea you described above and came up with the stuff a bit below. This is in no way meant to be finished, I also only was able to compile test it yet, but it looks like it might work when I test it tomorrow.
So if possible I would just like to get a "looks halfway sane, continue" or "completely wrong track" please :-) :
constants in dt-bindings/pinctrl/pinconfig.h:
-----------------------------
#define PINCONFIG_NONE 0
#define PINCONFIG_BIAS_DISABLE (1 << 0)
#define PINCONFIG_BIAS_HIGH_IMPEDANCE (1 << 1)
#define PINCONFIG_BIAS_BUS_HOLD (1 << 2)
#define PINCONFIG_BIAS_PULL_PIN_DEFAULT (1 << 3)
#define PINCONFIG_BIAS_PULL_UP (1 << 4)
#define PINCONFIG_BIAS_PULL_DOWN (1 << 5)
#define PINCONFIG_DRIVE_PUSH_PULL (1 << 6)
#define PINCONFIG_DRIVE_OPEN_DRAIN (1 << 7)
#define PINCONFIG_DRIVE_OPEN_SOURCE (1 << 8)
#define PINCONFIG_INPUT_SCHMITT_ENABLE (1 << 9)
#define PINCONFIG_INPUT_SCHMITT_DISABLE (1 << 10)
#define PINCONFIG_LOW_POWER_MODE (1 << 11)
#define PINCONFIG_OUTPUT_LOW (1 << 12)
#define PINCONFIG_OUTPUT_HIGH (1 << 13)
and code including how the rockchip driver could look like:
---------
drivers/pinctrl/pinconf-generic.c +58 -0
@@ -139,3 +139,61 @@ void pinconf_generic_dump_config(struct pinctrl_dev *pctldev, }EXPORT_SYMBOL_GPL (pinconf_generic_dump_config);#endif + +/* +* Maps the devicetree config bits to actual pinconf values. +* The array indizes match the bits set in dt-bindings/pinctrl/pinconf.h +* and the array should contain an entry for each bit defined there +*/ +static unsigned long conf_map[] = { +PIN_CONF_PACKED (PIN_CONFIG_BIAS_DISABLE ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_BIAS_HIGH_IMPEDANCE ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_BIAS_BUS_HOLD ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_BIAS_PULL_PIN_DEFAULT ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_BIAS_PULL_UP ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_BIAS_PULL_DOWN ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_DRIVE_PUSH_PULL ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_DRIVE_OPEN_DRAIN ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_DRIVE_OPEN_SOURCE ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_INPUT_SCHMITT_ENABLE ,1 ), +PIN_CONF_PACKED (PIN_CONFIG_INPUT_SCHMITT_ENABLE ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_LOW_POWER_MODE ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_OUTPUT ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_OUTPUT ,1 ), +}; + +/* +* Parse a pinconf bitmap from a devicetree entry into individual pin configs. +* @pinconf: the bitmap containing config bits +* @configs: after the function returns contains a pointer to an array of +* pin configs +* @nconfigs: number of entries of configs +*/ +int pinconf_generic_parse_dt_bitmap (unsigned long pinconf, +unsigned long *configs, +unsigned int *nconfigs) +{ +int bit; +int i; + + *nconfigs =hweight_long (pinconf); + configs =kzalloc (*nconfigs *sizeof (unsigned long ),GFP_KERNEL ); + + i =0 ; +while (pinconf && i < *nconfigs) { + bit =__ffs (pinconf); + pinconf &= ~BIT (i); + +if (bit >ARRAY_SIZE (conf_map)) { +pr_err ("%s: unknown bit %d\n" , __func__, bit); +kfree (configs); +return -EINVAL ; + } + + configs[i] = conf_map[bit]; + + i++; + } + +return 0 ; +}
drivers/pinctrl/pinconf.h +6 -0
@@ -123,3 +123,9 @@ static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev, return; }#endif + +#ifdef CONFIG_GENERIC_PINCONF +int pinconf_generic_parse_dt_bitmap (unsigned long pinconf, +unsigned long *configs, +unsigned int *nconfigs); +#endif
drivers/pinctrl/pinctrl-rockchip.c +12 -16
@@ -40,6 +40,7 @@#include <dt-bindings/pinctrl/rockchip.h> #include "core.h" +#include "pinconf.h" /* GPIO control registers */ #define GPIO_SWPORT_DR 0x00
@@ -639,7 +640,8 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np,int num;int i, j;int pin; -int bias; +int ret; +int nconfigs;dev_dbg (info->dev,"group(%d): %s\n" , index, np->name);
@@ -683,22 +685,16 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, grp->func[j] =be32_to_cpu (*list++); pinconf =be32_to_cpu (*list++); -switch (pinconf) { -case RK_PINCTRL_NONE : - bias =PIN_CONFIG_BIAS_DISABLE ; -break ; -case RK_PINCTRL_PULL_PIN_DEFAULT : - bias =PIN_CONFIG_BIAS_PULL_PIN_DEFAULT ; -break ; -case RK_PINCTRL_PULL_UP : - bias =PIN_CONFIG_BIAS_PULL_UP ; -break ; -case RK_PINCTRL_PULL_DOWN : - bias =PIN_CONFIG_BIAS_PULL_DOWN ; -break ; - } - grp->configs[j] =pinconf_to_config_packed (bias,0 ); + ret =pinconf_generic_parse_dt_bitmap (pinconf, + &grp->configs[j], &nconfigs); +if (ret) +return ret; + +if (nconfigs !=1 ) { +pr_err ("unexpected number of config entries\n" ); +return -EINVAL ; + } }return 0 ;
Heiko Stübner
maintainerRe: [PATCH v2 5/8] pinctrl: add pinctrl driver for Rockchip SoCs
Am Samstag, 8. Juni 2013, 01:13:48 schrieb Heiko Stübner:
Quoted 206 lines
Am Freitag, 7. Juni 2013, 14:53:51 schrieb Linus Walleij:
Quoted 53 lines · Heiko Stübner
Quoted 20 lines
(quoted diff) +20
-0+ for (i = 0, j = 0; i < size; i += 4, j++) { + unsigned long pinconf; + + num = be32_to_cpu(*list++); + bank = bank_num_to_bank(info, num); + if (IS_ERR(bank)) + return PTR_ERR(bank); + + pin = be32_to_cpu(*list++); + grp->pins[j] = bank->pin_base + pin; + grp->func[j] = be32_to_cpu(*list++); + + pinconf = be32_to_cpu(*list++); + switch(pinconf) { + case RK_PINCTRL_NONE: + bias = PIN_CONFIG_BIAS_DISABLE; + break; + case RK_PINCTRL_PULL_PIN_DEFAULT: + bias = PIN_CONFIG_BIAS_PULL_PIN_DEFAULT; + break;Review
Quoted 10 lines
(quoted diff) +10
-0+ case RK_PINCTRL_PULL_UP: + bias = PIN_CONFIG_BIAS_PULL_UP; + break; + case RK_PINCTRL_PULL_DOWN: + bias = PIN_CONFIG_BIAS_PULL_DOWN; + break; + } + + grp->configs[j] = pinconf_to_config_packed(bias, 0); + }I would like this to be added to
drivers/pinctrl/pinconf-generic.c
as a utility function, with the header indrivers/pinctrl/pinconf.hAlso in a separate patch.
Quoted 1 line
+++
b/include/dt-bindings/pinctrl/rockchip.h(...)
Review
Quoted 4 lines
(quoted diff) +4
-0+#define RK_PINCTRL_NONE 0 +#define RK_PINCTRL_PULL_PIN_DEFAULT (1 << 0) +#define RK_PINCTRL_PULL_UP (1 << 1) +#define RK_PINCTRL_PULL_DOWN (1 << 2)So I'd like these moved to /include/dt-bindings/pinctrl/pinconfig.h and used as a separete include. Drop the RK_* prefix as it will be universal and use a PINCONFIG_* prefix instead of PINCTRL_*.
Quoted 5 lines
I think that is the route we need to take.
Bonus if you implement more config options from
pinconf-generic.hbut otherwise me and others will have to do it.Gah, damn me for always wanting to get bonus points ;-),
I did play around a bit with the idea you described above and came up with the stuff a bit below. This is in no way meant to be finished, I also only was able to compile test it yet, but it looks like it might work when I test it tomorrow.
So if possible I would just like to get a "looks halfway sane, continue" or "completely wrong track" please :-) :
constants in
dt-bindings/pinctrl/pinconfig.h:
-----------------------------
#definePINCONFIG_NONE0
#definePINCONFIG_BIAS_DISABLE(1 << 0)
#definePINCONFIG_BIAS_HIGH_IMPEDANCE(1 << 1)
#definePINCONFIG_BIAS_BUS_HOLD(1 << 2)
#definePINCONFIG_BIAS_PULL_PIN_DEFAULT(1 << 3)
#definePINCONFIG_BIAS_PULL_UP(1 << 4)
#definePINCONFIG_BIAS_PULL_DOWN(1 << 5)
#definePINCONFIG_DRIVE_PUSH_PULL(1 << 6)
#definePINCONFIG_DRIVE_OPEN_DRAIN(1 << 7)
#definePINCONFIG_DRIVE_OPEN_SOURCE(1 << 8)
#definePINCONFIG_INPUT_SCHMITT_ENABLE(1 << 9)
#definePINCONFIG_INPUT_SCHMITT_DISABLE(1 << 10)
#definePINCONFIG_LOW_POWER_MODE(1 << 11)
#definePINCONFIG_OUTPUT_LOW(1 << 12)
#definePINCONFIG_OUTPUT_HIGH(1 << 13)and code including how the rockchip driver could look like:
---------(quoted diff) +0
-0
b/drivers/pinctrl/pinconf-generic.cindex 9a6812b..35c40be 100644drivers/pinctrl/pinconf-generic.c +25
-0@@ -139,3 +139,61 @@ void pinconf_generic_dump_config(struct pinctrl_dev *pctldev, }EXPORT_SYMBOL_GPL (pinconf_generic_dump_config);#endif + +/* +* Maps the devicetree config bits to actual pinconf values. +* The array indizes match the bits set in dt-bindings/pinctrl/pinconf.h +* and the array should contain an entry for each bit defined there +*/ +static unsigned long conf_map[] = { +PIN_CONF_PACKED (PIN_CONFIG_BIAS_DISABLE ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_BIAS_HIGH_IMPEDANCE ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_BIAS_BUS_HOLD ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_BIAS_PULL_PIN_DEFAULT ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_BIAS_PULL_UP ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_BIAS_PULL_DOWN ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_DRIVE_PUSH_PULL ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_DRIVE_OPEN_DRAIN ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_DRIVE_OPEN_SOURCE ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_INPUT_SCHMITT_ENABLE ,1 ), +PIN_CONF_PACKED (PIN_CONFIG_INPUT_SCHMITT_ENABLE ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_LOW_POWER_MODE ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_OUTPUT ,0 ), +PIN_CONF_PACKED (PIN_CONFIG_OUTPUT ,1 ), +}; + +/* +* Parse a pinconf bitmap from a devicetree entry into individual pin configs. + * @pinconf: the bitmap containing config bits
+ * @configs: after the function returns contains a pointer to an array of
+ * pin configs
+ * @nconfigs: number of entries of configs
+ */drivers/pinctrl/pinconf-generic.c +28
-0+int pinconf_generic_parse_dt_bitmap (unsigned long pinconf, +unsigned long *configs, +unsigned int *nconfigs) +{ +int bit; +int i; + + *nconfigs =hweight_long (pinconf); + configs =kzalloc (*nconfigs *sizeof (unsigned long ),GFP_KERNEL ); + + i =0 ; +while (pinconf && i < *nconfigs) { + bit =__ffs (pinconf); + pinconf &= ~BIT (i); + +if (bit >ARRAY_SIZE (conf_map)) { +pr_err ("%s: unknown bit %d\n" , __func__, bit); +kfree (configs); +return -EINVAL ; + } + + configs[i] = conf_map[bit]; + + i++; + } + +return 0 ; +}drivers/pinctrl/pinconf.h +6
-0@@ -123,3 +123,9 @@ static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev, return; }#endif + +#ifdef CONFIG_GENERIC_PINCONF +int pinconf_generic_parse_dt_bitmap (unsigned long pinconf, +unsigned long *configs, +unsigned int *nconfigs); +#endif (quoted diff) +0
-0
b/drivers/pinctrl/pinctrl-rockchip.cindex b77e241..88398df 100644drivers/pinctrl/pinctrl-rockchip.c +3
-9@@ -40,6 +40,7 @@#include <dt-bindings/pinctrl/rockchip.h> #include "core.h" +#include "pinconf.h" /* GPIO control registers */ #define GPIO_SWPORT_DR 0x00@@ -639,7 +640,8 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, int num;int i, j;int pin; -int bias; +int ret; +int nconfigs;dev_dbg (info->dev,"group(%d): %s\n" , index, np->name);@@ -683,22 +685,16 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, grp->func[j] =be32_to_cpu (*list++); pinconf =be32_to_cpu (*list++); -switch (pinconf) { -case RK_PINCTRL_NONE : - bias =PIN_CONFIG_BIAS_DISABLE ; -break ; -case RK_PINCTRL_PULL_PIN_DEFAULT : - bias =PIN_CONFIG_BIAS_PULL_PIN_DEFAULT ; -break ; -case RK_PINCTRL_PULL_UP :
drivers/pinctrl/pinctrl-rockchip.c static int rockchip_pinctrl_parse_groups(struct · line 690
Quoted 10 lines
drivers/pinctrl/pinctrl-rockchip.c +2
-7- bias =PIN_CONFIG_BIAS_PULL_UP ; -break ; -case RK_PINCTRL_PULL_DOWN : - bias =PIN_CONFIG_BIAS_PULL_DOWN ; -break ; - } - grp->configs[j] =pinconf_to_config_packed (bias,0 ); + ret =pinconf_generic_parse_dt_bitmap (pinconf, + &grp->configs[j], &nconfigs);
of course this part is obviously wrong, which I just realized, because the configs array only contains usigned longs
it must be more like pinconf_generic_parse_dt_bitmap(pinconf, configs, &nconfigs)
...
grp->configs[j] = configs[0];
or better yet simply carrying the created configs without copying entries or limiting the number of configs
Quoted 10 lines
drivers/pinctrl/pinctrl-rockchip.c +7
-0+if (ret) +return ret; + +if (nconfigs !=1 ) { +pr_err ("unexpected number of config entries\n" ); +return -EINVAL ; + } }return 0 ;
Heiko Stübner
maintainerPATCH v2 6/8 clk: add basic Rockchip rk3066a clock support
In reply to Heiko StübnerThis adds basic support for clocks on Rockchip rk3066 SoCs. The clock handling thru small dt nodes is heavily inspired by the sunxi clk code.
The plls are currently read-only, as their setting needs more investigation. This also results in slow cpu speeds, as the apll starts at a default of 600mhz.
--- arch/arm/boot/dts/rk3066a-clocks.dtsi | 460 +++++++++++++++++++++++++++++++ drivers/clk/Makefile | 1 + drivers/clk/rockchip/Makefile | 6 + drivers/clk/rockchip/clk-rockchip-pll.c | 131 +++++++++ drivers/clk/rockchip/clk-rockchip-pll.h | 19 ++ drivers/clk/rockchip/clk-rockchip.c | 313 +++++++++++++++++++++ 6 files changed, 930 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/dts/rk3066a-clocks.dtsi create mode 100644 drivers/clk/rockchip/Makefile create mode 100644 drivers/clk/rockchip/clk-rockchip-pll.c create mode 100644 drivers/clk/rockchip/clk-rockchip-pll.h create mode 100644 drivers/clk/rockchip/clk-rockchip.c
arch/arm/boot/dts/rk3066a-clocks.dtsi new file +460 -0
@@ -0,0 +1,460 @@ +/* + * Copyright (c) 2013 MundoReader S.L. + * Author: Heiko Stuebner <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/ { + clocks { + compatible = "rockchip,clocks"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* + * This is a dummy clock, to be used as placeholder on + * other mux clocks when a specific parent clock is not + * yet implemented. It should be dropped when the driver + * is complete. + */ + dummy: dummy { + compatible = "fixed-clock"; + clock-frequency = <0>; + #clock-cells = <0>; + }; + + xin24m: xin24m { + compatible = "fixed-clock"; + clock-frequency = <24000000>; + #clock-cells = <0>; + }; + + apll: apll at 20000000 { + compatible = "rockchip,rk3066a-apll"; + reg = <0x20000000 0x10>, + <0x20000040 0x04>; + clocks = <&xin24m>; + #clock-cells = <0>; + }; + + dpll: dpll at 20000000 { + compatible = "rockchip,rk3066a-dpll"; + reg = <0x20000010 0x10>, + <0x20000040 0x04>; + clocks = <&xin24m>; + #clock-cells = <0>; + }; + + cpll: cpll at 20000000 { + compatible = "rockchip,rk3066a-cpll"; + reg = <0x20000020 0x10>, + <0x20000040 0x04>; + clocks = <&xin24m>; + #clock-cells = <0>; + }; + + gpll: gpll at 20000000 { + compatible = "rockchip,rk3066a-gpll"; + reg = <0x20000030 0x10>, + <0x20000040 0x04>; + clocks = <&xin24m>; + #clock-cells = <0>; + }; + + mux_aclk_periph: mux-aclk-periph at 2000006c { + compatible = "rockchip,rk2928-gpll-cpll-bit15-mux"; + reg = <0x2000006c 0x04>; + clocks = <&gpll>, <&cpll>; + #clock-cells = <0>; + }; + + mux_uart_pll: mux-uart_pll at 20000074 { + compatible = "rockchip,rk2928-gpll-cpll-bit15-mux"; + reg = <0x20000074 0x04>; + clocks = <&gpll>, <&cpll>; + #clock-cells = <0>; + }; + + div_uart0: div-uart0 at 20000078 { + compatible = "rockchip,rk2928-uart-divider"; + reg = <0x20000078 0x04>; + clocks = <&mux_uart_pll>; + #clock-cells = <0>; + }; + + mux_uart0: mux-uart0 at 20000078 { + compatible = "rockchip,rk2928-uart-mux"; + reg = <0x20000078 0x04>; + clocks = <&clk_gates1 8>, <&dummy>, <&xin24m>; /* dummy is uart0_frac_div */ + #clock-cells = <0>; + }; + + div_uart1: div-uart1 at 2000007c { + compatible = "rockchip,rk2928-uart-divider"; + reg = <0x2000007c 0x04>; + clocks = <&mux_uart_pll>; + #clock-cells = <0>; + }; + + mux_uart1: mux-uart1 at 2000007c { + compatible = "rockchip,rk2928-uart-mux"; + reg = <0x2000007c 0x04>; + clocks = <&clk_gates1 10>, <&dummy>, <&xin24m>; + #clock-cells = <0>; + }; + + div_uart2: div-uart2 at 20000080 { + compatible = "rockchip,rk2928-uart-divider"; + reg = <0x20000080 0x04>; + clocks = <&mux_uart_pll>; + #clock-cells = <0>; + }; + + mux_uart2: mux-uart2 at 20000080 { + compatible = "rockchip,rk2928-uart-mux"; + reg = <0x20000080 0x04>; + clocks = <&clk_gates1 12>, <&dummy>, <&xin24m>; + #clock-cells = <0>; + }; + + div_uart3: div-uart3 at 20000084 { + compatible = "rockchip,rk2928-uart-divider"; + reg = <0x20000084 0x04>; + clocks = <&mux_uart_pll>; + #clock-cells = <0>; + }; + + mux_uart3: mux-uart3 at 20000084 { + compatible = "rockchip,rk2928-uart-mux"; + reg = <0x20000084 0x04>; + clocks = <&clk_gates1 14>, <&dummy>, <&xin24m>; + #clock-cells = <0>; + }; + + mux_cpu: mux-cpu at 20000044 { + compatible = "rockchip,rk3066-cpu-mux"; + reg = <0x20000044 0x4>; + clocks = <&apll>, <&dummy> /* cpu_gpll_path */; + #clock-cells = <0>; + }; + + div_cpu: div-cpu at 20000044 { + compatible = "rockchip,rk3066a-cpu-divider"; + reg = <0x20000044 0x4>; + clocks = <&mux_cpu>; + #clock-cells = <0>; + }; + + div_aclk_cpu: div-aclk-cpu at 20000048 { + compatible = "rockchip,rk3066a-aclk-cpu-divider"; + reg = <0x20000048 0x4>; + clocks = <&div_cpu>; + #clock-cells = <0>; + }; + + div_aclk_periph: div-aclk-periph at 2000006c { + compatible = "rockchip,rk2928-aclk-periph-divider"; + reg = <0x2000006c 0x4>; + clocks = <&mux_aclk_periph>; + #clock-cells = <0>; + }; + + div_hclk_periph: div-hclk-periph at 2000006c { + compatible = "rockchip,rk2928-hclk-divider"; + reg = <0x2000006c 0x4>; + clocks = <&clk_gates2 1>; + #clock-cells = <0>; + }; + + div_pclk_periph: div-pclk-periph at 2000006c { + compatible = "rockchip,rk2928-pclk-divider"; + reg = <0x2000006c 0x4>; + clocks = <&clk_gates2 1>; + #clock-cells = <0>; + }; + + div_hclk_cpu: div-hclk-cpu at 20000048 { + compatible = "rockchip,rk2928-hclk-divider"; + reg = <0x20000048 0x4>; + clocks = <&clk_gates0 3>; + #clock-cells = <0>; + }; + + div_pclk_cpu: div-pclk-cpu at 20000048 { + compatible = "rockchip,rk2928-pclk-divider"; + reg = <0x20000048 0x4>; + clocks = <&clk_gates0 3>; + #clock-cells = <0>; + }; + + div_mmc0: div-mmc0 at 20000070 { + compatible = "rockchip,rk2928-mmc-divider"; + reg = <0x20000070 0x4>; + clocks = <&clk_gates2 2>; + #clock-cells = <0>; + }; + + div_mmc1: div-mmc1 at 20000074 { + compatible = "rockchip,rk2928-mmc-divider"; + reg = <0x20000074 0x4>; + clocks = <&clk_gates2 2>; + #clock-cells = <0>; + }; + + clk_gates0: gate-clk at 200000d0 { + compatible = "rockchip,rk2928-gate-clk"; + reg = <0x200000d0 0x4>; + clocks = <&dummy>, <&dummy>, + <&dummy>, <&div_aclk_cpu>, + <&div_hclk_cpu>, <&div_pclk_cpu>, + <&dummy>, <&dummy>, + <&dummy>, <&dummy>, + <&dummy>, <&dummy>, + <&dummy>, <&dummy>, + <&dummy>, <&dummy>; + + clock-output-names = + "gate_core_periph", "gate_cpu_gpll", + "gate_ddrphy", "gate_aclk_cpu", + "gate_hclk_cpu", "gate_pclk_cpu", + "gate_atclk_cpu", "gate_i2s0", + "gate_i2s0_frac", "gate_i2s1", + "gate_i2s1_frac", "gate_i2s2", + "gate_i2s2_frac", "gate_spdif", + "gate_spdif_frac", "gate_testclk"; + + #clock-cells = <1>; + }; + + clk_gates1: gate-clk at 200000d4 { + compatible = "rockchip,rk2928-gate-clk"; + reg = <0x200000d4 0x4>; + clocks = <&xin24m>, <&xin24m>, + <&xin24m>, <&dummy>, + <&dummy>, <&xin24m>, + <&xin24m>, <&dummy>, + <&div_uart0>, <&dummy>, + <&div_uart1>, <&dummy>, + <&div_uart2>, <&dummy>, + <&div_uart3>, <&dummy>; + + clock-output-names = + "gate_timer0", "gate_timer1", + "gate_timer2", "gate_jtag", + "gate_aclk_lcdc1_src", "gate_otgphy0", + "gate_otgphy1", "gate_ddr_gpll", + "gate_uart0", "gate_frac_uart0", + "gate_uart1", "gate_frac_uart1", + "gate_uart2", "gate_frac_uart2", + "gate_uart3", "gate_frac_uart3"; + + #clock-cells = <1>; + }; + + clk_gates2: gate-clk at 200000d8 { + compatible = "rockchip,rk2928-gate-clk"; + reg = <0x200000d8 0x4>; + clocks = <&clk_gates2 1>, <&div_aclk_periph>, + <&div_hclk_periph>, <&div_pclk_periph>, + <&dummy>, <&dummy>, + <&clk_gates2 3>, <&dummy>, + <&dummy>, <&dummy>, + <&dummy>, <&div_mmc0>, + <&dummy>, <&div_mmc1>, + <&dummy>, <&dummy>; + + clock-output-names = + "gate_periph_src", "gate_aclk_periph", + "gate_hclk_periph", "gate_pclk_periph", + "gate_smc", "gate_mac", + "gate_hsadc", "gate_hsadc_frac", + "gate_saradc", "gate_spi0", + "gate_spi1", "gate_mmc0", + "gate_mac_lbtest", "gate_mmc1", + "gate_emmc", "gate_tsadc"; + + #clock-cells = <1>; + }; + + clk_gates3: gate-clk at 200000dc { + compatible = "rockchip,rk2928-gate-clk"; + reg = <0x200000dc 0x4>; + clocks = <&dummy>, <&dummy>, + <&dummy>, <&dummy>, + <&dummy>, <&dummy>, + <&dummy>, <&dummy>, + <&dummy>, <&dummy>, + <&dummy>, <&dummy>, + <&dummy>, <&dummy>, + <&dummy>, <&dummy>; + + clock-output-names = + "gate_aclk_lcdc0_src", "gate_dclk_lcdc0", + "gate_dclk_lcdc1", "gate_pclkin_cif0", + "gate_pclkin_cif1", "reserved", + "reserved", "gate_cif0_out", + "gate_cif1_out", "gate_aclk_vepu", + "gate_hclk_vepu", "gate_aclk_vdpu", + "gate_hclk_vdpu", "gate_gpu_src", + "reserved", "gate_xin27m"; + + #clock-cells = <1>; + }; + + clk_gates4: gate-clk at 200000e0 { + compatible = "rockchip,rk2928-gate-clk"; + reg = <0x200000e0 0x4>; + clocks = <&clk_gates2 2>, <&clk_gates2 3>, + <&clk_gates2 1>, <&clk_gates2 1>, + <&clk_gates2 1>, <&clk_gates2 2>, + <&clk_gates2 2>, <&clk_gates2 2>, + <&clk_gates0 4>, <&clk_gates0 4>, + <&clk_gates0 3>, <&clk_gates0 3>, + <&clk_gates0 3>, <&clk_gates2 3>, + <&clk_gates0 4>; + + clock-output-names = + "gate_hclk_peri_axi_matrix", "gate_pclk_peri_axi_matrix", + "gate_aclk_cpu_peri", "gate_aclk_peri_axi_matrix", + "gate_aclk_pei_niu", "gate_hclk_usb_peri", + "gate_hclk_peri_ahb_arbi", "gate_hclk_emem_peri", + "gate_hclk_cpubus", "gate_hclk_ahb2apb", + "gate_aclk_strc_sys", "gate_aclk_l2mem_con", + "gate_aclk_intmem", "gate_pclk_tsadc", + "gate_hclk_hdmi"; + + #clock-cells = <1>; + }; + + clk_gates5: gate-clk at 200000e4 { + compatible = "rockchip,rk2928-gate-clk"; + reg = <0x200000e4 0x4>; + clocks = <&clk_gates0 3>, <&clk_gates2 1>, + <&clk_gates0 5>, <&clk_gates0 5>, + <&clk_gates0 5>, <&clk_gates0 5>, + <&clk_gates0 4>, <&clk_gates0 5>, + <&clk_gates2 1>, <&clk_gates2 2>, + <&clk_gates2 2>, <&clk_gates2 2>, + <&clk_gates2 2>, <&clk_gates4 5>, + <&clk_gates4 5>, <&dummy>; + + clock-output-names = + "gate_aclk_dmac1", "gate_aclk_dmac2", + "gate_pclk_efuse", "gate_pclk_tzpc", + "gate_pclk_grf", "gate_pclk_pmu", + "gate_hclk_rom", "gate_pclk_ddrupctl", + "gate_aclk_smc", "gate_hclk_nandc", + "gate_hclk_mmc0", "gate_hclk_mmc1", + "gate_hclk_emmc", "gate_hclk_otg0", + "gate_hclk_otg1", "gate_aclk_gpu"; + + #clock-cells = <1>; + }; + + clk_gates6: gate-clk at 200000e8 { + compatible = "rockchip,rk2928-gate-clk"; + reg = <0x200000e8 0x4>; + clocks = <&clk_gates3 0>, <&clk_gates0 4>, + <&clk_gates0 4>, <&clk_gates1 4>, + <&clk_gates0 4>, <&clk_gates3 0>, + <&clk_gates0 4>, <&clk_gates1 4>, + <&clk_gates3 0>, <&clk_gates0 4>, + <&clk_gates0 4>, <&clk_gates1 4>, + <&clk_gates0 4>, <&clk_gates3 0>, + <&dummy>, <&dummy>; + + clock-output-names = + "gate_aclk_lcdc0", "gate_hclk_lcdc0", + "gate_hclk_lcdc1", "gate_aclk_lcdc1", + "gate_hclk_cif0", "gate_aclk_cif0", + "gate_hclk_cif1", "gate_aclk_cif1", + "gate_aclk_ipp", "gate_hclk_ipp", + "gate_hclk_rga", "gate_aclk_rga", + "gate_hclk_vio_bus", "gate_aclk_vio0", + "gate_aclk_vcodec", "gate_shclk_vio_h2h"; + + #clock-cells = <1>; + }; + + clk_gates7: gate-clk at 200000ec { + compatible = "rockchip,rk2928-gate-clk"; + reg = <0x200000ec 0x4>; + clocks = <&clk_gates2 2>, <&clk_gates0 4>, + <&clk_gates0 4>, <&clk_gates0 4>, + <&clk_gates0 4>, <&clk_gates2 2>, + <&clk_gates2 2>, <&clk_gates0 5>, + <&clk_gates0 5>, <&clk_gates0 5>, + <&clk_gates0 5>, <&clk_gates2 3>, + <&clk_gates2 3>, <&clk_gates2 3>, + <&clk_gates2 3>, <&clk_gates2 3>; + + clock-output-names = + "gate_hclk_emac", "gate_hclk_spdif", + "gate_hclk_i2s0_2ch", "gate_hclk_i2s1_2ch", + "gate_hclk_i2s_8ch", "gate_hclk_hsadc", + "gate_hclk_pidf", "gate_pclk_timer0", + "gate_pclk_timer1", "gate_pclk_timer2", + "gate_pclk_pwm01", "gate_pclk_pwm23", + "gate_pclk_spi0", "gate_pclk_spi1", + "gate_pclk_saradc", "gate_pclk_wdt"; + + #clock-cells = <1>; + }; + + clk_gates8: gate-clk at 200000f0 { + compatible = "rockchip,rk2928-gate-clk"; + reg = <0x200000f0 0x4>; + clocks = <&clk_gates0 5>, <&clk_gates0 5>, + <&clk_gates2 3>, <&clk_gates2 3>, + <&clk_gates0 5>, <&clk_gates0 5>, + <&clk_gates2 3>, <&clk_gates2 3>, + <&clk_gates2 3>, <&clk_gates0 5>, + <&clk_gates0 5>, <&clk_gates0 5>, + <&clk_gates2 3>, <&clk_gates2 3>, + <&dummy>, <&clk_gates0 5>; + + clock-output-names = + "gate_pclk_uart0", "gate_pclk_uart1", + "gate_pclk_uart2", "gate_pclk_uart3", + "gate_pclk_i2c0", "gate_pclk_i2c1", + "gate_pclk_i2c2", "gate_pclk_i2c3", + "gate_pclk_i2c4", "gate_pclk_gpio0", + "gate_pclk_gpio1", "gate_pclk_gpio2", + "gate_pclk_gpio3", "gate_pclk_gpio4", + "reserved", "gate_pclk_gpio6"; + + #clock-cells = <1>; + }; + + clk_gates9: gate-clk at 200000f4 { + compatible = "rockchip,rk2928-gate-clk"; + reg = <0x200000f4 0x4>; + clocks = <&dummy>, <&clk_gates0 5>, + <&dummy>, <&dummy>, + <&dummy>, <&clk_gates1 4>, + <&clk_gates0 5>, <&dummy>, + <&dummy>, <&dummy>, + <&dummy>; + + clock-output-names = + "gate_clk_core_dbg", "gate_pclk_dbg", + "gate_clk_trace", "gate_atclk", + "gate_clk_l2c", "gate_aclk_vio1", + "gate_pclk_publ", "gate_aclk_intmem0", + "gate_aclk_intmem1", "gate_aclk_intmem2", + "gate_aclk_intmem3"; + + #clock-cells = <1>; + }; + }; + +};
drivers/clk/Makefile +1 -0
@@ -25,6 +25,7 @@ ifeq ($(CONFIG_COMMON_CLK), y) obj-$(CONFIG_ARCH_MMP) += mmp/ endif obj-$(CONFIG_MACH_LOONGSON1) += clk-ls1x.o +obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ obj-$(CONFIG_ARCH_SUNXI) += sunxi/ obj-$(CONFIG_ARCH_U8500) += ux500/ obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o
drivers/clk/rockchip/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# Rockchip Clock specific Makefile +# + +obj-y += clk-rockchip.o +obj-y += clk-rockchip-pll.o
drivers/clk/rockchip/clk-rockchip-pll.c new file +131 -0
131 lines not on this page · raw message
drivers/clk/rockchip/clk-rockchip-pll.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* Copyright (c) 2013 MundoReader S.L. +* Author: Heiko Stuebner <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +extern struct clk *__init rockchip_clk_register_rk3x_pll (const char *name, +const char *pname,const void __iomem *reg_base, +const void __iomem *reg_mode,unsigned int shift_mode, +spinlock_t *lock);
drivers/clk/rockchip/clk-rockchip.c new file +313 -0
313 lines not on this page · raw message
Signature · 1 line
1.7.2.3
Heiko Stübner
maintainerPATCH v2 7/8 arm: add debug uarts for rockchip rk29xx and rk3xxx series
In reply to Heiko StübnerUarts on all recent Rockchip SoCs are Synopsis DesignWare 8250 types. Only their addresses vary very much.
This patch adds the necessary definitions to use any of the uart ports for early debug purposes.
--- arch/arm/Kconfig.debug | 34 +++++++++++++++++++++++++++++ arch/arm/include/debug/rockchip.S | 42 +++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/debug/rockchip.S
arch/arm/Kconfig.debug +34 -0
@@ -360,6 +360,13 @@ choice their output to the standard serial port on the RealView PB1176 platform. + config DEBUG_ROCKCHIP_UART + bool "Kernel low-level debugging messages via Rockchip UART" + depends on ARCH_ROCKCHIP + help + Say Y here if you want kernel low-level debugging support + on Rockchip based platforms. + config DEBUG_S3C_UART0 depends on PLAT_SAMSUNG select DEBUG_EXYNOS_UART if ARCH_EXYNOS
@@ -597,6 +604,32 @@ endchoice choice prompt "Low-level debug console UART" + depends on DEBUG_ROCKCHIP_UART + + config DEBUG_RK29_UART0 + bool "RK29 UART0" + + config DEBUG_RK29_UART1 + bool "RK29 UART1" + + config DEBUG_RK29_UART2 + bool "RK29 UART2" + + config DEBUG_RK3X_UART0 + bool "RK3X UART0" + + config DEBUG_RK3X_UART1 + bool "RK3X UART1" + + config DEBUG_RK3X_UART2 + bool "RK3X UART2" + + config DEBUG_RK3X_UART3 + bool "RK3X UART3" +endchoice + +choice + prompt "Low-level debug console UART" depends on DEBUG_LL && DEBUG_TEGRA_UART config TEGRA_DEBUG_UART_AUTO_ODMDATA
@@ -648,6 +681,7 @@ config DEBUG_LL_INCLUDE default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART default "debug/pxa.S" if DEBUG_PXA_UART1 || DEBUG_MMP_UART2 || \ DEBUG_MMP_UART3 + default "debug/rockchip.S" if DEBUG_ROCKCHIP_UART default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1 default "debug/socfpga.S" if DEBUG_SOCFPGA_UART default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1
arch/arm/include/debug/rockchip.S new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.7.2.3
Heiko Stübner
maintainerPATCH v2 8/8 arm: add basic support for Rockchip RK3066a boards
In reply to Heiko StübnerThis adds a generic devicetree board file and a dtsi for boards based on the RK3066a SoCs from Rockchip.
Apart from the generic parts (gic, clocks, pinctrl) the only components currently supported are the timers, uarts and mmc ports (all DesignWare- based).
--- arch/arm/Kconfig | 2 + arch/arm/Makefile | 1 + arch/arm/boot/dts/rk3066a.dtsi | 359 +++++++++++++++++++++++++++++++++++++ arch/arm/mach-rockchip/Kconfig | 16 ++ arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/rockchip.c | 54 ++++++ 6 files changed, 433 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/dts/rk3066a.dtsi create mode 100644 arch/arm/mach-rockchip/Kconfig create mode 100644 arch/arm/mach-rockchip/Makefile create mode 100644 arch/arm/mach-rockchip/rockchip.c
arch/arm/Kconfig +2 -0
@@ -983,6 +983,8 @@ source "arch/arm/mach-mmp/Kconfig" source "arch/arm/mach-realview/Kconfig" +source "arch/arm/mach-rockchip/Kconfig" + source "arch/arm/mach-sa1100/Kconfig" source "arch/arm/plat-samsung/Kconfig"
arch/arm/Makefile +1 -0
@@ -172,6 +172,7 @@ machine-$(CONFIG_ARCH_PICOXCELL) += picoxcell machine-$(CONFIG_ARCH_PRIMA2) += prima2 machine-$(CONFIG_ARCH_PXA) += pxa machine-$(CONFIG_ARCH_REALVIEW) += realview +machine-$(CONFIG_ARCH_ROCKCHIP) += rockchip machine-$(CONFIG_ARCH_RPC) += rpc machine-$(CONFIG_ARCH_S3C24XX) += s3c24xx machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx
arch/arm/boot/dts/rk3066a.dtsi new file +359 -0
359 lines not on this page · raw message
arch/arm/mach-rockchip/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +config ARCH_ROCKCHIP + bool "Rockchip RK2928 and RK3xxx SOCs" if ARCH_MULTI_V7 + select PINCTRL + select PINCTRL_ROCKCHIP + select ARCH_REQUIRE_GPIOLIB + select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERS + select HAVE_SMP + select LOCAL_TIMERS if SMP + select COMMON_CLK + select GENERIC_CLOCKEVENTS + select DW_APB_TIMER_OF + help + Support for Rockchip's Cortex-A9 Single-to-Quad-Core-SoCs + containing the RK2928, RK30xx and RK31xx series.
arch/arm/mach-rockchip/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip.o
arch/arm/mach-rockchip/rockchip.c new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
1.7.2.3