diff options
| -rw-r--r-- | arch/arm/mach-omap1/board-osk.c | 13 | ||||
| -rw-r--r-- | drivers/mtd/maps/omap_nor.c | 23 | ||||
| -rw-r--r-- | drivers/pcmcia/omap_cf.c | 25 | ||||
| -rw-r--r-- | include/asm-arm/arch-omap/tc.h | 10 |
4 files changed, 43 insertions, 28 deletions
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c index a66505f58b15..82ec34c43bc5 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c | |||
| @@ -267,13 +267,17 @@ static struct i2c_board_info __initdata osk_i2c_board_info[] = { | |||
| 267 | 267 | ||
| 268 | static void __init osk_init_smc91x(void) | 268 | static void __init osk_init_smc91x(void) |
| 269 | { | 269 | { |
| 270 | u32 l; | ||
| 271 | |||
| 270 | if ((gpio_request(0, "smc_irq")) < 0) { | 272 | if ((gpio_request(0, "smc_irq")) < 0) { |
| 271 | printk("Error requesting gpio 0 for smc91x irq\n"); | 273 | printk("Error requesting gpio 0 for smc91x irq\n"); |
| 272 | return; | 274 | return; |
| 273 | } | 275 | } |
| 274 | 276 | ||
| 275 | /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */ | 277 | /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */ |
| 276 | EMIFS_CCS(1) |= 0x3; | 278 | l = omap_readl(EMIFS_CCS(1)); |
| 279 | l |= 0x3; | ||
| 280 | omap_writel(l, EMIFS_CCS(1)); | ||
| 277 | } | 281 | } |
| 278 | 282 | ||
| 279 | static void __init osk_init_cf(void) | 283 | static void __init osk_init_cf(void) |
| @@ -526,13 +530,16 @@ static void __init osk_mistral_init(void) { } | |||
| 526 | 530 | ||
| 527 | static void __init osk_init(void) | 531 | static void __init osk_init(void) |
| 528 | { | 532 | { |
| 533 | u32 l; | ||
| 534 | |||
| 529 | /* Workaround for wrong CS3 (NOR flash) timing | 535 | /* Workaround for wrong CS3 (NOR flash) timing |
| 530 | * There are some U-Boot versions out there which configure | 536 | * There are some U-Boot versions out there which configure |
| 531 | * wrong CS3 memory timings. This mainly leads to CRC | 537 | * wrong CS3 memory timings. This mainly leads to CRC |
| 532 | * or similar errors if you use NOR flash (e.g. with JFFS2) | 538 | * or similar errors if you use NOR flash (e.g. with JFFS2) |
| 533 | */ | 539 | */ |
| 534 | if (EMIFS_CCS(3) != EMIFS_CS3_VAL) | 540 | l = omap_readl(EMIFS_CCS(3)); |
| 535 | EMIFS_CCS(3) = EMIFS_CS3_VAL; | 541 | if (l != EMIFS_CS3_VAL) |
| 542 | omap_writel(EMIFS_CS3_VAL, EMIFS_CCS(3)); | ||
| 536 | 543 | ||
| 537 | osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); | 544 | osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); |
| 538 | osk_flash_resource.end += SZ_32M - 1; | 545 | osk_flash_resource.end += SZ_32M - 1; |
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c index c12d8056bebd..68eec6c6c517 100644 --- a/drivers/mtd/maps/omap_nor.c +++ b/drivers/mtd/maps/omap_nor.c | |||
| @@ -60,13 +60,22 @@ struct omapflash_info { | |||
| 60 | static void omap_set_vpp(struct map_info *map, int enable) | 60 | static void omap_set_vpp(struct map_info *map, int enable) |
| 61 | { | 61 | { |
| 62 | static int count; | 62 | static int count; |
| 63 | 63 | u32 l; | |
| 64 | if (enable) { | 64 | |
| 65 | if (count++ == 0) | 65 | if (cpu_class_is_omap1()) { |
| 66 | OMAP_EMIFS_CONFIG_REG |= OMAP_EMIFS_CONFIG_WP; | 66 | if (enable) { |
| 67 | } else { | 67 | if (count++ == 0) { |
| 68 | if (count && (--count == 0)) | 68 | l = omap_readl(EMIFS_CONFIG); |
| 69 | OMAP_EMIFS_CONFIG_REG &= ~OMAP_EMIFS_CONFIG_WP; | 69 | l |= OMAP_EMIFS_CONFIG_WP; |
| 70 | omap_writel(l, EMIFS_CONFIG); | ||
| 71 | } | ||
| 72 | } else { | ||
| 73 | if (count && (--count == 0)) { | ||
| 74 | l = omap_readl(EMIFS_CONFIG); | ||
| 75 | l &= ~OMAP_EMIFS_CONFIG_WP; | ||
| 76 | omap_writel(l, EMIFS_CONFIG); | ||
| 77 | } | ||
| 78 | } | ||
| 70 | } | 79 | } |
| 71 | } | 80 | } |
| 72 | 81 | ||
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c index 46314b420765..569b746b5731 100644 --- a/drivers/pcmcia/omap_cf.c +++ b/drivers/pcmcia/omap_cf.c | |||
| @@ -38,19 +38,19 @@ | |||
| 38 | #define CF_BASE 0xfffe2800 | 38 | #define CF_BASE 0xfffe2800 |
| 39 | 39 | ||
| 40 | /* status; read after IRQ */ | 40 | /* status; read after IRQ */ |
| 41 | #define CF_STATUS_REG __REG16(CF_BASE + 0x00) | 41 | #define CF_STATUS (CF_BASE + 0x00) |
| 42 | # define CF_STATUS_BAD_READ (1 << 2) | 42 | # define CF_STATUS_BAD_READ (1 << 2) |
| 43 | # define CF_STATUS_BAD_WRITE (1 << 1) | 43 | # define CF_STATUS_BAD_WRITE (1 << 1) |
| 44 | # define CF_STATUS_CARD_DETECT (1 << 0) | 44 | # define CF_STATUS_CARD_DETECT (1 << 0) |
| 45 | 45 | ||
| 46 | /* which chipselect (CS0..CS3) is used for CF (active low) */ | 46 | /* which chipselect (CS0..CS3) is used for CF (active low) */ |
| 47 | #define CF_CFG_REG __REG16(CF_BASE + 0x02) | 47 | #define CF_CFG (CF_BASE + 0x02) |
| 48 | 48 | ||
| 49 | /* card reset */ | 49 | /* card reset */ |
| 50 | #define CF_CONTROL_REG __REG16(CF_BASE + 0x04) | 50 | #define CF_CONTROL (CF_BASE + 0x04) |
| 51 | # define CF_CONTROL_RESET (1 << 0) | 51 | # define CF_CONTROL_RESET (1 << 0) |
| 52 | 52 | ||
| 53 | #define omap_cf_present() (!(CF_STATUS_REG & CF_STATUS_CARD_DETECT)) | 53 | #define omap_cf_present() (!(omap_readw(CF_STATUS) & CF_STATUS_CARD_DETECT)) |
| 54 | 54 | ||
| 55 | /*--------------------------------------------------------------------------*/ | 55 | /*--------------------------------------------------------------------------*/ |
| 56 | 56 | ||
| @@ -139,11 +139,11 @@ omap_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s) | |||
| 139 | return -EINVAL; | 139 | return -EINVAL; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | control = CF_CONTROL_REG; | 142 | control = omap_readw(CF_CONTROL); |
| 143 | if (s->flags & SS_RESET) | 143 | if (s->flags & SS_RESET) |
| 144 | CF_CONTROL_REG = CF_CONTROL_RESET; | 144 | omap_writew(CF_CONTROL_RESET, CF_CONTROL); |
| 145 | else | 145 | else |
| 146 | CF_CONTROL_REG = 0; | 146 | omap_writew(0, CF_CONTROL); |
| 147 | 147 | ||
| 148 | pr_debug("%s: Vcc %d, io_irq %d, flags %04x csc %04x\n", | 148 | pr_debug("%s: Vcc %d, io_irq %d, flags %04x csc %04x\n", |
| 149 | driver_name, s->Vcc, s->io_irq, s->flags, s->csc_mask); | 149 | driver_name, s->Vcc, s->io_irq, s->flags, s->csc_mask); |
| @@ -270,7 +270,7 @@ static int __init omap_cf_probe(struct platform_device *pdev) | |||
| 270 | omap_cfg_reg(V10_1610_CF_IREQ); | 270 | omap_cfg_reg(V10_1610_CF_IREQ); |
| 271 | omap_cfg_reg(W10_1610_CF_RESET); | 271 | omap_cfg_reg(W10_1610_CF_RESET); |
| 272 | 272 | ||
| 273 | CF_CFG_REG = ~(1 << seg); | 273 | omap_writew(~(1 << seg), CF_CFG); |
| 274 | 274 | ||
| 275 | pr_info("%s: cs%d on irq %d\n", driver_name, seg, irq); | 275 | pr_info("%s: cs%d on irq %d\n", driver_name, seg, irq); |
| 276 | 276 | ||
| @@ -279,14 +279,15 @@ static int __init omap_cf_probe(struct platform_device *pdev) | |||
| 279 | * CF/PCMCIA variants... | 279 | * CF/PCMCIA variants... |
| 280 | */ | 280 | */ |
| 281 | pr_debug("%s: cs%d, previous ccs %08x acs %08x\n", driver_name, | 281 | pr_debug("%s: cs%d, previous ccs %08x acs %08x\n", driver_name, |
| 282 | seg, EMIFS_CCS(seg), EMIFS_ACS(seg)); | 282 | seg, omap_readl(EMIFS_CCS(seg)), omap_readl(EMIFS_ACS(seg))); |
| 283 | EMIFS_CCS(seg) = 0x0004a1b3; /* synch mode 4 etc */ | 283 | omap_writel(0x0004a1b3, EMIFS_CCS(seg)); /* synch mode 4 etc */ |
| 284 | EMIFS_ACS(seg) = 0x00000000; /* OE hold/setup */ | 284 | omap_writel(0x00000000, EMIFS_ACS(seg)); /* OE hold/setup */ |
| 285 | 285 | ||
| 286 | /* CF uses armxor_ck, which is "always" available */ | 286 | /* CF uses armxor_ck, which is "always" available */ |
| 287 | 287 | ||
| 288 | pr_debug("%s: sts %04x cfg %04x control %04x %s\n", driver_name, | 288 | pr_debug("%s: sts %04x cfg %04x control %04x %s\n", driver_name, |
| 289 | CF_STATUS_REG, CF_CFG_REG, CF_CONTROL_REG, | 289 | omap_readw(CF_STATUS), omap_readw(CF_CFG), |
| 290 | omap_readw(CF_CONTROL), | ||
| 290 | omap_cf_present() ? "present" : "(not present)"); | 291 | omap_cf_present() ? "present" : "(not present)"); |
| 291 | 292 | ||
| 292 | cf->socket.owner = THIS_MODULE; | 293 | cf->socket.owner = THIS_MODULE; |
diff --git a/include/asm-arm/arch-omap/tc.h b/include/asm-arm/arch-omap/tc.h index 8ded218cbea5..65a9c82d3bf7 100644 --- a/include/asm-arm/arch-omap/tc.h +++ b/include/asm-arm/arch-omap/tc.h | |||
| @@ -75,16 +75,14 @@ | |||
| 75 | #ifndef __ASSEMBLER__ | 75 | #ifndef __ASSEMBLER__ |
| 76 | 76 | ||
| 77 | /* EMIF Slow Interface Configuration Register */ | 77 | /* EMIF Slow Interface Configuration Register */ |
| 78 | #define OMAP_EMIFS_CONFIG_REG __REG32(EMIFS_CONFIG) | ||
| 79 | |||
| 80 | #define OMAP_EMIFS_CONFIG_FR (1 << 4) | 78 | #define OMAP_EMIFS_CONFIG_FR (1 << 4) |
| 81 | #define OMAP_EMIFS_CONFIG_PDE (1 << 3) | 79 | #define OMAP_EMIFS_CONFIG_PDE (1 << 3) |
| 82 | #define OMAP_EMIFS_CONFIG_PWD_EN (1 << 2) | 80 | #define OMAP_EMIFS_CONFIG_PWD_EN (1 << 2) |
| 83 | #define OMAP_EMIFS_CONFIG_BM (1 << 1) | 81 | #define OMAP_EMIFS_CONFIG_BM (1 << 1) |
| 84 | #define OMAP_EMIFS_CONFIG_WP (1 << 0) | 82 | #define OMAP_EMIFS_CONFIG_WP (1 << 0) |
| 85 | 83 | ||
| 86 | #define EMIFS_CCS(n) __REG32(EMIFS_CS0_CONFIG + (4 * (n))) | 84 | #define EMIFS_CCS(n) (EMIFS_CS0_CONFIG + (4 * (n))) |
| 87 | #define EMIFS_ACS(n) __REG32(EMIFS_ACS0 + (4 * (n))) | 85 | #define EMIFS_ACS(n) (EMIFS_ACS0 + (4 * (n))) |
| 88 | 86 | ||
| 89 | /* Almost all documentation for chip and board memory maps assumes | 87 | /* Almost all documentation for chip and board memory maps assumes |
| 90 | * BM is clear. Most devel boards have a switch to control booting | 88 | * BM is clear. Most devel boards have a switch to control booting |
| @@ -93,13 +91,13 @@ | |||
| 93 | */ | 91 | */ |
| 94 | static inline u32 omap_cs0_phys(void) | 92 | static inline u32 omap_cs0_phys(void) |
| 95 | { | 93 | { |
| 96 | return (OMAP_EMIFS_CONFIG_REG & OMAP_EMIFS_CONFIG_BM) | 94 | return (omap_readl(EMIFS_CONFIG) & OMAP_EMIFS_CONFIG_BM) |
| 97 | ? OMAP_CS3_PHYS : 0; | 95 | ? OMAP_CS3_PHYS : 0; |
| 98 | } | 96 | } |
| 99 | 97 | ||
| 100 | static inline u32 omap_cs3_phys(void) | 98 | static inline u32 omap_cs3_phys(void) |
| 101 | { | 99 | { |
| 102 | return (OMAP_EMIFS_CONFIG_REG & OMAP_EMIFS_CONFIG_BM) | 100 | return (omap_readl(EMIFS_CONFIG) & OMAP_EMIFS_CONFIG_BM) |
| 103 | ? 0 : OMAP_CS3_PHYS; | 101 | ? 0 : OMAP_CS3_PHYS; |
| 104 | } | 102 | } |
| 105 | 103 | ||
