Subject: [RFC PATCH] ARM: initial DTS support for km_kirkwood

From: [email-masked] (Valentin Longchamp)
Date: Wed, 29 Aug 2012 10:04:21 +0200

Hi Andrew,

On 08/28/2012 02:20 PM, Andrew Lunn wrote:
> Hi Valentin
> 
>> This is a first attempt to support the km_kirkwood reference design with
>> a device tree. This km_kirkwood design is present in many Keymile
>> products. It is based on the Marvell Bobcat SOC which integrates a
>> Kirkwood CPU next to a big L2 Ethernet Switch. The Kirkwood in the SOC
>> is very similar to the "normal" one, but there are a few differences.
> 
> Is there a public datasheet for this device?

Unfortunately I am not aware of such a document. I have just checked on
Marvell's website and I haven't found anything. All the documents we have are
under NDA.

> 
>> diff --git a/arch/arm/mach-kirkwood/board-km_kirkwood.c b/arch/arm/mach-kirkwood/board-km_kirkwood.c
>> new file mode 100644
>> index 0000000..7a103db
>> --- /dev/null
>> +++ b/arch/arm/mach-kirkwood/board-km_kirkwood.c
>> @@ -0,0 +1,75 @@
>> +/*
>> + * Copyright 2012 2012 KEYMILE AG, CH-3097 Bern
>> + * Valentin Longchamp <[email-masked]>
>> + *
>> + * arch/arm/mach-kirkwood/board-km_kirkwood.c
>> + *
>> + * Keymile km_kirkwood Reference Desing Init for drivers not converted to
>> + * flattened device tree yet.
>> + *
>> + * This file is licensed under the terms of the GNU General Public
>> + * License version 2.  This program is licensed "as is" without any
>> + * warranty of any kind, whether express or implied.
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/init.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/ata_platform.h>
>> +#include <linux/mv643xx_eth.h>
>> +#include <linux/of.h>
>> +#include <linux/of_address.h>
>> +#include <linux/of_fdt.h>
>> +#include <linux/of_irq.h>
>> +#include <linux/of_platform.h>
>> +#include <linux/gpio.h>
>> +#include <linux/mtd/physmap.h>
>> +#include <linux/spi/flash.h>
>> +#include <linux/spi/spi.h>
>> +#include <linux/clk.h>
>> +#include <linux/clk-private.h>
>> +#include <asm/mach-types.h>
>> +#include <asm/mach/arch.h>
>> +#include <asm/mach/map.h>
>> +#include <mach/kirkwood.h>
>> +#include <mach/bridge-regs.h>
>> +#include <plat/mvsdio.h>
>> +#include "common.h"
>> +#include "mpp.h"
> 
> Please remove all the header files you don't need.

OK.

> 
>> +
>> +static struct mv643xx_eth_platform_data km_kirkwood_ge00_data = {
>> +	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
>> +};
>> +
>> +static unsigned int km_kirkwood_mpp_config[] __initdata = {
>> +	MPP8_GPIO,	/* I2C SDA */
>> +	MPP9_GPIO,	/* I2C SCL */
>> +	0
>> +};
>> +
>> +void __init km_kirkwood_init(void)
>> +{
>> +	struct clk *sata_clk;
>> +	/*
>> +	 * Basic setup. Needs to be called early.
>> +	 */
>> +
>> +	kirkwood_mpp_conf(km_kirkwood_mpp_config);
>> +
>> +	/*
>> +	 * Our variant of kirkwood (integrated in the Bobcat) hangs on accessing
>> +	 * SATA bits (14-15) of the Clock Gating Control Register. Since these
>> +	 * devices are also not present in this variant, their clocks get
>> +	 * disabled because unused when clk_disable_unused() gets called.
> 
> So there is no SATA at all on this SoC? Anything else missing which a
> 'normal' kirkwood has?

No SATA at all. Yes, other missing peripherals are RTC, SDIO, I2S (Audio), TDM,
TS (MPEG-2 Transport Stream).

> 
> If there a way to identify the chipset? e.g. what does 
> 
> kirkwood_pcie_id(&dev, &rev);
> 
> give? It would be better to not create the clocks at all, if we could
> determine at runtime the hardware was not there.
> 

Yeah I agree, it would be much better. However here is what is returned from the
kirkwood_pcie_id call in kirkwood_dt_init() (kirkwood_id())

> Kirkwood: MV88F6281-A0, TCLK=200000000.

To me it looks like this is the exact same ID as the usual kirkwood version so
we cannot determine this at runtime (at least not with that ID).

Valentin