diff options
author | Ian Wisbon <ian.wisbon@timesys.com> | 2011-02-14 16:41:03 -0500 |
---|---|---|
committer | Ian Wisbon <ian.wisbon@timesys.com> | 2011-02-14 16:41:03 -0500 |
commit | 8a83780a187ba1961380814eaf9c503043345d12 (patch) | |
tree | 80f5d89cca49330e137688c72fb10c9f42dc5663 /arch/arm/mach-mx28 | |
parent | 14a4057959f8ee0a2249eb2abd64fd6b1f571d98 (diff) |
Digi Release Code from del-5.6/main2.6.31-digi-201102141643
Diffstat (limited to 'arch/arm/mach-mx28')
-rw-r--r-- | arch/arm/mach-mx28/bus_freq.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-mx28/device.c | 100 | ||||
-rw-r--r-- | arch/arm/mach-mx28/emi_settings.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-mx28/mx28evk.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-mx28/mx28evk.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-mx28/mx28evk_pins.c | 233 | ||||
-rw-r--r-- | arch/arm/mach-mx28/pm.c | 52 | ||||
-rw-r--r-- | arch/arm/mach-mx28/sleep.S | 195 | ||||
-rw-r--r-- | arch/arm/mach-mx28/usb_dr.c | 24 |
9 files changed, 131 insertions, 495 deletions
diff --git a/arch/arm/mach-mx28/bus_freq.c b/arch/arm/mach-mx28/bus_freq.c index ef01a41fc095..1ea76cbdb4e3 100644 --- a/arch/arm/mach-mx28/bus_freq.c +++ b/arch/arm/mach-mx28/bus_freq.c @@ -49,14 +49,16 @@ #define BF(value, field) (((value) << BP_##field) & BM_##field) struct profile profiles[] = { - { 454736, 151570, 205710, 0, 1550000, + { 454736, 151580, 196360, 0, 1550000, 1450000, 355000, 3300000, 1750000, 24000, 0 }, - { 360000, 120000, 130910, 0, 1350000, - 1250000, 200000, 3300000, 1750000, 24000, 0 }, - { 261818, 130910, 130910, 0, 1350000, - 1250000, 173000, 3300000, 1750000, 24000, 0 }, - { 64000, 64000, 130910, 3, 1350000, - 1250000, 150000, 3300000, 1750000, 24000, 0 }, + { 392727, 130910, 160000, 0, 1475000, + 1375000, 225000, 3300000, 1750000, 24000, 0 }, + { 360000, 120000, 130910, 0, 1375000, + 1275000, 200000, 3300000, 1750000, 24000, 0 }, + { 261818, 130910, 130910, 0, 1275000, + 1175000, 173000, 3300000, 1750000, 24000, 0 }, + { 64000, 64000, 130910, 3, 1050000, + 975000, 150000, 3300000, 1750000, 24000, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, }; diff --git a/arch/arm/mach-mx28/device.c b/arch/arm/mach-mx28/device.c index 35e8f14a5568..7305b35bc74b 100644 --- a/arch/arm/mach-mx28/device.c +++ b/arch/arm/mach-mx28/device.c @@ -27,7 +27,6 @@ #include <linux/platform_device.h> #include <linux/mmc/host.h> #include <linux/phy.h> -#include <linux/etherdevice.h> #include <linux/fec.h> #include <linux/gpmi-nfc.h> @@ -36,7 +35,6 @@ #include <mach/hardware.h> #include <mach/regs-timrot.h> #include <mach/regs-lradc.h> -#include <mach/regs-ocotp.h> #include <mach/device.h> #include <mach/dma.h> #include <mach/lradc.h> @@ -556,10 +554,9 @@ static struct mxs_mmc_platform_data mmc0_data = { .get_wp = mxs_mmc_get_wp_ssp0, .cmd_pullup = mxs_mmc_cmd_pullup_ssp0, .setclock = mxs_mmc_setclock_ssp0, - .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA - | MMC_CAP_DATA_DDR, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .min_clk = 400000, - .max_clk = 48000000, + .max_clk = 52000000, .read_uA = 50000, .write_uA = 70000, .clock_mmc = "ssp.0", @@ -595,10 +592,9 @@ static struct mxs_mmc_platform_data mmc1_data = { .get_wp = mxs_mmc_get_wp_ssp1, .cmd_pullup = mxs_mmc_cmd_pullup_ssp1, .setclock = mxs_mmc_setclock_ssp1, - .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA - | MMC_CAP_DATA_DDR, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .min_clk = 400000, - .max_clk = 48000000, + .max_clk = 52000000, .read_uA = 50000, .write_uA = 70000, .clock_mmc = "ssp.1", @@ -761,16 +757,7 @@ static void __init mx28_init_fec(void) { struct platform_device *pdev; struct mxs_dev_lookup *lookup; - struct fec_platform_data *pfec; int i; - u32 val; - - __raw_writel(BM_OCOTP_CTRL_RD_BANK_OPEN, - IO_ADDRESS(OCOTP_PHYS_ADDR) + HW_OCOTP_CTRL_SET); - - while (BM_OCOTP_CTRL_BUSY & - __raw_readl(IO_ADDRESS(OCOTP_PHYS_ADDR) + HW_OCOTP_CTRL)) - udelay(10); lookup = mxs_get_devices("mxs-fec"); if (lookup == NULL || IS_ERR(lookup)) @@ -778,8 +765,6 @@ static void __init mx28_init_fec(void) for (i = 0; i < lookup->size; i++) { pdev = lookup->pdev + i; - val = __raw_readl(IO_ADDRESS(OCOTP_PHYS_ADDR) + - HW_OCOTP_CUSTn(pdev->id)); switch (pdev->id) { case 0: pdev->resource = fec0_resource; @@ -794,15 +779,6 @@ static void __init mx28_init_fec(void) default: return; } - - pfec = (struct fec_platform_data *)pdev->dev.platform_data; - pfec->mac[0] = 0x00; - pfec->mac[1] = 0x04; - pfec->mac[2] = (val >> 24) & 0xFF; - pfec->mac[3] = (val >> 16) & 0xFF; - pfec->mac[4] = (val >> 8) & 0xFF; - pfec->mac[5] = (val >> 0) & 0xFF; - mxs_add_device(pdev, 2); } } @@ -848,36 +824,13 @@ static struct switch_platform_data l2switch_data = { static void __init mx28_init_l2switch(void) { struct platform_device *pdev; - struct switch_platform_data *pswitch; - struct fec_platform_data *pfec; - u32 val; - - __raw_writel(BM_OCOTP_CTRL_RD_BANK_OPEN, - IO_ADDRESS(OCOTP_PHYS_ADDR) + HW_OCOTP_CTRL_SET); - - while (BM_OCOTP_CTRL_BUSY & - __raw_readl(IO_ADDRESS(OCOTP_PHYS_ADDR) + HW_OCOTP_CTRL)) - udelay(10); - pdev = mxs_get_device("mxs-l2switch", 0); if (pdev == NULL || IS_ERR(pdev)) return; - val = __raw_readl(IO_ADDRESS(OCOTP_PHYS_ADDR) + - HW_OCOTP_CUSTn(pdev->id)); pdev->resource = l2switch_resources; pdev->num_resources = ARRAY_SIZE(l2switch_resources); pdev->dev.platform_data = &l2switch_data; - - pswitch = (struct switch_platform_data *)pdev->dev.platform_data; - pfec = pswitch->fec_enet; - pfec->mac[0] = 0x00; - pfec->mac[1] = 0x04; - pfec->mac[2] = (val >> 24) & 0xFF; - pfec->mac[3] = (val >> 16) & 0xFF; - pfec->mac[4] = (val >> 8) & 0xFF; - pfec->mac[5] = (val >> 0) & 0xFF; - mxs_add_device(pdev, 2); } #else @@ -1459,50 +1412,6 @@ static void mx28_init_persistent() } #endif -#if defined(CONFIG_FSL_OTP) -/* Building up eight registers's names of a bank */ -#define BANK(a, b, c, d, e, f, g, h) \ - {\ - ("HW_OCOTP_"#a), ("HW_OCOTP_"#b), ("HW_OCOTP_"#c), ("HW_OCOTP_"#d), \ - ("HW_OCOTP_"#e), ("HW_OCOTP_"#f), ("HW_OCOTP_"#g), ("HW_OCOTP_"#h) \ - } - -#define BANKS (5) -#define BANK_ITEMS (8) -static const char *bank_reg_desc[BANKS][BANK_ITEMS] = { - BANK(CUST0, CUST1, CUST2, CUST3, CRYPTO0, CRYPTO1, CRYPTO2, CRYPTO3), - BANK(HWCAP0, HWCAP1, HWCAP2, HWCAP3, HWCAP4, HWCAP5, SWCAP, CUSTCAP), - BANK(LOCK, OPS0, OPS1, OPS2, OPS3, UN0, UN1, UN2), - BANK(ROM0, ROM1, ROM2, ROM3, ROM4, ROM5, ROM6, ROM7), - BANK(SRK0, SRK1, SRK2, SRK3, SRK4, SRK5, SRK6, SRK7), -}; - -static struct fsl_otp_data otp_data = { - .fuse_name = (char **)bank_reg_desc, - .regulator_name = "vddio", - .fuse_num = BANKS * BANK_ITEMS, -}; -#undef BANK -#undef BANKS -#undef BANK_ITEMS - -static void __init mx28_init_otp(void) -{ - struct platform_device *pdev; - pdev = mxs_get_device("ocotp", 0); - if (pdev == NULL || IS_ERR(pdev)) - return; - pdev->dev.platform_data = &otp_data; - pdev->resource = NULL; - pdev->num_resources = 0; - mxs_add_device(pdev, 3); -} -#else -static void mx28_init_otp(void) -{ -} -#endif - int __init mx28_device_init(void) { mx28_init_dma(); @@ -1527,7 +1436,6 @@ int __init mx28_device_init(void) mx28_init_dcp(); mx28_init_battery(); mx28_init_persistent(); - mx28_init_otp(); return 0; } diff --git a/arch/arm/mach-mx28/emi_settings.c b/arch/arm/mach-mx28/emi_settings.c index 56df6ad0c0d4..7dd62b9dd65a 100644 --- a/arch/arm/mach-mx28/emi_settings.c +++ b/arch/arm/mach-mx28/emi_settings.c @@ -27,6 +27,7 @@ #include <linux/platform_device.h> #include <linux/mmc/host.h> #include <linux/phy.h> +#include <linux/fec.h> #include <asm/mach/map.h> diff --git a/arch/arm/mach-mx28/mx28evk.c b/arch/arm/mach-mx28/mx28evk.c index 37beb27f7065..768b21a5ffe5 100644 --- a/arch/arm/mach-mx28/mx28evk.c +++ b/arch/arm/mach-mx28/mx28evk.c @@ -39,7 +39,7 @@ static struct i2c_board_info __initdata mxs_i2c_device[] = { { I2C_BOARD_INFO("sgtl5000-i2c", 0x14), .flags = I2C_M_TEN } }; -static void __init i2c_device_init(void) +static void i2c_device_init(void) { i2c_register_board_info(0, mxs_i2c_device, ARRAY_SIZE(mxs_i2c_device)); } diff --git a/arch/arm/mach-mx28/mx28evk.h b/arch/arm/mach-mx28/mx28evk.h index d973c0f7ef19..58910271343d 100644 --- a/arch/arm/mach-mx28/mx28evk.h +++ b/arch/arm/mach-mx28/mx28evk.h @@ -21,8 +21,5 @@ extern void __init mx28evk_pins_init(void); extern int mx28evk_enet_gpio_init(void); -void mx28evk_enet_io_lowerpower_enter(void); -void mx28evk_enet_io_lowerpower_exit(void); - #endif /* __ASM_ARM_MACH_MX28EVK_H */ diff --git a/arch/arm/mach-mx28/mx28evk_pins.c b/arch/arm/mach-mx28/mx28evk_pins.c index 7d5b64328324..a7c81b3cf023 100644 --- a/arch/arm/mach-mx28/mx28evk_pins.c +++ b/arch/arm/mach-mx28/mx28evk_pins.c @@ -531,106 +531,16 @@ static struct pin_desc mx28evk_fixed_pins[] = { .name = "SSP0_SCK", .id = PINID_SSP0_SCK, .fun = PIN_FUN1, - .strength = PAD_12MA, + .strength = PAD_8MA, .voltage = PAD_3_3V, .pullup = 0, - .drive = 2, - .pull = 0, - }, -#endif -#if defined(CONFIG_LEDS_MXS) || defined(CONFIG_LEDS_MXS_MODULE) - { - .name = "LEDS_PWM0", - .id = PINID_AUART1_RX, - .fun = PIN_FUN3, - .strength = PAD_8MA, - .voltage = PAD_3_3V, - .pullup = 1, - .drive = 1, - .pull = 1, - }, - { - .name = "LEDS_PWM1", - .id = PINID_AUART1_TX, - .fun = PIN_FUN3, - .strength = PAD_8MA, - .voltage = PAD_3_3V, - .pullup = 1, - .drive = 1, - .pull = 1, - }, -#endif -#if defined(CONFIG_SND_MXS_SOC_DAI) || defined(CONFIG_SND_MXS_SOC_DAI_MODULE) - /* Configurations of SAIF0 port pins */ - { - .name = "SAIF0_MCLK", - .id = PINID_SAIF0_MCLK, - .fun = PIN_FUN1, - .strength = PAD_12MA, - .voltage = PAD_3_3V, - .pullup = 1, - .drive = 1, - .pull = 1, - }, - { - .name = "SAIF0_LRCLK", - .id = PINID_SAIF0_LRCLK, - .fun = PIN_FUN1, - .strength = PAD_12MA, - .voltage = PAD_3_3V, - .pullup = 1, .drive = 1, - .pull = 1, - }, - { - .name = "SAIF0_BITCLK", - .id = PINID_SAIF0_BITCLK, - .fun = PIN_FUN1, - .strength = PAD_12MA, - .voltage = PAD_3_3V, - .pullup = 1, - .drive = 1, - .pull = 1, - }, - { - .name = "SAIF0_SDATA0", - .id = PINID_SAIF0_SDATA0, - .fun = PIN_FUN1, - .strength = PAD_12MA, - .voltage = PAD_3_3V, - .pullup = 1, - .drive = 1, - .pull = 1, - }, - { - .name = "SAIF1_SDATA0", - .id = PINID_SAIF1_SDATA0, - .fun = PIN_FUN1, - .strength = PAD_12MA, - .voltage = PAD_3_3V, - .pullup = 1, - .drive = 1, - .pull = 1, + .pull = 0, }, #endif -#if defined(CONFIG_SND_SOC_MXS_SPDIF) || \ - defined(CONFIG_SND_SOC_MXS_SPDIF_MODULE) - { - .name = "SPDIF", - .id = PINID_SPDIF, - .fun = PIN_FUN1, - .strength = PAD_12MA, - .voltage = PAD_3_3V, - .pullup = 1, - .drive = 1, - .pull = 1, - }, -#endif -}; #if defined(CONFIG_FEC) || defined(CONFIG_FEC_MODULE)\ || defined(CONFIG_FEC_L2SWITCH) -static struct pin_desc mx28evk_eth_pins[] = { { .name = "ENET0_MDC", .id = PINID_ENET0_MDC, @@ -781,8 +691,97 @@ static struct pin_desc mx28evk_eth_pins[] = { .voltage = PAD_3_3V, .drive = 1, }, -}; #endif +#if defined(CONFIG_LEDS_MXS) || defined(CONFIG_LEDS_MXS_MODULE) + { + .name = "LEDS_PWM0", + .id = PINID_AUART1_RX, + .fun = PIN_FUN3, + .strength = PAD_8MA, + .voltage = PAD_3_3V, + .pullup = 1, + .drive = 1, + .pull = 1, + }, + { + .name = "LEDS_PWM1", + .id = PINID_AUART1_TX, + .fun = PIN_FUN3, + .strength = PAD_8MA, + .voltage = PAD_3_3V, + .pullup = 1, + .drive = 1, + .pull = 1, + }, +#endif +#if defined(CONFIG_SND_MXS_SOC_DAI) || defined(CONFIG_SND_MXS_SOC_DAI_MODULE) + /* Configurations of SAIF0 port pins */ + { + .name = "SAIF0_MCLK", + .id = PINID_SAIF0_MCLK, + .fun = PIN_FUN1, + .strength = PAD_12MA, + .voltage = PAD_3_3V, + .pullup = 1, + .drive = 1, + .pull = 1, + }, + { + .name = "SAIF0_LRCLK", + .id = PINID_SAIF0_LRCLK, + .fun = PIN_FUN1, + .strength = PAD_12MA, + .voltage = PAD_3_3V, + .pullup = 1, + .drive = 1, + .pull = 1, + }, + { + .name = "SAIF0_BITCLK", + .id = PINID_SAIF0_BITCLK, + .fun = PIN_FUN1, + .strength = PAD_12MA, + .voltage = PAD_3_3V, + .pullup = 1, + .drive = 1, + .pull = 1, + }, + { + .name = "SAIF0_SDATA0", + .id = PINID_SAIF0_SDATA0, + .fun = PIN_FUN1, + .strength = PAD_12MA, + .voltage = PAD_3_3V, + .pullup = 1, + .drive = 1, + .pull = 1, + }, + { + .name = "SAIF1_SDATA0", + .id = PINID_SAIF1_SDATA0, + .fun = PIN_FUN1, + .strength = PAD_12MA, + .voltage = PAD_3_3V, + .pullup = 1, + .drive = 1, + .pull = 1, + }, +#endif +#if defined(CONFIG_SND_SOC_MXS_SPDIF) || \ + defined(CONFIG_SND_SOC_MXS_SPDIF_MODULE) + { + .name = "SPDIF", + .id = PINID_SPDIF, + .fun = PIN_FUN1, + .strength = PAD_12MA, + .voltage = PAD_3_3V, + .pullup = 1, + .drive = 1, + .pull = 1, + }, +#endif +}; + static int __initdata enable_ssp1 = { 0 }; static int __init ssp1_setup(char *__unused) @@ -898,10 +897,10 @@ static struct pin_desc mx28evk_ssp1_pins[] = { .name = "SSP1_SCK", .id = PINID_GPMI_WRN, .fun = PIN_FUN2, - .strength = PAD_12MA, + .strength = PAD_8MA, .voltage = PAD_3_3V, .pullup = 0, - .drive = 2, + .drive = 1, .pull = 0, }, }; @@ -1088,49 +1087,11 @@ int mx28evk_enet_gpio_init(void) return 0; } - -void mx28evk_enet_io_lowerpower_enter(void) -{ - int i; - gpio_direction_output(MXS_PIN_TO_GPIO(PINID_SSP1_DATA3), 1); - gpio_direction_output(MXS_PIN_TO_GPIO(PINID_ENET0_RX_CLK), 0); - gpio_request(MXS_PIN_TO_GPIO(PINID_ENET0_TX_CLK), "ETH_INT"); - gpio_direction_output(MXS_PIN_TO_GPIO(PINID_ENET0_TX_CLK), 0); - - for (i = 0; i < ARRAY_SIZE(mx28evk_eth_pins); i++) { - mxs_release_pin(mx28evk_eth_pins[i].id, - mx28evk_eth_pins[i].name); - gpio_request(MXS_PIN_TO_GPIO(mx28evk_eth_pins[i].id), - mx28evk_eth_pins[i].name); - gpio_direction_output( - MXS_PIN_TO_GPIO(mx28evk_eth_pins[i].id), 0); - } - -} - -void mx28evk_enet_io_lowerpower_exit(void) -{ - int i; - gpio_direction_output(MXS_PIN_TO_GPIO(PINID_SSP1_DATA3), 0); - gpio_direction_output(MXS_PIN_TO_GPIO(PINID_ENET0_RX_CLK), 1); - gpio_free(MXS_PIN_TO_GPIO(PINID_ENET0_TX_CLK)); - for (i = 0; i < ARRAY_SIZE(mx28evk_eth_pins); i++) { - gpio_free(MXS_PIN_TO_GPIO(mx28evk_eth_pins[i].id)); - mxs_request_pin(mx28evk_eth_pins[i].id, - mx28evk_eth_pins[i].fun, - mx28evk_eth_pins[i].name); - } -} - #else int mx28evk_enet_gpio_init(void) { return 0; } -void mx28evk_enet_io_lowerpower_enter(void) -{} -void mx28evk_enet_io_lowerpower_exit(void) -{} #endif void __init mx28evk_init_pin_group(struct pin_desc *pins, unsigned count) @@ -1174,9 +1135,5 @@ void __init mx28evk_pins_init(void) mx28evk_init_pin_group(mx28evk_gpmi_pins, ARRAY_SIZE(mx28evk_gpmi_pins)); } -#if defined(CONFIG_FEC) || defined(CONFIG_FEC_MODULE)\ - || defined(CONFIG_FEC_L2SWITCH) - mx28evk_init_pin_group(mx28evk_eth_pins, - ARRAY_SIZE(mx28evk_eth_pins)); -#endif + } diff --git a/arch/arm/mach-mx28/pm.c b/arch/arm/mach-mx28/pm.c index 4ac13bc3248c..c26a495f59e2 100644 --- a/arch/arm/mach-mx28/pm.c +++ b/arch/arm/mach-mx28/pm.c @@ -36,13 +36,12 @@ #include <mach/dma.h> #include <mach/regs-rtc.h> #include "regs-clkctrl.h" +#include "regs-pinctrl.h" #include <mach/regs-power.h> #include <mach/regs-pwm.h> #include <mach/regs-rtc.h> #include <mach/../../regs-icoll.h> #include "regs-dram.h" -#include "mx28_pins.h" -#include "mx28evk.h" #include "sleep.h" @@ -80,8 +79,7 @@ static inline void do_standby(void) u32 reg_clkctrl_clkseq, reg_clkctrl_xtal; unsigned long iram_phy_addr; void *iram_virtual_addr; - int wakeupirq; - mx28evk_enet_io_lowerpower_enter(); + /* * 1) switch clock domains from PLL to 24MHz * 2) lower voltage (TODO) @@ -112,8 +110,7 @@ static inline void do_standby(void) cpu_parent = clk_get_parent(cpu_clk); hbus_rate = clk_get_rate(hbus_clk); clk_set_parent(cpu_clk, osc_clk); - } else - pr_err("fail to get cpu clk\n"); + } local_fiq_disable(); @@ -125,18 +122,15 @@ static inline void do_standby(void) reg_clkctrl_xtal = __raw_readl(REGS_CLKCTRL_BASE + HW_CLKCTRL_XTAL); - /* do suspend */ mx28_cpu_standby_ptr = iram_virtual_addr; mx28_cpu_standby_ptr(); - wakeupirq = __raw_readl(IO_ADDRESS(ICOLL_PHYS_ADDR) + HW_ICOLL_STAT); - - pr_info("wakeup irq = %d\n", wakeupirq); __raw_writel(reg_clkctrl_clkseq, REGS_CLKCTRL_BASE + HW_CLKCTRL_CLKSEQ); __raw_writel(reg_clkctrl_xtal, REGS_CLKCTRL_BASE + HW_CLKCTRL_XTAL); + saved_sleep_state = 0; /* waking from standby */ __raw_writel(BM_POWER_CTRL_PSWITCH_IRQ, REGS_POWER_BASE + HW_POWER_CTRL_CLR); @@ -155,7 +149,6 @@ static inline void do_standby(void) clk_put(cpu_clk); iram_free(iram_phy_addr, MAX_POWEROFF_CODE_SIZE); - mx28evk_enet_io_lowerpower_exit(); } static noinline void do_mem(void) @@ -262,52 +255,38 @@ static struct mx28_pswitch_state pswitch_state = { .dev_running = 0, }; -#define PSWITCH_POWER_DOWN_DELAY 30 -static struct delayed_work pswitch_work; -static void pswitch_check_work(struct work_struct *work) +static irqreturn_t pswitch_interrupt(int irq, void *dev) { int pin_value, i; - for (i = 0; i < PSWITCH_POWER_DOWN_DELAY; i++) { + + /* check if irq by pswitch */ + if (!(__raw_readl(REGS_POWER_BASE + HW_POWER_CTRL) & + BM_POWER_CTRL_PSWITCH_IRQ)) + return IRQ_HANDLED; + for (i = 0; i < 3000; i++) { pin_value = __raw_readl(REGS_POWER_BASE + HW_POWER_STS) & BF_POWER_STS_PSWITCH(0x1); if (pin_value == 0) break; - msleep(100); + mdelay(1); } - if (i < PSWITCH_POWER_DOWN_DELAY) { + if (i < 3000) { pr_info("pswitch goto suspend\n"); complete(&suspend_request); } else { pr_info("release pswitch to power down\n"); - for (i = 0; i < 500; i++) { + for (i = 0; i < 5000; i++) { pin_value = __raw_readl(REGS_POWER_BASE + HW_POWER_STS) & BF_POWER_STS_PSWITCH(0x1); if (pin_value == 0) break; - msleep(10); + mdelay(1); } pr_info("pswitch power down\n"); mx28_pm_power_off(); } __raw_writel(BM_POWER_CTRL_PSWITCH_IRQ, REGS_POWER_BASE + HW_POWER_CTRL_CLR); - __raw_writel(BM_POWER_CTRL_ENIRQ_PSWITCH, - REGS_POWER_BASE + HW_POWER_CTRL_SET); - __raw_writel(BM_POWER_CTRL_PSWITCH_IRQ, - REGS_POWER_BASE + HW_POWER_CTRL_CLR); -} - - -static irqreturn_t pswitch_interrupt(int irq, void *dev) -{ - - /* check if irq by pswitch */ - if (!(__raw_readl(REGS_POWER_BASE + HW_POWER_CTRL) & - BM_POWER_CTRL_PSWITCH_IRQ)) - return IRQ_HANDLED; - __raw_writel(BM_POWER_CTRL_ENIRQ_PSWITCH, - REGS_POWER_BASE + HW_POWER_CTRL_CLR); - schedule_delayed_work(&pswitch_work, 1); return IRQ_HANDLED; } @@ -320,7 +299,6 @@ static struct irqaction pswitch_irq = { static void init_pswitch(void) { - INIT_DELAYED_WORK(&pswitch_work, pswitch_check_work); kthread_run(suspend_thread_fn, NULL, "pswitch"); __raw_writel(BM_POWER_CTRL_PSWITCH_IRQ, REGS_POWER_BASE + HW_POWER_CTRL_CLR); diff --git a/arch/arm/mach-mx28/sleep.S b/arch/arm/mach-mx28/sleep.S index 54e86bd4f717..438f588f85d3 100644 --- a/arch/arm/mach-mx28/sleep.S +++ b/arch/arm/mach-mx28/sleep.S @@ -25,7 +25,6 @@ #include <mach/hardware.h> #include <mach/regs-power.h> #include <mach/regs-rtc.h> -#include "regs-pinctrl.h" #include "regs-clkctrl.h" #include "regs-dram.h" #include "sleep.h" @@ -40,104 +39,11 @@ #define HW_DRAM_CTL17_ADDR \ (MX28_SOC_IO_ADDRESS(DRAM_PHYS_ADDR) + HW_DRAM_CTL17) -#define HW_DRAM_CTL22_ADDR \ - (MX28_SOC_IO_ADDRESS(DRAM_PHYS_ADDR) + HW_DRAM_CTL22) - #define HW_RTC_PERSISTENT0_ADDR \ (MX28_SOC_IO_ADDRESS(RTC_PHYS_ADDR) + HW_RTC_PERSISTENT0) -#define HW_CLKCTRL_EMI_ADDR \ - (MX28_SOC_IO_ADDRESS(CLKCTRL_PHYS_ADDR) + HW_CLKCTRL_EMI) -#define HW_CLKCTRL_PLL0CTRL0_ADDR \ - (MX28_SOC_IO_ADDRESS(CLKCTRL_PHYS_ADDR) + HW_CLKCTRL_PLL0CTRL0) -#define HW_POWER_VDDIOCTRL_ADDR \ - (MX28_SOC_IO_ADDRESS(POWER_PHYS_ADDR) + HW_POWER_VDDIOCTRL) -#define HW_POWER_VDDDCTRL_ADDR \ - (MX28_SOC_IO_ADDRESS(POWER_PHYS_ADDR) + HW_POWER_VDDDCTRL) -#define HW_POWER_VDDACTRL_ADDR \ - (MX28_SOC_IO_ADDRESS(POWER_PHYS_ADDR) + HW_POWER_VDDACTRL) -#define HW_PINCTRL_EMI_DS_CTRL_ADDR \ - (MX28_SOC_IO_ADDRESS(PINCTRL_PHYS_ADDR) + HW_PINCTRL_EMI_DS_CTRL) - -#define HW_POWER_LOOPCTRL_ADDR \ - (MX28_SOC_IO_ADDRESS(POWER_PHYS_ADDR) + HW_POWER_LOOPCTRL) - -#define HW_POWER_MINPWR_ADDR \ - (MX28_SOC_IO_ADDRESS(POWER_PHYS_ADDR) + HW_POWER_MINPWR) #define PHYS_RAM_START 0x40000000 -#define LOWER_VDDIO 6 -#define LOWER_VDDA 9 -#define LOWER_VDDD 0x16 - -#define VDDIOCTRL_BACKUP 0 -#define VDDACTRL_BACKUP 1 -#define VDDDCTRL_BACKUP 2 -#define POWER_LOOPCTRL_BACKUP 3 -#define POWER_MINPWR_BACKUP 4 - -.macro PM_BITS_SET, addr, val - mov r0, #(\addr & 0x000000FF) - orr r0, r0, #(\addr & 0x0000FF00) - orr r0, r0, #(\addr & 0x00FF0000) - orr r0, r0, #(\addr & 0xFF000000) - ldr r1, [r0] - orr r1, r1, #(\val) - str r1, [r0] -.endm - -.macro PM_BITS_CLR, addr, val - mov r0, #(\addr & 0x000000FF) - orr r0, r0, #(\addr & 0x0000FF00) - orr r0, r0, #(\addr & 0x00FF0000) - orr r0, r0, #(\addr & 0xFF000000) - ldr r1, [r0] - bic r1, r1, #(\val) - str r1, [r0] -.endm - -.macro PM_BACKUP_REG, addr, num - mov r0, #(\addr & 0x000000FF) - orr r0, r0, #(\addr & 0x0000FF00) - orr r0, r0, #(\addr & 0x00FF0000) - orr r0, r0, #(\addr & 0xFF000000) - ldr r1, [r0] - str r1, __mx28_temp_stack + \num * 4 -.endm - -.macro PM_WRITE_REG_MASK, addr, bitmask, val - mov r0, #(\addr & 0x000000FF) - orr r0, r0, #(\addr & 0x0000FF00) - orr r0, r0, #(\addr & 0x00FF0000) - orr r0, r0, #(\addr & 0xFF000000) - ldr r1, [r0] - bic r1, r1, #(\bitmask) - orr r1, r1, #(\val) - str r1, [r0] -.endm - -.macro PM_SET_AND_BACKUP_REG, addr, bitmask, val, num - mov r0, #(\addr & 0x000000FF) - orr r0, r0, #(\addr & 0x0000FF00) - orr r0, r0, #(\addr & 0x00FF0000) - orr r0, r0, #(\addr & 0xFF000000) - ldr r1, [r0] - str r1, __mx28_temp_stack + \num * 4 - bic r1, r1, #(\bitmask) - orr r1, r1, #(\val) - str r1, [r0] -.endm - -.macro PM_SET_RESTORE_REG, addr, num - mov r0, #(\addr & 0x000000FF) - orr r0, r0, #(\addr & 0x0000FF00) - orr r0, r0, #(\addr & 0x00FF0000) - orr r0, r0, #(\addr & 0xFF000000) - ldr r1, __mx28_temp_stack + \num * 4 - str r1, [r0] -.endm - - .global cpu_arm926_switch_mm .text @@ -153,6 +59,7 @@ ENTRY(mx28_cpu_standby) ldr r1, __mx28_flush_cache_addr mov lr, pc mov pc, r1 + @ put DRAM into self refresh mov r0, #(HW_DRAM_CTL17_ADDR & 0x000000FF) orr r0, r0, #(HW_DRAM_CTL17_ADDR & 0x0000FF00) @@ -162,67 +69,6 @@ ENTRY(mx28_cpu_standby) orr r1, r1, #(BM_DRAM_CTL17_SREFRESH) str r1, [r0] @ wait for it to actually happen - mov r0, #24 << 5 -11: sub r0, r0, #1 - cmp r0, #0 - bne 11b - - @ gate clk - mov r0, #(HW_CLKCTRL_EMI_ADDR & 0x000000FF) - orr r0, r0, #(HW_CLKCTRL_EMI_ADDR & 0x0000FF00) - orr r0, r0, #(HW_CLKCTRL_EMI_ADDR & 0x00FF0000) - orr r0, r0, #(HW_CLKCTRL_EMI_ADDR & 0xFF000000) - ldr r1, [r0] - orr r1, r1, #(BM_CLKCTRL_EMI_CLKGATE) - str r1, [r0] - -// PM_SET_AND_BACKUP_REG HW_PINCTRL_EMI_DS_CTRL_ADDR,\ -// BM_PINCTRL_EMI_DS_CTRL_DDR_MODE,\ -// BF_PINCTRL_EMI_DS_CTRL_DDR_MODE(0x1), 4 - - // vddio - PM_SET_AND_BACKUP_REG HW_POWER_VDDIOCTRL_ADDR,\ - BM_POWER_VDDIOCTRL_TRG, LOWER_VDDIO, VDDIOCTRL_BACKUP - mov r0, #24 << 10 -1: sub r0, r0, #1 - cmp r0, #0 - bne 1b - - PM_SET_AND_BACKUP_REG HW_POWER_VDDACTRL_ADDR,\ - BM_POWER_VDDACTRL_TRG, LOWER_VDDA, VDDACTRL_BACKUP - mov r0, #24 << 10 -2: sub r0, r0, #1 - cmp r0, #0 - bne 2b - - PM_SET_AND_BACKUP_REG HW_POWER_VDDDCTRL_ADDR,\ - BM_POWER_VDDDCTRL_TRG, LOWER_VDDD, VDDDCTRL_BACKUP - mov r0, #24 << 10 -3: sub r0, r0, #1 - cmp r0, #0 - bne 3b - - PM_BACKUP_REG HW_POWER_LOOPCTRL_ADDR, POWER_LOOPCTRL_BACKUP - PM_BACKUP_REG HW_POWER_MINPWR_ADDR, POWER_MINPWR_BACKUP - -// PM_BITS_CLR HW_POWER_LOOPCTRL_ADDR, BM_POWER_LOOPCTRL_EN_RCSCALE -// PM_WRITE_REG_MASK HW_POWER_LOOPCTRL_ADDR, BM_POWER_LOOPCTRL_DC_R,\ -// (2<<BP_POWER_LOOPCTRL_DC_R) - - // half fets - PM_BITS_SET HW_POWER_MINPWR_ADDR, BM_POWER_MINPWR_HALF_FETS - - PM_BITS_CLR HW_POWER_LOOPCTRL_ADDR, BM_POWER_LOOPCTRL_CM_HYST_THRESH - PM_BITS_CLR HW_POWER_LOOPCTRL_ADDR, BM_POWER_LOOPCTRL_EN_CM_HYST - PM_BITS_CLR HW_POWER_LOOPCTRL_ADDR, BM_POWER_LOOPCTRL_EN_DF_HYST - - // enable PFM - PM_BITS_SET HW_POWER_LOOPCTRL_ADDR, BM_POWER_LOOPCTRL_HYST_SIGN - PM_BITS_SET HW_POWER_MINPWR_ADDR, BM_POWER_MINPWR_EN_DC_PFM - - - //Gated PLL0 - PM_BITS_CLR HW_CLKCTRL_PLL0CTRL0_ADDR, BM_CLKCTRL_PLL0CTRL0_POWER @ do enter standby mov r0, #(HW_CLKCTRL_CPU_ADDR & 0x000000FF) @@ -243,39 +89,6 @@ ENTRY(mx28_cpu_standby) nop nop - PM_BITS_SET HW_CLKCTRL_PLL0CTRL0_ADDR, BM_CLKCTRL_PLL0CTRL0_POWER - - PM_SET_RESTORE_REG HW_POWER_MINPWR_ADDR, POWER_MINPWR_BACKUP - - PM_SET_RESTORE_REG HW_POWER_LOOPCTRL_ADDR, POWER_LOOPCTRL_BACKUP - - // vddio - PM_SET_RESTORE_REG HW_POWER_VDDIOCTRL_ADDR, VDDIOCTRL_BACKUP - mov r0, #24 << 10 -10: sub r0, r0, #1 - cmp r0, #0 - bne 10b - PM_SET_RESTORE_REG HW_POWER_VDDACTRL_ADDR, VDDACTRL_BACKUP - mov r0, #24 << 10 -20: sub r0, r0, #1 - cmp r0, #0 - bne 20b - PM_SET_RESTORE_REG HW_POWER_VDDDCTRL_ADDR, VDDDCTRL_BACKUP - mov r0, #24 << 10 -30: sub r0, r0, #1 - cmp r0, #0 - bne 30b - - @ ungate clk - mov r0, #(HW_CLKCTRL_EMI_ADDR & 0x000000FF) - orr r0, r0, #(HW_CLKCTRL_EMI_ADDR & 0x0000FF00) - orr r0, r0, #(HW_CLKCTRL_EMI_ADDR & 0x00FF0000) - orr r0, r0, #(HW_CLKCTRL_EMI_ADDR & 0xFF000000) - ldr r1, [r0] - bic r1, r1, #(BM_CLKCTRL_EMI_CLKGATE) - str r1, [r0] - -// PM_SET_RESTORE_REG HW_PINCTRL_EMI_DS_CTRL_ADDR, 4 @ restore normal DRAM mode mov r0, #(HW_DRAM_CTL17_ADDR & 0x000000FF) orr r0, r0, #(HW_DRAM_CTL17_ADDR & 0x0000FF00) @@ -285,10 +98,6 @@ ENTRY(mx28_cpu_standby) bic r1, r1, #BM_DRAM_CTL17_SREFRESH str r1, [r0] @ wait for it to actually happen - mov r0, #24 << 5 -12: sub r0, r0, #1 - cmp r0, #0 - bne 12b nop nop @@ -299,7 +108,7 @@ ENTRY(mx28_cpu_standby) .space 0x100 __mx28_temp_stack: - .space 128 + .word 0 #ifdef CONFIG_STMP378X_RAM_FREQ_SCALING #include "emi.inc" diff --git a/arch/arm/mach-mx28/usb_dr.c b/arch/arm/mach-mx28/usb_dr.c index 50a2f8b381af..13344ef0e26f 100644 --- a/arch/arm/mach-mx28/usb_dr.c +++ b/arch/arm/mach-mx28/usb_dr.c @@ -63,7 +63,7 @@ static struct fsl_usb2_platform_data __maybe_unused dr_utmi_config = { }; /* - * OTG resources + * resources */ static struct resource otg_resources[] = { [0] = { @@ -78,22 +78,6 @@ static struct resource otg_resources[] = { }, }; -/* - * UDC resources (same as OTG resource) - */ -static struct resource udc_resources[] = { - [0] = { - .start = (u32)USBCTRL0_PHYS_ADDR, - .end = (u32)(USBCTRL0_PHYS_ADDR + 0x1ff), - .flags = IORESOURCE_MEM, - }, - - [1] = { - .start = IRQ_USB0, - .flags = IORESOURCE_IRQ, - }, -}; - static u64 dr_udc_dmamask = ~(u32) 0; static void dr_udc_release(struct device *dev) { @@ -127,8 +111,8 @@ static struct platform_device __maybe_unused dr_otg_device = { .dma_mask = &dr_otg_dmamask, .coherent_dma_mask = 0xffffffff, }, - .resource = udc_resources, - .num_resources = ARRAY_SIZE(udc_resources), + .resource = otg_resources, + .num_resources = ARRAY_SIZE(otg_resources), }; @@ -172,5 +156,5 @@ void fsl_phy_set_power(struct fsl_xcvr_ops *this, #ifdef CONFIG_MXS_VBUS_CURRENT_DRAW fs_initcall(usb_dr_init); #else - subsys_initcall(usb_dr_init); + module_init(usb_dr_init); #endif |