mirror of https://gitee.com/openkylin/linux.git
Merge branch 'sh/hwblk' into sh-latest
This commit is contained in:
commit
9d14070f65
|
@ -249,9 +249,6 @@ static struct platform_device lcdc_device = {
|
|||
.dev = {
|
||||
.platform_data = &lcdc_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_LCDC,
|
||||
},
|
||||
};
|
||||
|
||||
static void camera_power(int val)
|
||||
|
@ -424,9 +421,6 @@ static struct platform_device ceu_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh_mobile_ceu_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_CEU,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource sdhi0_cn3_resources[] = {
|
||||
|
@ -454,9 +448,6 @@ static struct platform_device sdhi0_cn3_device = {
|
|||
.dev = {
|
||||
.platform_data = &sdhi0_cn3_data,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SDHI0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource sdhi1_cn7_resources[] = {
|
||||
|
@ -484,9 +475,6 @@ static struct platform_device sdhi1_cn7_device = {
|
|||
.dev = {
|
||||
.platform_data = &sdhi1_cn7_data,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SDHI1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
|
||||
|
|
|
@ -156,9 +156,6 @@ static struct platform_device sh_eth_device = {
|
|||
},
|
||||
.num_resources = ARRAY_SIZE(sh_eth_resources),
|
||||
.resource = sh_eth_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_ETHER,
|
||||
},
|
||||
};
|
||||
|
||||
/* USB0 host */
|
||||
|
@ -278,9 +275,6 @@ static struct platform_device usbhs_device = {
|
|||
},
|
||||
.num_resources = ARRAY_SIZE(usbhs_resources),
|
||||
.resource = usbhs_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_USB1,
|
||||
},
|
||||
};
|
||||
|
||||
/* LCDC */
|
||||
|
@ -366,9 +360,6 @@ static struct platform_device lcdc_device = {
|
|||
.dev = {
|
||||
.platform_data = &lcdc_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_LCDC,
|
||||
},
|
||||
};
|
||||
|
||||
/* CEU0 */
|
||||
|
@ -400,9 +391,6 @@ static struct platform_device ceu0_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh_mobile_ceu0_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_CEU0,
|
||||
},
|
||||
};
|
||||
|
||||
/* CEU1 */
|
||||
|
@ -434,9 +422,6 @@ static struct platform_device ceu1_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh_mobile_ceu1_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_CEU1,
|
||||
},
|
||||
};
|
||||
|
||||
/* I2C device */
|
||||
|
@ -491,9 +476,6 @@ static struct platform_device keysc_device = {
|
|||
.dev = {
|
||||
.platform_data = &keysc_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_KEYSC,
|
||||
},
|
||||
};
|
||||
|
||||
/* TouchScreen */
|
||||
|
@ -568,9 +550,6 @@ static struct platform_device sdhi0_device = {
|
|||
.dev = {
|
||||
.platform_data = &sdhi0_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SDHI0,
|
||||
},
|
||||
};
|
||||
|
||||
#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
|
||||
|
@ -608,9 +587,6 @@ static struct platform_device sdhi1_device = {
|
|||
.dev = {
|
||||
.platform_data = &sdhi1_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SDHI1,
|
||||
},
|
||||
};
|
||||
#endif /* CONFIG_MMC_SH_MMCIF */
|
||||
|
||||
|
@ -676,9 +652,6 @@ static struct platform_device msiof0_device = {
|
|||
},
|
||||
.num_resources = ARRAY_SIZE(msiof0_resources),
|
||||
.resource = msiof0_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_MSIOF0,
|
||||
},
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -818,9 +791,6 @@ static struct platform_device fsi_device = {
|
|||
.dev = {
|
||||
.platform_data = &fsi_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SPU, /* FSI needs SPU hwblk */
|
||||
},
|
||||
};
|
||||
|
||||
/* IrDA */
|
||||
|
@ -882,9 +852,6 @@ static struct platform_device vou_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh_vou_pdata,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_VOU,
|
||||
},
|
||||
};
|
||||
|
||||
#if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE)
|
||||
|
@ -936,9 +903,6 @@ static struct platform_device sh_mmcif_device = {
|
|||
},
|
||||
.num_resources = ARRAY_SIZE(sh_mmcif_resources),
|
||||
.resource = sh_mmcif_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_MMC,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -122,9 +122,6 @@ static struct platform_device kfr2r09_sh_keysc_device = {
|
|||
.dev = {
|
||||
.platform_data = &kfr2r09_sh_keysc_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_KEYSC,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct fb_videomode kfr2r09_lcdc_modes[] = {
|
||||
|
@ -191,9 +188,6 @@ static struct platform_device kfr2r09_sh_lcdc_device = {
|
|||
.dev = {
|
||||
.platform_data = &kfr2r09_sh_lcdc_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_LCDC,
|
||||
},
|
||||
};
|
||||
|
||||
static struct r8a66597_platdata kfr2r09_usb0_gadget_data = {
|
||||
|
@ -254,9 +248,6 @@ static struct platform_device kfr2r09_ceu_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh_mobile_ceu_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_CEU0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct i2c_board_info kfr2r09_i2c_camera = {
|
||||
|
@ -377,9 +368,6 @@ static struct platform_device kfr2r09_sh_sdhi0_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh7724_sdhi0_data,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SDHI0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device *kfr2r09_devices[] __initdata = {
|
||||
|
|
|
@ -99,9 +99,6 @@ static struct platform_device sh_keysc_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh_keysc_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_KEYSC,
|
||||
},
|
||||
};
|
||||
|
||||
static struct mtd_partition migor_nor_flash_partitions[] =
|
||||
|
@ -300,9 +297,6 @@ static struct platform_device migor_lcdc_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh_mobile_lcdc_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_LCDC,
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk *camera_clk;
|
||||
|
@ -390,9 +384,6 @@ static struct platform_device migor_ceu_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh_mobile_ceu_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_CEU,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource sdhi_cn9_resources[] = {
|
||||
|
@ -421,9 +412,6 @@ static struct platform_device sdhi_cn9_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh7724_sdhi_data,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SDHI,
|
||||
},
|
||||
};
|
||||
|
||||
static struct i2c_board_info migor_i2c_devices[] = {
|
||||
|
|
|
@ -127,9 +127,6 @@ static struct platform_device sh_keysc_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh_keysc_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_KEYSC,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device *se7722_devices[] __initdata = {
|
||||
|
|
|
@ -210,9 +210,6 @@ static struct platform_device lcdc_device = {
|
|||
.dev = {
|
||||
.platform_data = &lcdc_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_LCDC,
|
||||
},
|
||||
};
|
||||
|
||||
/* CEU0 */
|
||||
|
@ -244,9 +241,6 @@ static struct platform_device ceu0_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh_mobile_ceu0_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_CEU0,
|
||||
},
|
||||
};
|
||||
|
||||
/* CEU1 */
|
||||
|
@ -278,9 +272,6 @@ static struct platform_device ceu1_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh_mobile_ceu1_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_CEU1,
|
||||
},
|
||||
};
|
||||
|
||||
/* FSI */
|
||||
|
@ -310,9 +301,6 @@ static struct platform_device fsi_device = {
|
|||
.dev = {
|
||||
.platform_data = &fsi_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SPU, /* FSI needs SPU hwblk */
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device fsi_ak4642_device = {
|
||||
|
@ -355,9 +343,6 @@ static struct platform_device keysc_device = {
|
|||
.dev = {
|
||||
.platform_data = &keysc_info,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_KEYSC,
|
||||
},
|
||||
};
|
||||
|
||||
/* SH Eth */
|
||||
|
@ -386,9 +371,6 @@ static struct platform_device sh_eth_device = {
|
|||
},
|
||||
.num_resources = ARRAY_SIZE(sh_eth_resources),
|
||||
.resource = sh_eth_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_ETHER,
|
||||
},
|
||||
};
|
||||
|
||||
static struct r8a66597_platdata sh7724_usb0_host_data = {
|
||||
|
@ -418,9 +400,6 @@ static struct platform_device sh7724_usb0_host_device = {
|
|||
},
|
||||
.num_resources = ARRAY_SIZE(sh7724_usb0_host_resources),
|
||||
.resource = sh7724_usb0_host_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_USB0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct r8a66597_platdata sh7724_usb1_gadget_data = {
|
||||
|
@ -479,9 +458,6 @@ static struct platform_device sdhi0_cn7_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh7724_sdhi0_data,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SDHI0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource sdhi1_cn8_resources[] = {
|
||||
|
@ -511,9 +487,6 @@ static struct platform_device sdhi1_cn8_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh7724_sdhi1_data,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SDHI1,
|
||||
},
|
||||
};
|
||||
|
||||
/* IrDA */
|
||||
|
@ -576,9 +549,6 @@ static struct platform_device vou_device = {
|
|||
.dev = {
|
||||
.platform_data = &sh_vou_pdata,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_VOU,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device *ms7724se_devices[] __initdata = {
|
||||
|
|
|
@ -15,5 +15,4 @@ int platform_resource_setup_memory(struct platform_device *pdev,
|
|||
void plat_early_device_setup(void);
|
||||
|
||||
struct pdev_archdata {
|
||||
int hwblk_id;
|
||||
};
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
#ifndef __ASM_SH_HWBLK_H
|
||||
#define __ASM_SH_HWBLK_H
|
||||
|
||||
#include <asm/clock.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#define HWBLK_CNT_USAGE 0
|
||||
#define HWBLK_CNT_IDLE 1
|
||||
#define HWBLK_CNT_DEVICES 2
|
||||
#define HWBLK_CNT_NR 3
|
||||
|
||||
#define HWBLK_AREA_FLAG_PARENT (1 << 0) /* valid parent */
|
||||
|
||||
#define HWBLK_AREA(_flags, _parent) \
|
||||
{ \
|
||||
.flags = _flags, \
|
||||
.parent = _parent, \
|
||||
}
|
||||
|
||||
struct hwblk_area {
|
||||
int cnt[HWBLK_CNT_NR];
|
||||
unsigned char parent;
|
||||
unsigned char flags;
|
||||
};
|
||||
|
||||
#define HWBLK(_mstp, _bit, _area) \
|
||||
{ \
|
||||
.mstp = (void __iomem *)_mstp, \
|
||||
.bit = _bit, \
|
||||
.area = _area, \
|
||||
}
|
||||
|
||||
struct hwblk {
|
||||
void __iomem *mstp;
|
||||
unsigned char bit;
|
||||
unsigned char area;
|
||||
int cnt[HWBLK_CNT_NR];
|
||||
};
|
||||
|
||||
struct hwblk_info {
|
||||
struct hwblk_area *areas;
|
||||
int nr_areas;
|
||||
struct hwblk *hwblks;
|
||||
int nr_hwblks;
|
||||
};
|
||||
|
||||
#if !defined(CONFIG_CPU_SUBTYPE_SH7722) && \
|
||||
!defined(CONFIG_CPU_SUBTYPE_SH7723) && \
|
||||
!defined(CONFIG_CPU_SUBTYPE_SH7724)
|
||||
/* Should be defined by processor-specific code */
|
||||
int arch_hwblk_init(void);
|
||||
int arch_hwblk_sleep_mode(void);
|
||||
|
||||
int hwblk_register(struct hwblk_info *info);
|
||||
int hwblk_init(void);
|
||||
|
||||
void hwblk_enable(struct hwblk_info *info, int hwblk);
|
||||
void hwblk_disable(struct hwblk_info *info, int hwblk);
|
||||
|
||||
void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int cnt);
|
||||
void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt);
|
||||
|
||||
/* allow clocks to enable and disable hardware blocks */
|
||||
#define SH_HWBLK_CLK(_hwblk, _parent, _flags) \
|
||||
[_hwblk] = { \
|
||||
.parent = _parent, \
|
||||
.arch_flags = _hwblk, \
|
||||
.flags = _flags, \
|
||||
}
|
||||
|
||||
int sh_hwblk_clk_register(struct clk *clks, int nr);
|
||||
#else
|
||||
#define hwblk_init() 0
|
||||
#endif
|
||||
#endif /* __ASM_SH_HWBLK_H */
|
|
@ -222,14 +222,11 @@ enum {
|
|||
};
|
||||
|
||||
enum {
|
||||
HWBLK_UNKNOWN = 0,
|
||||
HWBLK_TLB, HWBLK_IC, HWBLK_OC, HWBLK_URAM, HWBLK_XYMEM,
|
||||
HWBLK_INTC, HWBLK_DMAC, HWBLK_SHYWAY, HWBLK_HUDI,
|
||||
HWBLK_UBC, HWBLK_TMU, HWBLK_CMT, HWBLK_RWDT, HWBLK_FLCTL,
|
||||
HWBLK_SCIF0, HWBLK_SCIF1, HWBLK_SCIF2, HWBLK_SIO,
|
||||
HWBLK_SIOF0, HWBLK_SIOF1, HWBLK_IIC, HWBLK_RTC,
|
||||
HWBLK_TPU, HWBLK_IRDA, HWBLK_SDHI, HWBLK_SIM, HWBLK_KEYSC,
|
||||
HWBLK_TSIF, HWBLK_USBF, HWBLK_2DG, HWBLK_SIU, HWBLK_VOU,
|
||||
HWBLK_URAM, HWBLK_XYMEM,
|
||||
HWBLK_TMU, HWBLK_CMT, HWBLK_RWDT, HWBLK_FLCTL,
|
||||
HWBLK_SCIF0, HWBLK_SCIF1, HWBLK_SCIF2, HWBLK_IIC, HWBLK_RTC,
|
||||
HWBLK_SDHI, HWBLK_KEYSC,
|
||||
HWBLK_USBF, HWBLK_2DG, HWBLK_SIU, HWBLK_VOU,
|
||||
HWBLK_JPU, HWBLK_BEU, HWBLK_CEU, HWBLK_VEU, HWBLK_VPU,
|
||||
HWBLK_LCDC,
|
||||
HWBLK_NR,
|
||||
|
|
|
@ -266,10 +266,9 @@ enum {
|
|||
};
|
||||
|
||||
enum {
|
||||
HWBLK_UNKNOWN = 0,
|
||||
HWBLK_TLB, HWBLK_IC, HWBLK_OC, HWBLK_L2C, HWBLK_ILMEM, HWBLK_FPU,
|
||||
HWBLK_INTC, HWBLK_DMAC0, HWBLK_SHYWAY,
|
||||
HWBLK_HUDI, HWBLK_DBG, HWBLK_UBC, HWBLK_SUBC,
|
||||
HWBLK_HUDI, HWBLK_UBC,
|
||||
HWBLK_TMU0, HWBLK_CMT, HWBLK_RWDT, HWBLK_DMAC1, HWBLK_TMU1,
|
||||
HWBLK_FLCTL,
|
||||
HWBLK_SCIF0, HWBLK_SCIF1, HWBLK_SCIF2,
|
||||
|
|
|
@ -268,10 +268,9 @@ enum {
|
|||
};
|
||||
|
||||
enum {
|
||||
HWBLK_UNKNOWN = 0,
|
||||
HWBLK_TLB, HWBLK_IC, HWBLK_OC, HWBLK_RSMEM, HWBLK_ILMEM, HWBLK_L2C,
|
||||
HWBLK_FPU, HWBLK_INTC, HWBLK_DMAC0, HWBLK_SHYWAY,
|
||||
HWBLK_HUDI, HWBLK_DBG, HWBLK_UBC,
|
||||
HWBLK_HUDI, HWBLK_UBC,
|
||||
HWBLK_TMU0, HWBLK_CMT, HWBLK_RWDT, HWBLK_DMAC1, HWBLK_TMU1,
|
||||
HWBLK_SCIF0, HWBLK_SCIF1, HWBLK_SCIF2, HWBLK_SCIF3,
|
||||
HWBLK_SCIF4, HWBLK_SCIF5, HWBLK_MSIOF0, HWBLK_MSIOF1,
|
||||
|
|
|
@ -19,6 +19,3 @@ obj-$(CONFIG_SH_ADC) += adc.o
|
|||
obj-$(CONFIG_SH_CLK_CPG_LEGACY) += clock-cpg.o
|
||||
|
||||
obj-y += irq/ init.o clock.o fpu.o proc.o
|
||||
ifneq ($(CONFIG_CPU_SUBTYPE_SH7722)$(CONFIG_CPU_SUBTYPE_SH7723)$(CONFIG_CPU_SUBTYPE_SH7724),y)
|
||||
obj-y += hwblk.o
|
||||
endif
|
||||
|
|
|
@ -1,159 +0,0 @@
|
|||
#include <linux/clk.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <asm/suspend.h>
|
||||
#include <asm/hwblk.h>
|
||||
#include <asm/clock.h>
|
||||
|
||||
static DEFINE_SPINLOCK(hwblk_lock);
|
||||
|
||||
static void hwblk_area_mod_cnt(struct hwblk_info *info,
|
||||
int area, int counter, int value, int goal)
|
||||
{
|
||||
struct hwblk_area *hap = info->areas + area;
|
||||
|
||||
hap->cnt[counter] += value;
|
||||
|
||||
if (hap->cnt[counter] != goal)
|
||||
return;
|
||||
|
||||
if (hap->flags & HWBLK_AREA_FLAG_PARENT)
|
||||
hwblk_area_mod_cnt(info, hap->parent, counter, value, goal);
|
||||
}
|
||||
|
||||
|
||||
static int __hwblk_mod_cnt(struct hwblk_info *info, int hwblk,
|
||||
int counter, int value, int goal)
|
||||
{
|
||||
struct hwblk *hp = info->hwblks + hwblk;
|
||||
|
||||
hp->cnt[counter] += value;
|
||||
if (hp->cnt[counter] == goal)
|
||||
hwblk_area_mod_cnt(info, hp->area, counter, value, goal);
|
||||
|
||||
return hp->cnt[counter];
|
||||
}
|
||||
|
||||
static void hwblk_mod_cnt(struct hwblk_info *info, int hwblk,
|
||||
int counter, int value, int goal)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&hwblk_lock, flags);
|
||||
__hwblk_mod_cnt(info, hwblk, counter, value, goal);
|
||||
spin_unlock_irqrestore(&hwblk_lock, flags);
|
||||
}
|
||||
|
||||
void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int counter)
|
||||
{
|
||||
hwblk_mod_cnt(info, hwblk, counter, 1, 1);
|
||||
}
|
||||
|
||||
void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int counter)
|
||||
{
|
||||
hwblk_mod_cnt(info, hwblk, counter, -1, 0);
|
||||
}
|
||||
|
||||
void hwblk_enable(struct hwblk_info *info, int hwblk)
|
||||
{
|
||||
struct hwblk *hp = info->hwblks + hwblk;
|
||||
unsigned long tmp;
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
spin_lock_irqsave(&hwblk_lock, flags);
|
||||
|
||||
ret = __hwblk_mod_cnt(info, hwblk, HWBLK_CNT_USAGE, 1, 1);
|
||||
if (ret == 1) {
|
||||
tmp = __raw_readl(hp->mstp);
|
||||
tmp &= ~(1 << hp->bit);
|
||||
__raw_writel(tmp, hp->mstp);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&hwblk_lock, flags);
|
||||
}
|
||||
|
||||
void hwblk_disable(struct hwblk_info *info, int hwblk)
|
||||
{
|
||||
struct hwblk *hp = info->hwblks + hwblk;
|
||||
unsigned long tmp;
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
spin_lock_irqsave(&hwblk_lock, flags);
|
||||
|
||||
ret = __hwblk_mod_cnt(info, hwblk, HWBLK_CNT_USAGE, -1, 0);
|
||||
if (ret == 0) {
|
||||
tmp = __raw_readl(hp->mstp);
|
||||
tmp |= 1 << hp->bit;
|
||||
__raw_writel(tmp, hp->mstp);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&hwblk_lock, flags);
|
||||
}
|
||||
|
||||
struct hwblk_info *hwblk_info;
|
||||
|
||||
int __init hwblk_register(struct hwblk_info *info)
|
||||
{
|
||||
hwblk_info = info;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __init __weak arch_hwblk_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __weak arch_hwblk_sleep_mode(void)
|
||||
{
|
||||
return SUSP_SH_SLEEP;
|
||||
}
|
||||
|
||||
int __init hwblk_init(void)
|
||||
{
|
||||
return arch_hwblk_init();
|
||||
}
|
||||
|
||||
/* allow clocks to enable and disable hardware blocks */
|
||||
static int sh_hwblk_clk_enable(struct clk *clk)
|
||||
{
|
||||
if (!hwblk_info)
|
||||
return -ENOENT;
|
||||
|
||||
hwblk_enable(hwblk_info, clk->arch_flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sh_hwblk_clk_disable(struct clk *clk)
|
||||
{
|
||||
if (hwblk_info)
|
||||
hwblk_disable(hwblk_info, clk->arch_flags);
|
||||
}
|
||||
|
||||
static struct clk_ops sh_hwblk_clk_ops = {
|
||||
.enable = sh_hwblk_clk_enable,
|
||||
.disable = sh_hwblk_clk_disable,
|
||||
.recalc = followparent_recalc,
|
||||
};
|
||||
|
||||
int __init sh_hwblk_clk_register(struct clk *clks, int nr)
|
||||
{
|
||||
struct clk *clkp;
|
||||
int ret = 0;
|
||||
int k;
|
||||
|
||||
for (k = 0; !ret && (k < nr); k++) {
|
||||
clkp = clks + k;
|
||||
|
||||
/* skip over clocks using hwblk 0 (HWBLK_UNKNOWN) */
|
||||
if (!clkp->arch_flags)
|
||||
continue;
|
||||
|
||||
clkp->ops = &sh_hwblk_clk_ops;
|
||||
ret |= clk_register(clkp);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -173,9 +173,6 @@ struct platform_device dma_device = {
|
|||
.dev = {
|
||||
.platform_data = &dma_platform_data,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_DMAC,
|
||||
},
|
||||
};
|
||||
|
||||
/* Serial */
|
||||
|
@ -264,9 +261,6 @@ static struct platform_device rtc_device = {
|
|||
.id = -1,
|
||||
.num_resources = ARRAY_SIZE(rtc_resources),
|
||||
.resource = rtc_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_RTC,
|
||||
},
|
||||
};
|
||||
|
||||
static struct m66592_platdata usbf_platdata = {
|
||||
|
@ -297,9 +291,6 @@ static struct platform_device usbf_device = {
|
|||
},
|
||||
.num_resources = ARRAY_SIZE(usbf_resources),
|
||||
.resource = usbf_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_USBF,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource iic_resources[] = {
|
||||
|
@ -321,9 +312,6 @@ static struct platform_device iic_device = {
|
|||
.id = 0, /* "i2c0" clock */
|
||||
.num_resources = ARRAY_SIZE(iic_resources),
|
||||
.resource = iic_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_IIC,
|
||||
},
|
||||
};
|
||||
|
||||
static struct uio_info vpu_platform_data = {
|
||||
|
@ -352,9 +340,6 @@ static struct platform_device vpu_device = {
|
|||
},
|
||||
.resource = vpu_resources,
|
||||
.num_resources = ARRAY_SIZE(vpu_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_VPU,
|
||||
},
|
||||
};
|
||||
|
||||
static struct uio_info veu_platform_data = {
|
||||
|
@ -383,9 +368,6 @@ static struct platform_device veu_device = {
|
|||
},
|
||||
.resource = veu_resources,
|
||||
.num_resources = ARRAY_SIZE(veu_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_VEU,
|
||||
},
|
||||
};
|
||||
|
||||
static struct uio_info jpu_platform_data = {
|
||||
|
@ -414,9 +396,6 @@ static struct platform_device jpu_device = {
|
|||
},
|
||||
.resource = jpu_resources,
|
||||
.num_resources = ARRAY_SIZE(jpu_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_JPU,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config cmt_platform_data = {
|
||||
|
@ -446,9 +425,6 @@ static struct platform_device cmt_device = {
|
|||
},
|
||||
.resource = cmt_resources,
|
||||
.num_resources = ARRAY_SIZE(cmt_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_CMT,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu0_platform_data = {
|
||||
|
@ -477,9 +453,6 @@ static struct platform_device tmu0_device = {
|
|||
},
|
||||
.resource = tmu0_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu0_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu1_platform_data = {
|
||||
|
@ -508,9 +481,6 @@ static struct platform_device tmu1_device = {
|
|||
},
|
||||
.resource = tmu1_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu1_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu2_platform_data = {
|
||||
|
@ -538,9 +508,6 @@ static struct platform_device tmu2_device = {
|
|||
},
|
||||
.resource = tmu2_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu2_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU,
|
||||
},
|
||||
};
|
||||
|
||||
static struct siu_platform siu_platform_data = {
|
||||
|
@ -571,9 +538,6 @@ static struct platform_device siu_device = {
|
|||
},
|
||||
.resource = siu_resources,
|
||||
.num_resources = ARRAY_SIZE(siu_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SIU,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device *sh7722_devices[] __initdata = {
|
||||
|
|
|
@ -158,9 +158,6 @@ static struct platform_device vpu_device = {
|
|||
},
|
||||
.resource = vpu_resources,
|
||||
.num_resources = ARRAY_SIZE(vpu_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_VPU,
|
||||
},
|
||||
};
|
||||
|
||||
static struct uio_info veu0_platform_data = {
|
||||
|
@ -189,9 +186,6 @@ static struct platform_device veu0_device = {
|
|||
},
|
||||
.resource = veu0_resources,
|
||||
.num_resources = ARRAY_SIZE(veu0_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_VEU2H0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct uio_info veu1_platform_data = {
|
||||
|
@ -220,9 +214,6 @@ static struct platform_device veu1_device = {
|
|||
},
|
||||
.resource = veu1_resources,
|
||||
.num_resources = ARRAY_SIZE(veu1_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_VEU2H1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config cmt_platform_data = {
|
||||
|
@ -252,9 +243,6 @@ static struct platform_device cmt_device = {
|
|||
},
|
||||
.resource = cmt_resources,
|
||||
.num_resources = ARRAY_SIZE(cmt_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_CMT,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu0_platform_data = {
|
||||
|
@ -283,9 +271,6 @@ static struct platform_device tmu0_device = {
|
|||
},
|
||||
.resource = tmu0_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu0_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu1_platform_data = {
|
||||
|
@ -314,9 +299,6 @@ static struct platform_device tmu1_device = {
|
|||
},
|
||||
.resource = tmu1_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu1_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu2_platform_data = {
|
||||
|
@ -344,9 +326,6 @@ static struct platform_device tmu2_device = {
|
|||
},
|
||||
.resource = tmu2_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu2_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu3_platform_data = {
|
||||
|
@ -374,9 +353,6 @@ static struct platform_device tmu3_device = {
|
|||
},
|
||||
.resource = tmu3_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu3_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu4_platform_data = {
|
||||
|
@ -404,9 +380,6 @@ static struct platform_device tmu4_device = {
|
|||
},
|
||||
.resource = tmu4_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu4_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu5_platform_data = {
|
||||
|
@ -434,9 +407,6 @@ static struct platform_device tmu5_device = {
|
|||
},
|
||||
.resource = tmu5_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu5_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource rtc_resources[] = {
|
||||
|
@ -467,9 +437,6 @@ static struct platform_device rtc_device = {
|
|||
.id = -1,
|
||||
.num_resources = ARRAY_SIZE(rtc_resources),
|
||||
.resource = rtc_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_RTC,
|
||||
},
|
||||
};
|
||||
|
||||
static struct r8a66597_platdata r8a66597_data = {
|
||||
|
@ -499,9 +466,6 @@ static struct platform_device sh7723_usb_host_device = {
|
|||
},
|
||||
.num_resources = ARRAY_SIZE(sh7723_usb_host_resources),
|
||||
.resource = sh7723_usb_host_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_USB,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource iic_resources[] = {
|
||||
|
@ -523,9 +487,6 @@ static struct platform_device iic_device = {
|
|||
.id = 0, /* "i2c0" clock */
|
||||
.num_resources = ARRAY_SIZE(iic_resources),
|
||||
.resource = iic_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_IIC,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device *sh7723_devices[] __initdata = {
|
||||
|
|
|
@ -275,9 +275,6 @@ static struct platform_device dma0_device = {
|
|||
.dev = {
|
||||
.platform_data = &dma_platform_data,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_DMAC0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device dma1_device = {
|
||||
|
@ -288,9 +285,6 @@ static struct platform_device dma1_device = {
|
|||
.dev = {
|
||||
.platform_data = &dma_platform_data,
|
||||
},
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_DMAC1,
|
||||
},
|
||||
};
|
||||
|
||||
/* Serial */
|
||||
|
@ -434,9 +428,6 @@ static struct platform_device rtc_device = {
|
|||
.id = -1,
|
||||
.num_resources = ARRAY_SIZE(rtc_resources),
|
||||
.resource = rtc_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_RTC,
|
||||
},
|
||||
};
|
||||
|
||||
/* I2C0 */
|
||||
|
@ -459,9 +450,6 @@ static struct platform_device iic0_device = {
|
|||
.id = 0, /* "i2c0" clock */
|
||||
.num_resources = ARRAY_SIZE(iic0_resources),
|
||||
.resource = iic0_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_IIC0,
|
||||
},
|
||||
};
|
||||
|
||||
/* I2C1 */
|
||||
|
@ -484,9 +472,6 @@ static struct platform_device iic1_device = {
|
|||
.id = 1, /* "i2c1" clock */
|
||||
.num_resources = ARRAY_SIZE(iic1_resources),
|
||||
.resource = iic1_resources,
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_IIC1,
|
||||
},
|
||||
};
|
||||
|
||||
/* VPU */
|
||||
|
@ -516,9 +501,6 @@ static struct platform_device vpu_device = {
|
|||
},
|
||||
.resource = vpu_resources,
|
||||
.num_resources = ARRAY_SIZE(vpu_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_VPU,
|
||||
},
|
||||
};
|
||||
|
||||
/* VEU0 */
|
||||
|
@ -548,9 +530,6 @@ static struct platform_device veu0_device = {
|
|||
},
|
||||
.resource = veu0_resources,
|
||||
.num_resources = ARRAY_SIZE(veu0_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_VEU0,
|
||||
},
|
||||
};
|
||||
|
||||
/* VEU1 */
|
||||
|
@ -580,9 +559,6 @@ static struct platform_device veu1_device = {
|
|||
},
|
||||
.resource = veu1_resources,
|
||||
.num_resources = ARRAY_SIZE(veu1_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_VEU1,
|
||||
},
|
||||
};
|
||||
|
||||
/* BEU0 */
|
||||
|
@ -612,9 +588,6 @@ static struct platform_device beu0_device = {
|
|||
},
|
||||
.resource = beu0_resources,
|
||||
.num_resources = ARRAY_SIZE(beu0_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_BEU0,
|
||||
},
|
||||
};
|
||||
|
||||
/* BEU1 */
|
||||
|
@ -644,9 +617,6 @@ static struct platform_device beu1_device = {
|
|||
},
|
||||
.resource = beu1_resources,
|
||||
.num_resources = ARRAY_SIZE(beu1_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_BEU1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config cmt_platform_data = {
|
||||
|
@ -676,9 +646,6 @@ static struct platform_device cmt_device = {
|
|||
},
|
||||
.resource = cmt_resources,
|
||||
.num_resources = ARRAY_SIZE(cmt_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_CMT,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu0_platform_data = {
|
||||
|
@ -707,9 +674,6 @@ static struct platform_device tmu0_device = {
|
|||
},
|
||||
.resource = tmu0_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu0_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu1_platform_data = {
|
||||
|
@ -738,9 +702,6 @@ static struct platform_device tmu1_device = {
|
|||
},
|
||||
.resource = tmu1_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu1_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu2_platform_data = {
|
||||
|
@ -768,9 +729,6 @@ static struct platform_device tmu2_device = {
|
|||
},
|
||||
.resource = tmu2_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu2_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU0,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
@ -799,9 +757,6 @@ static struct platform_device tmu3_device = {
|
|||
},
|
||||
.resource = tmu3_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu3_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu4_platform_data = {
|
||||
|
@ -829,9 +784,6 @@ static struct platform_device tmu4_device = {
|
|||
},
|
||||
.resource = tmu4_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu4_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct sh_timer_config tmu5_platform_data = {
|
||||
|
@ -859,9 +811,6 @@ static struct platform_device tmu5_device = {
|
|||
},
|
||||
.resource = tmu5_resources,
|
||||
.num_resources = ARRAY_SIZE(tmu5_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_TMU1,
|
||||
},
|
||||
};
|
||||
|
||||
/* JPU */
|
||||
|
@ -891,9 +840,6 @@ static struct platform_device jpu_device = {
|
|||
},
|
||||
.resource = jpu_resources,
|
||||
.num_resources = ARRAY_SIZE(jpu_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_JPU,
|
||||
},
|
||||
};
|
||||
|
||||
/* SPU2DSP0 */
|
||||
|
@ -923,9 +869,6 @@ static struct platform_device spu0_device = {
|
|||
},
|
||||
.resource = spu0_resources,
|
||||
.num_resources = ARRAY_SIZE(spu0_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SPU,
|
||||
},
|
||||
};
|
||||
|
||||
/* SPU2DSP1 */
|
||||
|
@ -955,9 +898,6 @@ static struct platform_device spu1_device = {
|
|||
},
|
||||
.resource = spu1_resources,
|
||||
.num_resources = ARRAY_SIZE(spu1_resources),
|
||||
.archdata = {
|
||||
.hwblk_id = HWBLK_SPU,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device *sh7724_devices[] __initdata = {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <linux/export.h>
|
||||
#include <asm/suspend.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/hwblk.h>
|
||||
|
||||
static unsigned long cpuidle_mode[] = {
|
||||
SUSP_SH_SLEEP, /* regular sleep mode */
|
||||
|
@ -29,7 +28,7 @@ static int cpuidle_sleep_enter(struct cpuidle_device *dev,
|
|||
struct cpuidle_driver *drv,
|
||||
int index)
|
||||
{
|
||||
unsigned long allowed_mode = arch_hwblk_sleep_mode();
|
||||
unsigned long allowed_mode = SUSP_SH_SLEEP;
|
||||
ktime_t before, after;
|
||||
int requested_state = index;
|
||||
int allowed_state;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <linux/smp.h>
|
||||
#include <linux/rtc.h>
|
||||
#include <asm/clock.h>
|
||||
#include <asm/hwblk.h>
|
||||
#include <asm/rtc.h>
|
||||
|
||||
/* Dummy RTC ops */
|
||||
|
@ -110,7 +109,6 @@ void __init time_init(void)
|
|||
if (board_time_init)
|
||||
board_time_init();
|
||||
|
||||
hwblk_init();
|
||||
clk_init();
|
||||
|
||||
late_time_init = sh_late_time_init;
|
||||
|
|
Loading…
Reference in New Issue