mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 07:45:16 +08:00
USB Device Mode Driver Support for RX65N
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
834e584169
commit
c6b51771f0
@@ -610,6 +610,21 @@ config RX65N_RIIC2_RCV_IN_BYTE_UNITS
|
||||
depends on !RX65N_RIIC2_RCV_CONTINUOUS
|
||||
|
||||
endif #RX65N_RIIC2
|
||||
|
||||
config RX65N_USBDEV
|
||||
bool "USB0 Device"
|
||||
default n
|
||||
depends on USBDEV
|
||||
|
||||
if RX65N_USBDEV
|
||||
|
||||
config RX65N_TEST_INTEP
|
||||
bool "Testing RX65N Interrupt endpoint"
|
||||
default n
|
||||
depends on SERIAL_IFLOWCONTROL && CDCACM_IFLOWCONTROL
|
||||
|
||||
endif #RX65N_USBDEV
|
||||
|
||||
endmenu # RX65N Peripheral Selections
|
||||
endif
|
||||
|
||||
|
||||
@@ -58,6 +58,11 @@ endif
|
||||
ifeq ($(CONFIG_RTC_DRIVER),y)
|
||||
CHIP_CSRCS += rx65n_rtc_lowerhalf.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USBDEV),y)
|
||||
CHIP_CSRCS += rx65n_usbdev.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_I2C),y)
|
||||
CHIP_CSRCS += rx65n_riic.c
|
||||
endif
|
||||
@@ -289,10 +289,10 @@ void r_cgc_create(void)
|
||||
while (0 != SYSTEM.OSCOVFSR.BIT.SOOVF);
|
||||
}
|
||||
|
||||
SYSTEM.PLLCR.BIT.PLIDIV = 0;
|
||||
SYSTEM.PLLCR.BIT.PLLSRCSEL = 0;
|
||||
SYSTEM.PLLCR.BIT.STC = (20 * 2) - 1;
|
||||
SYSTEM.PLLCR2.BYTE = 0x00;
|
||||
SYSTEM.PLLCR.WORD = _0000_CGC_PLL_FREQ_DIV_1 |
|
||||
_0000_CGC_PLL_SOURCE_MAIN |
|
||||
_2700_CGC_PLL_FREQ_MUL_20_0;
|
||||
SYSTEM.PLLCR2.BYTE = 0x00;
|
||||
while (0 == SYSTEM.OSCOVFSR.BIT.PLOVF);
|
||||
SYSTEM.ROMWT.BYTE = 0x02;
|
||||
if (0x02 == SYSTEM.ROMWT.BYTE)
|
||||
@@ -300,9 +300,20 @@ void r_cgc_create(void)
|
||||
__asm("nop");
|
||||
}
|
||||
|
||||
SYSTEM.SCKCR.LONG = 0x21c11222;
|
||||
SYSTEM.SCKCR2.WORD = 0x0011;
|
||||
SYSTEM.SCKCR3.WORD = 4u << 8; /* BSP_CFG_CLOCK_SOURCE */
|
||||
SYSTEM.SCKCR.LONG = _00000002_CGC_PCLKD_DIV_4 | _00000020_CGC_PCLKC_DIV_4 |
|
||||
_00000200_CGC_PCLKB_DIV_4 |
|
||||
_00001000_CGC_PCLKA_DIV_2 |
|
||||
_00010000_CGC_BCLK_DIV_2 |
|
||||
_00C00000_CGC_PSTOP0_PSTOP1 |
|
||||
_01000000_CGC_ICLK_DIV_2 |
|
||||
_20000000_CGC_FCLK_DIV_4;
|
||||
|
||||
#if defined(CONFIG_USBHOST) || defined(CONFIG_USBDEV)
|
||||
SYSTEM.SCKCR2.WORD = _0040_CGC_UCLK_DIV_5 | _0001_SCKCR2_BIT0;
|
||||
#else
|
||||
SYSTEM.SCKCR2.WORD = _0010_CGC_UCLK_DIV_1 | _0001_SCKCR2_BIT0;
|
||||
#endif
|
||||
SYSTEM.SCKCR3.WORD = _0400_CGC_CLOCKSOURCE_PLL; /* BSP_CFG_CLOCK_SOURCE */
|
||||
|
||||
SYSTEM.LOCOCR.BYTE = 0x01;
|
||||
#else
|
||||
|
||||
@@ -77,6 +77,8 @@
|
||||
#define _00050000_CGC_BCLK_DIV_32 (0x00050000ul) /* x1/32 */
|
||||
#define _00060000_CGC_BCLK_DIV_64 (0x00060000ul) /* x1/64 */
|
||||
|
||||
#define _00C00000_CGC_PSTOP0_PSTOP1 (0x00c00000)
|
||||
|
||||
/* System Clock (ICLK) */
|
||||
|
||||
#define _00000000_CGC_ICLK_DIV_1 (0x00000000ul) /* x1 */
|
||||
@@ -260,6 +262,8 @@
|
||||
#define _0E_CGC_PRIORITY_LEVEL14 (0x0eu) /* Level 14 */
|
||||
#define _0F_CGC_PRIORITY_LEVEL15 (0x0fu) /* Level 15 (highest) */
|
||||
|
||||
#define _0001_CGC_LOCO_STOP (0x1)
|
||||
|
||||
/* Main clock oscillator wait time */
|
||||
|
||||
#define _5C_CGC_MOSCWTCR_VALUE (0x5cu)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -849,9 +849,9 @@ void up_enable_irq(int irq)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RX65N_PERIB
|
||||
if (irq == RX65N_INTB176_IRQ)
|
||||
if (irq == RX65N_INTB185_IRQ)
|
||||
{
|
||||
ICU.IER[16].BIT.IEN0 = 1;
|
||||
ICU.IER[0x17].BIT.IEN1 = 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -42,6 +42,9 @@ void r_port_create(void)
|
||||
{
|
||||
led_port_create();
|
||||
sci_port_create();
|
||||
#ifdef CONFIG_USBDEV
|
||||
r_usbdev_port_enable();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RX65N_EMAC0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,94 @@
|
||||
/****************************************************************************
|
||||
* arch/renesas/src/rx65n/rx65n_usbdev.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_RENESAS_SRC_RX65N_USBDEV_H
|
||||
#define __ARCH_RENESAS_SRC_RX65N_USBDEV_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <nuttx/config.h>
|
||||
#include "rx65n_definitions.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define CDC_CLASS_DATA_LENGTH (7)
|
||||
#define RW_DATA_LEN (1)
|
||||
#define BULK_IN_PIPE (1)
|
||||
#define INT_IN_PIPE (6)
|
||||
#define INT_OUT_PIPE (7)
|
||||
#define BULK_OUT_PIPE (2)
|
||||
|
||||
/* The below endpoint numbers are assigned by
|
||||
* NuttX Class Driver, during endpoint
|
||||
* initialization.
|
||||
*
|
||||
*/
|
||||
|
||||
#define BULK_IN_EPNUM (2)
|
||||
#define INT_IN_EPNUM (1)
|
||||
#define BULK_OUT_EPNUM (3)
|
||||
#define INT_OUT_EPNUM (4)
|
||||
|
||||
/* USB_BMREQUESTTYPERECIP 0x001Fu(b4-0) */
|
||||
#define USB_DEVICE (0x0000u)
|
||||
#define USB_INTERFACE (0x0001u)
|
||||
#define USB_ENDPOINT (0x0002u)
|
||||
#define USB_OTHER (0x0003u)
|
||||
|
||||
#define USB_DEV_REMOTE_WAKEUP (0x0001u)
|
||||
#define USB_TEST_MODE (0x0002u)
|
||||
#define USB_TEST_RESERVED (0x4000u) /* Reserved */
|
||||
#define USB_TEST_VSTMODES (0xC000u) /* VendorSpecific test modes */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* #if defined(CONFIG_USBHOST) && defined(RX65N_NUSBHOST) > 0 */
|
||||
@@ -11,35 +11,10 @@ Contents
|
||||
- Serial Console
|
||||
- LEDs
|
||||
- Networking
|
||||
- IPv6 Integration
|
||||
- HTTP Server Integration on IPv4
|
||||
- DHCP Client Integration on IPv4
|
||||
- DHCP Server Integration on IPv4
|
||||
- FTP Server Integration on IPv4
|
||||
- FTP Client Integration on IPv4
|
||||
- TFTP Client Integration on IPv4
|
||||
- Telnet Server Integration on IPv4
|
||||
- Telnet Client Integration on IPv4
|
||||
- Ustream Socket Integration on IPv4
|
||||
- Udgram Socket Integration on IPv4
|
||||
- SMTP Client Integration on IPv4
|
||||
- Raw Socket Integration
|
||||
- Custom User Socket Integration
|
||||
- IGMPv2 Integration
|
||||
- Inherit telnet server Integration
|
||||
- VNC Server Integration
|
||||
- PPPD Integration
|
||||
- HTTP Client Integration
|
||||
- NTP Client Integration
|
||||
- NFS Client Integration
|
||||
- MLD Integration
|
||||
- ICMPv6 AutoConfig Integration
|
||||
- IP Forwarding Integration for IPv4
|
||||
- DNS Name Resolution Integration for IPv4
|
||||
- LINK MONITOR Integration
|
||||
- Contents
|
||||
- RTC
|
||||
- File Systems
|
||||
- Standby RAM
|
||||
- USB Device
|
||||
- Debugging
|
||||
- Debugging
|
||||
|
||||
Board Features
|
||||
@@ -61,12 +36,6 @@ See the RX65N GRROSE website for further information about this board:
|
||||
|
||||
- http://gadget.renesas.com/en/product/rose.html
|
||||
|
||||
Status/Open Issues
|
||||
==================
|
||||
Ethernet
|
||||
---------
|
||||
|
||||
|
||||
Serial Console
|
||||
==============
|
||||
RX65N GRROSE supports 12 serial ports (SCI0 - SCI12), however only 5 ports can be tested(SCI0, SCI1, SCI2,
|
||||
@@ -262,6 +231,26 @@ The following configurations are to be enabled as part of testing RTC examples.
|
||||
CONFIG_EXAMPLES_ALARM
|
||||
CONFIG_EXAMPLES_PERIODIC
|
||||
CONFIG_EXAMPLES_CARRY
|
||||
|
||||
USB Device Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for USB Device
|
||||
|
||||
CONFIG_USBDEV
|
||||
CONFIG_CDCACM
|
||||
CONFIG_STDIO_BUFFER_SIZE=64
|
||||
CONFIG_STDIO_LINEBUFFER
|
||||
|
||||
USB Device Testing
|
||||
------------------------
|
||||
The following testing is executed as part of USB Device testing on RX65N target for GRROSE board
|
||||
|
||||
echo "This is a test for USB Device" > /dev/ttyACM0
|
||||
|
||||
xd 0 0x20000 > /dev/ttyACM0
|
||||
|
||||
The output of the commands mentioned above should be seen on the USB Device COM port on teraterm
|
||||
|
||||
Debugging
|
||||
==========
|
||||
|
||||
@@ -295,8 +284,3 @@ endif
|
||||
Select Motorola SREC format.
|
||||
4. Download Renesas flash programmer tool from https://www.renesas.com/in/en/products/software-tools/tools/programmer/renesas-flash-programmer-programming-gui.html#downloads
|
||||
5. Refer to the user manual document, for steps to flash NuttX binary using RFP tool.
|
||||
Changes Made in NuttX 8.2 Code
|
||||
================================
|
||||
1. In wd_start.c file, in function wd_expiration(), typecasting is done when the signal handler nxsig_timeout() is invoked.
|
||||
2. In rtc.c, (drivers/timers/rtc.c) file, in function rtc_periodic_callback(), alarminfo->active = false is commented.
|
||||
The reason being, periodic interrupt should not be disabled. Uncommenting the above mentioned line (alarminfo->active = false), will make the periodic interrupt come only once.
|
||||
|
||||
@@ -103,6 +103,24 @@ void led_port_create(void);
|
||||
void r_ether_pheriperal_enable(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_usbdev_port_enable
|
||||
*
|
||||
* Description:
|
||||
* USB device port settings
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
void r_usbdev_port_enable(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci0_init_port
|
||||
*
|
||||
|
||||
@@ -43,6 +43,10 @@
|
||||
# include "rx65n_rtc.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CDCACM
|
||||
# include <nuttx/usb/cdcacm.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RIIC_DRIVER
|
||||
# include <nuttx/i2c/i2c_master.h>
|
||||
# include "rx65n_riic.h"
|
||||
@@ -136,6 +140,19 @@ int rx65n_bringup(void)
|
||||
|
||||
(void)rx65n_sbram_int();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CDCACM) && !defined(CONFIG_CDCACM_CONSOLE)
|
||||
/* Initialize CDCACM */
|
||||
|
||||
syslog(LOG_INFO, "Initialize CDCACM device\n");
|
||||
|
||||
ret = cdcacm_initialize(0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: cdcacm_initialize failed: %d\n", ret);
|
||||
}
|
||||
#endif /* CONFIG_CDCACM & !CONFIG_CDCACM_CONSOLE */
|
||||
|
||||
#ifdef HAVE_RIIC_DRIVER
|
||||
FAR struct i2c_master_s *i2c;
|
||||
|
||||
|
||||
@@ -161,6 +161,23 @@ void r_ether_pheriperal_enable(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_usbdev_port_enable
|
||||
*
|
||||
* Description:
|
||||
* USB Device enabling
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
void r_usbdev_port_enable(void)
|
||||
{
|
||||
/* Set USB0_VBUS pin */
|
||||
|
||||
MPC.P16PFS.BYTE = 0x11;
|
||||
PORT1.PMR.BIT.B6 = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci0_init_port
|
||||
*
|
||||
|
||||
@@ -11,35 +11,8 @@ Contents
|
||||
- Serial Console
|
||||
- LEDs
|
||||
- Networking
|
||||
- IPv6 Integration
|
||||
- HTTP Server Integration on IPv4
|
||||
- DHCP Client Integration on IPv4
|
||||
- DHCP Server Integration on IPv4
|
||||
- FTP Server Integration on IPv4
|
||||
- FTP Client Integration on IPv4
|
||||
- TFTP Client Integration on IPv4
|
||||
- Telnet Server Integration on IPv4
|
||||
- Telnet Client Integration on IPv4
|
||||
- Ustream Socket Integration on IPv4
|
||||
- Udgram Socket Integration on IPv4
|
||||
- SMTP Client Integration on IPv4
|
||||
- Raw Socket Integration
|
||||
- Custom User Socket Integration
|
||||
- IGMPv2 Integration
|
||||
- Inherit telnet server Integration
|
||||
- VNC Server Integration
|
||||
- PPPD Integration
|
||||
- HTTP Client Integration
|
||||
- NTP Client Integration
|
||||
- NFS Client Integration
|
||||
- MLD Integration
|
||||
- ICMPv6 AutoConfig Integration
|
||||
- IP Forwarding Integration for IPv4
|
||||
- DNS Name Resolution Integration for IPv4
|
||||
- LINK MONITOR Integration
|
||||
- RTC
|
||||
- Standby RAM
|
||||
- File Systems
|
||||
- USB Device
|
||||
- Debugging
|
||||
|
||||
Board Features
|
||||
@@ -59,14 +32,6 @@ See the RX65N RSK2MB website for further information about this board:
|
||||
|
||||
- https://www.renesas.com/br/en/products/software-tools/boards-and-kits/starter-kits/renesas-starter-kitplus-for-rx65n-2mb.html
|
||||
|
||||
Status/Open Issues
|
||||
==================
|
||||
Ethernet
|
||||
---------
|
||||
1.Observed instability in Link Management, due to difference in hardware design.(No Separate Interrupt line for PHY)
|
||||
2.Currently tested only ping and udpblaster application.
|
||||
3. Executed long run ping and udpblaster stress test for 12 hrs. Code is able to execute for 12hrs without any breakage.
|
||||
|
||||
Serial Console
|
||||
==============
|
||||
RX65N RSK2MB supports 12 serial ports (SCI0 - SCI12), however only 1 port can be tested(SCI8, which is the serial console). Only SCI8 port can be tested which is connected to USB Serial port.
|
||||
@@ -146,6 +111,15 @@ Ethernet Connections
|
||||
P71 ET0_MDIO
|
||||
P54 ET0_LINKSTA
|
||||
------ ---------
|
||||
|
||||
USB Device
|
||||
-----------
|
||||
|
||||
For the RX65N RSK2MB board, to be used as USB Device, the following Jumper settings need to be done
|
||||
|
||||
J7 Short Pin 2 & Pin 3
|
||||
J16 Short Pin 1 & Pin 2
|
||||
|
||||
NuttX Configurations
|
||||
--------------------
|
||||
The following configurations, need to be enabled for network.
|
||||
@@ -223,6 +197,25 @@ CONFIG_EXAMPLES_ALARM
|
||||
CONFIG_EXAMPLES_PERIODIC
|
||||
CONFIG_EXAMPLES_CARRY
|
||||
|
||||
USB Device Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for USB Device
|
||||
|
||||
CONFIG_USBDEV
|
||||
CONFIG_CDCACM
|
||||
CONFIG_STDIO_BUFFER_SIZE=64
|
||||
CONFIG_STDIO_LINEBUFFER
|
||||
|
||||
USB Device Testing
|
||||
------------------------
|
||||
The following testing is executed as part of USB Device testing on RX65N target for GRROSE board
|
||||
|
||||
echo "This is a test for USB Device" > /dev/ttyACM0
|
||||
|
||||
xd 0 0x20000 > /dev/ttyACM0
|
||||
|
||||
The output of the commands mentioned above should be seen on the USB Device COM port on teraterm
|
||||
|
||||
Debugging
|
||||
==========
|
||||
1. NuttX needs to be compiled in Cygwin environment on Windows.
|
||||
|
||||
@@ -103,6 +103,24 @@ void led_port_create(void);
|
||||
void r_ether_pheriperal_enable(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_usbdev_port_enable
|
||||
*
|
||||
* Description:
|
||||
* USB device port settings
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
void r_usbdev_port_enable(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci1_init_port
|
||||
*
|
||||
|
||||
@@ -43,6 +43,10 @@
|
||||
# include "rx65n_rtc.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CDCACM
|
||||
# include <nuttx/usb/cdcacm.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RIIC_DRIVER
|
||||
# include <nuttx/i2c/i2c_master.h>
|
||||
# include "rx65n_riic.h"
|
||||
@@ -136,6 +140,19 @@ int rx65n_bringup(void)
|
||||
|
||||
(void)rx65n_sbram_int();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CDCACM) && !defined(CONFIG_CDCACM_CONSOLE)
|
||||
/* Initialize CDCACM */
|
||||
|
||||
syslog(LOG_INFO, "Initialize CDCACM device\n");
|
||||
|
||||
ret = cdcacm_initialize(0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: cdcacm_initialize failed: %d\n", ret);
|
||||
}
|
||||
#endif /* CONFIG_CDCACM & !CONFIG_CDCACM_CONSOLE */
|
||||
|
||||
#ifdef HAVE_RIIC_DRIVER
|
||||
FAR struct i2c_master_s *i2c;
|
||||
|
||||
|
||||
@@ -197,6 +197,23 @@ void r_ether_pheriperal_enable(void)
|
||||
MPC.P34PFS.BYTE = 0x11u;
|
||||
PORT3.PMR.BIT.B4 = 1u;
|
||||
}
|
||||
|
||||
#endif
|
||||
/****************************************************************************
|
||||
* Name: r_usbdev_port_enable
|
||||
*
|
||||
* Description:
|
||||
* USB Device enabling
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
void r_usbdev_port_enable(void)
|
||||
{
|
||||
/* Set USB0_VBUS pin */
|
||||
|
||||
MPC.P16PFS.BYTE = 0x11;
|
||||
PORT1.PMR.BIT.B6 = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user