Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
cb86ae95
Commit
cb86ae95
authored
Jul 22, 2010
by
Russell King
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git://git.infradead.org/users/cbou/linux-cns3xxx
into devel-stable
parents
14764b01
23f5cace
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
596 additions
and
56 deletions
+596
-56
arch/arm/Kconfig
arch/arm/Kconfig
+2
-1
arch/arm/mach-cns3xxx/Makefile
arch/arm/mach-cns3xxx/Makefile
+2
-1
arch/arm/mach-cns3xxx/cns3420vb.c
arch/arm/mach-cns3xxx/cns3420vb.c
+4
-0
arch/arm/mach-cns3xxx/devices.c
arch/arm/mach-cns3xxx/devices.c
+111
-0
arch/arm/mach-cns3xxx/devices.h
arch/arm/mach-cns3xxx/devices.h
+20
-0
arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
+45
-46
arch/arm/mach-cns3xxx/pcie.c
arch/arm/mach-cns3xxx/pcie.c
+389
-0
arch/arm/mach-cns3xxx/pm.c
arch/arm/mach-cns3xxx/pm.c
+23
-8
No files found.
arch/arm/Kconfig
View file @
cb86ae95
...
...
@@ -301,6 +301,7 @@ config ARCH_CNS3XXX
select CPU_V6
select GENERIC_CLOCKEVENTS
select ARM_GIC
select PCI_DOMAINS if PCI
help
Support for Cavium Networks CNS3XXX platform.
...
...
@@ -1061,7 +1062,7 @@ config ISA_DMA_API
bool
config PCI
bool "PCI support" if ARCH_INTEGRATOR_AP || ARCH_VERSATILE_PB || ARCH_IXP4XX || ARCH_KS8695 || MACH_ARMCORE
bool "PCI support" if ARCH_INTEGRATOR_AP || ARCH_VERSATILE_PB || ARCH_IXP4XX || ARCH_KS8695 || MACH_ARMCORE
|| ARCH_CNS3XXX
help
Find out whether you have a PCI motherboard. PCI is the name of a
bus system, i.e. the way the CPU talks to the other stuff inside
...
...
arch/arm/mach-cns3xxx/Makefile
View file @
cb86ae95
obj-$(CONFIG_ARCH_CNS3XXX)
+=
core.o pm.o
obj-$(CONFIG_ARCH_CNS3XXX)
+=
core.o pm.o devices.o
obj-$(CONFIG_PCI)
+=
pcie.o
obj-$(CONFIG_MACH_CNS3420VB)
+=
cns3420vb.o
arch/arm/mach-cns3xxx/cns3420vb.c
View file @
cb86ae95
...
...
@@ -32,6 +32,7 @@
#include <mach/cns3xxx.h>
#include <mach/irqs.h>
#include "core.h"
#include "devices.h"
/*
* NOR Flash
...
...
@@ -117,6 +118,9 @@ static void __init cns3420_init(void)
{
platform_add_devices
(
cns3420_pdevs
,
ARRAY_SIZE
(
cns3420_pdevs
));
cns3xxx_ahci_init
();
cns3xxx_sdhci_init
();
pm_power_off
=
cns3xxx_power_off
;
}
...
...
arch/arm/mach-cns3xxx/devices.c
0 → 100644
View file @
cb86ae95
/*
* CNS3xxx common devices
*
* Copyright 2008 Cavium Networks
* Scott Shu
* Copyright 2010 MontaVista Software, LLC.
* Anton Vorontsov <avorontsov@mvista.com>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, Version 2, as
* published by the Free Software Foundation.
*/
#include <linux/io.h>
#include <linux/init.h>
#include <linux/compiler.h>
#include <linux/dma-mapping.h>
#include <linux/platform_device.h>
#include <mach/cns3xxx.h>
#include <mach/irqs.h>
#include "core.h"
#include "devices.h"
/*
* AHCI
*/
static
struct
resource
cns3xxx_ahci_resource
[]
=
{
[
0
]
=
{
.
start
=
CNS3XXX_SATA2_BASE
,
.
end
=
CNS3XXX_SATA2_BASE
+
CNS3XXX_SATA2_SIZE
-
1
,
.
flags
=
IORESOURCE_MEM
,
},
[
1
]
=
{
.
start
=
IRQ_CNS3XXX_SATA
,
.
end
=
IRQ_CNS3XXX_SATA
,
.
flags
=
IORESOURCE_IRQ
,
},
};
static
u64
cns3xxx_ahci_dmamask
=
DMA_BIT_MASK
(
32
);
static
struct
platform_device
cns3xxx_ahci_pdev
=
{
.
name
=
"ahci"
,
.
id
=
0
,
.
resource
=
cns3xxx_ahci_resource
,
.
num_resources
=
ARRAY_SIZE
(
cns3xxx_ahci_resource
),
.
dev
=
{
.
dma_mask
=
&
cns3xxx_ahci_dmamask
,
.
coherent_dma_mask
=
DMA_BIT_MASK
(
32
),
},
};
void
__init
cns3xxx_ahci_init
(
void
)
{
u32
tmp
;
tmp
=
__raw_readl
(
MISC_SATA_POWER_MODE
);
tmp
|=
0x1
<<
16
;
/* Disable SATA PHY 0 from SLUMBER Mode */
tmp
|=
0x1
<<
17
;
/* Disable SATA PHY 1 from SLUMBER Mode */
__raw_writel
(
tmp
,
MISC_SATA_POWER_MODE
);
/* Enable SATA PHY */
cns3xxx_pwr_power_up
(
0x1
<<
PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY0
);
cns3xxx_pwr_power_up
(
0x1
<<
PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY1
);
/* Enable SATA Clock */
cns3xxx_pwr_clk_en
(
0x1
<<
PM_CLK_GATE_REG_OFFSET_SATA
);
/* De-Asscer SATA Reset */
cns3xxx_pwr_soft_rst
(
CNS3XXX_PWR_SOFTWARE_RST
(
SATA
));
platform_device_register
(
&
cns3xxx_ahci_pdev
);
}
/*
* SDHCI
*/
static
struct
resource
cns3xxx_sdhci_resources
[]
=
{
[
0
]
=
{
.
start
=
CNS3XXX_SDIO_BASE
,
.
end
=
CNS3XXX_SDIO_BASE
+
SZ_4K
-
1
,
.
flags
=
IORESOURCE_MEM
,
},
[
1
]
=
{
.
start
=
IRQ_CNS3XXX_SDIO
,
.
end
=
IRQ_CNS3XXX_SDIO
,
.
flags
=
IORESOURCE_IRQ
,
},
};
static
struct
platform_device
cns3xxx_sdhci_pdev
=
{
.
name
=
"sdhci-cns3xxx"
,
.
id
=
0
,
.
num_resources
=
ARRAY_SIZE
(
cns3xxx_sdhci_resources
),
.
resource
=
cns3xxx_sdhci_resources
,
};
void
__init
cns3xxx_sdhci_init
(
void
)
{
u32
__iomem
*
gpioa
=
__io
(
CNS3XXX_MISC_BASE_VIRT
+
0x0014
);
u32
gpioa_pins
=
__raw_readl
(
gpioa
);
/* MMC/SD pins share with GPIOA */
gpioa_pins
|=
0x1fff0004
;
__raw_writel
(
gpioa_pins
,
gpioa
);
cns3xxx_pwr_clk_en
(
CNS3XXX_PWR_CLK_EN
(
SDIO
));
cns3xxx_pwr_soft_rst
(
CNS3XXX_PWR_SOFTWARE_RST
(
SDIO
));
platform_device_register
(
&
cns3xxx_sdhci_pdev
);
}
arch/arm/mach-cns3xxx/devices.h
0 → 100644
View file @
cb86ae95
/*
* CNS3xxx common devices
*
* Copyright 2008 Cavium Networks
* Scott Shu
* Copyright 2010 MontaVista Software, LLC.
* Anton Vorontsov <avorontsov@mvista.com>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, Version 2, as
* published by the Free Software Foundation.
*/
#ifndef __CNS3XXX_DEVICES_H_
#define __CNS3XXX_DEVICES_H_
void
__init
cns3xxx_ahci_init
(
void
);
void
__init
cns3xxx_sdhci_init
(
void
);
#endif
/* __CNS3XXX_DEVICES_H_ */
arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
View file @
cb86ae95
...
...
@@ -247,37 +247,36 @@
* Misc block
*/
#define MISC_MEM_MAP(offs) (void __iomem *)(CNS3XXX_MISC_BASE_VIRT + (offs))
#define MISC_MEM_MAP_VALUE(offset) (*((volatile unsigned int *)(CNS3XXX_MISC_BASE_VIRT + (offset))))
#define MISC_MEMORY_REMAP_REG MISC_MEM_MAP_VALUE(0x00)
#define MISC_CHIP_CONFIG_REG MISC_MEM_MAP_VALUE(0x04)
#define MISC_DEBUG_PROBE_DATA_REG MISC_MEM_MAP_VALUE(0x08)
#define MISC_DEBUG_PROBE_SELECTION_REG MISC_MEM_MAP_VALUE(0x0C)
#define MISC_IO_PIN_FUNC_SELECTION_REG MISC_MEM_MAP_VALUE(0x10)
#define MISC_GPIOA_PIN_ENABLE_REG MISC_MEM_MAP_VALUE(0x14)
#define MISC_GPIOB_PIN_ENABLE_REG MISC_MEM_MAP_VALUE(0x18)
#define MISC_IO_PAD_DRIVE_STRENGTH_CTRL_A MISC_MEM_MAP_VALUE(0x1C)
#define MISC_IO_PAD_DRIVE_STRENGTH_CTRL_B MISC_MEM_MAP_VALUE(0x20)
#define MISC_GPIOA_15_0_PULL_CTRL_REG MISC_MEM_MAP_VALUE(0x24)
#define MISC_GPIOA_16_31_PULL_CTRL_REG MISC_MEM_MAP_VALUE(0x28)
#define MISC_GPIOB_15_0_PULL_CTRL_REG MISC_MEM_MAP_VALUE(0x2C)
#define MISC_GPIOB_16_31_PULL_CTRL_REG MISC_MEM_MAP_VALUE(0x30)
#define MISC_IO_PULL_CTRL_REG MISC_MEM_MAP_VALUE(0x34)
#define MISC_E_FUSE_31_0_REG MISC_MEM_MAP_VALUE(0x40)
#define MISC_E_FUSE_63_32_REG MISC_MEM_MAP_VALUE(0x44)
#define MISC_E_FUSE_95_64_REG MISC_MEM_MAP_VALUE(0x48)
#define MISC_E_FUSE_127_96_REG MISC_MEM_MAP_VALUE(0x4C)
#define MISC_SOFTWARE_TEST_1_REG MISC_MEM_MAP_VALUE(0x50)
#define MISC_SOFTWARE_TEST_2_REG MISC_MEM_MAP_VALUE(0x54)
#define MISC_SATA_POWER_MODE MISC_MEM_MAP_VALUE(0x310)
#define MISC_USB_CFG_REG MISC_MEM_MAP_VALUE(0x800)
#define MISC_USB_STS_REG MISC_MEM_MAP_VALUE(0x804)
#define MISC_USBPHY00_CFG_REG MISC_MEM_MAP_VALUE(0x808)
#define MISC_USBPHY01_CFG_REG MISC_MEM_MAP_VALUE(0x80c)
#define MISC_USBPHY10_CFG_REG MISC_MEM_MAP_VALUE(0x810)
#define MISC_USBPHY11_CFG_REG MISC_MEM_MAP_VALUE(0x814)
#define MISC_MEMORY_REMAP_REG MISC_MEM_MAP(0x00)
#define MISC_CHIP_CONFIG_REG MISC_MEM_MAP(0x04)
#define MISC_DEBUG_PROBE_DATA_REG MISC_MEM_MAP(0x08)
#define MISC_DEBUG_PROBE_SELECTION_REG MISC_MEM_MAP(0x0C)
#define MISC_IO_PIN_FUNC_SELECTION_REG MISC_MEM_MAP(0x10)
#define MISC_GPIOA_PIN_ENABLE_REG MISC_MEM_MAP(0x14)
#define MISC_GPIOB_PIN_ENABLE_REG MISC_MEM_MAP(0x18)
#define MISC_IO_PAD_DRIVE_STRENGTH_CTRL_A MISC_MEM_MAP(0x1C)
#define MISC_IO_PAD_DRIVE_STRENGTH_CTRL_B MISC_MEM_MAP(0x20)
#define MISC_GPIOA_15_0_PULL_CTRL_REG MISC_MEM_MAP(0x24)
#define MISC_GPIOA_16_31_PULL_CTRL_REG MISC_MEM_MAP(0x28)
#define MISC_GPIOB_15_0_PULL_CTRL_REG MISC_MEM_MAP(0x2C)
#define MISC_GPIOB_16_31_PULL_CTRL_REG MISC_MEM_MAP(0x30)
#define MISC_IO_PULL_CTRL_REG MISC_MEM_MAP(0x34)
#define MISC_E_FUSE_31_0_REG MISC_MEM_MAP(0x40)
#define MISC_E_FUSE_63_32_REG MISC_MEM_MAP(0x44)
#define MISC_E_FUSE_95_64_REG MISC_MEM_MAP(0x48)
#define MISC_E_FUSE_127_96_REG MISC_MEM_MAP(0x4C)
#define MISC_SOFTWARE_TEST_1_REG MISC_MEM_MAP(0x50)
#define MISC_SOFTWARE_TEST_2_REG MISC_MEM_MAP(0x54)
#define MISC_SATA_POWER_MODE MISC_MEM_MAP(0x310)
#define MISC_USB_CFG_REG MISC_MEM_MAP(0x800)
#define MISC_USB_STS_REG MISC_MEM_MAP(0x804)
#define MISC_USBPHY00_CFG_REG MISC_MEM_MAP(0x808)
#define MISC_USBPHY01_CFG_REG MISC_MEM_MAP(0x80c)
#define MISC_USBPHY10_CFG_REG MISC_MEM_MAP(0x810)
#define MISC_USBPHY11_CFG_REG MISC_MEM_MAP(0x814)
#define MISC_PCIEPHY_CMCTL(x) MISC_MEM_MAP(0x900 + (x) * 0x004)
#define MISC_PCIEPHY_CTL(x) MISC_MEM_MAP(0x940 + (x) * 0x100)
...
...
@@ -300,21 +299,21 @@
/*
* Power management and clock control
*/
#define PMU_
REG_VALUE(offset) (*((volatile unsigned int *)(CNS3XXX_PM_BASE_VIRT + (offset))
))
#define PM_CLK_GATE_REG PMU_
REG_VALUE
(0x000)
#define PM_SOFT_RST_REG PMU_
REG_VALUE
(0x004)
#define PM_HS_CFG_REG PMU_
REG_VALUE
(0x008)
#define PM_CACTIVE_STA_REG PMU_
REG_VALUE
(0x00C)
#define PM_PWR_STA_REG PMU_
REG_VALUE
(0x010)
#define PM_CLK_CTRL_REG PMU_
REG_VALUE
(0x014)
#define PM_PLL_LCD_I2S_CTRL_REG PMU_
REG_VALUE
(0x018)
#define PM_PLL_HM_PD_CTRL_REG PMU_
REG_VALUE
(0x01C)
#define PM_REGULAT_CTRL_REG PMU_
REG_VALUE
(0x020)
#define PM_WDT_CTRL_REG PMU_
REG_VALUE
(0x024)
#define PM_WU_CTRL0_REG PMU_
REG_VALUE
(0x028)
#define PM_WU_CTRL1_REG PMU_
REG_VALUE
(0x02C)
#define PM_CSR_REG PMU_
REG_VALUE
(0x030)
#define PMU_
MEM_MAP(offs) (void __iomem *)(CNS3XXX_PM_BASE_VIRT + (offs
))
#define PM_CLK_GATE_REG PMU_
MEM_MAP
(0x000)
#define PM_SOFT_RST_REG PMU_
MEM_MAP
(0x004)
#define PM_HS_CFG_REG PMU_
MEM_MAP
(0x008)
#define PM_CACTIVE_STA_REG PMU_
MEM_MAP
(0x00C)
#define PM_PWR_STA_REG PMU_
MEM_MAP
(0x010)
#define PM_CLK_CTRL_REG PMU_
MEM_MAP
(0x014)
#define PM_PLL_LCD_I2S_CTRL_REG PMU_
MEM_MAP
(0x018)
#define PM_PLL_HM_PD_CTRL_REG PMU_
MEM_MAP
(0x01C)
#define PM_REGULAT_CTRL_REG PMU_
MEM_MAP
(0x020)
#define PM_WDT_CTRL_REG PMU_
MEM_MAP
(0x024)
#define PM_WU_CTRL0_REG PMU_
MEM_MAP
(0x028)
#define PM_WU_CTRL1_REG PMU_
MEM_MAP
(0x02C)
#define PM_CSR_REG PMU_
MEM_MAP
(0x030)
/* PM_CLK_GATE_REG */
#define PM_CLK_GATE_REG_OFFSET_SDIO (25)
...
...
arch/arm/mach-cns3xxx/pcie.c
0 → 100644
View file @
cb86ae95
This diff is collapsed.
Click to expand it.
arch/arm/mach-cns3xxx/pm.c
View file @
cb86ae95
...
...
@@ -6,18 +6,25 @@
* published by the Free Software Foundation.
*/
#include <linux/io.h>
#include <linux/delay.h>
#include <mach/system.h>
#include <mach/cns3xxx.h>
void
cns3xxx_pwr_clk_en
(
unsigned
int
block
)
{
PM_CLK_GATE_REG
|=
(
block
&
PM_CLK_GATE_REG_MASK
);
u32
reg
=
__raw_readl
(
PM_CLK_GATE_REG
);
reg
|=
(
block
&
PM_CLK_GATE_REG_MASK
);
__raw_writel
(
reg
,
PM_CLK_GATE_REG
);
}
void
cns3xxx_pwr_power_up
(
unsigned
int
block
)
{
PM_PLL_HM_PD_CTRL_REG
&=
~
(
block
&
CNS3XXX_PWR_PLL_ALL
);
u32
reg
=
__raw_readl
(
PM_PLL_HM_PD_CTRL_REG
);
reg
&=
~
(
block
&
CNS3XXX_PWR_PLL_ALL
);
__raw_writel
(
reg
,
PM_PLL_HM_PD_CTRL_REG
);
/* Wait for 300us for the PLL output clock locked. */
udelay
(
300
);
...
...
@@ -25,22 +32,29 @@ void cns3xxx_pwr_power_up(unsigned int block)
void
cns3xxx_pwr_power_down
(
unsigned
int
block
)
{
u32
reg
=
__raw_readl
(
PM_PLL_HM_PD_CTRL_REG
);
/* write '1' to power down */
PM_PLL_HM_PD_CTRL_REG
|=
(
block
&
CNS3XXX_PWR_PLL_ALL
);
reg
|=
(
block
&
CNS3XXX_PWR_PLL_ALL
);
__raw_writel
(
reg
,
PM_PLL_HM_PD_CTRL_REG
);
};
static
void
cns3xxx_pwr_soft_rst_force
(
unsigned
int
block
)
{
u32
reg
=
__raw_readl
(
PM_SOFT_RST_REG
);
/*
* bit 0, 28, 29 => program low to reset,
* the other else program low and then high
*/
if
(
block
&
0x30000001
)
{
PM_SOFT_RST_REG
&=
~
(
block
&
PM_SOFT_RST_REG_MASK
);
reg
&=
~
(
block
&
PM_SOFT_RST_REG_MASK
);
}
else
{
PM_SOFT_RST_REG
&=
~
(
block
&
PM_SOFT_RST_REG_MASK
);
PM_SOFT_RST_REG
|=
(
block
&
PM_SOFT_RST_REG_MASK
);
reg
&=
~
(
block
&
PM_SOFT_RST_REG_MASK
);
reg
|=
(
block
&
PM_SOFT_RST_REG_MASK
);
}
__raw_writel
(
reg
,
PM_SOFT_RST_REG
);
}
void
cns3xxx_pwr_soft_rst
(
unsigned
int
block
)
...
...
@@ -73,12 +87,13 @@ void arch_reset(char mode, const char *cmd)
*/
int
cns3xxx_cpu_clock
(
void
)
{
u32
reg
=
__raw_readl
(
PM_CLK_CTRL_REG
);
int
cpu
;
int
cpu_sel
;
int
div_sel
;
cpu_sel
=
(
PM_CLK_CTRL_REG
>>
PM_CLK_CTRL_REG_OFFSET_PLL_CPU_SEL
)
&
0xf
;
div_sel
=
(
PM_CLK_CTRL_REG
>>
PM_CLK_CTRL_REG_OFFSET_CPU_CLK_DIV
)
&
0x3
;
cpu_sel
=
(
reg
>>
PM_CLK_CTRL_REG_OFFSET_PLL_CPU_SEL
)
&
0xf
;
div_sel
=
(
reg
>>
PM_CLK_CTRL_REG_OFFSET_CPU_CLK_DIV
)
&
0x3
;
cpu
=
(
300
+
((
cpu_sel
/
3
)
*
100
)
+
((
cpu_sel
%
3
)
*
33
))
>>
div_sel
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment