diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/common/locomo.c | 32 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/collie.c | 23 |
2 files changed, 32 insertions, 23 deletions
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c index 4e0dcaef6eb2..c46dc65ec79a 100644 --- a/arch/arm/common/locomo.c +++ b/arch/arm/common/locomo.c | |||
@@ -814,12 +814,15 @@ static inline struct locomo *locomo_chip_driver(struct locomo_dev *ldev) | |||
814 | return (struct locomo *)dev_get_drvdata(ldev->dev.parent); | 814 | return (struct locomo *)dev_get_drvdata(ldev->dev.parent); |
815 | } | 815 | } |
816 | 816 | ||
817 | void locomo_gpio_set_dir(struct locomo_dev *ldev, unsigned int bits, unsigned int dir) | 817 | void locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir) |
818 | { | 818 | { |
819 | struct locomo *lchip = locomo_chip_driver(ldev); | 819 | struct locomo *lchip = dev_get_drvdata(dev); |
820 | unsigned long flags; | 820 | unsigned long flags; |
821 | unsigned int r; | 821 | unsigned int r; |
822 | 822 | ||
823 | if (!lchip) | ||
824 | return; | ||
825 | |||
823 | spin_lock_irqsave(&lchip->lock, flags); | 826 | spin_lock_irqsave(&lchip->lock, flags); |
824 | 827 | ||
825 | r = locomo_readl(lchip->base + LOCOMO_GPD); | 828 | r = locomo_readl(lchip->base + LOCOMO_GPD); |
@@ -836,12 +839,15 @@ void locomo_gpio_set_dir(struct locomo_dev *ldev, unsigned int bits, unsigned in | |||
836 | spin_unlock_irqrestore(&lchip->lock, flags); | 839 | spin_unlock_irqrestore(&lchip->lock, flags); |
837 | } | 840 | } |
838 | 841 | ||
839 | unsigned int locomo_gpio_read_level(struct locomo_dev *ldev, unsigned int bits) | 842 | int locomo_gpio_read_level(struct device *dev, unsigned int bits) |
840 | { | 843 | { |
841 | struct locomo *lchip = locomo_chip_driver(ldev); | 844 | struct locomo *lchip = dev_get_drvdata(dev); |
842 | unsigned long flags; | 845 | unsigned long flags; |
843 | unsigned int ret; | 846 | unsigned int ret; |
844 | 847 | ||
848 | if (!lchip) | ||
849 | return -ENODEV; | ||
850 | |||
845 | spin_lock_irqsave(&lchip->lock, flags); | 851 | spin_lock_irqsave(&lchip->lock, flags); |
846 | ret = locomo_readl(lchip->base + LOCOMO_GPL); | 852 | ret = locomo_readl(lchip->base + LOCOMO_GPL); |
847 | spin_unlock_irqrestore(&lchip->lock, flags); | 853 | spin_unlock_irqrestore(&lchip->lock, flags); |
@@ -850,12 +856,15 @@ unsigned int locomo_gpio_read_level(struct locomo_dev *ldev, unsigned int bits) | |||
850 | return ret; | 856 | return ret; |
851 | } | 857 | } |
852 | 858 | ||
853 | unsigned int locomo_gpio_read_output(struct locomo_dev *ldev, unsigned int bits) | 859 | int locomo_gpio_read_output(struct device *dev, unsigned int bits) |
854 | { | 860 | { |
855 | struct locomo *lchip = locomo_chip_driver(ldev); | 861 | struct locomo *lchip = dev_get_drvdata(dev); |
856 | unsigned long flags; | 862 | unsigned long flags; |
857 | unsigned int ret; | 863 | unsigned int ret; |
858 | 864 | ||
865 | if (!lchip) | ||
866 | return -ENODEV; | ||
867 | |||
859 | spin_lock_irqsave(&lchip->lock, flags); | 868 | spin_lock_irqsave(&lchip->lock, flags); |
860 | ret = locomo_readl(lchip->base + LOCOMO_GPO); | 869 | ret = locomo_readl(lchip->base + LOCOMO_GPO); |
861 | spin_unlock_irqrestore(&lchip->lock, flags); | 870 | spin_unlock_irqrestore(&lchip->lock, flags); |
@@ -864,12 +873,15 @@ unsigned int locomo_gpio_read_output(struct locomo_dev *ldev, unsigned int bits) | |||
864 | return ret; | 873 | return ret; |
865 | } | 874 | } |
866 | 875 | ||
867 | void locomo_gpio_write(struct locomo_dev *ldev, unsigned int bits, unsigned int set) | 876 | void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set) |
868 | { | 877 | { |
869 | struct locomo *lchip = locomo_chip_driver(ldev); | 878 | struct locomo *lchip = dev_get_drvdata(dev); |
870 | unsigned long flags; | 879 | unsigned long flags; |
871 | unsigned int r; | 880 | unsigned int r; |
872 | 881 | ||
882 | if (!lchip) | ||
883 | return; | ||
884 | |||
873 | spin_lock_irqsave(&lchip->lock, flags); | 885 | spin_lock_irqsave(&lchip->lock, flags); |
874 | 886 | ||
875 | r = locomo_readl(lchip->base + LOCOMO_GPO); | 887 | r = locomo_readl(lchip->base + LOCOMO_GPO); |
@@ -1058,9 +1070,9 @@ void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf) | |||
1058 | struct locomo *lchip = locomo_chip_driver(dev); | 1070 | struct locomo *lchip = locomo_chip_driver(dev); |
1059 | 1071 | ||
1060 | if (vr) | 1072 | if (vr) |
1061 | locomo_gpio_write(dev, LOCOMO_GPIO_FL_VR, 1); | 1073 | locomo_gpio_write(dev->dev.parent, LOCOMO_GPIO_FL_VR, 1); |
1062 | else | 1074 | else |
1063 | locomo_gpio_write(dev, LOCOMO_GPIO_FL_VR, 0); | 1075 | locomo_gpio_write(dev->dev.parent, LOCOMO_GPIO_FL_VR, 0); |
1064 | 1076 | ||
1065 | spin_lock_irqsave(&lchip->lock, flags); | 1077 | spin_lock_irqsave(&lchip->lock, flags); |
1066 | locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS); | 1078 | locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS); |
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index a0dfa390e34b..6496eb645cee 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
@@ -91,30 +91,29 @@ static struct mcp_plat_data collie_mcp_data = { | |||
91 | /* | 91 | /* |
92 | * low-level UART features. | 92 | * low-level UART features. |
93 | */ | 93 | */ |
94 | static struct locomo_dev *uart_dev = NULL; | 94 | struct platform_device collie_locomo_device; |
95 | 95 | ||
96 | static void collie_uart_set_mctrl(struct uart_port *port, u_int mctrl) | 96 | static void collie_uart_set_mctrl(struct uart_port *port, u_int mctrl) |
97 | { | 97 | { |
98 | if (!uart_dev) return; | ||
99 | |||
100 | if (mctrl & TIOCM_RTS) | 98 | if (mctrl & TIOCM_RTS) |
101 | locomo_gpio_write(uart_dev, LOCOMO_GPIO_RTS, 0); | 99 | locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_RTS, 0); |
102 | else | 100 | else |
103 | locomo_gpio_write(uart_dev, LOCOMO_GPIO_RTS, 1); | 101 | locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_RTS, 1); |
104 | 102 | ||
105 | if (mctrl & TIOCM_DTR) | 103 | if (mctrl & TIOCM_DTR) |
106 | locomo_gpio_write(uart_dev, LOCOMO_GPIO_DTR, 0); | 104 | locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_DTR, 0); |
107 | else | 105 | else |
108 | locomo_gpio_write(uart_dev, LOCOMO_GPIO_DTR, 1); | 106 | locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_DTR, 1); |
109 | } | 107 | } |
110 | 108 | ||
111 | static u_int collie_uart_get_mctrl(struct uart_port *port) | 109 | static u_int collie_uart_get_mctrl(struct uart_port *port) |
112 | { | 110 | { |
113 | int ret = TIOCM_CD; | 111 | int ret = TIOCM_CD; |
114 | unsigned int r; | 112 | unsigned int r; |
115 | if (!uart_dev) return ret; | ||
116 | 113 | ||
117 | r = locomo_gpio_read_output(uart_dev, LOCOMO_GPIO_CTS & LOCOMO_GPIO_DSR); | 114 | r = locomo_gpio_read_output(&collie_locomo_device.dev, LOCOMO_GPIO_CTS & LOCOMO_GPIO_DSR); |
115 | if (r == -ENODEV) | ||
116 | return ret; | ||
118 | if (r & LOCOMO_GPIO_CTS) | 117 | if (r & LOCOMO_GPIO_CTS) |
119 | ret |= TIOCM_CTS; | 118 | ret |= TIOCM_CTS; |
120 | if (r & LOCOMO_GPIO_DSR) | 119 | if (r & LOCOMO_GPIO_DSR) |
@@ -130,13 +129,11 @@ static struct sa1100_port_fns collie_port_fns __initdata = { | |||
130 | 129 | ||
131 | static int collie_uart_probe(struct locomo_dev *dev) | 130 | static int collie_uart_probe(struct locomo_dev *dev) |
132 | { | 131 | { |
133 | uart_dev = dev; | ||
134 | return 0; | 132 | return 0; |
135 | } | 133 | } |
136 | 134 | ||
137 | static int collie_uart_remove(struct locomo_dev *dev) | 135 | static int collie_uart_remove(struct locomo_dev *dev) |
138 | { | 136 | { |
139 | uart_dev = NULL; | ||
140 | return 0; | 137 | return 0; |
141 | } | 138 | } |
142 | 139 | ||
@@ -170,7 +167,7 @@ static struct resource locomo_resources[] = { | |||
170 | }, | 167 | }, |
171 | }; | 168 | }; |
172 | 169 | ||
173 | static struct platform_device locomo_device = { | 170 | struct platform_device collie_locomo_device = { |
174 | .name = "locomo", | 171 | .name = "locomo", |
175 | .id = 0, | 172 | .id = 0, |
176 | .num_resources = ARRAY_SIZE(locomo_resources), | 173 | .num_resources = ARRAY_SIZE(locomo_resources), |
@@ -178,7 +175,7 @@ static struct platform_device locomo_device = { | |||
178 | }; | 175 | }; |
179 | 176 | ||
180 | static struct platform_device *devices[] __initdata = { | 177 | static struct platform_device *devices[] __initdata = { |
181 | &locomo_device, | 178 | &collie_locomo_device, |
182 | &colliescoop_device, | 179 | &colliescoop_device, |
183 | }; | 180 | }; |
184 | 181 | ||