Thread (16 messages) flat view 16 messages, 6 authors, 2008-01-18

Re: [PATCH 2/3] add MPC837x USB platform support

From: Stephen Rothwell <hidden>
Date: 2008-01-07 23:05:16

Hi,

Just a couple of comments.

On Mon,  7 Jan 2008 20:03:19 +0800 Li Yang [off-list ref] wrote:
+static int mpc837xmds_usb_cfg(void)
+{

+	np = of_find_node_by_name(NULL, "usb");
+	phy_type = of_get_property(np, "phy_type", NULL);
No check for np being NULL
+	if (phy_type && !strcmp(phy_type, "ulpi")) {
+		clrbits8(bcsr_regs + 12, BCSR12_USB_SER_PIN);
+	} else if (phy_type && !strcmp(phy_type, "serial")) {
+		mode = of_get_property(np, "dr_mode", NULL);
+		bcsr12 = in_8(bcsr_regs + 12) & ~BCSR12_USB_SER_MASK;
+		bcsr12 |= BCSR12_USB_SER_PIN;
+		if (mode && !strcmp(mode, "peripheral"))
+			bcsr12 |= BCSR12_USB_SER_DEVICE;
+		out_8(bcsr_regs + 12, bcsr12);
+	} else {
+		printk(KERN_ERR "USB DR: unsupported PHY\n");
+	}
+
+	iounmap(bcsr_regs);
+	return 0;
No of_node_put(np)
+#ifdef CONFIG_PPC_MPC837x
+int mpc837x_usb_cfg(void)
+{

+	np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr");
+	if (!np)
+		return -ENODEV;
+	prop = of_get_property(np, "phy_type", NULL);
+
+	if (strcmp(prop, "ulpi") && strcmp(prop, "serial")) {
No check for prop being NULL.
+		printk(KERN_WARNING "837x USB PHY type not supported\n");
+		return -EINVAL;
No of_node_put(np)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help