Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296630
b: refs/heads/master
c: eda413c
h: refs/heads/master
v: v3
  • Loading branch information
Lee Jones authored and Arnd Bergmann committed Feb 13, 2012
1 parent 5dab0ac commit 9786532
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 18403424c4fe5bac509bf52343f5d5407d45ee3a
refs/heads/master: eda413c228e227d888bc13d210e7c4c6aa62a682
1 change: 1 addition & 0 deletions trunk/arch/arm/mach-ux500/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ config MACH_U8500
bool "U8500 Development platform"
depends on UX500_SOC_DB8500
select TPS6105X
select SOC_BUS
help
Include support for the mop500 development platform.

Expand Down
30 changes: 22 additions & 8 deletions trunk/arch/arm/mach-ux500/cpu-db5500.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,32 @@ static int usb_db5500_tx_dma_cfg[] = {
DB5500_DMA_DEV38_USB_OTG_OEP_8
};

struct device* __init u5500_init_devices(void)
static const char *db5500_read_soc_id(void)
{
/* FIXME: First parameter to be a real parent. */
db5500_add_gpios(NULL);
return kasprintf(GFP_KERNEL, "u5500 currently unsupported\n");
}

static struct device * __init db5500_soc_device_init(void)
{
const char *soc_id = db5500_read_soc_id();

return ux500_soc_device_init(soc_id);
}

struct device * __init u5500_init_devices(void)
{
struct device *parent;

parent = db5500_soc_device_init();

db5500_add_gpios(parent);
db5500_pmu_init();
db5500_dma_init(NULL);
db5500_add_rtc(NULL);
db5500_add_usb(NULL, usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg);
db5500_dma_init(parent);
db5500_add_rtc(parent);
db5500_add_usb(parent, usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg);

platform_add_devices(db5500_platform_devs,
ARRAY_SIZE(db5500_platform_devs));

/* FIXME: Return value to be a real parent. */
return NULL;
return parent;
}
33 changes: 27 additions & 6 deletions trunk/arch/arm/mach-ux500/cpu-db8500.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <mach/setup.h>
#include <mach/devices.h>
#include <mach/usb.h>
#include <mach/db8500-regs.h>

#include "devices-db8500.h"
#include "ste-dma40-db8500.h"
Expand Down Expand Up @@ -164,18 +165,38 @@ static int usb_db8500_tx_dma_cfg[] = {
DB8500_DMA_DEV39_USB_OTG_OEP_8
};

static const char *db8500_read_soc_id(void)
{
void __iomem *uid = __io_address(U8500_BB_UID_BASE);

return kasprintf(GFP_KERNEL, "%08x%08x%08x%08x%08x",
readl((u32 *)uid+1),
readl((u32 *)uid+1), readl((u32 *)uid+2),
readl((u32 *)uid+3), readl((u32 *)uid+4));
}

static struct device * __init db8500_soc_device_init(void)
{
const char *soc_id = db8500_read_soc_id();

return ux500_soc_device_init(soc_id);
}

/*
* This function is called from the board init
*/
struct device* __init u8500_init_devices(void)
struct device * __init u8500_init_devices(void)
{
db8500_add_rtc(NULL);
db8500_add_gpios(NULL);
db8500_add_usb(NULL, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg);
struct device *parent;

parent = db8500_soc_device_init();

db8500_add_rtc(parent);
db8500_add_gpios(parent);
db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg);

platform_device_register_simple("cpufreq-u8500", -1, NULL, 0);
platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));

/* FIXME: Return value to be a real parent. */
return NULL;
return parent;
}
75 changes: 75 additions & 0 deletions trunk/arch/arm/mach-ux500/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (C) ST-Ericsson SA 2010
*
* Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
* Author: Lee Jones <lee.jones@linaro.org> for ST-Ericsson
* License terms: GNU General Public License (GPL) version 2
*/

Expand All @@ -11,6 +12,10 @@
#include <linux/mfd/db8500-prcmu.h>
#include <linux/mfd/db5500-prcmu.h>
#include <linux/clksrc-dbx500-prcmu.h>
#include <linux/sys_soc.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/stat.h>

#include <asm/hardware/gic.h>
#include <asm/mach/map.h>
Expand Down Expand Up @@ -50,3 +55,73 @@ void __init ux500_init_irq(void)
db8500_prcmu_early_init();
clk_init();
}

static const char * __init ux500_get_machine(void)
{
return kasprintf(GFP_KERNEL, "DB%4x", dbx500_partnumber());
}

static const char * __init ux500_get_family(void)
{
return kasprintf(GFP_KERNEL, "ux500");
}

static const char * __init ux500_get_revision(void)
{
unsigned int rev = dbx500_revision();

if (rev == 0x01)
return kasprintf(GFP_KERNEL, "%s", "ED");
else if (rev >= 0xA0)
return kasprintf(GFP_KERNEL, "%d.%d",
(rev >> 4) - 0xA + 1, rev & 0xf);

return kasprintf(GFP_KERNEL, "%s", "Unknown");
}

static ssize_t ux500_get_process(struct device *dev,
struct device_attribute *attr,
char *buf)
{
if (dbx500_id.process == 0x00)
return sprintf(buf, "Standard\n");

return sprintf(buf, "%02xnm\n", dbx500_id.process);
}

static void __init soc_info_populate(struct soc_device_attribute *soc_dev_attr,
const char *soc_id)
{
soc_dev_attr->soc_id = soc_id;
soc_dev_attr->machine = ux500_get_machine();
soc_dev_attr->family = ux500_get_family();
soc_dev_attr->revision = ux500_get_revision();
}

struct device_attribute ux500_soc_attr =
__ATTR(process, S_IRUGO, ux500_get_process, NULL);

struct device * __init ux500_soc_device_init(const char *soc_id)
{
struct device *parent;
struct soc_device *soc_dev;
struct soc_device_attribute *soc_dev_attr;

soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
if (!soc_dev_attr)
return ERR_PTR(-ENOMEM);

soc_info_populate(soc_dev_attr, soc_id);

soc_dev = soc_device_register(soc_dev_attr);
if (IS_ERR_OR_NULL(soc_dev)) {
kfree(soc_dev_attr);
return NULL;
}

parent = soc_device_to_device(soc_dev);
if (!IS_ERR_OR_NULL(parent))
device_create_file(parent, &ux500_soc_attr);

return parent;
}
3 changes: 3 additions & 0 deletions trunk/arch/arm/mach-ux500/include/mach/db8500-regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,7 @@
#define U8500_MODEM_BASE 0xe000000
#define U8500_APE_BASE 0x6000000

/* SoC identification number information */
#define U8500_BB_UID_BASE (U8500_BACKUPRAM1_BASE + 0xFC0)

#endif
2 changes: 2 additions & 0 deletions trunk/arch/arm/mach-ux500/include/mach/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ extern void __init u5500_sdi_init(struct device *parent);

extern void __init db5500_dma_init(struct device *parent);

extern struct device *ux500_soc_device_init(const char *soc_id);

/* We re-use nomadik_timer for this platform */
extern void nmdk_timer_init(void);

Expand Down

0 comments on commit 9786532

Please sign in to comment.