1. 12 Jan, 2014 20 commits
    • Gerhard Sittig's avatar
      powerpc/512x: dts: add MPC5125 clock specs · bc750594
      Gerhard Sittig authored
      add clock related specs to the MPC5125 "tower" board DTS
      - add clock providers (crystal/oscillator, clock control module)
      - add consumers (the CAN, SDHC, I2C, DIU, FEC, USB, PSC peripherals)
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      bc750594
    • Gerhard Sittig's avatar
      powerpc/512x: clk: support MPC5121/5123/5125 SoC variants · 319bbe0e
      Gerhard Sittig authored
      improve the common clock support code for MPC512x
      
      - expand the CCM register set declaration with MPC5125 related registers
        (which reside in the previously "reserved" area)
      - tell the MPC5121, MPC5123, and MPC5125 SoC variants apart, and derive
        the availability of components and their clocks from the detected SoC
        (MBX, AXE, VIU, SPDIF, PATA, SATA, PCI, second FEC, second SDHC,
        number of PSC components, type of NAND flash controller,
        interpretation of the CPMF bitfield, PSC/CAN mux0 stage input clocks,
        output clocks on SoC pins)
      - add backwards compatibility (allow operation against a device tree
        which lacks clock related specs) for MPC5125 FECs, too
      
      telling SoC variants apart and adjusting the clock tree's generation
      occurs at runtime, a common generic binary supports all of the chips
      
      the MPC5125 approach to the NFC clock (one register with two counters
      for the high and low periods of the clock) is not implemented, as there
      are no users and there is no common implementation which supports this
      kind of clock -- the new implementation would be unused and could not
      get verified, so it shall wait until there is demand
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Acked-by: default avatarMike Turquette <mturquette@linaro.org>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      319bbe0e
    • Gerhard Sittig's avatar
      powerpc/512x: clk: enforce even SDHC divider values · 76922ebb
      Gerhard Sittig authored
      the SDHC clock is derived from CSB with a fractional divider which can
      address "quarters"; the implementation multiplies CSB by 4 and divides
      it by the (integer) divider value
      
      a bug in the clock domain synchronisation requires that only even
      divider values get setup; we achieve this by
      - multiplying CSB by 2 only instead of 4
      - registering with CCF the divider's bit field without bit0
      - the divider's lowest bit remains clear as this is the reset value
        and later operations won't touch it
      
      this change keeps fully utilizing common clock primitives (needs no
      additional support logic, and avoids an excessive divider table) and
      satisfies the hardware's constraint of only supporting even divider
      values
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Acked-by: default avatarMike Turquette <mturquette@linaro.org>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      76922ebb
    • Gerhard Sittig's avatar
      powerpc/512x: clk: minor comment updates · 2a2b9ff8
      Gerhard Sittig authored
      adjust (expand on or move) a few comments,
      add markers for easier navigation around helpers
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Acked-by: default avatarMike Turquette <mturquette@linaro.org>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      2a2b9ff8
    • Gerhard Sittig's avatar
      clk: mpc512x: remove migration support workarounds · 20755f85
      Gerhard Sittig authored
      this change removes workarounds which have become obsolete after
      migration to common clock support has completed
      - remove clkdev registration calls (compatibility clock item aliases)
        after all peripheral drivers were adjusted for device tree based
        clock lookup
      - remove pre-enable workarounds after all peripheral drivers were
        adjusted to acquire their respective clock items
      
      workarounds for these clock items get removed:  FEC (ethernet), I2C,
      PSC (UART, SPI), PSC FIFO, USB, NFC (NAND flash), VIU (video capture),
      BDLC (CAN), CAN MCLK, DIU (video output)
      
      these clkdev registered names won't be provided any longer by the
      MPC512x platform's clock driver:  "psc%d_mclk", "mscan%d_mclk",
      "usb%d_clk", "nfc_clk", "viu_clk", "sys_clk", "ref_clk"
      
      the pre-enable workaround for PCI remains, but depends on the presence
      of PCI related device tree nodes (disables the PCI clock in the absence
      of PCI nodes, keeps the PCI clock enabled in the presence of nodes) --
      moving clock acquisition into the peripheral driver isn't possible for
      PCI because its initialization takes place before the platform clock
      driver gets initialized, thus the clock provider isn't available then
      
      Cc: Mike Turquette <mturquette@linaro.org>
      Cc: Anatolij Gustschin <agust@denx.de>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      20755f85
    • Gerhard Sittig's avatar
      powerpc/mpc512x: improve DIU related clock setup · ba218127
      Gerhard Sittig authored
      adapt the DIU clock initialization to the COMMON_CLK approach:
      device tree based clock lookup, prepare and unprepare for clocks,
      work with frequencies not dividers, call the appropriate clk_*()
      routines and don't access CCM registers
      
      the "best clock" determination now completely relies on the
      platform's clock driver to pick a frequency close to what the
      caller requests, and merely checks whether the desired frequency
      was met (fits the tolerance of the monitor)
      
      this approach shall succeed upon first try in the usual case,
      will test a few less desirable yet acceptable frequencies in
      edge cases, and will fallback to "best effort" if none of the
      previously tried frequencies pass the test
      
      provide a fallback clock lookup approach in case the OF based clock
      lookup for the DIU fails, this allows for successful operation in
      the presence of an outdated device tree which lacks clock specs
      
      Cc: Anatolij Gustschin <agust@denx.de>
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      ba218127
    • Gerhard Sittig's avatar
      net: can: mscan: remove non-CCF code for MPC512x · 7b19f3bc
      Gerhard Sittig authored
      transition to the common clock framework has completed and the PPC_CLOCK
      is no longer available for the MPC512x platform, remove the now obsolete
      code path of the mpc5xxx mscan driver which accessed clock control module
      registers directly
      
      Cc: Wolfgang Grandegger <wg@grandegger.com>
      Cc: Marc Kleine-Budde <mkl@pengutronix.de>
      Cc: linux-can@vger.kernel.org
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      7b19f3bc
    • Gerhard Sittig's avatar
      net: can: mscan: adjust to common clock support for mpc512x · 5ac22504
      Gerhard Sittig authored
      implement a .get_clock() callback for the MPC512x platform which uses
      the common clock infrastructure (eliminating direct access to the clock
      control registers from within the CAN network driver), and provide the
      corresponding .put_clock() callback to release resources after use
      
      acquire both the clock items for register access ("ipg") as well as for
      wire communication ("can")
      
      keep the previous implementation of MPC512x support in place during
      migration, this results in a readable diff of the change
      
      this change is neutral to the MPC5200 platform
      
      Cc: Wolfgang Grandegger <wg@grandegger.com>
      Cc: Marc Kleine-Budde <mkl@pengutronix.de>
      Cc: linux-can@vger.kernel.org
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      5ac22504
    • Gerhard Sittig's avatar
      fsl-viu: adjust for OF based clock lookup · 17552189
      Gerhard Sittig authored
      after device tree based clock lookup became available, the VIU driver
      need no longer use the previous global "viu_clk" name, but should use
      the "ipg" clock name specific to the OF node
      
      Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
      Cc: linux-media@vger.kernel.org
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      17552189
    • Gerhard Sittig's avatar
      mtd: mpc5121_nfc: adjust for OF based clock lookup · 10de271f
      Gerhard Sittig authored
      after device tree based clock lookup became available, the NAND
      flash driver need no longer use the previous global "nfc_clk" name,
      but should use the "ipg" clock name specific to the OF node
      
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Cc: linux-mtd@lists.infradead.org
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      10de271f
    • Gerhard Sittig's avatar
      USB: fsl-mph-dr-of: adjust for OF based clock lookup · d77276c4
      Gerhard Sittig authored
      after device tree based clock lookup became available, the peripheral
      driver need no longer construct clock names which include the component
      index -- remove the "usb%d_clk" template, always use "ipg" instead
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: linux-usb@vger.kernel.org
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      d77276c4
    • Gerhard Sittig's avatar
      serial: mpc512x: setup the PSC FIFO clock as well · cb1ea812
      Gerhard Sittig authored
      prepare and enable the FIFO clock upon PSC FIFO initialization,
      check for and propagage errors when enabling the PSC FIFO clock,
      disable and unprepare the FIFO clock upon PSC FIFO uninitialization
      
      devm_{get,put}_clk() doesn't apply here, as the SoC provides a
      single FIFO component which is shared among several PSC components,
      thus the FIFO isn't associated with a device (while the PSCs are)
      
      provide a fallback clock lookup approach in case the OF based clock
      lookup for the PSC FIFO fails, this allows for successful operation in
      the presence of an outdated device tree which lacks clock specs
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: linux-serial@vger.kernel.org
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      cb1ea812
    • Gerhard Sittig's avatar
      serial: mpc512x: adjust for OF based clock lookup · e149b42b
      Gerhard Sittig authored
      after device tree based clock lookup became available, the peripheral
      driver need no longer construct clock names which include the PSC index,
      remove the "psc%d_mclk" template and unconditionally use 'mclk'
      
      acquire and release the "ipg" clock item for register access as well
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: linux-serial@vger.kernel.org
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      e149b42b
    • Gerhard Sittig's avatar
      spi: mpc512x: adjust to OF based clock lookup · dff148ad
      Gerhard Sittig authored
      after device tree based clock lookup became available, the peripheral
      driver need no longer construct clock names which include the PSC index,
      remove the "psc%d_mclk" template and unconditionally use 'mclk'
      
      acquire and release the 'ipg' clock item for register access as well
      
      Cc: Mark Brown <broonie@kernel.org>
      Cc: linux-spi@vger.kernel.org
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Acked-by: default avatarMark Brown <broonie@linaro.org>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      dff148ad
    • Gerhard Sittig's avatar
      clk: mpc5xxx: switch to COMMON_CLK, retire PPC_CLOCK · 7d71d5b2
      Gerhard Sittig authored
      the setup before the change was
      - arch/powerpc/Kconfig had the PPC_CLOCK option, off by default
      - depending on the PPC_CLOCK option the arch/powerpc/kernel/clock.c file
        was built, which implements the clk.h API but always returns -ENOSYS
        unless a platform registers specific callbacks
      - the MPC52xx platform selected PPC_CLOCK but did not register any
        callbacks, thus all clk.h API calls keep resulting in -ENOSYS errors
        (which is OK, all peripheral drivers deal with the situation)
      - the MPC512x platform selected PPC_CLOCK and registered specific
        callbacks implemented in arch/powerpc/platforms/512x/clock.c, thus
        provided real support for the clock API
      - no other powerpc platform did select PPC_CLOCK
      
      the situation after the change is
      - the MPC512x platform implements the COMMON_CLK interface, and thus the
        PPC_CLOCK approach in arch/powerpc/platforms/512x/clock.c has become
        obsolete
      - the MPC52xx platform still lacks genuine support for the clk.h API
        while this is not a change against the previous situation (the error
        code returned from COMMON_CLK stubs differs but every call still
        results in an error)
      - with all references gone, the arch/powerpc/kernel/clock.c wrapper and
        the PPC_CLOCK option have become obsolete, as did the clk_interface.h
        header file
      
      the switch from PPC_CLOCK to COMMON_CLK is done for all platforms within
      the same commit such that multiplatform kernels (the combination of 512x
      and 52xx within one executable) keep working
      
      Cc: Mike Turquette <mturquette@linaro.org>
      Cc: Anatolij Gustschin <agust@denx.de>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      7d71d5b2
    • Gerhard Sittig's avatar
      dts: mpc512x: add clock specs for client lookups · 124fe7c5
      Gerhard Sittig authored
      this addresses the client side of device tree based clock lookups
      
      add clock specifiers to the mbx, nfc, mscan, sdhc, i2c, axe, diu, viu,
      mdio, fec, usb, pata, psc, psc fifo, and pci nodes in the shared
      mpc5121.dtsi include
      
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Pawel Moll <pawel.moll@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Stephen Warren <swarren@wwwdotorg.org>
      Cc: Ian Campbell <ian.campbell@citrix.com>
      Cc: devicetree@vger.kernel.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Reviewed-by: default avatarMike Turquette <mturquette@linaro.org>
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      124fe7c5
    • Gerhard Sittig's avatar
      clk: mpc512x: add backwards compat to the CCF code · 01f25c37
      Gerhard Sittig authored
      extend the recently added COMMON_CLK platform support for MPC512x such
      that it works with incomplete device tree data which lacks clock specs
      
      Cc: Mike Turquette <mturquette@linaro.org>
      Cc: Anatolij Gustschin <agust@denx.de>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      [agust@denx.de: moved node macro definitions out of the function body]
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      01f25c37
    • Gerhard Sittig's avatar
      clk: mpc512x: introduce COMMON_CLK for MPC512x (disabled) · 6d8cdb68
      Gerhard Sittig authored
      this change implements a clock driver for the MPC512x PowerPC platform
      which follows the COMMON_CLK approach and uses common clock drivers
      shared with other platforms
      
      this driver implements the publicly announced set of clocks (those
      listed in the dt-bindings header file), as well as generates additional
      'struct clk' items where the SoC hardware cannot easily get mapped to
      the common primitives (shared code) of the clock API, or requires
      "intermediate clock nodes" to represent clocks that have both gates and
      dividers
      
      the previous PPC_CLOCK implementation is kept in place and remains
      active for the moment, the newly introduced CCF clock driver will
      receive additional support for backwards compatibility in a subsequent
      patch before it gets enabled and will replace the PPC_CLOCK approach
      
      some of the clock items get pre-enabled in the clock driver to not have
      them automatically disabled by the underlying clock subsystem because of
      their being unused -- this approach is desirable because
      - some of the clocks are useful to have for diagnostics and information
        despite their not getting claimed by any drivers (CPU, internal and
        external RAM, internal busses, boot media)
      - some of the clocks aren't claimed by their peripheral drivers yet,
        either because of missing driver support or because device tree specs
        aren't available yet (but the workarounds will get removed as the
        drivers get adjusted and the device tree provides the clock specs)
      
      clkdev registration provides "alias names" for few clock items
      - to not break those peripheral drivers which encode their component
        index into the name that is used for clock lookup (UART, SPI, USB)
      - to not break those drivers which use names for the clock lookup which
        were encoded in the previous PPC_CLOCK implementation (NFC, VIU, CAN)
      this workaround will get removed as these drivers get adjusted after
      device tree based clock lookup has become available
      
      the COMMON_CLK implementation copes with device trees which lack an
      oscillator node (backwards compat), the REF clock is then derived from
      the IPS bus frequency and multiplier values fetched from hardware
      
      Cc: Mike Turquette <mturquette@linaro.org>
      Cc: Anatolij Gustschin <agust@denx.de>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      6d8cdb68
    • Gerhard Sittig's avatar
      dts: mpc512x: add clock related device tree specs · f87ccd2e
      Gerhard Sittig authored
      this addresses the clock driver aka provider's side of clocks
      - introduce a 'clocks' subtree with an 'osc' node for the crystal
        or oscillator SoC input (fixed frequency)
      - the 'clock@f00' clock-control-module node references the 'osc' for
        its input, and is another provider for all the clocks which the
        CCM component manages
      - prepare for future references to clocks from peripheral nodes
        by means of the <&clks ID> syntax and symbolic ID names which a
        header file provides
      - provide default values with 33MHz oscillator frequency in the
        common include (the 66MHz IPS bus already was there), and add
        override values for the ifm AC14xx board which deviates from
        the reference design (25MHz xtal, 80MHz IPS bus)
      
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Pawel Moll <pawel.moll@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Stephen Warren <swarren@wwwdotorg.org>
      Cc: Ian Campbell <ian.campbell@citrix.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: devicetree@vger.kernel.org
      Reviewed-by: default avatarMike Turquette <mturquette@linaro.org>
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      f87ccd2e
    • Gerhard Sittig's avatar
      dts: mpc512x: introduce dt-bindings/clock/ header · 4cc5e1ca
      Gerhard Sittig authored
      introduce a dt-bindings/ header file for MPC512x clocks,
      providing symbolic identifiers for those SoC clocks which
      clients will reference from their device tree nodes
      
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Pawel Moll <pawel.moll@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Stephen Warren <swarren@wwwdotorg.org>
      Cc: Ian Campbell <ian.campbell@citrix.com>
      Cc: devicetree@vger.kernel.org
      Reviewed-by: default avatarMike Turquette <mturquette@linaro.org>
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      4cc5e1ca
  2. 30 Dec, 2013 15 commits
  3. 20 Dec, 2013 1 commit
  4. 18 Dec, 2013 1 commit
    • Gerhard Sittig's avatar
      powerpc/512x: dts: remove misplaced IRQ spec from 'soc' node (5125) · bbca4d39
      Gerhard Sittig authored
      the 'soc' node in the MPC5125 "tower" board .dts has an '#interrupt-cells'
      property although this node is not an interrupt controller
      
      remove this erroneously placed property because starting with v3.13-rc1
      lookup and resolution of 'interrupts' specs for peripherals gets misled
      (tries to use the 'soc' as the interrupt parent which fails), emits
      'no irq domain found' WARN() messages and breaks the boot process
      
      [ best viewed with 'git diff -U5' to have DT node names in the context ]
      
      Cc: Anatolij Gustschin <agust@denx.de>
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: devicetree@vger.kernel.org
      Signed-off-by: default avatarGerhard Sittig <gsi@denx.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      bbca4d39
  5. 13 Dec, 2013 3 commits