From: Minkyu Kang Date: Thu, 19 Aug 2010 01:09:19 +0000 (+0900) Subject: s5p: usb: move to usb driver to s5p common X-Git-Tag: JH02_20100820~69 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42638ede0033f37aa5044838fce29a8b6535dcfa;p=kernel%2Fu-boot.git s5p: usb: move to usb driver to s5p common Signed-off-by: Minkyu Kang --- diff --git a/arch/arm/cpu/armv7/s5p-common/Makefile b/arch/arm/cpu/armv7/s5p-common/Makefile index 5d2fbd6..fe81d68 100644 --- a/arch/arm/cpu/armv7/s5p-common/Makefile +++ b/arch/arm/cpu/armv7/s5p-common/Makefile @@ -30,6 +30,7 @@ LIB = $(obj)libs5p-common.a COBJS-y += cpu_info.o COBJS-y += timer.o +COBJS-$(CONFIG_CMD_USBDOWN) += usb-hs-otg.o usb_downloader.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS)) diff --git a/arch/arm/cpu/armv7/s5pc1xx/usb-hs-otg.c b/arch/arm/cpu/armv7/s5p-common/usb-hs-otg.c similarity index 83% rename from arch/arm/cpu/armv7/s5pc1xx/usb-hs-otg.c rename to arch/arm/cpu/armv7/s5p-common/usb-hs-otg.c index 9243dba..0e51b90 100644 --- a/arch/arm/cpu/armv7/s5pc1xx/usb-hs-otg.c +++ b/arch/arm/cpu/armv7/s5p-common/usb-hs-otg.c @@ -293,75 +293,71 @@ static unsigned int otg_base; static inline void s5p_usb_init_base(void) { - if (cpu_is_s5pc110()) { - phy_base = S5PC110_PHY_BASE; - otg_base = S5PC110_OTG_BASE; - } else { - phy_base = S5PC100_PHY_BASE; - otg_base = S5PC100_OTG_BASE; - } + phy_base = samsung_get_base_usb_phy(); + otg_base = samsung_get_base_usb_otg(); } -static inline int s5pc1xx_phy_read_reg(int offset) +static inline int s5p_phy_read_reg(int offset) { return readl(phy_base + offset); } -static inline void s5pc1xx_phy_write_reg(int value, int offset) +static inline void s5p_phy_write_reg(int value, int offset) { writel(value, phy_base + offset); } -static inline int s5pc1xx_otg_read_reg(int offset) +static inline int s5p_otg_read_reg(int offset) { return readl(otg_base + offset); } -static inline void s5pc1xx_otg_write_reg(int value, int offset) +static inline void s5p_otg_write_reg(int value, int offset) { writel(value, otg_base + offset); } static void s5p_usb_init_phy(void) { - if (cpu_is_s5pc110()) { - s5pc1xx_phy_write_reg(0xA0, OTG_PHYPWR); - s5pc1xx_phy_write_reg(0x3, OTG_PHYCTRL); - } else { - s5pc1xx_phy_write_reg(0x0, OTG_PHYPWR); + + if (s5p_cpu_id == 0xc100) { + s5p_phy_write_reg(0x0, OTG_PHYPWR); #ifdef CONFIG_OTG_CLK_OSCC - s5pc1xx_phy_write_reg(0x22, OTG_PHYCTRL); + s5p_phy_write_reg(0x22, OTG_PHYCTRL); #else - s5pc1xx_phy_write_reg(0x2, OTG_PHYCTRL); + s5p_phy_write_reg(0x2, OTG_PHYCTRL); #endif + } else { + s5p_phy_write_reg(0xA0, OTG_PHYPWR); + s5p_phy_write_reg(0x3, OTG_PHYCTRL); } - s5pc1xx_phy_write_reg(0x1, OTG_RSTCON); + s5p_phy_write_reg(0x1, OTG_RSTCON); udelay(20); - s5pc1xx_phy_write_reg(0x0, OTG_RSTCON); + s5p_phy_write_reg(0x0, OTG_RSTCON); udelay(20); } int s5p_usb_detect_irq(void) { u32 status; - status = s5pc1xx_otg_read_reg(OTG_GINTSTS); + status = s5p_otg_read_reg(OTG_GINTSTS); return (status & 0x800c3810); } void s5p_usb_clear_irq(void) { - s5pc1xx_otg_write_reg(0xffffffff, OTG_GINTSTS); + s5p_otg_write_reg(0xffffffff, OTG_GINTSTS); } static void s5p_usb_core_soft_reset(void) { u32 tmp; - s5pc1xx_otg_write_reg(CORE_SOFT_RESET, OTG_GRSTCTL); + s5p_otg_write_reg(CORE_SOFT_RESET, OTG_GRSTCTL); do { - tmp = s5pc1xx_otg_read_reg(OTG_GRSTCTL); + tmp = s5p_otg_read_reg(OTG_GRSTCTL); } while (!(tmp & AHB_MASTER_IDLE)); } @@ -373,7 +369,7 @@ static void s5p_usb_wait_cable_insert(void) do { udelay(50); - tmp = s5pc1xx_otg_read_reg(OTG_GOTGCTL); + tmp = s5p_otg_read_reg(OTG_GOTGCTL); if (tmp & (B_SESSION_VALID | A_SESSION_VALID)) { break; @@ -386,10 +382,10 @@ static void s5p_usb_wait_cable_insert(void) static void s5p_usb_init_core(void) { - s5pc1xx_otg_write_reg(PTXFE_HALF | NPTXFE_HALF | MODE_SLAVE | + s5p_otg_write_reg(PTXFE_HALF | NPTXFE_HALF | MODE_SLAVE | BURST_SINGLE | GBL_INT_UNMASK, OTG_GAHBCFG); - s5pc1xx_otg_write_reg( + s5p_otg_write_reg( 0x0 << 15 /* PHY Low Power Clock sel */ | 0x1 << 14 /* Non-Periodic TxFIFO Rewind Enable */ | 0x5 << 10 /* Turnaround time */ @@ -407,7 +403,7 @@ static void s5p_usb_check_current_mode(u8 *pucMode) { u32 tmp; - tmp = s5pc1xx_otg_read_reg(OTG_GINTSTS); + tmp = s5p_otg_read_reg(OTG_GINTSTS); *pucMode = tmp & 0x1; } @@ -415,19 +411,19 @@ static void s5p_usb_soft_disconnect(int set) { u32 tmp; - tmp = s5pc1xx_otg_read_reg(OTG_DCTL); + tmp = s5p_otg_read_reg(OTG_DCTL); if (set) tmp |= SOFT_DISCONNECT; else tmp &= ~SOFT_DISCONNECT; - s5pc1xx_otg_write_reg(tmp, OTG_DCTL); + s5p_otg_write_reg(tmp, OTG_DCTL); } static void s5p_usb_init_device(void) { - s5pc1xx_otg_write_reg(1 << 18 | otg.speed << 0, OTG_DCFG); + s5p_otg_write_reg(1 << 18 | otg.speed << 0, OTG_DCFG); - s5pc1xx_otg_write_reg(INT_RESUME | INT_OUT_EP | INT_IN_EP | + s5p_otg_write_reg(INT_RESUME | INT_OUT_EP | INT_IN_EP | INT_ENUMDONE | INT_RESET | INT_SUSPEND | INT_RX_FIFO_NOT_EMPTY, OTG_GINTMSK); } @@ -439,15 +435,14 @@ int s5p_usbctl_init(void) s5p_usb_init_base(); - if (cpu_is_s5pc110()) { - reg = readl(S5PC110_USB_PHY_CON); - reg |= (1 << 0); /* USB PHY0 enable */ - writel(reg, S5PC110_USB_PHY_CON); - } else { - reg = readl(S5PC100_OTHERS); - reg |= (1 << 16); /* unmask usb signal */ - writel(reg, S5PC100_OTHERS); - } + reg = readl(s5p_get_usb_power_reg()); + + if (s5p_cpu_id == 0xc100) + reg |= (1 << 16); /* unmask usb signal */ + else + reg |= (1 << 0); /* USB PHY0 enable */ + + writel(reg, s5p_get_usb_power_reg()); otg.speed = speed; otg.set_config = 0; @@ -475,10 +470,10 @@ int s5p_usbctl_init(void) static void s5p_usb_set_inep_xfersize(EP_TYPE type, u32 pktcnt, u32 xfersize) { if (type == EP_TYPE_CONTROL) { - s5pc1xx_otg_write_reg((pktcnt << 19) | (xfersize << 0), + s5p_otg_write_reg((pktcnt << 19) | (xfersize << 0), OTG_DIEPTSIZ0); } else if (type == EP_TYPE_BULK) { - s5pc1xx_otg_write_reg((1 << 29) | (pktcnt << 19) | + s5p_otg_write_reg((1 << 29) | (pktcnt << 19) | (xfersize << 0), OTG_DIEPTSIZ_IN); } } @@ -486,10 +481,10 @@ static void s5p_usb_set_inep_xfersize(EP_TYPE type, u32 pktcnt, u32 xfersize) static void s5p_usb_set_outep_xfersize(EP_TYPE type, u32 pktcnt, u32 xfersize) { if (type == EP_TYPE_CONTROL) { - s5pc1xx_otg_write_reg((1 << 29) | (pktcnt << 19) | + s5p_otg_write_reg((1 << 29) | (pktcnt << 19) | (xfersize << 0), OTG_DOEPTSIZ0); } else if (type == EP_TYPE_BULK) { - s5pc1xx_otg_write_reg((pktcnt << 19) | (xfersize << 0), + s5p_otg_write_reg((pktcnt << 19) | (xfersize << 0), OTG_DOEPTSIZ_OUT); } } @@ -505,7 +500,7 @@ static void s5p_usb_write_ep0_fifo(u8 *buf, int num) ((*(buf + 2)) << 16) | ((*(buf + 1)) << 8) | *buf; - s5pc1xx_otg_write_reg(Wr_Data, OTG_EP0_FIFO); + s5p_otg_write_reg(Wr_Data, OTG_EP0_FIFO); buf += 4; } } @@ -687,7 +682,7 @@ static void s5p_usb_ep0_int_hndlr(void) if (otg.ep0_state == EP0_STATE_INIT) { for (i = 0; i < 2; i++) - buf[i] = s5pc1xx_otg_read_reg(OTG_EP0_FIFO); + buf[i] = s5p_otg_read_reg(OTG_EP0_FIFO); otg.dev_req.bmRequestType = buf[0]; otg.dev_req.bRequest = buf[0] >> 8; @@ -702,7 +697,7 @@ static void s5p_usb_ep0_int_hndlr(void) case STANDARD_SET_ADDRESS: /* Set Address Update bit */ addr = (otg.dev_req.wValue_L); - s5pc1xx_otg_write_reg(1 << 18 | addr << 4 | otg.speed << 0, + s5p_otg_write_reg(1 << 18 | addr << 4 | otg.speed << 0, OTG_DCFG); otg.ep0_state = EP0_STATE_INIT; break; @@ -723,8 +718,8 @@ static void s5p_usb_ep0_int_hndlr(void) s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 1); /*ep0 enable, clear nak, next ep0, 8byte */ - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); - s5pc1xx_otg_write_reg(config_value, OTG_EP0_FIFO); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(config_value, OTG_EP0_FIFO); otg.ep0_state = EP0_STATE_INIT; break; @@ -765,7 +760,7 @@ static void s5p_usb_ep0_int_hndlr(void) s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, otg.ctrl_max_pktsize); /*clear nak, next ep0, 64byte */ - s5pc1xx_otg_write_reg(((1 << 26) | (CONTROL_EP << 11) | (0 << 0)), + s5p_otg_write_reg(((1 << 26) | (CONTROL_EP << 11) | (0 << 0)), OTG_DIEPCTL0); } @@ -774,11 +769,11 @@ static void s5p_usb_set_otherspeed_conf_desc(u32 length) /* Standard device descriptor */ if (length == 9) { s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 9); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *) &config_full, 9); } else if (length == 32) { s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 32); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *) &config_full_total, 32); } otg.ep0_state = EP0_STATE_INIT; @@ -791,12 +786,12 @@ static void s5p_usb_transfer_ep0(void) s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 0); /*ep0 enable, clear nak, next ep0, 8byte */ - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); break; case EP0_STATE_GD_DEV_0: /*ep0 enable, clear nak, next ep0, max 64byte */ - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); if (otg.req_length < DEVICE_DESC_SIZE) { s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, otg.req_length); @@ -812,7 +807,7 @@ static void s5p_usb_transfer_ep0(void) break; case EP0_STATE_GD_DEV_1: - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); if (otg.req_length < (2 * FS_CTRL_PKT_SIZE)) { s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.dev)) + FS_CTRL_PKT_SIZE, @@ -826,7 +821,7 @@ static void s5p_usb_transfer_ep0(void) break; case EP0_STATE_GD_DEV_2: - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); if (otg.req_length < DEVICE_DESC_SIZE) { s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.dev)) + (2 * FS_CTRL_PKT_SIZE), @@ -840,7 +835,7 @@ static void s5p_usb_transfer_ep0(void) break; case EP0_STATE_GD_CFG_0: - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); if (otg.req_length < CONFIG_DESC_TOTAL_SIZE) { s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, otg.req_length); @@ -856,7 +851,7 @@ static void s5p_usb_transfer_ep0(void) break; case EP0_STATE_GD_CFG_1: - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); if (otg.req_length < (2 * FS_CTRL_PKT_SIZE)) { s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.config)) + FS_CTRL_PKT_SIZE, @@ -870,7 +865,7 @@ static void s5p_usb_transfer_ep0(void) break; case EP0_STATE_GD_CFG_2: - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); if (otg.req_length < (3 * FS_CTRL_PKT_SIZE)) { s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.config)) + (2 * FS_CTRL_PKT_SIZE), @@ -884,7 +879,7 @@ static void s5p_usb_transfer_ep0(void) break; case EP0_STATE_GD_CFG_3: - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); if (otg.req_length < (4 * FS_CTRL_PKT_SIZE)) { s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.config)) + (3 * FS_CTRL_PKT_SIZE), @@ -902,7 +897,7 @@ static void s5p_usb_transfer_ep0(void) break; case EP0_STATE_GD_DEV_QUALIFIER: - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); if (otg.req_length < 10) { s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, otg.req_length); @@ -922,12 +917,12 @@ static void s5p_usb_transfer_ep0(void) case EP0_STATE_GD_OTHER_SPEED_HIGH_1: if (otg.req_length == 9) { s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 1); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo(((u8 *) &config_high) + 8, 1); otg.ep0_state = EP0_STATE_INIT; } else { s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 8); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo(((u8 *) &config_high) + 8, 8); otg.ep0_state = EP0_STATE_GD_OTHER_SPEED_HIGH_2; } @@ -935,14 +930,14 @@ static void s5p_usb_transfer_ep0(void) case EP0_STATE_GD_OTHER_SPEED_HIGH_2: s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 8); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo(((u8 *) &config_high) + 16, 8); otg.ep0_state = EP0_STATE_GD_OTHER_SPEED_HIGH_3; break; case EP0_STATE_GD_OTHER_SPEED_HIGH_3: s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 8); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo(((u8 *) &config_high) + 24, 8); otg.ep0_state = EP0_STATE_INIT; break; @@ -951,13 +946,13 @@ static void s5p_usb_transfer_ep0(void) if (otg.req_length < CONFIG_DESC_SIZE) { s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, otg.req_length); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.config)), otg.req_length); } else { s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, CONFIG_DESC_SIZE); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.config)), CONFIG_DESC_SIZE); } @@ -965,7 +960,7 @@ static void s5p_usb_transfer_ep0(void) break; case EP0_STATE_GD_CFG_ONLY_1: - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.config)) + FS_CTRL_PKT_SIZE, CONFIG_DESC_SIZE - FS_CTRL_PKT_SIZE); @@ -976,13 +971,13 @@ static void s5p_usb_transfer_ep0(void) if (otg.req_length < INTERFACE_DESC_SIZE) { s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, otg.req_length); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.intf)), otg.req_length); } else { s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, INTERFACE_DESC_SIZE); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.intf)), INTERFACE_DESC_SIZE); } @@ -990,7 +985,7 @@ static void s5p_usb_transfer_ep0(void) break; case EP0_STATE_GD_IF_ONLY_1: - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.intf)) + FS_CTRL_PKT_SIZE, INTERFACE_DESC_SIZE - FS_CTRL_PKT_SIZE); @@ -998,7 +993,7 @@ static void s5p_usb_transfer_ep0(void) break; case EP0_STATE_GD_EP0_ONLY_0: - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, ENDPOINT_DESC_SIZE); s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.ep1)), ENDPOINT_DESC_SIZE); @@ -1007,7 +1002,7 @@ static void s5p_usb_transfer_ep0(void) case EP0_STATE_GD_EP1_ONLY_0: s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, ENDPOINT_DESC_SIZE); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo(((u8 *) &(otg.desc.ep2)), ENDPOINT_DESC_SIZE); otg.ep0_state = EP0_STATE_INIT; @@ -1015,7 +1010,7 @@ static void s5p_usb_transfer_ep0(void) case EP0_STATE_GD_STR_I0: s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, STRING_DESC0_SIZE); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *)string_desc0, STRING_DESC0_SIZE); otg.ep0_state = EP0_STATE_INIT; break; @@ -1024,7 +1019,7 @@ static void s5p_usb_transfer_ep0(void) s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, sizeof(string_desc1)); if ((otg.ep0_substate * otg.ctrl_max_pktsize + otg.ctrl_max_pktsize) < sizeof(string_desc1)) { - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *)string_desc1 + (otg.ep0_substate * otg.ctrl_max_pktsize), @@ -1032,7 +1027,7 @@ static void s5p_usb_transfer_ep0(void) otg.ep0_state = EP0_STATE_GD_STR_I1; otg.ep0_substate++; } else { - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *)string_desc1 + (otg.ep0_substate * otg.ctrl_max_pktsize), @@ -1047,7 +1042,7 @@ static void s5p_usb_transfer_ep0(void) s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, sizeof(string_desc2)); if ((otg.ep0_substate * otg.ctrl_max_pktsize + otg.ctrl_max_pktsize) < sizeof(string_desc2)) { - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *) string_desc2 + (otg.ep0_substate * otg.ctrl_max_pktsize), @@ -1055,7 +1050,7 @@ static void s5p_usb_transfer_ep0(void) otg.ep0_state = EP0_STATE_GD_STR_I2; otg.ep0_substate++; } else { - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_64, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *) string_desc2 + (otg.ep0_substate * otg.ctrl_max_pktsize), sizeof(string_desc2) - (otg.ep0_substate * @@ -1067,42 +1062,42 @@ static void s5p_usb_transfer_ep0(void) case EP0_STATE_INTERFACE_GET: s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 1); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *) &get_intf, 1); otg.ep0_state = EP0_STATE_INIT; break; case EP0_STATE_GET_STATUS0: s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 1); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *) &get_status, 1); otg.ep0_state = EP0_STATE_INIT; break; case EP0_STATE_GET_STATUS1: s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 1); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *) &get_status + 1, 1); otg.ep0_state = EP0_STATE_INIT; break; case EP0_STATE_GET_STATUS2: s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 1); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *) &get_status + 2, 1); otg.ep0_state = EP0_STATE_INIT; break; case EP0_STATE_GET_STATUS3: s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 1); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *) &get_status + 3, 1); otg.ep0_state = EP0_STATE_INIT; break; case EP0_STATE_GET_STATUS4: s5p_usb_set_inep_xfersize(EP_TYPE_CONTROL, 1, 1); - s5pc1xx_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); + s5p_otg_write_reg(EPEN_CNAK_EP0_8, OTG_DIEPCTL0); s5p_usb_write_ep0_fifo((u8 *) &get_status + 4, 1); otg.ep0_state = EP0_STATE_INIT; break; @@ -1127,20 +1122,20 @@ void s5p_usb_tx(char *tx_data, int tx_size) } /*ep1 enable, clear nak, bulk, usb active, max pkt */ - s5pc1xx_otg_write_reg(1u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | + s5p_otg_write_reg(1u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | otg.bulkin_max_pktsize << 0, OTG_DIEPCTL_IN); s5p_usb_write_in_fifo(otg.up_ptr, otg.up_size); } else if ((otg.op_mode == USB_DMA) && (otg.up_size > 0)) { u32 pktcnt, remainder; - s5pc1xx_otg_write_reg(MODE_DMA | BURST_INCR4 | GBL_INT_UNMASK, + s5p_otg_write_reg(MODE_DMA | BURST_INCR4 | GBL_INT_UNMASK, OTG_GAHBCFG); - s5pc1xx_otg_write_reg(INT_RESUME | INT_OUT_EP | INT_IN_EP | + s5p_otg_write_reg(INT_RESUME | INT_OUT_EP | INT_IN_EP | INT_ENUMDONE | INT_RESET | INT_SUSPEND, OTG_GINTMSK); - s5pc1xx_otg_write_reg((u32) otg.up_ptr, OTG_DIEPDMA_IN); + s5p_otg_write_reg((u32) otg.up_ptr, OTG_DIEPDMA_IN); pktcnt = (u32) (otg.up_size / otg.bulkin_max_pktsize); remainder = (u32) (otg.up_size % otg.bulkin_max_pktsize); @@ -1156,7 +1151,7 @@ void s5p_usb_tx(char *tx_data, int tx_size) } /*ep1 enable, clear nak, bulk, usb active, next ep1, max pkt */ - s5pc1xx_otg_write_reg(1u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | + s5p_otg_write_reg(1u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | BULK_IN_EP << 11 | otg.bulkin_max_pktsize << 0, OTG_DIEPCTL_IN); } @@ -1171,7 +1166,7 @@ static void s5p_usb_int_bulkout(u32 fifo_cnt_byte) otg.bulkout_max_pktsize); /*ep3 enable, clear nak, bulk, usb active, next ep3, max pkt */ - s5pc1xx_otg_write_reg(1u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | + s5p_otg_write_reg(1u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | otg.bulkout_max_pktsize << 0, OTG_DOEPCTL_OUT); if (((u32)otg.dn_ptr - otg.dn_addr) >= (otg.dn_filesize)) @@ -1182,7 +1177,7 @@ static void s5p_usb_dma_in_done(void) { s32 remain_cnt; - otg.up_ptr = (u8 *)s5pc1xx_otg_read_reg(OTG_DIEPDMA_IN); + otg.up_ptr = (u8 *)s5p_otg_read_reg(OTG_DIEPDMA_IN); remain_cnt = otg.up_size - ((u32) otg.up_ptr - otg.up_addr); if (remain_cnt > 0) { @@ -1202,7 +1197,7 @@ static void s5p_usb_dma_in_done(void) } /*ep1 enable, clear nak, bulk, usb active, next ep1, max pkt */ - s5pc1xx_otg_write_reg(1u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | + s5p_otg_write_reg(1u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | BULK_IN_EP << 11 | otg.bulkin_max_pktsize << 0, OTG_DIEPCTL_IN); @@ -1214,7 +1209,7 @@ static void s5p_usb_dma_out_done(void) { s32 remain_cnt; - otg.dn_ptr = (u8 *)s5pc1xx_otg_read_reg(OTG_DOEPDMA_OUT); + otg.dn_ptr = (u8 *)s5p_otg_read_reg(OTG_DOEPDMA_OUT); remain_cnt = otg.dn_filesize - ((u32) otg.dn_ptr - otg.dn_addr + 8); @@ -1235,7 +1230,7 @@ static void s5p_usb_dma_out_done(void) } /*ep3 enable, clear nak, bulk, usb active, next ep3, max pkt 64 */ - s5pc1xx_otg_write_reg(1u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | + s5p_otg_write_reg(1u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | otg.bulkout_max_pktsize << 0, OTG_DOEPCTL_OUT); } else { udelay(500); /*for FPGA ??? */ @@ -1248,12 +1243,12 @@ static void s5p_usb_set_all_outep_nak(int set) u32 tmp; for (i = 0; i < 16; i++) { - tmp = s5pc1xx_otg_read_reg(OTG_DOEPCTL0 + 0x20 * i); + tmp = s5p_otg_read_reg(OTG_DOEPCTL0 + 0x20 * i); if (set) tmp |= DEPCTL_SNAK; else tmp |= (DEPCTL_EPENA | DEPCTL_CNAK); - s5pc1xx_otg_write_reg(tmp, OTG_DOEPCTL0 + 0x20 * i); + s5p_otg_write_reg(tmp, OTG_DOEPCTL0 + 0x20 * i); } } @@ -1268,17 +1263,17 @@ static void s5p_usb_set_max_pktsize(USB_SPEED speed) static void s5p_usb_set_endpoint(void) { /* Unmask OTG_DAINT source */ - s5pc1xx_otg_write_reg(0xff, OTG_DIEPINT0); - s5pc1xx_otg_write_reg(0xff, OTG_DOEPINT0); - s5pc1xx_otg_write_reg(0xff, OTG_DIEPINT_IN); - s5pc1xx_otg_write_reg(0xff, OTG_DOEPINT_OUT); + s5p_otg_write_reg(0xff, OTG_DIEPINT0); + s5p_otg_write_reg(0xff, OTG_DOEPINT0); + s5p_otg_write_reg(0xff, OTG_DIEPINT_IN); + s5p_otg_write_reg(0xff, OTG_DOEPINT_OUT); /* Init For Ep0 */ /*MPS:64bytes */ - s5pc1xx_otg_write_reg(((1 << 26) | (CONTROL_EP << 11) | (0 << 0)), + s5p_otg_write_reg(((1 << 26) | (CONTROL_EP << 11) | (0 << 0)), OTG_DIEPCTL0); /*ep0 enable, clear nak */ - s5pc1xx_otg_write_reg((1u << 31) | (1 << 26) | (0 << 0), + s5p_otg_write_reg((1u << 31) | (1 << 26) | (0 << 0), OTG_DOEPCTL0); } @@ -1372,22 +1367,22 @@ static void s5p_usb_set_opmode(USB_OPMODE mode) { otg.op_mode = mode; - s5pc1xx_otg_write_reg(INT_RESUME | INT_OUT_EP | INT_IN_EP | INT_ENUMDONE | + s5p_otg_write_reg(INT_RESUME | INT_OUT_EP | INT_IN_EP | INT_ENUMDONE | INT_RESET | INT_SUSPEND | INT_RX_FIFO_NOT_EMPTY, OTG_GINTMSK); - s5pc1xx_otg_write_reg(MODE_SLAVE | BURST_SINGLE | GBL_INT_UNMASK, + s5p_otg_write_reg(MODE_SLAVE | BURST_SINGLE | GBL_INT_UNMASK, OTG_GAHBCFG); s5p_usb_set_outep_xfersize(EP_TYPE_BULK, 1, otg.bulkout_max_pktsize); s5p_usb_set_inep_xfersize(EP_TYPE_BULK, 1, 0); /*bulk out ep enable, clear nak, bulk, usb active, next ep3, max pkt */ - s5pc1xx_otg_write_reg(1u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | + s5p_otg_write_reg(1u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | otg.bulkout_max_pktsize << 0, OTG_DOEPCTL_OUT); /*bulk in ep enable, clear nak, bulk, usb active, next ep1, max pkt */ - s5pc1xx_otg_write_reg(0u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | + s5p_otg_write_reg(0u << 31 | 1 << 26 | 2 << 18 | 1 << 15 | otg.bulkin_max_pktsize << 0, OTG_DIEPCTL_IN); } @@ -1396,24 +1391,24 @@ static void s5p_usb_reset(void) s5p_usb_set_all_outep_nak(1); otg.ep0_state = EP0_STATE_INIT; - s5pc1xx_otg_write_reg(((1 << BULK_OUT_EP) | (1 << CONTROL_EP)) << 16 | + s5p_otg_write_reg(((1 << BULK_OUT_EP) | (1 << CONTROL_EP)) << 16 | ((1 << BULK_IN_EP) | (1 << CONTROL_EP)), OTG_DAINTMSK); - s5pc1xx_otg_write_reg(CTRL_OUT_EP_SETUP_PHASE_DONE | AHB_ERROR | + s5p_otg_write_reg(CTRL_OUT_EP_SETUP_PHASE_DONE | AHB_ERROR | TRANSFER_DONE, OTG_DOEPMSK); - s5pc1xx_otg_write_reg(INTKN_TXFEMP | NON_ISO_IN_EP_TIMEOUT | AHB_ERROR | + s5p_otg_write_reg(INTKN_TXFEMP | NON_ISO_IN_EP_TIMEOUT | AHB_ERROR | TRANSFER_DONE, OTG_DIEPMSK); /* Rx FIFO Size */ - s5pc1xx_otg_write_reg(RX_FIFO_SIZE, OTG_GRXFSIZ); + s5p_otg_write_reg(RX_FIFO_SIZE, OTG_GRXFSIZ); /* Non Periodic Tx FIFO Size */ - s5pc1xx_otg_write_reg(NPTX_FIFO_SIZE << 16 | NPTX_FIFO_START_ADDR << 0, + s5p_otg_write_reg(NPTX_FIFO_SIZE << 16 | NPTX_FIFO_START_ADDR << 0, OTG_GNPTXFSIZ); s5p_usb_set_all_outep_nak(0); /*clear device address */ - s5pc1xx_otg_write_reg(s5pc1xx_otg_read_reg(OTG_DCFG) & ~(0x7f << 4), + s5p_otg_write_reg(s5p_otg_read_reg(OTG_DCFG) & ~(0x7f << 4), OTG_DCFG); } @@ -1421,7 +1416,7 @@ static int s5p_usb_set_init(void) { u32 status; - status = s5pc1xx_otg_read_reg(OTG_DSTS); + status = s5p_otg_read_reg(OTG_DSTS); /* Set if Device is High speed or Full speed */ if (((status & 0x6) >> 1) == USB_HIGH) { @@ -1446,7 +1441,7 @@ static void s5p_usb_pkt_receive(void) u32 rx_status; u32 fifo_cnt_byte; - rx_status = s5pc1xx_otg_read_reg(OTG_GRXSTSP); + rx_status = s5p_otg_read_reg(OTG_GRXSTSP); if ((rx_status & (0xf << 17)) == SETUP_PKT_RECEIVED) { s5p_usb_ep0_int_hndlr(); @@ -1456,7 +1451,7 @@ static void s5p_usb_pkt_receive(void) if ((rx_status & BULK_OUT_EP) && (fifo_cnt_byte)) { s5p_usb_int_bulkout(fifo_cnt_byte); if (otg.op_mode == USB_CPU) { - s5pc1xx_otg_write_reg(INT_RESUME | INT_OUT_EP | + s5p_otg_write_reg(INT_RESUME | INT_OUT_EP | INT_IN_EP | INT_ENUMDONE | INT_RESET | INT_SUSPEND | INT_RX_FIFO_NOT_EMPTY, OTG_GINTMSK); @@ -1473,48 +1468,48 @@ static void s5p_usb_transfer(void) u32 check_dma; u32 ep_int_status; - ep_int = s5pc1xx_otg_read_reg(OTG_DAINT); + ep_int = s5p_otg_read_reg(OTG_DAINT); if (ep_int & (1 << CONTROL_EP)) { - ep_int_status = s5pc1xx_otg_read_reg(OTG_DIEPINT0); + ep_int_status = s5p_otg_read_reg(OTG_DIEPINT0); if (ep_int_status & INTKN_TXFEMP) { u32 uNTxFifoSpace; do { - uNTxFifoSpace = s5pc1xx_otg_read_reg(OTG_GNPTXSTS) + uNTxFifoSpace = s5p_otg_read_reg(OTG_GNPTXSTS) & 0xffff; } while (uNTxFifoSpace < otg.ctrl_max_pktsize); s5p_usb_transfer_ep0(); } - s5pc1xx_otg_write_reg(ep_int_status, OTG_DIEPINT0); + s5p_otg_write_reg(ep_int_status, OTG_DIEPINT0); } if (ep_int & ((1 << CONTROL_EP) << 16)) { - ep_int_status = s5pc1xx_otg_read_reg(OTG_DOEPINT0); + ep_int_status = s5p_otg_read_reg(OTG_DOEPINT0); s5p_usb_set_outep_xfersize(EP_TYPE_CONTROL, 1, 8); - s5pc1xx_otg_write_reg(1u << 31 | 1 << 26, OTG_DOEPCTL0); + s5p_otg_write_reg(1u << 31 | 1 << 26, OTG_DOEPCTL0); - s5pc1xx_otg_write_reg(ep_int_status, OTG_DOEPINT0); + s5p_otg_write_reg(ep_int_status, OTG_DOEPINT0); } if (ep_int & (1 << BULK_IN_EP)) { - ep_int_status = s5pc1xx_otg_read_reg(OTG_DIEPINT_IN); + ep_int_status = s5p_otg_read_reg(OTG_DIEPINT_IN); - s5pc1xx_otg_write_reg(ep_int_status, OTG_DIEPINT_IN); - check_dma = s5pc1xx_otg_read_reg(OTG_GAHBCFG); + s5p_otg_write_reg(ep_int_status, OTG_DIEPINT_IN); + check_dma = s5p_otg_read_reg(OTG_GAHBCFG); if ((check_dma & MODE_DMA) && (ep_int_status & TRANSFER_DONE)) s5p_usb_dma_in_done(); } if (ep_int & ((1 << BULK_OUT_EP) << 16)) { - ep_int_status = s5pc1xx_otg_read_reg(OTG_DOEPINT_OUT); + ep_int_status = s5p_otg_read_reg(OTG_DOEPINT_OUT); - s5pc1xx_otg_write_reg(ep_int_status, OTG_DOEPINT_OUT); - check_dma = s5pc1xx_otg_read_reg(OTG_GAHBCFG); + s5p_otg_write_reg(ep_int_status, OTG_DOEPINT_OUT); + check_dma = s5p_otg_read_reg(OTG_GAHBCFG); if ((check_dma & MODE_DMA) && (ep_int_status & TRANSFER_DONE)) s5p_usb_dma_out_done(); @@ -1526,16 +1521,16 @@ void s5p_udc_int_hndlr(void) u32 int_status; int tmp; - int_status = s5pc1xx_otg_read_reg(OTG_GINTSTS); - s5pc1xx_otg_write_reg(int_status, OTG_GINTSTS); + int_status = s5p_otg_read_reg(OTG_GINTSTS); + s5p_otg_write_reg(int_status, OTG_GINTSTS); if (int_status & INT_RESET) { - s5pc1xx_otg_write_reg(INT_RESET, OTG_GINTSTS); + s5p_otg_write_reg(INT_RESET, OTG_GINTSTS); s5p_usb_reset(); } if (int_status & INT_ENUMDONE) { - s5pc1xx_otg_write_reg(INT_ENUMDONE, OTG_GINTSTS); + s5p_otg_write_reg(INT_ENUMDONE, OTG_GINTSTS); tmp = s5p_usb_set_init(); if (tmp == 0) @@ -1543,19 +1538,19 @@ void s5p_udc_int_hndlr(void) } if (int_status & INT_RESUME) - s5pc1xx_otg_write_reg(INT_RESUME, OTG_GINTSTS); + s5p_otg_write_reg(INT_RESUME, OTG_GINTSTS); if (int_status & INT_SUSPEND) - s5pc1xx_otg_write_reg(INT_SUSPEND, OTG_GINTSTS); + s5p_otg_write_reg(INT_SUSPEND, OTG_GINTSTS); if (int_status & INT_RX_FIFO_NOT_EMPTY) { - s5pc1xx_otg_write_reg(INT_RESUME | INT_OUT_EP | INT_IN_EP | + s5p_otg_write_reg(INT_RESUME | INT_OUT_EP | INT_IN_EP | INT_ENUMDONE | INT_RESET | INT_SUSPEND, OTG_GINTMSK); s5p_usb_pkt_receive(); - s5pc1xx_otg_write_reg(INT_RESUME | INT_OUT_EP | INT_IN_EP | + s5p_otg_write_reg(INT_RESUME | INT_OUT_EP | INT_IN_EP | INT_ENUMDONE | INT_RESET | INT_SUSPEND | INT_RX_FIFO_NOT_EMPTY, OTG_GINTMSK); } diff --git a/arch/arm/cpu/armv7/s5pc1xx/usb-hs-otg.h b/arch/arm/cpu/armv7/s5p-common/usb-hs-otg.h similarity index 100% rename from arch/arm/cpu/armv7/s5pc1xx/usb-hs-otg.h rename to arch/arm/cpu/armv7/s5p-common/usb-hs-otg.h diff --git a/arch/arm/cpu/armv7/s5pc1xx/usb_downloader.c b/arch/arm/cpu/armv7/s5p-common/usb_downloader.c similarity index 100% rename from arch/arm/cpu/armv7/s5pc1xx/usb_downloader.c rename to arch/arm/cpu/armv7/s5p-common/usb_downloader.c diff --git a/arch/arm/cpu/armv7/s5pc1xx/Makefile b/arch/arm/cpu/armv7/s5pc1xx/Makefile index 0e37ad8..9097fa1 100644 --- a/arch/arm/cpu/armv7/s5pc1xx/Makefile +++ b/arch/arm/cpu/armv7/s5pc1xx/Makefile @@ -35,7 +35,6 @@ COBJS-y += clock.o COBJS-y += sromc.o COBJS-$(CONFIG_CMD_SLEEP) += sleep.o COBJS-$(CONFIG_CMD_SLEEP) += sleep_asm.o -COBJS-$(CONFIG_CMD_USBDOWN) += usb-hs-otg.o usb_downloader.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS)) diff --git a/arch/arm/include/asm/arch-s5pc1xx/cpu.h b/arch/arm/include/asm/arch-s5pc1xx/cpu.h index 1ccb7fc..27d57a4 100644 --- a/arch/arm/include/asm/arch-s5pc1xx/cpu.h +++ b/arch/arm/include/asm/arch-s5pc1xx/cpu.h @@ -38,6 +38,8 @@ #define S5PC100_PWMTIMER_BASE 0xEA000000 #define S5PC100_WATCHDOG_BASE 0xEA200000 #define S5PC100_UART_BASE 0xEC000000 +#define S5PC100_USBOTG_BASE 0xED200000 +#define S5PC100_USBPHY_BASE 0xED300000 #define S5PC100_MMC_BASE 0xED800000 /* S5PC110 */ @@ -51,6 +53,8 @@ #define S5PC110_UART_BASE 0xE2900000 #define S5PC110_SROMC_BASE 0xE8000000 #define S5PC110_MMC_BASE 0xEB000000 +#define S5PC110_USBOTG_BASE 0xEC000000 +#define S5PC110_USBPHY_BASE 0xEC100000 #define S5PC110_DMC0_BASE 0xF0000000 #define S5PC110_DMC1_BASE 0xF1400000 #define S5PC110_VIC0_BASE 0xF2000000 @@ -96,6 +100,8 @@ SAMSUNG_BASE(mmc, MMC_BASE) SAMSUNG_BASE(sromc, SROMC_BASE) SAMSUNG_BASE(timer, PWMTIMER_BASE) SAMSUNG_BASE(uart, UART_BASE) +SAMSUNG_BASE(usb_phy, USBPHY_BASE) +SAMSUNG_BASE(usb_otg, USBOTG_BASE) extern unsigned int s5p_cpu_rev; diff --git a/arch/arm/include/asm/arch-s5pc1xx/usb-hs-otg.h b/arch/arm/include/asm/arch-s5pc1xx/usb-hs-otg.h index 4df1081..ed51dfa 100644 --- a/arch/arm/include/asm/arch-s5pc1xx/usb-hs-otg.h +++ b/arch/arm/include/asm/arch-s5pc1xx/usb-hs-otg.h @@ -22,15 +22,6 @@ #ifndef __ASM_ARCH_USB_HS_OTG_H_ #define __ASM_ARCH_USB_HS_OTG_H_ -/* - * USB2.0 HS OTG - */ -#define S5PC100_OTG_BASE 0xED200000 -#define S5PC100_PHY_BASE 0xED300000 - -#define S5PC110_OTG_BASE 0xEC000000 -#define S5PC110_PHY_BASE 0xEC100000 - /* Core Global Registers */ #define OTG_GOTGCTL 0x000 #define OTG_GOTGINT 0x004 @@ -85,16 +76,16 @@ #define OTG_DCFG 0x800 #define OTG_DCTL 0x804 #define OTG_DSTS 0x808 -#define OTG_DIEPMSK 0x810 -#define OTG_DOEPMSK 0x814 +#define OTG_DIEPMSK 0x810 +#define OTG_DOEPMSK 0x814 #define OTG_DAINT 0x818 #define OTG_DAINTMSK 0x81C -#define OTG_DTKNQR1 0x820 -#define OTG_DTKNQR2 0x824 +#define OTG_DTKNQR1 0x820 +#define OTG_DTKNQR2 0x824 #define OTG_DVBUSDIS 0x828 #define OTG_DVBUSPULSE 0x82C -#define OTG_DTKNQR3 0x830 -#define OTG_DTKNQR4 0x834 +#define OTG_DTKNQR3 0x830 +#define OTG_DTKNQR4 0x834 /* Device Logical IN Endpoint-Specific Registers */ #define OTG_DIEPCTL0 0x900 @@ -119,4 +110,15 @@ #define OTG_PHYCTRL 0x4 #define OTG_RSTCON 0x8 +/* register for power control on PMU */ +static inline unsigned int s5p_get_usb_power_reg(void) +{ + if (cpu_is_s5pc100()) + return 0xE0108200; + else if (cpu_is_s5pc110()) + return 0xE010E80C; + + return 0; +} + #endif diff --git a/recovery/drivers/usb/s5p_usb_hs_otg.c b/recovery/drivers/usb/s5p_usb_hs_otg.c index 4f77b51..0f26cd4 100644 --- a/recovery/drivers/usb/s5p_usb_hs_otg.c +++ b/recovery/drivers/usb/s5p_usb_hs_otg.c @@ -277,9 +277,8 @@ static unsigned int otg_base; static inline void s5p_usb_init_base(void) { - /* support s5pc110 only */ - phy_base = S5PC110_PHY_BASE; - otg_base = S5PC110_OTG_BASE; + phy_base = samsung_get_base_usb_phy(); + otg_base = samsung_get_base_usb_otg(); } static inline int s5pc1xx_phy_read_reg(int offset)