Big clean-up for multi-omap
Subsystems (13)
A message that is not in the archive (sent off-list or not yet received): multi-omap-2008-05-27-212014
Tony Lindgren
maintainercover Big clean-up for multi-omap
Hi all,
Following patches clean up blockers for getting multi-omap closer to working for omap2 like we have for omap1:
- Remove __REG macros, use omap_read/write() instead
- Split omap24xx sram code so no register rewriting is needed
- Introduce struct omap_globals to allow early cpu detection to work
- Make PRM and CM registers work for multi-omap
The __REG patches were posted earlier, but had some issues. They should be fixed now.
The first patch is to test primitive omap type detection with DEBUG_LL. Could somebody please try it out on 15xx and make sure you get output from DEBUG_LL?
Once the DEBU_LL patch works on all omaps, we can use the similar detection for multi-omap non-optimized get_irq_nr_and_base too :)
These patches are against current linux-omap tree, I pushed few fixes there so you pull before trying out these patches.
Regards,
Tony
Tony Lindgren
maintainerPATCH 1/14 ARM: OMAP: Fix debug-macro for multi_omap
Use ARM revision register to set debug serial port base.
--- include/asm-arm/arch-omap/debug-macro.S | 40 ++++++++++++++++++++++-------- 1 files changed, 29 insertions(+), 11 deletions(-)
include/asm-arm/arch-omap/debug-macro.S +29 -11
@@ -12,34 +12,51 @@ */ .macro addruart,rx - mrc p15, 0, \rx, c1, c0 + + /* Detect omap */ + mrc p15, 0, \rx, c0, c0, 0 @ get processor revision + and \rx, \rx, #0x000f0000 @ only check architecture + cmp \rx, #0x00060000 @ is v6? + beq 1000f @ found 925 or 926 (omap1) + cmp \rx, #0x00070000 @ is v7? + beq 2000f @ found arm11 (omap2) + cmp \rx, #0x000f0000 @ is cortex? + beq 3000f @ found cortex (omap3) + +1000: /* Found omap1 */ + mrc p15, 0, \rx, c1, c0 @ get control register tst \rx, #1 @ MMU enabled? -#ifdef CONFIG_ARCH_OMAP1 moveq \rx, #0xff000000 @ physical base address movne \rx, #0xfe000000 @ virtual base - orr \rx, \rx, #0x00fb0000 -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 - orr \rx, \rx, #0x00009000 @ UART 3 -#endif + orr \rx, \rx, #0x00fb0000 @ UART 1 #if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3) orr \rx, \rx, #0x00000800 @ UART 2 & 3 #endif +#ifdef CONFIG_OMAP_LL_DEBUG_UART3 + orr \rx, \rx, #0x00009000 @ UART 3 +#endif + b 9999f @ goto out -#elif CONFIG_ARCH_OMAP2 +2000: /* Found omap2 */ + mrc p15, 0, \rx, c1, c0 @ get control register + tst \rx, #1 @ MMU enabled? moveq \rx, #0x48000000 @ physical base address movne \rx, #0xd8000000 @ virtual base - orr \rx, \rx, #0x0006a000 + orr \rx, \rx, #0x0006a000 @ UART 1 #ifdef CONFIG_OMAP_LL_DEBUG_UART2 add \rx, \rx, #0x00002000 @ UART 2 #endif #ifdef CONFIG_OMAP_LL_DEBUG_UART3 add \rx, \rx, #0x00004000 @ UART 3 #endif + b 9999f @ goto out -#elif CONFIG_ARCH_OMAP3 +3000: /* Found omap3 */ + mrc p15, 0, \rx, c1, c0 @ get control register + tst \rx, #1 @ MMU enabled? moveq \rx, #0x48000000 @ physical base address movne \rx, #0xd8000000 @ virtual base - orr \rx, \rx, #0x0006a000 + orr \rx, \rx, #0x0006a000 @ UART 1 #ifdef CONFIG_OMAP_LL_DEBUG_UART2 add \rx, \rx, #0x00002000 @ UART 2 #endif
@@ -47,7 +64,8 @@ add \rx, \rx, #0x00fb0000 @ UART 3 add \rx, \rx, #0x00006000 #endif -#endif + +9999: .endm .macro senduart,rd,rx
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 2/14 CF: Change omap_cf.c to use omap_readw/writew instead of __REG for multi-omap
Change omap_cf.c to use omap_readw/writew instead of __REG for multi-omap
--- drivers/pcmcia/omap_cf.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
drivers/pcmcia/omap_cf.c +10 -9
@@ -38,19 +38,19 @@#define CF_BASE 0xfffe2800/* status; read after IRQ */ -#define CF_STATUS_REG __REG16(CF_BASE + 0x00) +#define CF_STATUS (CF_BASE + 0x00)# define CF_STATUS_BAD_READ (1 << 2)# define CF_STATUS_BAD_WRITE (1 << 1)# define CF_STATUS_CARD_DETECT (1 << 0)/* which chipselect (CS0..CS3) is used for CF (active low) */ -#define CF_CFG_REG __REG16(CF_BASE + 0x02) +#define CF_CFG (CF_BASE + 0x02)/* card reset */ -#define CF_CONTROL_REG __REG16(CF_BASE + 0x04) +#define CF_CONTROL (CF_BASE + 0x04)# define CF_CONTROL_RESET (1 << 0) -#define omap_cf_present () (!(CF_STATUS_REG & CF_STATUS_CARD_DETECT)) +#define omap_cf_present () (!(omap_readw(CF_STATUS) & CF_STATUS_CARD_DETECT))/*--------------------------------------------------------------------------*/
@@ -139,11 +139,11 @@ omap_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s)return -EINVAL ; } - control =CF_CONTROL_REG ; + control =omap_readw (CF_CONTROL );if (s->flags &SS_RESET ) -CF_CONTROL_REG =CF_CONTROL_RESET ; +omap_writew (CF_CONTROL_RESET ,CF_CONTROL );else -CF_CONTROL_REG =0 ; +omap_writew (0 ,CF_CONTROL );pr_debug ("%s: Vcc %d, io_irq %d, flags %04x csc %04x\n" , 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)omap_cfg_reg (V10_1610_CF_IREQ );omap_cfg_reg (W10_1610_CF_RESET ); -CF_CFG_REG = ~(1 << seg); +omap_writew (~(1 << seg),CF_CFG );pr_info ("%s: cs%d on irq %d\n" , driver_name, seg, irq);
@@ -286,7 +286,8 @@ static int __init omap_cf_probe(struct platform_device *pdev)/* CF uses armxor_ck, which is "always" available */ pr_debug ("%s: sts %04x cfg %04x control %04x %s\n" , driver_name, -CF_STATUS_REG ,CF_CFG_REG ,CF_CONTROL_REG , +omap_readw (CF_STATUS ),omap_readw (CF_CFG ), +omap_readw (CF_CONTROL ),omap_cf_present () ?"present" :"(not present)" ); cf->socket.owner =THIS_MODULE ;
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 3/14 USB: Change omap USB code to use omap_read/write instead of __REG for multi-omap
Change omap USB code to use omap_read/write instead of __REG for multi-omap
--- arch/arm/mach-omap1/board-osk.c | 7 +- arch/arm/plat-omap/usb.c | 132 ++++++++---- drivers/cbus/tahvo-usb.c | 91 +++++--- drivers/i2c/chips/isp1301_omap.c | 163 ++++++++----- drivers/i2c/chips/twl4030-usb.c | 39 ++-- drivers/usb/gadget/omap_udc.c | 472 +++++++++++++++++++++----------------- drivers/usb/gadget/omap_udc.h | 61 +++--- drivers/usb/host/ohci-omap.c | 5 +- include/asm-arm/arch-omap/usb.h | 23 +- 9 files changed, 586 insertions(+), 407 deletions(-)
arch/arm/mach-omap1/board-osk.c +6 -1
@@ -526,6 +526,8 @@ static void __init osk_mistral_init(void) { }static void __init osk_init (void ) { +u32 l; +/* Workaround for wrong CS3 (NOR flash) timing * There are some U-Boot versions out there which configure * wrong CS3 memory timings. This mainly leads to CRC
@@ -539,7 +541,10 @@ static void __init osk_init(void)platform_add_devices (osk5912_devices,ARRAY_SIZE (osk5912_devices)); omap_board_config = osk_config; omap_board_config_size =ARRAY_SIZE (osk_config); -USB_TRANSCEIVER_CTRL_REG |= (3 <<1 ); + + l =omap_readl (USB_TRANSCEIVER_CTRL ); + l |= (3 <<1 ); +omap_writel (l,USB_TRANSCEIVER_CTRL );/* irq for tps65010 chip */ /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */
arch/arm/plat-omap/usb.c +92 -40
259 lines not on this page · raw message
drivers/cbus/tahvo-usb.c +61 -30
206 lines not on this page · raw message
drivers/i2c/chips/isp1301_omap.c +99 -64
481 lines not on this page · raw message
drivers/i2c/chips/twl4030-usb.c +21 -18
@@ -67,15 +67,15 @@#define IFC_CTRL_CARKITMODE (1 << 2)#define IFC_CTRL_FSLSSERIALMODE_3PIN (1 << 1) -#define OTG_CTRL 0x0A -#define OTG_CTRL_SET 0x0B -#define OTG_CTRL_CLR 0x0C -#define OTG_CTRL_DRVVBUS (1 << 5) -#define OTG_CTRL_CHRGVBUS (1 << 4) -#define OTG_CTRL_DISCHRGVBUS (1 << 3) -#define OTG_CTRL_DMPULLDOWN (1 << 2) -#define OTG_CTRL_DPPULLDOWN (1 << 1) -#define OTG_CTRL_IDPULLUP (1 << 0) +#define TWL4030_OTG_CTRL 0x0A +#define TWL4030_OTG_CTRL_SET 0x0B +#define TWL4030_OTG_CTRL_CLR 0x0C +#define TWL4030_OTG_CTRL_DRVVBUS (1 << 5) +#define TWL4030_OTG_CTRL_CHRGVBUS (1 << 4) +#define TWL4030_OTG_CTRL_DISCHRGVBUS (1 << 3) +#define TWL4030_OTG_CTRL_DMPULLDOWN (1 << 2) +#define TWL4030_OTG_CTRL_DPPULLDOWN (1 << 1) +#define TWL4030_OTG_CTRL_IDPULLUP (1 << 0)#define USB_INT_EN_RISE 0x0D#define USB_INT_EN_RISE_SET 0x0E
@@ -253,7 +253,7 @@/* internal define on top of container_of */ #define xceiv_to_twl (x) container_of((x), struct twl4030_usb, otg); -/* bits in OTG_CTRL_REG */ +/* bits in OTG_CTRL */ #define OTG_XCEIV_OUTPUTS \ (OTG_ASESSVLD|OTG_BSESSEND|OTG_BSESSVLD|OTG_VBUSVLD|OTG_ID)
@@ -626,12 +626,13 @@ static int twl4030_set_peripheral(struct otg_transceiver *xceiv, struct usb_gadget *gadget) {struct twl4030_usb *twl =xceiv_to_twl (xceiv); +u32 l;if (!xceiv)return -ENODEV ;if (!gadget) { -OTG_IRQ_EN_REG =0 ; +omap_writew (0 ,OTG_IRQ_EN );twl4030_phy_suspend (1 ); twl->otg.gadget =NULL ;
@@ -641,9 +642,10 @@ static int twl4030_set_peripheral(struct otg_transceiver *xceiv, twl->otg.gadget = gadget;twl4030_phy_resume (); -OTG_CTRL_REG = (OTG_CTRL_REG &OTG_CTRL_MASK - & ~(OTG_XCEIV_OUTPUTS |OTG_CTRL_BITS )) - |OTG_ID ; + l =omap_readl (OTG_CTRL ) &OTG_CTRL_MASK ; + l &= ~(OTG_XCEIV_OUTPUTS |OTG_CTRL_BITS ); + l |=OTG_ID ; +omap_writel (l,OTG_CTRL ); twl->otg.state =OTG_STATE_B_IDLE ;
@@ -663,7 +665,7 @@ static int twl4030_set_host(struct otg_transceiver *xceiv, struct usb_bus *host)return -ENODEV ;if (!host) { -OTG_IRQ_EN_REG =0 ; +omap_writew (0 ,OTG_IRQ_EN );twl4030_phy_suspend (1 ); twl->otg.host =NULL ;
@@ -673,12 +675,13 @@ static int twl4030_set_host(struct otg_transceiver *xceiv, struct usb_bus *host) twl->otg.host = host;twl4030_phy_resume (); -twl4030_usb_set_bits (twl,OTG_CTRL , -OTG_CTRL_DMPULLDOWN |OTG_CTRL_DPPULLDOWN ); +twl4030_usb_set_bits (twl,TWL4030_OTG_CTRL , +TWL4030_OTG_CTRL_DMPULLDOWN + |TWL4030_OTG_CTRL_DPPULLDOWN );twl4030_usb_set_bits (twl,USB_INT_EN_RISE ,USB_INT_IDGND );twl4030_usb_set_bits (twl,USB_INT_EN_FALL ,USB_INT_IDGND );twl4030_usb_set_bits (twl,FUNC_CTRL ,FUNC_CTRL_SUSPENDM ); -twl4030_usb_set_bits (twl,OTG_CTRL ,OTG_CTRL_DRVVBUS ); +twl4030_usb_set_bits (twl,TWL4030_OTG_CTRL ,TWL4030_OTG_CTRL_DRVVBUS );return 0 ; }
drivers/usb/gadget/omap_udc.c +263 -209
1,202 lines not on this page · raw message
drivers/usb/gadget/omap_udc.h +30 -31
154 lines not on this page · raw message
drivers/usb/host/ohci-omap.c +4 -1
@@ -169,13 +169,16 @@ static void start_hnp(struct ohci_hcd *ohci) {const unsigned port =ohci_to_hcd (ohci)->self.otg_port -1 ;unsigned long flags; +u32 l;otg_start_hnp (ohci->transceiver);local_irq_save (flags); ohci->transceiver->state =OTG_STATE_A_SUSPEND ;writel (RH_PS_PSS , &ohci->regs->roothub.portstatus [port]); -OTG_CTRL_REG &= ~OTG_A_BUSREQ ; + l =omap_readl (OTG_CTRL ); + l &= ~OTG_A_BUSREQ ; +omap_writel (l,OTG_CTRL );local_irq_restore (flags); }
include/asm-arm/arch-omap/usb.h +10 -13
@@ -37,11 +37,8 @@ void __init usb_ehci_init(void);/* * OTG and transceiver registers, for OMAPs starting with ARM926 */ -#define OTG_REG32 (offset) __REG32(OTG_BASE + (offset)) -#define OTG_REG16 (offset) __REG16(OTG_BASE + (offset)) - -#define OTG_REV_REG OTG_REG32(0x00) -#define OTG_SYSCON_1_REG OTG_REG32(0x04) +#define OTG_REV (OTG_BASE + 0x00) +#define OTG_SYSCON_1 (OTG_BASE + 0x04)# define USB2_TRX_MODE (w) (((w)>>24)&0x07)# define USB1_TRX_MODE (w) (((w)>>20)&0x07)# define USB0_TRX_MODE (w) (((w)>>16)&0x07)
@@ -50,7 +47,7 @@ void __init usb_ehci_init(void);# define DEV_IDLE_EN (1 << 13)# define OTG_RESET_DONE (1 << 2)# define OTG_SOFT_RESET (1 << 1) -#define OTG_SYSCON_2_REG OTG_REG32(0x08) +#define OTG_SYSCON_2 (OTG_BASE + 0x08)# define OTG_EN (1 << 31)# define USBX_SYNCHRO (1 << 30)# define OTG_MST16 (1 << 29)
@@ -68,7 +65,7 @@ void __init usb_ehci_init(void);# define HMC_TLLSPEED (1 << 7)# define HMC_TLLATTACH (1 << 6)# define OTG_HMC (w) (((w)>>0)&0x3f) -#define OTG_CTRL_REG OTG_REG32(0x0c) +#define OTG_CTRL (OTG_BASE + 0x0c)# define OTG_USB2_EN (1 << 29)# define OTG_USB2_DP (1 << 28)# define OTG_USB2_DM (1 << 27)
@@ -95,7 +92,7 @@ void __init usb_ehci_init(void);# define OTG_PD_VBUS (1 << 2)# define OTG_PU_VBUS (1 << 1)# define OTG_PU_ID (1 << 0) -#define OTG_IRQ_EN_REG OTG_REG16(0x10) +#define OTG_IRQ_EN (OTG_BASE + 0x10)/* 16-bit */ # define DRIVER_SWITCH (1 << 15)# define A_VBUS_ERR (1 << 13)# define A_REQ_TMROUT (1 << 12)
@@ -105,9 +102,9 @@ void __init usb_ehci_init(void);# define B_SRP_DONE (1 << 8)# define B_SRP_STARTED (1 << 7)# define OPRT_CHG (1 << 0) -#define OTG_IRQ_SRC_REG OTG_REG16(0x14) +#define OTG_IRQ_SRC (OTG_BASE + 0x14)/* 16-bit */ // same bits as in IRQ_EN -#define OTG_OUTCTRL_REG OTG_REG16(0x18) +#define OTG_OUTCTRL (OTG_BASE + 0x18)/* 16-bit */ # define OTGVPD (1 << 14)# define OTGVPU (1 << 13)# define OTGPUID (1 << 12)
@@ -120,13 +117,13 @@ void __init usb_ehci_init(void);# define USB0VDR (1 << 2)# define USB0PDEN (1 << 1)# define USB0PUEN (1 << 0) -#define OTG_TEST_REG OTG_REG16(0x20) -#define OTG_VENDOR_CODE_REG OTG_REG32(0xfc) +#define OTG_TEST (OTG_BASE + 0x20)/* 16-bit */ +#define OTG_VENDOR_CODE (OTG_BASE + 0xfc)/* 16-bit */ /*-------------------------------------------------------------------------*/ /* OMAP1 */ -#define USB_TRANSCEIVER_CTRL_REG __REG32(0xfffe1000 + 0x0064) +#define USB_TRANSCEIVER_CTRL (0xfffe1000 + 0x0064)# define CONF_USB2_UNI_R (1 << 8)# define CONF_USB1_UNI_R (1 << 7)# define CONF_USB_PORT0_R (x) (((x)>>4)&0x7)
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 4/14 ARM: OMAP: Change __REG access to omap/read write for traffic controller
Change __REG access to omap/read write for traffic controller
--- arch/arm/mach-omap1/board-osk.c | 11 ++++++++--- drivers/mtd/maps/omap_nor.c | 15 +++++++++++---- drivers/pcmcia/omap_cf.c | 6 +++--- include/asm-arm/arch-omap/tc.h | 10 ++++------ 4 files changed, 26 insertions(+), 16 deletions(-)
arch/arm/mach-omap1/board-osk.c +8 -3
@@ -267,13 +267,17 @@ static struct i2c_board_info __initdata osk_i2c_board_info[] = {static void __init osk_init_smc91x (void ) { +u32 l; +if ((gpio_request (0 ,"smc_irq" )) <0 ) {printk ("Error requesting gpio 0 for smc91x irq\n" );return ; }/* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */ -EMIFS_CCS (1 ) |=0x3 ; + l =omap_readl (EMIFS_CCS (1 )); + l |=0x3 ; +omap_writel (l,EMIFS_CCS (1 )); }static void __init osk_init_cf (void )
@@ -533,8 +537,9 @@ static void __init osk_init(void)* wrong CS3 memory timings. This mainly leads to CRC * or similar errors if you use NOR flash (e.g. with JFFS2) */ -if (EMIFS_CCS (3 ) !=EMIFS_CS3_VAL ) -EMIFS_CCS (3 ) =EMIFS_CS3_VAL ; + l =omap_readl (EMIFS_CCS (3 )); +if (l !=EMIFS_CS3_VAL ) +omap_writel (EMIFS_CS3_VAL ,EMIFS_CCS (3 )); osk_flash_resource.end = osk_flash_resource.start =omap_cs3_phys (); osk_flash_resource.end +=SZ_32M -1 ;
drivers/mtd/maps/omap_nor.c +11 -4
@@ -60,14 +60,21 @@ struct omapflash_info {static void omap_set_vpp (struct map_info *map,int enable) {static int count; +u32 l;if (cpu_class_is_omap1 ()) {if (enable) { -if (count++ ==0 ) -OMAP_EMIFS_CONFIG_REG |=OMAP_EMIFS_CONFIG_WP ; +if (count++ ==0 ) { + l =omap_readl (EMIFS_CONFIG ); + l |=OMAP_EMIFS_CONFIG_WP ; +omap_writel (l,EMIFS_CONFIG ); + } }else { -if (count && (--count ==0 )) -OMAP_EMIFS_CONFIG_REG &= ~OMAP_EMIFS_CONFIG_WP ; +if (count && (--count ==0 )) { + l =omap_readl (EMIFS_CONFIG ); + l &= ~OMAP_EMIFS_CONFIG_WP ; +omap_writel (l,EMIFS_CONFIG ); + } } } }
drivers/pcmcia/omap_cf.c +3 -3
@@ -279,9 +279,9 @@ static int __init omap_cf_probe(struct platform_device *pdev)* CF/PCMCIA variants... */ pr_debug ("%s: cs%d, previous ccs %08x acs %08x\n" , driver_name, - seg,EMIFS_CCS (seg),EMIFS_ACS (seg)); -EMIFS_CCS (seg) =0x0004a1b3 ;/* synch mode 4 etc */ -EMIFS_ACS (seg) =0x00000000 ;/* OE hold/setup */ + seg,omap_readl (EMIFS_CCS (seg)),omap_readl (EMIFS_ACS (seg))); +omap_writel (0x0004a1b3 ,EMIFS_CCS (seg));/* synch mode 4 etc */ +omap_writel (0x00000000 ,EMIFS_ACS (seg));/* OE hold/setup */ /* CF uses armxor_ck, which is "always" available */
include/asm-arm/arch-omap/tc.h +4 -6
@@ -75,16 +75,14 @@#ifndef __ASSEMBLER__/* EMIF Slow Interface Configuration Register */ -#define OMAP_EMIFS_CONFIG_REG __REG32(EMIFS_CONFIG) -#define OMAP_EMIFS_CONFIG_FR (1 << 4)#define OMAP_EMIFS_CONFIG_PDE (1 << 3)#define OMAP_EMIFS_CONFIG_PWD_EN (1 << 2)#define OMAP_EMIFS_CONFIG_BM (1 << 1)#define OMAP_EMIFS_CONFIG_WP (1 << 0) -#define EMIFS_CCS (n) __REG32(EMIFS_CS0_CONFIG + (4 * (n))) -#define EMIFS_ACS (n) __REG32(EMIFS_ACS0 + (4 * (n))) +#define EMIFS_CCS (n) (EMIFS_CS0_CONFIG + (4 * (n))) +#define EMIFS_ACS (n) (EMIFS_ACS0 + (4 * (n)))/* Almost all documentation for chip and board memory maps assumes * BM is clear. Most devel boards have a switch to control booting
@@ -93,13 +91,13 @@*/ static inline u32 omap_cs0_phys (void ) { -return (OMAP_EMIFS_CONFIG_REG &OMAP_EMIFS_CONFIG_BM ) +return (omap_readl (EMIFS_CONFIG ) &OMAP_EMIFS_CONFIG_BM ) ?OMAP_CS3_PHYS :0 ; }static inline u32 omap_cs3_phys (void ) { -return (OMAP_EMIFS_CONFIG_REG &OMAP_EMIFS_CONFIG_BM ) +return (omap_readl (EMIFS_CONFIG ) &OMAP_EMIFS_CONFIG_BM ) ?0 :OMAP_CS3_PHYS ; }
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 5/14 musb_hdrc: Change __REG access to omap_read/write for multi-boot
Change __REG access to omap_read/write for multi-boot
--- drivers/usb/musb/omap2430.c | 48 ++++++++++++++++++++++++++++++------------ drivers/usb/musb/omap2430.h | 14 ++++++------ 2 files changed, 41 insertions(+), 21 deletions(-)
drivers/usb/musb/omap2430.c +34 -14
@@ -216,6 +216,7 @@ void musb_platform_set_mode(struct musb *musb, u8 musb_mode)int __init musb_platform_init (struct musb *musb) {struct otg_transceiver *xceiv =otg_get_transceiver (); +u32 l;#if defined(CONFIG_ARCH_OMAP2430 )omap_cfg_reg (AE5_2430_USB0HS_STP );
@@ -224,20 +225,25 @@ int __init musb_platform_init(struct musb *musb) musb->xceiv = *xceiv;musb_platform_resume (musb); -OTG_SYSCONFIG_REG &= ~ENABLEWAKEUP ;/* disable wakeup */ -OTG_SYSCONFIG_REG &= ~NOSTDBY ;/* remove possible nostdby */ -OTG_SYSCONFIG_REG |=SMARTSTDBY ;/* enable smart standby */ -OTG_SYSCONFIG_REG &= ~AUTOIDLE ;/* disable auto idle */ -OTG_SYSCONFIG_REG &= ~NOIDLE ;/* remove possible noidle */ -OTG_SYSCONFIG_REG |=SMARTIDLE ;/* enable smart idle */ -OTG_SYSCONFIG_REG |=AUTOIDLE ;/* enable auto idle */ + l =omap_readl (OTG_SYSCONFIG ); + l &= ~ENABLEWAKEUP ;/* disable wakeup */ + l &= ~NOSTDBY ;/* remove possible nostdby */ + l |=SMARTSTDBY ;/* enable smart standby */ + l &= ~AUTOIDLE ;/* disable auto idle */ + l &= ~NOIDLE ;/* remove possible noidle */ + l |=SMARTIDLE ;/* enable smart idle */ + l |=AUTOIDLE ;/* enable auto idle */ +omap_writel (l,OTG_SYSCONFIG ); -OTG_INTERFSEL_REG |=ULPI_12PIN ; + l =omap_readl (OTG_INTERFSEL ); + l |=ULPI_12PIN ; +omap_writel (l,OTG_INTERFSEL );pr_debug ("HS USB OTG: revision 0x%x, sysconfig 0x%02x, " "sysstatus 0x%x, intrfsel 0x%x, simenable 0x%x\n" , -OTG_REVISION_REG ,OTG_SYSCONFIG_REG ,OTG_SYSSTATUS_REG , -OTG_INTERFSEL_REG ,OTG_SIMENABLE_REG ); +omap_readl (OTG_REVISION ),omap_readl (OTG_SYSCONFIG ), +omap_readl (OTG_SYSSTATUS ),omap_readl (OTG_INTERFSEL ), +omap_readl (OTG_SIMENABLE ));omap_vbus_power (musb, musb->board_mode ==MUSB_HOST ,1 );
@@ -254,12 +260,19 @@ int __init musb_platform_init(struct musb *musb)int musb_platform_suspend (struct musb *musb) { +u32 l; +if (!musb->clock)return 0 ;/* in any role */ -OTG_FORCESTDBY_REG |=ENABLEFORCE ;/* enable MSTANDBY */ -OTG_SYSCONFIG_REG |=ENABLEWAKEUP ;/* enable wakeup */ + l =omap_readl (OTG_FORCESTDBY ); + l |=ENABLEFORCE ;/* enable MSTANDBY */ +omap_writel (l,OTG_FORCESTDBY ); + + l =omap_readl (OTG_SYSCONFIG ); + l |=ENABLEWAKEUP ;/* enable wakeup */ +omap_writel (l,OTG_SYSCONFIG );if (musb->xceiv.set_suspend) musb->xceiv.set_suspend (&musb->xceiv,1 );
@@ -274,6 +287,8 @@ int musb_platform_suspend(struct musb *musb)int musb_platform_resume (struct musb *musb) { +u32 l; +if (!musb->clock)return 0 ;
@@ -285,8 +300,13 @@ int musb_platform_resume(struct musb *musb)else clk_enable (musb->clock); -OTG_SYSCONFIG_REG &= ~ENABLEWAKEUP ;/* disable wakeup */ -OTG_FORCESTDBY_REG &= ~ENABLEFORCE ;/* disable MSTANDBY */ + l =omap_readl (OTG_SYSCONFIG ); + l &= ~ENABLEWAKEUP ;/* disable wakeup */ +omap_writel (l,OTG_SYSCONFIG ); + + l =omap_readl (OTG_FORCESTDBY ); + l &= ~ENABLEFORCE ;/* disable MSTANDBY */ +omap_writel (l,OTG_FORCESTDBY );return 0 ; }
drivers/usb/musb/omap2430.h +7 -7
@@ -24,9 +24,9 @@#elif defined(CONFIG_ARCH_OMAP3430 )#define OMAP_HSOTG_BASE (OMAP34XX_HSUSB_OTG_BASE)#endif -#define OMAP_HSOTG (offset) __REG32(OMAP_HSOTG_BASE + 0x400 + (offset)) -#define OTG_REVISION_REG OMAP_HSOTG(0x0) -#define OTG_SYSCONFIG_REG OMAP_HSOTG(0x4) +#define OMAP_HSOTG (offset) (OMAP_HSOTG_BASE + 0x400 + (offset)) +#define OTG_REVISION OMAP_HSOTG(0x0) +#define OTG_SYSCONFIG OMAP_HSOTG(0x4)# define MIDLEMODE 12/* bit position */ # define FORCESTDBY (0 << MIDLEMODE)# define NOSTDBY (1 << MIDLEMODE)
@@ -38,17 +38,17 @@# define ENABLEWAKEUP (1 << 2)# define SOFTRST (1 << 1)# define AUTOIDLE (1 << 0) -#define OTG_SYSSTATUS_REG OMAP_HSOTG(0x8) +#define OTG_SYSSTATUS OMAP_HSOTG(0x8)# define RESETDONE (1 << 0) -#define OTG_INTERFSEL_REG OMAP_HSOTG(0xc) +#define OTG_INTERFSEL OMAP_HSOTG(0xc)# define EXTCP (1 << 2)# define PHYSEL 0/* bit position */ # define UTMI_8BIT (0 << PHYSEL)# define ULPI_12PIN (1 << PHYSEL)# define ULPI_8PIN (2 << PHYSEL) -#define OTG_SIMENABLE_REG OMAP_HSOTG(0x10) +#define OTG_SIMENABLE OMAP_HSOTG(0x10)# define TM1 (1 << 0) -#define OTG_FORCESTDBY_REG OMAP_HSOTG(0x14) +#define OTG_FORCESTDBY OMAP_HSOTG(0x14)# define ENABLEFORCE (1 << 0)#endif /* CONFIG_ARCH_OMAP2430 */
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 6/14 ARM: OMAP: Remove __REG access for multi-omap
This does not play nicely with multi-omap as it cannot be replaced by a function in io.c for omaps with different IO bases.
--- include/asm-arm/arch-omap/io.h | 23 ----------------------- 1 files changed, 0 insertions(+), 23 deletions(-)
include/asm-arm/arch-omap/io.h +0 -23
@@ -183,35 +183,12 @@#define omap_writew (v,a) (*(volatile unsigned short *)IO_ADDRESS(a) = (v))#define omap_writel (v,a) (*(volatile unsigned int *)IO_ADDRESS(a) = (v)) -/* 16 bit uses LDRH/STRH, base +/- offset_8 */ -typedef struct {volatile u16 offset[256 ]; }__regbase16 ; -#define __REGV16 (vaddr) ((__regbase16 *)((vaddr)&~0xff)) \ - ->offset[((vaddr)&0xff)>>1] -#define __REG16 (paddr) __REGV16(io_p2v(paddr)) - -/* 8/32 bit uses LDR/STR, base +/- offset_12 */ -typedef struct {volatile u8 offset[4096 ]; }__regbase8 ; -#define __REGV8 (vaddr) ((__regbase8 *)((vaddr)&~4095)) \ - ->offset[((vaddr)&4095)>>0] -#define __REG8 (paddr) __REGV8(io_p2v(paddr)) - -typedef struct {volatile u32 offset[4096 ]; }__regbase32 ; -#define __REGV32 (vaddr) ((__regbase32 *)((vaddr)&~4095)) \ - ->offset[((vaddr)&4095)>>2] -#define __REG32 (paddr) __REGV32(io_p2v(paddr)) -extern void omap1_map_common_io (void );extern void omap1_init_common_hw (void );extern void omap2_map_common_io (void );extern void omap2_init_common_hw (void ); -#else - -#define __REG8 (paddr) io_p2v(paddr) -#define __REG16 (paddr) io_p2v(paddr) -#define __REG32 (paddr) io_p2v(paddr) -#endif #endif
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 7/14 ARM: OMAP: Split sleep24xx.S into sleep242x.S and sleep243x.S
Split sleep24xx.S into sleep242x.S and sleep243x.S. This is easier to follow than rewriting the registers.
--- arch/arm/mach-omap2/Makefile | 13 ++-- arch/arm/mach-omap2/pm24xx.c | 30 ++++----- arch/arm/mach-omap2/sleep242x.S | 131 ++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/sleep243x.S | 131 ++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/sleep24xx.S | 133 --------------------------------------- include/asm-arm/arch-omap/pm.h | 12 +++- 6 files changed, 289 insertions(+), 161 deletions(-) create mode 100644 arch/arm/mach-omap2/sleep242x.S create mode 100644 arch/arm/mach-omap2/sleep243x.S delete mode 100644 arch/arm/mach-omap2/sleep24xx.S
arch/arm/mach-omap2/Makefile +6 -7
@@ -14,15 +14,14 @@ obj-$(CONFIG_ARCH_OMAP3) += sram34xx.o # Power Management obj-$(CONFIG_PM) += pm.o -ifeq ($(CONFIG_ARCH_OMAP2),y) -obj-$(CONFIG_PM) += pm24xx.o sleep24xx.o +ifeq ($(CONFIG_PM),y) +obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o +obj-$(CONFIG_ARCH_OMAP2420) += sleep242x.o +obj-$(CONFIG_ARCH_OMAP2430) += sleep243x.o +obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o +obj-$(CONFIG_PM_DEBUG) += pm-debug.o endif -ifeq ($(CONFIG_ARCH_OMAP3),y) -obj-$(CONFIG_PM) += pm34xx.o sleep34xx.o -endif -obj-$(CONFIG_PM_DEBUG) += pm-debug.o - # Clock framework obj-$(CONFIG_ARCH_OMAP2) += clock24xx.o obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o
arch/arm/mach-omap2/pm24xx.c +13 -17
@@ -52,10 +52,6 @@#include "sdrc.h" #include "pm.h" -/* These addrs are in assembly language code to be patched at runtime */ -extern void *omap2_ocs_sdrc_power; -extern void *omap2_ocs_sdrc_dlla_ctrl; -static void (*omap2_sram_idle)(void );static void (*omap2_sram_suspend)(void __iomem *dllctrl);static void (*saved_idle)(void );
@@ -495,19 +491,19 @@ int __init omap2_pm_init(void)* These routines need to be in SRAM as that's the only * memory the MPU can see when it wakes up. */ - omap2_sram_idle =omap_sram_push (omap24xx_idle_loop_suspend, - omap24xx_idle_loop_suspend_sz); - - omap2_sram_suspend =omap_sram_push (omap24xx_cpu_suspend, - omap24xx_cpu_suspend_sz); - -/* Patch in the correct register addresses for multiboot */ -omap_sram_patch_va (omap24xx_cpu_suspend, &omap2_ocs_sdrc_power, - omap2_sram_suspend, -OMAP_SDRC_REGADDR (SDRC_POWER )); -omap_sram_patch_va (omap24xx_cpu_suspend, &omap2_ocs_sdrc_dlla_ctrl, - omap2_sram_suspend, -OMAP_SDRC_REGADDR (SDRC_DLLA_CTRL )); +if (cpu_is_omap242x ()) { + omap2_sram_idle =omap_sram_push (omap242x_idle_loop_suspend, + omap242x_idle_loop_suspend_sz); + + omap2_sram_suspend =omap_sram_push (omap242x_cpu_suspend, + omap242x_cpu_suspend_sz); + }else { + omap2_sram_idle =omap_sram_push (omap243x_idle_loop_suspend, + omap243x_idle_loop_suspend_sz); + + omap2_sram_suspend =omap_sram_push (omap243x_cpu_suspend, + omap243x_cpu_suspend_sz); + }suspend_set_ops (&omap_pm_ops); pm_idle = omap2_pm_idle;
arch/arm/mach-omap2/sleep242x.S new file +131 -0
131 lines not on this page · raw message
arch/arm/mach-omap2/sleep243x.S new file +131 -0
131 lines not on this page · raw message
arch/arm/mach-omap2/sleep24xx.S deleted +0 -133
133 lines not on this page · raw message
include/asm-arm/arch-omap/pm.h +8 -4
@@ -145,22 +145,26 @@ static inline void omap2_allow_sleep(void) { }extern void omap730_cpu_suspend (unsigned short ,unsigned short );extern void omap1510_cpu_suspend (unsigned short ,unsigned short );extern void omap1610_cpu_suspend (unsigned short ,unsigned short ); -extern void omap24xx_cpu_suspend (u32 dll_ctrl,u32 cpu_revision); +extern void omap242x_cpu_suspend (u32 dll_ctrl,u32 cpu_revision); +extern void omap243x_cpu_suspend (u32 dll_ctrl,u32 cpu_revision);extern void omap34xx_cpu_suspend (u32 *addr,int save_state);extern void omap730_idle_loop_suspend (void );extern void omap1510_idle_loop_suspend (void );extern void omap1610_idle_loop_suspend (void ); -extern void omap24xx_idle_loop_suspend (void ); +extern void omap242x_idle_loop_suspend (void ); +extern void omap243x_idle_loop_suspend (void );extern unsigned int omap730_cpu_suspend_sz;extern unsigned int omap1510_cpu_suspend_sz;extern unsigned int omap1610_cpu_suspend_sz; -extern unsigned int omap24xx_cpu_suspend_sz; +extern unsigned int omap242x_cpu_suspend_sz; +extern unsigned int omap243x_cpu_suspend_sz;extern unsigned int omap34xx_cpu_suspend_sz;extern unsigned int omap730_idle_loop_suspend_sz;extern unsigned int omap1510_idle_loop_suspend_sz;extern unsigned int omap1610_idle_loop_suspend_sz; -extern unsigned int omap24xx_idle_loop_suspend_sz; +extern unsigned int omap242x_idle_loop_suspend_sz; +extern unsigned int omap243x_idle_loop_suspend_sz;extern unsigned int omap34xx_suspend_sz;#ifdef CONFIG_OMAP_SERIAL_WAKE
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 8/14 ARM: OMAP: Split sram24xx.S into sram242x.S and sram243x.S
Split sram24xx.S into sram242x.S and sram243x.S
--- arch/arm/mach-omap2/Makefile | 3 +- arch/arm/mach-omap2/clock.c | 7 +- arch/arm/mach-omap2/pm24xx.c | 4 +- arch/arm/mach-omap2/prcm-common.h | 1 + arch/arm/mach-omap2/prm.h | 19 ++- arch/arm/mach-omap2/sram242x.S | 321 +++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/sram243x.S | 321 +++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/sram24xx.S | 337 ------------------------------------- arch/arm/plat-omap/sram.c | 121 ++++---------- include/asm-arm/arch-omap/sram.h | 25 ++- 10 files changed, 723 insertions(+), 436 deletions(-) create mode 100644 arch/arm/mach-omap2/sram242x.S create mode 100644 arch/arm/mach-omap2/sram243x.S delete mode 100644 arch/arm/mach-omap2/sram24xx.S
arch/arm/mach-omap2/Makefile +2 -1
@@ -8,7 +8,8 @@ obj-y := irq.o id.o io.o memory.o control.o prcm.o clock.o mux.o \ clockdomain.o # Functions loaded to SRAM -obj-$(CONFIG_ARCH_OMAP2) += sram24xx.o +obj-$(CONFIG_ARCH_OMAP2420) += sram242x.o +obj-$(CONFIG_ARCH_OMAP2430) += sram243x.o obj-$(CONFIG_ARCH_OMAP3) += sram34xx.o # Power Management
arch/arm/mach-omap2/clock.c +4 -3
@@ -652,7 +652,8 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate) clk->rate = clk->parent->rate / new_div;if (clk->flags &DELAYED_APP &&cpu_is_omap24xx ()) { -__raw_writel (OMAP24XX_VALID_CONFIG ,OMAP24XX_PRCM_CLKCFG_CTRL ); +prm_write_mod_reg (OMAP24XX_VALID_CONFIG , +OMAP24XX_GR_MOD ,OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET );wmb (); }
@@ -748,8 +749,8 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)wmb ();if (clk->flags &DELAYED_APP &&cpu_is_omap24xx ()) { -__raw_writel (OMAP24XX_VALID_CONFIG , -OMAP24XX_PRCM_CLKCFG_CTRL ); +prm_write_mod_reg (OMAP24XX_VALID_CONFIG , +OMAP24XX_GR_MOD ,OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET );wmb (); }
arch/arm/mach-omap2/pm24xx.c +2 -2
@@ -437,12 +437,12 @@ static void __init prcm_setup_regs(void)/* Configure automatic voltage transition */ __raw_writel (2 <<OMAP_SETUP_TIME_SHIFT ,OMAP24XX_PRCM_VOLTSETUP ); -__raw_writel (OMAP24XX_AUTO_EXTVOLT | +prm_write_mod_reg (OMAP24XX_AUTO_EXTVOLT | (0x1 <<OMAP24XX_SETOFF_LEVEL_SHIFT ) |OMAP24XX_MEMRETCTRL | (0x1 <<OMAP24XX_SETRET_LEVEL_SHIFT ) | (0x0 <<OMAP24XX_VOLT_LEVEL_SHIFT ), -OMAP24XX_PRCM_VOLTCTRL ); +OMAP24XX_GR_MOD ,OMAP24XX_PRCM_VOLTCTRL_OFFSET );/* Enable wake-up events */ prm_write_mod_reg(OMAP24XX_EN_GPIOS | OMAP24XX_EN_GPT1,
arch/arm/mach-omap2/prcm-common.h +1 -0
@@ -32,6 +32,7 @@/* Chip-specific module offsets */ +#define OMAP24XX_GR_MOD OCP_MOD#define OMAP24XX_DSP_MOD 0x800#define OMAP2430_MDM_MOD 0xc00
arch/arm/mach-omap2/prm.h +17 -2
@@ -38,18 +38,33 @@* */ +/* Global 24xx registers in GR_MOD (Same as OCP_MOD for 24xx) */ +#define OMAP24XX_PRCM_VOLTCTRL_OFFSET 0x0050 +#define OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET 0x0080 + +/* 242x GR_MOD registers, use these only for assembly code */ +#define OMAP242X_PRCM_VOLTCTRL OMAP2420_PRM_REGADDR(OMAP24XX_GR_MOD, \ + OMAP24XX_PRCM_VOLTCTRL_OFFSET) +#define OMAP242X_PRCM_CLKCFG_CTRL OMAP2420_PRM_REGADDR(OMAP24XX_GR_MOD, \ + OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET) + +/* 243x GR_MOD registers, use these only for assembly code */ +#define OMAP243X_PRCM_VOLTCTRL OMAP2430_PRM_REGADDR(OMAP24XX_GR_MOD, \ + OMAP24XX_PRCM_VOLTCTRL_OFFSET) +#define OMAP243X_PRCM_CLKCFG_CTRL OMAP2430_PRM_REGADDR(OMAP24XX_GR_MOD, \ + OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET) + +/* These will disappear */ #define OMAP24XX_PRCM_REVISION OMAP_PRM_REGADDR(OCP_MOD, 0x0000)#define OMAP24XX_PRCM_SYSCONFIG OMAP_PRM_REGADDR(OCP_MOD, 0x0010)#define OMAP24XX_PRCM_IRQSTATUS_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x0018)#define OMAP24XX_PRCM_IRQENABLE_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x001c) -#define OMAP24XX_PRCM_VOLTCTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0050)#define OMAP24XX_PRCM_VOLTST OMAP_PRM_REGADDR(OCP_MOD, 0x0054)#define OMAP24XX_PRCM_CLKSRC_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0060)#define OMAP24XX_PRCM_CLKOUT_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0070)#define OMAP24XX_PRCM_CLKEMUL_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0078) -#define OMAP24XX_PRCM_CLKCFG_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0080)#define OMAP24XX_PRCM_CLKCFG_STATUS OMAP_PRM_REGADDR(OCP_MOD, 0x0084)#define OMAP24XX_PRCM_VOLTSETUP OMAP_PRM_REGADDR(OCP_MOD, 0x0090)#define OMAP24XX_PRCM_CLKSSETUP OMAP_PRM_REGADDR(OCP_MOD, 0x0094)
arch/arm/mach-omap2/sram242x.S new file +321 -0
321 lines not on this page · raw message
arch/arm/mach-omap2/sram243x.S new file +321 -0
321 lines not on this page · raw message
arch/arm/mach-omap2/sram24xx.S deleted +0 -337
337 lines not on this page · raw message
arch/arm/plat-omap/sram.c +36 -85
144 lines not on this page · raw message
include/asm-arm/arch-omap/sram.h +19 -6
@@ -31,17 +31,30 @@ extern unsigned long omap1_sram_reprogram_clock_sz;extern void omap24xx_sram_reprogram_clock (u32 ckctl,u32 dpllctl);extern unsigned long omap24xx_sram_reprogram_clock_sz; -extern void omap24xx_sram_ddr_init (u32 *slow_dll_ctrl,u32 fast_dll_ctrl, +extern void omap242x_sram_ddr_init (u32 *slow_dll_ctrl,u32 fast_dll_ctrl,u32 base_cs,u32 force_unlock); -extern unsigned long omap24xx_sram_ddr_init_sz; +extern unsigned long omap242x_sram_ddr_init_sz; -extern u32 omap24xx_sram_set_prcm (u32 dpll_ctrl_val,u32 sdrc_rfr_val, +extern u32 omap242x_sram_set_prcm (u32 dpll_ctrl_val,u32 sdrc_rfr_val,int bypass); -extern unsigned long omap24xx_sram_set_prcm_sz; +extern unsigned long omap242x_sram_set_prcm_sz; -extern void omap24xx_sram_reprogram_sdrc (u32 perf_level,u32 dll_val, +extern void omap242x_sram_reprogram_sdrc (u32 perf_level,u32 dll_val,u32 mem_type); -extern unsigned long omap24xx_sram_reprogram_sdrc_sz; +extern unsigned long omap242x_sram_reprogram_sdrc_sz; + + +extern void omap243x_sram_ddr_init (u32 *slow_dll_ctrl,u32 fast_dll_ctrl, +u32 base_cs,u32 force_unlock); +extern unsigned long omap243x_sram_ddr_init_sz; + +extern u32 omap243x_sram_set_prcm (u32 dpll_ctrl_val,u32 sdrc_rfr_val, +int bypass); +extern unsigned long omap243x_sram_set_prcm_sz; + +extern void omap243x_sram_reprogram_sdrc (u32 perf_level,u32 dll_val, +u32 mem_type); +extern unsigned long omap243x_sram_reprogram_sdrc_sz; extern void omap34xx_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 9/14 ARM: OMAP: Remove omap_sram_patch_va
This is no longer needed as the 24xx *.S files have been split into 242x and 243x specific files.
--- arch/arm/plat-omap/Kconfig | 10 ------ arch/arm/plat-omap/sram.c | 60 -------------------------------------- include/asm-arm/arch-omap/sram.h | 3 -- include/linux/poison.h | 6 ---- 4 files changed, 0 insertions(+), 79 deletions(-)
arch/arm/plat-omap/Kconfig +0 -10
@@ -32,16 +32,6 @@ config OMAP_DEBUG_LEDS depends on OMAP_DEBUG_DEVICES default y if LEDS || LEDS_OMAP_DEBUG -config OMAP_DEBUG_SRAM_PATCH - bool "Extra sanity checking for SRAM patch code" - depends on ARCH_OMAP - default y - help - Say Y here if you want the kernel to use extra caution - in patching SRAM virtual addresses. If you are - confident in your SRAM code, disabling this will save - about 600 bytes. - config OMAP_DEBUG_POWERDOMAIN bool "Emit debug messages from powerdomain layer" depends on ARCH_OMAP2 || ARCH_OMAP3
arch/arm/plat-omap/sram.c +0 -60
66 lines not on this page · raw message
include/asm-arm/arch-omap/sram.h +0 -3
@@ -11,11 +11,8 @@#ifndef __ARCH_ARM_OMAP_SRAM_H#define __ARCH_ARM_OMAP_SRAM_H -#include <linux/poison.h> /* for SRAM_VA_MAGIC */ -extern int __init omap_sram_init (void );extern void *omap_sram_push (void * start,unsigned long size); -extern int omap_sram_patch_va (void *srcfn,void *srcd,void *sramfn,void __iomem *d);extern void omap_sram_reprogram_clock (u32 dpllctl,u32 ckctl); extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
include/linux/poison.h +0 -6
@@ -68,10 +68,4 @@/********** sound/oss/ **********/ #define OSS_POISON_FREE 0xAB -/* -* Used in arch/arm/plat-omap/sram.h to mark SRAM addresses that -* will be patched at runtime -*/ -#define SRAM_VA_MAGIC 0xbadfeed1 -#endif
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 10/14 ARM: OMAP: Introduce omap_globals and prcm access functions for multi-omap
New struct omap_globals contains the omap processor specific module bases. Use omap_globals to set the various base addresses before to make detecting omap chip type simpler.
Also introduce OMAP2_IO_ADDRESS for future multi-omap patches.
--- arch/arm/mach-omap2/cm.h | 12 +------ arch/arm/mach-omap2/control.c | 12 +++--- arch/arm/mach-omap2/memory.c | 11 +++++- arch/arm/mach-omap2/mux.c | 2 +- arch/arm/mach-omap2/prcm.c | 51 ++++++++++++++++++++++++++++++ arch/arm/mach-omap2/prm.h | 14 +------- arch/arm/mach-omap2/sdrc.h | 10 ++--- arch/arm/plat-omap/common.c | 59 +++++++++++++++++++++++++++++----- include/asm-arm/arch-omap/common.h | 15 +++++++++ include/asm-arm/arch-omap/control.h | 4 +-- include/asm-arm/arch-omap/io.h | 3 ++ 11 files changed, 144 insertions(+), 49 deletions(-)
arch/arm/mach-omap2/cm.h +2 -10
@@ -114,17 +114,9 @@ static __inline__ u32 __attribute__((unused)) cm_rmw_reg_bits(u32 mask,/* Clock management domain register get/set */ #ifndef __ASSEMBLER__ -static __inline__void __attribute__((unused))cm_write_mod_reg (u32 val, -s16 module,s16 idx) -{ -__raw_writel (val,OMAP_CM_REGADDR (module, idx)); -} -static __inline__u32 __attribute__((unused))cm_read_mod_reg (s16 module, -s16 idx) -{ -return __raw_readl (OMAP_CM_REGADDR (module, idx)); -} +extern u32 cm_read_mod_reg (s16 module,u16 idx); +extern void cm_write_mod_reg (u32 val,s16 module,u16 idx);/* Read-modify-write bits in a CM register (by domain) */ static __inline__ u32 __attribute__((unused)) cm_rmw_mod_reg_bits(u32 mask,
arch/arm/mach-omap2/control.c +6 -6
@@ -15,19 +15,19 @@#include <linux/kernel.h> #include <linux/io.h> +#include <asm/arch/common.h> #include <asm/arch/control.h> -static u32 omap2_ctrl_base; +static void __iomem *omap2_ctrl_base; -#define OMAP_CTRL_REGADDR (reg) \ - (__force void __iomem *)IO_ADDRESS(omap2_ctrl_base + (reg)) +#define OMAP_CTRL_REGADDR (reg) (omap2_ctrl_base + (reg)) -void omap_ctrl_base_set (u32 base) +void __init omap2_set_globals_control (struct omap_globals *omap2_globals) { - omap2_ctrl_base = base; + omap2_ctrl_base = omap2_globals->ctrl; } -u32 omap_ctrl_base_get (void ) +void __iomem *omap_ctrl_base_get (void ) {return omap2_ctrl_base; }
arch/arm/mach-omap2/memory.c +9 -2
@@ -24,6 +24,7 @@#include <asm/io.h> +#include <asm/arch/common.h> #include <asm/arch/clock.h> #include <asm/arch/sram.h>
@@ -32,8 +33,8 @@#include "memory.h" #include "sdrc.h" -unsigned long omap2_sdrc_base; -unsigned long omap2_sms_base; +void __iomem *omap2_sdrc_base; +void __iomem *omap2_sms_base;static struct memory_timings mem_timings;static u32 curr_perf_level =CORE_CLK_SRC_DPLL_X2 ;
@@ -154,6 +155,12 @@ void omap2_init_memory_params(u32 force_lock_to_unlock_mode) mem_timings.slow_dll_ctrl |= ((1 <<1 ) | (3 <<8 )); } +void __init omap2_set_globals_memory (struct omap_globals *omap2_globals) +{ + omap2_sdrc_base = omap2_globals->sdrc; + omap2_sms_base = omap2_globals->sms; +} +/* turn on smart idle modes for SDRAM scheduler and controller */ void __init omap2_init_memory (void ) {
arch/arm/mach-omap2/mux.c +1 -1
@@ -381,7 +381,7 @@ static void __init_or_module omap2_cfg_debug(const struct pin_config *cfg, u16 r warn = (orig != reg);if (debug || warn)printk (KERN_WARNING -"MUX: setup %s (0x%08x): 0x%04x -> 0x%04x\n" , +"MUX: setup %s (0x%p): 0x%04x -> 0x%04x\n" , cfg->name,omap_ctrl_base_get () + cfg->mux_reg, orig, reg); }
arch/arm/mach-omap2/prcm.c +51 -0
66 lines not on this page · raw message
arch/arm/mach-omap2/prm.h +2 -12
@@ -201,18 +201,8 @@ static u32 __attribute__((unused)) prm_clear_mod_reg_bits(u32 bits, s16 module, }/* Power/reset management domain register get/set */ - -static __inline__void __attribute__((unused))prm_write_mod_reg (u32 val, -s16 module,s16 idx) -{ -__raw_writel (val,OMAP_PRM_REGADDR (module, idx)); -} - -static __inline__u32 __attribute__((unused))prm_read_mod_reg (s16 module, -s16 idx) -{ -return __raw_readl (OMAP_PRM_REGADDR (module, idx)); -} +extern u32 prm_read_mod_reg (s16 module,u16 idx); +extern void prm_write_mod_reg (u32 val,s16 module,u16 idx);#endif
arch/arm/mach-omap2/sdrc.h +4 -6
@@ -18,13 +18,11 @@#include <asm/arch/sdrc.h> #ifndef __ASSEMBLER__ -extern unsigned long omap2_sdrc_base; -extern unsigned long omap2_sms_base; +extern void __iomem *omap2_sdrc_base; +extern void __iomem *omap2_sms_base; -#define OMAP_SDRC_REGADDR (reg) \ - (void __iomem *)IO_ADDRESS(omap2_sdrc_base + (reg)) -#define OMAP_SMS_REGADDR (reg) \ - (void __iomem *)IO_ADDRESS(omap2_sms_base + (reg)) +#define OMAP_SDRC_REGADDR (reg) (omap2_sdrc_base + (reg)) +#define OMAP_SMS_REGADDR (reg) (omap2_sms_base + (reg))/* SDRC global register get/set */
arch/arm/plat-omap/common.c +50 -9
86 lines not on this page · raw message
include/asm-arm/arch-omap/common.h +15 -0
@@ -48,8 +48,23 @@ static inline int omap_register_i2c_bus(int bus_id, u32 clkrate, }#endif +/* IO bases for various OMAP processors */ +struct omap_globals { +void __iomem *tap;/* Control module ID code */ +void __iomem *sdrc;/* SDRAM Controller */ +void __iomem *sms;/* SDRAM Memory Scheduler */ +void __iomem *ctrl;/* System Control Module */ +void __iomem *prm;/* Power and Reset Management */ +void __iomem *cm;/* Clock Management */ +}; +void omap2_set_globals_242x (void );void omap2_set_globals_243x (void );void omap2_set_globals_343x (void ); +/* These get called from omap2_set_globals_xxxx(), do not call these */ +void omap2_set_globals_memory (struct omap_globals *); +void omap2_set_globals_control (struct omap_globals *); +void omap2_set_globals_prcm (struct omap_globals *); +#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
include/asm-arm/arch-omap/control.h +1 -3
@@ -173,8 +173,7 @@#ifndef __ASSEMBLY__#if defined(CONFIG_ARCH_OMAP2 ) || defined(CONFIG_ARCH_OMAP3 ) -extern void omap_ctrl_base_set (u32 base); -extern u32 omap_ctrl_base_get (void ); +extern void __iomem *omap_ctrl_base_get (void );extern u8 omap_ctrl_readb (u16 offset);extern u16 omap_ctrl_readw (u16 offset);extern u32 omap_ctrl_readl (u16 offset);
@@ -182,7 +181,6 @@ extern void omap_ctrl_writeb(u8 val, u16 offset);extern void omap_ctrl_writew (u16 val,u16 offset);extern void omap_ctrl_writel (u32 val,u16 offset);#else -#define omap_ctrl_base_set (x) WARN_ON(1)#define omap_ctrl_base_get () 0#define omap_ctrl_readb (x) 0#define omap_ctrl_readw (x) 0
include/asm-arm/arch-omap/io.h +3 -0
@@ -60,6 +60,7 @@#define IO_SIZE 0x40000#define IO_VIRT (IO_PHYS - IO_OFFSET)#define IO_ADDRESS (pa) ((pa) - IO_OFFSET) +#define OMAP1_IO_ADDRESS (pa) ((pa) - IO_OFFSET)#define io_p2v (pa) ((pa) - IO_OFFSET)#define io_v2p (va) ((va) + IO_OFFSET)
@@ -91,6 +92,7 @@#define IO_OFFSET 0x90000000#define IO_ADDRESS (pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ +#define OMAP2_IO_ADDRESS (pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ #define io_p2v (pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ #define io_v2p (va) ((va) - IO_OFFSET)/* Works for L3 and L4 */
@@ -148,6 +150,7 @@#define IO_OFFSET 0x90000000#define IO_ADDRESS (pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ +#define OMAP2_IO_ADDRESS (pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ #define io_p2v (pa) ((pa) + IO_OFFSET)/* Works for L3 and L4 */ #define io_v2p (va) ((va) - IO_OFFSET)/* Works for L3 and L4 */
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 11/14 ARM: OMAP: Remove OMAP_PRM_REGADDR
Remove OMAP_PRM_REGADDR. Use prm_read/write_mod_reg() instead. For assembly, use OMAPXXXX_PRM_REGADDR macros.
--- arch/arm/mach-omap2/clock24xx.c | 55 +++++++++- arch/arm/mach-omap2/clock24xx.h | 27 +++--- arch/arm/mach-omap2/clock34xx.h | 2 +- arch/arm/mach-omap2/memory.c | 3 +- arch/arm/mach-omap2/pm24xx.c | 21 +++-- arch/arm/mach-omap2/prcm.c | 14 +++ arch/arm/mach-omap2/prm.h | 192 +++++++++++++++++++----------------- arch/arm/plat-omap/common.c | 1 + include/asm-arm/arch-omap/clock.h | 3 +- include/asm-arm/arch-omap/common.h | 5 + 10 files changed, 206 insertions(+), 117 deletions(-)
arch/arm/mach-omap2/clock24xx.c +50 -5
@@ -28,6 +28,7 @@#include <linux/io.h> #include <linux/cpufreq.h> +#include <asm/arch/common.h> #include <asm/arch/clock.h> #include <asm/arch/sram.h> #include <asm/div64.h>
@@ -77,16 +78,16 @@ static u32 omap2_get_dpll_rate_24xx(struct clk *tclk)static int omap2_enable_osc_ck (struct clk *clk) { -prm_rmw_reg_bits (OMAP_AUTOEXTCLKMODE_MASK ,0 , -OMAP24XX_PRCM_CLKSRC_CTRL ); +prm_rmw_mod_reg_bits (OMAP_AUTOEXTCLKMODE_MASK ,0 , +OMAP24XX_GR_MOD ,OMAP24XX_PRCM_CLKSRC_CTRL_OFFSET );return 0 ; }static void omap2_disable_osc_ck (struct clk *clk) { -prm_rmw_reg_bits (OMAP_AUTOEXTCLKMODE_MASK ,OMAP_AUTOEXTCLKMODE_MASK , -OMAP24XX_PRCM_CLKSRC_CTRL ); +prm_rmw_mod_reg_bits (OMAP_AUTOEXTCLKMODE_MASK ,OMAP_AUTOEXTCLKMODE_MASK , +OMAP24XX_GR_MOD ,OMAP24XX_PRCM_CLKSRC_CTRL_OFFSET ); }/* Enable an APLL if off */
@@ -443,7 +444,8 @@ static u32 omap2_get_sysclkdiv(void) {u32 div; - div =__raw_readl (OMAP24XX_PRCM_CLKSRC_CTRL ); + div =prm_read_mod_reg (OMAP24XX_GR_MOD , +OMAP24XX_PRCM_CLKSRC_CTRL_OFFSET ); div &=OMAP_SYSCLKDIV_MASK ; div >>=OMAP_SYSCLKDIV_SHIFT ;
@@ -499,6 +501,37 @@ static int __init omap2_clk_arch_init(void) }arch_initcall (omap2_clk_arch_init); +static u32 prm_base; +static u32 cm_base; + +/* +* Since we share clock data for 242x and 243x, we need to rewrite some +* some register base offsets. Assume offset is at prm_base if flagged, +* else assume it's cm_base. +*/ +static inline void omap2_clk_check_reg (u32 flags,void __iomem **reg) +{ +u32 tmp = (__force u32)*reg; + +if ((tmp >>24 ) !=0 ) +return ; + +if (flags &OFFSET_GR_MOD ) + tmp += prm_base; +else + tmp += cm_base; + + *reg = (__force void __iomem *)tmp; +} + +void __init omap2_clk_rewrite_base (struct clk *clk) +{ +omap2_clk_check_reg (clk->flags, &clk->clksel_reg); +omap2_clk_check_reg (clk->flags, &clk->enable_reg); +if (clk->dpll_data) +omap2_clk_check_reg (0 , &clk->dpll_data->mult_div1_reg); +} +int __init omap2_clk_init (void ) {struct prcm_config *prcm;
@@ -510,6 +543,12 @@ int __init omap2_clk_init(void)else if (cpu_is_omap2430 ()) cpu_mask =RATE_IN_243X ; +for (clkp = onchip_24xx_clks; + clkp < onchip_24xx_clks +ARRAY_SIZE (onchip_24xx_clks); + clkp++) { +omap2_clk_rewrite_base (*clkp); + } +clk_init (&omap2_clk_functions);omap2_osc_clk_recalc (&osc_ck);
@@ -561,3 +600,9 @@ int __init omap2_clk_init(void)return 0 ; } + +void __init omap2_set_globals_clock24xx (struct omap_globals *omap2_globals) +{ + prm_base = (__force u32 )omap2_globals->prm; + cm_base = (__force u32 )omap2_globals->cm; +}
arch/arm/mach-omap2/clock24xx.h +15 -12
@@ -600,6 +600,8 @@ static struct prcm_config rate_table[] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, }; +#define _GR_MOD_OFFSET (reg) ((void __iomem*)(OMAP24XX_GR_MOD + (reg))) +/*------------------------------------------------------------------------- * 24xx clock tree. *
@@ -877,11 +879,11 @@ static struct clk sys_clkout_src = { .name = "sys_clkout_src", .parent = &func_54m_ck, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | - RATE_PROPAGATES, - .enable_reg = OMAP24XX_PRCM_CLKOUT_CTRL, + RATE_PROPAGATES | OFFSET_GR_MOD, + .enable_reg = _GR_MOD_OFFSET(OMAP24XX_PRCM_CLKOUT_CTRL_OFFSET), .enable_bit = OMAP24XX_CLKOUT_EN_SHIFT, .init = &omap2_init_clksel_parent, - .clksel_reg = OMAP24XX_PRCM_CLKOUT_CTRL, + .clksel_reg = _GR_MOD_OFFSET(OMAP24XX_PRCM_CLKOUT_CTRL_OFFSET), .clksel_mask = OMAP24XX_CLKOUT_SOURCE_MASK, .clksel = common_clkout_src_clksel, .recalc = &omap2_clksel_recalc,
@@ -907,8 +909,8 @@ static struct clk sys_clkout = { .name = "sys_clkout", .parent = &sys_clkout_src, .flags =CLOCK_IN_OMAP242X |CLOCK_IN_OMAP243X | - PARENT_CONTROLS_CLOCK, - .clksel_reg = OMAP24XX_PRCM_CLKOUT_CTRL, + PARENT_CONTROLS_CLOCK | OFFSET_GR_MOD, + .clksel_reg = _GR_MOD_OFFSET(OMAP24XX_PRCM_CLKOUT_CTRL_OFFSET), .clksel_mask = OMAP24XX_CLKOUT_DIV_MASK, .clksel = sys_clkout_clksel, .recalc = &omap2_clksel_recalc,
@@ -920,11 +922,11 @@ static struct clk sys_clkout = {static struct clk sys_clkout2_src = { .name ="sys_clkout2_src" , .parent = &func_54m_ck, - .flags =CLOCK_IN_OMAP242X |RATE_PROPAGATES , - .enable_reg =OMAP24XX_PRCM_CLKOUT_CTRL , + .flags =CLOCK_IN_OMAP242X |RATE_PROPAGATES |OFFSET_GR_MOD , + .enable_reg =_GR_MOD_OFFSET (OMAP24XX_PRCM_CLKOUT_CTRL_OFFSET ), .enable_bit =OMAP2420_CLKOUT2_EN_SHIFT , .init = &omap2_init_clksel_parent, - .clksel_reg =OMAP24XX_PRCM_CLKOUT_CTRL , + .clksel_reg =_GR_MOD_OFFSET (OMAP24XX_PRCM_CLKOUT_CTRL_OFFSET ), .clksel_mask =OMAP2420_CLKOUT2_SOURCE_MASK , .clksel = common_clkout_src_clksel, .recalc = &omap2_clksel_recalc,
@@ -941,8 +943,9 @@ static const struct clksel sys_clkout2_clksel[] = {static struct clk sys_clkout2 = { .name ="sys_clkout2" , .parent = &sys_clkout2_src, - .flags =CLOCK_IN_OMAP242X |PARENT_CONTROLS_CLOCK , - .clksel_reg =OMAP24XX_PRCM_CLKOUT_CTRL , + .flags =CLOCK_IN_OMAP242X |PARENT_CONTROLS_CLOCK | +OFFSET_GR_MOD , + .clksel_reg =_GR_MOD_OFFSET (OMAP24XX_PRCM_CLKOUT_CTRL_OFFSET ), .clksel_mask =OMAP2420_CLKOUT2_DIV_MASK , .clksel = sys_clkout2_clksel, .recalc = &omap2_clksel_recalc,
@@ -953,8 +956,8 @@ static struct clk sys_clkout2 = {static struct clk emul_ck = { .name ="emul_ck" , .parent = &func_54m_ck, - .flags =CLOCK_IN_OMAP242X , - .enable_reg =OMAP24XX_PRCM_CLKEMUL_CTRL , + .flags =CLOCK_IN_OMAP242X |OFFSET_GR_MOD , + .enable_reg =_GR_MOD_OFFSET (OMAP24XX_PRCM_CLKEMUL_CTRL_OFFSET ), .enable_bit =OMAP24XX_EMULATION_EN_SHIFT , .recalc = &followparent_recalc,
arch/arm/mach-omap2/clock34xx.h +1 -1
@@ -2219,7 +2219,7 @@ static struct clk usbhost_sar_fck = { .name = "usbhost_sar_fck", .parent = &osc_sys_ck, .init = &omap2_init_clk_clkdm, - .enable_reg = OMAP_PRM_REGADDR(OMAP3430ES2_USBHOST_MOD, PM_PWSTCTRL), + .enable_reg = OMAP34XX_PRM_REGADDR(OMAP3430ES2_USBHOST_MOD, PM_PWSTCTRL), .enable_bit = OMAP3430ES2_SAVEANDRESTORE_SHIFT, .flags = CLOCK_IN_OMAP3430ES2, .clkdm_name = "usbhost_clkdm",
arch/arm/mach-omap2/memory.c +2 -1
@@ -94,7 +94,8 @@ u32 omap2_reprogram_sdrc(u32 level, u32 force) m_type =omap2_memory_get_type ();local_irq_save (flags); -__raw_writel (0xffff ,OMAP24XX_PRCM_VOLTSETUP ); +prm_write_mod_reg (0xffff ,OMAP24XX_GR_MOD , +OMAP24XX_PRCM_VOLTSETUP_OFFSET );omap2_sram_reprogram_sdrc (level, dll_ctrl, m_type); curr_perf_level = level;local_irq_restore (flags);
arch/arm/mach-omap2/pm24xx.c +13 -8
@@ -134,14 +134,16 @@ no_sleep:prm_clear_mod_reg_bits (0x4 |0x1 ,WKUP_MOD ,PM_WKST );/* MPU domain wake events */ - l =__raw_readl (OMAP24XX_PRCM_IRQSTATUS_MPU ); + l =prm_read_mod_reg (OCP_MOD ,OMAP24XX_PRCM_IRQSTATUS_MPU_OFFSET );if (l &0x01 ) -__raw_writel (0x01 ,OMAP24XX_PRCM_IRQSTATUS_MPU ); +prm_write_mod_reg (0x01 ,OCP_MOD , +OMAP24XX_PRCM_IRQSTATUS_MPU_OFFSET );if (l &0x20 ) -__raw_writel (0x20 ,OMAP24XX_PRCM_IRQSTATUS_MPU ); +prm_write_mod_reg (0x20 ,OCP_MOD , +OMAP24XX_PRCM_IRQSTATUS_MPU_OFFSET );/* Mask future PRCM-to-MPU interrupts */ -__raw_writel (0x0 ,OMAP24XX_PRCM_IRQSTATUS_MPU ); +prm_write_mod_reg (0x0 ,OCP_MOD ,OMAP24XX_PRCM_IRQSTATUS_MPU_OFFSET ); }static int omap2_i2c_active (void )
@@ -327,7 +329,8 @@ static void __init prcm_setup_regs(void)u32 l;/* Enable autoidle */ -__raw_writel (OMAP24XX_AUTOIDLE ,OMAP24XX_PRCM_SYSCONFIG ); +prm_write_mod_reg (OMAP24XX_AUTOIDLE ,OCP_MOD , +OMAP24XX_PRCM_SYSCONFIG_OFFSET );/* Set all domain wakeup dependencies */ prm_write_mod_reg (OMAP_EN_WKUP_MASK ,MPU_MOD ,PM_WKDEP );
@@ -433,10 +436,12 @@ static void __init prcm_setup_regs(void)/* REVISIT: Configure number of 32 kHz clock cycles for sys_clk * stabilisation */ -__raw_writel (15 <<OMAP_SETUP_TIME_SHIFT ,OMAP24XX_PRCM_CLKSSETUP ); +prm_write_mod_reg (15 <<OMAP_SETUP_TIME_SHIFT ,OMAP24XX_GR_MOD , +OMAP24XX_PRCM_CLKSSETUP_OFFSET );/* Configure automatic voltage transition */ -__raw_writel (2 <<OMAP_SETUP_TIME_SHIFT ,OMAP24XX_PRCM_VOLTSETUP ); +prm_write_mod_reg (2 <<OMAP_SETUP_TIME_SHIFT ,OMAP24XX_GR_MOD , +OMAP24XX_PRCM_VOLTSETUP_OFFSET ); prm_write_mod_reg(OMAP24XX_AUTO_EXTVOLT | (0x1 << OMAP24XX_SETOFF_LEVEL_SHIFT) | OMAP24XX_MEMRETCTRL |
@@ -454,7 +459,7 @@ int __init omap2_pm_init(void)u32 l;printk (KERN_INFO "Power Management for OMAP2 initializing\n" ); - l =__raw_readl (OMAP24XX_PRCM_REVISION ); + l =prm_read_mod_reg (OCP_MOD ,OMAP24XX_PRCM_REVISION_OFFSET );printk (KERN_INFO "PRCM revision %d.%d\n" , (l >>4 ) &0x0f , l &0x0f ); osc_ck =clk_get (NULL ,"osc_ck" );
arch/arm/mach-omap2/prcm.c +14 -0
@@ -78,6 +78,20 @@ void prm_write_mod_reg(u32 val, s16 module, u16 idx) }EXPORT_SYMBOL (prm_write_mod_reg); +/* Read-modify-write a register in a PRM module. Caller must lock */ +u32 prm_rmw_mod_reg_bits (u32 mask,u32 bits,s16 module,s16 idx) +{ +u32 v; + + v =prm_read_mod_reg (module, idx); + v &= ~mask; + v |= bits; +prm_write_mod_reg (v, module, idx); + +return v; +} +EXPORT_SYMBOL (prm_rmw_mod_reg_bits); +/* Read a register in a CM module */ u32 cm_read_mod_reg (s16 module,u16 idx) {
arch/arm/mach-omap2/prm.h +103 -89
235 lines not on this page · raw message
arch/arm/plat-omap/common.c +1 -0
@@ -271,6 +271,7 @@ static void __init __omap2_set_globals(void)omap2_set_globals_memory (omap2_globals);omap2_set_globals_control (omap2_globals);omap2_set_globals_prcm (omap2_globals); + omap2_set_globals_clock24xx(omap2_globals); }#endif
include/asm-arm/arch-omap/clock.h +2 -1
@@ -139,7 +139,8 @@ extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);#define CONFIG_PARTICIPANT (1 << 10)/* Fundamental clock */ #define ENABLE_ON_INIT (1 << 11)/* Enable upon framework init */ #define INVERT_ENABLE (1 << 12)/* 0 enables, 1 disables */ -/* bits 13-20 are currently free */ +#define OFFSET_GR_MOD (1 << 13)/* 24xx GR_MOD reg as offset */ +/* bits 14-20 are currently free */ #define CLOCK_IN_OMAP310 (1 << 21)#define CLOCK_IN_OMAP730 (1 << 22)#define CLOCK_IN_OMAP1510 (1 << 23)
include/asm-arm/arch-omap/common.h +5 -0
@@ -66,5 +66,10 @@ void omap2_set_globals_343x(void);void omap2_set_globals_memory (struct omap_globals *);void omap2_set_globals_control (struct omap_globals *);void omap2_set_globals_prcm (struct omap_globals *); +#ifdef CONFIG_ARCH_OMAP24XX +void omap2_set_globals_clock24xx (struct omap_globals *); +#else +#define omap2_set_globals_clock24xx (x) do { } while (0) +#endif #endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 12/14 ARM: OMAP: Remove OMAP_CM_REGADDR for multi-boot
Please use OMAP2420_CM_REGADDR, OMAP2430_CM_REGADDR or OMAP34XX_CM_REGADDR instead.
--- arch/arm/mach-omap2/clock.c | 5 +- arch/arm/mach-omap2/clock34xx.h | 409 ++++++++++++++++++++------------------- arch/arm/mach-omap2/cm.h | 15 +- 3 files changed, 217 insertions(+), 212 deletions(-)
arch/arm/mach-omap2/clock.c +3 -2
@@ -28,6 +28,7 @@#include <asm/arch/clockdomain.h> #include <asm/arch/sram.h> #include <asm/arch/cpu.h> +#include <asm/arch/prcm.h> #include <asm/div64.h> #include "memory.h"
@@ -245,8 +246,8 @@ static void omap2_clk_wait_ready(struct clk *clk)/* REVISIT: What are the appropriate exclusions for 34XX? */ /* OMAP3: ignore DSS-mod clocks */ if (cpu_is_omap34xx () && - ((reg & ~0xff ) == (__force u32 )OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,0 ) || - (((reg & ~0xff ) == (__force u32 )OMAP_CM_REGADDR (CORE_MOD ,0 )) && + ((reg & ~0xff ) ==cm_read_mod_reg (OMAP3430_DSS_MOD ,0 ) || + (((reg & ~0xff ) ==cm_read_mod_reg (CORE_MOD ,0 )) && clk->enable_bit ==OMAP3430_EN_SSI_SHIFT )))return ;
arch/arm/mach-omap2/clock34xx.h +206 -203
1,497 lines not on this page · raw message
arch/arm/mach-omap2/cm.h +8 -7
@@ -19,26 +19,27 @@#ifndef __ASSEMBLER__#define OMAP_CM_REGADDR (module, reg) \ (__force void __iomem *)IO_ADDRESS(OMAP2_CM_BASE + (module) + (reg)) -#else +#endif +#define OMAP2420_CM_REGADDR (module, reg) \ IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))#define OMAP2430_CM_REGADDR (module, reg) \ IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))#define OMAP34XX_CM_REGADDR (module, reg) \ IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg)) -#endif /* * Architecture-specific global CM registers -* Use cm_{read,write}_reg() with these registers. +* Use __raw_{read,write}l() with these registers. * These registers appear once per CM module. */ -#define OMAP3430_CM_REVISION OMAP_CM_REGADDR(OCP_MOD, 0x0000) -#define OMAP3430_CM_SYSCONFIG OMAP_CM_REGADDR(OCP_MOD, 0x0010) -#define OMAP3430_CM_POLCTRL OMAP_CM_REGADDR(OCP_MOD, 0x009c) +#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000) +#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010) +#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c) -#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070) +#define OMAP3430_CM_CLKOUT_CTRL \ + OMAP34XX_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)#ifndef __ASSEMBLER__
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 13/14 ARM: OMAP: Change to use CM offsets for clocks for multi-omap
Change to use CM offsets for clocks for multi-omap
--- arch/arm/mach-omap2/clock24xx.c | 9 +- arch/arm/mach-omap2/clock24xx.h | 295 ++++++++++++++++++++------------------- arch/arm/mach-omap2/cm.h | 13 +-- arch/arm/mach-omap2/prcm.c | 14 ++ 4 files changed, 172 insertions(+), 159 deletions(-)
arch/arm/mach-omap2/clock24xx.c +7 -2
@@ -94,6 +94,7 @@ static void omap2_disable_osc_ck(struct clk *clk)static int omap2_clk_fixed_enable (struct clk *clk) {u32 cval, apll_mask; +void __iomem *idlest; apll_mask =EN_APLL_LOCKED << clk->enable_bit;
@@ -111,8 +112,12 @@ static int omap2_clk_fixed_enable(struct clk *clk)else if (clk == &apll54_ck) cval =OMAP24XX_ST_54M_APLL ; -omap2_wait_clock_ready (OMAP_CM_REGADDR (PLL_MOD ,CM_IDLEST ), cval, - clk->name); +if (cpu_is_omap242x ()) + idlest =OMAP2420_CM_REGADDR (PLL_MOD ,CM_IDLEST ); +else + idlest =OMAP2430_CM_REGADDR (PLL_MOD ,CM_IDLEST ); + +omap2_wait_clock_ready (idlest, cval, clk->name);/* * REVISIT: Should we return an error code if omap2_wait_clock_ready()
arch/arm/mach-omap2/clock24xx.h +150 -145
1,076 lines not on this page · raw message
arch/arm/mach-omap2/cm.h +1 -12
@@ -16,11 +16,6 @@#include "prcm-common.h" -#ifndef __ASSEMBLER__ -#define OMAP_CM_REGADDR (module, reg) \ - (__force void __iomem *)IO_ADDRESS(OMAP2_CM_BASE + (module) + (reg)) -#endif -#define OMAP2420_CM_REGADDR (module, reg) \ IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))#define OMAP2430_CM_REGADDR (module, reg) \
@@ -118,13 +113,7 @@ static __inline__ u32 __attribute__((unused)) cm_rmw_reg_bits(u32 mask,extern u32 cm_read_mod_reg (s16 module,u16 idx);extern void cm_write_mod_reg (u32 val,s16 module,u16 idx); - -/* Read-modify-write bits in a CM register (by domain) */ -static __inline__u32 __attribute__((unused))cm_rmw_mod_reg_bits (u32 mask, -u32 bits,s16 module,s16 idx) -{ -return cm_rmw_reg_bits (mask, bits,OMAP_CM_REGADDR (module, idx)); -} +extern u32 cm_rmw_mod_reg_bits (u32 mask,u32 bits,s16 module,s16 idx);static __inline__u32 __attribute__((unused))cm_set_mod_reg_bits (u32 bits,s16 module,s16 idx)
arch/arm/mach-omap2/prcm.c +14 -0
@@ -106,6 +106,20 @@ void cm_write_mod_reg(u32 val, s16 module, u16 idx) }EXPORT_SYMBOL (cm_write_mod_reg); +/* Read-modify-write a register in a CM module. Caller must lock */ +u32 cm_rmw_mod_reg_bits (u32 mask,u32 bits,s16 module,s16 idx) +{ +u32 v; + + v =cm_read_mod_reg (module, idx); + v &= ~mask; + v |= bits; +cm_write_mod_reg (v, module, idx); + +return v; +} +EXPORT_SYMBOL (cm_rmw_mod_reg_bits); +void __init omap2_set_globals_prcm (struct omap_globals *omap2_globals) { prm_base = omap2_globals->prm;
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerPATCH 14/14 ARM: OMAP: Use omap_globals for CPU detection for multi-omap
This allows to get rid of the ifdefs and will allow simpler CPU detection in the future.
--- arch/arm/mach-omap2/id.c | 43 ++++++++++++++++++++++------------- arch/arm/plat-omap/common.c | 4 +++ include/asm-arm/arch-omap/common.h | 2 + include/asm-arm/arch-omap/cpu.h | 5 ++++ 4 files changed, 38 insertions(+), 16 deletions(-)
arch/arm/mach-omap2/id.c +27 -16
@@ -16,24 +16,15 @@#include <linux/init.h> #include <linux/io.h> +#include <asm/arch/common.h> #include <asm/arch/control.h> #include <asm/arch/cpu.h> -#if defined(CONFIG_ARCH_OMAP2420 ) -#define TAP_BASE (__force void __iomem *)io_p2v(0x48014000) -#elif defined(CONFIG_ARCH_OMAP2430 ) -#define TAP_BASE (__force void __iomem *)io_p2v(0x4900A000) -#elif defined(CONFIG_ARCH_OMAP34XX ) -#define TAP_BASE (__force void __iomem *)io_p2v(0x4830A000) -#endif +static u32 class; +static void __iomem *tap_base; +static u16 tap_prod_id;#define OMAP_TAP_IDCODE 0x0204 -#if defined(CONFIG_ARCH_OMAP34XX ) -#define OMAP_TAP_PROD_ID 0x0210 -#else -#define OMAP_TAP_PROD_ID 0x0208 -#endif -#define OMAP_TAP_DIE_ID_0 0x0218#define OMAP_TAP_DIE_ID_1 0x021C#define OMAP_TAP_DIE_ID_2 0x0220
@@ -92,18 +83,24 @@ static u32 __init read_tap_reg(int reg)* it means its Cortex r0p0 which is 3430 ES1 */ if ((((cpuid >>4 ) &0xFFF ) ==0xC08 ) && ((cpuid &0xF ) ==0x0 )) { + +if (reg == tap_prod_id) { + regval =0x000F00F0 ; + goto out; + } +switch (reg) {case OMAP_TAP_IDCODE : regval =0x0B7AE02F ;break ;/* Making DevType as 0xF in ES1 to differ from ES2 */ -case OMAP_TAP_PROD_ID : regval =0x000F00F0 ;break ;case OMAP_TAP_DIE_ID_0 : regval =0x01000000 ;break ;case OMAP_TAP_DIE_ID_1 : regval =0x1012d687 ;break ;case OMAP_TAP_DIE_ID_2 : regval =0x00000000 ;break ;case OMAP_TAP_DIE_ID_3 : regval =0x2d2c0000 ;break ; } }else - regval =__raw_readl (TAP_BASE + reg); + regval =__raw_readl (tap_base + reg); +out:return regval; }
@@ -202,7 +199,7 @@ void __init omap2_check_revision(void)u8 rev; idcode =read_tap_reg (OMAP_TAP_IDCODE ); - prod_id =read_tap_reg (OMAP_TAP_PROD_ID ); + prod_id =read_tap_reg (tap_prod_id); hawkeye = (idcode >>12 ) &0xffff ; rev = (idcode >>28 ) &0x0f ; dev_type = (prod_id >>16 ) &0x0f ;
@@ -275,6 +272,9 @@ static int __init omap3_check_l2cache(void) {u32 val; +if (class <OMAP3430_REV_ES1_0 ) +return -ENODEV ; +/* Get CP15 AUX register, bit 1 enabled indicates L2 cache is on */ asmvolatile ("mrc p15, 0, %0, c1, c0, 1" :"=r" (val));
@@ -289,3 +289,14 @@ static int __init omap3_check_l2cache(void)arch_initcall (omap3_check_l2cache);#endif /* CONFIG_ARCH_OMAP3 */ + +void __init omap2_set_globals_tap (struct omap_globals *omap2_globals) +{ + class = omap2_globals->class; + tap_base = omap2_globals->tap; + +if (class ==0x3430 ) + tap_prod_id =0x0210 ; +else + tap_prod_id =0x0208 ; +}
arch/arm/plat-omap/common.c +4 -0
@@ -268,6 +268,7 @@ static struct omap_globals *omap2_globals;static void __init __omap2_set_globals (void ) { +omap2_set_globals_tap (omap2_globals);omap2_set_globals_memory (omap2_globals);omap2_set_globals_control (omap2_globals);omap2_set_globals_prcm (omap2_globals);
@@ -279,6 +280,7 @@ static void __init __omap2_set_globals(void)#if defined(CONFIG_ARCH_OMAP2420 )static struct omap_globals omap242x_globals = { + .class =OMAP242X_CLASS , .tap = (__force void __iomem *)OMAP2_IO_ADDRESS (0x48014000 ), .sdrc = (__force void __iomem *)OMAP2_IO_ADDRESS (OMAP2420_SDRC_BASE ), .sms = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_SMS_BASE),
@@ -297,6 +299,7 @@ void __init omap2_set_globals_242x(void)#if defined(CONFIG_ARCH_OMAP2430 )static struct omap_globals omap243x_globals = { + .class =OMAP243X_CLASS , .tap = (__force void __iomem *)OMAP2_IO_ADDRESS (0x4900a000 ), .sdrc = (__force void __iomem *)OMAP2_IO_ADDRESS (OMAP243X_SDRC_BASE ), .sms = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP243X_SMS_BASE),
@@ -315,6 +318,7 @@ void __init omap2_set_globals_243x(void)#if defined(CONFIG_ARCH_OMAP3430 )static struct omap_globals omap343x_globals = { + .class =OMAP343X_CLASS , .tap = (__force void __iomem *)OMAP2_IO_ADDRESS (0x4830A000 ), .sdrc = (__force void __iomem *)OMAP2_IO_ADDRESS (OMAP343X_SDRC_BASE ), .sms = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP343X_SMS_BASE),
include/asm-arm/arch-omap/common.h +2 -0
@@ -50,6 +50,7 @@ static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,/* IO bases for various OMAP processors */ struct omap_globals { +u32 class;/* OMAP class to detect */ void __iomem *tap;/* Control module ID code */ void __iomem *sdrc;/* SDRAM Controller */ void __iomem *sms;/* SDRAM Memory Scheduler */
@@ -63,6 +64,7 @@ void omap2_set_globals_243x(void);void omap2_set_globals_343x (void );/* These get called from omap2_set_globals_xxxx(), do not call these */ +void omap2_set_globals_tap (struct omap_globals *);void omap2_set_globals_memory (struct omap_globals *);void omap2_set_globals_control (struct omap_globals *);void omap2_set_globals_prcm (struct omap_globals *);
include/asm-arm/arch-omap/cpu.h +5 -0
@@ -348,9 +348,14 @@ IS_OMAP_TYPE(3430, 0x3430)get_sil_revision (system_rev) /* Various silicon macros defined here */ +#define OMAP242X_CLASS 0x24200000#define OMAP2420_REV_ES1_0 0x24200000#define OMAP2420_REV_ES2_0 0x24201000 + +#define OMAP243X_CLASS 0x24300000#define OMAP2430_REV_ES1_0 0x24300000 + +#define OMAP343X_CLASS 0x34300000#define OMAP3430_REV_ES1_0 0x34300000#define OMAP3430_REV_ES2_0 0x34301000#define OMAP3430_REV_ES2_1 0x34302000
Signature · 1 line
1.5.3.6
Tony Lindgren
maintainerQuoted 21 lines · Tony Lindgren
Hi all,
Following patches clean up blockers for getting multi-omap closer to working for omap2 like we have for omap1:
- Remove
__REGmacros, use omap_read/write() instead- Split omap24xx sram code so no register rewriting is needed
- Introduce struct
omap_globalsto allow early cpu detection to work- Make PRM and CM registers work for multi-omap
The
__REGpatches were posted earlier, but had some issues. They should be fixed now.The first patch is to test primitive omap type detection with
DEBUG_LL. Could somebody please try it out on 15xx and make sure you get output fromDEBUG_LL?
Quoted 5 lines
Once the
DEBU_LLpatch works on all omaps, we can use the similar detection for multi-omap non-optimizedget_irq_nr_and_basetoo :)These patches are against current linux-omap tree, I pushed few fixes there so you pull before trying out these patches.
I've pushed this series refreshed and in slightly different order. I also left out the DEBUG_LL patch for now.
Regards,
Tony